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 on mode l2 #198

Merged
merged 4 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitleaksignore
Original file line number Diff line number Diff line change
Expand Up @@ -424,3 +424,7 @@ eff9ec09651b73fcbd7270f070b2747e6f408157:scripts/deployment/l2/globals_arbitrum_
408d8153bc8dc60d952edbb022229c1994906c7e:scripts/deployment/l2/globals_mode_sepolia.json:generic-api-key:2
08d8153bc8dc60d952edbb022229c1994906c7e:scripts/deployment/l2/globals_mode_sepolia.json:generic-api-key:1
08d8153bc8dc60d952edbb022229c1994906c7e:scripts/deployment/l2/globals_mode_sepolia.json:generic-api-key:2
b5ca8da1a582e0e91c3d292f72c91411874756f0:scripts/deployment/l2/globals_mode_mainnet.json:generic-api-key:1
b5ca8da1a582e0e91c3d292f72c91411874756f0:scripts/deployment/l2/globals_mode_mainnet.json:generic-api-key:2
c71519f1ffae8a411ee44ee49de26d13ec6a0ce2:scripts/deployment/l2/globals_mode_mainnet.json:generic-api-key:1
c71519f1ffae8a411ee44ee49de26d13ec6a0ce2:scripts/deployment/l2/globals_mode_mainnet.json:generic-api-key:2
29 changes: 17 additions & 12 deletions docs/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -655,47 +655,52 @@
{
"name": "ServiceRegistryL2",
"artifact": "abis/0.8.28/ServiceRegistryL2.json",
"address": ""
"address": "0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE"
},
{
"name": "ServiceRegistryTokenUtility",
"artifact": "abis/0.8.28/ServiceRegistryTokenUtility.json",
"address": ""
"address": "0x34C895f302D0b5cf52ec0Edd3945321EB0f83dd5"
},
{
"name": "ServiceManagerToken",
"artifact": "abis/0.8.28/ServiceManagerToken.json",
"address": ""
"address": "0x63e66d7ad413C01A7b49C7FF4e3Bb765C4E4bd1b"
},
{
"name": "OperatorWhitelist",
"artifact": "abis/0.8.28/OperatorWhitelist.json",
"address": ""
"address": "0x3d77596beb0f130a4415df3D2D8232B3d3D31e44"
},
{
"name": "GnosisSafeMultisig",
"artifact": "abis/0.8.28/GnosisSafeMultisig.json",
"address": ""
"address": "0xBb7e1D6Cb6F243D6bdE81CE92a9f2aFF7Fbe7eac"
},
{
"name": "GnosisSafeSameAddressMultisig",
"artifact": "abis/0.8.28/GnosisSafeSameAddressMultisig.json",
"address": ""
"address": "0xFbBEc0C8b13B38a9aC0499694A69a10204c5E2aB"
},
{
"name": "StakingToken",
"artifact": "abis/0.8.25/StakingToken.json",
"address": ""
"artifact": "abis/0.8.28/StakingToken.json",
"address": "0xE49CB081e8d96920C38aA7AB90cb0294ab4Bc8EA"
},
{
"name": "StakingNativeToken",
"artifact": "abis/0.8.28/StakingNativeToken.json",
"address": "0x88DE734655184a09B70700aE4F72364d1ad23728"
},
{
"name": "StakingVerifier",
"artifact": "abis/0.8.25/StakingVerifier.json",
"address": ""
"artifact": "abis/0.8.28/StakingVerifier.json",
"address": "0x87c511c8aE3fAF0063b3F3CF9C6ab96c4AA5C60c"
},
{
"name": "StakingFactory",
"artifact": "abis/0.8.25/StakingFactory.json",
"address": ""
"artifact": "abis/0.8.28/StakingFactory.json",
"address": "0x75D529FAe220bC8db714F0202193726b46881B76"
}
]
},
Expand Down
4 changes: 2 additions & 2 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ module.exports = {
network: "mode",
chainId: 34443,
urls: {
apiURL: "https://api.routescan.io/v2/network/mainnet/evm/34443/etherscan",
browserURL: "https://modescan.io"
apiURL: "https://explorer.mode.network/api",
browserURL: "https://explorer.mode.network"
},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async function main() {
console.log("EOA is:", deployer);

// Transaction signing and execution
console.log("19. EOA to deploy StakingVerifier");
console.log("18. EOA to deploy StakingVerifier");
const StakingVerifier = await ethers.getContractFactory("StakingVerifier");
console.log("You are signing the following transaction: StakingVerifier.connect(EOA).deploy()");
const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei");
Expand Down
2 changes: 1 addition & 1 deletion scripts/deployment/l2/deploy_19_service_staking_factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ async function main() {
console.log("EOA is:", deployer);

// Transaction signing and execution
console.log("20. EOA to deploy StakingFactory");
console.log("19. EOA to deploy StakingFactory");
const StakingFactory = await ethers.getContractFactory("StakingFactory");
console.log("You are signing the following transaction: StakingFactory.connect(EOA).deploy()");
const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*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;
const gasPriceInGwei = parsedData.gasPriceInGwei;
const stakingTokenAddress = parsedData.stakingTokenAddress;
const stakingNativeTokenAddress = parsedData.stakingNativeTokenAddress;
const stakingVerifierAddress = parsedData.stakingVerifierAddress;

let networkURL = parsedData.networkURL;
if (providerName === "mainnet") {
if (!process.env.ALCHEMY_API_KEY_MAINNET) {
console.log("set ALCHEMY_API_KEY_MAINNET env variable");
}
networkURL += process.env.ALCHEMY_API_KEY_MAINNET;
}
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);

// Get the verifier contracts
const stakingVerifier = await ethers.getContractAt("StakingVerifier", stakingVerifierAddress);

// Gas pricing
const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei");

// Transaction signing and execution
console.log("20. You are signing the following transaction: StakingVerifier.connect(EOA).setImplementationsStatuses()");
let result = await stakingVerifier.connect(EOA).setImplementationsStatuses([stakingTokenAddress, stakingNativeTokenAddress],
[true, true], true, { gasPrice });
// Transaction details
console.log("Contract address:", stakingVerifierAddress);
console.log("Transaction:", result.hash);
}

main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ async function main() {
// Contract verification
if (parsedData.contractVerification) {
const execSync = require("child_process").execSync;
execSync("npx hardhat verify --contract contracts/utils/HashCheckpoint.sol:HashCheckpoint --constructor-args scripts/deployment/l2/verify_20_hash_checkpoint.js --network " + providerName + " " + hashCheckpoint.address, { encoding: "utf-8" });
execSync("npx hardhat verify --contract contracts/utils/HashCheckpoint.sol:HashCheckpoint --constructor-args scripts/deployment/l2/verify_23_hash_checkpoint.js --network " + providerName + " " + hashCheckpoint.address, { encoding: "utf-8" });
}
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/deployment/l2/globals_mode_mainnet.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"contractVerification":true,"useLedger":true,"derivationPath":"m/44'/60'/2'/0/0","providerName":"base","networkURL":"https://mainnet.mode.network","gasPriceInGwei":"1","gnosisSafeAddress":"0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552","gnosisSafeProxyFactoryAddress":"0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2","baseURI":"https://gateway.autonolas.tech/ipfs/","serviceRegistryName":"Service Registry L2","serviceRegistrySymbol":"AUTONOLAS-SERVICE-L2-V1","bridgeMediatorAddress":"0x9338b5153AE39BB89f50468E608eD9d764B755fD","olasAddress":"","multisigProxyHash130":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000","serviceRegistryAddress":"","operatorWhitelistAddress":"","serviceRegistryTokenUtilityAddress":"","serviceManagerTokenAddress":"","gnosisSafeMultisigImplementationAddress":"","gnosisSafeSameAddressMultisigImplementationAddress":"","stakingTokenAddress":"","stakingNativeTokenAddress":"","minStakingDepositLimit":"10000000000000000000000","timeForEmissionsLimit":"2592000","numServicesLimit":"100","apyLimit":"3000000000000000000","stakingVerifierAddress":"","stakingFactoryAddress":"","L1CrossDomainMessengerProxyAddress":"0x95bDCA6c8EdEB69C98Bd5bd17660BaCef1298A6f"}
{"contractVerification":true,"useLedger":true,"derivationPath":"m/44'/60'/2'/0/0","providerName":"base","networkURL":"https://mainnet.mode.network","gasPriceInGwei":"1","gnosisSafeAddress":"0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552","gnosisSafeProxyFactoryAddress":"0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2","baseURI":"https://gateway.autonolas.tech/ipfs/","serviceRegistryName":"Service Registry L2","serviceRegistrySymbol":"AUTONOLAS-SERVICE-L2-V1","bridgeMediatorAddress":"0x9338b5153AE39BB89f50468E608eD9d764B755fD","olasAddress":"0xcfD1D50ce23C46D3Cf6407487B2F8934e96DC8f9","multisigProxyHash130":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000","serviceRegistryAddress":"0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE","operatorWhitelistAddress":"0x3d77596beb0f130a4415df3D2D8232B3d3D31e44","serviceRegistryTokenUtilityAddress":"0x34C895f302D0b5cf52ec0Edd3945321EB0f83dd5","serviceManagerTokenAddress":"0x63e66d7ad413C01A7b49C7FF4e3Bb765C4E4bd1b","gnosisSafeMultisigImplementationAddress":"0xBb7e1D6Cb6F243D6bdE81CE92a9f2aFF7Fbe7eac","gnosisSafeSameAddressMultisigImplementationAddress":"0xFbBEc0C8b13B38a9aC0499694A69a10204c5E2aB","stakingTokenAddress":"0xE49CB081e8d96920C38aA7AB90cb0294ab4Bc8EA","stakingNativeTokenAddress":"0x88DE734655184a09B70700aE4F72364d1ad23728","minStakingDepositLimit":"10000000000000000000000","timeForEmissionsLimit":"2592000","numServicesLimit":"100","apyLimit":"3000000000000000000","stakingVerifierAddress":"0x87c511c8aE3fAF0063b3F3CF9C6ab96c4AA5C60c","stakingFactoryAddress":"0x75D529FAe220bC8db714F0202193726b46881B76","L1CrossDomainMessengerProxyAddress":"0x95bDCA6c8EdEB69C98Bd5bd17660BaCef1298A6f"}
Loading