@gooddollar/goodprotocol 2.0.3-beta.0 → 2.0.4

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.
Files changed (186) hide show
  1. package/artifacts/abis/Faucet.min.json +1 -1
  2. package/artifacts/abis/FuseFaucetV2.min.json +1 -1
  3. package/artifacts/abis/GoodDollarMintBurnWrapper.min.json +1 -1
  4. package/artifacts/abis/OneTimePayments.min.json +1 -0
  5. package/artifacts/contracts/DAOStackInterfaces.sol/Avatar.dbg.json +1 -1
  6. package/artifacts/contracts/DAOStackInterfaces.sol/Controller.dbg.json +1 -1
  7. package/artifacts/contracts/DAOStackInterfaces.sol/GlobalConstraintInterface.dbg.json +1 -1
  8. package/artifacts/contracts/DAOStackInterfaces.sol/IntVoteInterface.dbg.json +1 -1
  9. package/artifacts/contracts/DAOStackInterfaces.sol/ReputationInterface.dbg.json +1 -1
  10. package/artifacts/contracts/DAOStackInterfaces.sol/SchemeRegistrar.dbg.json +1 -1
  11. package/artifacts/contracts/Interfaces.sol/AggregatorV3Interface.dbg.json +1 -1
  12. package/artifacts/contracts/Interfaces.sol/ERC20.dbg.json +1 -1
  13. package/artifacts/contracts/Interfaces.sol/IAaveIncentivesController.dbg.json +1 -1
  14. package/artifacts/contracts/Interfaces.sol/IAdminWallet.dbg.json +1 -1
  15. package/artifacts/contracts/Interfaces.sol/IDonationStaking.dbg.json +1 -1
  16. package/artifacts/contracts/Interfaces.sol/IERC2917.dbg.json +1 -1
  17. package/artifacts/contracts/Interfaces.sol/IFirstClaimPool.dbg.json +1 -1
  18. package/artifacts/contracts/Interfaces.sol/IGoodDollar.dbg.json +1 -1
  19. package/artifacts/contracts/Interfaces.sol/IGoodStaking.dbg.json +1 -1
  20. package/artifacts/contracts/Interfaces.sol/IHasRouter.dbg.json +1 -1
  21. package/artifacts/contracts/Interfaces.sol/IIdentity.dbg.json +1 -1
  22. package/artifacts/contracts/Interfaces.sol/IIdentityV2.dbg.json +1 -1
  23. package/artifacts/contracts/Interfaces.sol/ILendingPool.dbg.json +1 -1
  24. package/artifacts/contracts/Interfaces.sol/IMultichainRouter.dbg.json +1 -1
  25. package/artifacts/contracts/Interfaces.sol/INameService.dbg.json +1 -1
  26. package/artifacts/contracts/Interfaces.sol/IUBIScheme.dbg.json +1 -1
  27. package/artifacts/contracts/Interfaces.sol/ProxyAdmin.dbg.json +1 -1
  28. package/artifacts/contracts/Interfaces.sol/Reserve.dbg.json +1 -1
  29. package/artifacts/contracts/Interfaces.sol/Staking.dbg.json +1 -1
  30. package/artifacts/contracts/Interfaces.sol/Uniswap.dbg.json +1 -1
  31. package/artifacts/contracts/Interfaces.sol/UniswapFactory.dbg.json +1 -1
  32. package/artifacts/contracts/Interfaces.sol/UniswapPair.dbg.json +1 -1
  33. package/artifacts/contracts/Interfaces.sol/cERC20.dbg.json +1 -1
  34. package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.dbg.json +1 -1
  35. package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.json +43 -17
  36. package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
  37. package/artifacts/contracts/fuseFaucet/FuseFaucetV2.sol/FuseFaucetV2.dbg.json +1 -1
  38. package/artifacts/contracts/fuseFaucet/FuseFaucetV2.sol/FuseFaucetV2.json +37 -17
  39. package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
  40. package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
  41. package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
  42. package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.dbg.json +1 -1
  43. package/artifacts/contracts/governance/GoodDollarStaking.sol/IGovernanceStaking.dbg.json +1 -1
  44. package/artifacts/contracts/governance/GoodDollarStaking.sol/IStakingUpgrade.dbg.json +1 -1
  45. package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.dbg.json +1 -1
  46. package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
  47. package/artifacts/contracts/governance/MultiBaseGovernanceShareField.sol/MultiBaseGovernanceShareField.dbg.json +1 -1
  48. package/artifacts/contracts/governance/Reputation.sol/Reputation.dbg.json +1 -1
  49. package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
  50. package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.dbg.json +1 -1
  51. package/artifacts/contracts/invite/InvitesFuseV2.sol/InvitesFuseV2.dbg.json +1 -1
  52. package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.dbg.json +1 -1
  53. package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.dbg.json +1 -1
  54. package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
  55. package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
  56. package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
  57. package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.dbg.json +1 -1
  58. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +1 -1
  59. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +1 -1
  60. package/artifacts/contracts/mocks/FeesFormularMock.sol/FeesFormulaMock.dbg.json +1 -1
  61. package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
  62. package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.dbg.json +1 -1
  63. package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
  64. package/artifacts/contracts/mocks/IdentityMock.sol/IdentityMock.dbg.json +1 -1
  65. package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
  66. package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
  67. package/artifacts/contracts/mocks/MultichainRouterMock.sol/IWrapper.dbg.json +1 -1
  68. package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.dbg.json +1 -1
  69. package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.dbg.json +1 -1
  70. package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
  71. package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
  72. package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
  73. package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.dbg.json +1 -1
  74. package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
  75. package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
  76. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
  77. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
  78. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.dbg.json +1 -1
  79. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.dbg.json +1 -1
  80. package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
  81. package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
  82. package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
  83. package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
  84. package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
  85. package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
  86. package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
  87. package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
  88. package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.dbg.json +1 -1
  89. package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
  90. package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
  91. package/artifacts/contracts/reserve/GoodReserveCDai.sol/ContributionCalc.dbg.json +1 -1
  92. package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.dbg.json +1 -1
  93. package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
  94. package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.dbg.json +1 -1
  95. package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
  96. package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.dbg.json +1 -1
  97. package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.json +2 -2
  98. package/artifacts/contracts/staking/FuseStakingV3.sol/IConsensus.dbg.json +1 -1
  99. package/artifacts/contracts/staking/FuseStakingV3.sol/PegSwap.dbg.json +1 -1
  100. package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.dbg.json +1 -1
  101. package/artifacts/contracts/staking/SimpleStaking.sol/SimpleStaking.dbg.json +1 -1
  102. package/artifacts/contracts/staking/SimpleStakingV2.sol/SimpleStakingV2.dbg.json +1 -1
  103. package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.dbg.json +1 -1
  104. package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
  105. package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
  106. package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.dbg.json +1 -1
  107. package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
  108. package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
  109. package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.dbg.json +1 -1
  110. package/artifacts/contracts/staking/utils/Math64X64.sol/Math64x64.dbg.json +1 -1
  111. package/artifacts/contracts/staking/utils/StakingRewardsFixedAPY.sol/StakingRewardsFixedAPY.dbg.json +1 -1
  112. package/artifacts/contracts/token/ERC20PresetMinterPauserUpgradeable.sol/ERC20PresetMinterPauserUpgradeable.dbg.json +1 -1
  113. package/artifacts/contracts/token/ERC677.sol/ERC677.dbg.json +1 -1
  114. package/artifacts/contracts/token/ERC677.sol/ERC677Receiver.dbg.json +1 -1
  115. package/artifacts/contracts/token/FeesFormula.sol/IFeesFormula.dbg.json +1 -1
  116. package/artifacts/contracts/token/GoodDollar.sol/GoodDollar.dbg.json +1 -1
  117. package/artifacts/contracts/token/superfluid/ERC20Permit.sol/ERC20Permit.dbg.json +1 -1
  118. package/artifacts/contracts/token/superfluid/ERC20Permit.sol/SelfApprove.dbg.json +1 -1
  119. package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/IGoodDollarCustom.dbg.json +1 -1
  120. package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/ISuperGoodDollar.dbg.json +1 -1
  121. package/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.dbg.json +1 -1
  122. package/artifacts/contracts/token/superfluid/SuperToken.sol/SuperToken.dbg.json +1 -1
  123. package/artifacts/contracts/token/superfluid/SuperfluidToken.sol/SuperfluidToken.dbg.json +1 -1
  124. package/artifacts/contracts/token/superfluid/UUPSProxiable.sol/UUPSProxiable.dbg.json +1 -1
  125. package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
  126. package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.json +2 -2
  127. package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
  128. package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.dbg.json +1 -1
  129. package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
  130. package/artifacts/contracts/utils/BulkProof.sol/BulkProof.dbg.json +1 -1
  131. package/artifacts/contracts/utils/BuyAndBridgeHelper.sol/BuyAndBridgeHelper.dbg.json +1 -1
  132. package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
  133. package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
  134. package/artifacts/contracts/utils/DSMath.sol/DSMath.dbg.json +1 -1
  135. package/artifacts/contracts/utils/DataTypes.sol/DataTypes.dbg.json +1 -1
  136. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.dbg.json +1 -1
  137. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.json +2 -9
  138. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/IRouter.dbg.json +1 -1
  139. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/PausableControl.dbg.json +1 -1
  140. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.dbg.json +1 -1
  141. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.json +2 -2
  142. package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.dbg.json +1 -1
  143. package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
  144. package/artifacts/contracts/utils/OneTimePayments.sol/OneTimePayments.dbg.json +4 -0
  145. package/artifacts/contracts/utils/OneTimePayments.sol/OneTimePayments.json +270 -0
  146. package/artifacts/contracts/utils/ProtocolUpgrade.sol/OldMarketMaker.dbg.json +1 -1
  147. package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.dbg.json +1 -1
  148. package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
  149. package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.dbg.json +1 -1
  150. package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.dbg.json +1 -1
  151. package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.dbg.json +1 -1
  152. package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.dbg.json +1 -1
  153. package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
  154. package/contracts/fuseFaucet/Faucet.sol +19 -10
  155. package/contracts/fuseFaucet/FuseFaucetV2.sol +28 -16
  156. package/contracts/ubi/UBIScheme.sol +1 -1
  157. package/contracts/utils/GoodDollarMintBurnWrapper.sol +1 -19
  158. package/contracts/utils/OneTimePayments.sol +135 -0
  159. package/package.json +1 -1
  160. package/releases/deployment.json +16 -5
  161. package/scripts/multichain-deploy/2_helpers-deploy.ts +46 -21
  162. package/scripts/multichain-deploy/2b_otp-deploy.ts +73 -0
  163. package/scripts/multichain-deploy/4_ubi-deploy.ts +19 -35
  164. package/scripts/multichain-deploy/helpers.ts +2 -2
  165. package/scripts/multichain-deploy/multichainWrapper-deploy.ts +7 -4
  166. package/scripts/upgradeToV3/v3-fuse-multichain.ts +117 -0
  167. package/scripts/upgrades/celo-defi-ubi-deploy.ts +9 -3
  168. package/scripts/upgrades/identity-upgrade.ts +20 -12
  169. package/test/faucet/Faucet.test.ts +4 -3
  170. package/test/faucet/FuseFaucet.test.ts +1 -1
  171. package/test/ubi/UBISchemeCycle.test.ts +20 -58
  172. package/test/utils/GoodDollarMintBurnWrapper.test.ts +66 -224
  173. package/types/Faucet.ts +61 -32
  174. package/types/FuseFaucetV2.ts +69 -32
  175. package/types/GoodDollarMintBurnWrapper.ts +0 -27
  176. package/types/OneTimePayments.ts +396 -0
  177. package/types/factories/Faucet__factory.ts +42 -16
  178. package/types/factories/FuseFaucetV2__factory.ts +36 -16
  179. package/types/factories/FuseStakingV3__factory.ts +1 -1
  180. package/types/factories/GoodDollarMintBurnWrapper__factory.ts +1 -8
  181. package/types/factories/OneTimePayments__factory.ts +323 -0
  182. package/types/factories/UBIScheme__factory.ts +1 -1
  183. package/types/hardhat.d.ts +9 -0
  184. package/types/index.ts +2 -0
  185. package/scripts/multichain-deploy/v3-fix.ts +0 -120
  186. package/scripts/multichain-deploy/v3-upgrade.ts +0 -219
