@gooddollar/goodprotocol 2.0.25-beta.9 → 2.0.26-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/abis/AdminWallet.min.json +1 -1
- package/artifacts/abis/CompoundVotingMachine.min.json +1 -1
- package/artifacts/abis/DistributionHelper.min.json +1 -1
- package/artifacts/abis/DistributionHelperTest.min.json +1 -1
- package/artifacts/abis/DistributionHelperTestHelper.min.json +1 -1
- package/artifacts/abis/EternalStorage.min.json +1 -0
- package/artifacts/abis/FuseOldBridgeKill.min.json +1 -0
- package/artifacts/abis/GoodFundManager.min.json +1 -1
- package/artifacts/abis/GoodFundManagerTest.min.json +1 -1
- package/artifacts/abis/GoodMarketMaker.min.json +1 -1
- package/artifacts/abis/GoodReserveCDai.min.json +1 -1
- package/artifacts/abis/IQuoterV2.min.json +1 -1
- package/artifacts/abis/ISwapRouter.min.json +1 -1
- package/artifacts/abis/IUpgradeabilityOwnerStorage.min.json +1 -0
- package/artifacts/abis/Initializable.min.json +1 -0
- package/artifacts/abis/Ownable.min.json +1 -0
- package/artifacts/abis/ReserveRestore.min.json +1 -0
- package/artifacts/abis/SuperfluidFaucet.min.json +1 -0
- package/artifacts/abis/Upgradeable.min.json +1 -0
- package/artifacts/contracts/DAOStackInterfaces.sol/Avatar.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/Controller.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/GlobalConstraintInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/IntVoteInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/ReputationInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/SchemeRegistrar.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/AggregatorV3Interface.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ERC20.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IAaveIncentivesController.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IAdminWallet.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IDonationStaking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IERC2917.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IFirstClaimPool.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IGoodDollar.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IGoodStaking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IHasRouter.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IIdentity.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IIdentityV2.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ILendingPool.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IMultichainRouter.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/INameService.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IQuoterV2.dbg.json +4 -0
- package/artifacts/contracts/{utils/BuyGDClone.sol → Interfaces.sol}/IQuoterV2.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ISwapRouter.dbg.json +4 -0
- package/artifacts/contracts/{utils/BuyGDClone.sol → Interfaces.sol}/ISwapRouter.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/fuseFaucet/FuseFaucetV2.sol/FuseFaucetV2.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/FuseFaucetV2.sol/FuseFaucetV2.json +2 -2
- package/artifacts/contracts/fuseFaucet/SuperfluidFacuet.sol/SuperfluidFaucet.dbg.json +4 -0
- package/artifacts/contracts/fuseFaucet/SuperfluidFacuet.sol/SuperfluidFaucet.json +536 -0
- 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 +20 -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/IStakingUpgrade.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.dbg.json +1 -1
- package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/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 +2 -2
- package/artifacts/contracts/invite/InvitesFuseV2.sol/InvitesFuseV2.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesFuseV2.sol/InvitesFuseV2.json +2 -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 +2 -2
- package/artifacts/contracts/invite/OneTimeReward.sol/OneTimeReward.dbg.json +1 -1
- package/artifacts/contracts/invite/OneTimeReward.sol/OneTimeReward.json +2 -2
- package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/AaveUSDMockOracle.sol/AaveUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/BatUSDMockOracle.sol/BatUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/CompUsdMockOracle.sol/CompUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DaiEthPriceMockOracle.sol/DaiEthPriceMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/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 +21 -2
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.json +21 -2
- package/artifacts/contracts/mocks/EthUSDMockOracle.sol/EthUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/FeesFormularMock.sol/FeesFormulaMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/GasPriceMockOracle.sol/GasPriceMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/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 +21 -2
- package/artifacts/contracts/mocks/IdentityMock.sol/IdentityMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/IdentityMock.sol/IdentityMock.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/PayableMock.sol/PayableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.dbg.json +1 -1
- package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/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 +21 -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 +6 -6
- 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 +3 -3
- 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 +21 -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 +1 -1
- package/artifacts/contracts/token/ERC677.sol/ERC677.dbg.json +1 -1
- package/artifacts/contracts/token/ERC677.sol/ERC677Receiver.dbg.json +1 -1
- package/artifacts/contracts/token/GoodDollar.sol/GoodDollar.dbg.json +1 -1
- package/artifacts/contracts/token/GoodDollar.sol/GoodDollar.json +2 -2
- package/artifacts/contracts/token/IFeesFormula.sol/IFeesFormula.dbg.json +1 -1
- package/artifacts/contracts/token/MultichainFeeFormula.sol/MultichainFeeFormula.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ERC20Permit.sol/ERC20Permit.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ERC20Permit.sol/SelfApprove.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/IGoodDollarCustom.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/ISuperGoodDollar.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ISuperToken.sol/ISuperToken.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.json +2 -2
- package/artifacts/contracts/token/superfluid/SuperToken.sol/SuperToken.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/SuperfluidToken.sol/SuperfluidToken.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/UUPSProxiable.sol/UUPSProxiable.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/UUPSProxy.sol/Proxy.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSProxy.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSUtils.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.json +2 -2
- package/artifacts/contracts/ubi/UBISchemeV2.sol/UBISchemeV2.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBISchemeV2.sol/UBISchemeV2.json +2 -2
- package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
- package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.json +2 -22
- package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.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/BulkWhitelist.sol/BulkWhitelist.dbg.json +1 -1
- package/artifacts/contracts/utils/BulkWhitelist.sol/BulkWhitelist.json +2 -2
- package/artifacts/contracts/utils/BuyAndBridgeHelper.sol/BuyAndBridgeHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyAndBridgeHelper.sol/BuyAndBridgeHelper.json +2 -2
- package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDClone.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDClone.json +2 -2
- package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDCloneFactory.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDCloneFactory.json +2 -2
- package/artifacts/contracts/utils/BuyGDClone.sol/DonateGDClone.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/DonateGDClone.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/FuseOldBridgeKill.sol/EternalStorage.dbg.json +4 -0
- package/artifacts/contracts/utils/FuseOldBridgeKill.sol/EternalStorage.json +10 -0
- package/artifacts/contracts/utils/FuseOldBridgeKill.sol/FuseOldBridgeKill.dbg.json +4 -0
- package/artifacts/contracts/utils/FuseOldBridgeKill.sol/FuseOldBridgeKill.json +31 -0
- package/artifacts/contracts/utils/FuseOldBridgeKill.sol/IUpgradeabilityOwnerStorage.dbg.json +4 -0
- package/artifacts/contracts/utils/FuseOldBridgeKill.sol/IUpgradeabilityOwnerStorage.json +24 -0
- package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Initializable.dbg.json +4 -0
- package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Initializable.json +24 -0
- package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Ownable.dbg.json +4 -0
- package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Ownable.json +56 -0
- package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Upgradeable.dbg.json +4 -0
- package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Upgradeable.json +10 -0
- package/artifacts/contracts/utils/GDFaucet.sol/GDFaucet.dbg.json +1 -1
- package/artifacts/contracts/utils/GDFaucet.sol/GDFaucet.json +2 -2
- 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/IdentityFix.sol/IdentityFix.dbg.json +1 -1
- package/artifacts/contracts/utils/IdentityFix.sol/IdentityFix.json +2 -2
- package/artifacts/contracts/utils/LastauthReduction.sol/LastauthReduction.dbg.json +1 -1
- package/artifacts/contracts/utils/LastauthReduction.sol/LastauthReduction.json +2 -2
- package/artifacts/contracts/utils/MultiCall.sol/Multicall.dbg.json +1 -1
- package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.json +2 -2
- package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
- package/artifacts/contracts/utils/OneTimePayments.sol/OneTimePayments.dbg.json +1 -1
- package/artifacts/contracts/utils/OneTimePayments.sol/OneTimePayments.json +2 -2
- package/artifacts/contracts/utils/OneTimePaymentsV2.sol/OneTimePaymentsV2.dbg.json +1 -1
- package/artifacts/contracts/utils/OneTimePaymentsV2.sol/OneTimePaymentsV2.json +2 -2
- 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/artifacts/contracts/utils/ReserveRestore.sol/ReserveRestore.dbg.json +4 -0
- package/artifacts/contracts/utils/ReserveRestore.sol/ReserveRestore.json +91 -0
- package/contracts/Interfaces.sol +122 -0
- package/contracts/fuseFaucet/SuperfluidFacuet.sol +129 -0
- package/contracts/governance/CompoundVotingMachine.sol +26 -11
- package/contracts/governance/StakersDistribution.sol +13 -13
- package/contracts/reserve/DistributionHelper.sol +29 -10
- package/contracts/reserve/ExchangeHelper.sol +16 -7
- package/contracts/reserve/GoodMarketMaker.sol +43 -53
- package/contracts/reserve/GoodReserveCDai.sol +44 -16
- package/contracts/staking/GoodFundManager.sol +44 -4
- package/contracts/utils/AdminWallet.sol +4 -6
- package/contracts/utils/BuyGDClone.sol +0 -122
- package/contracts/utils/FuseOldBridgeKill.sol +123 -0
- package/contracts/utils/ReserveRestore.sol +157 -0
- package/dist/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.json +2 -2
- package/dist/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.json +2 -2
- package/hardhat.config.ts +21 -39
- package/package.json +3 -3
- package/releases/deployment.json +6 -0
- package/scripts/multichain-deploy/0_proxyFactory-deploy.ts +20 -15
- package/scripts/multichain-deploy/7_superfluidfaucet-deploy.ts +95 -0
- package/scripts/multichain-deploy/helpers.ts +8 -8
- package/scripts/proposals/reserveRestore.ts +429 -0
- package/scripts/test/localOldDaoDeploy.ts +2 -1
- package/test/governance/CompoundVotingMachine.daoscheme.ts +3 -0
- package/test/governance/CompoundVotingMachine.guardian.test.ts +76 -21
- package/test/governance/CompoundVotingMachine.state.test.ts +31 -28
- package/test/governance/StakersDistribution.test.ts +79 -5
- package/test/helpers.ts +7 -0
- package/test/reserve/DistributionHelper.test.ts +10 -10
- package/test/reserve/GoodMarketMaker.test.ts +75 -26
- package/test/staking/StakingRewards.test.ts +106 -29
- package/test/utils/ProtocolUpgrade.test.ts +1 -0
- package/types/contracts/{utils/BuyGDClone.sol → Interfaces.sol}/IQuoterV2.ts +1 -1
- package/types/contracts/{utils/BuyGDClone.sol → Interfaces.sol}/ISwapRouter.ts +1 -1
- package/types/contracts/Interfaces.sol/index.ts +2 -0
- package/types/contracts/fuseFaucet/SuperfluidFacuet.sol/SuperfluidFaucet.ts +867 -0
- package/types/contracts/fuseFaucet/SuperfluidFacuet.sol/index.ts +4 -0
- package/types/contracts/fuseFaucet/index.ts +2 -0
- package/types/contracts/governance/CompoundVotingMachine.ts +44 -3
- package/types/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.ts +35 -0
- package/types/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.ts +35 -0
- package/types/contracts/mocks/GoodFundManagerTest.ts +35 -0
- package/types/contracts/reserve/DistributionHelper.ts +35 -0
- package/types/contracts/reserve/GoodMarketMaker.ts +3 -3
- package/types/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.ts +5 -5
- package/types/contracts/staking/GoodFundManager.ts +35 -0
- package/types/contracts/utils/AdminWallet.ts +0 -34
- package/types/contracts/utils/BuyGDClone.sol/index.ts +0 -2
- package/types/contracts/utils/FuseOldBridgeKill.sol/FuseOldBridgeKill.ts +108 -0
- package/types/contracts/utils/FuseOldBridgeKill.sol/IUpgradeabilityOwnerStorage.ts +89 -0
- package/types/contracts/utils/FuseOldBridgeKill.sol/Initializable.ts +87 -0
- package/types/contracts/utils/FuseOldBridgeKill.sol/Ownable.ts +148 -0
- package/types/contracts/utils/FuseOldBridgeKill.sol/index.ts +7 -0
- package/types/contracts/utils/ReserveRestore.ts +201 -0
- package/types/contracts/utils/index.ts +3 -0
- package/types/factories/contracts/{utils/BuyGDClone.sol → Interfaces.sol}/IQuoterV2__factory.ts +1 -1
- package/types/factories/contracts/{utils/BuyGDClone.sol → Interfaces.sol}/ISwapRouter__factory.ts +1 -1
- package/types/factories/contracts/Interfaces.sol/index.ts +2 -0
- package/types/factories/contracts/fuseFaucet/Faucet__factory.ts +1 -1
- package/types/factories/contracts/fuseFaucet/FuseFaucetV2__factory.ts +1 -1
- package/types/factories/contracts/fuseFaucet/FuseFaucet__factory.ts +1 -1
- package/types/factories/contracts/fuseFaucet/SuperfluidFacuet.sol/SuperfluidFaucet__factory.ts +587 -0
- package/types/factories/contracts/fuseFaucet/SuperfluidFacuet.sol/index.ts +4 -0
- package/types/factories/contracts/fuseFaucet/index.ts +1 -0
- package/types/factories/contracts/governance/ClaimersDistribution__factory.ts +1 -1
- package/types/factories/contracts/governance/CompoundVotingMachine__factory.ts +19 -1
- package/types/factories/contracts/governance/GReputation__factory.ts +1 -1
- package/types/factories/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking__factory.ts +1 -1
- package/types/factories/contracts/governance/GovernanceStaking__factory.ts +1 -1
- package/types/factories/contracts/governance/Reputation__factory.ts +1 -1
- package/types/factories/contracts/governance/StakersDistribution__factory.ts +1 -1
- package/types/factories/contracts/identity/IdentityV2__factory.ts +1 -1
- package/types/factories/contracts/invite/InvitesFuseV2__factory.ts +1 -1
- package/types/factories/contracts/invite/InvitesV1__factory.ts +1 -1
- package/types/factories/contracts/invite/InvitesV2__factory.ts +1 -1
- package/types/factories/contracts/invite/OneTimeReward__factory.ts +1 -1
- package/types/factories/contracts/mocks/DistributionBridgeMock__factory.ts +1 -1
- package/types/factories/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper__factory.ts +20 -1
- package/types/factories/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest__factory.ts +20 -1
- package/types/factories/contracts/mocks/GoodCompoundStakingTest__factory.ts +1 -1
- package/types/factories/contracts/mocks/GoodDollarStakingMock__factory.ts +1 -1
- package/types/factories/contracts/mocks/GoodFundManagerTest__factory.ts +20 -1
- package/types/factories/contracts/mocks/IdentityMock__factory.ts +1 -1
- package/types/factories/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock__factory.ts +1 -1
- package/types/factories/contracts/mocks/OverMintTester.sol/OverMintTester__factory.ts +1 -1
- package/types/factories/contracts/mocks/OverMintTesterRegularStake__factory.ts +1 -1
- package/types/factories/contracts/mocks/SwapHelperTest__factory.ts +1 -1
- package/types/factories/contracts/mocks/UpgradableMocks.sol/UpgradableMock2__factory.ts +1 -1
- package/types/factories/contracts/mocks/UpgradableMocks.sol/UpgradableMock3__factory.ts +1 -1
- package/types/factories/contracts/mocks/UpgradableMocks.sol/UpgradableMock4__factory.ts +1 -1
- package/types/factories/contracts/mocks/UpgradableMocks.sol/UpgradableMock__factory.ts +1 -1
- package/types/factories/contracts/reserve/DistributionHelper__factory.ts +20 -1
- package/types/factories/contracts/reserve/ExchangeHelper__factory.ts +1 -1
- package/types/factories/contracts/reserve/GoodMarketMaker__factory.ts +5 -5
- package/types/factories/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai__factory.ts +2 -2
- package/types/factories/contracts/staking/BaseShareFieldV2__factory.ts +1 -1
- package/types/factories/contracts/staking/BaseShareField__factory.ts +1 -1
- package/types/factories/contracts/staking/DonationsStaking__factory.ts +1 -1
- package/types/factories/contracts/staking/FuseStakingV3.sol/FuseStakingV3__factory.ts +1 -1
- package/types/factories/contracts/staking/GoodFundManager__factory.ts +20 -1
- package/types/factories/contracts/staking/UniswapV2SwapHelper__factory.ts +1 -1
- package/types/factories/contracts/staking/aave/AaveStakingFactory__factory.ts +1 -1
- package/types/factories/contracts/staking/aave/GoodAaveStakingV2__factory.ts +1 -1
- package/types/factories/contracts/staking/aave/GoodAaveStaking__factory.ts +1 -1
- package/types/factories/contracts/staking/compound/CompoundStakingFactory__factory.ts +1 -1
- package/types/factories/contracts/staking/compound/GoodCompoundStakingV2__factory.ts +1 -1
- package/types/factories/contracts/staking/compound/GoodCompoundStaking__factory.ts +1 -1
- package/types/factories/contracts/token/GoodDollar__factory.ts +1 -1
- package/types/factories/contracts/token/superfluid/SuperGoodDollar__factory.ts +1 -1
- package/types/factories/contracts/ubi/UBISchemeV2__factory.ts +1 -1
- package/types/factories/contracts/ubi/UBIScheme__factory.ts +1 -1
- package/types/factories/contracts/utils/AdminWalletFuse__factory.ts +1 -1
- package/types/factories/contracts/utils/AdminWallet__factory.ts +1 -21
- package/types/factories/contracts/utils/BulkWhitelist__factory.ts +1 -1
- package/types/factories/contracts/utils/BuyAndBridgeHelper__factory.ts +1 -1
- package/types/factories/contracts/utils/BuyGDClone.sol/BuyGDCloneFactory__factory.ts +1 -1
- package/types/factories/contracts/utils/BuyGDClone.sol/BuyGDClone__factory.ts +1 -1
- package/types/factories/contracts/utils/BuyGDClone.sol/DonateGDClone__factory.ts +1 -1
- package/types/factories/contracts/utils/BuyGDClone.sol/index.ts +0 -2
- package/types/factories/contracts/utils/DAOContract__factory.ts +1 -1
- package/types/factories/contracts/utils/DAOUpgradeableContract__factory.ts +1 -1
- package/types/factories/contracts/utils/FuseOldBridgeKill.sol/FuseOldBridgeKill__factory.ts +82 -0
- package/types/factories/contracts/utils/FuseOldBridgeKill.sol/IUpgradeabilityOwnerStorage__factory.ts +43 -0
- package/types/factories/contracts/utils/FuseOldBridgeKill.sol/Initializable__factory.ts +75 -0
- package/types/factories/contracts/utils/FuseOldBridgeKill.sol/Ownable__factory.ts +105 -0
- package/types/factories/contracts/utils/FuseOldBridgeKill.sol/index.ts +7 -0
- package/types/factories/contracts/utils/GDFaucet__factory.ts +1 -1
- package/types/factories/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper__factory.ts +1 -1
- package/types/factories/contracts/utils/IdentityFix__factory.ts +1 -1
- package/types/factories/contracts/utils/LastauthReduction__factory.ts +1 -1
- package/types/factories/contracts/utils/MultichainBridgeHelper__factory.ts +1 -1
- package/types/factories/contracts/utils/OneTimePaymentsV2__factory.ts +1 -1
- package/types/factories/contracts/utils/OneTimePayments__factory.ts +1 -1
- package/types/factories/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade__factory.ts +1 -1
- package/types/factories/contracts/utils/ProtocolUpgradeFuseRecover__factory.ts +1 -1
- package/types/factories/contracts/utils/ProtocolUpgradeFuse__factory.ts +1 -1
- package/types/factories/contracts/utils/ProtocolUpgradeRecover__factory.ts +1 -1
- package/types/factories/contracts/utils/ReputationTestHelper__factory.ts +1 -1
- package/types/factories/contracts/utils/ReserveRestore__factory.ts +144 -0
- package/types/factories/contracts/utils/index.ts +2 -0
- package/types/hardhat.d.ts +70 -16
- package/types/index.ts +12 -4
- package/artifacts/contracts/utils/BuyGDClone.sol/IQuoterV2.dbg.json +0 -4
- package/artifacts/contracts/utils/BuyGDClone.sol/ISwapRouter.dbg.json +0 -4
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.0;
|
|
3
|
+
|
|
4
|
+
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
5
|
+
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
|
|
6
|
+
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
|
|
7
|
+
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* to be deployed on base to support superfluid airdrop to G$ users
|
|
11
|
+
*/
|
|
12
|
+
contract SuperfluidFaucet is
|
|
13
|
+
Initializable,
|
|
14
|
+
UUPSUpgradeable,
|
|
15
|
+
AccessControlUpgradeable
|
|
16
|
+
{
|
|
17
|
+
using SafeMathUpgradeable for uint256;
|
|
18
|
+
|
|
19
|
+
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
|
|
20
|
+
|
|
21
|
+
uint256 public toppingAmount;
|
|
22
|
+
uint256 public maxAmountPerPeriod;
|
|
23
|
+
uint256 public toppingPeriod;
|
|
24
|
+
|
|
25
|
+
struct RecipientInfo {
|
|
26
|
+
uint256 lastWithdrawalPeriod;
|
|
27
|
+
uint256 totalWithdrawnThisPeriod;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
mapping(address => RecipientInfo) public recipientInfo;
|
|
31
|
+
|
|
32
|
+
event WalletTopped(address recipient, uint256 amount);
|
|
33
|
+
event SettingsUpdated(
|
|
34
|
+
uint256 toppingAmount,
|
|
35
|
+
uint256 maxAmountPerPeriod,
|
|
36
|
+
uint256 toppingPeriod
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
/// @custom:oz-upgrades-unsafe-allow constructor
|
|
40
|
+
constructor() {
|
|
41
|
+
_disableInitializers();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function initialize(
|
|
45
|
+
uint256 _toppingAmount,
|
|
46
|
+
uint256 _maxAmountPerPeriod,
|
|
47
|
+
uint256 _toppingPeriod,
|
|
48
|
+
address _admin
|
|
49
|
+
) public initializer {
|
|
50
|
+
__AccessControl_init();
|
|
51
|
+
__UUPSUpgradeable_init();
|
|
52
|
+
|
|
53
|
+
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
|
|
54
|
+
_setupRole(ADMIN_ROLE, msg.sender);
|
|
55
|
+
_grantRole(ADMIN_ROLE, _admin);
|
|
56
|
+
toppingAmount = _toppingAmount;
|
|
57
|
+
maxAmountPerPeriod = _maxAmountPerPeriod;
|
|
58
|
+
toppingPeriod = _toppingPeriod;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function updateSettings(
|
|
62
|
+
uint256 _toppingAmount,
|
|
63
|
+
uint256 _maxAmountPerPeriod,
|
|
64
|
+
uint256 _toppingPeriod
|
|
65
|
+
) external onlyRole(ADMIN_ROLE) {
|
|
66
|
+
toppingAmount = _toppingAmount;
|
|
67
|
+
maxAmountPerPeriod = _maxAmountPerPeriod;
|
|
68
|
+
toppingPeriod = _toppingPeriod;
|
|
69
|
+
emit SettingsUpdated(_toppingAmount, _maxAmountPerPeriod, _toppingPeriod);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function canTop(address recipient) public view returns (bool) {
|
|
73
|
+
if (recipient == address(0)) return false;
|
|
74
|
+
if (recipient.balance >= toppingAmount / 2) return false;
|
|
75
|
+
|
|
76
|
+
uint256 amountToSend = toppingAmount.sub(recipient.balance);
|
|
77
|
+
if (address(this).balance < amountToSend) return false;
|
|
78
|
+
|
|
79
|
+
uint256 currentPeriod = block.timestamp / toppingPeriod;
|
|
80
|
+
RecipientInfo storage info = recipientInfo[recipient];
|
|
81
|
+
|
|
82
|
+
if (currentPeriod > info.lastWithdrawalPeriod) {
|
|
83
|
+
return true; // New period, reset counters
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (info.totalWithdrawnThisPeriod.add(amountToSend) > maxAmountPerPeriod)
|
|
87
|
+
return false;
|
|
88
|
+
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function topWallet(address payable recipient) external onlyRole(ADMIN_ROLE) {
|
|
93
|
+
require(canTop(recipient), "Recipient cannot be topped up");
|
|
94
|
+
|
|
95
|
+
uint256 currentPeriod = block.timestamp / toppingPeriod;
|
|
96
|
+
RecipientInfo storage info = recipientInfo[recipient];
|
|
97
|
+
|
|
98
|
+
if (currentPeriod > info.lastWithdrawalPeriod) {
|
|
99
|
+
info.totalWithdrawnThisPeriod = 0;
|
|
100
|
+
info.lastWithdrawalPeriod = currentPeriod;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
uint256 amountToSend = toppingAmount.sub(recipient.balance);
|
|
104
|
+
require(
|
|
105
|
+
address(this).balance >= amountToSend,
|
|
106
|
+
"Insufficient contract balance for topping up"
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
info.totalWithdrawnThisPeriod = info.totalWithdrawnThisPeriod.add(
|
|
110
|
+
amountToSend
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
(bool success, ) = recipient.call{ value: amountToSend }("");
|
|
114
|
+
require(success, "Failed to send Ether");
|
|
115
|
+
|
|
116
|
+
emit WalletTopped(recipient, amountToSend);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
receive() external payable {}
|
|
120
|
+
|
|
121
|
+
function withdraw() external onlyRole(DEFAULT_ADMIN_ROLE) {
|
|
122
|
+
uint256 balance = address(this).balance;
|
|
123
|
+
payable(msg.sender).transfer(balance);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function _authorizeUpgrade(
|
|
127
|
+
address newImplementation
|
|
128
|
+
) internal override onlyRole(DEFAULT_ADMIN_ROLE) {}
|
|
129
|
+
}
|
|
@@ -33,11 +33,9 @@ contract CompoundVotingMachine is ContextUpgradeable, DAOUpgradeableContract {
|
|
|
33
33
|
/// @notice The number of votes required in order for a voter to become a proposer
|
|
34
34
|
uint256 public proposalPercentage;
|
|
35
35
|
|
|
36
|
-
function proposalThreshold(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
returns (uint256)
|
|
40
|
-
{
|
|
36
|
+
function proposalThreshold(
|
|
37
|
+
uint256 blockNumber
|
|
38
|
+
) public view returns (uint256) {
|
|
41
39
|
return (rep.totalSupplyAt(blockNumber) * proposalPercentage) / 1000000; //0.25%
|
|
42
40
|
}
|
|
43
41
|
|
|
@@ -102,6 +100,8 @@ contract CompoundVotingMachine is ContextUpgradeable, DAOUpgradeableContract {
|
|
|
102
100
|
uint256 quoromRequired;
|
|
103
101
|
// support proposal voting bridge
|
|
104
102
|
uint256 forBlockchain;
|
|
103
|
+
// flag to mark proposal was approved as not malicious by guardians
|
|
104
|
+
bool guardianApproved;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
/// @notice Ballot receipt record for a voter
|
|
@@ -426,6 +426,11 @@ contract CompoundVotingMachine is ContextUpgradeable, DAOUpgradeableContract {
|
|
|
426
426
|
"CompoundVotingMachine::execute: proposal for wrong blockchain"
|
|
427
427
|
);
|
|
428
428
|
|
|
429
|
+
require(
|
|
430
|
+
address(guardian) == address(0) || proposals[proposalId].guardianApproved,
|
|
431
|
+
"CompoundVotingMachine: proposal not approved"
|
|
432
|
+
);
|
|
433
|
+
|
|
429
434
|
proposals[proposalId].executed = true;
|
|
430
435
|
address[] memory _targets = proposals[proposalId].targets;
|
|
431
436
|
uint256[] memory _values = proposals[proposalId].values;
|
|
@@ -501,7 +506,9 @@ contract CompoundVotingMachine is ContextUpgradeable, DAOUpgradeableContract {
|
|
|
501
506
|
}
|
|
502
507
|
|
|
503
508
|
/// @notice get the actions to be done in a proposal
|
|
504
|
-
function getActions(
|
|
509
|
+
function getActions(
|
|
510
|
+
uint256 proposalId
|
|
511
|
+
)
|
|
505
512
|
public
|
|
506
513
|
view
|
|
507
514
|
returns (
|
|
@@ -516,11 +523,10 @@ contract CompoundVotingMachine is ContextUpgradeable, DAOUpgradeableContract {
|
|
|
516
523
|
}
|
|
517
524
|
|
|
518
525
|
/// @notice get the receipt of a single voter in a proposal
|
|
519
|
-
function getReceipt(
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
{
|
|
526
|
+
function getReceipt(
|
|
527
|
+
uint256 proposalId,
|
|
528
|
+
address voter
|
|
529
|
+
) public view returns (Receipt memory) {
|
|
524
530
|
return proposals[proposalId].receipts[voter];
|
|
525
531
|
}
|
|
526
532
|
|
|
@@ -770,6 +776,15 @@ contract CompoundVotingMachine is ContextUpgradeable, DAOUpgradeableContract {
|
|
|
770
776
|
emit GuardianSet(guardian);
|
|
771
777
|
}
|
|
772
778
|
|
|
779
|
+
function approveProposal(uint256 _proposalId) public {
|
|
780
|
+
require(
|
|
781
|
+
_msgSender() == address(avatar) || _msgSender() == guardian,
|
|
782
|
+
"CompoundVotingMachine: not avatar or guardian"
|
|
783
|
+
);
|
|
784
|
+
|
|
785
|
+
proposals[_proposalId].guardianApproved = true;
|
|
786
|
+
}
|
|
787
|
+
|
|
773
788
|
/// @notice allow anyone to emit details about proposal that passed. can be used for cross-chain proposals using blockheader proofs
|
|
774
789
|
function emitSucceeded(uint256 _proposalId) public {
|
|
775
790
|
require(
|
|
@@ -52,6 +52,7 @@ contract StakersDistribution is
|
|
|
52
52
|
) external {
|
|
53
53
|
_onlyAvatar();
|
|
54
54
|
monthlyReputationDistribution = newMonthlyReputationDistribution;
|
|
55
|
+
_updateRewards();
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
/**
|
|
@@ -174,9 +175,10 @@ contract StakersDistribution is
|
|
|
174
175
|
_claimReputation(_staker, _stakingContracts);
|
|
175
176
|
}
|
|
176
177
|
|
|
177
|
-
function _claimReputation(
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
function _claimReputation(
|
|
179
|
+
address _staker,
|
|
180
|
+
address[] memory _stakingContracts
|
|
181
|
+
) internal {
|
|
180
182
|
uint256 totalRep;
|
|
181
183
|
GoodFundManager gfm = GoodFundManager(
|
|
182
184
|
nameService.getAddress("FUND_MANAGER")
|
|
@@ -206,11 +208,10 @@ contract StakersDistribution is
|
|
|
206
208
|
* @param _user the user to check rewards for
|
|
207
209
|
* @return reputation rewards pending for user
|
|
208
210
|
*/
|
|
209
|
-
function getUserPendingRewards(
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
{
|
|
211
|
+
function getUserPendingRewards(
|
|
212
|
+
address[] memory _contracts,
|
|
213
|
+
address _user
|
|
214
|
+
) public view returns (uint256) {
|
|
214
215
|
uint256 pending;
|
|
215
216
|
for (uint256 i = 0; i < _contracts.length; i++) {
|
|
216
217
|
(
|
|
@@ -239,11 +240,10 @@ contract StakersDistribution is
|
|
|
239
240
|
* @param _user account to get rewards status for
|
|
240
241
|
* @return (minted, pending) in GDAO 18 decimals
|
|
241
242
|
*/
|
|
242
|
-
function getUserMintedAndPending(
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
{
|
|
243
|
+
function getUserMintedAndPending(
|
|
244
|
+
address[] memory _contracts,
|
|
245
|
+
address _user
|
|
246
|
+
) public view returns (uint256, uint256) {
|
|
247
247
|
uint256 pending = getUserPendingRewards(_contracts, _user);
|
|
248
248
|
uint256 minted;
|
|
249
249
|
for (uint256 i = 0; i < _contracts.length; i++) {
|
|
@@ -44,7 +44,7 @@ contract DistributionHelper is
|
|
|
44
44
|
0x467719aD09025FcC6cF6F8311755809d45a5E5f3;
|
|
45
45
|
|
|
46
46
|
enum TransferType {
|
|
47
|
-
|
|
47
|
+
DEPRECATED_FuseBridge,
|
|
48
48
|
LayerZeroBridge,
|
|
49
49
|
AxelarBridge,
|
|
50
50
|
Contract
|
|
@@ -182,10 +182,11 @@ contract DistributionHelper is
|
|
|
182
182
|
if (toDistribute == 0) return;
|
|
183
183
|
|
|
184
184
|
if (address(this).balance < feeSettings.minBalanceForFees) {
|
|
185
|
-
uint256
|
|
185
|
+
uint256 gdToSellForFee = (toDistribute *
|
|
186
186
|
feeSettings.percentageToSellForFee) / 100;
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
gdToSellForFee = calcGDToSell(gdToSellForFee);
|
|
188
|
+
toDistribute -= gdToSellForFee;
|
|
189
|
+
buyNativeWithGD(gdToSellForFee);
|
|
189
190
|
}
|
|
190
191
|
|
|
191
192
|
uint256 totalDistributed;
|
|
@@ -234,12 +235,8 @@ contract DistributionHelper is
|
|
|
234
235
|
DistributionRecipient storage _recipient,
|
|
235
236
|
uint256 _amount
|
|
236
237
|
) internal {
|
|
237
|
-
if (_recipient.transferType == TransferType.
|
|
238
|
-
|
|
239
|
-
fuseBridge,
|
|
240
|
-
_amount,
|
|
241
|
-
abi.encodePacked(_recipient.addr)
|
|
242
|
-
);
|
|
238
|
+
if (_recipient.transferType == TransferType.DEPRECATED_FuseBridge) {
|
|
239
|
+
revert("DEPRECATED");
|
|
243
240
|
} else if (_recipient.transferType == TransferType.LayerZeroBridge) {
|
|
244
241
|
nativeToken().approve(address(mpbBridge), _amount);
|
|
245
242
|
(uint256 lzFee, ) = ILayerZeroFeeEstimator(address(mpbBridge))
|
|
@@ -276,6 +273,28 @@ contract DistributionHelper is
|
|
|
276
273
|
}
|
|
277
274
|
}
|
|
278
275
|
|
|
276
|
+
function calcGDToSell(
|
|
277
|
+
uint256 maxAmountToSell
|
|
278
|
+
) public view returns (uint256 gdToSell) {
|
|
279
|
+
uint24[] memory fees = new uint24[](1);
|
|
280
|
+
fees[0] = 500;
|
|
281
|
+
|
|
282
|
+
uint256 ethToBuy = feeSettings.minBalanceForFees * 3;
|
|
283
|
+
(uint256 ethValueInUSDC, ) = STATIC_ORACLE
|
|
284
|
+
.quoteSpecificFeeTiersWithTimePeriod(
|
|
285
|
+
uint128(ethToBuy),
|
|
286
|
+
WETH_TOKEN,
|
|
287
|
+
USDC_TOKEN,
|
|
288
|
+
fees,
|
|
289
|
+
60 //last 1 minute
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
uint256 gdPriceInDai = GoodReserveCDai(nameService.getAddress("RESERVE"))
|
|
293
|
+
.currentPriceDAI();
|
|
294
|
+
gdToSell = (ethValueInUSDC * 1e12 * 100) / gdPriceInDai; //* 1e12 to increase usdc to 18 decimals, mul by 100 so result is in 2 G$ 2 decimals
|
|
295
|
+
gdToSell = gdToSell > maxAmountToSell ? maxAmountToSell : gdToSell;
|
|
296
|
+
}
|
|
297
|
+
|
|
279
298
|
function buyNativeWithGD(uint256 amountToSell) internal {
|
|
280
299
|
address[] memory path = new address[](2);
|
|
281
300
|
path[0] = nameService.getAddress("DAI");
|
|
@@ -5,6 +5,8 @@ import "../utils/DAOUpgradeableContract.sol";
|
|
|
5
5
|
import "../utils/NameService.sol";
|
|
6
6
|
import "./GoodReserveCDai.sol";
|
|
7
7
|
|
|
8
|
+
// import "hardhat/console.sol";
|
|
9
|
+
|
|
8
10
|
contract ExchangeHelper is DAOUpgradeableContract {
|
|
9
11
|
uint256 private _status;
|
|
10
12
|
|
|
@@ -78,6 +80,14 @@ contract ExchangeHelper is DAOUpgradeableContract {
|
|
|
78
80
|
cDaiAddress = nameService.getAddress("CDAI");
|
|
79
81
|
// Approve transfer to cDAI contract
|
|
80
82
|
ERC20(daiAddress).approve(cDaiAddress, type(uint256).max);
|
|
83
|
+
address reserve = nameService.getAddress("RESERVE");
|
|
84
|
+
if (reserve != address(0)) {
|
|
85
|
+
ERC20(nameService.getAddress("GOODDOLLAR")).approve(
|
|
86
|
+
reserve,
|
|
87
|
+
type(uint256).max
|
|
88
|
+
);
|
|
89
|
+
ERC20(cDaiAddress).approve(reserve, type(uint256).max);
|
|
90
|
+
}
|
|
81
91
|
ERC20(daiAddress).approve(
|
|
82
92
|
nameService.getAddress("UNISWAP_ROUTER"),
|
|
83
93
|
type(uint256).max
|
|
@@ -121,11 +131,9 @@ contract ExchangeHelper is DAOUpgradeableContract {
|
|
|
121
131
|
require(
|
|
122
132
|
ERC20(_buyPath[0]).transferFrom(
|
|
123
133
|
msg.sender,
|
|
124
|
-
address(
|
|
125
|
-
? address(reserve)
|
|
126
|
-
: address(this),
|
|
134
|
+
address(this),
|
|
127
135
|
_tokenAmount
|
|
128
|
-
)
|
|
136
|
+
),
|
|
129
137
|
"transferFrom failed, make sure you approved input token transfer"
|
|
130
138
|
);
|
|
131
139
|
}
|
|
@@ -191,8 +199,9 @@ contract ExchangeHelper is DAOUpgradeableContract {
|
|
|
191
199
|
GoodReserveCDai reserve = GoodReserveCDai(
|
|
192
200
|
nameService.getAddress("RESERVE")
|
|
193
201
|
);
|
|
194
|
-
|
|
202
|
+
ERC20(nameService.getAddress("GOODDOLLAR")).transferFrom(
|
|
195
203
|
msg.sender,
|
|
204
|
+
address(this),
|
|
196
205
|
_gdAmount
|
|
197
206
|
);
|
|
198
207
|
|
|
@@ -290,7 +299,6 @@ contract ExchangeHelper is DAOUpgradeableContract {
|
|
|
290
299
|
require(cDaiResult == 0, "Minting cDai failed");
|
|
291
300
|
|
|
292
301
|
uint256 cDaiInput = cDai.balanceOf(address(this)) - currCDaiBalance;
|
|
293
|
-
cDai.transfer(address(reserve), cDaiInput);
|
|
294
302
|
return reserve.buy(cDaiInput, _minReturn, _targetAddress);
|
|
295
303
|
}
|
|
296
304
|
|
|
@@ -333,8 +341,9 @@ contract ExchangeHelper is DAOUpgradeableContract {
|
|
|
333
341
|
);
|
|
334
342
|
return swap;
|
|
335
343
|
} else {
|
|
336
|
-
if (isBuy)
|
|
344
|
+
if (isBuy) {
|
|
337
345
|
ERC20(_inputPath[0]).approve(address(uniswapContract), _tokenAmount);
|
|
346
|
+
}
|
|
338
347
|
swap = uniswapContract.swapExactTokensForTokens(
|
|
339
348
|
_tokenAmount,
|
|
340
349
|
isBuy ? _minDAIAmount : _minTokenReturn,
|
|
@@ -8,6 +8,8 @@ import "../DAOStackInterfaces.sol";
|
|
|
8
8
|
import "../Interfaces.sol";
|
|
9
9
|
import "../utils/DAOUpgradeableContract.sol";
|
|
10
10
|
|
|
11
|
+
// import "hardhat/console.sol";
|
|
12
|
+
|
|
11
13
|
/**
|
|
12
14
|
@title Dynamic reserve ratio market maker
|
|
13
15
|
*/
|
|
@@ -187,11 +189,10 @@ contract GoodMarketMaker is DAOUpgradeableContract, DSMath {
|
|
|
187
189
|
* @param _tokenAmount The amount of reserve token buying with
|
|
188
190
|
* @return Number of GD that should be given in exchange as calculated by the bonding curve
|
|
189
191
|
*/
|
|
190
|
-
function buyReturn(
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
{
|
|
192
|
+
function buyReturn(
|
|
193
|
+
ERC20 _token,
|
|
194
|
+
uint256 _tokenAmount
|
|
195
|
+
) public view returns (uint256) {
|
|
195
196
|
ReserveToken memory rtoken = reserveTokens[address(_token)];
|
|
196
197
|
return
|
|
197
198
|
getBancor().calculatePurchaseReturn(
|
|
@@ -208,11 +209,10 @@ contract GoodMarketMaker is DAOUpgradeableContract, DSMath {
|
|
|
208
209
|
* @param _gdAmount The amount of GD that are sold
|
|
209
210
|
* @return Number of tokens that should be given in exchange as calculated by the bonding curve
|
|
210
211
|
*/
|
|
211
|
-
function sellReturn(
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
{
|
|
212
|
+
function sellReturn(
|
|
213
|
+
ERC20 _token,
|
|
214
|
+
uint256 _gdAmount
|
|
215
|
+
) public view returns (uint256) {
|
|
216
216
|
ReserveToken memory rtoken = reserveTokens[address(_token)];
|
|
217
217
|
return
|
|
218
218
|
getBancor().calculateSaleReturn(
|
|
@@ -264,7 +264,8 @@ contract GoodMarketMaker is DAOUpgradeableContract, DSMath {
|
|
|
264
264
|
rtoken.gdSupply += _gdAmount;
|
|
265
265
|
rtoken.reserveRatio = uint32(
|
|
266
266
|
((rtoken.reserveSupply * 1e27) /
|
|
267
|
-
(rtoken.gdSupply * priceBeforeGdSupplyChange)) /
|
|
267
|
+
(rtoken.gdSupply * priceBeforeGdSupplyChange)) /
|
|
268
|
+
10 ** reserveDecimalsDiff
|
|
268
269
|
); // Divide it decimal diff to bring it proper decimal
|
|
269
270
|
}
|
|
270
271
|
|
|
@@ -317,55 +318,46 @@ contract GoodMarketMaker is DAOUpgradeableContract, DSMath {
|
|
|
317
318
|
* @param _token The desired reserve token to have
|
|
318
319
|
* @return price of GD
|
|
319
320
|
*/
|
|
320
|
-
function currentPrice(ERC20 _token) public view returns (uint256) {
|
|
321
|
+
function currentPrice(ERC20 _token) public view returns (uint256 price) {
|
|
321
322
|
ReserveToken memory rtoken = reserveTokens[address(_token)];
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
rtoken.reserveSupply,
|
|
326
|
-
rtoken.reserveRatio,
|
|
327
|
-
(10**decimals)
|
|
328
|
-
);
|
|
323
|
+
price =
|
|
324
|
+
(rtoken.reserveSupply * 1e8) /
|
|
325
|
+
(rtoken.gdSupply * rtoken.reserveRatio); // gd precision 1e2 + reserveRatio precision 1e6 = multiply by 1e8 not to lose precision
|
|
329
326
|
}
|
|
330
327
|
|
|
331
|
-
//TODO: need real calculation and tests
|
|
332
328
|
/**
|
|
333
329
|
* @dev Calculates how much G$ to mint based on added token supply (from interest)
|
|
334
330
|
* and on current reserve ratio, in order to keep G$ price the same at the bonding curve
|
|
335
|
-
* formula to calculate the gd to mint:
|
|
336
|
-
* addreservebalance * (gdsupply / (reservebalance * reserveratio))
|
|
331
|
+
* formula to calculate the gd to mint: amountToMint = reserveInterest * tokenSupply / reserveBalance
|
|
337
332
|
* @param _token the reserve token
|
|
338
333
|
* @param _addTokenSupply amount of token added to supply
|
|
339
|
-
* @return how much to mint in order to keep price in bonding curve the same
|
|
334
|
+
* @return toMint how much to mint in order to keep price in bonding curve the same
|
|
340
335
|
*/
|
|
341
|
-
function calculateMintInterest(
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
//we divide by decimalsdiff to get precision in GD (2 decimals)
|
|
349
|
-
return
|
|
350
|
-
((_addTokenSupply * 1e27) / currentPrice(_token)) / (10**decimalsDiff);
|
|
336
|
+
function calculateMintInterest(
|
|
337
|
+
ERC20 _token,
|
|
338
|
+
uint256 _addTokenSupply
|
|
339
|
+
) public view returns (uint256 toMint) {
|
|
340
|
+
ReserveToken memory rtoken = reserveTokens[address(_token)];
|
|
341
|
+
|
|
342
|
+
toMint = (_addTokenSupply * rtoken.gdSupply) / rtoken.reserveSupply;
|
|
351
343
|
}
|
|
352
344
|
|
|
353
345
|
/**
|
|
354
346
|
* @dev Updates bonding curve based on _addTokenSupply and new minted amount
|
|
355
347
|
* @param _token The reserve token
|
|
356
348
|
* @param _addTokenSupply Amount of token added to supply
|
|
357
|
-
* @return How much to mint in order to keep price in bonding curve the same
|
|
349
|
+
* @return toMint How much to mint in order to keep price in bonding curve the same
|
|
358
350
|
*/
|
|
359
|
-
function mintInterest(
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
{
|
|
351
|
+
function mintInterest(
|
|
352
|
+
ERC20 _token,
|
|
353
|
+
uint256 _addTokenSupply
|
|
354
|
+
) public returns (uint256 toMint) {
|
|
363
355
|
_onlyReserveOrAvatar();
|
|
364
356
|
_onlyActiveToken(_token);
|
|
365
357
|
if (_addTokenSupply == 0) {
|
|
366
358
|
return 0;
|
|
367
359
|
}
|
|
368
|
-
|
|
360
|
+
toMint = calculateMintInterest(_token, _addTokenSupply);
|
|
369
361
|
ReserveToken storage reserveToken = reserveTokens[address(_token)];
|
|
370
362
|
reserveToken.gdSupply += toMint;
|
|
371
363
|
reserveToken.reserveSupply += _addTokenSupply;
|
|
@@ -376,24 +368,22 @@ contract GoodMarketMaker is DAOUpgradeableContract, DSMath {
|
|
|
376
368
|
/**
|
|
377
369
|
* @dev Calculate how much G$ to mint based on expansion change (new reserve
|
|
378
370
|
* ratio), in order to keep G$ price the same at the bonding curve. the
|
|
379
|
-
* formula to calculate the gd to mint:
|
|
380
|
-
*
|
|
371
|
+
* formula to calculate the gd to mint:
|
|
372
|
+
* amountToMint = (tokenSupply * reserveRatio - tokenSupply * newRatio) / newRatio
|
|
381
373
|
* @param _token The reserve token
|
|
382
|
-
* @return How much to mint in order to keep price in bonding curve the same
|
|
374
|
+
* @return toMint How much to mint in order to keep price in bonding curve the same
|
|
383
375
|
*/
|
|
384
|
-
function calculateMintExpansion(
|
|
376
|
+
function calculateMintExpansion(
|
|
377
|
+
ERC20 _token
|
|
378
|
+
) public view returns (uint256 toMint) {
|
|
385
379
|
ReserveToken memory reserveToken = reserveTokens[address(_token)];
|
|
386
380
|
uint32 newReserveRatio = calculateNewReserveRatio(_token); // new reserve ratio
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
uint256 toMint = ((reserveToken.reserveSupply *
|
|
394
|
-
(10**reserveDecimalsDiff) *
|
|
395
|
-
1e27) / denom) / (10**gdDecimalsDiff); // reservebalance in RAY precision // return to gd precision
|
|
396
|
-
return toMint - reserveToken.gdSupply;
|
|
381
|
+
toMint =
|
|
382
|
+
(reserveToken.gdSupply *
|
|
383
|
+
reserveToken.reserveRatio -
|
|
384
|
+
reserveToken.gdSupply *
|
|
385
|
+
newReserveRatio) /
|
|
386
|
+
newReserveRatio;
|
|
397
387
|
}
|
|
398
388
|
|
|
399
389
|
/**
|
|
@@ -59,6 +59,9 @@ contract GoodReserveCDai is
|
|
|
59
59
|
|
|
60
60
|
bool public gdxDisabled;
|
|
61
61
|
bool public discountDisabled;
|
|
62
|
+
|
|
63
|
+
uint256 private _reentrantStatus;
|
|
64
|
+
|
|
62
65
|
// Emits when new GD tokens minted
|
|
63
66
|
event UBIMinted(
|
|
64
67
|
//epoch of UBI
|
|
@@ -186,19 +189,21 @@ contract GoodReserveCDai is
|
|
|
186
189
|
uint256 _tokenAmount,
|
|
187
190
|
uint256 _minReturn,
|
|
188
191
|
address _targetAddress
|
|
189
|
-
) external returns (uint256) {
|
|
192
|
+
) external nonReentrant returns (uint256) {
|
|
190
193
|
ERC20 buyWith = ERC20(cDaiAddress);
|
|
191
194
|
uint256 gdReturn = getMarketMaker().buy(buyWith, _tokenAmount);
|
|
192
195
|
_targetAddress = _targetAddress == address(0x0)
|
|
193
196
|
? msg.sender
|
|
194
197
|
: _targetAddress;
|
|
195
198
|
address exchangeHelper = nameService.getAddress("EXCHANGE_HELPER");
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
|
|
200
|
+
require(
|
|
201
|
+
buyWith.transferFrom(msg.sender, address(this), _tokenAmount) == true,
|
|
202
|
+
"transferFrom failed, make sure you approved input token transfer"
|
|
203
|
+
);
|
|
204
|
+
|
|
201
205
|
require(gdReturn >= _minReturn, "GD return must be above the minReturn");
|
|
206
|
+
|
|
202
207
|
_mintGoodDollars(_targetAddress, gdReturn, true);
|
|
203
208
|
//mint GDX
|
|
204
209
|
_mintGDX(_targetAddress, gdReturn);
|
|
@@ -224,7 +229,7 @@ contract GoodReserveCDai is
|
|
|
224
229
|
address _token,
|
|
225
230
|
address _to,
|
|
226
231
|
uint256 _amount
|
|
227
|
-
) external {
|
|
232
|
+
) external nonReentrant {
|
|
228
233
|
getMarketMaker().mintFromReserveRatio(ERC20(_token), _amount);
|
|
229
234
|
_mintGoodDollars(_to, _amount, false);
|
|
230
235
|
//mint GDX
|
|
@@ -247,16 +252,24 @@ contract GoodReserveCDai is
|
|
|
247
252
|
uint256 _minReturn,
|
|
248
253
|
address _target,
|
|
249
254
|
address _seller
|
|
250
|
-
) external returns (uint256, uint256) {
|
|
255
|
+
) external nonReentrant returns (uint256, uint256) {
|
|
251
256
|
require(paused() == false, "paused");
|
|
252
257
|
GoodMarketMaker mm = getMarketMaker();
|
|
253
258
|
if (msg.sender != nameService.getAddress("EXCHANGE_HELPER")) {
|
|
254
|
-
IGoodDollar(nameService.getAddress("GOODDOLLAR")).burnFrom(
|
|
255
|
-
msg.sender,
|
|
256
|
-
_gdAmount
|
|
257
|
-
);
|
|
258
259
|
_seller = msg.sender;
|
|
259
260
|
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* transferfrom and then burn instead of burnfrom to make sure funds after fee are valid
|
|
264
|
+
* ie specifically for addresses that hold stolen funds who has 100% fee applied
|
|
265
|
+
*/
|
|
266
|
+
IGoodDollar(nameService.getAddress("GOODDOLLAR")).transferFrom(
|
|
267
|
+
msg.sender,
|
|
268
|
+
address(this),
|
|
269
|
+
_gdAmount
|
|
270
|
+
);
|
|
271
|
+
IGoodDollar(nameService.getAddress("GOODDOLLAR")).burn(_gdAmount);
|
|
272
|
+
|
|
260
273
|
_target = _target == address(0x0) ? msg.sender : _target;
|
|
261
274
|
//discount on exit contribution based on gdx
|
|
262
275
|
|
|
@@ -358,18 +371,21 @@ contract GoodReserveCDai is
|
|
|
358
371
|
* @dev only FundManager or other with mint G$ permission can call this to trigger minting.
|
|
359
372
|
* Reserve sends UBI + interest to FundManager.
|
|
360
373
|
* @param _daiToConvert DAI amount to convert cDAI
|
|
361
|
-
* @param _startingCDAIBalance Initial cDAI balance before staking collect process start
|
|
362
374
|
* @param _interestToken The token that was transfered to the reserve
|
|
363
375
|
* @return gdUBI,interestInCdai how much GD UBI was minted and how much cDAI collected from staking contracts
|
|
364
376
|
*/
|
|
365
377
|
function mintUBI(
|
|
366
378
|
uint256 _daiToConvert,
|
|
367
|
-
uint256 _startingCDAIBalance,
|
|
379
|
+
uint256 /*_startingCDAIBalance*/, // dont trust it, use reserveSupply from marketmaker instead
|
|
368
380
|
ERC20 _interestToken
|
|
369
|
-
) external returns (uint256, uint256) {
|
|
381
|
+
) external nonReentrant returns (uint256, uint256) {
|
|
370
382
|
cERC20(cDaiAddress).mint(_daiToConvert);
|
|
383
|
+
|
|
384
|
+
(uint256 reserveSupply, , , ) = getMarketMaker().reserveTokens(cDaiAddress);
|
|
385
|
+
|
|
371
386
|
uint256 interestInCdai = _interestToken.balanceOf(address(this)) -
|
|
372
|
-
|
|
387
|
+
reserveSupply;
|
|
388
|
+
|
|
373
389
|
uint256 gdInterestToMint = getMarketMaker().mintInterest(
|
|
374
390
|
_interestToken,
|
|
375
391
|
interestInCdai
|
|
@@ -519,4 +535,16 @@ contract GoodReserveCDai is
|
|
|
519
535
|
function when() public pure override returns (CallPhase) {
|
|
520
536
|
return CallPhase.Pre;
|
|
521
537
|
}
|
|
538
|
+
|
|
539
|
+
modifier nonReentrant() {
|
|
540
|
+
// On the first call to nonReentrant, _status will be _NOT_ENTERED
|
|
541
|
+
require(_reentrantStatus != 1, "ReentrancyGuard: reentrant call");
|
|
542
|
+
|
|
543
|
+
// Any calls to nonReentrant after this point will fail
|
|
544
|
+
_reentrantStatus = 1;
|
|
545
|
+
_;
|
|
546
|
+
// By storing the original value once again, a refund is triggered (see
|
|
547
|
+
// https://eips.ethereum.org/EIPS/eip-2200)
|
|
548
|
+
_reentrantStatus = 0;
|
|
549
|
+
}
|
|
522
550
|
}
|