-
Notifications
You must be signed in to change notification settings - Fork 389
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
Yield-earning Warp Routes with ERC4626 #3076
Conversation
|
fd9c494
to
9ca1b4e
Compare
9ca1b4e
to
0f505b8
Compare
hey @ltyu still working on this? |
This is complete. Waiting on team approval |
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.
nice work!
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.
nice work!
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.
nice work!
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.
nice work!
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.
nice work!
…-monorepo into yield-warp-routes
function _depositIntoVault(uint256 _amount) internal { | ||
assetDeposited += _amount; | ||
vault.deposit(_amount, address(this)); | ||
} |
Check warning
Code scanning / Slither
Unused return Medium
constructor( | ||
ERC4626 _vault, | ||
address _mailbox | ||
) HypERC20Collateral(_vault.asset(), _mailbox) { | ||
vault = _vault; | ||
wrappedToken.approve(address(vault), type(uint256).max); | ||
} |
Check warning
Code scanning / Slither
Unused return Medium
function _withdrawFromVault(uint256 _amount, address _recipient) internal { | ||
assetDeposited -= _amount; | ||
vault.withdraw(_amount, _recipient, address(this)); | ||
} |
Check warning
Code scanning / Slither
Unused return Medium
function sweep() external onlyOwner { | ||
uint256 excessShares = vault.maxRedeem(address(this)) - | ||
vault.convertToShares(assetDeposited); | ||
uint256 assetsRedeemed = vault.redeem( | ||
excessShares, | ||
owner(), | ||
address(this) | ||
); | ||
emit ExcessSharesSwept(excessShares, assetsRedeemed); | ||
} |
Check notice
Code scanning / Slither
Reentrancy vulnerabilities Low
External calls:
- assetsRedeemed = vault.redeem(excessShares,owner(),address(this))
Event emitted after the call(s):
- ExcessSharesSwept(excessShares,assetsRedeemed)
@yorhodes could you DM lee about the steps to merge |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3076 +/- ##
==========================================
+ Coverage 68.02% 68.45% +0.42%
==========================================
Files 99 100 +1
Lines 1032 1046 +14
Branches 107 108 +1
==========================================
+ Hits 702 716 +14
+ Misses 284 283 -1
- Partials 46 47 +1
|
### Description Integrates ERC4626 compatible vaults. This PR assumes that the vault `asset` is the same as `wrappedToken` - `_transferFromSender()` deposits into the vault - `_transferTo()` withdraws from the vault - `sweep()` redeems excess shares for the vault asset - Uses internal `assetDeposited` store to keep track of assets deposited. Used to calculate excess shares to be withdrawn by owner - Makes minor changes to existing test files to allow new tests to inherit ### Drive-by changes <!-- Are there any minor or drive-by changes also included? --> ### Related issues - Implements #2450 ### Backward compatibility Yes ### Testing Manual/Unit Tests --------- Co-authored-by: Yorke Rhodes <[email protected]>
Description
Integrates ERC4626 compatible vaults. This PR assumes that the vault
asset
is the same aswrappedToken
_transferFromSender()
deposits into the vault_transferTo()
withdraws from the vaultsweep()
redeems excess shares for the vault assetassetDeposited
store to keep track of assets deposited. Used to calculate excess shares to be withdrawn by ownerDrive-by changes
Related issues
Backward compatibility
Yes
Testing
Manual/Unit Tests