@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
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { ethers, upgrades, artifacts } from "hardhat";
|
|
2
|
-
import { loadFixture
|
|
2
|
+
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
|
|
3
3
|
import { expect } from "chai";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
GoodReserveCDai,
|
|
6
|
+
DistributionHelperTestHelper,
|
|
7
|
+
DistributionBridgeMock,
|
|
8
|
+
IGoodDollar
|
|
9
|
+
} from "../../types";
|
|
5
10
|
import { createDAO, increaseTime } from "../helpers";
|
|
6
|
-
import { FormatTypes } from "@ethersproject/abi";
|
|
7
11
|
import * as waffle from "ethereum-waffle";
|
|
8
|
-
import { BaseContract } from "ethers";
|
|
9
12
|
|
|
10
13
|
const BN = ethers.BigNumber;
|
|
11
14
|
export const NULL_ADDRESS = ethers.constants.AddressZero;
|
|
@@ -13,7 +16,14 @@ export const BLOCK_INTERVAL = 1;
|
|
|
13
16
|
|
|
14
17
|
describe("DistributionHelper", () => {
|
|
15
18
|
let goodReserve: GoodReserveCDai;
|
|
16
|
-
let goodDollar: IGoodDollar,
|
|
19
|
+
let goodDollar: IGoodDollar,
|
|
20
|
+
genericCall,
|
|
21
|
+
avatar,
|
|
22
|
+
founder,
|
|
23
|
+
signers,
|
|
24
|
+
setDAOAddress,
|
|
25
|
+
nameService,
|
|
26
|
+
cDai;
|
|
17
27
|
|
|
18
28
|
before(async () => {
|
|
19
29
|
[founder, ...signers] = await ethers.getSigners();
|
|
@@ -67,19 +77,27 @@ describe("DistributionHelper", () => {
|
|
|
67
77
|
await distHelper.setOracle(oracle.address);
|
|
68
78
|
|
|
69
79
|
//make sure disthelper has enough native token so it doesnt try to swap G$s
|
|
70
|
-
await founder.sendTransaction({
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
await founder.sendTransaction({
|
|
81
|
+
to: distHelper.address,
|
|
82
|
+
value: ethers.constants.WeiPerEther
|
|
83
|
+
});
|
|
84
|
+
const bridge = (await ethers.deployContract(
|
|
85
|
+
"DistributionBridgeMock"
|
|
86
|
+
)) as DistributionBridgeMock;
|
|
87
|
+
|
|
88
|
+
const encodedCall = distHelper.interface.encodeFunctionData(
|
|
89
|
+
"setFeeSettings",
|
|
90
|
+
[
|
|
91
|
+
{
|
|
92
|
+
axelarBaseFeeUSD: "100000000000000000",
|
|
93
|
+
bridgeExecuteGas: 400000,
|
|
94
|
+
targetChainGasPrice: 5e9,
|
|
95
|
+
maxFee: "5000000000000000",
|
|
96
|
+
minBalanceForFees: "10000000000000000",
|
|
97
|
+
percentageToSellForFee: "5"
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
);
|
|
83
101
|
|
|
84
102
|
await genericCall(distHelper.address, encodedCall, avatar.address, 0);
|
|
85
103
|
|
|
@@ -100,7 +118,9 @@ describe("DistributionHelper", () => {
|
|
|
100
118
|
addr: recipient.address,
|
|
101
119
|
transferType: 0
|
|
102
120
|
})
|
|
103
|
-
).to.be.revertedWith(
|
|
121
|
+
).to.be.revertedWith(
|
|
122
|
+
/is missing role 0x0000000000000000000000000000000000000000000000000000000000000000/
|
|
123
|
+
);
|
|
104
124
|
});
|
|
105
125
|
|
|
106
126
|
it("should allow to add recipient by avatar", async () => {
|
|
@@ -108,14 +128,17 @@ describe("DistributionHelper", () => {
|
|
|
108
128
|
|
|
109
129
|
const recipient = signers[0];
|
|
110
130
|
|
|
111
|
-
const encodedCall = distHelper.interface.encodeFunctionData(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
131
|
+
const encodedCall = distHelper.interface.encodeFunctionData(
|
|
132
|
+
"addOrUpdateRecipient",
|
|
133
|
+
[
|
|
134
|
+
{
|
|
135
|
+
bps: 3000,
|
|
136
|
+
chainId: 42220,
|
|
137
|
+
addr: recipient.address,
|
|
138
|
+
transferType: 0
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
);
|
|
119
142
|
|
|
120
143
|
await genericCall(distHelper.address, encodedCall, avatar.address, 0);
|
|
121
144
|
const dr = await distHelper.distributionRecipients(0);
|
|
@@ -130,30 +153,40 @@ describe("DistributionHelper", () => {
|
|
|
130
153
|
|
|
131
154
|
const recipient = signers[0];
|
|
132
155
|
|
|
133
|
-
let encodedCall = distHelper.interface.encodeFunctionData(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
156
|
+
let encodedCall = distHelper.interface.encodeFunctionData(
|
|
157
|
+
"addOrUpdateRecipient",
|
|
158
|
+
[
|
|
159
|
+
{
|
|
160
|
+
bps: 1000,
|
|
161
|
+
chainId: 2,
|
|
162
|
+
addr: recipient.address,
|
|
163
|
+
transferType: 1
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
);
|
|
141
167
|
|
|
142
168
|
await genericCall(distHelper.address, encodedCall, avatar.address, 0);
|
|
143
169
|
|
|
144
|
-
encodedCall = distHelper.interface.encodeFunctionData(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
170
|
+
encodedCall = distHelper.interface.encodeFunctionData(
|
|
171
|
+
"addOrUpdateRecipient",
|
|
172
|
+
[
|
|
173
|
+
{
|
|
174
|
+
bps: 1500,
|
|
175
|
+
chainId: 45,
|
|
176
|
+
addr: recipient.address,
|
|
177
|
+
transferType: 2
|
|
178
|
+
}
|
|
179
|
+
]
|
|
180
|
+
);
|
|
152
181
|
|
|
153
182
|
await genericCall(distHelper.address, encodedCall, avatar.address, 0);
|
|
154
183
|
|
|
155
|
-
const updEvents = await distHelper.queryFilter(
|
|
156
|
-
|
|
184
|
+
const updEvents = await distHelper.queryFilter(
|
|
185
|
+
distHelper.filters.RecipientUpdated()
|
|
186
|
+
);
|
|
187
|
+
const addEvents = await distHelper.queryFilter(
|
|
188
|
+
distHelper.filters.RecipientAdded()
|
|
189
|
+
);
|
|
157
190
|
|
|
158
191
|
const dr = await distHelper.distributionRecipients(0);
|
|
159
192
|
expect(dr.addr).to.equal(recipient.address);
|
|
@@ -167,20 +200,25 @@ describe("DistributionHelper", () => {
|
|
|
167
200
|
|
|
168
201
|
const recipient = signers[0];
|
|
169
202
|
|
|
170
|
-
let encodedCall = distHelper.interface.encodeFunctionData(
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
203
|
+
let encodedCall = distHelper.interface.encodeFunctionData(
|
|
204
|
+
"addOrUpdateRecipient",
|
|
205
|
+
[
|
|
206
|
+
{
|
|
207
|
+
bps: 2000,
|
|
208
|
+
chainId: 42220,
|
|
209
|
+
addr: recipient.address,
|
|
210
|
+
transferType: 0
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
);
|
|
178
214
|
|
|
179
215
|
await genericCall(distHelper.address, encodedCall, avatar.address, 0);
|
|
180
216
|
|
|
181
217
|
await goodDollar.mint(distHelper.address, "100000000000");
|
|
182
218
|
await distHelper.onDistribution("100000000000");
|
|
183
|
-
expect(await goodDollar.balanceOf(bridge.address)).to.equal(
|
|
219
|
+
expect(await goodDollar.balanceOf(bridge.address)).to.equal(
|
|
220
|
+
(100000000000 * 2000) / 10000
|
|
221
|
+
);
|
|
184
222
|
|
|
185
223
|
const events = await bridge.queryFilter(bridge.filters.OnToken());
|
|
186
224
|
expect(events[0].args.sender).to.equal(distHelper.address);
|
|
@@ -193,21 +231,29 @@ describe("DistributionHelper", () => {
|
|
|
193
231
|
|
|
194
232
|
const recipient = signers[0];
|
|
195
233
|
|
|
196
|
-
let encodedCall = distHelper.interface.encodeFunctionData(
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
234
|
+
let encodedCall = distHelper.interface.encodeFunctionData(
|
|
235
|
+
"addOrUpdateRecipient",
|
|
236
|
+
[
|
|
237
|
+
{
|
|
238
|
+
bps: 2000,
|
|
239
|
+
chainId: 42220,
|
|
240
|
+
addr: recipient.address, //needs to be a contract for transferAndCall to work
|
|
241
|
+
transferType: 1
|
|
242
|
+
}
|
|
243
|
+
]
|
|
244
|
+
);
|
|
204
245
|
|
|
205
246
|
await genericCall(distHelper.address, encodedCall, avatar.address, 0);
|
|
206
247
|
|
|
207
248
|
await goodDollar.mint(distHelper.address, "100000000000");
|
|
208
|
-
await founder.sendTransaction({
|
|
249
|
+
await founder.sendTransaction({
|
|
250
|
+
to: distHelper.address,
|
|
251
|
+
value: ethers.constants.WeiPerEther
|
|
252
|
+
});
|
|
209
253
|
await distHelper.onDistribution("100000000000");
|
|
210
|
-
expect(
|
|
254
|
+
expect(
|
|
255
|
+
await goodDollar.allowance(distHelper.address, bridge.address)
|
|
256
|
+
).to.equal((100000000000 * 2000) / 10000);
|
|
211
257
|
|
|
212
258
|
const events = await bridge.queryFilter(bridge.filters.BridgeLz());
|
|
213
259
|
expect(events[0].args.recipient).to.equal(recipient.address);
|
|
@@ -221,28 +267,38 @@ describe("DistributionHelper", () => {
|
|
|
221
267
|
|
|
222
268
|
const recipient = signers[0];
|
|
223
269
|
|
|
224
|
-
let encodedCall = distHelper.interface.encodeFunctionData(
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
270
|
+
let encodedCall = distHelper.interface.encodeFunctionData(
|
|
271
|
+
"addOrUpdateRecipient",
|
|
272
|
+
[
|
|
273
|
+
{
|
|
274
|
+
bps: 2000,
|
|
275
|
+
chainId: 42220,
|
|
276
|
+
addr: recipient.address, //needs to be a contract for transferAndCall to work
|
|
277
|
+
transferType: 2
|
|
278
|
+
}
|
|
279
|
+
]
|
|
280
|
+
);
|
|
232
281
|
|
|
233
282
|
await genericCall(distHelper.address, encodedCall, avatar.address, 0);
|
|
234
283
|
|
|
235
284
|
await goodDollar.mint(distHelper.address, "100000000000");
|
|
236
|
-
await founder.sendTransaction({
|
|
285
|
+
await founder.sendTransaction({
|
|
286
|
+
to: distHelper.address,
|
|
287
|
+
value: ethers.constants.WeiPerEther
|
|
288
|
+
});
|
|
237
289
|
await distHelper.onDistribution("100000000000");
|
|
238
|
-
expect(
|
|
290
|
+
expect(
|
|
291
|
+
await goodDollar.allowance(distHelper.address, bridge.address)
|
|
292
|
+
).to.equal((100000000000 * 2000) / 10000);
|
|
239
293
|
|
|
240
294
|
const events = await bridge.queryFilter(bridge.filters.BridgeAxl());
|
|
241
295
|
expect(events[0].args.recipient).to.equal(recipient.address);
|
|
242
296
|
expect(events[0].args.amount).to.equal((100000000000 * 2000) / 10000);
|
|
243
297
|
expect(events[0].args.chainId).to.equal(42220);
|
|
244
298
|
expect(events[0].args.fee).to.equal(2.2e13); //fee should be 2e13 with 10% extra
|
|
245
|
-
expect(events[0].args.gasRefund).to.equal(
|
|
299
|
+
expect(events[0].args.gasRefund).to.equal(
|
|
300
|
+
await distHelper.getTargetChainRefundAddress(42220)
|
|
301
|
+
);
|
|
246
302
|
});
|
|
247
303
|
|
|
248
304
|
it("should distribute via transferAndCall", async () => {
|
|
@@ -250,20 +306,25 @@ describe("DistributionHelper", () => {
|
|
|
250
306
|
|
|
251
307
|
const recipient = signers[0];
|
|
252
308
|
|
|
253
|
-
let encodedCall = distHelper.interface.encodeFunctionData(
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
309
|
+
let encodedCall = distHelper.interface.encodeFunctionData(
|
|
310
|
+
"addOrUpdateRecipient",
|
|
311
|
+
[
|
|
312
|
+
{
|
|
313
|
+
bps: 2555,
|
|
314
|
+
chainId: 42220,
|
|
315
|
+
addr: signers[0].address,
|
|
316
|
+
transferType: 3
|
|
317
|
+
}
|
|
318
|
+
]
|
|
319
|
+
);
|
|
261
320
|
|
|
262
321
|
await genericCall(distHelper.address, encodedCall, avatar.address, 0);
|
|
263
322
|
|
|
264
323
|
await goodDollar.mint(distHelper.address, "100000000000");
|
|
265
324
|
await distHelper.onDistribution("100000000000");
|
|
266
|
-
expect(await goodDollar.balanceOf(signers[0].address)).to.equal(
|
|
325
|
+
expect(await goodDollar.balanceOf(signers[0].address)).to.equal(
|
|
326
|
+
(100000000000 * 2555) / 10000
|
|
327
|
+
);
|
|
267
328
|
});
|
|
268
329
|
|
|
269
330
|
it("should distribute to multiple recipients", async () => {
|
|
@@ -271,44 +332,59 @@ describe("DistributionHelper", () => {
|
|
|
271
332
|
|
|
272
333
|
const recipient = signers[0];
|
|
273
334
|
|
|
274
|
-
let encodedCall = distHelper.interface.encodeFunctionData(
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
335
|
+
let encodedCall = distHelper.interface.encodeFunctionData(
|
|
336
|
+
"addOrUpdateRecipient",
|
|
337
|
+
[
|
|
338
|
+
{
|
|
339
|
+
bps: 2555,
|
|
340
|
+
chainId: 42220,
|
|
341
|
+
addr: signers[0].address,
|
|
342
|
+
transferType: 3
|
|
343
|
+
}
|
|
344
|
+
]
|
|
345
|
+
);
|
|
282
346
|
|
|
283
347
|
await genericCall(distHelper.address, encodedCall, avatar.address, 0);
|
|
284
348
|
|
|
285
|
-
encodedCall = distHelper.interface.encodeFunctionData(
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
349
|
+
encodedCall = distHelper.interface.encodeFunctionData(
|
|
350
|
+
"addOrUpdateRecipient",
|
|
351
|
+
[
|
|
352
|
+
{
|
|
353
|
+
bps: 1000,
|
|
354
|
+
chainId: 42220,
|
|
355
|
+
addr: signers[1].address,
|
|
356
|
+
transferType: 3
|
|
357
|
+
}
|
|
358
|
+
]
|
|
359
|
+
);
|
|
293
360
|
|
|
294
361
|
await genericCall(distHelper.address, encodedCall, avatar.address, 0);
|
|
295
362
|
|
|
296
|
-
encodedCall = distHelper.interface.encodeFunctionData(
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
363
|
+
encodedCall = distHelper.interface.encodeFunctionData(
|
|
364
|
+
"addOrUpdateRecipient",
|
|
365
|
+
[
|
|
366
|
+
{
|
|
367
|
+
bps: 5,
|
|
368
|
+
chainId: 42220,
|
|
369
|
+
addr: signers[2].address,
|
|
370
|
+
transferType: 3
|
|
371
|
+
}
|
|
372
|
+
]
|
|
373
|
+
);
|
|
304
374
|
|
|
305
375
|
await genericCall(distHelper.address, encodedCall, avatar.address, 0);
|
|
306
376
|
|
|
307
377
|
await goodDollar.mint(distHelper.address, "100000000000");
|
|
308
378
|
await distHelper.onDistribution("100000000000");
|
|
309
|
-
expect(await goodDollar.balanceOf(signers[0].address)).to.equal(
|
|
310
|
-
|
|
311
|
-
|
|
379
|
+
expect(await goodDollar.balanceOf(signers[0].address)).to.equal(
|
|
380
|
+
(100000000000 * 2555) / 10000
|
|
381
|
+
);
|
|
382
|
+
expect(await goodDollar.balanceOf(signers[1].address)).to.equal(
|
|
383
|
+
(100000000000 * 1000) / 10000
|
|
384
|
+
);
|
|
385
|
+
expect(await goodDollar.balanceOf(signers[2].address)).to.equal(
|
|
386
|
+
(100000000000 * 5) / 10000
|
|
387
|
+
);
|
|
312
388
|
});
|
|
313
389
|
|
|
314
390
|
it("should emit distribution event for multiple recipients", async () => {
|
|
@@ -316,45 +392,62 @@ describe("DistributionHelper", () => {
|
|
|
316
392
|
|
|
317
393
|
const recipient = signers[0];
|
|
318
394
|
|
|
319
|
-
let encodedCall = distHelper.interface.encodeFunctionData(
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
395
|
+
let encodedCall = distHelper.interface.encodeFunctionData(
|
|
396
|
+
"addOrUpdateRecipient",
|
|
397
|
+
[
|
|
398
|
+
{
|
|
399
|
+
bps: 2555,
|
|
400
|
+
chainId: 42220,
|
|
401
|
+
addr: signers[0].address,
|
|
402
|
+
transferType: 3
|
|
403
|
+
}
|
|
404
|
+
]
|
|
405
|
+
);
|
|
327
406
|
|
|
328
407
|
await genericCall(distHelper.address, encodedCall, avatar.address, 0);
|
|
329
408
|
|
|
330
|
-
encodedCall = distHelper.interface.encodeFunctionData(
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
409
|
+
encodedCall = distHelper.interface.encodeFunctionData(
|
|
410
|
+
"addOrUpdateRecipient",
|
|
411
|
+
[
|
|
412
|
+
{
|
|
413
|
+
bps: 1000,
|
|
414
|
+
chainId: 42220,
|
|
415
|
+
addr: signers[1].address,
|
|
416
|
+
transferType: 3
|
|
417
|
+
}
|
|
418
|
+
]
|
|
419
|
+
);
|
|
338
420
|
|
|
339
421
|
await genericCall(distHelper.address, encodedCall, avatar.address, 0);
|
|
340
422
|
|
|
341
|
-
encodedCall = distHelper.interface.encodeFunctionData(
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
423
|
+
encodedCall = distHelper.interface.encodeFunctionData(
|
|
424
|
+
"addOrUpdateRecipient",
|
|
425
|
+
[
|
|
426
|
+
{
|
|
427
|
+
bps: 5,
|
|
428
|
+
chainId: 42220,
|
|
429
|
+
addr: signers[2].address,
|
|
430
|
+
transferType: 3
|
|
431
|
+
}
|
|
432
|
+
]
|
|
433
|
+
);
|
|
349
434
|
|
|
350
435
|
await genericCall(distHelper.address, encodedCall, avatar.address, 0);
|
|
351
436
|
|
|
352
437
|
await goodDollar.mint(distHelper.address, "100000000000");
|
|
353
438
|
await distHelper.onDistribution("100000000000");
|
|
354
439
|
|
|
355
|
-
const DistributionEvents = await distHelper.queryFilter(
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
expect(DistributionEvents[0].args.distributionRecipients[
|
|
440
|
+
const DistributionEvents = await distHelper.queryFilter(
|
|
441
|
+
distHelper.filters.Distribution()
|
|
442
|
+
);
|
|
443
|
+
expect(DistributionEvents[0].args.distributionRecipients[0].addr).eq(
|
|
444
|
+
signers[0].address
|
|
445
|
+
);
|
|
446
|
+
expect(DistributionEvents[0].args.distributionRecipients[1].addr).eq(
|
|
447
|
+
signers[1].address
|
|
448
|
+
);
|
|
449
|
+
expect(DistributionEvents[0].args.distributionRecipients[2].addr).eq(
|
|
450
|
+
signers[2].address
|
|
451
|
+
);
|
|
359
452
|
});
|
|
360
453
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { default as hre, ethers, upgrades
|
|
1
|
+
import { default as hre, ethers, upgrades } from "hardhat";
|
|
2
2
|
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
|
|
3
3
|
import { expect } from "chai";
|
|
4
4
|
import { GoodMarketMaker, CERC20 } from "../../types";
|
|
@@ -176,7 +176,7 @@ describe("GoodMarketMaker - calculate gd value at reserve", () => {
|
|
|
176
176
|
ethers.utils.parseEther("2")
|
|
177
177
|
);
|
|
178
178
|
await expect(res).to.be.revertedWith(
|
|
179
|
-
|
|
179
|
+
/GD amount is lower than the contribution amount/
|
|
180
180
|
);
|
|
181
181
|
});
|
|
182
182
|
|
|
@@ -194,14 +194,14 @@ describe("GoodMarketMaker - calculate gd value at reserve", () => {
|
|
|
194
194
|
let res = marketMaker.connect(staker).mintInterest(cdai, BN.from(1e8));
|
|
195
195
|
|
|
196
196
|
await expect(res).to.be.revertedWith(
|
|
197
|
-
|
|
197
|
+
/GoodMarketMaker: not Reserve or Avatar/
|
|
198
198
|
);
|
|
199
199
|
});
|
|
200
200
|
|
|
201
201
|
it("should not be able to mint expansion by a non owner", async () => {
|
|
202
202
|
let res = marketMaker.connect(staker).mintExpansion(cdai);
|
|
203
203
|
await expect(res).to.be.revertedWith(
|
|
204
|
-
|
|
204
|
+
/GoodMarketMaker: not Reserve or Avatar/
|
|
205
205
|
);
|
|
206
206
|
});
|
|
207
207
|
|
|
@@ -217,21 +217,21 @@ describe("GoodMarketMaker - calculate gd value at reserve", () => {
|
|
|
217
217
|
it("should be able to update the reserve ratio only by the owner", async () => {
|
|
218
218
|
let res = marketMaker.connect(staker).expandReserveRatio(cdai);
|
|
219
219
|
await expect(res).to.be.revertedWith(
|
|
220
|
-
|
|
220
|
+
/GoodMarketMaker: not Reserve or Avatar/
|
|
221
221
|
);
|
|
222
222
|
});
|
|
223
223
|
|
|
224
224
|
it("should be able to mint interest only by the owner", async () => {
|
|
225
225
|
let res = marketMaker.connect(staker).mintInterest(cdai, BN.from(1e8));
|
|
226
226
|
await expect(res).to.be.revertedWith(
|
|
227
|
-
|
|
227
|
+
/GoodMarketMaker: not Reserve or Avatar/
|
|
228
228
|
);
|
|
229
229
|
});
|
|
230
230
|
|
|
231
231
|
it("should be able to mint expansion only by the owner", async () => {
|
|
232
232
|
let res = marketMaker.connect(staker).mintExpansion(cdai);
|
|
233
233
|
await expect(res).to.be.revertedWith(
|
|
234
|
-
|
|
234
|
+
/GoodMarketMaker: not Reserve or Avatar/
|
|
235
235
|
);
|
|
236
236
|
});
|
|
237
237
|
|
|
@@ -412,21 +412,21 @@ describe("GoodMarketMaker - calculate gd value at reserve", () => {
|
|
|
412
412
|
.connect(staker)
|
|
413
413
|
.buy(dai, ethers.utils.parseEther("1"));
|
|
414
414
|
await expect(res).to.be.revertedWith(
|
|
415
|
-
|
|
415
|
+
/GoodMarketMaker: not Reserve or Avatar/
|
|
416
416
|
);
|
|
417
417
|
});
|
|
418
418
|
|
|
419
419
|
it("should not be able to calculate the sell return in reserve token and update the bonding curve params by a non-owner account", async () => {
|
|
420
420
|
let res = marketMaker.connect(staker).sellWithContribution(dai, 100, 0);
|
|
421
421
|
await expect(res).to.be.revertedWith(
|
|
422
|
-
|
|
422
|
+
/GoodMarketMaker: not Reserve or Avatar/
|
|
423
423
|
);
|
|
424
424
|
});
|
|
425
425
|
|
|
426
426
|
it("should not be able to calculate the sellWithContribution return in reserve token and update the bonding curve params by a non-owner account", async () => {
|
|
427
427
|
let res = marketMaker.connect(staker).sellWithContribution(dai, 100, 80);
|
|
428
428
|
await expect(res).to.be.revertedWith(
|
|
429
|
-
|
|
429
|
+
/GoodMarketMaker: not Reserve or Avatar/
|
|
430
430
|
);
|
|
431
431
|
});
|
|
432
432
|
|
|
@@ -442,7 +442,7 @@ describe("GoodMarketMaker - calculate gd value at reserve", () => {
|
|
|
442
442
|
reserveRatioBefore.toString()
|
|
443
443
|
);
|
|
444
444
|
let res = marketMaker.buy(cdai, ethers.utils.parseEther("1"));
|
|
445
|
-
await expect(res).to.be.revertedWith(
|
|
445
|
+
await expect(res).to.be.revertedWith(/Reserve token not initialized/);
|
|
446
446
|
await initializeToken(
|
|
447
447
|
cdai,
|
|
448
448
|
gdSupplyBefore,
|
|
@@ -458,7 +458,7 @@ describe("GoodMarketMaker - calculate gd value at reserve", () => {
|
|
|
458
458
|
0
|
|
459
459
|
);
|
|
460
460
|
|
|
461
|
-
await expect(res).to.be.revertedWith(
|
|
461
|
+
await expect(res).to.be.revertedWith(/Reserve token not initialized/);
|
|
462
462
|
});
|
|
463
463
|
|
|
464
464
|
it("should be able to sellWithContribution only with active token", async () => {
|
|
@@ -467,7 +467,7 @@ describe("GoodMarketMaker - calculate gd value at reserve", () => {
|
|
|
467
467
|
ethers.utils.parseEther("1"),
|
|
468
468
|
ethers.utils.parseEther("1")
|
|
469
469
|
);
|
|
470
|
-
await expect(res).to.be.revertedWith(
|
|
470
|
+
await expect(res).to.be.revertedWith(/Reserve token not initialized/);
|
|
471
471
|
});
|
|
472
472
|
|
|
473
473
|
it("should be able to sell gd only when the amount is lower than the total supply", async () => {
|
|
@@ -479,7 +479,7 @@ describe("GoodMarketMaker - calculate gd value at reserve", () => {
|
|
|
479
479
|
0
|
|
480
480
|
);
|
|
481
481
|
await expect(res).to.be.revertedWith(
|
|
482
|
-
|
|
482
|
+
/GD amount is higher than the total supply/
|
|
483
483
|
);
|
|
484
484
|
});
|
|
485
485
|
|
|
@@ -510,7 +510,7 @@ describe("GoodMarketMaker - calculate gd value at reserve", () => {
|
|
|
510
510
|
.connect(staker)
|
|
511
511
|
.setReserveRatioDailyExpansion(1, 1e15);
|
|
512
512
|
await expect(res).to.be.revertedWith(
|
|
513
|
-
|
|
513
|
+
/GoodMarketMaker: not Reserve or Avatar/
|
|
514
514
|
);
|
|
515
515
|
});
|
|
516
516
|
|
|
@@ -598,7 +598,7 @@ describe("GoodMarketMaker - calculate gd value at reserve", () => {
|
|
|
598
598
|
const invalidZeroDenominator = 0;
|
|
599
599
|
await expect(
|
|
600
600
|
marketMaker.setReserveRatioDailyExpansion(1, invalidZeroDenominator)
|
|
601
|
-
).to.be.revertedWith(
|
|
601
|
+
).to.be.revertedWith(/denominator must be above 0/);
|
|
602
602
|
|
|
603
603
|
const denominator = 1;
|
|
604
604
|
const nominatorHigherThanDenom = 2;
|
|
@@ -607,6 +607,6 @@ describe("GoodMarketMaker - calculate gd value at reserve", () => {
|
|
|
607
607
|
nominatorHigherThanDenom,
|
|
608
608
|
denominator
|
|
609
609
|
)
|
|
610
|
-
).to.be.revertedWith(
|
|
610
|
+
).to.be.revertedWith(/Invalid nom or denom value/);
|
|
611
611
|
});
|
|
612
612
|
});
|