Endorser
An ERC-721 tokens that tracks ownership of negotiable instruments
Inherits: Initializable, ERC721Upgradeable, ERC721BurnableUpgradeable, EIP712Upgradeable, AccessManagedUpgradeable, UUPSUpgradeable, WitnessConsumer
Author: Ernesto García
A contract to track digital endorsements according to Mexican comercial and debt instruments law. This contract allows for any user to mint a new token by providing the hash of the digital document a provenance proof checked against the Witness and a valid signature from an authorizer. Privacy is ensured by only tracking the hash of the document, and not the document itself.
Property is tied to regular Ethereum addresses. It’s the responsibility of the developer to implement a robust regulatory framework to ensure the link between the owner and such address.
security-contact: security@plumaa.id
State Variables
ENDORSER_STORAGE
PROVENANCE_AUTHORIZER_ROLE
_MINT_AUTHORIZATION_TYPEHASH
Functions
constructor
Note: oz-upgrades-unsafe-allow: constructor
getProvenanceHash
Leaf hash. Uses SHA256 according to the algorithms approved by the Mexican government.
initialize
Initializes the contract setting an initial authority and a Witness contract
WITNESS
The Witness contract that this contract uses to verify provenance.
mint
Mints a new token for the provided to
address if the proof is valid and nullifies it so it can’t be used again.
setWitness
Sets the Witness contract
Witness is set by default to the mainnet address, it should be updated to the correct address before deployment when deploying to testnets.
_baseURI
_validateAndNullifyProof
Checks whether a proof is valid and nullifies it so it can’t be used again.
Requirements:
- The leaf was not nullified before.
- The mint request was signed by an authorizer.
- The authorizer is a member of the PROVENANCE_AUTHORIZER_ROLE.
- The proof is valid according to the Witness contract.
_getEndorserStorage
Get EIP-7201 storage