Contract Address Details

Contract
0x0000000000000000000000000000000000001002
Balance
0.0 @G ($0.0)
Tokens
0 Tokens
$0.0 USD
Transactions
Gas Used
0
Contract Source Code Verified
Contract NameFilterContract
Compiler Versionv0.8.19+commit.7dd6d404
Optimization EnabledYes
Other SettingsDefault evmVersion
Contract Source Code (Solidity)
1
// SPDX-License-Identifier: MIT
2
 
3
pragma solidity ^0.8.6;
4
 
5
interface IKYCContract {
6
function level(address addr) external view returns (uint);
7
}
8
 
9
/**
10
* @title FilterContract
11
* @notice Graphite system contract that interacts with the KYC contract to manage user-specific filter levels
12
* and verify permissions based on KYC levels.
13
*/
14
contract FilterContract {
15
 
16
/**
17
* @notice Mapping to store the filter level of each user.
18
* @dev This determines the minimum KYC level required by others to interact with the user.
19
*/
20
mapping(address => uint) filterLevel;
21
 
22
// External KYC contract used for checking KYC levels.
23
IKYCContract public kycContract;
24
 
25
/**
26
* @notice Emitted when a user's filter level is updated.
27
* @param user The address of the user whose filter level was updated.
28
* @param level The new filter level for the user.
29
*/
30
event FilterLevelChanged(address indexed user, uint indexed level);
31
 
32
/**
33
* @notice Updates the caller's filter level.
34
* @dev This allows a user to set the minimum KYC level required by others to interact with them.
35
* @param _level The new filter level to set for the caller.
36
*/
37
function setFilterLevel(uint _level) external {
38
filterLevel[msg.sender] = _level;
39
emit FilterLevelChanged(msg.sender, _level);
40
}
41
 
42
/**
43
* @notice Retrieves the caller's current filter level.
44
* @dev Useful for users to query their own filter settings.
45
* returns The filter level of the caller.
46
*/
47
function viewFilterLevel() external view returns(uint){
48
return(filterLevel[msg.sender]);
49
}
50
 
51
/**
52
* @notice Checks if the KYC level of the sender meets the filter level of the destination address.
53
* @dev This function compares the sender's KYC level with the required filter level of the destination.
54
* @param _sender The address of the user initiating the interaction.
55
* @param _destination The address of the user receiving the interaction.
56
* @return `true` if the `_sender`'s KYC level is greater than or equal to `_destination`'s filter level, otherwise `false`.
57
*/
58
function filter(address _sender, address _destination) external view returns(bool) {
59
return(kycContract.level(_sender) >= filterLevel[_destination]);
60
}
61
}
62
 
Contract ABI
[{"name": "FilterLevelChanged", "type": "event", "inputs": [{"name": "user", "type": "address", "indexed": true, "internalType": "address"}, {"name": "level", "type": "uint256", "indexed": true, "internalType": "uint256"}], "anonymous": false}, {"name": "filter", "type": "function", "inputs": [{"name": "_sender", "type": "address", "internalType": "address"}, {"name": "_destination", "type": "address", "internalType": "address"}], "outputs": [{"name": "", "type": "bool", "internalType": "bool"}], "stateMutability": "view"}, {"name": "kycContract", "type": "function", "inputs": [], "outputs": [{"name": "", "type": "address", "internalType": "contract IKYCContract"}], "stateMutability": "view"}, {"name": "setFilterLevel", "type": "function", "inputs": [{"name": "_level", "type": "uint256", "internalType": "uint256"}], "outputs": [], "stateMutability": "nonpayable"}, {"name": "viewFilterLevel", "type": "function", "inputs": [], "outputs": [{"name": "", "type": "uint256", "internalType": "uint256"}], "stateMutability": "view"}]
Contract Creation Code
0x608060405234801561001057600080fd5b506004361061004c5760003560e01c80632cea8391146100515780636d3123eb14610074578063d1a23b901461009f578063e1917fda146100b4575b600080fd5b336000908152602081905260409020546040519081526020015b60405180910390f35b600154610087906001600160a01b031681565b6040516001600160a01b03909116815260200161006b565b6100b26100ad3660046101a0565b6100d7565b005b6100c76100c23660046101d5565b610114565b604051901515815260200161006b565b33600081815260208190526040808220849055518392917f2ac7de9de5ad40921e24320f86f2fcb6f4c55726e82e2a173f9cee5dc62342f791a350565b6001600160a01b03818116600090815260208190526040808220546001549151636a0db6db60e11b815286851660048201529293909291169063d41b6db690602401602060405180830381865afa158015610173573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101979190610208565b10159392505050565b6000602082840312156101b257600080fd5b5035919050565b80356001600160a01b03811681146101d057600080fd5b919050565b600080604083850312156101e857600080fd5b6101f1836101b9565b91506101ff602084016101b9565b90509250929050565b60006020828403121561021a57600080fd5b505191905056fea2646970667358221220db37876039486f4fddd046c6f6c3b861c3d08c71e893564b7e838013ae2f4fab64736f6c63430008130033
©2022-now by Graphite