@gooddollar/goodprotocol 2.0.32-beta.0 → 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 +7 -5
- 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,845 @@
|
|
|
1
|
+
/***
|
|
2
|
+
* Mainnet:
|
|
3
|
+
* FIXES:
|
|
4
|
+
* - prevent hacked funds burnFrom
|
|
5
|
+
* - set GOOD rewards to 0
|
|
6
|
+
* - prevent untrusted contracts in goodfundmanager
|
|
7
|
+
* - use bonding curve for actual cDAI balance (prevent the "buy" instead of "transferTo" used in hack to trick reserve into minting UBI from interest)
|
|
8
|
+
* - fix reserve calculations of expansion/currentprice
|
|
9
|
+
* - fix exit contribution calculations
|
|
10
|
+
* - add requirement of guardians to approve on-chain proposals
|
|
11
|
+
* - reserve should not trust exchange helper
|
|
12
|
+
* - resere should not trust fundmanager for its starting balance
|
|
13
|
+
* Changes:
|
|
14
|
+
* - mainnet no longer main token chain. so bridge now mints/burns instead of lock/unlock
|
|
15
|
+
* - require guardians to approve proposals
|
|
16
|
+
*
|
|
17
|
+
* PLAN:
|
|
18
|
+
* - upgrade compoundvotingmachine
|
|
19
|
+
* - upgrade reserve
|
|
20
|
+
* - upgrade exchangeHelper
|
|
21
|
+
* - upgrade goodfundmanager
|
|
22
|
+
* - upgrade governance
|
|
23
|
+
* - upgrade goodmarketmaker
|
|
24
|
+
* - pause staking
|
|
25
|
+
* - prevent fusebridge usage
|
|
26
|
+
* - set GOOD rewards to 0
|
|
27
|
+
* - blacklist hacked accounts to prevent burn (transfer already blocked done via tax)
|
|
28
|
+
* - upgrade/stop fuse bridge + withdraw funds
|
|
29
|
+
* - withdraw funds from MPB bridge
|
|
30
|
+
* - burn withdrawn funds
|
|
31
|
+
* - upgrade MPB bridge contract to mint/burn
|
|
32
|
+
* - give minting rights to the MPB (by adding it as scheme)
|
|
33
|
+
* - switch fuse distribution to use lz bridge insted of deprecated fuse bridge
|
|
34
|
+
*
|
|
35
|
+
* Fuse:
|
|
36
|
+
*
|
|
37
|
+
* Changes:
|
|
38
|
+
* - require guardians to approve proposals
|
|
39
|
+
* PLAN:
|
|
40
|
+
* - upgrade compoundvotingmachine
|
|
41
|
+
* - prevent old fuse bridge usage
|
|
42
|
+
* - upgrade MPB bridge contract
|
|
43
|
+
* - give minting rights to the MPB (by adding it as scheme)
|
|
44
|
+
* - remove mint rights to bridge given through mintburnwrapper
|
|
45
|
+
*
|
|
46
|
+
* Celo:
|
|
47
|
+
* Changes:
|
|
48
|
+
* - Upgrade MPB contract
|
|
49
|
+
* - Deploy new distribution helper
|
|
50
|
+
*
|
|
51
|
+
* PLAN:
|
|
52
|
+
* - upgrade MP bridge contract
|
|
53
|
+
* - remove minting rights from bridge (since now it is lock/unlock)
|
|
54
|
+
* - mint tokens to MPB to match G$ supply on Ethereum+Fuse-Minus locked funds
|
|
55
|
+
* - deploy CeloDistributionHelper
|
|
56
|
+
* - add recipients to distribution helper
|
|
57
|
+
* - give minting rights to mento broker directly on token
|
|
58
|
+
* - give minting rights to mento expansion controller directly on token
|
|
59
|
+
* - create the mento G$/CUSD exchange
|
|
60
|
+
* - set the expansion rate
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
// add distributionhelper recipients
|
|
64
|
+
|
|
65
|
+
import { network, ethers, upgrades } from "hardhat";
|
|
66
|
+
import { reset } from "@nomicfoundation/hardhat-network-helpers";
|
|
67
|
+
import { defaultsDeep, last } from "lodash";
|
|
68
|
+
import prompt from "prompt";
|
|
69
|
+
// import mpbDeployments from "@gooddollar/bridge-contracts/release/mpb.json"
|
|
70
|
+
|
|
71
|
+
import { executeViaGuardian, executeViaSafe, verifyProductionSigner } from "../multichain-deploy/helpers";
|
|
72
|
+
|
|
73
|
+
import ProtocolSettings from "../../releases/deploy-settings.json";
|
|
74
|
+
|
|
75
|
+
import dao from "../../releases/deployment.json";
|
|
76
|
+
import {
|
|
77
|
+
CeloDistributionHelper,
|
|
78
|
+
Controller,
|
|
79
|
+
FuseOldBridgeKill,
|
|
80
|
+
GoodMarketMaker,
|
|
81
|
+
IBancorExchangeProvider,
|
|
82
|
+
IBroker,
|
|
83
|
+
IGoodDollar,
|
|
84
|
+
IGoodDollarExchangeProvider,
|
|
85
|
+
IGoodDollarExpansionController,
|
|
86
|
+
IMentoReserve,
|
|
87
|
+
ProtocolUpgradeV4Mento
|
|
88
|
+
} from "../../types";
|
|
89
|
+
import releaser from "../releaser";
|
|
90
|
+
let { name: networkName } = network;
|
|
91
|
+
|
|
92
|
+
// hacker and hacked multichain bridge accounts
|
|
93
|
+
const LOCKED_ACCOUNTS = [
|
|
94
|
+
"0xeC577447D314cf1e443e9f4488216651450DBE7c",
|
|
95
|
+
"0xD17652350Cfd2A37bA2f947C910987a3B1A1c60d",
|
|
96
|
+
"0x6738fA889fF31F82d9Fe8862ec025dbE318f3Fde"
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
// TODO: import from bridge-contracts package
|
|
100
|
+
const mpbDeployments = {
|
|
101
|
+
"1": [
|
|
102
|
+
{ name: "mainnet", MessagePassingBridge_Implementation: { address: "0x618fae127b803eABf72f9e86a88A7505eEBf218a" } }
|
|
103
|
+
],
|
|
104
|
+
"122": [
|
|
105
|
+
{ name: "fuse", MessagePassingBridge_Implementation: { address: "0xFCd61ccB982ce77192E3D18a5AE3326DcE0B6874" } }
|
|
106
|
+
],
|
|
107
|
+
"42220": [
|
|
108
|
+
{ name: "celo", MessagePassingBridge_Implementation: { address: "0x2537f22E7B2D5d14E7f571fA67FCd846d73317f6" } }
|
|
109
|
+
]
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const isSimulation = network.name === "hardhat" || network.name === "fork" || network.name === "localhost";
|
|
113
|
+
export const upgradeMainnet = async (network, checksOnly) => {
|
|
114
|
+
const isProduction = networkName.includes("production");
|
|
115
|
+
let [root, ...signers] = await ethers.getSigners();
|
|
116
|
+
|
|
117
|
+
if (isProduction) verifyProductionSigner(root);
|
|
118
|
+
|
|
119
|
+
let guardian = root;
|
|
120
|
+
|
|
121
|
+
//simulate produciton on fork
|
|
122
|
+
if (isSimulation) {
|
|
123
|
+
networkName = "production-mainnet";
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
let release: { [key: string]: any } = dao[networkName];
|
|
127
|
+
let protocolSettings = defaultsDeep({}, ProtocolSettings[networkName], ProtocolSettings["default"]);
|
|
128
|
+
|
|
129
|
+
//simulate on fork, make sure safe has enough eth to simulate txs
|
|
130
|
+
if (isSimulation && !checksOnly) {
|
|
131
|
+
// await reset("https://cloudflare-eth.com/");
|
|
132
|
+
guardian = await ethers.getImpersonatedSigner(protocolSettings.guardiansSafe);
|
|
133
|
+
|
|
134
|
+
await root.sendTransaction({
|
|
135
|
+
value: ethers.constants.WeiPerEther.mul(3),
|
|
136
|
+
to: protocolSettings.guardiansSafe
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const rootBalance = await ethers.provider.getBalance(root.address).then(_ => _.toString());
|
|
141
|
+
const guardianBalance = await ethers.provider.getBalance(guardian.address).then(_ => _.toString());
|
|
142
|
+
|
|
143
|
+
console.log("got signers:", {
|
|
144
|
+
networkName,
|
|
145
|
+
root: root.address,
|
|
146
|
+
guardian: guardian.address,
|
|
147
|
+
balance: rootBalance,
|
|
148
|
+
guardianBalance: guardianBalance
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
const gd = (await ethers.getContractAt("IGoodDollar", release.GoodDollar)) as IGoodDollar;
|
|
152
|
+
const fuseBridgeBalance = await gd.balanceOf(release.ForeignBridge);
|
|
153
|
+
const mpbBridgeBalance = await gd.balanceOf(release.MpbBridge);
|
|
154
|
+
const totalToBurn = fuseBridgeBalance.add(mpbBridgeBalance);
|
|
155
|
+
const mpbImplementation = mpbDeployments["1"].find(_ => _.name === "mainnet")["MessagePassingBridge_Implementation"]
|
|
156
|
+
.address;
|
|
157
|
+
|
|
158
|
+
// test blacklisting to prevent burn by hacker
|
|
159
|
+
if (isSimulation && !checksOnly) {
|
|
160
|
+
const locked = await ethers.getImpersonatedSigner(LOCKED_ACCOUNTS[0]);
|
|
161
|
+
const tx = await gd
|
|
162
|
+
.connect(locked)
|
|
163
|
+
.burn("10", { maxFeePerGas: 30e9, maxPriorityFeePerGas: 1e9, gasLimit: 200000 })
|
|
164
|
+
.then(_ => _.wait())
|
|
165
|
+
.then(_ => _.status)
|
|
166
|
+
.catch(e => e);
|
|
167
|
+
console.log("Burn tx before:", tx);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const startSupply = await gd.totalSupply();
|
|
171
|
+
console.log(
|
|
172
|
+
`Total bridge balances to burn: Total Supply: ${startSupply.toNumber() / 1e2} Fuse: ${
|
|
173
|
+
fuseBridgeBalance.toNumber() / 1e2
|
|
174
|
+
} Celo: ${mpbBridgeBalance.toNumber() / 1e2} Total: ${totalToBurn.toNumber() / 1e2}`
|
|
175
|
+
);
|
|
176
|
+
console.log("executing proposals");
|
|
177
|
+
|
|
178
|
+
// const reserveImpl = await ethers.deployContract("GoodReserveCDai");
|
|
179
|
+
// const goodFundManagerImpl = await ethers.deployContract("GoodFundManager");
|
|
180
|
+
// const exchangeHelperImpl = await ethers.deployContract("ExchangeHelper");
|
|
181
|
+
// const stakersDistImpl = await ethers.deployContract("StakersDistribution");
|
|
182
|
+
// const govImpl = await ethers.deployContract("CompoundVotingMachine");
|
|
183
|
+
// const distHelperImpl = await ethers.deployContract("DistributionHelper");
|
|
184
|
+
// const marketMakerImpl = await ethers.deployContract("GoodMarketMaker");
|
|
185
|
+
|
|
186
|
+
const reserveImpl = { address: "0x18BcdF79A724648bF34eb06701be81bD072A2384" };
|
|
187
|
+
const goodFundManagerImpl = { address: "0xAACbaaB8571cbECEB46ba85B5981efDB8928545e" };
|
|
188
|
+
const exchangeHelperImpl = { address: "0x24614Ad257F4d09fCcaec024c65C40C060E73e9D" };
|
|
189
|
+
const stakersDistImpl = { address: "0x92c69a12C2Ffc54AfCfa320bE7305ffd0f5782E0" };
|
|
190
|
+
const govImpl = { address: "0x807D0066d60a0a8312B6D191f60a6938a527E971" };
|
|
191
|
+
const distHelperImpl = { address: "0xAE2cd2a9513215961D344a2581DcAB678598eEDf" };
|
|
192
|
+
const marketMakerImpl = { address: "0x8520633e40574e9550f6a0436b0F8D56F3b99BD0" };
|
|
193
|
+
|
|
194
|
+
console.log("deployed impls", {
|
|
195
|
+
reserveImpl: reserveImpl.address,
|
|
196
|
+
goodFundManagerImpl: goodFundManagerImpl.address,
|
|
197
|
+
exchangeHelperImpl: exchangeHelperImpl.address,
|
|
198
|
+
stakersDistImpl: stakersDistImpl.address,
|
|
199
|
+
govImpl: govImpl.address,
|
|
200
|
+
distHelperImpl: distHelperImpl.address,
|
|
201
|
+
marketMakerImpl: marketMakerImpl.address
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
const proposalActions = [
|
|
205
|
+
[
|
|
206
|
+
release.StakersDistribution,
|
|
207
|
+
"setMonthlyReputationDistribution(uint256)",
|
|
208
|
+
ethers.utils.defaultAbiCoder.encode(["uint256"], [0]),
|
|
209
|
+
"0"
|
|
210
|
+
], //set GOOD rewards to 0
|
|
211
|
+
[
|
|
212
|
+
release.GoodReserveCDai,
|
|
213
|
+
"setReserveRatioDailyExpansion(uint256,uint256)",
|
|
214
|
+
ethers.utils.defaultAbiCoder.encode(["uint256", "uint256"], [999711382710978, 1e15]),
|
|
215
|
+
0
|
|
216
|
+
], //expansion ratio
|
|
217
|
+
[
|
|
218
|
+
release.GoodReserveCDai,
|
|
219
|
+
"upgradeTo(address)",
|
|
220
|
+
ethers.utils.defaultAbiCoder.encode(["address"], [reserveImpl.address]),
|
|
221
|
+
"0"
|
|
222
|
+
], //upgrade reserve
|
|
223
|
+
[
|
|
224
|
+
release.GoodFundManager,
|
|
225
|
+
"upgradeTo(address)",
|
|
226
|
+
ethers.utils.defaultAbiCoder.encode(["address"], [goodFundManagerImpl.address]),
|
|
227
|
+
"0"
|
|
228
|
+
], //upgrade fundmanager
|
|
229
|
+
[
|
|
230
|
+
release.ExchangeHelper,
|
|
231
|
+
"upgradeTo(address)",
|
|
232
|
+
ethers.utils.defaultAbiCoder.encode(["address"], [exchangeHelperImpl.address]),
|
|
233
|
+
"0"
|
|
234
|
+
], //upgrade exchangehelper
|
|
235
|
+
[release.ExchangeHelper, "setAddresses()", "0x", "0"], // activate upgrade changes
|
|
236
|
+
[
|
|
237
|
+
release.DistributionHelper,
|
|
238
|
+
"upgradeTo(address)",
|
|
239
|
+
ethers.utils.defaultAbiCoder.encode(["address"], [distHelperImpl.address]),
|
|
240
|
+
"0"
|
|
241
|
+
], //upgrade disthelper
|
|
242
|
+
[
|
|
243
|
+
release.StakersDistribution,
|
|
244
|
+
"upgradeTo(address)",
|
|
245
|
+
ethers.utils.defaultAbiCoder.encode(["address"], [stakersDistImpl.address]),
|
|
246
|
+
"0"
|
|
247
|
+
], //upgrade stakers dist
|
|
248
|
+
[
|
|
249
|
+
release.GoodMarketMaker,
|
|
250
|
+
"upgradeTo(address)",
|
|
251
|
+
ethers.utils.defaultAbiCoder.encode(["address"], [marketMakerImpl.address]),
|
|
252
|
+
"0"
|
|
253
|
+
], //upgrade mm
|
|
254
|
+
[
|
|
255
|
+
release.CompoundVotingMachine,
|
|
256
|
+
"upgradeTo(address)",
|
|
257
|
+
ethers.utils.defaultAbiCoder.encode(["address"], [govImpl.address]),
|
|
258
|
+
"0"
|
|
259
|
+
], // upgrade gov
|
|
260
|
+
[release.StakingContractsV3[0][0], "pause(bool)", ethers.utils.defaultAbiCoder.encode(["bool"], [true]), "0"], // pause staking
|
|
261
|
+
[release.StakingContractsV3[1][0], "pause(bool)", ethers.utils.defaultAbiCoder.encode(["bool"], [true]), "0"], // pause staking
|
|
262
|
+
[
|
|
263
|
+
release.ForeignBridge,
|
|
264
|
+
"setExecutionDailyLimit(uint256)",
|
|
265
|
+
ethers.utils.defaultAbiCoder.encode(["uint256"], [0]),
|
|
266
|
+
"0"
|
|
267
|
+
], // prevent from using
|
|
268
|
+
[
|
|
269
|
+
release.ForeignBridge,
|
|
270
|
+
"claimTokens(address,address)",
|
|
271
|
+
ethers.utils.defaultAbiCoder.encode(["address", "address"], [release.GoodDollar, release.Avatar]),
|
|
272
|
+
"0"
|
|
273
|
+
], // claim bridge tokens to avatar
|
|
274
|
+
[
|
|
275
|
+
release.Identity,
|
|
276
|
+
"addBlacklisted(address)",
|
|
277
|
+
ethers.utils.defaultAbiCoder.encode(["address"], [LOCKED_ACCOUNTS[0]]),
|
|
278
|
+
"0"
|
|
279
|
+
], // set locked G$ accounts as blacklisted
|
|
280
|
+
[
|
|
281
|
+
release.Identity,
|
|
282
|
+
"addBlacklisted(address)",
|
|
283
|
+
ethers.utils.defaultAbiCoder.encode(["address"], [LOCKED_ACCOUNTS[1]]),
|
|
284
|
+
"0"
|
|
285
|
+
], // set locked G$ accounts as blacklisted
|
|
286
|
+
[
|
|
287
|
+
release.Identity,
|
|
288
|
+
"addBlacklisted(address)",
|
|
289
|
+
ethers.utils.defaultAbiCoder.encode(["address"], [LOCKED_ACCOUNTS[2]]),
|
|
290
|
+
"0"
|
|
291
|
+
], // set locked G$ accounts as blacklisted
|
|
292
|
+
[
|
|
293
|
+
release.MpbBridge,
|
|
294
|
+
"upgradeTo(address)",
|
|
295
|
+
ethers.utils.defaultAbiCoder.encode(["address"], [mpbImplementation]),
|
|
296
|
+
"0"
|
|
297
|
+
], // mpb upgrade
|
|
298
|
+
[
|
|
299
|
+
release.MpbBridge,
|
|
300
|
+
"withdraw(address,uint256)",
|
|
301
|
+
ethers.utils.defaultAbiCoder.encode(["address", "uint256"], [release.GoodDollar, 0]),
|
|
302
|
+
"0"
|
|
303
|
+
], // claim bridge tokens to avatar
|
|
304
|
+
[release.GoodDollar, "burn(uint256)", ethers.utils.defaultAbiCoder.encode(["uint256"], [totalToBurn]), "0"], // burn tokens
|
|
305
|
+
[
|
|
306
|
+
release.Controller,
|
|
307
|
+
"registerScheme(address,bytes32,bytes4,address)",
|
|
308
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
309
|
+
["address", "bytes32", "bytes4", "address"],
|
|
310
|
+
[
|
|
311
|
+
release.MpbBridge, //scheme
|
|
312
|
+
ethers.constants.HashZero, //paramshash
|
|
313
|
+
"0x00000001", //permissions - minimal
|
|
314
|
+
release.Avatar
|
|
315
|
+
]
|
|
316
|
+
),
|
|
317
|
+
"0"
|
|
318
|
+
], //minting rigts to our bridge
|
|
319
|
+
[
|
|
320
|
+
release.DistributionHelper,
|
|
321
|
+
"addOrUpdateRecipient((uint32,uint32,address,uint8))",
|
|
322
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
323
|
+
["uint32", "uint32", "address", "uint8"],
|
|
324
|
+
[0, 122, dao["production"].UBIScheme, 1] //0% chainId 122 ubischeme 1-lz bridge
|
|
325
|
+
),
|
|
326
|
+
"0"
|
|
327
|
+
], // switch to lz bridge for fuse
|
|
328
|
+
[
|
|
329
|
+
release.GoodReserveCDai,
|
|
330
|
+
"grantRole(bytes32,address)",
|
|
331
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
332
|
+
["bytes32", "address"],
|
|
333
|
+
[
|
|
334
|
+
"0x65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a", //pauser role
|
|
335
|
+
release.Avatar
|
|
336
|
+
]
|
|
337
|
+
),
|
|
338
|
+
"0"
|
|
339
|
+
] // give avatar reserve pauser role
|
|
340
|
+
];
|
|
341
|
+
|
|
342
|
+
const [proposalContracts, proposalFunctionSignatures, proposalFunctionInputs, proposalEthValues] = [
|
|
343
|
+
proposalActions.map(_ => _[0]),
|
|
344
|
+
proposalActions.map(_ => _[1]),
|
|
345
|
+
proposalActions.map(_ => _[2]),
|
|
346
|
+
proposalActions.map(_ => _[3])
|
|
347
|
+
];
|
|
348
|
+
if (isProduction) {
|
|
349
|
+
await executeViaSafe(
|
|
350
|
+
proposalContracts,
|
|
351
|
+
proposalEthValues,
|
|
352
|
+
proposalFunctionSignatures,
|
|
353
|
+
proposalFunctionInputs,
|
|
354
|
+
protocolSettings.guardiansSafe,
|
|
355
|
+
"mainnet"
|
|
356
|
+
);
|
|
357
|
+
} else if (!checksOnly) {
|
|
358
|
+
//simulation or dev envs
|
|
359
|
+
await executeViaGuardian(
|
|
360
|
+
proposalContracts,
|
|
361
|
+
proposalEthValues,
|
|
362
|
+
proposalFunctionSignatures,
|
|
363
|
+
proposalFunctionInputs,
|
|
364
|
+
guardian,
|
|
365
|
+
networkName
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
if (isSimulation) {
|
|
370
|
+
await mainnetPostChecks(totalToBurn, startSupply);
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
const mainnetPostChecks = async (totalToBurn, startSupply) => {
|
|
375
|
+
networkName = "production-mainnet";
|
|
376
|
+
let release: { [key: string]: any } = dao[networkName];
|
|
377
|
+
|
|
378
|
+
let [root, ...signers] = await ethers.getSigners();
|
|
379
|
+
const gd = await ethers.getContractAt("IGoodDollar", release.GoodDollar);
|
|
380
|
+
|
|
381
|
+
const locked = await ethers.getImpersonatedSigner(LOCKED_ACCOUNTS[0]);
|
|
382
|
+
const tx = await gd
|
|
383
|
+
.connect(locked)
|
|
384
|
+
.burn("10", { maxFeePerGas: 30e9, maxPriorityFeePerGas: 1e9, gasLimit: 200000 })
|
|
385
|
+
.then(_ => _.wait())
|
|
386
|
+
.then(_ => _.status)
|
|
387
|
+
.catch(e => e);
|
|
388
|
+
console.log("Burn tx after should fail:", tx);
|
|
389
|
+
const finalSupply = await gd.totalSupply();
|
|
390
|
+
const burnOk = finalSupply.add(totalToBurn).eq(startSupply);
|
|
391
|
+
console.log("Burn check:", burnOk ? "Success" : "Failed");
|
|
392
|
+
|
|
393
|
+
const mm = (await ethers.getContractAt("GoodMarketMaker", release.GoodMarketMaker)) as GoodMarketMaker;
|
|
394
|
+
const newExpansion = await mm.reserveRatioDailyExpansion();
|
|
395
|
+
console.log(
|
|
396
|
+
"new expansion set:",
|
|
397
|
+
newExpansion,
|
|
398
|
+
newExpansion.mul(1e15).div(ethers.utils.parseEther("1000000000")).toNumber() / 1e15 === 0.999711382710978
|
|
399
|
+
);
|
|
400
|
+
|
|
401
|
+
const [mpbBalance, fuseBalance] = await Promise.all([
|
|
402
|
+
gd.balanceOf(release.MpbBridge),
|
|
403
|
+
gd.balanceOf(release.ForeignBridge)
|
|
404
|
+
]);
|
|
405
|
+
console.log("bridges shouuld have 0 balance as tokens have been burned", { mpbBalance, fuseBalance });
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
export const upgradeFuse = async network => {
|
|
409
|
+
let [root] = await ethers.getSigners();
|
|
410
|
+
|
|
411
|
+
const isProduction = networkName.includes("production");
|
|
412
|
+
|
|
413
|
+
let networkEnv = networkName.split("-")[0];
|
|
414
|
+
if (isSimulation) networkEnv = "production";
|
|
415
|
+
|
|
416
|
+
let release: { [key: string]: any } = dao[networkEnv];
|
|
417
|
+
|
|
418
|
+
let guardian = root;
|
|
419
|
+
//simulate on fork, make sure safe has enough eth to simulate txs
|
|
420
|
+
if (isSimulation) {
|
|
421
|
+
// await reset("https://rpc.fuse.io");
|
|
422
|
+
guardian = await ethers.getImpersonatedSigner(release.GuardiansSafe);
|
|
423
|
+
|
|
424
|
+
await root.sendTransaction({ value: ethers.constants.WeiPerEther.mul(3), to: guardian.address });
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
const mpbImplementation = mpbDeployments["122"].find(_ => _.name === "fuse")["MessagePassingBridge_Implementation"]
|
|
428
|
+
.address;
|
|
429
|
+
const govImpl = await ethers.getContractAt("CompoundVotingMachine", "0x9373046bbC6D381129B49aC3334881390df1CB13"); //await ethers.deployContract("CompoundVotingMachine");
|
|
430
|
+
const killBridge = (await ethers.getContractAt(
|
|
431
|
+
"FuseOldBridgeKill",
|
|
432
|
+
"0x4b93275D500929c2E0146D4fda0f411550C63eFC"
|
|
433
|
+
)) as FuseOldBridgeKill; //(await ethers.deployContract("FuseOldBridgeKill")) as FuseOldBridgeKill;
|
|
434
|
+
|
|
435
|
+
const ctrl = await ethers.getContractAt("Controller", release.Controller);
|
|
436
|
+
|
|
437
|
+
console.log({ networkEnv, mpbImplementation, guardian: guardian.address, isSimulation, isProduction });
|
|
438
|
+
const proposalActions = [
|
|
439
|
+
[
|
|
440
|
+
release.HomeBridge,
|
|
441
|
+
"upgradeToAndCall(uint256,address,bytes)", // upgrade and call end
|
|
442
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
443
|
+
["uint256", "address", "bytes"],
|
|
444
|
+
[2, killBridge.address, killBridge.interface.encodeFunctionData("end")]
|
|
445
|
+
),
|
|
446
|
+
"0"
|
|
447
|
+
], // prevent from using
|
|
448
|
+
[
|
|
449
|
+
release.CompoundVotingMachine,
|
|
450
|
+
"upgradeTo(address)",
|
|
451
|
+
ethers.utils.defaultAbiCoder.encode(["address"], [govImpl.address]),
|
|
452
|
+
"0"
|
|
453
|
+
], //upgrade
|
|
454
|
+
[
|
|
455
|
+
release.MpbBridge,
|
|
456
|
+
"upgradeTo(address)",
|
|
457
|
+
ethers.utils.defaultAbiCoder.encode(["address"], [mpbImplementation]),
|
|
458
|
+
"0"
|
|
459
|
+
], //upgrade
|
|
460
|
+
[
|
|
461
|
+
release.Controller,
|
|
462
|
+
"registerScheme(address,bytes32,bytes4,address)", //make sure mpb is a registered scheme so it can mint G$ tokens
|
|
463
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
464
|
+
["address", "bytes32", "bytes4", "address"],
|
|
465
|
+
[
|
|
466
|
+
release.MpbBridge, //scheme
|
|
467
|
+
ethers.constants.HashZero, //paramshash
|
|
468
|
+
"0x00000001", //permissions - minimal
|
|
469
|
+
release.Avatar
|
|
470
|
+
]
|
|
471
|
+
),
|
|
472
|
+
"0"
|
|
473
|
+
], // set mpb as minter = add as scheme
|
|
474
|
+
[
|
|
475
|
+
release.GoodDollarMintBurnWrapper,
|
|
476
|
+
"revokeRole(bytes32,address)",
|
|
477
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
478
|
+
["bytes32", "address"],
|
|
479
|
+
[ethers.utils.keccak256(ethers.utils.toUtf8Bytes("MINTER_ROLE")), release.MpbBridge]
|
|
480
|
+
),
|
|
481
|
+
"0"
|
|
482
|
+
] //remove bridge minting rights via wrapper
|
|
483
|
+
];
|
|
484
|
+
|
|
485
|
+
const [proposalContracts, proposalFunctionSignatures, proposalFunctionInputs, proposalEthValues] = [
|
|
486
|
+
proposalActions.map(_ => _[0]),
|
|
487
|
+
proposalActions.map(_ => _[1]),
|
|
488
|
+
proposalActions.map(_ => _[2]),
|
|
489
|
+
proposalActions.map(_ => _[3])
|
|
490
|
+
];
|
|
491
|
+
|
|
492
|
+
if (isProduction) {
|
|
493
|
+
await executeViaSafe(
|
|
494
|
+
proposalContracts,
|
|
495
|
+
proposalEthValues,
|
|
496
|
+
proposalFunctionSignatures,
|
|
497
|
+
proposalFunctionInputs,
|
|
498
|
+
release.GuardiansSafe,
|
|
499
|
+
"fuse"
|
|
500
|
+
);
|
|
501
|
+
} else {
|
|
502
|
+
await executeViaGuardian(
|
|
503
|
+
proposalContracts,
|
|
504
|
+
proposalEthValues,
|
|
505
|
+
proposalFunctionSignatures,
|
|
506
|
+
proposalFunctionInputs,
|
|
507
|
+
guardian,
|
|
508
|
+
networkEnv
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
if (isSimulation) {
|
|
513
|
+
const isMPBScheme = await ctrl.isSchemeRegistered(release.MpbBridge, release.Avatar);
|
|
514
|
+
const isFuseBridge = await ctrl.isSchemeRegistered(release.HomeBridge, release.Avatar);
|
|
515
|
+
console.log("MPB scheme registration check:", isMPBScheme ? "Success" : "Failed");
|
|
516
|
+
console.log("Fuse bridge scheme de-registration check:", !isFuseBridge ? "Success" : "Failed");
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
export const upgradeCelo = async (network, checksOnly) => {
|
|
521
|
+
let [root] = await ethers.getSigners();
|
|
522
|
+
|
|
523
|
+
const isProduction = networkName.includes("production");
|
|
524
|
+
|
|
525
|
+
let networkEnv = networkName;
|
|
526
|
+
if (isSimulation) networkEnv = network;
|
|
527
|
+
|
|
528
|
+
let release: { [key: string]: any } = dao[networkEnv];
|
|
529
|
+
|
|
530
|
+
let guardian = root;
|
|
531
|
+
console.log("signer:", root.address, { networkEnv, isSimulation, isProduction, release });
|
|
532
|
+
|
|
533
|
+
const cusd = await ethers.getContractAt("IERC20", release.CUSD);
|
|
534
|
+
const gd = await ethers.getContractAt("GoodDollar", release.GoodDollar);
|
|
535
|
+
const mentoReserve = (await ethers.getContractAt("IMentoReserve", release.MentoReserve)) as IMentoReserve;
|
|
536
|
+
|
|
537
|
+
const mentoExchange = (await ethers.getContractAt(
|
|
538
|
+
"IBancorExchangeProvider",
|
|
539
|
+
release.MentoExchangeProvider
|
|
540
|
+
)) as IBancorExchangeProvider;
|
|
541
|
+
|
|
542
|
+
//simulate on fork, make sure safe has enough eth to simulate txs
|
|
543
|
+
let DIST_HELPER_MIN_CELO_BALANCE = ethers.utils.parseEther("2");
|
|
544
|
+
|
|
545
|
+
if (isSimulation && !checksOnly) {
|
|
546
|
+
DIST_HELPER_MIN_CELO_BALANCE = ethers.utils.parseEther("0.1");
|
|
547
|
+
// await reset("https://rpc.ankr.com/celo");
|
|
548
|
+
await root.sendTransaction({ value: ethers.utils.parseEther("0.5"), to: release.Avatar });
|
|
549
|
+
|
|
550
|
+
const avatar = await ethers.getImpersonatedSigner(release.Avatar);
|
|
551
|
+
const reserveOwner = await ethers.getImpersonatedSigner(await mentoReserve.owner());
|
|
552
|
+
const eids = await mentoExchange.getExchangeIds();
|
|
553
|
+
if (eids.length > 0) {
|
|
554
|
+
await mentoExchange.connect(avatar).destroyExchange(eids[0], 0);
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
const devCUSD = await ethers.getContractAt(
|
|
558
|
+
[
|
|
559
|
+
"function mint(address,uint) external returns (uint)",
|
|
560
|
+
"function setValidators(address) external",
|
|
561
|
+
"function owner() view returns(address)"
|
|
562
|
+
],
|
|
563
|
+
release.CUSD
|
|
564
|
+
);
|
|
565
|
+
|
|
566
|
+
console.log("minting devCUSD");
|
|
567
|
+
const cusdOwner = await ethers.getImpersonatedSigner(await devCUSD.owner());
|
|
568
|
+
await root.sendTransaction({ value: ethers.utils.parseEther("0.5"), to: cusdOwner.address });
|
|
569
|
+
await devCUSD.connect(cusdOwner).setValidators(release.Avatar).catch(console.log);
|
|
570
|
+
await devCUSD.connect(avatar).mint(root.address, ethers.utils.parseEther("2000000")).catch(console.log);
|
|
571
|
+
|
|
572
|
+
console.log("transfering cusd to reserve");
|
|
573
|
+
await cusd.connect(root).transfer(release.MentoReserve, ethers.utils.parseEther("200000"));
|
|
574
|
+
|
|
575
|
+
guardian = await ethers.getImpersonatedSigner(release.GuardiansSafe);
|
|
576
|
+
await root.sendTransaction({ value: ethers.utils.parseEther("0.5"), to: guardian.address });
|
|
577
|
+
} else if (!isProduction && !checksOnly) {
|
|
578
|
+
DIST_HELPER_MIN_CELO_BALANCE = ethers.utils.parseEther("0.1");
|
|
579
|
+
const mentoReserve = (await ethers.getContractAt("IMentoReserve", release.MentoReserve)) as IMentoReserve;
|
|
580
|
+
const ctrl = (await ethers.getContractAt("Controller", release.Controller)) as Controller;
|
|
581
|
+
|
|
582
|
+
const eids = await mentoExchange.getExchangeIds();
|
|
583
|
+
if (eids.length > 0) {
|
|
584
|
+
await (
|
|
585
|
+
await ctrl.genericCall(
|
|
586
|
+
mentoExchange.address,
|
|
587
|
+
mentoExchange.interface.encodeFunctionData("destroyExchange", [eids[0], 0]),
|
|
588
|
+
release.Avatar,
|
|
589
|
+
0
|
|
590
|
+
)
|
|
591
|
+
).wait();
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
const devCUSD = await ethers.getContractAt(
|
|
595
|
+
["function mint(address,uint) external returns (uint)", "function setValidators(address) external"],
|
|
596
|
+
release.CUSD
|
|
597
|
+
);
|
|
598
|
+
await (
|
|
599
|
+
await ctrl.genericCall(
|
|
600
|
+
devCUSD.address,
|
|
601
|
+
devCUSD.interface.encodeFunctionData("setValidators", [release.Avatar]),
|
|
602
|
+
release.Avatar,
|
|
603
|
+
0
|
|
604
|
+
)
|
|
605
|
+
).wait();
|
|
606
|
+
await (
|
|
607
|
+
await ctrl.genericCall(
|
|
608
|
+
devCUSD.address,
|
|
609
|
+
devCUSD.interface.encodeFunctionData("mint", [root.address, ethers.utils.parseEther("2000000")]),
|
|
610
|
+
release.Avatar,
|
|
611
|
+
0
|
|
612
|
+
)
|
|
613
|
+
).wait();
|
|
614
|
+
|
|
615
|
+
if ((await cusd.balanceOf(release.MentoReserve)).lt(ethers.utils.parseEther("200000"))) {
|
|
616
|
+
await cusd.transfer(release.MentoReserve, ethers.utils.parseEther("200000"));
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
const mpbImplementation = mpbDeployments["42220"].find(_ => _.name === "celo")["MessagePassingBridge_Implementation"]
|
|
621
|
+
.address;
|
|
622
|
+
const bridgeLocked = ["0xa3247276DbCC76Dd7705273f766eB3E8a5ecF4a5", "0xD5D11eE582c8931F336fbcd135e98CEE4DB8CCB0"];
|
|
623
|
+
const locked = [
|
|
624
|
+
"0xD17652350Cfd2A37bA2f947C910987a3B1A1c60d",
|
|
625
|
+
"0xeC577447D314cf1e443e9f4488216651450DBE7c",
|
|
626
|
+
"0x6738fA889fF31F82d9Fe8862ec025dbE318f3Fde"
|
|
627
|
+
];
|
|
628
|
+
|
|
629
|
+
const ethprovider = new ethers.providers.JsonRpcProvider("https://rpc.flashbots.net");
|
|
630
|
+
const fuseprovider = new ethers.providers.JsonRpcProvider("https://rpc.fuse.io");
|
|
631
|
+
const TOTAL_LOCKED = (
|
|
632
|
+
await Promise.all(
|
|
633
|
+
locked
|
|
634
|
+
.concat(bridgeLocked)
|
|
635
|
+
.map(_ => gd.connect(ethprovider).attach(dao["production-mainnet"].GoodDollar).balanceOf(_))
|
|
636
|
+
)
|
|
637
|
+
).reduce((prev, cur) => prev.add(cur), ethers.constants.Zero);
|
|
638
|
+
const TOTAL_SUPPLY_ETH = await gd.connect(ethprovider).attach(dao["production-mainnet"].GoodDollar).totalSupply();
|
|
639
|
+
const TOTAL_SUPPLY_FUSE = await gd.connect(fuseprovider).attach(dao["production"].GoodDollar).totalSupply();
|
|
640
|
+
const TOTAL_SUPPLY_CELO = await gd.totalSupply();
|
|
641
|
+
const TOTAL_GLOBAL_SUPPLY = TOTAL_SUPPLY_ETH.add(TOTAL_SUPPLY_FUSE)
|
|
642
|
+
.sub(TOTAL_LOCKED)
|
|
643
|
+
.mul(ethers.BigNumber.from("10000000000000000")) //convert to 18 decimals
|
|
644
|
+
.add(TOTAL_SUPPLY_CELO);
|
|
645
|
+
|
|
646
|
+
const exchangeParams = [release.CUSD, release.GoodDollar, 0, 0, 0, 0]; //address reserveAsset;address tokenAddress;uint256 tokenSupply;uint256 reserveBalance;uint32 reserveRatio;uint32 exitConribution;
|
|
647
|
+
|
|
648
|
+
console.log({
|
|
649
|
+
networkEnv,
|
|
650
|
+
mpbImplementation,
|
|
651
|
+
guardian: guardian.address,
|
|
652
|
+
isSimulation,
|
|
653
|
+
isProduction,
|
|
654
|
+
release,
|
|
655
|
+
TOTAL_GLOBAL_SUPPLY
|
|
656
|
+
});
|
|
657
|
+
|
|
658
|
+
const mentoUpgrade = release.MentoUpgradeHelper
|
|
659
|
+
? ((await ethers.getContractAt("ProtocolUpgradeV4Mento", release.MentoUpgradeHelper)) as ProtocolUpgradeV4Mento)
|
|
660
|
+
: await ethers.deployContract("ProtocolUpgradeV4Mento", [release.Avatar]);
|
|
661
|
+
let distHelper = release.CeloDistributionHelper
|
|
662
|
+
? ((await ethers.getContractAt("CeloDistributionHelper", release.CeloDistributionHelper)) as CeloDistributionHelper)
|
|
663
|
+
: ((await upgrades.deployProxy(
|
|
664
|
+
await ethers.getContractFactory("CeloDistributionHelper"),
|
|
665
|
+
[release.NameService, "0x00851A91a3c4E9a4c1B48df827Bacc1f884bdE28"], //static oracle for uniswap
|
|
666
|
+
{ initializer: "initialize" }
|
|
667
|
+
)) as CeloDistributionHelper);
|
|
668
|
+
|
|
669
|
+
release.MentoUpgradeHelper = mentoUpgrade.address;
|
|
670
|
+
release.CeloDistributionHelper = distHelper.address;
|
|
671
|
+
if (!isSimulation) {
|
|
672
|
+
releaser(release, networkEnv);
|
|
673
|
+
}
|
|
674
|
+
console.log("deployed mentoUpgrade", {
|
|
675
|
+
distribuitonHelper: distHelper.address,
|
|
676
|
+
mentoUpgrade: mentoUpgrade.address,
|
|
677
|
+
distHelperAvatar: await distHelper.avatar()
|
|
678
|
+
});
|
|
679
|
+
|
|
680
|
+
const proposalContracts = [
|
|
681
|
+
release.CeloDistributionHelper, //set fee settings
|
|
682
|
+
release.CeloDistributionHelper, //add ubi recipient
|
|
683
|
+
release.CeloDistributionHelper, //add community treasury recipient
|
|
684
|
+
release.MpbBridge, // upgrade
|
|
685
|
+
release.MpbBridge && release.GoodDollarMintBurnWrapper, // remove minting rights from bridge
|
|
686
|
+
release.GoodDollar, // set mento broker as minter
|
|
687
|
+
release.GoodDollar, // set reserve expansion controller as minter
|
|
688
|
+
release.Controller, // register upgrade contract
|
|
689
|
+
mentoUpgrade.address // create the exchange + set expansion rate
|
|
690
|
+
];
|
|
691
|
+
|
|
692
|
+
const proposalEthValues = proposalContracts.map(_ => 0);
|
|
693
|
+
|
|
694
|
+
const proposalFunctionSignatures = [
|
|
695
|
+
"setFeeSettings((uint128,uint128,uint8,uint8))",
|
|
696
|
+
"addOrUpdateRecipient((uint32,uint32,address,uint8))",
|
|
697
|
+
"addOrUpdateRecipient((uint32,uint32,address,uint8))",
|
|
698
|
+
"upgradeTo(address)",
|
|
699
|
+
"revokeRole(bytes32,address)", // mpb is now lock/unlock doesnt need minting
|
|
700
|
+
"addMinter(address)",
|
|
701
|
+
"addMinter(address)",
|
|
702
|
+
"registerScheme(address,bytes32,bytes4,address)",
|
|
703
|
+
"upgrade(address,(address,address,uint256,uint256,uint32,uint32),address,address,address,uint256)" //Controller _controller,PoolExchange memory _exchange,address _mentoExchange,address _mentoController, address _distHelper
|
|
704
|
+
];
|
|
705
|
+
|
|
706
|
+
console.log("preparing inputs...");
|
|
707
|
+
const proposalFunctionInputs = [
|
|
708
|
+
//uint128 maxFee;uint128 minBalanceForFees;uint8 percentageToSellForFee;
|
|
709
|
+
//2 celo max fee for lz bridge, min balance 2 celo, max percentage to sell 1%, max slippage 5%
|
|
710
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
711
|
+
["uint128", "uint128", "uint8", "uint8"],
|
|
712
|
+
[ethers.utils.parseEther("2"), DIST_HELPER_MIN_CELO_BALANCE, "1", "5"]
|
|
713
|
+
),
|
|
714
|
+
ethers.utils.defaultAbiCoder.encode(["uint32", "uint32", "address", "uint8"], [9000, 42220, release.UBIScheme, 1]), // ubi pool recipient
|
|
715
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
716
|
+
["uint32", "uint32", "address", "uint8"],
|
|
717
|
+
[1000, 42220, release.CommunitySafe, 1]
|
|
718
|
+
), //community treasury recipient
|
|
719
|
+
ethers.utils.defaultAbiCoder.encode(["address"], [mpbImplementation]),
|
|
720
|
+
release.MpbBridge &&
|
|
721
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
722
|
+
["bytes32", "address"],
|
|
723
|
+
[ethers.utils.keccak256(ethers.utils.toUtf8Bytes("MINTER_ROLE")), release.MpbBridge]
|
|
724
|
+
),
|
|
725
|
+
ethers.utils.defaultAbiCoder.encode(["address"], [release.MentoBroker]),
|
|
726
|
+
ethers.utils.defaultAbiCoder.encode(["address"], [release.MentoExpansionController]),
|
|
727
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
728
|
+
["address", "bytes32", "bytes4", "address"],
|
|
729
|
+
[mentoUpgrade.address, ethers.constants.HashZero, "0x0000001f", release.Avatar]
|
|
730
|
+
),
|
|
731
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
732
|
+
["address", "(address,address,uint256,uint256,uint32,uint32)", "address", "address", "address", "uint256"],
|
|
733
|
+
[
|
|
734
|
+
release.Controller,
|
|
735
|
+
exchangeParams,
|
|
736
|
+
release.MentoExchangeProvider,
|
|
737
|
+
release.MentoExpansionController,
|
|
738
|
+
release.CeloDistributionHelper,
|
|
739
|
+
TOTAL_GLOBAL_SUPPLY
|
|
740
|
+
]
|
|
741
|
+
)
|
|
742
|
+
];
|
|
743
|
+
|
|
744
|
+
console.log({ exchangeParams, mentoExchange: release.MentoExchangeProvider });
|
|
745
|
+
console.log("executing upgrade...", { proposalContracts, proposalFunctionInputs, proposalFunctionSignatures });
|
|
746
|
+
|
|
747
|
+
if (isProduction && !checksOnly) {
|
|
748
|
+
await executeViaSafe(
|
|
749
|
+
proposalContracts,
|
|
750
|
+
proposalEthValues,
|
|
751
|
+
proposalFunctionSignatures,
|
|
752
|
+
proposalFunctionInputs,
|
|
753
|
+
release.GuardiansSafe,
|
|
754
|
+
"celo"
|
|
755
|
+
);
|
|
756
|
+
} else if (!checksOnly) {
|
|
757
|
+
await executeViaGuardian(
|
|
758
|
+
proposalContracts,
|
|
759
|
+
proposalEthValues,
|
|
760
|
+
proposalFunctionSignatures,
|
|
761
|
+
proposalFunctionInputs,
|
|
762
|
+
guardian,
|
|
763
|
+
networkEnv
|
|
764
|
+
);
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
if (isSimulation || !isProduction) {
|
|
768
|
+
const swapper = networkEnv.includes("production")
|
|
769
|
+
? await ethers.getImpersonatedSigner("0x66582D24FEaD72555adaC681Cc621caCbB208324")
|
|
770
|
+
: root;
|
|
771
|
+
const supplyAfter = await (await ethers.getContractAt("IGoodDollar", release.GoodDollar)).totalSupply();
|
|
772
|
+
console.log("Supply after upgrade:", { supplyAfter, TOTAL_GLOBAL_SUPPLY });
|
|
773
|
+
|
|
774
|
+
const isBrokerMinter = await gd.isMinter(release.MentoBroker);
|
|
775
|
+
const isExpansionMinter = await gd.isMinter(release.MentoExpansionController);
|
|
776
|
+
const mentoExchange = await ethers.getContractAt("IBancorExchangeProvider", release.MentoExchangeProvider);
|
|
777
|
+
const mentoBroker = (await ethers.getContractAt("IBroker", release.MentoBroker)) as IBroker;
|
|
778
|
+
const eids = await mentoExchange.getExchangeIds();
|
|
779
|
+
const exchange = await mentoExchange.getPoolExchange(eids[0]);
|
|
780
|
+
const price = (await mentoExchange.currentPrice(eids[0])) / 1e18;
|
|
781
|
+
console.log("current price:", price);
|
|
782
|
+
console.log("Exchange:", exchange, eids[0]);
|
|
783
|
+
|
|
784
|
+
console.log("Broker minter check:", isBrokerMinter ? "Success" : "Failed");
|
|
785
|
+
console.log("Expansion minter check:", isExpansionMinter ? "Success" : "Failed");
|
|
786
|
+
|
|
787
|
+
console.log("balance before swap:", await gd.balanceOf(swapper.address), await cusd.balanceOf(swapper.address));
|
|
788
|
+
await cusd.connect(swapper).approve(release.MentoBroker, ethers.utils.parseEther("1000"));
|
|
789
|
+
await mentoBroker
|
|
790
|
+
.connect(swapper)
|
|
791
|
+
.swapIn(mentoExchange.address, eids[0], cusd.address, gd.address, ethers.utils.parseEther("1000"), 0)
|
|
792
|
+
.then(_ => _.wait());
|
|
793
|
+
console.log(
|
|
794
|
+
"Balance after swap:",
|
|
795
|
+
swapper.address,
|
|
796
|
+
await gd.balanceOf(swapper.address),
|
|
797
|
+
await cusd.balanceOf(swapper.address)
|
|
798
|
+
);
|
|
799
|
+
const mentomint = (await ethers.getContractAt(
|
|
800
|
+
"IGoodDollarExpansionController",
|
|
801
|
+
release.MentoExpansionController
|
|
802
|
+
)) as IGoodDollarExpansionController;
|
|
803
|
+
await cusd.connect(swapper).approve(mentomint.address, ethers.utils.parseEther("1000"));
|
|
804
|
+
const tx = await (
|
|
805
|
+
await mentomint.connect(swapper).mintUBIFromInterest(eids[0], ethers.utils.parseEther("1000"))
|
|
806
|
+
).wait();
|
|
807
|
+
console.log(
|
|
808
|
+
"mint from interest:",
|
|
809
|
+
tx.events.find(_ => _.event === "InterestUBIMinted").args.amount.toString() / 1e18
|
|
810
|
+
);
|
|
811
|
+
console.log("price after interest mint:", (await mentoExchange.currentPrice(eids[0])) / 1e18);
|
|
812
|
+
const distTx = await (await distHelper.onDistribution(0, { gasLimit: 2000000 })).wait();
|
|
813
|
+
const { distributionRecipients, distributed } = distTx.events.find(_ => _.event === "Distribution").args;
|
|
814
|
+
console.log("Distribution events:", distributionRecipients, distributed, distTx.events.length);
|
|
815
|
+
const bridgeBalance = await gd.balanceOf("0xa3247276DbCC76Dd7705273f766eB3E8a5ecF4a5");
|
|
816
|
+
console.log("Brigde balance should equal other chains total supply:", {
|
|
817
|
+
bridgeBalance,
|
|
818
|
+
isEqual: bridgeBalance.eq(TOTAL_GLOBAL_SUPPLY.sub(TOTAL_SUPPLY_CELO))
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
};
|
|
822
|
+
|
|
823
|
+
export const main = async () => {
|
|
824
|
+
prompt.start();
|
|
825
|
+
const { network } = await prompt.get(["network"]);
|
|
826
|
+
|
|
827
|
+
console.log("running step:", { network });
|
|
828
|
+
const chain = last(network.split("-"));
|
|
829
|
+
switch (chain) {
|
|
830
|
+
case "mainnet":
|
|
831
|
+
await upgradeMainnet(network, true);
|
|
832
|
+
|
|
833
|
+
break;
|
|
834
|
+
case "fuse":
|
|
835
|
+
await upgradeFuse(network);
|
|
836
|
+
|
|
837
|
+
break;
|
|
838
|
+
case "celo":
|
|
839
|
+
await upgradeCelo(network, true);
|
|
840
|
+
|
|
841
|
+
break;
|
|
842
|
+
}
|
|
843
|
+
};
|
|
844
|
+
|
|
845
|
+
main().catch(console.log);
|