libid_contracts/bindings/
identity.rs1#[allow(clippy::too_many_arguments, unused_attributes)]
10mod names_inner {
11 use alloy::sol;
12
13 sol! {
14 #[sol(rpc, abi)]
15 interface IdentityNames {
16 #[derive(Debug, serde::Serialize, serde::Deserialize)]
17 struct Rules {
18 uint16 maxLength;
19 bool stripLeadingAt;
20 bool isEmail;
21 bool allowUnderscore;
22 bool allowHyphen;
23 }
24
25 #[derive(Debug, serde::Serialize, serde::Deserialize)]
32 struct Account {
33 bytes32 platformId;
34 string userId;
35 string handle;
36 bool handleCurrent;
37 }
38
39 function initialize(address owner_) external;
40
41 function byId(bytes32 idNode) external view returns (address owner, uint64 observedAt);
43 function byHandle(bytes32 handleNode) external view returns (address owner, uint64 observedAt);
46 function CLAIM_IDENTITY_DOMAIN() external view returns (bytes32);
48
49 function owner() external view returns (address);
50 function pendingOwner() external view returns (address);
51 function transferOwnership(address newOwner) external;
52 function acceptOwnership() external;
53 function renounceOwnership() external pure;
55
56 function setPlatform(bytes32 platformId, Rules calldata rules) external;
60
61 function setProofVerifier(address verifier) external;
64 function proofVerifier() external view returns (address);
65
66 function bind(bytes32 platformId, uint16 verifierVersion, bytes calldata payload, bool publishName) external payable;
72 function quoteBind(bytes32 platformId, uint16 verifierVersion) external view returns (uint256);
73 function digestSpent(bytes32 digest) external view returns (bool);
74 function unpublish(bytes32 platformId) external;
75 function resolveId(bytes32 platformId, string calldata userId) external view returns (address);
76 function resolveHandle(bytes32 platformId, string calldata handle) external view returns (address);
77 function resolvePair(bytes32 platformId, string calldata handle, string calldata userId) external view returns (address wallet, bool idAgrees);
80 function reverseOf(address wallet, bytes32 platformId) external view returns (string memory);
81 function primaryOf(address wallet, bytes32 platformId) external view returns (string memory);
82 function rulesOf(bytes32 platformId) external view returns (Rules memory);
84 function acceptsBindings(bytes32 platformId) external view returns (bool);
87 function handleHashOf(bytes32 platformId, string calldata handle) external view returns (bytes32 handleHash);
90 function nodeOf(bytes32 platformId, string calldata handle) external view returns (bytes32 handleNode);
92 function nodeOfHash(bytes32 platformId, bytes32 handleHash) external pure returns (bytes32);
94
95 function accountCount(address wallet) external view returns (uint256);
97 function accountsOf(address wallet, uint256 from, uint256 limit) external view returns (Account[] memory);
104
105 event IdentityBound(
111 address indexed owner,
112 bytes32 indexed idNode,
113 bytes32 indexed handleNode,
114 bytes32 platformId,
115 string userId,
116 string handle,
117 uint64 observedAt,
118 bool published,
119 uint16 ceremonyVersion
120 );
121 error UnknownPlatform(bytes32 platformId);
124 error UnusableHandle(uint8 problem);
127
128 event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
129 event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
130
131 error ZeroAddress();
134 error ForeignOperationDomain(bytes32 operationDomain);
135 error DigestAlreadySpent(bytes32 digest);
136 error BadTransactionData(uint256 length);
137 error WrongBindValue(uint256 required, uint256 provided);
138 error WrongFeeValue(uint256 required, uint256 provided);
139 error NoncanonicalFee(uint256 amount, address receiver);
140 error FeeTransferFailed(address receiver, uint256 amount);
141 error NotProofTarget(address proved, address caller);
142 error NoObservationTime();
143 error NoUserId();
144 error StaleProof(uint64 observedAt, uint64 known);
145 error EmptyHandle();
146 error HandleTooLong();
147 error BadCharacter();
148 error BadShape();
149 error OwnableUnauthorizedAccount(address account);
150 error OwnableInvalidOwner(address owner);
151 error ReentrancyGuardReentrantCall();
152
153 event HandleRetired(bytes32 indexed platformId, bytes32 indexed handleNode, address indexed owner);
154 event PlatformConfigured(bytes32 indexed platformId);
155 event ProofVerifierConfigured(address verifier);
156 event BindFeePaid(bytes32 indexed authorizationDigest, address indexed receiver, uint256 amount);
159 event NameUnpublished(address indexed owner, bytes32 indexed platformId);
160 event CeremonyBound(
164 bytes32 indexed authorizationDigest,
165 address indexed owner,
166 bytes32 indexed platformId,
167 bytes clientIdentifier
168 );
169 }
170 }
171}
172
173pub use names_inner::IdentityNames;
174
175#[cfg(test)]
176mod tests {
177 use super::names_inner::IdentityNames;
178 use crate::bindings::drift::assert_binding_matches_artifact;
179
180 const OMITTED: &[&str] = &[
182 "error AddressEmptyCode(address)",
183 "error ERC1967InvalidImplementation(address)",
184 "error ERC1967NonPayable()",
185 "error FailedCall()",
186 "error InvalidInitialization()",
187 "error NotInitializing()",
188 "error UUPSUnauthorizedCallContext()",
189 "error UUPSUnsupportedProxiableUUID(bytes32)",
190 "event Initialized(uint64)",
191 "event Upgraded(address)",
192 "function UPGRADE_INTERFACE_VERSION()",
193 "function proxiableUUID()",
194 "function upgradeToAndCall(address,bytes)",
195 ];
196
197 #[test]
198 fn the_binding_matches_the_artifact_abi() {
199 assert_binding_matches_artifact(
200 "IdentityNames",
201 "IdentityNames",
202 &IdentityNames::abi::contract(),
203 OMITTED,
204 );
205 }
206}