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

Dust in ConvexEthMetaStrategy #1835

Open
DanielVF opened this issue Sep 26, 2023 · 2 comments
Open

Dust in ConvexEthMetaStrategy #1835

DanielVF opened this issue Sep 26, 2023 · 2 comments
Labels
contracts Works related to contracts

Comments

@DanielVF
Copy link
Collaborator

When withdrawing funds, we should deposit the full balance of ETH to WETH. This way we don't leave any intermediate ETH in the contract, and also the next depositAll() will pick up the funds.

weth.deposit{ value: _amount }();

@DanielVF DanielVF added the contracts Works related to contracts label Sep 26, 2023
@DanielVF
Copy link
Collaborator Author

DanielVF commented Sep 26, 2023

I'm not actually reproing bug here. Doesn't seem to actually leave dust.

from world import *
OETH_CONVEX_OETH_ETH_STRAT
'0x1827F9eA98E0bf96550b2FC20F7233277FcD7E63'
s = accounts.at(OETH_CONVEX_OETH_ETH_STRAT, force=True)

oeth_vault_admin.withdrawFromStrategy(OETH_CONVEX_OETH_ETH_STRAT, [WETH], [10e18], {'from': STRATEGIST})
print(s.balance()) # zero

oeth_vault_admin.withdrawFromStrategy(OETH_CONVEX_OETH_ETH_STRAT, [WETH], [27850153071752247653], {'from': STRATEGIST})
print(s.balance()) # zero

@DanielVF
Copy link
Collaborator Author

DanielVF commented Sep 26, 2023

Our math on calculating how many LP tokens to withdraw is really good, at least a current pool tilt. Decided to fuzz it a little, and no dust leftover.

from world import *
OETH_CONVEX_OETH_ETH_STRAT
'0x1827F9eA98E0bf96550b2FC20F7233277FcD7E63'
s = accounts.at(OETH_CONVEX_OETH_ETH_STRAT, force=True)

for i in range(0,800):
  amount = int(2e18*random.random())+int(100*random.random())
  oeth_vault_admin.withdrawFromStrategy(OETH_CONVEX_OETH_ETH_STRAT, [WETH], [amount], {'from': STRATEGIST})
  print(s.balance(), amount)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contracts Works related to contracts
Projects
None yet
Development

No branches or pull requests

1 participant