@gooddollar/goodprotocol 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/abis/AdminWalletFuse.min.json +1 -1
- package/artifacts/abis/Faucet.min.json +1 -1
- package/artifacts/abis/FuseFaucetV2.min.json +1 -1
- package/artifacts/abis/GoodDollarMintBurnWrapper.min.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/Avatar.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/Controller.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/GlobalConstraintInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/IntVoteInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/ReputationInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/SchemeRegistrar.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/AggregatorV3Interface.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ERC20.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IAaveIncentivesController.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IAdminWallet.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IDonationStaking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IERC2917.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IFirstClaimPool.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IGoodDollar.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IGoodStaking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IHasRouter.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IIdentity.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IIdentityV2.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ILendingPool.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IMultichainRouter.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/INameService.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IUBIScheme.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ProxyAdmin.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Reserve.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Uniswap.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/UniswapFactory.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/UniswapPair.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/cERC20.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.json +43 -17
- package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/FuseFaucetV2.sol/FuseFaucetV2.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/FuseFaucetV2.sol/FuseFaucetV2.json +55 -17
- package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
- package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
- package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/IGovernanceStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/IStakingUpgrade.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.dbg.json +1 -1
- package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/MultiBaseGovernanceShareField.sol/MultiBaseGovernanceShareField.dbg.json +1 -1
- package/artifacts/contracts/governance/Reputation.sol/Reputation.dbg.json +1 -1
- package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
- package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.dbg.json +1 -1
- package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.json +2 -2
- package/artifacts/contracts/invite/InvitesFuseV2.sol/InvitesFuseV2.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.dbg.json +1 -1
- package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +1 -1
- package/artifacts/contracts/mocks/FeesFormularMock.sol/FeesFormulaMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/IdentityMock.sol/IdentityMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/IWrapper.dbg.json +1 -1
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
- package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.dbg.json +1 -1
- package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.dbg.json +1 -1
- package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
- package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/ContributionCalc.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.dbg.json +1 -1
- package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
- package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.dbg.json +1 -1
- package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.dbg.json +1 -1
- package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.json +2 -2
- package/artifacts/contracts/staking/FuseStakingV3.sol/IConsensus.dbg.json +1 -1
- package/artifacts/contracts/staking/FuseStakingV3.sol/PegSwap.dbg.json +1 -1
- package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.dbg.json +1 -1
- package/artifacts/contracts/staking/SimpleStaking.sol/SimpleStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/SimpleStakingV2.sol/SimpleStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/utils/Math64X64.sol/Math64x64.dbg.json +1 -1
- package/artifacts/contracts/staking/utils/StakingRewardsFixedAPY.sol/StakingRewardsFixedAPY.dbg.json +1 -1
- package/artifacts/contracts/token/ERC20PresetMinterPauserUpgradeable.sol/ERC20PresetMinterPauserUpgradeable.dbg.json +1 -1
- package/artifacts/contracts/token/ERC677.sol/ERC677.dbg.json +1 -1
- package/artifacts/contracts/token/ERC677.sol/ERC677Receiver.dbg.json +1 -1
- package/artifacts/contracts/token/FeesFormula.sol/IFeesFormula.dbg.json +1 -1
- package/artifacts/contracts/token/GoodDollar.sol/GoodDollar.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ERC20Permit.sol/ERC20Permit.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ERC20Permit.sol/SelfApprove.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/IGoodDollarCustom.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/ISuperGoodDollar.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/SuperToken.sol/SuperToken.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/SuperfluidToken.sol/SuperfluidToken.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/UUPSProxiable.sol/UUPSProxiable.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.json +2 -2
- package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
- package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.json +28 -2
- package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
- package/artifacts/contracts/utils/BulkProof.sol/BulkProof.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyAndBridgeHelper.sol/BuyAndBridgeHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
- package/artifacts/contracts/utils/DSMath.sol/DSMath.dbg.json +1 -1
- package/artifacts/contracts/utils/DataTypes.sol/DataTypes.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.json +2 -9
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/IRouter.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/PausableControl.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.json +2 -2
- package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgrade.sol/OldMarketMaker.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.dbg.json +1 -1
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.dbg.json +1 -1
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.dbg.json +1 -1
- package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
- package/contracts/fuseFaucet/Faucet.sol +19 -10
- package/contracts/fuseFaucet/FuseFaucetV2.sol +36 -13
- package/contracts/identity/IdentityV2.sol +9 -4
- package/contracts/ubi/UBIScheme.sol +1 -1
- package/contracts/utils/AdminWalletFuse.sol +8 -0
- package/contracts/utils/GoodDollarMintBurnWrapper.sol +1 -19
- package/hardhat.config.ts +17 -42
- package/package.json +1 -1
- package/releases/deploy-settings.json +3 -3
- package/releases/deployment.json +11 -3
- package/scripts/multichain-deploy/2_helpers-deploy.ts +64 -68
- package/scripts/multichain-deploy/4_ubi-deploy.ts +19 -35
- package/scripts/multichain-deploy/helpers.ts +2 -2
- package/scripts/multichain-deploy/multichainWrapper-deploy.ts +7 -4
- package/scripts/upgradeToV3/v3-fuse-multichain.ts +117 -0
- package/scripts/upgrades/celo-defi-ubi-deploy.ts +15 -2
- package/scripts/upgrades/identity-upgrade.ts +28 -11
- package/test/faucet/Faucet.test.ts +4 -3
- package/test/faucet/FuseFaucet.test.ts +5 -4
- package/test/ubi/UBISchemeCycle.test.ts +20 -58
- package/test/utils/GoodDollarMintBurnWrapper.test.ts +66 -224
- package/types/AdminWalletFuse.ts +38 -0
- package/types/Faucet.ts +61 -32
- package/types/FuseFaucetV2.ts +101 -34
- package/types/GoodDollarMintBurnWrapper.ts +0 -27
- package/types/factories/AdminWalletFuse__factory.ts +27 -1
- package/types/factories/Faucet__factory.ts +42 -16
- package/types/factories/FuseFaucetV2__factory.ts +54 -16
- package/types/factories/FuseStakingV3__factory.ts +1 -1
- package/types/factories/GoodDollarMintBurnWrapper__factory.ts +1 -8
- package/types/factories/IdentityV2__factory.ts +1 -1
- package/types/factories/UBIScheme__factory.ts +1 -1
- package/scripts/multichain-deploy/v3-fix.ts +0 -120
- package/scripts/multichain-deploy/v3-upgrade.ts +0 -219
|
@@ -5,24 +5,23 @@
|
|
|
5
5
|
import { network, ethers, upgrades, run } from "hardhat";
|
|
6
6
|
import { Contract } from "ethers";
|
|
7
7
|
import { defaultsDeep } from "lodash";
|
|
8
|
+
import { getImplementationAddress } from "@openzeppelin/upgrades-core";
|
|
8
9
|
import {
|
|
9
10
|
deployDeterministic,
|
|
10
11
|
executeViaGuardian,
|
|
11
12
|
executeViaSafe,
|
|
13
|
+
verifyContract,
|
|
12
14
|
verifyProductionSigner
|
|
13
15
|
} from "./helpers";
|
|
14
16
|
import releaser from "../releaser";
|
|
15
17
|
import ProtocolSettings from "../../releases/deploy-settings.json";
|
|
16
18
|
import dao from "../../releases/deployment.json";
|
|
17
19
|
import { TransactionResponse } from "@ethersproject/providers";
|
|
18
|
-
import { InvitesV1__factory } from "../../types";
|
|
19
20
|
import { keccak256, toUtf8Bytes } from "ethers/lib/utils";
|
|
20
21
|
|
|
21
22
|
const { name } = network;
|
|
22
23
|
|
|
23
|
-
const printDeploy = async (
|
|
24
|
-
c: Contract | TransactionResponse
|
|
25
|
-
): Promise<Contract | TransactionResponse> => {
|
|
24
|
+
const printDeploy = async (c: Contract | TransactionResponse): Promise<Contract | TransactionResponse> => {
|
|
26
25
|
if (c instanceof Contract) {
|
|
27
26
|
await c.deployed();
|
|
28
27
|
console.log("deployed to: ", c.address);
|
|
@@ -35,16 +34,14 @@ const printDeploy = async (
|
|
|
35
34
|
};
|
|
36
35
|
|
|
37
36
|
export const deployHelpers = async () => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
ProtocolSettings["default"]
|
|
42
|
-
);
|
|
37
|
+
const viaGuardians = false;
|
|
38
|
+
|
|
39
|
+
let protocolSettings = defaultsDeep({}, ProtocolSettings[network.name], ProtocolSettings["default"]);
|
|
43
40
|
let release: { [key: string]: any } = dao[network.name];
|
|
44
41
|
|
|
45
42
|
let [root, ...signers] = await ethers.getSigners();
|
|
46
43
|
const isProduction = network.name.includes("production");
|
|
47
|
-
|
|
44
|
+
|
|
48
45
|
if (isProduction) verifyProductionSigner(root);
|
|
49
46
|
//generic call permissions
|
|
50
47
|
let schemeMock = root;
|
|
@@ -53,9 +50,7 @@ export const deployHelpers = async () => {
|
|
|
53
50
|
network,
|
|
54
51
|
root: root.address,
|
|
55
52
|
schemeMock: schemeMock.address,
|
|
56
|
-
balance: await ethers.provider
|
|
57
|
-
.getBalance(root.address)
|
|
58
|
-
.then(_ => _.toString())
|
|
53
|
+
balance: await ethers.provider.getBalance(root.address).then(_ => _.toString())
|
|
59
54
|
});
|
|
60
55
|
|
|
61
56
|
console.log("deploying ubi pool");
|
|
@@ -64,19 +59,14 @@ export const deployHelpers = async () => {
|
|
|
64
59
|
name: "UBIScheme",
|
|
65
60
|
isUpgradeable: true
|
|
66
61
|
},
|
|
67
|
-
[
|
|
68
|
-
release.NameService,
|
|
69
|
-
ethers.constants.AddressZero,
|
|
70
|
-
protocolSettings.ubi.maxInactiveDays
|
|
71
|
-
]
|
|
62
|
+
[release.NameService, ethers.constants.AddressZero, protocolSettings.ubi.maxInactiveDays]
|
|
72
63
|
).then(printDeploy)) as Contract;
|
|
73
64
|
|
|
74
65
|
console.log("deploying claimers distribution");
|
|
75
66
|
|
|
76
|
-
const ClaimersDistribution = (await deployDeterministic(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
).then(printDeploy)) as Contract;
|
|
67
|
+
const ClaimersDistribution = (await deployDeterministic({ name: "ClaimersDistribution", isUpgradeable: true }, [
|
|
68
|
+
release.NameService
|
|
69
|
+
]).then(printDeploy)) as Contract;
|
|
80
70
|
|
|
81
71
|
console.log("setting nameservice addresses via guardian");
|
|
82
72
|
const proposalContracts = [
|
|
@@ -93,10 +83,7 @@ export const deployHelpers = async () => {
|
|
|
93
83
|
ethers.utils.defaultAbiCoder.encode(
|
|
94
84
|
["bytes32[]", "address[]"],
|
|
95
85
|
[
|
|
96
|
-
[
|
|
97
|
-
keccak256(toUtf8Bytes("UBISCHEME")),
|
|
98
|
-
keccak256(toUtf8Bytes("GDAO_CLAIMERS"))
|
|
99
|
-
],
|
|
86
|
+
[keccak256(toUtf8Bytes("UBISCHEME")), keccak256(toUtf8Bytes("GDAO_CLAIMERS"))],
|
|
100
87
|
[UBIScheme.address, ClaimersDistribution.address]
|
|
101
88
|
]
|
|
102
89
|
)
|
|
@@ -106,17 +93,14 @@ export const deployHelpers = async () => {
|
|
|
106
93
|
console.log("minting G$s to pool on dev envs");
|
|
107
94
|
const gd = await ethers.getContractAt("IGoodDollar", release.GoodDollar);
|
|
108
95
|
const decimals = await gd.decimals();
|
|
109
|
-
await gd.mint(
|
|
110
|
-
UBIScheme.address,
|
|
111
|
-
ethers.BigNumber.from(1e6).mul(ethers.BigNumber.from("10").pow(decimals))
|
|
112
|
-
); //1million GD
|
|
96
|
+
await gd.mint(UBIScheme.address, ethers.BigNumber.from(1e6).mul(ethers.BigNumber.from("10").pow(decimals))); //1million GD
|
|
113
97
|
}
|
|
114
98
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
await
|
|
99
|
+
let impl = await getImplementationAddress(ethers.provider, UBIScheme.address);
|
|
100
|
+
await verifyContract(impl, "UBIScheme", network.name);
|
|
101
|
+
|
|
102
|
+
impl = await getImplementationAddress(ethers.provider, ClaimersDistribution.address);
|
|
103
|
+
await verifyContract(impl, "ClaimersDistribution", network.name);
|
|
120
104
|
|
|
121
105
|
try {
|
|
122
106
|
if (viaGuardians) {
|
|
@@ -207,7 +207,7 @@ export const executeViaSafe = async (
|
|
|
207
207
|
txServiceUrl = "https://safe-transaction-mainnet.safe.global";
|
|
208
208
|
break;
|
|
209
209
|
case 122:
|
|
210
|
-
txServiceUrl = "https://
|
|
210
|
+
txServiceUrl = "https://transaction-fuse.safe.fuse.io";
|
|
211
211
|
break;
|
|
212
212
|
case 42220:
|
|
213
213
|
txServiceUrl = "https://mainnet-tx-svc.celo-safe-prod.celo-networks-dev.org";
|
|
@@ -236,8 +236,8 @@ export const executeViaSafe = async (
|
|
|
236
236
|
const contract = contracts[i];
|
|
237
237
|
|
|
238
238
|
const sigHash = ethers.utils.keccak256(ethers.utils.toUtf8Bytes(functionSigs[i])).slice(0, 10);
|
|
239
|
+
console.log("creating tx:", contracts[i], functionSigs[i], functionInputs[i]);
|
|
239
240
|
const encoded = ethers.utils.solidityPack(["bytes4", "bytes"], [sigHash, functionInputs[i]]);
|
|
240
|
-
console.log("creating tx:", contracts[i], functionSigs[i], functionInputs[i], encoded);
|
|
241
241
|
if (contract === ctrl.address) {
|
|
242
242
|
const simulationResult =
|
|
243
243
|
isSimulation === false &&
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { network, ethers, upgrades, run } from "hardhat";
|
|
2
2
|
import { Contract } from "ethers";
|
|
3
|
+
import { getImplementationAddress } from "@openzeppelin/upgrades-core";
|
|
3
4
|
|
|
4
|
-
import { deployDeterministic, printDeploy } from "./helpers";
|
|
5
|
+
import { deployDeterministic, printDeploy, verifyContract } from "./helpers";
|
|
5
6
|
import releaser from "../../scripts/releaser";
|
|
6
7
|
import ProtocolSettings from "../../releases/deploy-settings.json";
|
|
7
8
|
import dao from "../../releases/deployment.json";
|
|
@@ -20,9 +21,7 @@ export const deployWrapper = async (defaultAdmin = null) => {
|
|
|
20
21
|
network,
|
|
21
22
|
root: root.address,
|
|
22
23
|
schemeMock: schemeMock.address,
|
|
23
|
-
balance: await ethers.provider
|
|
24
|
-
.getBalance(root.address)
|
|
25
|
-
.then(_ => _.toString())
|
|
24
|
+
balance: await ethers.provider.getBalance(root.address).then(_ => _.toString())
|
|
26
25
|
});
|
|
27
26
|
|
|
28
27
|
console.log("MintBurnWrapper deploy params:", [
|
|
@@ -44,6 +43,10 @@ export const deployWrapper = async (defaultAdmin = null) => {
|
|
|
44
43
|
GoodDollarMintBurnWrapper: Wrapper.address
|
|
45
44
|
};
|
|
46
45
|
await releaser(release, network.name, "deployment", false);
|
|
46
|
+
|
|
47
|
+
const impl = await getImplementationAddress(ethers.provider, Wrapper.address);
|
|
48
|
+
await verifyContract(impl, "GoodDollarMintBurnWrapper", network.name);
|
|
49
|
+
|
|
47
50
|
return Wrapper;
|
|
48
51
|
};
|
|
49
52
|
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/***
|
|
2
|
+
* This script will deploy a reserve upgrade and the DistributionHelper so that some of the expansion can be allocated
|
|
3
|
+
* for non-ubi purposes
|
|
4
|
+
* Upgrade process:
|
|
5
|
+
* mainnet:
|
|
6
|
+
* - deploy reserve
|
|
7
|
+
* - deploy distributionHelper
|
|
8
|
+
* - create proposal that:
|
|
9
|
+
* - upgrades the reserve
|
|
10
|
+
* - sets the distributionHelper at reserve with the agreed bps
|
|
11
|
+
* - add to the distributionHelper the contracts addresses to receive part of the UBI
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { network, ethers } from "hardhat";
|
|
15
|
+
import { defaultsDeep } from "lodash";
|
|
16
|
+
import {
|
|
17
|
+
deployDeterministic,
|
|
18
|
+
printDeploy,
|
|
19
|
+
executeViaGuardian,
|
|
20
|
+
executeViaSafe,
|
|
21
|
+
verifyProductionSigner
|
|
22
|
+
} from "../multichain-deploy/helpers";
|
|
23
|
+
import { deployWrapper } from "../multichain-deploy/multichainWrapper-deploy";
|
|
24
|
+
|
|
25
|
+
import releaser from "../releaser";
|
|
26
|
+
import ProtocolSettings from "../../releases/deploy-settings.json";
|
|
27
|
+
import dao from "../../releases/deployment.json";
|
|
28
|
+
import { BigNumber } from "ethers";
|
|
29
|
+
const { name: networkName } = network;
|
|
30
|
+
|
|
31
|
+
export const deployFuse = async () => {
|
|
32
|
+
const isProduction = networkName.includes("production");
|
|
33
|
+
let [root, ...signers] = await ethers.getSigners();
|
|
34
|
+
|
|
35
|
+
if (isProduction) verifyProductionSigner(root);
|
|
36
|
+
|
|
37
|
+
let executionMethod = "safe";
|
|
38
|
+
|
|
39
|
+
const networkKey = networkName === "localhost" ? "production-mainnet" : networkName;
|
|
40
|
+
let release: { [key: string]: any } = dao[networkKey];
|
|
41
|
+
let settings = defaultsDeep({}, ProtocolSettings[networkName], ProtocolSettings["default"]);
|
|
42
|
+
|
|
43
|
+
console.log("got signers:", {
|
|
44
|
+
networkName,
|
|
45
|
+
networkKey,
|
|
46
|
+
root: root.address,
|
|
47
|
+
balance: await ethers.provider.getBalance(root.address).then(_ => _.toString())
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const Wrapper = await deployWrapper();
|
|
51
|
+
// const Wrapper = await ethers.getContractAt("GoodDollarMintBurnWrapper", release.GoodDollarMintBurnWrapper);
|
|
52
|
+
|
|
53
|
+
const proposalContracts = [
|
|
54
|
+
release.NameService, //nameservice add Wrapper,MultiChainRouter
|
|
55
|
+
release.GoodDollar, // give mint rights to Wrapper
|
|
56
|
+
Wrapper.address //add multichainrouter as minter
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
const proposalEthValues = proposalContracts.map(_ => 0);
|
|
60
|
+
|
|
61
|
+
const proposalFunctionSignatures = [
|
|
62
|
+
"setAddresses(bytes32[],address[])",
|
|
63
|
+
"addMinter(address)",
|
|
64
|
+
"addMinter(address,uint256,uint256,uint32,uint256,uint256,uint32,bool)"
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
const proposalFunctionInputs = [
|
|
68
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
69
|
+
["bytes32[]", "address[]"],
|
|
70
|
+
[
|
|
71
|
+
[
|
|
72
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("MINTBURN_WRAPPER")),
|
|
73
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("MULTICHAIN_ROUTER"))
|
|
74
|
+
],
|
|
75
|
+
[Wrapper.address, release.MultichainRouter]
|
|
76
|
+
]
|
|
77
|
+
), //setAddresses(bytes32[],address[])"
|
|
78
|
+
ethers.utils.defaultAbiCoder.encode(["address"], [Wrapper.address]), //addMinter(address)
|
|
79
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
80
|
+
["address", "uint256", "uint256", "uint32", "uint256", "uint256", "uint32", "bool"],
|
|
81
|
+
[
|
|
82
|
+
release.MultichainRouter,
|
|
83
|
+
0,
|
|
84
|
+
0,
|
|
85
|
+
0,
|
|
86
|
+
0,
|
|
87
|
+
300 * 1e6 * 100, //300M G$ 2 decimals
|
|
88
|
+
1000, //10%
|
|
89
|
+
false
|
|
90
|
+
]
|
|
91
|
+
) //addMinter(address,uint256,uint256,uint32,uint256,uint256,uint32,bool)
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
if (executionMethod === "safe") {
|
|
95
|
+
return executeViaSafe(
|
|
96
|
+
proposalContracts,
|
|
97
|
+
proposalEthValues,
|
|
98
|
+
proposalFunctionSignatures,
|
|
99
|
+
proposalFunctionInputs,
|
|
100
|
+
networkName === "localhost" ? "0xE0c5daa7CC6F88d29505f702a53bb5E67600e7Ec" : release.GuardiansSafe,
|
|
101
|
+
"fuse"
|
|
102
|
+
);
|
|
103
|
+
} else {
|
|
104
|
+
return executeViaGuardian(
|
|
105
|
+
proposalContracts,
|
|
106
|
+
proposalEthValues,
|
|
107
|
+
proposalFunctionSignatures,
|
|
108
|
+
proposalFunctionInputs,
|
|
109
|
+
root
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export const main = async () => {
|
|
115
|
+
await deployFuse().catch(console.log);
|
|
116
|
+
};
|
|
117
|
+
if (process.argv[1].includes("v3-fuse-multichain")) main();
|
|
@@ -3,10 +3,15 @@
|
|
|
3
3
|
* - upgrade Identity on Fuse to support whitelisting with chainid
|
|
4
4
|
*
|
|
5
5
|
* Step 2:
|
|
6
|
+
* - deploy 2_helpers on Celo
|
|
7
|
+
* - add 1000 celo to adminwallet and faucet
|
|
8
|
+
* - monitor adminwallet + faucet on defender
|
|
9
|
+
*
|
|
10
|
+
* Step 3: (once guardians sign Identity upgrade)
|
|
6
11
|
* - upgrade AdminWallet+Invites+Faucet on Fuse to support whitelisting chainid
|
|
7
12
|
* - upgrade backend server to support whitelisting with chainid
|
|
8
13
|
*
|
|
9
|
-
* Step
|
|
14
|
+
* Step 4:
|
|
10
15
|
* 0. deploy 3_gdStaking, deploy 4_ubi
|
|
11
16
|
* 1. guardians vote send X% to celo ubi pool
|
|
12
17
|
* 2. guardians vote on celo set new GOOD distribution for gdstaking + claiming ubi
|
|
@@ -29,6 +34,7 @@ import ProtocolSettings from "../../releases/deploy-settings.json";
|
|
|
29
34
|
import dao from "../../releases/deployment.json";
|
|
30
35
|
import { upgrade as identityUpgrade } from "./identity-upgrade";
|
|
31
36
|
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
|
37
|
+
import { deployHelpers } from "../multichain-deploy/2_helpers-deploy";
|
|
32
38
|
|
|
33
39
|
const { name: networkName } = network;
|
|
34
40
|
const isProduction = networkName.includes("production");
|
|
@@ -40,6 +46,10 @@ const step1 = async () => {
|
|
|
40
46
|
};
|
|
41
47
|
|
|
42
48
|
const step2 = async () => {
|
|
49
|
+
await deployHelpers();
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const step3 = async () => {
|
|
43
53
|
let release: { [key: string]: any } = dao[networkName];
|
|
44
54
|
let [root] = await ethers.getSigners();
|
|
45
55
|
|
|
@@ -67,7 +77,7 @@ const step2 = async () => {
|
|
|
67
77
|
console.log("upgrade backend contracts abi + call whitelist with chainid....");
|
|
68
78
|
};
|
|
69
79
|
|
|
70
|
-
const
|
|
80
|
+
const step4 = async () => {
|
|
71
81
|
// let [root, ...signers] = await ethers.getSigners();
|
|
72
82
|
|
|
73
83
|
const isSafeSimulation = process.env.SAFE_SIMULATION === "true";
|
|
@@ -160,6 +170,9 @@ const main = async () => {
|
|
|
160
170
|
case "3":
|
|
161
171
|
await step3();
|
|
162
172
|
break;
|
|
173
|
+
case "4":
|
|
174
|
+
await step4();
|
|
175
|
+
break;
|
|
163
176
|
}
|
|
164
177
|
};
|
|
165
178
|
main().catch(e => console.error(e));
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Upgrade Plan:
|
|
4
4
|
* - deploy Identity
|
|
5
5
|
* - give adminWallet admin permissions
|
|
6
|
+
* - give new identy admin permissions in old identity
|
|
6
7
|
* - revoke deployer permissions
|
|
7
8
|
* - replace pointers to old identity contract in:
|
|
8
9
|
* - GoodDollar token
|
|
@@ -10,9 +11,10 @@
|
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
13
|
import { network, ethers } from "hardhat";
|
|
13
|
-
import { Contract
|
|
14
|
+
import { Contract } from "ethers";
|
|
14
15
|
import { defaultsDeep } from "lodash";
|
|
15
16
|
import { getImplementationAddress } from "@openzeppelin/upgrades-core";
|
|
17
|
+
import OldIdentityABI from "@gooddollar/goodcontracts/build/contracts/Identity.min.json";
|
|
16
18
|
|
|
17
19
|
import {
|
|
18
20
|
deployDeterministic,
|
|
@@ -41,56 +43,71 @@ export const upgrade = async () => {
|
|
|
41
43
|
console.log("got signers:", {
|
|
42
44
|
networkName,
|
|
43
45
|
root: root.address,
|
|
44
|
-
balance: await ethers.provider.getBalance(root.address).then(_ => _.toString())
|
|
46
|
+
balance: await ethers.provider.getBalance(root.address).then(_ => _.toString()),
|
|
47
|
+
Identity: release.Identity
|
|
45
48
|
});
|
|
46
49
|
|
|
50
|
+
let OldIdentity = await ethers.getContractAt(OldIdentityABI.abi, release.IdentityOld || release.Identity);
|
|
47
51
|
// let Identity = await ethers.getContractAt("IdentityV2", release.Identity);
|
|
48
52
|
// Identity = await ethers.getContractAt("IdentityV2", "0xb0cD4828Cc90C5BC28f4920Adf2Fd8F025003D7E");
|
|
49
|
-
console.log("deploying new identity...");
|
|
53
|
+
console.log("deploying new identity...", { old: OldIdentity.address });
|
|
50
54
|
let Identity = (await deployDeterministic(
|
|
51
55
|
{
|
|
52
56
|
name: "IdentityV2",
|
|
53
57
|
salt: "IdentityV2",
|
|
54
58
|
isUpgradeable: true
|
|
55
59
|
},
|
|
56
|
-
[root.address,
|
|
60
|
+
[root.address, OldIdentity.address]
|
|
57
61
|
).then(printDeploy)) as Contract;
|
|
58
62
|
|
|
59
63
|
let torelease = {
|
|
60
64
|
Identity: Identity.address,
|
|
61
|
-
IdentityOld:
|
|
65
|
+
IdentityOld: OldIdentity.address
|
|
62
66
|
};
|
|
63
67
|
|
|
64
68
|
await releaser(torelease, networkName, "deployment", false);
|
|
65
69
|
|
|
66
70
|
console.log("calling initDAO...");
|
|
67
|
-
const tx = await
|
|
71
|
+
const tx = await Identity.initDAO(release.NameService).then(printDeploy);
|
|
72
|
+
await Identity.grantRole(
|
|
73
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("identity_admin")),
|
|
74
|
+
release.AdminWallet
|
|
75
|
+
).then(printDeploy);
|
|
76
|
+
|
|
77
|
+
//done via Avatar in proposal
|
|
78
|
+
// await OldIdentity.addIdentityAdmin(Identity.address).then(printDeploy);
|
|
79
|
+
|
|
68
80
|
const impl = await getImplementationAddress(ethers.provider, Identity.address);
|
|
69
81
|
await verifyContract(impl, "IdentityV2", networkName);
|
|
70
82
|
|
|
71
83
|
const proposalContracts = [
|
|
72
84
|
release.GoodDollar, //controller -> set new identity in G$
|
|
73
|
-
release.NameService //nameservice modify to new Identity
|
|
85
|
+
release.NameService, //nameservice modify to new Identity
|
|
86
|
+
OldIdentity.address // add new Identity as admin in old identity
|
|
74
87
|
];
|
|
75
88
|
|
|
76
89
|
const proposalEthValues = proposalContracts.map(_ => 0);
|
|
77
90
|
|
|
78
91
|
const proposalFunctionSignatures = [
|
|
79
92
|
"setIdentity(address)", //set Identity on GoodDollar token
|
|
80
|
-
"setAddress(string,address)" //set new identity address in nameservice
|
|
93
|
+
"setAddress(string,address)", //set new identity address in nameservice
|
|
94
|
+
"addIdentityAdmin(address)"
|
|
81
95
|
];
|
|
82
96
|
|
|
83
97
|
const proposalFunctionInputs = [
|
|
84
98
|
ethers.utils.defaultAbiCoder.encode(["address"], [Identity.address]),
|
|
85
|
-
ethers.utils.defaultAbiCoder.encode(["string", "address"], ["IDENTITY", Identity.address])
|
|
99
|
+
ethers.utils.defaultAbiCoder.encode(["string", "address"], ["IDENTITY", Identity.address]),
|
|
100
|
+
ethers.utils.defaultAbiCoder.encode(["address"], [Identity.address])
|
|
86
101
|
];
|
|
102
|
+
|
|
87
103
|
if (isProduction) {
|
|
88
104
|
await executeViaSafe(
|
|
89
105
|
proposalContracts,
|
|
90
106
|
proposalEthValues,
|
|
91
107
|
proposalFunctionSignatures,
|
|
92
|
-
|
|
93
|
-
protocolSettings.guardiansSafe
|
|
108
|
+
proposalFunctionInputs,
|
|
109
|
+
protocolSettings.guardiansSafe,
|
|
110
|
+
"fuse"
|
|
94
111
|
);
|
|
95
112
|
} else {
|
|
96
113
|
await executeViaGuardian(
|
|
@@ -67,7 +67,7 @@ describe("Faucet", () => {
|
|
|
67
67
|
expect(await faucet.canTop(user1.address)).to.true;
|
|
68
68
|
const tx = await (await faucet.connect(signers[0]).topWallet(user1.address)).wait();
|
|
69
69
|
const balance = await ethers.provider.getBalance(user1.address);
|
|
70
|
-
expect(balance).to.equal(await faucet.
|
|
70
|
+
expect(balance).to.equal(await faucet.getToppingAmount());
|
|
71
71
|
});
|
|
72
72
|
|
|
73
73
|
it("should not let new user top more than once", async () => {
|
|
@@ -98,7 +98,7 @@ describe("Faucet", () => {
|
|
|
98
98
|
const tx = await (await faucet.topWallet(user1.address)).wait();
|
|
99
99
|
console.log(tx.gasUsed.toString());
|
|
100
100
|
const balance = await ethers.provider.getBalance(user1.address);
|
|
101
|
-
expect(balance).to.equal(await faucet.
|
|
101
|
+
expect(balance).to.equal(await faucet.getToppingAmount());
|
|
102
102
|
});
|
|
103
103
|
|
|
104
104
|
it("should not let identified user top over daily limit", async () => {
|
|
@@ -123,12 +123,13 @@ describe("Faucet", () => {
|
|
|
123
123
|
// });
|
|
124
124
|
|
|
125
125
|
it("should not let user top over weekly limit", async () => {
|
|
126
|
+
const toppingAmount = await faucet.getToppingAmount();
|
|
126
127
|
for (let i = 0; i < 5; i++) {
|
|
127
128
|
await ethers.provider.send("evm_increaseTime", [60 * 60 * 24]);
|
|
128
129
|
await (await faucet.topWallet(user1.address)).wait();
|
|
129
130
|
await user1.sendTransaction({
|
|
130
131
|
to: ethers.constants.AddressZero,
|
|
131
|
-
value:
|
|
132
|
+
value: toppingAmount.mul(80).div(100)
|
|
132
133
|
});
|
|
133
134
|
}
|
|
134
135
|
await ethers.provider.send("evm_increaseTime", [60 * 60 * 24]);
|
|
@@ -13,17 +13,18 @@ describe("FuseFaucet", () => {
|
|
|
13
13
|
let user2 = ethers.Wallet.createRandom().connect(ethers.provider);
|
|
14
14
|
let signers;
|
|
15
15
|
|
|
16
|
-
let avatar, gd: IGoodDollar, Controller, id: IIdentity;
|
|
16
|
+
let avatar, gd: IGoodDollar, Controller, id: IIdentity, ns;
|
|
17
17
|
|
|
18
18
|
before(async () => {
|
|
19
19
|
[founder, ...signers] = await ethers.getSigners();
|
|
20
20
|
|
|
21
21
|
const FuseFaucetF = await ethers.getContractFactory("FuseFaucet");
|
|
22
22
|
|
|
23
|
-
let { daoCreator, controller, avatar: av, gd: gooddollar, identity } = await loadFixture(createDAO);
|
|
23
|
+
let { daoCreator, controller, avatar: av, gd: gooddollar, identity, nameService } = await loadFixture(createDAO);
|
|
24
24
|
|
|
25
25
|
Controller = controller;
|
|
26
26
|
avatar = av;
|
|
27
|
+
ns = nameService.address;
|
|
27
28
|
|
|
28
29
|
// await daoCreator.setSchemes(
|
|
29
30
|
// avatar,
|
|
@@ -54,10 +55,10 @@ describe("FuseFaucet", () => {
|
|
|
54
55
|
const res = await upgrades.upgradeProxy(faucet.address, await ethers.getContractFactory("FuseFaucetV2"), {
|
|
55
56
|
kind: "transparent",
|
|
56
57
|
unsafeAllowRenames: true,
|
|
57
|
-
call: { fn: "upgrade", args: [signers[1].address, founder.address] }
|
|
58
|
+
call: { fn: "upgrade", args: [signers[1].address, founder.address, ns] }
|
|
58
59
|
});
|
|
59
60
|
expect(res).not.empty;
|
|
60
|
-
await expect(res.upgrade(signers[0].address, signers[0].address)).revertedWith("
|
|
61
|
+
await expect(res.upgrade(signers[0].address, signers[0].address, ns)).revertedWith("wrong upgrade version");
|
|
61
62
|
expect(await res.owner()).equal(founder.address);
|
|
62
63
|
expect(await res.relayer()).equal(signers[1].address);
|
|
63
64
|
});
|
|
@@ -13,19 +13,10 @@ const ONE_DAY = 86400;
|
|
|
13
13
|
describe("UBIScheme cycle", () => {
|
|
14
14
|
let goodDollar, firstClaimPool;
|
|
15
15
|
let reputation;
|
|
16
|
-
let root,
|
|
17
|
-
acct,
|
|
18
|
-
claimer1,
|
|
19
|
-
claimer2,
|
|
20
|
-
claimer3,
|
|
21
|
-
signers,
|
|
22
|
-
nameService,
|
|
23
|
-
genericCall,
|
|
24
|
-
ubiScheme: UBIScheme;
|
|
16
|
+
let root, acct, claimer1, claimer2, claimer3, signers, nameService, genericCall, ubiScheme: UBIScheme;
|
|
25
17
|
|
|
26
18
|
before(async () => {
|
|
27
|
-
[root, acct, claimer1, claimer2, claimer3, ...signers] =
|
|
28
|
-
await ethers.getSigners();
|
|
19
|
+
[root, acct, claimer1, claimer2, claimer3, ...signers] = await ethers.getSigners();
|
|
29
20
|
|
|
30
21
|
const deployedDAO = await loadFixture(createDAO);
|
|
31
22
|
let {
|
|
@@ -53,8 +44,8 @@ describe("UBIScheme cycle", () => {
|
|
|
53
44
|
// await increaseTime(60 * 60 * 24);
|
|
54
45
|
});
|
|
55
46
|
|
|
56
|
-
it("should deploy the ubi with default cycle of
|
|
57
|
-
expect(await ubiScheme.cycleLength()).to.equal(
|
|
47
|
+
it("should deploy the ubi with default cycle of 30 days", async () => {
|
|
48
|
+
expect(await ubiScheme.cycleLength()).to.equal(30);
|
|
58
49
|
});
|
|
59
50
|
|
|
60
51
|
it("should not be able to change cycleLength if not avatar", async () => {
|
|
@@ -64,9 +55,7 @@ describe("UBIScheme cycle", () => {
|
|
|
64
55
|
|
|
65
56
|
it("should be able to change cycleLength if avatar", async () => {
|
|
66
57
|
// initializing the ubi
|
|
67
|
-
let encodedCall = ubiScheme.interface.encodeFunctionData("setCycleLength", [
|
|
68
|
-
8
|
|
69
|
-
]);
|
|
58
|
+
let encodedCall = ubiScheme.interface.encodeFunctionData("setCycleLength", [8]);
|
|
70
59
|
await genericCall(ubiScheme.address, encodedCall);
|
|
71
60
|
expect(await ubiScheme.cycleLength()).to.be.equal(8);
|
|
72
61
|
});
|
|
@@ -81,10 +70,7 @@ describe("UBIScheme cycle", () => {
|
|
|
81
70
|
|
|
82
71
|
it("should set ubischeme", async () => {
|
|
83
72
|
// initializing the ubi
|
|
84
|
-
let encodedCall = firstClaimPool.interface.encodeFunctionData(
|
|
85
|
-
"setUBIScheme",
|
|
86
|
-
[ubiScheme.address]
|
|
87
|
-
);
|
|
73
|
+
let encodedCall = firstClaimPool.interface.encodeFunctionData("setUBIScheme", [ubiScheme.address]);
|
|
88
74
|
|
|
89
75
|
await genericCall(firstClaimPool.address, encodedCall);
|
|
90
76
|
// await firstClaimPool.start();
|
|
@@ -98,9 +84,7 @@ describe("UBIScheme cycle", () => {
|
|
|
98
84
|
let currentCycle = await ubiScheme.currentCycleLength();
|
|
99
85
|
let balance = await goodDollar.balanceOf(ubiScheme.address);
|
|
100
86
|
expect(currentCycle.toNumber()).to.be.gt(0);
|
|
101
|
-
const cycleEvent = transaction.events.find(
|
|
102
|
-
e => e.event === "UBICycleCalculated"
|
|
103
|
-
);
|
|
87
|
+
const cycleEvent = transaction.events.find(e => e.event === "UBICycleCalculated");
|
|
104
88
|
expect(cycleEvent.args.day.toNumber()).to.be.a("number");
|
|
105
89
|
expect(cycleEvent.args.pool).to.be.equal(balance);
|
|
106
90
|
expect(cycleEvent.args.cycleLength).to.be.equal(cycleLength);
|
|
@@ -110,48 +94,33 @@ describe("UBIScheme cycle", () => {
|
|
|
110
94
|
it("should have calculated dailyCyclePool and dailyUbi correctly", async () => {
|
|
111
95
|
increaseTime(ONE_DAY);
|
|
112
96
|
let transaction = await ubiScheme.connect(claimer2).claim();
|
|
113
|
-
expect(
|
|
114
|
-
await
|
|
115
|
-
)
|
|
116
|
-
expect(
|
|
117
|
-
|
|
118
|
-
).to.be.equal(125000);
|
|
119
|
-
expect(
|
|
120
|
-
await ubiScheme.currentDayInCycle().then(_ => _.toNumber())
|
|
121
|
-
).to.be.equal(1); //1 day passed
|
|
97
|
+
expect(await goodDollar.balanceOf(claimer2.address).then(_ => _.toNumber())).to.be.equal(
|
|
98
|
+
1000 + (await ubiScheme.dailyUbi().then(_ => _.toNumber()))
|
|
99
|
+
); //first day 10G$ (1000 wei), second claim 125000 wei daily pool divided by 2 active users = 625000
|
|
100
|
+
expect(await ubiScheme.dailyCyclePool().then(_ => _.toNumber())).to.be.equal(125000);
|
|
101
|
+
expect(await ubiScheme.currentDayInCycle().then(_ => _.toNumber())).to.be.equal(1); //1 day passed
|
|
122
102
|
});
|
|
123
103
|
|
|
124
104
|
it("should calculate next cycle even if day passed without claims(setDay)", async () => {
|
|
125
105
|
increaseTime(ONE_DAY * 9);
|
|
126
|
-
expect(
|
|
127
|
-
await ubiScheme.currentDayInCycle().then(_ => _.toNumber())
|
|
128
|
-
).to.be.equal(10); //10 days passed total
|
|
106
|
+
expect(await ubiScheme.currentDayInCycle().then(_ => _.toNumber())).to.be.equal(10); //10 days passed total
|
|
129
107
|
|
|
130
108
|
let transaction = await (await ubiScheme.connect(claimer1).claim()).wait(); //claims in new ubi cycle
|
|
131
109
|
let dailyClaimAmount = (await ubiScheme.dailyCyclePool()).div(1000); //initialy we have by default min 1000 active users
|
|
132
110
|
|
|
133
|
-
expect(await goodDollar.balanceOf(claimer1.address)).to.be.equal(
|
|
134
|
-
|
|
135
|
-
); //intial 10 from first claim pool + daily
|
|
136
|
-
const cycleEvent = transaction.events.find(
|
|
137
|
-
e => e.event === "UBICycleCalculated"
|
|
138
|
-
);
|
|
111
|
+
expect(await goodDollar.balanceOf(claimer1.address)).to.be.equal(dailyClaimAmount.add(1000)); //intial 10 from first claim pool + daily
|
|
112
|
+
const cycleEvent = transaction.events.find(e => e.event === "UBICycleCalculated");
|
|
139
113
|
|
|
140
114
|
expect(cycleEvent).to.be.not.empty;
|
|
141
115
|
|
|
142
|
-
expect(
|
|
143
|
-
await ubiScheme.currentDayInCycle().then(_ => _.toNumber())
|
|
144
|
-
).to.be.equal(0); //new cycle started
|
|
116
|
+
expect(await ubiScheme.currentDayInCycle().then(_ => _.toNumber())).to.be.equal(0); //new cycle started
|
|
145
117
|
//intial balance on cycle start 1000000 - 125(one user that claimed) = 999875, divide by cycle length (8) = 124984
|
|
146
118
|
expect(cycleEvent.args.dailyUBIPool).to.be.equal(124984);
|
|
147
119
|
});
|
|
148
120
|
|
|
149
121
|
it("should calculate cycle early if we can increase current daily pool", async () => {
|
|
150
122
|
//increase ubi pool balance
|
|
151
|
-
let encoded = goodDollar.interface.encodeFunctionData("mint", [
|
|
152
|
-
ubiScheme.address,
|
|
153
|
-
400000
|
|
154
|
-
]);
|
|
123
|
+
let encoded = goodDollar.interface.encodeFunctionData("mint", [ubiScheme.address, 400000]);
|
|
155
124
|
await genericCall(goodDollar.address, encoded);
|
|
156
125
|
let balance = await goodDollar.balanceOf(ubiScheme.address);
|
|
157
126
|
|
|
@@ -164,9 +133,7 @@ describe("UBIScheme cycle", () => {
|
|
|
164
133
|
const estimated = await ubiScheme.estimateNextDailyUBI();
|
|
165
134
|
await increaseTime(ONE_DAY); //make sure
|
|
166
135
|
let transaction = await (await ubiScheme.connect(claimer1).claim()).wait();
|
|
167
|
-
const cycleEvent = transaction.events.find(
|
|
168
|
-
e => e.event === "UBICycleCalculated"
|
|
169
|
-
);
|
|
136
|
+
const cycleEvent = transaction.events.find(e => e.event === "UBICycleCalculated");
|
|
170
137
|
const dailyUBI = await ubiScheme.dailyUbi();
|
|
171
138
|
expect(dailyUBI).to.eq(estimated); //the estimated before actual calculation should be correct, ie equal to actual dailyUBI calculated after first claim.
|
|
172
139
|
expect(cycleEvent).to.be.not.empty;
|
|
@@ -178,10 +145,7 @@ describe("UBIScheme cycle", () => {
|
|
|
178
145
|
|
|
179
146
|
it("should not calculate cycle early if not possible to increase daily ubi pool", async () => {
|
|
180
147
|
//increase ubi pool balance
|
|
181
|
-
let encoded = goodDollar.interface.encodeFunctionData("mint", [
|
|
182
|
-
ubiScheme.address,
|
|
183
|
-
100
|
|
184
|
-
]);
|
|
148
|
+
let encoded = goodDollar.interface.encodeFunctionData("mint", [ubiScheme.address, 100]);
|
|
185
149
|
await genericCall(goodDollar.address, encoded);
|
|
186
150
|
let balance = await goodDollar.balanceOf(ubiScheme.address);
|
|
187
151
|
const curCycleLen = await ubiScheme.cycleLength();
|
|
@@ -191,9 +155,7 @@ describe("UBIScheme cycle", () => {
|
|
|
191
155
|
|
|
192
156
|
await increaseTime(ONE_DAY); //make sure
|
|
193
157
|
let transaction = await (await ubiScheme.connect(claimer1).claim()).wait();
|
|
194
|
-
const cycleEvent = transaction.events.find(
|
|
195
|
-
e => e.event === "UBICycleCalculated"
|
|
196
|
-
);
|
|
158
|
+
const cycleEvent = transaction.events.find(e => e.event === "UBICycleCalculated");
|
|
197
159
|
expect(cycleEvent).to.be.undefined;
|
|
198
160
|
});
|
|
199
161
|
});
|