@gooddollar/goodprotocol 2.0.31 → 2.0.32
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/CeloDistributionHelper.min.json +1 -0
- package/artifacts/abis/CeloDistributionHelperTest.min.json +1 -0
- package/artifacts/abis/CeloDistributionHelperTestHelper.min.json +1 -0
- package/artifacts/abis/IBancorExchangeProvider.min.json +1 -0
- package/artifacts/abis/IBroker.min.json +1 -0
- package/artifacts/abis/IGoodDollarExchangeProvider.min.json +1 -0
- package/artifacts/abis/IGoodDollarExpansionController.min.json +1 -0
- package/artifacts/abis/IMentoReserve.min.json +1 -0
- package/artifacts/abis/ITradingLimits.min.json +1 -0
- package/artifacts/abis/MentoExchange.min.json +1 -0
- package/artifacts/abis/ProtocolUpgradeV4Mento.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 +1 -1
- package/artifacts/contracts/Interfaces.sol/ISwapRouter.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/MentoInterfaces.sol/IBancorExchangeProvider.dbg.json +4 -0
- package/artifacts/contracts/MentoInterfaces.sol/IBancorExchangeProvider.json +282 -0
- package/artifacts/contracts/MentoInterfaces.sol/IBroker.dbg.json +4 -0
- package/artifacts/contracts/MentoInterfaces.sol/IBroker.json +491 -0
- package/artifacts/contracts/MentoInterfaces.sol/IGoodDollarExchangeProvider.dbg.json +4 -0
- package/artifacts/contracts/MentoInterfaces.sol/IGoodDollarExchangeProvider.json +164 -0
- package/artifacts/contracts/MentoInterfaces.sol/IGoodDollarExpansionController.dbg.json +4 -0
- package/artifacts/contracts/MentoInterfaces.sol/IGoodDollarExpansionController.json +333 -0
- package/artifacts/contracts/MentoInterfaces.sol/IMentoReserve.dbg.json +4 -0
- package/artifacts/contracts/MentoInterfaces.sol/IMentoReserve.json +927 -0
- package/artifacts/contracts/MentoInterfaces.sol/ITradingLimits.dbg.json +4 -0
- package/artifacts/contracts/MentoInterfaces.sol/ITradingLimits.json +10 -0
- package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/FuseFaucetV2.sol/FuseFaucetV2.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/SuperfluidFacuet.sol/SuperfluidFaucet.dbg.json +1 -1
- package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
- package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
- package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/IGovernanceStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/IStakingUpgrade.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.dbg.json +1 -1
- package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/MultiBaseGovernanceShareField.sol/MultiBaseGovernanceShareField.dbg.json +1 -1
- package/artifacts/contracts/governance/Reputation.sol/Reputation.dbg.json +1 -1
- package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
- package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.json +2 -2
- package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesFuseV2.sol/InvitesFuseV2.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.dbg.json +1 -1
- package/artifacts/contracts/invite/OneTimeReward.sol/OneTimeReward.dbg.json +1 -1
- package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/AaveUSDMockOracle.sol/AaveUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/BatUSDMockOracle.sol/BatUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTest.dbg.json +4 -0
- package/artifacts/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTest.json +864 -0
- package/artifacts/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTestHelper.dbg.json +4 -0
- package/artifacts/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTestHelper.json +890 -0
- package/artifacts/contracts/mocks/CompUsdMockOracle.sol/CompUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DaiEthPriceMockOracle.sol/DaiEthPriceMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.json +2 -2
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.json +2 -2
- package/artifacts/contracts/mocks/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/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.json +2 -2
- package/artifacts/contracts/mocks/IdentityMock.sol/IdentityMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/IWrapper.dbg.json +1 -1
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
- package/artifacts/contracts/mocks/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/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.dbg.json +1 -1
- package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
- package/artifacts/contracts/reserve/CeloDistributionHelper.sol/CeloDistributionHelper.dbg.json +4 -0
- package/artifacts/contracts/reserve/CeloDistributionHelper.sol/CeloDistributionHelper.json +864 -0
- package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.json +2 -2
- package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.json +2 -2
- package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.json +2 -2
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/ContributionCalc.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.json +2 -2
- package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
- package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.dbg.json +1 -1
- 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/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/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/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/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/UBISchemeV2.sol/UBISchemeV2.dbg.json +1 -1
- package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
- package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
- package/artifacts/contracts/utils/BulkProof.sol/BulkProof.dbg.json +1 -1
- package/artifacts/contracts/utils/BulkProof.sol/BulkProof.json +2 -2
- package/artifacts/contracts/utils/BulkWhitelist.sol/BulkWhitelist.dbg.json +1 -1
- 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/BuyGDCloneFactory.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/DonateGDClone.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
- package/artifacts/contracts/utils/DSMath.sol/DSMath.dbg.json +1 -1
- package/artifacts/contracts/utils/DataTypes.sol/DataTypes.dbg.json +1 -1
- package/artifacts/contracts/utils/FuseOldBridgeKill.sol/EternalStorage.dbg.json +1 -1
- package/artifacts/contracts/utils/FuseOldBridgeKill.sol/FuseOldBridgeKill.dbg.json +1 -1
- package/artifacts/contracts/utils/FuseOldBridgeKill.sol/IUpgradeabilityOwnerStorage.dbg.json +1 -1
- package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Initializable.dbg.json +1 -1
- package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Ownable.dbg.json +1 -1
- package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Upgradeable.dbg.json +1 -1
- package/artifacts/contracts/utils/GDFaucet.sol/GDFaucet.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/IRouter.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/PausableControl.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.dbg.json +1 -1
- package/artifacts/contracts/utils/IdentityFix.sol/IdentityFix.dbg.json +1 -1
- package/artifacts/contracts/utils/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/NameService.sol/NameService.dbg.json +1 -1
- package/artifacts/contracts/utils/OneTimePayments.sol/OneTimePayments.dbg.json +1 -1
- package/artifacts/contracts/utils/OneTimePaymentsV2.sol/OneTimePaymentsV2.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtoclUpgradeV4Mento.sol/MentoExchange.dbg.json +4 -0
- package/artifacts/contracts/utils/ProtoclUpgradeV4Mento.sol/MentoExchange.json +24 -0
- package/artifacts/contracts/utils/ProtoclUpgradeV4Mento.sol/ProtocolUpgradeV4Mento.dbg.json +4 -0
- package/artifacts/contracts/utils/ProtoclUpgradeV4Mento.sol/ProtocolUpgradeV4Mento.json +92 -0
- package/artifacts/contracts/utils/ProtocolUpgrade.sol/OldMarketMaker.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.dbg.json +1 -1
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.dbg.json +1 -1
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.dbg.json +1 -1
- package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/ReserveRestore.sol/ReserveRestore.dbg.json +1 -1
- package/artifacts/contracts/utils/ReserveRestore.sol/ReserveRestore.json +2 -2
- package/contracts/MentoInterfaces.sol +746 -0
- package/contracts/mocks/CeloDistributionHelperTest.sol +25 -0
- package/contracts/reserve/CeloDistributionHelper.sol +286 -0
- package/contracts/reserve/GoodMarketMaker.sol +11 -1
- package/contracts/staking/GoodFundManager.sol +5 -2
- package/contracts/utils/ProtoclUpgradeV4Mento.sol +99 -0
- package/contracts/utils/ReserveRestore.sol +171 -147
- package/hardhat.config.ts +4 -4
- package/package.json +5 -2
- package/releases/deployment.json +25 -13
- package/scripts/multichain-deploy/helpers.ts +45 -24
- package/scripts/proposals/reserveRestore.ts +130 -85
- package/scripts/proposals/v4Upgrade.ts +845 -0
- package/test/reserve/CeloDistributionHelper.test.ts +377 -0
- package/test/reserve/GoodMarketMaker.test.ts +98 -35
- package/test/zzz - e2e/CeloDistributionHelper.e2e.test.ts +0 -0
- package/types/contracts/MentoInterfaces.sol/IBancorExchangeProvider.ts +422 -0
- package/types/contracts/MentoInterfaces.sol/IBroker.ts +727 -0
- package/types/contracts/MentoInterfaces.sol/IGoodDollarExchangeProvider.ts +341 -0
- package/types/contracts/MentoInterfaces.sol/IGoodDollarExpansionController.ts +617 -0
- package/types/contracts/MentoInterfaces.sol/IMentoReserve.ts +1700 -0
- package/types/contracts/MentoInterfaces.sol/index.ts +8 -0
- package/types/contracts/index.ts +2 -0
- package/types/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTest.ts +1226 -0
- package/types/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTestHelper.ts +1279 -0
- package/types/contracts/mocks/CeloDistributionHelperTest.sol/index.ts +5 -0
- package/types/contracts/mocks/index.ts +2 -0
- package/types/contracts/reserve/CeloDistributionHelper.ts +1226 -0
- package/types/contracts/reserve/index.ts +1 -0
- package/types/contracts/utils/ProtoclUpgradeV4Mento.sol/MentoExchange.ts +81 -0
- package/types/contracts/utils/ProtoclUpgradeV4Mento.sol/ProtocolUpgradeV4Mento.ts +161 -0
- package/types/contracts/utils/ProtoclUpgradeV4Mento.sol/index.ts +5 -0
- package/types/contracts/utils/index.ts +2 -0
- package/types/factories/contracts/MentoInterfaces.sol/IBancorExchangeProvider__factory.ts +301 -0
- package/types/factories/contracts/MentoInterfaces.sol/IBroker__factory.ts +506 -0
- package/types/factories/contracts/MentoInterfaces.sol/IGoodDollarExchangeProvider__factory.ts +183 -0
- package/types/factories/contracts/MentoInterfaces.sol/IGoodDollarExpansionController__factory.ts +352 -0
- package/types/factories/contracts/MentoInterfaces.sol/IMentoReserve__factory.ts +942 -0
- package/types/factories/contracts/MentoInterfaces.sol/index.ts +8 -0
- package/types/factories/contracts/governance/StakersDistribution__factory.ts +1 -1
- package/types/factories/contracts/index.ts +1 -0
- package/types/factories/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTestHelper__factory.ts +949 -0
- package/types/factories/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTest__factory.ts +919 -0
- package/types/factories/contracts/mocks/CeloDistributionHelperTest.sol/index.ts +5 -0
- package/types/factories/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper__factory.ts +1 -1
- package/types/factories/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest__factory.ts +1 -1
- package/types/factories/contracts/mocks/GoodCompoundStakingTest__factory.ts +1 -1
- package/types/factories/contracts/mocks/GoodFundManagerTest__factory.ts +1 -1
- package/types/factories/contracts/mocks/OverMintTesterRegularStake__factory.ts +1 -1
- package/types/factories/contracts/mocks/index.ts +1 -0
- package/types/factories/contracts/reserve/CeloDistributionHelper__factory.ts +919 -0
- package/types/factories/contracts/reserve/DistributionHelper__factory.ts +1 -1
- package/types/factories/contracts/reserve/ExchangeHelper__factory.ts +1 -1
- package/types/factories/contracts/reserve/GoodMarketMaker__factory.ts +1 -1
- package/types/factories/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai__factory.ts +1 -1
- package/types/factories/contracts/reserve/index.ts +1 -0
- package/types/factories/contracts/staking/DonationsStaking__factory.ts +1 -1
- package/types/factories/contracts/staking/GoodFundManager__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/utils/BuyAndBridgeHelper__factory.ts +1 -1
- package/types/factories/contracts/utils/LastauthReduction__factory.ts +1 -1
- package/types/factories/contracts/utils/ProtoclUpgradeV4Mento.sol/MentoExchange__factory.ts +39 -0
- package/types/factories/contracts/utils/ProtoclUpgradeV4Mento.sol/ProtocolUpgradeV4Mento__factory.ts +152 -0
- package/types/factories/contracts/utils/ProtoclUpgradeV4Mento.sol/index.ts +5 -0
- package/types/factories/contracts/utils/ReserveRestore__factory.ts +1 -1
- package/types/factories/contracts/utils/index.ts +1 -0
- package/types/hardhat.d.ts +90 -0
- package/types/index.ts +20 -0
|
@@ -0,0 +1,25 @@
|
|
|
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/CeloDistributionHelper.sol";
|
|
10
|
+
|
|
11
|
+
contract CeloDistributionHelperTest is CeloDistributionHelper {
|
|
12
|
+
function onDistribution(uint256 _amount) external override {
|
|
13
|
+
revert();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
contract CeloDistributionHelperTestHelper is CeloDistributionHelper {
|
|
18
|
+
function setOracle(IStaticOracle oracle) external {
|
|
19
|
+
STATIC_ORACLE = oracle;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function setBridges(address _mpbBridge) external {
|
|
23
|
+
mpbBridge = IMessagePassingBridge(_mpbBridge);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.8;
|
|
4
|
+
|
|
5
|
+
import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
|
|
6
|
+
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
7
|
+
import "@mean-finance/uniswap-v3-oracle/solidity/interfaces/IStaticOracle.sol";
|
|
8
|
+
import "@gooddollar/bridge-contracts/contracts/messagePassingBridge/IMessagePassingBridge.sol";
|
|
9
|
+
|
|
10
|
+
import "../utils/DAOUpgradeableContract.sol";
|
|
11
|
+
|
|
12
|
+
// import "hardhat/console.sol";
|
|
13
|
+
|
|
14
|
+
/***
|
|
15
|
+
* @dev DistributionHelper receives funds and distributes them to recipients
|
|
16
|
+
* recipients can be on other blockchains and get their funds via fuse/multichain bridge
|
|
17
|
+
* accounts with ADMIN_ROLE can update the recipients, defaults to Avatar
|
|
18
|
+
*/
|
|
19
|
+
contract CeloDistributionHelper is
|
|
20
|
+
DAOUpgradeableContract,
|
|
21
|
+
AccessControlEnumerableUpgradeable
|
|
22
|
+
{
|
|
23
|
+
error FEE_LIMIT(uint256 fee);
|
|
24
|
+
error INVALID_CHAINID();
|
|
25
|
+
|
|
26
|
+
bytes32 public constant GUARDIAN_ROLE = keccak256("GUARDIAN_ROLE");
|
|
27
|
+
|
|
28
|
+
address public constant CELO = 0x471EcE3750Da237f93B8E339c536989b8978a438;
|
|
29
|
+
|
|
30
|
+
address public constant CUSD = 0x765DE816845861e75A25fCA122bb6898B8B1282a;
|
|
31
|
+
|
|
32
|
+
ISwapRouter public constant ROUTER =
|
|
33
|
+
ISwapRouter(0x5615CDAb10dc425a742d643d949a7F474C01abc4);
|
|
34
|
+
|
|
35
|
+
enum TransferType {
|
|
36
|
+
LayerZeroBridge,
|
|
37
|
+
Transfer,
|
|
38
|
+
TransferAndCall
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
struct DistributionRecipient {
|
|
42
|
+
uint32 bps; //share out of each distribution
|
|
43
|
+
uint32 chainId; //for multichain bridge
|
|
44
|
+
address addr; //recipient address
|
|
45
|
+
TransferType transferType;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
struct FeeSettings {
|
|
49
|
+
uint128 maxFee;
|
|
50
|
+
uint128 minBalanceForFees;
|
|
51
|
+
uint8 percentageToSellForFee;
|
|
52
|
+
uint8 maxSlippage;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
DistributionRecipient[] public distributionRecipients;
|
|
56
|
+
|
|
57
|
+
IMessagePassingBridge public mpbBridge;
|
|
58
|
+
FeeSettings public feeSettings;
|
|
59
|
+
IStaticOracle public STATIC_ORACLE;
|
|
60
|
+
|
|
61
|
+
event Distribution(
|
|
62
|
+
uint256 distributed,
|
|
63
|
+
uint256 startingBalance,
|
|
64
|
+
uint256 incomingAmount,
|
|
65
|
+
DistributionRecipient[] distributionRecipients,
|
|
66
|
+
uint256 gdSoldForGas,
|
|
67
|
+
uint256 nativeBoughtForGas
|
|
68
|
+
);
|
|
69
|
+
event RecipientUpdated(DistributionRecipient recipient, uint256 index);
|
|
70
|
+
event RecipientAdded(DistributionRecipient recipient, uint256 index);
|
|
71
|
+
event BuyNativeFailed(string reason);
|
|
72
|
+
|
|
73
|
+
receive() external payable {}
|
|
74
|
+
|
|
75
|
+
function initialize(
|
|
76
|
+
INameService _ns,
|
|
77
|
+
IStaticOracle _oracle
|
|
78
|
+
) external initializer {
|
|
79
|
+
__AccessControlEnumerable_init();
|
|
80
|
+
setDAO(_ns);
|
|
81
|
+
_setupRole(DEFAULT_ADMIN_ROLE, avatar); //this needs to happen after setDAO for avatar to be non empty
|
|
82
|
+
_setupRole(GUARDIAN_ROLE, avatar);
|
|
83
|
+
mpbBridge = IMessagePassingBridge(
|
|
84
|
+
nameService.getAddress("MPBBRIDGE_CONTRACT")
|
|
85
|
+
);
|
|
86
|
+
STATIC_ORACLE = _oracle;
|
|
87
|
+
uint24[] memory fees = new uint24[](1);
|
|
88
|
+
fees[0] = 10000;
|
|
89
|
+
STATIC_ORACLE.prepareSpecificFeeTiersWithTimePeriod(
|
|
90
|
+
CUSD,
|
|
91
|
+
address(nativeToken()),
|
|
92
|
+
fees,
|
|
93
|
+
60
|
|
94
|
+
);
|
|
95
|
+
fees[0] = 100;
|
|
96
|
+
STATIC_ORACLE.prepareSpecificFeeTiersWithTimePeriod(CUSD, CELO, fees, 60);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function setFeeSettings(
|
|
100
|
+
FeeSettings memory _feeData
|
|
101
|
+
) external onlyRole(GUARDIAN_ROLE) {
|
|
102
|
+
feeSettings = _feeData;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @notice this is usually called by reserve, but can be called by anyone anytime to trigger distribution
|
|
107
|
+
* @param _amount how much was sent, informational only
|
|
108
|
+
*/
|
|
109
|
+
function onDistribution(uint256 _amount) external virtual {
|
|
110
|
+
//we consider the actual balance and not _amount
|
|
111
|
+
uint256 toDistribute = nativeToken().balanceOf(address(this));
|
|
112
|
+
if (toDistribute == 0) return;
|
|
113
|
+
|
|
114
|
+
uint256 boughtNative;
|
|
115
|
+
uint256 gdToSellForFee;
|
|
116
|
+
uint256 minReceived;
|
|
117
|
+
if (address(this).balance < feeSettings.minBalanceForFees) {
|
|
118
|
+
gdToSellForFee =
|
|
119
|
+
(toDistribute * feeSettings.percentageToSellForFee) /
|
|
120
|
+
100;
|
|
121
|
+
(gdToSellForFee, minReceived) = calcGDToSell(gdToSellForFee);
|
|
122
|
+
toDistribute -= gdToSellForFee;
|
|
123
|
+
boughtNative = buyNativeWithGD(gdToSellForFee, minReceived);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
uint256 totalDistributed;
|
|
127
|
+
for (uint256 i = 0; i < distributionRecipients.length; i++) {
|
|
128
|
+
DistributionRecipient storage r = distributionRecipients[i];
|
|
129
|
+
if (r.bps > 0) {
|
|
130
|
+
uint256 toTransfer = (toDistribute * r.bps) / 10000;
|
|
131
|
+
totalDistributed += toTransfer;
|
|
132
|
+
if (toTransfer > 0) distribute(r, toTransfer);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
emit Distribution(
|
|
137
|
+
totalDistributed,
|
|
138
|
+
toDistribute,
|
|
139
|
+
_amount,
|
|
140
|
+
distributionRecipients,
|
|
141
|
+
gdToSellForFee,
|
|
142
|
+
boughtNative
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @notice add or update a recipient details, if address exists it will update, otherwise add
|
|
148
|
+
* to "remove" set recipient bps to 0. only ADMIN_ROLE can call this.
|
|
149
|
+
*/
|
|
150
|
+
function addOrUpdateRecipient(
|
|
151
|
+
DistributionRecipient memory _recipient
|
|
152
|
+
) external onlyRole(DEFAULT_ADMIN_ROLE) {
|
|
153
|
+
if (
|
|
154
|
+
_recipient.transferType != TransferType.LayerZeroBridge &&
|
|
155
|
+
_recipient.chainId != block.chainid
|
|
156
|
+
) {
|
|
157
|
+
revert INVALID_CHAINID();
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
for (uint256 i = 0; i < distributionRecipients.length; i++) {
|
|
161
|
+
if (distributionRecipients[i].addr == _recipient.addr) {
|
|
162
|
+
distributionRecipients[i] = _recipient;
|
|
163
|
+
emit RecipientUpdated(_recipient, i);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
//if reached here then add new one
|
|
168
|
+
emit RecipientAdded(_recipient, distributionRecipients.length);
|
|
169
|
+
distributionRecipients.push(_recipient);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* @notice internal function that takes care of sending the G$s according to the transfer type
|
|
174
|
+
* @param _recipient data about the recipient
|
|
175
|
+
* @param _amount how much to send
|
|
176
|
+
*/
|
|
177
|
+
function distribute(
|
|
178
|
+
DistributionRecipient storage _recipient,
|
|
179
|
+
uint256 _amount
|
|
180
|
+
) internal {
|
|
181
|
+
if (_recipient.transferType == TransferType.LayerZeroBridge) {
|
|
182
|
+
nativeToken().approve(address(mpbBridge), _amount);
|
|
183
|
+
(uint256 lzFee, ) = ILayerZeroFeeEstimator(address(mpbBridge))
|
|
184
|
+
.estimateSendFee(
|
|
185
|
+
mpbBridge.toLzChainId(_recipient.chainId),
|
|
186
|
+
address(this),
|
|
187
|
+
_recipient.addr,
|
|
188
|
+
_amount,
|
|
189
|
+
false,
|
|
190
|
+
abi.encodePacked(uint16(1), uint256(400000)) // 400k gas to execute bridge at target chain
|
|
191
|
+
);
|
|
192
|
+
if (lzFee > feeSettings.maxFee || lzFee > address(this).balance)
|
|
193
|
+
revert FEE_LIMIT(lzFee);
|
|
194
|
+
|
|
195
|
+
mpbBridge.bridgeToWithLz{ value: lzFee }(
|
|
196
|
+
_recipient.addr,
|
|
197
|
+
_recipient.chainId,
|
|
198
|
+
_amount,
|
|
199
|
+
""
|
|
200
|
+
);
|
|
201
|
+
} else if (_recipient.transferType == TransferType.TransferAndCall) {
|
|
202
|
+
nativeToken().transferAndCall(_recipient.addr, _amount, "");
|
|
203
|
+
} else if (_recipient.transferType == TransferType.Transfer) {
|
|
204
|
+
nativeToken().transfer(_recipient.addr, _amount);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function calcGDToSell(
|
|
209
|
+
uint256 maxAmountToSell
|
|
210
|
+
) public view returns (uint256 gdToSell, uint256 minReceived) {
|
|
211
|
+
uint24[] memory fees = new uint24[](1);
|
|
212
|
+
fees[0] = 100;
|
|
213
|
+
uint256 nativeToBuy = feeSettings.minBalanceForFees *
|
|
214
|
+
3 -
|
|
215
|
+
address(this).balance;
|
|
216
|
+
(uint256 nativeValueInUSD, ) = STATIC_ORACLE
|
|
217
|
+
.quoteSpecificFeeTiersWithTimePeriod(
|
|
218
|
+
uint128(nativeToBuy),
|
|
219
|
+
CELO,
|
|
220
|
+
CUSD,
|
|
221
|
+
fees,
|
|
222
|
+
60 //last 1 minute
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
fees[0] = 10000;
|
|
226
|
+
(gdToSell, ) = STATIC_ORACLE.quoteSpecificFeeTiersWithTimePeriod(
|
|
227
|
+
uint128(nativeValueInUSD),
|
|
228
|
+
CUSD,
|
|
229
|
+
address(nativeToken()),
|
|
230
|
+
fees,
|
|
231
|
+
60 //last 1 minute
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
minReceived = nativeToBuy;
|
|
235
|
+
if (gdToSell > maxAmountToSell) {
|
|
236
|
+
gdToSell = maxAmountToSell;
|
|
237
|
+
|
|
238
|
+
fees[0] = 10000;
|
|
239
|
+
// gdToSell = (nativeValueInUSD * 1e18) / gdPriceInUSD; // mul by 1e18 so result is in 18 decimals
|
|
240
|
+
(uint256 minReceivedCUSD, ) = STATIC_ORACLE
|
|
241
|
+
.quoteSpecificFeeTiersWithTimePeriod(
|
|
242
|
+
uint128(gdToSell),
|
|
243
|
+
address(nativeToken()),
|
|
244
|
+
CUSD,
|
|
245
|
+
fees,
|
|
246
|
+
60 //last 1 minute
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
fees[0] = 100;
|
|
250
|
+
(minReceived, ) = STATIC_ORACLE.quoteSpecificFeeTiersWithTimePeriod(
|
|
251
|
+
uint128(minReceivedCUSD),
|
|
252
|
+
CUSD,
|
|
253
|
+
CELO,
|
|
254
|
+
fees,
|
|
255
|
+
60 //last 1 minute
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function buyNativeWithGD(
|
|
261
|
+
uint256 amountToSell,
|
|
262
|
+
uint256 minReceived
|
|
263
|
+
) internal returns (uint256 nativeBought) {
|
|
264
|
+
ERC20(nativeToken()).approve(address(ROUTER), amountToSell);
|
|
265
|
+
uint256 amountOutMinimum = (minReceived * (100 - feeSettings.maxSlippage)) /
|
|
266
|
+
100; // 5% slippage
|
|
267
|
+
ISwapRouter.ExactInputParams memory params = ISwapRouter.ExactInputParams({
|
|
268
|
+
path: abi.encodePacked(
|
|
269
|
+
nativeToken(),
|
|
270
|
+
uint24(10000),
|
|
271
|
+
CUSD,
|
|
272
|
+
uint24(100),
|
|
273
|
+
CELO
|
|
274
|
+
),
|
|
275
|
+
recipient: address(this),
|
|
276
|
+
amountIn: amountToSell,
|
|
277
|
+
amountOutMinimum: amountOutMinimum
|
|
278
|
+
});
|
|
279
|
+
try ROUTER.exactInput(params) returns (uint256 amountOut) {
|
|
280
|
+
return amountOut;
|
|
281
|
+
} catch Error(string memory reason) {
|
|
282
|
+
emit BuyNativeFailed(reason);
|
|
283
|
+
return 0;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
@@ -300,8 +300,18 @@ contract GoodMarketMaker is DAOUpgradeableContract, DSMath {
|
|
|
300
300
|
|
|
301
301
|
// The return value after the deduction
|
|
302
302
|
uint256 tokenReturn = sellReturn(_token, amountAfterContribution);
|
|
303
|
-
|
|
303
|
+
|
|
304
|
+
rtoken.gdSupply -= amountAfterContribution;
|
|
304
305
|
rtoken.reserveSupply -= tokenReturn;
|
|
306
|
+
//burn contributed tokens on curve
|
|
307
|
+
if (_contributionGdAmount > 0) {
|
|
308
|
+
uint256 nom = rtoken.gdSupply * rtoken.reserveRatio;
|
|
309
|
+
uint256 denom = rtoken.gdSupply - _contributionGdAmount;
|
|
310
|
+
uint256 newRatio = nom / denom;
|
|
311
|
+
rtoken.reserveRatio = uint32(newRatio);
|
|
312
|
+
rtoken.gdSupply -= _contributionGdAmount;
|
|
313
|
+
}
|
|
314
|
+
|
|
305
315
|
emit BalancesUpdated(
|
|
306
316
|
msg.sender,
|
|
307
317
|
address(_token),
|
|
@@ -398,13 +398,16 @@ contract GoodFundManager is DAOUpgradeableContract, DSMath {
|
|
|
398
398
|
staking.blockStart,
|
|
399
399
|
staking.blockEnd
|
|
400
400
|
);
|
|
401
|
-
if (
|
|
401
|
+
if (
|
|
402
|
+
amount > 0 &&
|
|
403
|
+
staking.isBlackListed == false &&
|
|
404
|
+
GoodReserveCDai(nameService.getAddress("RESERVE")).paused() == false
|
|
405
|
+
) {
|
|
402
406
|
GoodReserveCDai(nameService.getAddress("RESERVE")).mintRewardFromRR(
|
|
403
407
|
_token,
|
|
404
408
|
_user,
|
|
405
409
|
amount
|
|
406
410
|
);
|
|
407
|
-
|
|
408
411
|
emit StakingRewardMinted(msg.sender, _user, amount);
|
|
409
412
|
}
|
|
410
413
|
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.0;
|
|
3
|
+
|
|
4
|
+
import "../utils/NameService.sol";
|
|
5
|
+
import "../Interfaces.sol";
|
|
6
|
+
import "../MentoInterfaces.sol";
|
|
7
|
+
|
|
8
|
+
// import "hardhat/console.sol";
|
|
9
|
+
|
|
10
|
+
interface MentoExchange {
|
|
11
|
+
function reserve() external view returns (address);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
contract ProtocolUpgradeV4Mento {
|
|
15
|
+
address avatar;
|
|
16
|
+
|
|
17
|
+
constructor(address _avatar) {
|
|
18
|
+
avatar = _avatar;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function upgrade(
|
|
22
|
+
Controller _controller,
|
|
23
|
+
IBancorExchangeProvider.PoolExchange memory _exchange,
|
|
24
|
+
address _mentoExchange,
|
|
25
|
+
address _mentoController,
|
|
26
|
+
address _distHelper,
|
|
27
|
+
uint256 totalGlobalSupply
|
|
28
|
+
) external {
|
|
29
|
+
require(msg.sender == address(avatar), "only avatar can call this");
|
|
30
|
+
|
|
31
|
+
// uint32 expansionFrequency = 1 days;
|
|
32
|
+
// uint64 expansionRate = 288617289021952; //10% a year = ((1e18 - expansionRate)/1e18)^365=0.9
|
|
33
|
+
uint256 cUSDBalance = ERC20(_exchange.reserveAsset).balanceOf(
|
|
34
|
+
MentoExchange(_mentoExchange).reserve()
|
|
35
|
+
);
|
|
36
|
+
require(cUSDBalance >= 200000e18, "not enough reserve");
|
|
37
|
+
|
|
38
|
+
uint256 gdSupply = ERC20(_exchange.tokenAddress).totalSupply();
|
|
39
|
+
uint256 price = 0.0001 ether; // we initialize with price of 0.0001
|
|
40
|
+
// given price calculate the reserve ratio
|
|
41
|
+
uint32 reserveRatio = uint32(
|
|
42
|
+
(cUSDBalance * 1e18 * 1e8) / (price * totalGlobalSupply)
|
|
43
|
+
); //cUSDBalance/(price * gdSupply/1e18) * 1e8
|
|
44
|
+
uint32 exitContribution = 0.1 * 1e8;
|
|
45
|
+
|
|
46
|
+
_exchange.reserveBalance = cUSDBalance;
|
|
47
|
+
_exchange.tokenSupply = totalGlobalSupply;
|
|
48
|
+
_exchange.reserveRatio = reserveRatio;
|
|
49
|
+
_exchange.exitContribution = exitContribution;
|
|
50
|
+
|
|
51
|
+
(bool ok, bytes memory result) = _controller.genericCall(
|
|
52
|
+
address(_mentoExchange),
|
|
53
|
+
abi.encodeCall(IBancorExchangeProvider.createExchange, _exchange),
|
|
54
|
+
address(avatar),
|
|
55
|
+
0
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
// console.log("createExchange %s", ok);
|
|
59
|
+
require(ok, "createExchange failed");
|
|
60
|
+
bytes32 exchangeId = abi.decode(result, (bytes32));
|
|
61
|
+
// console.logBytes32(exchangeId);
|
|
62
|
+
(ok, ) = _controller.genericCall(
|
|
63
|
+
address(_mentoController),
|
|
64
|
+
abi.encodeCall(
|
|
65
|
+
IGoodDollarExpansionController.setExpansionConfig,
|
|
66
|
+
(exchangeId, 288617289021952, 1 days) //10% a year = ((1e18 - expansionRate)/1e18)^365=0.9 frequency 1 day
|
|
67
|
+
),
|
|
68
|
+
address(avatar),
|
|
69
|
+
0
|
|
70
|
+
);
|
|
71
|
+
require(ok, "setExpansionConfig failed");
|
|
72
|
+
|
|
73
|
+
(ok, ) = _controller.genericCall(
|
|
74
|
+
address(_mentoController),
|
|
75
|
+
abi.encodeCall(
|
|
76
|
+
IGoodDollarExpansionController.setDistributionHelper,
|
|
77
|
+
_distHelper
|
|
78
|
+
),
|
|
79
|
+
address(avatar),
|
|
80
|
+
0
|
|
81
|
+
);
|
|
82
|
+
require(ok, "setDistribuitionHelper failed");
|
|
83
|
+
|
|
84
|
+
// mint exit liquidity to bridge
|
|
85
|
+
uint256 toMint = totalGlobalSupply - gdSupply;
|
|
86
|
+
require(
|
|
87
|
+
_controller.mintTokens(
|
|
88
|
+
toMint,
|
|
89
|
+
0xa3247276DbCC76Dd7705273f766eB3E8a5ecF4a5,
|
|
90
|
+
address(avatar)
|
|
91
|
+
),
|
|
92
|
+
"bridge minting failed"
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
// prevent executing again
|
|
96
|
+
require(_controller.unregisterSelf(avatar), "unregistering failed");
|
|
97
|
+
avatar = address(0);
|
|
98
|
+
}
|
|
99
|
+
}
|