@gooddollar/goodprotocol 1.0.29-beta.1 → 1.0.29-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/abis/AdminWallet.min.json +1 -1
- package/artifacts/abis/Faucet.min.json +1 -0
- package/artifacts/abis/GoodDollarStaking.min.json +1 -1
- package/artifacts/abis/GoodDollarStakingMock.min.json +1 -1
- package/artifacts/abis/IGoodDollar.min.json +1 -1
- package/artifacts/abis/IGovernanceStaking.min.json +1 -0
- package/artifacts/abis/IIdentity.min.json +1 -1
- package/artifacts/abis/IIdentityV2.min.json +1 -0
- package/artifacts/abis/IdentityV2.min.json +1 -0
- package/artifacts/abis/InvitesV2.min.json +1 -0
- package/artifacts/abis/UBIScheme.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/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/IGoodDollar.json +39 -0
- 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/IIdentity.json +51 -0
- package/artifacts/contracts/Interfaces.sol/IIdentityV2.dbg.json +4 -0
- package/artifacts/contracts/Interfaces.sol/IIdentityV2.json +281 -0
- 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/IUBIScheme.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ProxyAdmin.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Reserve.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Uniswap.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/UniswapFactory.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/UniswapPair.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/cERC20.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.dbg.json +4 -0
- package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.json +684 -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 +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.json +15 -2
- package/artifacts/contracts/governance/GoodDollarStaking.sol/IGovernanceStaking.dbg.json +4 -0
- package/artifacts/contracts/governance/GoodDollarStaking.sol/IGovernanceStaking.json +24 -0
- package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.dbg.json +1 -1
- package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.json +2 -2
- package/artifacts/contracts/governance/MultiBaseGovernanceShareField.sol/MultiBaseGovernanceShareField.dbg.json +1 -1
- package/artifacts/contracts/governance/Reputation.sol/Reputation.dbg.json +1 -1
- package/artifacts/contracts/governance/Reputation.sol/Reputation.json +2 -2
- package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
- package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.json +2 -2
- package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.dbg.json +4 -0
- package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.json +1000 -0
- package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.json +2 -2
- package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.dbg.json +4 -0
- package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.json +586 -0
- 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 +1 -1
- package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.json +2 -2
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.json +2 -2
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.json +2 -2
- package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.json +2 -2
- package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.json +15 -2
- 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 +1 -1
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.json +2 -2
- package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.json +2 -2
- package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.json +2 -2
- package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.dbg.json +1 -1
- package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.json +2 -2
- package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.json +2 -2
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.json +2 -2
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.json +2 -2
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.json +2 -2
- package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
- package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.json +2 -2
- package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.json +2 -2
- package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.json +2 -2
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/ContributionCalc.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.json +2 -2
- package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
- package/artifacts/contracts/staking/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 +1 -1
- package/artifacts/contracts/staking/utils/StakingRewardsFixedAPY.sol/StakingRewardsFixedAPY.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.json +15 -22
- package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
- package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.json +76 -56
- package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
- package/artifacts/contracts/utils/BulkProof.sol/BulkProof.dbg.json +1 -1
- package/artifacts/contracts/utils/BulkProof.sol/BulkProof.json +2 -2
- package/artifacts/contracts/utils/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 +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.json +2 -2
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/IRouter.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/PausableControl.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.json +2 -2
- package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.json +2 -2
- package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
- package/artifacts/contracts/utils/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 +26 -0
- package/contracts/fuseFaucet/Faucet.sol +245 -0
- package/contracts/governance/GoodDollarStaking.sol +23 -9
- package/contracts/identity/IdentityV2.sol +434 -0
- package/contracts/invite/InvitesV2.sol +316 -0
- package/contracts/ubi/UBIScheme.sol +45 -40
- package/contracts/utils/AdminWallet.sol +42 -11
- package/hardhat.config.ts +16 -2
- package/package.json +3 -2
- package/releases/deploy-settings.json +36 -1
- package/releases/deployment.json +93 -52
- package/scripts/multichain-deploy/0_proxyFactory-deploy.ts +45 -0
- package/scripts/multichain-deploy/{basicdao-deploy.ts → 1_basicdao-deploy.ts} +56 -52
- package/scripts/multichain-deploy/2_helpers-deploy.ts +143 -0
- package/scripts/multichain-deploy/{gdSavings-deploy.ts → 3_gdSavings-deploy.ts} +90 -76
- package/scripts/multichain-deploy/4_ubi-deploy.ts +121 -0
- package/scripts/multichain-deploy/5_gov-deploy.ts +123 -0
- package/scripts/multichain-deploy/helpers.ts +0 -1
- package/scripts/multichain-deploy/verifyEtherscan.ts +84 -0
- package/scripts/test/localOldDaoDeploy.ts +10 -3
- package/scripts/upgrades/identity-upgrade.ts +153 -0
- package/scripts/{multichain-deploy → upgrades}/nonubiDistribution-deploy.ts +2 -5
- package/test/helpers.ts +12 -8
- package/test/ubi/UBIScheme.test.ts +30 -30
- package/test/ubi/UBISchemeCycle.test.ts +9 -7
- package/test/utils/AdminWallet.test.ts +33 -11
- package/types/AdminWallet.ts +124 -113
- package/types/Faucet.ts +1014 -0
- package/types/GoodDollarStaking.ts +34 -0
- package/types/GoodDollarStakingMock.ts +34 -0
- package/types/IERC1271.ts +109 -0
- package/types/IGoodDollar.ts +54 -0
- package/types/IGovernanceStaking.ts +98 -0
- package/types/IIdentity.ts +75 -0
- package/types/IIdentityV2.ts +526 -0
- package/types/IdentityV2.ts +1612 -0
- package/types/InvitesV2.ts +933 -0
- package/types/UBIScheme.ts +19 -40
- package/types/factories/AaveStakingFactory__factory.ts +1 -1
- package/types/factories/AdminWallet__factory.ts +75 -55
- package/types/factories/BaseShareFieldV2__factory.ts +1 -1
- package/types/factories/BaseShareField__factory.ts +1 -1
- 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 +1 -1
- package/types/factories/DistributionHelperTestHelper__factory.ts +1 -1
- package/types/factories/DistributionHelperTest__factory.ts +1 -1
- package/types/factories/DistributionHelper__factory.ts +1 -1
- package/types/factories/DonationsStaking__factory.ts +1 -1
- package/types/factories/ExchangeHelper__factory.ts +1 -1
- package/types/factories/Faucet__factory.ts +729 -0
- 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 +1 -1
- package/types/factories/GoodDollarStakingMock__factory.ts +14 -1
- package/types/factories/GoodDollarStaking__factory.ts +14 -1
- 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 +1 -1
- package/types/factories/GovernanceStaking__factory.ts +1 -1
- package/types/factories/IERC1271__factory.ts +47 -0
- package/types/factories/IGoodDollar__factory.ts +39 -0
- package/types/factories/IGovernanceStaking__factory.ts +39 -0
- package/types/factories/IIdentityV2__factory.ts +293 -0
- package/types/factories/IIdentity__factory.ts +51 -0
- package/types/factories/IdentityV2__factory.ts +1048 -0
- package/types/factories/InvitesV1__factory.ts +1 -1
- package/types/factories/InvitesV2__factory.ts +634 -0
- package/types/factories/MultichainBridgeHelper__factory.ts +1 -1
- package/types/factories/MultichainRouterMock__factory.ts +1 -1
- package/types/factories/OverMintTesterRegularStake__factory.ts +1 -1
- package/types/factories/OverMintTester__factory.ts +1 -1
- 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/StakersDistribution__factory.ts +1 -1
- package/types/factories/SwapHelperTest__factory.ts +1 -1
- package/types/factories/UBIScheme__factory.ts +14 -21
- 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 +54 -0
- package/types/index.ts +12 -0
- package/yarn.lock +4 -4
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.8;
|
|
4
|
+
|
|
5
|
+
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
6
|
+
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
|
|
7
|
+
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
|
|
8
|
+
import "../Interfaces.sol";
|
|
9
|
+
import "../utils/NameService.sol";
|
|
10
|
+
|
|
11
|
+
// import "hardhat/console.sol";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @title InvitesV1 contract that handles invites with pre allocated bounty pool
|
|
15
|
+
* 1.1 adds invitee bonus
|
|
16
|
+
* 2 uses uups upgradeable - not compatible upgrade for v1
|
|
17
|
+
*/
|
|
18
|
+
contract InvitesV2 is Initializable, UUPSUpgradeable {
|
|
19
|
+
using SafeMathUpgradeable for uint256;
|
|
20
|
+
|
|
21
|
+
struct Stats {
|
|
22
|
+
uint256 totalApprovedInvites;
|
|
23
|
+
uint256 totalBountiesPaid;
|
|
24
|
+
uint256 totalInvited;
|
|
25
|
+
uint256[5] __reserevedSpace;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
struct User {
|
|
29
|
+
address invitedBy;
|
|
30
|
+
bytes32 inviteCode;
|
|
31
|
+
bool bountyPaid;
|
|
32
|
+
address[] invitees;
|
|
33
|
+
address[] pending;
|
|
34
|
+
uint256 level;
|
|
35
|
+
uint256 levelStarted;
|
|
36
|
+
uint256 totalApprovedInvites;
|
|
37
|
+
uint256 totalEarned;
|
|
38
|
+
uint256 joinedAt;
|
|
39
|
+
uint256[5] __reserevedSpace;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
struct Level {
|
|
43
|
+
uint256 toNext;
|
|
44
|
+
uint256 bounty; //in G$ cents ie 2 decimals
|
|
45
|
+
uint256 daysToComplete;
|
|
46
|
+
uint256[5] __reserevedSpace;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
mapping(bytes32 => address) public codeToUser;
|
|
50
|
+
mapping(address => User) public users;
|
|
51
|
+
address payable public avatar;
|
|
52
|
+
|
|
53
|
+
mapping(uint256 => Level) public levels;
|
|
54
|
+
|
|
55
|
+
address public owner;
|
|
56
|
+
NameService public nameService;
|
|
57
|
+
cERC20 public goodDollar;
|
|
58
|
+
bool public active;
|
|
59
|
+
Stats public stats;
|
|
60
|
+
|
|
61
|
+
bool public levelExpirationEnabled;
|
|
62
|
+
|
|
63
|
+
event InviteeJoined(address indexed inviter, address indexed invitee);
|
|
64
|
+
event InviterBounty(
|
|
65
|
+
address indexed inviter,
|
|
66
|
+
address indexed invitee,
|
|
67
|
+
uint256 bountyPaid,
|
|
68
|
+
uint256 inviterLevel,
|
|
69
|
+
bool earnedLevel
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
modifier ownerOrAvatar() {
|
|
73
|
+
require(
|
|
74
|
+
msg.sender == owner || msg.sender == avatar,
|
|
75
|
+
"Only owner or avatar can perform this action"
|
|
76
|
+
);
|
|
77
|
+
_;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
modifier onlyAvatar() {
|
|
81
|
+
require(msg.sender == avatar, "Only DAO avatar can perform this action");
|
|
82
|
+
_;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
modifier isActive() {
|
|
86
|
+
require(active);
|
|
87
|
+
_;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function initialize(
|
|
91
|
+
address payable _avatar,
|
|
92
|
+
address _ns,
|
|
93
|
+
address _gd,
|
|
94
|
+
uint256 _level0Bounty,
|
|
95
|
+
address _owner
|
|
96
|
+
) public initializer {
|
|
97
|
+
owner = _owner;
|
|
98
|
+
nameService = NameService(_ns);
|
|
99
|
+
active = true;
|
|
100
|
+
Level storage lvl = levels[0];
|
|
101
|
+
lvl.bounty = _level0Bounty;
|
|
102
|
+
goodDollar = cERC20(_gd);
|
|
103
|
+
avatar = _avatar;
|
|
104
|
+
levelExpirationEnabled = false;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function _authorizeUpgrade(address newImplementation)
|
|
108
|
+
internal
|
|
109
|
+
override
|
|
110
|
+
ownerOrAvatar
|
|
111
|
+
{}
|
|
112
|
+
|
|
113
|
+
function getIdentity() public view returns (IIdentityV2) {
|
|
114
|
+
return IIdentityV2(nameService.getAddress("IDENTITY"));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function setLevelExpirationEnabled(bool _isEnabled) public ownerOrAvatar {
|
|
118
|
+
levelExpirationEnabled = _isEnabled;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function join(bytes32 _myCode, bytes32 _inviterCode) public isActive {
|
|
122
|
+
require(
|
|
123
|
+
codeToUser[_myCode] == address(0) || codeToUser[_myCode] == msg.sender,
|
|
124
|
+
"invite code already in use"
|
|
125
|
+
);
|
|
126
|
+
User storage user = users[msg.sender]; // this is not expensive as user is new
|
|
127
|
+
address inviter = codeToUser[_inviterCode];
|
|
128
|
+
//allow user to set inviter if doesnt have one
|
|
129
|
+
require(
|
|
130
|
+
user.inviteCode == 0x0 ||
|
|
131
|
+
(user.invitedBy == address(0) && inviter != address(0)),
|
|
132
|
+
"user already joined"
|
|
133
|
+
);
|
|
134
|
+
if (user.inviteCode == 0x0) {
|
|
135
|
+
user.inviteCode = _myCode;
|
|
136
|
+
user.levelStarted = block.timestamp;
|
|
137
|
+
user.joinedAt = block.timestamp;
|
|
138
|
+
codeToUser[_myCode] = msg.sender;
|
|
139
|
+
}
|
|
140
|
+
if (inviter != address(0)) {
|
|
141
|
+
user.invitedBy = inviter;
|
|
142
|
+
users[inviter].invitees.push(msg.sender);
|
|
143
|
+
users[inviter].pending.push(msg.sender);
|
|
144
|
+
stats.totalInvited += 1;
|
|
145
|
+
}
|
|
146
|
+
emit InviteeJoined(inviter, msg.sender);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function canCollectBountyFor(address _invitee) public view returns (bool) {
|
|
150
|
+
address invitedBy = users[_invitee].invitedBy;
|
|
151
|
+
uint256 daysToComplete = levels[users[invitedBy].level].daysToComplete;
|
|
152
|
+
bool isLevelExpired = levelExpirationEnabled == true &&
|
|
153
|
+
daysToComplete > 0 &&
|
|
154
|
+
daysToComplete <
|
|
155
|
+
users[_invitee].joinedAt.sub(users[invitedBy].levelStarted).div(1 days);
|
|
156
|
+
|
|
157
|
+
return
|
|
158
|
+
invitedBy != address(0) &&
|
|
159
|
+
!users[_invitee].bountyPaid &&
|
|
160
|
+
getIdentity().isWhitelisted(_invitee) &&
|
|
161
|
+
getIdentity().isWhitelisted(invitedBy) &&
|
|
162
|
+
isLevelExpired == false;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function getInvitees(address _inviter)
|
|
166
|
+
public
|
|
167
|
+
view
|
|
168
|
+
returns (address[] memory)
|
|
169
|
+
{
|
|
170
|
+
return users[_inviter].invitees;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function getPendingInvitees(address _inviter)
|
|
174
|
+
public
|
|
175
|
+
view
|
|
176
|
+
returns (address[] memory)
|
|
177
|
+
{
|
|
178
|
+
address[] memory pending = users[_inviter].pending;
|
|
179
|
+
uint256 cur = 0;
|
|
180
|
+
uint256 total = 0;
|
|
181
|
+
for (uint256 i; i < pending.length; i++) {
|
|
182
|
+
if (!users[pending[i]].bountyPaid) {
|
|
183
|
+
total++;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
address[] memory result = new address[](total);
|
|
188
|
+
|
|
189
|
+
for (uint256 i; i < pending.length; i++) {
|
|
190
|
+
if (!users[pending[i]].bountyPaid) {
|
|
191
|
+
result[cur] = pending[i];
|
|
192
|
+
cur++;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function getPendingBounties(address _inviter) public view returns (uint256) {
|
|
200
|
+
address[] memory pending = users[_inviter].pending;
|
|
201
|
+
uint256 total = 0;
|
|
202
|
+
for (uint256 i; i < pending.length; i++) {
|
|
203
|
+
if (canCollectBountyFor(pending[i])) {
|
|
204
|
+
total++;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return total;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* @dev pay bounty for the inviter of _invitee
|
|
212
|
+
* invitee need to be whitelisted
|
|
213
|
+
*/
|
|
214
|
+
function bountyFor(address _invitee)
|
|
215
|
+
public
|
|
216
|
+
isActive
|
|
217
|
+
returns (uint256 bounty)
|
|
218
|
+
{
|
|
219
|
+
require(canCollectBountyFor(_invitee), "user not elligble for bounty yet");
|
|
220
|
+
return _bountyFor(_invitee, true);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function _bountyFor(address _invitee, bool isSingleBounty)
|
|
224
|
+
internal
|
|
225
|
+
returns (uint256 bounty)
|
|
226
|
+
{
|
|
227
|
+
address invitedBy = users[_invitee].invitedBy;
|
|
228
|
+
uint256 joinedAt = users[_invitee].joinedAt;
|
|
229
|
+
Level memory level = levels[users[invitedBy].level];
|
|
230
|
+
|
|
231
|
+
bool isLevelExpired = level.daysToComplete > 0 &&
|
|
232
|
+
joinedAt > users[invitedBy].levelStarted && //prevent overflow in subtraction
|
|
233
|
+
level.daysToComplete <
|
|
234
|
+
joinedAt.sub(users[invitedBy].levelStarted).div(1 days); //how long after level started did invitee join
|
|
235
|
+
|
|
236
|
+
users[_invitee].bountyPaid = true;
|
|
237
|
+
users[invitedBy].totalApprovedInvites += 1;
|
|
238
|
+
users[invitedBy].totalEarned += level.bounty;
|
|
239
|
+
stats.totalApprovedInvites += 1;
|
|
240
|
+
stats.totalBountiesPaid += level.bounty;
|
|
241
|
+
|
|
242
|
+
bool earnedLevel = false;
|
|
243
|
+
if (
|
|
244
|
+
level.toNext > 0 &&
|
|
245
|
+
users[invitedBy].totalApprovedInvites >= level.toNext &&
|
|
246
|
+
isLevelExpired == false
|
|
247
|
+
) {
|
|
248
|
+
users[invitedBy].level += 1;
|
|
249
|
+
users[invitedBy].levelStarted = block.timestamp;
|
|
250
|
+
earnedLevel = true;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (isSingleBounty) goodDollar.transfer(invitedBy, level.bounty);
|
|
254
|
+
goodDollar.transfer(_invitee, level.bounty.div(2)); //pay invitee half the bounty
|
|
255
|
+
emit InviterBounty(
|
|
256
|
+
invitedBy,
|
|
257
|
+
_invitee,
|
|
258
|
+
level.bounty,
|
|
259
|
+
users[invitedBy].level,
|
|
260
|
+
earnedLevel
|
|
261
|
+
);
|
|
262
|
+
|
|
263
|
+
return level.bounty;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
@dev collect bounties for invitees by msg.sender that are now whitelisted
|
|
268
|
+
*/
|
|
269
|
+
function collectBounties() public isActive {
|
|
270
|
+
address[] storage pendings = users[msg.sender].pending;
|
|
271
|
+
uint256 totalBounties = 0;
|
|
272
|
+
for (int256 i = int256(pendings.length) - 1; i >= 0; i--) {
|
|
273
|
+
if (gasleft() < 100000) break;
|
|
274
|
+
address pending = pendings[uint256(i)];
|
|
275
|
+
if (canCollectBountyFor(pending)) {
|
|
276
|
+
totalBounties += _bountyFor(pending, false);
|
|
277
|
+
pendings.pop();
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
if (totalBounties > 0) goodDollar.transfer(msg.sender, totalBounties);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function setLevel(
|
|
284
|
+
uint256 _lvl,
|
|
285
|
+
uint256 _toNext,
|
|
286
|
+
uint256 _bounty,
|
|
287
|
+
uint256 _daysToComplete
|
|
288
|
+
) public ownerOrAvatar {
|
|
289
|
+
Level storage lvl = levels[_lvl];
|
|
290
|
+
lvl.toNext = _toNext;
|
|
291
|
+
lvl.daysToComplete = _daysToComplete;
|
|
292
|
+
lvl.bounty = _bounty;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
function setActive(bool _active) public ownerOrAvatar {
|
|
296
|
+
active = _active;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function end() public ownerOrAvatar isActive {
|
|
300
|
+
uint256 gdBalance = goodDollar.balanceOf(address(this));
|
|
301
|
+
goodDollar.transfer(avatar, gdBalance);
|
|
302
|
+
avatar.transfer(address(this).balance);
|
|
303
|
+
active = false;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* @dev
|
|
308
|
+
* 1.2.0 - final changes before release
|
|
309
|
+
* 1.3.0 - allow to set inviter later
|
|
310
|
+
* 1.4.0 - improve gas for bounty collection
|
|
311
|
+
* 1.5.0 - more gas improvements
|
|
312
|
+
*/
|
|
313
|
+
function version() public pure returns (string memory) {
|
|
314
|
+
return "1.5.0";
|
|
315
|
+
}
|
|
316
|
+
}
|
|
@@ -71,7 +71,8 @@ contract UBIScheme is DAOUpgradeableContract {
|
|
|
71
71
|
//dont use first claim, and give ubi as usual
|
|
72
72
|
bool public useFirstClaimPool;
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
//minimum amount of users to divide the pool for, renamed from defaultDailyUbi
|
|
75
|
+
uint256 public minActiveUsers;
|
|
75
76
|
|
|
76
77
|
// A pool of GD to give to activated users,
|
|
77
78
|
// since they will enter the UBI pool
|
|
@@ -99,14 +100,14 @@ contract UBIScheme is DAOUpgradeableContract {
|
|
|
99
100
|
// Total claims per user stat
|
|
100
101
|
mapping(address => uint256) public totalClaimsPerUser;
|
|
101
102
|
|
|
103
|
+
bool public paused;
|
|
104
|
+
|
|
102
105
|
// Emits when a withdraw has been succeded
|
|
103
106
|
event WithdrawFromDao(uint256 prevBalance, uint256 newBalance);
|
|
104
107
|
|
|
105
108
|
// Emits when a user is activated
|
|
106
109
|
event ActivatedUser(address indexed account);
|
|
107
110
|
|
|
108
|
-
bool public paused;
|
|
109
|
-
|
|
110
111
|
// Emits when a fish has been succeded
|
|
111
112
|
event InactiveUserFished(
|
|
112
113
|
address indexed caller,
|
|
@@ -157,8 +158,8 @@ contract UBIScheme is DAOUpgradeableContract {
|
|
|
157
158
|
iterationGasLimit = 150000;
|
|
158
159
|
periodStart = (block.timestamp / (1 days)) * 1 days + 12 hours; //set start time to GMT noon
|
|
159
160
|
startOfCycle = periodStart;
|
|
160
|
-
useFirstClaimPool =
|
|
161
|
-
|
|
161
|
+
useFirstClaimPool = address(_firstClaimPool) != address(0);
|
|
162
|
+
minActiveUsers = 1000;
|
|
162
163
|
}
|
|
163
164
|
|
|
164
165
|
function setUseFirstClaimPool(bool _use) public {
|
|
@@ -285,17 +286,20 @@ contract UBIScheme is DAOUpgradeableContract {
|
|
|
285
286
|
Funds storage funds = dailyUBIHistory[currentDay];
|
|
286
287
|
funds.hasWithdrawn = shouldWithdrawFromDAO;
|
|
287
288
|
funds.openAmount = currentBalance;
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}
|
|
289
|
+
dailyUbi = dailyCyclePool / max(activeUsersCount, minActiveUsers);
|
|
290
|
+
//update minActiveUsers as claimers grow
|
|
291
|
+
minActiveUsers = max(activeUsersCount / 2, minActiveUsers);
|
|
292
|
+
|
|
293
293
|
emit UBICalculated(currentDay, dailyUbi, block.number);
|
|
294
294
|
}
|
|
295
295
|
|
|
296
296
|
return dailyUbi;
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
+
function max(uint256 a, uint256 b) private pure returns (uint256) {
|
|
300
|
+
return a >= b ? a : b;
|
|
301
|
+
}
|
|
302
|
+
|
|
299
303
|
/**
|
|
300
304
|
*@dev Sets the currentDay variable to amount of days
|
|
301
305
|
* since start of contract.
|
|
@@ -356,12 +360,14 @@ contract UBIScheme is DAOUpgradeableContract {
|
|
|
356
360
|
* and emits an event in case of claimed.
|
|
357
361
|
* In case that `isFirstTime` is true, it awards the user.
|
|
358
362
|
* @param _account the account which recieves the funds
|
|
363
|
+
* @param _target the recipient of funds
|
|
359
364
|
* @param _amount the amount to transfer
|
|
360
365
|
* @param _isClaimed true for claimed
|
|
361
366
|
* @param _isFirstTime true for new user or fished user
|
|
362
367
|
*/
|
|
363
368
|
function _transferTokens(
|
|
364
369
|
address _account,
|
|
370
|
+
address _target,
|
|
365
371
|
uint256 _amount,
|
|
366
372
|
bool _isClaimed,
|
|
367
373
|
bool _isFirstTime
|
|
@@ -377,7 +383,7 @@ contract UBIScheme is DAOUpgradeableContract {
|
|
|
377
383
|
|
|
378
384
|
// awards a new user or a fished user
|
|
379
385
|
if (_isFirstTime) {
|
|
380
|
-
uint256 awardAmount = firstClaimPool.awardUser(
|
|
386
|
+
uint256 awardAmount = firstClaimPool.awardUser(_target);
|
|
381
387
|
claimDay[currentDay].claimAmount += awardAmount;
|
|
382
388
|
emit UBIClaimed(_account, awardAmount);
|
|
383
389
|
} else {
|
|
@@ -386,7 +392,7 @@ contract UBIScheme is DAOUpgradeableContract {
|
|
|
386
392
|
emit UBIClaimed(_account, _amount);
|
|
387
393
|
}
|
|
388
394
|
IGoodDollar token = nativeToken();
|
|
389
|
-
require(token.transfer(
|
|
395
|
+
require(token.transfer(_target, _amount), "claim transfer failed");
|
|
390
396
|
}
|
|
391
397
|
}
|
|
392
398
|
|
|
@@ -403,11 +409,9 @@ contract UBIScheme is DAOUpgradeableContract {
|
|
|
403
409
|
{
|
|
404
410
|
_dailyCyclePool = currentBalance / cycleLength;
|
|
405
411
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
_dailyUbi = defaultDailyUbi;
|
|
410
|
-
}
|
|
412
|
+
|
|
413
|
+
_dailyUbi = _dailyCyclePool / max(activeUsersCount, minActiveUsers);
|
|
414
|
+
|
|
411
415
|
return _dailyUbi;
|
|
412
416
|
}
|
|
413
417
|
|
|
@@ -447,9 +451,10 @@ contract UBIScheme is DAOUpgradeableContract {
|
|
|
447
451
|
* calculats the amount the account can claims, and transfers the amount to the account.
|
|
448
452
|
* Emits the address of account and amount claimed.
|
|
449
453
|
* @param _account The claimer account
|
|
454
|
+
* @param _target recipient of funds
|
|
450
455
|
* @return A bool indicating if UBI was claimed
|
|
451
456
|
*/
|
|
452
|
-
function _claim(address _account) internal returns (bool) {
|
|
457
|
+
function _claim(address _account, address _target) internal returns (bool) {
|
|
453
458
|
// calculats the formula up today ie on day 0 there are no active users, on day 1 any user
|
|
454
459
|
// (new or active) will trigger the calculation with the active users count of the day before
|
|
455
460
|
// and so on. the new or inactive users that will become active today, will not take into account
|
|
@@ -462,16 +467,16 @@ contract UBIScheme is DAOUpgradeableContract {
|
|
|
462
467
|
!fishedUsersAddresses[_account] &&
|
|
463
468
|
!hasClaimed(_account)
|
|
464
469
|
) {
|
|
465
|
-
_transferTokens(_account, newDistribution, true, false);
|
|
470
|
+
_transferTokens(_account, _target, newDistribution, true, false);
|
|
466
471
|
return true;
|
|
467
472
|
} else if (!isNotNewUser(_account) || fishedUsersAddresses[_account]) {
|
|
468
473
|
// a unregistered or fished user
|
|
469
474
|
activeUsersCount += 1;
|
|
470
475
|
fishedUsersAddresses[_account] = false;
|
|
471
476
|
if (useFirstClaimPool) {
|
|
472
|
-
_transferTokens(_account, 0, false, true);
|
|
477
|
+
_transferTokens(_account, _target, 0, false, true);
|
|
473
478
|
} else {
|
|
474
|
-
_transferTokens(_account, newDistribution, true, false);
|
|
479
|
+
_transferTokens(_account, _target, newDistribution, true, false);
|
|
475
480
|
}
|
|
476
481
|
emit ActivatedUser(_account);
|
|
477
482
|
return true;
|
|
@@ -486,14 +491,13 @@ contract UBIScheme is DAOUpgradeableContract {
|
|
|
486
491
|
* @return A bool indicating if UBI was claimed
|
|
487
492
|
*/
|
|
488
493
|
function claim() public requireStarted returns (bool) {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
);
|
|
493
|
-
bool didClaim = _claim(msg.sender);
|
|
494
|
+
address whitelistedRoot = IIdentityV2(nameService.getAddress("IDENTITY"))
|
|
495
|
+
.getWhitelistedRoot(msg.sender);
|
|
496
|
+
require(whitelistedRoot != address(0), "UBIScheme: not whitelisted");
|
|
497
|
+
bool didClaim = _claim(whitelistedRoot, msg.sender);
|
|
494
498
|
address claimerDistribution = nameService.getAddress("GDAO_CLAIMERS");
|
|
495
499
|
if (didClaim && claimerDistribution != address(0)) {
|
|
496
|
-
ClaimersDistribution(claimerDistribution).updateClaim(
|
|
500
|
+
ClaimersDistribution(claimerDistribution).updateClaim(whitelistedRoot);
|
|
497
501
|
}
|
|
498
502
|
return didClaim;
|
|
499
503
|
}
|
|
@@ -524,7 +528,7 @@ contract UBIScheme is DAOUpgradeableContract {
|
|
|
524
528
|
if (activeUsersCount > 0) {
|
|
525
529
|
activeUsersCount -= 1;
|
|
526
530
|
}
|
|
527
|
-
_transferTokens(msg.sender, newDistribution, false, false);
|
|
531
|
+
_transferTokens(msg.sender, msg.sender, newDistribution, false, false);
|
|
528
532
|
emit InactiveUserFished(msg.sender, _account, newDistribution);
|
|
529
533
|
return true;
|
|
530
534
|
}
|
|
@@ -572,18 +576,19 @@ contract UBIScheme is DAOUpgradeableContract {
|
|
|
572
576
|
paused = _pause;
|
|
573
577
|
}
|
|
574
578
|
|
|
575
|
-
function upgrade() public {
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
579
|
+
// function upgrade() public {
|
|
580
|
+
// _onlyAvatar();
|
|
581
|
+
// paused = true;
|
|
582
|
+
// activeUsersCount = 50000; //estimated
|
|
583
|
+
// dailyUbi = 0; //required so distributionformula will trigger
|
|
584
|
+
// cycleLength = 30;
|
|
585
|
+
// currentCycleLength = 0; //this will trigger a new cycle calculation in distribution formula
|
|
586
|
+
// startOfCycle = block.timestamp - 91 days; //this will trigger a new calculation in distributionFormula
|
|
587
|
+
// periodStart = 1646136000;
|
|
588
|
+
// maxDailyUBI = 50000;
|
|
589
|
+
// distributionFormula();
|
|
590
|
+
// emit CycleLengthSet(cycleLength);
|
|
591
|
+
// }
|
|
587
592
|
|
|
588
593
|
function setActiveUserCount(uint256 _activeUserCount) public {
|
|
589
594
|
_onlyAvatar();
|
|
@@ -4,10 +4,10 @@ pragma solidity >=0.8.0;
|
|
|
4
4
|
|
|
5
5
|
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
6
6
|
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
|
|
7
|
-
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
|
8
7
|
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
|
|
9
8
|
|
|
10
9
|
import "../Interfaces.sol";
|
|
10
|
+
import "../utils/NameService.sol";
|
|
11
11
|
|
|
12
12
|
/* @title Admin wallet contract allowing whitelisting and topping up of
|
|
13
13
|
* addresses
|
|
@@ -15,7 +15,6 @@ import "../Interfaces.sol";
|
|
|
15
15
|
contract AdminWallet is
|
|
16
16
|
Initializable,
|
|
17
17
|
UUPSUpgradeable,
|
|
18
|
-
OwnableUpgradeable,
|
|
19
18
|
AccessControlUpgradeable
|
|
20
19
|
{
|
|
21
20
|
bytes32 public constant WALLET_ADMIN_ROLE = keccak256("WALLET_ADMIN_ROLE");
|
|
@@ -28,10 +27,13 @@ contract AdminWallet is
|
|
|
28
27
|
uint256 public toppingTimes;
|
|
29
28
|
uint256 public gasPrice;
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
NameService public nameService;
|
|
32
31
|
|
|
33
32
|
mapping(uint256 => mapping(address => uint256)) toppings;
|
|
34
33
|
|
|
34
|
+
uint64 public maxDailyNewWallets;
|
|
35
|
+
uint64 public day;
|
|
36
|
+
|
|
35
37
|
event AdminsAdded(address payable[] indexed admins);
|
|
36
38
|
event AdminsRemoved(address[] indexed admins);
|
|
37
39
|
event WalletTopped(address indexed user, uint256 amount);
|
|
@@ -47,17 +49,29 @@ contract AdminWallet is
|
|
|
47
49
|
*/
|
|
48
50
|
function initialize(
|
|
49
51
|
address payable[] memory _admins,
|
|
52
|
+
NameService _ns,
|
|
50
53
|
address _owner,
|
|
51
|
-
|
|
54
|
+
uint256 _gasPrice
|
|
52
55
|
) public initializer {
|
|
53
56
|
__AccessControl_init_unchained();
|
|
54
|
-
__Ownable_init_unchained();
|
|
55
57
|
_setupRole(DEFAULT_ADMIN_ROLE, _owner);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
|
|
59
|
+
|
|
60
|
+
_setDefaults(600000, 9e6, 3, _gasPrice);
|
|
61
|
+
nameService = _ns;
|
|
58
62
|
if (_admins.length > 0) {
|
|
59
63
|
addAdmins(_admins);
|
|
60
64
|
}
|
|
65
|
+
if (msg.sender != _owner) revokeRole(DEFAULT_ADMIN_ROLE, msg.sender);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
modifier onlyOwner() {
|
|
69
|
+
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "not owner");
|
|
70
|
+
_;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function getIdentity() public view returns (IIdentityV2) {
|
|
74
|
+
return IIdentityV2(nameService.getAddress("IDENTITY"));
|
|
61
75
|
}
|
|
62
76
|
|
|
63
77
|
function setDefaults(
|
|
@@ -171,28 +185,45 @@ contract AdminWallet is
|
|
|
171
185
|
onlyAdmin
|
|
172
186
|
reimburseGas
|
|
173
187
|
{
|
|
174
|
-
|
|
188
|
+
getIdentity().addWhitelistedWithDID(_user, _did);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/* @dev Function to add given address to whitelist of identity contract
|
|
192
|
+
* can only be done by admins of wallet and if wallet is an IdentityAdmin
|
|
193
|
+
*/
|
|
194
|
+
function whitelist(
|
|
195
|
+
address _user,
|
|
196
|
+
string memory _did,
|
|
197
|
+
uint256 orgChain,
|
|
198
|
+
uint256 dateAuthenticated
|
|
199
|
+
) public onlyAdmin reimburseGas {
|
|
200
|
+
getIdentity().addWhitelistedWithDIDAndChain(
|
|
201
|
+
_user,
|
|
202
|
+
_did,
|
|
203
|
+
orgChain,
|
|
204
|
+
dateAuthenticated
|
|
205
|
+
);
|
|
175
206
|
}
|
|
176
207
|
|
|
177
208
|
/* @dev Function to remove given address from whitelist of identity contract
|
|
178
209
|
* can only be done by admins of wallet and if wallet is an IdentityAdmin
|
|
179
210
|
*/
|
|
180
211
|
function removeWhitelist(address _user) public onlyAdmin reimburseGas {
|
|
181
|
-
|
|
212
|
+
getIdentity().removeWhitelisted(_user);
|
|
182
213
|
}
|
|
183
214
|
|
|
184
215
|
/* @dev Function to add given address to blacklist of identity contract
|
|
185
216
|
* can only be done by admins of wallet and if wallet is an IdentityAdmin
|
|
186
217
|
*/
|
|
187
218
|
function blacklist(address _user) public onlyAdmin reimburseGas {
|
|
188
|
-
|
|
219
|
+
getIdentity().addBlacklisted(_user);
|
|
189
220
|
}
|
|
190
221
|
|
|
191
222
|
/* @dev Function to remove given address from blacklist of identity contract
|
|
192
223
|
* can only be done by admins of wallet and if wallet is an IdentityAdmin
|
|
193
224
|
*/
|
|
194
225
|
function removeBlacklist(address _user) public onlyAdmin reimburseGas {
|
|
195
|
-
|
|
226
|
+
getIdentity().removeBlacklisted(_user);
|
|
196
227
|
}
|
|
197
228
|
|
|
198
229
|
/* @dev Function to top given address with amount of G$ given in constructor
|
package/hardhat.config.ts
CHANGED
|
@@ -60,8 +60,8 @@ const hhconfig: HardhatUserConfig = {
|
|
|
60
60
|
network: "celo",
|
|
61
61
|
chainId: 42220,
|
|
62
62
|
urls: {
|
|
63
|
-
apiURL: "https://api.celoscan.io",
|
|
64
|
-
browserURL: "https://celoscan.io"
|
|
63
|
+
apiURL: "https://api.celoscan.io/api",
|
|
64
|
+
browserURL: "https://celoscan.io/"
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
]
|
|
@@ -193,6 +193,20 @@ const hhconfig: HardhatUserConfig = {
|
|
|
193
193
|
gas: 3000000,
|
|
194
194
|
gasPrice: 500000000,
|
|
195
195
|
chainId: 42220
|
|
196
|
+
},
|
|
197
|
+
"staging-celo": {
|
|
198
|
+
accounts: { mnemonic },
|
|
199
|
+
url: "https://forno.celo.org",
|
|
200
|
+
gas: 3000000,
|
|
201
|
+
gasPrice: 150000000,
|
|
202
|
+
chainId: 42220
|
|
203
|
+
},
|
|
204
|
+
"development-celo": {
|
|
205
|
+
accounts: { mnemonic },
|
|
206
|
+
url: "https://forno.celo.org",
|
|
207
|
+
gas: 3000000,
|
|
208
|
+
gasPrice: 150000000,
|
|
209
|
+
chainId: 42220
|
|
196
210
|
}
|
|
197
211
|
},
|
|
198
212
|
mocha: {
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddollar/goodprotocol",
|
|
3
|
-
"version": "1.0.29-beta.
|
|
3
|
+
"version": "1.0.29-beta.2",
|
|
4
4
|
"description": "GoodDollar Protocol",
|
|
5
5
|
"scripts": {
|
|
6
|
+
"prepack": "npm run minimize",
|
|
6
7
|
"build": "scripts/build.sh deploy",
|
|
7
8
|
"coverage:report": "export COVERALLS_REPO_TOKEN='qiXNelh1HXMAsoPah9yRD2yG2WlqrDfLh' && cat ../coverage/lcov.info coverage/lcov.info | coveralls",
|
|
8
9
|
"coverage": "export CODE_COVERAGE=true; hardhat --max-memory 6096 coverage",
|
|
@@ -55,7 +56,7 @@
|
|
|
55
56
|
},
|
|
56
57
|
"homepage": "https://gooddollar.org",
|
|
57
58
|
"dependencies": {
|
|
58
|
-
"@gooddollar/goodcontracts": "^2.6.
|
|
59
|
+
"@gooddollar/goodcontracts": "^2.6.4",
|
|
59
60
|
"@jsier/retrier": "^1.2.4",
|
|
60
61
|
"@openzeppelin/contracts": "^4.5.0",
|
|
61
62
|
"@openzeppelin/contracts-upgradeable": "^4.3.2",
|