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

chore: deploy bridged erc20 #106

Merged
merged 10 commits into from
Jan 18, 2024
20 changes: 20 additions & 0 deletions .gitleaksignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,23 @@ c4f2bb1997ed9f4689a807d494e7d29ed3c6bd2f:scripts/lbp/fjord_enable_swap.js:generi
1211a105fbf2894d275ffa4403e23e11aa3701fc:scripts/deployment/bridges/polygon/test/globals.json:generic-api-key:2
81391242dbc552ecb88a8dc3b2da7c719c5ea34e:scripts/deployment/bridges/polygon/test/globals.json:generic-api-key:1
81391242dbc552ecb88a8dc3b2da7c719c5ea34e:scripts/deployment/bridges/polygon/test/globals.json:generic-api-key:2
52ee9b78ab49877499cb0783ec769d9837a4e182:scripts/deployment/bridges/polygon/globals_polygon_mumbai.json:generic-api-key:1
52ee9b78ab49877499cb0783ec769d9837a4e182:scripts/deployment/bridges/polygon/globals_polygon_mumbai.json:generic-api-key:2
df38dbd04ed85cc71e8187bcdcc7689102e6ad4c:scripts/deployment/bridges/polygon/globals_polygon_mainnet.json:generic-api-key:1
df38dbd04ed85cc71e8187bcdcc7689102e6ad4c:scripts/deployment/bridges/polygon/globals_polygon_mainnet.json:generic-api-key:2
aade34222a0bbc96de45473df33e075fcc30e372:scripts/deployment/bridges/polygon/globals_polygon_mainnet.json:generic-api-key:1
aade34222a0bbc96de45473df33e075fcc30e372:scripts/deployment/bridges/polygon/globals_polygon_mainnet.json:generic-api-key:2
774c3b21da8bedbc86f9c4ceb49cfac018e4145e:scripts/deployment/globals_mainnet.json:generic-api-key:1
774c3b21da8bedbc86f9c4ceb49cfac018e4145e:scripts/deployment/globals_mainnet.json:generic-api-key:2
eb1fbc9c7b2bb0de048866ad04cf11da1c3aea6b:scripts/deployment/globals_mainnet.json:generic-api-key:1
eb1fbc9c7b2bb0de048866ad04cf11da1c3aea6b:scripts/deployment/globals_mainnet.json:generic-api-key:2
67967407006d4acd1dac6069f674f47c830e8d44:scripts/deployment/globals_mainnet.json:generic-api-key:1
67967407006d4acd1dac6069f674f47c830e8d44:scripts/deployment/globals_mainnet.json:generic-api-key:2
b4216a977cdf5e997dad6dd564b8e66e58f189da:scripts/deployment/globals_goerli.json:generic-api-key:1
b4216a977cdf5e997dad6dd564b8e66e58f189da:scripts/deployment/globals_goerli.json:generic-api-key:2
b4216a977cdf5e997dad6dd564b8e66e58f189da:scripts/deployment/bridges/polygon/globals_polygon_mumbai.json:generic-api-key:1
b4216a977cdf5e997dad6dd564b8e66e58f189da:scripts/deployment/bridges/polygon/globals_polygon_mumbai.json:generic-api-key:2
bd442a4d40914bfc4d062cc5625b5b3d532328d8:scripts/deployment/bridges/polygon/globals_polygon_mumbai.json:generic-api-key:1
bd442a4d40914bfc4d062cc5625b5b3d532328d8:scripts/deployment/bridges/polygon/globals_polygon_mumbai.json:generic-api-key:2
bd442a4d40914bfc4d062cc5625b5b3d532328d8:scripts/deployment/globals_goerli.json:generic-api-key:1
bd442a4d40914bfc4d062cc5625b5b3d532328d8:scripts/deployment/globals_goerli.json:generic-api-key:2
4 changes: 2 additions & 2 deletions abis/0.8.23/FxERC20ChildTunnel.json

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions docs/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@
"name": "GuardCM",
"artifact": "abis/0.8.21/GuardCM.json",
"address": "0x1a0bADb278dE44E261DEC9f4225E3DD761336DA8"
},
{
"name": "BridgedERC20",
"artifact": "abis/0.8.23/BridgedERC20.json",
"address": "0x06512E620A8317da51a73690A596Aca97287b31D"
},
{
"name": "FxERC20RootTunnel",
"artifact": "abis/0.8.23/FxERC20RootTunnel.json",
"address": "0x1737408def992AF04b29C8Ba4BBcD7397B08c930"
}
]
},
Expand Down Expand Up @@ -78,6 +88,16 @@
"name": "GuardCM",
"artifact": "abis/0.8.21/GuardCM.json",
"address": "0x1F4C3134aFB97DE2BfBBF28894d24F58D0A95eFC"
},
{
"name": "BridgedERC20",
"artifact": "abis/0.8.23/BridgedERC20.json",
"address": "0x0CF8ad7AD779157a253964036af0e95f625EA27c"
},
{
"name": "FxERC20RootTunnel",
"artifact": "abis/0.8.23/FxERC20RootTunnel.json",
"address": "0x7E335396a9804097Fd7c04F8b3adc314Ca9398A0"
}
]
},
Expand All @@ -89,6 +109,11 @@
"name": "FxGovernorTunnel",
"artifact": "abis/0.8.19/FxGovernorTunnel.json",
"address": "0x9338b5153AE39BB89f50468E608eD9d764B755fD"
},
{
"name": "FxERC20ChildTunnel",
"artifact": "abis/0.8.23/FxERC20ChildTunnel.json",
"address": "0x1fe74A08ac89300B102AdCd474C721AE8764E850"
}
]
},
Expand All @@ -100,6 +125,11 @@
"name": "FxGovernorTunnel",
"artifact": "abis/0.8.19/FxGovernorTunnel.json",
"address": "0x17806E2a12d5E0F48C9803cd397DB3F044DA3b77"
},
{
"name": "FxERC20ChildTunnel",
"artifact": "abis/0.8.23/FxERC20ChildTunnel.json",
"address": "0x5b5C7BA8424e6B48f92Ac02980FFc2531c3196DF"
}
]
},
Expand Down
82 changes: 81 additions & 1 deletion scripts/audit_chains/audit_contracts_setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,20 @@ async function checkGuardCM(chainId, provider, globalsInstance, configContracts,
customExpect(multisig, globalsInstance["CM"], log + ", function: multisig()");
}

