@gooddollar/goodprotocol 2.0.24 → 2.0.25-beta.1

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 (177) hide show
  1. package/artifacts/contracts/DAOStackInterfaces.sol/Avatar.dbg.json +1 -1
  2. package/artifacts/contracts/DAOStackInterfaces.sol/Controller.dbg.json +1 -1
  3. package/artifacts/contracts/DAOStackInterfaces.sol/GlobalConstraintInterface.dbg.json +1 -1
  4. package/artifacts/contracts/DAOStackInterfaces.sol/IntVoteInterface.dbg.json +1 -1
  5. package/artifacts/contracts/DAOStackInterfaces.sol/ReputationInterface.dbg.json +1 -1
  6. package/artifacts/contracts/DAOStackInterfaces.sol/SchemeRegistrar.dbg.json +1 -1
  7. package/artifacts/contracts/Interfaces.sol/AggregatorV3Interface.dbg.json +1 -1
  8. package/artifacts/contracts/Interfaces.sol/ERC20.dbg.json +1 -1
  9. package/artifacts/contracts/Interfaces.sol/IAaveIncentivesController.dbg.json +1 -1
  10. package/artifacts/contracts/Interfaces.sol/IAdminWallet.dbg.json +1 -1
  11. package/artifacts/contracts/Interfaces.sol/IDonationStaking.dbg.json +1 -1
  12. package/artifacts/contracts/Interfaces.sol/IERC2917.dbg.json +1 -1
  13. package/artifacts/contracts/Interfaces.sol/IFirstClaimPool.dbg.json +1 -1
  14. package/artifacts/contracts/Interfaces.sol/IGoodDollar.dbg.json +1 -1
  15. package/artifacts/contracts/Interfaces.sol/IGoodStaking.dbg.json +1 -1
  16. package/artifacts/contracts/Interfaces.sol/IHasRouter.dbg.json +1 -1
  17. package/artifacts/contracts/Interfaces.sol/IIdentity.dbg.json +1 -1
  18. package/artifacts/contracts/Interfaces.sol/IIdentityV2.dbg.json +1 -1
  19. package/artifacts/contracts/Interfaces.sol/ILendingPool.dbg.json +1 -1
  20. package/artifacts/contracts/Interfaces.sol/IMultichainRouter.dbg.json +1 -1
  21. package/artifacts/contracts/Interfaces.sol/INameService.dbg.json +1 -1
  22. package/artifacts/contracts/Interfaces.sol/IUBIScheme.dbg.json +1 -1
  23. package/artifacts/contracts/Interfaces.sol/ProxyAdmin.dbg.json +1 -1
  24. package/artifacts/contracts/Interfaces.sol/Reserve.dbg.json +1 -1
  25. package/artifacts/contracts/Interfaces.sol/Staking.dbg.json +1 -1
  26. package/artifacts/contracts/Interfaces.sol/Uniswap.dbg.json +1 -1
  27. package/artifacts/contracts/Interfaces.sol/UniswapFactory.dbg.json +1 -1
  28. package/artifacts/contracts/Interfaces.sol/UniswapPair.dbg.json +1 -1
  29. package/artifacts/contracts/Interfaces.sol/cERC20.dbg.json +1 -1
  30. package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.dbg.json +1 -1
  31. package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
  32. package/artifacts/contracts/fuseFaucet/FuseFaucetV2.sol/FuseFaucetV2.dbg.json +1 -1
  33. package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
  34. package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
  35. package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
  36. package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.dbg.json +1 -1
  37. package/artifacts/contracts/governance/GoodDollarStaking.sol/IGovernanceStaking.dbg.json +1 -1
  38. package/artifacts/contracts/governance/GoodDollarStaking.sol/IStakingUpgrade.dbg.json +1 -1
  39. package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.dbg.json +1 -1
  40. package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
  41. package/artifacts/contracts/governance/MultiBaseGovernanceShareField.sol/MultiBaseGovernanceShareField.dbg.json +1 -1
  42. package/artifacts/contracts/governance/Reputation.sol/Reputation.dbg.json +1 -1
  43. package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
  44. package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.dbg.json +1 -1
  45. package/artifacts/contracts/invite/InvitesFuseV2.sol/InvitesFuseV2.dbg.json +1 -1
  46. package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.dbg.json +1 -1
  47. package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.dbg.json +1 -1
  48. package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
  49. package/artifacts/contracts/mocks/AaveUSDMockOracle.sol/AaveUSDMockOracle.dbg.json +1 -1
  50. package/artifacts/contracts/mocks/BatUSDMockOracle.sol/BatUSDMockOracle.dbg.json +1 -1
  51. package/artifacts/contracts/mocks/CompUsdMockOracle.sol/CompUSDMockOracle.dbg.json +1 -1
  52. package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
  53. package/artifacts/contracts/mocks/DaiEthPriceMockOracle.sol/DaiEthPriceMockOracle.dbg.json +1 -1
  54. package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
  55. package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.dbg.json +1 -1
  56. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +1 -1
  57. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +1 -1
  58. package/artifacts/contracts/mocks/EthUSDMockOracle.sol/EthUSDMockOracle.dbg.json +1 -1
  59. package/artifacts/contracts/mocks/FeesFormularMock.sol/FeesFormulaMock.dbg.json +1 -1
  60. package/artifacts/contracts/mocks/GasPriceMockOracle.sol/GasPriceMockOracle.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/PayableMock.sol/PayableMock.dbg.json +1 -1
  73. package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
  74. package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.dbg.json +1 -1
  75. package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
  76. package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
  77. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
  78. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
  79. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.dbg.json +1 -1
  80. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.dbg.json +1 -1
  81. package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
  82. package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
  83. package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
  84. package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
  85. package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
  86. package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
  87. package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
  88. package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
  89. package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.dbg.json +1 -1
  90. package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
  91. package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
  92. package/artifacts/contracts/reserve/GoodReserveCDai.sol/ContributionCalc.dbg.json +1 -1
  93. package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.dbg.json +1 -1
  94. package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
  95. package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.dbg.json +1 -1
  96. package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
  97. package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.dbg.json +1 -1
  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/GoodDollar.sol/GoodDollar.dbg.json +1 -1
  116. package/artifacts/contracts/token/IFeesFormula.sol/IFeesFormula.dbg.json +1 -1
  117. package/artifacts/contracts/token/MultichainFeeFormula.sol/MultichainFeeFormula.dbg.json +1 -1
  118. package/artifacts/contracts/token/MultichainFeeFormula.sol/MultichainFeeFormula.json +2 -2
  119. package/artifacts/contracts/token/superfluid/ERC20Permit.sol/ERC20Permit.dbg.json +1 -1
  120. package/artifacts/contracts/token/superfluid/ERC20Permit.sol/SelfApprove.dbg.json +1 -1
  121. package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/IGoodDollarCustom.dbg.json +1 -1
  122. package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/ISuperGoodDollar.dbg.json +1 -1
  123. package/artifacts/contracts/token/superfluid/ISuperToken.sol/ISuperToken.dbg.json +1 -1
  124. package/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.dbg.json +1 -1
  125. package/artifacts/contracts/token/superfluid/SuperToken.sol/SuperToken.dbg.json +1 -1
  126. package/artifacts/contracts/token/superfluid/SuperfluidToken.sol/SuperfluidToken.dbg.json +1 -1
  127. package/artifacts/contracts/token/superfluid/UUPSProxiable.sol/UUPSProxiable.dbg.json +1 -1
  128. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/Proxy.dbg.json +1 -1
  129. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSProxy.dbg.json +1 -1
  130. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSUtils.dbg.json +1 -1
  131. package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
  132. package/artifacts/contracts/ubi/UBISchemeV2.sol/UBISchemeV2.dbg.json +1 -1
  133. package/artifacts/contracts/ubi/UBISchemeV2.sol/UBISchemeV2.json +2 -2
  134. package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
  135. package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.dbg.json +1 -1
  136. package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
  137. package/artifacts/contracts/utils/BulkProof.sol/BulkProof.dbg.json +1 -1
  138. package/artifacts/contracts/utils/BuyAndBridgeHelper.sol/BuyAndBridgeHelper.dbg.json +1 -1
  139. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDClone.dbg.json +1 -1
  140. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDCloneFactory.dbg.json +1 -1
  141. package/artifacts/contracts/utils/BuyGDClone.sol/DonateGDClone.dbg.json +1 -1
  142. package/artifacts/contracts/utils/BuyGDClone.sol/IQuoterV2.dbg.json +1 -1
  143. package/artifacts/contracts/utils/BuyGDClone.sol/ISwapRouter.dbg.json +1 -1
  144. package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
  145. package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
  146. package/artifacts/contracts/utils/DSMath.sol/DSMath.dbg.json +1 -1
  147. package/artifacts/contracts/utils/DataTypes.sol/DataTypes.dbg.json +1 -1
  148. package/artifacts/contracts/utils/GDFaucet.sol/GDFaucet.dbg.json +1 -1
  149. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.dbg.json +1 -1
  150. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/IRouter.dbg.json +1 -1
  151. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/PausableControl.dbg.json +1 -1
  152. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.dbg.json +1 -1
  153. package/artifacts/contracts/utils/IdentityFix.sol/IdentityFix.dbg.json +1 -1
  154. package/artifacts/contracts/utils/MultiCall.sol/Multicall.dbg.json +1 -1
  155. package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.dbg.json +1 -1
  156. package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
  157. package/artifacts/contracts/utils/OneTimePayments.sol/OneTimePayments.dbg.json +1 -1
  158. package/artifacts/contracts/utils/OneTimePaymentsV2.sol/OneTimePaymentsV2.dbg.json +1 -1
  159. package/artifacts/contracts/utils/ProtocolUpgrade.sol/OldMarketMaker.dbg.json +1 -1
  160. package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.dbg.json +1 -1
  161. package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
  162. package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.dbg.json +1 -1
  163. package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.dbg.json +1 -1
  164. package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.dbg.json +1 -1
  165. package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.dbg.json +1 -1
  166. package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
  167. package/contracts/token/MultichainFeeFormula.sol +5 -2
  168. package/contracts/ubi/UBISchemeV2.sol +3 -3
  169. package/package.json +1 -1
  170. package/releases/deploy-settings.json +1 -1
  171. package/scripts/analytics/activeWalletsStats.ts +53 -23
  172. package/scripts/analytics/faucetStats.ts +19 -15
  173. package/scripts/multichain-deploy/helpers.ts +46 -118
  174. package/scripts/proposals/hack-ubi-recovery.ts +414 -0
  175. package/scripts/upgrades/multichain-formula-upgrade.ts +4 -1
  176. package/types/factories/contracts/token/MultichainFeeFormula__factory.ts +1 -1
  177. package/types/factories/contracts/ubi/UBISchemeV2__factory.ts +1 -1
