@gooddollar/goodprotocol 2.1.4 → 2.2.0-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 (292) hide show
  1. package/artifacts/abis/IdentityV4.min.json +1 -0
  2. package/artifacts/contracts/DAOStackInterfaces.sol/Avatar.dbg.json +1 -1
  3. package/artifacts/contracts/DAOStackInterfaces.sol/Controller.dbg.json +1 -1
  4. package/artifacts/contracts/DAOStackInterfaces.sol/GlobalConstraintInterface.dbg.json +1 -1
  5. package/artifacts/contracts/DAOStackInterfaces.sol/IntVoteInterface.dbg.json +1 -1
  6. package/artifacts/contracts/DAOStackInterfaces.sol/ReputationInterface.dbg.json +1 -1
  7. package/artifacts/contracts/DAOStackInterfaces.sol/SchemeRegistrar.dbg.json +1 -1
  8. package/artifacts/contracts/IUniswapV3.sol/INonfungiblePositionManager.dbg.json +1 -1
  9. package/artifacts/contracts/IUniswapV3.sol/IUniswapV3Pool.dbg.json +1 -1
  10. package/artifacts/contracts/Interfaces.sol/AggregatorV3Interface.dbg.json +1 -1
  11. package/artifacts/contracts/Interfaces.sol/ERC20.dbg.json +1 -1
  12. package/artifacts/contracts/Interfaces.sol/IAaveIncentivesController.dbg.json +1 -1
  13. package/artifacts/contracts/Interfaces.sol/IAdminWallet.dbg.json +1 -1
  14. package/artifacts/contracts/Interfaces.sol/IDonationStaking.dbg.json +1 -1
  15. package/artifacts/contracts/Interfaces.sol/IERC2917.dbg.json +1 -1
  16. package/artifacts/contracts/Interfaces.sol/IFirstClaimPool.dbg.json +1 -1
  17. package/artifacts/contracts/Interfaces.sol/IGoodDollar.dbg.json +1 -1
  18. package/artifacts/contracts/Interfaces.sol/IGoodStaking.dbg.json +1 -1
  19. package/artifacts/contracts/Interfaces.sol/IHasRouter.dbg.json +1 -1
  20. package/artifacts/contracts/Interfaces.sol/IIdentity.dbg.json +1 -1
  21. package/artifacts/contracts/Interfaces.sol/IIdentityV2.dbg.json +1 -1
  22. package/artifacts/contracts/Interfaces.sol/ILendingPool.dbg.json +1 -1
  23. package/artifacts/contracts/Interfaces.sol/IMultichainRouter.dbg.json +1 -1
  24. package/artifacts/contracts/Interfaces.sol/INameService.dbg.json +1 -1
  25. package/artifacts/contracts/Interfaces.sol/IQuoterV2.dbg.json +1 -1
  26. package/artifacts/contracts/Interfaces.sol/ISwapRouter.dbg.json +1 -1
  27. package/artifacts/contracts/Interfaces.sol/IUBIScheme.dbg.json +1 -1
  28. package/artifacts/contracts/Interfaces.sol/ProxyAdmin.dbg.json +1 -1
  29. package/artifacts/contracts/Interfaces.sol/Reserve.dbg.json +1 -1
  30. package/artifacts/contracts/Interfaces.sol/Staking.dbg.json +1 -1
  31. package/artifacts/contracts/Interfaces.sol/Uniswap.dbg.json +1 -1
  32. package/artifacts/contracts/Interfaces.sol/UniswapFactory.dbg.json +1 -1
  33. package/artifacts/contracts/Interfaces.sol/UniswapPair.dbg.json +1 -1
  34. package/artifacts/contracts/Interfaces.sol/cERC20.dbg.json +1 -1
  35. package/artifacts/contracts/MentoInterfaces.sol/IBancorExchangeProvider.dbg.json +1 -1
  36. package/artifacts/contracts/MentoInterfaces.sol/IBroker.dbg.json +1 -1
  37. package/artifacts/contracts/MentoInterfaces.sol/IGoodDollarExchangeProvider.dbg.json +1 -1
  38. package/artifacts/contracts/MentoInterfaces.sol/IGoodDollarExpansionController.dbg.json +1 -1
  39. package/artifacts/contracts/MentoInterfaces.sol/IMentoReserve.dbg.json +1 -1
  40. package/artifacts/contracts/MentoInterfaces.sol/ITradingLimits.dbg.json +1 -1
  41. package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.dbg.json +1 -1
  42. package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
  43. package/artifacts/contracts/fuseFaucet/FuseFaucetV2.sol/FuseFaucetV2.dbg.json +1 -1
  44. package/artifacts/contracts/fuseFaucet/SuperfluidFacuet.sol/SuperfluidFaucet.dbg.json +1 -1
  45. package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
  46. package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
  47. package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
  48. package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
  49. package/artifacts/contracts/governance/MultiBaseGovernanceShareField.sol/MultiBaseGovernanceShareField.dbg.json +1 -1
  50. package/artifacts/contracts/governance/Reputation.sol/Reputation.dbg.json +1 -1
  51. package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
  52. package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.dbg.json +1 -1
  53. package/artifacts/contracts/identity/IdentityV3.sol/IdentityV3.dbg.json +1 -1
  54. package/artifacts/contracts/identity/IdentityV3.sol/IdentityV3.json +2 -2
  55. package/artifacts/contracts/identity/IdentityV4.sol/IdentityV4.dbg.json +4 -0
  56. package/artifacts/contracts/identity/IdentityV4.sol/IdentityV4.json +1162 -0
  57. package/artifacts/contracts/invite/InvitesFuseV2.sol/InvitesFuseV2.dbg.json +1 -1
  58. package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.dbg.json +1 -1
  59. package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.dbg.json +1 -1
  60. package/artifacts/contracts/invite/OneTimeReward.sol/OneTimeReward.dbg.json +1 -1
  61. package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
  62. package/artifacts/contracts/mocks/AaveUSDMockOracle.sol/AaveUSDMockOracle.dbg.json +1 -1
  63. package/artifacts/contracts/mocks/BatUSDMockOracle.sol/BatUSDMockOracle.dbg.json +1 -1
  64. package/artifacts/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTest.dbg.json +1 -1
  65. package/artifacts/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTestHelper.dbg.json +1 -1
  66. package/artifacts/contracts/mocks/CompUsdMockOracle.sol/CompUSDMockOracle.dbg.json +1 -1
  67. package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
  68. package/artifacts/contracts/mocks/DaiEthPriceMockOracle.sol/DaiEthPriceMockOracle.dbg.json +1 -1
  69. package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
  70. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +1 -1
  71. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +1 -1
  72. package/artifacts/contracts/mocks/EthUSDMockOracle.sol/EthUSDMockOracle.dbg.json +1 -1
  73. package/artifacts/contracts/mocks/FeesFormularMock.sol/FeesFormulaMock.dbg.json +1 -1
  74. package/artifacts/contracts/mocks/GasPriceMockOracle.sol/GasPriceMockOracle.dbg.json +1 -1
  75. package/artifacts/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTest.dbg.json +1 -1
  76. package/artifacts/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTestHelper.dbg.json +1 -1
  77. package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
  78. package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
  79. package/artifacts/contracts/mocks/IdentityMock.sol/IdentityMock.dbg.json +1 -1
  80. package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
  81. package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
  82. package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.dbg.json +1 -1
  83. package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
  84. package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
  85. package/artifacts/contracts/mocks/PayableMock.sol/PayableMock.dbg.json +1 -1
  86. package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
  87. package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
  88. package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
  89. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
  90. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
  91. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.dbg.json +1 -1
  92. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.dbg.json +1 -1
  93. package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
  94. package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
  95. package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
  96. package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
  97. package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
  98. package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
  99. package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
  100. package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
  101. package/artifacts/contracts/reserve/CeloDistributionHelper.sol/CeloDistributionHelper.dbg.json +1 -1
  102. package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.dbg.json +1 -1
  103. package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
  104. package/artifacts/contracts/reserve/GenericDistributionHelper.sol/GenericDistributionHelper.dbg.json +1 -1
  105. package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
  106. package/artifacts/contracts/reserve/GoodReserveCDai.sol/ContributionCalc.dbg.json +1 -1
  107. package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.dbg.json +1 -1
  108. package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
  109. package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.dbg.json +1 -1
  110. package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
  111. package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.dbg.json +1 -1
  112. package/artifacts/contracts/staking/FuseStakingV3.sol/IConsensus.dbg.json +1 -1
  113. package/artifacts/contracts/staking/FuseStakingV3.sol/PegSwap.dbg.json +1 -1
  114. package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.dbg.json +1 -1
  115. package/artifacts/contracts/staking/SimpleStaking.sol/SimpleStaking.dbg.json +1 -1
  116. package/artifacts/contracts/staking/SimpleStakingV2.sol/SimpleStakingV2.dbg.json +1 -1
  117. package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.dbg.json +1 -1
  118. package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
  119. package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
  120. package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.dbg.json +1 -1
  121. package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
  122. package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
  123. package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.dbg.json +1 -1
  124. package/artifacts/contracts/staking/utils/Math64X64.sol/Math64x64.dbg.json +1 -1
  125. package/artifacts/contracts/token/ERC20PresetMinterPauserUpgradeable.sol/ERC20PresetMinterPauserUpgradeable.dbg.json +1 -1
  126. package/artifacts/contracts/token/ERC677.sol/ERC677.dbg.json +1 -1
  127. package/artifacts/contracts/token/ERC677.sol/ERC677Receiver.dbg.json +1 -1
  128. package/artifacts/contracts/token/GoodDollar.sol/GoodDollar.dbg.json +1 -1
  129. package/artifacts/contracts/token/GoodDollar2.sol/GoodDollar2.dbg.json +1 -1
  130. package/artifacts/contracts/token/IFeesFormula.sol/IFeesFormula.dbg.json +1 -1
  131. package/artifacts/contracts/token/MultichainFeeFormula.sol/MultichainFeeFormula.dbg.json +1 -1
  132. package/artifacts/contracts/token/superfluid/ERC20Permit.sol/ERC20Permit.dbg.json +1 -1
  133. package/artifacts/contracts/token/superfluid/ERC20Permit.sol/SelfApprove.dbg.json +1 -1
  134. package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/IGoodDollarCustom.dbg.json +1 -1
  135. package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/ISuperGoodDollar.dbg.json +1 -1
  136. package/artifacts/contracts/token/superfluid/ISuperToken.sol/ISuperToken.dbg.json +1 -1
  137. package/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.dbg.json +1 -1
  138. package/artifacts/contracts/token/superfluid/SuperToken.sol/SuperToken.dbg.json +1 -1
  139. package/artifacts/contracts/token/superfluid/SuperfluidToken.sol/SuperfluidToken.dbg.json +1 -1
  140. package/artifacts/contracts/token/superfluid/UUPSProxiable.sol/UUPSProxiable.dbg.json +1 -1
  141. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/Proxy.dbg.json +1 -1
  142. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSProxy.dbg.json +1 -1
  143. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSUtils.dbg.json +1 -1
  144. package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
  145. package/artifacts/contracts/ubi/UBISchemeV2.sol/UBISchemeV2.dbg.json +1 -1
  146. package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
  147. package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.dbg.json +1 -1
  148. package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
  149. package/artifacts/contracts/utils/BulkProof.sol/BulkProof.dbg.json +1 -1
  150. package/artifacts/contracts/utils/BulkWhitelist.sol/BulkWhitelist.dbg.json +1 -1
  151. package/artifacts/contracts/utils/BuyAndBridgeHelper.sol/BuyAndBridgeHelper.dbg.json +1 -1
  152. package/artifacts/contracts/utils/BuyFromReserveHelper.sol/BuyFromReserveHelper.dbg.json +1 -1
  153. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDClone.dbg.json +1 -1
  154. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDCloneFactory.dbg.json +1 -1
  155. package/artifacts/contracts/utils/BuyGDClone.sol/DonateGDClone.dbg.json +1 -1
  156. package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
  157. package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
  158. package/artifacts/contracts/utils/DSMath.sol/DSMath.dbg.json +1 -1
  159. package/artifacts/contracts/utils/DataTypes.sol/DataTypes.dbg.json +1 -1
  160. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/EternalStorage.dbg.json +1 -1
  161. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/FuseOldBridgeKill.dbg.json +1 -1
  162. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/IUpgradeabilityOwnerStorage.dbg.json +1 -1
  163. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Initializable.dbg.json +1 -1
  164. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Ownable.dbg.json +1 -1
  165. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Upgradeable.dbg.json +1 -1
  166. package/artifacts/contracts/utils/GDFaucet.sol/GDFaucet.dbg.json +1 -1
  167. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.dbg.json +1 -1
  168. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/IRouter.dbg.json +1 -1
  169. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/PausableControl.dbg.json +1 -1
  170. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.dbg.json +1 -1
  171. package/artifacts/contracts/utils/IdentityFix.sol/IdentityFix.dbg.json +1 -1
  172. package/artifacts/contracts/utils/MultiCall.sol/Multicall.dbg.json +1 -1
  173. package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.dbg.json +1 -1
  174. package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
  175. package/artifacts/contracts/utils/OneTimePayments.sol/OneTimePayments.dbg.json +1 -1
  176. package/artifacts/contracts/utils/OneTimePaymentsV2.sol/OneTimePaymentsV2.dbg.json +1 -1
  177. package/artifacts/contracts/utils/ProtoclUpgradeV4Mento.sol/MentoExchange.dbg.json +1 -1
  178. package/artifacts/contracts/utils/ProtoclUpgradeV4Mento.sol/ProtocolUpgradeV4Mento.dbg.json +1 -1
  179. package/artifacts/contracts/utils/ProtocolUpgrade.sol/OldMarketMaker.dbg.json +1 -1
  180. package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.dbg.json +1 -1
  181. package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
  182. package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.dbg.json +1 -1
  183. package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.dbg.json +1 -1
  184. package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.dbg.json +1 -1
  185. package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.dbg.json +1 -1
  186. package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
  187. package/contracts/identity/IdentityV3.sol +0 -3
  188. package/contracts/identity/IdentityV4.sol +578 -0
  189. package/hardhat.config.ts +3 -4
  190. package/package.json +8 -4
  191. package/releases/deployment.json +691 -1
  192. package/test/governance/ClaimersDistribution.test.ts +1 -1
  193. package/test/governance/CompoundVotingMachine.castvote.test.ts +30 -30
  194. package/test/helpers.ts +76 -195
  195. package/test/identity/IdentityV3.test.ts +53 -129
  196. package/test/identity/IdentityV4.test.ts +454 -0
  197. package/test/reserve/GenericDistributionHelper.e2e.test.ts +445 -0
  198. package/test/utils/AdminWallet.test.ts +14 -15
  199. package/types/contracts/identity/IdentityV4.ts +2001 -0
  200. package/types/contracts/identity/index.ts +1 -0
  201. package/types/contracts/utils/UpdateReserveRatio.sol/MentoExchange.ts +81 -0
  202. package/types/contracts/utils/UpdateReserveRatio.sol/UpdateReserveRatio.ts +134 -0
  203. package/types/contracts/utils/UpdateReserveRatio.sol/index.ts +5 -0
  204. package/types/contracts/utils/UpdateReserveRatioAfterXDC.sol/UpdateReserveRatioAfterXDC.ts +7 -2
  205. package/types/contracts/utils/index.ts +2 -0
  206. package/types/factories/contracts/identity/IdentityV3__factory.ts +1 -1
  207. package/types/factories/contracts/identity/IdentityV4__factory.ts +1213 -0
  208. package/types/factories/contracts/identity/index.ts +1 -0
  209. package/types/factories/contracts/utils/UpdateReserveRatio.sol/MentoExchange__factory.ts +39 -0
  210. package/types/factories/contracts/utils/UpdateReserveRatio.sol/UpdateReserveRatio__factory.ts +113 -0
  211. package/types/factories/contracts/utils/UpdateReserveRatio.sol/index.ts +5 -0
  212. package/types/factories/contracts/utils/UpdateReserveRatioAfterXDC.sol/UpdateReserveRatioAfterXDC__factory.ts +9 -15
  213. package/types/factories/contracts/utils/index.ts +1 -0
  214. package/types/hardhat.d.ts +27 -0
  215. package/types/index.ts +4 -0
  216. package/scripts/ProxyFactory.json +0 -4425
  217. package/scripts/analytics/activeGDStakers.ts +0 -188
  218. package/scripts/analytics/activeStakers.ts +0 -25
  219. package/scripts/analytics/activeUsersCount.ts +0 -156
  220. package/scripts/analytics/activeWalletsStats.ts +0 -301
  221. package/scripts/analytics/checkActiveWallets.ts +0 -60
  222. package/scripts/analytics/checkBridgeBalances.ts +0 -442
  223. package/scripts/analytics/claimIncidentStats.ts +0 -98
  224. package/scripts/analytics/faucetStats.ts +0 -130
  225. package/scripts/analytics/gdinflow.ts +0 -57
  226. package/scripts/analytics/goodHolders.ts +0 -46
  227. package/scripts/analytics/goodgiveback.ts +0 -64
  228. package/scripts/analytics/p2pTxs.ts +0 -564
  229. package/scripts/analytics/stuckgd.ts +0 -70
  230. package/scripts/analytics/tokenInOutStats.ts +0 -48
  231. package/scripts/analytics/whitelistsyncIssue.ts +0 -87
  232. package/scripts/bulkProof.ts +0 -202
  233. package/scripts/bulkWhitelist.ts +0 -31
  234. package/scripts/deployGnosisSafe.ts +0 -111
  235. package/scripts/fetchOrDeployProxyFactory.ts +0 -46
  236. package/scripts/fv.ts +0 -263
  237. package/scripts/gdx/gdxAirdropCalculation.ts +0 -479
  238. package/scripts/getFounders.ts +0 -32
  239. package/scripts/governance/README.md +0 -70
  240. package/scripts/governance/airdropCalculation.ts +0 -1119
  241. package/scripts/governance/airdropCalculationRecover.ts +0 -416
  242. package/scripts/governance/airdropCalculationSorted.ts +0 -438
  243. package/scripts/governance/goodCheckpointSorted.ts +0 -300
  244. package/scripts/keeper/fishInactive.ts +0 -47
  245. package/scripts/minimize.sh +0 -17
  246. package/scripts/multichain-deploy/0_proxyFactory-deploy.ts +0 -131
  247. package/scripts/multichain-deploy/1_basicdao-deploy.ts +0 -294
  248. package/scripts/multichain-deploy/2_helpers-deploy.ts +0 -152
  249. package/scripts/multichain-deploy/2b_otp-deploy.ts +0 -73
  250. package/scripts/multichain-deploy/3_gdSavings-deploy.ts +0 -190
  251. package/scripts/multichain-deploy/4_ubi-deploy.ts +0 -129
  252. package/scripts/multichain-deploy/5_gov-deploy.ts +0 -179
  253. package/scripts/multichain-deploy/6_testnetFaucet.ts +0 -85
  254. package/scripts/multichain-deploy/7_superfluidfaucet-deploy.ts +0 -123
  255. package/scripts/multichain-deploy/8_disthelper-deploy.ts +0 -152
  256. package/scripts/multichain-deploy/createUniswapTestPools.ts +0 -163
  257. package/scripts/multichain-deploy/flattened/Avatar.sol +0 -913
  258. package/scripts/multichain-deploy/flattened/Controller.sol +0 -1891
  259. package/scripts/multichain-deploy/flattened/FeeFormula.sol +0 -1290
  260. package/scripts/multichain-deploy/fulldeploy.sh +0 -26
  261. package/scripts/multichain-deploy/helpers.ts +0 -647
  262. package/scripts/multichain-deploy/multichainWrapper-deploy.ts +0 -59
  263. package/scripts/multichain-deploy/verifyEtherscan.ts +0 -177
  264. package/scripts/proposals/gip-14_1.ts +0 -251
  265. package/scripts/proposals/gip-15.ts +0 -427
  266. package/scripts/proposals/gip-25-xdc-upgrade-ubi.ts +0 -746
  267. package/scripts/proposals/gips-14_1.md +0 -29
  268. package/scripts/proposals/hack-ubi-recovery.ts +0 -414
  269. package/scripts/proposals/identityAuthPeriod.ts +0 -229
  270. package/scripts/proposals/reserveRestore.ts +0 -474
  271. package/scripts/proposals/updateDistHelper.ts +0 -180
  272. package/scripts/proposals/v4Upgrade.ts +0 -845
  273. package/scripts/releaser.js +0 -24
  274. package/scripts/staking/stakersGdRewardsCalculation.ts +0 -64
  275. package/scripts/upgradeScheme.ts +0 -97
  276. package/scripts/upgradeToV2/upgradeToV2.ts +0 -853
  277. package/scripts/upgradeToV2/upgradeToV2Recover.ts +0 -939
  278. package/scripts/upgradeToV3/v3-fix.ts +0 -120
  279. package/scripts/upgradeToV3/v3-fuse-multichain.ts +0 -117
  280. package/scripts/upgradeToV3/v3-upgrade.ts +0 -219
  281. package/scripts/upgrades/celo-defi-ubi-deploy.ts +0 -184
  282. package/scripts/upgrades/identity-upgrade.ts +0 -126
  283. package/scripts/upgrades/multichain-formula-upgrade.ts +0 -143
  284. package/scripts/upgrades/multichain-temp-fix.ts +0 -129
  285. package/scripts/upgrades/restoreFunds.ts +0 -91
  286. package/scripts/upgrades/superfluid-nft-celo-gas-token.ts +0 -159
  287. package/scripts/upgrades/transferDaoToGuardians.ts +0 -80
  288. package/scripts/upgrades/upgradeAdminWallet.ts +0 -29
  289. package/scripts/upgrades/upgradeFaucet.ts +0 -46
  290. package/scripts/utils.ts +0 -50
  291. package/scripts/verify.ts +0 -67
  292. package/scripts/voltageswaps.ts +0 -46
