Skip to content
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(protocol): enhance nextTxId logics in DelegateOwner #17718

Merged
merged 15 commits into from
Jul 21, 2024
2 changes: 1 addition & 1 deletion packages/protocol/deployments/mainnet-contract-logs-L2.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@

#### delegate_owner

- proxy: `0x904aa0aC002532f1410457484893107757683F53`
- proxy: `0x2f46c57046672e71d02ed0f0b71dfa42c7f3c488`
- impl: `0x9F0C40A474E0FB6b27D71c43Aff840B9c42f0C44`
- admin: `0x8F13E3a9dFf52e282884aA70eAe93F57DD601298`
- remoteOwner: `0x8F13E3a9dFf52e282884aA70eAe93F57DD601298`
Expand Down
55 changes: 55 additions & 0 deletions packages/protocol/script/SendMessageToDelegateOwner.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import "forge-std/src/Script.sol";
import "../contracts/L2/DelegateOwner.sol";
import "../contracts/bridge/IBridge.sol";
import "../test/common/TestMulticall3.sol";

contract SendMessageToDelegateOwner is Script {
address public delegateOwner = 0x2F46C57046672E71d02ed0f0B71dFa42C7F3C488;
address public multicall3 = 0xcA11bde05977b3631167028862bE2a173976CA11;
address public l1Bridge = 0xd60247c6848B7Ca29eDdF63AA924E53dB6Ddd8EC;

modifier broadcast() {
vm.startBroadcast();
_;
vm.stopBroadcast();
}

function run() external broadcast {
TestMulticall3.Call3[] memory calls = new TestMulticall3.Call3[](2);
calls[0].target = address(delegateOwner);
calls[0].allowFailure = false;
calls[0].callData =
abi.encodeCall(DelegateOwner.setAdmin, (0x4757D97449acA795510b9f3152C6a9019A3545c3));

calls[1].target = address(delegateOwner);
calls[1].allowFailure = false;
calls[1].callData =
abi.encodeCall(DelegateOwner.setAdmin, (0x55d79345Afc87806B690C9f96c4D7BfE2Bca8268));

DelegateOwner.Call memory dcall = DelegateOwner.Call({
txId: 0, // Has to match with DelegateOwner's nextTxId
target: multicall3,
isDelegateCall: true,
txdata: abi.encodeCall(TestMulticall3.aggregate3, (calls))
});

IBridge.Message memory message = IBridge.Message({
id: 0,
fee: 0,
gasLimit: 1_000_000, // cannot be zero
from: msg.sender,
srcChainId: 1,
srcOwner: msg.sender,
destChainId: 167_000,
destOwner: delegateOwner,
to: delegateOwner,
value: 0,
data: abi.encode(dcall)
});

IBridge(l1Bridge).sendMessage(message);
}
}