diff --git a/.gitleaksignore b/.gitleaksignore index ec28b402..57793f77 100644 --- a/.gitleaksignore +++ b/.gitleaksignore @@ -142,3 +142,23 @@ ea6713128995ac18f3911c0214163e2b82896a7f:scripts/deployment/globals_mainnet.json 1a7a855a853d2bc21e1e9178754a22dae54439f3:scripts/deployment/staking/globals_mainnet.json:generic-api-key:2 3c5c0643bfa60605d7b91eb4b7a4b80c6f7a1b43:scripts/deployment/staking/globals_mainnet.json:generic-api-key:1 3c5c0643bfa60605d7b91eb4b7a4b80c6f7a1b43:scripts/deployment/staking/globals_mainnet.json:generic-api-key:2 +b17bdd0ebae90b769b8756da81d831a70fcb4af3:scripts/deployment/globals_mainnet.json:generic-api-key:1 +b17bdd0ebae90b769b8756da81d831a70fcb4af3:scripts/deployment/staking/globals_mainnet.json:generic-api-key:1 +b17bdd0ebae90b769b8756da81d831a70fcb4af3:scripts/deployment/globals_mainnet.json:generic-api-key:2 +b17bdd0ebae90b769b8756da81d831a70fcb4af3:scripts/deployment/staking/globals_mainnet.json:generic-api-key:2 +c5ba11d1b46a6fa9644c0de28b4b0f7b154156ee:scripts/deployment/globals_mainnet.json:generic-api-key:1 +c5ba11d1b46a6fa9644c0de28b4b0f7b154156ee:scripts/deployment/globals_mainnet.json:generic-api-key:2 +c5ba11d1b46a6fa9644c0de28b4b0f7b154156ee:scripts/deployment/staking/globals_mainnet.json:generic-api-key:1 +c5ba11d1b46a6fa9644c0de28b4b0f7b154156ee:scripts/deployment/staking/globals_mainnet.json:generic-api-key:2 +7cf3cd1c5fa705f82f0f33c90538fa6e6892af5b:scripts/deployment/globals_mainnet.json:generic-api-key:1 +7cf3cd1c5fa705f82f0f33c90538fa6e6892af5b:scripts/deployment/staking/globals_mainnet.json:generic-api-key:1 +7cf3cd1c5fa705f82f0f33c90538fa6e6892af5b:scripts/deployment/globals_mainnet.json:generic-api-key:2 +7cf3cd1c5fa705f82f0f33c90538fa6e6892af5b:scripts/deployment/staking/globals_mainnet.json:generic-api-key:2 +38ff93e8e51ef86b6c46872b12e27f67152ec07a:scripts/deployment/staking/wormhole/test/globals_celo_mainnet.json:generic-api-key:1 +38ff93e8e51ef86b6c46872b12e27f67152ec07a:scripts/deployment/staking/wormhole/test/globals_celo_mainnet.json:generic-api-key:2 +38ff93e8e51ef86b6c46872b12e27f67152ec07a:scripts/deployment/staking/wormhole/globals_celo_mainnet.json:generic-api-key:1 +38ff93e8e51ef86b6c46872b12e27f67152ec07a:scripts/deployment/staking/wormhole/globals_celo_mainnet.json:generic-api-key:2 +cfe4b8064bfda91d83bd5bdc5af44f2155859ef3:scripts/deployment/staking/wormhole/test/globals_celo_mainnet.json:generic-api-key:1 +cfe4b8064bfda91d83bd5bdc5af44f2155859ef3:scripts/deployment/staking/wormhole/test/globals_celo_mainnet.json:generic-api-key:2 +cfe4b8064bfda91d83bd5bdc5af44f2155859ef3:scripts/deployment/staking/wormhole/globals_celo_mainnet.json:generic-api-key:1 +cfe4b8064bfda91d83bd5bdc5af44f2155859ef3:scripts/deployment/staking/wormhole/globals_celo_mainnet.json:generic-api-key:2 diff --git a/scripts/deployment/globals_mainnet.json b/scripts/deployment/globals_mainnet.json index a8ef5b0b..c11ac1ac 100644 --- a/scripts/deployment/globals_mainnet.json +++ b/scripts/deployment/globals_mainnet.json @@ -1 +1 @@ -{"contractVerification":true,"useLedger":true,"derivationPath":"m/44'/60'/2'/0/0","providerName":"mainnet","olasAddress":"0x0001A500A6B18995B03f44bb040A5fFc28E45CB0","timelockAddress":"0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE","veOLASAddress":"0x7e01A500805f8A52Fad229b3015AD130A332B7b3","governorAddress":"0x34C895f302D0b5cf52ec0Edd3945321EB0f83dd5","governorTwoAddress":"0x4E3e48bA826b15214FDe72a50BFd17aB286B584E","componentRegistryAddress":"0x15bd56669F57192a97dF41A2aa8f4403e9491776","agentRegistryAddress":"0x2F1f7D38e4772884b88f3eCd8B6b9faCdC319112","serviceRegistryAddress":"0x48b6af7B12C71f09e2fC8aF4855De4Ff54e775cA","epochLen":"2592000","donatorBlacklistAddress":"0xE85791B18F5df42163092Acc5C9da1c479AFEa9d","tokenomicsAddress":"0x87f89F94033305791B6269AE2F9cF4e09983E56e","tokenomicsProxyAddress":"0xc096362fa6f4A4B1a9ea68b1043416f3381ce300","treasuryAddress":"0xa0DA53447C0f6C4987964d8463da7e6628B30f82","genericBondCalculatorAddress":"0x1521918961bDBC9Ed4C67a7103D5999e4130E6CB","depositoryAddress":"0x52A043bcebdB2f939BaEF2E8b6F01652290eAB3f","dispenserAddress":"0xeED0000fE94d7cfeF4Dc0CA86a223f0F603A61B8","tokenomicsTwoAddress":"0xD599ED4a5c45Fa66AA3C474b00701Fd452a2C30e","OLAS_ETH_PairAddress":"0x09D1d767eDF8Fa23A64C51fa559E0688E526812F","depositoryTwoAddress":"0xfF8697d8d2998d6AA2e09B405795C6F4BEeB0C81","XOLAS_WXDAI_PairAddress":"0x27df632fd0dcf191C418c803801D521cd579F18e","tokenomicsThreeAddress":"0x2C1633765c66a7CF0EC801a1046347bBee7344C9","voteWeightingAddress":"","retainerAddress":"0x000000000000000000000000000000000000000000000000000000000000dEaD","maxNumClaimingEpochs":"1","maxNumStakingTargets":"10","minStakingWeight":"","maxStakingIncentive":""} \ No newline at end of file +{"contractVerification":true,"useLedger":true,"derivationPath":"m/44'/60'/2'/0/0","providerName":"mainnet","olasAddress":"0x0001A500A6B18995B03f44bb040A5fFc28E45CB0","timelockAddress":"0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE","veOLASAddress":"0x7e01A500805f8A52Fad229b3015AD130A332B7b3","governorAddress":"0x34C895f302D0b5cf52ec0Edd3945321EB0f83dd5","governorTwoAddress":"0x4E3e48bA826b15214FDe72a50BFd17aB286B584E","componentRegistryAddress":"0x15bd56669F57192a97dF41A2aa8f4403e9491776","agentRegistryAddress":"0x2F1f7D38e4772884b88f3eCd8B6b9faCdC319112","serviceRegistryAddress":"0x48b6af7B12C71f09e2fC8aF4855De4Ff54e775cA","epochLen":"2592000","donatorBlacklistAddress":"0xE85791B18F5df42163092Acc5C9da1c479AFEa9d","tokenomicsAddress":"0x87f89F94033305791B6269AE2F9cF4e09983E56e","tokenomicsProxyAddress":"0xc096362fa6f4A4B1a9ea68b1043416f3381ce300","treasuryAddress":"0xa0DA53447C0f6C4987964d8463da7e6628B30f82","genericBondCalculatorAddress":"0x1521918961bDBC9Ed4C67a7103D5999e4130E6CB","depositoryAddress":"0x52A043bcebdB2f939BaEF2E8b6F01652290eAB3f","dispenserAddress":"0xeED0000fE94d7cfeF4Dc0CA86a223f0F603A61B8","tokenomicsTwoAddress":"0xD599ED4a5c45Fa66AA3C474b00701Fd452a2C30e","OLAS_ETH_PairAddress":"0x09D1d767eDF8Fa23A64C51fa559E0688E526812F","depositoryTwoAddress":"0xfF8697d8d2998d6AA2e09B405795C6F4BEeB0C81","XOLAS_WXDAI_PairAddress":"0x27df632fd0dcf191C418c803801D521cd579F18e","tokenomicsThreeAddress":"0x2C1633765c66a7CF0EC801a1046347bBee7344C9","voteWeightingAddress":"0x95418b46d5566D3d1ea62C12Aea91227E566c5c1","retainerAddress":"0x000000000000000000000000000000000000000000000000000000000000dEaD","maxNumClaimingEpochs":"1","maxNumStakingTargets":"10","minStakingWeight":"100","maxStakingIncentive":""} \ No newline at end of file diff --git a/scripts/deployment/staking/arbitrum/send_tokens_and_message.js b/scripts/deployment/staking/arbitrum/send_tokens_and_message.js index a691b901..482790f2 100644 --- a/scripts/deployment/staking/arbitrum/send_tokens_and_message.js +++ b/scripts/deployment/staking/arbitrum/send_tokens_and_message.js @@ -163,7 +163,7 @@ const main = async () => { await tx.wait(); // tx back to L1: https://sepolia.arbiscan.io/tx/0xea8119b1030bb223a896680d9c4ea03877beee08927ef1b8a9532ce48db68c55 - // Finalized tx on L1: + // Finalized tx on L1: https://sepolia.etherscan.io/tx/0x5f61dd72b5feb31af563f7af76402e523e1e871bdac7f1a82bb0ffefcd333ebb // Use the following script to finalize L2-L1 transaction: // https://github.com/OffchainLabs/arbitrum-tutorials/blob/master/packages/outbox-execute/scripts/exec.js diff --git a/scripts/deployment/staking/base/deploy_07_base_targer_dispenser.js b/scripts/deployment/staking/base/deploy_07_base_targer_dispenser.js new file mode 100644 index 00000000..13bd32fc --- /dev/null +++ b/scripts/deployment/staking/base/deploy_07_base_targer_dispenser.js @@ -0,0 +1,75 @@ +/*global process*/ + +const { ethers } = require("hardhat"); +const { LedgerSigner } = require("@anders-t/ethers-ledger"); + +async function main() { + const fs = require("fs"); + const globalsFile = "globals.json"; + const dataFromJSON = fs.readFileSync(globalsFile, "utf8"); + let parsedData = JSON.parse(dataFromJSON); + const useLedger = parsedData.useLedger; + const derivationPath = parsedData.derivationPath; + const providerName = parsedData.providerName; + + let networkURL = parsedData.networkURL; + if (providerName === "polygon") { + if (!process.env.ALCHEMY_API_KEY_MATIC) { + console.log("set ALCHEMY_API_KEY_MATIC env variable"); + } + networkURL += process.env.ALCHEMY_API_KEY_MATIC; + } else if (providerName === "polygonAmoy") { + if (!process.env.ALCHEMY_API_KEY_AMOY) { + console.log("set ALCHEMY_API_KEY_AMOY env variable"); + return; + } + networkURL += process.env.ALCHEMY_API_KEY_AMOY; + } + + const provider = new ethers.providers.JsonRpcProvider(networkURL); + const signers = await ethers.getSigners(); + + let EOA; + if (useLedger) { + EOA = new LedgerSigner(provider, derivationPath); + } else { + EOA = signers[0]; + } + // EOA address + const deployer = await EOA.getAddress(); + console.log("EOA is:", deployer); + + // Transaction signing and execution + console.log("7. EOA to deploy OptimismTargetDispenserL2 for Base"); + const OptimismTargetDispenserL2 = await ethers.getContractFactory("OptimismTargetDispenserL2"); + console.log("You are signing the following transaction: OptimismTargetDispenserL2.connect(EOA).deploy()"); + const baseTargetDispenserL2 = await OptimismTargetDispenserL2.connect(EOA).deploy(parsedData.olasAddress, + parsedData.serviceStakingFactoryAddress, parsedData.baseL2CrossDomainMessengerAddress, + parsedData.baseDepositProcessorL1Address, parsedData.l1ChainId); + const result = await baseTargetDispenserL2.deployed(); + + // Transaction details + console.log("Contract deployment: OptimismTargetDispenserL2"); + console.log("Contract address:", baseTargetDispenserL2.address); + console.log("Transaction:", result.deployTransaction.hash); + + // Wait for half a minute for the transaction completion + await new Promise(r => setTimeout(r, 30000)); + + // Writing updated parameters back to the JSON file + parsedData.baseTargetDispenserL2Address = baseTargetDispenserL2.address; + fs.writeFileSync(globalsFile, JSON.stringify(parsedData)); + + // Contract verification + if (parsedData.contractVerification) { + const execSync = require("child_process").execSync; + execSync("npx hardhat verify --constructor-args scripts/deployment/staking/optimistic/verify_07_base_target_dispenser.js --network " + providerName + " " + baseTargetDispenserL2.address, { encoding: "utf-8" }); + } +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/deployment/staking/base/globals_base_mainnet.json b/scripts/deployment/staking/base/globals_base_mainnet.json new file mode 100644 index 00000000..c86148c1 --- /dev/null +++ b/scripts/deployment/staking/base/globals_base_mainnet.json @@ -0,0 +1 @@ +{"contractVerification":true,"useLedger":true,"derivationPath":"m/44'/60'/2'/0/0","providerName":"base","networkURL":"https://mainnet.base.org","gasPriceInGwei":"2","olasAddress":"0x54330d28ca3357F294334BDC454a032e7f353416","serviceStakingFactoryAddress":"","timelockAddress":"","baseL2CrossDomainMessengerAddress":"0x4200000000000000000000000000000000000007","l1ChainId":"1","baseDepositProcessorL1Address":"","baseTargetDispenserL2Address":""} \ No newline at end of file diff --git a/scripts/deployment/staking/base/verify_07_base_target_dispenser.js b/scripts/deployment/staking/base/verify_07_base_target_dispenser.js new file mode 100644 index 00000000..be0fd403 --- /dev/null +++ b/scripts/deployment/staking/base/verify_07_base_target_dispenser.js @@ -0,0 +1,12 @@ +const fs = require("fs"); +const globalsFile = "globals.json"; +const dataFromJSON = fs.readFileSync(globalsFile, "utf8"); +const parsedData = JSON.parse(dataFromJSON); + +module.exports = [ + parsedData.olasAddress, + parsedData.serviceStakingFactoryAddress, + parsedData.baseL2CrossDomainMessengerAddress, + parsedData.baseDepositProcessorL1Address, + parsedData.l1ChainId +]; \ No newline at end of file diff --git a/scripts/deployment/staking/deploy_07_base_deposit_processor.js b/scripts/deployment/staking/deploy_07_base_deposit_processor.js new file mode 100644 index 00000000..b2ce30d3 --- /dev/null +++ b/scripts/deployment/staking/deploy_07_base_deposit_processor.js @@ -0,0 +1,64 @@ +/*global process*/ + +const { ethers } = require("hardhat"); +const { LedgerSigner } = require("@anders-t/ethers-ledger"); + +async function main() { + const fs = require("fs"); + const globalsFile = "globals.json"; + const dataFromJSON = fs.readFileSync(globalsFile, "utf8"); + let parsedData = JSON.parse(dataFromJSON); + const useLedger = parsedData.useLedger; + const derivationPath = parsedData.derivationPath; + const providerName = parsedData.providerName; + let EOA; + + const provider = await ethers.providers.getDefaultProvider(providerName); + const signers = await ethers.getSigners(); + + if (useLedger) { + EOA = new LedgerSigner(provider, derivationPath); + } else { + EOA = signers[0]; + } + // EOA address + const deployer = await EOA.getAddress(); + console.log("EOA is:", deployer); + + // Transaction signing and execution + console.log("7. EOA to deploy OptimismDepositProcessorL1 for Base"); + const OptimismDepositProcessorL1 = await ethers.getContractFactory("OptimismDepositProcessorL1"); + console.log("You are signing the following transaction: OptimismDepositProcessorL1.connect(EOA).deploy()"); + const baseDepositProcessorL1 = await OptimismDepositProcessorL1.connect(EOA).deploy(parsedData.olasAddress, + parsedData.dispenserAddress, parsedData.baseL1StandardBridgeProxyAddress, + parsedData.baseL1CrossDomainMessengerProxyAddress, parsedData.baseL2TargetChainId, + parsedData.baseOLASAddress); + const result = await baseDepositProcessorL1.deployed(); + + // Transaction details + console.log("Contract deployment: OptimismDepositProcessorL1"); + console.log("Contract address:", baseDepositProcessorL1.address); + console.log("Transaction:", result.deployTransaction.hash); + + // If on sepolia, wait a minute for the transaction completion + if (providerName === "sepolia") { + await new Promise(r => setTimeout(r, 30000)); + } + + // Writing updated parameters back to the JSON file + parsedData.baseDepositProcessorL1Address = baseDepositProcessorL1.address; + fs.writeFileSync(globalsFile, JSON.stringify(parsedData)); + + // Contract verification + if (parsedData.contractVerification) { + const execSync = require("child_process").execSync; + execSync("npx hardhat verify --constructor-args scripts/deployment/staking/verify_07_base_deposit_processor.js --network " + providerName + " " + baseDepositProcessorL1.address, { encoding: "utf-8" }); + } +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/deployment/staking/globals_mainnet.json b/scripts/deployment/staking/globals_mainnet.json index 8a20c59b..c69bd060 100644 --- a/scripts/deployment/staking/globals_mainnet.json +++ b/scripts/deployment/staking/globals_mainnet.json @@ -1 +1 @@ -{"contractVerification":true,"useLedger":true,"derivationPath":"m/44'/60'/2'/0/0","providerName":"mainnet","olasAddress":"0x0001A500A6B18995B03f44bb040A5fFc28E45CB0","dispenserAddress":"","arbitrumL1ERC20GatewayRouterAddress":"0x72Ce9c846789fdB6fC1f34aC4AD25Dd9ef7031ef","arbitrumL1ERC20GatewayAddress":"0xa3A7B6F88361F48403514059F1F16C8E78d60EeC","arbitrumInboxAddress":"0x4Dbd4fc535Ac27206064B68FfCf827b0A60BAB3f","arbitrumOutboxAddress":"0x0B9857ae2D4A3DBe74ffE1d7DF045bb7F96E4840","arbitrumBridgeAddress":"0x8315177aB297bA92A06054cE80a67Ed4DBd7ed3a","arbitrumL2TargetChainId":"42161","arbitrumDepositProcessorL1Address":"","gnosisOmniBridgeAddress":"0x88ad09518695c6c3712AC10a214bE5109a655671","gnosisAMBForeignAddress":"0x4C36d2919e407f0Cc2Ee3c993ccF8ac26d9CE64e","gnosisL2TargetChainId":"100","gnosisDepositProcessorL1Address":"","optimisticL1StandardBridgeProxyAddress":"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1","optimisticL1CrossDomainMessengerProxyAddress":"0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1","optimisticOLASAddress":"0xFC2E6e6BCbd49ccf3A5f029c79984372DcBFE527","optimisticL2TargetChainId":"10","optimismDepositProcessorL1Address":"","wormholeL1CoreAddress":"0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B","wormholeL1TokenRelayerAddress":"0x3ee18B2214AFF97000D974cf647E7C347E8fa585","wormholeL1MessageRelayerAddress":"0x27428DD2d3DD32A4D7f7C497eAaa23130d894911","celoL2TargetChainId":"42220","celoWormholeL2TargetChainId":"14","celoWormholeDepositProcessorL1Address":"","polygonRootChainManagerProxyAddress":"0xA0c68C638235ee32657e8f720a23ceC1bFc77C77","polygonFXRootAddress":"0xfe5e5D361b2ad62c541bAb87C45a0B9B018389a2","polygonCheckpointManagerAddress":"0x86E4Dc95c7FBdBf52e33D563BbDB00823894C287","polygonERC20PredicateAddress":"0x40ec5B33f54e0E8A33A975908C5BA1c14e5BbbDf","polygonL2TargetChainId":"137","polygonDepositProcessorL1Address":""} \ No newline at end of file +{"contractVerification":true,"useLedger":true,"derivationPath":"m/44'/60'/2'/0/0","providerName":"mainnet","olasAddress":"0x0001A500A6B18995B03f44bb040A5fFc28E45CB0","dispenserAddress":"","arbitrumL1ERC20GatewayRouterAddress":"0x72Ce9c846789fdB6fC1f34aC4AD25Dd9ef7031ef","arbitrumL1ERC20GatewayAddress":"0xa3A7B6F88361F48403514059F1F16C8E78d60EeC","arbitrumInboxAddress":"0x4Dbd4fc535Ac27206064B68FfCf827b0A60BAB3f","arbitrumOutboxAddress":"0x0B9857ae2D4A3DBe74ffE1d7DF045bb7F96E4840","arbitrumBridgeAddress":"0x8315177aB297bA92A06054cE80a67Ed4DBd7ed3a","arbitrumL2TargetChainId":"42161","arbitrumDepositProcessorL1Address":"","gnosisOmniBridgeAddress":"0x88ad09518695c6c3712AC10a214bE5109a655671","gnosisAMBForeignAddress":"0x4C36d2919e407f0Cc2Ee3c993ccF8ac26d9CE64e","gnosisL2TargetChainId":"100","gnosisDepositProcessorL1Address":"","optimisticL1StandardBridgeProxyAddress":"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1","optimisticL1CrossDomainMessengerProxyAddress":"0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1","optimisticOLASAddress":"0xFC2E6e6BCbd49ccf3A5f029c79984372DcBFE527","optimisticL2TargetChainId":"10","optimismDepositProcessorL1Address":"","wormholeL1CoreAddress":"0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B","wormholeL1TokenRelayerAddress":"0x3ee18B2214AFF97000D974cf647E7C347E8fa585","wormholeL1MessageRelayerAddress":"0x27428DD2d3DD32A4D7f7C497eAaa23130d894911","celoL2TargetChainId":"42220","celoWormholeL2TargetChainId":"14","celoWormholeDepositProcessorL1Address":"","polygonRootChainManagerProxyAddress":"0xA0c68C638235ee32657e8f720a23ceC1bFc77C77","polygonFXRootAddress":"0xfe5e5D361b2ad62c541bAb87C45a0B9B018389a2","polygonCheckpointManagerAddress":"0x86E4Dc95c7FBdBf52e33D563BbDB00823894C287","polygonERC20PredicateAddress":"0x40ec5B33f54e0E8A33A975908C5BA1c14e5BbbDf","polygonL2TargetChainId":"137","polygonDepositProcessorL1Address":"","baseL1StandardBridgeProxyAddress":"0x3154Cf16ccdb4C6d922629664174b904d80F2C35","baseL1CrossDomainMessengerProxyAddress":"0x866E82a600A1414e583f7F13623F1aC5d58b0Afa","baseOLASAddress":"0x54330d28ca3357F294334BDC454a032e7f353416","baseL2TargetChainId":"8453"} \ No newline at end of file diff --git a/scripts/deployment/staking/optimistic/globals_optimistic_mainnet.json b/scripts/deployment/staking/optimistic/globals_optimistic_mainnet.json index f22c6d15..fb8d8d7c 100644 --- a/scripts/deployment/staking/optimistic/globals_optimistic_mainnet.json +++ b/scripts/deployment/staking/optimistic/globals_optimistic_mainnet.json @@ -1 +1 @@ -{"contractVerification":true,"useLedger":false,"derivationPath":"m/44'/60'/2'/0/0","providerName":"optimistic","networkURL":"https://optimism.drpc.org","gasPriceInGwei":"2","olasAddress":"0xFC2E6e6BCbd49ccf3A5f029c79984372DcBFE527","serviceStakingFactoryAddress":"","timelockAddress":"","optimisticL2CrossDomainMessengerAddress":"0x4200000000000000000000000000000000000007","l1ChainId":"1","optimismDepositProcessorL1Address":"","optimismTargetDispenserL2Address":""} \ No newline at end of file +{"contractVerification":true,"useLedger":true,"derivationPath":"m/44'/60'/2'/0/0","providerName":"optimistic","networkURL":"https://optimism.drpc.org","gasPriceInGwei":"2","olasAddress":"0xFC2E6e6BCbd49ccf3A5f029c79984372DcBFE527","serviceStakingFactoryAddress":"","timelockAddress":"","optimisticL2CrossDomainMessengerAddress":"0x4200000000000000000000000000000000000007","l1ChainId":"1","optimismDepositProcessorL1Address":"","optimismTargetDispenserL2Address":""} \ No newline at end of file diff --git a/scripts/deployment/staking/optimistic/send_tokens_and_message.js b/scripts/deployment/staking/optimistic/send_tokens_and_message.js index cc8c1dc9..23433dd7 100644 --- a/scripts/deployment/staking/optimistic/send_tokens_and_message.js +++ b/scripts/deployment/staking/optimistic/send_tokens_and_message.js @@ -55,7 +55,7 @@ const main = async () => { await tx.wait(); // tx back: https://sepolia-optimism.etherscan.io/tx/0x08ff60b3ef506e0f34e5941953608fa5bec1a13d7e0a175084245aa622edf7e0 - // tx result: + // tx result: https://sepolia.etherscan.io/tx/0xcd6ad253a6f869899f25f5d69d8261dbabd1fe49d9fce69cbcd3672064bb49dc // https://docs.optimism.io/builders/app-developers/tutorials/cross-dom-solidity#interact-with-the-l2-greeter // https://github.com/t4sk/notes/tree/main/op diff --git a/scripts/deployment/staking/verify_07_base_deposit_processor.js b/scripts/deployment/staking/verify_07_base_deposit_processor.js new file mode 100644 index 00000000..c7855344 --- /dev/null +++ b/scripts/deployment/staking/verify_07_base_deposit_processor.js @@ -0,0 +1,13 @@ +const fs = require("fs"); +const globalsFile = "globals.json"; +const dataFromJSON = fs.readFileSync(globalsFile, "utf8"); +const parsedData = JSON.parse(dataFromJSON); + +module.exports = [ + parsedData.olasAddress, + parsedData.dispenserAddress, + parsedData.baseL1StandardBridgeProxyAddress, + parsedData.baseL1CrossDomainMessengerProxyAddress, + parsedData.baseL2TargetChainId, + parsedData.baseOLASAddress +]; \ No newline at end of file diff --git a/scripts/deployment/staking/wormhole/globals_celo_mainnet.json b/scripts/deployment/staking/wormhole/globals_celo_mainnet.json index 2b7b0975..cbaf8205 100644 --- a/scripts/deployment/staking/wormhole/globals_celo_mainnet.json +++ b/scripts/deployment/staking/wormhole/globals_celo_mainnet.json @@ -1 +1 @@ -{"contractVerification":true,"useLedger":false,"derivationPath":"m/44'/60'/2'/0/0","providerName":"celo","networkURL":"https://forno.celo.org","gasPriceInGwei":"2","olasAddress":"0xb8B338b84cc4E16D1a73B617bfbe8f74a07270E6","serviceStakingFactoryAddress":"0x670Ac235EE13C0B2a5065282bBB0c61cfB354592","timelockAddress":"0x52370eE170c0E2767B32687166791973a0dE7966","wormholeL2CoreAddress":"0xa321448d90d4e5b0A732867c18eA198e75CAC48E","wormholeL2TokenRelayerAddress":"0x796Dff6D74F3E27060B71255Fe517BFb23C93eed","wormholeL2MessageRelayer":"0x27428DD2d3DD32A4D7f7C497eAaa23130d894911","wormholel1ChainId":"5","celoWormholeDepositProcessorL1Address":"0x04A0afD079F14D539B17253Ea93563934A024165","celoWormholeTargetDispenserL2Address":"0x17806E2a12d5E0F48C9803cd397DB3F044DA3b77"} \ No newline at end of file +{"contractVerification":true,"useLedger":true,"derivationPath":"m/44'/60'/2'/0/0","providerName":"celo","networkURL":"https://forno.celo.org","gasPriceInGwei":"2","olasAddress":"0xaCFfAe8e57Ec6E394Eb1b41939A8CF7892DbDc51","serviceStakingFactoryAddress":"","timelockAddress":"","wormholeL2CoreAddress":"0xa321448d90d4e5b0A732867c18eA198e75CAC48E","wormholeL2TokenRelayerAddress":"0x796Dff6D74F3E27060B71255Fe517BFb23C93eed","wormholeL2MessageRelayer":"0x27428DD2d3DD32A4D7f7C497eAaa23130d894911","wormholel1ChainId":"2","celoWormholeDepositProcessorL1Address":"","celoWormholeTargetDispenserL2Address":""} \ No newline at end of file diff --git a/scripts/deployment/staking/wormhole/bridge_new_token.js b/scripts/deployment/staking/wormhole/test/bridge_new_token.js similarity index 100% rename from scripts/deployment/staking/wormhole/bridge_new_token.js rename to scripts/deployment/staking/wormhole/test/bridge_new_token.js diff --git a/scripts/deployment/staking/wormhole/deploy_00_mock_olas_as_erc20_ownerless.js b/scripts/deployment/staking/wormhole/test/deploy_00_mock_olas_as_erc20_ownerless.js similarity index 100% rename from scripts/deployment/staking/wormhole/deploy_00_mock_olas_as_erc20_ownerless.js rename to scripts/deployment/staking/wormhole/test/deploy_00_mock_olas_as_erc20_ownerless.js diff --git a/scripts/deployment/staking/wormhole/deploy_01_mock_dispenser.js b/scripts/deployment/staking/wormhole/test/deploy_01_mock_dispenser.js similarity index 94% rename from scripts/deployment/staking/wormhole/deploy_01_mock_dispenser.js rename to scripts/deployment/staking/wormhole/test/deploy_01_mock_dispenser.js index a035270c..a7b7d733 100644 --- a/scripts/deployment/staking/wormhole/deploy_01_mock_dispenser.js +++ b/scripts/deployment/staking/wormhole/test/deploy_01_mock_dispenser.js @@ -63,7 +63,7 @@ async function main() { // Contract verification if (parsedData.contractVerification) { const execSync = require("child_process").execSync; - execSync("npx hardhat verify --constructor-args scripts/deployment/staking/wormhole/verify_01_mock_dispenser.js --network " + providerName + " " + dispenser.address, { encoding: "utf-8" }); + execSync("npx hardhat verify --constructor-args scripts/deployment/staking/wormhole/test/verify_01_mock_dispenser.js --network " + providerName + " " + dispenser.address, { encoding: "utf-8" }); } } diff --git a/scripts/deployment/staking/wormhole/test/deploy_05_celo_wormhole_targer_dispenser.js b/scripts/deployment/staking/wormhole/test/deploy_05_celo_wormhole_targer_dispenser.js new file mode 100644 index 00000000..342a2bbd --- /dev/null +++ b/scripts/deployment/staking/wormhole/test/deploy_05_celo_wormhole_targer_dispenser.js @@ -0,0 +1,76 @@ +/*global process*/ + +const { ethers } = require("hardhat"); +const { LedgerSigner } = require("@anders-t/ethers-ledger"); + +async function main() { + const fs = require("fs"); + const globalsFile = "globals.json"; + const dataFromJSON = fs.readFileSync(globalsFile, "utf8"); + let parsedData = JSON.parse(dataFromJSON); + const useLedger = parsedData.useLedger; + const derivationPath = parsedData.derivationPath; + const providerName = parsedData.providerName; + + let networkURL = parsedData.networkURL; + if (providerName === "polygon") { + if (!process.env.ALCHEMY_API_KEY_MATIC) { + console.log("set ALCHEMY_API_KEY_MATIC env variable"); + } + networkURL += process.env.ALCHEMY_API_KEY_MATIC; + } else if (providerName === "polygonAmoy") { + if (!process.env.ALCHEMY_API_KEY_AMOY) { + console.log("set ALCHEMY_API_KEY_AMOY env variable"); + return; + } + networkURL += process.env.ALCHEMY_API_KEY_AMOY; + } + + const provider = new ethers.providers.JsonRpcProvider(networkURL); + const signers = await ethers.getSigners(); + + let EOA; + if (useLedger) { + EOA = new LedgerSigner(provider, derivationPath); + } else { + EOA = signers[0]; + } + // EOA address + const deployer = await EOA.getAddress(); + console.log("EOA is:", deployer); + + // Transaction signing and execution + console.log("5. EOA to deploy WormholeTargetDispenserL2"); + const WormholeTargetDispenserL2 = await ethers.getContractFactory("WormholeTargetDispenserL2"); + console.log("You are signing the following transaction: WormholeTargetDispenserL2.connect(EOA).deploy()"); + const wormholeTargetDispenserL2 = await WormholeTargetDispenserL2.connect(EOA).deploy(parsedData.olasAddress, + parsedData.serviceStakingFactoryAddress, parsedData.wormholeL2MessageRelayer, + parsedData.celoWormholeDepositProcessorL1Address, parsedData.wormholel1ChainId, + parsedData.wormholeL2CoreAddress, parsedData.wormholeL2TokenRelayerAddress); + const result = await wormholeTargetDispenserL2.deployed(); + + // Transaction details + console.log("Contract deployment: WormholeTargetDispenserL2"); + console.log("Contract address:", wormholeTargetDispenserL2.address); + console.log("Transaction:", result.deployTransaction.hash); + + // Wait for half a minute for the transaction completion + await new Promise(r => setTimeout(r, 30000)); + + // Writing updated parameters back to the JSON file + parsedData.celoWormholeTargetDispenserL2Address = wormholeTargetDispenserL2.address; + fs.writeFileSync(globalsFile, JSON.stringify(parsedData)); + + // Contract verification + if (parsedData.contractVerification) { + const execSync = require("child_process").execSync; + execSync("npx hardhat verify --constructor-args scripts/deployment/staking/wormhole/test/verify_05_celo_wormhole_target_dispenser.js --network " + providerName + " " + wormholeTargetDispenserL2.address, { encoding: "utf-8" }); + } +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/deployment/staking/wormhole/deploy_05_polygon_wormhole_deposit_processor.js b/scripts/deployment/staking/wormhole/test/deploy_05_polygon_wormhole_deposit_processor.js similarity index 94% rename from scripts/deployment/staking/wormhole/deploy_05_polygon_wormhole_deposit_processor.js rename to scripts/deployment/staking/wormhole/test/deploy_05_polygon_wormhole_deposit_processor.js index 3b2cc674..b3f41be9 100644 --- a/scripts/deployment/staking/wormhole/deploy_05_polygon_wormhole_deposit_processor.js +++ b/scripts/deployment/staking/wormhole/test/deploy_05_polygon_wormhole_deposit_processor.js @@ -64,7 +64,7 @@ async function main() { // Contract verification if (parsedData.contractVerification) { const execSync = require("child_process").execSync; - execSync("npx hardhat verify --constructor-args scripts/deployment/staking/wormhole/verify_05_polygon_wormhole_deposit_processor.js --network " + providerName + " " + wormholeDepositProcessorL1.address, { encoding: "utf-8" }); + execSync("npx hardhat verify --constructor-args scripts/deployment/staking/wormhole/test/verify_05_polygon_wormhole_deposit_processor.js --network " + providerName + " " + wormholeDepositProcessorL1.address, { encoding: "utf-8" }); } } diff --git a/scripts/deployment/staking/wormhole/test/globals_celo_mainnet.json b/scripts/deployment/staking/wormhole/test/globals_celo_mainnet.json new file mode 100644 index 00000000..2b7b0975 --- /dev/null +++ b/scripts/deployment/staking/wormhole/test/globals_celo_mainnet.json @@ -0,0 +1 @@ +{"contractVerification":true,"useLedger":false,"derivationPath":"m/44'/60'/2'/0/0","providerName":"celo","networkURL":"https://forno.celo.org","gasPriceInGwei":"2","olasAddress":"0xb8B338b84cc4E16D1a73B617bfbe8f74a07270E6","serviceStakingFactoryAddress":"0x670Ac235EE13C0B2a5065282bBB0c61cfB354592","timelockAddress":"0x52370eE170c0E2767B32687166791973a0dE7966","wormholeL2CoreAddress":"0xa321448d90d4e5b0A732867c18eA198e75CAC48E","wormholeL2TokenRelayerAddress":"0x796Dff6D74F3E27060B71255Fe517BFb23C93eed","wormholeL2MessageRelayer":"0x27428DD2d3DD32A4D7f7C497eAaa23130d894911","wormholel1ChainId":"5","celoWormholeDepositProcessorL1Address":"0x04A0afD079F14D539B17253Ea93563934A024165","celoWormholeTargetDispenserL2Address":"0x17806E2a12d5E0F48C9803cd397DB3F044DA3b77"} \ No newline at end of file diff --git a/scripts/deployment/staking/wormhole/globals_polygon_mainnet.json b/scripts/deployment/staking/wormhole/test/globals_polygon_mainnet.json similarity index 100% rename from scripts/deployment/staking/wormhole/globals_polygon_mainnet.json rename to scripts/deployment/staking/wormhole/test/globals_polygon_mainnet.json diff --git a/scripts/deployment/staking/wormhole/send_tokens_and_message.js b/scripts/deployment/staking/wormhole/test/send_tokens_and_message.js similarity index 100% rename from scripts/deployment/staking/wormhole/send_tokens_and_message.js rename to scripts/deployment/staking/wormhole/test/send_tokens_and_message.js diff --git a/scripts/deployment/staking/wormhole/verify_01_mock_dispenser.js b/scripts/deployment/staking/wormhole/test/verify_01_mock_dispenser.js similarity index 100% rename from scripts/deployment/staking/wormhole/verify_01_mock_dispenser.js rename to scripts/deployment/staking/wormhole/test/verify_01_mock_dispenser.js diff --git a/scripts/deployment/staking/wormhole/test/verify_05_celo_wormhole_target_dispenser.js b/scripts/deployment/staking/wormhole/test/verify_05_celo_wormhole_target_dispenser.js new file mode 100644 index 00000000..3028f790 --- /dev/null +++ b/scripts/deployment/staking/wormhole/test/verify_05_celo_wormhole_target_dispenser.js @@ -0,0 +1,14 @@ +const fs = require("fs"); +const globalsFile = "globals.json"; +const dataFromJSON = fs.readFileSync(globalsFile, "utf8"); +const parsedData = JSON.parse(dataFromJSON); + +module.exports = [ + parsedData.olasAddress, + parsedData.serviceStakingFactoryAddress, + parsedData.wormholeL2MessageRelayer, + parsedData.celoWormholeDepositProcessorL1Address, + parsedData.wormholel1ChainId, + parsedData.wormholeL2CoreAddress, + parsedData.wormholeL2TokenRelayerAddress +]; \ No newline at end of file diff --git a/scripts/deployment/staking/wormhole/verify_05_polygon_wormhole_deposit_processor.js b/scripts/deployment/staking/wormhole/test/verify_05_polygon_wormhole_deposit_processor.js similarity index 100% rename from scripts/deployment/staking/wormhole/verify_05_polygon_wormhole_deposit_processor.js rename to scripts/deployment/staking/wormhole/test/verify_05_polygon_wormhole_deposit_processor.js