During EthOnline we are going to develop a Proof of Concept of a savings accounts smart-contract with a stable-coin initial implementation. Many saving-providers (as we call them) can be implemented for any protocol in the defi ecosystem. Our first provider implementation will use mStable. By Using this protocol, our users will achieve financial gain without getting into the risks of more exotic tokens or platforms whilst getting a fantastic APY. One interesting effect of the mStable protocol is that we had to keep the “savings credit” balance of each user, which we used to create an interest-bearing token that we call DORADOs

El Dorado showcase

How it's made

Tech: We used Buidler as a base for our repo. Most the code is written in solidity and typescript. Used mStable npm package to interface with their contracts. We used openzeppelin to help with the ERC20 implementation and Enumerable utils. Dapp is created using React and Portis as our wallet provider. Functionality: Users of mstable have to do 2 operations in order to use their protocol: Mint bAsset (stable coins) > mAsset and then deposit those mAssets to be able to get interests on that. Users get a savings credit that is multiplied by the exchange rate (this is done in the view function) to get the current value of the deposit. This way, the balance is kept in credit units, but the users sees the USD accrued at the time of the request. We simplified the workflow in two ways: 1) Deposits of stablecoints to our contract go directly to the mStable provider, and are minted and deposited in one go. 2) Instead of just keeping the balance of each user's credit, we mint tokens that represent said credit. And then the balanceOf function returns the credit multiplied by the current exchange rate. That'd make it so users wont have to burn their DORADOS everytime they would like to make a payment, since 1 Dorado is worth 1 USD + the bearing interests.

Technologies used

EthereumSolidityMetastablePortis WalletUSDC