-
Notifications
You must be signed in to change notification settings - Fork 43
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
Feat/share ccip bridge #180
Conversation
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.
Just some small changes. This is an exciting PR man, awesome work! We discussed some bigger picture aspects such as:
- If there is any risk with the
destinationShares
being used in adestination chain protocol
with liquidation. This is a teaser to the possible areas that cross-chain shares could be used in to help "aggregate" yields and whatnot across the networks. We are leaving it to figure out later though and is outside of the scope of this PR so all good. - Another "Future" thing to consider that we chatted about is how
destination
chain protocols who provide liquidity mining or some type of reward setup would work with cross-chain shares such that they could get all yield (from the shares as well) on thedestination chain
itself. This is not in scope for this PR though, and could be handled via arbitrage as you had pointed out in our chat.
error DestinationMinter___SourceChainNotAllowlisted(uint64 sourceChainSelector); | ||
error DestinationMinter___SenderNotAllowlisted(address sender); | ||
error DestinationMinter___InvalidTo(); | ||
error DestinationMinter___FeeTooHigh(); |
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.
Same for this error, did we want to outline the amount of fees that was erroneous? Or is it just self-explanatory since they are user input params
again?
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.
So this error only bubbles up if the user specified maxLinkToPay
is less than the fees it would cost to send the bridge TX. So we could probably add in 2 args, the user specified max, and the actual fees being charged. However I dont think etherscan knows how to process custom errors, so this would only help people interacting with our contracts via some dev env that tells them.
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.
Interesting that Etherscan is limited in that sense. So how would this pop up on etherscan if it were to revert because of this? If nothing can be done about it so it helps users, then that is fine to leave this unchanged.
|
||
if (fees > maxLinkToPay) revert DestinationMinter___FeeTooHigh(); | ||
|
||
LINK.safeTransferFrom(msg.sender, address(this), fees); |
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.
Caller will have to approve LINK
to be sent to this DestinationMinter
, add note in the natspec?
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.
On that note, do we want to have a revokeApprovals
at the end of this function for LINK?
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.
Hmmm that is a good question. The router address is verified to be safe, and these contracts will not be holding any customer funds that are LINK. So it would probably only help us if for some reason the router did not transfer the link it said it would, and the LINK contract had ERC20 breaking logic like USDT where we revert when going from non zero allowance to non zero allowance.
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.
True, but since we know that is not the case with the LINK
contract, are you saying that we do not need to have a revokeApprovals
applied here?
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've looked through the changes, and discussed any lingering ones with you async. Any that are lingering will be added to the fix branch once the audit report is received from Macro.
PR Scope Details
Core Contracts
DestinationMinter.sol
(DM)DestinationMinterFactory.sol
(DMF)SourceLocker.sol
(SL)SourceLockerFactory.sol
(SLF)Sequence of Main Operations for Contracts
setDestinationMinterFactory()
such that they are properly connected.shareToken
via call:SourceLockerFactory.deploy()
callback
whereSourceLocker.setTargetDestination()
is finally called that finishes the setup of the DM & SL pair for said ERC20shareToken
param specified in initialdeploy()
call- Likely setup to start: