rtoken-project / rtoken-monorepo

RToken Ethereum monorepo
https://rdai.money
89 stars 43 forks source link

Fix allocation strategy #39

Closed hellwolf closed 4 years ago

hellwolf commented 4 years ago

add IAS.redeemAll function

In order to switch allocatraion strategy and drain all funds from the old startegy, IAS.redeemAll is a more clean way of achieving it.

hellwolf commented 4 years ago

old strategy

https://etherscan.io/address/0xd0810dee68dd9aeafc2dbc2a6f53c3809a2e6578

There is some cDAI leftover in the old strategy: 0.81545014

new strategy

https://etherscan.io/address/0xbb16307aaed1e070b3c4465d4fda5e518bdc2433

balance: 9395.46543336

rdai.getSavingAssetBalance:

 rAmount uint256, sOriginalAmount uint256
  rAmount|uint256 :  188196669622507188429
  sOriginalAmount|uint256 :  939628088350

And: fromDecimals("939628088350", 8 = 9396.2808835 9395.46543336 + 0.81545014 == 9396.2808835

We would need to send 0.81545014 to the new allocation strategy if we want there be no "missing/leaked" interest due to the previous wrong allocation strategy switching bug.