Deal
ConfidentialDeal Contract
The ConfidentialDeal
contract is a significant component of the NotVault SDK. It primarily extends the ERC721 functionality to implement confidential deals that interact with a Confidential Vault and supports the verification of zkSNARKs proofs to maintain privacy. This contract leverages OpenZeppelin contracts for various functionalities such as ERC721, pausable, ownable, and burnable features.
Structure Definitions
DealMeta: This structure contains the metadata of a deal, including owner, counterpart, denomination, name, description, notional, and initial.
Public Functions
pause and unpause: These functions allow the owner of the contract to pause and unpause the contract respectively.
tokenURI: This function returns the URI of the token based on the token ID.
safeMint: This function allows the owner to mint a token safely. The token metadata (URI) and other deal-specific data (counterpart, minimum commitment, and idHash) are associated with the token during minting. The nonce for the owner and the counterpart is incremented, and the token is added to the owner and counterpart's pool.
getDealByOwner: This function returns all the deals initiated by a given owner.
getDealByCounterpart: This function returns all the deals where a given address is the counterpart.
getSendRequestByDeal: This function returns all the SendRequests associated with a given deal.
addSendRequest: This function allows associating a SendRequest to a deal using its
idHash
.
accept: This function allows the counterpart of a deal to accept it. The function verifies the zkSNARKs proof, checks the minimum commitment, and compares the idHash before marking the deal as accepted.
Last updated