Vault
ConfidentialVault Contract
The ConfidentialVault
contract is a crucial component of the NotVault SDK. This contract is responsible for private token management. It maintains private balances and executes private transactions using zkSNARKs proofs. It is specifically designed to interact with ERC20 tokens.
Structure Definitions
CreateRequestMessage: This structure is used for creating a request for a confidential transfer. It contains recipient, denomination, and other related details of a private transfer.
SendRequest: This structure keeps the record of the confidential transfer requests. It contains details like the sender, recipient, and the amount of the transfer.
Public Functions
privateBalanceOf: This function returns the private balance of a given account in a specified denomination.
getSendRequestBySender: This function returns all the
SendRequest
made by a given account.getSendRequestByReceiver: This function returns all the
SendRequest
which have a given account as the receiver.getSendRequest: This function returns the details of a
SendRequest
based on a givenidHash
.getNonce: This function returns the nonce of a given account.
deposit: This function deposits an amount of a specific ERC20 token from the sender's address into the contract and updates the sender's private and hash balances. A zkSNARKs proof and its corresponding input are required for this operation to ensure confidentiality.
withdraw: This function withdraws an amount of a specific ERC20 token from the contract to the sender's address and updates the sender's private and hash balances. A zkSNARKs proof and its corresponding input are required for this operation to ensure confidentiality.
createRequest: This function creates multiple
SendRequest
using an array ofCreateRequestMessage
. It also updates the sender's private and hash balances for each request.acceptRequest: This function is used to accept a
SendRequest
. The function takes theidHash
of theSendRequest
, the new private balance of the receiver, a zkSNARKs proof and its corresponding inputs as arguments. It verifies the proof, checks if the request is valid and active, and then updates the private and hash balances of the receiver.
Last updated