// Check bridgedERC20: chain Id, provider, parsed globals, configuration contracts, contract name
async function checkBridgedERC20(chainId, provider, globalsInstance, configContracts, contractName, log) {
// Check the bytecode
await checkBytecode(provider, configContracts, contractName, log);

// Get the contract instance
const bridgedERC20 = await findContractInstance(provider, configContracts, contractName);

log += ", address: " + bridgedERC20.address;
// Check the owner
const owner = await bridgedERC20.owner();
customExpect(owner, globalsInstance["fxERC20RootTunnelAddress"], log + ", function: owner()");
}

// Check FxGovernorTunnel: chain Id, provider, parsed globals, configuration contracts, contract name
async function checkFxGovernorTunnel(chainId, provider, globalsInstance, configContracts, contractName, log) {
// Check the bytecode
Expand All @@ -260,6 +274,62 @@ async function checkFxGovernorTunnel(chainId, provider, globalsInstance, configC
customExpect(fxChild, globalsInstance["fxChildAddress"], log + ", function: fxChild()");
}

// Check FxERC20ChildTunnel: chain Id, provider, parsed globals, configuration contracts, contract name
async function checkFxERC20ChildTunnel(chainId, provider, globalsInstance, configContracts, contractName, log) {
// Check the bytecode
await checkBytecode(provider, configContracts, contractName, log);

// Get the contract instance
const fxERC20ChildTunnel = await findContractInstance(provider, configContracts, contractName);

log += ", address: " + fxERC20ChildTunnel.address;
// Check the child token
const childToken = await fxERC20ChildTunnel.childToken();
customExpect(childToken, globalsInstance["childTokenAddress"], log + ", function: childToken()");

// Check the root token
const rootToken = await fxERC20ChildTunnel.rootToken();
customExpect(rootToken, globalsInstance["bridgedERC20Address"], log + ", function: rootToken()");

// Check fxChild
const fxChild = await fxERC20ChildTunnel.fxChild();
customExpect(fxChild, globalsInstance["fxChildAddress"], log + ", function: fxChild()");

// Check the fxRootTunnel
const fxRootTunnel = await fxERC20ChildTunnel.fxRootTunnel();
customExpect(fxRootTunnel, globalsInstance["fxERC20RootTunnelAddress"], log + ", function: fxRootTunnel()");
}

// Check FxERC20RootTunnel: chain Id, provider, parsed globals, configuration contracts, contract name
async function checkFxERC20RootTunnel(chainId, provider, globalsInstance, configContracts, contractName, log) {
// Check the bytecode
await checkBytecode(provider, configContracts, contractName, log);

// Get the contract instance
const fxERC20RootTunnel = await findContractInstance(provider, configContracts, contractName);

log += ", address: " + fxERC20RootTunnel.address;
// Check the child token
const childToken = await fxERC20RootTunnel.childToken();
customExpect(childToken, globalsInstance["childTokenAddress"], log + ", function: childToken()");

// Check the root token
const rootToken = await fxERC20RootTunnel.rootToken();
customExpect(rootToken, globalsInstance["bridgedERC20Address"], log + ", function: rootToken()");

// Check fxRoot
const fxRoot = await fxERC20RootTunnel.fxRoot();
customExpect(fxRoot, globalsInstance["fxRootAddress"], log + ", function: fxChild()");

// Check the fxChildTunnel
const fxChildTunnel = await fxERC20RootTunnel.fxChildTunnel();
customExpect(fxChildTunnel, globalsInstance["fxERC20ChildTunnelAddress"], log + ", function: fxChildTunnel()");

// Check the checkpointManager
const checkpointManager = await fxERC20RootTunnel.checkpointManager();
customExpect(checkpointManager, globalsInstance["checkpointManagerAddress"], log + ", function: checkpointManager()");
}

// Check HomeMediator: chain Id, provider, parsed globals, configuration contracts, contract name
async function checkHomeMediator(chainId, provider, globalsInstance, configContracts, contractName, log) {
// Check the bytecode
Expand Down Expand Up @@ -384,6 +454,12 @@ async function main() {

log = initLog + ", contract: " + "GuardCM";
await checkGuardCM(configs[i]["chainId"], providers[i], globals[i], configs[i]["contracts"], "GuardCM", log);

log = initLog + ", contract: " + "BridgedERC20";
await checkBridgedERC20(configs[i]["chainId"], providers[i], globals[i], configs[i]["contracts"], "BridgedERC20", log);

log = initLog + ", contract: " + "FxERC20RootTunnel";
await checkFxERC20RootTunnel(configs[i]["chainId"], providers[i], globals[i], configs[i]["contracts"], "FxERC20RootTunnel", log);
}

// L2 contracts
Expand All @@ -392,10 +468,14 @@ async function main() {

const initLog = "ChainId: " + configs[i]["chainId"] + ", network: " + configs[i]["name"];

let log = initLog + ", contract: " + "BridgeMediator";
if (configs[i]["chainId"] == "137" || configs[i]["chainId"] == "80001") {
let log = initLog + ", contract: " + "FxGovernorTunnel";
await checkFxGovernorTunnel(configs[i]["chainId"], providers[i], globals[i], configs[i]["contracts"], "FxGovernorTunnel", log);

log = initLog + ", contract: " + "FxERC20ChildTunnel";
await checkFxERC20ChildTunnel(configs[i]["chainId"], providers[i], globals[i], configs[i]["contracts"], "FxERC20ChildTunnel", log);
} else {
let log = initLog + ", contract: " + "HomeMediator";
await checkHomeMediator(configs[i]["chainId"], providers[i], globals[i], configs[i]["contracts"], "HomeMediator", log);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ async function main() {
console.log("4. FxERC20ChildTunnel to set root tunnel to FxERC20RootTunnel");
const fxERC20ChildTunnel = await ethers.getContractAt("FxERC20ChildTunnel", fxERC20ChildTunnelAddress);
console.log("You are signing the following transaction: FxERC20ChildTunnel.connect(EOA).setFxRootTunnel(FxERC20RootTunnel)");
const gasPriceInGwei = "230";
const gasPriceInGwei = "110";
const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei");
const result = await fxERC20ChildTunnel.setFxRootTunnel(fxERC20RootTunnelAddress, { gasPrice });
const result = await fxERC20ChildTunnel.connect(EOA).setFxRootTunnel(fxERC20RootTunnelAddress, { gasPrice });

// Transaction details
console.log("Contract deployment: FxERC20ChildTunnel");
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"contractVerification":true,"useLedger":true,"derivationPath":"m/44'/60'/2'/0/0","providerName":"polygon","fxChildAddress":"0x8397259c983751DAf40400790063935a11afa28a","timelockAddress":"0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE","fxGovernorTunnelAddress":"0x9338b5153AE39BB89f50468E608eD9d764B755fD"}
{"contractVerification":true,"useLedger":true,"derivationPath":"m/44'/60'/2'/0/0","providerName":"polygon","fxChildAddress":"0x8397259c983751DAf40400790063935a11afa28a","timelockAddress":"0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE","fxGovernorTunnelAddress":"0x9338b5153AE39BB89f50468E608eD9d764B755fD","childTokenAddress":"0x62309056c759c36879Cde93693E7903bF415E4Bc","bridgedERC20Address":"0x06512E620A8317da51a73690A596Aca97287b31D","fxERC20ChildTunnelAddress":"0x1fe74A08ac89300B102AdCd474C721AE8764E850", "fxERC20RootTunnelAddress": "0x1737408def992AF04b29C8Ba4BBcD7397B08c930"}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"contractVerification":true,"useLedger":false,"derivationPath":"m/44'/60'/2'/0/0","providerName":"polygonMumbai","fxChildAddress":"0xCf73231F28B7331BBe3124B907840A94851f9f11","timelockAddress":"0x34C895f302D0b5cf52ec0Edd3945321EB0f83dd5","fxGovernorTunnelAddress":"0x17806E2a12d5E0F48C9803cd397DB3F044DA3b77"}
{"contractVerification":true,"useLedger":false,"derivationPath":"m/44'/60'/2'/0/0","providerName":"polygonMumbai","fxChildAddress":"0xCf73231F28B7331BBe3124B907840A94851f9f11","timelockAddress":"0x34C895f302D0b5cf52ec0Edd3945321EB0f83dd5","fxGovernorTunnelAddress":"0x17806E2a12d5E0F48C9803cd397DB3F044DA3b77","childTokenAddress":"0x93Cd3f6DcE64d67f4420939865A00aC89776D4b5","checkpointManagerAddress":"0x2890bA17EfE978480615e330ecB65333b880928e","fxERC20ChildTunnelAddress":"0x5b5C7BA8424e6B48f92Ac02980FFc2531c3196DF","bridgedERC20Address":"0x0CF8ad7AD779157a253964036af0e95f625EA27c","fxERC20RootTunnelAddress":"0x7E335396a9804097Fd7c04F8b3adc314Ca9398A0"}
10 changes: 1 addition & 9 deletions scripts/deployment/deploy_19_bridged_erc20.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,7 @@ async function main() {
const BridgedERC20 = await ethers.getContractFactory("BridgedERC20");
console.log("You are signing the following transaction: BridgedERC20.connect(EOA).deploy()");

// *********** DELETE THESE LINES ***********
console.log("Define proper token name and symbol, then delete this line");
const skip = true;
if (skip) {
return;
}
// *********** DELETE THESE LINES ***********

const bridgedERC20 = await BridgedERC20.connect(EOA).deploy("ERC20 bridged token", "BridgedERC20", 18);
const bridgedERC20 = await BridgedERC20.connect(EOA).deploy("50WMATIC-50OLAS from Polygon (POS)", "W-50WMATIC-50OLAS", 18);
let result = await bridgedERC20.deployed();

// Transaction details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async function main() {
console.log("21. EOA to change owner of BridgedERC20 to FxERC20RootTunnel");
const bridgedERC20 = await ethers.getContractAt("BridgedERC20", bridgedERC20Address);
console.log("You are signing the following transaction: bridgedERC20.connect(EOA).changeOwner(FxERC20RootTunnel)");
let result = await bridgedERC20.changeOwner(fxERC20RootTunnelAddress);
let result = await bridgedERC20.connect(EOA).changeOwner(fxERC20RootTunnelAddress);

// Transaction details
console.log("Contract deployment: BridgedERC20");
Expand All @@ -42,7 +42,7 @@ async function main() {
console.log("22. FxERC20RootTunnel to set child tunnel to FxERC20ChildTunnel");
const fxERC20RootTunnel = await ethers.getContractAt("FxERC20RootTunnel", fxERC20RootTunnelAddress);
console.log("You are signing the following transaction: fxERC20RootTunnel.connect(EOA).setFxChildTunnel(FxERC20ChildTunnel)");
result = await fxERC20RootTunnel.setFxChildTunnel(fxERC20ChildTunnelAddress);
result = await fxERC20RootTunnel.connect(EOA).setFxChildTunnel(fxERC20ChildTunnelAddress);

// Transaction details
console.log("Contract deployment: FxERC20RootTunnel");
Expand Down
2 changes: 1 addition & 1 deletion scripts/deployment/globals_goerli.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"contractVerification":true,"useLedger":false,"valoryMultisig":"0x87cc0d34f6111c8A7A4Bdf758a9a715A3675f941","derivationPath":"m/44'/60'/2'/0/0","CM":"0x04C06323Fe3D53Deb7364c0055E1F68458Cc2570","providerName":"goerli","olasSaltString":"0x0001a5","timelockMinDelay":"5","veOlasSaltString":"0x7e01a5","initialVotingDelay":"20","initialVotingPeriod":"80","initialProposalThreshold":"1000000000000000000000","quorum":"1","initSupply":"526500000000000000000000000","timelockSupply":"100000000000000000000000000","saleSupply":"301500000000000000000000000","valorySupply":"125000000000000000000000000","GnosisSafe":"0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552","GnosisSafeProxyFactory":"0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2","MultiSendCallOnly":"0x40A2aCCbd92BCA938b02010E17A5b8929b49130D","deploymentFactory":"0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE","olasAddress":"0xEdfc28215B1Eb6eb0be426f1f529cf691A5C2400","timelockAddress":"0x34C895f302D0b5cf52ec0Edd3945321EB0f83dd5","veOLASAddress":"0xf8B20e160557c747E8640CdcE77E1dd44bCaAfbB","governorAddress":"0xBb7e1D6Cb6F243D6bdE81CE92a9f2aFF7Fbe7eac","buOLASAddress":"0x397125902ED2cA2d42104F621f448A2cE1bC8Fb7","wveOLASAddress":"0xa2AA89938805836077aB0724f335142da7A27085","governorTwoAddress":"0x63b0f322837a7160B7E3d95C60aAaeB4EF1aECcb","treasuryAddress":"0x7bedCA17D29e53C8062d10902a6219F8d1E3B9B5","guardCMAddress":"0x1F4C3134aFB97DE2BfBBF28894d24F58D0A95eFC","fxRootAddress":"0x3d1d3E34f7fB6D26245E6640E1c50710eFFf15bA","checkpointManagerAddress":"0x2890bA17EfE978480615e330ecB65333b880928e"}
{"contractVerification":true,"useLedger":false,"valoryMultisig":"0x87cc0d34f6111c8A7A4Bdf758a9a715A3675f941","derivationPath":"m/44'/60'/2'/0/0","CM":"0x04C06323Fe3D53Deb7364c0055E1F68458Cc2570","providerName":"goerli","olasSaltString":"0x0001a5","timelockMinDelay":"5","veOlasSaltString":"0x7e01a5","initialVotingDelay":"20","initialVotingPeriod":"80","initialProposalThreshold":"1000000000000000000000","quorum":"1","initSupply":"526500000000000000000000000","timelockSupply":"100000000000000000000000000","saleSupply":"301500000000000000000000000","valorySupply":"125000000000000000000000000","GnosisSafe":"0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552","GnosisSafeProxyFactory":"0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2","MultiSendCallOnly":"0x40A2aCCbd92BCA938b02010E17A5b8929b49130D","deploymentFactory":"0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE","olasAddress":"0xEdfc28215B1Eb6eb0be426f1f529cf691A5C2400","timelockAddress":"0x34C895f302D0b5cf52ec0Edd3945321EB0f83dd5","veOLASAddress":"0xf8B20e160557c747E8640CdcE77E1dd44bCaAfbB","governorAddress":"0xBb7e1D6Cb6F243D6bdE81CE92a9f2aFF7Fbe7eac","buOLASAddress":"0x397125902ED2cA2d42104F621f448A2cE1bC8Fb7","wveOLASAddress":"0xa2AA89938805836077aB0724f335142da7A27085","governorTwoAddress":"0x63b0f322837a7160B7E3d95C60aAaeB4EF1aECcb","treasuryAddress":"0x7bedCA17D29e53C8062d10902a6219F8d1E3B9B5","guardCMAddress":"0x1F4C3134aFB97DE2BfBBF28894d24F58D0A95eFC","fxRootAddress":"0x3d1d3E34f7fB6D26245E6640E1c50710eFFf15bA","checkpointManagerAddress":"0x2890bA17EfE978480615e330ecB65333b880928e","bridgedERC20Address":"0x0CF8ad7AD779157a253964036af0e95f625EA27c","fxERC20RootTunnelAddress":"0x7E335396a9804097Fd7c04F8b3adc314Ca9398A0","childTokenAddress":"0x93Cd3f6DcE64d67f4420939865A00aC89776D4b5","fxERC20ChildTunnelAddress":"0x5b5C7BA8424e6B48f92Ac02980FFc2531c3196DF"}
Loading
Loading