Skip to content

re-al-Foundation/real-dai

Repository files navigation

Real-Dai

Real DAI is a token built on the Real Network that aims to provide users with a rebase mechanism for their Dai holdings.

Rebase Dai Token, is a token that utilizes the Real Network to implement a rebase mechanism for Dai holders. When Dai is staked in the escrow account on L1, it is converted to MakerDAO DSR (DAI Savings Rate Earn Strategy). The harvested yield is then bridged onto the Real Network, where it is used to rebase the DAI token. This allows DAI holders to automatically increase their token holdings over time, providing a passive income stream.

Features

Rebasing Mechanism: Real DAI utilizes a rebase mechanism to automatically adjust token balances based on the harvested yield from staked Dai.

Integration with MakerDAO DSR: Dai staked in the escrow account is converted to MakerDAO DSR, enabling users to earn interest on their holdings.

Bridge to Real Network: The harvested yield from MakerDAO DSR is bridged onto the Real Network, where it is used to rebase the DAI token.

Documentation

https://book.getfoundry.sh/

Usage

Build

$ forge build

Test

$ forge test

Format

$ forge fmt

Gas Snapshots

$ forge snapshot

Anvil

$ anvil

Deploy

$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>

Cast

$ cast <subcommand>

Help

$ forge --help
$ anvil --help
$ cast --help

Rounding Issue

When we deposit x amount of DAI to sDAI, we will get y amount of sDAI based on the current exchange rate r. Due to how y is rounded down by sDAI, there is possibility that when we redeem y amount of sDAI we will get x' = x - 1 amount of DAI.

For, example:

uint256 x = 1000000000000000001;
uint256 y = sdai.deposit(x);
uint255 x_ = sdai.redeem(y); // x_ = 1000000000000000000

Note See sDAI.t.sol for more details.

Ofcourse, r will be increased over time and this 1 wei will be covered.

To make sure that bridged DAI is always 1:1, it is advised to donate small amount of DAI on L1DaiEscrow on the first time it get deployed (e.g. 0.01 DAI).

sendExcessYield will send excess yield if the total yield is more than 0.05 DAI and will leave 0.01 DAI from the yield in L1DaiEscrow.

Locked DAI in L1DaiEscrow may greater than totalProtocolDAI

Currently there is no way to check the maximum deposit amount of sDAI. sdai.maxDeposit(address) is hardcoded to type(uint256).max.

sdai.deposit(amount, recipient) may reverted and it is possible that total amount of locked DAI in the L1DaiEscrow is greater than the specified totalProtocolDAI.

About

Re.al DAI native bridge rebases the DAI token on Real Network by harvesting MakerDAO DSR yield from Ethereum.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors