Skip to content

chore: add details on migrate to native#194

Merged
hexshire merged 14 commits intodevfrom
chore/update-readme
May 13, 2025
Merged

chore: add details on migrate to native#194
hexshire merged 14 commits intodevfrom
chore/update-readme

Conversation

@hexshire
Copy link
Member

No description provided.

Co-authored-by: Disco <131301107+0xDiscotech@users.noreply.github.com>
Signed-off-by: Hex <165055168+hexshire@users.noreply.github.com>
@hexshire hexshire requested a review from 0xDiscotech May 1, 2025 16:37
0xDiscotech
0xDiscotech previously approved these changes May 1, 2025
1. Transfers the ownership of the Bridged USDC contract to the `_owner`
2. Transfer the admin rights of the Bridged USDC proxy to the `msg.sender` (a.k.a. `roleCaller`)
- L1 Sequence (MUST wait at least 7 days to execute this sequence).
1. Call `setBurnAmount`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does setBurnAmount get invoked automatically by a message sent from the L2 > L1 bridge contract or do we need to invoke this manually after the 7 day waiting period? If it needs to be invoked manually, which address is allowed to invoke this and how is the 7 day waiting period being enforced?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, is not invoked automatically. Any address can invoke it since the message is generated from the L2Adapter and the L1Adapter verify its origin. The waiting period is enforced by the bridge.

I will add this to the readme as well. Thanks.

README.md Outdated
1. Effects
1. Burns the USDC locked in the adapter based on the `burnAmount` variable or the contract balance.
2. Reset `burnAmount` and `burnCaller` variables, to avoid calling the function more than once.
3. `receiveWithdrawLockedFundsPostMigration` is enabled, this function handles the messages that were in-flight during the migration and were sent back from L2 by transferring the locked USDC to the user.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are in-flight deposits (L1 > L2 bridged USDC that hasn't been claimed on the L2) handled after the migration has been initiated? It would be nice to add another section here to describe in detail how both in-flight deposits and withdrawals are handled within this system.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are in-flight deposits (L1 > L2 bridged USDC that hasn't been claimed on the L2) handled after the migration has been initiated?

After the migration is started the incoming message on the L2 are sent back to the spender (the address that sent the message on L1). This is the part of the code that does it

if (messengerStatus == Status.Deprecated) {
uint32 _minGasLimit = 150_000;
// Return the funds to the spender in case the target on L2 is a contract that can´t handle the funds on L1
ICrossDomainMessenger(MESSENGER).sendMessage(
LINKED_ADAPTER, abi.encodeCall(IOpUSDCBridgeAdapter.receiveMessage, (_spender, _spender, _amount)), _minGasLimit
);
emit ReplayedFundsSentBackToL1(_spender, _amount);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to add another section here to describe in detail how both in-flight deposits and withdrawals are handled within this system.

Yes, what do you think about adding some flow diagrams.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh okay, makes sense! Yes, that would be great if we could add some flow diagrams.

Enables `setBurnAmount` that is only callable by the Linked Adapter.
3. Sends message to call `receiveMigrateToNative` on destination chain.
3. ⚠️ Note: Once this step is executed the bridges can’t be unpaused.
2. Call `receiveMigrateToNative` on L2 (Automatically relayed)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add some detail or a link to OP documentation for how messaging between the contracts works?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think will reference this document

hexshire and others added 6 commits May 8, 2025 10:02
Signed-off-by: Hex <165055168+hexshire@users.noreply.github.com>
Signed-off-by: Hex <165055168+hexshire@users.noreply.github.com>
Signed-off-by: Hex <165055168+hexshire@users.noreply.github.com>
Signed-off-by: Hex <165055168+hexshire@users.noreply.github.com>
@hexshire hexshire changed the base branch from main to dev May 13, 2025 18:42
@hexshire hexshire merged commit 1d1bb4d into dev May 13, 2025
5 checks passed
@hexshire hexshire deleted the chore/update-readme branch May 13, 2025 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants