Deposits & Withdrawals
For Hinkal, depositing and withdrawing funds are two key operations. To interact with the protocol, users must first create and mint an access token. After that, they generate a Zero-Knowledge Proof (ZKP) off-chain and submit it on-chain using the Hinkal contract’s transact
function. The contract then performs several checks, including verifying the proof, checking the root hashes of both the Hinkal and Access Token Merkle trees, and ensuring the protocol’s balances are accurate.
During this process, the contract nullifies any commitments tied to the provided nullifiers to prevent them from being reused. It also adds any new commitments to Hinkal's Merkle tree. For deposits, the user’s funds are transferred to the Hinkal contract. In the case of withdrawals, the contract first pays any relayer fees (if a relayer is involved) and then transfers the remaining funds to the recipient. To prevent frontrunning attacks, a calldata hash is submitted with the ZKP, ensuring that transaction details, such as the relayer, cannot be maliciously altered during the transaction.
Last updated