@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
|
@@ -11,14 +11,39 @@ const BN = ethers.BigNumber;
|
|
|
11
11
|
|
|
12
12
|
describe("InvitesV2", () => {
|
|
13
13
|
let invites: InvitesV2, founder: SignerWithAddress;
|
|
14
|
-
let inviter1,
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
let inviter1,
|
|
15
|
+
inviter2,
|
|
16
|
+
invitee1,
|
|
17
|
+
invitee2,
|
|
18
|
+
invitee3,
|
|
19
|
+
invitee4,
|
|
20
|
+
invitee5,
|
|
21
|
+
invitee6,
|
|
22
|
+
invitee7,
|
|
23
|
+
invitee8;
|
|
24
|
+
|
|
25
|
+
let avatar,
|
|
26
|
+
gd: IGoodDollar,
|
|
27
|
+
Controller,
|
|
28
|
+
id: IdentityV2,
|
|
29
|
+
setDAOAddress,
|
|
30
|
+
setSchemes;
|
|
17
31
|
|
|
18
32
|
const initialState = async () => {};
|
|
19
33
|
before(async () => {
|
|
20
|
-
[
|
|
21
|
-
|
|
34
|
+
[
|
|
35
|
+
founder,
|
|
36
|
+
inviter1,
|
|
37
|
+
inviter2,
|
|
38
|
+
invitee1,
|
|
39
|
+
invitee2,
|
|
40
|
+
invitee3,
|
|
41
|
+
invitee4,
|
|
42
|
+
invitee5,
|
|
43
|
+
invitee6,
|
|
44
|
+
invitee7,
|
|
45
|
+
invitee8
|
|
46
|
+
] = await ethers.getSigners();
|
|
22
47
|
|
|
23
48
|
const InvitesV2 = await ethers.getContractFactory("InvitesV2");
|
|
24
49
|
|
|
@@ -37,12 +62,24 @@ describe("InvitesV2", () => {
|
|
|
37
62
|
setDAOAddress = sda;
|
|
38
63
|
setSchemes = sc;
|
|
39
64
|
|
|
40
|
-
invites = (await upgrades.deployProxy(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
65
|
+
invites = (await upgrades.deployProxy(
|
|
66
|
+
InvitesV2,
|
|
67
|
+
[nameService.address, 500, founder.address],
|
|
68
|
+
{
|
|
69
|
+
kind: "uups"
|
|
70
|
+
}
|
|
71
|
+
)) as InvitesV2;
|
|
72
|
+
|
|
73
|
+
gd = (await ethers.getContractAt(
|
|
74
|
+
"IGoodDollar",
|
|
75
|
+
gooddollar,
|
|
76
|
+
founder
|
|
77
|
+
)) as IGoodDollar;
|
|
78
|
+
id = (await ethers.getContractAt(
|
|
79
|
+
"IdentityV2",
|
|
80
|
+
identity,
|
|
81
|
+
founder
|
|
82
|
+
)) as IdentityV2;
|
|
46
83
|
|
|
47
84
|
await gd["mint(address,uint256)"](invites.address, BN.from(5000));
|
|
48
85
|
await loadFixture(initialState);
|
|
@@ -51,13 +88,21 @@ describe("InvitesV2", () => {
|
|
|
51
88
|
|
|
52
89
|
it("v1 should be upgradeable via old proxy method", async () => {
|
|
53
90
|
const InvitesV1 = await ethers.getContractFactory("InvitesV1");
|
|
54
|
-
const invites = await upgrades.deployProxy(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
91
|
+
const invites = await upgrades.deployProxy(
|
|
92
|
+
InvitesV1,
|
|
93
|
+
[avatar, id.address, gd.address, 500],
|
|
94
|
+
{
|
|
95
|
+
kind: "transparent"
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
const res = await upgrades.upgradeProxy(
|
|
99
|
+
invites.address,
|
|
100
|
+
await ethers.getContractFactory("InvitesFuseV2"),
|
|
101
|
+
{
|
|
102
|
+
kind: "transparent",
|
|
103
|
+
unsafeAllowRenames: true
|
|
104
|
+
}
|
|
105
|
+
);
|
|
61
106
|
expect(res).not.empty;
|
|
62
107
|
});
|
|
63
108
|
|
|
@@ -73,26 +118,40 @@ describe("InvitesV2", () => {
|
|
|
73
118
|
});
|
|
74
119
|
|
|
75
120
|
it("should let anyone join", async () => {
|
|
76
|
-
await invites
|
|
121
|
+
await invites
|
|
122
|
+
.connect(inviter1)
|
|
123
|
+
.join(ethers.utils.hexZeroPad("0xfa", 32), ethers.constants.HashZero);
|
|
77
124
|
let inviter = await invites.users(inviter1.address);
|
|
78
125
|
expect(inviter.inviteCode).to.equal(ethers.utils.hexZeroPad("0xfa", 32));
|
|
79
126
|
});
|
|
80
127
|
|
|
81
128
|
it("should allow to join only once", async () => {
|
|
82
129
|
await expect(
|
|
83
|
-
invites
|
|
84
|
-
|
|
130
|
+
invites
|
|
131
|
+
.connect(inviter1)
|
|
132
|
+
.join(
|
|
133
|
+
ethers.utils.hexZeroPad("0xfa", 32),
|
|
134
|
+
ethers.utils.hexZeroPad("0x01", 32)
|
|
135
|
+
)
|
|
136
|
+
).to.revertedWith(/user already joined/);
|
|
85
137
|
});
|
|
86
138
|
|
|
87
139
|
it("should not allow code reuse", async () => {
|
|
88
140
|
// const invites = await Invites.deployed();
|
|
89
141
|
await expect(
|
|
90
|
-
invites
|
|
91
|
-
|
|
142
|
+
invites
|
|
143
|
+
.connect(inviter2)
|
|
144
|
+
.join(ethers.utils.hexZeroPad("0xfa", 32), ethers.constants.HashZero)
|
|
145
|
+
).to.revertedWith(/invite code already in use/);
|
|
92
146
|
});
|
|
93
147
|
|
|
94
148
|
it("should mark inviter", async () => {
|
|
95
|
-
await invites
|
|
149
|
+
await invites
|
|
150
|
+
.connect(invitee1)
|
|
151
|
+
.join(
|
|
152
|
+
ethers.utils.hexZeroPad("0xaa", 32),
|
|
153
|
+
ethers.utils.hexZeroPad("0xfa", 32)
|
|
154
|
+
);
|
|
96
155
|
let invitee = await invites.users(invitee1.address);
|
|
97
156
|
let inviterInvitees = await invites.getInvitees(inviter1.address);
|
|
98
157
|
expect(invitee.invitedBy).to.be.equal(inviter1.address);
|
|
@@ -100,9 +159,9 @@ describe("InvitesV2", () => {
|
|
|
100
159
|
});
|
|
101
160
|
|
|
102
161
|
it("should not pay bounty for non whitelisted invitee", async () => {
|
|
103
|
-
await expect(
|
|
104
|
-
|
|
105
|
-
);
|
|
162
|
+
await expect(
|
|
163
|
+
invites.connect(inviter1).bountyFor(invitee1.address)
|
|
164
|
+
).to.revertedWith(/user not elligble for bounty yet/);
|
|
106
165
|
});
|
|
107
166
|
|
|
108
167
|
it("should not allow to pay bounty for non whitelisted inviter", async () => {
|
|
@@ -116,29 +175,45 @@ describe("InvitesV2", () => {
|
|
|
116
175
|
|
|
117
176
|
it("should pay bounty for whitelisted invitee and inviter", async () => {
|
|
118
177
|
const bounty = (await invites.levels(0)).bounty.toNumber();
|
|
119
|
-
await id
|
|
120
|
-
|
|
178
|
+
await id
|
|
179
|
+
.addWhitelistedWithDID(inviter1.address, Math.random() + "")
|
|
180
|
+
.catch(e => e);
|
|
181
|
+
const startBalance = await gd
|
|
182
|
+
.balanceOf(inviter1.address)
|
|
183
|
+
.then(_ => _.toNumber());
|
|
121
184
|
expect(await id.isWhitelisted(inviter1.address)).to.be.true;
|
|
122
185
|
let pending = await invites.getPendingInvitees(inviter1.address);
|
|
123
186
|
expect(pending.length, "pending").to.be.equal(1);
|
|
124
|
-
const inviteeBalance = await gd
|
|
187
|
+
const inviteeBalance = await gd
|
|
188
|
+
.balanceOf(invitee1.address)
|
|
189
|
+
.then(_ => _.toNumber());
|
|
125
190
|
await invites.connect(inviter1).bountyFor(invitee1.address);
|
|
126
191
|
|
|
127
192
|
let invitee = await invites.users(invitee1.address);
|
|
128
193
|
let inviter = await invites.users(inviter1.address);
|
|
129
|
-
const endBalance = await gd
|
|
194
|
+
const endBalance = await gd
|
|
195
|
+
.balanceOf(inviter1.address)
|
|
196
|
+
.then(_ => _.toNumber());
|
|
130
197
|
|
|
131
198
|
pending = await invites.getPendingInvitees(inviter1.address);
|
|
132
|
-
const txFee = await gd["getFees(uint256)"](bounty).then(_ =>
|
|
133
|
-
|
|
199
|
+
const txFee = await gd["getFees(uint256)"](bounty).then(_ =>
|
|
200
|
+
_["0"].toNumber()
|
|
201
|
+
); //gd might have a tx fee
|
|
202
|
+
const txFee2 = await gd["getFees(uint256)"](bounty / 2).then(_ =>
|
|
203
|
+
_["0"].toNumber()
|
|
204
|
+
); //gd might have a tx fee
|
|
134
205
|
|
|
135
206
|
expect(pending.length, "pending").to.be.equal(0);
|
|
136
207
|
expect(invitee.bountyPaid).to.be.true;
|
|
137
208
|
expect(inviter.totalApprovedInvites.toNumber()).to.be.equal(1);
|
|
138
209
|
expect(inviter.totalEarned.toNumber()).to.be.equal(bounty);
|
|
139
|
-
expect(endBalance - startBalance + txFee, "inviter rewards not matching bounty").to.be.equal(bounty);
|
|
140
210
|
expect(
|
|
141
|
-
|
|
211
|
+
endBalance - startBalance + txFee,
|
|
212
|
+
"inviter rewards not matching bounty"
|
|
213
|
+
).to.be.equal(bounty);
|
|
214
|
+
expect(
|
|
215
|
+
(await gd.balanceOf(invitee1.address).then(_ => _.toNumber())) -
|
|
216
|
+
inviteeBalance,
|
|
142
217
|
"invitee rewrad should be bounty/2"
|
|
143
218
|
).to.be.equal(bounty / 2 - txFee2); //test that invitee got half bonus
|
|
144
219
|
});
|
|
@@ -146,20 +221,33 @@ describe("InvitesV2", () => {
|
|
|
146
221
|
it("should update global stats", async () => {
|
|
147
222
|
const bounty = (await invites.levels(0)).bounty.toNumber();
|
|
148
223
|
const stats = await invites.stats();
|
|
149
|
-
expect(stats.totalApprovedInvites.toNumber()).to.be.equal(
|
|
224
|
+
expect(stats.totalApprovedInvites.toNumber()).to.be.equal(
|
|
225
|
+
1,
|
|
226
|
+
"approved invites"
|
|
227
|
+
);
|
|
150
228
|
expect(stats.totalInvited.toNumber()).to.be.equal(1, "total invited");
|
|
151
229
|
expect(stats.totalBountiesPaid.toNumber()).to.be.equal(bounty);
|
|
152
230
|
});
|
|
153
231
|
|
|
154
232
|
it("should not pay bounty twice", async () => {
|
|
155
|
-
await expect(
|
|
156
|
-
|
|
157
|
-
);
|
|
233
|
+
await expect(
|
|
234
|
+
invites.connect(inviter2).bountyFor(invitee1.address)
|
|
235
|
+
).to.revertedWith(/user not elligble for bounty yet/);
|
|
158
236
|
});
|
|
159
237
|
|
|
160
238
|
it("should not fail in collectBounties for invalid invitees", async () => {
|
|
161
|
-
await invites
|
|
162
|
-
|
|
239
|
+
await invites
|
|
240
|
+
.connect(invitee7)
|
|
241
|
+
.join(
|
|
242
|
+
ethers.utils.hexZeroPad("0x01", 32),
|
|
243
|
+
ethers.utils.hexZeroPad("0xfa", 32)
|
|
244
|
+
);
|
|
245
|
+
await invites
|
|
246
|
+
.connect(invitee8)
|
|
247
|
+
.join(
|
|
248
|
+
ethers.utils.hexZeroPad("0x02", 32),
|
|
249
|
+
ethers.utils.hexZeroPad("0xfa", 32)
|
|
250
|
+
);
|
|
163
251
|
|
|
164
252
|
let pending = await invites.getPendingInvitees(inviter1.address);
|
|
165
253
|
expect(pending.length, "pending").to.be.equal(2);
|
|
@@ -167,7 +255,9 @@ describe("InvitesV2", () => {
|
|
|
167
255
|
let user1 = await invites.users(invitee7.address);
|
|
168
256
|
let user2 = await invites.users(invitee8.address);
|
|
169
257
|
pending = await invites.getPendingInvitees(inviter1.address);
|
|
170
|
-
expect(
|
|
258
|
+
expect(
|
|
259
|
+
await invites.getPendingBounties(inviter1.address).then(_ => _.toNumber())
|
|
260
|
+
).to.be.equal(0);
|
|
171
261
|
expect(user1.bountyPaid).to.be.false;
|
|
172
262
|
expect(user2.bountyPaid).to.be.false;
|
|
173
263
|
expect(pending.length, "pending").to.be.equal(2);
|
|
@@ -176,22 +266,26 @@ describe("InvitesV2", () => {
|
|
|
176
266
|
it("should collectBounties for inviter", async () => {
|
|
177
267
|
await id.addWhitelistedWithDID(invitee7.address, Math.random() + "");
|
|
178
268
|
await id.addWhitelistedWithDID(invitee8.address, Math.random() + "");
|
|
179
|
-
expect(
|
|
269
|
+
expect(
|
|
270
|
+
await invites.getPendingBounties(inviter1.address).then(_ => _.toNumber())
|
|
271
|
+
).to.be.equal(2);
|
|
180
272
|
const res = await invites.connect(inviter1).collectBounties();
|
|
181
273
|
|
|
182
274
|
let user1 = await invites.users(invitee7.address);
|
|
183
275
|
let user2 = await invites.users(invitee8.address);
|
|
184
276
|
let pending = await invites.getPendingInvitees(inviter1.address);
|
|
185
|
-
expect(
|
|
277
|
+
expect(
|
|
278
|
+
await invites.getPendingBounties(inviter1.address).then(_ => _.toNumber())
|
|
279
|
+
).to.be.equal(0);
|
|
186
280
|
expect(pending.length, "pending").to.be.equal(0);
|
|
187
281
|
expect(user1.bountyPaid, "user1").to.be.true;
|
|
188
282
|
expect(user2.bountyPaid, "user2").to.be.true;
|
|
189
283
|
});
|
|
190
284
|
|
|
191
285
|
it("should not set level not by owner", async () => {
|
|
192
|
-
await expect(
|
|
193
|
-
|
|
194
|
-
);
|
|
286
|
+
await expect(
|
|
287
|
+
invites.connect(inviter1).setLevel(0, 1, 5, 1)
|
|
288
|
+
).to.revertedWith(/Only owner or avatar can perform this action/);
|
|
195
289
|
});
|
|
196
290
|
|
|
197
291
|
it("should set level by owner", async () => {
|
|
@@ -213,14 +307,30 @@ describe("InvitesV2", () => {
|
|
|
213
307
|
.then(_ => _.wait())
|
|
214
308
|
.catch(e => e);
|
|
215
309
|
|
|
216
|
-
await id
|
|
310
|
+
await id
|
|
311
|
+
.addWhitelistedWithDID(inviter1.address, Math.random() + "")
|
|
312
|
+
.catch(e => e);
|
|
217
313
|
await invites.setLevel(0, 1, 5, 1); //1 inviter to level up
|
|
218
314
|
await invites.setLevel(1, 0, 10, 2); // 10 bounty for second level
|
|
219
315
|
|
|
220
|
-
await invites
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
316
|
+
await invites
|
|
317
|
+
.connect(invitee4)
|
|
318
|
+
.join(
|
|
319
|
+
ethers.utils.hexZeroPad("0x03", 32),
|
|
320
|
+
ethers.utils.hexZeroPad("0xfa", 32)
|
|
321
|
+
);
|
|
322
|
+
await invites
|
|
323
|
+
.connect(invitee5)
|
|
324
|
+
.join(
|
|
325
|
+
ethers.utils.hexZeroPad("0x04", 32),
|
|
326
|
+
ethers.utils.hexZeroPad("0xfa", 32)
|
|
327
|
+
);
|
|
328
|
+
await id
|
|
329
|
+
.addWhitelistedWithDID(invitee4.address, Math.random() + "")
|
|
330
|
+
.catch(e => e);
|
|
331
|
+
await id
|
|
332
|
+
.addWhitelistedWithDID(invitee5.address, Math.random() + "")
|
|
333
|
+
.catch(e => e);
|
|
224
334
|
const res1 = await (await invites.bountyFor(invitee4.address)).wait();
|
|
225
335
|
|
|
226
336
|
const log1 = res1.events.find(_ => _.event === "InviterBounty");
|
|
@@ -231,7 +341,9 @@ describe("InvitesV2", () => {
|
|
|
231
341
|
|
|
232
342
|
let inviter = await invites.users(inviter1.address);
|
|
233
343
|
expect(inviter.level.toNumber()).to.be.equal(1);
|
|
234
|
-
const res2 = await (
|
|
344
|
+
const res2 = await (
|
|
345
|
+
await invites.connect(inviter1).collectBounties()
|
|
346
|
+
).wait();
|
|
235
347
|
const log2 = res2.events.find(_ => _.event === "InviterBounty");
|
|
236
348
|
expect(log2.event).to.be.equal("InviterBounty");
|
|
237
349
|
expect(log2.args.inviterLevel.toNumber()).to.be.equal(1);
|
|
@@ -240,27 +352,50 @@ describe("InvitesV2", () => {
|
|
|
240
352
|
});
|
|
241
353
|
|
|
242
354
|
it("should allow to set inviter later and pay bounty", async () => {
|
|
243
|
-
await invites
|
|
244
|
-
|
|
355
|
+
await invites
|
|
356
|
+
.connect(invitee6)
|
|
357
|
+
.join(ethers.utils.hexZeroPad("0xfd", 32), ethers.constants.HashZero);
|
|
358
|
+
await invites
|
|
359
|
+
.connect(invitee6)
|
|
360
|
+
.join(
|
|
361
|
+
ethers.utils.hexZeroPad("0xfd", 32),
|
|
362
|
+
ethers.utils.hexZeroPad("0xfa", 32)
|
|
363
|
+
);
|
|
245
364
|
const invitee = await invites.users(invitee6.address);
|
|
246
365
|
expect(invitee.invitedBy).to.equal(inviter1.address);
|
|
247
|
-
await id
|
|
248
|
-
|
|
366
|
+
await id
|
|
367
|
+
.addWhitelistedWithDID(invitee6.address, Math.random() + "")
|
|
368
|
+
.catch(e => e);
|
|
369
|
+
await expect(invites.bountyFor(invitee6.address)).to.emit(
|
|
370
|
+
invites,
|
|
371
|
+
"InviterBounty"
|
|
372
|
+
);
|
|
249
373
|
});
|
|
250
374
|
|
|
251
375
|
describe("MultiChain", () => {
|
|
252
376
|
it("should not revert if old identity contract without getWhitelistedOnChain", async () => {
|
|
253
377
|
await loadFixture(initialState);
|
|
254
|
-
const contractFactory = new ethers.ContractFactory(
|
|
378
|
+
const contractFactory = new ethers.ContractFactory(
|
|
379
|
+
IdentityABI.abi,
|
|
380
|
+
IdentityABI.bytecode,
|
|
381
|
+
founder
|
|
382
|
+
);
|
|
255
383
|
const oldId = await contractFactory.deploy();
|
|
256
384
|
await oldId.setAvatar(avatar);
|
|
257
385
|
await setSchemes([oldId.address], []);
|
|
258
386
|
await setDAOAddress("IDENTITY", oldId.address);
|
|
259
387
|
|
|
260
388
|
expect(await invites.getIdentity()).equal(oldId.address);
|
|
261
|
-
await invites
|
|
389
|
+
await invites
|
|
390
|
+
.connect(inviter1)
|
|
391
|
+
.join(ethers.utils.hexZeroPad("0xfa", 32), ethers.constants.HashZero);
|
|
262
392
|
|
|
263
|
-
await invites
|
|
393
|
+
await invites
|
|
394
|
+
.connect(invitee2)
|
|
395
|
+
.join(
|
|
396
|
+
ethers.utils.hexZeroPad("0xaa", 32),
|
|
397
|
+
ethers.utils.hexZeroPad("0xfa", 32)
|
|
398
|
+
);
|
|
264
399
|
|
|
265
400
|
await oldId.addWhitelistedWithDID(invitee2.address, Math.random() + "");
|
|
266
401
|
await oldId.addWhitelistedWithDID(inviter1.address, Math.random() + "");
|
|
@@ -270,50 +405,102 @@ describe("InvitesV2", () => {
|
|
|
270
405
|
it("should always be able to use my address as invite code", async () => {
|
|
271
406
|
await loadFixture(initialState);
|
|
272
407
|
|
|
273
|
-
await invites
|
|
408
|
+
await invites
|
|
409
|
+
.connect(inviter1)
|
|
410
|
+
.join(
|
|
411
|
+
ethers.utils.hexZeroPad(inviter1.address, 32),
|
|
412
|
+
ethers.constants.HashZero
|
|
413
|
+
);
|
|
274
414
|
|
|
275
415
|
await expect(
|
|
276
|
-
invites
|
|
416
|
+
invites
|
|
417
|
+
.connect(inviter2)
|
|
418
|
+
.join(
|
|
419
|
+
ethers.utils.hexZeroPad(inviter2.address, 32),
|
|
420
|
+
ethers.constants.HashZero
|
|
421
|
+
)
|
|
277
422
|
).not.reverted;
|
|
278
423
|
|
|
279
424
|
await expect(
|
|
280
|
-
invites
|
|
425
|
+
invites
|
|
426
|
+
.connect(inviter1)
|
|
427
|
+
.join(
|
|
428
|
+
ethers.utils.hexZeroPad(inviter1.address, 32),
|
|
429
|
+
ethers.constants.HashZero
|
|
430
|
+
)
|
|
281
431
|
).reverted;
|
|
282
432
|
});
|
|
283
433
|
|
|
284
434
|
it("should not allow to claim if whitelisted originally on another chain", async () => {
|
|
285
435
|
await loadFixture(initialState);
|
|
286
|
-
await invites
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
await
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
436
|
+
await invites
|
|
437
|
+
.connect(inviter1)
|
|
438
|
+
.join(ethers.utils.hexZeroPad("0xfa", 32), ethers.constants.HashZero);
|
|
439
|
+
await invites
|
|
440
|
+
.connect(invitee2)
|
|
441
|
+
.join(
|
|
442
|
+
ethers.utils.hexZeroPad("0xaa", 32),
|
|
443
|
+
ethers.utils.hexZeroPad("0xfa", 32)
|
|
444
|
+
);
|
|
445
|
+
|
|
446
|
+
await id.addWhitelistedWithDIDAndChain(
|
|
447
|
+
invitee2.address,
|
|
448
|
+
Math.random() + "",
|
|
449
|
+
122,
|
|
450
|
+
0
|
|
293
451
|
);
|
|
452
|
+
expect(await id.getWhitelistedOnChainId(invitee2.address)).equal(122);
|
|
453
|
+
await expect(
|
|
454
|
+
invites.connect(inviter1).bountyFor(invitee2.address)
|
|
455
|
+
).to.revertedWith(/user not elligble for bounty yet/);
|
|
294
456
|
});
|
|
295
457
|
|
|
296
458
|
it("should allow to claim if whitelisted originally on same chain", async () => {
|
|
297
459
|
await loadFixture(initialState);
|
|
298
|
-
await invites
|
|
299
|
-
|
|
460
|
+
await invites
|
|
461
|
+
.connect(inviter1)
|
|
462
|
+
.join(ethers.utils.hexZeroPad("0xfa", 32), ethers.constants.HashZero);
|
|
463
|
+
await invites
|
|
464
|
+
.connect(invitee2)
|
|
465
|
+
.join(
|
|
466
|
+
ethers.utils.hexZeroPad("0xaa", 32),
|
|
467
|
+
ethers.utils.hexZeroPad("0xfa", 32)
|
|
468
|
+
);
|
|
300
469
|
|
|
301
470
|
await id.addWhitelistedWithDID(inviter1.address, Math.random() + "");
|
|
302
471
|
|
|
303
|
-
await id.addWhitelistedWithDIDAndChain(
|
|
472
|
+
await id.addWhitelistedWithDIDAndChain(
|
|
473
|
+
invitee2.address,
|
|
474
|
+
Math.random() + "",
|
|
475
|
+
4447,
|
|
476
|
+
0
|
|
477
|
+
);
|
|
304
478
|
expect(await id.getWhitelistedOnChainId(invitee2.address)).equal(4447);
|
|
305
|
-
await expect(invites.connect(inviter1).bountyFor(invitee2.address)).not
|
|
479
|
+
await expect(invites.connect(inviter1).bountyFor(invitee2.address)).not
|
|
480
|
+
.reverted;
|
|
306
481
|
});
|
|
307
482
|
|
|
308
483
|
it("should pay bounty on join for whitelisted invitee and inviter", async () => {
|
|
309
484
|
await loadFixture(initialState);
|
|
310
|
-
await id
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
await
|
|
485
|
+
await id
|
|
486
|
+
.addWhitelistedWithDID(inviter1.address, Math.random() + "")
|
|
487
|
+
.catch(e => e);
|
|
488
|
+
await id
|
|
489
|
+
.addWhitelistedWithDID(invitee1.address, Math.random() + "")
|
|
490
|
+
.catch(e => e);
|
|
491
|
+
|
|
492
|
+
await invites
|
|
493
|
+
.connect(inviter1)
|
|
494
|
+
.join(
|
|
495
|
+
ethers.utils.hexZeroPad(inviter1.address, 32),
|
|
496
|
+
ethers.constants.HashZero
|
|
497
|
+
);
|
|
314
498
|
const tx = await invites
|
|
315
499
|
.connect(invitee1)
|
|
316
|
-
.join(
|
|
500
|
+
.join(
|
|
501
|
+
ethers.utils.hexZeroPad(invitee1.address, 32),
|
|
502
|
+
ethers.utils.hexZeroPad(inviter1.address, 32)
|
|
503
|
+
);
|
|
317
504
|
const { events } = await tx.wait();
|
|
318
505
|
const bountyEvent = events.find(_ => _.event === "InviterBounty");
|
|
319
506
|
expect(bountyEvent).not.empty;
|
|
@@ -321,8 +508,12 @@ describe("InvitesV2", () => {
|
|
|
321
508
|
});
|
|
322
509
|
|
|
323
510
|
it("should end contract by owner", async () => {
|
|
324
|
-
expect(
|
|
511
|
+
expect(
|
|
512
|
+
await gd.balanceOf(invites.address).then(_ => _.toNumber())
|
|
513
|
+
).to.be.gt(0);
|
|
325
514
|
await invites.end();
|
|
326
|
-
expect(
|
|
515
|
+
expect(
|
|
516
|
+
await gd.balanceOf(invites.address).then(_ => _.toNumber())
|
|
517
|
+
).to.be.eq(0);
|
|
327
518
|
});
|
|
328
519
|
});
|