@gooddollar/goodprotocol 1.0.29-beta.3 → 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 +5 -3
- package/contracts/fuseFaucet/FuseFaucet.sol +1 -2
- package/contracts/governance/GReputation.sol +24 -10
- 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 +9 -5
- package/scripts/multichain-deploy/1_basicdao-deploy.ts +45 -28
- package/scripts/multichain-deploy/2_helpers-deploy.ts +1 -7
- package/scripts/multichain-deploy/verifyEtherscan.ts +33 -5
- 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
|
@@ -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 {
|
|
@@ -57,14 +58,14 @@ describe("Different decimals staking token", () => {
|
|
|
57
58
|
genericCall: gc,
|
|
58
59
|
setDAOAddress,
|
|
59
60
|
COMP
|
|
60
|
-
} = await createDAO
|
|
61
|
+
} = await loadFixture(createDAO);
|
|
61
62
|
|
|
62
63
|
comp = COMP;
|
|
63
64
|
dai = await ethers.getContractAt("DAIMock", daiAddress);
|
|
64
65
|
cDAI = await ethers.getContractAt("cDAIMock", cdaiAddress);
|
|
65
66
|
uniswap = await deployUniswap(comp, dai);
|
|
66
67
|
uniswapRouter = uniswap.router;
|
|
67
|
-
setDAOAddress("UNISWAP_ROUTER", uniswapRouter.address);
|
|
68
|
+
await setDAOAddress("UNISWAP_ROUTER", uniswapRouter.address);
|
|
68
69
|
avatar = av;
|
|
69
70
|
controller = ctrl;
|
|
70
71
|
genericCall = gc;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ethers, upgrades } from "hardhat";
|
|
2
|
+
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
|
|
2
3
|
import { BigNumber, constants, Contract } from "ethers";
|
|
3
4
|
import { expect } from "chai";
|
|
4
5
|
import {
|
|
@@ -77,7 +78,7 @@ describe("DonationsStaking - DonationStaking contract that receives funds in ETH
|
|
|
77
78
|
reserve,
|
|
78
79
|
setReserveToken,
|
|
79
80
|
genericCall: gc
|
|
80
|
-
} = await createDAO
|
|
81
|
+
} = await loadFixture(createDAO);
|
|
81
82
|
|
|
82
83
|
comp = await daiFactory.deploy();
|
|
83
84
|
genericCall = gc;
|
|
@@ -235,7 +236,7 @@ describe("DonationsStaking - DonationStaking contract that receives funds in ETH
|
|
|
235
236
|
"no stakingToken to stake"
|
|
236
237
|
);
|
|
237
238
|
});
|
|
238
|
-
|
|
239
|
+
|
|
239
240
|
it("it should stake donations with ETH according to 0.3% of pool", async () => {
|
|
240
241
|
let stakeAmount = ethers.utils.parseEther("20");
|
|
241
242
|
const pairContract = await ethers.getContractAt(
|
|
@@ -315,15 +316,15 @@ describe("DonationsStaking - DonationStaking contract that receives funds in ETH
|
|
|
315
316
|
|
|
316
317
|
expect(totalStakedAfterEnd).to.be.equal(0);
|
|
317
318
|
});
|
|
318
|
-
|
|
319
|
+
|
|
319
320
|
it("should not allow to stake donations when not active", async () => {
|
|
320
321
|
let isActive = await donationsStaking.active();
|
|
321
322
|
expect(isActive).to.be.equal(true);
|
|
322
323
|
let stakeAmount = ethers.utils.parseEther("10");
|
|
323
324
|
await dai["mint(address,uint256)"](donationsStaking.address, stakeAmount);
|
|
324
|
-
|
|
325
|
+
|
|
325
326
|
expect(donationsStaking.stakeDonations()).to.not.be.reverted;
|
|
326
|
-
|
|
327
|
+
|
|
327
328
|
let encodedData = donationsStaking.interface.encodeFunctionData(
|
|
328
329
|
"setActive",
|
|
329
330
|
[false]
|
|
@@ -335,10 +336,9 @@ describe("DonationsStaking - DonationStaking contract that receives funds in ETH
|
|
|
335
336
|
await dai["mint(address,uint256)"](donationsStaking.address, stakeAmount);
|
|
336
337
|
await expect(donationsStaking.stakeDonations()).to.be.reverted;
|
|
337
338
|
// revent to original state
|
|
338
|
-
encodedData = donationsStaking.interface.encodeFunctionData(
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
);
|
|
339
|
+
encodedData = donationsStaking.interface.encodeFunctionData("setActive", [
|
|
340
|
+
true
|
|
341
|
+
]);
|
|
342
342
|
await genericCall(donationsStaking.address, encodedData);
|
|
343
343
|
});
|
|
344
344
|
|
|
@@ -354,18 +354,18 @@ describe("DonationsStaking - DonationStaking contract that receives funds in ETH
|
|
|
354
354
|
|
|
355
355
|
// Invalid scenarios checks
|
|
356
356
|
const invalidPaths = [
|
|
357
|
-
[NULL_ADDRESS],
|
|
357
|
+
[NULL_ADDRESS], // less than minimum 2 length
|
|
358
358
|
[bat.address, dai.address], // first is not ETH null address
|
|
359
359
|
[NULL_ADDRESS, bat.address] // last is not the staking token
|
|
360
360
|
];
|
|
361
361
|
|
|
362
362
|
for (const invalidPath of invalidPaths) {
|
|
363
363
|
encodedData = donationsStaking.interface.encodeFunctionData(
|
|
364
|
-
|
|
365
|
-
|
|
364
|
+
"setSwapPaths",
|
|
365
|
+
[invalidPath]
|
|
366
366
|
);
|
|
367
367
|
await genericCall(donationsStaking.address, encodedData);
|
|
368
|
-
expect(await isEthToStakingTokenPathEqualTo(invalidPath)).to.be.false;
|
|
368
|
+
expect(await isEthToStakingTokenPathEqualTo(invalidPath)).to.be.false;
|
|
369
369
|
}
|
|
370
370
|
|
|
371
371
|
encodedData = donationsStaking.interface.encodeFunctionData(
|
|
@@ -374,23 +374,27 @@ describe("DonationsStaking - DonationStaking contract that receives funds in ETH
|
|
|
374
374
|
);
|
|
375
375
|
await genericCall(donationsStaking.address, encodedData);
|
|
376
376
|
});
|
|
377
|
-
|
|
377
|
+
|
|
378
378
|
async function isEthToStakingTokenPathEqualTo(path) {
|
|
379
379
|
for (let index = 0; index < path.length; index++) {
|
|
380
380
|
let expectedValue = path[index];
|
|
381
|
-
let valueAtIndex = await donationsStaking
|
|
381
|
+
let valueAtIndex = await donationsStaking
|
|
382
|
+
.ethToStakingTokenSwapPath(index)
|
|
383
|
+
.catch(e => e);
|
|
382
384
|
if (expectedValue != valueAtIndex) {
|
|
383
385
|
return false;
|
|
384
386
|
}
|
|
385
387
|
}
|
|
386
388
|
|
|
387
|
-
const outOfArray = await donationsStaking
|
|
389
|
+
const outOfArray = await donationsStaking
|
|
390
|
+
.ethToStakingTokenSwapPath(path.length)
|
|
391
|
+
.catch(e => e);
|
|
388
392
|
if (!outOfArray.message) {
|
|
389
393
|
return false;
|
|
390
394
|
}
|
|
391
395
|
|
|
392
396
|
return true;
|
|
393
|
-
}
|
|
397
|
+
}
|
|
394
398
|
|
|
395
399
|
it("it should set stakingContract when avatar call it ", async () => {
|
|
396
400
|
let stakeAmount = ethers.utils.parseEther("6000"); // Max swap amount is around 5964 with current liquidity level so we should set it to higher number in order to test functionality
|
|
@@ -473,21 +477,26 @@ describe("DonationsStaking - DonationStaking contract that receives funds in ETH
|
|
|
473
477
|
avatarDaiBalanceBeforeSet.add(stakingAmountBeforeSet.sub(safeAmount))
|
|
474
478
|
); // It should send leftover stakingToken to avatar after swap to ETH in safeAmount
|
|
475
479
|
expect(stakingAmountBeforeSet).to.be.gt(safeAmount); // maxSafeAmount must be smaller than actualstaking amount so we can verify that we hit the limit for transaction amount at once
|
|
476
|
-
});
|
|
477
|
-
|
|
480
|
+
});
|
|
481
|
+
|
|
478
482
|
it("should set max liquidity percentage swap when avatar", async () => {
|
|
479
|
-
const originalPercentage =
|
|
483
|
+
const originalPercentage =
|
|
484
|
+
await donationsStaking.maxLiquidityPercentageSwap();
|
|
480
485
|
//fail when not avatar
|
|
481
486
|
const percentageToSet = 21;
|
|
482
|
-
expect(
|
|
483
|
-
|
|
487
|
+
expect(
|
|
488
|
+
donationsStaking
|
|
489
|
+
.connect(staker)
|
|
490
|
+
["setMaxLiquidityPercentageSwap(uint24)"](percentageToSet)
|
|
491
|
+
).to.be.revertedWith("only avatar can call this method");
|
|
484
492
|
//succeed when avatar
|
|
485
493
|
let encodedData = donationsStaking.interface.encodeFunctionData(
|
|
486
494
|
"setMaxLiquidityPercentageSwap",
|
|
487
495
|
[percentageToSet]
|
|
488
496
|
);
|
|
489
497
|
await genericCall(donationsStaking.address, encodedData);
|
|
490
|
-
const actualPercentage =
|
|
498
|
+
const actualPercentage =
|
|
499
|
+
await donationsStaking.maxLiquidityPercentageSwap();
|
|
491
500
|
expect(actualPercentage).to.be.equal(percentageToSet);
|
|
492
501
|
//revent to original state
|
|
493
502
|
encodedData = donationsStaking.interface.encodeFunctionData(
|
|
@@ -500,4 +509,4 @@ describe("DonationsStaking - DonationStaking contract that receives funds in ETH
|
|
|
500
509
|
const version = await donationsStaking.getVersion();
|
|
501
510
|
expect(version).to.be.equal("2.0.0");
|
|
502
511
|
});
|
|
503
|
-
});
|
|
512
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ethers, network as networkConfig } from "hardhat";
|
|
1
|
+
import hre, { ethers, network as networkConfig } from "hardhat";
|
|
2
|
+
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
|
|
2
3
|
import { FuseStakingV3 } from "../../types";
|
|
3
4
|
import { expect } from "chai";
|
|
4
5
|
import { deployMockContract, MockContract } from "ethereum-waffle";
|
|
5
|
-
import hre from "hardhat";
|
|
6
6
|
import { abi as ubiabi } from "../../artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.json";
|
|
7
7
|
import { BigNumber } from "ethers";
|
|
8
8
|
export const NULL_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
@@ -1,7 +1,13 @@
|
|
|
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
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
CERC20,
|
|
7
|
+
GoodAaveStaking,
|
|
8
|
+
GoodAaveStakingV2,
|
|
9
|
+
AaveStakingFactory
|
|
10
|
+
} from "../../types";
|
|
5
11
|
import { createDAO, deployUniswap } from "../helpers";
|
|
6
12
|
import { Contract } from "ethers";
|
|
7
13
|
|
|
@@ -25,7 +31,7 @@ describe("AaveStakingFactory", () => {
|
|
|
25
31
|
|
|
26
32
|
before(async () => {
|
|
27
33
|
[founder, ...signers] = await ethers.getSigners();
|
|
28
|
-
dao = await createDAO
|
|
34
|
+
dao = await loadFixture(createDAO);
|
|
29
35
|
const usdcFactory = await ethers.getContractFactory("USDCMock");
|
|
30
36
|
const lendingPoolFactory = await ethers.getContractFactory(
|
|
31
37
|
"LendingPoolMock"
|
|
@@ -128,33 +134,33 @@ describe("AaveStakingFactory", () => {
|
|
|
128
134
|
"GoodAaveStakingV2",
|
|
129
135
|
await stakingFactory.impl()
|
|
130
136
|
)) as GoodAaveStakingV2;
|
|
131
|
-
await expect(
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
);
|
|
145
|
-
await expect(
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
);
|
|
137
|
+
await expect(
|
|
138
|
+
goodAaveStakingV2.init(
|
|
139
|
+
usdc.address,
|
|
140
|
+
lendingPool.address,
|
|
141
|
+
dao.nameService.address,
|
|
142
|
+
"USDC",
|
|
143
|
+
"USDC",
|
|
144
|
+
5760,
|
|
145
|
+
stakingFactory.address,
|
|
146
|
+
incentiveController.address,
|
|
147
|
+
aaveUsdOracle.address,
|
|
148
|
+
[cdai, dai] // violates tokenToDaiSwapPath[0] == _token (cdai != usdc)
|
|
149
|
+
)
|
|
150
|
+
).to.be.revertedWith("invalid _tokenToDaiSwapPath");
|
|
151
|
+
await expect(
|
|
152
|
+
goodAaveStakingV2.init(
|
|
153
|
+
usdc.address,
|
|
154
|
+
lendingPool.address,
|
|
155
|
+
dao.nameService.address,
|
|
156
|
+
"USDC",
|
|
157
|
+
"USDC",
|
|
158
|
+
5760,
|
|
159
|
+
stakingFactory.address,
|
|
160
|
+
incentiveController.address,
|
|
161
|
+
aaveUsdOracle.address,
|
|
162
|
+
[usdc.address, cdai] // violates _tokenToDaiSwapPath[] path leading to dai
|
|
163
|
+
)
|
|
164
|
+
).to.be.revertedWith("invalid _tokenToDaiSwapPath");
|
|
159
165
|
});
|
|
160
166
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ethers, upgrades } from "hardhat";
|
|
2
|
+
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
|
|
2
3
|
import { Contract } from "ethers";
|
|
3
4
|
import { expect } from "chai";
|
|
4
5
|
import { GoodMarketMaker, GoodReserveCDai } from "../../types";
|
|
@@ -57,8 +58,8 @@ describe("SimpleDAISTAking - staking with cDAI mocks", () => {
|
|
|
57
58
|
cdaiAddress,
|
|
58
59
|
reserve,
|
|
59
60
|
setReserveToken,
|
|
60
|
-
runAsAvatarOnly: raao
|
|
61
|
-
} = await createDAO
|
|
61
|
+
runAsAvatarOnly: raao
|
|
62
|
+
} = await loadFixture(createDAO);
|
|
62
63
|
dai = await ethers.getContractAt("DAIMock", daiAddress);
|
|
63
64
|
cDAI = await ethers.getContractAt("cDAIMock", cdaiAddress);
|
|
64
65
|
avatar = av;
|
|
@@ -94,7 +95,7 @@ describe("SimpleDAISTAking - staking with cDAI mocks", () => {
|
|
|
94
95
|
daiUsdOracle = await tokenUsdOracleFactory.deploy();
|
|
95
96
|
const daiFactory = await ethers.getContractFactory("DAIMock");
|
|
96
97
|
|
|
97
|
-
setDAOAddress("UNISWAP_ROUTER", signers[0].address); // need this address for initialize simplestaking
|
|
98
|
+
await setDAOAddress("UNISWAP_ROUTER", signers[0].address); // need this address for initialize simplestaking
|
|
98
99
|
const compUsdOracleFactory = await ethers.getContractFactory(
|
|
99
100
|
"CompUSDMockOracle"
|
|
100
101
|
);
|
|
@@ -1264,17 +1265,12 @@ describe("SimpleDAISTAking - staking with cDAI mocks", () => {
|
|
|
1264
1265
|
it("should not be able to withdraw stake when the withdrawn amount is higher than the staked amount", async () => {
|
|
1265
1266
|
const stakeAmount = ethers.utils.parseEther("100");
|
|
1266
1267
|
const higherThanStakeAmount = ethers.utils.parseEther("101");
|
|
1267
|
-
await cDAI["mint(address,uint256)"](
|
|
1268
|
-
staker.address,
|
|
1269
|
-
stakeAmount
|
|
1270
|
-
);
|
|
1268
|
+
await cDAI["mint(address,uint256)"](staker.address, stakeAmount);
|
|
1271
1269
|
await cDAI
|
|
1272
1270
|
.connect(staker)
|
|
1273
1271
|
.approve(goodCompoundStaking.address, higherThanStakeAmount);
|
|
1274
1272
|
|
|
1275
|
-
await goodCompoundStaking
|
|
1276
|
-
.connect(staker)
|
|
1277
|
-
.stake(stakeAmount, "100", true);
|
|
1273
|
+
await goodCompoundStaking.connect(staker).stake(stakeAmount, "100", true);
|
|
1278
1274
|
|
|
1279
1275
|
const tx = await goodCompoundStaking
|
|
1280
1276
|
.connect(staker)
|
|
@@ -1283,9 +1279,7 @@ describe("SimpleDAISTAking - staking with cDAI mocks", () => {
|
|
|
1283
1279
|
|
|
1284
1280
|
expect(tx.message).to.be.not.empty;
|
|
1285
1281
|
// revent to original state
|
|
1286
|
-
await goodCompoundStaking
|
|
1287
|
-
.connect(staker)
|
|
1288
|
-
.withdrawStake(stakeAmount, true);
|
|
1282
|
+
await goodCompoundStaking.connect(staker).withdrawStake(stakeAmount, true);
|
|
1289
1283
|
});
|
|
1290
1284
|
|
|
1291
1285
|
it("should pause the contract", async () => {
|
|
@@ -1456,14 +1450,16 @@ describe("SimpleDAISTAking - staking with cDAI mocks", () => {
|
|
|
1456
1450
|
|
|
1457
1451
|
it("should set max liquidity percentage swap when avatar", async () => {
|
|
1458
1452
|
goodCompoundStaking = await deployStaking();
|
|
1459
|
-
const percentageBeforeSet =
|
|
1453
|
+
const percentageBeforeSet =
|
|
1454
|
+
await goodCompoundStaking.maxLiquidityPercentageSwap();
|
|
1460
1455
|
const percentageToSet = 21;
|
|
1461
1456
|
await runAsAvatarOnly(
|
|
1462
1457
|
goodCompoundStaking,
|
|
1463
1458
|
"setMaxLiquidityPercentageSwap(uint24)",
|
|
1464
1459
|
percentageToSet
|
|
1465
|
-
)
|
|
1466
|
-
const percentageAfterSet =
|
|
1460
|
+
);
|
|
1461
|
+
const percentageAfterSet =
|
|
1462
|
+
await goodCompoundStaking.maxLiquidityPercentageSwap();
|
|
1467
1463
|
expect(percentageAfterSet).to.be.equal(percentageToSet);
|
|
1468
1464
|
expect(percentageAfterSet).to.not.equal(percentageBeforeSet);
|
|
1469
1465
|
});
|
|
@@ -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 } from "../../types";
|
|
@@ -51,19 +52,7 @@ describe("StakingRewards - staking with cDAI mocks and get Rewards in GoodDollar
|
|
|
51
52
|
before(async () => {
|
|
52
53
|
[founder, staker, ...signers] = await ethers.getSigners();
|
|
53
54
|
schemeMock = signers.pop();
|
|
54
|
-
const cdaiFactory = await ethers.getContractFactory("cDAIMock");
|
|
55
|
-
const cBatFactory = await ethers.getContractFactory("cBATMock");
|
|
56
|
-
const goodFundManagerFactory = await ethers.getContractFactory(
|
|
57
|
-
"GoodFundManager"
|
|
58
|
-
);
|
|
59
|
-
goodCompoundStakingFactory = await getStakingFactory(
|
|
60
|
-
"GoodCompoundStakingV2"
|
|
61
|
-
);
|
|
62
|
-
goodCompoundStakingTestFactory = await getStakingFactory(
|
|
63
|
-
"GoodCompoundStakingTest"
|
|
64
|
-
);
|
|
65
55
|
|
|
66
|
-
const daiFactory = await ethers.getContractFactory("DAIMock");
|
|
67
56
|
let {
|
|
68
57
|
controller: ctrl,
|
|
69
58
|
avatar: av,
|
|
@@ -79,7 +68,21 @@ describe("StakingRewards - staking with cDAI mocks and get Rewards in GoodDollar
|
|
|
79
68
|
setReserveToken,
|
|
80
69
|
genericCall: gc,
|
|
81
70
|
COMP
|
|
82
|
-
} = await createDAO
|
|
71
|
+
} = await loadFixture(createDAO);
|
|
72
|
+
|
|
73
|
+
const cdaiFactory = await ethers.getContractFactory("cDAIMock");
|
|
74
|
+
const cBatFactory = await ethers.getContractFactory("cBATMock");
|
|
75
|
+
const goodFundManagerFactory = await ethers.getContractFactory(
|
|
76
|
+
"GoodFundManager"
|
|
77
|
+
);
|
|
78
|
+
goodCompoundStakingFactory = await getStakingFactory(
|
|
79
|
+
"GoodCompoundStakingV2"
|
|
80
|
+
);
|
|
81
|
+
goodCompoundStakingTestFactory = await getStakingFactory(
|
|
82
|
+
"GoodCompoundStakingTest"
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
const daiFactory = await ethers.getContractFactory("DAIMock");
|
|
83
86
|
|
|
84
87
|
genericCall = gc;
|
|
85
88
|
dai = await ethers.getContractAt("DAIMock", daiAddress);
|
|
@@ -129,7 +132,7 @@ describe("StakingRewards - staking with cDAI mocks and get Rewards in GoodDollar
|
|
|
129
132
|
const tokenUsdOracleFactory = await ethers.getContractFactory(
|
|
130
133
|
"BatUSDMockOracle"
|
|
131
134
|
);
|
|
132
|
-
setDAOAddress("UNISWAP_ROUTER", uniswapRouter.address);
|
|
135
|
+
await setDAOAddress("UNISWAP_ROUTER", uniswapRouter.address);
|
|
133
136
|
|
|
134
137
|
daiUsdOracle = await tokenUsdOracleFactory.deploy();
|
|
135
138
|
const compUsdOracleFactory = await ethers.getContractFactory(
|
|
@@ -194,8 +197,8 @@ describe("StakingRewards - staking with cDAI mocks and get Rewards in GoodDollar
|
|
|
194
197
|
JSON.stringify(IUniswapV2Pair.abi),
|
|
195
198
|
staker
|
|
196
199
|
).connect(founder);
|
|
197
|
-
setDAOAddress("CDAI", cDAI.address);
|
|
198
|
-
setDAOAddress("DAI", dai.address);
|
|
200
|
+
await setDAOAddress("CDAI", cDAI.address);
|
|
201
|
+
await setDAOAddress("DAI", dai.address);
|
|
199
202
|
|
|
200
203
|
batUsdOracle = await tokenUsdOracleFactory.deploy();
|
|
201
204
|
|
|
@@ -641,12 +644,13 @@ describe("StakingRewards - staking with cDAI mocks and get Rewards in GoodDollar
|
|
|
641
644
|
|
|
642
645
|
await advanceBlocks(4);
|
|
643
646
|
|
|
644
|
-
const userMintedAndPending =
|
|
647
|
+
const userMintedAndPending =
|
|
648
|
+
await goodCompoundStaking.getUserMintedAndPending(staker.address);
|
|
645
649
|
const userMintedReward = userMintedAndPending[0].toString();
|
|
646
650
|
const userPendingReward = userMintedAndPending[1].toString();
|
|
647
651
|
expect(userMintedReward).to.equal("5000");
|
|
648
652
|
expect(userPendingReward).to.equal("2000");
|
|
649
|
-
|
|
653
|
+
|
|
650
654
|
await goodCompoundStaking
|
|
651
655
|
.connect(staker)
|
|
652
656
|
.withdrawStake(stakingAmount, false);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { expect } from "chai";
|
|
2
2
|
import { ethers, waffle } from "hardhat";
|
|
3
|
+
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
|
|
3
4
|
import { createDAO, advanceBlocks } from "../helpers";
|
|
4
5
|
import { StakingMockFixedAPY } from "../../types";
|
|
5
6
|
import { default as StakingABI } from "../../artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.json";
|
|
@@ -61,7 +62,7 @@ describe("StakingRewardsFixedAPY - generic staking for fixed APY rewards contrac
|
|
|
61
62
|
gd,
|
|
62
63
|
nameService: ns,
|
|
63
64
|
setDAOAddress
|
|
64
|
-
} = await createDAO
|
|
65
|
+
} = await loadFixture(createDAO);
|
|
65
66
|
|
|
66
67
|
setNSAddress = setDAOAddress;
|
|
67
68
|
nameService = ns;
|
|
@@ -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
|
|
|
@@ -38,6 +39,24 @@ describe("SwapHelper - Helper library for swap on the Uniswap", () => {
|
|
|
38
39
|
before(async () => {
|
|
39
40
|
[founder, staker, ...signers] = await ethers.getSigners();
|
|
40
41
|
schemeMock = signers.pop();
|
|
42
|
+
|
|
43
|
+
let {
|
|
44
|
+
controller: ctrl,
|
|
45
|
+
avatar: av,
|
|
46
|
+
gd,
|
|
47
|
+
identity,
|
|
48
|
+
nameService: ns,
|
|
49
|
+
setDAOAddress: sda,
|
|
50
|
+
setSchemes,
|
|
51
|
+
marketMaker: mm,
|
|
52
|
+
daiAddress,
|
|
53
|
+
cdaiAddress,
|
|
54
|
+
reserve,
|
|
55
|
+
setReserveToken,
|
|
56
|
+
genericCall: gc,
|
|
57
|
+
COMP
|
|
58
|
+
} = await loadFixture(createDAO);
|
|
59
|
+
|
|
41
60
|
const cdaiFactory = await ethers.getContractFactory("cDAIMock");
|
|
42
61
|
const cBatFactory = await ethers.getContractFactory("cDecimalsMock");
|
|
43
62
|
const goodFundManagerFactory = await ethers.getContractFactory(
|
|
@@ -54,22 +73,6 @@ describe("SwapHelper - Helper library for swap on the Uniswap", () => {
|
|
|
54
73
|
);
|
|
55
74
|
swapHelperTest = await swapHelperTestFactory.deploy();
|
|
56
75
|
const daiFactory = await ethers.getContractFactory("DAIMock");
|
|
57
|
-
let {
|
|
58
|
-
controller: ctrl,
|
|
59
|
-
avatar: av,
|
|
60
|
-
gd,
|
|
61
|
-
identity,
|
|
62
|
-
nameService: ns,
|
|
63
|
-
setDAOAddress: sda,
|
|
64
|
-
setSchemes,
|
|
65
|
-
marketMaker: mm,
|
|
66
|
-
daiAddress,
|
|
67
|
-
cdaiAddress,
|
|
68
|
-
reserve,
|
|
69
|
-
setReserveToken,
|
|
70
|
-
genericCall: gc,
|
|
71
|
-
COMP
|
|
72
|
-
} = await createDAO();
|
|
73
76
|
|
|
74
77
|
genericCall = gc;
|
|
75
78
|
dai = await ethers.getContractAt("DAIMock", daiAddress);
|
|
@@ -109,7 +112,7 @@ describe("SwapHelper - Helper library for swap on the Uniswap", () => {
|
|
|
109
112
|
const tokenUsdOracleFactory = await ethers.getContractFactory(
|
|
110
113
|
"BatUSDMockOracle"
|
|
111
114
|
);
|
|
112
|
-
setDAOAddress("UNISWAP_ROUTER", uniswapRouter.address);
|
|
115
|
+
await setDAOAddress("UNISWAP_ROUTER", uniswapRouter.address);
|
|
113
116
|
|
|
114
117
|
const compUsdOracleFactory = await ethers.getContractFactory(
|
|
115
118
|
"CompUSDMockOracle"
|
|
@@ -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 } from "ethers";
|
|
3
4
|
import { expect } from "chai";
|
|
4
5
|
import { GoodMarketMaker } from "../../types";
|
|
@@ -37,17 +38,6 @@ describe("UsdcAaveStakingV2 - staking with USDC mocks to AAVE interface", () =>
|
|
|
37
38
|
[founder, staker, ...signers] = await ethers.getSigners();
|
|
38
39
|
schemeMock = signers.pop();
|
|
39
40
|
|
|
40
|
-
const cUsdcFactory = await ethers.getContractFactory("cUSDCMock");
|
|
41
|
-
const goodFundManagerFactory = await ethers.getContractFactory(
|
|
42
|
-
"GoodFundManager"
|
|
43
|
-
);
|
|
44
|
-
goodAaveStakingFactory = await getStakingFactory("GoodAaveStakingV2");
|
|
45
|
-
|
|
46
|
-
const lendingPoolFactory = await ethers.getContractFactory(
|
|
47
|
-
"LendingPoolMock"
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
const usdcFactory = await ethers.getContractFactory("USDCMock");
|
|
51
41
|
let {
|
|
52
42
|
controller: ctrl,
|
|
53
43
|
avatar: av,
|
|
@@ -60,7 +50,20 @@ describe("UsdcAaveStakingV2 - staking with USDC mocks to AAVE interface", () =>
|
|
|
60
50
|
genericCall: gc,
|
|
61
51
|
COMP,
|
|
62
52
|
runAsAvatarOnly: raao
|
|
63
|
-
} = await createDAO
|
|
53
|
+
} = await loadFixture(createDAO);
|
|
54
|
+
|
|
55
|
+
const cUsdcFactory = await ethers.getContractFactory("cUSDCMock");
|
|
56
|
+
const goodFundManagerFactory = await ethers.getContractFactory(
|
|
57
|
+
"GoodFundManager"
|
|
58
|
+
);
|
|
59
|
+
goodAaveStakingFactory = await getStakingFactory("GoodAaveStakingV2");
|
|
60
|
+
|
|
61
|
+
const lendingPoolFactory = await ethers.getContractFactory(
|
|
62
|
+
"LendingPoolMock"
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
const usdcFactory = await ethers.getContractFactory("USDCMock");
|
|
66
|
+
|
|
64
67
|
dai = await ethers.getContractAt("DAIMock", daiAddress);
|
|
65
68
|
avatar = av;
|
|
66
69
|
controller = ctrl;
|
|
@@ -96,7 +99,7 @@ describe("UsdcAaveStakingV2 - staking with USDC mocks to AAVE interface", () =>
|
|
|
96
99
|
const uniswap = await deployUniswap(comp, dai);
|
|
97
100
|
uniswapRouter = uniswap.router;
|
|
98
101
|
const { factory, weth } = uniswap;
|
|
99
|
-
setDAOAddress("UNISWAP_ROUTER", uniswapRouter.address);
|
|
102
|
+
await setDAOAddress("UNISWAP_ROUTER", uniswapRouter.address);
|
|
100
103
|
await factory.createPair(usdc.address, dai.address); // Create tokenA and dai pair
|
|
101
104
|
const pairAddress = factory.getPair(usdc.address, dai.address);
|
|
102
105
|
pair = new Contract(
|
|
@@ -139,23 +142,21 @@ describe("UsdcAaveStakingV2 - staking with USDC mocks to AAVE interface", () =>
|
|
|
139
142
|
).deploy();
|
|
140
143
|
await setDAOAddress("AAVE", aave.address);
|
|
141
144
|
deployStaking = async () => {
|
|
142
|
-
return await goodAaveStakingFactory
|
|
143
|
-
.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
return contract;
|
|
158
|
-
});
|
|
145
|
+
return await goodAaveStakingFactory.deploy().then(async contract => {
|
|
146
|
+
await contract.init(
|
|
147
|
+
usdc.address,
|
|
148
|
+
lendingPool.address,
|
|
149
|
+
nameService.address,
|
|
150
|
+
"Good USDC",
|
|
151
|
+
"gUSDC",
|
|
152
|
+
"172800",
|
|
153
|
+
daiUsdOracle.address,
|
|
154
|
+
incentiveController.address,
|
|
155
|
+
aaveUsdOracle.address,
|
|
156
|
+
[usdc.address, dai.address]
|
|
157
|
+
);
|
|
158
|
+
return contract;
|
|
159
|
+
});
|
|
159
160
|
};
|
|
160
161
|
goodAaveStaking = await deployStaking();
|
|
161
162
|
await usdc["mint(address,uint256)"](
|
|
@@ -318,15 +319,17 @@ describe("UsdcAaveStakingV2 - staking with USDC mocks to AAVE interface", () =>
|
|
|
318
319
|
it("should set gas cost to interest collection parameters", async () => {
|
|
319
320
|
const stakingContract = await deployStaking();
|
|
320
321
|
const collectGasCostBefore = await stakingContract.collectInterestGasCost();
|
|
321
|
-
const claimStakeGasCostBefore =
|
|
322
|
+
const claimStakeGasCostBefore =
|
|
323
|
+
await stakingContract.collectInterestGasCost();
|
|
322
324
|
await runAsAvatarOnly(
|
|
323
325
|
stakingContract,
|
|
324
326
|
"setcollectInterestGasCostParams(uint32,uint32)",
|
|
325
327
|
999,
|
|
326
328
|
999
|
|
327
|
-
)
|
|
329
|
+
);
|
|
328
330
|
const collectGasCostAfter = await stakingContract.collectInterestGasCost();
|
|
329
|
-
const claimStakeGasCostAfter =
|
|
331
|
+
const claimStakeGasCostAfter =
|
|
332
|
+
await stakingContract.collectInterestGasCost();
|
|
330
333
|
expect(collectGasCostAfter).to.not.equal(collectGasCostBefore);
|
|
331
334
|
expect(collectGasCostAfter).to.equal(999);
|
|
332
335
|
expect(claimStakeGasCostAfter).to.not.equal(claimStakeGasCostBefore);
|