Skip to content

Commit 5dbd50e

Browse files
committed
feedback
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
1 parent 745beaf commit 5dbd50e

File tree

6 files changed

+94
-54
lines changed

6 files changed

+94
-54
lines changed

foundry.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ test = "test/evm/foundry"
99
libs = ["node_modules", "lib"]
1010
cache_path = "cache-foundry"
1111
via_ir = true
12-
optimizer_runs = 300
12+
optimizer_runs = 800
1313
solc_version = "0.8.30"
1414
revert_strings = "strip"
1515
fs_permissions = [{ access = "read-write", path = "./" }]
@@ -27,6 +27,10 @@ fallback_oz = true
2727
mode = '3'
2828
zksolc = "1.5.15"
2929

30+
[profile.mintburn]
31+
# Mint/burn contracts need to be compiled with 300 runs to avoide going over contract size limit
32+
optimizer_runs = 300
33+
3034
[rpc_endpoints]
3135
arbitrum = "${NODE_URL_42161}"
3236
base = "${NODE_URL_8453}"

script/mintburn/cctp/DeploySponsoredCCTPDstPeriphery.s.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ contract DeploySponsoredCCTPDstPeriphery is DeploymentUtils {
5252

5353
vm.stopBroadcast();
5454

55+
config.set("sponsoredCCTPDstPeriphery", address(sponsoredCCTPDstPeriphery));
56+
5557
// Post-deployment verification.
5658
assertEq(address(sponsoredCCTPDstPeriphery.cctpMessageTransmitter()), cctpMessageTransmitter);
5759
assertEq(sponsoredCCTPDstPeriphery.baseToken(), baseToken);
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// SPDX-License-Identifier: BUSL-1.1
2+
pragma solidity ^0.8.0;
3+
4+
import { console } from "forge-std/console.sol";
5+
6+
import { DeploymentUtils } from "../../utils/DeploymentUtils.sol";
7+
8+
// How to run:
9+
// 1. source .env (needs MNEMONIC and the relevant NODE_URL_*)
10+
// 2. forge script script/mintburn/cctp/SetUpTokens.s.sol:SetUpTokens --rpc-url <chain> --sig "run(string)" <chain> -vvvv
11+
contract SetUpTokens is DeploymentUtils {
12+
function run(string calldata chain) external {
13+
console.log("Setting up core token info...");
14+
console.log("Chain ID:", block.chainid);
15+
16+
string memory deployerMnemonic = vm.envString("MNEMONIC");
17+
uint256 deployerPrivateKey = vm.deriveKey(deployerMnemonic, 0);
18+
address deployer = vm.addr(deployerPrivateKey);
19+
console.log("Deployer:", deployer);
20+
21+
_loadConfig("./script/mintburn/cctp/config.toml", false);
22+
23+
address dstPeriphery = config.get("sponsoredCCTPDstPeriphery").toAddress();
24+
address baseToken = config.get("baseToken").toAddress();
25+
uint256 coreIndex = config.get("coreIndex").toUint256();
26+
uint256 accountActivationFeeCore = config.get("accountActivationFeeCore").toUint256();
27+
uint256 bridgeSafetyBufferCore = config.get("bridgeSafetyBufferCore").toUint256();
28+
bool canBeUsedForAccountActivation = config.get("canBeUsedForAccountActivation").toBool();
29+
30+
string memory chain = chain;
31+
string memory dstPeripheryStr = vm.toString(dstPeriphery);
32+
string memory baseTokenStr = vm.toString(baseToken);
33+
string memory coreIndexStr = vm.toString(coreIndex);
34+
string memory accountActivationFeeCoreStr = vm.toString(accountActivationFeeCore);
35+
string memory bridgeSafetyBufferCoreStr = vm.toString(bridgeSafetyBufferCore);
36+
string memory canBeUsedForAccountActivationStr = canBeUsedForAccountActivation ? "true" : "false";
37+
38+
// 1. Check DEFAULT_ADMIN_ROLE
39+
console.log("# Checking DEFAULT_ADMIN_ROLE...");
40+
string[] memory callCmd = new string[](6);
41+
callCmd[0] = "cast";
42+
callCmd[1] = "call";
43+
callCmd[2] = dstPeripheryStr;
44+
callCmd[3] = "DEFAULT_ADMIN_ROLE()(bytes32)";
45+
callCmd[4] = "--rpc-url";
46+
callCmd[5] = chain;
47+
bytes memory roleResult = vm.ffi(callCmd);
48+
// vm.ffi hex-decodes output starting with 0x, so convert raw bytes back to a hex string.
49+
string memory role = vm.toString(bytes32(roleResult));
50+
console.log("DEFAULT_ADMIN_ROLE:", role);
51+
52+
// 2. Check if deployer has DEFAULT_ADMIN_ROLE
53+
console.log("# Checking if deployer has DEFAULT_ADMIN_ROLE...");
54+
string[] memory hasRoleCmd = new string[](8);
55+
hasRoleCmd[0] = "cast";
56+
hasRoleCmd[1] = "call";
57+
hasRoleCmd[2] = dstPeripheryStr;
58+
hasRoleCmd[3] = "hasRole(bytes32,address)(bool)";
59+
hasRoleCmd[4] = role;
60+
hasRoleCmd[5] = vm.toString(deployer);
61+
hasRoleCmd[6] = "--rpc-url";
62+
hasRoleCmd[7] = chain;
63+
bytes memory hasRoleResult = vm.ffi(hasRoleCmd);
64+
console.log("Deployer has admin role:", string(hasRoleResult));
65+
66+
// 3. Set core token info
67+
console.log("# Setting core token info...");
68+
string[] memory sendCmd = new string[](13);
69+
sendCmd[0] = "cast";
70+
sendCmd[1] = "send";
71+
sendCmd[2] = dstPeripheryStr;
72+
sendCmd[3] = "setCoreTokenInfo(address,uint32,bool,uint64,uint64)";
73+
sendCmd[4] = baseTokenStr;
74+
sendCmd[5] = coreIndexStr;
75+
sendCmd[6] = canBeUsedForAccountActivationStr;
76+
sendCmd[7] = accountActivationFeeCoreStr;
77+
sendCmd[8] = bridgeSafetyBufferCoreStr;
78+
sendCmd[9] = "--account";
79+
sendCmd[10] = "dev";
80+
sendCmd[11] = "--rpc-url";
81+
sendCmd[12] = chain;
82+
83+
bytes memory sendResult = vm.ffi(sendCmd);
84+
console.log("setCoreTokenInfo result:", string(sendResult));
85+
}
86+
}

script/mintburn/cctp/config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ sponsoredCCTPSrcPeriphery = "0xc611D7c33d1C7915F13ef35f488EAee9D9DC3555"
132132
cctpMessageTransmitter = "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"
133133
baseToken = "0xb88339CB7199b77E23DB6E890353E22632Ba630f"
134134
multicallHandler = "0xfD0876712DD9003D014CDCd8e5140B4EFAC9BFCC"
135+
sponsoredCCTPDstPeriphery = "0x478d451e101be484880a14cf3ccc293cd48e6140"
135136

136137
[999.uint]
137138
cctpDomainId = 19
File renamed without changes.

script/mintburn/cctp/setUpTokens.sol

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)