@gooddollar/goodprotocol 1.0.29-beta.4 → 1.0.29-beta.5
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/ERC20PresetMinterPauserUpgradeable.min.json +1 -0
- package/artifacts/abis/ERC677.min.json +1 -0
- package/artifacts/abis/ERC677Receiver.min.json +1 -0
- package/artifacts/abis/GoodDollar.min.json +1 -0
- package/artifacts/abis/IFeesFormula.min.json +1 -0
- package/artifacts/abis/IIdentity.min.json +1 -1
- package/artifacts/abis/IIdentityV2.min.json +1 -1
- package/artifacts/abis/IdentityV2.min.json +1 -1
- package/artifacts/abis/InvitesV2.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/IIdentity.json +19 -0
- package/artifacts/contracts/Interfaces.sol/IIdentityV2.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IIdentityV2.json +19 -0
- 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/Faucet.sol/Faucet.json +2 -2
- package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.json +2 -2
- package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
- package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.json +2 -2
- package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
- package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.json +2 -2
- package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
- package/artifacts/contracts/governance/GReputation.sol/GReputation.json +2 -2
- package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.json +2 -2
- package/artifacts/contracts/governance/GoodDollarStaking.sol/IGovernanceStaking.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/GovernanceStaking.sol/GovernanceStaking.json +2 -2
- 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/Reputation.sol/Reputation.json +2 -2
- package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
- package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.json +2 -2
- package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.dbg.json +1 -1
- package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.json +33 -2
- package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.json +2 -2
- package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.json +38 -10
- package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.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/DistributionBridgeMock.sol/DistributionBridgeMock.json +2 -2
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.json +2 -2
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.json +2 -2
- package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.json +2 -2
- package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.json +2 -2
- package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.json +2 -2
- 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/MultichainRouterMock.sol/MultichainRouterMock.json +2 -2
- 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/OverMintTester.sol/OverMintTester.json +2 -2
- package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.json +2 -2
- 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/SwapHelperTest.sol/SwapHelperTest.json +2 -2
- 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/UpgradableMock.json +2 -2
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.json +2 -2
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.json +2 -2
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.json +2 -2
- 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/DistributionHelper.sol/DistributionHelper.json +2 -2
- package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.json +2 -2
- package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.json +2 -2
- 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/reserve/GoodReserveCDai.sol/GoodReserveCDai.json +2 -2
- package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
- package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.json +2 -2
- package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.dbg.json +1 -1
- package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.json +2 -2
- package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.json +2 -2
- package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.dbg.json +1 -1
- package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.json +2 -2
- 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/GoodFundManager.sol/GoodFundManager.json +2 -2
- 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/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.json +2 -2
- package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.json +2 -2
- package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.json +2 -2
- package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.json +2 -2
- package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.json +2 -2
- package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.json +2 -2
- package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.json +2 -2
- 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 +4 -0
- package/artifacts/contracts/token/ERC20PresetMinterPauserUpgradeable.sol/ERC20PresetMinterPauserUpgradeable.json +755 -0
- package/artifacts/contracts/token/ERC677.sol/ERC677.dbg.json +4 -0
- package/artifacts/contracts/token/ERC677.sol/ERC677.json +66 -0
- package/artifacts/contracts/token/ERC677.sol/ERC677Receiver.dbg.json +4 -0
- package/artifacts/contracts/token/ERC677.sol/ERC677Receiver.json +40 -0
- package/artifacts/contracts/token/FeesFormula.sol/IFeesFormula.dbg.json +4 -0
- package/artifacts/contracts/token/FeesFormula.sol/IFeesFormula.json +45 -0
- package/artifacts/contracts/token/GoodDollar.sol/GoodDollar.dbg.json +4 -0
- package/artifacts/contracts/token/GoodDollar.sol/GoodDollar.json +1180 -0
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.json +2 -2
- package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
- package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.json +2 -2
- 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/BulkProof.sol/BulkProof.json +2 -2
- package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOContract.sol/DAOContract.json +2 -2
- package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.json +2 -2
- 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/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.json +2 -2
- 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/GoodDollarMintBurnWrapper.sol/TokenOperation.json +2 -2
- package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.json +2 -2
- package/artifacts/contracts/utils/NameService.sol/NameService.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/ProtocolUpgrade.sol/ProtocolUpgrade.json +2 -2
- package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.json +2 -2
- package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.json +2 -2
- package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.json +2 -2
- 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/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.json +2 -2
- package/contracts/Interfaces.sol +2 -0
- package/contracts/fuseFaucet/Faucet.sol +3 -3
- package/contracts/fuseFaucet/FuseFaucet.sol +1 -2
- package/contracts/governance/GReputation.sol +5 -4
- package/contracts/identity/IdentityV2.sol +79 -28
- package/contracts/invite/InvitesV1.sol +5 -24
- package/contracts/invite/InvitesV2.sol +8 -15
- package/contracts/mocks/UpgradableMocks.sol +5 -3
- package/contracts/token/ERC20PresetMinterPauserUpgradeable.sol +140 -0
- package/contracts/token/ERC677.sol +74 -0
- package/contracts/token/FeesFormula.sol +10 -0
- package/contracts/token/GoodDollar.sol +234 -0
- package/hardhat.config.ts +5 -5
- package/package.json +3 -2
- package/releases/deployment.json +1 -1
- package/scripts/multichain-deploy/1_basicdao-deploy.ts +45 -28
- package/scripts/multichain-deploy/2_helpers-deploy.ts +1 -7
- package/test/faucet/Faucet.test.ts +184 -0
- package/test/{FuseFaucet.test.ts → faucet/FuseFaucet.test.ts} +4 -3
- package/test/governance/ClaimersDistribution.test.ts +3 -2
- package/test/governance/CompoundVotingMachine.castvote.test.ts +3 -2
- package/test/governance/CompoundVotingMachine.crossblockchain.ts +3 -2
- package/test/governance/CompoundVotingMachine.daoscheme.ts +3 -2
- package/test/governance/CompoundVotingMachine.delegate.test.ts +3 -2
- package/test/governance/CompoundVotingMachine.guardian.test.ts +3 -2
- package/test/governance/CompoundVotingMachine.propose.test.ts +3 -2
- package/test/governance/CompoundVotingMachine.state.test.ts +3 -2
- package/test/governance/GReputation.test.ts +22 -14
- package/test/governance/GoodDollarStaking.gd.test.ts +2 -1
- package/test/governance/GoodDollarStaking.good.test.ts +2 -1
- package/test/governance/GovernanceStaking.test.ts +4 -3
- package/test/governance/Reputation.test.ts +2 -1
- package/test/governance/StakersDistribution.test.ts +26 -12
- package/test/helpers.ts +61 -29
- package/test/identity/IdentityV2.test.ts +481 -0
- package/test/{InvitesV1.test.ts → invite/InvitesV1.test.ts} +4 -3
- package/test/invite/InvitesV2.test.ts +355 -0
- package/test/reserve/DistributionHelper.test.ts +2 -1
- package/test/reserve/GoodMarketMaker.test.ts +15 -8
- package/test/reserve/GoodReserveCDai.cap.test.ts +8 -1
- package/test/reserve/GoodReserveCDai.distribution.test.ts +2 -1
- package/test/reserve/GoodReserveCDai.gdx.test.ts +2 -1
- package/test/reserve/GoodReserveCDai.pause.test.ts +2 -1
- package/test/reserve/GoodReserveCDai.test.ts +11 -28
- package/test/reserve/GoodReserveCDai.uniswap.test.ts +20 -18
- package/test/staking/CompoundStakingFactory.test.ts +8 -4
- package/test/staking/DifferentStakingTokens.test.ts +3 -2
- package/test/staking/DonationsStaking.test.ts +33 -24
- package/test/staking/FuseStaking.test.ts +2 -2
- package/test/staking/GoodAaveStakingFactory.test.ts +36 -30
- package/test/staking/SimpleDAIStaking.test.ts +12 -16
- package/test/staking/StakingRewards.test.ts +22 -18
- package/test/staking/StakingRewardsFixedAPY.test.ts +2 -1
- package/test/staking/SwapHelper.test.ts +20 -17
- package/test/staking/UsdcAaveStaking.test.ts +36 -33
- package/test/token/GoodDollar.test.ts +277 -0
- package/test/ubi/UBIScheme.e2e.test.ts +4 -3
- package/test/ubi/UBIScheme.test.ts +3 -2
- package/test/ubi/UBISchemeCycle.test.ts +2 -1
- package/test/utils/AdminWallet.test.ts +2 -1
- package/test/utils/DAOUpgradeableContract.test.ts +3 -2
- package/test/utils/GoodDollarMintBurnWrapper.test.ts +2 -1
- package/test/utils/NameService.test.ts +37 -21
- package/test/utils/ProtocolUpgrade.test.ts +1 -0
- package/test/utils/ProxyFactory.test.ts +1 -0
- package/types/ERC20PermitUpgradeable.ts +522 -0
- package/types/ERC20PresetMinterPauserUpgradeable.ts +105 -1
- package/types/ERC677.ts +131 -0
- package/types/ERC677Receiver.ts +115 -0
- package/types/GoodDollar.ts +1705 -0
- package/types/IERC20PermitUpgradeable.ts +176 -0
- package/types/IFeesFormula.ts +111 -0
- package/types/IIdentity.ts +31 -0
- package/types/IIdentityV2.ts +31 -0
- package/types/IdentityV2.ts +69 -5
- package/types/InvitesV2.ts +61 -7
- package/types/factories/AaveStakingFactory__factory.ts +1 -1
- package/types/factories/AdminWallet__factory.ts +1 -1
- package/types/factories/BaseShareFieldV2__factory.ts +1 -1
- package/types/factories/BaseShareField__factory.ts +1 -1
- package/types/factories/ClaimersDistribution__factory.ts +1 -1
- package/types/factories/CompoundStakingFactory__factory.ts +1 -1
- package/types/factories/CompoundVotingMachine__factory.ts +1 -1
- package/types/factories/DAOContract__factory.ts +1 -1
- package/types/factories/DAOUpgradeableContract__factory.ts +1 -1
- package/types/factories/DistributionBridgeMock__factory.ts +1 -1
- package/types/factories/DistributionHelperTestHelper__factory.ts +1 -1
- package/types/factories/DistributionHelperTest__factory.ts +1 -1
- package/types/factories/DistributionHelper__factory.ts +1 -1
- package/types/factories/DonationsStaking__factory.ts +1 -1
- package/types/factories/ERC20PermitUpgradeable__factory.ts +375 -0
- package/types/factories/ERC20PresetMinterPauserUpgradeable__factory.ts +83 -2
- package/types/factories/ERC677Receiver__factory.ts +55 -0
- package/types/factories/ERC677__factory.ts +75 -0
- package/types/factories/ExchangeHelper__factory.ts +1 -1
- package/types/factories/Faucet__factory.ts +1 -1
- package/types/factories/FuseFaucet__factory.ts +1 -1
- package/types/factories/FuseStakingV3__factory.ts +1 -1
- package/types/factories/GReputation__factory.ts +1 -1
- package/types/factories/GoodAaveStakingV2__factory.ts +1 -1
- package/types/factories/GoodAaveStaking__factory.ts +1 -1
- package/types/factories/GoodCompoundStakingTest__factory.ts +1 -1
- package/types/factories/GoodCompoundStakingV2__factory.ts +1 -1
- package/types/factories/GoodCompoundStaking__factory.ts +1 -1
- package/types/factories/GoodDollarMintBurnWrapper__factory.ts +1 -1
- package/types/factories/GoodDollarStakingMock__factory.ts +1 -1
- package/types/factories/GoodDollarStaking__factory.ts +1 -1
- package/types/factories/GoodDollar__factory.ts +1228 -0
- package/types/factories/GoodFundManagerTest__factory.ts +1 -1
- package/types/factories/GoodFundManager__factory.ts +1 -1
- package/types/factories/GoodMarketMaker__factory.ts +1 -1
- package/types/factories/GoodReserveCDai__factory.ts +1 -1
- package/types/factories/GovernanceStaking__factory.ts +1 -1
- package/types/factories/IERC20PermitUpgradeable__factory.ts +105 -0
- package/types/factories/IFeesFormula__factory.ts +57 -0
- package/types/factories/IIdentityV2__factory.ts +19 -0
- package/types/factories/IIdentity__factory.ts +19 -0
- package/types/factories/IdentityV2__factory.ts +32 -1
- package/types/factories/InvitesV1__factory.ts +1 -1
- package/types/factories/InvitesV2__factory.ts +37 -9
- package/types/factories/MultichainBridgeHelper__factory.ts +1 -1
- package/types/factories/MultichainRouterMock__factory.ts +1 -1
- package/types/factories/OverMintTesterRegularStake__factory.ts +1 -1
- package/types/factories/OverMintTester__factory.ts +1 -1
- package/types/factories/ProtocolUpgradeFuseRecover__factory.ts +1 -1
- package/types/factories/ProtocolUpgradeFuse__factory.ts +1 -1
- package/types/factories/ProtocolUpgradeRecover__factory.ts +1 -1
- package/types/factories/ProtocolUpgrade__factory.ts +1 -1
- package/types/factories/ReputationTestHelper__factory.ts +1 -1
- package/types/factories/Reputation__factory.ts +1 -1
- package/types/factories/StakersDistribution__factory.ts +1 -1
- package/types/factories/SwapHelperTest__factory.ts +1 -1
- package/types/factories/UBIScheme__factory.ts +1 -1
- package/types/factories/UniswapV2SwapHelper__factory.ts +1 -1
- package/types/factories/UpgradableMock2__factory.ts +1 -1
- package/types/factories/UpgradableMock3__factory.ts +1 -1
- package/types/factories/UpgradableMock4__factory.ts +1 -1
- package/types/factories/UpgradableMock__factory.ts +1 -1
- package/types/hardhat.d.ts +63 -0
- package/types/index.ts +12 -0
- package/yarn.lock +11 -29
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import hre, { ethers, upgrades } from "hardhat";
|
|
2
|
+
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
|
|
3
|
+
import { expect } from "chai";
|
|
4
|
+
import { InvitesV2, IGoodDollar, IIdentity } from "../../types";
|
|
5
|
+
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address";
|
|
6
|
+
import { createDAO } from "../helpers";
|
|
7
|
+
|
|
8
|
+
const BN = ethers.BigNumber;
|
|
9
|
+
|
|
10
|
+
describe("InvitesV2", () => {
|
|
11
|
+
let invites: InvitesV2, founder: SignerWithAddress;
|
|
12
|
+
let inviter1,
|
|
13
|
+
inviter2,
|
|
14
|
+
invitee1,
|
|
15
|
+
invitee2,
|
|
16
|
+
invitee3,
|
|
17
|
+
invitee4,
|
|
18
|
+
invitee5,
|
|
19
|
+
invitee6,
|
|
20
|
+
invitee7,
|
|
21
|
+
invitee8;
|
|
22
|
+
|
|
23
|
+
let avatar, gd: IGoodDollar, Controller, id: IIdentity;
|
|
24
|
+
|
|
25
|
+
before(async () => {
|
|
26
|
+
[
|
|
27
|
+
founder,
|
|
28
|
+
inviter1,
|
|
29
|
+
inviter2,
|
|
30
|
+
invitee1,
|
|
31
|
+
invitee2,
|
|
32
|
+
invitee3,
|
|
33
|
+
invitee4,
|
|
34
|
+
invitee5,
|
|
35
|
+
invitee6,
|
|
36
|
+
invitee7,
|
|
37
|
+
invitee8
|
|
38
|
+
] = await ethers.getSigners();
|
|
39
|
+
|
|
40
|
+
const InvitesV2 = await ethers.getContractFactory("InvitesV2");
|
|
41
|
+
|
|
42
|
+
let {
|
|
43
|
+
daoCreator,
|
|
44
|
+
controller,
|
|
45
|
+
avatar: av,
|
|
46
|
+
gd: gooddollar,
|
|
47
|
+
identity,
|
|
48
|
+
nameService
|
|
49
|
+
} = await loadFixture(createDAO);
|
|
50
|
+
|
|
51
|
+
Controller = controller;
|
|
52
|
+
avatar = av;
|
|
53
|
+
|
|
54
|
+
invites = (await upgrades.deployProxy(
|
|
55
|
+
InvitesV2,
|
|
56
|
+
[nameService.address, gooddollar, 500, founder.address],
|
|
57
|
+
{
|
|
58
|
+
kind: "uups"
|
|
59
|
+
}
|
|
60
|
+
)) as InvitesV2;
|
|
61
|
+
|
|
62
|
+
gd = (await ethers.getContractAt(
|
|
63
|
+
"IGoodDollar",
|
|
64
|
+
gooddollar,
|
|
65
|
+
founder
|
|
66
|
+
)) as IGoodDollar;
|
|
67
|
+
id = (await ethers.getContractAt(
|
|
68
|
+
"IIdentity",
|
|
69
|
+
identity,
|
|
70
|
+
founder
|
|
71
|
+
)) as IIdentity;
|
|
72
|
+
|
|
73
|
+
await gd["mint(address,uint256)"](invites.address, BN.from(5000));
|
|
74
|
+
// await gd.transfer(invites.address, BN.from(5000));
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it("should have balance", async () => {
|
|
78
|
+
const balance = await gd.balanceOf(invites.address);
|
|
79
|
+
expect(balance).to.equal(5000);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it("should have version", async () => {
|
|
83
|
+
expect(await invites.active()).to.be.true;
|
|
84
|
+
const version = await invites.version();
|
|
85
|
+
expect(version).to.be.equal("2.0");
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("should let anyone join", async () => {
|
|
89
|
+
await invites
|
|
90
|
+
.connect(inviter1)
|
|
91
|
+
.join(ethers.utils.hexZeroPad("0xfa", 32), ethers.constants.HashZero);
|
|
92
|
+
let inviter = await invites.users(inviter1.address);
|
|
93
|
+
expect(inviter.inviteCode).to.equal(ethers.utils.hexZeroPad("0xfa", 32));
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it("should allow to join only once", async () => {
|
|
97
|
+
await expect(
|
|
98
|
+
invites
|
|
99
|
+
.connect(inviter1)
|
|
100
|
+
.join(
|
|
101
|
+
ethers.utils.hexZeroPad("0xfa", 32),
|
|
102
|
+
ethers.utils.hexZeroPad("0x01", 32)
|
|
103
|
+
)
|
|
104
|
+
).to.revertedWith("user already joined");
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it("should not allow code reuse", async () => {
|
|
108
|
+
// const invites = await Invites.deployed();
|
|
109
|
+
await expect(
|
|
110
|
+
invites
|
|
111
|
+
.connect(inviter2)
|
|
112
|
+
.join(ethers.utils.hexZeroPad("0xfa", 32), ethers.constants.HashZero)
|
|
113
|
+
).to.revertedWith("invite code already in use");
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it("should mark inviter", async () => {
|
|
117
|
+
await invites
|
|
118
|
+
.connect(invitee1)
|
|
119
|
+
.join(
|
|
120
|
+
ethers.utils.hexZeroPad("0xaa", 32),
|
|
121
|
+
ethers.utils.hexZeroPad("0xfa", 32)
|
|
122
|
+
);
|
|
123
|
+
let invitee = await invites.users(invitee1.address);
|
|
124
|
+
let inviterInvitees = await invites.getInvitees(inviter1.address);
|
|
125
|
+
expect(invitee.invitedBy).to.be.equal(inviter1.address);
|
|
126
|
+
expect(inviterInvitees).to.include(invitee1.address);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it("should not pay bounty for non whitelisted invitee", async () => {
|
|
130
|
+
await expect(
|
|
131
|
+
invites.connect(inviter1).bountyFor(invitee1.address)
|
|
132
|
+
).to.revertedWith("user not elligble for bounty yet");
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it("should not pay bounty for non whitelisted inviter", async () => {
|
|
136
|
+
await id.addWhitelistedWithDID(invitee1.address, Math.random() + "");
|
|
137
|
+
expect(await id.isWhitelisted(invitee1.address)).to.be.true;
|
|
138
|
+
expect(await invites.canCollectBountyFor(invitee1.address)).to.be.false;
|
|
139
|
+
await expect(
|
|
140
|
+
invites.connect(inviter1).bountyFor(invitee1.address)
|
|
141
|
+
).to.revertedWith("user not elligble for bounty yet");
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it("should pay bounty for whitelisted invitee and inviter", async () => {
|
|
145
|
+
const bounty = (await invites.levels(0)).bounty.toNumber();
|
|
146
|
+
await id
|
|
147
|
+
.addWhitelistedWithDID(inviter1.address, Math.random() + "")
|
|
148
|
+
.catch(e => e);
|
|
149
|
+
const startBalance = await gd
|
|
150
|
+
.balanceOf(inviter1.address)
|
|
151
|
+
.then(_ => _.toNumber());
|
|
152
|
+
expect(await id.isWhitelisted(inviter1.address)).to.be.true;
|
|
153
|
+
let pending = await invites.getPendingInvitees(inviter1.address);
|
|
154
|
+
expect(pending.length, "pending").to.be.equal(1);
|
|
155
|
+
const inviteeBalance = await gd
|
|
156
|
+
.balanceOf(invitee1.address)
|
|
157
|
+
.then(_ => _.toNumber());
|
|
158
|
+
await invites.connect(inviter1).bountyFor(invitee1.address);
|
|
159
|
+
|
|
160
|
+
let invitee = await invites.users(invitee1.address);
|
|
161
|
+
let inviter = await invites.users(inviter1.address);
|
|
162
|
+
const endBalance = await gd
|
|
163
|
+
.balanceOf(inviter1.address)
|
|
164
|
+
.then(_ => _.toNumber());
|
|
165
|
+
|
|
166
|
+
pending = await invites.getPendingInvitees(inviter1.address);
|
|
167
|
+
const txFee = await gd.getFees(bounty).then(_ => _["0"].toNumber()); //gd might have a tx fee
|
|
168
|
+
const txFee2 = await gd.getFees(bounty / 2).then(_ => _["0"].toNumber()); //gd might have a tx fee
|
|
169
|
+
|
|
170
|
+
expect(pending.length, "pending").to.be.equal(0);
|
|
171
|
+
expect(invitee.bountyPaid).to.be.true;
|
|
172
|
+
expect(inviter.totalApprovedInvites.toNumber()).to.be.equal(1);
|
|
173
|
+
expect(inviter.totalEarned.toNumber()).to.be.equal(bounty);
|
|
174
|
+
expect(
|
|
175
|
+
endBalance - startBalance + txFee,
|
|
176
|
+
"inviter rewards not matching bounty"
|
|
177
|
+
).to.be.equal(bounty);
|
|
178
|
+
expect(
|
|
179
|
+
(await gd.balanceOf(invitee1.address).then(_ => _.toNumber())) -
|
|
180
|
+
inviteeBalance,
|
|
181
|
+
"invitee rewrad should be bounty/2"
|
|
182
|
+
).to.be.equal(bounty / 2 - txFee2); //test that invitee got half bonus
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
it("should update global stats", async () => {
|
|
186
|
+
const bounty = (await invites.levels(0)).bounty.toNumber();
|
|
187
|
+
const stats = await invites.stats();
|
|
188
|
+
expect(stats.totalApprovedInvites.toNumber()).to.be.equal(
|
|
189
|
+
1,
|
|
190
|
+
"approved invites"
|
|
191
|
+
);
|
|
192
|
+
expect(stats.totalInvited.toNumber()).to.be.equal(1, "total invited");
|
|
193
|
+
expect(stats.totalBountiesPaid.toNumber()).to.be.equal(bounty);
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
it("should not pay bounty twice", async () => {
|
|
197
|
+
await expect(
|
|
198
|
+
invites.connect(inviter2).bountyFor(invitee1.address)
|
|
199
|
+
).to.revertedWith("user not elligble for bounty yet");
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
it("should not fail in collectBounties for invalid invitees", async () => {
|
|
203
|
+
await invites
|
|
204
|
+
.connect(invitee7)
|
|
205
|
+
.join(
|
|
206
|
+
ethers.utils.hexZeroPad("0x01", 32),
|
|
207
|
+
ethers.utils.hexZeroPad("0xfa", 32)
|
|
208
|
+
);
|
|
209
|
+
await invites
|
|
210
|
+
.connect(invitee8)
|
|
211
|
+
.join(
|
|
212
|
+
ethers.utils.hexZeroPad("0x02", 32),
|
|
213
|
+
ethers.utils.hexZeroPad("0xfa", 32)
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
let pending = await invites.getPendingInvitees(inviter1.address);
|
|
217
|
+
expect(pending.length, "pending").to.be.equal(2);
|
|
218
|
+
await expect(invites.connect(inviter1).collectBounties()).to.not.reverted;
|
|
219
|
+
let user1 = await invites.users(invitee7.address);
|
|
220
|
+
let user2 = await invites.users(invitee8.address);
|
|
221
|
+
pending = await invites.getPendingInvitees(inviter1.address);
|
|
222
|
+
expect(
|
|
223
|
+
await invites.getPendingBounties(inviter1.address).then(_ => _.toNumber())
|
|
224
|
+
).to.be.equal(0);
|
|
225
|
+
expect(user1.bountyPaid).to.be.false;
|
|
226
|
+
expect(user2.bountyPaid).to.be.false;
|
|
227
|
+
expect(pending.length, "pending").to.be.equal(2);
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
it("should collectBounties for inviter", async () => {
|
|
231
|
+
await id
|
|
232
|
+
.addWhitelistedWithDID(invitee7.address, Math.random() + "")
|
|
233
|
+
.catch(e => e);
|
|
234
|
+
await id
|
|
235
|
+
.addWhitelistedWithDID(invitee8.address, Math.random() + "")
|
|
236
|
+
.catch(e => e);
|
|
237
|
+
expect(
|
|
238
|
+
await invites.getPendingBounties(inviter1.address).then(_ => _.toNumber())
|
|
239
|
+
).to.be.equal(2);
|
|
240
|
+
const res = await invites
|
|
241
|
+
.connect(inviter1)
|
|
242
|
+
.collectBounties()
|
|
243
|
+
.catch(e => e);
|
|
244
|
+
|
|
245
|
+
let user1 = await invites.users(invitee7.address);
|
|
246
|
+
let user2 = await invites.users(invitee8.address);
|
|
247
|
+
let pending = await invites.getPendingInvitees(inviter1.address);
|
|
248
|
+
expect(
|
|
249
|
+
await invites.getPendingBounties(inviter1.address).then(_ => _.toNumber())
|
|
250
|
+
).to.be.equal(0);
|
|
251
|
+
expect(pending.length, "pending").to.be.equal(0);
|
|
252
|
+
expect(user1.bountyPaid, "user1").to.be.true;
|
|
253
|
+
expect(user2.bountyPaid, "user2").to.be.true;
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
it("should not set level not by owner", async () => {
|
|
257
|
+
await expect(
|
|
258
|
+
invites.connect(inviter1).setLevel(0, 1, 5, 1)
|
|
259
|
+
).to.revertedWith("Only owner or avatar can perform this action");
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
it("should set level by owner", async () => {
|
|
263
|
+
await invites.setLevel(0, 1, 5, 1);
|
|
264
|
+
let lvl = await invites.levels(0);
|
|
265
|
+
expect(lvl.toNext.toNumber()).to.be.equal(1);
|
|
266
|
+
expect(lvl.daysToComplete.toNumber()).to.be.equal(1);
|
|
267
|
+
await invites.setLevel(1, 0, 10, 2);
|
|
268
|
+
lvl = await invites.levels(1);
|
|
269
|
+
expect(lvl.toNext.toNumber()).to.be.equal(0);
|
|
270
|
+
expect(lvl.daysToComplete.toNumber()).to.be.equal(2);
|
|
271
|
+
expect(lvl.bounty.toNumber()).to.be.equal(10);
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
it("should update inviter level", async () => {
|
|
275
|
+
await invites
|
|
276
|
+
.connect(inviter1)
|
|
277
|
+
.join(ethers.utils.hexZeroPad("0xfa", 32), ethers.constants.HashZero)
|
|
278
|
+
.then(_ => _.wait())
|
|
279
|
+
.catch(e => e);
|
|
280
|
+
|
|
281
|
+
await id
|
|
282
|
+
.addWhitelistedWithDID(inviter1.address, Math.random() + "")
|
|
283
|
+
.catch(e => e);
|
|
284
|
+
await invites.setLevel(0, 1, 5, 1); //1 inviter to level up
|
|
285
|
+
await invites.setLevel(1, 0, 10, 2); // 10 bounty for second level
|
|
286
|
+
|
|
287
|
+
await invites
|
|
288
|
+
.connect(invitee4)
|
|
289
|
+
.join(
|
|
290
|
+
ethers.utils.hexZeroPad("0x03", 32),
|
|
291
|
+
ethers.utils.hexZeroPad("0xfa", 32)
|
|
292
|
+
);
|
|
293
|
+
await invites
|
|
294
|
+
.connect(invitee5)
|
|
295
|
+
.join(
|
|
296
|
+
ethers.utils.hexZeroPad("0x04", 32),
|
|
297
|
+
ethers.utils.hexZeroPad("0xfa", 32)
|
|
298
|
+
);
|
|
299
|
+
await id
|
|
300
|
+
.addWhitelistedWithDID(invitee4.address, Math.random() + "")
|
|
301
|
+
.catch(e => e);
|
|
302
|
+
await id
|
|
303
|
+
.addWhitelistedWithDID(invitee5.address, Math.random() + "")
|
|
304
|
+
.catch(e => e);
|
|
305
|
+
const res1 = await (await invites.bountyFor(invitee4.address)).wait();
|
|
306
|
+
|
|
307
|
+
const log1 = res1.events.find(_ => _.event === "InviterBounty");
|
|
308
|
+
expect(log1.event).to.be.equal("InviterBounty");
|
|
309
|
+
expect(log1.args.inviterLevel.toNumber()).to.be.equal(1);
|
|
310
|
+
expect(log1.args.earnedLevel).to.be.equal(true);
|
|
311
|
+
expect(log1.args.bountyPaid.toNumber()).to.be.equal(5);
|
|
312
|
+
|
|
313
|
+
let inviter = await invites.users(inviter1.address);
|
|
314
|
+
expect(inviter.level.toNumber()).to.be.equal(1);
|
|
315
|
+
const res2 = await (
|
|
316
|
+
await invites.connect(inviter1).collectBounties()
|
|
317
|
+
).wait();
|
|
318
|
+
const log2 = res2.events.find(_ => _.event === "InviterBounty");
|
|
319
|
+
expect(log2.event).to.be.equal("InviterBounty");
|
|
320
|
+
expect(log2.args.inviterLevel.toNumber()).to.be.equal(1);
|
|
321
|
+
expect(log2.args.earnedLevel).to.be.equal(false);
|
|
322
|
+
expect(log2.args.bountyPaid.toNumber()).to.be.equal(10);
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
it("should allow to set inviter later and pay bounty", async () => {
|
|
326
|
+
await invites
|
|
327
|
+
.connect(invitee6)
|
|
328
|
+
.join(ethers.utils.hexZeroPad("0xfd", 32), ethers.constants.HashZero);
|
|
329
|
+
await invites
|
|
330
|
+
.connect(invitee6)
|
|
331
|
+
.join(
|
|
332
|
+
ethers.utils.hexZeroPad("0xfd", 32),
|
|
333
|
+
ethers.utils.hexZeroPad("0xfa", 32)
|
|
334
|
+
);
|
|
335
|
+
const invitee = await invites.users(invitee6.address);
|
|
336
|
+
expect(invitee.invitedBy).to.equal(inviter1.address);
|
|
337
|
+
await id
|
|
338
|
+
.addWhitelistedWithDID(invitee6.address, Math.random() + "")
|
|
339
|
+
.catch(e => e);
|
|
340
|
+
await expect(invites.bountyFor(invitee6.address)).to.emit(
|
|
341
|
+
invites,
|
|
342
|
+
"InviterBounty"
|
|
343
|
+
);
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
it("should end contract by owner", async () => {
|
|
347
|
+
expect(
|
|
348
|
+
await gd.balanceOf(invites.address).then(_ => _.toNumber())
|
|
349
|
+
).to.be.gt(0);
|
|
350
|
+
await invites.end();
|
|
351
|
+
expect(
|
|
352
|
+
await gd.balanceOf(invites.address).then(_ => _.toNumber())
|
|
353
|
+
).to.be.eq(0);
|
|
354
|
+
});
|
|
355
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ethers, waffle, upgrades } from "hardhat";
|
|
2
|
+
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
|
|
2
3
|
import { expect } from "chai";
|
|
3
4
|
import {
|
|
4
5
|
GoodReserveCDai,
|
|
@@ -40,7 +41,7 @@ describe("DistributionHelper", () => {
|
|
|
40
41
|
cdaiAddress,
|
|
41
42
|
genericCall: gc,
|
|
42
43
|
nameService: ns
|
|
43
|
-
} = await createDAO
|
|
44
|
+
} = await loadFixture(createDAO);
|
|
44
45
|
|
|
45
46
|
nameService = ns;
|
|
46
47
|
genericCall = gc;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as hre, ethers, upgrades } from "hardhat";
|
|
2
|
+
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
|
|
2
3
|
import { deployMockContract, MockContract } from "ethereum-waffle";
|
|
3
4
|
import { expect } from "chai";
|
|
4
5
|
import { GoodMarketMaker, CERC20 } from "../../types";
|
|
@@ -42,8 +43,6 @@ describe("GoodMarketMaker - calculate gd value at reserve", () => {
|
|
|
42
43
|
|
|
43
44
|
before(async () => {
|
|
44
45
|
[founder, staker, fakeReserve, ...signers] = await ethers.getSigners();
|
|
45
|
-
cdai = await deploycDAIMock();
|
|
46
|
-
dai = await deployDAIMock();
|
|
47
46
|
|
|
48
47
|
let {
|
|
49
48
|
controller: ctrl,
|
|
@@ -56,7 +55,7 @@ describe("GoodMarketMaker - calculate gd value at reserve", () => {
|
|
|
56
55
|
setSchemes,
|
|
57
56
|
setReserveToken,
|
|
58
57
|
setDAOAddress
|
|
59
|
-
} = await createDAO
|
|
58
|
+
} = await loadFixture(createDAO);
|
|
60
59
|
avatar = av;
|
|
61
60
|
marketMaker = mm.connect(fakeReserve);
|
|
62
61
|
controller = ctrl;
|
|
@@ -64,9 +63,12 @@ describe("GoodMarketMaker - calculate gd value at reserve", () => {
|
|
|
64
63
|
|
|
65
64
|
console.log("deployed dao", { goodDollar, identity, controller, avatar });
|
|
66
65
|
|
|
66
|
+
cdai = await deploycDAIMock();
|
|
67
|
+
dai = await deployDAIMock();
|
|
68
|
+
|
|
67
69
|
//give founder generic call permission
|
|
68
70
|
await setSchemes([founder.address]);
|
|
69
|
-
setDAOAddress("RESERVE", fakeReserve.address);
|
|
71
|
+
await setDAOAddress("RESERVE", fakeReserve.address);
|
|
70
72
|
console.log("starting tests...");
|
|
71
73
|
});
|
|
72
74
|
|
|
@@ -600,12 +602,17 @@ describe("GoodMarketMaker - calculate gd value at reserve", () => {
|
|
|
600
602
|
|
|
601
603
|
it("should not set reserve ratio daily expansion with illigal values", async () => {
|
|
602
604
|
const invalidZeroDenominator = 0;
|
|
603
|
-
await expect(
|
|
604
|
-
|
|
605
|
+
await expect(
|
|
606
|
+
marketMaker.setReserveRatioDailyExpansion(1, invalidZeroDenominator)
|
|
607
|
+
).to.be.revertedWith("denominator must be above 0");
|
|
605
608
|
|
|
606
609
|
const denominator = 1;
|
|
607
610
|
const nominatorHigherThanDenom = 2;
|
|
608
|
-
await expect(
|
|
609
|
-
|
|
611
|
+
await expect(
|
|
612
|
+
marketMaker.setReserveRatioDailyExpansion(
|
|
613
|
+
nominatorHigherThanDenom,
|
|
614
|
+
denominator
|
|
615
|
+
)
|
|
616
|
+
).to.be.revertedWith("Invalid nom or denom value");
|
|
610
617
|
});
|
|
611
618
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as hre, ethers, upgrades } from "hardhat";
|
|
2
|
+
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
|
|
2
3
|
import { expect } from "chai";
|
|
3
4
|
import { GoodMarketMaker, CERC20, GoodReserveCDai } from "../../types";
|
|
4
5
|
import { createDAO, increaseTime, advanceBlocks } from "../helpers";
|
|
@@ -36,7 +37,7 @@ describe("GoodReserve - Enforce token cap", () => {
|
|
|
36
37
|
marketMaker: mm,
|
|
37
38
|
reserve,
|
|
38
39
|
cdaiAddress
|
|
39
|
-
} = await createDAO
|
|
40
|
+
} = await loadFixture(createDAO);
|
|
40
41
|
|
|
41
42
|
cDai = cdaiAddress;
|
|
42
43
|
avatar = av;
|
|
@@ -111,6 +112,12 @@ describe("GoodReserve - Enforce token cap", () => {
|
|
|
111
112
|
.connect(founder)
|
|
112
113
|
.mintRewardFromRR(cDai, founder.address, 10);
|
|
113
114
|
expect(await goodDollar.balanceOf(founder.address)).to.equal(1020);
|
|
115
|
+
|
|
116
|
+
encodedCall = goodDollar.interface.encodeFunctionData("addMinter", [
|
|
117
|
+
avatar
|
|
118
|
+
]);
|
|
119
|
+
|
|
120
|
+
await ictrl.genericCall(goodDollar.address, encodedCall, avatar, 0);
|
|
114
121
|
});
|
|
115
122
|
|
|
116
123
|
it("should not be able to mint if not core contract and GoodReserve is minter", async () => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ethers, waffle } from "hardhat";
|
|
2
|
+
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
|
|
2
3
|
import { expect } from "chai";
|
|
3
4
|
import { GoodReserveCDai, DistributionHelper } from "../../types";
|
|
4
5
|
import { createDAO, increaseTime } from "../helpers";
|
|
@@ -34,7 +35,7 @@ describe("GoodReserve - Distribution Helper", () => {
|
|
|
34
35
|
cdaiAddress,
|
|
35
36
|
genericCall: gc,
|
|
36
37
|
nameService: ns
|
|
37
|
-
} = await createDAO
|
|
38
|
+
} = await loadFixture(createDAO);
|
|
38
39
|
|
|
39
40
|
nameService = ns;
|
|
40
41
|
genericCall = gc;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as hre, ethers, upgrades } from "hardhat";
|
|
2
|
+
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
|
|
2
3
|
import { BigNumber, Signer } from "ethers";
|
|
3
4
|
import { deployMockContract, MockContract } from "ethereum-waffle";
|
|
4
5
|
import { expect } from "chai";
|
|
@@ -50,7 +51,7 @@ describe("GDX Token", () => {
|
|
|
50
51
|
cdaiAddress,
|
|
51
52
|
genericCall: gn,
|
|
52
53
|
runAsAvatarOnly: raao
|
|
53
|
-
} = await createDAO
|
|
54
|
+
} = await loadFixture(createDAO);
|
|
54
55
|
|
|
55
56
|
dai = await ethers.getContractAt("DAIMock", daiAddress);
|
|
56
57
|
cDAI = await ethers.getContractAt("cDAIMock", cdaiAddress);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ethers, waffle } from "hardhat";
|
|
2
|
+
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
|
|
2
3
|
import { expect } from "chai";
|
|
3
4
|
import { GoodReserveCDai, DistributionHelper } from "../../types";
|
|
4
5
|
import { createDAO, increaseTime } from "../helpers";
|
|
@@ -34,7 +35,7 @@ describe("GoodReserve - Distribution Helper", () => {
|
|
|
34
35
|
daiAddress,
|
|
35
36
|
cdaiAddress,
|
|
36
37
|
genericCall: gc
|
|
37
|
-
} = await createDAO
|
|
38
|
+
} = await loadFixture(createDAO);
|
|
38
39
|
|
|
39
40
|
dai = await ethers.getContractAt("DAIMock", daiAddress);
|
|
40
41
|
cDAI = await ethers.getContractAt("cDAIMock", cdaiAddress);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as hre, ethers, upgrades } from "hardhat";
|
|
2
|
+
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
|
|
2
3
|
import { BigNumber, Contract, Signer } from "ethers";
|
|
3
4
|
import { deployMockContract, MockContract } from "ethereum-waffle";
|
|
4
5
|
import { expect } from "chai";
|
|
@@ -48,8 +49,8 @@ describe("GoodReserve - staking with cDAI mocks", () => {
|
|
|
48
49
|
daiAddress,
|
|
49
50
|
cdaiAddress,
|
|
50
51
|
reserve,
|
|
51
|
-
runAsAvatarOnly: raao
|
|
52
|
-
} = await createDAO
|
|
52
|
+
runAsAvatarOnly: raao
|
|
53
|
+
} = await loadFixture(createDAO);
|
|
53
54
|
|
|
54
55
|
dai = await ethers.getContractAt("DAIMock", daiAddress);
|
|
55
56
|
cDAI = await ethers.getContractAt("cDAIMock", cdaiAddress);
|
|
@@ -86,7 +87,6 @@ describe("GoodReserve - staking with cDAI mocks", () => {
|
|
|
86
87
|
|
|
87
88
|
marketMaker = mm;
|
|
88
89
|
|
|
89
|
-
const reserveFactory = await ethers.getContractFactory("GoodReserveCDai");
|
|
90
90
|
console.log("deployed contribution, deploying reserve...", {
|
|
91
91
|
founder: founder.address
|
|
92
92
|
});
|
|
@@ -117,26 +117,8 @@ describe("GoodReserve - staking with cDAI mocks", () => {
|
|
|
117
117
|
|
|
118
118
|
it("should set fundManager in the reserve by avatar", async () => {
|
|
119
119
|
await setDAOAddress("FUND_MANAGER", founder.address);
|
|
120
|
-
// const rFactory = await ethers.getContractFactory("GoodReserveCDai");
|
|
121
|
-
// const ctrl = await ethers.getContractAt(
|
|
122
|
-
// "Controller",
|
|
123
|
-
// controller,
|
|
124
|
-
// schemeMock
|
|
125
|
-
// );
|
|
126
|
-
// const encodedCall = rFactory.interface.encodeFunctionData(
|
|
127
|
-
// "setFundManager",
|
|
128
|
-
// [founder.address]
|
|
129
|
-
// );
|
|
130
|
-
// await ctrl.genericCall(goodReserve.address, encodedCall, avatar, 0);
|
|
131
|
-
// const newFM = await goodReserve.fundManager();
|
|
132
|
-
// expect(newFM.toString()).to.be.equal(founder.address);
|
|
133
120
|
});
|
|
134
121
|
|
|
135
|
-
// it("should returned true for isActive", async () => {
|
|
136
|
-
// const isActive = await goodReserve.isActive();
|
|
137
|
-
// expect(isActive.toString()).to.be.equal("true");
|
|
138
|
-
// });
|
|
139
|
-
|
|
140
122
|
it("should returned fixed 0.0001 market price", async () => {
|
|
141
123
|
const gdPrice = await goodReserve["currentPrice()"]();
|
|
142
124
|
const cdaiWorthInGD = gdPrice.mul(BN.from("100000000"));
|
|
@@ -1139,22 +1121,23 @@ describe("GoodReserve - staking with cDAI mocks", () => {
|
|
|
1139
1121
|
|
|
1140
1122
|
await runAsAvatarOnly(
|
|
1141
1123
|
goodReserve,
|
|
1142
|
-
"setReserveRatioDailyExpansion(uint256,uint256)",
|
|
1143
|
-
1,
|
|
1124
|
+
"setReserveRatioDailyExpansion(uint256,uint256)",
|
|
1125
|
+
1,
|
|
1144
1126
|
1e15
|
|
1145
1127
|
);
|
|
1146
1128
|
|
|
1147
1129
|
let newReserveRatioDailyExpansion =
|
|
1148
1130
|
await marketMaker.reserveRatioDailyExpansion();
|
|
1149
1131
|
console.log(newReserveRatioDailyExpansion.toString());
|
|
1150
|
-
|
|
1151
|
-
expect(newReserveRatioDailyExpansion).to.not.equal(
|
|
1132
|
+
|
|
1133
|
+
expect(newReserveRatioDailyExpansion).to.not.equal(
|
|
1134
|
+
currentReserveRatioDailyExpansion
|
|
1135
|
+
);
|
|
1152
1136
|
expect(newReserveRatioDailyExpansion).to.be.equal(BN.from("1000000000000"));
|
|
1153
1137
|
|
|
1154
1138
|
const encodedCall = goodReserve.interface.encodeFunctionData(
|
|
1155
|
-
"setReserveRatioDailyExpansion",
|
|
1156
|
-
[BN.from(currentReserveRatioDailyExpansion).div(1e12),
|
|
1157
|
-
1e15]
|
|
1139
|
+
"setReserveRatioDailyExpansion",
|
|
1140
|
+
[BN.from(currentReserveRatioDailyExpansion).div(1e12), 1e15]
|
|
1158
1141
|
);
|
|
1159
1142
|
const ctrl = await ethers.getContractAt(
|
|
1160
1143
|
"Controller",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ethers, upgrades } from "hardhat";
|
|
2
|
+
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
|
|
2
3
|
import { BigNumber, Contract } from "ethers";
|
|
3
4
|
import { expect } from "chai";
|
|
4
5
|
import { GoodMarketMaker, GoodReserveCDai } from "../../types";
|
|
@@ -43,6 +44,24 @@ describe("GoodReserve - buy/sell with any token through uniswap", () => {
|
|
|
43
44
|
before(async () => {
|
|
44
45
|
[founder, staker, ...signers] = await ethers.getSigners();
|
|
45
46
|
schemeMock = signers.pop();
|
|
47
|
+
|
|
48
|
+
let {
|
|
49
|
+
controller: ctrl,
|
|
50
|
+
avatar: av,
|
|
51
|
+
gd,
|
|
52
|
+
identity,
|
|
53
|
+
daoCreator,
|
|
54
|
+
nameService: ns,
|
|
55
|
+
setDAOAddress: sda,
|
|
56
|
+
setSchemes,
|
|
57
|
+
marketMaker: mm,
|
|
58
|
+
daiAddress,
|
|
59
|
+
cdaiAddress,
|
|
60
|
+
reserve,
|
|
61
|
+
setReserveToken,
|
|
62
|
+
COMP
|
|
63
|
+
} = await loadFixture(createDAO);
|
|
64
|
+
|
|
46
65
|
const cdaiFactory = await ethers.getContractFactory("cDAIMock");
|
|
47
66
|
const daiFactory = await ethers.getContractFactory("DAIMock");
|
|
48
67
|
const routerFactory = new ethers.ContractFactory(
|
|
@@ -69,23 +88,6 @@ describe("GoodReserve - buy/sell with any token through uniswap", () => {
|
|
|
69
88
|
|
|
70
89
|
tokenB = await daiFactory.deploy(); // another erc20 for uniswap router test
|
|
71
90
|
|
|
72
|
-
let {
|
|
73
|
-
controller: ctrl,
|
|
74
|
-
avatar: av,
|
|
75
|
-
gd,
|
|
76
|
-
identity,
|
|
77
|
-
daoCreator,
|
|
78
|
-
nameService: ns,
|
|
79
|
-
setDAOAddress: sda,
|
|
80
|
-
setSchemes,
|
|
81
|
-
marketMaker: mm,
|
|
82
|
-
daiAddress,
|
|
83
|
-
cdaiAddress,
|
|
84
|
-
reserve,
|
|
85
|
-
setReserveToken,
|
|
86
|
-
COMP
|
|
87
|
-
} = await createDAO();
|
|
88
|
-
|
|
89
91
|
dai = await ethers.getContractAt("DAIMock", daiAddress);
|
|
90
92
|
cDAI = await ethers.getContractAt("cDAIMock", cdaiAddress);
|
|
91
93
|
comp = COMP;
|
|
@@ -118,7 +120,7 @@ describe("GoodReserve - buy/sell with any token through uniswap", () => {
|
|
|
118
120
|
});
|
|
119
121
|
goodReserve = reserve;
|
|
120
122
|
|
|
121
|
-
setDAOAddress("UNISWAP_ROUTER", uniswapRouter.address);
|
|
123
|
+
await setDAOAddress("UNISWAP_ROUTER", uniswapRouter.address);
|
|
122
124
|
const exchangeHelperFactory = await ethers.getContractFactory(
|
|
123
125
|
"ExchangeHelper"
|
|
124
126
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as hre, ethers, upgrades } from "hardhat";
|
|
2
|
+
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
|
|
2
3
|
import { deployMockContract, MockContract } from "ethereum-waffle";
|
|
3
4
|
import { expect } from "chai";
|
|
4
5
|
import {
|
|
@@ -27,7 +28,7 @@ describe("CompoundStakingFactory", () => {
|
|
|
27
28
|
|
|
28
29
|
before(async () => {
|
|
29
30
|
[founder, ...signers] = await ethers.getSigners();
|
|
30
|
-
dao = await createDAO
|
|
31
|
+
dao = await loadFixture(createDAO);
|
|
31
32
|
|
|
32
33
|
const compUsdOracleFactory = await ethers.getContractFactory(
|
|
33
34
|
"CompUSDMockOracle"
|
|
@@ -128,13 +129,16 @@ describe("CompoundStakingFactory", () => {
|
|
|
128
129
|
|
|
129
130
|
const INITIAL_COLLECT_INTEREST_GAS_COST = 250000;
|
|
130
131
|
const INITIAL_COLLECT_COMP_GAS_COST = 150000;
|
|
131
|
-
const gasCostForInterestTransfer =
|
|
132
|
-
|
|
132
|
+
const gasCostForInterestTransfer =
|
|
133
|
+
await goodCompoundStakingV2.getGasCostForInterestTransfer();
|
|
134
|
+
expect(gasCostForInterestTransfer).to.equal(
|
|
135
|
+
INITIAL_COLLECT_INTEREST_GAS_COST
|
|
136
|
+
);
|
|
133
137
|
|
|
134
138
|
const settings = await goodCompoundStakingV2.getSettings();
|
|
135
139
|
const collectInteresetGasCost = settings[0];
|
|
136
140
|
const compCollectGasCost = settings[1];
|
|
137
141
|
expect(collectInteresetGasCost).to.equal(INITIAL_COLLECT_INTEREST_GAS_COST);
|
|
138
142
|
expect(compCollectGasCost).to.equal(INITIAL_COLLECT_COMP_GAS_COST);
|
|
139
|
-
|
|
143
|
+
});
|
|
140
144
|
});
|