@gooddollar/goodprotocol 2.0.21 → 2.0.22-beta.0

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 (222) hide show
  1. package/artifacts/abis/ISuperToken.min.json +1 -1
  2. package/artifacts/abis/SuperGoodDollar.min.json +1 -1
  3. package/artifacts/abis/SuperToken.min.json +1 -1
  4. package/artifacts/contracts/DAOStackInterfaces.sol/Avatar.dbg.json +1 -1
  5. package/artifacts/contracts/DAOStackInterfaces.sol/Controller.dbg.json +1 -1
  6. package/artifacts/contracts/DAOStackInterfaces.sol/GlobalConstraintInterface.dbg.json +1 -1
  7. package/artifacts/contracts/DAOStackInterfaces.sol/IntVoteInterface.dbg.json +1 -1
  8. package/artifacts/contracts/DAOStackInterfaces.sol/ReputationInterface.dbg.json +1 -1
  9. package/artifacts/contracts/DAOStackInterfaces.sol/SchemeRegistrar.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/IUBIScheme.dbg.json +1 -1
  26. package/artifacts/contracts/Interfaces.sol/ProxyAdmin.dbg.json +1 -1
  27. package/artifacts/contracts/Interfaces.sol/Reserve.dbg.json +1 -1
  28. package/artifacts/contracts/Interfaces.sol/Staking.dbg.json +1 -1
  29. package/artifacts/contracts/Interfaces.sol/Uniswap.dbg.json +1 -1
  30. package/artifacts/contracts/Interfaces.sol/UniswapFactory.dbg.json +1 -1
  31. package/artifacts/contracts/Interfaces.sol/UniswapPair.dbg.json +1 -1
  32. package/artifacts/contracts/Interfaces.sol/cERC20.dbg.json +1 -1
  33. package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.dbg.json +1 -1
  34. package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
  35. package/artifacts/contracts/fuseFaucet/FuseFaucetV2.sol/FuseFaucetV2.dbg.json +1 -1
  36. package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
  37. package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
  38. package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
  39. package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.dbg.json +1 -1
  40. package/artifacts/contracts/governance/GoodDollarStaking.sol/IGovernanceStaking.dbg.json +1 -1
  41. package/artifacts/contracts/governance/GoodDollarStaking.sol/IStakingUpgrade.dbg.json +1 -1
  42. package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.dbg.json +1 -1
  43. package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
  44. package/artifacts/contracts/governance/MultiBaseGovernanceShareField.sol/MultiBaseGovernanceShareField.dbg.json +1 -1
  45. package/artifacts/contracts/governance/Reputation.sol/Reputation.dbg.json +1 -1
  46. package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
  47. package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.dbg.json +1 -1
  48. package/artifacts/contracts/invite/InvitesFuseV2.sol/InvitesFuseV2.dbg.json +1 -1
  49. package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.dbg.json +1 -1
  50. package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.dbg.json +1 -1
  51. package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
  52. package/artifacts/contracts/mocks/AaveUSDMockOracle.sol/AaveUSDMockOracle.dbg.json +1 -1
  53. package/artifacts/contracts/mocks/BatUSDMockOracle.sol/BatUSDMockOracle.dbg.json +1 -1
  54. package/artifacts/contracts/mocks/CompUsdMockOracle.sol/CompUSDMockOracle.dbg.json +1 -1
  55. package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
  56. package/artifacts/contracts/mocks/DaiEthPriceMockOracle.sol/DaiEthPriceMockOracle.dbg.json +1 -1
  57. package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
  58. package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.dbg.json +1 -1
  59. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +1 -1
  60. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +1 -1
  61. package/artifacts/contracts/mocks/EthUSDMockOracle.sol/EthUSDMockOracle.dbg.json +1 -1
  62. package/artifacts/contracts/mocks/FeesFormularMock.sol/FeesFormulaMock.dbg.json +1 -1
  63. package/artifacts/contracts/mocks/GasPriceMockOracle.sol/GasPriceMockOracle.dbg.json +1 -1
  64. package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
  65. package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.dbg.json +1 -1
  66. package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
  67. package/artifacts/contracts/mocks/IdentityMock.sol/IdentityMock.dbg.json +1 -1
  68. package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
  69. package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
  70. package/artifacts/contracts/mocks/MultichainRouterMock.sol/IWrapper.dbg.json +1 -1
  71. package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.dbg.json +1 -1
  72. package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.dbg.json +1 -1
  73. package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
  74. package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
  75. package/artifacts/contracts/mocks/PayableMock.sol/PayableMock.dbg.json +1 -1
  76. package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
  77. package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.dbg.json +1 -1
  78. package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
  79. package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
  80. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
  81. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
  82. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.dbg.json +1 -1
  83. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.dbg.json +1 -1
  84. package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
  85. package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
  86. package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
  87. package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
  88. package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
  89. package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
  90. package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
  91. package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
  92. package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.dbg.json +1 -1
  93. package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
  94. package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
  95. package/artifacts/contracts/reserve/GoodReserveCDai.sol/ContributionCalc.dbg.json +1 -1
  96. package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.dbg.json +1 -1
  97. package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
  98. package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.dbg.json +1 -1
  99. package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
  100. package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.dbg.json +1 -1
  101. package/artifacts/contracts/staking/FuseStakingV3.sol/IConsensus.dbg.json +1 -1
  102. package/artifacts/contracts/staking/FuseStakingV3.sol/PegSwap.dbg.json +1 -1
  103. package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.dbg.json +1 -1
  104. package/artifacts/contracts/staking/SimpleStaking.sol/SimpleStaking.dbg.json +1 -1
  105. package/artifacts/contracts/staking/SimpleStakingV2.sol/SimpleStakingV2.dbg.json +1 -1
  106. package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.dbg.json +1 -1
  107. package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
  108. package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
  109. package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.dbg.json +1 -1
  110. package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
  111. package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
  112. package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.dbg.json +1 -1
  113. package/artifacts/contracts/staking/utils/Math64X64.sol/Math64x64.dbg.json +1 -1
  114. package/artifacts/contracts/staking/utils/StakingRewardsFixedAPY.sol/StakingRewardsFixedAPY.dbg.json +1 -1
  115. package/artifacts/contracts/token/ERC20PresetMinterPauserUpgradeable.sol/ERC20PresetMinterPauserUpgradeable.dbg.json +1 -1
  116. package/artifacts/contracts/token/ERC677.sol/ERC677.dbg.json +1 -1
  117. package/artifacts/contracts/token/ERC677.sol/ERC677Receiver.dbg.json +1 -1
  118. package/artifacts/contracts/token/GoodDollar.sol/GoodDollar.dbg.json +1 -1
  119. package/artifacts/contracts/token/IFeesFormula.sol/IFeesFormula.dbg.json +1 -1
  120. package/artifacts/contracts/token/MultichainFeeFormula.sol/MultichainFeeFormula.dbg.json +1 -1
  121. package/artifacts/contracts/token/superfluid/ERC20Permit.sol/ERC20Permit.dbg.json +1 -1
  122. package/artifacts/contracts/token/superfluid/ERC20Permit.sol/SelfApprove.dbg.json +1 -1
  123. package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/IGoodDollarCustom.dbg.json +1 -1
  124. package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/ISuperGoodDollar.dbg.json +1 -1
  125. package/artifacts/contracts/token/superfluid/ISuperToken.sol/ISuperToken.dbg.json +1 -1
  126. package/artifacts/contracts/token/superfluid/ISuperToken.sol/ISuperToken.json +5 -0
  127. package/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.dbg.json +1 -1
  128. package/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.json +25 -2
  129. package/artifacts/contracts/token/superfluid/SuperToken.sol/SuperToken.dbg.json +1 -1
  130. package/artifacts/contracts/token/superfluid/SuperToken.sol/SuperToken.json +7 -2
  131. package/artifacts/contracts/token/superfluid/SuperfluidToken.sol/SuperfluidToken.dbg.json +1 -1
  132. package/artifacts/contracts/token/superfluid/UUPSProxiable.sol/UUPSProxiable.dbg.json +1 -1
  133. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/Proxy.dbg.json +1 -1
  134. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSProxy.dbg.json +1 -1
  135. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSUtils.dbg.json +1 -1
  136. package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
  137. package/artifacts/contracts/ubi/UBISchemeV2.sol/UBISchemeV2.dbg.json +1 -1
  138. package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
  139. package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.dbg.json +1 -1
  140. package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
  141. package/artifacts/contracts/utils/BulkProof.sol/BulkProof.dbg.json +1 -1
  142. package/artifacts/contracts/utils/BuyAndBridgeHelper.sol/BuyAndBridgeHelper.dbg.json +1 -1
  143. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDClone.dbg.json +1 -1
  144. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDCloneFactory.dbg.json +1 -1
  145. package/artifacts/contracts/utils/BuyGDClone.sol/DonateGDClone.dbg.json +1 -1
  146. package/artifacts/contracts/utils/BuyGDClone.sol/IQuoterV2.dbg.json +1 -1
  147. package/artifacts/contracts/utils/BuyGDClone.sol/ISwapRouter.dbg.json +1 -1
  148. package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
  149. package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
  150. package/artifacts/contracts/utils/DSMath.sol/DSMath.dbg.json +1 -1
  151. package/artifacts/contracts/utils/DataTypes.sol/DataTypes.dbg.json +1 -1
  152. package/artifacts/contracts/utils/GDFaucet.sol/GDFaucet.dbg.json +1 -1
  153. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.dbg.json +1 -1
  154. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/IRouter.dbg.json +1 -1
  155. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/PausableControl.dbg.json +1 -1
  156. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.dbg.json +1 -1
  157. package/artifacts/contracts/utils/IdentityFix.sol/IdentityFix.dbg.json +1 -1
  158. package/artifacts/contracts/utils/MultiCall.sol/Multicall.dbg.json +1 -1
  159. package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.dbg.json +1 -1
  160. package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
  161. package/artifacts/contracts/utils/OneTimePayments.sol/OneTimePayments.dbg.json +1 -1
  162. package/artifacts/contracts/utils/OneTimePaymentsV2.sol/OneTimePaymentsV2.dbg.json +1 -1
  163. package/artifacts/contracts/utils/ProtocolUpgrade.sol/OldMarketMaker.dbg.json +1 -1
  164. package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.dbg.json +1 -1
  165. package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
  166. package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.dbg.json +1 -1
  167. package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.dbg.json +1 -1
  168. package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.dbg.json +1 -1
  169. package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.dbg.json +1 -1
  170. package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
  171. package/contracts/token/superfluid/ISuperToken.sol +1 -0
  172. package/contracts/token/superfluid/SuperGoodDollar.sol +11 -2
  173. package/contracts/token/superfluid/SuperToken.sol +8 -0
  174. package/dist/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.json +25 -2
  175. package/hardhat.config.ts +1 -1
  176. package/package.json +4 -3
  177. package/scripts/blockchainTestSetup.sh +1 -1
  178. package/test/faucet/Faucet.test.ts +63 -19
  179. package/test/faucet/FuseFaucet.test.ts +43 -14
  180. package/test/governance/ClaimersDistribution.test.ts +3 -3
  181. package/test/governance/CompoundVotingMachine.castvote.test.ts +3 -6
  182. package/test/governance/CompoundVotingMachine.crossblockchain.ts +2 -2
  183. package/test/governance/CompoundVotingMachine.daoscheme.ts +1 -1
  184. package/test/governance/CompoundVotingMachine.guardian.test.ts +4 -4
  185. package/test/governance/CompoundVotingMachine.propose.test.ts +8 -8
  186. package/test/governance/CompoundVotingMachine.state.test.ts +4 -4
  187. package/test/governance/GReputation.test.ts +6 -6
  188. package/test/governance/GoodDollarStaking.gd.test.ts +44 -71
  189. package/test/governance/GoodDollarStaking.good.test.ts +52 -73
  190. package/test/governance/GovernanceStaking.test.ts +1 -1
  191. package/test/governance/Reputation.test.ts +2 -2
  192. package/test/helpers.ts +1 -1
  193. package/test/identity/IdentityV2.test.ts +12 -12
  194. package/test/invite/InvitesV1.test.ts +6 -6
  195. package/test/invite/InvitesV2.test.ts +272 -81
  196. package/test/reserve/DistributionHelper.test.ts +232 -139
  197. package/test/reserve/GoodMarketMaker.test.ts +17 -17
  198. package/test/reserve/GoodReserveCDai.cap.test.ts +4 -4
  199. package/test/reserve/GoodReserveCDai.distribution.test.ts +64 -42
  200. package/test/reserve/GoodReserveCDai.gdx.test.ts +1 -1
  201. package/test/reserve/GoodReserveCDai.pause.test.ts +8 -8
  202. package/test/reserve/GoodReserveCDai.test.ts +307 -101
  203. package/test/reserve/GoodReserveCDai.uniswap.test.ts +1 -1
  204. package/test/staking/DonationsStaking.test.ts +2 -2
  205. package/test/staking/FuseStaking.test.ts +3 -3
  206. package/test/staking/GoodAaveStakingFactory.test.ts +2 -2
  207. package/test/staking/StakingRewards.test.ts +913 -320
  208. package/test/staking/StakingRewardsFixedAPY.test.ts +62 -66
  209. package/test/token/CeloGasToken.test.ts +2 -2
  210. package/test/token/GoodDollar.test.ts +5 -5
  211. package/test/token/SuperGoodDollar.test.ts +17 -13
  212. package/test/ubi/UBIScheme.test.ts +1 -1
  213. package/test/utils/AdminWallet.test.ts +10 -10
  214. package/test/utils/BuyAndBridgeHelper.test.ts +33 -9
  215. package/test/utils/GoodDollarMintBurnWrapper.test.ts +265 -113
  216. package/test/utils/NameService.test.ts +1 -1
  217. package/test/utils/ProxyFactory.test.ts +2 -2
  218. package/types/contracts/token/superfluid/SuperGoodDollar.ts +26 -0
  219. package/types/factories/contracts/token/superfluid/ISuperToken__factory.ts +5 -0
  220. package/types/factories/contracts/token/superfluid/SuperGoodDollar__factory.ts +24 -1
  221. package/types/factories/contracts/token/superfluid/SuperToken__factory.ts +6 -1
  222. package/yarn.lock +635 -253
