Skip to content

Commit

Permalink
Prepare for prod
Browse files Browse the repository at this point in the history
  • Loading branch information
SvineruS committed Oct 23, 2023
1 parent df07dc4 commit d394b05
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 30 deletions.
15 changes: 13 additions & 2 deletions scripts/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@ export const Igor = "0x55d46039e187b37a0201068dE189ecB63eaE87d2";
export const Andrii = "0xb16398c0698149Ae6EC342614830bC0511b83CAf";
export const Rory = "0x40B7d71E70fA6311cB0b300c1Ba6926A2A9000b8";
export const Kevin = "0x55feDD7843efc88A9ddd066B2ec2C8618C38fB62";
export const Stefan = ""; // TODO
export const Seth = ""; // TODO
export const Seth = "0x6fA040aD7e94f905a29536Ba786D433638FeD19b";
export const Valerii = "0x5700F8e0ae3d80964f7718EA625E3a2CB4D2096d";
export const Oleksii = "0xa5E32D3fB342D9Ed3135fD5cb59a102AC8ED7B85";
export const Olena = "0xe620e1F969Bc3a24Ac96D527220AD6B6e2d12843";
export const Alina = "0x787afc1E7a61af49D7B94F8E774aC566D1B60e99";
export const Alex = "0xe8592B3a9ee54472A0115262871eF43B5F3e8E53";
export const Sophie = "0xBc2e61822443b18070E387F045CcFAD33E6958d0";
export const Matthieu = "0x37d6bF7e8875137EefA8286e6AEA2cc4bFAF1247";
export const Michael = "0xB72aDaffEb3419487C49690Dc68e963F7d7D81AC";

// testing
export const SharedDev = "0xD693a3cc5686e74Ca2e72e8120A2F2013B8eE66E";
Expand All @@ -15,3 +22,7 @@ export const DimaTest3C = "0x60bBa9ca40D4A5ef331b6065dC58a13c91a67B3C";
export const DimaTest08 = "0xE6b7De299a3c76d8ee42Fd1B769b42Eec25baB08";

export const AndriiTest = "0xb017DcCC473499C83f1b553bE564f3CeAf002254";


export const Roadmap2023Addresses = [Valerii, Oleksii, Olena, Igor, Andrii, Alina, Alex, Seth, Sophie, Matthieu, Michael];
export const Roadmap2023MultisigSettings = [Roadmap2023Addresses, Roadmap2023Addresses.map(() => true), 50] as const; // all are initiators
3 changes: 2 additions & 1 deletion scripts/staking/deploy_basenodes_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
RewardsBank__factory,
ValidatorSet,
} from "../../typechain-types";
import {Roadmap2023MultisigSettings} from "../addresses";

