@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,60 +0,0 @@
1
- import { countBy, chunk, difference, flatten, sortBy } from "lodash";
2
- import fs from "fs";
3
- import { network, ethers, upgrades } from "hardhat";
4
- import { Contract, Provider, setMulticallAddress } from "ethers-multicall";
5
- import Identity from "../../artifacts/contracts/Interfaces.sol/IIdentity.json";
6
-
7
- setMulticallAddress(122, "0x3CE6158b7278Bf6792e014FA7B4f3c6c46fe9410");
8
-
9
- setMulticallAddress(42220, "0x188C1bf697B66474dC3eaa119Ae691a8352537e3");
10
-
11
- const fuseProvider = new ethers.providers.JsonRpcBatchProvider(
12
- "https://explorer-node.fuse.io/"
13
- // "https://rpc.fuse.io"
14
- );
15
- const celoProvider = new ethers.providers.JsonRpcBatchProvider(
16
- "https://forno.celo.org"
17
- // "https://rpc.fuse.io"
18
- );
19
- const ethcallProvider = new Provider(fuseProvider, 122);
20
- const ethcallProviderCelo = new Provider(celoProvider, 42220);
21
-
22
- const GD_FUSE = "0x495d133b938596c9984d462f007b676bdc57ecec";
23
- const GD_CELO = "0x62B8B11039FcfE5aB0C56E502b1C372A3d2a9c7A";
24
-
25
- const gdMulti = new Contract(GD_FUSE, [
26
- "event Transfer(address indexed from, address indexed to, uint amount)",
27
- "function balanceOf(address) view returns(uint256)"
28
- ]);
29
- const gdMultiCelo = new Contract(GD_CELO, [
30
- "event Transfer(address indexed from, address indexed to, uint amount)",
31
- "function balanceOf(address) view returns(uint256)"
32
- ]);
33
-
34
- const hasBalance = async wallets => {
35
- console.log("checking balances for:", wallets.length);
36
- const chunks = chunk(wallets, 100);
37
- let balances = {};
38
- let users = [];
39
- for (let batch of chunks) {
40
- const calls = batch.map(a => gdMultiCelo.balanceOf(a));
41
- const result = await ethcallProviderCelo.all(calls);
42
- const found = batch.filter((d, i) => result[i] > 0);
43
- console.log("batch:", batch.length, calls.length, result.length, found.length);
44
- users = users.concat(found);
45
- }
46
- console.log("got balances for:", Object.entries(balances).length, "found users:", users.length);
47
- console.log(users);
48
- };
49
-
50
- const main = async () => {
51
- const wallets = fs
52
- .readFileSync("accounts.csv")
53
- .toString()
54
- .split("\n")
55
- .map(l => l.split(",")[0])
56
- .filter(a => a.startsWith("0x"));
57
-
58
- const refunded = await hasBalance(wallets);
59
- };
60
- main().catch(e => console.log(e));
@@ -1,442 +0,0 @@
1
- import { groupBy, range, sortBy } from "lodash";
2
- import PromisePool from "async-promise-pool";
3
- import fs from "fs";
4
- import { Provider, setMulticallAddress } from "ethers-multicall";
5
-
6
- import { ethers } from "hardhat";
7
- import { Retrier } from "@jsier/retrier";
8
- import { BigNumber } from "ethers";
9
- import EthDater from "ethereum-block-by-date";
10
-
11
- setMulticallAddress(122, "0x3CE6158b7278Bf6792e014FA7B4f3c6c46fe9410");
12
- // "https://celo-mainnet-archive.allthatnode.com" : "https://explorer-node.fuse.io"
13
-
14
- const celoProvider = new ethers.providers.JsonRpcProvider("https://celo-mainnet-archive.allthatnode.com");
15
- const fuseProvider = new ethers.providers.JsonRpcProvider("https://explorer-node.fuse.io");
16
- const ethProvider = new ethers.providers.JsonRpcProvider("https://ethereum-mainnet-archive.allthatnode.com");
17
-
18
- const GD_CELO = "0x62B8B11039FcfE5aB0C56E502b1C372A3d2a9c7A";
19
- const GD_FUSE = "0x495d133B938596C9984d462F007B676bDc57eCEC";
20
- const GD_ETH = "0x67C5870b4A41D4Ebef24d2456547A03F1f3e094B";
21
- const ETH_BRIDGES = [
22
- "0xd17652350cfd2a37ba2f947c910987a3b1a1c60d",
23
- "0xa3247276DbCC76Dd7705273f766eB3E8a5ecF4a5",
24
- "0xD5D11eE582c8931F336fbcd135e98CEE4DB8CCB0",
25
- "0x17B09b22823F00BB9b8ee2d4632E332cadC29458"
26
- ];
27
-
28
- const CELO_MULTIBRIDGE = "0xf27Ee99622C3C9b264583dACB2cCE056e194494f";
29
- const CELO_MPBBRIDGE = "0xa3247276DbCC76Dd7705273f766eB3E8a5ecF4a5";
30
- let gd = new ethers.Contract(
31
- GD_CELO,
32
- [
33
- "event Transfer(address indexed from, address indexed to, uint amount)",
34
- "function balanceOf(address) view returns(uint256)",
35
- "function totalSupply() view returns(uint256)"
36
- ],
37
- celoProvider
38
- );
39
-
40
- const multiBridge = new ethers.Contract(
41
- CELO_MULTIBRIDGE,
42
- [
43
- "event LogAnySwapOut(address indexed token,address indexed from,address indexed to,uint256 amount,uint256 fromChainID,uint256 toChainID)",
44
- "event LogAnySwapIn(bytes32 indexed txhash,address indexed token,address indexed to,uint256 amount,uint256 fromChainID, uint256 toChainID)"
45
- ],
46
- celoProvider
47
- );
48
-
49
- const mpbBridge = new ethers.Contract(
50
- CELO_MPBBRIDGE,
51
- [
52
- "event BridgeRequest(address indexed from,address indexed to,uint256 targetChainId,uint256 normalizedAmount,uint256 timestamp,uint8 bridge,uint256 indexed id)",
53
- "event ExecutedTransfer(address indexed from,address indexed to,uint256 normalizedAmount,uint256 fee,uint256 sourceChainId,uint8 bridge,uint256 indexed id)"
54
- ],
55
- celoProvider
56
- );
57
- const main = async () => {
58
- console.log("starting...");
59
-
60
- // let mintFuse = await getTransferEvents(
61
- // gd.connect(new ethers.providers.JsonRpcProvider("https://rpc.fuse.io")).attach(GD_FUSE),
62
- // ethers.constants.AddressZero,
63
- // 6000000,
64
- // undefined
65
- // );
66
- // fs.writeFileSync("mintFuse.json", JSON.stringify(mintFuse, null, 2));
67
- // mintFuse.forEach(log => (log.amount = log.args.amount.toString()));
68
-
69
- // const mintFuse = JSON.parse(fs.readFileSync("mintFuse.json").toString());
70
-
71
- // let mintCelo = await getTransferEvents(gd, ethers.constants.AddressZero, 17000000, undefined);
72
- // fs.writeFileSync("mintCelo.json", JSON.stringify(mintCelo, null, 2));
73
-
74
- if (false) {
75
- let multiOut = await fetch(
76
- "https://explorer.celo.org/mainnet/api?module=logs&action=getLogs&fromBlock=0&toBlock=latest&address=0xf27Ee99622C3C9b264583dACB2cCE056e194494f&topic0=0x97116cf6cd4f6412bb47914d6db18da9e16ab2142f543b86e207c24fbd16b23a&topic1=0x0000000000000000000000005566b6e4962ba83e05a426ad89031ec18e9cadd3&topic0_1_opr=and"
77
- )
78
- .then(_ => _.json())
79
- .then(_ => _.result);
80
-
81
- console.log("multiOut");
82
- let multiIn = await fetch(
83
- "https://explorer.celo.org/mainnet/api?module=logs&action=getLogs&fromBlock=0&toBlock=latest&address=0xf27Ee99622C3C9b264583dACB2cCE056e194494f&topic0=0xaac9ce45fe3adf5143598c4f18a369591a20a3384aedaf1b525d29127e1fcd55&topic2=0x0000000000000000000000005566b6e4962ba83e05a426ad89031ec18e9cadd3&topic0_2_opr=and"
84
- )
85
- .then(_ => _.json())
86
- .then(_ => _.result);
87
-
88
- console.log("multiIn");
89
- let multiInFuse = await fetch(
90
- "https://explorer.fuse.io/api?module=logs&action=getLogs&fromBlock=0&toBlock=latest&address=0x735aBE48e8782948a37C7765ECb76b98CdE97B0F&topic0=0xaac9ce45fe3adf5143598c4f18a369591a20a3384aedaf1b525d29127e1fcd55&topic2=0x000000000000000000000000031b2b7c7854dd8ee9c4a644d7e54ad17f56e3cb&topic0_2_opr=and"
91
- )
92
- .then(_ => _.json())
93
- .then(_ => _.result);
94
-
95
- console.log("multiInFuse");
96
- let multiOutFuse = await fetch(
97
- "https://explorer.fuse.io/api?module=logs&action=getLogs&fromBlock=0&toBlock=latest&address=0x735aBE48e8782948a37C7765ECb76b98CdE97B0F&topic0=0x97116cf6cd4f6412bb47914d6db18da9e16ab2142f543b86e207c24fbd16b23a&topic1=0x000000000000000000000000031b2b7c7854dd8ee9c4a644d7e54ad17f56e3cb&topic0_1_opr=and"
98
- )
99
- .then(_ => _.json())
100
- .then(_ => _.result);
101
-
102
- console.log("multiOutFuse");
103
- let mpbOut = await fetch(
104
- "https://explorer.celo.org/mainnet/api?module=logs&action=getLogs&fromBlock=0&toBlock=latest&address=0xa3247276DbCC76Dd7705273f766eB3E8a5ecF4a5&topic0=0xabeeb7182c7294cd8efcd40e9ff952c1b759c2165b3634aac589429de5d55ad0"
105
- )
106
- .then(_ => _.json())
107
- .then(_ => _.result);
108
-
109
- console.log("mpbOut");
110
- let mpbIn = await fetch(
111
- "https://explorer.celo.org/mainnet/api?module=logs&action=getLogs&fromBlock=0&toBlock=latest&address=0xa3247276DbCC76Dd7705273f766eB3E8a5ecF4a5&topic0=0x6cf712ce908185c8c38a073b7315f79687e7440fb057d9d1ca76a2509a1282ee"
112
- )
113
- .then(_ => _.json())
114
- .then(_ => _.result);
115
-
116
- console.log("mpbIn");
117
- let mpbOutFuse = await fetch(
118
- "https://explorer.fuse.io/api?module=logs&action=getLogs&fromBlock=0&toBlock=latest&address=0xa3247276DbCC76Dd7705273f766eB3E8a5ecF4a5&topic0=0xabeeb7182c7294cd8efcd40e9ff952c1b759c2165b3634aac589429de5d55ad0"
119
- )
120
- .then(_ => _.json())
121
- .then(_ => _.result);
122
-
123
- console.log("mpbOutFuse");
124
- let mpbInFuse = await fetch(
125
- "https://explorer.fuse.io/api?module=logs&action=getLogs&fromBlock=0&toBlock=latest&address=0xa3247276DbCC76Dd7705273f766eB3E8a5ecF4a5&topic0=0x6cf712ce908185c8c38a073b7315f79687e7440fb057d9d1ca76a2509a1282ee"
126
- )
127
- .then(_ => _.json())
128
- .then(_ => _.result);
129
-
130
- console.log("mpbInFuse");
131
- let outFuse = await fetch(
132
- "https://explorer.fuse.io/api?module=logs&action=getLogs&fromBlock=0&toBlock=latest&address=0x495d133B938596C9984d462F007B676bDc57eCEC&topic0=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef&topic1=0x000000000000000000000000d39021db018e2caeadb4b2e6717d31550e7918d0&topic2=0x0000000000000000000000000000000000000000000000000000000000000000&topic1_2_opr=and&topic0_1_opr=and&topic0_2_opr=and"
133
- )
134
- .then(_ => _.json())
135
- .then(_ => _.result);
136
-
137
- console.log("outFuse");
138
- let inFuse = await fetch(
139
- "https://explorer.fuse.io/api?module=logs&action=getLogs&fromBlock=0&toBlock=latest&address=0xD39021DB018E2CAEadb4B2e6717D31550e7918D0&topic0=0x2f9a6098d4503a127779ba975f5f6b04f842362b1809f346989e9abc0b4dedb6"
140
- )
141
- .then(_ => _.json())
142
- .then(_ => _.result);
143
-
144
- console.log("inFuse");
145
-
146
- let outFuse2 = await fetch(
147
- "https://explorer.fuse.io/api?module=logs&action=getLogs&fromBlock=0&toBlock=latest&address=0x495d133B938596C9984d462F007B676bDc57eCEC&topic0=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef&topic1=0x000000000000000000000000e24957CB0f0001A03314C72E6EBC331436e2f7F60&topic2=0x0000000000000000000000000000000000000000000000000000000000000000&topic1_2_opr=and&topic0_1_opr=and&topic0_2_opr=and"
148
- )
149
- .then(_ => _.json())
150
- .then(_ => _.result);
151
-
152
- console.log("outFuse");
153
- let inFuse2 = await fetch(
154
- "https://explorer.fuse.io/api?module=logs&action=getLogs&fromBlock=0&toBlock=latest&address=0xe24957CB0f0001A03314C72E6EBC331436e2f7F6&topic0=0x6fc115a803b8703117d9a3956c5a15401cb42401f91630f015eb6b043fa76253"
155
- )
156
- .then(_ => _.json())
157
- .then(_ => _.result);
158
-
159
- mpbIn.forEach(log => {
160
- log.params = ethers.utils.defaultAbiCoder.decode(["uint256", "uint256", "uint256", "uint8"], log.data);
161
- log.amount = log.params[0];
162
- });
163
- mpbOut.forEach(log => {
164
- log.params = ethers.utils.defaultAbiCoder.decode(["uint256", "uint256", "uint256", "uint8"], log.data);
165
- log.amountOut = log.params[1];
166
- });
167
- mpbInFuse.forEach(log => {
168
- log.params = ethers.utils.defaultAbiCoder.decode(["uint256", "uint256", "uint256", "uint8"], log.data);
169
- log.amount = log.params[0];
170
- });
171
- mpbOutFuse.forEach(log => {
172
- log.params = ethers.utils.defaultAbiCoder.decode(["uint256", "uint256", "uint256", "uint8"], log.data);
173
- log.amountOut = log.params[1];
174
- });
175
-
176
- multiIn.forEach(log => {
177
- log.params = ethers.utils.defaultAbiCoder.decode(["uint256", "uint256", "uint256"], log.data);
178
- log.amount = log.params[0];
179
- });
180
- multiOut.forEach(log => {
181
- log.params = ethers.utils.defaultAbiCoder.decode(["uint256", "uint256", "uint256"], log.data);
182
- log.amountOut = log.params[0];
183
- });
184
-
185
- multiInFuse.forEach(log => {
186
- log.params = ethers.utils.defaultAbiCoder.decode(["uint256", "uint256", "uint256"], log.data);
187
- log.amount = log.params[0];
188
- });
189
- multiOutFuse.forEach(log => {
190
- log.params = ethers.utils.defaultAbiCoder.decode(["uint256", "uint256", "uint256"], log.data);
191
- log.amountOut = log.params[0];
192
- });
193
-
194
- inFuse.forEach(log => {
195
- log.params = ethers.utils.defaultAbiCoder.decode(["uint256"], log.data);
196
- log.amount = log.params[0];
197
- });
198
- outFuse.forEach(log => {
199
- log.params = ethers.utils.defaultAbiCoder.decode(["uint256"], log.data);
200
- log.amountOut = log.params[0];
201
- });
202
-
203
- outFuse2.forEach(log => {
204
- log.params = ethers.utils.defaultAbiCoder.decode(["uint256"], log.data);
205
- log.amountOut = log.params[0];
206
- });
207
- inFuse2.forEach(log => {
208
- log.params = ethers.utils.defaultAbiCoder.decode(["address", "uint256", "bytes32"], log.data);
209
- log.amount = log.params[1];
210
- });
211
-
212
- // console.log({
213
- // mpbOut: mpbOut.length,
214
- // mpbIn: mpbIn.length,
215
- // multiOut: multiOut.length,
216
- // multiIn: multiIn.length,
217
- // multiInFuse: multiInFuse.length,
218
- // multiOutFuse: multiOutFuse.length,
219
- // mpbInFuse: mpbInFuse.length,
220
- // mpbOutFuse: mpbOutFuse.length,
221
- // inFuse: inFuse.length,
222
- // outFuse: outFuse.length,
223
- // inFuse2: inFuse2.length,
224
- // outFuse2: outFuse2.length
225
- // // mintFuse: mintFuse.length
226
- // });
227
-
228
- // // const found = []
229
- // // .concat(mpbIn, multiIn, multiInFuse, mpbInFuse, inFuse)
230
- // // .filter(_ => _.params[0].gt(ethers.constants.WeiPerEther.mul(180000000)));
231
-
232
- // const found = [].concat(mpbIn, multiIn, multiInFuse, mpbInFuse, inFuse, inFuse2);
233
-
234
- // const bytx = Object.entries(groupBy(found, _ => _.transactionHash)).filter((k, v) => (v as any).length > 1);
235
-
236
- // console.log({ bytx });
237
-
238
- // // const bridgeMintsTxs = found.map(_ => _.transactionHash);
239
- // // const nonBridgeMints = mintCelo.filter(l => !bridgeMintsTxs.includes(l.transactionHash));
240
- // // console.log(
241
- // // "nonbridgemints celo:",
242
- // // nonBridgeMints.map(_ => _.transactionHash)
243
- // // );
244
- // // return;
245
-
246
- // let totalMpbOut = mpbOut
247
- // .filter(_ => _.params[0].eq(1))
248
- // .reduce((prev, cur) => prev.add(ethers.BigNumber.from(cur.params[1])), ethers.constants.Zero);
249
-
250
- // let totalMpbIn = mpbIn
251
- // .filter(_ => _.params[2].eq(1))
252
- // .reduce((prev, cur) => prev.add(ethers.BigNumber.from(cur.params[0])), ethers.constants.Zero);
253
-
254
- // totalMpbOut = mpbOutFuse
255
- // .filter(_ => _.params[0].eq(1))
256
- // .reduce((prev, cur) => prev.add(ethers.BigNumber.from(cur.params[1])), totalMpbOut);
257
-
258
- // totalMpbIn = mpbInFuse
259
- // .filter(_ => _.params[2].eq(1))
260
- // .reduce((prev, cur) => prev.add(ethers.BigNumber.from(cur.params[0])), totalMpbIn);
261
-
262
- // let totalMultiOut = multiOut
263
- // .filter(l => l.params[2].eq(1))
264
- // .reduce((prev, cur) => prev.add(ethers.BigNumber.from(cur.params[0])), ethers.constants.Zero);
265
-
266
- // let totalMultiIn = multiIn
267
- // .filter(l => l.params[1].eq(1))
268
- // .reduce((prev, cur) => prev.add(ethers.BigNumber.from(cur.params[0])), ethers.constants.Zero);
269
-
270
- // totalMultiOut = multiOutFuse
271
- // .filter(l => l.params[2].eq(1))
272
- // .reduce((prev, cur) => prev.add(ethers.BigNumber.from(cur.params[0])), totalMultiOut);
273
- // totalMultiIn = multiInFuse
274
- // .filter(l => l.params[1].eq(1))
275
- // .reduce((prev, cur) => prev.add(ethers.BigNumber.from(cur.params[0])), totalMultiIn);
276
-
277
- // let totalInFuse = inFuse.reduce((prev, cur) => prev.add(ethers.BigNumber.from(cur.params[0])), ethers.constants.Zero);
278
-
279
- // let totalOutFuse = outFuse.reduce(
280
- // (prev, cur) => prev.add(ethers.BigNumber.from(cur.params[0])),
281
- // ethers.constants.Zero
282
- // );
283
-
284
- // let totalInFuse2 = inFuse2.reduce(
285
- // (prev, cur) => prev.add(ethers.BigNumber.from(cur.params[0])),
286
- // ethers.constants.Zero
287
- // );
288
-
289
- // let totalOutFuse2 = outFuse2.reduce(
290
- // (prev, cur) => prev.add(ethers.BigNumber.from(cur.params[1])),
291
- // ethers.constants.Zero
292
- // );
293
-
294
- // console.log({
295
- // totalMpbOut,
296
- // totalMpbIn,
297
- // totalMultiOut,
298
- // totalMultiIn,
299
- // totalInFuse,
300
- // totalOutFuse,
301
- // totalInFuse2,
302
- // totalOutFuse2
303
- // });
304
-
305
- // const all = [].concat(
306
- // mpbIn.filter(_ => _.params[2].eq(1)),
307
- // mpbOut.filter(_ => _.params[0].eq(1)),
308
- // multiIn.filter(l => l.params[1].eq(1)),
309
- // multiOut.filter(l => l.params[2].eq(1)),
310
- // multiInFuse.filter(l => l.params[1].eq(1)),
311
- // multiOutFuse.filter(l => l.params[2].eq(1)),
312
- // mpbInFuse.filter(_ => _.params[2].eq(1)),
313
- // mpbOutFuse.filter(_ => _.params[0].eq(1)),
314
- // inFuse,
315
- // outFuse,
316
- // outFuse2,
317
- // inFuse2
318
- // );
319
-
320
- // fs.writeFileSync("allBridgeEvents.json", JSON.stringify(all));
321
- }
322
- const all = JSON.parse(fs.readFileSync("allBridgeEvents.json").toString());
323
-
324
- let counter = 0;
325
- let total = ethers.constants.Zero;
326
- const gdEth = gd.connect(ethProvider).attach(GD_ETH);
327
- const sorted = sortBy(all, _ => Number(_.timeStamp));
328
- console.log(sorted.slice(0, 10));
329
-
330
- const ethDater = new EthDater(ethProvider);
331
- const fuseDater = new EthDater(fuseProvider);
332
- const celoDater = new EthDater(celoProvider);
333
-
334
- for (let log of sorted) {
335
- if (log.amountOut) {
336
- log.amountOut = ethers.BigNumber.from(log.amountOut.hex);
337
- total = total.sub(
338
- log.amountOut.gte(ethers.constants.WeiPerEther)
339
- ? log.amountOut.div(ethers.constants.WeiPerEther)
340
- : log.amountOut.div(100)
341
- );
342
- }
343
- if (log.amount) {
344
- log.amount = ethers.BigNumber.from(log.amount.hex);
345
- total = total.add(
346
- log.amount.gte(ethers.constants.WeiPerEther)
347
- ? log.amount.div(ethers.constants.WeiPerEther)
348
- : log.amount.div(100)
349
- );
350
- }
351
- counter++;
352
- if (
353
- counter >= 1040 ||
354
- (counter >= 950 && counter % 10 === 0) ||
355
- counter % 100 === 0 ||
356
- counter >= sorted.length - 1
357
- ) {
358
- // const [tx, tx2] = await Promise.all([
359
- // fuseProvider.getTransaction(log.transactionHash),
360
- // celoProvider.getTransaction(log.transactionHash)
361
- // ]);
362
- const timestamp = Number(log.timeStamp);
363
- const [ethBlock, fuseBlock, celoBlock] = await Promise.all([
364
- ethDater.getDate(timestamp * 1000, false, false),
365
- fuseDater.getDate(timestamp * 1000, true, false),
366
- celoDater.getDate(timestamp * 1000, true, false)
367
- ]);
368
- console.log("counter:", counter, timestamp, { ethBlock, fuseBlock, celoBlock });
369
-
370
- const res = await Promise.all(
371
- ETH_BRIDGES.map(b => gdEth.balanceOf(b, { blockTag: ethBlock.block }).catch(_ => ethers.constants.Zero))
372
- );
373
- const [onFuse, onCelo] = await Promise.all([
374
- gd
375
- .connect(fuseProvider)
376
- .attach(GD_FUSE)
377
- .totalSupply({ blockTag: fuseBlock.block })
378
- .catch(_ => ethers.constants.Zero),
379
- gd.totalSupply({ blockTag: celoBlock.block }).catch(_ => ethers.constants.Zero)
380
- ]);
381
- const onBridges = res.reduce((prev, cur) => prev.add(cur), ethers.constants.Zero).div(100);
382
- console.log(
383
- "bridged:" + total.toString(),
384
- "on bridges:" + onBridges.toString(),
385
- "on chains:",
386
- onCelo.div(ethers.constants.WeiPerEther).add(onFuse.div(100)).toString(),
387
- "time:",
388
- timestamp,
389
- {
390
- onFuse,
391
- onCelo
392
- },
393
- res.map(_ => _.toString())
394
- );
395
- }
396
- }
397
- //
398
-
399
- // console.log(txs.length);
400
- // fs.writeFileSync("stuckgd.json", JSON.stringify(txs));
401
- };
402
-
403
- const getTransferEvents = async (gd, from, fromBlock, toBlock) => {
404
- const curBlock = toBlock || (await gd.provider.getBlockNumber());
405
- let txs = [];
406
- const f = gd.filters.Transfer(from, null);
407
- const STEP_SIZE = 10000;
408
- const fromBlocks = range(fromBlock, curBlock, STEP_SIZE);
409
- const pool = new PromisePool({ concurrency: 2 });
410
- console.log({ curBlock });
411
- fromBlocks.forEach(start => {
412
- pool.add(async () => {
413
- const options = { limit: 3, delay: 2000 };
414
- const retrier = new Retrier(options);
415
-
416
- const results = await retrier
417
- .resolve(() => gd.queryFilter(f, start, start + STEP_SIZE))
418
- .catch(e => console.warn("queryfilter failed:", { start }));
419
- if (!results) return;
420
-
421
- txs = txs.concat(results);
422
- console.log({ start }, results.length);
423
- });
424
- });
425
-
426
- await pool.all();
427
- return txs;
428
- };
429
-
430
- // const analyze = () => {
431
- // const txs = JSON.parse(fs.readFileSync("stuckgd.json").toString());
432
- // let value = 0;
433
- // console.log(txs[0]);
434
- // txs.forEach(tx => {
435
- // value += Number(tx.args[2].hex);
436
- // console.log(`erc20,${GD_CELO},${tx.args[0]},${Number(tx.args[2].hex) / 1e18},`);
437
- // });
438
- // console.log(txs.length, { value });
439
- // };
440
- // analyze();
441
-
442
- main().catch(e => console.error("Error:", e.message));
@@ -1,98 +0,0 @@
1
- import { countBy, chunk, difference, flatten, sortBy } from "lodash";
2
- import fs from "fs";
3
- import { network, ethers, upgrades } from "hardhat";
4
- import { Contract, Provider, setMulticallAddress } from "ethers-multicall";
5
- import Identity from "../../artifacts/contracts/Interfaces.sol/IIdentity.json";
6
-
7
- setMulticallAddress(122, "0x3CE6158b7278Bf6792e014FA7B4f3c6c46fe9410");
8
- const CLAIM_START_BLOCK = 17896430;
9
-
10
- const fuseProvider = new ethers.providers.JsonRpcBatchProvider(
11
- "https://explorer-node.fuse.io/"
12
- // "https://rpc.fuse.io"
13
- );
14
- const ethcallProvider = new Provider(fuseProvider, 122);
15
-
16
- const GD_FUSE = "0x495d133b938596c9984d462f007b676bdc57ecec";
17
- const IDENTITY_FUSE = "0xFa8d865A962ca8456dF331D78806152d3aC5B84F";
18
-
19
- let gd = new ethers.Contract(
20
- GD_FUSE,
21
- [
22
- "event Transfer(address indexed from, address indexed to, uint amount)",
23
- "function balanceOf(address) view returns(uint256)"
24
- ],
25
- fuseProvider
26
- );
27
- const gdMulti = new Contract(GD_FUSE, [
28
- "event Transfer(address indexed from, address indexed to, uint amount)",
29
- "function balanceOf(address) view returns(uint256)"
30
- ]);
31
-
32
- const hasBalanceToRefund = async wallets => {
33
- const chunks = chunk(wallets, 1000);
34
- let balances = {};
35
- for (let batch of chunks) {
36
- const calls = batch.map(a => gdMulti.balanceOf(a));
37
- const result = await ethcallProvider.all(calls);
38
- console.log("batch:", batch.length, calls.length, result.length);
39
- batch.forEach((d, i) => (balances[d] = result[i]));
40
- }
41
- console.log("got balances for:", Object.entries(balances).length);
42
- const hasBalance = countBy(balances, v => v >= 9622260);
43
- const noBalance = Object.entries(balances).filter(([k, v]) => v < 9622260);
44
- console.log({ hasBalance });
45
- return noBalance.map(_ => _[0]);
46
- };
47
-
48
- const hasRefunded = async wallets => {
49
- const curBlock = (await gd.provider.getBlockNumber()) - 1;
50
- console.log({ curBlock });
51
- let toBlock = CLAIM_START_BLOCK + 50000;
52
- let refunded = [];
53
- let startBlock = CLAIM_START_BLOCK;
54
- while (startBlock <= curBlock) {
55
- const events = await gd.queryFilter(
56
- gd.filters.Transfer(undefined, "0xd253A5203817225e9768C05E5996d642fb96bA86"),
57
- startBlock,
58
- toBlock
59
- );
60
- const accounts = events.filter(e => e.args.amount >= 9622260).map(_ => _.args.from.toLowerCase());
61
- refunded.push(...accounts);
62
- console.log("has refunded:", {
63
- startBlock,
64
- toBlock,
65
- accounts: accounts.length
66
- });
67
- toBlock = Math.min(curBlock, toBlock + 50000);
68
- startBlock += 50000;
69
- }
70
- return refunded;
71
- };
72
-
73
- const whereIsTheMoney = async noBalance => {
74
- let targets = [];
75
- for (let batch of chunk(noBalance, 100)) {
76
- const tos = await Promise.all(
77
- batch.map(async a => {
78
- const e = await gd.queryFilter(gd.filters.Transfer(a), CLAIM_START_BLOCK);
79
- const tos = e.filter(_ => _.args.amount > 1000000).map(_ => _.args.to);
80
- return tos;
81
- })
82
- );
83
- targets.push(...flatten(tos));
84
- }
85
- const targetCounter = countBy(targets, _ => _);
86
- console.log("transfer targets:", sortBy(Object.entries(targetCounter), "1").reverse());
87
- };
88
- const main = async () => {
89
- const wallets = JSON.parse(fs.readFileSync("torefund.json").toString()).map(_ => _.toLowerCase());
90
- console.log("Total Claimed:", wallets.length);
91
- const refunded = await hasRefunded(wallets);
92
- const notRefunded = difference(wallets, refunded);
93
- console.log("refunded:", refunded.length, "not refunded:", notRefunded.length);
94
-
95
- const noBalanceToRefund = await hasBalanceToRefund(notRefunded);
96
- await whereIsTheMoney(noBalanceToRefund);
97
- };
98
- main().catch(e => console.log(e));