@@ -66,7 +66,7 @@ describe("GoodReserve - Enforce token cap", () => {
66
66
  it("should not be able to mint if not minter", async () => {
67
67
  await expect(
68
68
  goodReserve.mintRewardFromRR(cDai, founder.address, 10)
69
- ).to.be.revertedWith("GoodReserve: not a minter");
69
+ ).to.be.revertedWith(/GoodReserve: not a minter/);
70
70
  });
71
71
 
72
72
  it("should be able to mint if fund_manager contract and Reserve is minter", async () => {
@@ -136,7 +136,7 @@ describe("GoodReserve - Enforce token cap", () => {
136
136
 
137
137
  await expect(
138
138
  goodReserve.connect(founder).mintRewardFromRR(cDai, founder.address, 10)
139
- ).to.be.revertedWith("GoodReserve: not a minter");
139
+ ).to.be.revertedWith(/GoodReserve: not a minter/);
140
140
  });
141
141
 
142
142
  it("should not be able to grant minter role if not Avatar", async () => {
@@ -145,7 +145,7 @@ describe("GoodReserve - Enforce token cap", () => {
145
145
  await goodReserve.RESERVE_MINTER_ROLE(),
146
146
  granted.address
147
147
  )
148
- ).to.be.revertedWith("is missing role");
148
+ ).to.be.revertedWith(/is missing role/);
149
149
  });
150
150
 
151
151
  it("should be able to grant minter role if Avatar", async () => {
@@ -180,7 +180,7 @@ describe("GoodReserve - Enforce token cap", () => {
180
180
  goodReserve
181
181
  .connect(granted)
182
182
  .mintRewardFromRR(cDai, founder.address, 22 * 1e14)
183
- ).to.be.revertedWith("GoodReserve: cap enforced");
183
+ ).to.be.revertedWith(/GoodReserve: cap enforced/);
184
184
  });
185
185
 
186
186
  it("should be able to revoke minter role if Avatar", async () => {
@@ -1,4 +1,4 @@
1
- import { ethers, waffle } from "hardhat";
1
+ import { ethers } from "hardhat";
2
2
  import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
3
3
  import { expect } from "chai";
4
4
  import { GoodReserveCDai, DistributionHelper } from "../../types";
@@ -12,7 +12,14 @@ export const BLOCK_INTERVAL = 1;
12
12
 
13
13
  describe("GoodReserve - Distribution Helper", () => {
14
14
  let goodReserve: GoodReserveCDai;
15
- let goodDollar: Contract, genericCall, avatar, founder, signers, setDAOAddress, nameService, cDai;
15
+ let goodDollar: Contract,
16
+ genericCall,
17
+ avatar,
18
+ founder,
19
+ signers,
20
+ setDAOAddress,
21
+ nameService,
22
+ cDai;
16
23
 
17
24
  before(async () => {
18
25
  [founder, ...signers] = await ethers.getSigners();
@@ -54,45 +61,42 @@ describe("GoodReserve - Distribution Helper", () => {
54
61
  console.log("setting permissions...");
55
62
  });
56
63
 
57
- const fixture = async (wallets, provider) => {
58
- const df = await ethers.getContractFactory("DistributionHelper");
59
- wallets = provider.getWallets();
60
- const distHelper = (await waffle.deployContract(wallets[0], {
61
- abi: JSON.parse(df.interface.format(FormatTypes.json) as string) as any[],
62
- bytecode: df.bytecode
63
- })) as DistributionHelper;
64
+ const fixture = async () => {
65
+ const distHelper = (await ethers.deployContract(
66
+ "DistributionHelper"
67
+ )) as DistributionHelper;
64
68
 
65
69
  return { distHelper };
66
70
  };
67
71
 
68
- const deployed_fixture = async (wallets, provider) => {
69
- const df = await ethers.getContractFactory("DistributionHelper");
70
- wallets = provider.getWallets();
71
- const distHelper = (await waffle.deployContract(wallets[0], {
72
- abi: JSON.parse(df.interface.format(FormatTypes.json) as string) as any[],
73
- bytecode: df.bytecode
74
- })) as DistributionHelper;
72
+ const deployed_fixture = async () => {
73
+ const distHelper = (await ethers.deployContract(
74
+ "DistributionHelper"
75
+ )) as DistributionHelper;
75
76
 
76
77
  await distHelper.initialize(nameService.address);
77
78
 
78
- const encodedCall = goodReserve.interface.encodeFunctionData("setDistributionHelper", [distHelper.address]);
79
+ const encodedCall = goodReserve.interface.encodeFunctionData(
80
+ "setDistributionHelper",
81
+ [distHelper.address]
82
+ );
79
83
 
80
84
  await genericCall(goodReserve.address, encodedCall, avatar.address, 0);
81
85
 
82
86
  return { distHelper };
83
87
  };
84
88
 
85
- const deployed_revert_fixture = async (wallets, provider) => {
86
- const df = await ethers.getContractFactory("DistributionHelperTest");
87
- wallets = provider.getWallets();
88
- const distHelper = (await waffle.deployContract(wallets[0], {
89
- abi: JSON.parse(df.interface.format(FormatTypes.json) as string) as any[],
90
- bytecode: df.bytecode
91
- })) as DistributionHelper;
89
+ const deployed_revert_fixture = async () => {
90
+ const distHelper = (await ethers.deployContract(
91
+ "DistributionHelperTest"
92
+ )) as DistributionHelper;
92
93
 
93
94
  await distHelper.initialize(nameService.address);
94
95
 
95
- const encodedCall = goodReserve.interface.encodeFunctionData("setDistributionHelper", [distHelper.address]);
96
+ const encodedCall = goodReserve.interface.encodeFunctionData(
97
+ "setDistributionHelper",
98
+ [distHelper.address]
99
+ );
96
100
 
97
101
  await genericCall(goodReserve.address, encodedCall, avatar.address, 0);
98
102
 
@@ -100,8 +104,11 @@ describe("GoodReserve - Distribution Helper", () => {
100
104
  };
101
105
 
102
106
  it("should allow avatar to set distribution helper target", async () => {
103
- const { distHelper } = await waffle.loadFixture(fixture);
104
- const encodedCall = goodReserve.interface.encodeFunctionData("setDistributionHelper", [distHelper.address]);
107
+ const { distHelper } = await loadFixture(fixture);
108
+ const encodedCall = goodReserve.interface.encodeFunctionData(
109
+ "setDistributionHelper",
110
+ [distHelper.address]
111
+ );
105
112
 
106
113
  await genericCall(goodReserve.address, encodedCall, avatar.address, 0);
107
114
 
@@ -109,33 +116,41 @@ describe("GoodReserve - Distribution Helper", () => {
109
116
  });
110
117
 
111
118
  it("should not allow to call setDistributionHelper", async () => {
112
- const { distHelper } = await waffle.loadFixture(fixture);
113
- await expect(goodReserve.setDistributionHelper(distHelper.address)).to.be.revertedWith("avatar");
119
+ const { distHelper } = await loadFixture(fixture);
120
+ await expect(
121
+ goodReserve.setDistributionHelper(distHelper.address)
122
+ ).to.be.revertedWith(/avatar/);
114
123
  });
115
124
 
116
125
  it("should send UBI to distribution contract", async () => {
117
- const { distHelper } = await waffle.loadFixture(deployed_fixture);
126
+ const { distHelper } = await loadFixture(deployed_fixture);
118
127
 
119
128
  await increaseTime(60 * 60 * 24 * 365); //required for reserve ratio advance
120
129
  await setDAOAddress("FUND_MANAGER", founder.address); //required so we can call mintUBI
121
130
 
122
- let tx = await (await goodReserve.connect(founder).mintUBI(0, 0, cDai)).wait();
131
+ let tx = await (
132
+ await goodReserve.connect(founder).mintUBI(0, 0, cDai)
133
+ ).wait();
123
134
 
124
135
  const ubiMintedEvent = tx.events.find(_ => _.event === "UBIMinted");
125
136
 
126
137
  const topic = distHelper.filters.Distribution().topics[0];
127
- const distributionEvent = tx.events.find(_ => _.topics.includes(topic as string));
138
+ const distributionEvent = tx.events.find(_ =>
139
+ _.topics.includes(topic as string)
140
+ );
128
141
 
129
142
  //verify onDistribution didnt happen
130
143
  expect(distributionEvent).not.empty;
131
144
 
132
145
  //verify amount transfered
133
146
 
134
- expect(ubiMintedEvent.args.gdUbiTransferred).to.equal(await goodDollar.balanceOf(distHelper.address));
147
+ expect(ubiMintedEvent.args.gdUbiTransferred).to.equal(
148
+ await goodDollar.balanceOf(distHelper.address)
149
+ );
135
150
  });
136
151
 
137
152
  it("should revert when DistributionHelper onDistribution reverts", async () => {
138
- let { distHelper } = await waffle.loadFixture(deployed_revert_fixture); //using DistributionHelperTest which reverts
153
+ let { distHelper } = await loadFixture(deployed_revert_fixture); //using DistributionHelperTest which reverts
139
154
 
140
155
  await increaseTime(60 * 60 * 24 * 365); //required for reserve ratio advance
141
156
  await setDAOAddress("FUND_MANAGER", founder.address); //required so we can call mintUBI
@@ -144,31 +159,38 @@ describe("GoodReserve - Distribution Helper", () => {
144
159
  });
145
160
 
146
161
  it("should trigger onDistribution of DistributionHelper", async () => {
147
- let { distHelper } = await waffle.loadFixture(deployed_fixture); //using DistributionHelperTest which reverts
162
+ let { distHelper } = await loadFixture(deployed_fixture); //using DistributionHelperTest which reverts
148
163
 
149
164
  await increaseTime(60 * 60 * 24 * 365); //required for reserve ratio advance
150
165
  await setDAOAddress("FUND_MANAGER", founder.address); //required so we can call mintUBI
151
166
 
152
- let tx = await (await goodReserve.connect(founder).mintUBI(0, 0, cDai)).wait();
167
+ let tx = await (
168
+ await goodReserve.connect(founder).mintUBI(0, 0, cDai)
169
+ ).wait();
153
170
 
154
171
  const topic = distHelper.filters.Distribution().topics[0];
155
- const distributionEvent = tx.events.find(_ => _.topics.includes(topic as string));
172
+ const distributionEvent = tx.events.find(_ =>
173
+ _.topics.includes(topic as string)
174
+ );
156
175
 
157
176
  expect(distributionEvent).not.empty;
158
177
  });
159
178
 
160
179
  it("should revert if distributionhelper is null", async () => {
161
- let { distHelper } = await waffle.loadFixture(deployed_fixture); //using DistributionHelperTest which reverts
180
+ let { distHelper } = await loadFixture(deployed_fixture); //using DistributionHelperTest which reverts
162
181
 
163
182
  await increaseTime(60 * 60 * 24 * 365); //required for reserve ratio advance
164
183
  await setDAOAddress("FUND_MANAGER", founder.address); //required so we can call mintUBI
165
184
 
166
- const encodedCall = goodReserve.interface.encodeFunctionData("setDistributionHelper", [
167
- ethers.constants.AddressZero
168
- ]);
185
+ const encodedCall = goodReserve.interface.encodeFunctionData(
186
+ "setDistributionHelper",
187
+ [ethers.constants.AddressZero]
188
+ );
169
189
 
170
190
  await genericCall(goodReserve.address, encodedCall, avatar.address, 0);
171
191
 
172
- await expect(goodReserve.connect(founder).mintUBI(0, 0, cDai)).revertedWith("helper not set");
192
+ await expect(goodReserve.connect(founder).mintUBI(0, 0, cDai)).revertedWith(
193
+ /helper not set/
194
+ );
173
195
  });
174
196
  });
@@ -312,6 +312,6 @@ describe("GDX Token", () => {
312
312
  "0xd515f7a623c1a18396a6aececcdcae32818b64faa0f536103b3a32e8c5ae7643"
313
313
  ]
314
314
  );
315
- await expect(tx).to.be.revertedWith("already claimed gdx");
315
+ await expect(tx).to.be.revertedWith(/already claimed gdx/);
316
316
  });
317
317
  });
@@ -1,4 +1,4 @@
1
- import { ethers, waffle } from "hardhat";
1
+ import { ethers } from "hardhat";
2
2
  import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
3
3
  import { expect } from "chai";
4
4
  import { GoodReserveCDai, DistributionHelper } from "../../types";
@@ -76,7 +76,7 @@ describe("GoodReserve - Distribution Helper", () => {
76
76
  };
77
77
 
78
78
  it("should allow avatar to unpause", async () => {
79
- const { goodReserve } = await waffle.loadFixture(fixture);
79
+ const { goodReserve } = await loadFixture(fixture);
80
80
  const encodedCall = goodReserve.interface.encodeFunctionData("unpause");
81
81
 
82
82
  expect(await goodReserve.paused()).to.equal(true);
@@ -87,31 +87,31 @@ describe("GoodReserve - Distribution Helper", () => {
87
87
 
88
88
  it("should not be able to buy when paused", async () => {
89
89
  let amount = 1e8;
90
- const { goodReserve } = await waffle.loadFixture(fixture);
90
+ const { goodReserve } = await loadFixture(fixture);
91
91
  await dai["mint(uint256)"](ethers.utils.parseEther("100"));
92
92
  await dai.approve(cDAI.address, ethers.utils.parseEther("100"));
93
93
  await cDAI["mint(uint256)"](ethers.utils.parseEther("100"));
94
94
  await cDAI.approve(goodReserve.address, ethers.utils.parseEther("10"));
95
95
  await expect(goodReserve.buy(amount, 0, founder.address)).revertedWith(
96
- "paused"
96
+ /paused/
97
97
  );
98
98
  });
99
99
 
100
100
  it("should not be able to sell when paused", async () => {
101
- const { goodReserve } = await waffle.loadFixture(fixture);
101
+ const { goodReserve } = await loadFixture(fixture);
102
102
  await expect(
103
103
  goodReserve.sell(1, 0, founder.address, founder.address)
104
- ).revertedWith("paused");
104
+ ).revertedWith(/paused/);
105
105
  });
106
106
 
107
107
  it("should not be able to mint when paused", async () => {
108
- const { goodReserve } = await waffle.loadFixture(fixture);
108
+ const { goodReserve } = await loadFixture(fixture);
109
109
  await setDAOAddress("FUND_MANAGER", founder.address);
110
110
 
111
111
  await expect(
112
112
  goodReserve
113
113
  .connect(founder)
114
114
  .mintRewardFromRR(cDAI.address, founder.address, 1000)
115
- ).revertedWith("paused"); //10000 cdai wei is 1G$
115
+ ).revertedWith(/paused/); //10000 cdai wei is 1G$
116
116
  });
117
117
  });