Saving ESD

📘 What is Saving?

The Saving service allows users to earn time-based interest on their deposited assets. These assets are efficiently managed within the protocol to provide sustainable and stable returns.

  • Key Features:

    • Stable Yield: Powered by a time-based ESD Savings Rate (ESR).

    • Compound Growth: Accumulated interest is added to the principal continuously.

    • User-Friendly Interface: Simple deposit and withdrawal functionality.


📊 Key Concepts

1. ESR (Esd Savings Rate)

  • Definition: The continuous annual interest rate applied per second.

  • Management:

    • Governed by the protocol's governance mechanism.

    • Provides stable returns by accumulating interest over time.

  • Unit: ray (fixed-point, (10^{27})).

DSR Calculation Formula

  • ( r ): Per-second interest rate.

  • ( Δt ): Time elapsed since the last update.


2. CHI (Rate Accumulator)

  • Definition: Tracks the cumulative interest rate over time.

  • Role:

    • Used to calculate the total value of deposited assets, including interest.

    • Updated whenever the drip function is called.

CHI Calculation Flow

  1. ( chi_next = chi_current \times r^{Δt} )

  2. ( total_value = pie \times chi )


🛠️ How to Use

1. Deposit (Join)

Users can start earning savings by depositing their assets into the protocol.

  • Steps:

    1. Call the join function on the smart contract.

    2. The deposited amount is stored in pie, and interest is accumulated based on chi.


2. Withdraw (Exit)

Users can withdraw their deposits at any time.

  • Steps:

    1. Call the exit function.

    2. The total amount (principal + interest) is calculated using chi and transferred to the user.


💡 Key Benefits

  1. Stable Returns:

    • Sustainable interest rate powered by protocol revenue.

  2. Flexible Withdrawals:

    • Users can withdraw their savings anytime.

  3. Governance-Controlled Rate:

    • ESR can be adjusted by governance to maintain protocol liquidity and stability.


🧑‍💻 Smart Contract Specification

Key Functions

  1. join(uint256 wad):

    • Deposits assets into the protocol.

    • wad: The amount to deposit.

    • The normalized deposit is stored in pie[msg.sender].

  2. exit(uint256 wad):

    • Withdraws assets from the protocol.

    • wad: The amount to withdraw.

  3. drip():

    • Updates the interest rate (chi) and last update timestamp (rho).

  4. file(bytes32 what, uint256 data):

    • Sets the ESR value.


📈 Example: Earning with Saving

Initial Conditions:

  • DSR: 1000000002293273137447730714 (approximately 7.5% annual interest rate).

  • Deposit Amount: 1,000 ESD.

Over Time:

  1. ( Δt = 1 year (31,536,000 seconds) ).

  2. CHI Update: [ chi_next = chi_current * r^{31,536,000} ]

Final Asset Value:

  • 1,000 ESD → approximately 1,075 ESD (7.5% growth).

Last updated