-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: adding to staking instance deployment scripts
- Loading branch information
Showing
8 changed files
with
113 additions
and
10 deletions.
There are no files selected for viewing
Submodule autonolas-registries
updated
41 files
Submodule forge-std
updated
10 files
+1 −1 | package.json | |
+8 −1 | src/StdChains.sol | |
+9 −0 | src/StdInvariant.sol | |
+1 −1 | src/StdStorage.sol | |
+89 −1 | src/Vm.sol | |
+401 −382 | src/console.sol | |
+1 −1,555 | src/console2.sol | |
+3 −0 | test/StdChains.t.sol | |
+8 −0 | test/StdStorage.t.sol | |
+2 −2 | test/Vm.t.sol |
87 changes: 87 additions & 0 deletions
87
scripts/deployment/deploy_00_basic_service_staking_activity_checker.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/*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 livenessRatio = parsedData.livenessRatio; | ||
|
||
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; | ||
} else if (providerName === "sepolia") { | ||
if (!process.env.ALCHEMY_API_KEY_SEPOLIA) { | ||
console.log("set ALCHEMY_API_KEY_SEPOLIA env variable"); | ||
return; | ||
} | ||
networkURL += process.env.ALCHEMY_API_KEY_SEPOLIA; | ||
} else 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("18. EOA to deploy StakingActivityChecker"); | ||
const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei"); | ||
const StakingActivityChecker = await ethers.getContractFactory("StakingActivityChecker"); | ||
console.log("You are signing the following transaction: StakingActivityChecker.connect(EOA).deploy()"); | ||
const stakingActivityChecker = await StakingActivityChecker.connect(EOA).deploy(livenessRatio, | ||
{ gasPrice }); | ||
const result = await stakingActivityChecker.deployed(); | ||
|
||
// Transaction details | ||
console.log("Contract deployment: StakingActivityChecker"); | ||
console.log("Contract address:", stakingActivityChecker.address); | ||
console.log("Transaction:", result.deployTransaction.hash); | ||
// Wait half a minute for the transaction completion | ||
await new Promise(r => setTimeout(r, 30000)); | ||
|
||
// Writing updated parameters back to the JSON file | ||
parsedData.stakingActivityCheckerAddress = stakingActivityChecker.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/l2/verify_18_service_staking_activity_checker.js --network " + providerName + " " + stakingActivityChecker.address, { encoding: "utf-8" }); | ||
} | ||
} | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"contractVerification":true,"useLedger":false,"derivationPath":"m/44'/60'/2'/0/0","providerName":"chiado","networkURL":"https://rpc.chiadochain.net","gasPriceInGwei":"5","gnosisSafeAddress":"0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552","gnosisSafeProxyFactoryAddress":"0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2","serviceRegistryAddress":"0x31D3202d8744B16A120117A053459DDFAE93c855","serviceRegistryTokenUtilityAddress":"0xc2c7E40674f1C7Bb99eFe5680Efd79842502bED4","olasAddress":"0xE40AE73aa0Ed3Ec35fdAF56e01FCd0D1Ff1d9AB6","multisigProxyHash130":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000","stakingNativeTokenAddress":"0xAed729d4f4b895d8ca84ba022675bB0C44d2cD52","stakingTokenAddress":"0xf438a9a11902ffecfc2dA2f2224193C6AaBc6346","agentMechAddress":"0x0A3cFc6BEe9658Eda040e6BB366FE963DdCe82C9","livenessRatio":"700000000000000","mechActivityCheckerAddress":"0x7781202B9b09B92F512A0E343F24d349d09bc3A6","stakingVerifierAddress":"0x00000000000000000000000000000000000000000","stakingFactoryAddress":"0xbF6Dd5e87535b8766f4848DE1c13f8d4EDfA86C5","stakingParams":{"metadataHash":"0x0000000000000000000000000000000000000000000000000000000000000001","maxNumServices":"100","rewardsPerSecond":"1000000000000000","minStakingDeposit":"50000000000000000000","minNumStakingPeriods":"3","maxNumInactivityPeriods":"3","livenessPeriod":"86400","timeForEmissions":"86400","numAgentInstances":"1","agentIds":["12"],"threshold":"0","configHash":"0x0000000000000000000000000000000000000000000000000000000000000000","proxyHash":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000","serviceRegistry":"0x31D3202d8744B16A120117A053459DDFAE93c855","activityChecker":"0x7781202B9b09B92F512A0E343F24d349d09bc3A6"},"stakingTokenInstanceAddress":"0x3cbf58bcC16d9195c35E01aFE1A57caf257e113a","stakingNativeTokenInstanceAddress":"0x6F67efF5cb5C35a40CdE2eD570f0885fe7De7D6b"} | ||
{"contractVerification":true,"useLedger":false,"derivationPath":"m/44'/60'/2'/0/0","providerName":"chiado","networkURL":"https://rpc.chiadochain.net","gasPriceInGwei":"5","gnosisSafeAddress":"0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552","gnosisSafeProxyFactoryAddress":"0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2","serviceRegistryAddress":"0x31D3202d8744B16A120117A053459DDFAE93c855","serviceRegistryTokenUtilityAddress":"0xc2c7E40674f1C7Bb99eFe5680Efd79842502bED4","olasAddress":"0xE40AE73aa0Ed3Ec35fdAF56e01FCd0D1Ff1d9AB6","multisigProxyHash130":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000","stakingNativeTokenAddress":"","stakingTokenAddress":"0x00c3B912FF54B2a7E37D495a496f025D51fb8058","agentMechAddress":"0x0A3cFc6BEe9658Eda040e6BB366FE963DdCe82C9","livenessRatio":"700000000000000","mechActivityCheckerAddress":"0x7781202B9b09B92F512A0E343F24d349d09bc3A6","stakingFactoryAddress":"0xbF6Dd5e87535b8766f4848DE1c13f8d4EDfA86C5","stakingParams":{"metadataHash":"0x0000000000000000000000000000000000000000000000000000000000000001","maxNumServices":"100","rewardsPerSecond":"1000000000000000","minStakingDeposit":"50000000000000000000","minNumStakingPeriods":"3","maxNumInactivityPeriods":"2","livenessPeriod":"86400","timeForEmissions":"86400","numAgentInstances":"1","agentIds":["25"],"threshold":"0","configHash":"0x0000000000000000000000000000000000000000000000000000000000000000","proxyHash":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000","serviceRegistry":"0x31D3202d8744B16A120117A053459DDFAE93c855","activityChecker":"0x7781202B9b09B92F512A0E343F24d349d09bc3A6"},"stakingTokenInstanceAddress":"","stakingNativeTokenInstanceAddress":""} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"contractVerification":true,"useLedger":false,"derivationPath":"m/44'/60'/2'/0/0","providerName":"gnosis","networkURL":"https://rpc.gnosischain.com","gasPriceInGwei":"15","gnosisSafeAddress":"0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552","gnosisSafeProxyFactoryAddress":"0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2","serviceRegistryAddress":"0x9338b5153AE39BB89f50468E608eD9d764B755fD","serviceRegistryTokenUtilityAddress":"0xa45E64d13A30a51b91ae0eb182e88a40e9b18eD8","olasAddress":"0xcE11e14225575945b8E6Dc0D4F2dD4C570f79d9f","multisigProxyHash130":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000","stakingNativeTokenAddress":"","stakingTokenAddress":"0x9Ec97Be9FF55ff11606ce7c589956f7Bf3D0b241","agentMechAddress":"0x77af31De935740567Cf4fF1986D04B2c964A786a","livenessRatio":"46296296296296","mechActivityCheckerAddress":"0x155547857680A6D51bebC5603397488988DEb1c8","stakingVerifierAddress":"0x00000000000000000000000000000000000000000","stakingFactoryAddress":"0xC720f1Ada2a882a4B375dCCd0aAc3F3B3e58bc84","stakingParams":{"metadataHash":"0x888914090dd6dd2bc98e113d7558854e6be7ad06d1af180cac83aac61479059e","maxNumServices":"200","rewardsPerSecond":"549768518519","minStakingDeposit":"10000000000000000000","minNumStakingPeriods":"3","maxNumInactivityPeriods":"2","livenessPeriod":"86400","timeForEmissions":"2592000","numAgentInstances":"1","agentIds":["14"],"threshold":"0","configHash":"0x0000000000000000000000000000000000000000000000000000000000000000","proxyHash":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000","serviceRegistry":"0x9338b5153AE39BB89f50468E608eD9d764B755fD","activityChecker":"0x155547857680A6D51bebC5603397488988DEb1c8"},"stakingTokenInstanceAddress":"0xEE9F19b5DF06c7E8Bfc7B28745dcf944C504198A"} | ||
{"contractVerification":true,"useLedger":false,"derivationPath":"m/44'/60'/2'/0/0","providerName":"gnosis","networkURL":"https://rpc.gnosischain.com","gasPriceInGwei":"15","gnosisSafeAddress":"0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552","gnosisSafeProxyFactoryAddress":"0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2","serviceRegistryAddress":"0x9338b5153AE39BB89f50468E608eD9d764B755fD","serviceRegistryTokenUtilityAddress":"0xa45E64d13A30a51b91ae0eb182e88a40e9b18eD8","olasAddress":"0xcE11e14225575945b8E6Dc0D4F2dD4C570f79d9f","multisigProxyHash130":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000","stakingNativeTokenAddress":"","stakingTokenAddress":"0xEa00be6690a871827fAfD705440D20dd75e67AB1","agentMechAddress":"0x77af31De935740567Cf4fF1986D04B2c964A786a","livenessRatio":"46296296296296","mechActivityCheckerAddress":"0x155547857680A6D51bebC5603397488988DEb1c8","stakingFactoryAddress":"0xb0228CA253A88Bc8eb4ca70BCAC8f87b381f4700","stakingParams":{"metadataHash":"0x888914090dd6dd2bc98e113d7558854e6be7ad06d1af180cac83aac61479059e","maxNumServices":"100","rewardsPerSecond":"1649305555557","minStakingDeposit":"20000000000000000000","minNumStakingPeriods":"3","maxNumInactivityPeriods":"2","livenessPeriod":"86400","timeForEmissions":"2592000","numAgentInstances":"1","agentIds":["25"],"threshold":"0","configHash":"0x0000000000000000000000000000000000000000000000000000000000000000","proxyHash":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000","serviceRegistry":"0x9338b5153AE39BB89f50468E608eD9d764B755fD","activityChecker":"0x155547857680A6D51bebC5603397488988DEb1c8"},"stakingTokenInstanceAddress":""} |
9 changes: 9 additions & 0 deletions
9
scripts/deployment/verify_00_basic_service_staking_activity_checker.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const fs = require("fs"); | ||
const globalsFile = "globals.json"; | ||
const dataFromJSON = fs.readFileSync(globalsFile, "utf8"); | ||
const parsedData = JSON.parse(dataFromJSON); | ||
const livenessRatio = parsedData.livenessRatio; | ||
|
||
module.exports = [ | ||
livenessRatio | ||
]; |