@gooddollar/goodprotocol 2.1.3 → 2.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/artifacts/abis/IdentityV4.min.json +1 -0
- package/artifacts/contracts/DAOStackInterfaces.sol/Avatar.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/Controller.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/GlobalConstraintInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/IntVoteInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/ReputationInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/SchemeRegistrar.dbg.json +1 -1
- package/artifacts/contracts/IUniswapV3.sol/INonfungiblePositionManager.dbg.json +1 -1
- package/artifacts/contracts/IUniswapV3.sol/IUniswapV3Pool.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/AggregatorV3Interface.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ERC20.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IAaveIncentivesController.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IAdminWallet.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IDonationStaking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IERC2917.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IFirstClaimPool.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IGoodDollar.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IGoodStaking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IHasRouter.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IIdentity.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IIdentityV2.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ILendingPool.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IMultichainRouter.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/INameService.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IQuoterV2.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ISwapRouter.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IUBIScheme.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ProxyAdmin.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Reserve.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Uniswap.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/UniswapFactory.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/UniswapPair.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/cERC20.dbg.json +1 -1
- package/artifacts/contracts/MentoInterfaces.sol/IBancorExchangeProvider.dbg.json +1 -1
- package/artifacts/contracts/MentoInterfaces.sol/IBroker.dbg.json +1 -1
- package/artifacts/contracts/MentoInterfaces.sol/IGoodDollarExchangeProvider.dbg.json +1 -1
- package/artifacts/contracts/MentoInterfaces.sol/IGoodDollarExpansionController.dbg.json +1 -1
- package/artifacts/contracts/MentoInterfaces.sol/IMentoReserve.dbg.json +1 -1
- package/artifacts/contracts/MentoInterfaces.sol/ITradingLimits.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/FuseFaucetV2.sol/FuseFaucetV2.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/SuperfluidFacuet.sol/SuperfluidFaucet.dbg.json +1 -1
- package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
- package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
- package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.json +2 -2
- package/artifacts/contracts/governance/GoodDollarStaking.sol/IGovernanceStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/IStakingUpgrade.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.dbg.json +1 -1
- package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/MultiBaseGovernanceShareField.sol/MultiBaseGovernanceShareField.dbg.json +1 -1
- package/artifacts/contracts/governance/Reputation.sol/Reputation.dbg.json +1 -1
- package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
- package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.dbg.json +1 -1
- package/artifacts/contracts/identity/IdentityV3.sol/IdentityV3.dbg.json +1 -1
- package/artifacts/contracts/identity/IdentityV3.sol/IdentityV3.json +2 -2
- package/artifacts/contracts/identity/IdentityV4.sol/IdentityV4.dbg.json +4 -0
- package/artifacts/contracts/identity/IdentityV4.sol/IdentityV4.json +1162 -0
- package/artifacts/contracts/invite/InvitesFuseV2.sol/InvitesFuseV2.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.dbg.json +1 -1
- package/artifacts/contracts/invite/OneTimeReward.sol/OneTimeReward.dbg.json +1 -1
- package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/AaveUSDMockOracle.sol/AaveUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/BatUSDMockOracle.sol/BatUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTestHelper.dbg.json +1 -1
- package/artifacts/contracts/mocks/CompUsdMockOracle.sol/CompUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DaiEthPriceMockOracle.sol/DaiEthPriceMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.json +2 -2
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +1 -1
- package/artifacts/contracts/mocks/EthUSDMockOracle.sol/EthUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/FeesFormularMock.sol/FeesFormulaMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/GasPriceMockOracle.sol/GasPriceMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTestHelper.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.json +2 -2
- package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/IdentityMock.sol/IdentityMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/IWrapper.dbg.json +1 -1
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.json +2 -2
- package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
- package/artifacts/contracts/mocks/PayableMock.sol/PayableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.dbg.json +1 -1
- package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.json +2 -2
- package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.dbg.json +1 -1
- package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
- package/artifacts/contracts/reserve/CeloDistributionHelper.sol/CeloDistributionHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/GenericDistributionHelper.sol/GenericDistributionHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/ContributionCalc.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.dbg.json +1 -1
- package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
- package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.dbg.json +1 -1
- package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.dbg.json +1 -1
- package/artifacts/contracts/staking/FuseStakingV3.sol/IConsensus.dbg.json +1 -1
- package/artifacts/contracts/staking/FuseStakingV3.sol/PegSwap.dbg.json +1 -1
- package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.dbg.json +1 -1
- package/artifacts/contracts/staking/SimpleStaking.sol/SimpleStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/SimpleStakingV2.sol/SimpleStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/utils/Math64X64.sol/Math64x64.dbg.json +1 -1
- package/artifacts/contracts/staking/utils/StakingRewardsFixedAPY.sol/StakingRewardsFixedAPY.dbg.json +1 -1
- package/artifacts/contracts/token/ERC20PresetMinterPauserUpgradeable.sol/ERC20PresetMinterPauserUpgradeable.dbg.json +1 -1
- package/artifacts/contracts/token/ERC677.sol/ERC677.dbg.json +1 -1
- package/artifacts/contracts/token/ERC677.sol/ERC677Receiver.dbg.json +1 -1
- package/artifacts/contracts/token/GoodDollar.sol/GoodDollar.dbg.json +1 -1
- package/artifacts/contracts/token/GoodDollar2.sol/GoodDollar2.dbg.json +1 -1
- package/artifacts/contracts/token/IFeesFormula.sol/IFeesFormula.dbg.json +1 -1
- package/artifacts/contracts/token/MultichainFeeFormula.sol/MultichainFeeFormula.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ERC20Permit.sol/ERC20Permit.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ERC20Permit.sol/SelfApprove.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/IGoodDollarCustom.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/ISuperGoodDollar.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ISuperToken.sol/ISuperToken.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/SuperToken.sol/SuperToken.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/SuperfluidToken.sol/SuperfluidToken.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/UUPSProxiable.sol/UUPSProxiable.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/UUPSProxy.sol/Proxy.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSProxy.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSUtils.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBISchemeV2.sol/UBISchemeV2.dbg.json +1 -1
- package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
- package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
- package/artifacts/contracts/utils/BulkProof.sol/BulkProof.dbg.json +1 -1
- package/artifacts/contracts/utils/BulkWhitelist.sol/BulkWhitelist.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyAndBridgeHelper.sol/BuyAndBridgeHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyFromReserveHelper.sol/BuyFromReserveHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDClone.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDCloneFactory.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/DonateGDClone.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
- package/artifacts/contracts/utils/DSMath.sol/DSMath.dbg.json +1 -1
- package/artifacts/contracts/utils/DataTypes.sol/DataTypes.dbg.json +1 -1
- package/artifacts/contracts/utils/FuseOldBridgeKill.sol/EternalStorage.dbg.json +1 -1
- package/artifacts/contracts/utils/FuseOldBridgeKill.sol/FuseOldBridgeKill.dbg.json +1 -1
- package/artifacts/contracts/utils/FuseOldBridgeKill.sol/IUpgradeabilityOwnerStorage.dbg.json +1 -1
- package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Initializable.dbg.json +1 -1
- package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Ownable.dbg.json +1 -1
- package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Upgradeable.dbg.json +1 -1
- package/artifacts/contracts/utils/GDFaucet.sol/GDFaucet.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/IRouter.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/PausableControl.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.dbg.json +1 -1
- package/artifacts/contracts/utils/IdentityFix.sol/IdentityFix.dbg.json +1 -1
- package/artifacts/contracts/utils/LastauthReduction.sol/LastauthReduction.dbg.json +1 -1
- package/artifacts/contracts/utils/LastauthReduction.sol/LastauthReduction.json +2 -2
- package/artifacts/contracts/utils/MultiCall.sol/Multicall.dbg.json +1 -1
- package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
- package/artifacts/contracts/utils/OneTimePayments.sol/OneTimePayments.dbg.json +1 -1
- package/artifacts/contracts/utils/OneTimePaymentsV2.sol/OneTimePaymentsV2.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtoclUpgradeV4Mento.sol/MentoExchange.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtoclUpgradeV4Mento.sol/ProtocolUpgradeV4Mento.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgrade.sol/OldMarketMaker.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.dbg.json +1 -1
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.dbg.json +1 -1
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.dbg.json +1 -1
- package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/ReserveRestore.sol/ReserveRestore.dbg.json +1 -1
- package/artifacts/contracts/utils/ReserveRestore.sol/ReserveRestore.json +2 -2
- package/contracts/identity/IdentityV3.sol +0 -3
- package/contracts/identity/IdentityV4.sol +578 -0
- package/hardhat.config.ts +3 -4
- package/package.json +8 -4
- package/test/governance/ClaimersDistribution.test.ts +1 -1
- package/test/governance/CompoundVotingMachine.castvote.test.ts +30 -30
- package/test/helpers.ts +76 -195
- package/test/identity/IdentityV3.test.ts +53 -129
- package/test/identity/IdentityV4.test.ts +454 -0
- package/test/reserve/GenericDistributionHelper.e2e.test.ts +445 -0
- package/test/utils/AdminWallet.test.ts +14 -15
- package/types/contracts/identity/IdentityV4.ts +2001 -0
- package/types/contracts/identity/index.ts +1 -0
- package/types/contracts/utils/UpdateReserveRatio.sol/MentoExchange.ts +81 -0
- package/types/contracts/utils/UpdateReserveRatio.sol/UpdateReserveRatio.ts +134 -0
- package/types/contracts/utils/UpdateReserveRatio.sol/index.ts +5 -0
- package/types/contracts/utils/UpdateReserveRatioAfterXDC.sol/UpdateReserveRatioAfterXDC.ts +7 -2
- package/types/contracts/utils/index.ts +2 -2
- package/types/factories/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking__factory.ts +1 -1
- package/types/factories/contracts/identity/IdentityV3__factory.ts +1 -1
- package/types/factories/contracts/identity/IdentityV4__factory.ts +1213 -0
- package/types/factories/contracts/identity/index.ts +1 -0
- package/types/factories/contracts/mocks/DistributionBridgeMock__factory.ts +1 -1
- package/types/factories/contracts/mocks/GoodDollarStakingMock__factory.ts +1 -1
- package/types/factories/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock__factory.ts +1 -1
- package/types/factories/contracts/mocks/StakingMockFixedAPY__factory.ts +1 -1
- package/types/factories/contracts/utils/LastauthReduction__factory.ts +1 -1
- package/types/factories/contracts/utils/ReserveRestore__factory.ts +1 -1
- package/types/factories/contracts/utils/UpdateReserveRatio.sol/MentoExchange__factory.ts +39 -0
- package/types/factories/contracts/utils/UpdateReserveRatio.sol/UpdateReserveRatio__factory.ts +113 -0
- package/types/factories/contracts/utils/UpdateReserveRatio.sol/index.ts +5 -0
- package/types/factories/contracts/utils/UpdateReserveRatioAfterXDC.sol/UpdateReserveRatioAfterXDC__factory.ts +9 -15
- package/types/factories/contracts/utils/index.ts +1 -1
- package/types/hardhat.d.ts +13 -4
- package/types/index.ts +4 -2
- package/scripts/ProxyFactory.json +0 -4425
- package/scripts/analytics/activeGDStakers.ts +0 -188
- package/scripts/analytics/activeStakers.ts +0 -25
- package/scripts/analytics/activeUsersCount.ts +0 -156
- package/scripts/analytics/activeWalletsStats.ts +0 -301
- package/scripts/analytics/checkActiveWallets.ts +0 -60
- package/scripts/analytics/checkBridgeBalances.ts +0 -442
- package/scripts/analytics/claimIncidentStats.ts +0 -98
- package/scripts/analytics/faucetStats.ts +0 -130
- package/scripts/analytics/gdinflow.ts +0 -57
- package/scripts/analytics/goodHolders.ts +0 -46
- package/scripts/analytics/goodgiveback.ts +0 -64
- package/scripts/analytics/p2pTxs.ts +0 -564
- package/scripts/analytics/stuckgd.ts +0 -70
- package/scripts/analytics/tokenInOutStats.ts +0 -48
- package/scripts/analytics/whitelistsyncIssue.ts +0 -87
- package/scripts/bulkProof.ts +0 -202
- package/scripts/bulkWhitelist.ts +0 -31
- package/scripts/deployGnosisSafe.ts +0 -111
- package/scripts/fetchOrDeployProxyFactory.ts +0 -46
- package/scripts/fv.ts +0 -263
- package/scripts/gdx/gdxAirdropCalculation.ts +0 -479
- package/scripts/getFounders.ts +0 -32
- package/scripts/governance/README.md +0 -70
- package/scripts/governance/airdropCalculation.ts +0 -1119
- package/scripts/governance/airdropCalculationRecover.ts +0 -416
- package/scripts/governance/airdropCalculationSorted.ts +0 -438
- package/scripts/governance/goodCheckpointSorted.ts +0 -300
- package/scripts/keeper/fishInactive.ts +0 -47
- package/scripts/minimize.sh +0 -17
- package/scripts/multichain-deploy/0_proxyFactory-deploy.ts +0 -131
- package/scripts/multichain-deploy/1_basicdao-deploy.ts +0 -294
- package/scripts/multichain-deploy/2_helpers-deploy.ts +0 -152
- package/scripts/multichain-deploy/2b_otp-deploy.ts +0 -73
- package/scripts/multichain-deploy/3_gdSavings-deploy.ts +0 -190
- package/scripts/multichain-deploy/4_ubi-deploy.ts +0 -129
- package/scripts/multichain-deploy/5_gov-deploy.ts +0 -179
- package/scripts/multichain-deploy/6_testnetFaucet.ts +0 -85
- package/scripts/multichain-deploy/7_superfluidfaucet-deploy.ts +0 -123
- package/scripts/multichain-deploy/8_disthelper-deploy.ts +0 -152
- package/scripts/multichain-deploy/createUniswapTestPools.ts +0 -163
- package/scripts/multichain-deploy/flattened/Avatar.sol +0 -913
- package/scripts/multichain-deploy/flattened/Controller.sol +0 -1891
- package/scripts/multichain-deploy/flattened/FeeFormula.sol +0 -1290
- package/scripts/multichain-deploy/fulldeploy.sh +0 -26
- package/scripts/multichain-deploy/helpers.ts +0 -647
- package/scripts/multichain-deploy/multichainWrapper-deploy.ts +0 -59
- package/scripts/multichain-deploy/verifyEtherscan.ts +0 -177
- package/scripts/proposals/gip-14_1.ts +0 -251
- package/scripts/proposals/gip-15.ts +0 -427
- package/scripts/proposals/gip-25-xdc-upgrade-ubi.ts +0 -746
- package/scripts/proposals/gips-14_1.md +0 -29
- package/scripts/proposals/hack-ubi-recovery.ts +0 -414
- package/scripts/proposals/identityAuthPeriod.ts +0 -229
- package/scripts/proposals/reserveRestore.ts +0 -474
- package/scripts/proposals/updateDistHelper.ts +0 -180
- package/scripts/proposals/v4Upgrade.ts +0 -845
- package/scripts/releaser.js +0 -24
- package/scripts/staking/stakersGdRewardsCalculation.ts +0 -64
- package/scripts/upgradeScheme.ts +0 -97
- package/scripts/upgradeToV2/upgradeToV2.ts +0 -853
- package/scripts/upgradeToV2/upgradeToV2Recover.ts +0 -939
- package/scripts/upgradeToV3/v3-fix.ts +0 -120
- package/scripts/upgradeToV3/v3-fuse-multichain.ts +0 -117
- package/scripts/upgradeToV3/v3-upgrade.ts +0 -219
- package/scripts/upgrades/celo-defi-ubi-deploy.ts +0 -184
- package/scripts/upgrades/identity-upgrade.ts +0 -126
- package/scripts/upgrades/multichain-formula-upgrade.ts +0 -143
- package/scripts/upgrades/multichain-temp-fix.ts +0 -129
- package/scripts/upgrades/restoreFunds.ts +0 -91
- package/scripts/upgrades/superfluid-nft-celo-gas-token.ts +0 -159
- package/scripts/upgrades/transferDaoToGuardians.ts +0 -80
- package/scripts/upgrades/upgradeAdminWallet.ts +0 -29
- package/scripts/upgrades/upgradeFaucet.ts +0 -46
- package/scripts/utils.ts +0 -50
- package/scripts/verify.ts +0 -67
- package/scripts/voltageswaps.ts +0 -46
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.0;
|
|
3
|
+
|
|
4
|
+
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
|
|
5
|
+
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
|
|
6
|
+
import "@openzeppelin/contracts-upgradeable/utils/cryptography/SignatureCheckerUpgradeable.sol";
|
|
7
|
+
import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol";
|
|
8
|
+
import "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol";
|
|
9
|
+
|
|
10
|
+
import "../utils/DAOUpgradeableContract.sol";
|
|
11
|
+
import "../utils/NameService.sol";
|
|
12
|
+
import "../Interfaces.sol";
|
|
13
|
+
|
|
14
|
+
// import "hardhat/console.sol";
|
|
15
|
+
|
|
16
|
+
/* @title Identity contract responsible for whitelisting
|
|
17
|
+
* and keeping track of amount of whitelisted users
|
|
18
|
+
*/
|
|
19
|
+
contract IdentityV4 is
|
|
20
|
+
DAOUpgradeableContract,
|
|
21
|
+
AccessControlUpgradeable,
|
|
22
|
+
PausableUpgradeable,
|
|
23
|
+
EIP712Upgradeable
|
|
24
|
+
{
|
|
25
|
+
struct Identity {
|
|
26
|
+
uint256 dateAuthenticated;
|
|
27
|
+
uint256 dateAdded;
|
|
28
|
+
string did;
|
|
29
|
+
uint256 whitelistedOnChainId;
|
|
30
|
+
uint8 status; //0 nothing, 1 whitelisted, 2 daocontract, 255 blacklisted
|
|
31
|
+
uint32 authCount;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
bytes32 public constant IDENTITY_ADMIN_ROLE = keccak256("identity_admin");
|
|
35
|
+
bytes32 public constant PAUSER_ROLE = keccak256("pause_admin");
|
|
36
|
+
string public constant TYPED_STRUCTURE =
|
|
37
|
+
"ConnectIdentity(address whitelisted,address connected,uint256 deadline)";
|
|
38
|
+
|
|
39
|
+
/* @dev rough estimate of number of whitelisted addresses */
|
|
40
|
+
uint256 public whitelistedCount;
|
|
41
|
+
uint256 public whitelistedContracts;
|
|
42
|
+
uint256 private unused_authenticationPeriod;
|
|
43
|
+
|
|
44
|
+
mapping(address => Identity) public identities;
|
|
45
|
+
|
|
46
|
+
mapping(bytes32 => address) public didHashToAddress;
|
|
47
|
+
|
|
48
|
+
mapping(address => address) public connectedAccounts;
|
|
49
|
+
|
|
50
|
+
IIdentity public oldIdentity;
|
|
51
|
+
|
|
52
|
+
uint32[] public reverifyDaysOptions;
|
|
53
|
+
|
|
54
|
+
event BlacklistAdded(address indexed account);
|
|
55
|
+
event BlacklistRemoved(address indexed account);
|
|
56
|
+
|
|
57
|
+
event WhitelistedAdded(address indexed account);
|
|
58
|
+
event WhitelistedRemoved(address indexed account);
|
|
59
|
+
event WhitelistedAuthenticated(address indexed account, uint256 timestamp);
|
|
60
|
+
|
|
61
|
+
event ContractAdded(address indexed account);
|
|
62
|
+
event ContractRemoved(address indexed account);
|
|
63
|
+
|
|
64
|
+
event AccountConnected(address indexed connected, address indexed to);
|
|
65
|
+
event AccountDisconnected(address indexed disconnected, address indexed from);
|
|
66
|
+
|
|
67
|
+
function initialize(
|
|
68
|
+
address _owner,
|
|
69
|
+
IIdentity _oldIdentity
|
|
70
|
+
) public initializer {
|
|
71
|
+
__AccessControl_init_unchained();
|
|
72
|
+
__Pausable_init_unchained();
|
|
73
|
+
__EIP712_init_unchained("Identity", "1.0.0");
|
|
74
|
+
_setupRole(DEFAULT_ADMIN_ROLE, _owner);
|
|
75
|
+
_setupRole(PAUSER_ROLE, _owner);
|
|
76
|
+
_setupRole(IDENTITY_ADMIN_ROLE, _owner);
|
|
77
|
+
|
|
78
|
+
oldIdentity = _oldIdentity;
|
|
79
|
+
|
|
80
|
+
// default reverify schedule (days)
|
|
81
|
+
// adjust as needed via setReverifyDaysOptions
|
|
82
|
+
reverifyDaysOptions.push(1);
|
|
83
|
+
reverifyDaysOptions.push(7);
|
|
84
|
+
reverifyDaysOptions.push(180);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @dev used to initialize after deployment once nameservice is available
|
|
89
|
+
*/
|
|
90
|
+
function initDAO(address _ns) external onlyRole(DEFAULT_ADMIN_ROLE) {
|
|
91
|
+
require(address(nameService) == address(0), "already initialized");
|
|
92
|
+
setDAO(INameService(_ns));
|
|
93
|
+
_setupRole(DEFAULT_ADMIN_ROLE, avatar);
|
|
94
|
+
_setupRole(PAUSER_ROLE, avatar);
|
|
95
|
+
_setupRole(IDENTITY_ADMIN_ROLE, avatar);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
modifier onlyWhitelisted() {
|
|
99
|
+
require(isWhitelisted(msg.sender), "not whitelisted");
|
|
100
|
+
_;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @dev Set the reverification schedule (days). Only identity admins.
|
|
105
|
+
* Provide non-empty array. Values must fit in uint8 (<=255).
|
|
106
|
+
*/
|
|
107
|
+
function setReverifyDaysOptions(
|
|
108
|
+
uint8[] calldata options
|
|
109
|
+
) external onlyRole(IDENTITY_ADMIN_ROLE) {
|
|
110
|
+
require(options.length > 0, "empty options");
|
|
111
|
+
// replace storage array
|
|
112
|
+
delete reverifyDaysOptions;
|
|
113
|
+
for (uint256 i = 0; i < options.length; i++) {
|
|
114
|
+
reverifyDaysOptions.push(options[i]);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @dev Sets the authentication date of `account`
|
|
120
|
+
* to the current time.
|
|
121
|
+
* Can only be called by Identity Administrators.
|
|
122
|
+
* @param account address to change its auth date
|
|
123
|
+
*/
|
|
124
|
+
function authenticate(address account) public {
|
|
125
|
+
return authenticateWithTimestamp(account, block.timestamp);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @dev Sets the authentication date of `account`
|
|
130
|
+
* to the current time.
|
|
131
|
+
* Can only be called by Identity Administrators.
|
|
132
|
+
* @param account address to change its auth date
|
|
133
|
+
* @param timestamp the authentication timestamp
|
|
134
|
+
*/
|
|
135
|
+
function authenticateWithTimestamp(
|
|
136
|
+
address account,
|
|
137
|
+
uint256 timestamp
|
|
138
|
+
) public onlyRole(IDENTITY_ADMIN_ROLE) whenNotPaused {
|
|
139
|
+
require(identities[account].status == 1, "not whitelisted");
|
|
140
|
+
uint daysSinceAuthentication = (timestamp -
|
|
141
|
+
identities[account].dateAuthenticated) / 1 days;
|
|
142
|
+
|
|
143
|
+
// should happen before updating dateAuthenticated
|
|
144
|
+
if (shouldReverify(account, daysSinceAuthentication)) {
|
|
145
|
+
identities[account].authCount += 1;
|
|
146
|
+
// if authCount has advanced past the last configured reverify step,
|
|
147
|
+
// reset back to start (cycle). This ensures we won't index out of bounds
|
|
148
|
+
// and allows repeated cycles through the reverify schedule.
|
|
149
|
+
if (identities[account].authCount >= reverifyDaysOptions.length) {
|
|
150
|
+
identities[account].authCount = 0;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
identities[account].dateAuthenticated = timestamp;
|
|
154
|
+
|
|
155
|
+
emit WhitelistedAuthenticated(account, timestamp);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* @dev Adds an address as whitelisted.
|
|
160
|
+
* Can only be called by Identity Administrators.
|
|
161
|
+
* @param account address to add as whitelisted
|
|
162
|
+
*/
|
|
163
|
+
function addWhitelisted(
|
|
164
|
+
address account
|
|
165
|
+
) public onlyRole(IDENTITY_ADMIN_ROLE) whenNotPaused {
|
|
166
|
+
_addWhitelisted(account, _chainId());
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
@dev Adds an address as whitelisted under a specific ID
|
|
171
|
+
@param account The address to add
|
|
172
|
+
@param did the ID to add account under
|
|
173
|
+
*/
|
|
174
|
+
function addWhitelistedWithDIDAndChain(
|
|
175
|
+
address account,
|
|
176
|
+
string memory did,
|
|
177
|
+
uint256 orgChain,
|
|
178
|
+
uint256 dateAuthenticated
|
|
179
|
+
) external onlyRole(IDENTITY_ADMIN_ROLE) whenNotPaused {
|
|
180
|
+
_addWhitelistedWithDID(account, did, orgChain);
|
|
181
|
+
|
|
182
|
+
//in case we are whitelisting on a new chain an already whitelisted account, we need to make sure it expires at the same time
|
|
183
|
+
if (dateAuthenticated > 0) {
|
|
184
|
+
identities[account].dateAuthenticated = dateAuthenticated;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* @dev Adds an address as whitelisted under a specific ID
|
|
190
|
+
* @param account The address to add
|
|
191
|
+
* @param did the ID to add account under
|
|
192
|
+
*/
|
|
193
|
+
function addWhitelistedWithDID(
|
|
194
|
+
address account,
|
|
195
|
+
string memory did
|
|
196
|
+
) public onlyRole(IDENTITY_ADMIN_ROLE) whenNotPaused {
|
|
197
|
+
_addWhitelistedWithDID(account, did, _chainId());
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* @dev Removes an address as whitelisted.
|
|
202
|
+
* Can only be called by Identity Administrators.
|
|
203
|
+
* @param account address to remove as whitelisted
|
|
204
|
+
*/
|
|
205
|
+
function removeWhitelisted(
|
|
206
|
+
address account
|
|
207
|
+
) public onlyRole(IDENTITY_ADMIN_ROLE) whenNotPaused {
|
|
208
|
+
_removeWhitelisted(account);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* @dev Renounces message sender from whitelisted
|
|
213
|
+
*/
|
|
214
|
+
function renounceWhitelisted() external whenNotPaused onlyWhitelisted {
|
|
215
|
+
_removeWhitelisted(msg.sender);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function shouldReverify(
|
|
219
|
+
address account,
|
|
220
|
+
uint daysSinceAuth
|
|
221
|
+
) public view returns (bool) {
|
|
222
|
+
if (identities[account].authCount >= reverifyDaysOptions.length)
|
|
223
|
+
return false;
|
|
224
|
+
uint reverifyAfterDays = reverifyDaysOptions[identities[account].authCount];
|
|
225
|
+
if (daysSinceAuth >= reverifyAfterDays) return true;
|
|
226
|
+
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* @dev Returns true if given address has been added to whitelist
|
|
232
|
+
* @param account the address to check
|
|
233
|
+
* @return a bool indicating weather the address is present in whitelist
|
|
234
|
+
*/
|
|
235
|
+
function isWhitelisted(address account) public view returns (bool) {
|
|
236
|
+
uint256 daysSinceAuthentication = (block.timestamp -
|
|
237
|
+
identities[account].dateAuthenticated) / 1 days;
|
|
238
|
+
|
|
239
|
+
if (identities[account].status == 1) {
|
|
240
|
+
return shouldReverify(account, daysSinceAuthentication) == false;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (address(oldIdentity) != address(0)) {
|
|
244
|
+
try oldIdentity.isWhitelisted(account) returns (bool res) {
|
|
245
|
+
return res;
|
|
246
|
+
} catch {
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* @dev Function that gives the date the given user was added
|
|
255
|
+
* @param account The address to check
|
|
256
|
+
* @return The date the address was added
|
|
257
|
+
*/
|
|
258
|
+
function lastAuthenticated(address account) external view returns (uint256) {
|
|
259
|
+
if (identities[account].dateAuthenticated > 0)
|
|
260
|
+
return identities[account].dateAuthenticated;
|
|
261
|
+
if (address(oldIdentity) != address(0)) {
|
|
262
|
+
try oldIdentity.lastAuthenticated(account) returns (uint256 _lastAuth) {
|
|
263
|
+
return _lastAuth;
|
|
264
|
+
} catch {
|
|
265
|
+
return 0;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return 0;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* @dev Adds an address to blacklist.
|
|
273
|
+
* Can only be called by Identity Administrators.
|
|
274
|
+
* @param account address to add as blacklisted
|
|
275
|
+
*/
|
|
276
|
+
function addBlacklisted(
|
|
277
|
+
address account
|
|
278
|
+
) public onlyRole(IDENTITY_ADMIN_ROLE) whenNotPaused {
|
|
279
|
+
_removeWhitelisted(account);
|
|
280
|
+
identities[account].status = 255;
|
|
281
|
+
emit BlacklistAdded(account);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* @dev Removes an address from blacklist
|
|
286
|
+
* Can only be called by Identity Administrators.
|
|
287
|
+
* @param account address to remove as blacklisted
|
|
288
|
+
*/
|
|
289
|
+
function removeBlacklisted(
|
|
290
|
+
address account
|
|
291
|
+
) external onlyRole(IDENTITY_ADMIN_ROLE) whenNotPaused {
|
|
292
|
+
if (
|
|
293
|
+
address(oldIdentity) != address(0) && oldIdentity.isBlacklisted(account)
|
|
294
|
+
) oldIdentity.removeBlacklisted(account);
|
|
295
|
+
|
|
296
|
+
identities[account].status = 0;
|
|
297
|
+
emit BlacklistRemoved(account);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* @dev Function to add a Contract to list of contracts
|
|
302
|
+
* @param account The address to add
|
|
303
|
+
*/
|
|
304
|
+
function addContract(
|
|
305
|
+
address account
|
|
306
|
+
) public onlyRole(IDENTITY_ADMIN_ROLE) whenNotPaused {
|
|
307
|
+
require(isContract(account), "Given address is not a contract");
|
|
308
|
+
_addWhitelisted(account, _chainId());
|
|
309
|
+
identities[account].status = 2; //this must come after _addWhitelisted
|
|
310
|
+
|
|
311
|
+
emit ContractAdded(account);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* @dev Function to remove a Contract from list of contracts
|
|
316
|
+
* @param account The address to add
|
|
317
|
+
*/
|
|
318
|
+
function removeContract(
|
|
319
|
+
address account
|
|
320
|
+
) public onlyRole(IDENTITY_ADMIN_ROLE) whenNotPaused {
|
|
321
|
+
if (
|
|
322
|
+
address(oldIdentity) != address(0) && oldIdentity.isDAOContract(account)
|
|
323
|
+
) {
|
|
324
|
+
oldIdentity.removeContract(account);
|
|
325
|
+
}
|
|
326
|
+
_removeWhitelisted(account);
|
|
327
|
+
|
|
328
|
+
emit ContractRemoved(account);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* @dev Function to check if given contract is on list of contracts.
|
|
333
|
+
* @param account to check
|
|
334
|
+
* @return a bool indicating if address is on list of contracts
|
|
335
|
+
*/
|
|
336
|
+
function isDAOContract(address account) external view returns (bool) {
|
|
337
|
+
if (identities[account].status == 2) return true;
|
|
338
|
+
if (address(oldIdentity) != address(0)) {
|
|
339
|
+
try oldIdentity.isDAOContract(account) returns (bool res) {
|
|
340
|
+
return res;
|
|
341
|
+
} catch {
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return false;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* @dev Internal function to add to whitelisted
|
|
350
|
+
* @param account the address to add
|
|
351
|
+
*/
|
|
352
|
+
function _addWhitelisted(address account, uint256 orgChain) internal {
|
|
353
|
+
require(identities[account].status == 0, "already has status");
|
|
354
|
+
whitelistedCount += 1;
|
|
355
|
+
identities[account].status = 1;
|
|
356
|
+
identities[account].dateAdded = block.timestamp;
|
|
357
|
+
identities[account].dateAuthenticated = block.timestamp;
|
|
358
|
+
identities[account].whitelistedOnChainId = orgChain;
|
|
359
|
+
identities[account].authCount = 0;
|
|
360
|
+
connectedAccounts[account] = address(0);
|
|
361
|
+
|
|
362
|
+
if (isContract(account)) {
|
|
363
|
+
whitelistedContracts += 1;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
emit WhitelistedAdded(account);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* @dev Internal whitelisting with did function.
|
|
371
|
+
* @param account the address to add
|
|
372
|
+
* @param did the id to register account under
|
|
373
|
+
*/
|
|
374
|
+
function _addWhitelistedWithDID(
|
|
375
|
+
address account,
|
|
376
|
+
string memory did,
|
|
377
|
+
uint256 orgChain
|
|
378
|
+
) internal {
|
|
379
|
+
bytes32 pHash = keccak256(bytes(did));
|
|
380
|
+
require(didHashToAddress[pHash] == address(0), "DID already registered");
|
|
381
|
+
|
|
382
|
+
identities[account].did = did;
|
|
383
|
+
didHashToAddress[pHash] = account;
|
|
384
|
+
|
|
385
|
+
_addWhitelisted(account, orgChain);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* @dev Internal function to remove from whitelisted
|
|
390
|
+
* @param account the address to add
|
|
391
|
+
*/
|
|
392
|
+
function _removeWhitelisted(address account) internal {
|
|
393
|
+
if (identities[account].status == 1 || identities[account].status == 2) {
|
|
394
|
+
whitelistedCount -= 1;
|
|
395
|
+
|
|
396
|
+
if (isContract(account) && whitelistedContracts > 0) {
|
|
397
|
+
whitelistedContracts -= 1;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
string memory did = identities[account].did;
|
|
401
|
+
bytes32 pHash = keccak256(bytes(did));
|
|
402
|
+
|
|
403
|
+
delete identities[account];
|
|
404
|
+
delete didHashToAddress[pHash];
|
|
405
|
+
|
|
406
|
+
emit WhitelistedRemoved(account);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
if (
|
|
410
|
+
address(oldIdentity) != address(0) && oldIdentity.isWhitelisted(account)
|
|
411
|
+
) {
|
|
412
|
+
oldIdentity.removeWhitelisted(account);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/// @notice helper function to get current chain id
|
|
417
|
+
/// @return chainId id
|
|
418
|
+
function _chainId() internal view returns (uint256 chainId) {
|
|
419
|
+
assembly {
|
|
420
|
+
chainId := chainid()
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* @dev Returns true if given address has been added to the blacklist
|
|
426
|
+
* @param account the address to check
|
|
427
|
+
* @return a bool indicating weather the address is present in the blacklist
|
|
428
|
+
*/
|
|
429
|
+
function isBlacklisted(address account) public view returns (bool) {
|
|
430
|
+
if (identities[account].status == 255) return true;
|
|
431
|
+
if (address(oldIdentity) != address(0)) {
|
|
432
|
+
try oldIdentity.isBlacklisted(account) returns (bool res) {
|
|
433
|
+
return res;
|
|
434
|
+
} catch {
|
|
435
|
+
return false;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
return false;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* @dev Function to see if given address is a contract
|
|
443
|
+
* @return true if address is a contract
|
|
444
|
+
*/
|
|
445
|
+
function isContract(address _addr) internal view returns (bool) {
|
|
446
|
+
uint256 length;
|
|
447
|
+
assembly {
|
|
448
|
+
length := extcodesize(_addr)
|
|
449
|
+
}
|
|
450
|
+
return length > 0;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
@dev allows user to connect more accounts to his identity. msg.sender needs to be whitelisted
|
|
455
|
+
@param account the account to connect to msg.sender
|
|
456
|
+
*/
|
|
457
|
+
function connectAccount(address account) external onlyWhitelisted {
|
|
458
|
+
require(
|
|
459
|
+
!isWhitelisted(account) && !isBlacklisted(account),
|
|
460
|
+
"invalid account"
|
|
461
|
+
);
|
|
462
|
+
require(connectedAccounts[account] == address(0x0), "already connected");
|
|
463
|
+
|
|
464
|
+
connectedAccounts[account] = msg.sender;
|
|
465
|
+
emit AccountConnected(account, msg.sender);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
@dev disconnect a connected account from identity. can be performed either by identity or the connected account
|
|
470
|
+
@param connected the account to disconnect
|
|
471
|
+
*/
|
|
472
|
+
function disconnectAccount(address connected) external {
|
|
473
|
+
require(
|
|
474
|
+
connectedAccounts[connected] == msg.sender || msg.sender == connected,
|
|
475
|
+
"unauthorized"
|
|
476
|
+
);
|
|
477
|
+
delete connectedAccounts[connected];
|
|
478
|
+
emit AccountDisconnected(connected, msg.sender);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
@dev returns the identity in case account is connected or is the identity itself otherwise returns the empty address
|
|
483
|
+
@param account address to get its identity
|
|
484
|
+
@return whitelisted the identity or address 0 if _account not connected or not identity
|
|
485
|
+
**/
|
|
486
|
+
function getWhitelistedRoot(
|
|
487
|
+
address account
|
|
488
|
+
) external view returns (address whitelisted) {
|
|
489
|
+
if (isWhitelisted(account)) return account;
|
|
490
|
+
if (isWhitelisted(connectedAccounts[account]))
|
|
491
|
+
return connectedAccounts[account];
|
|
492
|
+
|
|
493
|
+
return address(0x0);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
function pause(bool toPause) external onlyRole(PAUSER_ROLE) {
|
|
497
|
+
if (toPause) _pause();
|
|
498
|
+
else _unpause();
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
@dev modify account did can be called by account owner or identity admin
|
|
503
|
+
@param account the account to modify
|
|
504
|
+
@param did the did to set
|
|
505
|
+
*/
|
|
506
|
+
function setDID(address account, string calldata did) external {
|
|
507
|
+
require(
|
|
508
|
+
msg.sender == account || hasRole(IDENTITY_ADMIN_ROLE, msg.sender),
|
|
509
|
+
"not authorized"
|
|
510
|
+
);
|
|
511
|
+
_setDID(account, did);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
function _setDID(address account, string memory did) internal {
|
|
515
|
+
require(isWhitelisted(account), "not whitelisted");
|
|
516
|
+
require(bytes(did).length > 0, "did empty");
|
|
517
|
+
bytes32 pHash = keccak256(bytes(did));
|
|
518
|
+
require(didHashToAddress[pHash] == address(0), "DID already registered");
|
|
519
|
+
|
|
520
|
+
if (address(oldIdentity) != address(0)) {
|
|
521
|
+
address oldDIDOwner;
|
|
522
|
+
try oldIdentity.didHashToAddress(pHash) returns (address _didOwner) {
|
|
523
|
+
oldDIDOwner = _didOwner;
|
|
524
|
+
} catch {}
|
|
525
|
+
//if owner not the same and doesnt have a new did set then revert
|
|
526
|
+
require(
|
|
527
|
+
oldDIDOwner == address(0) ||
|
|
528
|
+
oldDIDOwner == account ||
|
|
529
|
+
bytes(identities[oldDIDOwner].did).length > 0,
|
|
530
|
+
"DID already registered oldIdentity"
|
|
531
|
+
);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
bytes32 oldHash = keccak256(bytes(identities[account].did));
|
|
535
|
+
delete didHashToAddress[oldHash];
|
|
536
|
+
identities[account].did = did;
|
|
537
|
+
didHashToAddress[pHash] = account;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
@dev for backward compatability with V1
|
|
542
|
+
@param account to get DID for
|
|
543
|
+
@return did of the account
|
|
544
|
+
*/
|
|
545
|
+
function addrToDID(
|
|
546
|
+
address account
|
|
547
|
+
) external view returns (string memory did) {
|
|
548
|
+
did = identities[account].did;
|
|
549
|
+
bytes32 pHash = keccak256(bytes(did));
|
|
550
|
+
|
|
551
|
+
//if did was set in this contract return it, otherwise check oldidentity
|
|
552
|
+
if (didHashToAddress[pHash] == account) return did;
|
|
553
|
+
|
|
554
|
+
if (address(oldIdentity) != address(0)) {
|
|
555
|
+
try oldIdentity.addrToDID(account) returns (string memory _did) {
|
|
556
|
+
return _did;
|
|
557
|
+
} catch {
|
|
558
|
+
return "";
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
return "";
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
function getWhitelistedOnChainId(
|
|
566
|
+
address account
|
|
567
|
+
) external view returns (uint256 chainId) {
|
|
568
|
+
chainId = identities[account].whitelistedOnChainId;
|
|
569
|
+
return chainId > 0 ? chainId : _chainId();
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* backward compatability with IdentityV1 that GoodDollar token checks if the identity contract is registered
|
|
574
|
+
*/
|
|
575
|
+
function isRegistered() external pure returns (bool) {
|
|
576
|
+
return true;
|
|
577
|
+
}
|
|
578
|
+
}
|
package/hardhat.config.ts
CHANGED
|
@@ -29,7 +29,7 @@ envEnc.config();
|
|
|
29
29
|
config();
|
|
30
30
|
|
|
31
31
|
const mnemonic = process.env.MNEMONIC || "test test test test test test test test test test test junk";
|
|
32
|
-
const deployerPrivateKey = process.env.
|
|
32
|
+
const deployerPrivateKey = process.env.DEV_KEY || ethers.utils.hexZeroPad("0x11", 32);
|
|
33
33
|
const infura_api = process.env.INFURA_API;
|
|
34
34
|
const alchemy_key = process.env.ALCHEMY_KEY;
|
|
35
35
|
const etherscan_key = process.env.ETHERSCAN_KEY;
|
|
@@ -41,7 +41,7 @@ const MAINNET_URL = "https://mainnet.infura.io/v3/" + infura_api;
|
|
|
41
41
|
|
|
42
42
|
const xdc = {
|
|
43
43
|
accounts: { mnemonic },
|
|
44
|
-
url: "https://rpc.xdc
|
|
44
|
+
url: "https://rpc.ankr.com/xdc",
|
|
45
45
|
gas: 3000000,
|
|
46
46
|
gasPrice: 12.5e9,
|
|
47
47
|
chainId: 50
|
|
@@ -125,8 +125,7 @@ const hhconfig: HardhatUserConfig = {
|
|
|
125
125
|
initialDate: "2021-12-01", //required for DAO tests like guardian
|
|
126
126
|
forking: process.env.FORK_CHAIN_ID && {
|
|
127
127
|
url: "https://eth-mainnet.alchemyapi.io/v2/" + process.env.ALCHEMY_KEY
|
|
128
|
-
}
|
|
129
|
-
blockGasLimit: 100000000429720,
|
|
128
|
+
}
|
|
130
129
|
},
|
|
131
130
|
fork: {
|
|
132
131
|
chainId: 1,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddollar/goodprotocol",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.0-beta.1",
|
|
4
4
|
"description": "GoodDollar Protocol",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16.x"
|
|
@@ -30,7 +30,9 @@
|
|
|
30
30
|
"artifacts/abis",
|
|
31
31
|
"contracts",
|
|
32
32
|
"releases",
|
|
33
|
-
"scripts",
|
|
33
|
+
"scripts/test",
|
|
34
|
+
"scripts/blockchainTestSetup.sh",
|
|
35
|
+
"scripts/deployFullDAO.ts",
|
|
34
36
|
"yarn.lock",
|
|
35
37
|
"package.json",
|
|
36
38
|
"hardhat.config.ts",
|
|
@@ -76,7 +78,7 @@
|
|
|
76
78
|
"@jsier/retrier": "^1.2.4",
|
|
77
79
|
"@mean-finance/uniswap-v3-oracle": "^1.0.3",
|
|
78
80
|
"@nomicfoundation/hardhat-chai-matchers": "1",
|
|
79
|
-
"@nomicfoundation/hardhat-network-helpers": "
|
|
81
|
+
"@nomicfoundation/hardhat-network-helpers": "1.*",
|
|
80
82
|
"@nomicfoundation/hardhat-verify": "^2.1.0",
|
|
81
83
|
"@nomiclabs/hardhat-ethers": "^2.2.1",
|
|
82
84
|
"@nomiclabs/hardhat-waffle": "^2.0.6",
|
|
@@ -110,7 +112,7 @@
|
|
|
110
112
|
"fs-extra": "9.0.0",
|
|
111
113
|
"graphql": "^15.5.0",
|
|
112
114
|
"graphql-request": "^3.4.0",
|
|
113
|
-
"hardhat": "
|
|
115
|
+
"hardhat": "2.26",
|
|
114
116
|
"hardhat-contract-sizer": "^2.6.1",
|
|
115
117
|
"hardhat-deploy": "^1.0.4",
|
|
116
118
|
"hardhat-gas-reporter": "^1.0.8",
|
|
@@ -126,6 +128,8 @@
|
|
|
126
128
|
"press-any-key": "^0.1.1",
|
|
127
129
|
"prompt": "^1.3.0",
|
|
128
130
|
"regenerator-runtime": "^0.13.9",
|
|
131
|
+
"sharp": "^0.34.5",
|
|
132
|
+
"sharp-phash": "^2.2.0",
|
|
129
133
|
"solhint": "*",
|
|
130
134
|
"solidity-coverage": "^0.8.4",
|
|
131
135
|
"truffle": "^5.11.5",
|
|
@@ -257,6 +257,6 @@ describe("ClaimersDistribution", () => {
|
|
|
257
257
|
// console.log({ totalGas }, tx.gasUsed.toNumber(), tx2.gasUsed.toNumber());
|
|
258
258
|
}
|
|
259
259
|
console.log(Object.keys(gasCosts));
|
|
260
|
-
expect(totalGas / 30).lt(
|
|
260
|
+
expect(totalGas / 30).lt(319000);
|
|
261
261
|
});
|
|
262
262
|
});
|