-
Notifications
You must be signed in to change notification settings - Fork 30
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
Compounding support via ERC4626 #83
base: develop
Are you sure you want to change the base?
Conversation
src/zkbob/ZkBobCompoundingMixin.sol
Outdated
} | ||
|
||
uint256 deltaShares = yieldVault.withdraw(toClaimAmount, address(this), address(this)); | ||
investedSharesAmount = currentInvestedSharesAmount - deltaShares; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure, if there is no rounding problems.
Maybe it is better to pass shares as an argument and add check on balance in the code
20623dc
to
39254e9
Compare
address interestReceiver; | ||
// operator address (or address(0) if permissionless) | ||
address yieldOperator; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the scenario of negative apr considered?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 2 possible snearios - we want to close the position in the vault or don't want.
It can be checked by comparing to variables - totalInvestedAssets
and previewWithdraw(totalInvestedShares)
So, offchain bot can monitor these 2 variables and notify, when our tvl become less than users deposits. After that the team can decide, if position should be closed.
Insufficiency in tvl can be fullfilled by us just by transferring tokens.
So, in code function for closing position should be added, and possibility to decrease totalInvestedAmount manually by transferring tokens to pool
…yield-erc4626-support # Conflicts: # script/scripts/DeployZkBobPoolModules.s.sol # src/zkbob/ZkBobPool.sol # src/zkbob/utils/ZkBobAccounting.sol # test/interfaces/IZkBobPoolAdmin.sol # test/zkbob/ZkBobPool.t.sol
39254e9
to
0d46f96
Compare
src/zkbob/ZkBobCompoundingMixin.sol
Outdated
uint256 rebalancedAssets = allAssets; | ||
|
||
yieldVault.withdraw(allAssets, address(this), address(this)); | ||
if (allAssets > currentInvestedAssetsAmount) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comparation can be inaccurate, better to compare amount after real withdrawa
…-support # Conflicts: # src/infra/EnergyRedeemer.sol # src/zkbob/ZkBobPool.sol # src/zkbob/ZkBobPoolUSDCMigrated.sol # src/zkbob/utils/ZkBobAccounting.sol # test/interfaces/IZkBobPoolAdmin.sol # test/zkbob/ZkBobPool.t.sol
13bf6a7
to
43cbede
Compare
… feat/yield-erc4626-support # Conflicts: # src/zkbob/ZkBobCompoundingMixin.sol # test/zkbob/ZkBobPool.t.sol
No description provided.