export async function main() {
const { chainId } = await ethers.provider.getNetwork();
Expand All @@ -20,7 +21,7 @@ export async function main() {
const multisig = await deploy<Multisig__factory>({
contractName: ContractNames.BaseNodesManagerMultisig,
artifactName: "Multisig",
deployArgs: [[deployer.address], [true], 75, masterMultisig],
deployArgs: [...Roadmap2023MultisigSettings, masterMultisig],
signer: deployer,
loadIfAlreadyDeployed: true,
});
Expand Down
14 changes: 5 additions & 9 deletions scripts/staking/deploy_legacy_pool_manager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ethers } from "hardhat";
import {ethers} from "hardhat";
import {
Catalogue__factory,
Context__factory,
Head,
LegacyPoolsNodes_Manager__factory,
Expand All @@ -9,13 +8,12 @@ import {
StorageCatalogue__factory,
ValidatorSet,
} from "../../typechain-types";
import { deploy, loadDeployment } from "@airdao/deployments/deploying";
import { ContractNames } from "../../src";
import {deploy, loadDeployment} from "@airdao/deployments/deploying";
import {ContractNames} from "../../src";
import {Roadmap2023MultisigSettings} from "../addresses";

const HEAD = "0x0000000000000000000000000000000000000F10";

const configAbi = ["function APOLLO_DEPOSIT() view returns (uint)"];

async function main() {
const { chainId } = await ethers.provider.getNetwork();

Expand All @@ -28,7 +26,7 @@ async function main() {
const multisig = await deploy<Multisig__factory>({
contractName: ContractNames.LegacyPoolManagerMultisig,
artifactName: "Multisig",
deployArgs: [[deployer.address], [true], 75, masterMultisig],
deployArgs: [...Roadmap2023MultisigSettings, masterMultisig],
signer: deployer,
loadIfAlreadyDeployed: true,
});
Expand Down Expand Up @@ -64,8 +62,6 @@ async function main() {
await (await rewardsBank.grantRole(await rewardsBank.DEFAULT_ADMIN_ROLE(), multisig.address)).wait();
await (await validatorSet.grantRole(await validatorSet.STAKING_MANAGER_ROLE(), manager.address)).wait();

// await (await manager.transferOwnership(multisig.address)).wait();
// console.log("transferred ownership to multisig", multisig.address);
}

if (require.main === module) {
Expand Down
10 changes: 5 additions & 5 deletions scripts/staking/deploy_servernodes_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
ValidatorSet,
} from "../../typechain-types";
import { deploy, loadDeployment } from "@airdao/deployments/deploying";
import {Roadmap2023MultisigSettings} from "../addresses";

export async function main() {
const { chainId } = await ethers.provider.getNetwork();
Expand All @@ -22,7 +23,7 @@ export async function main() {
const multisig = await deploy<Multisig__factory>({
contractName: ContractNames.ServerNodesManagerMultisig,
artifactName: "Multisig",
deployArgs: [[deployer.address], [true], 75, masterMultisig],
deployArgs: [...Roadmap2023MultisigSettings, masterMultisig],
signer: deployer,
loadIfAlreadyDeployed: true,
});
Expand All @@ -42,10 +43,9 @@ export async function main() {
signer: deployer,
});

// const onboardingDelay = 15 * 24 * 60 * 60; // 15d
const onboardingDelay = 0; // for testing, todo remove
const unstakeLockTime = 15 * 24 * 60 * 60; // 15d
const minStakeAmount = ethers.utils.parseEther("1000"); // 1000 AMB
const onboardingDelay = 0;
const unstakeLockTime = 0;
const minStakeAmount = ethers.utils.parseEther("1000000"); // 1M AMB

const manager = await deploy<ServerNodes_Manager__factory>({
contractName: ContractNames.ServerNodesManager,
Expand Down
3 changes: 2 additions & 1 deletion scripts/staking/deploy_treasury.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ethers } from "hardhat";
import { deploy, loadDeployment } from "@airdao/deployments/deploying";
import { ContractNames } from "../../src";
import { Multisig__factory, Treasury__factory } from "../../typechain-types";
import {Roadmap2023MultisigSettings} from "../addresses";

async function main() {
const { chainId } = await ethers.provider.getNetwork();
Expand All @@ -13,7 +14,7 @@ async function main() {
const multisig = await deploy<Multisig__factory>({
contractName: ContractNames.TreasuryMultisig,
artifactName: "Multisig",
deployArgs: [[deployer.address], [true], 75, masterMultisig],
deployArgs: [...Roadmap2023MultisigSettings, masterMultisig],
signer: deployer,
loadIfAlreadyDeployed: true,
});
Expand Down
20 changes: 11 additions & 9 deletions scripts/staking/deploy_validatorset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ethers, network } from "hardhat";
import { ContractNames } from "../../src";
import { Multisig__factory, ValidatorSet__factory } from "../../typechain-types";
import { deploy, loadDeployment } from "@airdao/deployments/deploying";
import {Roadmap2023MultisigSettings} from "../addresses";

export async function main() {
const { chainId } = await ethers.provider.getNetwork();
Expand All @@ -12,29 +13,30 @@ export async function main() {
const multisig = await deploy<Multisig__factory>({
contractName: ContractNames.ValidatorSetMultisig,
artifactName: "Multisig",
deployArgs: [[deployer.address], [true], 75, masterMultisig],
deployArgs: [...Roadmap2023MultisigSettings, masterMultisig],
signer: deployer,
loadIfAlreadyDeployed: true,
});

// todo
// todo get block rewards from legacy fee contract
const baseReward = ethers.utils.parseEther("14");
const topStakesCount = 200;

const rewardsOracleAddress =
network.name == "main"
? "0xCa8Ee7368E4d415361A1A860974A99758dDd5019"
: "0xb0857e3203f9e392c83f746da9a6a2ddeb6b69af"; //384cbfc4a2218ab4a5ba81e6888073ad97f98f7f7a4ff52f3c6c0eb5407fee6b

const validatorSet = await deploy<ValidatorSet__factory>({
contractName: ContractNames.ValidatorSet,
artifactName: "ValidatorSet",
deployArgs: [deployer.address, 1, 200],
deployArgs: [rewardsOracleAddress, baseReward, topStakesCount],
signer: deployer,
isUpgradeableProxy: true,
});

const rewardsOracleAddress =
network.name == "main"
? "?" // todo
: "0xb0857e3203f9e392c83f746da9a6a2ddeb6b69af"; //384cbfc4a2218ab4a5ba81e6888073ad97f98f7f7a4ff52f3c6c0eb5407fee6b

await (await validatorSet.grantRole(await validatorSet.DEFAULT_ADMIN_ROLE(), multisig.address)).wait();
await (await validatorSet.grantRole(await validatorSet.REWARD_ORACLE_ROLE(), multisig.address)).wait();
await (await validatorSet.grantRole(await validatorSet.REWARD_ORACLE_ROLE(), rewardsOracleAddress)).wait();
}

if (require.main === module) {
Expand Down
8 changes: 5 additions & 3 deletions scripts/staking/migrate_to_new_staking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ async function main() {
const multiplexer = new ethers.Contract(multiplexerAddress, multiplexerAbi);

if (!(await fees.isAdmin(deployer.address))) {
if (network.name === "main") throw new Error(`${deployer.address} is not a admin`);
console.warn(`${deployer.address} is not a admin`);
await submitMultisigTx(multisig, multiplexer, multiplexer.populateTransaction.addAdmin(deployer.address));
}
if (!(await fees.paused())) {
if (network.name === "main") throw new Error("legacy contracts doesn't paused!");
console.warn("legacy contracts doesn't paused!");
await submitMultisigTx(multisig, multiplexer, multiplexer.populateTransaction.setPaused(true));
}
Expand Down Expand Up @@ -135,17 +137,17 @@ async function main() {

// todo uncomment lines below before prod
console.log("setup ownership for baseNodes");
// await (await baseNodesManager.revokeRole(defaultAdminRole, deployer.address)).wait();
await (await baseNodesManager.revokeRole(defaultAdminRole, deployer.address)).wait();

console.log("setup ownership for serverNodes");
// await (await serverNodesManager.revokeRole(defaultAdminRole, deployer.address)).wait();
await (await serverNodesManager.revokeRole(defaultAdminRole, deployer.address)).wait();

console.log("setup ownership for poolNodes");
const poolNodesMultisig = loadDeployment(ContractNames.LegacyPoolManagerMultisig, chainId).address;
await (await poolNodesManager.transferOwnership(poolNodesMultisig)).wait();

console.log("setup ownership for validatorset");
// await (await validatorSet.revokeRole(defaultAdminRole, deployer.address)).wait();
await (await validatorSet.revokeRole(defaultAdminRole, deployer.address)).wait();
}

async function getOldStakes(depositStoreAddr: string, poolsStoreAddr: string, rolesEventEmitterAddr: string) {
Expand Down

0 comments on commit d394b05

Please sign in to comment.