@@ -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();
@@ -7,7 +7,7 @@
7
7
  * - add 1000 celo to adminwallet and faucet
8
8
  * - monitor adminwallet + faucet on defender
9
9
  *
10
- * Step 3:
10
+ * Step 3: (once guardians sign Identity upgrade)
11
11
  * - upgrade AdminWallet+Invites+Faucet on Fuse to support whitelisting chainid
12
12
  * - upgrade backend server to support whitelisting with chainid
13
13
  *
@@ -57,14 +57,20 @@ const step3 = async () => {
57
57
 
58
58
  const adminimpl = await (await ethers.getContractFactory("AdminWalletFuse")).deploy();
59
59
  const curadmin = adminimpl.attach(release.AdminWallet);
60
- const upgradetx = await (await curadmin.upgradeTo(adminimpl.address)).wait();
60
+ console.log("deployed admin impl", adminimpl.address);
61
+ const encodedAdmin = adminimpl.interface.encodeFunctionData("upgrade", [release.NameService]);
62
+ const upgradetx = await (await curadmin.upgradeToAndCall(adminimpl.address, encodedAdmin)).wait();
61
63
  const impl = adminimpl.address;
62
64
  console.log("AdminWallet upgraded", { impl, txhash: upgradetx.transactionHash });
63
65
  await verifyContract(impl, "AdminWalletFuse", networkName);
64
66
 
65
67
  const faucetimpl = await (await ethers.getContractFactory("FuseFaucetV2")).deploy();
66
68
  const proxyAdmin = await ethers.getContractAt("ProxyAdmin", release.ProxyAdmin);
67
- const encoded = faucetimpl.interface.encodeFunctionData("upgrade", [release.AdminWallet, root.address]);
69
+ const encoded = faucetimpl.interface.encodeFunctionData("upgrade", [
70
+ release.AdminWallet,
71
+ root.address,
72
+ release.NameService
73
+ ]);
68
74
  const faucettx = await (await proxyAdmin.upgradeAndCall(release.FuseFaucet, faucetimpl.address, encoded)).wait();
69
75
  console.log("Faucet upgraded", faucettx.transactionHash);
70
76
  await verifyContract(faucetimpl.address, "FuseFaucetV2", networkName);
@@ -43,63 +43,71 @@ export const upgrade = async () => {
43
43
  console.log("got signers:", {
44
44
  networkName,
45
45
  root: root.address,
46
- balance: await ethers.provider.getBalance(root.address).then(_ => _.toString())
46
+ balance: await ethers.provider.getBalance(root.address).then(_ => _.toString()),
47
+ Identity: release.Identity
47
48
  });
48
49
 
49
- let OldIdentity = await ethers.getContractAt(OldIdentityABI.abi, release.OldIdentity || release.Identity);
50
+ let OldIdentity = await ethers.getContractAt(OldIdentityABI.abi, release.IdentityOld || release.Identity);
50
51
  // let Identity = await ethers.getContractAt("IdentityV2", release.Identity);
51
52
  // Identity = await ethers.getContractAt("IdentityV2", "0xb0cD4828Cc90C5BC28f4920Adf2Fd8F025003D7E");
52
- console.log("deploying new identity...");
53
+ console.log("deploying new identity...", { old: OldIdentity.address });
53
54
  let Identity = (await deployDeterministic(
54
55
  {
55
56
  name: "IdentityV2",
56
57
  salt: "IdentityV2",
57
58
  isUpgradeable: true
58
59
  },
59
- [root.address, release.Identity]
60
+ [root.address, OldIdentity.address]
60
61
  ).then(printDeploy)) as Contract;
61
62
 
62
63
  let torelease = {
63
64
  Identity: Identity.address,
64
- IdentityOld: release.Identity
65
+ IdentityOld: OldIdentity.address
65
66
  };
66
67
 
67
68
  await releaser(torelease, networkName, "deployment", false);
68
69
 
69
70
  console.log("calling initDAO...");
70
- const tx = await (await Identity.initDAO(release.NameService)).wait();
71
+ const tx = await Identity.initDAO(release.NameService).then(printDeploy);
71
72
  await Identity.grantRole(
72
73
  ethers.utils.keccak256(ethers.utils.toUtf8Bytes("identity_admin")),
73
74
  release.AdminWallet
74
75
  ).then(printDeploy);
75
- await OldIdentity.addIdentityAdmin(Identity.address).then(printDeploy);
76
+
77
+ //done via Avatar in proposal
78
+ // await OldIdentity.addIdentityAdmin(Identity.address).then(printDeploy);
76
79
 
77
80
  const impl = await getImplementationAddress(ethers.provider, Identity.address);
78
81
  await verifyContract(impl, "IdentityV2", networkName);
79
82
 
80
83
  const proposalContracts = [
81
84
  release.GoodDollar, //controller -> set new identity in G$
82
- 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
83
87
  ];
84
88
 
85
89
  const proposalEthValues = proposalContracts.map(_ => 0);
86
90
 
87
91
  const proposalFunctionSignatures = [
88
92
  "setIdentity(address)", //set Identity on GoodDollar token
89
- "setAddress(string,address)" //set new identity address in nameservice
93
+ "setAddress(string,address)", //set new identity address in nameservice
94
+ "addIdentityAdmin(address)"
90
95
  ];
91
96
 
92
97
  const proposalFunctionInputs = [
93
98
  ethers.utils.defaultAbiCoder.encode(["address"], [Identity.address]),
94
- 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])
95
101
  ];
