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:

  1. Note

  2. Recipient Address

  3. Relayer settings (relayer URL, fee amount) or current wallet

Process:

  1. Browser (front-end only) decodes the Note (more info on Note structure in proof generation section).

  2. Check if Note is valid, check if deposit still exists (check Merkle Tree)

  3. Arguments set to the contract:

    1. proof (zksnark output)

    2. root (merkle tree)

    3. Nullifier

    4. recipient address

    5. relayer (address)

    6. fee

    7. refund (non native currency only)

  4. Contract verifies proof, marks that nullifier used and sends funds to:

    1. User (denomination - fee)

    2. Relayer (fee) - if used

  5. Front-end catches transaction receipt and displays all relevant info

Outputs:

  1. Transaction receipt

The claim process is highlighted below in red

Last updated