Interest earning interest

When a user withdraws their deposit, there is a time delay until they can claim the interest earned on their deposit. During that time delay the portion of their interest is earning interest. However the system does not track this time. We also don’t know how much interest that user has accumulated at the time of withdrawal. Unlike the deposit amounts which are of a fixed denomination, the interest amounts vary by user. Leaking the time delay between the withdrawal and interest claim has privacy consequences.

Conclusion: The amount of interest earned on users’ unclaimed interest will be added to the total amount of interest and distributed to all users according to their share of the interest. The process is summarized below.

Note: interest from all Sacred Pools are managed as one, as this simplifies the tracking logic.

Code Summary - Share tracking mechanism

The share tracker is a structure containing the following (public) information:

  • Total shares currently

  • Number of active deposits

  • Last updated

Every time a deposit, withdrawal or interest claim happens, the Share Tracker’s values are updated. When a User claims their share of Interest, we calculate the ratio of their deposit’s Share in the Sacred Pool to the Total Shares which the Tracker holds.

Each time a deposit happens:

  • calculate # of blocks since last

  • update and multiply by # of current depositors

  • update Total Share value update the # of current depositors by 1.

Each time a withdraw happens:

  • Calculate # of blocks since last update and multiply by # of current depositors

  • Update Total Share value

  • Update the # of current depositors by -1.

Each time a claim happens:

  • Calculate # of blocks since last update and multiply by # of current depositors

  • Update Total Share value

  • Withdraw # of blocks that the claim spent in the protocol from tracker value

When a claim happens and the # of blocks that the claim spent in the protocol information is known, but it is not linked to the withdrawal or deposit of that claim. This is the same information that is known during IC claim.

Last updated