💸Integrating Savings Contracts

Integrate Angle Savings Contracts to earn from your assets

Angle Savings contracts enable depositing Angle stablecoins to earn a yield from it.

These are simple ERC4626 contracts (see implementation) which do not invest the tokens deposited in it, but simply mint new tokens based on a rate defined by governance.

The flow is the following: if one user deposits 100 EURA in the contract, and governance encodes a 2% yearly rate, then after a year when the user wants to withdraw its EURA, the contract mints 2 EURA (it has a minting right on the token), and the user can withdraw 2 EURA.

As such, apart from the savings contract smart contract risk, there is no extra trust assumption between owning a stablecoin and owning a stablecoin in a staking contract to earn a yield from it.

Savings contracts addresses for Angle stablecoins across all chains can be obtained here.

Fetch APY and inflation rate

To get the rate that a savings contract is paying, you can simply call the rate parameter of the contract. It's the per second inflation rate given in base 27.

The contract also comes with a wrapper estimatedAPR function which gives the estimated APY in base 18 for depositing in this contract (rewards in the savings contract are compounding and so what this function returns is an APY rather than an APR).

A 1% APY for this function would correspond to a value of 10000000000000000.

In the same vein, you can anticipate (assuming the inflation rate does not change) how much you'll earn for a period of time by depositing in the contract by calling the computeUpdatedAssets function:

function computeUpdatedAssets(uint256 _totalAssets, uint256 exp) external view returns (uint256);

Parameters:

  • _totalAssets: How much you're depositing in the contract

  • exp: Period in second for which you want to estimate your earnings

Return Value:

  • Value of your assets after exp seconds in the contract should the inflation rate remain constant

Deposit & withdraw

Angle Savings contract implementation is a very simple extension of the baseline ERC4626 contract. As such, the logic to deposit or withdraw assets, as well as to mint or redeem shares is exactly the same as explained here.

The only thing that changes is that in case of unforeseen events, governance has the power to pause depositing and withdrawing from the contract. To check whether the contract is paused, you can check the paused variable of the contract which is equal to 1 when contract is paused.

The contract also comes with the usual convertToShares, convertToAssets, maxDeposit, maxWithdraw, maxMint, maxRedeem functions which have no specifities.

Get a staked token price

The functions convertToShares and convertToAssets can be used to estimate the price of the share of the savings contract (=the staked token) in reference token.

Basically, the value of 1 share in reference asset is convertToAssets(1 ether).

Different implementations for Angle savings contracts may be deployed on different chains. It's important to note that while contract addresses may be the same, the prices of the corresponding shares may completely vary from one chain to another.

Rate modifications

The inflation rate in an Angle Savings contract is encoded by governance. As such, it is non dilutive and does not vary as people deposit more capital or withdraw their assets.

Depending on the stablecoin and on the setup, governance may follow different update schedules. And the frequency of updates may vary from every week to every several months. Between two updates, depositors in Angle Savings contract are guaranteed to earn a fixed rate on their assets.

Last updated