Skip to content

Compounding support via ERC4626#83

Open
AlexSaplin wants to merge 34 commits intodevelopfrom
feat/yield-erc4626-support
Open

Compounding support via ERC4626#83
AlexSaplin wants to merge 34 commits intodevelopfrom
feat/yield-erc4626-support

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
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

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
@k1rill-fedoseev k1rill-fedoseev force-pushed the feat/yield-erc4626-support branch from 13bf6a7 to 43cbede Compare September 22, 2023 00:22
… 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