Skip to content

Commit

Permalink
chore: diepenser deployment script
Browse files Browse the repository at this point in the history
  • Loading branch information
kupermind committed Jul 15, 2024
1 parent 8b49e18 commit ea67131
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 16 deletions.
20 changes: 11 additions & 9 deletions docs/deployment_v1.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ Steps for deploying the tokenomics version 1.2 contracts are as follows:
1. EOA to deploy Tokenomics implementation (`TokenomicsThree`);
2. TokenomicsProxy to change Tokenomics implementation calling `changeTokenomicsImplementation(TokenomicsThree)`;
3. EOA to deploy Dispenser (`DispenserTwo`) with VoteWeighting contract being deployed before that in `autonolas-governance`;
4. EOA to deploy staking bridging contracts with StakingFactory contract being deployed before that in `autonolas-registries`;
5. EOA to set up correct L1->L2 links for all the bridging contracts calling `setL2TargetDispenser(L2 corresponding contract)`;
6. EOA to transfer ownership rights of Dispenser to Timelock calling `changeOwner(Timelock)`;
7. DAO to change Tokenomics managers calling `changeManagers(ZeroAddress, ZeroAddress, DispenserTwo)`;
8. DAO to change staking parameters in Tokenomics calling `changeStakingParams()`;
9. DAO to change Treasury managers calling `changeManagers(ZeroAddress, ZeroAddress, DispenserTwo)`;
10. DAO to enable bridge deposit processors in Dispenser calling `setDepositProcessorChainIds()`;
11. DAO to unpause staking incentives in Dispenser calling `setPauseState(3)`;
12. EOA to transfer ownership rights of all the L2 bridging contracts to Timelock representation calling `changeOwner(Timelock)`.
4. EOA to change Dispenser address in VoteWeighting calling `changeDispenser(DispenserTwo)`;
5. EOA to add a retainer address as a nominee in VoteWeighting;
6. EOA to deploy staking bridging contracts with StakingFactory contract being deployed before that in `autonolas-registries`;
7. EOA to set up correct L1->L2 links for all the bridging contracts calling `setL2TargetDispenser(L2 corresponding contract)`;
8. EOA to transfer ownership rights of Dispenser to Timelock calling `changeOwner(Timelock)`;
9. DAO to change Tokenomics managers calling `changeManagers(ZeroAddress, ZeroAddress, DispenserTwo)`;
10. DAO to change staking parameters in Tokenomics calling `changeStakingParams()`;
11. DAO to change Treasury managers calling `changeManagers(ZeroAddress, ZeroAddress, DispenserTwo)`;
12. DAO to enable bridge deposit processors in Dispenser calling `setDepositProcessorChainIds()`;
13. DAO to unpause staking incentives in Dispenser calling `setPauseState(3)`;
14. EOA to transfer ownership rights of all the L2 bridging contracts to Timelock representation calling `changeOwner(Timelock)`.

Note for updating VoteWeighting contract address in Dispenser, if required at some point of time.
As outlined in the C4R [issue 59](https://github.com/code-423n4/2024-05-olas-findings/issues/59), the following set of
Expand Down
20 changes: 15 additions & 5 deletions scripts/deployment/deploy_07_dispenser.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,35 @@ async function main() {
console.log("EOA is:", deployer);

// Get all the necessary contract addresses
const olasAddress = parsedData.olasAddress;
const tokenomicsProxyAddress = parsedData.tokenomicsProxyAddress;
const treasuryAddress = parsedData.treasuryAddress;
const voteWeightingAddress = parsedData.voteWeightingAddress;
const retainerAddress = parsedData.retainerAddress;
const maxNumClaimingEpochs = parsedData.maxNumClaimingEpochs;
const maxNumStakingTargets = parsedData.maxNumStakingTargets;
const minStakingWeight = parsedData.minStakingWeight;
const maxStakingIncentive = parsedData.maxStakingIncentive;

// Transaction signing and execution
console.log("7. EOA to deploy Dispenser");
const Dispenser = await ethers.getContractFactory("Dispenser");
console.log("You are signing the following transaction: Dispenser.connect(EOA).deploy()");
const dispenser = await Dispenser.connect(EOA).deploy(tokenomicsProxyAddress, treasuryAddress);
const dispenser = await Dispenser.connect(EOA).deploy(olasAddress, tokenomicsProxyAddress, treasuryAddress,
voteWeightingAddress, retainerAddress, maxNumClaimingEpochs, maxNumStakingTargets, minStakingWeight,
maxStakingIncentive);
const result = await dispenser.deployed();
// If on goerli, wait a minute for the transaction completion
if (providerName === "goerli") {
await new Promise(r => setTimeout(r, 60000));
}

// Transaction details
console.log("Contract deployment: Dispenser");
console.log("Contract address:", dispenser.address);
console.log("Transaction:", result.deployTransaction.hash);

// If on sepolia, wait half a minute for the transaction completion
if (providerName === "sepolia") {
await new Promise(r => setTimeout(r, 30000));
}

// Contract verification
if (parsedData.contractVerification) {
const execSync = require("child_process").execSync;
Expand Down
2 changes: 1 addition & 1 deletion scripts/deployment/globals_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":"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"}
{"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":""}
16 changes: 15 additions & 1 deletion scripts/deployment/verify_07_dispenser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,22 @@ const dataFromJSON = fs.readFileSync(globalsFile, "utf8");
const parsedData = JSON.parse(dataFromJSON);
const tokenomicsProxyAddress = parsedData.tokenomicsProxyAddress;
const treasuryAddress = parsedData.treasuryAddress;
const olasAddress = parsedData.olasAddress;
const voteWeightingAddress = parsedData.voteWeightingAddress;
const retainerAddress = parsedData.retainerAddress;
const maxNumClaimingEpochs = parsedData.maxNumClaimingEpochs;
const maxNumStakingTargets = parsedData.maxNumStakingTargets;
const minStakingWeight = parsedData.minStakingWeight;
const maxStakingIncentive = parsedData.maxStakingIncentive;

module.exports = [
olasAddress,
tokenomicsProxyAddress,
treasuryAddress
treasuryAddress,
voteWeightingAddress,
retainerAddress,
maxNumClaimingEpochs,
maxNumStakingTargets,
minStakingWeight,
maxStakingIncentive
];

0 comments on commit ea67131

Please sign in to comment.