-
Notifications
You must be signed in to change notification settings - Fork 95
[WIP] Cross-chain Strategy #2715
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
base: master
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2715 +/- ##
==========================================
- Coverage 41.10% 37.35% -3.76%
==========================================
Files 126 134 +8
Lines 5778 6056 +278
Branches 1537 1608 +71
==========================================
- Hits 2375 2262 -113
- Misses 3401 3792 +391
Partials 2 2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| pragma solidity ^0.8.0; | ||
|
|
||
| /** | ||
| * @title OUSD Yearn V3 Remote Strategy Mock - the Mainnet part |
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.
"- the Mainnet part" should probably be "- the L2 chain part"
| * @author Origin Protocol Inc | ||
| */ | ||
|
|
||
| contract CrossChainRemoteStrategyMock { |
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.
Remove is a better name than Slave :)
| address public immutable cctpHookWrapper; | ||
|
|
||
| // USDC address on local chain | ||
| address public immutable baseToken; |
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.
we can rename this to usdcToken?
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.
That's a good point. Since we would only be dealing with USDC with CCTP
| } | ||
|
|
||
| function _setFeePremiumBps(uint32 _feePremiumBps) internal { | ||
| require(_feePremiumBps <= 3000, "Fee premium too high"); // 30% |
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.
The limit can be much more conservative here I think. Say 5bp?
Though since we are using standard transfers we might hardcode this to 0
| ); | ||
| } | ||
|
|
||
| function handleReceiveUnfinalizedMessage( |
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 think we might need to implement this, but should we revert when this function gets called. We should only be receiving finalized messages as a result of plain message or standard CCTP token transfer
| return message.extractSlice(8, message.length); | ||
| } | ||
|
|
||
| function _encodeDepositMessage(uint64 nonce, uint256 depositAmount) |
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 think the:
- _encodeDepositMessage
- _decodeDepositMessage
- _encodeDepositAckMessage
- _decodeDepositAckMessage
- _encodeWithdrawMessage
- _decodeWithdrawMessage
- _encodeWithdrawAckMessage
- _decodeWithdrawAckMessage
- _encodeBalanceCheckMessage
- _decodeBalanceCheckMessage
Would fit into a separate contract that isn't part of CCTP abstract integrator. This way the Abstract integrator can be used by the OUSD L2 strategy that holds the funds on the mainnet.
Maybe they can be moved into a new AbstractCCTPStrategyIntegrator that inherits from AbstractCCTPIntegrator
* fix deploy files * minor rename * add calls to Morpho Vault into a try catch * refactor hook wrapper * don't revert if withdraw from underlying fails * use checkBalance for deposit/withdrawal acknowledgment * update message in remote strategy * remove unneeded functions
Code Changes
WIP - TBD