From 9ddf18e15844083bb4ace8827dcc511ba9ae36fe Mon Sep 17 00:00:00 2001 From: svin Date: Tue, 19 Sep 2023 18:01:50 +0300 Subject: [PATCH 01/19] Add `baseRewardSettings` - data required for rewards oracle --- contracts/consensus/ValidatorSet.sol | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/contracts/consensus/ValidatorSet.sol b/contracts/consensus/ValidatorSet.sol index 37e3a85d..ce085702 100644 --- a/contracts/consensus/ValidatorSet.sol +++ b/contracts/consensus/ValidatorSet.sol @@ -40,7 +40,9 @@ contract ValidatorSet is UUPSUpgradeable, OnBlockNotifier, AccessControlEnumerab uint public topStakesCount; // max validators count uint public baseReward; // base reward for validators; updated by reward oracle - + uint64[5] internal _baseRewardSettings; // settings for base reward oracle: [0] - isEnabled + // [1] - min %, [2] - max % (bips), + // [3] - min reward, [4] - max reward (bips of amb) // NOTE: nodeAddresses here address[] internal finalizedValidators; // consensus validators @@ -55,7 +57,7 @@ contract ValidatorSet is UUPSUpgradeable, OnBlockNotifier, AccessControlEnumerab uint internal _latestRewardBlock; // block when reward was called last time (to prevent call more then once) uint internal _latestRemoveFromTopBlock; // block when node was removed from top list last time (to prevent call more then once per finalization) - uint256[19] private __gap; + uint256[20] private __gap; event InitiateChange(bytes32 indexed parentHash, address[] newSet); // emitted when topStakes changes and need to be finalized event ValidatorSetFinalized(address[] newSet); // emitted when topStakes finalized to finalizedValidators @@ -90,6 +92,8 @@ contract ValidatorSet is UUPSUpgradeable, OnBlockNotifier, AccessControlEnumerab baseReward = _baseReward; topStakesCount = _topStakesCount; + _baseRewardSettings = [1, 16.6 * 10000, 100 * 10000, 14 * 10000, 60.8 * 10000]; // default settings: enabled, 16.6% = 14 amb, 100% = 60.8 amb + _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); _setupRole(REWARD_ORACLE_ROLE, _rewardOracle); } @@ -132,7 +136,6 @@ contract ValidatorSet is UUPSUpgradeable, OnBlockNotifier, AccessControlEnumerab return result; } - // STAKING POOL METHODS function newStake(address nodeAddress, uint amount, bool isAlwaysTop) external onlyRole(STAKING_MANAGER_ROLE) { @@ -169,7 +172,7 @@ contract ValidatorSet is UUPSUpgradeable, OnBlockNotifier, AccessControlEnumerab totalStakeAmount -= amount; stake.amount -= amount; - emit StakeChanged(nodeAddress, msg.sender, -int(amount)); + emit StakeChanged(nodeAddress, msg.sender, - int(amount)); if (stake.amount == 0) { _removeStake(nodeAddress, isInTopStakes); @@ -186,8 +189,6 @@ contract ValidatorSet is UUPSUpgradeable, OnBlockNotifier, AccessControlEnumerab emit Reward(msg.sender, nodeAddress, rewardReceiver, nodeOwner, tokenAddress, amount); } - - // ADMIN METHODS @@ -207,6 +208,11 @@ contract ValidatorSet is UUPSUpgradeable, OnBlockNotifier, AccessControlEnumerab _removeListener(listener); } + function setRewardSettings(uint64[5] memory newSettings) public onlyRole(DEFAULT_ADMIN_ROLE) { + _baseRewardSettings = newSettings; + } + + function _authorizeUpgrade(address) internal override onlyRole(DEFAULT_ADMIN_ROLE) {} @@ -231,16 +237,16 @@ contract ValidatorSet is UUPSUpgradeable, OnBlockNotifier, AccessControlEnumerab _tryMoveFromQueue(); } - // ORACLE METHODS + function getRewardSettings() public view returns (uint64[5] memory){ + return _baseRewardSettings; + } + function setReward(uint _baseReward) public onlyRole(REWARD_ORACLE_ROLE) { baseReward = _baseReward; } - - - // PRIVATE METHODS function _topValidatorsChanged() internal { @@ -264,7 +270,6 @@ contract ValidatorSet is UUPSUpgradeable, OnBlockNotifier, AccessControlEnumerab } } - // HELPERS @@ -334,6 +339,7 @@ contract ValidatorSet is UUPSUpgradeable, OnBlockNotifier, AccessControlEnumerab } } + function _tryMoveToQueue() internal { if (topStakes.length <= topStakesCount) return; if (block.number < _latestRemoveFromTopBlock + finalizedValidators.length) return; // no more than once per round From 496deca149047fdfea36fb8bf12412a5730ea980 Mon Sep 17 00:00:00 2001 From: svin Date: Tue, 19 Sep 2023 19:46:44 +0300 Subject: [PATCH 02/19] Add Treasury --- contracts/consensus/ValidatorSet.sol | 32 +++++++--------- contracts/finance/Treasury.sol | 27 ++++++++++++++ contracts/staking/BaseNodes_Manager.sol | 10 ++++- contracts/staking/ServerNodes_Manager.sol | 17 +++++---- .../pools/LegacyPoolsNodes_Manager.sol | 12 ++++-- scripts/staking/deploy_basenodes_manager.ts | 3 +- scripts/staking/deploy_legacy_pool_manager.ts | 2 + scripts/staking/deploy_servernodes_manager.ts | 2 + scripts/staking/deploy_treasury.ts | 37 +++++++++++++++++++ src/contracts/names.ts | 17 +++------ test/staking/BaseNodes.ts | 4 ++ test/staking/ServerNodes.ts | 28 ++++++++------ 12 files changed, 136 insertions(+), 55 deletions(-) create mode 100644 contracts/finance/Treasury.sol create mode 100644 scripts/staking/deploy_treasury.ts diff --git a/contracts/consensus/ValidatorSet.sol b/contracts/consensus/ValidatorSet.sol index ce085702..3b189776 100644 --- a/contracts/consensus/ValidatorSet.sol +++ b/contracts/consensus/ValidatorSet.sol @@ -73,17 +73,12 @@ contract ValidatorSet is UUPSUpgradeable, OnBlockNotifier, AccessControlEnumerab event TopListNodeRemoved(address indexed nodeAddress); event Report(address indexed nodeAddress, uint malisciousType); - event Reward( - address indexed manager, - address indexed nodeAddress, - address indexed rewardReceiver, - address nodeOwner, - address tokenAddress, - uint256 amount - ); + event Reward(address indexed manager, address indexed nodeAddress, address indexed rewardReceiver, + address nodeOwner, address tokenAddress, uint256 amount); event RewardError(address stakingManager, string errorText); + function initialize( address _rewardOracle, uint _baseReward, @@ -216,6 +211,17 @@ contract ValidatorSet is UUPSUpgradeable, OnBlockNotifier, AccessControlEnumerab function _authorizeUpgrade(address) internal override onlyRole(DEFAULT_ADMIN_ROLE) {} + // ORACLE METHODS + + function getRewardSettings() public view returns (uint64[5] memory){ + return _baseRewardSettings; + } + + function setReward(uint _baseReward) public onlyRole(REWARD_ORACLE_ROLE) { + baseReward = _baseReward; + } + + // SUPERUSER (NODE) METHODS @@ -237,16 +243,6 @@ contract ValidatorSet is UUPSUpgradeable, OnBlockNotifier, AccessControlEnumerab _tryMoveFromQueue(); } - // ORACLE METHODS - - function getRewardSettings() public view returns (uint64[5] memory){ - return _baseRewardSettings; - } - - function setReward(uint _baseReward) public onlyRole(REWARD_ORACLE_ROLE) { - baseReward = _baseReward; - } - // PRIVATE METHODS function _topValidatorsChanged() internal { diff --git a/contracts/finance/Treasury.sol b/contracts/finance/Treasury.sol new file mode 100644 index 00000000..fbbcc05a --- /dev/null +++ b/contracts/finance/Treasury.sol @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.0; + +import "./Finance.sol"; + + +contract Treasury is Finance { + + uint public fee; // in base points (1/10000) + + constructor(address owner, uint _fee) Finance(owner) { + require(_fee <= 10000, "fee is too big"); + fee = _fee; + } + + function setFee(uint _fee) public onlyOwner { + require(_fee <= 10000, "fee is too big"); + fee = _fee; + } + + function calcFee(uint amount) public view returns (uint) { + return amount * fee / 10000; + } + + + // receive and withdraw functions are in Finance contract +} diff --git a/contracts/staking/BaseNodes_Manager.sol b/contracts/staking/BaseNodes_Manager.sol index 8f366abb..743d797c 100644 --- a/contracts/staking/BaseNodes_Manager.sol +++ b/contracts/staking/BaseNodes_Manager.sol @@ -6,20 +6,23 @@ import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol" import "./IStakeManager.sol"; import "../consensus/IValidatorSet.sol"; import "../funds/RewardsBank.sol"; +import "../finance/Treasury.sol"; // Manager, that can add and remove nodes from validator set TOP list (controlled by multisig) contract BaseNodes_Manager is UUPSUpgradeable, IStakeManager, AccessControlUpgradeable { IValidatorSet public validatorSet; // contract that manages validator set RewardsBank public rewardsBank; + Treasury public treasury; uint256[20] private __gap; function initialize( - IValidatorSet _validatorSet, RewardsBank _rewardsBank + IValidatorSet _validatorSet, RewardsBank _rewardsBank, Treasury _treasury ) public initializer { validatorSet = _validatorSet; rewardsBank = _rewardsBank; + treasury = _treasury; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); } @@ -44,6 +47,11 @@ contract BaseNodes_Manager is UUPSUpgradeable, IStakeManager, AccessControlUpgra function reward(address nodeAddress, uint amount) external { require(msg.sender == address(validatorSet), "Only validatorSet can call reward()"); + + uint treasuryAmount = treasury.calcFee(amount); + rewardsBank.withdrawAmb(payable(address(treasury)), treasuryAmount); + amount -= treasuryAmount; + rewardsBank.withdrawAmb(payable(nodeAddress), amount); validatorSet.emitReward(nodeAddress, nodeAddress, nodeAddress, address(0), amount); } diff --git a/contracts/staking/ServerNodes_Manager.sol b/contracts/staking/ServerNodes_Manager.sol index 86d25cd0..968c3c2b 100644 --- a/contracts/staking/ServerNodes_Manager.sol +++ b/contracts/staking/ServerNodes_Manager.sol @@ -9,6 +9,7 @@ import "../consensus/IValidatorSet.sol"; import {IOnBlockListener} from "../consensus/OnBlockNotifier.sol"; import "../LockKeeper.sol"; import "../funds/RewardsBank.sol"; +import "../finance/Treasury.sol"; // Manager, that allows users to register their nodes in validator set @@ -23,9 +24,9 @@ contract ServerNodes_Manager is UUPSUpgradeable, IStakeManager, IOnBlockListener IValidatorSet public validatorSet; // contract that manages validator set LockKeeper public lockKeeper; // contract that locks stakes - RewardsBank public rewardsBank; address public airBond; + Treasury public treasury; uint public onboardingDelay; // time that new node will be in queueStakes even if it has enough stake (only affects nodes without FLAG_ALWAYS_IN_TOP) uint public unstakeLockTime; // time that funds will be locked after unstake @@ -43,13 +44,14 @@ contract ServerNodes_Manager is UUPSUpgradeable, IStakeManager, IOnBlockListener uint256[20] private __gap; function initialize( - IValidatorSet _validatorSet, LockKeeper _lockKeeper, RewardsBank _rewardsBank, address _airBond, + IValidatorSet _validatorSet, LockKeeper _lockKeeper, RewardsBank _rewardsBank, address _airBond, Treasury _treasury, uint _onboardingDelay, uint _unstakeLockTime, uint _minStakeAmount ) public initializer { validatorSet = _validatorSet; lockKeeper = _lockKeeper; rewardsBank = _rewardsBank; airBond = _airBond; + treasury = _treasury; onboardingDelay = _onboardingDelay; unstakeLockTime = _unstakeLockTime; @@ -58,7 +60,6 @@ contract ServerNodes_Manager is UUPSUpgradeable, IStakeManager, IOnBlockListener _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); } - // USER METHODS function newStake(address nodeAddress, address rewardAddress) payable public whenNotPaused { @@ -98,7 +99,6 @@ contract ServerNodes_Manager is UUPSUpgradeable, IStakeManager, IOnBlockListener if (validatorSet.getNodeStake(nodeAddress) > 0) // only if node already validator validatorSet.unstake(nodeAddress, amount); - // cancel previous lock (if exists). canceledAmount will be added to new lock uint canceledAmount; if (lockKeeper.getLock(lockedWithdraws[nodeAddress]).totalClaims > 0) // prev lock exists @@ -111,7 +111,7 @@ contract ServerNodes_Manager is UUPSUpgradeable, IStakeManager, IOnBlockListener string(abi.encodePacked("ServerNodes unstake: ", nodeAddress)) ); - emit StakeChanged(nodeAddress, msg.sender, -int(amount)); + emit StakeChanged(nodeAddress, msg.sender, - int(amount)); } // unlock latest withdraw to stake @@ -148,7 +148,6 @@ contract ServerNodes_Manager is UUPSUpgradeable, IStakeManager, IOnBlockListener return result; } - // VALIDATOR SET METHODS function reward(address nodeAddress, uint amount) external { @@ -156,6 +155,10 @@ contract ServerNodes_Manager is UUPSUpgradeable, IStakeManager, IOnBlockListener Stake memory stakeStruct = stakes[nodeAddress]; require(stakeStruct.stake > 0, "nodeAddress not in stakes"); + uint treasuryAmount = treasury.calcFee(amount); + rewardsBank.withdrawAmb(payable(address(treasury)), treasuryAmount); + amount -= treasuryAmount; + uint bondsReward = amount * _getBondsPercent(stakeStruct.timestampStake) / 100; uint nativeReward = amount - bondsReward; @@ -185,7 +188,6 @@ contract ServerNodes_Manager is UUPSUpgradeable, IStakeManager, IOnBlockListener // todo } - // MULTISIG METHODS function changeMinStakeAmount(uint newMinStakeAmount) public onlyRole(DEFAULT_ADMIN_ROLE) { @@ -257,7 +259,6 @@ contract ServerNodes_Manager is UUPSUpgradeable, IStakeManager, IOnBlockListener } } - // move nodes from onboardingWaitingList to topStakes function _checkOnboardingWaitingList() internal { uint minTimestampForOnboarding = block.timestamp - onboardingDelay; diff --git a/contracts/staking/pools/LegacyPoolsNodes_Manager.sol b/contracts/staking/pools/LegacyPoolsNodes_Manager.sol index d71cd875..21b78d2c 100644 --- a/contracts/staking/pools/LegacyPoolsNodes_Manager.sol +++ b/contracts/staking/pools/LegacyPoolsNodes_Manager.sol @@ -10,6 +10,7 @@ import "../../consensus/IValidatorSet.sol"; import "./Legacy/IPoolsNodesManager.sol"; import "./Legacy/ICatalogueContracts.sol"; import "../../funds/RewardsBank.sol"; +import "../../finance/Treasury.sol"; // Manager that allows to register staking pools; // Each pool can onboard a node (via this manager) when reached some stake goal @@ -18,6 +19,7 @@ contract LegacyPoolsNodes_Manager is UUPSUpgradeable, OwnableUpgradeable, Pausab IValidatorSet public validatorSet; // contract that manages validator set RewardsBank public rewardsBank; + Treasury public treasury; uint public minApolloDeposit; @@ -38,6 +40,7 @@ contract LegacyPoolsNodes_Manager is UUPSUpgradeable, OwnableUpgradeable, Pausab uint _minApolloDeposit, IValidatorSet _validatorSet, RewardsBank _rewardsBank, + Treasury _treasury, PoolsStore _poolsStore, ApolloDepositStore _apolloDepositStore, RolesEventEmitter _rolesEventEmitter, @@ -47,6 +50,7 @@ contract LegacyPoolsNodes_Manager is UUPSUpgradeable, OwnableUpgradeable, Pausab minApolloDeposit = _minApolloDeposit; validatorSet = _validatorSet; rewardsBank = _rewardsBank; + treasury = _treasury; poolsStore = _poolsStore; apolloDepositStore = _apolloDepositStore; @@ -54,7 +58,6 @@ contract LegacyPoolsNodes_Manager is UUPSUpgradeable, OwnableUpgradeable, Pausab poolEventsEmitter = _poolEventsEmitter; } - // ONLY POOL METHODS @@ -99,7 +102,6 @@ contract LegacyPoolsNodes_Manager is UUPSUpgradeable, OwnableUpgradeable, Pausab return poolsStore.nextId(); } - // OWNER METHODS function addPool(address pool) public onlyOwner { @@ -140,6 +142,10 @@ contract LegacyPoolsNodes_Manager is UUPSUpgradeable, OwnableUpgradeable, Pausab address poolAddress = node2pool[nodeAddress]; require(poolAddress != address(0), "Can't find pool for node"); + uint treasuryAmount = treasury.calcFee(amount); + rewardsBank.withdrawAmb(payable(address(treasury)), treasuryAmount); + amount -= treasuryAmount; + rewardsBank.withdrawAmb(payable(address(this)), amount); IPool(poolAddress).addReward{value: amount}(); validatorSet.emitReward(nodeAddress, address(this), address(this), address(0), amount); @@ -149,7 +155,6 @@ contract LegacyPoolsNodes_Manager is UUPSUpgradeable, OwnableUpgradeable, Pausab } - // VIEW METHODS function getDeposit(address nodeAddress) public view returns (uint) { @@ -167,7 +172,6 @@ contract LegacyPoolsNodes_Manager is UUPSUpgradeable, OwnableUpgradeable, Pausab return poolsStore.getPools(0, count); } - // INTERNAL receive() external payable {} diff --git a/scripts/staking/deploy_basenodes_manager.ts b/scripts/staking/deploy_basenodes_manager.ts index 0ed6811e..8b65dafa 100644 --- a/scripts/staking/deploy_basenodes_manager.ts +++ b/scripts/staking/deploy_basenodes_manager.ts @@ -15,6 +15,7 @@ export async function main() { const validatorSet = loadDeployment(ContractNames.ValidatorSet, chainId, deployer) as ValidatorSet; const masterMultisig = loadDeployment(ContractNames.MasterMultisig, chainId).address; + const treasury = loadDeployment(ContractNames.Treasury, chainId); const multisig = await deploy({ contractName: ContractNames.BaseNodesManagerMultisig, @@ -34,7 +35,7 @@ export async function main() { const manager = await deploy({ contractName: ContractNames.BaseNodesManager, artifactName: "BaseNodes_Manager", - deployArgs: [validatorSet.address, rewardsBank.address], + deployArgs: [validatorSet.address, rewardsBank.address, treasury.address], signer: deployer, isUpgradeableProxy: true, }); diff --git a/scripts/staking/deploy_legacy_pool_manager.ts b/scripts/staking/deploy_legacy_pool_manager.ts index 21da9ff8..eaca86bd 100644 --- a/scripts/staking/deploy_legacy_pool_manager.ts +++ b/scripts/staking/deploy_legacy_pool_manager.ts @@ -23,6 +23,7 @@ async function main() { const validatorSet = loadDeployment(ContractNames.ValidatorSet, chainId, deployer) as ValidatorSet; const masterMultisig = loadDeployment(ContractNames.MasterMultisig, chainId).address; + const treasury = loadDeployment(ContractNames.Treasury, chainId); const multisig = await deploy({ contractName: ContractNames.LegacyPoolManagerMultisig, @@ -53,6 +54,7 @@ async function main() { minApolloDeposit, validatorSet.address, rewardsBank.address, + treasury.address, await oldStorageCatalogue.poolsStore(), await oldStorageCatalogue.apolloDepositStore(), await oldStorageCatalogue.rolesEventEmitter(), diff --git a/scripts/staking/deploy_servernodes_manager.ts b/scripts/staking/deploy_servernodes_manager.ts index 72c7372c..cb454e83 100644 --- a/scripts/staking/deploy_servernodes_manager.ts +++ b/scripts/staking/deploy_servernodes_manager.ts @@ -17,6 +17,7 @@ export async function main() { const validatorSet = loadDeployment(ContractNames.ValidatorSet, chainId, deployer) as ValidatorSet; const masterMultisig = loadDeployment(ContractNames.MasterMultisig, chainId).address; const airBond = loadDeployment(ContractNames.AirBond, chainId); + const treasury = loadDeployment(ContractNames.Treasury, chainId); const multisig = await deploy({ contractName: ContractNames.ServerNodesManagerMultisig, @@ -53,6 +54,7 @@ export async function main() { lockKeeper.address, rewardsBank.address, airBond.address, + treasury.address, onboardingDelay, unstakeLockTime, minStakeAmount, diff --git a/scripts/staking/deploy_treasury.ts b/scripts/staking/deploy_treasury.ts new file mode 100644 index 00000000..65b67c36 --- /dev/null +++ b/scripts/staking/deploy_treasury.ts @@ -0,0 +1,37 @@ +import { ethers } from "hardhat"; +import { deploy, loadDeployment } from "@airdao/deployments/deploying"; +import { ContractNames } from "../../src"; +import { Multisig__factory, Treasury__factory } from "../../typechain-types"; + +async function main() { + const { chainId } = await ethers.provider.getNetwork(); + + const [deployer] = await ethers.getSigners(); + + const masterMultisig = loadDeployment(ContractNames.MasterMultisig, chainId).address; + + const multisig = await deploy({ + contractName: ContractNames.TreasuryMultisig, + artifactName: "Multisig", + deployArgs: [[deployer.address], [true], 75, masterMultisig], + signer: deployer, + loadIfAlreadyDeployed: true, + }); + + await deploy({ + contractName: ContractNames.Treasury, + artifactName: "Treasury", + signer: deployer, + deployArgs: [ + multisig.address, + 0.1 * 10000, // 10% fee + ], + }); +} + +if (require.main === module) { + main().catch((error) => { + console.error(error); + process.exitCode = 1; + }); +} diff --git a/src/contracts/names.ts b/src/contracts/names.ts index 980b57d2..3271c74c 100644 --- a/src/contracts/names.ts +++ b/src/contracts/names.ts @@ -35,6 +35,9 @@ export enum ContractNames { ServerNodesManagerMultisig = "ServerNodesManager_Multisig", ServerNodesManagerRewardsBank = "ServerNodesManager_RewardsBank", + Treasury = "Treasury", + TreasuryMultisig = "Treasury_Multisig", + // funds AirBond = "AirBond", @@ -60,19 +63,9 @@ export const MULTISIGS = { [ContractNames.BaseNodesManagerRewardsBank]: ContractNames.BaseNodesManagerMultisig, [ContractNames.LegacyPoolManagerRewardsBank]: ContractNames.LegacyPoolManagerMultisig, [ContractNames.ServerNodesManagerRewardsBank]: ContractNames.ServerNodesManagerMultisig, + [ContractNames.Treasury]: ContractNames.TreasuryMultisig, }; -export const slavesMultisigsNames = [ - ContractNames.FinanceMasterMultisig, - ContractNames.FinanceRewardsMultisig, - ContractNames.FinanceInvestorsMultisig, - ContractNames.FinanceTeamMultisig, - ContractNames.FinanceEcosystemMultisig, - - ContractNames.ValidatorSetMultisig, - ContractNames.BaseNodesManagerMultisig, - ContractNames.LegacyPoolManagerMultisig, - ContractNames.ServerNodesManagerMultisig, -]; +export const slavesMultisigsNames = [...new Set(Object.values(MULTISIGS))]; export const multisigsNames = [ContractNames.MasterMultisig, ...slavesMultisigsNames]; diff --git a/test/staking/BaseNodes.ts b/test/staking/BaseNodes.ts index 982be9f0..251f1435 100644 --- a/test/staking/BaseNodes.ts +++ b/test/staking/BaseNodes.ts @@ -6,6 +6,7 @@ import { BaseNodes_Manager__factory, RewardsBank__factory, TEST_ValidatorSet, + Treasury__factory, } from "../../typechain-types"; import { expect } from "chai"; @@ -21,10 +22,13 @@ describe("BaseNodes", function () { const validatorSet = (await upgrades.deployProxy(ValidatorSetFactory, [owner.address, 10, 2])) as TEST_ValidatorSet; const rewardsBank = await new RewardsBank__factory(owner).deploy(); + const treasury = await new Treasury__factory(owner).deploy(owner.address, 0.1 * 10000); + const BaseNodesFactory = await ethers.getContractFactory("BaseNodes_Manager"); const baseNodes = (await upgrades.deployProxy(BaseNodesFactory, [ validatorSet.address, rewardsBank.address, + treasury.address, ])) as BaseNodes_Manager; await rewardsBank.grantRole(await rewardsBank.DEFAULT_ADMIN_ROLE(), baseNodes.address); diff --git a/test/staking/ServerNodes.ts b/test/staking/ServerNodes.ts index 2d9d143e..f77c0269 100644 --- a/test/staking/ServerNodes.ts +++ b/test/staking/ServerNodes.ts @@ -9,6 +9,7 @@ import { RewardsBank__factory, ServerNodes_Manager, TEST_ValidatorSet, + Treasury__factory, } from "../../typechain-types"; import { expect } from "chai"; import { AddressZero } from "@ethersproject/constants"; @@ -31,6 +32,7 @@ describe("ServerNodes", function () { const lockKeeper = await new LockKeeper__factory(owner).deploy(); const airBond = await new AirBond__factory(owner).deploy(owner.address); const rewardsBank = await new RewardsBank__factory(owner).deploy(); + const treasury = await new Treasury__factory(owner).deploy(owner.address, 0.1 * 10000); const ServerNodesFactory = await ethers.getContractFactory("ServerNodes_Manager"); const serverNodes = (await upgrades.deployProxy(ServerNodesFactory, [ @@ -38,6 +40,7 @@ describe("ServerNodes", function () { lockKeeper.address, rewardsBank.address, airBond.address, + treasury.address, onboardingDelay, 60 * 5, 42, @@ -230,7 +233,7 @@ describe("ServerNodes", function () { it("reward with bonds (amb to stake, bonds to owner address)", async function () { await time.setNextBlockTimestamp(T + 10000); - const [nativeReward, bondsReward] = getRewardsValues(10, getBondsPercent(10000)); + const [nativeReward, bondsReward] = await getRewardsValues(10, getBondsPercent(10000)); await expect(serverNodes.connect(validatorSetSigner).reward(owner.address, 10)) .to.changeEtherBalance(owner, 0) // todo why owner balance is changed? @@ -243,7 +246,7 @@ describe("ServerNodes", function () { await serverNodes.setRewardsAddress(owner.address, rewardAddress.address); await time.setNextBlockTimestamp(T + 10000); - const [nativeReward, bondsReward] = getRewardsValues(10, getBondsPercent(10000)); + const [nativeReward, bondsReward] = await getRewardsValues(10, getBondsPercent(10000)); await expect(serverNodes.connect(validatorSetSigner).reward(owner.address, 10)) .to.changeEtherBalance(rewardAddress, nativeReward) @@ -254,7 +257,7 @@ describe("ServerNodes", function () { it("reward with bonds (amb and bonds to reward address (which is owner))", async function () { await serverNodes.setRewardsAddress(owner.address, owner.address); await time.setNextBlockTimestamp(T + 10000); - const [nativeReward, bondsReward] = getRewardsValues(10, getBondsPercent(10000)); + const [nativeReward, bondsReward] = await getRewardsValues(10, getBondsPercent(10000)); await expect(serverNodes.connect(validatorSetSigner).reward(owner.address, 10)) .to.changeEtherBalance(owner, nativeReward) @@ -266,7 +269,7 @@ describe("ServerNodes", function () { it("reward without bonds (3 years)", async function () { const years3 = 3 * 365 * 24 * 60 * 60; await time.setNextBlockTimestamp(T + years3); - const [nativeReward, bondsReward] = getRewardsValues(10, getBondsPercent(years3)); + const [nativeReward, bondsReward] = await getRewardsValues(10, getBondsPercent(years3)); expect(bondsReward).to.be.eq(0); await expect(serverNodes.connect(validatorSetSigner).reward(owner.address, 10)) @@ -278,7 +281,7 @@ describe("ServerNodes", function () { it("reward without bonds (4 years)", async function () { const years4 = 4 * 365 * 24 * 60 * 60; await time.setNextBlockTimestamp(T + years4); - const [nativeReward, bondsReward] = getRewardsValues(10, getBondsPercent(years4)); + const [nativeReward, bondsReward] = await getRewardsValues(10, getBondsPercent(years4)); expect(bondsReward).to.be.eq(0); await expect(serverNodes.connect(validatorSetSigner).reward(owner.address, 10)) @@ -434,13 +437,16 @@ describe("ServerNodes", function () { expect(await serverNodes.paused()).to.be.false; }); }); -}); -function getRewardsValues(amount: number, bondsPercent: number) { - const bondsReward = Math.floor((amount * bondsPercent) / 100); - const nativeReward = amount - bondsReward; - return [nativeReward, bondsReward]; -} + async function getRewardsValues(amount: number, bondsPercent: number) { + const treasuryFee = +(await Treasury__factory.connect(await serverNodes.treasury(), owner).calcFee(amount)); + amount -= treasuryFee; + + const bondsReward = Math.floor((amount * bondsPercent) / 100); + const nativeReward = amount - bondsReward; + return [nativeReward, bondsReward]; + } +}); function getBondsPercent(stakingTime: number) { return 0; // for now From b34c77291682b3c58e3a6777608e044b984b404f Mon Sep 17 00:00:00 2001 From: svin Date: Thu, 21 Sep 2023 13:48:34 +0300 Subject: [PATCH 03/19] Deploy roadmap part 2 to devnet --- deployments/30746.json | 176 ++++++++++++++++++++++++++++------------- package.json | 5 +- 2 files changed, 122 insertions(+), 59 deletions(-) diff --git a/deployments/30746.json b/deployments/30746.json index 9b865463..b49b0200 100644 --- a/deployments/30746.json +++ b/deployments/30746.json @@ -1,6 +1,6 @@ { "MasterMultisig": { - "address": "0x096B5914C95C34Df19500DAff77470C845EC749D", + "address": "0x761314376Ac00758DB402b47F44104529768605b", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -39,11 +39,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0xaa73aec53cf39b18deefcd47515cdba310f67d78be2082ac0390adbc0f67aec1", + "deployTx": "0x8c98757ed60c25ec75439b110da89e6f2174854262762f4c31fb9c5be495b439", "fullyQualifiedName": "contracts/multisig/MasterMultisig.sol:MasterMultisig" }, "FinanceMaster_Multisig": { - "address": "0x8c33e9D24eBf3918D37eC2F26BaE044C9fD30Ea9", + "address": "0xFFafaD16D4C174cA8E403E764704eb2784037b26", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -79,11 +79,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x4fb46bd94d6878ad3d7dca1bff1b68b0998f0b8792ab546797ab5b9ec99636ce", + "deployTx": "0x525a98d76e44882802ccd4ba01a7f36205aefc4cb9944b7116a52c48f548adc9", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "FinanceMaster": { - "address": "0x55Be7dd776fAbe89d93bAC66ed1cf0Ab31bdd6eB", + "address": "0x5705Cf73136EDeE17Ce481Da589c4c0CaA36C693", "abi": [ "constructor(address owner, uint256 maxBanks_, uint256 maxBankBalance_)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", @@ -96,11 +96,11 @@ "function transferToBanks()", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0xd6fde1a84c0467c2893e1208caf10181f810db0ff0403717c1611a87153643fe", + "deployTx": "0x98f14ed3943487e8ddf04f0bae3306dd87ce49bd44d6967025fd803dfd6c7ea9", "fullyQualifiedName": "contracts/finance/MasterFinance.sol:MasterFinance" }, "FinanceRewards_Multisig": { - "address": "0x615D835e0C492b4309E79439765F66Db7BdcE200", + "address": "0x8C52c360270b324A65Cd4bD4a5e2DCBe6aF8f500", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -136,11 +136,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x44fe577e9273c8d07d5b5064e0cb8fa636c858e3ef76f40f30cda5bda1e876cd", + "deployTx": "0x4c19dcd1c37f60d19e3a0744a3763c59e18baf04e7ebaf431ff3e3e33a474236", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "FinanceRewards": { - "address": "0x0c3001D98a02dFFf10814E2e5e1DA5a276C2552a", + "address": "0xebd013e82004a58f0599d2f45918250e04d80Abf", "abi": [ "constructor(address owner)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", @@ -150,11 +150,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0xb91f416c06cadd97aa8de2e4ad92554de4cbc4f33f65114cdd59b8f9fffa2785", + "deployTx": "0xafb076dcc621288c9fd0261bee7fef6dcf5ee6540a025e3dac6d8eaf2a233316", "fullyQualifiedName": "contracts/finance/Finance.sol:Finance" }, "FinanceInvestors_Multisig": { - "address": "0x3B851d4d79C44AbBBF914D6bc61A2BdCC7387d85", + "address": "0x31Ec9254bf00cF1429c250398d30A711E19BffC3", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -190,11 +190,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0xdf9b3f842b475ba2de2a0d3ca2bee29278b8360eb2c19df15962341e06c3ade6", + "deployTx": "0x0b69fa6dc12110aa0efa034eee8259317c46d2d213bb2a1e7f44ffc1c82f9560", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "FinanceInvestors": { - "address": "0x7F4f5d586F33075F4Ac1D3FC11fb394Da6f7c041", + "address": "0x0784273B3eb7EC159bb48Da834e230fe583D11CC", "abi": [ "constructor(address owner)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", @@ -204,11 +204,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0x696fad3acae126323455f5c0186d7a87ee2acb3d86a0f70367150168e2dbf81a", + "deployTx": "0x3f976982c1f52893652147422afcfb31410afc9227a94b84d8ac0a1f8ad60c1f", "fullyQualifiedName": "contracts/finance/Finance.sol:Finance" }, "FinanceTeam_Multisig": { - "address": "0x9436CEC90DC41F03c7b679779D3B55dca5a02382", + "address": "0xB45121Ea4DB3878b564c617287bf9BDDD17CfD2A", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -244,11 +244,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0xd85d97fb0c931707434ce395ba1a1200674c8ac461882e436bb8af8f013cb348", + "deployTx": "0x98df2dda2cff4c9763ff3e5effe1dcc2eb427fd822f79b7f328cf4ceadc48a5c", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "FinanceTeam": { - "address": "0x132827Ee051b7276a2f85D6964F6182974aa243c", + "address": "0xb04D84FC6BA3202f741d0db0124d890e7A3493b7", "abi": [ "constructor(address owner)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", @@ -258,11 +258,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0xa800a9c00e080affc14eb92e6ef19003faf83aaec0e151e2ee1319702c3ab36b", + "deployTx": "0x27d05465442f451265a1dc3f61ab8d6445910b7056c0d9dd8620d6f279f06176", "fullyQualifiedName": "contracts/finance/Finance.sol:Finance" }, "FinanceEcosystem_Multisig": { - "address": "0x4db96017947838031561b35A643B2d9Dbf163241", + "address": "0xC6613c683f2d4684D806FAcb9D413f41221537c6", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -298,11 +298,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x4aa1e4e7c48ad27567764ac5e50df475a1ca6af57019994f8729fc56b91a7ca6", + "deployTx": "0x8672222504e7907b299567cf649c4eedbac1d863f526e7a5eb6a8e9f07f63cfe", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "FinanceEcosystem": { - "address": "0x090801d716A9d501F57519B1f4bd6aBD2961aa88", + "address": "0x7A70536307a0411d2Df2FE832CFa16231089dD6F", "abi": [ "constructor(address owner)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", @@ -312,11 +312,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0x0d8f264627bde51a97d6cd3809daa9b06c7a6acd71659c027c0ddf3a272155a4", + "deployTx": "0xd011f4471b2b456c9fb0f2bea62216c90d2622e774c04f2e2ffa3bee657b12b2", "fullyQualifiedName": "contracts/finance/Finance.sol:Finance" }, "AirBond": { - "address": "0x17c9b9A8BeeB1FE98566877AF442dbeBd0F5dB09", + "address": "0xBE94eFB16edFCB44b3De6C452062D1B599d3d40d", "abi": [ "constructor(address admin)", "event Approval(address indexed owner, address indexed spender, uint256 value)", @@ -346,11 +346,11 @@ "function transfer(address to, uint256 amount) returns (bool)", "function transferFrom(address from, address to, uint256 amount) returns (bool)" ], - "deployTx": "0xec8431520bcff907d0cbcbf614a7df835b08c060b49663b68934ecf8430a5c32", + "deployTx": "0xec75a144dcc53d083ad3393e077de9ae4f92174b087843d3ad3d4e4361e43521", "fullyQualifiedName": "contracts/funds/AirBond.sol:AirBond" }, "AirDrop": { - "address": "0xF01EF9dFf8cA6e4324b000812D75Aa4A67ee52ca", + "address": "0xe2672E824C249b24851389e69225959d1c6c1A1F", "abi": [ "constructor(address airBondToken_, address backendAddress_, uint256 minAmbBalance_, tuple(address user, bytes32 category, uint256 amount)[] claims) payable", "event Claim(address user, bytes32[] categories, uint256[] amounts)", @@ -368,11 +368,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0x291bd230ab0a19329dbc1eb8af4ed573db8df4d31bdbd17bfaf7e38e7120af32", + "deployTx": "0xac1f57700a37a261b5cb4d62ec921d1905c3e75f71ac7cc8ffdd6b536dce24a5", "fullyQualifiedName": "contracts/projects/airdrop/AirDrop.sol:AirDrop" }, "ValidatorSet_Multisig": { - "address": "0x58E98B0974A22270D974Ce914Fc430E048368546", + "address": "0x2B6d32BADB2F3C6f5D7CfEF07962a50109A57fA9", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -408,11 +408,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x57cae80a54a4718b54e6ab736a29a02c9449f82d113c1c39b928ed27a08dd961", + "deployTx": "0x14e898c192eb8111004f1757284c736ba612f9d310994f64501f5516752176c0", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "ValidatorSet": { - "address": "0xeeff62628dcD8E8AF2aA376C718f54602a54B5c5", + "address": "0xD11a85386e3C5Cc493A1440Ef7Fd99BFAF72477d", "abi": [ "event AdminChanged(address previousAdmin, address newAdmin)", "event BeaconUpgraded(address indexed beacon)", @@ -445,6 +445,7 @@ "function getBlockListeners() view returns (address[])", "function getNodeStake(address nodeAddress) view returns (uint256)", "function getQueuedStakes() view returns (address[])", + "function getRewardSettings() view returns (uint64[5])", "function getRoleAdmin(bytes32 role) view returns (bytes32)", "function getRoleMember(bytes32 role, uint256 index) view returns (address)", "function getRoleMemberCount(bytes32 role) view returns (uint256)", @@ -461,6 +462,7 @@ "function renounceRole(bytes32 role, address account)", "function revokeRole(bytes32 role, address account)", "function setReward(uint256 _baseReward)", + "function setRewardSettings(uint64[5] newSettings)", "function stake(address nodeAddress, uint256 amount)", "function stakes(address) view returns (uint256 amount, address stakingContract, bool isAlwaysTop)", "function supportsInterface(bytes4 interfaceId) view returns (bool)", @@ -470,15 +472,72 @@ "function upgradeTo(address newImplementation)", "function upgradeToAndCall(address newImplementation, bytes data) payable" ], - "deployTx": "0x4daeeb8bf726434b245a2d25e396d2f69d480607911eb3802b3a10d875dadf76", + "deployTx": "0x2ae7ba2673c302a89e3b81e6f54d01e94aad869cd167e54084a136b485d66711", "fullyQualifiedName": "contracts/consensus/ValidatorSet.sol:ValidatorSet", "proxy": { - "implementation": "0x7A70536307a0411d2Df2FE832CFa16231089dD6F", + "implementation": "0x1fEf4FA0e0a5988F02Ba11786c91d25e0d352eEA", "fullyQualifiedName": "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" } }, + "Treasury_Multisig": { + "address": "0x30eb4563F0E64963569847E357Cdc1fDE1adf1c7", + "abi": [ + "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", + "event Confirmation(address indexed sender, uint256 indexed txId)", + "event Execution(uint256 indexed txId)", + "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", + "event Revocation(address indexed sender, uint256 indexed txId)", + "event SignerAddition(address indexed signer, bool isInitiator)", + "event SignerRemoval(address indexed signer)", + "event Submission(uint256 indexed txId)", + "event ThresholdChange(uint256 required)", + "function changeSigners(address[] signersToRemove, address[] signersToAdd, bool[] isInitiatorFlags)", + "function changeThreshold(uint256 _threshold)", + "function checkBeforeSubmitTransaction(address destination, uint256 value, bytes data) payable", + "function confirmTransaction(uint256 txId)", + "function confirmations(uint256, address) view returns (bool)", + "function getConfirmations(uint256 txId) view returns (address[])", + "function getInitiatorsCount() view returns (uint256)", + "function getRequiredSignersCount() view returns (uint256)", + "function getSigners() view returns (address[], bool[])", + "function getTransactionData(uint256 txId) view returns (tuple(address destination, uint256 value, bytes data, bool executed), address[])", + "function getTransactionIds(uint256 from, uint256 to, bool pending, bool executed) view returns (uint256[] result)", + "function isConfirmed(uint256 txId) view returns (bool)", + "function isInitiator(address) view returns (bool)", + "function isSigner(address) view returns (bool)", + "function owner() view returns (address)", + "function renounceOwnership()", + "function revokeConfirmation(uint256 txId)", + "function signers(uint256) view returns (address)", + "function submitTransaction(address destination, uint256 value, bytes data) payable returns (uint256 txId)", + "function threshold() view returns (uint256)", + "function transactionCount() view returns (uint256)", + "function transactions(uint256) view returns (address destination, uint256 value, bytes data, bool executed)", + "function transferOwnership(address newOwner)", + "function withdraw(address to, uint256 amount)" + ], + "deployTx": "0x6708a31d47119ae35b870db926eae03617de7b6914e561daf13810a9b9337341", + "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" + }, + "Treasury": { + "address": "0xFF9F502976E7bD2b4901aD7Dd1131Bb81E5567de", + "abi": [ + "constructor(address owner, uint256 _fee)", + "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", + "event Withdraw(address addressTo, uint256 amount)", + "function calcFee(uint256 amount) view returns (uint256)", + "function fee() view returns (uint256)", + "function owner() view returns (address)", + "function renounceOwnership()", + "function setFee(uint256 _fee)", + "function transferOwnership(address newOwner)", + "function withdraw(address addressTo, uint256 amount)" + ], + "deployTx": "0x73548ec5c871b4df35743ad43b6bf0f1a76a6d1bef11d3b79d4228a839319b37", + "fullyQualifiedName": "contracts/finance/Treasury.sol:Treasury" + }, "BaseNodesManager_Multisig": { - "address": "0x1D49c49CD99d149142a4B9c673bbeacB8cBe194c", + "address": "0x99d7DEf637ad71Da08D1a1f9b917789B805cCb0a", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -514,11 +573,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x93575f8c289e2e5620d9956e395bc7714c023e9113dd933497a8abc9646da1bc", + "deployTx": "0x1ffd4bbba28d8522ce0e750298080161d47dbe9442709f92496c9f0bd65c754d", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "BaseNodesManager_RewardsBank": { - "address": "0xc050F45e9394C47c020AE3322F7017D67D4e215b", + "address": "0xE3C532aD50B16e59c1866DCC0C672F7b4c685f00", "abi": [ "constructor()", "event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)", @@ -534,11 +593,11 @@ "function withdrawAmb(address addressTo, uint256 amount)", "function withdrawErc20(address tokenAddress, address addressTo, uint256 amount)" ], - "deployTx": "0xf03a9a1e021d9dbd4fc05e14e2861fe50db959a981855b41051fcb38d5819d5b", + "deployTx": "0x1e033cf4ab71c611f267aa20500b35526ff5f87f59cc3ff8189d894437fbd607", "fullyQualifiedName": "contracts/funds/RewardsBank.sol:RewardsBank" }, "BaseNodesManager": { - "address": "0x765e3e03f8dfca312EfdAb378e386E1EA60ee93F", + "address": "0x51781501C27a7D6503652CA280BF5e92F3Eb03CD", "abi": [ "event AdminChanged(address previousAdmin, address newAdmin)", "event BeaconUpgraded(address indexed beacon)", @@ -552,7 +611,7 @@ "function getRoleAdmin(bytes32 role) view returns (bytes32)", "function grantRole(bytes32 role, address account)", "function hasRole(bytes32 role, address account) view returns (bool)", - "function initialize(address _validatorSet, address _rewardsBank)", + "function initialize(address _validatorSet, address _rewardsBank, address _treasury)", "function proxiableUUID() view returns (bytes32)", "function removeStake(address nodeAddress, uint256 amount, address sendTo)", "function renounceRole(bytes32 role, address account)", @@ -561,19 +620,20 @@ "function reward(address nodeAddress, uint256 amount)", "function rewardsBank() view returns (address)", "function supportsInterface(bytes4 interfaceId) view returns (bool)", + "function treasury() view returns (address)", "function upgradeTo(address newImplementation)", "function upgradeToAndCall(address newImplementation, bytes data) payable", "function validatorSet() view returns (address)" ], - "deployTx": "0x38ad57943d4f28a2f75a966e47bc5347324f04522834ff143cfcefe0120d5fbb", + "deployTx": "0x3bb4b39c409b07bdde010542149a97941863ee9bde9706f91f20cd3e6ab92103", "fullyQualifiedName": "contracts/staking/BaseNodes_Manager.sol:BaseNodes_Manager", "proxy": { - "implementation": "0x1D1c26e0b8DAFa08FD678A888a8f4de175B1d060", + "implementation": "0xD3A7E420Aa128Cb6AcFDd998258Ea938E50Ae600", "fullyQualifiedName": "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" } }, "ServerNodesManager_Multisig": { - "address": "0x1bB13b68DbA3571415B4092802777B5cA15de897", + "address": "0xE398B46804810c6e6aFc35E99079CF541b88cb8F", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -609,11 +669,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x1e7440c660d007b095a413d8caba9c011ae69b0d600fb3d720295cf5b6c580a5", + "deployTx": "0x17d19d7e4de53cf32e18fdbbb8b0d9c2266f36cac4e194080019b7718a141b2f", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "LockKeeper": { - "address": "0xfB069aFFe6e75674FaBf67108e9094fb988A31D9", + "address": "0x3AfEbeE38E5A4e3E7EDD66dAdEeD475Dc7287F6d", "abi": [ "constructor()", "event Claim(uint256 indexed lockId, address indexed userAddress, uint256 amount)", @@ -630,11 +690,11 @@ "function lockSingle(address receiver, address token, uint64 unlockTime, uint256 amount, string description) payable returns (uint256)", "function onBlock()" ], - "deployTx": "0x0166c7f8e74d75d3b0a50cbdb842b36337f36325e41b1a82eb5f441208d87b37", + "deployTx": "0xc8cfdfe99ec9d6b337a1aa1a6d45a74caab005aba09f27883b2ed0e6c190ffda", "fullyQualifiedName": "contracts/LockKeeper.sol:LockKeeper" }, "ServerNodesManager_RewardsBank": { - "address": "0x5f0EA6276D40A3529E060EA5Acb9bf963f5c430a", + "address": "0x2Cf845b49e1c4E5D657fbBF36E97B7B5B7B7b74b", "abi": [ "constructor()", "event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)", @@ -650,11 +710,11 @@ "function withdrawAmb(address addressTo, uint256 amount)", "function withdrawErc20(address tokenAddress, address addressTo, uint256 amount)" ], - "deployTx": "0xfcb7c4616ccf390be659c9f92a9e857ea402c31a7f022a92658d81e0f065f058", + "deployTx": "0xbcbf430d48349fbd027eadb714e37d54af19db577d2b4125e468f875ea7df7cb", "fullyQualifiedName": "contracts/funds/RewardsBank.sol:RewardsBank" }, "ServerNodesManager": { - "address": "0x450A606B9D42D081CE58bC5cDF6acA380acF7731", + "address": "0xdd82283Fc93Aa4373B6B27a7B25EB3A770fc3aba", "abi": [ "event AdminChanged(address previousAdmin, address newAdmin)", "event BeaconUpgraded(address indexed beacon)", @@ -680,7 +740,7 @@ "function grantRole(bytes32 role, address account)", "function hasRole(bytes32 role, address account) view returns (bool)", "function importOldStakes(address[] addresses, uint256[] amounts, uint256[] timestamps) payable", - "function initialize(address _validatorSet, address _lockKeeper, address _rewardsBank, address _airBond, uint256 _onboardingDelay, uint256 _unstakeLockTime, uint256 _minStakeAmount)", + "function initialize(address _validatorSet, address _lockKeeper, address _rewardsBank, address _airBond, address _treasury, uint256 _onboardingDelay, uint256 _unstakeLockTime, uint256 _minStakeAmount)", "function lockKeeper() view returns (address)", "function lockedWithdraws(address) view returns (uint256)", "function minStakeAmount() view returns (uint256)", @@ -699,6 +759,7 @@ "function setRewardsAddress(address nodeAddress, address rewardsAddress)", "function stakes(address) view returns (uint256 stake, uint256 timestampStake, address ownerAddress, address rewardsAddress)", "function supportsInterface(bytes4 interfaceId) view returns (bool)", + "function treasury() view returns (address)", "function unpause()", "function unstake(address nodeAddress, uint256 amount)", "function unstakeLockTime() view returns (uint256)", @@ -706,15 +767,15 @@ "function upgradeToAndCall(address newImplementation, bytes data) payable", "function validatorSet() view returns (address)" ], - "deployTx": "0xe7f0921182b3832b1ed810ae2c41a89fb6de7167e1c67347af6600c3fc3ce62b", + "deployTx": "0xf40fcf6e92829d0467944fd5dd647ea4b285a4b80d550e1ad877e726eb901b50", "fullyQualifiedName": "contracts/staking/ServerNodes_Manager.sol:ServerNodes_Manager", "proxy": { - "implementation": "0xe2672E824C249b24851389e69225959d1c6c1A1F", + "implementation": "0x3c80Eb9ebe759F28Ae6f366275A9e2A9FE341b0a", "fullyQualifiedName": "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" } }, "LegacyPoolManager_Multisig": { - "address": "0xb08cFc95eEA0F1d9Bb79002d23FA204B8836A536", + "address": "0x44E2880c2d4f1b806FD106a209EEDf0e7dC9C4aE", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -750,11 +811,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0xc32949b371ee4efe36925bba2ab1d30c5e572e9f50952f305940ea10d18e1539", + "deployTx": "0x21b1d18a28f647b93787fc4f9e23602b115f0124094a19fc5bd56b8acccb5b48", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "LegacyPoolManager_RewardsBank": { - "address": "0x3fbb4BfEfB478fcE4fb52503ce95e7602E4BB760", + "address": "0xeAAd95c57BC920A175767f1b6187820B193E0889", "abi": [ "constructor()", "event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)", @@ -770,11 +831,11 @@ "function withdrawAmb(address addressTo, uint256 amount)", "function withdrawErc20(address tokenAddress, address addressTo, uint256 amount)" ], - "deployTx": "0x19b98e8c31709bf724ff644ba1621c3f1043eb62eab642dcb081af61e042075b", + "deployTx": "0x17df10c6e27b496363984dce40ff5a0aa462cda891bb93309b34d5519eca5c3c", "fullyQualifiedName": "contracts/funds/RewardsBank.sol:RewardsBank" }, "LegacyPoolManager": { - "address": "0x00385a84F8ea4A244B2E084D81460e768fAE8ec3", + "address": "0x480ca9040a1e64E9337c6Adac6730069B509DC08", "abi": [ "event AdminChanged(address previousAdmin, address newAdmin)", "event BeaconUpgraded(address indexed beacon)", @@ -792,7 +853,7 @@ "function getDeposit(address nodeAddress) view returns (uint256)", "function getPools() view returns (address[])", "function importOldStakes(address[] addresses, address[] pools, uint256[] amounts)", - "function initialize(uint256 _minApolloDeposit, address _validatorSet, address _rewardsBank, address _poolsStore, address _apolloDepositStore, address _rolesEventEmitter, address _poolEventsEmitter)", + "function initialize(uint256 _minApolloDeposit, address _validatorSet, address _rewardsBank, address _treasury, address _poolsStore, address _apolloDepositStore, address _rolesEventEmitter, address _poolEventsEmitter)", "function isPool(address poolAddress) view returns (bool)", "function minApolloDeposit() view returns (uint256)", "function nextId() returns (uint256)", @@ -811,15 +872,16 @@ "function reward(address nodeAddress, uint256 amount)", "function rewardsBank() view returns (address)", "function transferOwnership(address newOwner)", + "function treasury() view returns (address)", "function unpause()", "function upgradeTo(address newImplementation)", "function upgradeToAndCall(address newImplementation, bytes data) payable", "function validatorSet() view returns (address)" ], - "deployTx": "0x024784b6830ba8ac4108596a77b73b8255cdb8ea40079b2731fed4f6c00fd3d3", + "deployTx": "0x54fc58c36e2c3cd2b9f4b7a2cd3ef520bf2ab0e89a0169c7beb7a4deb8064542", "fullyQualifiedName": "contracts/staking/pools/LegacyPoolsNodes_Manager.sol:LegacyPoolsNodes_Manager", "proxy": { - "implementation": "0x585896742516DF0703D72018E5c049D2C293718F", + "implementation": "0x009Ae4Bf3A00Ee4f9981bf7a808702f18b86d217", "fullyQualifiedName": "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" } } diff --git a/package.json b/package.json index b00fdd39..371c2735 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@airdao/airdao-node-contracts", - "version": "1.0.35", + "version": "1.1.1", "main": "./dist/src/index.js", "types": "./dist/src/index.d.ts", "files": [ @@ -19,10 +19,11 @@ "deploy_finance": "hardhat run scripts/finance/deploy_finance.ts --network dev", "deploy_airdrop": "hardhat run scripts/finance/deploy_airdrop.ts --network dev", "deploy_validatorset": "hardhat run scripts/staking/deploy_validatorset.ts --network dev", + "deploy_treasury": "hardhat run scripts/staking/deploy_treasury.ts --network dev", "deploy_basenodes_manager": "hardhat run scripts/staking/deploy_basenodes_manager.ts --network dev", "deploy_servernodes_manager": "hardhat run scripts/staking/deploy_servernodes_manager.ts --network dev", "deploy_legacy_pool_manager": "hardhat run scripts/staking/deploy_legacy_pool_manager.ts --network dev", - "deploy_all": "npm run deploy_multisig && npm run deploy_finance && npm run deploy_airdrop && npm run deploy_validatorset && npm run deploy_basenodes_manager && npm run deploy_servernodes_manager && npm run deploy_legacy_pool_manager", + "deploy_all": "npm run deploy_multisig && npm run deploy_finance && npm run deploy_airdrop && npm run deploy_validatorset && npm run deploy_treasury && npm run deploy_basenodes_manager && npm run deploy_servernodes_manager && npm run deploy_legacy_pool_manager", "deploy_migration_to_new_staking": "hardhat run scripts/staking/migrate_to_new_staking.ts --network dev", "test_script": "hardhat run scripts/staking/test.ts --network test", "integration_test_script": "hardhat run scripts/staking/new_validatorset_integration_test.ts --network local", From e380fabaaa5e0bd90edb2881a1298ca1818ff5ad Mon Sep 17 00:00:00 2001 From: svin Date: Fri, 22 Sep 2023 10:27:35 +0300 Subject: [PATCH 04/19] Fix base nodes; Redeploy devnet --- deployments/30746.json | 116 +++++++++++----------- package.json | 2 +- scripts/staking/migrate_to_new_staking.ts | 65 ++++++------ 3 files changed, 87 insertions(+), 96 deletions(-) diff --git a/deployments/30746.json b/deployments/30746.json index b49b0200..4c8f6e1f 100644 --- a/deployments/30746.json +++ b/deployments/30746.json @@ -1,6 +1,6 @@ { "MasterMultisig": { - "address": "0x761314376Ac00758DB402b47F44104529768605b", + "address": "0x096B5914C95C34Df19500DAff77470C845EC749D", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -39,11 +39,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x8c98757ed60c25ec75439b110da89e6f2174854262762f4c31fb9c5be495b439", + "deployTx": "0xfbcda39532ce6acfbfc96ea3893a9f777063d26b4653286b7e24174d03fc6ba2", "fullyQualifiedName": "contracts/multisig/MasterMultisig.sol:MasterMultisig" }, "FinanceMaster_Multisig": { - "address": "0xFFafaD16D4C174cA8E403E764704eb2784037b26", + "address": "0x8c33e9D24eBf3918D37eC2F26BaE044C9fD30Ea9", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -79,11 +79,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x525a98d76e44882802ccd4ba01a7f36205aefc4cb9944b7116a52c48f548adc9", + "deployTx": "0x82d4279c2bd508c707fb3eda2ec6fcf210fc1a8a219a8cfb5b4895601e581e61", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "FinanceMaster": { - "address": "0x5705Cf73136EDeE17Ce481Da589c4c0CaA36C693", + "address": "0x55Be7dd776fAbe89d93bAC66ed1cf0Ab31bdd6eB", "abi": [ "constructor(address owner, uint256 maxBanks_, uint256 maxBankBalance_)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", @@ -96,11 +96,11 @@ "function transferToBanks()", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0x98f14ed3943487e8ddf04f0bae3306dd87ce49bd44d6967025fd803dfd6c7ea9", + "deployTx": "0x391e85beee094ccb22606703939a7fef6475f5ae7d395bf619946386f4934e9e", "fullyQualifiedName": "contracts/finance/MasterFinance.sol:MasterFinance" }, "FinanceRewards_Multisig": { - "address": "0x8C52c360270b324A65Cd4bD4a5e2DCBe6aF8f500", + "address": "0x615D835e0C492b4309E79439765F66Db7BdcE200", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -136,11 +136,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x4c19dcd1c37f60d19e3a0744a3763c59e18baf04e7ebaf431ff3e3e33a474236", + "deployTx": "0xfcc10d29cab758ed84b92865a7157696be12dd71151aac7b91f0177fcb4f08c3", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "FinanceRewards": { - "address": "0xebd013e82004a58f0599d2f45918250e04d80Abf", + "address": "0x0c3001D98a02dFFf10814E2e5e1DA5a276C2552a", "abi": [ "constructor(address owner)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", @@ -150,11 +150,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0xafb076dcc621288c9fd0261bee7fef6dcf5ee6540a025e3dac6d8eaf2a233316", + "deployTx": "0x23d8dba7932985815dcdd0eb637fc5cfc5a2b02bd8b20ef35688297866b6a7b4", "fullyQualifiedName": "contracts/finance/Finance.sol:Finance" }, "FinanceInvestors_Multisig": { - "address": "0x31Ec9254bf00cF1429c250398d30A711E19BffC3", + "address": "0x3B851d4d79C44AbBBF914D6bc61A2BdCC7387d85", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -190,11 +190,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x0b69fa6dc12110aa0efa034eee8259317c46d2d213bb2a1e7f44ffc1c82f9560", + "deployTx": "0x567203802a7d77e875a50a0f9bc849c67c34dba9468dcc88967de02375868741", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "FinanceInvestors": { - "address": "0x0784273B3eb7EC159bb48Da834e230fe583D11CC", + "address": "0x7F4f5d586F33075F4Ac1D3FC11fb394Da6f7c041", "abi": [ "constructor(address owner)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", @@ -204,11 +204,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0x3f976982c1f52893652147422afcfb31410afc9227a94b84d8ac0a1f8ad60c1f", + "deployTx": "0xd163900a0749982745f1735329a382560a0b92631212c0770362b3069197c802", "fullyQualifiedName": "contracts/finance/Finance.sol:Finance" }, "FinanceTeam_Multisig": { - "address": "0xB45121Ea4DB3878b564c617287bf9BDDD17CfD2A", + "address": "0x9436CEC90DC41F03c7b679779D3B55dca5a02382", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -244,11 +244,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x98df2dda2cff4c9763ff3e5effe1dcc2eb427fd822f79b7f328cf4ceadc48a5c", + "deployTx": "0x02b6d1cf8dba5a7ae1593e885868c763ea7a2ddd59d3334eeb3865e108365c24", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "FinanceTeam": { - "address": "0xb04D84FC6BA3202f741d0db0124d890e7A3493b7", + "address": "0x132827Ee051b7276a2f85D6964F6182974aa243c", "abi": [ "constructor(address owner)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", @@ -258,11 +258,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0x27d05465442f451265a1dc3f61ab8d6445910b7056c0d9dd8620d6f279f06176", + "deployTx": "0x9d5228d5b742e1b33bbf178c48ba81211eb9dd01db37e317839229b4fb792ebe", "fullyQualifiedName": "contracts/finance/Finance.sol:Finance" }, "FinanceEcosystem_Multisig": { - "address": "0xC6613c683f2d4684D806FAcb9D413f41221537c6", + "address": "0x4db96017947838031561b35A643B2d9Dbf163241", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -298,11 +298,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x8672222504e7907b299567cf649c4eedbac1d863f526e7a5eb6a8e9f07f63cfe", + "deployTx": "0xe733ebcde38ff440a442a046f94dd25ce75b006145770066b0b97f7a9e5dea5d", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "FinanceEcosystem": { - "address": "0x7A70536307a0411d2Df2FE832CFa16231089dD6F", + "address": "0x090801d716A9d501F57519B1f4bd6aBD2961aa88", "abi": [ "constructor(address owner)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", @@ -312,11 +312,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0xd011f4471b2b456c9fb0f2bea62216c90d2622e774c04f2e2ffa3bee657b12b2", + "deployTx": "0xc98e7ac88e7996b81bfbec2ae62c4f723f210c4d524a04108762c3c8974bed0c", "fullyQualifiedName": "contracts/finance/Finance.sol:Finance" }, "AirBond": { - "address": "0xBE94eFB16edFCB44b3De6C452062D1B599d3d40d", + "address": "0x17c9b9A8BeeB1FE98566877AF442dbeBd0F5dB09", "abi": [ "constructor(address admin)", "event Approval(address indexed owner, address indexed spender, uint256 value)", @@ -346,11 +346,11 @@ "function transfer(address to, uint256 amount) returns (bool)", "function transferFrom(address from, address to, uint256 amount) returns (bool)" ], - "deployTx": "0xec75a144dcc53d083ad3393e077de9ae4f92174b087843d3ad3d4e4361e43521", + "deployTx": "0xc77e7685cae3186a9494ff6f8cfc4e0d26add00910df260d9820895a07074bfc", "fullyQualifiedName": "contracts/funds/AirBond.sol:AirBond" }, "AirDrop": { - "address": "0xe2672E824C249b24851389e69225959d1c6c1A1F", + "address": "0xF01EF9dFf8cA6e4324b000812D75Aa4A67ee52ca", "abi": [ "constructor(address airBondToken_, address backendAddress_, uint256 minAmbBalance_, tuple(address user, bytes32 category, uint256 amount)[] claims) payable", "event Claim(address user, bytes32[] categories, uint256[] amounts)", @@ -368,11 +368,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0xac1f57700a37a261b5cb4d62ec921d1905c3e75f71ac7cc8ffdd6b536dce24a5", + "deployTx": "0xf7140e03a3835f21ce758765ba745d1365ae7c723701442d201fcca7d3d2b7ff", "fullyQualifiedName": "contracts/projects/airdrop/AirDrop.sol:AirDrop" }, "ValidatorSet_Multisig": { - "address": "0x2B6d32BADB2F3C6f5D7CfEF07962a50109A57fA9", + "address": "0x58E98B0974A22270D974Ce914Fc430E048368546", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -408,11 +408,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x14e898c192eb8111004f1757284c736ba612f9d310994f64501f5516752176c0", + "deployTx": "0xddfb7ddcdc44532fae2591b8cd2ab4f336ce01d87dc5bf831688b6a79d2d45ec", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "ValidatorSet": { - "address": "0xD11a85386e3C5Cc493A1440Ef7Fd99BFAF72477d", + "address": "0xeeff62628dcD8E8AF2aA376C718f54602a54B5c5", "abi": [ "event AdminChanged(address previousAdmin, address newAdmin)", "event BeaconUpgraded(address indexed beacon)", @@ -472,15 +472,15 @@ "function upgradeTo(address newImplementation)", "function upgradeToAndCall(address newImplementation, bytes data) payable" ], - "deployTx": "0x2ae7ba2673c302a89e3b81e6f54d01e94aad869cd167e54084a136b485d66711", + "deployTx": "0x286eaea83658bc832aa10a194dc4a3e20d01b5d0f943b82460ccf6feae12194c", "fullyQualifiedName": "contracts/consensus/ValidatorSet.sol:ValidatorSet", "proxy": { - "implementation": "0x1fEf4FA0e0a5988F02Ba11786c91d25e0d352eEA", + "implementation": "0xea3011C9Efeb1e2A63A0c6cb23a0e0314970735F", "fullyQualifiedName": "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" } }, "Treasury_Multisig": { - "address": "0x30eb4563F0E64963569847E357Cdc1fDE1adf1c7", + "address": "0x1D49c49CD99d149142a4B9c673bbeacB8cBe194c", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -516,11 +516,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x6708a31d47119ae35b870db926eae03617de7b6914e561daf13810a9b9337341", + "deployTx": "0xf6049effd86868b620883a9fd76cd76383c89fa74768d9ebf4337b9171b8f03e", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "Treasury": { - "address": "0xFF9F502976E7bD2b4901aD7Dd1131Bb81E5567de", + "address": "0xc050F45e9394C47c020AE3322F7017D67D4e215b", "abi": [ "constructor(address owner, uint256 _fee)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", @@ -533,11 +533,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0x73548ec5c871b4df35743ad43b6bf0f1a76a6d1bef11d3b79d4228a839319b37", + "deployTx": "0xfaead67258445d8cb0e482744c1d06d9b93fca372fd9865ed59f224a5c84def6", "fullyQualifiedName": "contracts/finance/Treasury.sol:Treasury" }, "BaseNodesManager_Multisig": { - "address": "0x99d7DEf637ad71Da08D1a1f9b917789B805cCb0a", + "address": "0x1D1c26e0b8DAFa08FD678A888a8f4de175B1d060", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -573,11 +573,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x1ffd4bbba28d8522ce0e750298080161d47dbe9442709f92496c9f0bd65c754d", + "deployTx": "0x631f9137a9b21675d9fd1d192f305b5fa1d60c63adecc2835b6d401b13b1c599", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "BaseNodesManager_RewardsBank": { - "address": "0xE3C532aD50B16e59c1866DCC0C672F7b4c685f00", + "address": "0x765e3e03f8dfca312EfdAb378e386E1EA60ee93F", "abi": [ "constructor()", "event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)", @@ -593,11 +593,11 @@ "function withdrawAmb(address addressTo, uint256 amount)", "function withdrawErc20(address tokenAddress, address addressTo, uint256 amount)" ], - "deployTx": "0x1e033cf4ab71c611f267aa20500b35526ff5f87f59cc3ff8189d894437fbd607", + "deployTx": "0xb9a2f8bee7be1812f108906401430128222b5eb93844b5125de10b84f048f1b0", "fullyQualifiedName": "contracts/funds/RewardsBank.sol:RewardsBank" }, "BaseNodesManager": { - "address": "0x51781501C27a7D6503652CA280BF5e92F3Eb03CD", + "address": "0x7cee2ae3042D2C646Aa24FACfA92dfeE589046f0", "abi": [ "event AdminChanged(address previousAdmin, address newAdmin)", "event BeaconUpgraded(address indexed beacon)", @@ -625,15 +625,15 @@ "function upgradeToAndCall(address newImplementation, bytes data) payable", "function validatorSet() view returns (address)" ], - "deployTx": "0x3bb4b39c409b07bdde010542149a97941863ee9bde9706f91f20cd3e6ab92103", + "deployTx": "0xdbd2ec84a558f17f8cf83d06cc72e850d9e0aac2ffc134899dec7f86404b4879", "fullyQualifiedName": "contracts/staking/BaseNodes_Manager.sol:BaseNodes_Manager", "proxy": { - "implementation": "0xD3A7E420Aa128Cb6AcFDd998258Ea938E50Ae600", + "implementation": "0x130c0e94E79DbA9F8A63D6452210C89e5942130c", "fullyQualifiedName": "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" } }, "ServerNodesManager_Multisig": { - "address": "0xE398B46804810c6e6aFc35E99079CF541b88cb8F", + "address": "0x5f0EA6276D40A3529E060EA5Acb9bf963f5c430a", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -669,11 +669,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x17d19d7e4de53cf32e18fdbbb8b0d9c2266f36cac4e194080019b7718a141b2f", + "deployTx": "0x4f720b2d9b56dd201b5286b4588931dd36cf15b635b17c1c78e7265facdb8bc8", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "LockKeeper": { - "address": "0x3AfEbeE38E5A4e3E7EDD66dAdEeD475Dc7287F6d", + "address": "0xdC103bf9a3789f78958f365321F3BA07e369667A", "abi": [ "constructor()", "event Claim(uint256 indexed lockId, address indexed userAddress, uint256 amount)", @@ -690,11 +690,11 @@ "function lockSingle(address receiver, address token, uint64 unlockTime, uint256 amount, string description) payable returns (uint256)", "function onBlock()" ], - "deployTx": "0xc8cfdfe99ec9d6b337a1aa1a6d45a74caab005aba09f27883b2ed0e6c190ffda", + "deployTx": "0xf325eb35d7a832d104794e7e72a0f5b85aff5cb3b059c915d93b51b557bdcfe7", "fullyQualifiedName": "contracts/LockKeeper.sol:LockKeeper" }, "ServerNodesManager_RewardsBank": { - "address": "0x2Cf845b49e1c4E5D657fbBF36E97B7B5B7B7b74b", + "address": "0x450A606B9D42D081CE58bC5cDF6acA380acF7731", "abi": [ "constructor()", "event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)", @@ -710,11 +710,11 @@ "function withdrawAmb(address addressTo, uint256 amount)", "function withdrawErc20(address tokenAddress, address addressTo, uint256 amount)" ], - "deployTx": "0xbcbf430d48349fbd027eadb714e37d54af19db577d2b4125e468f875ea7df7cb", + "deployTx": "0xe3c0e2a888c4b769f90b923ad0f61115583ef58ff6377b9cf1c8b49e6ba90c7d", "fullyQualifiedName": "contracts/funds/RewardsBank.sol:RewardsBank" }, "ServerNodesManager": { - "address": "0xdd82283Fc93Aa4373B6B27a7B25EB3A770fc3aba", + "address": "0x7aE1eAFC7a9b106b392ddEE027449b09dbDE1347", "abi": [ "event AdminChanged(address previousAdmin, address newAdmin)", "event BeaconUpgraded(address indexed beacon)", @@ -767,15 +767,15 @@ "function upgradeToAndCall(address newImplementation, bytes data) payable", "function validatorSet() view returns (address)" ], - "deployTx": "0xf40fcf6e92829d0467944fd5dd647ea4b285a4b80d550e1ad877e726eb901b50", + "deployTx": "0x9afda1b30db816a8f76295add9526ea7cd5ad86ed60bdf1fcaee72b2ce5db246", "fullyQualifiedName": "contracts/staking/ServerNodes_Manager.sol:ServerNodes_Manager", "proxy": { - "implementation": "0x3c80Eb9ebe759F28Ae6f366275A9e2A9FE341b0a", + "implementation": "0xe8DA2709BCAD1e2045f25A13347ed994b3d2cBaD", "fullyQualifiedName": "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" } }, "LegacyPoolManager_Multisig": { - "address": "0x44E2880c2d4f1b806FD106a209EEDf0e7dC9C4aE", + "address": "0x585896742516DF0703D72018E5c049D2C293718F", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -811,11 +811,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x21b1d18a28f647b93787fc4f9e23602b115f0124094a19fc5bd56b8acccb5b48", + "deployTx": "0xdc8165a6a97bcb43680204eb2a9e56af0642745ced8e66b3caf2e543d68b0358", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "LegacyPoolManager_RewardsBank": { - "address": "0xeAAd95c57BC920A175767f1b6187820B193E0889", + "address": "0x00385a84F8ea4A244B2E084D81460e768fAE8ec3", "abi": [ "constructor()", "event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)", @@ -831,11 +831,11 @@ "function withdrawAmb(address addressTo, uint256 amount)", "function withdrawErc20(address tokenAddress, address addressTo, uint256 amount)" ], - "deployTx": "0x17df10c6e27b496363984dce40ff5a0aa462cda891bb93309b34d5519eca5c3c", + "deployTx": "0x8bcbeeb47973d7f0e50accd2b84d1e5b85eb559a01fb7d947e5fcc10479c8ee2", "fullyQualifiedName": "contracts/funds/RewardsBank.sol:RewardsBank" }, "LegacyPoolManager": { - "address": "0x480ca9040a1e64E9337c6Adac6730069B509DC08", + "address": "0xC54007213080526139d38eAe66777dFac413772C", "abi": [ "event AdminChanged(address previousAdmin, address newAdmin)", "event BeaconUpgraded(address indexed beacon)", @@ -878,10 +878,10 @@ "function upgradeToAndCall(address newImplementation, bytes data) payable", "function validatorSet() view returns (address)" ], - "deployTx": "0x54fc58c36e2c3cd2b9f4b7a2cd3ef520bf2ab0e89a0169c7beb7a4deb8064542", + "deployTx": "0x48693507f023a73650c4a24137a57eba99ca06e94698dffc576ab4c1471480fe", "fullyQualifiedName": "contracts/staking/pools/LegacyPoolsNodes_Manager.sol:LegacyPoolsNodes_Manager", "proxy": { - "implementation": "0x009Ae4Bf3A00Ee4f9981bf7a808702f18b86d217", + "implementation": "0x99B1A627604dB1479379c2c576dAFdC8AE4C546E", "fullyQualifiedName": "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" } } diff --git a/package.json b/package.json index 371c2735..d050599b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@airdao/airdao-node-contracts", - "version": "1.1.1", + "version": "1.1.2", "main": "./dist/src/index.js", "types": "./dist/src/index.d.ts", "files": [ diff --git a/scripts/staking/migrate_to_new_staking.ts b/scripts/staking/migrate_to_new_staking.ts index 6c1d2291..926a2090 100644 --- a/scripts/staking/migrate_to_new_staking.ts +++ b/scripts/staking/migrate_to_new_staking.ts @@ -16,7 +16,7 @@ import { StorageCatalogue__factory, ValidatorSet, } from "../../typechain-types"; -import { BigNumber, BigNumberish } from "ethers"; +import { BigNumber } from "ethers"; import { loadDeployment } from "@airdao/deployments/deploying"; import { ContractNames } from "../../src"; import { wrapProviderToError } from "../../src/utils/AmbErrorProvider"; @@ -57,6 +57,15 @@ async function main() { if (!(await fees.isAdmin(deployer.address))) throw `${deployer.address} is not a admin`; if (!(await fees.paused())) throw "legacy contracts doesn't paused!"; + const oldStakes = await getOldStakes( + await storageCatalogue.apolloDepositStore(), + await storageCatalogue.poolsStore(), + await storageCatalogue.rolesEventEmitter() + ); + + console.log("old stakes", oldStakes); + return; + const { baseNodesAddresses, poolNodesAddresses, @@ -64,11 +73,7 @@ async function main() { stakes, poolNodes2Pool, serverNodesOnboardTime, - } = await getOldStakes( - await storageCatalogue.apolloDepositStore(), - await storageCatalogue.poolsStore(), - await storageCatalogue.rolesEventEmitter() - ); + } = oldStakes; // transfer basenodes and servernodes deposits to deployer console.log("withdraw stakes from baseNodes", baseNodesAddresses); @@ -139,15 +144,15 @@ async function getOldStakes(depositStoreAddr: string, poolsStoreAddr: string, ro const poolsStore = PoolsStore__factory.connect(poolsStoreAddr, owner); const rolesEventEmitter = RolesEventEmitter__factory.connect(rolesEventEmitterAddr, owner); - const baseNodesAddresses = await getBaseNodes(); + const validatorSetAddresses = await validatorSet.getValidators(); + + const baseNodesAddresses = await getBaseNodes(validatorSetAddresses); const poolNodes2Pool = await getPoolNodesAddresses(poolsStore); const poolNodesAddresses = Object.keys(poolNodes2Pool); const serverNodesAddresses: string[] = []; const stakes: { [node: string]: BigNumber } = {}; - const validatorSetAddresses = await validatorSet.getValidators(); - // get stake AMOUNT from deposit store for each address for (const address of validatorSetAddresses) { if (!(await depositStore.isDepositing(address))) throw new Error(`${address} is not depositing`); @@ -201,35 +206,21 @@ async function fetchEvents(fetchCall: (startBlock: number, endBlock: number) => return result; } -async function getBaseNodes() { - const baseNodes = { - dev: [ - "0xdecA85befcC43ed1891758E37c35053aFF935AC1", - "0x427933454115d6D55E8e24821d430F944d3eD936", - "0x87a3d2CcacDe32f366Bd01bcbeB202643cD38A4E", - ], - test: [ - "0x311B7E7d0795c9697c6ED20B962f844E1e1F08ba", - "0x5a16b69a09013C077A70fc62a3705Dbf1b60c2B0", - "0x91a48ebAfb1C6bc89000B0F63850BeF1258A082B", - "0x042cab4fe91f0fb00936a2b9B262A1f9cf88aAd2", - "0x62291e77Dc079897751e26a9F6b3BC4630D7454c", - "0xA373F89F90ecEf9f430719Ed83eD49722b98FD09", - "0x51213F81319E42f6296C29BEeA1245C5F78f2dEf", - "0xDE3939BEe9A4B0aB8272bDd06d6B6E7E917FB514", - "0x52aB486A5067cd8e2705DbC90Ed72D6dA549D0EB", - ], - main: [ - "0x162BA761Fc75f5873197A340F9e7fb926bA7517D", - "0x129C0057AF3f91d4fa729AEA7910b46F7cE3d081", - "0x73574449cbEd6213F5340e806E9Dec36f05A25ec", - "0x742c823aC6963f43E3Fa218be3B8aBb4b786BdBe", - "0x9b1822da3F6450832DD92713f49C075b2538F057", - "0x9f8B33a65A61F3382904611020EdC17E64745622", - // todo - ], +async function getBaseNodes(validators: string[]) { + const url = { + dev: "https://chainspec.ambrosus-dev.io/", + test: "https://chainspec.ambrosus-test.io/", + main: "https://chainspec.ambrosus.io/", }[network.name]; - if (baseNodes == undefined) throw new Error(`Unknown network ${network.name}`); + if (url == undefined) throw new Error(`Unknown network ${network.name}`); + + const res = await fetch(url); + if (!res.ok) throw new Error(`Can't fetch ${url}`); + const json = await res.json(); + const baseNodes = (Object.entries(json.accounts) as [string, any][]) + .filter(([addr, val]) => validators.includes(addr) && val.balance) + .map(([addr]) => addr); + return baseNodes; } From 5648268542221dafdc95fda273c4afb0d2e2a286 Mon Sep 17 00:00:00 2001 From: serezhaolshan Date: Tue, 26 Sep 2023 13:47:45 +0300 Subject: [PATCH 05/19] feat: add rewards settings to multisig --- src/methods/consensus.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/methods/consensus.ts b/src/methods/consensus.ts index 1183b984..402e5c79 100644 --- a/src/methods/consensus.ts +++ b/src/methods/consensus.ts @@ -30,6 +30,11 @@ export async function validatorSetGetQueuedStakes(contracts: Contracts) { return validatorSet.getQueuedStakes(); } +export async function validatorSetGetRewardSettings(contracts: Contracts) { + const validatorSet = contracts.getContractByName(ContractNames.ValidatorSet) as ValidatorSet; + return validatorSet.getQueuedStakes(); +} + export async function validatorSetGetStakesByManager(contracts: Contracts, managerAddress: string) { const validatorSet = contracts.getContractByName(ContractNames.ValidatorSet) as ValidatorSet; return validatorSet.getStakesByManager(managerAddress); @@ -48,6 +53,13 @@ export async function validatorSetAddBlockListener(contracts: Contracts, listene ); } +export async function validatorSetSetRewardSettings(contracts: Contracts, newSettings: Array) { + return await submitTransaction2(contracts, ContractNames.ValidatorSet, 0, (validatorSet) => + // @ts-ignore + validatorSet.setRewardSettings(newSettings) + ); +} + export async function validatorSetRemoveBlockListener(contracts: Contracts, listener: string) { return await submitTransaction2(contracts, ContractNames.ValidatorSet, 0, (validatorSet) => validatorSet.removeBlockListener(listener) From 6c450f477239c94a03ba5307ae1ba330ff23b471 Mon Sep 17 00:00:00 2001 From: svin Date: Tue, 26 Sep 2023 17:12:26 +0300 Subject: [PATCH 06/19] Add RewardSettings methods to SDK --- package.json | 3 ++- src/methods/consensus.ts | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index d050599b..f82a9a2d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@airdao/airdao-node-contracts", - "version": "1.1.2", + "version": "1.1.3", "main": "./dist/src/index.js", "types": "./dist/src/index.d.ts", "files": [ @@ -9,6 +9,7 @@ "homepage": "https://github.com/ambrosus/airdao-node-contracts", "scripts": { "build": "npm run build:sol && npm run build:js", + "move_build_to_multisig": "cp -r ./dist /home/svin/dev/work/ambrosus/multisigApplication/node_modules/@airdao/airdao-node-contracts", "build:js": "rm -rf ./dist/ && tsc -p tsconfig.sdk.json", "build:sol": "hardhat compile --force", "test": "REPORT_GAS=true hardhat test", diff --git a/src/methods/consensus.ts b/src/methods/consensus.ts index 1183b984..b16d90b3 100644 --- a/src/methods/consensus.ts +++ b/src/methods/consensus.ts @@ -40,6 +40,13 @@ export async function validatorSetGetBlockListeners(contracts: Contracts) { return validatorSet.getBlockListeners(); } +export async function validatorSetGetRewardSettings(contracts: Contracts) { + const validatorSet = contracts.getContractByName(ContractNames.ValidatorSet) as ValidatorSet; + const [isEnabled, ...settings] = await validatorSet.getRewardSettings(); + const [lowerPercent, upperPercent, lowerReward, upperReward] = settings.map((e) => +e / 10000); + return { isEnabled: +isEnabled != 0, lowerPercent, upperPercent, lowerReward, upperReward }; +} + // admin methods export async function validatorSetAddBlockListener(contracts: Contracts, listener: string) { @@ -65,3 +72,22 @@ export async function validatorSetSetReward(contracts: Contracts, baseReward: Bi validatorSet.setReward(baseReward) ); } + +export async function validatorSetSetRewardSettings( + contracts: Contracts, + isEnabled: boolean, + lowerPercent: number, + upperPercent: number, + lowerReward: number, + upperReward: number +) { + return await submitTransaction2(contracts, ContractNames.ValidatorSet, 0, (validatorSet) => + validatorSet.setRewardSettings([ + +isEnabled, + lowerPercent * 10000, + upperPercent * 10000, + lowerReward * 10000, + upperReward * 10000, + ]) + ); +} From aef994c56eab1386597160a9eb7fbc187a0b5928 Mon Sep 17 00:00:00 2001 From: svin Date: Tue, 26 Sep 2023 18:18:07 +0300 Subject: [PATCH 07/19] Change arg validation in changeTopStakesCount --- contracts/consensus/ValidatorSet.sol | 4 ++-- deployments/30746.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/consensus/ValidatorSet.sol b/contracts/consensus/ValidatorSet.sol index 3b189776..46250d2e 100644 --- a/contracts/consensus/ValidatorSet.sol +++ b/contracts/consensus/ValidatorSet.sol @@ -189,8 +189,8 @@ contract ValidatorSet is UUPSUpgradeable, OnBlockNotifier, AccessControlEnumerab function changeTopStakesCount(uint newTopStakesCount) public onlyRole(DEFAULT_ADMIN_ROLE) { require(newTopStakesCount > 0, "newTopStakesCount must be > 0"); - if (newTopStakesCount < topStakesCount) - require(newTopStakesCount + (topStakesCount / 8) >= topStakesCount, "decrease of more than 12.5% is not allowed"); + if (newTopStakesCount < queuedStakes.length) + require(newTopStakesCount + (queuedStakes.length / 8) >= queuedStakes.length, "decrease of more than 12.5% is not allowed"); topStakesCount = newTopStakesCount; } diff --git a/deployments/30746.json b/deployments/30746.json index 4c8f6e1f..a1d68651 100644 --- a/deployments/30746.json +++ b/deployments/30746.json @@ -475,7 +475,7 @@ "deployTx": "0x286eaea83658bc832aa10a194dc4a3e20d01b5d0f943b82460ccf6feae12194c", "fullyQualifiedName": "contracts/consensus/ValidatorSet.sol:ValidatorSet", "proxy": { - "implementation": "0xea3011C9Efeb1e2A63A0c6cb23a0e0314970735F", + "implementation": "0xC54450028dAE52c1DC1bb9Dabe553457eABd4Aa3", "fullyQualifiedName": "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" } }, From 70ac37d6a1e099aca92e06014b5c6526f8521599 Mon Sep 17 00:00:00 2001 From: serezhaolshan Date: Wed, 27 Sep 2023 15:34:58 +0300 Subject: [PATCH 08/19] feat: add elasticRewardsSetterAddress to deploy validatorset --- scripts/staking/deploy_validatorset.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/staking/deploy_validatorset.ts b/scripts/staking/deploy_validatorset.ts index cc09518f..881037b3 100644 --- a/scripts/staking/deploy_validatorset.ts +++ b/scripts/staking/deploy_validatorset.ts @@ -27,8 +27,12 @@ export async function main() { isUpgradeableProxy: true, }); + const elasticRewardsSetterAddress = "0xb0857e3203f9e392c83f746da9a6a2ddeb6b69af"; //TODO change it for mainnet + 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(), elasticRewardsSetterAddress)).wait(); + //384cbfc4a2218ab4a5ba81e6888073ad97f98f7f7a4ff52f3c6c0eb5407fee6b } if (require.main === module) { From bd43d9b8ea1862e400f2c595199e44cc8cbb5820 Mon Sep 17 00:00:00 2001 From: svin Date: Fri, 29 Sep 2023 10:42:46 +0300 Subject: [PATCH 09/19] Fixes --- scripts/staking/deploy_validatorset.ts | 10 ++++++---- src/methods/consensus.ts | 12 ------------ 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/scripts/staking/deploy_validatorset.ts b/scripts/staking/deploy_validatorset.ts index 881037b3..92422f7c 100644 --- a/scripts/staking/deploy_validatorset.ts +++ b/scripts/staking/deploy_validatorset.ts @@ -1,4 +1,4 @@ -import { ethers } from "hardhat"; +import { ethers, network } from "hardhat"; import { ContractNames } from "../../src"; import { Multisig__factory, ValidatorSet__factory } from "../../typechain-types"; import { deploy, loadDeployment } from "@airdao/deployments/deploying"; @@ -27,12 +27,14 @@ export async function main() { isUpgradeableProxy: true, }); - const elasticRewardsSetterAddress = "0xb0857e3203f9e392c83f746da9a6a2ddeb6b69af"; //TODO change it for mainnet + 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(), elasticRewardsSetterAddress)).wait(); - //384cbfc4a2218ab4a5ba81e6888073ad97f98f7f7a4ff52f3c6c0eb5407fee6b + await (await validatorSet.grantRole(await validatorSet.REWARD_ORACLE_ROLE(), rewardsOracleAddress)).wait(); } if (require.main === module) { diff --git a/src/methods/consensus.ts b/src/methods/consensus.ts index 01ad10c6..b16d90b3 100644 --- a/src/methods/consensus.ts +++ b/src/methods/consensus.ts @@ -30,11 +30,6 @@ export async function validatorSetGetQueuedStakes(contracts: Contracts) { return validatorSet.getQueuedStakes(); } -export async function validatorSetGetRewardSettings(contracts: Contracts) { - const validatorSet = contracts.getContractByName(ContractNames.ValidatorSet) as ValidatorSet; - return validatorSet.getQueuedStakes(); -} - export async function validatorSetGetStakesByManager(contracts: Contracts, managerAddress: string) { const validatorSet = contracts.getContractByName(ContractNames.ValidatorSet) as ValidatorSet; return validatorSet.getStakesByManager(managerAddress); @@ -60,13 +55,6 @@ export async function validatorSetAddBlockListener(contracts: Contracts, listene ); } -export async function validatorSetSetRewardSettings(contracts: Contracts, newSettings: Array) { - return await submitTransaction2(contracts, ContractNames.ValidatorSet, 0, (validatorSet) => - // @ts-ignore - validatorSet.setRewardSettings(newSettings) - ); -} - export async function validatorSetRemoveBlockListener(contracts: Contracts, listener: string) { return await submitTransaction2(contracts, ContractNames.ValidatorSet, 0, (validatorSet) => validatorSet.removeBlockListener(listener) From 98ca6d253489e168234cc2021059d3fcbd1d7f76 Mon Sep 17 00:00:00 2001 From: svin Date: Fri, 29 Sep 2023 11:49:56 +0300 Subject: [PATCH 10/19] Deploy on testnet --- deployments/22040.json | 514 +++++++++++++++++++++++++++++++++++++++++ package.json | 21 +- 2 files changed, 525 insertions(+), 10 deletions(-) diff --git a/deployments/22040.json b/deployments/22040.json index 8c5e06fe..a43aea67 100644 --- a/deployments/22040.json +++ b/deployments/22040.json @@ -370,5 +370,519 @@ ], "deployTx": "0x3c1d84398c87818a97a1a88d2fd2cbf135f84adb187241d02fa8d22a0f5fde94", "fullyQualifiedName": "contracts/projects/airdrop/AirDrop.sol:AirDrop" + }, + "ValidatorSet_Multisig": { + "address": "0x6aba61DA4CD5A12DBfE1f3263540B293890b9214", + "abi": [ + "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", + "event Confirmation(address indexed sender, uint256 indexed txId)", + "event Execution(uint256 indexed txId)", + "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", + "event Revocation(address indexed sender, uint256 indexed txId)", + "event SignerAddition(address indexed signer, bool isInitiator)", + "event SignerRemoval(address indexed signer)", + "event Submission(uint256 indexed txId)", + "event ThresholdChange(uint256 required)", + "function changeSigners(address[] signersToRemove, address[] signersToAdd, bool[] isInitiatorFlags)", + "function changeThreshold(uint256 _threshold)", + "function checkBeforeSubmitTransaction(address destination, uint256 value, bytes data) payable", + "function confirmTransaction(uint256 txId)", + "function confirmations(uint256, address) view returns (bool)", + "function getConfirmations(uint256 txId) view returns (address[])", + "function getInitiatorsCount() view returns (uint256)", + "function getRequiredSignersCount() view returns (uint256)", + "function getSigners() view returns (address[], bool[])", + "function getTransactionData(uint256 txId) view returns (tuple(address destination, uint256 value, bytes data, bool executed), address[])", + "function getTransactionIds(uint256 from, uint256 to, bool pending, bool executed) view returns (uint256[] result)", + "function isConfirmed(uint256 txId) view returns (bool)", + "function isInitiator(address) view returns (bool)", + "function isSigner(address) view returns (bool)", + "function owner() view returns (address)", + "function renounceOwnership()", + "function revokeConfirmation(uint256 txId)", + "function signers(uint256) view returns (address)", + "function submitTransaction(address destination, uint256 value, bytes data) payable returns (uint256 txId)", + "function threshold() view returns (uint256)", + "function transactionCount() view returns (uint256)", + "function transactions(uint256) view returns (address destination, uint256 value, bytes data, bool executed)", + "function transferOwnership(address newOwner)", + "function withdraw(address to, uint256 amount)" + ], + "deployTx": "0x1bb7e254a9c0c3455347504e56f94416283ecf1e6b405c95f85263903b302c5f", + "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" + }, + "ValidatorSet": { + "address": "0x45651Bdb0dB444780a44BE73DAF72AF7C5482abc", + "abi": [ + "event AdminChanged(address previousAdmin, address newAdmin)", + "event BeaconUpgraded(address indexed beacon)", + "event Initialized(uint8 version)", + "event InitiateChange(bytes32 indexed parentHash, address[] newSet)", + "event QueueListNodeAdded(address indexed nodeAddress)", + "event QueueListNodeRemoved(address indexed nodeAddress)", + "event Report(address indexed nodeAddress, uint256 malisciousType)", + "event Reward(address indexed manager, address indexed nodeAddress, address indexed rewardReceiver, address nodeOwner, address tokenAddress, uint256 amount)", + "event RewardError(address stakingManager, string errorText)", + "event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)", + "event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)", + "event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)", + "event StakeChanged(address indexed nodeAddress, address indexed stakingContract, int256 changeAmount)", + "event StakeCreated(address indexed nodeAddress, address indexed stakingContract, uint256 amount, bool isAlwaysTop)", + "event StakeRemoved(address indexed nodeAddress, address indexed stakingContract)", + "event TopListNodeAdded(address indexed nodeAddress)", + "event TopListNodeRemoved(address indexed nodeAddress)", + "event Upgraded(address indexed implementation)", + "event ValidatorSetFinalized(address[] newSet)", + "function DEFAULT_ADMIN_ROLE() view returns (bytes32)", + "function REWARD_ORACLE_ROLE() view returns (bytes32)", + "function STAKING_MANAGER_ROLE() view returns (bytes32)", + "function _updateExternal()", + "function addBlockListener(address listener)", + "function baseReward() view returns (uint256)", + "function changeTopStakesCount(uint256 newTopStakesCount)", + "function emitReward(address nodeAddress, address nodeOwner, address rewardReceiver, address tokenAddress, uint256 amount)", + "function finalizeChange()", + "function getBlockListeners() view returns (address[])", + "function getNodeStake(address nodeAddress) view returns (uint256)", + "function getQueuedStakes() view returns (address[])", + "function getRewardSettings() view returns (uint64[5])", + "function getRoleAdmin(bytes32 role) view returns (bytes32)", + "function getRoleMember(bytes32 role, uint256 index) view returns (address)", + "function getRoleMemberCount(bytes32 role) view returns (uint256)", + "function getStakesByManager(address manager) view returns (address[] result)", + "function getTopStakes() view returns (address[])", + "function getValidators() view returns (address[])", + "function grantRole(bytes32 role, address account)", + "function hasRole(bytes32 role, address account) view returns (bool)", + "function initialize(address _rewardOracle, uint256 _baseReward, uint256 _topStakesCount)", + "function newStake(address nodeAddress, uint256 amount, bool isAlwaysTop)", + "function process()", + "function proxiableUUID() view returns (bytes32)", + "function removeBlockListener(address listener)", + "function renounceRole(bytes32 role, address account)", + "function revokeRole(bytes32 role, address account)", + "function setReward(uint256 _baseReward)", + "function setRewardSettings(uint64[5] newSettings)", + "function stake(address nodeAddress, uint256 amount)", + "function stakes(address) view returns (uint256 amount, address stakingContract, bool isAlwaysTop)", + "function supportsInterface(bytes4 interfaceId) view returns (bool)", + "function topStakesCount() view returns (uint256)", + "function totalStakeAmount() view returns (uint256)", + "function unstake(address nodeAddress, uint256 amount)", + "function upgradeTo(address newImplementation)", + "function upgradeToAndCall(address newImplementation, bytes data) payable" + ], + "deployTx": "0xa18d299b0c43c813c914c38237b9236f56bca28cefa94e43ff8efd93a3d6a0f6", + "fullyQualifiedName": "contracts/consensus/ValidatorSet.sol:ValidatorSet", + "proxy": { + "implementation": "0x4fFE71CA70134770B9C8d811a7523A6A8a7aF84f", + "fullyQualifiedName": "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" + } + }, + "Treasury_Multisig": { + "address": "0x86659f410677F8C5cd08a7090b0657165D6F1423", + "abi": [ + "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", + "event Confirmation(address indexed sender, uint256 indexed txId)", + "event Execution(uint256 indexed txId)", + "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", + "event Revocation(address indexed sender, uint256 indexed txId)", + "event SignerAddition(address indexed signer, bool isInitiator)", + "event SignerRemoval(address indexed signer)", + "event Submission(uint256 indexed txId)", + "event ThresholdChange(uint256 required)", + "function changeSigners(address[] signersToRemove, address[] signersToAdd, bool[] isInitiatorFlags)", + "function changeThreshold(uint256 _threshold)", + "function checkBeforeSubmitTransaction(address destination, uint256 value, bytes data) payable", + "function confirmTransaction(uint256 txId)", + "function confirmations(uint256, address) view returns (bool)", + "function getConfirmations(uint256 txId) view returns (address[])", + "function getInitiatorsCount() view returns (uint256)", + "function getRequiredSignersCount() view returns (uint256)", + "function getSigners() view returns (address[], bool[])", + "function getTransactionData(uint256 txId) view returns (tuple(address destination, uint256 value, bytes data, bool executed), address[])", + "function getTransactionIds(uint256 from, uint256 to, bool pending, bool executed) view returns (uint256[] result)", + "function isConfirmed(uint256 txId) view returns (bool)", + "function isInitiator(address) view returns (bool)", + "function isSigner(address) view returns (bool)", + "function owner() view returns (address)", + "function renounceOwnership()", + "function revokeConfirmation(uint256 txId)", + "function signers(uint256) view returns (address)", + "function submitTransaction(address destination, uint256 value, bytes data) payable returns (uint256 txId)", + "function threshold() view returns (uint256)", + "function transactionCount() view returns (uint256)", + "function transactions(uint256) view returns (address destination, uint256 value, bytes data, bool executed)", + "function transferOwnership(address newOwner)", + "function withdraw(address to, uint256 amount)" + ], + "deployTx": "0x130734d92a7c85421af1b1ef80b11ac2c8fa78bc0e5dc25c792ae3d2305fecc5", + "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" + }, + "Treasury": { + "address": "0x4E7cF064d05C6F6a34d41D1f919bb92B88f4B9a5", + "abi": [ + "constructor(address owner, uint256 _fee)", + "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", + "event Withdraw(address addressTo, uint256 amount)", + "function calcFee(uint256 amount) view returns (uint256)", + "function fee() view returns (uint256)", + "function owner() view returns (address)", + "function renounceOwnership()", + "function setFee(uint256 _fee)", + "function transferOwnership(address newOwner)", + "function withdraw(address addressTo, uint256 amount)" + ], + "deployTx": "0xd15ec5e8ec820310ac8d0d5cb78419bb4b7160f12b1e9bcc40f0a5049602adf7", + "fullyQualifiedName": "contracts/finance/Treasury.sol:Treasury" + }, + "BaseNodesManager_Multisig": { + "address": "0xCD27691A75D9a112012f9fB771a691fe3bE1F1f0", + "abi": [ + "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", + "event Confirmation(address indexed sender, uint256 indexed txId)", + "event Execution(uint256 indexed txId)", + "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", + "event Revocation(address indexed sender, uint256 indexed txId)", + "event SignerAddition(address indexed signer, bool isInitiator)", + "event SignerRemoval(address indexed signer)", + "event Submission(uint256 indexed txId)", + "event ThresholdChange(uint256 required)", + "function changeSigners(address[] signersToRemove, address[] signersToAdd, bool[] isInitiatorFlags)", + "function changeThreshold(uint256 _threshold)", + "function checkBeforeSubmitTransaction(address destination, uint256 value, bytes data) payable", + "function confirmTransaction(uint256 txId)", + "function confirmations(uint256, address) view returns (bool)", + "function getConfirmations(uint256 txId) view returns (address[])", + "function getInitiatorsCount() view returns (uint256)", + "function getRequiredSignersCount() view returns (uint256)", + "function getSigners() view returns (address[], bool[])", + "function getTransactionData(uint256 txId) view returns (tuple(address destination, uint256 value, bytes data, bool executed), address[])", + "function getTransactionIds(uint256 from, uint256 to, bool pending, bool executed) view returns (uint256[] result)", + "function isConfirmed(uint256 txId) view returns (bool)", + "function isInitiator(address) view returns (bool)", + "function isSigner(address) view returns (bool)", + "function owner() view returns (address)", + "function renounceOwnership()", + "function revokeConfirmation(uint256 txId)", + "function signers(uint256) view returns (address)", + "function submitTransaction(address destination, uint256 value, bytes data) payable returns (uint256 txId)", + "function threshold() view returns (uint256)", + "function transactionCount() view returns (uint256)", + "function transactions(uint256) view returns (address destination, uint256 value, bytes data, bool executed)", + "function transferOwnership(address newOwner)", + "function withdraw(address to, uint256 amount)" + ], + "deployTx": "0xf246f1799cb5325b577846b58dbdd0216fd3091f90a77f715e69ff2c364f5f33", + "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" + }, + "BaseNodesManager_RewardsBank": { + "address": "0x5B1Fd7Ebac3E31F2b9562bBF85BEBf37958F9320", + "abi": [ + "constructor()", + "event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)", + "event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)", + "event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)", + "function DEFAULT_ADMIN_ROLE() view returns (bytes32)", + "function getRoleAdmin(bytes32 role) view returns (bytes32)", + "function grantRole(bytes32 role, address account)", + "function hasRole(bytes32 role, address account) view returns (bool)", + "function renounceRole(bytes32 role, address account)", + "function revokeRole(bytes32 role, address account)", + "function supportsInterface(bytes4 interfaceId) view returns (bool)", + "function withdrawAmb(address addressTo, uint256 amount)", + "function withdrawErc20(address tokenAddress, address addressTo, uint256 amount)" + ], + "deployTx": "0x3c9fdeb08527e72c8da98f100d80aa494f20bd48c092cc66c66aca9a736bed93", + "fullyQualifiedName": "contracts/funds/RewardsBank.sol:RewardsBank" + }, + "BaseNodesManager": { + "address": "0x5971E941FC5B3446899c0a5DCfE2631Da575918F", + "abi": [ + "event AdminChanged(address previousAdmin, address newAdmin)", + "event BeaconUpgraded(address indexed beacon)", + "event Initialized(uint8 version)", + "event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)", + "event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)", + "event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)", + "event Upgraded(address indexed implementation)", + "function DEFAULT_ADMIN_ROLE() view returns (bytes32)", + "function addStake(address nodeAddress) payable", + "function getRoleAdmin(bytes32 role) view returns (bytes32)", + "function grantRole(bytes32 role, address account)", + "function hasRole(bytes32 role, address account) view returns (bool)", + "function initialize(address _validatorSet, address _rewardsBank, address _treasury)", + "function proxiableUUID() view returns (bytes32)", + "function removeStake(address nodeAddress, uint256 amount, address sendTo)", + "function renounceRole(bytes32 role, address account)", + "function report(address nodeAddress)", + "function revokeRole(bytes32 role, address account)", + "function reward(address nodeAddress, uint256 amount)", + "function rewardsBank() view returns (address)", + "function supportsInterface(bytes4 interfaceId) view returns (bool)", + "function treasury() view returns (address)", + "function upgradeTo(address newImplementation)", + "function upgradeToAndCall(address newImplementation, bytes data) payable", + "function validatorSet() view returns (address)" + ], + "deployTx": "0x4fb350e46c717989577d0a59b8f70aaad83c9b9715380a155f918679b5c79c98", + "fullyQualifiedName": "contracts/staking/BaseNodes_Manager.sol:BaseNodes_Manager", + "proxy": { + "implementation": "0x7fADeCaB56160A744E8f86D362E4F651c487B95F", + "fullyQualifiedName": "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" + } + }, + "ServerNodesManager_Multisig": { + "address": "0x29bd1af37b775E5BECaa36AB11c61e77D27Ec747", + "abi": [ + "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", + "event Confirmation(address indexed sender, uint256 indexed txId)", + "event Execution(uint256 indexed txId)", + "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", + "event Revocation(address indexed sender, uint256 indexed txId)", + "event SignerAddition(address indexed signer, bool isInitiator)", + "event SignerRemoval(address indexed signer)", + "event Submission(uint256 indexed txId)", + "event ThresholdChange(uint256 required)", + "function changeSigners(address[] signersToRemove, address[] signersToAdd, bool[] isInitiatorFlags)", + "function changeThreshold(uint256 _threshold)", + "function checkBeforeSubmitTransaction(address destination, uint256 value, bytes data) payable", + "function confirmTransaction(uint256 txId)", + "function confirmations(uint256, address) view returns (bool)", + "function getConfirmations(uint256 txId) view returns (address[])", + "function getInitiatorsCount() view returns (uint256)", + "function getRequiredSignersCount() view returns (uint256)", + "function getSigners() view returns (address[], bool[])", + "function getTransactionData(uint256 txId) view returns (tuple(address destination, uint256 value, bytes data, bool executed), address[])", + "function getTransactionIds(uint256 from, uint256 to, bool pending, bool executed) view returns (uint256[] result)", + "function isConfirmed(uint256 txId) view returns (bool)", + "function isInitiator(address) view returns (bool)", + "function isSigner(address) view returns (bool)", + "function owner() view returns (address)", + "function renounceOwnership()", + "function revokeConfirmation(uint256 txId)", + "function signers(uint256) view returns (address)", + "function submitTransaction(address destination, uint256 value, bytes data) payable returns (uint256 txId)", + "function threshold() view returns (uint256)", + "function transactionCount() view returns (uint256)", + "function transactions(uint256) view returns (address destination, uint256 value, bytes data, bool executed)", + "function transferOwnership(address newOwner)", + "function withdraw(address to, uint256 amount)" + ], + "deployTx": "0x9f04d44521dfe0d35b687c2f78edb47cdec27abdcaa907c76dc285f2a9daa8ba", + "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" + }, + "LockKeeper": { + "address": "0xB606021f96c140C6d8168e55D947042f377876B8", + "abi": [ + "constructor()", + "event Claim(uint256 indexed lockId, address indexed userAddress, uint256 amount)", + "event LockCanceled(uint256 indexed lockId, uint256 canceledAmount)", + "event Locked(uint256 indexed lockId, address indexed receiver, address indexed token, address locker, uint64 lockTime, uint64 firstUnlockTime, uint64 unlockPeriod, uint64 totalClaims, uint256 intervalAmount, string description)", + "function allUserLocks(address user) view returns (uint256[], tuple(address locker, address receiver, address token, uint64 firstUnlockTime, uint64 unlockPeriod, uint64 totalClaims, uint64 timesClaimed, uint256 intervalAmount)[])", + "function autoClaim()", + "function cancelLock(uint256 lockId) returns (uint256 unclaimedAmount)", + "function claim(uint256 lockId)", + "function claimAll()", + "function getLock(uint256 id) view returns (tuple(address locker, address receiver, address token, uint64 firstUnlockTime, uint64 unlockPeriod, uint64 totalClaims, uint64 timesClaimed, uint256 intervalAmount))", + "function latestLockId() view returns (uint256)", + "function lockLinear(address receiver, address token, uint64 firstUnlockTime, uint64 totalClaims, uint64 unlockPeriod, uint256 unlockAmount, string description) payable returns (uint256)", + "function lockSingle(address receiver, address token, uint64 unlockTime, uint256 amount, string description) payable returns (uint256)", + "function onBlock()" + ], + "deployTx": "0xc7813833e627d38eea8eb79219167b67f771facbcc8316dde955e2ea9d3d4d97", + "fullyQualifiedName": "contracts/LockKeeper.sol:LockKeeper" + }, + "ServerNodesManager_RewardsBank": { + "address": "0x3BDa31D80BbbC9D6C83111689A67b2CAC87437A0", + "abi": [ + "constructor()", + "event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)", + "event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)", + "event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)", + "function DEFAULT_ADMIN_ROLE() view returns (bytes32)", + "function getRoleAdmin(bytes32 role) view returns (bytes32)", + "function grantRole(bytes32 role, address account)", + "function hasRole(bytes32 role, address account) view returns (bool)", + "function renounceRole(bytes32 role, address account)", + "function revokeRole(bytes32 role, address account)", + "function supportsInterface(bytes4 interfaceId) view returns (bool)", + "function withdrawAmb(address addressTo, uint256 amount)", + "function withdrawErc20(address tokenAddress, address addressTo, uint256 amount)" + ], + "deployTx": "0x5482696344ae455ebb59a17ffe02a376215e476f4f8e68bc03fff4384f5fd6b3", + "fullyQualifiedName": "contracts/funds/RewardsBank.sol:RewardsBank" + }, + "ServerNodesManager": { + "address": "0xe453fCae08D70E54Bd71F52aA87Cf4645B612C37", + "abi": [ + "event AdminChanged(address previousAdmin, address newAdmin)", + "event BeaconUpgraded(address indexed beacon)", + "event Initialized(uint8 version)", + "event Paused(address account)", + "event Reward(address indexed nodeAddress, address indexed rewardAddress, uint256 amountAmb, uint256 amountBonds)", + "event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)", + "event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)", + "event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)", + "event StakeChanged(address indexed nodeAddress, address indexed nodeOwner, int256 amount)", + "event Unpaused(address account)", + "event Upgraded(address indexed implementation)", + "function DEFAULT_ADMIN_ROLE() view returns (bytes32)", + "function addStake(address nodeAddress) payable", + "function airBond() view returns (address)", + "function changeMinStakeAmount(uint256 newMinStakeAmount)", + "function changeNodeOwner(address nodeAddress, address newOwnerAddress)", + "function changeOnboardingDelay(uint256 newOnboardingDelay)", + "function changeUnstakeLockTime(uint256 newUnstakeLockTime)", + "function getRoleAdmin(bytes32 role) view returns (bytes32)", + "function getStakesList() view returns (address[])", + "function getUserStakesList(address ownerAddress) view returns (address[] result)", + "function grantRole(bytes32 role, address account)", + "function hasRole(bytes32 role, address account) view returns (bool)", + "function importOldStakes(address[] addresses, uint256[] amounts, uint256[] timestamps) payable", + "function initialize(address _validatorSet, address _lockKeeper, address _rewardsBank, address _airBond, address _treasury, uint256 _onboardingDelay, uint256 _unstakeLockTime, uint256 _minStakeAmount)", + "function lockKeeper() view returns (address)", + "function lockedWithdraws(address) view returns (uint256)", + "function minStakeAmount() view returns (uint256)", + "function newStake(address nodeAddress, address rewardAddress) payable", + "function onBlock()", + "function onboardingDelay() view returns (uint256)", + "function pause()", + "function paused() view returns (bool)", + "function proxiableUUID() view returns (bytes32)", + "function renounceRole(bytes32 role, address account)", + "function report(address nodeAddress)", + "function restake(address nodeAddress)", + "function revokeRole(bytes32 role, address account)", + "function reward(address nodeAddress, uint256 amount)", + "function rewardsBank() view returns (address)", + "function setRewardsAddress(address nodeAddress, address rewardsAddress)", + "function stakes(address) view returns (uint256 stake, uint256 timestampStake, address ownerAddress, address rewardsAddress)", + "function supportsInterface(bytes4 interfaceId) view returns (bool)", + "function treasury() view returns (address)", + "function unpause()", + "function unstake(address nodeAddress, uint256 amount)", + "function unstakeLockTime() view returns (uint256)", + "function upgradeTo(address newImplementation)", + "function upgradeToAndCall(address newImplementation, bytes data) payable", + "function validatorSet() view returns (address)" + ], + "deployTx": "0xd39c827e830b258174da413d886fc5957bc7dcb4c4e9c7f4ace1f8b1a745724f", + "fullyQualifiedName": "contracts/staking/ServerNodes_Manager.sol:ServerNodes_Manager", + "proxy": { + "implementation": "0x8a80037D8000A0d76DA9296546c125EC61D6Bd57", + "fullyQualifiedName": "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" + } + }, + "LegacyPoolManager_Multisig": { + "address": "0x8195Ba9E9fCF35627fD8117f2e0638b1d94DC18e", + "abi": [ + "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", + "event Confirmation(address indexed sender, uint256 indexed txId)", + "event Execution(uint256 indexed txId)", + "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", + "event Revocation(address indexed sender, uint256 indexed txId)", + "event SignerAddition(address indexed signer, bool isInitiator)", + "event SignerRemoval(address indexed signer)", + "event Submission(uint256 indexed txId)", + "event ThresholdChange(uint256 required)", + "function changeSigners(address[] signersToRemove, address[] signersToAdd, bool[] isInitiatorFlags)", + "function changeThreshold(uint256 _threshold)", + "function checkBeforeSubmitTransaction(address destination, uint256 value, bytes data) payable", + "function confirmTransaction(uint256 txId)", + "function confirmations(uint256, address) view returns (bool)", + "function getConfirmations(uint256 txId) view returns (address[])", + "function getInitiatorsCount() view returns (uint256)", + "function getRequiredSignersCount() view returns (uint256)", + "function getSigners() view returns (address[], bool[])", + "function getTransactionData(uint256 txId) view returns (tuple(address destination, uint256 value, bytes data, bool executed), address[])", + "function getTransactionIds(uint256 from, uint256 to, bool pending, bool executed) view returns (uint256[] result)", + "function isConfirmed(uint256 txId) view returns (bool)", + "function isInitiator(address) view returns (bool)", + "function isSigner(address) view returns (bool)", + "function owner() view returns (address)", + "function renounceOwnership()", + "function revokeConfirmation(uint256 txId)", + "function signers(uint256) view returns (address)", + "function submitTransaction(address destination, uint256 value, bytes data) payable returns (uint256 txId)", + "function threshold() view returns (uint256)", + "function transactionCount() view returns (uint256)", + "function transactions(uint256) view returns (address destination, uint256 value, bytes data, bool executed)", + "function transferOwnership(address newOwner)", + "function withdraw(address to, uint256 amount)" + ], + "deployTx": "0x3978f28e4015ae053815577cc4ce58850f4859e9bd2949692d5993c15184e36f", + "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" + }, + "LegacyPoolManager_RewardsBank": { + "address": "0x4B41dE7e5FBFc88FfE0e530F426a776AA894E08D", + "abi": [ + "constructor()", + "event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)", + "event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)", + "event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)", + "function DEFAULT_ADMIN_ROLE() view returns (bytes32)", + "function getRoleAdmin(bytes32 role) view returns (bytes32)", + "function grantRole(bytes32 role, address account)", + "function hasRole(bytes32 role, address account) view returns (bool)", + "function renounceRole(bytes32 role, address account)", + "function revokeRole(bytes32 role, address account)", + "function supportsInterface(bytes4 interfaceId) view returns (bool)", + "function withdrawAmb(address addressTo, uint256 amount)", + "function withdrawErc20(address tokenAddress, address addressTo, uint256 amount)" + ], + "deployTx": "0x96a141541fb60fbf898b748f961a3412f8d638ae3d27d5ab2c032b3728a203fe", + "fullyQualifiedName": "contracts/funds/RewardsBank.sol:RewardsBank" + }, + "LegacyPoolManager": { + "address": "0xa8cAE790eE3476d57B99707e89d9fA2edC01BAdB", + "abi": [ + "event AdminChanged(address previousAdmin, address newAdmin)", + "event BeaconUpgraded(address indexed beacon)", + "event Initialized(uint8 version)", + "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", + "event Paused(address account)", + "event PoolAdded(address poolAddress)", + "event PoolRemoved(address poolAddress)", + "event Unpaused(address account)", + "event Upgraded(address indexed implementation)", + "function addNodeRequest(uint256 stake, uint256 requestId, uint256 nodeId, uint8 role)", + "function addNodeRequestResolved(uint256 requestId, uint256 status)", + "function addPool(address pool)", + "function changeMinApolloDeposit(uint256 newMinApolloDeposit)", + "function getDeposit(address nodeAddress) view returns (uint256)", + "function getPools() view returns (address[])", + "function importOldStakes(address[] addresses, address[] pools, uint256[] amounts)", + "function initialize(uint256 _minApolloDeposit, address _validatorSet, address _rewardsBank, address _treasury, address _poolsStore, address _apolloDepositStore, address _rolesEventEmitter, address _poolEventsEmitter)", + "function isPool(address poolAddress) view returns (bool)", + "function minApolloDeposit() view returns (uint256)", + "function nextId() returns (uint256)", + "function node2pool(address) view returns (address)", + "function onboard(address nodeAddress, uint8 nodeType) payable", + "function owner() view returns (address)", + "function pause()", + "function paused() view returns (bool)", + "function poolReward(uint256 reward, uint256 tokenPrice)", + "function poolStakeChanged(address user, int256 stake, int256 tokens)", + "function proxiableUUID() view returns (bytes32)", + "function removePool(address pool)", + "function renounceOwnership()", + "function report(address nodeAddress)", + "function retire(address nodeAddress, uint8 nodeType) returns (uint256)", + "function reward(address nodeAddress, uint256 amount)", + "function rewardsBank() view returns (address)", + "function transferOwnership(address newOwner)", + "function treasury() view returns (address)", + "function unpause()", + "function upgradeTo(address newImplementation)", + "function upgradeToAndCall(address newImplementation, bytes data) payable", + "function validatorSet() view returns (address)" + ], + "deployTx": "0x3fc455e21ee930aba8207d2d211995abed70e6aff3a65e31b64881eea9fb76f6", + "fullyQualifiedName": "contracts/staking/pools/LegacyPoolsNodes_Manager.sol:LegacyPoolsNodes_Manager", + "proxy": { + "implementation": "0xb690EA5c884312988e55bE86aEe38759485703c4", + "fullyQualifiedName": "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" + } } } \ No newline at end of file diff --git a/package.json b/package.json index f82a9a2d..f25fb296 100644 --- a/package.json +++ b/package.json @@ -16,20 +16,21 @@ "coverage": "COVERAGE=true hardhat coverage", "format:check": "eslint ./ && prettier --check ./", "format:fix": "eslint --fix ./ && prettier --write ./", - "deploy_multisig": "hardhat run scripts/multisig/deploy_multisig.ts --network dev", - "deploy_finance": "hardhat run scripts/finance/deploy_finance.ts --network dev", - "deploy_airdrop": "hardhat run scripts/finance/deploy_airdrop.ts --network dev", - "deploy_validatorset": "hardhat run scripts/staking/deploy_validatorset.ts --network dev", - "deploy_treasury": "hardhat run scripts/staking/deploy_treasury.ts --network dev", - "deploy_basenodes_manager": "hardhat run scripts/staking/deploy_basenodes_manager.ts --network dev", - "deploy_servernodes_manager": "hardhat run scripts/staking/deploy_servernodes_manager.ts --network dev", - "deploy_legacy_pool_manager": "hardhat run scripts/staking/deploy_legacy_pool_manager.ts --network dev", - "deploy_all": "npm run deploy_multisig && npm run deploy_finance && npm run deploy_airdrop && npm run deploy_validatorset && npm run deploy_treasury && npm run deploy_basenodes_manager && npm run deploy_servernodes_manager && npm run deploy_legacy_pool_manager", + "deploy_multisig": "hardhat run scripts/multisig/deploy_multisig.ts --network test", + "deploy_finance": "hardhat run scripts/finance/deploy_finance.ts --network test", + "deploy_airdrop": "hardhat run scripts/finance/deploy_airdrop.ts --network test", + "deploy_validatorset": "hardhat run scripts/staking/deploy_validatorset.ts --network test", + "deploy_treasury": "hardhat run scripts/staking/deploy_treasury.ts --network test", + "deploy_basenodes_manager": "hardhat run scripts/staking/deploy_basenodes_manager.ts --network test", + "deploy_servernodes_manager": "hardhat run scripts/staking/deploy_servernodes_manager.ts --network test", + "deploy_legacy_pool_manager": "hardhat run scripts/staking/deploy_legacy_pool_manager.ts --network test", + "deploy_staking": "npm run deploy_validatorset && npm run deploy_treasury && npm run deploy_basenodes_manager && npm run deploy_servernodes_manager && npm run deploy_legacy_pool_manager", + "deploy_all": "npm run deploy_multisig && npm run deploy_finance && npm run deploy_airdrop && npm run deploy_staking", "deploy_migration_to_new_staking": "hardhat run scripts/staking/migrate_to_new_staking.ts --network dev", "test_script": "hardhat run scripts/staking/test.ts --network test", "integration_test_script": "hardhat run scripts/staking/new_validatorset_integration_test.ts --network local", "sourcify:dev": "SOURCIFY_API=https://sourcify.ambrosus-dev.io/ hardhat sourcify --network dev", - "sourcify:test": "hardhat sourcify --network test", + "sourcify:test": "SOURCIFY_API=https://sourcify.ambrosus-dev.io/ hardhat sourcify --network test", "sourcify:main": "hardhat sourcify --network main" }, "devDependencies": { From 82e87f67fb63f7c92d969089ba5ef2387a53304a Mon Sep 17 00:00:00 2001 From: svin Date: Tue, 3 Oct 2023 20:16:52 +0300 Subject: [PATCH 11/19] Deploy on testnet --- deployments/22040.json | 186 ++++++++++++++++++++--------------------- package.json | 2 +- 2 files changed, 94 insertions(+), 94 deletions(-) diff --git a/deployments/22040.json b/deployments/22040.json index a43aea67..f4e95296 100644 --- a/deployments/22040.json +++ b/deployments/22040.json @@ -1,8 +1,8 @@ { - "FinanceMaster_Multisig": { - "address": "0x55C402b5F9C2c3DfE3d866B36598f0Fd53e03B89", + "MasterMultisig": { + "address": "0x096B5914C95C34Df19500DAff77470C845EC749D", "abi": [ - "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", + "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold)", "event Confirmation(address indexed sender, uint256 indexed txId)", "event Execution(uint256 indexed txId)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", @@ -11,11 +11,14 @@ "event SignerRemoval(address indexed signer)", "event Submission(uint256 indexed txId)", "event ThresholdChange(uint256 required)", + "function changeOwners(address[] multisigs, address newOwner)", "function changeSigners(address[] signersToRemove, address[] signersToAdd, bool[] isInitiatorFlags)", + "function changeSignersMaster(tuple(address contract_, address[] signersToRemove, address[] signersToAdd, bool[] isInitiatorFlags)[] changes)", "function changeThreshold(uint256 _threshold)", "function checkBeforeSubmitTransaction(address destination, uint256 value, bytes data) payable", "function confirmTransaction(uint256 txId)", "function confirmations(uint256, address) view returns (bool)", + "function getAllSigners(address[] multisigs) view returns (tuple(address[] signers, bool[] isInitiatorFlags, uint256 threshold)[])", "function getConfirmations(uint256 txId) view returns (address[])", "function getInitiatorsCount() view returns (uint256)", "function getRequiredSignersCount() view returns (uint256)", @@ -36,28 +39,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x6ffcdf39f388c194572677e173cc2d12eacda8e309379b63718e579337e0d44c", - "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" - }, - "FinanceMaster": { - "address": "0xA9646A0281996fDcB88f8f6f01Af52BB0268c494", - "abi": [ - "constructor(address owner, uint256 maxBanks_, uint256 maxBankBalance_)", - "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", - "event Withdraw(address addressTo, uint256 amount)", - "function banks(uint256) view returns (address)", - "function getBalances() view returns (address[] addresses, uint256[] balances)", - "function owner() view returns (address)", - "function renounceOwnership()", - "function transferOwnership(address newOwner)", - "function transferToBanks()", - "function withdraw(address addressTo, uint256 amount)" - ], - "deployTx": "0xd76772e084aa668b72b19c0526051cee31a34a9fbabf01f4fdd1039d040872e7", - "fullyQualifiedName": "contracts/finance/MasterFinance.sol:MasterFinance" + "deployTx": "0x53d068a2affadcd67a86e275473130155d50e70815b31dcf76f943939533706a", + "fullyQualifiedName": "contracts/multisig/MasterMultisig.sol:MasterMultisig" }, - "FinanceRewards_Multisig": { - "address": "0x4798Cbd108e3D7b531ef2f3d67E7fFabdEe29867", + "FinanceMaster_Multisig": { + "address": "0x8c33e9D24eBf3918D37eC2F26BaE044C9fD30Ea9", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -93,25 +79,28 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0xade8b2ca8b4bcca1d46433385aeba9f7d07e6f271fe929137360a4196f5eec4e", + "deployTx": "0xfcbb3c4951905ab60550c71cf88e8db71b9e50b567a18a4bbc4c1f162a96daf6", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, - "FinanceRewards": { - "address": "0xb805D144dCF9eEEe0E12e1a55E9AD46905Ef47fe", + "FinanceMaster": { + "address": "0x55Be7dd776fAbe89d93bAC66ed1cf0Ab31bdd6eB", "abi": [ - "constructor(address owner)", + "constructor(address owner, uint256 maxBanks_, uint256 maxBankBalance_)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", "event Withdraw(address addressTo, uint256 amount)", + "function banks(uint256) view returns (address)", + "function getBalances() view returns (address[] addresses, uint256[] balances)", "function owner() view returns (address)", "function renounceOwnership()", "function transferOwnership(address newOwner)", + "function transferToBanks()", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0xfa8b5a544a6c1a27e63b0a89c82262e6bd58707bb18914bab1ed7983543afa12", - "fullyQualifiedName": "contracts/finance/Finance.sol:Finance" + "deployTx": "0x56c7f8e0ce5beec09a408166c21bb9345066ad7f2a254160c6a40bc4dd7db927", + "fullyQualifiedName": "contracts/finance/MasterFinance.sol:MasterFinance" }, - "FinanceInvestors_Multisig": { - "address": "0x073F6D7a999aa5F9172f4Fe1AB4604268ecbFd0E", + "FinanceRewards_Multisig": { + "address": "0x615D835e0C492b4309E79439765F66Db7BdcE200", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -147,11 +136,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x45b378acf2b2339f8f697c1405544976f56cae01b847bb7a45570bf894d07bf1", + "deployTx": "0x4bd332682b4195427f96e9df340d0c8d2d21525c6ced908af54d7372770c133a", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, - "FinanceInvestors": { - "address": "0x81DC178E336C0Fd916982028065497ffdCa01F40", + "FinanceRewards": { + "address": "0x0c3001D98a02dFFf10814E2e5e1DA5a276C2552a", "abi": [ "constructor(address owner)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", @@ -161,11 +150,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0x1de7fc762fe606af00d8001e468d58041ed7a3eafbf587fd215e0fb04e9525a1", + "deployTx": "0xc32a5657c44fdd43f55516ace75ec7c9f785733e9378ce88d166b747a9226398", "fullyQualifiedName": "contracts/finance/Finance.sol:Finance" }, - "FinanceTeam_Multisig": { - "address": "0xB17eEc1d977bea26c67c8Be86DF98C33a21F7fE9", + "FinanceInvestors_Multisig": { + "address": "0x3B851d4d79C44AbBBF914D6bc61A2BdCC7387d85", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -201,11 +190,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x9b49b3b94e3441a8ceae4c84e75400b39b19c69e516a7887f8f32fff51a3b662", + "deployTx": "0xe81a10fcaac38f6836f84cecb7ad1ed541105382c0b2128234507899f78ebde0", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, - "FinanceTeam": { - "address": "0xE6b3585c2E2Fe8C39EECB163e5D8C90346c873F4", + "FinanceInvestors": { + "address": "0x7F4f5d586F33075F4Ac1D3FC11fb394Da6f7c041", "abi": [ "constructor(address owner)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", @@ -215,11 +204,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0x02487b20e44f3a364d4a96092e478370c07f4132f5db8a2b183f3d682280b001", + "deployTx": "0x53428078aab418bff4295a6d296face41ebc15aad4349787c58602dd35874a3d", "fullyQualifiedName": "contracts/finance/Finance.sol:Finance" }, - "FinanceEcosystem_Multisig": { - "address": "0xF3EE25f6600B68cDBeECa955B4bCcF9c9ABF9a40", + "FinanceTeam_Multisig": { + "address": "0x9436CEC90DC41F03c7b679779D3B55dca5a02382", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -255,11 +244,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x02da17144181c7f67a0ca6cda7baf8e12f4eddd3fe69fb62a538ea518d82b68c", + "deployTx": "0x2a354f98cdde23f229fe5c657d44043d31a96b1d3553122c1d6d1561f45b7b75", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, - "FinanceEcosystem": { - "address": "0x91c2F6725a1e076929E1fDECCfD72209D0694af0", + "FinanceTeam": { + "address": "0x132827Ee051b7276a2f85D6964F6182974aa243c", "abi": [ "constructor(address owner)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", @@ -269,13 +258,13 @@ "function transferOwnership(address newOwner)", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0x4404dd11020d175c04f3d5da688f6eefc08f4e524be72c77553756a00c927bb4", + "deployTx": "0xcec3fd3589544ed34eae3fbcc02e6c6c4c179d8f4bba4937fa9025718ce75ebf", "fullyQualifiedName": "contracts/finance/Finance.sol:Finance" }, - "MasterMultisig": { - "address": "0xC54007213080526139d38eAe66777dFac413772C", + "FinanceEcosystem_Multisig": { + "address": "0x4db96017947838031561b35A643B2d9Dbf163241", "abi": [ - "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold)", + "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", "event Execution(uint256 indexed txId)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", @@ -284,14 +273,11 @@ "event SignerRemoval(address indexed signer)", "event Submission(uint256 indexed txId)", "event ThresholdChange(uint256 required)", - "function changeOwners(address[] multisigs, address newOwner)", "function changeSigners(address[] signersToRemove, address[] signersToAdd, bool[] isInitiatorFlags)", - "function changeSignersMaster(tuple(address contract_, address[] signersToRemove, address[] signersToAdd, bool[] isInitiatorFlags)[] changes)", "function changeThreshold(uint256 _threshold)", "function checkBeforeSubmitTransaction(address destination, uint256 value, bytes data) payable", "function confirmTransaction(uint256 txId)", "function confirmations(uint256, address) view returns (bool)", - "function getAllSigners(address[] multisigs) view returns (tuple(address[] signers, bool[] isInitiatorFlags, uint256 threshold)[])", "function getConfirmations(uint256 txId) view returns (address[])", "function getInitiatorsCount() view returns (uint256)", "function getRequiredSignersCount() view returns (uint256)", @@ -312,11 +298,25 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x8d7e7e591af263f45a506981c213971c502476bc8e326e441459dd637d3e8a98", - "fullyQualifiedName": "contracts/multisig/MasterMultisig.sol:MasterMultisig" + "deployTx": "0xcbda22e93479b817b2846f365a1f622799bec1f7781bba92fbf745f39e78b4ea", + "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" + }, + "FinanceEcosystem": { + "address": "0x090801d716A9d501F57519B1f4bd6aBD2961aa88", + "abi": [ + "constructor(address owner)", + "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", + "event Withdraw(address addressTo, uint256 amount)", + "function owner() view returns (address)", + "function renounceOwnership()", + "function transferOwnership(address newOwner)", + "function withdraw(address addressTo, uint256 amount)" + ], + "deployTx": "0x085eebe97f0baff5cbdc90ddbe8b0c95f2e4fa915c8d87d08e0640470ac0a244", + "fullyQualifiedName": "contracts/finance/Finance.sol:Finance" }, "AirBond": { - "address": "0xC6613c683f2d4684D806FAcb9D413f41221537c6", + "address": "0x17c9b9A8BeeB1FE98566877AF442dbeBd0F5dB09", "abi": [ "constructor(address admin)", "event Approval(address indexed owner, address indexed spender, uint256 value)", @@ -346,11 +346,11 @@ "function transfer(address to, uint256 amount) returns (bool)", "function transferFrom(address from, address to, uint256 amount) returns (bool)" ], - "deployTx": "0xd7d738f734308c8965846dd769f10b7b973767b53a56cece796a975767161966", - "fullyQualifiedName": "contracts/funds/AmbBond.sol:AmbBond" + "deployTx": "0x50a4a1aaccc09980d96e1c40ac84d011533e4bb6234ce0a7fcb402481feac244", + "fullyQualifiedName": "contracts/funds/AirBond.sol:AirBond" }, "AirDrop": { - "address": "0x1448682F926862Fa3624AF007D14CB80D1bdDccC", + "address": "0xF01EF9dFf8cA6e4324b000812D75Aa4A67ee52ca", "abi": [ "constructor(address airBondToken_, address backendAddress_, uint256 minAmbBalance_, tuple(address user, bytes32 category, uint256 amount)[] claims) payable", "event Claim(address user, bytes32[] categories, uint256[] amounts)", @@ -368,11 +368,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0x3c1d84398c87818a97a1a88d2fd2cbf135f84adb187241d02fa8d22a0f5fde94", + "deployTx": "0x1d5986c16efd1ccb0e6bf2ba03bd1f52922d021e39ade39958d876f187c57df6", "fullyQualifiedName": "contracts/projects/airdrop/AirDrop.sol:AirDrop" }, "ValidatorSet_Multisig": { - "address": "0x6aba61DA4CD5A12DBfE1f3263540B293890b9214", + "address": "0x58E98B0974A22270D974Ce914Fc430E048368546", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -408,11 +408,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x1bb7e254a9c0c3455347504e56f94416283ecf1e6b405c95f85263903b302c5f", + "deployTx": "0x986aefc1812a9a80d27f294106366f2b1e16e0d24d1d1eb73ac2208e2658f83d", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "ValidatorSet": { - "address": "0x45651Bdb0dB444780a44BE73DAF72AF7C5482abc", + "address": "0xeeff62628dcD8E8AF2aA376C718f54602a54B5c5", "abi": [ "event AdminChanged(address previousAdmin, address newAdmin)", "event BeaconUpgraded(address indexed beacon)", @@ -472,15 +472,15 @@ "function upgradeTo(address newImplementation)", "function upgradeToAndCall(address newImplementation, bytes data) payable" ], - "deployTx": "0xa18d299b0c43c813c914c38237b9236f56bca28cefa94e43ff8efd93a3d6a0f6", + "deployTx": "0xc83277b6f4b133f5ea4ca3f3a6500efa763640a84b4804d33df64c460ff55e4a", "fullyQualifiedName": "contracts/consensus/ValidatorSet.sol:ValidatorSet", "proxy": { - "implementation": "0x4fFE71CA70134770B9C8d811a7523A6A8a7aF84f", + "implementation": "0xea3011C9Efeb1e2A63A0c6cb23a0e0314970735F", "fullyQualifiedName": "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" } }, "Treasury_Multisig": { - "address": "0x86659f410677F8C5cd08a7090b0657165D6F1423", + "address": "0xc050F45e9394C47c020AE3322F7017D67D4e215b", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -516,11 +516,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x130734d92a7c85421af1b1ef80b11ac2c8fa78bc0e5dc25c792ae3d2305fecc5", + "deployTx": "0xc69fda82a75abd4b3a4b2483d077ee0752eae9931422d8ee1434576327b01615", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "Treasury": { - "address": "0x4E7cF064d05C6F6a34d41D1f919bb92B88f4B9a5", + "address": "0x1D1c26e0b8DAFa08FD678A888a8f4de175B1d060", "abi": [ "constructor(address owner, uint256 _fee)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", @@ -533,11 +533,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0xd15ec5e8ec820310ac8d0d5cb78419bb4b7160f12b1e9bcc40f0a5049602adf7", + "deployTx": "0xe13921fafaea0bafe81562ab6e7f5990714590bb8041b40dfdf212fe2d058d77", "fullyQualifiedName": "contracts/finance/Treasury.sol:Treasury" }, "BaseNodesManager_Multisig": { - "address": "0xCD27691A75D9a112012f9fB771a691fe3bE1F1f0", + "address": "0x765e3e03f8dfca312EfdAb378e386E1EA60ee93F", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -573,11 +573,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0xf246f1799cb5325b577846b58dbdd0216fd3091f90a77f715e69ff2c364f5f33", + "deployTx": "0x3e0b9a8f0468c0881ccccf3d7c9e38e657072ee198d43c7c813a108a4f6489ac", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "BaseNodesManager_RewardsBank": { - "address": "0x5B1Fd7Ebac3E31F2b9562bBF85BEBf37958F9320", + "address": "0x130c0e94E79DbA9F8A63D6452210C89e5942130c", "abi": [ "constructor()", "event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)", @@ -593,11 +593,11 @@ "function withdrawAmb(address addressTo, uint256 amount)", "function withdrawErc20(address tokenAddress, address addressTo, uint256 amount)" ], - "deployTx": "0x3c9fdeb08527e72c8da98f100d80aa494f20bd48c092cc66c66aca9a736bed93", + "deployTx": "0xbb87c1a736cb22becf41d056bd0646b6015e7e797d0438a8ed9d4b87bfc58715", "fullyQualifiedName": "contracts/funds/RewardsBank.sol:RewardsBank" }, "BaseNodesManager": { - "address": "0x5971E941FC5B3446899c0a5DCfE2631Da575918F", + "address": "0x871c1F199bD17F1cbed559DE974a7F1568b6E1Ea", "abi": [ "event AdminChanged(address previousAdmin, address newAdmin)", "event BeaconUpgraded(address indexed beacon)", @@ -625,15 +625,15 @@ "function upgradeToAndCall(address newImplementation, bytes data) payable", "function validatorSet() view returns (address)" ], - "deployTx": "0x4fb350e46c717989577d0a59b8f70aaad83c9b9715380a155f918679b5c79c98", + "deployTx": "0x2d1fd11b0811c169dce505a7f700bd555906f0048340d474f05b2cd6854709c7", "fullyQualifiedName": "contracts/staking/BaseNodes_Manager.sol:BaseNodes_Manager", "proxy": { - "implementation": "0x7fADeCaB56160A744E8f86D362E4F651c487B95F", + "implementation": "0x7cee2ae3042D2C646Aa24FACfA92dfeE589046f0", "fullyQualifiedName": "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" } }, "ServerNodesManager_Multisig": { - "address": "0x29bd1af37b775E5BECaa36AB11c61e77D27Ec747", + "address": "0xdC103bf9a3789f78958f365321F3BA07e369667A", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -669,11 +669,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x9f04d44521dfe0d35b687c2f78edb47cdec27abdcaa907c76dc285f2a9daa8ba", + "deployTx": "0x34c37df24f3d09cb2829738145f9ea7fbee76c4a2e0b4981e1d76b533b370143", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "LockKeeper": { - "address": "0xB606021f96c140C6d8168e55D947042f377876B8", + "address": "0x450A606B9D42D081CE58bC5cDF6acA380acF7731", "abi": [ "constructor()", "event Claim(uint256 indexed lockId, address indexed userAddress, uint256 amount)", @@ -690,11 +690,11 @@ "function lockSingle(address receiver, address token, uint64 unlockTime, uint256 amount, string description) payable returns (uint256)", "function onBlock()" ], - "deployTx": "0xc7813833e627d38eea8eb79219167b67f771facbcc8316dde955e2ea9d3d4d97", + "deployTx": "0xa8246752375ee59786e5c13f587da45524c6b7370d322a55cdfab20e0611392e", "fullyQualifiedName": "contracts/LockKeeper.sol:LockKeeper" }, "ServerNodesManager_RewardsBank": { - "address": "0x3BDa31D80BbbC9D6C83111689A67b2CAC87437A0", + "address": "0xe8DA2709BCAD1e2045f25A13347ed994b3d2cBaD", "abi": [ "constructor()", "event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)", @@ -710,11 +710,11 @@ "function withdrawAmb(address addressTo, uint256 amount)", "function withdrawErc20(address tokenAddress, address addressTo, uint256 amount)" ], - "deployTx": "0x5482696344ae455ebb59a17ffe02a376215e476f4f8e68bc03fff4384f5fd6b3", + "deployTx": "0x2fb8460e66d74d45b1e30e4eee2c064bc4737b803ce688df7f0f814daaf6fbde", "fullyQualifiedName": "contracts/funds/RewardsBank.sol:RewardsBank" }, "ServerNodesManager": { - "address": "0xe453fCae08D70E54Bd71F52aA87Cf4645B612C37", + "address": "0x97464F18b71cbF5f42B134CE48b47341f4B4fddf", "abi": [ "event AdminChanged(address previousAdmin, address newAdmin)", "event BeaconUpgraded(address indexed beacon)", @@ -767,15 +767,15 @@ "function upgradeToAndCall(address newImplementation, bytes data) payable", "function validatorSet() view returns (address)" ], - "deployTx": "0xd39c827e830b258174da413d886fc5957bc7dcb4c4e9c7f4ace1f8b1a745724f", + "deployTx": "0x5dd895b7442e8b3ea0fefb53ad55969fe2fce0cf8ef39a190d5c5f74c94f4a78", "fullyQualifiedName": "contracts/staking/ServerNodes_Manager.sol:ServerNodes_Manager", "proxy": { - "implementation": "0x8a80037D8000A0d76DA9296546c125EC61D6Bd57", + "implementation": "0x7aE1eAFC7a9b106b392ddEE027449b09dbDE1347", "fullyQualifiedName": "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" } }, "LegacyPoolManager_Multisig": { - "address": "0x8195Ba9E9fCF35627fD8117f2e0638b1d94DC18e", + "address": "0x00385a84F8ea4A244B2E084D81460e768fAE8ec3", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -811,11 +811,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x3978f28e4015ae053815577cc4ce58850f4859e9bd2949692d5993c15184e36f", + "deployTx": "0x6896c763c4ef789e99d05e5582cfd5cf99cd3b5d767e9f296b0cac1c22cef36b", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "LegacyPoolManager_RewardsBank": { - "address": "0x4B41dE7e5FBFc88FfE0e530F426a776AA894E08D", + "address": "0x99B1A627604dB1479379c2c576dAFdC8AE4C546E", "abi": [ "constructor()", "event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)", @@ -831,11 +831,11 @@ "function withdrawAmb(address addressTo, uint256 amount)", "function withdrawErc20(address tokenAddress, address addressTo, uint256 amount)" ], - "deployTx": "0x96a141541fb60fbf898b748f961a3412f8d638ae3d27d5ab2c032b3728a203fe", + "deployTx": "0xe269d2a9f2d6e13dda7213d603e908a3bb0b84590971276b502f005d61740822", "fullyQualifiedName": "contracts/funds/RewardsBank.sol:RewardsBank" }, "LegacyPoolManager": { - "address": "0xa8cAE790eE3476d57B99707e89d9fA2edC01BAdB", + "address": "0x55C402b5F9C2c3DfE3d866B36598f0Fd53e03B89", "abi": [ "event AdminChanged(address previousAdmin, address newAdmin)", "event BeaconUpgraded(address indexed beacon)", @@ -878,10 +878,10 @@ "function upgradeToAndCall(address newImplementation, bytes data) payable", "function validatorSet() view returns (address)" ], - "deployTx": "0x3fc455e21ee930aba8207d2d211995abed70e6aff3a65e31b64881eea9fb76f6", + "deployTx": "0xdadf8c8dd6bfb5e5921017af33c01b4bad0882b6b7f84b63b525d50f9c416602", "fullyQualifiedName": "contracts/staking/pools/LegacyPoolsNodes_Manager.sol:LegacyPoolsNodes_Manager", "proxy": { - "implementation": "0xb690EA5c884312988e55bE86aEe38759485703c4", + "implementation": "0xC54007213080526139d38eAe66777dFac413772C", "fullyQualifiedName": "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" } } diff --git a/package.json b/package.json index f25fb296..15dea760 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@airdao/airdao-node-contracts", - "version": "1.1.3", + "version": "1.1.4", "main": "./dist/src/index.js", "types": "./dist/src/index.d.ts", "files": [ From 12e77f03f508dc669795b644dac20303d0bee1e7 Mon Sep 17 00:00:00 2001 From: svin Date: Thu, 5 Oct 2023 14:54:01 +0300 Subject: [PATCH 12/19] Remove minApolloDeposit from pool manager --- contracts/staking/pools/LegacyPoolsNodes_Manager.sol | 9 --------- scripts/staking/deploy_legacy_pool_manager.ts | 4 ---- src/methods/staking.ts | 10 ---------- 3 files changed, 23 deletions(-) diff --git a/contracts/staking/pools/LegacyPoolsNodes_Manager.sol b/contracts/staking/pools/LegacyPoolsNodes_Manager.sol index 21b78d2c..0a3cddce 100644 --- a/contracts/staking/pools/LegacyPoolsNodes_Manager.sol +++ b/contracts/staking/pools/LegacyPoolsNodes_Manager.sol @@ -21,8 +21,6 @@ contract LegacyPoolsNodes_Manager is UUPSUpgradeable, OwnableUpgradeable, Pausab RewardsBank public rewardsBank; Treasury public treasury; - uint public minApolloDeposit; - PoolsStore private poolsStore; ApolloDepositStore private apolloDepositStore; RolesEventEmitter private rolesEventEmitter; @@ -37,7 +35,6 @@ contract LegacyPoolsNodes_Manager is UUPSUpgradeable, OwnableUpgradeable, Pausab function initialize( - uint _minApolloDeposit, IValidatorSet _validatorSet, RewardsBank _rewardsBank, Treasury _treasury, @@ -47,7 +44,6 @@ contract LegacyPoolsNodes_Manager is UUPSUpgradeable, OwnableUpgradeable, Pausab PoolEventsEmitter _poolEventsEmitter ) public initializer { __Ownable_init(); - minApolloDeposit = _minApolloDeposit; validatorSet = _validatorSet; rewardsBank = _rewardsBank; treasury = _treasury; @@ -62,7 +58,6 @@ contract LegacyPoolsNodes_Manager is UUPSUpgradeable, OwnableUpgradeable, Pausab function onboard(address nodeAddress, Consts.NodeType nodeType) external payable onlyPoolsCalls whenNotPaused { - require(msg.value >= minApolloDeposit, "Invalid deposit value"); require(getDeposit(nodeAddress) == 0, "Already staking"); apolloDepositStore.storeDeposit{value: msg.value}(nodeAddress); validatorSet.newStake(nodeAddress, msg.value, true); @@ -112,10 +107,6 @@ contract LegacyPoolsNodes_Manager is UUPSUpgradeable, OwnableUpgradeable, Pausab poolsStore.removePool(pool); } - function changeMinApolloDeposit(uint newMinApolloDeposit) public onlyOwner { - minApolloDeposit = newMinApolloDeposit; - } - function importOldStakes(address[] memory addresses, address[] memory pools, uint[] memory amounts) public onlyOwner { require(addresses.length == amounts.length, "Invalid input"); for (uint i = 0; i < addresses.length; i++) { diff --git a/scripts/staking/deploy_legacy_pool_manager.ts b/scripts/staking/deploy_legacy_pool_manager.ts index eaca86bd..b16c4541 100644 --- a/scripts/staking/deploy_legacy_pool_manager.ts +++ b/scripts/staking/deploy_legacy_pool_manager.ts @@ -42,16 +42,12 @@ async function main() { const head: Head = await ethers.getContractAt("Head", HEAD); const oldContext = Context__factory.connect(await head.context(), deployer); - const oldCatalogue = Catalogue__factory.connect(await oldContext.catalogue(), deployer); const oldStorageCatalogue = StorageCatalogue__factory.connect(await oldContext.storageCatalogue(), deployer); - const minApolloDeposit = await new ethers.Contract(await oldCatalogue.config(), configAbi, deployer).APOLLO_DEPOSIT(); - const manager = await deploy({ contractName: ContractNames.LegacyPoolManager, artifactName: "LegacyPoolsNodes_Manager", deployArgs: [ - minApolloDeposit, validatorSet.address, rewardsBank.address, treasury.address, diff --git a/src/methods/staking.ts b/src/methods/staking.ts index 9b2bc1bb..f9b68f60 100644 --- a/src/methods/staking.ts +++ b/src/methods/staking.ts @@ -54,16 +54,6 @@ export async function poolManagerRemovePool(contracts: Contracts, contractName: ); } -export async function poolManagerChangeMinApolloDeposit( - contracts: Contracts, - contractName: PoolManagersCN, - minApolloDeposit: BigNumberish -) { - return await submitTransaction2(contracts, contractName, 0, (poolManager) => - poolManager.changeMinApolloDeposit(minApolloDeposit) - ); -} - // base nodes manager export async function baseNodesManagerAddStake(contracts: Contracts, nodeAddress: string, amount: BigNumberish) { From 7afeeed3059e901962037d9b0bd092b6963b94d6 Mon Sep 17 00:00:00 2001 From: svin Date: Thu, 5 Oct 2023 15:18:33 +0300 Subject: [PATCH 13/19] Update constructor values --- scripts/staking/deploy_servernodes_manager.ts | 3 ++- scripts/staking/deploy_treasury.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/staking/deploy_servernodes_manager.ts b/scripts/staking/deploy_servernodes_manager.ts index cb454e83..222bb034 100644 --- a/scripts/staking/deploy_servernodes_manager.ts +++ b/scripts/staking/deploy_servernodes_manager.ts @@ -42,7 +42,8 @@ export async function main() { signer: deployer, }); - const onboardingDelay = 15 * 24 * 60 * 60; // 15d + // 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 diff --git a/scripts/staking/deploy_treasury.ts b/scripts/staking/deploy_treasury.ts index 65b67c36..6e173949 100644 --- a/scripts/staking/deploy_treasury.ts +++ b/scripts/staking/deploy_treasury.ts @@ -24,7 +24,8 @@ async function main() { signer: deployer, deployArgs: [ multisig.address, - 0.1 * 10000, // 10% fee + 0 // turn off for now + // 0.1 * 10000, // 10% fee ], }); } From eb1420648cc0396266d8c34335037ef04a3fa123 Mon Sep 17 00:00:00 2001 From: svin Date: Thu, 5 Oct 2023 15:34:35 +0300 Subject: [PATCH 14/19] Redeploy testnet --- deployments/22040.json | 10 ++++------ package.json | 6 +++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/deployments/22040.json b/deployments/22040.json index f4e95296..30bb0e82 100644 --- a/deployments/22040.json +++ b/deployments/22040.json @@ -533,7 +533,7 @@ "function transferOwnership(address newOwner)", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0xe13921fafaea0bafe81562ab6e7f5990714590bb8041b40dfdf212fe2d058d77", + "deployTx": "0x0f9b1c2e0b684ae0b43f0da0d70c9d8d2287273ca3270831c737676e3a9e3a28", "fullyQualifiedName": "contracts/finance/Treasury.sol:Treasury" }, "BaseNodesManager_Multisig": { @@ -767,7 +767,7 @@ "function upgradeToAndCall(address newImplementation, bytes data) payable", "function validatorSet() view returns (address)" ], - "deployTx": "0x5dd895b7442e8b3ea0fefb53ad55969fe2fce0cf8ef39a190d5c5f74c94f4a78", + "deployTx": "0x31e7049f75755014b3b37aec700d878812cfcbb1f5a3bcc54105613b526ac87d", "fullyQualifiedName": "contracts/staking/ServerNodes_Manager.sol:ServerNodes_Manager", "proxy": { "implementation": "0x7aE1eAFC7a9b106b392ddEE027449b09dbDE1347", @@ -849,13 +849,11 @@ "function addNodeRequest(uint256 stake, uint256 requestId, uint256 nodeId, uint8 role)", "function addNodeRequestResolved(uint256 requestId, uint256 status)", "function addPool(address pool)", - "function changeMinApolloDeposit(uint256 newMinApolloDeposit)", "function getDeposit(address nodeAddress) view returns (uint256)", "function getPools() view returns (address[])", "function importOldStakes(address[] addresses, address[] pools, uint256[] amounts)", - "function initialize(uint256 _minApolloDeposit, address _validatorSet, address _rewardsBank, address _treasury, address _poolsStore, address _apolloDepositStore, address _rolesEventEmitter, address _poolEventsEmitter)", + "function initialize(address _validatorSet, address _rewardsBank, address _treasury, address _poolsStore, address _apolloDepositStore, address _rolesEventEmitter, address _poolEventsEmitter)", "function isPool(address poolAddress) view returns (bool)", - "function minApolloDeposit() view returns (uint256)", "function nextId() returns (uint256)", "function node2pool(address) view returns (address)", "function onboard(address nodeAddress, uint8 nodeType) payable", @@ -878,7 +876,7 @@ "function upgradeToAndCall(address newImplementation, bytes data) payable", "function validatorSet() view returns (address)" ], - "deployTx": "0xdadf8c8dd6bfb5e5921017af33c01b4bad0882b6b7f84b63b525d50f9c416602", + "deployTx": "0x973af5c50e180b0d5391387d75f91df87b36f761700cec90994114cdacb3b3ae", "fullyQualifiedName": "contracts/staking/pools/LegacyPoolsNodes_Manager.sol:LegacyPoolsNodes_Manager", "proxy": { "implementation": "0xC54007213080526139d38eAe66777dFac413772C", diff --git a/package.json b/package.json index 15dea760..f16a0816 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@airdao/airdao-node-contracts", - "version": "1.1.4", + "version": "1.1.5", "main": "./dist/src/index.js", "types": "./dist/src/index.d.ts", "files": [ @@ -26,8 +26,8 @@ "deploy_legacy_pool_manager": "hardhat run scripts/staking/deploy_legacy_pool_manager.ts --network test", "deploy_staking": "npm run deploy_validatorset && npm run deploy_treasury && npm run deploy_basenodes_manager && npm run deploy_servernodes_manager && npm run deploy_legacy_pool_manager", "deploy_all": "npm run deploy_multisig && npm run deploy_finance && npm run deploy_airdrop && npm run deploy_staking", - "deploy_migration_to_new_staking": "hardhat run scripts/staking/migrate_to_new_staking.ts --network dev", - "test_script": "hardhat run scripts/staking/test.ts --network test", + "deploy_migration_to_new_staking": "hardhat run scripts/staking/migrate_to_new_staking.ts --network test", + "test_script": "hardhat run scripts/test.ts", "integration_test_script": "hardhat run scripts/staking/new_validatorset_integration_test.ts --network local", "sourcify:dev": "SOURCIFY_API=https://sourcify.ambrosus-dev.io/ hardhat sourcify --network dev", "sourcify:test": "SOURCIFY_API=https://sourcify.ambrosus-dev.io/ hardhat sourcify --network test", From 2d30500d72cfa955ceb1c650d4630479833624f6 Mon Sep 17 00:00:00 2001 From: svin Date: Mon, 9 Oct 2023 18:29:35 +0300 Subject: [PATCH 15/19] Redeploy testnet --- deployments/22040.json | 116 ++++++++++++++++++++--------------------- package.json | 2 +- 2 files changed, 59 insertions(+), 59 deletions(-) diff --git a/deployments/22040.json b/deployments/22040.json index 30bb0e82..e305f96f 100644 --- a/deployments/22040.json +++ b/deployments/22040.json @@ -1,6 +1,6 @@ { "MasterMultisig": { - "address": "0x096B5914C95C34Df19500DAff77470C845EC749D", + "address": "0xBE94eFB16edFCB44b3De6C452062D1B599d3d40d", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -39,11 +39,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x53d068a2affadcd67a86e275473130155d50e70815b31dcf76f943939533706a", + "deployTx": "0xacabf287ea3edf534df2aa8e37f75fa6d81330db23ad979f2662344a1107055f", "fullyQualifiedName": "contracts/multisig/MasterMultisig.sol:MasterMultisig" }, "FinanceMaster_Multisig": { - "address": "0x8c33e9D24eBf3918D37eC2F26BaE044C9fD30Ea9", + "address": "0xe2672E824C249b24851389e69225959d1c6c1A1F", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -79,11 +79,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0xfcbb3c4951905ab60550c71cf88e8db71b9e50b567a18a4bbc4c1f162a96daf6", + "deployTx": "0xa1d7a78fe56b23777b2c506d020f285349e78958bed9db03321e8d5cd77cca4a", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "FinanceMaster": { - "address": "0x55Be7dd776fAbe89d93bAC66ed1cf0Ab31bdd6eB", + "address": "0x2B6d32BADB2F3C6f5D7CfEF07962a50109A57fA9", "abi": [ "constructor(address owner, uint256 maxBanks_, uint256 maxBankBalance_)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", @@ -96,11 +96,11 @@ "function transferToBanks()", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0x56c7f8e0ce5beec09a408166c21bb9345066ad7f2a254160c6a40bc4dd7db927", + "deployTx": "0x6c1eeb3603ec94709fe0def8307d929e4d750541629a5297e72e16799a50f98e", "fullyQualifiedName": "contracts/finance/MasterFinance.sol:MasterFinance" }, "FinanceRewards_Multisig": { - "address": "0x615D835e0C492b4309E79439765F66Db7BdcE200", + "address": "0x1fEf4FA0e0a5988F02Ba11786c91d25e0d352eEA", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -136,11 +136,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x4bd332682b4195427f96e9df340d0c8d2d21525c6ced908af54d7372770c133a", + "deployTx": "0xb711a6c14ffbcfa29fff821147631fb69fbad7d1bea83994e07ad729398031a4", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "FinanceRewards": { - "address": "0x0c3001D98a02dFFf10814E2e5e1DA5a276C2552a", + "address": "0xD11a85386e3C5Cc493A1440Ef7Fd99BFAF72477d", "abi": [ "constructor(address owner)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", @@ -150,11 +150,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0xc32a5657c44fdd43f55516ace75ec7c9f785733e9378ce88d166b747a9226398", + "deployTx": "0xebbdf5418bf1ed7520e16ed6dc22e74c075ebad5ae1289ff7c64e77df86e4b0a", "fullyQualifiedName": "contracts/finance/Finance.sol:Finance" }, "FinanceInvestors_Multisig": { - "address": "0x3B851d4d79C44AbBBF914D6bc61A2BdCC7387d85", + "address": "0x1Aa64D2f8747DDc62a78e033D2Ee8bC04a63cd79", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -190,11 +190,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0xe81a10fcaac38f6836f84cecb7ad1ed541105382c0b2128234507899f78ebde0", + "deployTx": "0x5832dd908efc36e8914ff1190342b8f68869a6e251d8d6ccdb7e53b34afede87", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "FinanceInvestors": { - "address": "0x7F4f5d586F33075F4Ac1D3FC11fb394Da6f7c041", + "address": "0x9149B334e2e023C5b01A3C17F4030168B6EF6575", "abi": [ "constructor(address owner)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", @@ -204,11 +204,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0x53428078aab418bff4295a6d296face41ebc15aad4349787c58602dd35874a3d", + "deployTx": "0x49f726f53001338e182182695e7bc2057ef05a89d9776ba836beaa1c4da0b5d1", "fullyQualifiedName": "contracts/finance/Finance.sol:Finance" }, "FinanceTeam_Multisig": { - "address": "0x9436CEC90DC41F03c7b679779D3B55dca5a02382", + "address": "0x30eb4563F0E64963569847E357Cdc1fDE1adf1c7", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -244,11 +244,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x2a354f98cdde23f229fe5c657d44043d31a96b1d3553122c1d6d1561f45b7b75", + "deployTx": "0x6412dc993f26d11a0a8ae8785b3c4ff1c673270b5d29d3d84a0238ea5469b434", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "FinanceTeam": { - "address": "0x132827Ee051b7276a2f85D6964F6182974aa243c", + "address": "0xFF9F502976E7bD2b4901aD7Dd1131Bb81E5567de", "abi": [ "constructor(address owner)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", @@ -258,11 +258,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0xcec3fd3589544ed34eae3fbcc02e6c6c4c179d8f4bba4937fa9025718ce75ebf", + "deployTx": "0xaf50d91386f0ce68ac8535e6411a347a76b2944d244f90d6efa34a57d99bfd24", "fullyQualifiedName": "contracts/finance/Finance.sol:Finance" }, "FinanceEcosystem_Multisig": { - "address": "0x4db96017947838031561b35A643B2d9Dbf163241", + "address": "0x99d7DEf637ad71Da08D1a1f9b917789B805cCb0a", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -298,11 +298,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0xcbda22e93479b817b2846f365a1f622799bec1f7781bba92fbf745f39e78b4ea", + "deployTx": "0xdada733bd4a5e5e8ebe4846279d3aa507497c87fe7dd4e266344e1cce8598314", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "FinanceEcosystem": { - "address": "0x090801d716A9d501F57519B1f4bd6aBD2961aa88", + "address": "0xE3C532aD50B16e59c1866DCC0C672F7b4c685f00", "abi": [ "constructor(address owner)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", @@ -312,11 +312,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0x085eebe97f0baff5cbdc90ddbe8b0c95f2e4fa915c8d87d08e0640470ac0a244", + "deployTx": "0xe02961c175ab42bb432f91462544584ca41ffc4aebf112f31c3defb99c376fd8", "fullyQualifiedName": "contracts/finance/Finance.sol:Finance" }, "AirBond": { - "address": "0x17c9b9A8BeeB1FE98566877AF442dbeBd0F5dB09", + "address": "0xD3A7E420Aa128Cb6AcFDd998258Ea938E50Ae600", "abi": [ "constructor(address admin)", "event Approval(address indexed owner, address indexed spender, uint256 value)", @@ -346,11 +346,11 @@ "function transfer(address to, uint256 amount) returns (bool)", "function transferFrom(address from, address to, uint256 amount) returns (bool)" ], - "deployTx": "0x50a4a1aaccc09980d96e1c40ac84d011533e4bb6234ce0a7fcb402481feac244", + "deployTx": "0x4faedcd99308dae761bd3e046098a3727f633c49fc684955b56e3968cbbc42f5", "fullyQualifiedName": "contracts/funds/AirBond.sol:AirBond" }, "AirDrop": { - "address": "0xF01EF9dFf8cA6e4324b000812D75Aa4A67ee52ca", + "address": "0x51781501C27a7D6503652CA280BF5e92F3Eb03CD", "abi": [ "constructor(address airBondToken_, address backendAddress_, uint256 minAmbBalance_, tuple(address user, bytes32 category, uint256 amount)[] claims) payable", "event Claim(address user, bytes32[] categories, uint256[] amounts)", @@ -368,11 +368,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0x1d5986c16efd1ccb0e6bf2ba03bd1f52922d021e39ade39958d876f187c57df6", + "deployTx": "0x9ce05b7ea829d998510a823db5552319857fe887077e189db5a169a94262ab45", "fullyQualifiedName": "contracts/projects/airdrop/AirDrop.sol:AirDrop" }, "ValidatorSet_Multisig": { - "address": "0x58E98B0974A22270D974Ce914Fc430E048368546", + "address": "0x1de2419B8CD823A23B534df136506C37A816947F", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -408,11 +408,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x986aefc1812a9a80d27f294106366f2b1e16e0d24d1d1eb73ac2208e2658f83d", + "deployTx": "0xb4dca8e9c135c151c82453ac447bb322af6869c44ea388df44213fc849cb4fd1", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "ValidatorSet": { - "address": "0xeeff62628dcD8E8AF2aA376C718f54602a54B5c5", + "address": "0x4Ee5e950f19E7B87052B92a2F6D001ec4A9F41f5", "abi": [ "event AdminChanged(address previousAdmin, address newAdmin)", "event BeaconUpgraded(address indexed beacon)", @@ -472,15 +472,15 @@ "function upgradeTo(address newImplementation)", "function upgradeToAndCall(address newImplementation, bytes data) payable" ], - "deployTx": "0xc83277b6f4b133f5ea4ca3f3a6500efa763640a84b4804d33df64c460ff55e4a", + "deployTx": "0x9e1df63f708c6b6cc348ed7c9ef8afd23a1062d38bfd328e36c215291ea61fad", "fullyQualifiedName": "contracts/consensus/ValidatorSet.sol:ValidatorSet", "proxy": { - "implementation": "0xea3011C9Efeb1e2A63A0c6cb23a0e0314970735F", + "implementation": "0xBDc316826B77d198Eec93BC813F2796e7f26c2b3", "fullyQualifiedName": "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" } }, "Treasury_Multisig": { - "address": "0xc050F45e9394C47c020AE3322F7017D67D4e215b", + "address": "0x2Cf845b49e1c4E5D657fbBF36E97B7B5B7B7b74b", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -516,11 +516,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0xc69fda82a75abd4b3a4b2483d077ee0752eae9931422d8ee1434576327b01615", + "deployTx": "0xd137b28b13e43e0edb1b6eb7b4a7c5268cde59d109660686fd1e52cbb6c8a16d", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "Treasury": { - "address": "0x1D1c26e0b8DAFa08FD678A888a8f4de175B1d060", + "address": "0x3c80Eb9ebe759F28Ae6f366275A9e2A9FE341b0a", "abi": [ "constructor(address owner, uint256 _fee)", "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", @@ -533,11 +533,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address addressTo, uint256 amount)" ], - "deployTx": "0x0f9b1c2e0b684ae0b43f0da0d70c9d8d2287273ca3270831c737676e3a9e3a28", + "deployTx": "0x509ce97171065c07cd634c92a478610220d8ab80b3b899a17ef47a558dd9a60e", "fullyQualifiedName": "contracts/finance/Treasury.sol:Treasury" }, "BaseNodesManager_Multisig": { - "address": "0x765e3e03f8dfca312EfdAb378e386E1EA60ee93F", + "address": "0xdd82283Fc93Aa4373B6B27a7B25EB3A770fc3aba", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -573,11 +573,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x3e0b9a8f0468c0881ccccf3d7c9e38e657072ee198d43c7c813a108a4f6489ac", + "deployTx": "0x2915ca17dfdb8540a6024d5ce2a7ba3ffd2fadfd731ceb647535d6e47032820d", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "BaseNodesManager_RewardsBank": { - "address": "0x130c0e94E79DbA9F8A63D6452210C89e5942130c", + "address": "0x160fb9e3a978F44c5E7fd82b17aAe27773e5b58D", "abi": [ "constructor()", "event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)", @@ -593,11 +593,11 @@ "function withdrawAmb(address addressTo, uint256 amount)", "function withdrawErc20(address tokenAddress, address addressTo, uint256 amount)" ], - "deployTx": "0xbb87c1a736cb22becf41d056bd0646b6015e7e797d0438a8ed9d4b87bfc58715", + "deployTx": "0x6f1bba7f7c44ecc5d8fe840ac98a71c56c46778566ad16f36db5e3fea50542d6", "fullyQualifiedName": "contracts/funds/RewardsBank.sol:RewardsBank" }, "BaseNodesManager": { - "address": "0x871c1F199bD17F1cbed559DE974a7F1568b6E1Ea", + "address": "0xd0322ae33ff5E14E4F200a2AAd57748F0899FAD9", "abi": [ "event AdminChanged(address previousAdmin, address newAdmin)", "event BeaconUpgraded(address indexed beacon)", @@ -625,15 +625,15 @@ "function upgradeToAndCall(address newImplementation, bytes data) payable", "function validatorSet() view returns (address)" ], - "deployTx": "0x2d1fd11b0811c169dce505a7f700bd555906f0048340d474f05b2cd6854709c7", + "deployTx": "0x10c1978eb927e0e59791a30fa101c917c4921459268c1aa432d0149057427238", "fullyQualifiedName": "contracts/staking/BaseNodes_Manager.sol:BaseNodes_Manager", "proxy": { - "implementation": "0x7cee2ae3042D2C646Aa24FACfA92dfeE589046f0", + "implementation": "0xe5A673b4BfCc7c6804185F35b94693b4CAfCF43c", "fullyQualifiedName": "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" } }, "ServerNodesManager_Multisig": { - "address": "0xdC103bf9a3789f78958f365321F3BA07e369667A", + "address": "0xeAAd95c57BC920A175767f1b6187820B193E0889", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -669,11 +669,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x34c37df24f3d09cb2829738145f9ea7fbee76c4a2e0b4981e1d76b533b370143", + "deployTx": "0x5a02c4f7f5962ed8914d58d637bf839d3c0e71f19632931b02775e74d031d7bb", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "LockKeeper": { - "address": "0x450A606B9D42D081CE58bC5cDF6acA380acF7731", + "address": "0x009Ae4Bf3A00Ee4f9981bf7a808702f18b86d217", "abi": [ "constructor()", "event Claim(uint256 indexed lockId, address indexed userAddress, uint256 amount)", @@ -690,11 +690,11 @@ "function lockSingle(address receiver, address token, uint64 unlockTime, uint256 amount, string description) payable returns (uint256)", "function onBlock()" ], - "deployTx": "0xa8246752375ee59786e5c13f587da45524c6b7370d322a55cdfab20e0611392e", + "deployTx": "0x4e56c71f53a7bd60519ce84f216eb063bcff5dcfad15095a68edaf587114361d", "fullyQualifiedName": "contracts/LockKeeper.sol:LockKeeper" }, "ServerNodesManager_RewardsBank": { - "address": "0xe8DA2709BCAD1e2045f25A13347ed994b3d2cBaD", + "address": "0x480ca9040a1e64E9337c6Adac6730069B509DC08", "abi": [ "constructor()", "event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)", @@ -710,11 +710,11 @@ "function withdrawAmb(address addressTo, uint256 amount)", "function withdrawErc20(address tokenAddress, address addressTo, uint256 amount)" ], - "deployTx": "0x2fb8460e66d74d45b1e30e4eee2c064bc4737b803ce688df7f0f814daaf6fbde", + "deployTx": "0x18b36af7959c2011e54c915974ee7ddcdadd70157ac48dfcb8a1e38b8c3e7ba4", "fullyQualifiedName": "contracts/funds/RewardsBank.sol:RewardsBank" }, "ServerNodesManager": { - "address": "0x97464F18b71cbF5f42B134CE48b47341f4B4fddf", + "address": "0xe208a39e3F988f1565628457F17E9Aa469B78F76", "abi": [ "event AdminChanged(address previousAdmin, address newAdmin)", "event BeaconUpgraded(address indexed beacon)", @@ -767,15 +767,15 @@ "function upgradeToAndCall(address newImplementation, bytes data) payable", "function validatorSet() view returns (address)" ], - "deployTx": "0x31e7049f75755014b3b37aec700d878812cfcbb1f5a3bcc54105613b526ac87d", + "deployTx": "0xa7f9c2f0b9846005bd014faf75a0e312f13f901d0d2e81a81c9d3f10f50e6a52", "fullyQualifiedName": "contracts/staking/ServerNodes_Manager.sol:ServerNodes_Manager", "proxy": { - "implementation": "0x7aE1eAFC7a9b106b392ddEE027449b09dbDE1347", + "implementation": "0x52d026B38b3382Fe1b8a28EA55895aF875191750", "fullyQualifiedName": "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" } }, "LegacyPoolManager_Multisig": { - "address": "0x00385a84F8ea4A244B2E084D81460e768fAE8ec3", + "address": "0x2C55f7d6B1c2aF6b06Fba942e01B39Ae1dd7B9D7", "abi": [ "constructor(address[] _signers, bool[] isInitiatorFlags, uint256 _threshold, address owner)", "event Confirmation(address indexed sender, uint256 indexed txId)", @@ -811,11 +811,11 @@ "function transferOwnership(address newOwner)", "function withdraw(address to, uint256 amount)" ], - "deployTx": "0x6896c763c4ef789e99d05e5582cfd5cf99cd3b5d767e9f296b0cac1c22cef36b", + "deployTx": "0x4535c4ff408cb35ac6571b21f1827904291055387d03dee9b897142225c48428", "fullyQualifiedName": "contracts/multisig/Multisig.sol:Multisig" }, "LegacyPoolManager_RewardsBank": { - "address": "0x99B1A627604dB1479379c2c576dAFdC8AE4C546E", + "address": "0xaa52FB83135FEfBB71fAcE1C2f7D654d52C08a37", "abi": [ "constructor()", "event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)", @@ -831,11 +831,11 @@ "function withdrawAmb(address addressTo, uint256 amount)", "function withdrawErc20(address tokenAddress, address addressTo, uint256 amount)" ], - "deployTx": "0xe269d2a9f2d6e13dda7213d603e908a3bb0b84590971276b502f005d61740822", + "deployTx": "0xb46d5ff335c10a9ae686bf7500c97b1f316c527057e760a84400cd1365bdeeba", "fullyQualifiedName": "contracts/funds/RewardsBank.sol:RewardsBank" }, "LegacyPoolManager": { - "address": "0x55C402b5F9C2c3DfE3d866B36598f0Fd53e03B89", + "address": "0xE4B71A6d487455d3Dc81292418b78214Ad4d4345", "abi": [ "event AdminChanged(address previousAdmin, address newAdmin)", "event BeaconUpgraded(address indexed beacon)", @@ -876,10 +876,10 @@ "function upgradeToAndCall(address newImplementation, bytes data) payable", "function validatorSet() view returns (address)" ], - "deployTx": "0x973af5c50e180b0d5391387d75f91df87b36f761700cec90994114cdacb3b3ae", + "deployTx": "0xd178130ffb89c3043a5a7bd34598eacd232fe68f99fd6c71de6bdf3ba0343537", "fullyQualifiedName": "contracts/staking/pools/LegacyPoolsNodes_Manager.sol:LegacyPoolsNodes_Manager", "proxy": { - "implementation": "0xC54007213080526139d38eAe66777dFac413772C", + "implementation": "0x5Fb2adefDC0cF350B87E6Ac31A66E3844afFcfD1", "fullyQualifiedName": "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" } } diff --git a/package.json b/package.json index f16a0816..ee5b48c0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@airdao/airdao-node-contracts", - "version": "1.1.5", + "version": "1.1.6", "main": "./dist/src/index.js", "types": "./dist/src/index.d.ts", "files": [ From 683ebdc1034568914997bad535b1429c03045f40 Mon Sep 17 00:00:00 2001 From: serezhaolshan Date: Tue, 10 Oct 2023 18:19:47 +0300 Subject: [PATCH 16/19] feat: assign admin role on migration to new staking --- hardhat.config.ts | 6 +++- package-lock.json | 12 +++---- scripts/staking/migrate_to_new_staking.ts | 43 ++++++++++++++++++++--- 3 files changed, 50 insertions(+), 11 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index 1b87b2a2..fe540907 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -33,7 +33,11 @@ const config: HardhatUserConfig = { test: { url: "https://network.ambrosus-test.io", hardfork: "byzantium", - accounts: [process.env.PRIVATEKEY_OWNER_AMB || ethers.constants.HashZero], + accounts: [ + process.env.PRIVATEKEY_OWNER_AMB || ethers.constants.HashZero, + process.env.PRIVATEKEY_TEST_MULTISIG1 || ethers.constants.HashZero, + process.env.PRIVATEKEY_TEST_MULTISIG2 || ethers.constants.HashZero, + ], }, main: { url: "https://network.ambrosus.io", diff --git a/package-lock.json b/package-lock.json index 146e97d8..ddf571e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,14 +1,14 @@ { "name": "@airdao/airdao-node-contracts", - "version": "1.0.11", + "version": "1.1.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@airdao/airdao-node-contracts", - "version": "1.0.11", + "version": "1.1.6", "dependencies": { - "@airdao/deployments": "0.2.3", + "@airdao/deployments": "0.2.4", "ethers": "^5.7.2" }, "devDependencies": { @@ -38,9 +38,9 @@ } }, "node_modules/@airdao/deployments": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@airdao/deployments/-/deployments-0.2.3.tgz", - "integrity": "sha512-UD+jcYJNRe2Irf5LBy9xl1PPuDg3LDkNQe1GgzY3w5ol9jcXDj4//Buswz8jrEHRCEam8m8+vecdRa/Ac3udMg==", + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/@airdao/deployments/-/deployments-0.2.4.tgz", + "integrity": "sha512-nrvuBBHjYjA4dfczcHNfWfPqrBTn+ZDopK2RhNEgKoFt6UDxAfVld4lzAEjMZ3PC/k1W0KC85AMaS+l7+eT4qw==", "peerDependencies": { "@nomicfoundation/hardhat-toolbox": "^2.0.1", "@openzeppelin/contracts-upgradeable": "4.9.0", diff --git a/scripts/staking/migrate_to_new_staking.ts b/scripts/staking/migrate_to_new_staking.ts index 926a2090..a1080e5b 100644 --- a/scripts/staking/migrate_to_new_staking.ts +++ b/scripts/staking/migrate_to_new_staking.ts @@ -16,15 +16,18 @@ import { StorageCatalogue__factory, ValidatorSet, } from "../../typechain-types"; -import { BigNumber } from "ethers"; +import { BigNumber, Contract, PopulatedTransaction } from "ethers"; import { loadDeployment } from "@airdao/deployments/deploying"; import { ContractNames } from "../../src"; -import { wrapProviderToError } from "../../src/utils/AmbErrorProvider"; +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +// import { wrapProviderToError } from "../../src/utils/AmbErrorProvider"; const HEAD = "0x0000000000000000000000000000000000000F10"; const VALIDATOR_SET = "0x0000000000000000000000000000000000000F00"; const validatorSetAbi = ["function getValidators() view returns (address[])"]; +const multiplexerAbi = ["function addAdmin(address _admin)", "function setPaused(bool _paused)"]; +const multisigAbi = ["function confirmTransaction(uint256 transactionId)", "function submitTransaction(address destination, uint256 value, bytes data) public returns (uint256 transactionId)"]; const feesAbi = ["function isAdmin(address) view returns (bool)", "function paused() view returns (bool)"]; async function main() { @@ -32,7 +35,7 @@ async function main() { const [deployer] = await ethers.getSigners(); - wrapProviderToError(deployer.provider!); + // wrapProviderToError(deployer.provider!); const validatorSet = loadDeployment(ContractNames.ValidatorSet, chainId, deployer) as ValidatorSet; const baseNodesManager = loadDeployment(ContractNames.BaseNodesManager, chainId, deployer) as BaseNodes_Manager; @@ -54,7 +57,11 @@ async function main() { const multisigAddress = await Head__factory.connect(multiplexerAddress, deployer).owner(); console.log("multiplexer", multiplexerAddress, ", multisig", multisigAddress); - if (!(await fees.isAdmin(deployer.address))) throw `${deployer.address} is not a admin`; + if (!(await fees.isAdmin(deployer.address))) { + console.warn(`${deployer.address} is not a admin`); + await assignAdminRole(deployer.address); + + } if (!(await fees.paused())) throw "legacy contracts doesn't paused!"; const oldStakes = await getOldStakes( @@ -244,6 +251,34 @@ async function getPoolNodesAddresses(poolsStore: PoolsStore) { return node2poll; } +async function assignAdminRole(address: string) { + const [owner, multisig1, multisig2] = await ethers.getSigners(); + const multiplexer = new ethers.Contract("Multiplexer", multiplexerAbi, multisig1); + const multisig = new ethers.Contract("MultiSigWallet", multisigAbi, multisig1); + + const pausedTxId = await submitAndExtractTxId(multiplexer, multisig, multiplexer.populateTransaction.setPaused(true)); + await confirmTransaction(multisig, multisig2, pausedTxId); + + const adminTxId = await submitAndExtractTxId(multiplexer, multisig, multiplexer.populateTransaction.addAdmin(address)); + await confirmTransaction(multisig, multisig2, adminTxId); +} + +async function submitAndExtractTxId(targetContract: Contract, multisig: Contract, populateTransactionPromise: Promise) { + const calldata = (await populateTransactionPromise).data!; + const txResponse = await multisig.submitTransaction(targetContract.address, 0, calldata); + const receipt = await txResponse.wait(); + + const submissionEvent = receipt.events?.find(e => e.event === "Submission"); + if (!submissionEvent || !submissionEvent.args) throw new Error("Submission event not found"); + const txId = submissionEvent.args[0]; + + return txId; +} + +async function confirmTransaction(multisig: Contract, signer: SignerWithAddress, txId: BigNumber) { + await multisig.connect(signer).confirmTransaction(txId); +} + function repeat(item: T, times: number): T[] { return Array(times).fill(item); } From 89a0c7a07ba02da56fe3b9c579863684a4eba943 Mon Sep 17 00:00:00 2001 From: svin Date: Tue, 10 Oct 2023 18:40:30 +0300 Subject: [PATCH 17/19] refactor --- scripts/staking/migrate_to_new_staking.ts | 37 +++++++++-------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/scripts/staking/migrate_to_new_staking.ts b/scripts/staking/migrate_to_new_staking.ts index a1080e5b..dccf3afc 100644 --- a/scripts/staking/migrate_to_new_staking.ts +++ b/scripts/staking/migrate_to_new_staking.ts @@ -19,7 +19,6 @@ import { import { BigNumber, Contract, PopulatedTransaction } from "ethers"; import { loadDeployment } from "@airdao/deployments/deploying"; import { ContractNames } from "../../src"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; // import { wrapProviderToError } from "../../src/utils/AmbErrorProvider"; const HEAD = "0x0000000000000000000000000000000000000F10"; @@ -57,12 +56,17 @@ async function main() { const multisigAddress = await Head__factory.connect(multiplexerAddress, deployer).owner(); console.log("multiplexer", multiplexerAddress, ", multisig", multisigAddress); + const multisig = new ethers.Contract(multisigAddress, multisigAbi); + const multiplexer = new ethers.Contract(multiplexerAddress, multiplexerAbi); + if (!(await fees.isAdmin(deployer.address))) { console.warn(`${deployer.address} is not a admin`); - await assignAdminRole(deployer.address); - + await submitMultisigTx(multisig, multiplexer, multiplexer.populateTransaction.addAdmin(deployer.address)); + } + if (!(await fees.paused())) { + console.warn("legacy contracts doesn't paused!"); + await submitMultisigTx(multisig, multiplexer, multiplexer.populateTransaction.setPaused(true)); } - if (!(await fees.paused())) throw "legacy contracts doesn't paused!"; const oldStakes = await getOldStakes( await storageCatalogue.apolloDepositStore(), @@ -71,7 +75,7 @@ async function main() { ); console.log("old stakes", oldStakes); - return; + // return; const { baseNodesAddresses, @@ -251,33 +255,20 @@ async function getPoolNodesAddresses(poolsStore: PoolsStore) { return node2poll; } -async function assignAdminRole(address: string) { - const [owner, multisig1, multisig2] = await ethers.getSigners(); - const multiplexer = new ethers.Contract("Multiplexer", multiplexerAbi, multisig1); - const multisig = new ethers.Contract("MultiSigWallet", multisigAbi, multisig1); - - const pausedTxId = await submitAndExtractTxId(multiplexer, multisig, multiplexer.populateTransaction.setPaused(true)); - await confirmTransaction(multisig, multisig2, pausedTxId); - const adminTxId = await submitAndExtractTxId(multiplexer, multisig, multiplexer.populateTransaction.addAdmin(address)); - await confirmTransaction(multisig, multisig2, adminTxId); -} +async function submitMultisigTx(multisig: Contract, targetContract: Contract, populateTransactionPromise: Promise) { + const [owner, multisig1, multisig2] = await ethers.getSigners(); -async function submitAndExtractTxId(targetContract: Contract, multisig: Contract, populateTransactionPromise: Promise) { const calldata = (await populateTransactionPromise).data!; - const txResponse = await multisig.submitTransaction(targetContract.address, 0, calldata); - const receipt = await txResponse.wait(); + const receipt = await (await multisig.connect(multisig1).submitTransaction(targetContract.address, 0, calldata)).wait(); - const submissionEvent = receipt.events?.find(e => e.event === "Submission"); + const submissionEvent = receipt.events?.find((e: any) => e.event === "Submission"); if (!submissionEvent || !submissionEvent.args) throw new Error("Submission event not found"); const txId = submissionEvent.args[0]; - return txId; + await (await multisig.connect(multisig2).confirmTransaction(txId)).wait(); } -async function confirmTransaction(multisig: Contract, signer: SignerWithAddress, txId: BigNumber) { - await multisig.connect(signer).confirmTransaction(txId); -} function repeat(item: T, times: number): T[] { return Array(times).fill(item); From df07dc4a00c0f16885d09739e6cf12f107fc7cd1 Mon Sep 17 00:00:00 2001 From: svin Date: Wed, 18 Oct 2023 12:25:32 +0300 Subject: [PATCH 18/19] Add `treasurySetFee` multisig method --- package.json | 2 +- src/methods/staking.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index ee5b48c0..df203a68 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@airdao/airdao-node-contracts", - "version": "1.1.6", + "version": "1.1.7", "main": "./dist/src/index.js", "types": "./dist/src/index.d.ts", "files": [ diff --git a/src/methods/staking.ts b/src/methods/staking.ts index f9b68f60..207fab6e 100644 --- a/src/methods/staking.ts +++ b/src/methods/staking.ts @@ -7,6 +7,7 @@ import { PoolsNodes_Manager, RewardsBank, ServerNodes_Manager, + Treasury, ValidatorSet, } from "../../typechain-types"; import { submitTransaction2 } from "./internal"; @@ -189,3 +190,10 @@ async function getPoolName(contracts: Contracts, poolAddress: string) { const poolContract = new ethers.Contract(poolAddress, abi, provider); return poolContract.name().catch(() => null); } + + +export async function treasurySetFee(contracts: Contracts, newFee: BigNumberish) { + return await submitTransaction2( + contracts, ContractNames.Treasury, 0, (treasury) => treasury.setFee(newFee) + ); +} From d394b05b45df02b53c86659778e83018c0a0bfc8 Mon Sep 17 00:00:00 2001 From: svin Date: Mon, 23 Oct 2023 16:38:55 +0300 Subject: [PATCH 19/19] Prepare for prod --- scripts/addresses.ts | 15 ++++++++++++-- scripts/staking/deploy_basenodes_manager.ts | 3 ++- scripts/staking/deploy_legacy_pool_manager.ts | 14 +++++-------- scripts/staking/deploy_servernodes_manager.ts | 10 +++++----- scripts/staking/deploy_treasury.ts | 3 ++- scripts/staking/deploy_validatorset.ts | 20 ++++++++++--------- scripts/staking/migrate_to_new_staking.ts | 8 +++++--- 7 files changed, 43 insertions(+), 30 deletions(-) diff --git a/scripts/addresses.ts b/scripts/addresses.ts index be00f10f..600935c8 100644 --- a/scripts/addresses.ts +++ b/scripts/addresses.ts @@ -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"; @@ -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 diff --git a/scripts/staking/deploy_basenodes_manager.ts b/scripts/staking/deploy_basenodes_manager.ts index 8b65dafa..747ed3d2 100644 --- a/scripts/staking/deploy_basenodes_manager.ts +++ b/scripts/staking/deploy_basenodes_manager.ts @@ -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(); @@ -20,7 +21,7 @@ export async function main() { const multisig = await deploy({ contractName: ContractNames.BaseNodesManagerMultisig, artifactName: "Multisig", - deployArgs: [[deployer.address], [true], 75, masterMultisig], + deployArgs: [...Roadmap2023MultisigSettings, masterMultisig], signer: deployer, loadIfAlreadyDeployed: true, }); diff --git a/scripts/staking/deploy_legacy_pool_manager.ts b/scripts/staking/deploy_legacy_pool_manager.ts index b16c4541..f34544c4 100644 --- a/scripts/staking/deploy_legacy_pool_manager.ts +++ b/scripts/staking/deploy_legacy_pool_manager.ts @@ -1,6 +1,5 @@ -import { ethers } from "hardhat"; +import {ethers} from "hardhat"; import { - Catalogue__factory, Context__factory, Head, LegacyPoolsNodes_Manager__factory, @@ -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(); @@ -28,7 +26,7 @@ async function main() { const multisig = await deploy({ contractName: ContractNames.LegacyPoolManagerMultisig, artifactName: "Multisig", - deployArgs: [[deployer.address], [true], 75, masterMultisig], + deployArgs: [...Roadmap2023MultisigSettings, masterMultisig], signer: deployer, loadIfAlreadyDeployed: true, }); @@ -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) { diff --git a/scripts/staking/deploy_servernodes_manager.ts b/scripts/staking/deploy_servernodes_manager.ts index 222bb034..c7178557 100644 --- a/scripts/staking/deploy_servernodes_manager.ts +++ b/scripts/staking/deploy_servernodes_manager.ts @@ -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(); @@ -22,7 +23,7 @@ export async function main() { const multisig = await deploy({ contractName: ContractNames.ServerNodesManagerMultisig, artifactName: "Multisig", - deployArgs: [[deployer.address], [true], 75, masterMultisig], + deployArgs: [...Roadmap2023MultisigSettings, masterMultisig], signer: deployer, loadIfAlreadyDeployed: true, }); @@ -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({ contractName: ContractNames.ServerNodesManager, diff --git a/scripts/staking/deploy_treasury.ts b/scripts/staking/deploy_treasury.ts index 6e173949..db186cf4 100644 --- a/scripts/staking/deploy_treasury.ts +++ b/scripts/staking/deploy_treasury.ts @@ -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(); @@ -13,7 +14,7 @@ async function main() { const multisig = await deploy({ contractName: ContractNames.TreasuryMultisig, artifactName: "Multisig", - deployArgs: [[deployer.address], [true], 75, masterMultisig], + deployArgs: [...Roadmap2023MultisigSettings, masterMultisig], signer: deployer, loadIfAlreadyDeployed: true, }); diff --git a/scripts/staking/deploy_validatorset.ts b/scripts/staking/deploy_validatorset.ts index 92422f7c..c3cba667 100644 --- a/scripts/staking/deploy_validatorset.ts +++ b/scripts/staking/deploy_validatorset.ts @@ -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(); @@ -12,29 +13,30 @@ export async function main() { const multisig = await deploy({ 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({ 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) { diff --git a/scripts/staking/migrate_to_new_staking.ts b/scripts/staking/migrate_to_new_staking.ts index dccf3afc..bcab0abe 100644 --- a/scripts/staking/migrate_to_new_staking.ts +++ b/scripts/staking/migrate_to_new_staking.ts @@ -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)); } @@ -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) {