Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce donate token gas costs #80

Closed
naddison36 opened this issue Nov 17, 2022 · 1 comment
Closed

Reduce donate token gas costs #80

naddison36 opened this issue Nov 17, 2022 · 1 comment
Assignees
Labels
contract Contract work v2 mStable v2 roadmap

Comments

@naddison36
Copy link
Contributor

Problem

Donating small amounts of DAI back to the mUSD, FRAX and BUSD vaults is very expensive. For example, it cost 3,264,357 gas (70 USD) to donate 63 DAI back to the mUSD, FRAX and BUSD vaults. https://etherscan.io/tx/0xfb0042c2425a27f4705fc76b1810be015c2d4bf43565f5e3c66a1c78255c054a

Normally this will be held back until there is a significant reward but last week we ran through the liquidation cycle for testing purposes. It's also worth considering that if rewards are not streaming then the APY will close to 0.

Proposed solution

The donate function will convert DAI/USDC/USDT to 3Crv using the 3Pool, but will not add liquidity to the Curve Metapool and deposit the Metapool LP token to the Convex pool. This will be delayed until the next mint or deposit.

The 3Crv can sit in the vault but have no impact on the assets per share. This is effectively an unrealised gain like accrued rewards.

The next time a mint or deposit is done, it will check if the vault has a 3Crv balance. This balance will be added to the mint/deposit 3Crv that is added to the Metapool and LP deposited to the Convex pool. The resulting shares will be proportionally split between the minter/depositor and the vault. The existing streaming process will then work to burn the vault shares over the next week.

@naddison36 naddison36 added contract Contract work v2 mStable v2 roadmap labels Nov 17, 2022
@naddison36
Copy link
Contributor Author

This should be done for the FraxBP contracts first on the fraxBP branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contract Contract work v2 mStable v2 roadmap
Projects
None yet
Development

No branches or pull requests

2 participants