@gooddollar/goodprotocol 2.0.12 → 2.0.13
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/AdminWalletFuse.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/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/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 +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/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
- package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
- package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/IGovernanceStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/IStakingUpgrade.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.dbg.json +1 -1
- package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/MultiBaseGovernanceShareField.sol/MultiBaseGovernanceShareField.dbg.json +1 -1
- package/artifacts/contracts/governance/Reputation.sol/Reputation.dbg.json +1 -1
- package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
- package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesFuseV2.sol/InvitesFuseV2.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.dbg.json +1 -1
- package/artifacts/contracts/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/CompUsdMockOracle.sol/CompUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DaiEthPriceMockOracle.sol/DaiEthPriceMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/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/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/IdentityMock.sol/IdentityMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/IWrapper.dbg.json +1 -1
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
- package/artifacts/contracts/mocks/PayableMock.sol/PayableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.dbg.json +1 -1
- package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.dbg.json +1 -1
- package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
- package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.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/FeesFormula.sol/IFeesFormula.dbg.json +1 -1
- package/artifacts/contracts/token/GoodDollar.sol/GoodDollar.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/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/AdminWallet.sol/AdminWallet.json +41 -2
- package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.json +35 -9
- 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/BuyAndBridgeHelper.sol/BuyAndBridgeHelper.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/ISwapRouter.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/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/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/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/contracts/utils/AdminWallet.sol +21 -10
- package/contracts/utils/AdminWalletFuse.sol +19 -14
- package/hardhat.config.ts +4 -0
- package/package.json +1 -1
- package/releases/deployment.json +3 -1
- package/scripts/analytics/checkActiveWallets.ts +60 -0
- package/scripts/analytics/faucetStats.ts +21 -34
- package/scripts/multichain-deploy/helpers.ts +2 -2
- package/scripts/upgrades/upgradeAdminWallet.ts +29 -0
- package/test/utils/AdminWallet.test.ts +49 -101
- package/types/AdminWallet.ts +59 -0
- package/types/AdminWalletFuse.ts +41 -7
- package/types/factories/AdminWalletFuse__factory.ts +34 -8
- package/types/factories/AdminWallet__factory.ts +40 -1
|
@@ -34,6 +34,9 @@ contract AdminWallet is
|
|
|
34
34
|
uint64 public maxDailyNewWallets;
|
|
35
35
|
uint64 public day;
|
|
36
36
|
|
|
37
|
+
ERC20 public gd;
|
|
38
|
+
mapping(address => uint256) public lastGdBalance; // only top non whitelisted if active G$ users
|
|
39
|
+
|
|
37
40
|
event AdminsAdded(address payable[] indexed admins);
|
|
38
41
|
event AdminsRemoved(address[] indexed admins);
|
|
39
42
|
event WalletTopped(address indexed user, uint256 amount);
|
|
@@ -63,6 +66,7 @@ contract AdminWallet is
|
|
|
63
66
|
addAdmins(_admins);
|
|
64
67
|
}
|
|
65
68
|
if (msg.sender != _owner) revokeRole(DEFAULT_ADMIN_ROLE, msg.sender);
|
|
69
|
+
gd = ERC20(nameService.getAddress("GOODDOLLAR"));
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
modifier onlyOwner() {
|
|
@@ -70,6 +74,10 @@ contract AdminWallet is
|
|
|
70
74
|
_;
|
|
71
75
|
}
|
|
72
76
|
|
|
77
|
+
function upgrade() public onlyOwner {
|
|
78
|
+
gd = ERC20(nameService.getAddress("GOODDOLLAR"));
|
|
79
|
+
}
|
|
80
|
+
|
|
73
81
|
function getIdentity() public view returns (IIdentityV2) {
|
|
74
82
|
return IIdentityV2(nameService.getAddress("IDENTITY"));
|
|
75
83
|
}
|
|
@@ -95,11 +103,9 @@ contract AdminWallet is
|
|
|
95
103
|
toppingTimes = _toppingTimes;
|
|
96
104
|
}
|
|
97
105
|
|
|
98
|
-
function _authorizeUpgrade(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
onlyOwner
|
|
102
|
-
{}
|
|
106
|
+
function _authorizeUpgrade(
|
|
107
|
+
address newImplementation
|
|
108
|
+
) internal override onlyOwner {}
|
|
103
109
|
|
|
104
110
|
/* @dev Modifier that checks if caller is admin of wallet
|
|
105
111
|
*/
|
|
@@ -180,11 +186,10 @@ contract AdminWallet is
|
|
|
180
186
|
/* @dev Function to add given address to whitelist of identity contract
|
|
181
187
|
* can only be done by admins of wallet and if wallet is an IdentityAdmin
|
|
182
188
|
*/
|
|
183
|
-
function whitelist(
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
{
|
|
189
|
+
function whitelist(
|
|
190
|
+
address _user,
|
|
191
|
+
string memory _did
|
|
192
|
+
) public onlyAdmin reimburseGas {
|
|
188
193
|
getIdentity().addWhitelistedWithDID(_user, _did);
|
|
189
194
|
}
|
|
190
195
|
|
|
@@ -231,10 +236,16 @@ contract AdminWallet is
|
|
|
231
236
|
* @param _user The address to transfer to
|
|
232
237
|
*/
|
|
233
238
|
function topWallet(address payable _user) public onlyAdmin reimburseGas {
|
|
239
|
+
uint256 gdBalance = gd.balanceOf(_user);
|
|
240
|
+
require(
|
|
241
|
+
getIdentity().isWhitelisted(_user) || gdBalance != lastGdBalance[_user],
|
|
242
|
+
"User has not used G$"
|
|
243
|
+
);
|
|
234
244
|
require(
|
|
235
245
|
toppings[currentDay()][_user] < toppingTimes,
|
|
236
246
|
"User wallet has been topped too many times today"
|
|
237
247
|
);
|
|
248
|
+
lastGdBalance[_user] = gdBalance;
|
|
238
249
|
if (address(_user).balance >= toppingAmount / 4) return;
|
|
239
250
|
|
|
240
251
|
_topWallet(_user);
|
|
@@ -39,6 +39,9 @@ contract AdminWalletFuse is
|
|
|
39
39
|
|
|
40
40
|
uint32 public version;
|
|
41
41
|
|
|
42
|
+
ERC20 public gd;
|
|
43
|
+
mapping(address => uint256) public lastGdBalance; // only top non whitelisted if active G$ users
|
|
44
|
+
|
|
42
45
|
event AdminsAdded(address payable[] indexed admins);
|
|
43
46
|
event AdminsRemoved(address[] indexed admins);
|
|
44
47
|
event WalletTopped(address indexed user, uint256 amount);
|
|
@@ -68,12 +71,11 @@ contract AdminWalletFuse is
|
|
|
68
71
|
if (_admins.length > 0) {
|
|
69
72
|
addAdmins(_admins);
|
|
70
73
|
}
|
|
74
|
+
gd = ERC20(nameService.getAddress("GOODDOLLAR"));
|
|
71
75
|
}
|
|
72
76
|
|
|
73
|
-
function upgrade(
|
|
74
|
-
|
|
75
|
-
version++;
|
|
76
|
-
nameService = _ns;
|
|
77
|
+
function upgrade() public onlyOwner {
|
|
78
|
+
gd = ERC20(nameService.getAddress("GOODDOLLAR"));
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
function getIdentity() public view returns (IIdentityV2) {
|
|
@@ -101,11 +103,9 @@ contract AdminWalletFuse is
|
|
|
101
103
|
toppingTimes = _toppingTimes;
|
|
102
104
|
}
|
|
103
105
|
|
|
104
|
-
function _authorizeUpgrade(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
onlyOwner
|
|
108
|
-
{}
|
|
106
|
+
function _authorizeUpgrade(
|
|
107
|
+
address newImplementation
|
|
108
|
+
) internal override onlyOwner {}
|
|
109
109
|
|
|
110
110
|
/* @dev Modifier that checks if caller is admin of wallet
|
|
111
111
|
*/
|
|
@@ -186,11 +186,10 @@ contract AdminWalletFuse is
|
|
|
186
186
|
/* @dev Function to add given address to whitelist of identity contract
|
|
187
187
|
* can only be done by admins of wallet and if wallet is an IdentityAdmin
|
|
188
188
|
*/
|
|
189
|
-
function whitelist(
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
{
|
|
189
|
+
function whitelist(
|
|
190
|
+
address _user,
|
|
191
|
+
string memory _did
|
|
192
|
+
) public onlyAdmin reimburseGas {
|
|
194
193
|
getIdentity().addWhitelistedWithDID(_user, _did);
|
|
195
194
|
}
|
|
196
195
|
|
|
@@ -237,10 +236,16 @@ contract AdminWalletFuse is
|
|
|
237
236
|
* @param _user The address to transfer to
|
|
238
237
|
*/
|
|
239
238
|
function topWallet(address payable _user) public onlyAdmin reimburseGas {
|
|
239
|
+
uint256 gdBalance = gd.balanceOf(_user);
|
|
240
|
+
require(
|
|
241
|
+
getIdentity().isWhitelisted(_user) || gdBalance != lastGdBalance[_user],
|
|
242
|
+
"User has not used G$"
|
|
243
|
+
);
|
|
240
244
|
require(
|
|
241
245
|
toppings[currentDay()][_user] < toppingTimes,
|
|
242
246
|
"User wallet has been topped too many times today"
|
|
243
247
|
);
|
|
248
|
+
lastGdBalance[_user] = gdBalance;
|
|
244
249
|
if (address(_user).balance >= toppingAmount / 4) return;
|
|
245
250
|
|
|
246
251
|
_topWallet(_user);
|
package/hardhat.config.ts
CHANGED
|
@@ -100,6 +100,10 @@ const hhconfig: HardhatUserConfig = {
|
|
|
100
100
|
url: "https://eth-mainnet.alchemyapi.io/v2/" + process.env.ALCHEMY_KEY
|
|
101
101
|
}
|
|
102
102
|
},
|
|
103
|
+
fork: {
|
|
104
|
+
chainId: 1,
|
|
105
|
+
url: "https://rpc.vnet.tenderly.co/devnet/reserve-ujpgrade/9f79f839-996c-495a-b470-c0237eede293"
|
|
106
|
+
},
|
|
103
107
|
test: {
|
|
104
108
|
allowUnlimitedContractSize: true,
|
|
105
109
|
url: "http://127.0.0.1:8545/"
|
package/package.json
CHANGED
package/releases/deployment.json
CHANGED
|
@@ -547,7 +547,9 @@
|
|
|
547
547
|
"GReputation": "0x0abF3D20fCb33FC03bdF25b042E77edfAeDBBDD3",
|
|
548
548
|
"FeeFormula": "0x5fAA779cF74a1Ba51909DEeaA0e8900474DA77Cf",
|
|
549
549
|
"DAOCreator": "0xc66c970a6d99da587a7d7fa7d5383b401c3e87f4",
|
|
550
|
-
"OneTimePaymentsV2": "0x4E8112430974b4CE87283221a11BDC52097e7e2e"
|
|
550
|
+
"OneTimePaymentsV2": "0x4E8112430974b4CE87283221a11BDC52097e7e2e",
|
|
551
|
+
"network": "development-goerli",
|
|
552
|
+
"networkId": 5
|
|
551
553
|
},
|
|
552
554
|
"alfajores": {
|
|
553
555
|
"network": "alfajores",
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { countBy, chunk, difference, flatten, sortBy } from "lodash";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import { network, ethers, upgrades } from "hardhat";
|
|
4
|
+
import { Contract, Provider, setMulticallAddress } from "ethers-multicall";
|
|
5
|
+
import Identity from "../../artifacts/contracts/Interfaces.sol/IIdentity.json";
|
|
6
|
+
|
|
7
|
+
setMulticallAddress(122, "0x3CE6158b7278Bf6792e014FA7B4f3c6c46fe9410");
|
|
8
|
+
|
|
9
|
+
setMulticallAddress(42220, "0x188C1bf697B66474dC3eaa119Ae691a8352537e3");
|
|
10
|
+
|
|
11
|
+
const fuseProvider = new ethers.providers.JsonRpcBatchProvider(
|
|
12
|
+
"https://explorer-node.fuse.io/"
|
|
13
|
+
// "https://rpc.fuse.io"
|
|
14
|
+
);
|
|
15
|
+
const celoProvider = new ethers.providers.JsonRpcBatchProvider(
|
|
16
|
+
"https://forno.celo.org"
|
|
17
|
+
// "https://rpc.fuse.io"
|
|
18
|
+
);
|
|
19
|
+
const ethcallProvider = new Provider(fuseProvider, 122);
|
|
20
|
+
const ethcallProviderCelo = new Provider(celoProvider, 42220);
|
|
21
|
+
|
|
22
|
+
const GD_FUSE = "0x495d133b938596c9984d462f007b676bdc57ecec";
|
|
23
|
+
const GD_CELO = "0x62B8B11039FcfE5aB0C56E502b1C372A3d2a9c7A";
|
|
24
|
+
|
|
25
|
+
const gdMulti = new Contract(GD_FUSE, [
|
|
26
|
+
"event Transfer(address indexed from, address indexed to, uint amount)",
|
|
27
|
+
"function balanceOf(address) view returns(uint256)"
|
|
28
|
+
]);
|
|
29
|
+
const gdMultiCelo = new Contract(GD_CELO, [
|
|
30
|
+
"event Transfer(address indexed from, address indexed to, uint amount)",
|
|
31
|
+
"function balanceOf(address) view returns(uint256)"
|
|
32
|
+
]);
|
|
33
|
+
|
|
34
|
+
const hasBalance = async wallets => {
|
|
35
|
+
console.log("checking balances for:", wallets.length);
|
|
36
|
+
const chunks = chunk(wallets, 100);
|
|
37
|
+
let balances = {};
|
|
38
|
+
let users = [];
|
|
39
|
+
for (let batch of chunks) {
|
|
40
|
+
const calls = batch.map(a => gdMultiCelo.balanceOf(a));
|
|
41
|
+
const result = await ethcallProviderCelo.all(calls);
|
|
42
|
+
const found = batch.filter((d, i) => result[i] > 0);
|
|
43
|
+
console.log("batch:", batch.length, calls.length, result.length, found.length);
|
|
44
|
+
users = users.concat(found);
|
|
45
|
+
}
|
|
46
|
+
console.log("got balances for:", Object.entries(balances).length, "found users:", users.length);
|
|
47
|
+
console.log(users);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const main = async () => {
|
|
51
|
+
const wallets = fs
|
|
52
|
+
.readFileSync("accounts.csv")
|
|
53
|
+
.toString()
|
|
54
|
+
.split("\n")
|
|
55
|
+
.map(l => l.split(",")[0])
|
|
56
|
+
.filter(a => a.startsWith("0x"));
|
|
57
|
+
|
|
58
|
+
const refunded = await hasBalance(wallets);
|
|
59
|
+
};
|
|
60
|
+
main().catch(e => console.log(e));
|
|
@@ -21,9 +21,7 @@ function arrayToCsv(data) {
|
|
|
21
21
|
const celoStats = async () => {};
|
|
22
22
|
const main = async (isCelo = true) => {
|
|
23
23
|
const archive = new JsonRpcProvider(
|
|
24
|
-
isCelo
|
|
25
|
-
? "https://celo-mainnet-archive.allthatnode.com"
|
|
26
|
-
: "https://explorer-node.fuse.io"
|
|
24
|
+
isCelo ? "https://celo-mainnet-archive.allthatnode.com" : "https://explorer-node.fuse.io"
|
|
27
25
|
);
|
|
28
26
|
const faucetAddr = isCelo
|
|
29
27
|
? "0x4F93Fa058b03953C851eFaA2e4FC5C34afDFAb84"
|
|
@@ -39,31 +37,24 @@ const main = async (isCelo = true) => {
|
|
|
39
37
|
],
|
|
40
38
|
faucetAddr
|
|
41
39
|
);
|
|
42
|
-
const endBlock = Number(await
|
|
43
|
-
const daysBack =
|
|
40
|
+
const endBlock = Number(await archive.getBlockNumber());
|
|
41
|
+
const daysBack = 90;
|
|
44
42
|
const dayBlocks = 12 * 60 * 24;
|
|
45
43
|
const startBlock = endBlock - dayBlocks * daysBack;
|
|
46
44
|
const days = range(startBlock, endBlock, dayBlocks);
|
|
45
|
+
console.log({ startBlock, endBlock });
|
|
47
46
|
const dailyBalance = [];
|
|
48
47
|
const dailyAdminBalance = [];
|
|
49
48
|
for (let day of days) {
|
|
50
|
-
dailyBalance.push(
|
|
51
|
-
(await archive.getBalance(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
// `https://api.celoscan.io/api?module=account&action=balance&address=${faucetAddr}&tag=${day}&apikey=${process.env.CELOSCAN_KEY}`
|
|
56
|
-
// )
|
|
57
|
-
// .then(_ => _.json())
|
|
58
|
-
// .then(_ => _.result)
|
|
59
|
-
// : (await archive.getBalance(faucetAddr, day)).div(1e10).toNumber() / 1e8
|
|
60
|
-
);
|
|
49
|
+
dailyBalance.push([
|
|
50
|
+
(await archive.getBalance("0x4F93Fa058b03953C851eFaA2e4FC5C34afDFAb84", day)).div(1e10).toNumber() / 1e8,
|
|
51
|
+
(await archive.getBalance("0x7119CD89D4792aF90277d84cDffa3F2Ab22a0022", day)).div(1e10).toNumber() / 1e8
|
|
52
|
+
]);
|
|
53
|
+
console.log({ day });
|
|
61
54
|
}
|
|
62
55
|
|
|
63
56
|
for (let day of days) {
|
|
64
|
-
dailyAdminBalance.push(
|
|
65
|
-
(await archive.getBalance(adminAddr, day)).div(1e10).toNumber() / 1e8
|
|
66
|
-
);
|
|
57
|
+
dailyAdminBalance.push((await archive.getBalance(adminAddr, day)).div(1e10).toNumber() / 1e8);
|
|
67
58
|
}
|
|
68
59
|
let curBlock = startBlock;
|
|
69
60
|
const toppingsByAddress = {};
|
|
@@ -71,35 +62,31 @@ const main = async (isCelo = true) => {
|
|
|
71
62
|
const toppingsByRelayer = {};
|
|
72
63
|
let totalToppings = 0;
|
|
73
64
|
let totalAmount = 0;
|
|
74
|
-
const dailyUsage = dailyBalance.map((v, i) =>
|
|
75
|
-
i < dailyBalance.length - 1 ? v - dailyBalance[i + 1] : 0
|
|
76
|
-
);
|
|
65
|
+
const dailyUsage = dailyBalance.map((v, i) => (i < dailyBalance.length - 1 ? v - dailyBalance[i + 1] : 0));
|
|
77
66
|
const dailyAdminUsage = dailyAdminBalance.map((v, i) =>
|
|
78
67
|
i < dailyAdminBalance.length - 1 ? v - dailyAdminBalance[i + 1] : 0
|
|
79
68
|
);
|
|
80
69
|
console.log({ dailyUsage, dailyAdminUsage });
|
|
70
|
+
fs.writeFileSync("celospend.csv", arrayToCsv(dailyBalance));
|
|
71
|
+
console.log(arrayToCsv(dailyBalance));
|
|
72
|
+
return;
|
|
81
73
|
console.log({ startBlock, endBlock });
|
|
82
74
|
while (curBlock <= endBlock) {
|
|
83
75
|
const fromBlock = curBlock;
|
|
84
76
|
const toBlock = Math.min(fromBlock + blockStep, endBlock);
|
|
85
77
|
pool.add(async () => {
|
|
86
78
|
const f = faucet.filters.WalletTopped();
|
|
87
|
-
const events = await faucet
|
|
88
|
-
.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return [];
|
|
92
|
-
});
|
|
79
|
+
const events = await faucet.queryFilter(f, fromBlock, toBlock).catch(e => {
|
|
80
|
+
console.log("failed", { fromBlock, toBlock });
|
|
81
|
+
return [];
|
|
82
|
+
});
|
|
93
83
|
events.forEach(e => {
|
|
94
84
|
totalToppings += 1;
|
|
95
85
|
totalAmount += Number(e.args.amount);
|
|
96
|
-
toppingsByAddress[e.args.whitelistedRoot] =
|
|
97
|
-
(toppingsByAddress[e.args.whitelistedRoot] || 0) + 1;
|
|
86
|
+
toppingsByAddress[e.args.whitelistedRoot] = (toppingsByAddress[e.args.whitelistedRoot] || 0) + 1;
|
|
98
87
|
if (e.args.account !== e.args.relayerOrWhitelisted)
|
|
99
|
-
toppingsByRelayer[e.args.relayerOrWhitelisted] =
|
|
100
|
-
|
|
101
|
-
toppingsByAmount[e.args.amount] =
|
|
102
|
-
(toppingsByAmount[e.args.amount] || 0) + 1;
|
|
88
|
+
toppingsByRelayer[e.args.relayerOrWhitelisted] = (toppingsByRelayer[e.args.relayerOrWhitelisted] || 0) + 1;
|
|
89
|
+
toppingsByAmount[e.args.amount] = (toppingsByAmount[e.args.amount] || 0) + 1;
|
|
103
90
|
});
|
|
104
91
|
console.log("fetched events", {
|
|
105
92
|
fromBlock,
|
|
@@ -328,11 +328,11 @@ export const executeViaSafe = async (
|
|
|
328
328
|
export const verifyContract = async (
|
|
329
329
|
address,
|
|
330
330
|
contractName,
|
|
331
|
-
networkName,
|
|
331
|
+
networkName = network.name,
|
|
332
332
|
proxyName?: string,
|
|
333
333
|
forcedConstructorArguments?: string
|
|
334
334
|
) => {
|
|
335
|
-
let networkProvider =
|
|
335
|
+
let networkProvider = networkName.includes("-") ? networkName.split("-")[1] : "fuse";
|
|
336
336
|
networkProvider = networkProvider === "mainnet" ? "ethereum" : networkProvider;
|
|
337
337
|
console.log("truffle compile...");
|
|
338
338
|
await exec("npx truffle compile");
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { network, ethers } from "hardhat";
|
|
2
|
+
import { Contract } from "ethers";
|
|
3
|
+
|
|
4
|
+
import { printDeploy, verifyProductionSigner } from "../multichain-deploy/helpers";
|
|
5
|
+
|
|
6
|
+
import dao from "../../releases/deployment.json";
|
|
7
|
+
import { verifyContract } from "../multichain-deploy/helpers";
|
|
8
|
+
|
|
9
|
+
let { name: networkName } = network;
|
|
10
|
+
|
|
11
|
+
export const upgrade = async () => {
|
|
12
|
+
const isProduction = networkName.includes("production");
|
|
13
|
+
let [root, ...signers] = await ethers.getSigners();
|
|
14
|
+
|
|
15
|
+
if (isProduction) verifyProductionSigner(root);
|
|
16
|
+
|
|
17
|
+
let guardian = root;
|
|
18
|
+
const isCelo = networkName.includes("celo");
|
|
19
|
+
let release: { [key: string]: any } = dao[networkName];
|
|
20
|
+
|
|
21
|
+
const deployed = await ethers.deployContract(isCelo ? "AdminWallet" : "AdminWalletFuse");
|
|
22
|
+
console.log("new impl:", deployed.address);
|
|
23
|
+
await verifyContract(deployed.address, isCelo ? "AdminWallet" : "AdminWalletFuse", networkName);
|
|
24
|
+
const old = await ethers.getContractAt("AdminWallet", release.AdminWallet);
|
|
25
|
+
await old.upgradeTo(deployed.address).then(printDeploy);
|
|
26
|
+
await deployed.attach(release.AdminWallet).upgrade().then(printDeploy);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
upgrade().catch(console.log);
|