Technical design
Last updated
Last updated
The growth of the modular ecosystem has resulted in a number of promising L1s and L2s. However, asset movement across these chains is challenging as a large amount of ETH/BTC/stablecoins are locked in bridge smart contracts without earning any returns. This prevents both users and protocols from accessing potential yields on the host chain. Raga Finance solves this by making native yields accessible to everyone. The document talks about ETH as it is the first asset getting unlocked by Raga Finance.
Users can mint an ETH derivative on their chosen chain while earning returns on their ETH through investment strategies managed by Raga Finance. This ETH derivative can then be utilised within applications on the target chain.
User deposits ETH to Raga Contract on Ethereum L1 and it triggers following action:
The user sends ETH or any ETH derivative that is whitelisted with Raga to Deposit Contract
The Deposit Contract checks whether there is any strategy associated with the token
The Deposit Contract sends the payload which contains the amount of nETH to be minted depending on the sharePrice and the address it needs to be minted to the Messaging Contract on Ethereum L1 to relay the message
The Messaging Contract on Ethereum L1 sends the message to the Messaging Contract on the target chain
The Messaging Contract on the target chain asks the nETH contract to mint the tokens
The nETH tokens minted are transferred to users on the respective chain.
For users, this is just a single click deposit and they get a token backed by all the ETH derivatives whitelisted. Their fragmented liquidity in various tokens gets a new form
If user has already bridged ETH or its derivative to a supported chain, they can deposit their asset and get nETH minted to their wallet. When the user deposits on the supported chain, it follows the following process:
The asset goes to the deposit contract on the supported chain which checks whether the asset can be taken as deposit
The Deposit L2 contract instructs the nETH token contract to mint tokens depending on the sharePrice
The minted asset is transferred to the user
All the assets that are deposited on the supported chain are batched and transferred to Ethereum L1 Deposit contract for strategy execution
The strategies that are created needs to be executed on regular interval and it is done in following manner:
The bot reads all the strategy and decides which strategy needs to be executed and what assets needs to be deposited from Deposit Contract
The Deposit contract verifies whether the data passed on by the bot is correct or not
The Strategy manager is called with respected assets to execute the particular strategy which in turns execute that particular strategy
Thus, the asset flows from the deposit contract to various protocols and start earning returns
Rewards are transferred to all minted nETH by increasing the value of the asset. Following steps happen when rewards are transferred:
The oracle triggers the rewards calculation function in deposit contract.
Anyone can trigger this action as all the calculations are done within the smart contract itself
The deposit contract gets all rewards from the strategies which changes the sharePrice
The deposit contract sends the message to Message Contract on all supported chains about the new sharePrice
The Message Contract relays the message to Deposit Contract on the supported chain regarding the new sharePrice.