An identity verifier is a smart contract which can restrict the ability for a user to bid on or purchase an NFT. This is especially useful if you wish to perform KYC, or do allow list sales.
IIdentityVerifier
An identity verifier MUST implement IIdentityVerifier
interfaceIIdentityVerifierisIERC165 {/** * @dev Verify that the buyer can purchase/bid * * @param listingId The listingId associated with this verification * @param identity The identity to verify * @param tokenAddress The tokenAddress associated with this verification * @param tokenId The tokenId associated with this verification * @param requestCount The number of items being requested to purchase/bid * @param requestAmount The amount being requested * @param requestERC20 The erc20 token address of the amount (0x0 if ETH) * @param data Additional data needed to verify * */ function verify(uint40 listingId, address identity, address tokenAddress, uint256 tokenId, uint24 requestCount, uint256 requestAmount, address requestERC20, bytes calldata data) external returns (bool);
}
The verify function is called before any bid or purchase by the Marketplace Contract, and the Marketplace Contract will reject the bid or purchase if the verify function returns false.
The verify function CAN be a view or pure function.
IIdentityVerifierCheck
An identity verifier MAY also implement IIdentityVerifierCheck if they need a separate view function to check wallet access in the UI prior to submitting a bid or purchase.
/** * Implement this interface if you want to have a view function to check * whether or not an identity is verified to bid/purchase */interfaceIIdentityVerifierCheckisIERC165 {/** * @dev Check that a buyer is verified to purchase/bid * * @param marketplaceAddress The address of the marketplace * @param listingId The listingId associated with this verification * @param identity The identity to verify * @param tokenAddress The tokenAddress associated with this verification * @param tokenId The tokenId associated with this verification * @param requestCount The number of items being requested to purchase/bid * @param requestAmount The amount being requested * @param requestERC20 The erc20 token address of the amount (0x0 if ETH) * @param data Additional data needed to verify * */ function checkVerify(address marketplaceAddress, uint40 listingId, address identity, address tokenAddress, uint256 tokenId, uint24 requestCount, uint256 requestAmount, address requestERC20, bytes calldata data) external view returns (bool);
}
Integrating Identity Verification into the Marketplace Widget