SACRED Technical Private Doc
  • What is Sacred?
    • Introduction to Sacred
    • Repos and Video Walkthrough
    • How to Use Sacred
    • Sacred Pools (Boxes)
    • Anonymity Set
    • User journey - from Deposit to Withdrawal
      • 1. Receive Note
      • 2. Deposit Tokens
      • 3. Earn While Waiting
        • Shares-of-Staked Seconds
        • Interest earning interest
        • Share Tracking Quirks
      • 4. Withdraw
      • 5. Redeem Claim - Receive Principal
        • Sacred Automated Market Maker
      • 6. Redeem Yield
      • 7. Redeem Incognito Credits
      • Using a Relayer to withdraw the principal, IC and yield
    • Sacred Rules to keep your deposit private
    • Circuits Summary
    • Links to individual Contracts
Powered by GitBook
On this page
  1. What is Sacred?
  2. User journey - from Deposit to Withdrawal

2. Deposit Tokens

Previous1. Receive NoteNext3. Earn While Waiting

Last updated 2 years ago

User deposits the predetermined amount into the Sacred pool. After the tokens are deposited, they are moved into a DeFi platform (Aave) where they can earn yield. The deposit process is as follows:

Code Summary - Deposit

User Inputs:

  1. Token (e.g. ETH)

  2. Amount (e.g. 0.1)

Process:

  1. Front-End code takes input

  2. Generates a zk note on the browser (nullifier+secret combo)

    1. Note

    2. Commitment

  3. The Note contains ALL parts of the proof (commitment and nullifier and secret). This is saved by the user.

  4. The commitment is sent to the contract to be inserted in the Merkle Tree.

Outputs:

  1. Transaction receipt

The deposit process is highlighted below in red:

Logosacred-cli-tools/cli.js at 9e297751a63087e140b6e0577cba6af702806341 · Sacred-Finance/sacred-cli-toolsGitHub