libid_contracts/bindings/
identity.rs1#[allow(clippy::too_many_arguments, unused_attributes)]
10mod registry_inner {
11 use alloy::sol;
12
13 sol! {
14 #[sol(rpc, abi)]
15 interface IdentityRegistry {
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 Identity {
33 bytes32 platformId;
34 string id;
35 string handle;
36 bool handleCurrent;
37 }
38
39 function initialize(address owner_) external;
40
41 function idBinding(bytes32 idNode) external view returns (address holder, uint64 observedAt);
43 function handleBinding(bytes32 handleNode) external view returns (address holder, uint64 observedAt);
46 function OPERATION_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 publish) 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 id) external view returns (address);
76 function resolveHandle(bytes32 platformId, string calldata handle) external view returns (address);
77 function resolveHandleAndId(bytes32 platformId, string calldata handle, string calldata id) external view returns (address holder, bool idAgrees);
80 function publishedHandleOf(address holder, bytes32 platformId) external view returns (string memory);
83 function rulesOf(bytes32 platformId) external view returns (Rules memory);
85 function acceptsBindings(bytes32 platformId) external view returns (bool);
88 function handleHashOf(bytes32 platformId, string calldata handle) external view returns (bytes32 handleHash);
91 function handleNodeOf(bytes32 platformId, string calldata handle) external view returns (bytes32 handleNode);
93 function handleNodeOfHash(bytes32 platformId, bytes32 handleHash) external pure returns (bytes32);
95
96 function identityCount(address holder) external view returns (uint256);
98 function identitiesOf(address holder, uint256 from, uint256 limit) external view returns (Identity[] memory);
104
105 event IdentityBound(
111 address indexed holder,
112 bytes32 indexed idNode,
113 bytes32 indexed handleNode,
114 bytes32 platformId,
115 string id,
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 NoId();
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 holder);
154 event PlatformConfigured(bytes32 indexed platformId);
155 event ProofVerifierConfigured(address verifier);
156 event BindFeePaid(bytes32 indexed authorizationDigest, address indexed receiver, uint256 amount);
159 event HandleUnpublished(address indexed holder, bytes32 indexed platformId);
160 event CeremonyBound(
164 bytes32 indexed authorizationDigest,
165 address indexed holder,
166 bytes32 indexed platformId,
167 bytes clientIdentifier
168 );
169 }
170 }
171}
172
173pub use registry_inner::IdentityRegistry;
174
175#[cfg(test)]
176mod tests {
177 use super::registry_inner::IdentityRegistry;
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 "IdentityRegistry",
201 "IdentityRegistry",
202 &IdentityRegistry::abi::contract(),
203 OMITTED,
204 );
205 }
206}