5. Redeem Claim - Receive Principal
When the user puts the unredeemed claim into Sacred, they will be able to withdraw their tokens to their wallet of choice. They can use a relayer service or redeem directly to their wallet. After this, the claim is nullified and marked as redeemed (Sacred generates a nullified hash). This will allow the user to cash in their Incognito Credits (IC) for Sacred.
After the user withdraws their principal, the user’s portion of yield continues to gain interest which is shared amongst the users who have not withdrawn their principal. This further de-links the principal that is earned from the yield and benefits the people in the Sacred pool as they continue to earn more (and more than other individuals in Aave pools).
The user will be able to withdraw the principal and yield in separate transactions. They can even redeem their yield earned all at the same time at a later date after making multiple deposits and withdrawals in a Sacred pool. While users can redeem the YIELD accumulated all at once from principals, it is recommended to stagger principal redemption and NEVER do this at the same time as it will compromise privacy!
Code Summary - Withdraw principal
User Inputs:
Note
Recipient Address
Relayer settings (relayer URL, fee amount) or current wallet
Process:
Browser (front-end only) decodes the Note (more info on Note structure in proof generation section).
Check if Note is valid, check if deposit still exists (check Merkle Tree)
Arguments set to the contract:
proof (zksnark output)
root (merkle tree)
Nullifier
recipient address
relayer (address)
fee
refund (non native currency only)
Contract verifies proof, marks that nullifier used and sends funds to:
User (denomination - fee)
Relayer (fee) - if used
Front-end catches transaction receipt and displays all relevant info
Outputs:
Transaction receipt
The claim process is highlighted below in red
Last updated