@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
@@ -0,0 +1,454 @@
1
+ import hre, { ethers, upgrades } from "hardhat";
2
+ import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
3
+ import { expect } from "chai";
4
+ import { IGoodDollar, IIdentity, IdentityV3, IdentityV4 } from "../../types";
5
+ import { createDAO, increaseTime, advanceBlocks } from "../helpers";
6
+ import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
7
+
8
+ const BN = ethers.BigNumber;
9
+
10
+ describe("IdentityV4", () => {
11
+ let identity: IdentityV4, founder: SignerWithAddress;
12
+ let user1 = ethers.Wallet.createRandom().connect(ethers.provider);
13
+ let user2 = ethers.Wallet.createRandom().connect(ethers.provider);
14
+ let signers: Array<SignerWithAddress>;
15
+ let genericCall;
16
+
17
+ let avatar, gd: IGoodDollar, Controller, id: IIdentity;
18
+
19
+ before(async () => {
20
+ [founder, ...signers] = await ethers.getSigners();
21
+ let { controller, avatar: av, gd: gooddollar, identity: idv2, genericCall: gc } = await loadFixture(createDAO);
22
+
23
+ genericCall = gc;
24
+ identity = (await ethers.getContractAt("IdentityV4", idv2)) as IdentityV4;
25
+ Controller = controller;
26
+ avatar = av;
27
+ // await daoCreator.setSchemes(
28
+ // avatar,
29
+ // [identity],
30
+ // [ethers.constants.HashZero],
31
+ // ["0x0000001F"],
32
+ // ""
33
+ // );
34
+
35
+ gd = (await ethers.getContractAt("IGoodDollar", gooddollar, founder)) as IGoodDollar;
36
+ });
37
+
38
+ it("should set DAO by creator", async () => {
39
+ let f = await ethers.getContractFactory("IdentityV4");
40
+ let newid = (await upgrades.deployProxy(f, [signers[0].address, ethers.constants.AddressZero], {
41
+ kind: "uups"
42
+ })) as IdentityV4;
43
+ expect(await newid.dao()).eq(ethers.constants.AddressZero);
44
+ await expect(newid.connect(signers[0]).initDAO(await identity.nameService())).not.reverted;
45
+ expect(await newid.dao()).not.eq(ethers.constants.AddressZero);
46
+ });
47
+
48
+ it("should not be able to set DAO by non-creator", async () => {
49
+ let f = await ethers.getContractFactory("IdentityV4");
50
+ let newid = (await upgrades.deployProxy(f, [signers[0].address, ethers.constants.AddressZero], {
51
+ kind: "uups"
52
+ })) as IdentityV4;
53
+ expect(await newid.dao()).eq(ethers.constants.AddressZero);
54
+ await expect(newid.initDAO(await identity.nameService())).reverted;
55
+ });
56
+
57
+ it("should blacklist address", async () => {
58
+ let blacklisted = signers[1];
59
+ await identity.addBlacklisted(blacklisted.address);
60
+ expect(await identity.isBlacklisted(blacklisted.address)).true;
61
+
62
+ await identity.removeBlacklisted(blacklisted.address);
63
+ expect(await identity.isBlacklisted(blacklisted.address)).false;
64
+ });
65
+
66
+ it("should add, check and remove whitelisted", async () => {
67
+ let whitelisted = signers[1];
68
+ await identity.addWhitelisted(whitelisted.address);
69
+ expect(await identity.isWhitelisted(whitelisted.address)).true;
70
+ const id = await identity.identities(whitelisted.address);
71
+ expect(id.whitelistedOnChainId).gt(0);
72
+
73
+ await identity.removeWhitelisted(whitelisted.address);
74
+ expect(await identity.isWhitelisted(whitelisted.address)).false;
75
+ });
76
+
77
+ it("should increment and decrement whitelisteds when adding whitelisted", async () => {
78
+ let whitelisted = signers[1];
79
+ const oldWhitelistedCount = (await identity.whitelistedCount()) as any;
80
+
81
+ await identity.addWhitelisted(whitelisted.address);
82
+
83
+ const diffWhitelistedCount = ((await identity.whitelistedCount()) as any).sub(oldWhitelistedCount);
84
+ expect(diffWhitelistedCount.toString()).to.be.equal("1");
85
+
86
+ await identity.removeWhitelisted(whitelisted.address);
87
+
88
+ const whitelistedCount = (await identity.whitelistedCount()) as any;
89
+ expect(whitelistedCount.toString()).to.be.equal(oldWhitelistedCount.toString());
90
+ });
91
+
92
+ it("should revert when non admin tries to add whitelisted", async () => {
93
+ let whitelisted = signers[1];
94
+ await expect(identity.connect(signers[2]).addWhitelisted(whitelisted.address)).revertedWith(
95
+ /AccessControl: account/
96
+ );
97
+ });
98
+
99
+ it("should revert when non admin tries to add blacklist", async () => {
100
+ let blacklisted = signers[1];
101
+ await expect(identity.connect(signers[2]).addBlacklisted(blacklisted.address)).revertedWith(
102
+ /AccessControl: account/
103
+ );
104
+ });
105
+
106
+ // it("should revert when non admin tries to set the authentication period", async () => {
107
+ // await expect(identity.connect(signers[2]).setAuthenticationPeriod(10)).reverted;
108
+ // });
109
+
110
+ // it("should let owner set auth period", async () => {
111
+ // const encoded = identity.interface.encodeFunctionData("setAuthenticationPeriod", [10]);
112
+ // await genericCall(identity.address, encoded);
113
+ // expect(await identity.authenticationPeriod()).eq(10);
114
+ // });
115
+
116
+ it("should revert when non admin tries to pause", async () => {
117
+ await expect(identity.connect(signers[2]).pause(true)).reverted;
118
+ });
119
+
120
+ it("should let admin pause", async () => {
121
+ await expect(identity.pause(true)).not.reverted;
122
+ await expect(identity.pause(false)).not.reverted;
123
+ });
124
+
125
+ it("should revert when non admin tries to authentice a user", async () => {
126
+ let authuser = signers[0].address;
127
+ await expect(identity.connect(signers[2]).authenticate(authuser)).revertedWith(/AccessControl: account/);
128
+ });
129
+
130
+ it("should authenticate the user with the correct timestamp", async () => {
131
+ let authuser = signers[0].address;
132
+ await identity.addWhitelisted(authuser);
133
+ await identity.authenticate(authuser);
134
+ let dateAuthenticated1 = await identity.lastAuthenticated(authuser);
135
+ await increaseTime(10);
136
+ await identity.authenticate(authuser);
137
+ let dateAuthenticated2 = await identity.lastAuthenticated(authuser);
138
+ expect(dateAuthenticated2.toNumber() - dateAuthenticated1.toNumber()).gt(0);
139
+ });
140
+
141
+ it("should add identity admin", async () => {
142
+ let outsider = signers[5].address;
143
+ await identity.grantRole(await identity.IDENTITY_ADMIN_ROLE(), outsider);
144
+ expect(await identity.hasRole(await identity.IDENTITY_ADMIN_ROLE(), outsider)).true;
145
+ });
146
+
147
+ it("should remove identity admin", async () => {
148
+ let outsider = signers[5].address;
149
+ await identity.revokeRole(await identity.IDENTITY_ADMIN_ROLE(), outsider);
150
+
151
+ expect(await identity.hasRole(await identity.IDENTITY_ADMIN_ROLE(), outsider)).false;
152
+ });
153
+
154
+ it("should revert when adding to whitelisted twice", async () => {
155
+ let whitelisted = signers[1];
156
+ await identity.addWhitelisted(whitelisted.address);
157
+ await expect(identity.addWhitelisted(whitelisted.address)).reverted;
158
+
159
+ await identity.removeWhitelisted(whitelisted.address);
160
+ });
161
+
162
+ it("should not increment whitelisted counter when adding whitelisted", async () => {
163
+ let whitelisted = signers[1];
164
+ await identity.addWhitelisted(whitelisted.address);
165
+ let whitelistedCount = await identity.whitelistedCount();
166
+
167
+ await expect(identity.addWhitelisted(whitelisted.address)).reverted;
168
+
169
+ let whitelistedCountNew = await identity.whitelistedCount();
170
+ expect(whitelistedCountNew).to.be.equal(whitelistedCount).gt(0);
171
+
172
+ await identity.removeWhitelisted(whitelisted.address);
173
+ });
174
+
175
+ it("should renounce whitelisted", async () => {
176
+ let whitelisted = signers[1];
177
+ await identity.addWhitelisted(whitelisted.address);
178
+ expect(await identity.isWhitelisted(whitelisted.address)).true;
179
+ await identity.connect(whitelisted).renounceWhitelisted();
180
+ expect(await identity.isWhitelisted(whitelisted.address)).false;
181
+ });
182
+
183
+ it("should add with did", async () => {
184
+ let whitelisted = signers[1];
185
+
186
+ await identity.addWhitelistedWithDID(whitelisted.address, "testString");
187
+
188
+ const id = await identity.identities(whitelisted.address);
189
+
190
+ expect(id.did).to.be.equal("testString");
191
+ });
192
+
193
+ it("should not allow adding with used did", async () => {
194
+ let whitelisted2 = signers[2];
195
+
196
+ await expect(identity.addWhitelistedWithDID(whitelisted2.address, "testString")).revertedWith(
197
+ /DID already registered/
198
+ );
199
+ });
200
+
201
+ it("should not allow adding non contract to contracts", async () => {
202
+ let outsider = signers[0];
203
+ await expect(identity.addContract(outsider.address)).revertedWith(/Given address is not a contract/);
204
+ });
205
+
206
+ it("should add contract to contracts", async () => {
207
+ await identity.addContract(gd.address);
208
+ const wasAdded = await identity.isDAOContract(gd.address);
209
+ expect(wasAdded).to.be.true;
210
+ });
211
+
212
+ const connectedFixture = async () => {
213
+ const toconnect = signers[10];
214
+ const toconnect2 = signers[11];
215
+ let whitelisted = signers[1];
216
+
217
+ await identity.connect(whitelisted).connectAccount(toconnect.address);
218
+ await identity.connect(whitelisted).connectAccount(toconnect2.address);
219
+ return {};
220
+ };
221
+
222
+ it("should allow to connect account", async () => {
223
+ const toconnect = signers[10];
224
+ let whitelisted = signers[1];
225
+
226
+ expect(await identity.getWhitelistedRoot(toconnect.address)).eq(ethers.constants.AddressZero);
227
+
228
+ await loadFixture(connectedFixture);
229
+
230
+ expect(await identity.getWhitelistedRoot(whitelisted.address)).eq(whitelisted.address);
231
+
232
+ expect(await identity.getWhitelistedRoot(toconnect.address)).eq(whitelisted.address);
233
+ });
234
+
235
+ it("should not allow to connect account already whitelisted", async () => {
236
+ await loadFixture(connectedFixture);
237
+
238
+ await identity.addWhitelisted(signers[2].address);
239
+ let whitelisted = signers[1];
240
+
241
+ await expect(identity.connect(whitelisted).connectAccount(signers[2].address)).revertedWith(/invalid account/);
242
+ });
243
+
244
+ it("should allow to disconnect account by owner or connected", async () => {
245
+ await loadFixture(connectedFixture);
246
+
247
+ const connected = signers[10];
248
+ const whitelisted = signers[1];
249
+ await identity.connect(connected).disconnectAccount(connected.address);
250
+ expect(await identity.getWhitelistedRoot(connected.address)).eq(ethers.constants.AddressZero);
251
+ await loadFixture(connectedFixture);
252
+ await identity.connect(whitelisted).disconnectAccount(connected.address);
253
+ expect(await identity.getWhitelistedRoot(connected.address)).eq(ethers.constants.AddressZero);
254
+ });
255
+
256
+ it("should not allow to disconnect account not by owner or by connected", async () => {
257
+ await loadFixture(connectedFixture);
258
+
259
+ const connected = signers[10];
260
+ const whitelisted = signers[1];
261
+ await expect(identity.disconnectAccount(connected.address)).revertedWith(/unauthorized/);
262
+ });
263
+
264
+ it("should not allow to connect to an already connected account", async () => {
265
+ await loadFixture(connectedFixture);
266
+
267
+ await identity.addWhitelisted(signers[2].address);
268
+ expect(await identity.isWhitelisted(signers[2].address)).true;
269
+ const connected = signers[10];
270
+
271
+ await expect(identity.connect(signers[2]).connectAccount(connected.address)).revertedWith(/already connected/);
272
+ });
273
+
274
+ it("should return same root for multiple connected accounts", async () => {
275
+ await loadFixture(connectedFixture);
276
+
277
+ const connected = signers[10];
278
+ const connected2 = signers[11];
279
+ const whitelisted = signers[1];
280
+ expect(await identity.getWhitelistedRoot(connected.address))
281
+ .eq(await identity.getWhitelistedRoot(connected2.address))
282
+ .eq(whitelisted.address);
283
+ });
284
+
285
+ it("should add whitelisted with orgchain and dateauthenticated", async () => {
286
+ await loadFixture(connectedFixture);
287
+ const toWhitelist = signers[2];
288
+
289
+ const ts = (Date.now() / 1000 - 100000).toFixed(0);
290
+ await identity.addWhitelistedWithDIDAndChain(toWhitelist.address, "xxx", 1234, ts);
291
+ const record = await identity.identities(toWhitelist.address);
292
+ expect(record.whitelistedOnChainId).eq(1234);
293
+ expect(record.dateAuthenticated).eq(ts);
294
+ });
295
+
296
+ const oldidFixture = async () => {
297
+ const newid = (await upgrades.deployProxy(await ethers.getContractFactory("IdentityV4"), [
298
+ founder.address,
299
+ identity.address
300
+ ])) as IdentityV4;
301
+
302
+ await identity.grantRole(await identity.IDENTITY_ADMIN_ROLE(), newid.address);
303
+ await identity.addBlacklisted(signers[4].address);
304
+ await identity.addContract(identity.address);
305
+ await identity.removeWhitelisted(signers[3].address);
306
+ await identity.addWhitelistedWithDID(signers[3].address, "testolddid");
307
+ return { newid };
308
+ };
309
+
310
+ it("should upgrade v3 to v4", async () => {
311
+ const impl = (await ethers.deployContract("IdentityV4", [])) as IdentityV4;
312
+ const upgradeCall = impl.interface.encodeFunctionData("setReverifyDaysOptions", [[6, 15, 30]]);
313
+ const encoded = identity.interface.encodeFunctionData("upgradeToAndCall", [impl.address, upgradeCall]);
314
+ await genericCall(identity.address, encoded);
315
+
316
+ expect(await identity.reverifyDaysOptions(0)).to.equal(6);
317
+ expect(await identity.reverifyDaysOptions(1)).to.equal(15);
318
+ expect(await identity.reverifyDaysOptions(2)).to.equal(30);
319
+
320
+ const oldid = (await upgrades.deployProxy(await ethers.getContractFactory("IdentityV3"), [
321
+ founder.address,
322
+ ethers.constants.AddressZero
323
+ ])) as IdentityV3;
324
+ await oldid.initDAO(await identity.nameService());
325
+ await genericCall(oldid.address, encoded);
326
+ const upgraded = await ethers.getContractAt("IdentityV4", oldid.address);
327
+ expect(await upgraded.reverifyDaysOptions(0)).to.equal(6);
328
+ expect(await upgraded.reverifyDaysOptions(1)).to.equal(15);
329
+ expect(await upgraded.reverifyDaysOptions(2)).to.equal(30);
330
+ });
331
+
332
+ it("should default to old identity isWhitelisted, isBlacklisted, isContract", async () => {
333
+ const { newid } = await loadFixture(oldidFixture);
334
+ expect(await (await identity.identities(signers[3].address)).did).eq("testolddid");
335
+ expect(await (await newid.identities(signers[3].address)).did).eq("");
336
+
337
+ expect(await identity.addrToDID(signers[3].address)).eq("testolddid");
338
+ expect(await newid.addrToDID(signers[3].address)).eq("testolddid");
339
+ expect(await newid.isBlacklisted(signers[4].address)).true;
340
+ expect(await newid.isWhitelisted(signers[3].address)).true;
341
+ expect(await newid.isDAOContract(identity.address)).true;
342
+ });
343
+
344
+ it("should remove whitelisted,blacklisted,contract from old identity", async () => {
345
+ const { newid } = await loadFixture(oldidFixture);
346
+ await newid.removeBlacklisted(signers[4].address);
347
+ await newid.removeWhitelisted(signers[3].address);
348
+ await newid.removeContract(identity.address);
349
+
350
+ expect(await newid.addrToDID(signers[3].address)).eq("");
351
+ expect(await newid.isBlacklisted(signers[4].address)).false;
352
+ expect(await newid.isWhitelisted(signers[3].address)).false;
353
+ expect(await newid.isDAOContract(identity.address)).false;
354
+
355
+ expect(await identity.isBlacklisted(signers[4].address)).false;
356
+ expect(await identity.isWhitelisted(signers[3].address)).false;
357
+ expect(await identity.isDAOContract(identity.address)).false;
358
+ });
359
+
360
+ it("should not set did if set in oldidentity", async () => {
361
+ const { newid } = await loadFixture(oldidFixture);
362
+
363
+ await expect(newid.connect(signers[1])["setDID(address,string)"](signers[1].address, "testolddid")).revertedWith(
364
+ /DID already registered oldIdentity/
365
+ );
366
+ });
367
+
368
+ it("should set did if set in oldidentity by same owner", async () => {
369
+ const { newid } = await loadFixture(oldidFixture);
370
+
371
+ await expect(newid.connect(signers[3])["setDID(address,string)"](signers[3].address, "testolddid")).not.reverted;
372
+ expect(await newid.addrToDID(signers[3].address)).eq("testolddid");
373
+ });
374
+ it("should set did if set in oldidentity by different owner but updated in new identity", async () => {
375
+ const { newid } = await loadFixture(oldidFixture);
376
+
377
+ await expect(newid.connect(signers[3])["setDID(address,string)"](signers[3].address, "newdid")).not.reverted;
378
+ expect(await newid.addrToDID(signers[3].address)).eq("newdid");
379
+
380
+ await expect(newid.connect(signers[1])["setDID(address,string)"](signers[1].address, "testolddid")).not.reverted;
381
+ expect(await newid.addrToDID(signers[1].address)).eq("testolddid");
382
+ });
383
+
384
+ it("should let admin setDID", async () => {
385
+ await expect(identity["setDID(address,string)"](signers[1].address, "admindid")).not.reverted;
386
+ expect(await identity.addrToDID(signers[1].address)).eq("admindid");
387
+ await expect(identity.connect(signers[2])["setDID(address,string)"](signers[1].address, "admindid")).reverted;
388
+ });
389
+
390
+ it("should be registered for v1 compatability", async () => {
391
+ expect(await identity.isRegistered()).true;
392
+ });
393
+
394
+ // New tests added below ---------------------------------------------------
395
+
396
+ it("should allow identity admin to set reverifyDaysOptions and reject empty", async () => {
397
+ // admin (default signer) sets new schedule
398
+ await expect(identity.setReverifyDaysOptions([2, 5, 10])).not.reverted;
399
+ expect(await identity.reverifyDaysOptions(0)).to.equal(2);
400
+ expect(await identity.reverifyDaysOptions(1)).to.equal(5);
401
+ expect(await identity.reverifyDaysOptions(2)).to.equal(10);
402
+
403
+ // empty options should revert
404
+ await expect(identity.setReverifyDaysOptions([])).revertedWith("empty options");
405
+ });
406
+
407
+ it("non-admin should not set reverifyDaysOptions", async () => {
408
+ await expect(identity.connect(signers[2]).setReverifyDaysOptions([1, 7, 180])).revertedWith(
409
+ /AccessControl: account/
410
+ );
411
+ });
412
+
413
+ it("should follow reverify schedule and cycle authCount", async () => {
414
+ await expect(identity.setReverifyDaysOptions([1, 7, 180])).not.reverted;
415
+
416
+ const u = signers[12];
417
+ // ensure a fresh account is whitelisted
418
+ await identity.addWhitelisted(u.address);
419
+ let record = await identity.identities(u.address);
420
+ expect(record.authCount).to.equal(0);
421
+
422
+ // default reverifyDaysOptions set in initialize: [1,7,180]
423
+ // move forward 2 days (past first reverify day)
424
+ await increaseTime(2 * 24 * 3600);
425
+ expect(await identity.isWhitelisted(u.address)).to.be.false;
426
+
427
+ // admin authenticates -> should increment authCount to 1
428
+ await identity.authenticate(u.address);
429
+ record = await identity.identities(u.address);
430
+ expect(record.authCount).to.equal(1);
431
+ expect(await identity.isWhitelisted(u.address)).to.be.true;
432
+
433
+ // move forward 8 days (past second reverify day = 7)
434
+ await increaseTime(8 * 24 * 3600);
435
+ expect(await identity.isWhitelisted(u.address)).to.be.false;
436
+
437
+ // authenticate again -> authCount becomes 2
438
+ await identity.authenticate(u.address);
439
+ record = await identity.identities(u.address);
440
+ expect(record.authCount).to.equal(2);
441
+ expect(await identity.isWhitelisted(u.address)).to.be.true;
442
+ // move forward 181 days (past third reverify day = 180)
443
+ await increaseTime(181 * 24 * 3600);
444
+ expect(await identity.isWhitelisted(u.address)).to.be.false;
445
+
446
+ // authenticate again -> authCount should wrap back to 0 (cycle)
447
+ await identity.authenticate(u.address);
448
+ record = await identity.identities(u.address);
449
+ expect(record.authCount).to.equal(0);
450
+ expect(await identity.isWhitelisted(u.address)).to.be.true;
451
+ // cleanup (remove whitelisted) to avoid affecting other tests
452
+ await identity.removeWhitelisted(u.address);
453
+ });
454
+ });