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
  3. 3. Earn While Waiting

Shares-of-Staked Seconds

Previous3. Earn While WaitingNextInterest earning interest

Last updated 2 years ago

Sacred uses a shares-of-staked-seconds method to calculate the interest earned by each user. For each Sacred pool that is created, all users’ principals are pooled together to earn yield. For each transaction, the yield is pooled together into a smart contract. The user gains a share of the pooled yield rather than the yield paid directly by Aave. The yield earned is dependent on the amount of a user’s deposit and the time that they stayed in the Sacred protocol.

Because the Interest Earned is compounded, the amount of time spent in the protocol is important to know to give users a fair share.

As we can’t directly link each user’s deposit and withdrawal timestamps because of privacy, we use the Share Tracking Mechanism explained below.

The user’s share is the ratio of time that their deposit earned interest in the Sacred Pool to the total time of all deposits currently earning interest in the Sacred pool.

  • To find the time of a user’s deposit in the pool:

    • From their Note when they claim the Interest Earned. As the Note contains information which can link the Deposit + Withdrawal, the time can be calculated.

    • Privacy level is the same as AP Mining.

    • Note: A user can only claim their Share of interest earned after a Note has been spent (Similar to AP Mining).

  • To find the total time of users’ current deposits in the pool:

    • Use a tracker that updates its value whenever there is a deposit, withdrawal or interest claim event.

    • More details below

This shows how yield distribution works. Note that this is just an example and is not part of the actual contract.

javascript example