@gooddollar/goodprotocol 2.1.3 → 2.2.0-beta.1
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/README.md +0 -2
- package/artifacts/abis/IdentityV4.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/IUniswapV3.sol/INonfungiblePositionManager.dbg.json +1 -1
- package/artifacts/contracts/IUniswapV3.sol/IUniswapV3Pool.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 +1 -1
- package/artifacts/contracts/MentoInterfaces.sol/IBroker.dbg.json +1 -1
- package/artifacts/contracts/MentoInterfaces.sol/IGoodDollarExchangeProvider.dbg.json +1 -1
- package/artifacts/contracts/MentoInterfaces.sol/IGoodDollarExpansionController.dbg.json +1 -1
- package/artifacts/contracts/MentoInterfaces.sol/IMentoReserve.dbg.json +1 -1
- package/artifacts/contracts/MentoInterfaces.sol/ITradingLimits.dbg.json +1 -1
- 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/GoodDollarStaking.json +2 -2
- package/artifacts/contracts/governance/GoodDollarStaking.sol/IGovernanceStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/IStakingUpgrade.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.dbg.json +1 -1
- package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/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/identity/IdentityV2.sol/IdentityV2.dbg.json +1 -1
- package/artifacts/contracts/identity/IdentityV3.sol/IdentityV3.dbg.json +1 -1
- package/artifacts/contracts/identity/IdentityV3.sol/IdentityV3.json +2 -2
- package/artifacts/contracts/identity/IdentityV4.sol/IdentityV4.dbg.json +4 -0
- package/artifacts/contracts/identity/IdentityV4.sol/IdentityV4.json +1162 -0
- 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 +1 -1
- package/artifacts/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTestHelper.dbg.json +1 -1
- package/artifacts/contracts/mocks/CompUsdMockOracle.sol/CompUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DaiEthPriceMockOracle.sol/DaiEthPriceMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.json +2 -2
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +1 -1
- 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/GenericDistributionHelperTest.sol/GenericDistributionHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTestHelper.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.json +2 -2
- package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/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/MultichainRouterMock.sol/MultichainRouterMock.json +2 -2
- package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
- 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/StakingMockFixedAPY.sol/StakingMockFixedAPY.json +2 -2
- 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 +1 -1
- package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/GenericDistributionHelper.sol/GenericDistributionHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
- 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/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/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/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/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.dbg.json +1 -1
- 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/GoodDollar2.sol/GoodDollar2.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/BulkWhitelist.sol/BulkWhitelist.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyAndBridgeHelper.sol/BuyAndBridgeHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyFromReserveHelper.sol/BuyFromReserveHelper.dbg.json +1 -1
- 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 +1 -1
- package/artifacts/contracts/utils/ProtoclUpgradeV4Mento.sol/ProtocolUpgradeV4Mento.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgrade.sol/OldMarketMaker.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.dbg.json +1 -1
- package/artifacts/contracts/utils/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/identity/IdentityV3.sol +0 -3
- package/contracts/identity/IdentityV4.sol +578 -0
- package/hardhat.config.ts +3 -4
- package/package.json +8 -4
- package/test/governance/ClaimersDistribution.test.ts +1 -1
- package/test/governance/CompoundVotingMachine.castvote.test.ts +30 -30
- package/test/helpers.ts +76 -195
- package/test/identity/IdentityV3.test.ts +53 -129
- package/test/identity/IdentityV4.test.ts +454 -0
- package/test/reserve/GenericDistributionHelper.e2e.test.ts +445 -0
- package/test/utils/AdminWallet.test.ts +14 -15
- package/types/contracts/identity/IdentityV4.ts +2001 -0
- package/types/contracts/identity/index.ts +1 -0
- package/types/contracts/utils/UpdateReserveRatio.sol/MentoExchange.ts +81 -0
- package/types/contracts/utils/UpdateReserveRatio.sol/UpdateReserveRatio.ts +134 -0
- package/types/contracts/utils/UpdateReserveRatio.sol/index.ts +5 -0
- package/types/contracts/utils/UpdateReserveRatioAfterXDC.sol/UpdateReserveRatioAfterXDC.ts +7 -2
- package/types/contracts/utils/index.ts +2 -2
- package/types/factories/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking__factory.ts +1 -1
- package/types/factories/contracts/identity/IdentityV3__factory.ts +1 -1
- package/types/factories/contracts/identity/IdentityV4__factory.ts +1213 -0
- package/types/factories/contracts/identity/index.ts +1 -0
- package/types/factories/contracts/mocks/DistributionBridgeMock__factory.ts +1 -1
- package/types/factories/contracts/mocks/GoodDollarStakingMock__factory.ts +1 -1
- package/types/factories/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock__factory.ts +1 -1
- package/types/factories/contracts/mocks/StakingMockFixedAPY__factory.ts +1 -1
- package/types/factories/contracts/utils/LastauthReduction__factory.ts +1 -1
- package/types/factories/contracts/utils/ReserveRestore__factory.ts +1 -1
- package/types/factories/contracts/utils/UpdateReserveRatio.sol/MentoExchange__factory.ts +39 -0
- package/types/factories/contracts/utils/UpdateReserveRatio.sol/UpdateReserveRatio__factory.ts +113 -0
- package/types/factories/contracts/utils/UpdateReserveRatio.sol/index.ts +5 -0
- package/types/factories/contracts/utils/UpdateReserveRatioAfterXDC.sol/UpdateReserveRatioAfterXDC__factory.ts +9 -15
- package/types/factories/contracts/utils/index.ts +1 -1
- package/types/hardhat.d.ts +13 -4
- package/types/index.ts +4 -2
- package/scripts/ProxyFactory.json +0 -4425
- package/scripts/analytics/activeGDStakers.ts +0 -188
- package/scripts/analytics/activeStakers.ts +0 -25
- package/scripts/analytics/activeUsersCount.ts +0 -156
- package/scripts/analytics/activeWalletsStats.ts +0 -301
- package/scripts/analytics/checkActiveWallets.ts +0 -60
- package/scripts/analytics/checkBridgeBalances.ts +0 -442
- package/scripts/analytics/claimIncidentStats.ts +0 -98
- package/scripts/analytics/faucetStats.ts +0 -130
- package/scripts/analytics/gdinflow.ts +0 -57
- package/scripts/analytics/goodHolders.ts +0 -46
- package/scripts/analytics/goodgiveback.ts +0 -64
- package/scripts/analytics/p2pTxs.ts +0 -564
- package/scripts/analytics/stuckgd.ts +0 -70
- package/scripts/analytics/tokenInOutStats.ts +0 -48
- package/scripts/analytics/whitelistsyncIssue.ts +0 -87
- package/scripts/bulkProof.ts +0 -202
- package/scripts/bulkWhitelist.ts +0 -31
- package/scripts/deployGnosisSafe.ts +0 -111
- package/scripts/fetchOrDeployProxyFactory.ts +0 -46
- package/scripts/fv.ts +0 -263
- package/scripts/gdx/gdxAirdropCalculation.ts +0 -479
- package/scripts/getFounders.ts +0 -32
- package/scripts/governance/README.md +0 -70
- package/scripts/governance/airdropCalculation.ts +0 -1119
- package/scripts/governance/airdropCalculationRecover.ts +0 -416
- package/scripts/governance/airdropCalculationSorted.ts +0 -438
- package/scripts/governance/goodCheckpointSorted.ts +0 -300
- package/scripts/keeper/fishInactive.ts +0 -47
- package/scripts/minimize.sh +0 -17
- package/scripts/multichain-deploy/0_proxyFactory-deploy.ts +0 -131
- package/scripts/multichain-deploy/1_basicdao-deploy.ts +0 -294
- package/scripts/multichain-deploy/2_helpers-deploy.ts +0 -152
- package/scripts/multichain-deploy/2b_otp-deploy.ts +0 -73
- package/scripts/multichain-deploy/3_gdSavings-deploy.ts +0 -190
- package/scripts/multichain-deploy/4_ubi-deploy.ts +0 -129
- package/scripts/multichain-deploy/5_gov-deploy.ts +0 -179
- package/scripts/multichain-deploy/6_testnetFaucet.ts +0 -85
- package/scripts/multichain-deploy/7_superfluidfaucet-deploy.ts +0 -123
- package/scripts/multichain-deploy/8_disthelper-deploy.ts +0 -152
- package/scripts/multichain-deploy/createUniswapTestPools.ts +0 -163
- package/scripts/multichain-deploy/flattened/Avatar.sol +0 -913
- package/scripts/multichain-deploy/flattened/Controller.sol +0 -1891
- package/scripts/multichain-deploy/flattened/FeeFormula.sol +0 -1290
- package/scripts/multichain-deploy/fulldeploy.sh +0 -26
- package/scripts/multichain-deploy/helpers.ts +0 -647
- package/scripts/multichain-deploy/multichainWrapper-deploy.ts +0 -59
- package/scripts/multichain-deploy/verifyEtherscan.ts +0 -177
- package/scripts/proposals/gip-14_1.ts +0 -251
- package/scripts/proposals/gip-15.ts +0 -427
- package/scripts/proposals/gip-25-xdc-upgrade-ubi.ts +0 -746
- package/scripts/proposals/gips-14_1.md +0 -29
- package/scripts/proposals/hack-ubi-recovery.ts +0 -414
- package/scripts/proposals/identityAuthPeriod.ts +0 -229
- package/scripts/proposals/reserveRestore.ts +0 -474
- package/scripts/proposals/updateDistHelper.ts +0 -180
- package/scripts/proposals/v4Upgrade.ts +0 -845
- package/scripts/releaser.js +0 -24
- package/scripts/staking/stakersGdRewardsCalculation.ts +0 -64
- package/scripts/upgradeScheme.ts +0 -97
- package/scripts/upgradeToV2/upgradeToV2.ts +0 -853
- package/scripts/upgradeToV2/upgradeToV2Recover.ts +0 -939
- package/scripts/upgradeToV3/v3-fix.ts +0 -120
- package/scripts/upgradeToV3/v3-fuse-multichain.ts +0 -117
- package/scripts/upgradeToV3/v3-upgrade.ts +0 -219
- package/scripts/upgrades/celo-defi-ubi-deploy.ts +0 -184
- package/scripts/upgrades/identity-upgrade.ts +0 -126
- package/scripts/upgrades/multichain-formula-upgrade.ts +0 -143
- package/scripts/upgrades/multichain-temp-fix.ts +0 -129
- package/scripts/upgrades/restoreFunds.ts +0 -91
- package/scripts/upgrades/superfluid-nft-celo-gas-token.ts +0 -159
- package/scripts/upgrades/transferDaoToGuardians.ts +0 -80
- package/scripts/upgrades/upgradeAdminWallet.ts +0 -29
- package/scripts/upgrades/upgradeFaucet.ts +0 -46
- package/scripts/utils.ts +0 -50
- package/scripts/verify.ts +0 -67
- package/scripts/voltageswaps.ts +0 -46
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
#run with source .env && ./scripts/multichain-deploy/fulldeploy.sh
|
|
2
|
-
NETWORK=$1
|
|
3
|
-
npx hardhat run ./scripts/multichain-deploy/0_proxyFactory-deploy.ts --network $NETWORK
|
|
4
|
-
if [ $? != 0 ]; then
|
|
5
|
-
exit 1;
|
|
6
|
-
fi
|
|
7
|
-
npx hardhat run ./scripts/multichain-deploy/1_basicdao-deploy.ts --network $NETWORK
|
|
8
|
-
if [ $? != 0 ]; then
|
|
9
|
-
exit 1;
|
|
10
|
-
fi
|
|
11
|
-
npx hardhat run ./scripts/multichain-deploy/2_helpers-deploy.ts --network $NETWORK
|
|
12
|
-
if [ $? != 0 ]; then
|
|
13
|
-
exit 1;
|
|
14
|
-
fi
|
|
15
|
-
npx hardhat run ./scripts/multichain-deploy/3_gdSavings-deploy.ts --network $NETWORK
|
|
16
|
-
if [ $? != 0 ]; then
|
|
17
|
-
exit 1;
|
|
18
|
-
fi
|
|
19
|
-
npx hardhat run ./scripts/multichain-deploy/4_ubi-deploy.ts --network $NETWORK
|
|
20
|
-
if [ $? != 0 ]; then
|
|
21
|
-
exit 1;
|
|
22
|
-
fi
|
|
23
|
-
npx hardhat run ./scripts/multichain-deploy/5_gov-deploy.ts --network $NETWORK
|
|
24
|
-
if [ $? != 0 ]; then
|
|
25
|
-
exit 1;
|
|
26
|
-
fi
|
|
@@ -1,647 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "fs";
|
|
2
|
-
import { Contract, ContractFactory, Signer } from "ethers";
|
|
3
|
-
import { network, ethers } from "hardhat";
|
|
4
|
-
import { TransactionResponse, TransactionReceipt } from "@ethersproject/providers";
|
|
5
|
-
import { getImplementationAddress } from "@openzeppelin/upgrades-core";
|
|
6
|
-
|
|
7
|
-
import SafeApiKit from "@safe-global/api-kit";
|
|
8
|
-
import Safe, { SafeTransactionOptionalProps } from "@safe-global/protocol-kit";
|
|
9
|
-
import { MetaTransactionData } from "@safe-global/types-kit";
|
|
10
|
-
|
|
11
|
-
import util from "util";
|
|
12
|
-
import dao from "../../releases/deployment.json";
|
|
13
|
-
import { ProxyFactory1967 } from "../../types";
|
|
14
|
-
|
|
15
|
-
const exec = util.promisify(require("child_process").exec);
|
|
16
|
-
|
|
17
|
-
const networkName = network.name;
|
|
18
|
-
let totalGas = 0;
|
|
19
|
-
const gasUsage = {};
|
|
20
|
-
const GAS_SETTINGS = { gasLimit: 10000000 };
|
|
21
|
-
let release: { [key: string]: any } = dao[networkName];
|
|
22
|
-
|
|
23
|
-
export const verifyProductionSigner = signer => {
|
|
24
|
-
if (signer.address.toLowerCase() !== "0x5128E3C1f8846724cc1007Af9b4189713922E4BB".toLowerCase()) {
|
|
25
|
-
throw new Error(
|
|
26
|
-
"signer not 0x5128E3C1f8846724cc1007Af9b4189713922E4BB to get same deployed addresses on production"
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
export const printDeploy = async (
|
|
31
|
-
c: Contract | TransactionResponse
|
|
32
|
-
): Promise<Contract | TransactionReceipt | TransactionResponse> => {
|
|
33
|
-
if (c instanceof Contract) {
|
|
34
|
-
await c.deployed();
|
|
35
|
-
console.log("deployed to: ", c.address);
|
|
36
|
-
return c.deployed();
|
|
37
|
-
}
|
|
38
|
-
if (c.wait) {
|
|
39
|
-
await c.wait();
|
|
40
|
-
console.log("tx done:", c.hash);
|
|
41
|
-
return c.wait();
|
|
42
|
-
}
|
|
43
|
-
return c;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const countTotalGas = async (tx, name) => {
|
|
47
|
-
let res = tx;
|
|
48
|
-
if (tx.deployTransaction) tx = tx.deployTransaction;
|
|
49
|
-
if (tx.wait) res = await tx.wait();
|
|
50
|
-
if (res.gasUsed) {
|
|
51
|
-
totalGas += parseInt(res.gasUsed);
|
|
52
|
-
gasUsage[name] = gasUsage[name] || 0;
|
|
53
|
-
gasUsage[name] += parseInt(res.gasUsed);
|
|
54
|
-
} else console.log("no gas data", { res, tx });
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export const deploySuperGoodDollar = async (
|
|
58
|
-
{ superfluidHost, superfluidInflowNFTLogic, superfluidOutflowNFTLogic },
|
|
59
|
-
tokenArgs
|
|
60
|
-
) => {
|
|
61
|
-
const withNFTs = !!(superfluidInflowNFTLogic && superfluidOutflowNFTLogic);
|
|
62
|
-
const SuperGoodDollar = (await deployDeterministic(
|
|
63
|
-
{
|
|
64
|
-
name: "SuperGoodDollar",
|
|
65
|
-
salt: "SuperGoodDollarLogic"
|
|
66
|
-
},
|
|
67
|
-
[superfluidHost]
|
|
68
|
-
).then(printDeploy)) as Contract;
|
|
69
|
-
|
|
70
|
-
console.log("supergoodollar logic deployed:", SuperGoodDollar.address);
|
|
71
|
-
const uupsFactory = await ethers.getContractFactory("UUPSProxy");
|
|
72
|
-
const GoodDollarProxy = (await deployDeterministic(
|
|
73
|
-
{
|
|
74
|
-
name: "SuperGoodDollar",
|
|
75
|
-
factory: uupsFactory
|
|
76
|
-
},
|
|
77
|
-
[]
|
|
78
|
-
).then(printDeploy)) as Contract;
|
|
79
|
-
console.log("supergoodollar proxy deployed:", GoodDollarProxy.address);
|
|
80
|
-
try {
|
|
81
|
-
await GoodDollarProxy.initializeProxy(SuperGoodDollar.address).then(printDeploy);
|
|
82
|
-
} catch (e) {
|
|
83
|
-
console.log("failed initialized supergd proxy. probably already was init");
|
|
84
|
-
}
|
|
85
|
-
console.log("supergoodollar proxy initialized:", GoodDollarProxy.address);
|
|
86
|
-
let OutFlowNFT = await ethers.getContractAt("ConstantOutflowNFT", ethers.constants.AddressZero);
|
|
87
|
-
let InFlowNFT = await ethers.getContractAt("ConstantOutflowNFT", ethers.constants.AddressZero);
|
|
88
|
-
|
|
89
|
-
if (withNFTs) {
|
|
90
|
-
OutFlowNFT = (await deployDeterministic(
|
|
91
|
-
{
|
|
92
|
-
name: "SuperGoodDollar OutflowNFT",
|
|
93
|
-
factory: uupsFactory
|
|
94
|
-
},
|
|
95
|
-
[]
|
|
96
|
-
).then(printDeploy)) as Contract;
|
|
97
|
-
|
|
98
|
-
InFlowNFT = (await deployDeterministic(
|
|
99
|
-
{
|
|
100
|
-
name: "SuperGoodDollar InflowNFT",
|
|
101
|
-
factory: uupsFactory
|
|
102
|
-
},
|
|
103
|
-
[]
|
|
104
|
-
).then(printDeploy)) as Contract;
|
|
105
|
-
|
|
106
|
-
console.log("initializing superfluid nfts proxies");
|
|
107
|
-
await OutFlowNFT.initializeProxy(superfluidOutflowNFTLogic);
|
|
108
|
-
await InFlowNFT.initializeProxy(superfluidInflowNFTLogic);
|
|
109
|
-
}
|
|
110
|
-
console.log("initializing supergooddollar");
|
|
111
|
-
try {
|
|
112
|
-
await SuperGoodDollar.attach(GoodDollarProxy.address)[
|
|
113
|
-
"initialize(string,string,uint256,address,address,address,address)"
|
|
114
|
-
](...tokenArgs);
|
|
115
|
-
} catch (e) {
|
|
116
|
-
console.log("failed initializing supergd. probably already was init");
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const GoodDollar = await ethers.getContractAt("ISuperGoodDollar", GoodDollarProxy.address);
|
|
120
|
-
|
|
121
|
-
if (withNFTs) {
|
|
122
|
-
const constantInflowNFT = await ethers.getContractAt("ConstantInflowNFT", InFlowNFT.address);
|
|
123
|
-
|
|
124
|
-
const constantOutflowNFT = await ethers.getContractAt("ConstantOutflowNFT", OutFlowNFT.address);
|
|
125
|
-
|
|
126
|
-
console.log("initializing inflow and outflow nfts");
|
|
127
|
-
await constantOutflowNFT
|
|
128
|
-
.attach(OutFlowNFT.address)
|
|
129
|
-
.initialize(
|
|
130
|
-
GoodDollarProxy.address,
|
|
131
|
-
(await GoodDollar.symbol()) + " Outflow NFT",
|
|
132
|
-
(await GoodDollar.symbol()) + " COF"
|
|
133
|
-
);
|
|
134
|
-
await constantInflowNFT
|
|
135
|
-
.attach(InFlowNFT.address)
|
|
136
|
-
.initialize(
|
|
137
|
-
GoodDollarProxy.address,
|
|
138
|
-
(await GoodDollar.symbol()) + " Inflow NFT",
|
|
139
|
-
(await GoodDollar.symbol()) + " CIF"
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
return GoodDollar;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
export const deployDeterministic = async (contract, args: any[], factoryOpts = {}, redeployProxyFactory = false) => {
|
|
146
|
-
try {
|
|
147
|
-
let proxyFactory: ProxyFactory1967;
|
|
148
|
-
if (networkName.startsWith("develop") && redeployProxyFactory) {
|
|
149
|
-
proxyFactory = (await (await ethers.getContractFactory("ProxyFactory1967")).deploy()) as ProxyFactory1967;
|
|
150
|
-
} else proxyFactory = (await ethers.getContractAt("ProxyFactory1967", release.ProxyFactory)) as ProxyFactory1967;
|
|
151
|
-
const Contract =
|
|
152
|
-
(contract.factory as ContractFactory) || (await ethers.getContractFactory(contract.name, factoryOpts));
|
|
153
|
-
|
|
154
|
-
const salt = ethers.BigNumber.from(
|
|
155
|
-
ethers.utils.keccak256(ethers.utils.toUtf8Bytes(contract.salt || contract.name))
|
|
156
|
-
);
|
|
157
|
-
|
|
158
|
-
if (contract.isUpgradeable === true) {
|
|
159
|
-
const proxyAddr = await proxyFactory["getDeploymentAddress(uint256,address)"](
|
|
160
|
-
salt,
|
|
161
|
-
await proxyFactory.signer.getAddress()
|
|
162
|
-
);
|
|
163
|
-
const code = await ethers.provider.getCode(proxyAddr);
|
|
164
|
-
if (code && code !== "0x") {
|
|
165
|
-
const implAddr = await getImplementationAddress(ethers.provider, proxyAddr).catch(e => "0x");
|
|
166
|
-
if (implAddr && implAddr !== "0x") {
|
|
167
|
-
console.log("proxy exists and impl set already:", contract.name, proxyAddr, implAddr);
|
|
168
|
-
return Contract.attach(proxyAddr);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
console.log("Deploying:", contract.name, "using proxyfactory", {
|
|
173
|
-
args,
|
|
174
|
-
proxyAddr,
|
|
175
|
-
proxyFactory: proxyFactory.address
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
const encoded = Contract.interface.encodeFunctionData(contract.initializer || "initialize", args);
|
|
179
|
-
const tx = await Contract.deploy(GAS_SETTINGS);
|
|
180
|
-
const impl = await tx.deployed();
|
|
181
|
-
console.log("implementation deployed:", contract.name, impl.address);
|
|
182
|
-
await countTotalGas(tx, contract.name);
|
|
183
|
-
let tx2;
|
|
184
|
-
try {
|
|
185
|
-
if (contract.withProxyFactory === false) {
|
|
186
|
-
console.log("deploying proxy without proxy factory", { salt, impl: impl.address, encoded });
|
|
187
|
-
const proxy = await ethers.getContractFactory("contracts/utils/ProxyFactory1967.sol:ERC1967Proxy");
|
|
188
|
-
tx2 = await proxyFactory.deployCode(salt, proxy.bytecode, GAS_SETTINGS);
|
|
189
|
-
await tx2.wait();
|
|
190
|
-
console.log("proxy deployed initializing...", contract.name, proxyAddr, tx2.hash);
|
|
191
|
-
tx2 = await proxy.attach(proxyAddr).initialize(impl.address, encoded);
|
|
192
|
-
console.log("proxy initialized:", contract.name, proxyAddr, tx2.hash);
|
|
193
|
-
} else {
|
|
194
|
-
console.log("deploying proxy with proxyfactory", { salt, impl: impl.address, encoded });
|
|
195
|
-
tx2 = await proxyFactory.deployProxy(salt, impl.address, encoded, GAS_SETTINGS);
|
|
196
|
-
}
|
|
197
|
-
await countTotalGas(tx2, contract.name);
|
|
198
|
-
const deployTx = await tx2.wait();
|
|
199
|
-
} catch (e) {
|
|
200
|
-
console.error("failed to deploy proxy, assuming it exists...", e);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
console.log("proxy deployed:", contract.name, proxyAddr);
|
|
204
|
-
return Contract.attach(proxyAddr);
|
|
205
|
-
} else {
|
|
206
|
-
const constructor = Contract.interface.encodeDeploy(args);
|
|
207
|
-
const bytecode = ethers.utils.solidityPack(["bytes", "bytes"], [Contract.bytecode, constructor]);
|
|
208
|
-
const proxyAddr = await proxyFactory["getDeploymentAddress(uint256,address,bytes32)"](
|
|
209
|
-
salt,
|
|
210
|
-
await proxyFactory.signer.getAddress(),
|
|
211
|
-
ethers.utils.keccak256(bytecode)
|
|
212
|
-
);
|
|
213
|
-
const code = await ethers.provider.getCode(proxyAddr);
|
|
214
|
-
if (code && code !== "0x") {
|
|
215
|
-
console.log("contract already exists:", contract.name, proxyAddr);
|
|
216
|
-
return Contract.attach(proxyAddr);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
console.log("Deploying:", contract.name, "using proxyfactory code", {
|
|
220
|
-
proxyFactory: proxyFactory.address,
|
|
221
|
-
args
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
const deployTx = await (await proxyFactory.deployCode(salt, bytecode, GAS_SETTINGS)).wait();
|
|
225
|
-
|
|
226
|
-
console.log("proxy deployed:", contract.name, proxyAddr);
|
|
227
|
-
|
|
228
|
-
return Contract.attach(proxyAddr);
|
|
229
|
-
}
|
|
230
|
-
} catch (e) {
|
|
231
|
-
console.log("Failed deploying contract:", { contract });
|
|
232
|
-
throw e;
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
export const upgradeDeterministicToNewImplViaGuardian = async (contract, factoryOpts = {}) => {
|
|
237
|
-
try {
|
|
238
|
-
let proxyFactory: ProxyFactory1967;
|
|
239
|
-
proxyFactory = (await ethers.getContractAt("ProxyFactory1967", release.ProxyFactory)) as ProxyFactory1967;
|
|
240
|
-
const Contract =
|
|
241
|
-
(contract.factory as ContractFactory) || (await ethers.getContractFactory(contract.name, factoryOpts));
|
|
242
|
-
|
|
243
|
-
const salt = ethers.BigNumber.from(
|
|
244
|
-
ethers.utils.keccak256(ethers.utils.toUtf8Bytes(contract.salt || contract.name))
|
|
245
|
-
);
|
|
246
|
-
|
|
247
|
-
if (contract.isUpgradeable === true) {
|
|
248
|
-
const proxyAddr = await proxyFactory["getDeploymentAddress(uint256,address)"](
|
|
249
|
-
salt,
|
|
250
|
-
await proxyFactory.signer.getAddress()
|
|
251
|
-
);
|
|
252
|
-
const code = await ethers.provider.getCode(proxyAddr);
|
|
253
|
-
if (code && code !== "0x") {
|
|
254
|
-
const implAddr = await getImplementationAddress(ethers.provider, proxyAddr).catch(e => "0x");
|
|
255
|
-
if (implAddr && implAddr !== "0x") {
|
|
256
|
-
console.log("proxy exists and impl set already:", contract.name, proxyAddr, implAddr);
|
|
257
|
-
console.log("Deploying:", contract.name, " implementation", {
|
|
258
|
-
proxyAddr
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
const tx = await Contract.deploy(GAS_SETTINGS);
|
|
262
|
-
const impl = await tx.deployed();
|
|
263
|
-
console.log("implementation deployed:", contract.name, impl.address);
|
|
264
|
-
await countTotalGas(tx, contract.name);
|
|
265
|
-
|
|
266
|
-
const proposalContracts = [release.DistributionHelper];
|
|
267
|
-
|
|
268
|
-
const proposalEthValues = proposalContracts.map(_ => 0);
|
|
269
|
-
|
|
270
|
-
const proposalFunctionSignatures = [
|
|
271
|
-
"upgradeTo(address)" //add ubischeme
|
|
272
|
-
];
|
|
273
|
-
|
|
274
|
-
const proposalFunctionInputs = [ethers.utils.defaultAbiCoder.encode(["address"], [impl.address])];
|
|
275
|
-
let [root] = await ethers.getSigners();
|
|
276
|
-
await executeViaGuardian(
|
|
277
|
-
proposalContracts,
|
|
278
|
-
proposalEthValues,
|
|
279
|
-
proposalFunctionSignatures,
|
|
280
|
-
proposalFunctionInputs,
|
|
281
|
-
root
|
|
282
|
-
);
|
|
283
|
-
|
|
284
|
-
console.log("proxy upgraded:", contract.name, { proxyAddr, implAddr: impl.address });
|
|
285
|
-
return Contract.attach(proxyAddr);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
} else {
|
|
289
|
-
console.log("This contract is not upgradeable");
|
|
290
|
-
}
|
|
291
|
-
} catch (e) {
|
|
292
|
-
console.log("Failed deploying contract:", { contract });
|
|
293
|
-
throw e;
|
|
294
|
-
}
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
export const executeViaGuardian = async (
|
|
298
|
-
contracts,
|
|
299
|
-
ethValues,
|
|
300
|
-
functionSigs,
|
|
301
|
-
functionInputs,
|
|
302
|
-
guardian: Signer,
|
|
303
|
-
network?: string
|
|
304
|
-
) => {
|
|
305
|
-
let release: { [key: string]: any } = dao[network || networkName];
|
|
306
|
-
const ctrl = await (await ethers.getContractAt("Controller", release.Controller)).connect(guardian);
|
|
307
|
-
|
|
308
|
-
const results = [];
|
|
309
|
-
for (let i = 0; i < contracts.length; i++) {
|
|
310
|
-
const contract = contracts[i];
|
|
311
|
-
if (!contract) {
|
|
312
|
-
console.warn("skipping executing missing contract", i, contracts[i], functionSigs[i], functionInputs[i]);
|
|
313
|
-
continue;
|
|
314
|
-
}
|
|
315
|
-
console.log("executing:", contracts[i], functionSigs[i], functionInputs[i]);
|
|
316
|
-
const sigHash = ethers.utils.keccak256(ethers.utils.toUtf8Bytes(functionSigs[i])).slice(0, 10);
|
|
317
|
-
const encoded = ethers.utils.solidityPack(["bytes4", "bytes"], [sigHash, functionInputs[i]]);
|
|
318
|
-
if (contract.toLowerCase().startsWith((await guardian.getAddress()).toLocaleLowerCase())) {
|
|
319
|
-
const [, target] = contract.split("_");
|
|
320
|
-
console.log("executing directly on target contract:", sigHash, encoded);
|
|
321
|
-
|
|
322
|
-
const tx = await guardian.sendTransaction({ to: target, data: encoded }).then(printDeploy);
|
|
323
|
-
results.push(tx);
|
|
324
|
-
} else if (contract === ctrl.address) {
|
|
325
|
-
console.log("executing directly on controller:", sigHash, encoded);
|
|
326
|
-
|
|
327
|
-
const tx = await guardian.sendTransaction({ to: contract, data: encoded }).then(printDeploy);
|
|
328
|
-
|
|
329
|
-
results.push(tx);
|
|
330
|
-
} else {
|
|
331
|
-
const simulationResult = await ctrl.callStatic.genericCall(contract, encoded, release.Avatar, ethValues[i], {
|
|
332
|
-
from: await guardian.getAddress()
|
|
333
|
-
});
|
|
334
|
-
console.log("executing genericCall:", {
|
|
335
|
-
sigHash,
|
|
336
|
-
contract,
|
|
337
|
-
encoded,
|
|
338
|
-
simulationResult
|
|
339
|
-
});
|
|
340
|
-
if (simulationResult[0] === false) throw new Error("simulation failed:" + contract);
|
|
341
|
-
const tx = await ctrl
|
|
342
|
-
.genericCall(contract, encoded, release.Avatar, ethValues[i], {
|
|
343
|
-
gasLimit: 8000000
|
|
344
|
-
})
|
|
345
|
-
.then(printDeploy);
|
|
346
|
-
// console.log("generic call events:", tx.events);
|
|
347
|
-
results.push(tx);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
return results;
|
|
351
|
-
};
|
|
352
|
-
|
|
353
|
-
export const executeViaSafe = async (
|
|
354
|
-
contracts,
|
|
355
|
-
ethValues,
|
|
356
|
-
functionSigs,
|
|
357
|
-
functionInputs,
|
|
358
|
-
safeAddress: string,
|
|
359
|
-
safeSignerOrNetwork?: Signer | string,
|
|
360
|
-
safeOptions: SafeTransactionOptionalProps = {},
|
|
361
|
-
isSimulation = false
|
|
362
|
-
) => {
|
|
363
|
-
if (typeof safeSignerOrNetwork !== "object" && !process.env.SAFEOWNER_PRIVATE_KEY) {
|
|
364
|
-
throw new Error("safe signer is missing");
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
// let safeSigner = new ethers.Wallet(
|
|
368
|
-
// process.env.SAFEOWNER_PRIVATE_KEY,
|
|
369
|
-
// new ethers.providers.JsonRpcProvider("https://rpc.flashbots.net")
|
|
370
|
-
// );
|
|
371
|
-
let chainId = 1;
|
|
372
|
-
let provider = "https://mainnet.gateway.tenderly.co";
|
|
373
|
-
if (typeof safeSignerOrNetwork === "string") {
|
|
374
|
-
switch (safeSignerOrNetwork) {
|
|
375
|
-
case "mainnet":
|
|
376
|
-
break;
|
|
377
|
-
case "celo":
|
|
378
|
-
chainId = 42220;
|
|
379
|
-
provider = "https://forno.celo.org";
|
|
380
|
-
// safeSigner = new ethers.Wallet(process.env.SAFEOWNER_PRIVATE_KEY).connect(
|
|
381
|
-
// new ethers.providers.JsonRpcProvider("https://forno.celo.org")
|
|
382
|
-
// );
|
|
383
|
-
break;
|
|
384
|
-
case "fuse":
|
|
385
|
-
chainId = 122;
|
|
386
|
-
provider = "https://rpc.fuse.io";
|
|
387
|
-
// safeSigner = new ethers.Wallet(process.env.SAFEOWNER_PRIVATE_KEY).connect(
|
|
388
|
-
// new ethers.providers.JsonRpcProvider("https://rpc.fuse.io")
|
|
389
|
-
// );
|
|
390
|
-
break;
|
|
391
|
-
case "xdc":
|
|
392
|
-
chainId = 50;
|
|
393
|
-
provider = "https://rpc.xdcrpc.com";
|
|
394
|
-
break;
|
|
395
|
-
}
|
|
396
|
-
} else if (safeSignerOrNetwork) {
|
|
397
|
-
// safeSigner = safeSignerOrNetwork as any;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
console.log("safeSigner:", { chainId, safeAddress });
|
|
401
|
-
let txServiceUrl;
|
|
402
|
-
switch (chainId) {
|
|
403
|
-
case 1:
|
|
404
|
-
// txServiceUrl = "https://safe-transaction-mainnet.safe.global";
|
|
405
|
-
break;
|
|
406
|
-
case 122:
|
|
407
|
-
txServiceUrl = "https://transaction-fuse.safe.fuse.io/api";
|
|
408
|
-
break;
|
|
409
|
-
case 42220:
|
|
410
|
-
// txServiceUrl = "https://safe-transaction-celo.safe.global";
|
|
411
|
-
break;
|
|
412
|
-
}
|
|
413
|
-
console.log("creating safe adapter", { txServiceUrl });
|
|
414
|
-
const safeService = new SafeApiKit({
|
|
415
|
-
chainId: BigInt(chainId),
|
|
416
|
-
txServiceUrl,
|
|
417
|
-
apiKey: process.env.SAFE_TX_SERVICE_API_KEY || ""
|
|
418
|
-
});
|
|
419
|
-
|
|
420
|
-
const safeSdk = await Safe.init({
|
|
421
|
-
provider,
|
|
422
|
-
signer: process.env.SAFEOWNER_PRIVATE_KEY,
|
|
423
|
-
safeAddress
|
|
424
|
-
});
|
|
425
|
-
|
|
426
|
-
const senderAddress = await safeSdk.getSafeProvider().getSignerAddress();
|
|
427
|
-
|
|
428
|
-
// console.log("creating safe client", { txServiceUrl });
|
|
429
|
-
|
|
430
|
-
// const safeService = new SafeClient({
|
|
431
|
-
// txServiceUrl,
|
|
432
|
-
// ethAdapter
|
|
433
|
-
// });
|
|
434
|
-
|
|
435
|
-
// const safeSdk = await Safe.create({ ethAdapter, safeAddress });
|
|
436
|
-
|
|
437
|
-
let release: { [key: string]: any } = dao[networkName];
|
|
438
|
-
const ctrl = await ethers.getContractAt("Controller", release.Controller, null);
|
|
439
|
-
|
|
440
|
-
const safeTransactionData: MetaTransactionData[] = [];
|
|
441
|
-
|
|
442
|
-
for (let i = 0; i < contracts.length; i++) {
|
|
443
|
-
const contract = contracts[i];
|
|
444
|
-
|
|
445
|
-
const sigHash = ethers.utils.keccak256(ethers.utils.toUtf8Bytes(functionSigs[i])).slice(0, 10);
|
|
446
|
-
console.log("creating tx:", contracts[i], functionSigs[i], functionInputs[i]);
|
|
447
|
-
const encoded = ethers.utils.solidityPack(["bytes4", "bytes"], [sigHash, functionInputs[i]]);
|
|
448
|
-
if (contract.toLowerCase().startsWith(safeAddress.toLocaleLowerCase())) {
|
|
449
|
-
const [, target] = contract.split("_");
|
|
450
|
-
const simulationResult = await ethers.provider.call({
|
|
451
|
-
to: target,
|
|
452
|
-
data: encoded,
|
|
453
|
-
from: safeAddress,
|
|
454
|
-
value: ethValues[i]
|
|
455
|
-
});
|
|
456
|
-
|
|
457
|
-
console.log("executing from guardians safe:", {
|
|
458
|
-
sigHash,
|
|
459
|
-
encoded,
|
|
460
|
-
simulationResult
|
|
461
|
-
});
|
|
462
|
-
safeTransactionData.push({
|
|
463
|
-
to: target,
|
|
464
|
-
value: ethValues[i],
|
|
465
|
-
data: encoded
|
|
466
|
-
});
|
|
467
|
-
} else if (contract === ctrl.address) {
|
|
468
|
-
const simulationResult = await ethers.provider.call({
|
|
469
|
-
to: ctrl.address,
|
|
470
|
-
data: encoded,
|
|
471
|
-
from: safeAddress,
|
|
472
|
-
value: ethValues[i]
|
|
473
|
-
});
|
|
474
|
-
console.log("executing controller call:", {
|
|
475
|
-
sigHash,
|
|
476
|
-
encoded,
|
|
477
|
-
simulationResult
|
|
478
|
-
});
|
|
479
|
-
safeTransactionData.push({
|
|
480
|
-
to: ctrl.address,
|
|
481
|
-
value: ethValues[i],
|
|
482
|
-
data: encoded
|
|
483
|
-
});
|
|
484
|
-
} else {
|
|
485
|
-
console.log("executing genericCall:", {
|
|
486
|
-
sigHash,
|
|
487
|
-
encoded,
|
|
488
|
-
contract,
|
|
489
|
-
avatar: release.Avatar,
|
|
490
|
-
value: ethValues[i]
|
|
491
|
-
});
|
|
492
|
-
|
|
493
|
-
const simulationResult = await ctrl.callStatic.genericCall(contract, encoded, release.Avatar, ethValues[i], {
|
|
494
|
-
from: safeAddress
|
|
495
|
-
});
|
|
496
|
-
console.log("executing genericCall simulation result:", {
|
|
497
|
-
sigHash,
|
|
498
|
-
simulationResult
|
|
499
|
-
});
|
|
500
|
-
if (isSimulation === true && simulationResult[0] === false) throw new Error("simulation failed:" + contract);
|
|
501
|
-
const genericEncode = ctrl.interface.encodeFunctionData("genericCall", [
|
|
502
|
-
contract,
|
|
503
|
-
encoded,
|
|
504
|
-
release.Avatar,
|
|
505
|
-
ethValues[i]
|
|
506
|
-
]);
|
|
507
|
-
safeTransactionData.push({
|
|
508
|
-
to: ctrl.address,
|
|
509
|
-
value: "0",
|
|
510
|
-
data: genericEncode
|
|
511
|
-
});
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
const safeTransaction = await safeSdk.createTransaction({
|
|
516
|
-
transactions: safeTransactionData
|
|
517
|
-
});
|
|
518
|
-
|
|
519
|
-
const safeTxHash = await safeSdk.getTransactionHash(safeTransaction);
|
|
520
|
-
const signedHash = await safeSdk.signHash(safeTxHash);
|
|
521
|
-
|
|
522
|
-
// const senderAddress = await safeSigner.getAddress();
|
|
523
|
-
console.log("propose safe transaction", {
|
|
524
|
-
safeAddress,
|
|
525
|
-
safeTransactionData: safeTransaction.data,
|
|
526
|
-
safeTxHash,
|
|
527
|
-
senderSignature: signedHash,
|
|
528
|
-
senderAddress
|
|
529
|
-
});
|
|
530
|
-
await safeService.proposeTransaction({
|
|
531
|
-
safeAddress,
|
|
532
|
-
safeTransactionData: safeTransaction.data,
|
|
533
|
-
safeTxHash,
|
|
534
|
-
senderSignature: signedHash.data,
|
|
535
|
-
senderAddress
|
|
536
|
-
});
|
|
537
|
-
};
|
|
538
|
-
|
|
539
|
-
export const verifyContract = async (
|
|
540
|
-
address,
|
|
541
|
-
contractPath,
|
|
542
|
-
networkName = network.name,
|
|
543
|
-
maybeProxy: boolean = true,
|
|
544
|
-
forcedConstructorArguments?: string
|
|
545
|
-
) => {
|
|
546
|
-
const impl = await getImplementationAddress(ethers.provider, address).catch(e => "");
|
|
547
|
-
const contractAddress = maybeProxy ? impl || address : address;
|
|
548
|
-
console.log("verifying contract:", { contractPath, address, impl, networkName, forcedConstructorArguments });
|
|
549
|
-
const cmd = `yarn hardhat verify --contract ${contractPath} ${contractAddress} ${
|
|
550
|
-
forcedConstructorArguments ?? ""
|
|
551
|
-
} --network ${networkName}`;
|
|
552
|
-
console.log("running...:", cmd);
|
|
553
|
-
await exec(cmd)
|
|
554
|
-
.then(({ stdout, stderr }) => {
|
|
555
|
-
console.log("Result for:", cmd);
|
|
556
|
-
console.log(stdout);
|
|
557
|
-
console.log(stderr);
|
|
558
|
-
})
|
|
559
|
-
.catch(e => {
|
|
560
|
-
console.error("Error verifying contract:", e);
|
|
561
|
-
});
|
|
562
|
-
if (maybeProxy && impl) {
|
|
563
|
-
const chainid = network.config.chainId.toString();
|
|
564
|
-
console.log("linking proxy to impl", { impl, address });
|
|
565
|
-
const body = new URLSearchParams({
|
|
566
|
-
chaini: network.config.chainId.toString(),
|
|
567
|
-
apikey: process.env.ETHERSCAN_KEY,
|
|
568
|
-
module: "contract",
|
|
569
|
-
action: "verifyproxycontract",
|
|
570
|
-
address
|
|
571
|
-
});
|
|
572
|
-
|
|
573
|
-
const response = await fetch(`https://api.etherscan.io/v2/api?chainid=${chainid}`, {
|
|
574
|
-
method: "POST",
|
|
575
|
-
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
576
|
-
body
|
|
577
|
-
});
|
|
578
|
-
|
|
579
|
-
const data = await response.json();
|
|
580
|
-
if (data.status !== "1") {
|
|
581
|
-
return console.log(`Proxy Verification submission failed: ${data.result}`);
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
const guid = data.result;
|
|
585
|
-
console.log(`Proxy Verification submitted. GUID: ${guid}`);
|
|
586
|
-
}
|
|
587
|
-
};
|
|
588
|
-
|
|
589
|
-
/**
|
|
590
|
-
* Verify a flattened contract on Etherscan
|
|
591
|
-
* @param {string} contractPath - Path to the contract (e.g., contracts/MyContract.sol)
|
|
592
|
-
* @param {string} contractName - Contract name (e.g., MyContract)
|
|
593
|
-
* @param {string} contractAddress - Deployed contract address
|
|
594
|
-
* @param {string} compilerVersion - Compiler version (e.g., v0.8.24+commit.e11b9ed9)
|
|
595
|
-
* @param {Array} constructorArgs - Object with {types:[], values:[]} for encoding
|
|
596
|
-
*/
|
|
597
|
-
export async function verifyOnEtherscan(
|
|
598
|
-
chainid,
|
|
599
|
-
contractPath,
|
|
600
|
-
contractName,
|
|
601
|
-
contractAddress,
|
|
602
|
-
compilerVersion,
|
|
603
|
-
constructorArgs = { types: [], values: [] }
|
|
604
|
-
) {
|
|
605
|
-
const apiKey = process.env.ETHERSCAN_KEY;
|
|
606
|
-
if (!apiKey) {
|
|
607
|
-
throw new Error("ETHERSCAN_API_KEY not set in .env");
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
const sourceCode = readFileSync(contractPath, "utf8");
|
|
611
|
-
|
|
612
|
-
let constructorEncoded = "";
|
|
613
|
-
if (constructorArgs.types && constructorArgs.values) {
|
|
614
|
-
constructorEncoded = ethers.utils.defaultAbiCoder.encode(constructorArgs.types, constructorArgs.values).slice(2); // Remove '0x'
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
console.log("Submitting verification request to Etherscan...", { chainid, contractAddress, contractName });
|
|
618
|
-
|
|
619
|
-
const body = new URLSearchParams({
|
|
620
|
-
chainid,
|
|
621
|
-
apikey: apiKey,
|
|
622
|
-
module: "contract",
|
|
623
|
-
action: "verifysourcecode",
|
|
624
|
-
contractaddress: contractAddress,
|
|
625
|
-
sourceCode: sourceCode,
|
|
626
|
-
codeformat: "solidity-single-file",
|
|
627
|
-
contractname: contractName,
|
|
628
|
-
compilerversion: compilerVersion,
|
|
629
|
-
optimizationUsed: "1",
|
|
630
|
-
runs: "200",
|
|
631
|
-
constructorArguements: constructorEncoded
|
|
632
|
-
});
|
|
633
|
-
|
|
634
|
-
const response = await fetch(`https://api.etherscan.io/v2/api?chainid=${chainid}`, {
|
|
635
|
-
method: "POST",
|
|
636
|
-
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
637
|
-
body
|
|
638
|
-
});
|
|
639
|
-
|
|
640
|
-
const data = await response.json();
|
|
641
|
-
if (data.status !== "1") {
|
|
642
|
-
return console.log(`Verification submission failed: ${data.result}`);
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
const guid = data.result;
|
|
646
|
-
console.log(`Verification submitted. GUID: ${guid}`);
|
|
647
|
-
}
|