World ID
1. Summary
WorldIdAcceptorController.sol contract enables users to require zero-knowledge proof for their lending or borrowing counterparties through World ID. One of the use cases is verifying the humanness of the counterparty.
info
For more information about World ID please refer to the World Docs.
2. Important links
3. Contract details
- WorldIdAcceptorController.sol is written in Solidity version 0.8.16
Features
- Verify World ID zero-knowledge proof
Inherited contracts, implemented Interfaces and ERCs
Functions
checkAcceptor
Overview
Proposal contracts call this function to verify submitted World ID proofs.
This function takes three arguments supplied by the proposal contracts:
address
acceptor
bytes calldata
proposerData
- data to be verified from the proposerbytes calldata
acceptorData
- data to be verified from the acceptor
Implementation
function checkAcceptor(
address acceptor, bytes calldata proposerData, bytes calldata acceptorData
) external view returns (bytes4) {
if (proposerData.length > 0) {
revert NonEmptyProposerData();
}
AcceptorData memory data = abi.decode(acceptorData, (AcceptorData));
worldId.verifyProof(
data.root,
groupId,
_hashToField(abi.encodePacked(acceptor)),
data.nullifierHash,
externalNullifier,
data.proof
);
return type(IPWNAcceptorController).interfaceId;
}
Events and Errors
The World ID Acceptor Controller contract defines one custom error and no events.
error NonEmptyProposerData();
NonEmptyProposerData
A NonEmptyProposerData error is thrown when proposer data are not empty.
This error doesn't have any parameters.
info
Check for empty acceptorData
is ensured though abi.decode
validation.
AcceptorData
Struct
Type | Name | Comment |
---|---|---|
uint256 | root | Root of the proof merkle tree |
uint256 | nullifierHash | Nullifier hash for the proof |
uint256[8] | proof | ZK Proof itself |