-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathIKintoID.sol
138 lines (86 loc) · 4.54 KB
/
IKintoID.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import "@openzeppelin/contracts-upgradeable/utils/structs/BitMapsUpgradeable.sol";
interface IKintoID {
/* ============ Errors ============ */
/// @notice Thrown when trying to interact with an account that has a positive balance
error BalanceNotZero();
/// @notice Thrown when trying to burn a non-existent token
error NothingToBurn();
/// @notice Thrown when arrays have mismatched lengths
error LengthMismatch();
/// @notice Thrown when monitoring update exceeds maximum allowed accounts
error AccountsAmountExceeded();
/// @notice Thrown when trying to confirm a sanction for an account with no active sanctions
error NoActiveSanction(address account);
/// @notice Thrown when an account lacks required KYC verification
error KYCRequired();
/// @notice Thrown when signature verification fails
error InvalidSigner();
/// @notice Thrown when the signature has expired
error SignatureExpired();
/// @notice Thrown when the nonce is invalid
error InvalidNonce();
/// @notice Thrown when the sender is not an authorized KYC provider
error InvalidProvider();
/// @notice Thrown when the signer is a contract instead of an EOA
error SignerNotEOA();
/// @notice Thrown when a disallowed method is called
error MethodNotAllowed(string message);
/// @notice Thrown when attempting unauthorized token transfers
error OnlyMintBurnOrTransfer();
/// @notice Thrown when attempting to add or removing sanctions during exit widnow period
error ExitWindowPeriod(address user, uint256 sanctionedAt);
/* ============ Structs ============ */
struct Metadata {
uint256 mintedAt;
uint256 updatedAt;
uint8 sanctionsCount;
bool individual;
BitMapsUpgradeable.BitMap traits;
BitMapsUpgradeable.BitMap sanctions; // Follows ISO-3661 numeric codes https://en.wikipedia.org/wiki/ISO_3166-1_numeric
}
struct SignatureData {
address signer;
uint256 nonce;
uint256 expiresAt;
bytes signature;
}
struct MonitorUpdateData {
bool isTrait; // otherwise sanction
bool isSet; // otherwise remove
uint16 index;
}
/* ============ State Change ============ */
function mintIndividualKyc(SignatureData calldata _signatureData, uint16[] calldata _traits) external;
function mintCompanyKyc(SignatureData calldata _signatureData, uint16[] calldata _traits) external;
function burnKYC(SignatureData calldata _signatureData) external;
function transferOnRecovery(address _from, address _to) external;
function addTrait(address _account, uint16 _traitId) external;
function removeTrait(address _account, uint16 _traitId) external;
function addSanction(address _account, uint16 _countryId) external;
function removeSanction(address _account, uint16 _countryId) external;
function monitor(address[] calldata _accounts, MonitorUpdateData[][] calldata _traitsAndSanctions) external;
/* ============ Basic Viewers ============ */
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function isKYC(address _account) external view returns (bool);
function isSanctionsMonitored(uint256 _days) external view returns (bool);
function isSanctionsSafe(address _account) external view returns (bool);
function isSanctionsSafeIn(address _account, uint16 _countryId) external view returns (bool);
function isCompany(address _account) external view returns (bool);
function isIndividual(address _account) external view returns (bool);
function mintedAt(address _account) external view returns (uint256);
function hasTrait(address _account, uint16 index) external view returns (bool);
function traits(address _account) external view returns (bool[] memory);
/* ============ Constants and attrs ============ */
function KYC_PROVIDER_ROLE() external view returns (bytes32);
function UPGRADER_ROLE() external view returns (bytes32);
function GOVERNANCE_ROLE() external view returns (bytes32);
function lastMonitoredAt() external view returns (uint256);
function nonces(address _account) external view returns (uint256);
function recoveryTargets(address _from) external view returns (address);
function domainSeparator() external view returns (bytes32);
function walletFactory() external view returns (address);
function faucet() external view returns (address);
}