@gooddollar/goodprotocol 1.0.29-beta.0 → 1.0.29-beta.2
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/AdminWallet.min.json +1 -1
- package/artifacts/abis/BulkProof.min.json +1 -1
- package/artifacts/abis/DistributionBridgeMock.min.json +1 -0
- package/artifacts/abis/DistributionHelper.min.json +1 -0
- package/artifacts/abis/DistributionHelperTest.min.json +1 -0
- package/artifacts/abis/DistributionHelperTestHelper.min.json +1 -0
- package/artifacts/abis/ERC20.min.json +1 -1
- package/artifacts/abis/Faucet.min.json +1 -0
- package/artifacts/abis/GoodDollarMintBurnWrapper.min.json +1 -0
- package/artifacts/abis/GoodDollarStaking.min.json +1 -0
- package/artifacts/abis/GoodDollarStakingMock.min.json +1 -0
- package/artifacts/abis/GoodReserveCDai.min.json +1 -1
- package/artifacts/abis/IERC2917.min.json +1 -1
- package/artifacts/abis/IGoodDollar.min.json +1 -1
- package/artifacts/abis/IGoodDollarStakingTest.min.json +1 -0
- package/artifacts/abis/IGovernanceStaking.min.json +1 -0
- package/artifacts/abis/IIdentity.min.json +1 -1
- package/artifacts/abis/IIdentityV2.min.json +1 -0
- package/artifacts/abis/IMultichainRouter.min.json +1 -0
- package/artifacts/abis/IRouter.min.json +1 -0
- package/artifacts/abis/IWrapper.min.json +1 -0
- package/artifacts/abis/IdentityV2.min.json +1 -0
- package/artifacts/abis/InvitesV2.min.json +1 -0
- package/artifacts/abis/Math64x64.min.json +1 -0
- package/artifacts/abis/MultichainBridgeHelper.min.json +1 -0
- package/artifacts/abis/MultichainRouterMock.min.json +1 -0
- package/artifacts/abis/OverMintTester.min.json +1 -1
- package/artifacts/abis/PausableControl.min.json +1 -0
- package/artifacts/abis/RewardsMinter.min.json +1 -0
- package/artifacts/abis/StakingMockFixedAPY.min.json +1 -0
- package/artifacts/abis/StakingRewardsFixedAPY.min.json +1 -0
- package/artifacts/abis/TokenOperation.min.json +1 -0
- package/artifacts/abis/UBIScheme.min.json +1 -1
- package/artifacts/abis/cERC20.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/ERC20.json +13 -0
- 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/IERC2917.json +13 -0
- 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/IGoodDollar.json +39 -0
- 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 +51 -0
- package/artifacts/contracts/Interfaces.sol/IIdentityV2.dbg.json +4 -0
- package/artifacts/contracts/Interfaces.sol/IIdentityV2.json +281 -0
- package/artifacts/contracts/Interfaces.sol/ILendingPool.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IMultichainRouter.dbg.json +4 -0
- package/artifacts/contracts/Interfaces.sol/IMultichainRouter.json +67 -0
- 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/Interfaces.sol/cERC20.json +13 -0
- package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.dbg.json +4 -0
- package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.json +684 -0
- 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 +4 -0
- package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.json +1335 -0
- package/artifacts/contracts/governance/GoodDollarStaking.sol/IGovernanceStaking.dbg.json +4 -0
- package/artifacts/contracts/governance/GoodDollarStaking.sol/IGovernanceStaking.json +24 -0
- package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.dbg.json +4 -0
- package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.json +35 -0
- 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 +4 -0
- package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.json +1000 -0
- 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 +4 -0
- package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.json +586 -0
- 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 +4 -0
- package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.json +152 -0
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +4 -0
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.json +662 -0
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +4 -0
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.json +680 -0
- 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 +4 -0
- package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.json +1335 -0
- 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 +4 -0
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/IWrapper.json +59 -0
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.dbg.json +4 -0
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.json +81 -0
- package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.dbg.json +4 -0
- package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.json +49 -0
- package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.json +4 -4
- 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 +4 -0
- package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.json +682 -0
- 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 +4 -0
- package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.json +662 -0
- 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 +75 -35
- 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 +4 -0
- package/artifacts/contracts/staking/utils/Math64X64.sol/Math64x64.json +10 -0
- package/artifacts/contracts/staking/utils/StakingRewardsFixedAPY.sol/StakingRewardsFixedAPY.dbg.json +4 -0
- package/artifacts/contracts/staking/utils/StakingRewardsFixedAPY.sol/StakingRewardsFixedAPY.json +268 -0
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.json +15 -22
- package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
- package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.json +76 -56
- 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 +3 -34
- 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 +4 -0
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.json +1263 -0
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/IRouter.dbg.json +4 -0
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/IRouter.json +59 -0
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/PausableControl.dbg.json +4 -0
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/PausableControl.json +69 -0
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.dbg.json +4 -0
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.json +10 -0
- package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.dbg.json +4 -0
- package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.json +79 -0
- 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 +46 -0
- package/contracts/fuseFaucet/Faucet.sol +245 -0
- package/contracts/governance/GoodDollarStaking.sol +524 -0
- package/contracts/governance/MultiBaseGovernanceShareField.sol +1 -0
- package/contracts/identity/IdentityV2.sol +434 -0
- package/contracts/invite/InvitesV2.sol +316 -0
- package/contracts/mocks/DistributionBridgeMock.sol +50 -0
- package/contracts/mocks/DistributionHelperTest.sol +22 -0
- package/contracts/mocks/GoodDollarStakingMock.sol +24 -0
- package/contracts/mocks/MultichainRouterMock.sol +38 -0
- package/contracts/mocks/OverMintTester.sol +39 -25
- package/contracts/mocks/StakingMockFixedAPY.sol +78 -0
- package/contracts/reserve/DistributionHelper.sol +142 -0
- package/contracts/reserve/GoodReserveCDai.sol +95 -41
- package/contracts/staking/utils/Math64X64.sol +268 -0
- package/contracts/staking/utils/StakingRewardsFixedAPY.sol +336 -0
- package/contracts/ubi/UBIScheme.sol +45 -40
- package/contracts/utils/AdminWallet.sol +42 -11
- package/contracts/utils/BulkProof.sol +10 -10
- package/contracts/utils/GoodDollarMintBurnWrapper.sol +638 -0
- package/contracts/utils/MultichainBridgeHelper.sol +39 -0
- package/hardhat.config.ts +21 -5
- package/package.json +9 -5
- package/patches/@openzeppelin+hardhat-upgrades+1.7.0.patch.depracate +67 -0
- package/releases/deploy-settings.json +36 -1
- package/releases/deployment.json +103 -55
- package/releases/olddao.json +1 -1
- package/scripts/analytics/activeUsersCount.ts +65 -0
- package/scripts/analytics/activeWalletsStats.ts +150 -0
- package/scripts/analytics/claimIncidentStats.ts +117 -0
- package/scripts/analytics/faucetStats.ts +103 -0
- package/scripts/analytics/goodHolders.ts +50 -0
- package/scripts/{misc → analytics}/goodgiveback.ts +0 -0
- package/scripts/governance/airdropCalculation.ts +1 -0
- package/scripts/multichain-deploy/0_proxyFactory-deploy.ts +45 -0
- package/scripts/multichain-deploy/{basicdao-deploy.ts → 1_basicdao-deploy.ts} +75 -56
- package/scripts/multichain-deploy/2_helpers-deploy.ts +143 -0
- package/scripts/multichain-deploy/3_gdSavings-deploy.ts +246 -0
- package/scripts/multichain-deploy/4_ubi-deploy.ts +121 -0
- package/scripts/multichain-deploy/5_gov-deploy.ts +123 -0
- package/scripts/multichain-deploy/helpers.ts +72 -8
- package/scripts/multichain-deploy/multichainWrapper-deploy.ts +56 -0
- package/scripts/multichain-deploy/verifyEtherscan.ts +84 -0
- package/scripts/test/localOldDaoDeploy.ts +10 -3
- package/scripts/upgrades/identity-upgrade.ts +153 -0
- package/scripts/upgrades/nonubiDistribution-deploy.ts +167 -0
- package/scripts/voltageswaps.ts +47 -0
- package/test/governance/ClaimersDistribution.test.ts +1 -1
- package/test/governance/GoodDollarStaking.gd.test.ts +559 -0
- package/test/governance/GoodDollarStaking.good.test.ts +998 -0
- package/test/governance/GovernanceStaking.test.ts +43 -0
- package/test/helpers.ts +21 -20
- package/test/reserve/DistributionHelper.test.ts +394 -0
- package/test/reserve/GoodReserveCDai.distribution.test.ts +296 -0
- package/test/reserve/GoodReserveCDai.gdx.test.ts +21 -16
- package/test/reserve/GoodReserveCDai.pause.test.ts +116 -0
- package/test/staking/StakingRewardsFixedAPY.test.ts +900 -0
- package/test/ubi/UBIScheme.test.ts +30 -30
- package/test/ubi/UBISchemeCycle.test.ts +9 -7
- package/test/utils/AdminWallet.test.ts +40 -13
- package/test/utils/GoodDollarMintBurnWrapper.test.ts +796 -0
- package/tsconfig.json +4 -9
- package/types/AccessControl.ts +361 -0
- package/types/AdminWallet.ts +124 -113
- package/types/CERC20.ts +25 -0
- package/types/DistributionBridgeMock.ts +251 -0
- package/types/DistributionHelper.ts +908 -0
- package/types/DistributionHelperTest.ts +909 -0
- package/types/DistributionHelperTestHelper.ts +945 -0
- package/types/ERC165.ts +104 -0
- package/types/ERC20.ts +101 -49
- package/types/Faucet.ts +1014 -0
- package/types/GoodDollarMintBurnWrapper.ts +1806 -0
- package/types/GoodDollarStaking.ts +1889 -0
- package/types/GoodDollarStakingMock.ts +1889 -0
- package/types/GoodReserveCDai.ts +90 -55
- package/types/IAccessControl.ts +306 -0
- package/types/IERC1271.ts +109 -0
- package/types/IERC165.ts +104 -0
- package/types/IERC20.ts +300 -0
- package/types/IERC20Metadata.ts +339 -0
- package/types/IERC2917.ts +25 -0
- package/types/IGoodDollar.ts +54 -0
- package/types/IGoodDollarStakingTest.ts +160 -0
- package/types/{BulkProof.ts → IGovernanceStaking.ts} +15 -28
- package/types/IIdentity.ts +75 -0
- package/types/IIdentityV2.ts +526 -0
- package/types/IMultichainRouter.ts +166 -0
- package/types/IRouter.ts +143 -0
- package/types/IWrapper.ts +143 -0
- package/types/IdentityV2.ts +1612 -0
- package/types/InvitesV2.ts +933 -0
- package/types/MultichainBridgeHelper.ts +170 -0
- package/types/MultichainRouterMock.ts +141 -0
- package/types/Pausable.ts +103 -0
- package/types/PausableControl.ts +125 -0
- package/types/RewardsMinter.ts +107 -0
- package/types/StakingMockFixedAPY.ts +995 -0
- package/types/StakingRewardsFixedAPY.ts +428 -0
- package/types/UBIScheme.ts +19 -40
- package/types/factories/AaveStakingFactory__factory.ts +1 -1
- package/types/factories/AccessControl__factory.ts +227 -0
- package/types/factories/AdminWallet__factory.ts +75 -55
- package/types/factories/BaseShareFieldV2__factory.ts +1 -1
- package/types/factories/BaseShareField__factory.ts +1 -1
- package/types/factories/CERC20__factory.ts +13 -0
- 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 +207 -0
- package/types/factories/DistributionHelperTestHelper__factory.ts +737 -0
- package/types/factories/DistributionHelperTest__factory.ts +717 -0
- package/types/factories/DistributionHelper__factory.ts +713 -0
- package/types/factories/DonationsStaking__factory.ts +1 -1
- package/types/factories/ERC165__factory.ts +39 -0
- package/types/factories/ERC20__factory.ts +13 -0
- package/types/factories/ExchangeHelper__factory.ts +1 -1
- package/types/factories/Faucet__factory.ts +729 -0
- 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 +1318 -0
- package/types/factories/GoodDollarStakingMock__factory.ts +1417 -0
- package/types/factories/GoodDollarStaking__factory.ts +1413 -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 +74 -34
- package/types/factories/GovernanceStaking__factory.ts +1 -1
- package/types/factories/IAccessControl__factory.ts +198 -0
- package/types/factories/IERC1271__factory.ts +47 -0
- package/types/factories/IERC165__factory.ts +42 -0
- package/types/factories/IERC20Metadata__factory.ts +248 -0
- package/types/factories/IERC20__factory.ts +203 -0
- package/types/factories/IERC2917__factory.ts +13 -0
- package/types/factories/IGoodDollarStakingTest__factory.ts +68 -0
- package/types/factories/IGoodDollar__factory.ts +39 -0
- package/types/factories/IGovernanceStaking__factory.ts +39 -0
- package/types/factories/IIdentityV2__factory.ts +293 -0
- package/types/factories/IIdentity__factory.ts +51 -0
- package/types/factories/IMultichainRouter__factory.ts +82 -0
- package/types/factories/IRouter__factory.ts +71 -0
- package/types/factories/IWrapper__factory.ts +71 -0
- package/types/factories/IdentityV2__factory.ts +1048 -0
- package/types/factories/InvitesV1__factory.ts +1 -1
- package/types/factories/InvitesV2__factory.ts +634 -0
- package/types/factories/MultichainBridgeHelper__factory.ts +134 -0
- package/types/factories/MultichainRouterMock__factory.ts +141 -0
- package/types/factories/OverMintTesterRegularStake__factory.ts +1 -1
- package/types/factories/OverMintTester__factory.ts +3 -3
- package/types/factories/PausableControl__factory.ts +84 -0
- package/types/factories/Pausable__factory.ts +62 -0
- 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/RewardsMinter__factory.ts +47 -0
- package/types/factories/StakersDistribution__factory.ts +1 -1
- package/types/factories/StakingMockFixedAPY__factory.ts +745 -0
- package/types/factories/StakingRewardsFixedAPY__factory.ts +287 -0
- package/types/factories/SwapHelperTest__factory.ts +1 -1
- package/types/factories/UBIScheme__factory.ts +14 -21
- 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 +279 -9
- package/types/index.ts +62 -4
- package/yarn.lock +184 -108
- package/types/factories/BulkProof__factory.ts +0 -89
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.8;
|
|
4
|
+
|
|
5
|
+
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
6
|
+
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
|
|
7
|
+
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
|
|
8
|
+
import "../Interfaces.sol";
|
|
9
|
+
import "../utils/NameService.sol";
|
|
10
|
+
|
|
11
|
+
// import "hardhat/console.sol";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @title InvitesV1 contract that handles invites with pre allocated bounty pool
|
|
15
|
+
* 1.1 adds invitee bonus
|
|
16
|
+
* 2 uses uups upgradeable - not compatible upgrade for v1
|
|
17
|
+
*/
|
|
18
|
+
contract InvitesV2 is Initializable, UUPSUpgradeable {
|
|
19
|
+
using SafeMathUpgradeable for uint256;
|
|
20
|
+
|
|
21
|
+
struct Stats {
|
|
22
|
+
uint256 totalApprovedInvites;
|
|
23
|
+
uint256 totalBountiesPaid;
|
|
24
|
+
uint256 totalInvited;
|
|
25
|
+
uint256[5] __reserevedSpace;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
struct User {
|
|
29
|
+
address invitedBy;
|
|
30
|
+
bytes32 inviteCode;
|
|
31
|
+
bool bountyPaid;
|
|
32
|
+
address[] invitees;
|
|
33
|
+
address[] pending;
|
|
34
|
+
uint256 level;
|
|
35
|
+
uint256 levelStarted;
|
|
36
|
+
uint256 totalApprovedInvites;
|
|
37
|
+
uint256 totalEarned;
|
|
38
|
+
uint256 joinedAt;
|
|
39
|
+
uint256[5] __reserevedSpace;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
struct Level {
|
|
43
|
+
uint256 toNext;
|
|
44
|
+
uint256 bounty; //in G$ cents ie 2 decimals
|
|
45
|
+
uint256 daysToComplete;
|
|
46
|
+
uint256[5] __reserevedSpace;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
mapping(bytes32 => address) public codeToUser;
|
|
50
|
+
mapping(address => User) public users;
|
|
51
|
+
address payable public avatar;
|
|
52
|
+
|
|
53
|
+
mapping(uint256 => Level) public levels;
|
|
54
|
+
|
|
55
|
+
address public owner;
|
|
56
|
+
NameService public nameService;
|
|
57
|
+
cERC20 public goodDollar;
|
|
58
|
+
bool public active;
|
|
59
|
+
Stats public stats;
|
|
60
|
+
|
|
61
|
+
bool public levelExpirationEnabled;
|
|
62
|
+
|
|
63
|
+
event InviteeJoined(address indexed inviter, address indexed invitee);
|
|
64
|
+
event InviterBounty(
|
|
65
|
+
address indexed inviter,
|
|
66
|
+
address indexed invitee,
|
|
67
|
+
uint256 bountyPaid,
|
|
68
|
+
uint256 inviterLevel,
|
|
69
|
+
bool earnedLevel
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
modifier ownerOrAvatar() {
|
|
73
|
+
require(
|
|
74
|
+
msg.sender == owner || msg.sender == avatar,
|
|
75
|
+
"Only owner or avatar can perform this action"
|
|
76
|
+
);
|
|
77
|
+
_;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
modifier onlyAvatar() {
|
|
81
|
+
require(msg.sender == avatar, "Only DAO avatar can perform this action");
|
|
82
|
+
_;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
modifier isActive() {
|
|
86
|
+
require(active);
|
|
87
|
+
_;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function initialize(
|
|
91
|
+
address payable _avatar,
|
|
92
|
+
address _ns,
|
|
93
|
+
address _gd,
|
|
94
|
+
uint256 _level0Bounty,
|
|
95
|
+
address _owner
|
|
96
|
+
) public initializer {
|
|
97
|
+
owner = _owner;
|
|
98
|
+
nameService = NameService(_ns);
|
|
99
|
+
active = true;
|
|
100
|
+
Level storage lvl = levels[0];
|
|
101
|
+
lvl.bounty = _level0Bounty;
|
|
102
|
+
goodDollar = cERC20(_gd);
|
|
103
|
+
avatar = _avatar;
|
|
104
|
+
levelExpirationEnabled = false;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function _authorizeUpgrade(address newImplementation)
|
|
108
|
+
internal
|
|
109
|
+
override
|
|
110
|
+
ownerOrAvatar
|
|
111
|
+
{}
|
|
112
|
+
|
|
113
|
+
function getIdentity() public view returns (IIdentityV2) {
|
|
114
|
+
return IIdentityV2(nameService.getAddress("IDENTITY"));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function setLevelExpirationEnabled(bool _isEnabled) public ownerOrAvatar {
|
|
118
|
+
levelExpirationEnabled = _isEnabled;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function join(bytes32 _myCode, bytes32 _inviterCode) public isActive {
|
|
122
|
+
require(
|
|
123
|
+
codeToUser[_myCode] == address(0) || codeToUser[_myCode] == msg.sender,
|
|
124
|
+
"invite code already in use"
|
|
125
|
+
);
|
|
126
|
+
User storage user = users[msg.sender]; // this is not expensive as user is new
|
|
127
|
+
address inviter = codeToUser[_inviterCode];
|
|
128
|
+
//allow user to set inviter if doesnt have one
|
|
129
|
+
require(
|
|
130
|
+
user.inviteCode == 0x0 ||
|
|
131
|
+
(user.invitedBy == address(0) && inviter != address(0)),
|
|
132
|
+
"user already joined"
|
|
133
|
+
);
|
|
134
|
+
if (user.inviteCode == 0x0) {
|
|
135
|
+
user.inviteCode = _myCode;
|
|
136
|
+
user.levelStarted = block.timestamp;
|
|
137
|
+
user.joinedAt = block.timestamp;
|
|
138
|
+
codeToUser[_myCode] = msg.sender;
|
|
139
|
+
}
|
|
140
|
+
if (inviter != address(0)) {
|
|
141
|
+
user.invitedBy = inviter;
|
|
142
|
+
users[inviter].invitees.push(msg.sender);
|
|
143
|
+
users[inviter].pending.push(msg.sender);
|
|
144
|
+
stats.totalInvited += 1;
|
|
145
|
+
}
|
|
146
|
+
emit InviteeJoined(inviter, msg.sender);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function canCollectBountyFor(address _invitee) public view returns (bool) {
|
|
150
|
+
address invitedBy = users[_invitee].invitedBy;
|
|
151
|
+
uint256 daysToComplete = levels[users[invitedBy].level].daysToComplete;
|
|
152
|
+
bool isLevelExpired = levelExpirationEnabled == true &&
|
|
153
|
+
daysToComplete > 0 &&
|
|
154
|
+
daysToComplete <
|
|
155
|
+
users[_invitee].joinedAt.sub(users[invitedBy].levelStarted).div(1 days);
|
|
156
|
+
|
|
157
|
+
return
|
|
158
|
+
invitedBy != address(0) &&
|
|
159
|
+
!users[_invitee].bountyPaid &&
|
|
160
|
+
getIdentity().isWhitelisted(_invitee) &&
|
|
161
|
+
getIdentity().isWhitelisted(invitedBy) &&
|
|
162
|
+
isLevelExpired == false;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function getInvitees(address _inviter)
|
|
166
|
+
public
|
|
167
|
+
view
|
|
168
|
+
returns (address[] memory)
|
|
169
|
+
{
|
|
170
|
+
return users[_inviter].invitees;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function getPendingInvitees(address _inviter)
|
|
174
|
+
public
|
|
175
|
+
view
|
|
176
|
+
returns (address[] memory)
|
|
177
|
+
{
|
|
178
|
+
address[] memory pending = users[_inviter].pending;
|
|
179
|
+
uint256 cur = 0;
|
|
180
|
+
uint256 total = 0;
|
|
181
|
+
for (uint256 i; i < pending.length; i++) {
|
|
182
|
+
if (!users[pending[i]].bountyPaid) {
|
|
183
|
+
total++;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
address[] memory result = new address[](total);
|
|
188
|
+
|
|
189
|
+
for (uint256 i; i < pending.length; i++) {
|
|
190
|
+
if (!users[pending[i]].bountyPaid) {
|
|
191
|
+
result[cur] = pending[i];
|
|
192
|
+
cur++;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function getPendingBounties(address _inviter) public view returns (uint256) {
|
|
200
|
+
address[] memory pending = users[_inviter].pending;
|
|
201
|
+
uint256 total = 0;
|
|
202
|
+
for (uint256 i; i < pending.length; i++) {
|
|
203
|
+
if (canCollectBountyFor(pending[i])) {
|
|
204
|
+
total++;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return total;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* @dev pay bounty for the inviter of _invitee
|
|
212
|
+
* invitee need to be whitelisted
|
|
213
|
+
*/
|
|
214
|
+
function bountyFor(address _invitee)
|
|
215
|
+
public
|
|
216
|
+
isActive
|
|
217
|
+
returns (uint256 bounty)
|
|
218
|
+
{
|
|
219
|
+
require(canCollectBountyFor(_invitee), "user not elligble for bounty yet");
|
|
220
|
+
return _bountyFor(_invitee, true);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function _bountyFor(address _invitee, bool isSingleBounty)
|
|
224
|
+
internal
|
|
225
|
+
returns (uint256 bounty)
|
|
226
|
+
{
|
|
227
|
+
address invitedBy = users[_invitee].invitedBy;
|
|
228
|
+
uint256 joinedAt = users[_invitee].joinedAt;
|
|
229
|
+
Level memory level = levels[users[invitedBy].level];
|
|
230
|
+
|
|
231
|
+
bool isLevelExpired = level.daysToComplete > 0 &&
|
|
232
|
+
joinedAt > users[invitedBy].levelStarted && //prevent overflow in subtraction
|
|
233
|
+
level.daysToComplete <
|
|
234
|
+
joinedAt.sub(users[invitedBy].levelStarted).div(1 days); //how long after level started did invitee join
|
|
235
|
+
|
|
236
|
+
users[_invitee].bountyPaid = true;
|
|
237
|
+
users[invitedBy].totalApprovedInvites += 1;
|
|
238
|
+
users[invitedBy].totalEarned += level.bounty;
|
|
239
|
+
stats.totalApprovedInvites += 1;
|
|
240
|
+
stats.totalBountiesPaid += level.bounty;
|
|
241
|
+
|
|
242
|
+
bool earnedLevel = false;
|
|
243
|
+
if (
|
|
244
|
+
level.toNext > 0 &&
|
|
245
|
+
users[invitedBy].totalApprovedInvites >= level.toNext &&
|
|
246
|
+
isLevelExpired == false
|
|
247
|
+
) {
|
|
248
|
+
users[invitedBy].level += 1;
|
|
249
|
+
users[invitedBy].levelStarted = block.timestamp;
|
|
250
|
+
earnedLevel = true;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (isSingleBounty) goodDollar.transfer(invitedBy, level.bounty);
|
|
254
|
+
goodDollar.transfer(_invitee, level.bounty.div(2)); //pay invitee half the bounty
|
|
255
|
+
emit InviterBounty(
|
|
256
|
+
invitedBy,
|
|
257
|
+
_invitee,
|
|
258
|
+
level.bounty,
|
|
259
|
+
users[invitedBy].level,
|
|
260
|
+
earnedLevel
|
|
261
|
+
);
|
|
262
|
+
|
|
263
|
+
return level.bounty;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
@dev collect bounties for invitees by msg.sender that are now whitelisted
|
|
268
|
+
*/
|
|
269
|
+
function collectBounties() public isActive {
|
|
270
|
+
address[] storage pendings = users[msg.sender].pending;
|
|
271
|
+
uint256 totalBounties = 0;
|
|
272
|
+
for (int256 i = int256(pendings.length) - 1; i >= 0; i--) {
|
|
273
|
+
if (gasleft() < 100000) break;
|
|
274
|
+
address pending = pendings[uint256(i)];
|
|
275
|
+
if (canCollectBountyFor(pending)) {
|
|
276
|
+
totalBounties += _bountyFor(pending, false);
|
|
277
|
+
pendings.pop();
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
if (totalBounties > 0) goodDollar.transfer(msg.sender, totalBounties);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function setLevel(
|
|
284
|
+
uint256 _lvl,
|
|
285
|
+
uint256 _toNext,
|
|
286
|
+
uint256 _bounty,
|
|
287
|
+
uint256 _daysToComplete
|
|
288
|
+
) public ownerOrAvatar {
|
|
289
|
+
Level storage lvl = levels[_lvl];
|
|
290
|
+
lvl.toNext = _toNext;
|
|
291
|
+
lvl.daysToComplete = _daysToComplete;
|
|
292
|
+
lvl.bounty = _bounty;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
function setActive(bool _active) public ownerOrAvatar {
|
|
296
|
+
active = _active;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function end() public ownerOrAvatar isActive {
|
|
300
|
+
uint256 gdBalance = goodDollar.balanceOf(address(this));
|
|
301
|
+
goodDollar.transfer(avatar, gdBalance);
|
|
302
|
+
avatar.transfer(address(this).balance);
|
|
303
|
+
active = false;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* @dev
|
|
308
|
+
* 1.2.0 - final changes before release
|
|
309
|
+
* 1.3.0 - allow to set inviter later
|
|
310
|
+
* 1.4.0 - improve gas for bounty collection
|
|
311
|
+
* 1.5.0 - more gas improvements
|
|
312
|
+
*/
|
|
313
|
+
function version() public pure returns (string memory) {
|
|
314
|
+
return "1.5.0";
|
|
315
|
+
}
|
|
316
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity ^0.8;
|
|
4
|
+
|
|
5
|
+
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
6
|
+
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
7
|
+
import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
|
|
8
|
+
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
9
|
+
import "@openzeppelin/contracts/utils/math/Math.sol";
|
|
10
|
+
|
|
11
|
+
import "../utils/DAOUpgradeableContract.sol";
|
|
12
|
+
|
|
13
|
+
import "hardhat/console.sol";
|
|
14
|
+
|
|
15
|
+
contract DistributionBridgeMock {
|
|
16
|
+
event AnySwap(
|
|
17
|
+
address token,
|
|
18
|
+
address recipient,
|
|
19
|
+
uint256 amount,
|
|
20
|
+
uint256 chainId
|
|
21
|
+
);
|
|
22
|
+
event OnToken(address sender, uint256 amount, bytes data);
|
|
23
|
+
|
|
24
|
+
function anySwapOut(
|
|
25
|
+
address token,
|
|
26
|
+
address recipient,
|
|
27
|
+
uint256 amount,
|
|
28
|
+
uint256 chainId
|
|
29
|
+
) external {
|
|
30
|
+
emit AnySwap(token, recipient, amount, chainId);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function anySwapOutUnderlying(
|
|
34
|
+
address token,
|
|
35
|
+
address recipient,
|
|
36
|
+
uint256 amount,
|
|
37
|
+
uint256 chainId
|
|
38
|
+
) external {
|
|
39
|
+
emit AnySwap(token, recipient, amount, chainId);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function onTokenTransfer(
|
|
43
|
+
address sender,
|
|
44
|
+
uint256 amount,
|
|
45
|
+
bytes memory data
|
|
46
|
+
) external returns (bool) {
|
|
47
|
+
emit OnToken(sender, amount, data);
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
pragma solidity >=0.8;
|
|
2
|
+
|
|
3
|
+
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
4
|
+
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
5
|
+
import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
|
|
6
|
+
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
7
|
+
import "@openzeppelin/contracts/utils/math/Math.sol";
|
|
8
|
+
|
|
9
|
+
import "../reserve/DistributionHelper.sol";
|
|
10
|
+
|
|
11
|
+
contract DistributionHelperTest is DistributionHelper {
|
|
12
|
+
function onDistribution(uint256 _amount) external override {
|
|
13
|
+
revert();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
contract DistributionHelperTestHelper is DistributionHelper {
|
|
18
|
+
function setBridges(address _fuseBridge, address _multiBridge) external {
|
|
19
|
+
fuseBridge = _fuseBridge;
|
|
20
|
+
multiChainBridge = IMultichainRouter(_multiBridge);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.0;
|
|
3
|
+
|
|
4
|
+
import "../governance/GoodDollarStaking.sol";
|
|
5
|
+
|
|
6
|
+
contract GoodDollarStakingMock is GoodDollarStaking {
|
|
7
|
+
constructor(
|
|
8
|
+
INameService _ns,
|
|
9
|
+
uint128 _interestRatePerBlock,
|
|
10
|
+
uint128 _numberOfBlocksPerYear,
|
|
11
|
+
uint32 _daysUntilUpgrade
|
|
12
|
+
)
|
|
13
|
+
GoodDollarStaking(
|
|
14
|
+
_ns,
|
|
15
|
+
_interestRatePerBlock,
|
|
16
|
+
_numberOfBlocksPerYear,
|
|
17
|
+
_daysUntilUpgrade
|
|
18
|
+
)
|
|
19
|
+
{}
|
|
20
|
+
|
|
21
|
+
function upgrade() external override {
|
|
22
|
+
_setMonthlyRewards(address(this), 2 ether * 1e6); //2M monthly GOOD
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity ^0.8;
|
|
4
|
+
|
|
5
|
+
import "../Interfaces.sol";
|
|
6
|
+
|
|
7
|
+
import "hardhat/console.sol";
|
|
8
|
+
|
|
9
|
+
interface IWrapper {
|
|
10
|
+
function mint(address to, uint256 amount) external returns (bool);
|
|
11
|
+
|
|
12
|
+
function burn(address from, uint256 amount) external returns (bool);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
contract MultichainRouterMock {
|
|
16
|
+
IWrapper wrapper;
|
|
17
|
+
|
|
18
|
+
constructor(IWrapper _wrapper) {
|
|
19
|
+
wrapper = _wrapper;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
event AnySwap(
|
|
23
|
+
address token,
|
|
24
|
+
address recipient,
|
|
25
|
+
uint256 amount,
|
|
26
|
+
uint256 chainId
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
function anySwapOut(
|
|
30
|
+
address token,
|
|
31
|
+
address recipient,
|
|
32
|
+
uint256 amount,
|
|
33
|
+
uint256 chainId
|
|
34
|
+
) external {
|
|
35
|
+
wrapper.burn(msg.sender, amount);
|
|
36
|
+
emit AnySwap(token, recipient, amount, chainId);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -3,32 +3,46 @@
|
|
|
3
3
|
pragma solidity >=0.8.0;
|
|
4
4
|
import "../governance/GovernanceStaking.sol";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
GovernanceStaking public stakingContract;
|
|
9
|
-
ERC20 public rewardToken;
|
|
10
|
-
|
|
11
|
-
constructor (ERC20 _stakingToken ,GovernanceStaking _stakingContract,ERC20 _rewardToken){
|
|
12
|
-
stakingToken = _stakingToken;
|
|
13
|
-
stakingContract = _stakingContract;
|
|
14
|
-
rewardToken = _rewardToken;
|
|
15
|
-
|
|
16
|
-
}
|
|
6
|
+
interface IGoodDollarStakingTest {
|
|
7
|
+
function stake(uint256 amount) external;
|
|
17
8
|
|
|
18
|
-
|
|
9
|
+
function stake(uint256 amount, uint32 ratio) external;
|
|
19
10
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
stakingContract.stake(tokenBalance);
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
function overMintTest()external{
|
|
26
|
-
stakingContract.withdrawRewards();
|
|
27
|
-
uint256 tokenBalance = rewardToken.balanceOf(address(this));
|
|
28
|
-
require(tokenBalance != 0,"Reward token balance should not be equal 0");
|
|
29
|
-
stakingContract.withdrawRewards();
|
|
30
|
-
uint256 tokenBalanceAfterSecondClaim = rewardToken.balanceOf(address(this));
|
|
31
|
-
require (tokenBalance == tokenBalanceAfterSecondClaim,"It should not overmint rewards");
|
|
32
|
-
}
|
|
11
|
+
function withdrawRewards() external;
|
|
12
|
+
}
|
|
33
13
|
|
|
14
|
+
contract OverMintTester {
|
|
15
|
+
ERC20 public stakingToken;
|
|
16
|
+
IGoodDollarStakingTest public stakingContract;
|
|
17
|
+
ERC20 public rewardToken;
|
|
18
|
+
|
|
19
|
+
constructor(
|
|
20
|
+
ERC20 _stakingToken,
|
|
21
|
+
IGoodDollarStakingTest _stakingContract,
|
|
22
|
+
ERC20 _rewardToken
|
|
23
|
+
) {
|
|
24
|
+
stakingToken = _stakingToken;
|
|
25
|
+
stakingContract = _stakingContract;
|
|
26
|
+
rewardToken = _rewardToken;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function stake() external {
|
|
30
|
+
uint256 tokenBalance = stakingToken.balanceOf(address(this));
|
|
31
|
+
stakingToken.approve(address(stakingContract), tokenBalance);
|
|
32
|
+
try stakingContract.stake(tokenBalance, 0) {} catch {
|
|
33
|
+
stakingContract.stake(tokenBalance);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function overMintTest() external {
|
|
38
|
+
stakingContract.withdrawRewards();
|
|
39
|
+
uint256 tokenBalance = rewardToken.balanceOf(address(this));
|
|
40
|
+
require(tokenBalance != 0, "Reward token balance should not be equal 0");
|
|
41
|
+
stakingContract.withdrawRewards();
|
|
42
|
+
uint256 tokenBalanceAfterSecondClaim = rewardToken.balanceOf(address(this));
|
|
43
|
+
require(
|
|
44
|
+
tokenBalance == tokenBalanceAfterSecondClaim,
|
|
45
|
+
"It should not overmint rewards"
|
|
46
|
+
);
|
|
47
|
+
}
|
|
34
48
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.0;
|
|
3
|
+
|
|
4
|
+
import { ERC20 as ERC20_OZ } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
|
5
|
+
import "../staking/utils/StakingRewardsFixedAPY.sol";
|
|
6
|
+
import "hardhat/console.sol";
|
|
7
|
+
|
|
8
|
+
contract StakingMockFixedAPY is ERC20_OZ, StakingRewardsFixedAPY {
|
|
9
|
+
using Math64x64 for int128;
|
|
10
|
+
|
|
11
|
+
constructor(uint128 _interestRatePerBlock)
|
|
12
|
+
ERC20_OZ("G$ Savings Mock", "mocksvG$")
|
|
13
|
+
{
|
|
14
|
+
_setAPY(_interestRatePerBlock);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function sharesSupply() public view virtual override returns (uint256) {
|
|
18
|
+
return totalSupply();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function sharesOf(address _account)
|
|
22
|
+
public
|
|
23
|
+
view
|
|
24
|
+
virtual
|
|
25
|
+
override
|
|
26
|
+
returns (uint256)
|
|
27
|
+
{
|
|
28
|
+
return balanceOf(_account);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function setAPY(uint128 _interestRatePerBlock) public {
|
|
32
|
+
_setAPY(_interestRatePerBlock);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function compound() public view returns (uint256 compoundedSavings) {
|
|
36
|
+
return _compound();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function compoundNextBlock() public view returns (uint256 compoundedSavings) {
|
|
40
|
+
if (stats.savings == 0 || block.number == stats.lastUpdateBlock) {
|
|
41
|
+
return stats.savings;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//earned in timespan = (interestRatePerBlock^blocksPassed * savings - savings)/PRECISION
|
|
45
|
+
//earned perToken = earnedInTimeSpan*PRECISION/totalStaked
|
|
46
|
+
//PRECISION cancels out
|
|
47
|
+
int128 compounded = interestRatePerBlockX64.pow(
|
|
48
|
+
block.number + 1 - stats.lastUpdateBlock
|
|
49
|
+
);
|
|
50
|
+
compoundedSavings = compounded.mulu(stats.savings);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function withdraw(address _from, uint256 _shares)
|
|
54
|
+
public
|
|
55
|
+
returns (uint256 depositComponent, uint256 rewardComponent)
|
|
56
|
+
{
|
|
57
|
+
(depositComponent, rewardComponent) = _withdraw(_from, _shares);
|
|
58
|
+
_burn(_from, _shares);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function withdrawAndUndo(address _from, uint256 _shares)
|
|
62
|
+
public
|
|
63
|
+
returns (uint256 depositComponent, uint256 rewardComponent)
|
|
64
|
+
{
|
|
65
|
+
(depositComponent, rewardComponent) = withdraw(_from, _shares);
|
|
66
|
+
undoReward(_from, rewardComponent);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function stake(address _from, uint256 _amount) public {
|
|
70
|
+
uint256 shares = _stake(_from, _amount);
|
|
71
|
+
_mint(_from, shares);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function undoReward(address _to, uint256 _amount) public {
|
|
75
|
+
uint256 shares = _undoReward(_to, _amount);
|
|
76
|
+
_mint(_to, shares);
|
|
77
|
+
}
|
|
78
|
+
}
|