@gooddollar/goodprotocol 1.0.28 → 1.0.29-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/artifacts/abis/BulkProof.min.json +1 -1
- package/artifacts/abis/DistributionBridgeMock.min.json +1 -0
- package/artifacts/abis/DistributionHelper.min.json +1 -0
- package/artifacts/abis/DistributionHelperTest.min.json +1 -0
- package/artifacts/abis/DistributionHelperTestHelper.min.json +1 -0
- package/artifacts/abis/ERC20.min.json +1 -1
- package/artifacts/abis/GoodDollarMintBurnWrapper.min.json +1 -0
- package/artifacts/abis/GoodDollarStaking.min.json +1 -0
- package/artifacts/abis/GoodDollarStakingMock.min.json +1 -0
- package/artifacts/abis/GoodReserveCDai.min.json +1 -1
- package/artifacts/abis/IERC2917.min.json +1 -1
- package/artifacts/abis/IGoodDollarStakingTest.min.json +1 -0
- package/artifacts/abis/IMultichainRouter.min.json +1 -0
- package/artifacts/abis/IRouter.min.json +1 -0
- package/artifacts/abis/IWrapper.min.json +1 -0
- package/artifacts/abis/Math64x64.min.json +1 -0
- package/artifacts/abis/MultichainBridgeHelper.min.json +1 -0
- package/artifacts/abis/MultichainRouterMock.min.json +1 -0
- package/artifacts/abis/OverMintTester.min.json +1 -1
- package/artifacts/abis/PausableControl.min.json +1 -0
- package/artifacts/abis/RewardsMinter.min.json +1 -0
- package/artifacts/abis/StakingMockFixedAPY.min.json +1 -0
- package/artifacts/abis/StakingRewardsFixedAPY.min.json +1 -0
- package/artifacts/abis/TokenOperation.min.json +1 -0
- package/artifacts/abis/cERC20.min.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/Avatar.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/Controller.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/GlobalConstraintInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/IntVoteInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/ReputationInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/SchemeRegistrar.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/AggregatorV3Interface.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ERC20.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ERC20.json +13 -0
- package/artifacts/contracts/Interfaces.sol/IAaveIncentivesController.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IAdminWallet.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IDonationStaking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IERC2917.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IERC2917.json +13 -0
- package/artifacts/contracts/Interfaces.sol/IFirstClaimPool.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IGoodDollar.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/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/ILendingPool.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IMultichainRouter.dbg.json +4 -0
- package/artifacts/contracts/Interfaces.sol/IMultichainRouter.json +67 -0
- package/artifacts/contracts/Interfaces.sol/INameService.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IUBIScheme.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ProxyAdmin.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Reserve.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Uniswap.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/UniswapFactory.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/UniswapPair.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/cERC20.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/cERC20.json +13 -0
- package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.json +2 -2
- package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
- package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.json +2 -2
- package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
- package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.json +2 -2
- package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
- package/artifacts/contracts/governance/GReputation.sol/GReputation.json +2 -2
- package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.dbg.json +4 -0
- package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.json +1322 -0
- package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.dbg.json +4 -0
- package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.json +35 -0
- package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.json +2 -2
- package/artifacts/contracts/governance/MultiBaseGovernanceShareField.sol/MultiBaseGovernanceShareField.dbg.json +1 -1
- package/artifacts/contracts/governance/Reputation.sol/Reputation.dbg.json +1 -1
- package/artifacts/contracts/governance/Reputation.sol/Reputation.json +2 -2
- package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
- package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.json +2 -2
- package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.json +2 -2
- package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.dbg.json +4 -0
- package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.json +152 -0
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +4 -0
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.json +662 -0
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +4 -0
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.json +680 -0
- package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.json +2 -2
- package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.dbg.json +4 -0
- package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.json +1322 -0
- package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.json +2 -2
- package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/IWrapper.dbg.json +4 -0
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/IWrapper.json +59 -0
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.dbg.json +4 -0
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.json +81 -0
- package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.dbg.json +4 -0
- package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.json +49 -0
- package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.json +4 -4
- package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.json +2 -2
- package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.dbg.json +4 -0
- package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.json +682 -0
- package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.json +2 -2
- package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.json +2 -2
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.json +2 -2
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.json +2 -2
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.json +2 -2
- package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
- package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.dbg.json +4 -0
- package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.json +662 -0
- package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.json +2 -2
- package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.json +2 -2
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/ContributionCalc.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.json +75 -35
- package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
- package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.json +2 -2
- package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.dbg.json +1 -1
- package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.json +2 -2
- package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.json +2 -2
- package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.dbg.json +1 -1
- package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.json +2 -2
- package/artifacts/contracts/staking/FuseStakingV3.sol/IConsensus.dbg.json +1 -1
- package/artifacts/contracts/staking/FuseStakingV3.sol/PegSwap.dbg.json +1 -1
- package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.dbg.json +1 -1
- package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.json +2 -2
- package/artifacts/contracts/staking/SimpleStaking.sol/SimpleStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/SimpleStakingV2.sol/SimpleStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.dbg.json +1 -1
- package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.json +2 -2
- package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.json +2 -2
- package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.json +2 -2
- package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.json +2 -2
- package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.json +2 -2
- package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.json +2 -2
- package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.json +2 -2
- package/artifacts/contracts/staking/utils/Math64X64.sol/Math64x64.dbg.json +4 -0
- package/artifacts/contracts/staking/utils/Math64X64.sol/Math64x64.json +10 -0
- package/artifacts/contracts/staking/utils/StakingRewardsFixedAPY.sol/StakingRewardsFixedAPY.dbg.json +4 -0
- package/artifacts/contracts/staking/utils/StakingRewardsFixedAPY.sol/StakingRewardsFixedAPY.json +268 -0
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.json +2 -2
- package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
- package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.json +2 -2
- package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
- package/artifacts/contracts/utils/BulkProof.sol/BulkProof.dbg.json +1 -1
- package/artifacts/contracts/utils/BulkProof.sol/BulkProof.json +3 -34
- package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOContract.sol/DAOContract.json +2 -2
- package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.json +2 -2
- package/artifacts/contracts/utils/DSMath.sol/DSMath.dbg.json +1 -1
- package/artifacts/contracts/utils/DataTypes.sol/DataTypes.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.dbg.json +4 -0
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.json +1263 -0
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/IRouter.dbg.json +4 -0
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/IRouter.json +59 -0
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/PausableControl.dbg.json +4 -0
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/PausableControl.json +69 -0
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.dbg.json +4 -0
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.json +10 -0
- package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.dbg.json +4 -0
- package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.json +79 -0
- package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgrade.sol/OldMarketMaker.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.json +2 -2
- package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.json +2 -2
- package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.json +2 -2
- package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.json +2 -2
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.dbg.json +1 -1
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.dbg.json +1 -1
- package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.json +2 -2
- package/contracts/Interfaces.sol +20 -0
- package/contracts/governance/GoodDollarStaking.sol +510 -0
- package/contracts/governance/MultiBaseGovernanceShareField.sol +1 -0
- package/contracts/mocks/DistributionBridgeMock.sol +50 -0
- package/contracts/mocks/DistributionHelperTest.sol +22 -0
- package/contracts/mocks/GoodDollarStakingMock.sol +24 -0
- package/contracts/mocks/MultichainRouterMock.sol +38 -0
- package/contracts/mocks/OverMintTester.sol +39 -25
- package/contracts/mocks/StakingMockFixedAPY.sol +78 -0
- package/contracts/reserve/DistributionHelper.sol +142 -0
- package/contracts/reserve/GoodReserveCDai.sol +95 -41
- package/contracts/staking/utils/Math64X64.sol +268 -0
- package/contracts/staking/utils/StakingRewardsFixedAPY.sol +336 -0
- package/contracts/utils/BulkProof.sol +10 -10
- package/contracts/utils/GoodDollarMintBurnWrapper.sol +638 -0
- package/contracts/utils/MultichainBridgeHelper.sol +39 -0
- package/hardhat.config.ts +5 -3
- package/package.json +7 -4
- package/patches/@openzeppelin+hardhat-upgrades+1.7.0.patch.depracate +67 -0
- package/releases/deployment.json +10 -3
- package/releases/olddao.json +1 -1
- package/scripts/analytics/activeUsersCount.ts +65 -0
- package/scripts/analytics/activeWalletsStats.ts +150 -0
- package/scripts/analytics/claimIncidentStats.ts +117 -0
- package/scripts/analytics/faucetStats.ts +103 -0
- package/scripts/analytics/goodHolders.ts +50 -0
- package/scripts/{misc → analytics}/goodgiveback.ts +0 -0
- package/scripts/governance/airdropCalculation.ts +1 -0
- package/scripts/multichain-deploy/basicdao-deploy.ts +20 -5
- package/scripts/multichain-deploy/gdSavings-deploy.ts +232 -0
- package/scripts/multichain-deploy/helpers.ts +73 -8
- package/scripts/multichain-deploy/multichainWrapper-deploy.ts +56 -0
- package/scripts/multichain-deploy/nonubiDistribution-deploy.ts +170 -0
- package/scripts/voltageswaps.ts +47 -0
- package/test/governance/ClaimersDistribution.test.ts +1 -1
- package/test/governance/GoodDollarStaking.gd.test.ts +559 -0
- package/test/governance/GoodDollarStaking.good.test.ts +998 -0
- package/test/governance/GovernanceStaking.test.ts +43 -0
- package/test/helpers.ts +9 -12
- package/test/reserve/DistributionHelper.test.ts +394 -0
- package/test/reserve/GoodReserveCDai.distribution.test.ts +296 -0
- package/test/reserve/GoodReserveCDai.gdx.test.ts +21 -16
- package/test/reserve/GoodReserveCDai.pause.test.ts +116 -0
- package/test/staking/StakingRewardsFixedAPY.test.ts +900 -0
- package/test/utils/AdminWallet.test.ts +35 -6
- package/test/utils/GoodDollarMintBurnWrapper.test.ts +796 -0
- package/tsconfig.json +4 -9
- package/types/AccessControl.ts +361 -0
- package/types/CERC20.ts +25 -0
- package/types/DistributionBridgeMock.ts +251 -0
- package/types/DistributionHelper.ts +908 -0
- package/types/DistributionHelperTest.ts +909 -0
- package/types/DistributionHelperTestHelper.ts +945 -0
- package/types/ERC165.ts +104 -0
- package/types/ERC20.ts +101 -49
- package/types/GoodDollarMintBurnWrapper.ts +1806 -0
- package/types/GoodDollarStaking.ts +1855 -0
- package/types/GoodDollarStakingMock.ts +1855 -0
- package/types/GoodReserveCDai.ts +90 -55
- package/types/IAccessControl.ts +306 -0
- package/types/IERC165.ts +104 -0
- package/types/IERC20.ts +300 -0
- package/types/IERC20Metadata.ts +339 -0
- package/types/IERC2917.ts +25 -0
- package/types/IGoodDollarStakingTest.ts +160 -0
- package/types/IMultichainRouter.ts +166 -0
- package/types/IRouter.ts +143 -0
- package/types/IWrapper.ts +143 -0
- package/types/MultichainBridgeHelper.ts +170 -0
- package/types/MultichainRouterMock.ts +141 -0
- package/types/Pausable.ts +103 -0
- package/types/PausableControl.ts +125 -0
- package/types/{BulkProof.ts → RewardsMinter.ts} +24 -28
- package/types/StakingMockFixedAPY.ts +995 -0
- package/types/StakingRewardsFixedAPY.ts +428 -0
- package/types/factories/AaveStakingFactory__factory.ts +1 -1
- package/types/factories/AccessControl__factory.ts +227 -0
- package/types/factories/AdminWallet__factory.ts +1 -1
- package/types/factories/BaseShareFieldV2__factory.ts +1 -1
- package/types/factories/BaseShareField__factory.ts +1 -1
- package/types/factories/CERC20__factory.ts +13 -0
- package/types/factories/ClaimersDistribution__factory.ts +1 -1
- package/types/factories/CompoundStakingFactory__factory.ts +1 -1
- package/types/factories/CompoundVotingMachine__factory.ts +1 -1
- package/types/factories/DAOContract__factory.ts +1 -1
- package/types/factories/DAOUpgradeableContract__factory.ts +1 -1
- package/types/factories/DistributionBridgeMock__factory.ts +207 -0
- package/types/factories/DistributionHelperTestHelper__factory.ts +737 -0
- package/types/factories/DistributionHelperTest__factory.ts +717 -0
- package/types/factories/DistributionHelper__factory.ts +713 -0
- package/types/factories/DonationsStaking__factory.ts +1 -1
- package/types/factories/ERC165__factory.ts +39 -0
- package/types/factories/ERC20__factory.ts +13 -0
- package/types/factories/ExchangeHelper__factory.ts +1 -1
- package/types/factories/FuseFaucet__factory.ts +1 -1
- package/types/factories/FuseStakingV3__factory.ts +1 -1
- package/types/factories/GReputation__factory.ts +1 -1
- package/types/factories/GoodAaveStakingV2__factory.ts +1 -1
- package/types/factories/GoodAaveStaking__factory.ts +1 -1
- package/types/factories/GoodCompoundStakingTest__factory.ts +1 -1
- package/types/factories/GoodCompoundStakingV2__factory.ts +1 -1
- package/types/factories/GoodCompoundStaking__factory.ts +1 -1
- package/types/factories/GoodDollarMintBurnWrapper__factory.ts +1318 -0
- package/types/factories/GoodDollarStakingMock__factory.ts +1404 -0
- package/types/factories/GoodDollarStaking__factory.ts +1400 -0
- package/types/factories/GoodFundManagerTest__factory.ts +1 -1
- package/types/factories/GoodFundManager__factory.ts +1 -1
- package/types/factories/GoodMarketMaker__factory.ts +1 -1
- package/types/factories/GoodReserveCDai__factory.ts +74 -34
- package/types/factories/GovernanceStaking__factory.ts +1 -1
- package/types/factories/IAccessControl__factory.ts +198 -0
- package/types/factories/IERC165__factory.ts +42 -0
- package/types/factories/IERC20Metadata__factory.ts +248 -0
- package/types/factories/IERC20__factory.ts +203 -0
- package/types/factories/IERC2917__factory.ts +13 -0
- package/types/factories/IGoodDollarStakingTest__factory.ts +68 -0
- package/types/factories/IMultichainRouter__factory.ts +82 -0
- package/types/factories/IRouter__factory.ts +71 -0
- package/types/factories/IWrapper__factory.ts +71 -0
- package/types/factories/InvitesV1__factory.ts +1 -1
- package/types/factories/MultichainBridgeHelper__factory.ts +134 -0
- package/types/factories/MultichainRouterMock__factory.ts +141 -0
- package/types/factories/OverMintTesterRegularStake__factory.ts +1 -1
- package/types/factories/OverMintTester__factory.ts +3 -3
- package/types/factories/PausableControl__factory.ts +84 -0
- package/types/factories/Pausable__factory.ts +62 -0
- package/types/factories/ProtocolUpgradeFuseRecover__factory.ts +1 -1
- package/types/factories/ProtocolUpgradeFuse__factory.ts +1 -1
- package/types/factories/ProtocolUpgradeRecover__factory.ts +1 -1
- package/types/factories/ProtocolUpgrade__factory.ts +1 -1
- package/types/factories/ReputationTestHelper__factory.ts +1 -1
- package/types/factories/Reputation__factory.ts +1 -1
- package/types/factories/RewardsMinter__factory.ts +47 -0
- package/types/factories/StakersDistribution__factory.ts +1 -1
- package/types/factories/StakingMockFixedAPY__factory.ts +745 -0
- package/types/factories/StakingRewardsFixedAPY__factory.ts +287 -0
- package/types/factories/SwapHelperTest__factory.ts +1 -1
- package/types/factories/UBIScheme__factory.ts +1 -1
- package/types/factories/UniswapV2SwapHelper__factory.ts +1 -1
- package/types/factories/UpgradableMock2__factory.ts +1 -1
- package/types/factories/UpgradableMock3__factory.ts +1 -1
- package/types/factories/UpgradableMock4__factory.ts +1 -1
- package/types/factories/UpgradableMock__factory.ts +1 -1
- package/types/hardhat.d.ts +225 -9
- package/types/index.ts +50 -4
- package/yarn.lock +180 -104
- package/types/factories/BulkProof__factory.ts +0 -89
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { range, sortBy, toPairs } from "lodash";
|
|
2
|
+
import fetch from "node-fetch";
|
|
3
|
+
import PromisePool from "async-promise-pool";
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import { ethers } from "hardhat";
|
|
6
|
+
import { start } from "repl";
|
|
7
|
+
import { JsonRpcProvider } from "@ethersproject/providers";
|
|
8
|
+
import { off } from "process";
|
|
9
|
+
|
|
10
|
+
function arrayToCsv(data) {
|
|
11
|
+
return data
|
|
12
|
+
.map(
|
|
13
|
+
row =>
|
|
14
|
+
row
|
|
15
|
+
.map(String) // convert every value to String
|
|
16
|
+
.map(v => v.replaceAll('"', '""')) // escape double colons
|
|
17
|
+
.map(v => `"${v}"`) // quote it
|
|
18
|
+
.join(",") // comma-separated
|
|
19
|
+
)
|
|
20
|
+
.join("\r\n"); // rows starting on new lines
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const main = async () => {
|
|
24
|
+
const archive = new JsonRpcProvider("https://explorer-node.fuse.io");
|
|
25
|
+
const blockStep = 10000;
|
|
26
|
+
const pool = new PromisePool({ concurrency: 10 });
|
|
27
|
+
|
|
28
|
+
let faucet = await ethers.getContractAt(
|
|
29
|
+
["event WalletTopped(address indexed user, uint256 amount)"],
|
|
30
|
+
"0x01ab5966C1d742Ae0CFF7f14cC0F4D85156e83d9"
|
|
31
|
+
);
|
|
32
|
+
const endBlock = Number(await ethers.provider.getBlockNumber());
|
|
33
|
+
const daysBack = 30;
|
|
34
|
+
const dayBlocks = 12 * 60 * 24;
|
|
35
|
+
const startBlock = endBlock - dayBlocks * daysBack;
|
|
36
|
+
const days = range(startBlock, endBlock, dayBlocks);
|
|
37
|
+
const dailyBalance = [];
|
|
38
|
+
for (let day of days) {
|
|
39
|
+
dailyBalance.push(
|
|
40
|
+
(
|
|
41
|
+
await archive.getBalance(
|
|
42
|
+
"0x01ab5966C1d742Ae0CFF7f14cC0F4D85156e83d9",
|
|
43
|
+
day
|
|
44
|
+
)
|
|
45
|
+
)
|
|
46
|
+
.div(1e10)
|
|
47
|
+
.toNumber() / 1e8
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
let curBlock = startBlock;
|
|
51
|
+
|
|
52
|
+
const toppingsByAddress = {};
|
|
53
|
+
const toppingsByAmount = {};
|
|
54
|
+
let totalToppings = 0;
|
|
55
|
+
let totalAmount = 0;
|
|
56
|
+
console.log({ dailyBalance });
|
|
57
|
+
console.log({ startBlock, endBlock });
|
|
58
|
+
while (curBlock <= endBlock) {
|
|
59
|
+
const fromBlock = curBlock;
|
|
60
|
+
const toBlock = Math.min(fromBlock + blockStep, endBlock);
|
|
61
|
+
pool.add(async () => {
|
|
62
|
+
const f = faucet.filters.WalletTopped();
|
|
63
|
+
const events = await faucet
|
|
64
|
+
.queryFilter(f, fromBlock, toBlock)
|
|
65
|
+
.catch(e => {
|
|
66
|
+
console.log("failed", { fromBlock, toBlock });
|
|
67
|
+
return [];
|
|
68
|
+
});
|
|
69
|
+
events.forEach(e => {
|
|
70
|
+
totalToppings += 1;
|
|
71
|
+
totalAmount += Number(e.args.amount);
|
|
72
|
+
toppingsByAddress[e.args.user] =
|
|
73
|
+
(toppingsByAddress[e.args.user] || 0) + 1;
|
|
74
|
+
toppingsByAmount[e.args.amount] =
|
|
75
|
+
(toppingsByAmount[e.args.amount] || 0) + 1;
|
|
76
|
+
});
|
|
77
|
+
console.log("fetched events", {
|
|
78
|
+
fromBlock,
|
|
79
|
+
toBlock,
|
|
80
|
+
events: events.length
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
curBlock += blockStep;
|
|
84
|
+
}
|
|
85
|
+
await pool.all();
|
|
86
|
+
|
|
87
|
+
const topToppers = sortBy(toPairs(toppingsByAddress), "1").reverse();
|
|
88
|
+
const topAmounts = sortBy(toPairs(toppingsByAmount), "1").reverse();
|
|
89
|
+
const totalWallets = topToppers.length;
|
|
90
|
+
|
|
91
|
+
const avgToppingsPerWallet = totalToppings / totalWallets;
|
|
92
|
+
const avgToppingAmount = totalAmount / totalToppings;
|
|
93
|
+
|
|
94
|
+
fs.writeFileSync("topToppers.csv", arrayToCsv(topToppers));
|
|
95
|
+
fs.writeFileSync("topAmounts.csv", arrayToCsv(topAmounts));
|
|
96
|
+
console.log({
|
|
97
|
+
totalAmount,
|
|
98
|
+
totalToppings,
|
|
99
|
+
avgToppingsPerWallet,
|
|
100
|
+
avgToppingAmount
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
main().catch(e => console.log(e));
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { last, range, sortBy } from "lodash";
|
|
2
|
+
import fetch from "node-fetch";
|
|
3
|
+
import PromisePool from "async-promise-pool";
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import { ethers } from "hardhat";
|
|
6
|
+
|
|
7
|
+
const main = async () => {
|
|
8
|
+
let result = [];
|
|
9
|
+
let balances = {};
|
|
10
|
+
let lastAddr = ethers.constants.AddressZero;
|
|
11
|
+
|
|
12
|
+
const graphQuery = async (start, skip) => {
|
|
13
|
+
const query = `{
|
|
14
|
+
goodBalances(first:1000 orderBy:id orderDirection: asc where:{id_gt:"${start}" }) {
|
|
15
|
+
id
|
|
16
|
+
coreBalance
|
|
17
|
+
totalVotes
|
|
18
|
+
}
|
|
19
|
+
}`;
|
|
20
|
+
// console.log({ query });
|
|
21
|
+
try {
|
|
22
|
+
const { data = {}, errors } = await fetch(
|
|
23
|
+
"https://api.thegraph.com/subgraphs/name/gooddollar/gooddollarfuse2",
|
|
24
|
+
{
|
|
25
|
+
method: "POST",
|
|
26
|
+
headers: {
|
|
27
|
+
"Content-Type": "application/json"
|
|
28
|
+
},
|
|
29
|
+
body: JSON.stringify({ query })
|
|
30
|
+
}
|
|
31
|
+
).then(_ => _.json());
|
|
32
|
+
errors && console.log({ errors });
|
|
33
|
+
if (data?.goodBalances?.length === 1000) {
|
|
34
|
+
const nextAddr = last(data?.goodBalances).id;
|
|
35
|
+
console.log("fetching next page:", nextAddr);
|
|
36
|
+
return data.goodBalances.concat(await graphQuery(nextAddr, 0));
|
|
37
|
+
}
|
|
38
|
+
return data.goodBalances || [];
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.log({ query, error });
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const goodBalances = await graphQuery(lastAddr, 0);
|
|
45
|
+
console.log("goodBalances:", goodBalances.length);
|
|
46
|
+
fs.writeFileSync("goodBalances.json", JSON.stringify(goodBalances));
|
|
47
|
+
// console.log({ lastUsed });
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
main().catch(e => console.log(e));
|
|
File without changes
|
|
@@ -1209,6 +1209,7 @@ export const airdrop = (
|
|
|
1209
1209
|
const getProof = addr => {
|
|
1210
1210
|
const { treeData, merkleRoot } = JSON.parse(
|
|
1211
1211
|
fs.readFileSync("airdrop/airdrop.json").toString()
|
|
1212
|
+
// fs.readFileSync("airdrop/airdropPrev.json").toString()
|
|
1212
1213
|
);
|
|
1213
1214
|
|
|
1214
1215
|
let entries = Object.entries(treeData as Tree);
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
/***
|
|
2
|
+
* to get same addresses as on Celo
|
|
3
|
+
* deploy proxyfactory with 0x271cd5391016eb621aB3f9c0c70F5cF91DFd3FB0 with nonce 2
|
|
4
|
+
* create a gnosissafe with 0x3de7216149f12d8f51540d9a870149560fc11bfb with nonce 3
|
|
5
|
+
* run this script with 0x3de7216149f12d8f51540d9a870149560fc11bfb with nonce 7
|
|
6
|
+
*/
|
|
1
7
|
import { network, ethers, upgrades, run } from "hardhat";
|
|
2
|
-
import pressAnyKey from "press-any-key";
|
|
3
8
|
import { Contract } from "ethers";
|
|
4
9
|
// import DAOCreatorABI from "@gooddollar/goodcontracts/build/contracts/DaoCreatorGoodDollar.json";
|
|
5
10
|
import DAOCreatorABI from "../../../GoodBootstrap/packages/contracts/build/contracts/DaoCreatorGoodDollarWithRep.json";
|
|
6
11
|
// import IdentityABI from "@gooddollar/goodcontracts/build/contracts/Identity.json";
|
|
7
12
|
import IdentityABI from "../../../GoodBootstrap/packages/contracts/build/contracts/IdentityWithOwner.json";
|
|
8
13
|
import FeeFormulaABI from "@gooddollar/goodcontracts/build/contracts/FeeFormula.json";
|
|
9
|
-
|
|
10
|
-
import AddFoundersABI from "../../../GoodBootstrap/packages/contracts/build/contracts/AddFoundersGoodDollarWithRep.json";
|
|
14
|
+
import AddFoundersABI from "@gooddollar/goodcontracts/contracts/build/contracts/AddFoundersGoodDollarWithRep.json";
|
|
11
15
|
|
|
12
16
|
import { deployDeterministic } from "./helpers";
|
|
13
17
|
import releaser from "../../scripts/releaser";
|
|
@@ -50,6 +54,17 @@ export const createDAO = async () => {
|
|
|
50
54
|
.then(_ => _.toString())
|
|
51
55
|
});
|
|
52
56
|
|
|
57
|
+
if (network.name.includes("production")) {
|
|
58
|
+
const txCount = await root.getTransactionCount();
|
|
59
|
+
if (txCount !== 7) {
|
|
60
|
+
console.error(
|
|
61
|
+
"nonce doesnt match expected 7, to have same contract address",
|
|
62
|
+
{ txCount }
|
|
63
|
+
);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
53
68
|
const DAOCreatorFactory = new ethers.ContractFactory(
|
|
54
69
|
DAOCreatorABI.abi,
|
|
55
70
|
DAOCreatorABI.bytecode,
|
|
@@ -103,7 +118,7 @@ export const createDAO = async () => {
|
|
|
103
118
|
const GReputation = (await deployDeterministic(
|
|
104
119
|
{
|
|
105
120
|
name: "GReputation",
|
|
106
|
-
|
|
121
|
+
isUpgradeable: true,
|
|
107
122
|
initializer: "initialize(address, string, bytes32, uint256)"
|
|
108
123
|
},
|
|
109
124
|
[
|
|
@@ -173,7 +188,7 @@ export const createDAO = async () => {
|
|
|
173
188
|
.then(printDeploy);
|
|
174
189
|
|
|
175
190
|
const NameService = await deployDeterministic(
|
|
176
|
-
{ name: "NameService",
|
|
191
|
+
{ name: "NameService", isUpgradeable: true },
|
|
177
192
|
[
|
|
178
193
|
controller,
|
|
179
194
|
["CONTROLLER", "AVATAR", "IDENTITY", "GOODDOLLAR"].map(_ =>
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/***
|
|
2
|
+
* complete deploy of the new G$ savings concept
|
|
3
|
+
* steps required:
|
|
4
|
+
* sidechain
|
|
5
|
+
* 1. deploy GoodDollarMintBurnWrapper
|
|
6
|
+
* 2. deploy G$Savings
|
|
7
|
+
* 3. create proposal to:
|
|
8
|
+
* - add G$Savings as rewards minter on GoodDollarMintBurnWraper
|
|
9
|
+
* - register GoodDollarMintBurnWrapper as scheme so it can call mint on controller
|
|
10
|
+
* - register G$Savings as scheme so it can handle upgrade from GovernanceStaking
|
|
11
|
+
* - add GoodDollarMintBurnWraper to name service
|
|
12
|
+
*
|
|
13
|
+
* mainnet:
|
|
14
|
+
* 1. deploy new reserve implementation
|
|
15
|
+
* 2. deploy DistributionHelper
|
|
16
|
+
* 3. create proposal to upgrade reserve
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { network, ethers, upgrades, run } from "hardhat";
|
|
21
|
+
import { Contract, Signer } from "ethers";
|
|
22
|
+
|
|
23
|
+
import { deployDeterministic, printDeploy } from "./helpers";
|
|
24
|
+
import releaser from "../../scripts/releaser";
|
|
25
|
+
import ProtocolSettings from "../../releases/deploy-settings.json";
|
|
26
|
+
import dao from "../../releases/deployment.json";
|
|
27
|
+
import { deployWrapper } from "./multichainWrapper-deploy";
|
|
28
|
+
import {
|
|
29
|
+
CompoundVotingMachine,
|
|
30
|
+
GoodDollarMintBurnWrapper,
|
|
31
|
+
Controller,
|
|
32
|
+
NameService
|
|
33
|
+
} from "../../types";
|
|
34
|
+
const { name: networkName } = network;
|
|
35
|
+
|
|
36
|
+
const BLOCKS_PER_YEAR = (12 * 60 * 24 * 365).toString();
|
|
37
|
+
const BLOCK_APY = "1000000007735630000";
|
|
38
|
+
|
|
39
|
+
export const deploySidechain = async () => {
|
|
40
|
+
const isProduction = networkName.includes("production");
|
|
41
|
+
let release: { [key: string]: any } = dao[networkName];
|
|
42
|
+
|
|
43
|
+
let [root, ...signers] = await ethers.getSigners();
|
|
44
|
+
const proposer =
|
|
45
|
+
networkName !== "fuse"
|
|
46
|
+
? new ethers.Wallet(process.env.PROPOSER_KEY, ethers.provider)
|
|
47
|
+
: root; //need proposer with 0.3% of GOOD tokens
|
|
48
|
+
|
|
49
|
+
console.log("got signers:", {
|
|
50
|
+
networkName,
|
|
51
|
+
root: root.address,
|
|
52
|
+
balance: await ethers.provider
|
|
53
|
+
.getBalance(root.address)
|
|
54
|
+
.then(_ => _.toString())
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
let Wrapper;
|
|
58
|
+
if (!release.GoodDollarMintBurnWrapper)
|
|
59
|
+
Wrapper = (await deployWrapper(
|
|
60
|
+
release.Avatar
|
|
61
|
+
)) as GoodDollarMintBurnWrapper;
|
|
62
|
+
else {
|
|
63
|
+
Wrapper = await ethers.getContractAt(
|
|
64
|
+
"GoodDollarMintBurnWrapper",
|
|
65
|
+
release.GoodDollarMintBurnWrapper
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
console.log("deploying savings...");
|
|
70
|
+
|
|
71
|
+
let GDSavings;
|
|
72
|
+
if (!release.GoodDollarStaking) {
|
|
73
|
+
GDSavings = (await deployDeterministic(
|
|
74
|
+
{
|
|
75
|
+
name: "GoodDollarStaking",
|
|
76
|
+
salt: isProduction ? "GoodDollarStaking" : "GoodDollarStakingV3",
|
|
77
|
+
isUpgradeable: false
|
|
78
|
+
},
|
|
79
|
+
[
|
|
80
|
+
release.NameService,
|
|
81
|
+
ethers.BigNumber.from(BLOCK_APY),
|
|
82
|
+
ethers.BigNumber.from(BLOCKS_PER_YEAR),
|
|
83
|
+
networkName === "fuse" ? 7 : 30 //days until upgrade
|
|
84
|
+
]
|
|
85
|
+
).then(printDeploy)) as Contract;
|
|
86
|
+
|
|
87
|
+
let torelease = {
|
|
88
|
+
GoodDollarStaking: GDSavings.address
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
await releaser(torelease, networkName, "deployment", false);
|
|
92
|
+
} else {
|
|
93
|
+
GDSavings = await ethers.getContractAt(
|
|
94
|
+
"GoodDollarStaking",
|
|
95
|
+
release.GoodDollarStaking
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
//create proposal
|
|
100
|
+
const vm = (await ethers.getContractAt(
|
|
101
|
+
"CompoundVotingMachine",
|
|
102
|
+
release.CompoundVotingMachine
|
|
103
|
+
)) as CompoundVotingMachine;
|
|
104
|
+
|
|
105
|
+
const ctrl = (await ethers.getContractAt(
|
|
106
|
+
"Controller",
|
|
107
|
+
release.Controller
|
|
108
|
+
)) as Controller;
|
|
109
|
+
|
|
110
|
+
const ns = (await ethers.getContractAt(
|
|
111
|
+
"NameService",
|
|
112
|
+
release.NameService
|
|
113
|
+
)) as NameService;
|
|
114
|
+
|
|
115
|
+
const proposalContracts = [
|
|
116
|
+
Wrapper.address, //MinterWrapper -> add GDSavings
|
|
117
|
+
ctrl.address, //controller -> add MinterWrapper as scheme
|
|
118
|
+
ctrl.address, // controller -> add GDSavings as scheme
|
|
119
|
+
ns.address //nameservice add MinterWrapper
|
|
120
|
+
];
|
|
121
|
+
|
|
122
|
+
const proposalEthValues = proposalContracts.map(_ => 0);
|
|
123
|
+
|
|
124
|
+
const proposalFunctionSignatures = [
|
|
125
|
+
"addMinter(address,uint256,uint256,uint32,uint256,uint256,uint32,bool)",
|
|
126
|
+
"registerScheme(address,bytes32,bytes4,address)",
|
|
127
|
+
"registerScheme(address,bytes32,bytes4,address)",
|
|
128
|
+
"setAddress(string,address)"
|
|
129
|
+
];
|
|
130
|
+
|
|
131
|
+
const proposalFunctionInputs = [
|
|
132
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
133
|
+
[
|
|
134
|
+
"address",
|
|
135
|
+
"uint256",
|
|
136
|
+
"uint256",
|
|
137
|
+
"uint32",
|
|
138
|
+
"uint256",
|
|
139
|
+
"uint256",
|
|
140
|
+
"uint32",
|
|
141
|
+
"bool"
|
|
142
|
+
],
|
|
143
|
+
[GDSavings.address, 0, 0, 30, 0, 0, 0, true]
|
|
144
|
+
), //function addMinter(
|
|
145
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
146
|
+
["address", "bytes32", "bytes4", "address"],
|
|
147
|
+
[
|
|
148
|
+
Wrapper.address, //scheme
|
|
149
|
+
ethers.constants.HashZero, //paramshash
|
|
150
|
+
"0x00000001", //permissions - minimal
|
|
151
|
+
release.Avatar
|
|
152
|
+
]
|
|
153
|
+
),
|
|
154
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
155
|
+
["address", "bytes32", "bytes4", "address"],
|
|
156
|
+
[
|
|
157
|
+
GDSavings.address, //scheme
|
|
158
|
+
ethers.constants.HashZero, //paramshash
|
|
159
|
+
"0x000000f1", //permissions - genericcall
|
|
160
|
+
release.Avatar
|
|
161
|
+
]
|
|
162
|
+
),
|
|
163
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
164
|
+
["string", "address"],
|
|
165
|
+
["MINTBURN_WRAPPER", Wrapper.address]
|
|
166
|
+
)
|
|
167
|
+
];
|
|
168
|
+
|
|
169
|
+
if (networkName === "fuse") {
|
|
170
|
+
return executeViaGuardian(
|
|
171
|
+
proposalContracts,
|
|
172
|
+
proposalEthValues,
|
|
173
|
+
proposalFunctionSignatures,
|
|
174
|
+
proposalFunctionInputs,
|
|
175
|
+
root
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
console.log("creating proposal...");
|
|
180
|
+
await vm
|
|
181
|
+
.connect(proposer)
|
|
182
|
+
["propose(address[],uint256[],string[],bytes[],string)"](
|
|
183
|
+
proposalContracts,
|
|
184
|
+
proposalEthValues,
|
|
185
|
+
proposalFunctionSignatures,
|
|
186
|
+
proposalFunctionInputs,
|
|
187
|
+
"https://discourse.gooddollar.org/t/gip-5-allocating-part-of-ubi-inflation-towards-g-savings-account/114/20"
|
|
188
|
+
)
|
|
189
|
+
.then(printDeploy);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const executeViaGuardian = async (
|
|
193
|
+
contracts,
|
|
194
|
+
ethValues,
|
|
195
|
+
functionSigs,
|
|
196
|
+
functionInputs,
|
|
197
|
+
guardian: Signer
|
|
198
|
+
) => {
|
|
199
|
+
let release: { [key: string]: any } = dao[networkName];
|
|
200
|
+
const ctrl = await (
|
|
201
|
+
await ethers.getContractAt("Controller", release.Controller)
|
|
202
|
+
).connect(guardian);
|
|
203
|
+
|
|
204
|
+
for (let i = 0; i < contracts.length; i++) {
|
|
205
|
+
const contract = contracts[i];
|
|
206
|
+
console.log("executing:", contracts[i], functionSigs[i], functionInputs[i]);
|
|
207
|
+
const sigHash = ethers.utils
|
|
208
|
+
.keccak256(ethers.utils.toUtf8Bytes(functionSigs[i]))
|
|
209
|
+
.slice(0, 10);
|
|
210
|
+
const encoded = ethers.utils.solidityPack(
|
|
211
|
+
["bytes4", "bytes"],
|
|
212
|
+
[sigHash, functionInputs[i]]
|
|
213
|
+
);
|
|
214
|
+
if (contract === ctrl.address) {
|
|
215
|
+
console.log("executing directly on controller:", sigHash, encoded);
|
|
216
|
+
|
|
217
|
+
await guardian
|
|
218
|
+
.sendTransaction({ to: contract, data: encoded })
|
|
219
|
+
.then(printDeploy);
|
|
220
|
+
} else {
|
|
221
|
+
console.log("executing genericCall:", sigHash, encoded);
|
|
222
|
+
await ctrl
|
|
223
|
+
.genericCall(contract, encoded, release.Avatar, ethValues[i])
|
|
224
|
+
.then(printDeploy);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
export const main = async () => {
|
|
230
|
+
await deploySidechain().catch(console.log);
|
|
231
|
+
};
|
|
232
|
+
if (process.argv[1].includes("gdSavings")) main();
|
|
@@ -1,9 +1,29 @@
|
|
|
1
|
-
import { ContractFactory } from "ethers";
|
|
1
|
+
import { Contract, ContractFactory, Signer } from "ethers";
|
|
2
2
|
import { network, ethers, upgrades, run } from "hardhat";
|
|
3
|
+
import { Contract } from "ethers";
|
|
4
|
+
import { TransactionResponse } from "@ethersproject/providers";
|
|
5
|
+
import dao from "../../releases/deployment.json";
|
|
3
6
|
|
|
7
|
+
const networkName = network.name;
|
|
4
8
|
let totalGas = 0;
|
|
5
9
|
const gasUsage = {};
|
|
6
|
-
const GAS_SETTINGS = {};
|
|
10
|
+
const GAS_SETTINGS = { gasLimit: 5000000 };
|
|
11
|
+
let release: { [key: string]: any } = dao[network.name];
|
|
12
|
+
|
|
13
|
+
export const printDeploy = async (
|
|
14
|
+
c: Contract | TransactionResponse
|
|
15
|
+
): Promise<Contract | TransactionResponse> => {
|
|
16
|
+
if (c instanceof Contract) {
|
|
17
|
+
await c.deployed();
|
|
18
|
+
console.log("deployed to: ", c.address);
|
|
19
|
+
}
|
|
20
|
+
if (c.wait) {
|
|
21
|
+
await c.wait();
|
|
22
|
+
console.log("tx done:", c.hash);
|
|
23
|
+
}
|
|
24
|
+
return c;
|
|
25
|
+
};
|
|
26
|
+
|
|
7
27
|
export const countTotalGas = async (tx, name) => {
|
|
8
28
|
let res = tx;
|
|
9
29
|
if (tx.deployTransaction) tx = tx.deployTransaction;
|
|
@@ -22,25 +42,30 @@ export const deployDeterministic = async (
|
|
|
22
42
|
) => {
|
|
23
43
|
try {
|
|
24
44
|
let proxyFactory;
|
|
25
|
-
if (
|
|
45
|
+
if (network.name.startsWith("develop")) {
|
|
26
46
|
proxyFactory = await (
|
|
27
47
|
await ethers.getContractFactory("ProxyFactory1967")
|
|
28
48
|
).deploy();
|
|
29
49
|
} else
|
|
30
50
|
proxyFactory = await ethers.getContractAt(
|
|
31
51
|
"ProxyFactory1967",
|
|
32
|
-
|
|
52
|
+
release.ProxyFactory
|
|
33
53
|
);
|
|
34
54
|
const Contract =
|
|
35
55
|
(contract.factory as ContractFactory) ||
|
|
36
56
|
(await ethers.getContractFactory(contract.name, factoryOpts));
|
|
37
57
|
|
|
38
58
|
const salt = ethers.BigNumber.from(
|
|
39
|
-
ethers.utils.keccak256(
|
|
59
|
+
ethers.utils.keccak256(
|
|
60
|
+
ethers.utils.toUtf8Bytes(contract.salt || contract.name)
|
|
61
|
+
)
|
|
40
62
|
);
|
|
41
63
|
|
|
42
|
-
if (contract.
|
|
43
|
-
console.log("Deploying:", contract.name, "using proxyfactory"
|
|
64
|
+
if (contract.isUpgradeable === true) {
|
|
65
|
+
console.log("Deploying:", contract.name, "using proxyfactory", {
|
|
66
|
+
args,
|
|
67
|
+
proxyFactory: proxyFactory.address
|
|
68
|
+
});
|
|
44
69
|
const encoded = Contract.interface.encodeFunctionData(
|
|
45
70
|
contract.initializer || "initialize",
|
|
46
71
|
args
|
|
@@ -68,7 +93,10 @@ export const deployDeterministic = async (
|
|
|
68
93
|
console.log("proxy deployed:", contract.name, proxyAddr);
|
|
69
94
|
return Contract.attach(proxyAddr);
|
|
70
95
|
} else {
|
|
71
|
-
console.log("Deploying:", contract.name, "using proxyfactory code"
|
|
96
|
+
console.log("Deploying:", contract.name, "using proxyfactory code", {
|
|
97
|
+
proxyFactory: proxyFactory.address,
|
|
98
|
+
args
|
|
99
|
+
});
|
|
72
100
|
const constructor = Contract.interface.encodeDeploy(args);
|
|
73
101
|
const bytecode = ethers.utils.solidityPack(
|
|
74
102
|
["bytes", "bytes"],
|
|
@@ -94,3 +122,40 @@ export const deployDeterministic = async (
|
|
|
94
122
|
throw e;
|
|
95
123
|
}
|
|
96
124
|
};
|
|
125
|
+
|
|
126
|
+
export const executeViaGuardian = async (
|
|
127
|
+
contracts,
|
|
128
|
+
ethValues,
|
|
129
|
+
functionSigs,
|
|
130
|
+
functionInputs,
|
|
131
|
+
guardian: Signer
|
|
132
|
+
) => {
|
|
133
|
+
let release: { [key: string]: any } = dao[networkName];
|
|
134
|
+
const ctrl = await (
|
|
135
|
+
await ethers.getContractAt("Controller", release.Controller)
|
|
136
|
+
).connect(guardian);
|
|
137
|
+
|
|
138
|
+
for (let i = 0; i < contracts.length; i++) {
|
|
139
|
+
const contract = contracts[i];
|
|
140
|
+
console.log("executing:", contracts[i], functionSigs[i], functionInputs[i]);
|
|
141
|
+
const sigHash = ethers.utils
|
|
142
|
+
.keccak256(ethers.utils.toUtf8Bytes(functionSigs[i]))
|
|
143
|
+
.slice(0, 10);
|
|
144
|
+
const encoded = ethers.utils.solidityPack(
|
|
145
|
+
["bytes4", "bytes"],
|
|
146
|
+
[sigHash, functionInputs[i]]
|
|
147
|
+
);
|
|
148
|
+
if (contract === ctrl.address) {
|
|
149
|
+
console.log("executing directly on controller:", sigHash, encoded);
|
|
150
|
+
|
|
151
|
+
await guardian
|
|
152
|
+
.sendTransaction({ to: contract, data: encoded })
|
|
153
|
+
.then(printDeploy);
|
|
154
|
+
} else {
|
|
155
|
+
console.log("executing genericCall:", sigHash, encoded);
|
|
156
|
+
await ctrl
|
|
157
|
+
.genericCall(contract, encoded, release.Avatar, ethValues[i])
|
|
158
|
+
.then(printDeploy);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { network, ethers, upgrades, run } from "hardhat";
|
|
2
|
+
import { Contract } from "ethers";
|
|
3
|
+
|
|
4
|
+
import { deployDeterministic, printDeploy } from "./helpers";
|
|
5
|
+
import releaser from "../../scripts/releaser";
|
|
6
|
+
import ProtocolSettings from "../../releases/deploy-settings.json";
|
|
7
|
+
import dao from "../../releases/deployment.json";
|
|
8
|
+
|
|
9
|
+
const INITIAL_CAP = 100000000000; //1B G$s
|
|
10
|
+
const { name } = network;
|
|
11
|
+
|
|
12
|
+
export const deployWrapper = async (defaultAdmin = null) => {
|
|
13
|
+
let release: { [key: string]: any } = dao[network.name];
|
|
14
|
+
|
|
15
|
+
let [root, ...signers] = await ethers.getSigners();
|
|
16
|
+
//generic call permissions
|
|
17
|
+
let schemeMock = root;
|
|
18
|
+
|
|
19
|
+
console.log("got signers:", {
|
|
20
|
+
network,
|
|
21
|
+
root: root.address,
|
|
22
|
+
schemeMock: schemeMock.address,
|
|
23
|
+
balance: await ethers.provider
|
|
24
|
+
.getBalance(root.address)
|
|
25
|
+
.then(_ => _.toString())
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
console.log("MintBurnWrapper deploy params:", [
|
|
29
|
+
release.GoodDollar,
|
|
30
|
+
defaultAdmin || release.GuardiansSafe,
|
|
31
|
+
release.NameService
|
|
32
|
+
]);
|
|
33
|
+
|
|
34
|
+
const Wrapper = (await deployDeterministic(
|
|
35
|
+
{
|
|
36
|
+
name: "GoodDollarMintBurnWrapper",
|
|
37
|
+
salt: "MintBurnWrapper",
|
|
38
|
+
isUpgradeable: true
|
|
39
|
+
},
|
|
40
|
+
[defaultAdmin || release.GuardiansSafe, release.NameService]
|
|
41
|
+
).then(printDeploy)) as Contract;
|
|
42
|
+
|
|
43
|
+
release = {
|
|
44
|
+
GoodDollarMintBurnWrapper: Wrapper.address
|
|
45
|
+
};
|
|
46
|
+
await releaser(release, network.name, "deployment", false);
|
|
47
|
+
return Wrapper;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const main = async (networkName = name) => {
|
|
51
|
+
await deployWrapper().catch(console.log);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
if (process.argv[1].includes("multichainWrapper")) {
|
|
55
|
+
main();
|
|
56
|
+
}
|