@@ -12,18 +12,14 @@ import dao from "../../releases/deployment.json";
12
12
 
13
13
  const exec = util.promisify(require("child_process").exec);
14
14
 
15
- const networkName =
16
- network.name === "localhost" ? "production-mainnet" : network.name;
15
+ const networkName = network.name === "localhost" ? "production-mainnet" : network.name;
17
16
  let totalGas = 0;
18
17
  const gasUsage = {};
19
18
  const GAS_SETTINGS = { gasLimit: 10000000 };
20
19
  let release: { [key: string]: any } = dao[networkName];
21
20
 
22
21
  export const verifyProductionSigner = signer => {
23
- if (
24
- signer.address.toLowerCase() !==
25
- "0x5128E3C1f8846724cc1007Af9b4189713922E4BB".toLowerCase()
26
- ) {
22
+ if (signer.address.toLowerCase() !== "0x5128E3C1f8846724cc1007Af9b4189713922E4BB".toLowerCase()) {
27
23
  throw new Error(
28
24
  "signer not 0x5128E3C1f8846724cc1007Af9b4189713922E4BB to get same deployed addresses on production"
29
25
  );
@@ -77,9 +73,7 @@ export const deploySuperGoodDollar = async (
77
73
  []
78
74
  ).then(printDeploy)) as Contract;
79
75
 
80
- await GoodDollarProxy.initializeProxy(SuperGoodDollar.address).then(
81
- printDeploy
82
- );
76
+ await GoodDollarProxy.initializeProxy(SuperGoodDollar.address).then(printDeploy);
83
77
 
84
78
  const OutFlowNFT = (await deployDeterministic(
85
79
  {
@@ -104,20 +98,11 @@ export const deploySuperGoodDollar = async (
104
98
  "initialize(string,string,uint256,address,address,address,address,address,address)"
105
99
  ](...tokenArgs, OutFlowNFT.address, InFlowNFT.address);
106
100
 
107
- const GoodDollar = await ethers.getContractAt(
108
- "ISuperGoodDollar",
109
- GoodDollarProxy.address
110
- );
101
+ const GoodDollar = await ethers.getContractAt("ISuperGoodDollar", GoodDollarProxy.address);
111
102
 
112
- const constantInflowNFT = await ethers.getContractAt(
113
- "ConstantInflowNFT",
114
- InFlowNFT.address
115
- );
103
+ const constantInflowNFT = await ethers.getContractAt("ConstantInflowNFT", InFlowNFT.address);
116
104
 
117
- const constantOutflowNFT = await ethers.getContractAt(
118
- "ConstantOutflowNFT",
119
- OutFlowNFT.address
120
- );
105
+ const constantOutflowNFT = await ethers.getContractAt("ConstantOutflowNFT", OutFlowNFT.address);
121
106
 
122
107
  await constantOutflowNFT
123
108
  .attach(OutFlowNFT.address)
@@ -137,31 +122,17 @@ export const deploySuperGoodDollar = async (
137
122
  return GoodDollar;
138
123
  };
139
124
 
140
- export const deployDeterministic = async (
141
- contract,
142
- args: any[],
143
- factoryOpts = {},
144
- redeployProxyFactory = false
145
- ) => {
125
+ export const deployDeterministic = async (contract, args: any[], factoryOpts = {}, redeployProxyFactory = false) => {
146
126
  try {
147
127
  let proxyFactory;
148
128
  if (networkName.startsWith("develop") && redeployProxyFactory) {
149
- proxyFactory = await (
150
- await ethers.getContractFactory("ProxyFactory1967")
151
- ).deploy();
152
- } else
153
- proxyFactory = await ethers.getContractAt(
154
- "ProxyFactory1967",
155
- release.ProxyFactory
156
- );
129
+ proxyFactory = await (await ethers.getContractFactory("ProxyFactory1967")).deploy();
130
+ } else proxyFactory = await ethers.getContractAt("ProxyFactory1967", release.ProxyFactory);
157
131
  const Contract =
158
- (contract.factory as ContractFactory) ||
159
- (await ethers.getContractFactory(contract.name, factoryOpts));
132
+ (contract.factory as ContractFactory) || (await ethers.getContractFactory(contract.name, factoryOpts));
160
133
 
161
134
  const salt = ethers.BigNumber.from(
162
- ethers.utils.keccak256(
163
- ethers.utils.toUtf8Bytes(contract.salt || contract.name)
164
- )
135
+ ethers.utils.keccak256(ethers.utils.toUtf8Bytes(contract.salt || contract.name))
165
136
  );
166
137
 
167
138
  if (contract.isUpgradeable === true) {
@@ -169,30 +140,19 @@ export const deployDeterministic = async (
169
140
  args,
170
141
  proxyFactory: proxyFactory.address
171
142
  });
172
- const encoded = Contract.interface.encodeFunctionData(
173
- contract.initializer || "initialize",
174
- args
175
- );
143
+ const encoded = Contract.interface.encodeFunctionData(contract.initializer || "initialize", args);
176
144
  const tx = await Contract.deploy(GAS_SETTINGS);
177
145
  const impl = await tx.deployed();
178
146
  console.log("implementation deployed:", contract.name, impl.address);
179
147
  await countTotalGas(tx, contract.name);
180
148
 
181
- const tx2 = await proxyFactory.deployProxy(
149
+ const tx2 = await proxyFactory.deployProxy(salt, impl.address, encoded, GAS_SETTINGS);
150
+ await countTotalGas(tx2, contract.name);
151
+ const deployTx = await tx2.wait().catch(e => console.error("failed to deploy proxy, assuming it exists...", e));
152
+ const proxyAddr = await proxyFactory["getDeploymentAddress(uint256,address)"](
182
153
  salt,
183
- impl.address,
184
- encoded,
185
- GAS_SETTINGS
154
+ await proxyFactory.signer.getAddress()
186
155
  );
187
- await countTotalGas(tx2, contract.name);
188
- const deployTx = await tx2
189
- .wait()
190
- .catch(e =>
191
- console.error("failed to deploy proxy, assuming it exists...", e)
192
- );
193
- const proxyAddr = await proxyFactory[
194
- "getDeploymentAddress(uint256,address)"
195
- ](salt, await proxyFactory.signer.getAddress());
196
156
  console.log("proxy deployed:", contract.name, proxyAddr);
197
157
  return Contract.attach(proxyAddr);
198
158
  } else {
@@ -201,17 +161,10 @@ export const deployDeterministic = async (
201
161
  args
202
162
  });
203
163
  const constructor = Contract.interface.encodeDeploy(args);
204
- const bytecode = ethers.utils.solidityPack(
205
- ["bytes", "bytes"],
206
- [Contract.bytecode, constructor]
207
- );
208
- const deployTx = await (
209
- await proxyFactory.deployCode(salt, bytecode, GAS_SETTINGS)
210
- ).wait();
164
+ const bytecode = ethers.utils.solidityPack(["bytes", "bytes"], [Contract.bytecode, constructor]);
165
+ const deployTx = await (await proxyFactory.deployCode(salt, bytecode, GAS_SETTINGS)).wait();
211
166
 
212
- const proxyAddr = await proxyFactory[
213
- "getDeploymentAddress(uint256,address,bytes32)"
214
- ](
167
+ const proxyAddr = await proxyFactory["getDeploymentAddress(uint256,address,bytes32)"](
215
168
  salt,
216
169
  await proxyFactory.signer.getAddress(),
217
170
  ethers.utils.keccak256(bytecode)
@@ -235,9 +188,7 @@ export const executeViaGuardian = async (
235
188
  network?: string
236
189
  ) => {
237
190
  let release: { [key: string]: any } = dao[network || networkName];
238
- const ctrl = await (
239
- await ethers.getContractAt("Controller", release.Controller)
240
- ).connect(guardian);
191
+ const ctrl = await (await ethers.getContractAt("Controller", release.Controller)).connect(guardian);
241
192
 
242
193
  const results = [];
243
194
  for (let i = 0; i < contracts.length; i++) {
@@ -258,23 +209,21 @@ export const executeViaGuardian = async (
258
209
 
259
210
  results.push(tx);
260
211
  } else {
261
- const simulationResult = await ctrl.callStatic.genericCall(
262
- contract,
263
- encoded,
264
- release.Avatar,
265
- ethValues[i],
266
- {
267
- from: await guardian.getAddress(),
268
- value: ethValues[i]
269
- }
270
- );
212
+ const simulationResult = await ctrl.callStatic.genericCall(contract, encoded, release.Avatar, ethValues[i], {
213
+ from: await guardian.getAddress()
214
+ });
271
215
  console.log("executing genericCall:", {
272
216
  sigHash,
217
+ contract,
273
218
  encoded,
274
219
  simulationResult
275
220
  });
276
221
  if (simulationResult[0] === false) throw new Error("simulation failed:" + contract);
277
- const tx = await ctrl.genericCall(contract, encoded, release.Avatar, ethValues[i]).then(printDeploy);
222
+ const tx = await ctrl
223
+ .genericCall(contract, encoded, release.Avatar, ethValues[i], {
224
+ gasLimit: 8000000
225
+ })
226
+ .then(printDeploy);
278
227
  // console.log("generic call events:", tx.events);
279
228
  results.push(tx);
280
229
  }
@@ -291,32 +240,24 @@ export const executeViaSafe = async (
291
240
  safeSignerOrNetwork?: Signer | string,
292
241
  isSimulation = false
293
242
  ) => {
294
- if (
295
- typeof safeSignerOrNetwork !== "object" &&
296
- !process.env.SAFEOWNER_PRIVATE_KEY
297
- ) {
243
+ if (typeof safeSignerOrNetwork !== "object" && !process.env.SAFEOWNER_PRIVATE_KEY) {
298
244
  throw new Error("safe signer is missing");
299
245
  }
300
246
 
301
- let safeSigner = new ethers.Wallet(
302
- process.env.SAFEOWNER_PRIVATE_KEY,
303
- new ethers.providers.CloudflareProvider()
304
- );
247
+ let safeSigner = new ethers.Wallet(process.env.SAFEOWNER_PRIVATE_KEY, new ethers.providers.CloudflareProvider());
305
248
  if (typeof safeSignerOrNetwork === "string") {
306
249
  switch (safeSignerOrNetwork) {
307
250
  case "mainnet":
308
251
  break;
309
252
  case "celo":
310
- safeSigner = new ethers.Wallet(
311
- process.env.SAFEOWNER_PRIVATE_KEY
312
- ).connect(
253
+ safeSigner = new ethers.Wallet(process.env.SAFEOWNER_PRIVATE_KEY).connect(
313
254
  new ethers.providers.JsonRpcProvider("https://forno.celo.org")
314
255
  );
315
256
  break;
316
257
  case "fuse":
317
- safeSigner = new ethers.Wallet(
318
- process.env.SAFEOWNER_PRIVATE_KEY
319
- ).connect(new ethers.providers.JsonRpcProvider("https://rpc.fuse.io"));
258
+ safeSigner = new ethers.Wallet(process.env.SAFEOWNER_PRIVATE_KEY).connect(
259
+ new ethers.providers.JsonRpcProvider("https://rpc.fuse.io")
260
+ );
320
261
  break;
321
262
  }
322
263
  } else if (safeSignerOrNetwork) {
@@ -351,11 +292,7 @@ export const executeViaSafe = async (
351
292
  const safeSdk = await Safe.create({ ethAdapter, safeAddress });
352
293
 
353
294
  let release: { [key: string]: any } = dao[networkName];
354
- const ctrl = await ethers.getContractAt(
355
- "Controller",
356
- release.Controller,
357
- null
358
- );
295
+ const ctrl = await ethers.getContractAt("Controller", release.Controller, null);
359
296
 
360
297
  const safeTransactionData: MetaTransactionData[] = [];
361
298
 
@@ -369,9 +306,9 @@ export const executeViaSafe = async (
369
306
  const [, target] = contract.split("_");
370
307
  const simulationResult = await ethers.provider.call({
371
308
  to: target,
372
- value: ethValues[i],
373
309
  data: encoded,
374
- from: safeAddress
310
+ from: safeAddress,
311
+ value: ethValues[i]
375
312
  });
376
313
 
377
314
  console.log("executing from guardians safe:", {
@@ -411,15 +348,13 @@ export const executeViaSafe = async (
411
348
  });
412
349
 
413
350
  const simulationResult = await ctrl.callStatic.genericCall(contract, encoded, release.Avatar, ethValues[i], {
414
- from: safeAddress,
415
- value: ethValues[i]
351
+ from: safeAddress
416
352
  });
417
353
  console.log("executing genericCall simulation result:", {
418
354
  sigHash,
419
355
  simulationResult
420
356
  });
421
- if (isSimulation === true && simulationResult[0] === false)
422
- throw new Error("simulation failed:" + contract);
357
+ if (isSimulation === true && simulationResult[0] === false) throw new Error("simulation failed:" + contract);
423
358
  const genericEncode = ctrl.interface.encodeFunctionData("genericCall", [
424
359
  contract,
425
360
  encoded,
@@ -428,7 +363,7 @@ export const executeViaSafe = async (
428
363
  ]);
429
364
  safeTransactionData.push({
430
365
  to: ctrl.address,
431
- value: ethValues[i],
366
+ value: "0",
432
367
  data: genericEncode
433
368
  });
434
369
  }
@@ -465,19 +400,12 @@ export const verifyContract = async (
465
400
  proxyName?: string,
466
401
  forcedConstructorArguments?: string
467
402
  ) => {
468
- let networkProvider = networkName.includes("-")
469
- ? networkName.split("-")[1]
470
- : "fuse";
471
- networkProvider =
472
- networkProvider === "mainnet" ? "ethereum" : networkProvider;
403
+ let networkProvider = networkName.includes("-") ? networkName.split("-")[1] : "fuse";
404
+ networkProvider = networkProvider === "mainnet" ? "ethereum" : networkProvider;
473
405
  console.log("truffle compile...");
474
406
  await exec("npx truffle compile");
475
- const cmd = `npx truffle run verify ${
476
- proxyName ? "--custom-proxy " + proxyName : ""
477
- } ${contractName}@${address} ${
478
- forcedConstructorArguments
479
- ? "--forceConstructorArgs string:" + forcedConstructorArguments.slice(2)
480
- : ""
407
+ const cmd = `npx truffle run verify ${proxyName ? "--custom-proxy " + proxyName : ""} ${contractName}@${address} ${
408
+ forcedConstructorArguments ? "--forceConstructorArgs string:" + forcedConstructorArguments.slice(2) : ""
481
409
  } --network ${networkProvider}`;
482
410
  console.log("running...:", cmd);
483
411
  await exec(cmd).then(({ stdout, stderr }) => {