@@ -1,300 +0,0 @@
1
- /**
2
- * this version is for testing purposes only, to test greputation initial rootstate with the fixed merkle v2
3
- * which uses sorted pairs so no position is required and it uses double hash for preimage attack
4
- * future blockchain state hashes should be recalculated and created using similar method done here
5
- */
6
- import { get, range, chunk, flatten, mergeWith, sortBy, uniq } from "lodash";
7
- import fs from "fs";
8
- import { MerkleTree } from "merkletreejs";
9
- import PromisePool from "async-promise-pool";
10
- import { ethers as Ethers } from "hardhat";
11
- import { BigNumber } from "ethers";
12
-
13
- const quantile = (sorted, q) => {
14
- const pos = (sorted.length - 1) * q;
15
- const base = Math.floor(pos);
16
-
17
- let sum = BigNumber.from(0);
18
- for (let i = 0; i < base; i++) sum = sum.add(sorted[i]);
19
-
20
- return sum;
21
- };
22
-
23
- export const airdrop = (ethers: typeof Ethers) => {
24
- const fuseProvider = new ethers.providers.JsonRpcProvider("https://rpc.fuse.io");
25
-
26
- const zxfastProvider = new ethers.providers.JsonRpcProvider("https://eth-eu.0xfast.com/rpc/free");
27
-
28
- const cfProvider = new ethers.providers.InfuraProvider(1, "143f9cf968fe4c3da0db77ff525e0da4");
29
- const goodActiveVotes = async (network = "fuse") => {
30
- let balances = [];
31
-
32
- const EPOCH = 60 * 60 * 24;
33
- const pool = new PromisePool({ concurrency: 30 });
34
- const epochs = range(1646844945, (Date.now() / 1000).toFixed(0), EPOCH);
35
- const graphName = network === "fuse" ? "gooddollarfuse2" : "goodsubgraphs";
36
- const graphUrl = `https://api.thegraph.com/subgraphs/name/gooddollar/${graphName}`;
37
-
38
- const graphQuery = async (start, skip, step = EPOCH) => {
39
- const query = `{
40
- goodBalances(first: 1000 skip:${skip} where: { memberSince_gte: ${start} memberSince_lt:${start + step} }) {
41
- id
42
- coreBalance
43
- totalVotes
44
- activeVotes
45
- blockchainsBalance
46
- }
47
- }`;
48
- try {
49
- const { data = {}, errors } = await fetch(graphUrl, {
50
- method: "POST",
51
- headers: {
52
- "Content-Type": "application/json"
53
- },
54
- body: JSON.stringify({ query })
55
- }).then(_ => _.json());
56
- errors && console.log({ errors });
57
- if (errors?.[0]?.message === "The `skip` argument must be between 0 and 5000, but is 6000") {
58
- throw new Error("skip");
59
- }
60
- if (data?.goodBalances?.length === 1000) {
61
- return data.goodBalances.concat(await graphQuery(start, skip + 1000, step));
62
- }
63
- return data.goodBalances || [];
64
- } catch (error) {
65
- if (error.message === "skip") throw error;
66
- console.log({ query, error });
67
- return [];
68
- }
69
- };
70
-
71
- const poolAdd = (start, step) => {
72
- pool.add(async () => {
73
- try {
74
- const goodBalances = await graphQuery(start, 0, step);
75
- balances = balances.concat(goodBalances);
76
- console.log({ curDate: start, step, records: goodBalances.length });
77
- } catch (e) {
78
- if (e.message === "skip") {
79
- const newstep = Number((step / 4).toFixed(0));
80
- console.log("creating sub epochs", {
81
- start,
82
- end: start + step,
83
- newstep
84
- });
85
-
86
- const subepochs = range(start, start + step, newstep);
87
- subepochs.forEach(e => poolAdd(e, newstep));
88
- }
89
- }
90
- });
91
- };
92
- epochs.forEach(e => {
93
- poolAdd(e, EPOCH);
94
- });
95
-
96
- await pool.all();
97
- console.log(`total ${network} GOOD Holders:`, balances.length, {
98
- uniques: uniq(balances.map(_ => _.id)).length,
99
- delegatees: uniq(balances.filter(_ => Number(_.coreBalance) < Number(_.totalVotes)).map(_ => _.id)).length,
100
- sample: balances.slice(0, 5)
101
- });
102
-
103
- const treeData = {};
104
-
105
- console.log("calculating leaves hashes...");
106
- balances.forEach(record => {
107
- treeData[record.id] = {
108
- address: record.id,
109
- rep: record.activeVotes,
110
- hash: ethers.utils.keccak256(
111
- ethers.utils.keccak256(
112
- ethers.utils.defaultAbiCoder.encode(["address", "uint256"], [record.id, record.activeVotes])
113
- )
114
- )
115
- };
116
- });
117
- fs.writeFileSync(
118
- `goodCheckpoints/goodCheckpoint_${network}.json`,
119
- JSON.stringify({ treeData, balances, until: Date.now() })
120
- );
121
- console.log(balances.filter(_ => Number(_.coreBalance) < Number(_.totalVotes)));
122
- };
123
-
124
- const collectAirdropData = async () => {
125
- const calcGoodMints = async () => {
126
- const step = 10000;
127
- const START_BLOCK = 14344739;
128
-
129
- const LAST_BLOCK = await good.provider.getBlockNumber();
130
- console.log({ LAST_BLOCK });
131
- const blocks = range(START_BLOCK, LAST_BLOCK, step);
132
- const allLogs = [];
133
- for (let blockChunk of chunk(blocks, 10)) {
134
- // Get the filter (the second null could be omitted)
135
- const ps = blockChunk.map(async (bc: number) => {
136
- const logs = await good.queryFilter(good.filters.Mint(), bc, Math.min(bc + step - 1, LAST_BLOCK)).catch(e => {
137
- console.log("block transfer logs failed retrying...", bc);
138
- return good.queryFilter(good.filters.Mint(), bc, Math.min(bc + step - 1, LAST_BLOCK));
139
- });
140
- const claimedLogs = await good
141
- .queryFilter(good.filters.StateHashProof(), bc, Math.min(bc + step - 1, LAST_BLOCK))
142
- .catch(e => {
143
- console.log("block transfer logs failed retrying...", bc);
144
- return good.queryFilter(good.filters.StateHashProof(), bc, Math.min(bc + step - 1, LAST_BLOCK));
145
- });
146
- console.log("found logs:", claimedLogs.length, logs.length, bc);
147
- return logs.concat(claimedLogs);
148
- });
149
- let chunkLogs = flatten(await Promise.all(ps));
150
- console.log("chunk logs: ", chunkLogs.length, { blockChunk });
151
- allLogs.push(chunkLogs);
152
- }
153
- const logs = flatten(allLogs);
154
-
155
- const mints = {};
156
- const claims = {};
157
- const result = {};
158
- console.log("logs found:", logs.length);
159
- let totalMints = ethers.constants.Zero;
160
- logs.forEach(l => {
161
- if (l.event === "Mint") {
162
- mints[l.args._to.toLowerCase()] = (mints[l.args._to.toLowerCase()] || BigNumber.from("0")).add(
163
- l.args._amount
164
- );
165
- totalMints = totalMints.add(l.args._amount);
166
- } else claims[l.args.user.toLowerCase()] = l.args.repBalance.toString();
167
- });
168
- Object.entries(mints).forEach(([k, v]) => (result[k] = { claim: "0", ...result[k], mint: v.toString() }));
169
- Object.entries(claims).forEach(([k, v]) => (result[k] = { mint: "0", ...result[k], claim: v.toString() }));
170
- console.log({ result, totalMints: totalMints.toString() });
171
- fs.writeFileSync("goodCheckpointMainnet.json", JSON.stringify(result));
172
- };
173
-
174
- // await goodActiveVotes();
175
- await goodActiveVotes("mainnet");
176
- // await calcGoodMints();
177
- };
178
-
179
- const buildMerkleTree = async () => {
180
- const buildTree = async (network = "fuse") => {
181
- const good = await ethers
182
- .getContractAt("GReputation", "0x603B8C0F110E037b51A381CBCacAbb8d6c6E4543")
183
- .then(_ => _.connect(network === "fuse" ? fuseProvider : cfProvider));
184
-
185
- const checkpoint = JSON.parse(fs.readFileSync(`goodCheckpoints/goodCheckpoint_${network}.json`).toString());
186
-
187
- const treeData = checkpoint.treeData;
188
-
189
- let toTree: Array<[string, BigNumber]> = Object.entries(treeData).map(([k, v]) => {
190
- return [k, BigNumber.from((v as any).rep)];
191
- });
192
-
193
- toTree = toTree.sort((a, b) => (a[1].gte(b[1]) ? 1 : -1)).reverse();
194
- // console.log({ toTree });
195
- // const topContracts = toTree.filter(_ => _[2] === true);
196
- const totalReputation = toTree.reduce((c, a) => c.add(a[1]), BigNumber.from(0));
197
- const totalSupply = (await good.totalSupply()).toString();
198
- console.log({
199
- totalSupply,
200
- totalReputation: totalReputation.toString(),
201
- numberOfAccounts: toTree.length
202
- });
203
-
204
- const sorted = toTree.map(_ => _[1]);
205
- console.log(toTree.slice(0, 10).map(_ => [_[0], _[1]]));
206
- // fs.writeFileSync(`${folder}/reptree.json`, JSON.stringify(toTree));
207
- console.log("Reputation Distribution");
208
- [0.001, 0.01, 0.1, 0.5].forEach(q => {
209
- const quantileRep = quantile(sorted, q);
210
- console.log({
211
- precentile: q * 100 + "%",
212
- addresses: (sorted.length * q).toFixed(0),
213
- quantileRep,
214
- rep: Number(quantileRep.div(1e10).toString()) / Number(totalReputation.div(1e10).toString())
215
- });
216
- });
217
- const items = Object.values(treeData);
218
- const elements = items.map((e: any) => e.hash);
219
- console.log("creating merkletree sorted...", elements.length);
220
- //NOTICE: we use a non sorted merkletree to save generation time, this requires also a different proof verification algorithm which
221
- //is not in the default openzeppelin library
222
- const merkleTree = new MerkleTree(elements, ethers.utils.keccak256, {
223
- sortPairs: true
224
- });
225
-
226
- // get the merkle root
227
- // returns 32 byte buffer
228
- const merkleRoot = merkleTree.getHexRoot();
229
- console.log("Merkle Root:", merkleRoot);
230
-
231
- // generate merkle proof
232
- // returns array of 32 byte buffers
233
- const proof = merkleTree.getHexProof(elements[0]);
234
- const validProof = merkleTree.verify(proof, elements[0], merkleRoot);
235
-
236
- const lastProof = merkleTree.getHexProof(elements[elements.length - 1]);
237
- const lastValidProof = merkleTree.verify(lastProof, elements[elements.length - 1], merkleRoot);
238
-
239
- //check for possible address preimage
240
- const danger = (merkleTree.getHexLayers() as any).map(_ => _.find(_ => _.startsWith("0x000000")));
241
-
242
- console.log({
243
- danger,
244
- merkleRoot,
245
- proof,
246
- validProof,
247
- lastProof,
248
- lastValidProof,
249
- proofFor: items[0],
250
- lastProofFor: items[items.length - 1],
251
- index: elements.length,
252
- leaf: elements[elements.length - 1].toString("hex")
253
- });
254
-
255
- checkpoint.merkleRoot = merkleRoot;
256
- checkpoint.totalSupply = totalSupply;
257
- fs.writeFileSync("goodCheckpoints/goodCheckpoint_fuse.json", JSON.stringify(checkpoint));
258
- };
259
-
260
- await buildTree();
261
- await buildTree("mainnet");
262
- };
263
-
264
- const getProof = addr => {
265
- const { treeData, merkleRoot } = JSON.parse(fs.readFileSync("airdrop/airdrop.json").toString());
266
-
267
- let entries = Object.entries(treeData as Tree);
268
- let elements = entries.map(e => Buffer.from(e[1].hash.slice(2), "hex"));
269
-
270
- console.log("creating merkletree sorted pairs...", elements.length);
271
- const merkleTree = new MerkleTree(elements, ethers.utils.keccak256, {
272
- sortPairs: true
273
- });
274
-
275
- const calcMerkleRoot = merkleTree.getHexRoot();
276
- console.log("merkleroots:", {
277
- fromFile: merkleRoot,
278
- calculated: calcMerkleRoot
279
- });
280
-
281
- const addrData = treeData[addr] || treeData[addr.toLowerCase()];
282
- const proofFor = Buffer.from(addrData.hash.slice(2), "hex");
283
-
284
- const proof = merkleTree.getHexProof(proofFor);
285
- const proofIndex = elements.findIndex(_ => "0x" + _.toString("hex") === addrData.hash) + 1;
286
-
287
- console.log({ proofIndex, proof, [addr]: addrData });
288
- console.log("checkProof:", merkleTree.verify(proof, proofFor, calcMerkleRoot));
289
- };
290
-
291
- return { buildMerkleTree, collectAirdropData, getProof };
292
- };
293
-
294
- const _timer = async (name, promise) => {
295
- const start = Date.now();
296
- const res = await promise;
297
- const milis = Date.now() - start;
298
- console.log(`done task ${name} in ${milis / 1000} seconds`);
299
- return res;
300
- };
@@ -1,47 +0,0 @@
1
- import { range, chunk } from "lodash";
2
- import { ethers as Ethers } from "hardhat";
3
-
4
- const ONE_DAY = 24 * 60 * 60;
5
-
6
- const main = async () => {
7
- const signer = (await Ethers.getSigners())[0];
8
- console.log("signer:", signer.address);
9
- const ubiScheme = new Ethers.Contract("0xD7aC544F8A570C4d8764c3AAbCF6870CBD960D0D", [
10
- "function fishMulti(address[] tofish)"
11
- ]).connect(signer);
12
- const twoWeeksAgo = parseInt((Date.now() / 1000).toFixed(0)) - 24 * 60 * 60 * 14;
13
-
14
- const daysAgo: number[] = range(0, 180, 1);
15
- let curDay = twoWeeksAgo;
16
- for (let day of daysAgo) {
17
- const query = `
18
- {
19
- walletStats(first:1000, where: { lastClaimed_lt: ${curDay},lastClaimed_gt: ${
20
- curDay - 24 * 60 * 60
21
- } isActiveUser: true }) {
22
- id
23
- }
24
- }
25
- `;
26
-
27
- console.log("fetching inactive users since:", { curDay, day }, JSON.stringify({ query }));
28
- const { walletStats } = await fetch("https://api.thegraph.com/subgraphs/name/gooddollar/gooddollarfuse", {
29
- method: "post",
30
- body: JSON.stringify({ query }),
31
- headers: { "Content-Type": "application/json" }
32
- }).then(_ => _.json());
33
-
34
- console.log("got inactive wallets:", walletStats.length);
35
- const accounts = walletStats.map(_ => _.id);
36
- for (let tofish of chunk(accounts, 50)) {
37
- const tx = await ubiScheme.fishMulti(tofish, { gasLimit: 2000000 });
38
- console.log("fishing tx:", tx, tofish);
39
- const res = await tx.wait();
40
- console.log("fishing tx result:", res);
41
- }
42
-
43
- curDay = curDay - ONE_DAY;
44
- }
45
- };
46
-
47
- main();
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # Notes:
4
- # - Shchema: https://github.com/trufflesuite/truffle/tree/develop/packages/truffle-contract-schema
5
- # - bytecode vs deployedBytecode: https://ethereum.stackexchange.com/questions/32234/difference-between-bytecode-and-runtime-bytecode
6
- # FILES=`find $1 -name '*.json' ! -name '*.dbg.json'`
7
- mkdir artifacts/abis && true
8
- find $1 -name "*.json" ! -name '*.*.json' |while read fname; do
9
- echo "$fname"
10
- #[ -z "${i%%*.min.json}" ] && continue # already minified
11
- f=${fname##*/}
12
- m=./artifacts/abis/${f%%.json}.min.json
13
- echo "Minimizing contract json artifact: $fname"
14
- echo "Original size: $(wc -c "$fname")"
15
- ./node_modules/node-jq/bin/jq -c 'del(.bytecode,.deployedBytecode,.ast,.legacyAST,.source,.deployedSourceMap,.userdoc,.sourcePath)' $fname > $m
16
- echo "Minimized size: $(wc -c "$m")"
17
- done
@@ -1,131 +0,0 @@
1
- import hre from "hardhat";
2
- import { network, ethers } from "hardhat";
3
-
4
- import { verifyContract, verifyOnEtherscan, verifyProductionSigner } from "./helpers";
5
- import releaser from "../../scripts/releaser";
6
- import dao from "../../releases/deployment.json";
7
- import { keccak256, parseUnits, toUtf8Bytes } from "ethers/lib/utils";
8
-
9
- const { name } = network;
10
- const celoProxyByteCode =
11
- "0x608060405234801561001057600080fd5b5060405161002060208201610044565b601f1982820381018352601f90910116604052805160209190910120600055610051565b6105c680610d8383390190565b610d23806100606000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80630bf61a011461005c5780631b903b841461008557806340ad200d1461009857806381ae1f5b146100ab578063b3eeb5e2146100be575b600080fd5b61006f61006a366004610512565b6100d1565b60405161007c9190610568565b60405180910390f35b61006f61009336600461057c565b6100e7565b61006f6100a63660046105f7565b61016c565b61006f6100b936600461062c565b6101df565b61006f6100cc366004610658565b6101f5565b60006100df848484336102f2565b949350505050565b60008061012b853386868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506103cd92505050565b90507fcf78cf0d6f3d8371e1075c69c492ab4ec5d8cf23a1a239b6a51a1d00be7ca3128160405161015c9190610568565b60405180910390a1949350505050565b60008061017985856103fe565b6040516001600160f81b031960208201526001600160601b03193060601b166021820152603581018290526055810185905290915060009060750160408051808303601f1901815291905280516020909101206001600160a01b03169695505050505050565b60006101ee838360005461016c565b9392505050565b6000808360601b9050604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528160148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f09250507efffc2da0b561cae30d9826d37709e9421c4725faebc226cbbb7ef5fc5e7349826040516102709190610568565b60405180910390a18251156102eb576000826001600160a01b03168460405161029991906106c9565b6000604051808303816000865af19150503d80600081146102d6576040519150601f19603f3d011682016040523d82523d6000602084013e6102db565b606091505b50509050806102e957600080fd5b505b5092915050565b6000806040518060200161030590610447565b601f1982820381018352601f90910116604052905060006103278785846103cd565b60405163347d5e2560e21b815290915081906001600160a01b0382169063d1f578949061035a908a908a906004016106e5565b600060405180830381600087803b15801561037457600080fd5b505af1158015610388573d6000803e3d6000fd5b505050507efffc2da0b561cae30d9826d37709e9421c4725faebc226cbbb7ef5fc5e7349816040516103ba9190610568565b60405180910390a1979650505050505050565b60008060006103dc86866103fe565b9050808451602086016000f59150813b6103f557600080fd5b50949350505050565b6000828260405160200161042992919091825260601b6001600160601b031916602082015260340190565b60405160208183030381529060405280519060200120905092915050565b6105c68061072883390190565b80356001600160a01b038116811461046b57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261049757600080fd5b81356001600160401b03808211156104b1576104b1610470565b604051601f8301601f19908116603f011681019082821181831017156104d9576104d9610470565b816040528381528660208588010111156104f257600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060006060848603121561052757600080fd5b8335925061053760208501610454565b915060408401356001600160401b0381111561055257600080fd5b61055e86828701610486565b9150509250925092565b6001600160a01b0391909116815260200190565b60008060006040848603121561059157600080fd5b8335925060208401356001600160401b03808211156105af57600080fd5b818601915086601f8301126105c357600080fd5b8135818111156105d257600080fd5b8760208285010111156105e457600080fd5b6020830194508093505050509250925092565b60008060006060848603121561060c57600080fd5b8335925061061c60208501610454565b9150604084013590509250925092565b6000806040838503121561063f57600080fd5b8235915061064f60208401610454565b90509250929050565b6000806040838503121561066b57600080fd5b61067483610454565b915060208301356001600160401b0381111561068f57600080fd5b61069b85828601610486565b9150509250929050565b60005b838110156106c05781810151838201526020016106a8565b50506000910152565b600082516106db8184602087016106a5565b9190910192915050565b60018060a01b038316815260406020820152600082518060408401526107128160608501602087016106a5565b601f01601f191691909101606001939250505056fe608060405234801561001057600080fd5b506105a6806100206000396000f3fe6080604052600436106100225760003560e01c8063d1f578941461003957610031565b366100315761002f61004c565b005b61002f61004c565b61002f6100473660046103ef565b61005e565b61005c61005761013d565b61014c565b565b6000610068610170565b6001600160a01b0316146100b15760405162461bcd60e51b815260206004820152600b60248201526a1a5b9a5d1a585b1a5e995960aa1b60448201526064015b60405180910390fd5b6100dc60017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd61047f565b60008051602061052a833981519152146100f8576100f86104a0565b6101388383838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920182905250925061018c915050565b505050565b6000610147610170565b905090565b3660008037600080366000845af43d6000803e80801561016b573d6000f35b3d6000fd5b60008051602061052a833981519152546001600160a01b031690565b610195836101b7565b6000825111806101a25750805b15610138576101b183836101f7565b50505050565b6101c081610225565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b606061021c838360405180606001604052806027815260200161054a602791396102bf565b90505b92915050565b61022e81610337565b6102905760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016100a8565b60008051602061052a83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080856001600160a01b0316856040516102dc91906104da565b600060405180830381855af49150503d8060008114610317576040519150601f19603f3d011682016040523d82523d6000602084013e61031c565b606091505b509150915061032d86838387610346565b9695505050505050565b6001600160a01b03163b151590565b606083156103b35782516000036103ac5761036085610337565b6103ac5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016100a8565b50816103bd565b6103bd83836103c5565b949350505050565b8151156103d55781518083602001fd5b8060405162461bcd60e51b81526004016100a891906104f6565b60008060006040848603121561040457600080fd5b83356001600160a01b038116811461041b57600080fd5b925060208401356001600160401b038082111561043757600080fd5b818601915086601f83011261044b57600080fd5b81358181111561045a57600080fd5b87602082850101111561046c57600080fd5b6020830194508093505050509250925092565b8181038181111561021f57634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052600160045260246000fd5b60005b838110156104d15781810151838201526020016104b9565b50506000910152565b600082516104ec8184602087016104b6565b9190910192915050565b60208152600082518060208401526105158160408501602087016104b6565b601f01601f1916919091016040019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220700964e1863e921cf409e58babd7df4199472bb8aeeac1315f61421b99f6fd5864736f6c63430008100033a264697066735822122015cbe254261934ea1f570e1c22223384888b3a09d774864acb6e95dfb8d4915e64736f6c63430008100033608060405234801561001057600080fd5b506105a6806100206000396000f3fe6080604052600436106100225760003560e01c8063d1f578941461003957610031565b366100315761002f61004c565b005b61002f61004c565b61002f6100473660046103ef565b61005e565b61005c61005761013d565b61014c565b565b6000610068610170565b6001600160a01b0316146100b15760405162461bcd60e51b815260206004820152600b60248201526a1a5b9a5d1a585b1a5e995960aa1b60448201526064015b60405180910390fd5b6100dc60017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd61047f565b60008051602061052a833981519152146100f8576100f86104a0565b6101388383838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920182905250925061018c915050565b505050565b6000610147610170565b905090565b3660008037600080366000845af43d6000803e80801561016b573d6000f35b3d6000fd5b60008051602061052a833981519152546001600160a01b031690565b610195836101b7565b6000825111806101a25750805b15610138576101b183836101f7565b50505050565b6101c081610225565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b606061021c838360405180606001604052806027815260200161054a602791396102bf565b90505b92915050565b61022e81610337565b6102905760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016100a8565b60008051602061052a83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080856001600160a01b0316856040516102dc91906104da565b600060405180830381855af49150503d8060008114610317576040519150601f19603f3d011682016040523d82523d6000602084013e61031c565b606091505b509150915061032d86838387610346565b9695505050505050565b6001600160a01b03163b151590565b606083156103b35782516000036103ac5761036085610337565b6103ac5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016100a8565b50816103bd565b6103bd83836103c5565b949350505050565b8151156103d55781518083602001fd5b8060405162461bcd60e51b81526004016100a891906104f6565b60008060006040848603121561040457600080fd5b83356001600160a01b038116811461041b57600080fd5b925060208401356001600160401b038082111561043757600080fd5b818601915086601f83011261044b57600080fd5b81358181111561045a57600080fd5b87602082850101111561046c57600080fd5b6020830194508093505050509250925092565b8181038181111561021f57634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052600160045260246000fd5b60005b838110156104d15781810151838201526020016104b9565b50506000910152565b600082516104ec8184602087016104b6565b9190910192915050565b60208152600082518060208401526105158160408501602087016104b6565b601f01601f1916919091016040019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220700964e1863e921cf409e58babd7df4199472bb8aeeac1315f61421b99f6fd5864736f6c63430008100033";
12
- export const deployUniversalProxyFactory = async () => {
13
- const f = await ethers.getContractFactory("ProxyFactory1967");
14
-
15
- const isProduction = name.includes("production");
16
- const deployTx = {
17
- nonce: 0,
18
- gasPrice: 50e9,
19
- gasLimit: 2891002,
20
- data: celoProxyByteCode
21
- };
22
-
23
- let signer = {
24
- v: 27,
25
- r: "0x2222222222222222222222222222222222222222222222222222222222222222",
26
- s: "0x2222222222222222222222222222222222222222222222222222222222222222"
27
- };
28
- //modify tx data a little so we get different contract address for different envs
29
- if (name.includes("development-base")) {
30
- deployTx.gasPrice = 7e7;
31
- }
32
- if (name.includes("staging")) {
33
- deployTx.gasLimit = 892000;
34
- } else if (name.includes("production")) {
35
- // deployTx.gasLimit = 890000; // was used on celo
36
- deployTx.gasLimit = 1500000; //xdc needs more gas
37
- }
38
-
39
- const rawTx = ethers.utils.serializeTransaction(deployTx);
40
- const txHash = ethers.utils.keccak256(rawTx);
41
- const deployer = ethers.utils.recoverAddress(txHash, signer);
42
- let [funder] = await ethers.getSigners();
43
-
44
- const curBalance = await ethers.provider.getBalance(deployer);
45
- const deployCost = ethers.BigNumber.from(deployTx.gasPrice).mul(deployTx.gasLimit);
46
-
47
- let tx = {};
48
- if (curBalance.lt(deployCost)) {
49
- tx = await (
50
- await funder.sendTransaction({
51
- to: deployer,
52
- value: deployCost.sub(curBalance)
53
- })
54
- ).wait();
55
- }
56
-
57
- if (isProduction) verifyProductionSigner(funder);
58
-
59
- console.log({
60
- fundingTx: tx.transactionHash,
61
- deployer,
62
- funder: funder.address,
63
- deployerBalance: ethers.utils.formatUnits(await ethers.provider.getBalance(deployer))
64
- });
65
- const signedTx = ethers.utils.serializeTransaction(deployTx, signer);
66
- const proxyTx = await ethers.provider.sendTransaction(signedTx);
67
- console.log({ proxyTx });
68
- const result = await proxyTx.wait();
69
- return ethers.getContractAt("ProxyFactory1967", result.contractAddress);
70
- };
71
-
72
- export const deployProxy = async (defaultAdmin = null) => {
73
- let release: { [key: string]: any } = dao[network.name] || {};
74
-
75
- if (network.name.match(/production|staging|fuse|development/) && release.ProxyFactory) {
76
- throw new Error("ProxyFactory already exists for env");
77
- }
78
- // let [root] = await ethers.getSigners();
79
- // //generic call permissions
80
- // let schemeMock = root;
81
-
82
- // console.log("got signers:", {
83
- // network,
84
- // root: root.address,
85
- // schemeMock: schemeMock.address,
86
- // balance: await ethers.provider
87
- // .getBalance(root.address)
88
- // .then(_ => _.toString())
89
- // });
90
-
91
- // const proxyFactory = await (
92
- // await ethers.getContractFactory("ProxyFactory1967")
93
- // ).deploy();
94
-
95
- const proxyFactory = await deployUniversalProxyFactory();
96
-
97
- release = {
98
- ProxyFactory: proxyFactory.address
99
- };
100
- await releaser(release, network.name, "deployment", false);
101
- };
102
-
103
- const deployProxyMethod2 = async (defaultAdmin = null) => {
104
- let [signer] = await ethers.getSigners();
105
- console.log("deploying proxyfactory with signer", {
106
- address: signer.address,
107
- balance: await ethers.provider.getBalance(signer.address).then(_ => _.toString())
108
- });
109
- const artifact = await hre.artifacts.readArtifact("ProxyFactory1967");
110
- const result = await hre.deployments.deterministic("ProxyFactory", {
111
- skipIfAlreadyDeployed: true,
112
- salt: keccak256(toUtf8Bytes("ProxyFactory")),
113
- contract: artifact,
114
- from: signer.address
115
- });
116
- const deployed = await result.deploy();
117
- console.log(result, deployed);
118
- const release = {
119
- ProxyFactory: deployed.address
120
- };
121
- await releaser(release, network.name, "deployment", false);
122
- await verifyContract(deployed.address, artifact.sourceName + ":" + artifact.contractName);
123
- };
124
- export const main = async (networkName = name) => {
125
- await deployProxy();
126
- // await deployProxyMethod2();
127
- };
128
-
129
- if (process.argv[1].includes("proxyFactory-deploy")) {
130
- main();
131
- }