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

Compounding support via ERC4626 #83

Open
wants to merge 34 commits into
base: develop
Choose a base branch
from

Conversation

AlexSaplin
Copy link
Collaborator

No description provided.

}

uint256 deltaShares = yieldVault.withdraw(toClaimAmount, address(this), address(this));
investedSharesAmount = currentInvestedSharesAmount - deltaShares;
Copy link
Collaborator

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

address interestReceiver;
// operator address (or address(0) if permissionless)
address yieldOperator;
}
Copy link
Collaborator

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?

Copy link
Collaborator

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
remappings.txt Outdated Show resolved Hide resolved
script/scripts/CompoundingMigration.s.sol Outdated Show resolved Hide resolved
script/scripts/CompoundingMigration.s.sol Outdated Show resolved Hide resolved
script/scripts/CompoundingMigration.s.sol Outdated Show resolved Hide resolved
src/zkbob/ZkBobCompoundingMixin.sol Outdated Show resolved Hide resolved
src/zkbob/ZkBobCompoundingMixin.sol Outdated Show resolved Hide resolved
src/zkbob/ZkBobCompoundingMixin.sol Outdated Show resolved Hide resolved
src/zkbob/ZkBobCompoundingMixin.sol Outdated Show resolved Hide resolved
src/zkbob/ZkBobCompoundingMixin.sol Outdated Show resolved Hide resolved
src/zkbob/ZkBobCompoundingMixin.sol Outdated Show resolved Hide resolved
src/zkbob/ZkBobCompoundingMixin.sol Show resolved Hide resolved
src/zkbob/ZkBobCompoundingMixin.sol Outdated Show resolved Hide resolved
src/zkbob/ZkBobCompoundingMixin.sol Outdated Show resolved Hide resolved
src/zkbob/ZkBobCompoundingMixin.sol Show resolved Hide resolved
uint256 rebalancedAssets = allAssets;

yieldVault.withdraw(allAssets, address(this), address(this));
if (allAssets > currentInvestedAssetsAmount) {
Copy link
Collaborator

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

src/zkbob/ZkBobCompoundingMixin.sol Outdated Show resolved Hide resolved
src/zkbob/ZkBobCompoundingMixin.sol Outdated Show resolved Hide resolved
src/zkbob/ZkBobCompoundingMixin.sol Outdated Show resolved Hide resolved
src/zkbob/ZkBobCompoundingMixin.sol Outdated Show resolved Hide resolved
src/zkbob/ZkBobCompoundingMixin.sol Outdated Show resolved Hide resolved
.gitmodules Outdated Show resolved Hide resolved
Base automatically changed from feat/energy-redeemer to develop September 5, 2023 13:22
…-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
.gitmodules Show resolved Hide resolved
src/zkbob/ZkBobCompoundingMixin.sol Outdated Show resolved Hide resolved
… feat/yield-erc4626-support

# Conflicts:
#	src/zkbob/ZkBobCompoundingMixin.sol
#	test/zkbob/ZkBobPool.t.sol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants