@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.
- package/artifacts/abis/ISuperToken.min.json +1 -1
- package/artifacts/abis/SuperGoodDollar.min.json +1 -1
- package/artifacts/abis/SuperToken.min.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/Avatar.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/Controller.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/GlobalConstraintInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/IntVoteInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/ReputationInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/SchemeRegistrar.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/AggregatorV3Interface.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ERC20.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IAaveIncentivesController.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IAdminWallet.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IDonationStaking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IERC2917.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IFirstClaimPool.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IGoodDollar.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IGoodStaking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IHasRouter.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IIdentity.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IIdentityV2.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ILendingPool.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IMultichainRouter.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/INameService.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IUBIScheme.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ProxyAdmin.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Reserve.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Uniswap.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/UniswapFactory.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/UniswapPair.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/cERC20.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/FuseFaucetV2.sol/FuseFaucetV2.dbg.json +1 -1
- package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
- package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
- package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/IGovernanceStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/IStakingUpgrade.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.dbg.json +1 -1
- package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/MultiBaseGovernanceShareField.sol/MultiBaseGovernanceShareField.dbg.json +1 -1
- package/artifacts/contracts/governance/Reputation.sol/Reputation.dbg.json +1 -1
- package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
- package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesFuseV2.sol/InvitesFuseV2.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.dbg.json +1 -1
- package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/AaveUSDMockOracle.sol/AaveUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/BatUSDMockOracle.sol/BatUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/CompUsdMockOracle.sol/CompUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DaiEthPriceMockOracle.sol/DaiEthPriceMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +1 -1
- package/artifacts/contracts/mocks/EthUSDMockOracle.sol/EthUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/FeesFormularMock.sol/FeesFormulaMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/GasPriceMockOracle.sol/GasPriceMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/IdentityMock.sol/IdentityMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/IWrapper.dbg.json +1 -1
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
- package/artifacts/contracts/mocks/PayableMock.sol/PayableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.dbg.json +1 -1
- package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.dbg.json +1 -1
- package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
- package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/ContributionCalc.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.dbg.json +1 -1
- package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
- package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.dbg.json +1 -1
- package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.dbg.json +1 -1
- package/artifacts/contracts/staking/FuseStakingV3.sol/IConsensus.dbg.json +1 -1
- package/artifacts/contracts/staking/FuseStakingV3.sol/PegSwap.dbg.json +1 -1
- package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.dbg.json +1 -1
- package/artifacts/contracts/staking/SimpleStaking.sol/SimpleStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/SimpleStakingV2.sol/SimpleStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/utils/Math64X64.sol/Math64x64.dbg.json +1 -1
- package/artifacts/contracts/staking/utils/StakingRewardsFixedAPY.sol/StakingRewardsFixedAPY.dbg.json +1 -1
- package/artifacts/contracts/token/ERC20PresetMinterPauserUpgradeable.sol/ERC20PresetMinterPauserUpgradeable.dbg.json +1 -1
- package/artifacts/contracts/token/ERC677.sol/ERC677.dbg.json +1 -1
- package/artifacts/contracts/token/ERC677.sol/ERC677Receiver.dbg.json +1 -1
- package/artifacts/contracts/token/GoodDollar.sol/GoodDollar.dbg.json +1 -1
- package/artifacts/contracts/token/IFeesFormula.sol/IFeesFormula.dbg.json +1 -1
- package/artifacts/contracts/token/MultichainFeeFormula.sol/MultichainFeeFormula.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ERC20Permit.sol/ERC20Permit.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ERC20Permit.sol/SelfApprove.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/IGoodDollarCustom.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/ISuperGoodDollar.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ISuperToken.sol/ISuperToken.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ISuperToken.sol/ISuperToken.json +5 -0
- package/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.json +25 -2
- package/artifacts/contracts/token/superfluid/SuperToken.sol/SuperToken.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/SuperToken.sol/SuperToken.json +7 -2
- package/artifacts/contracts/token/superfluid/SuperfluidToken.sol/SuperfluidToken.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/UUPSProxiable.sol/UUPSProxiable.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/UUPSProxy.sol/Proxy.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSProxy.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSUtils.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBISchemeV2.sol/UBISchemeV2.dbg.json +1 -1
- package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
- package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
- package/artifacts/contracts/utils/BulkProof.sol/BulkProof.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyAndBridgeHelper.sol/BuyAndBridgeHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDClone.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDCloneFactory.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/DonateGDClone.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/IQuoterV2.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/ISwapRouter.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
- package/artifacts/contracts/utils/DSMath.sol/DSMath.dbg.json +1 -1
- package/artifacts/contracts/utils/DataTypes.sol/DataTypes.dbg.json +1 -1
- package/artifacts/contracts/utils/GDFaucet.sol/GDFaucet.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/IRouter.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/PausableControl.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.dbg.json +1 -1
- package/artifacts/contracts/utils/IdentityFix.sol/IdentityFix.dbg.json +1 -1
- package/artifacts/contracts/utils/MultiCall.sol/Multicall.dbg.json +1 -1
- package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
- package/artifacts/contracts/utils/OneTimePayments.sol/OneTimePayments.dbg.json +1 -1
- package/artifacts/contracts/utils/OneTimePaymentsV2.sol/OneTimePaymentsV2.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgrade.sol/OldMarketMaker.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.dbg.json +1 -1
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.dbg.json +1 -1
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.dbg.json +1 -1
- package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
- package/contracts/token/superfluid/ISuperToken.sol +1 -0
- package/contracts/token/superfluid/SuperGoodDollar.sol +11 -2
- package/contracts/token/superfluid/SuperToken.sol +8 -0
- package/dist/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.json +25 -2
- package/hardhat.config.ts +1 -1
- package/package.json +4 -3
- package/scripts/blockchainTestSetup.sh +1 -1
- package/test/faucet/Faucet.test.ts +63 -19
- package/test/faucet/FuseFaucet.test.ts +43 -14
- package/test/governance/ClaimersDistribution.test.ts +3 -3
- package/test/governance/CompoundVotingMachine.castvote.test.ts +3 -6
- package/test/governance/CompoundVotingMachine.crossblockchain.ts +2 -2
- package/test/governance/CompoundVotingMachine.daoscheme.ts +1 -1
- package/test/governance/CompoundVotingMachine.guardian.test.ts +4 -4
- package/test/governance/CompoundVotingMachine.propose.test.ts +8 -8
- package/test/governance/CompoundVotingMachine.state.test.ts +4 -4
- package/test/governance/GReputation.test.ts +6 -6
- package/test/governance/GoodDollarStaking.gd.test.ts +44 -71
- package/test/governance/GoodDollarStaking.good.test.ts +52 -73
- package/test/governance/GovernanceStaking.test.ts +1 -1
- package/test/governance/Reputation.test.ts +2 -2
- package/test/helpers.ts +1 -1
- package/test/identity/IdentityV2.test.ts +12 -12
- package/test/invite/InvitesV1.test.ts +6 -6
- package/test/invite/InvitesV2.test.ts +272 -81
- package/test/reserve/DistributionHelper.test.ts +232 -139
- package/test/reserve/GoodMarketMaker.test.ts +17 -17
- package/test/reserve/GoodReserveCDai.cap.test.ts +4 -4
- package/test/reserve/GoodReserveCDai.distribution.test.ts +64 -42
- package/test/reserve/GoodReserveCDai.gdx.test.ts +1 -1
- package/test/reserve/GoodReserveCDai.pause.test.ts +8 -8
- package/test/reserve/GoodReserveCDai.test.ts +307 -101
- package/test/reserve/GoodReserveCDai.uniswap.test.ts +1 -1
- package/test/staking/DonationsStaking.test.ts +2 -2
- package/test/staking/FuseStaking.test.ts +3 -3
- package/test/staking/GoodAaveStakingFactory.test.ts +2 -2
- package/test/staking/StakingRewards.test.ts +913 -320
- package/test/staking/StakingRewardsFixedAPY.test.ts +62 -66
- package/test/token/CeloGasToken.test.ts +2 -2
- package/test/token/GoodDollar.test.ts +5 -5
- package/test/token/SuperGoodDollar.test.ts +17 -13
- package/test/ubi/UBIScheme.test.ts +1 -1
- package/test/utils/AdminWallet.test.ts +10 -10
- package/test/utils/BuyAndBridgeHelper.test.ts +33 -9
- package/test/utils/GoodDollarMintBurnWrapper.test.ts +265 -113
- package/test/utils/NameService.test.ts +1 -1
- package/test/utils/ProxyFactory.test.ts +2 -2
- package/types/contracts/token/superfluid/SuperGoodDollar.ts +26 -0
- package/types/factories/contracts/token/superfluid/ISuperToken__factory.ts +5 -0
- package/types/factories/contracts/token/superfluid/SuperGoodDollar__factory.ts +24 -1
- package/types/factories/contracts/token/superfluid/SuperToken__factory.ts +6 -1
- 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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
|
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,
|
|
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 (
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
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 (
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
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(
|
|
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 (
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
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(
|
|
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
|
|
104
|
-
const encodedCall = goodReserve.interface.encodeFunctionData(
|
|
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
|
|
113
|
-
await expect(
|
|
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
|
|
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 (
|
|
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(_ =>
|
|
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(
|
|
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
|
|
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
|
|
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 (
|
|
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(_ =>
|
|
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
|
|
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(
|
|
167
|
-
|
|
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(
|
|
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(
|
|
315
|
+
await expect(tx).to.be.revertedWith(/already claimed gdx/);
|
|
316
316
|
});
|
|
317
317
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ethers
|
|
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
|
|
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
|
|
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
|
-
|
|
96
|
+
/paused/
|
|
97
97
|
);
|
|
98
98
|
});
|
|
99
99
|
|
|
100
100
|
it("should not be able to sell when paused", async () => {
|
|
101
|
-
const { goodReserve } = await
|
|
101
|
+
const { goodReserve } = await loadFixture(fixture);
|
|
102
102
|
await expect(
|
|
103
103
|
goodReserve.sell(1, 0, founder.address, founder.address)
|
|
104
|
-
).revertedWith(
|
|
104
|
+
).revertedWith(/paused/);
|
|
105
105
|
});
|
|
106
106
|
|
|
107
107
|
it("should not be able to mint when paused", async () => {
|
|
108
|
-
const { goodReserve } = await
|
|
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(
|
|
115
|
+
).revertedWith(/paused/); //10000 cdai wei is 1G$
|
|
116
116
|
});
|
|
117
117
|
});
|