102
+
96
103
  if (isProduction) {
97
104
  await executeViaSafe(
98
105
  proposalContracts,
99
106
  proposalEthValues,
100
107
  proposalFunctionSignatures,
101
- proposalFunctionSignatures,
102
- protocolSettings.guardiansSafe
108
+ proposalFunctionInputs,
109
+ protocolSettings.guardiansSafe,
110
+ "fuse"
103
111
  );
104
112
  } else {
105
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.toppingAmount());
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.toppingAmount());
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: ethers.utils.parseUnits("5000000", "gwei")
132
+ value: toppingAmount.mul(80).div(100)
132
133
  });
133
134
  }
134
135
  await ethers.provider.send("evm_increaseTime", [60 * 60 * 24]);
@@ -58,7 +58,7 @@ describe("FuseFaucet", () => {
58
58
  call: { fn: "upgrade", args: [signers[1].address, founder.address, ns] }
59
59
  });
60
60
  expect(res).not.empty;
61
- await expect(res.upgrade(signers[0].address, signers[0].address, ns)).revertedWith("already upgraded");
61
+ await expect(res.upgrade(signers[0].address, signers[0].address, ns)).revertedWith("wrong upgrade version");
62
62
  expect(await res.owner()).equal(founder.address);
63
63
  expect(await res.relayer()).equal(signers[1].address);
64
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 90 days", async () => {
57
- expect(await ubiScheme.cycleLength()).to.equal(90);
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 goodDollar.balanceOf(claimer2.address).then(_ => _.toNumber())
115
- ).to.be.equal(1000 + (await ubiScheme.dailyUbi().then(_ => _.toNumber()))); //first day 10G$ (1000 wei), second claim 125000 wei daily pool divided by 2 active users = 625000
116
- expect(
117
- await ubiScheme.dailyCyclePool().then(_ => _.toNumber())
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
- dailyClaimAmount.add(1000)
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
  });