@gooddollar/goodprotocol 2.0.25-beta.7 → 2.0.25-beta.9

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.
Files changed (189) hide show
  1. package/artifacts/abis/BulkWhitelist.min.json +1 -0
  2. package/artifacts/abis/LastauthReduction.min.json +1 -0
  3. package/artifacts/contracts/DAOStackInterfaces.sol/Avatar.dbg.json +1 -1
  4. package/artifacts/contracts/DAOStackInterfaces.sol/Controller.dbg.json +1 -1
  5. package/artifacts/contracts/DAOStackInterfaces.sol/GlobalConstraintInterface.dbg.json +1 -1
  6. package/artifacts/contracts/DAOStackInterfaces.sol/IntVoteInterface.dbg.json +1 -1
  7. package/artifacts/contracts/DAOStackInterfaces.sol/ReputationInterface.dbg.json +1 -1
  8. package/artifacts/contracts/DAOStackInterfaces.sol/SchemeRegistrar.dbg.json +1 -1
  9. package/artifacts/contracts/Interfaces.sol/AggregatorV3Interface.dbg.json +1 -1
  10. package/artifacts/contracts/Interfaces.sol/ERC20.dbg.json +1 -1
  11. package/artifacts/contracts/Interfaces.sol/IAaveIncentivesController.dbg.json +1 -1
  12. package/artifacts/contracts/Interfaces.sol/IAdminWallet.dbg.json +1 -1
  13. package/artifacts/contracts/Interfaces.sol/IDonationStaking.dbg.json +1 -1
  14. package/artifacts/contracts/Interfaces.sol/IERC2917.dbg.json +1 -1
  15. package/artifacts/contracts/Interfaces.sol/IFirstClaimPool.dbg.json +1 -1
  16. package/artifacts/contracts/Interfaces.sol/IGoodDollar.dbg.json +1 -1
  17. package/artifacts/contracts/Interfaces.sol/IGoodStaking.dbg.json +1 -1
  18. package/artifacts/contracts/Interfaces.sol/IHasRouter.dbg.json +1 -1
  19. package/artifacts/contracts/Interfaces.sol/IIdentity.dbg.json +1 -1
  20. package/artifacts/contracts/Interfaces.sol/IIdentityV2.dbg.json +1 -1
  21. package/artifacts/contracts/Interfaces.sol/ILendingPool.dbg.json +1 -1
  22. package/artifacts/contracts/Interfaces.sol/IMultichainRouter.dbg.json +1 -1
  23. package/artifacts/contracts/Interfaces.sol/INameService.dbg.json +1 -1
  24. package/artifacts/contracts/Interfaces.sol/IUBIScheme.dbg.json +1 -1
  25. package/artifacts/contracts/Interfaces.sol/ProxyAdmin.dbg.json +1 -1
  26. package/artifacts/contracts/Interfaces.sol/Reserve.dbg.json +1 -1
  27. package/artifacts/contracts/Interfaces.sol/Staking.dbg.json +1 -1
  28. package/artifacts/contracts/Interfaces.sol/Uniswap.dbg.json +1 -1
  29. package/artifacts/contracts/Interfaces.sol/UniswapFactory.dbg.json +1 -1
  30. package/artifacts/contracts/Interfaces.sol/UniswapPair.dbg.json +1 -1
  31. package/artifacts/contracts/Interfaces.sol/cERC20.dbg.json +1 -1
  32. package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.dbg.json +1 -1
  33. package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
  34. package/artifacts/contracts/fuseFaucet/FuseFaucetV2.sol/FuseFaucetV2.dbg.json +1 -1
  35. package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
  36. package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
  37. package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
  38. package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.dbg.json +1 -1
  39. package/artifacts/contracts/governance/GoodDollarStaking.sol/IGovernanceStaking.dbg.json +1 -1
  40. package/artifacts/contracts/governance/GoodDollarStaking.sol/IStakingUpgrade.dbg.json +1 -1
  41. package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.dbg.json +1 -1
  42. package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
  43. package/artifacts/contracts/governance/MultiBaseGovernanceShareField.sol/MultiBaseGovernanceShareField.dbg.json +1 -1
  44. package/artifacts/contracts/governance/Reputation.sol/Reputation.dbg.json +1 -1
  45. package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
  46. package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.dbg.json +1 -1
  47. package/artifacts/contracts/invite/InvitesFuseV2.sol/InvitesFuseV2.dbg.json +1 -1
  48. package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.dbg.json +1 -1
  49. package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.dbg.json +1 -1
  50. package/artifacts/contracts/invite/OneTimeReward.sol/OneTimeReward.dbg.json +1 -1
  51. package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
  52. package/artifacts/contracts/mocks/AaveUSDMockOracle.sol/AaveUSDMockOracle.dbg.json +1 -1
  53. package/artifacts/contracts/mocks/BatUSDMockOracle.sol/BatUSDMockOracle.dbg.json +1 -1
  54. package/artifacts/contracts/mocks/CompUsdMockOracle.sol/CompUSDMockOracle.dbg.json +1 -1
  55. package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
  56. package/artifacts/contracts/mocks/DaiEthPriceMockOracle.sol/DaiEthPriceMockOracle.dbg.json +1 -1
  57. package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
  58. package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.dbg.json +1 -1
  59. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +1 -1
  60. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +1 -1
  61. package/artifacts/contracts/mocks/EthUSDMockOracle.sol/EthUSDMockOracle.dbg.json +1 -1
  62. package/artifacts/contracts/mocks/FeesFormularMock.sol/FeesFormulaMock.dbg.json +1 -1
  63. package/artifacts/contracts/mocks/GasPriceMockOracle.sol/GasPriceMockOracle.dbg.json +1 -1
  64. package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
  65. package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.dbg.json +1 -1
  66. package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
  67. package/artifacts/contracts/mocks/IdentityMock.sol/IdentityMock.dbg.json +1 -1
  68. package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
  69. package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
  70. package/artifacts/contracts/mocks/MultichainRouterMock.sol/IWrapper.dbg.json +1 -1
  71. package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.dbg.json +1 -1
  72. package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.dbg.json +1 -1
  73. package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
  74. package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
  75. package/artifacts/contracts/mocks/PayableMock.sol/PayableMock.dbg.json +1 -1
  76. package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
  77. package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.dbg.json +1 -1
  78. package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
  79. package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
  80. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
  81. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
  82. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.dbg.json +1 -1
  83. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.dbg.json +1 -1
  84. package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
  85. package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
  86. package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
  87. package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
  88. package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
  89. package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
  90. package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
  91. package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
  92. package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.dbg.json +1 -1
  93. package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
  94. package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
  95. package/artifacts/contracts/reserve/GoodReserveCDai.sol/ContributionCalc.dbg.json +1 -1
  96. package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.dbg.json +1 -1
  97. package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
  98. package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.dbg.json +1 -1
  99. package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
  100. package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.dbg.json +1 -1
  101. package/artifacts/contracts/staking/FuseStakingV3.sol/IConsensus.dbg.json +1 -1
  102. package/artifacts/contracts/staking/FuseStakingV3.sol/PegSwap.dbg.json +1 -1
  103. package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.dbg.json +1 -1
  104. package/artifacts/contracts/staking/SimpleStaking.sol/SimpleStaking.dbg.json +1 -1
  105. package/artifacts/contracts/staking/SimpleStakingV2.sol/SimpleStakingV2.dbg.json +1 -1
  106. package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.dbg.json +1 -1
  107. package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
  108. package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
  109. package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.dbg.json +1 -1
  110. package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
  111. package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
  112. package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.dbg.json +1 -1
  113. package/artifacts/contracts/staking/utils/Math64X64.sol/Math64x64.dbg.json +1 -1
  114. package/artifacts/contracts/staking/utils/StakingRewardsFixedAPY.sol/StakingRewardsFixedAPY.dbg.json +1 -1
  115. package/artifacts/contracts/token/ERC20PresetMinterPauserUpgradeable.sol/ERC20PresetMinterPauserUpgradeable.dbg.json +1 -1
  116. package/artifacts/contracts/token/ERC677.sol/ERC677.dbg.json +1 -1
  117. package/artifacts/contracts/token/ERC677.sol/ERC677Receiver.dbg.json +1 -1
  118. package/artifacts/contracts/token/GoodDollar.sol/GoodDollar.dbg.json +1 -1
  119. package/artifacts/contracts/token/IFeesFormula.sol/IFeesFormula.dbg.json +1 -1
  120. package/artifacts/contracts/token/MultichainFeeFormula.sol/MultichainFeeFormula.dbg.json +1 -1
  121. package/artifacts/contracts/token/superfluid/ERC20Permit.sol/ERC20Permit.dbg.json +1 -1
  122. package/artifacts/contracts/token/superfluid/ERC20Permit.sol/SelfApprove.dbg.json +1 -1
  123. package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/IGoodDollarCustom.dbg.json +1 -1
  124. package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/ISuperGoodDollar.dbg.json +1 -1
  125. package/artifacts/contracts/token/superfluid/ISuperToken.sol/ISuperToken.dbg.json +1 -1
  126. package/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.dbg.json +1 -1
  127. package/artifacts/contracts/token/superfluid/SuperToken.sol/SuperToken.dbg.json +1 -1
  128. package/artifacts/contracts/token/superfluid/SuperfluidToken.sol/SuperfluidToken.dbg.json +1 -1
  129. package/artifacts/contracts/token/superfluid/UUPSProxiable.sol/UUPSProxiable.dbg.json +1 -1
  130. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/Proxy.dbg.json +1 -1
  131. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSProxy.dbg.json +1 -1
  132. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSUtils.dbg.json +1 -1
  133. package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
  134. package/artifacts/contracts/ubi/UBISchemeV2.sol/UBISchemeV2.dbg.json +1 -1
  135. package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
  136. package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.dbg.json +1 -1
  137. package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
  138. package/artifacts/contracts/utils/BulkProof.sol/BulkProof.dbg.json +1 -1
  139. package/artifacts/contracts/utils/BulkWhitelist.sol/BulkWhitelist.dbg.json +4 -0
  140. package/artifacts/contracts/utils/BulkWhitelist.sol/BulkWhitelist.json +67 -0
  141. package/artifacts/contracts/utils/BuyAndBridgeHelper.sol/BuyAndBridgeHelper.dbg.json +1 -1
  142. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDClone.dbg.json +1 -1
  143. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDCloneFactory.dbg.json +1 -1
  144. package/artifacts/contracts/utils/BuyGDClone.sol/DonateGDClone.dbg.json +1 -1
  145. package/artifacts/contracts/utils/BuyGDClone.sol/IQuoterV2.dbg.json +1 -1
  146. package/artifacts/contracts/utils/BuyGDClone.sol/ISwapRouter.dbg.json +1 -1
  147. package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
  148. package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
  149. package/artifacts/contracts/utils/DSMath.sol/DSMath.dbg.json +1 -1
  150. package/artifacts/contracts/utils/DataTypes.sol/DataTypes.dbg.json +1 -1
  151. package/artifacts/contracts/utils/GDFaucet.sol/GDFaucet.dbg.json +1 -1
  152. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.dbg.json +1 -1
  153. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/IRouter.dbg.json +1 -1
  154. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/PausableControl.dbg.json +1 -1
  155. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.dbg.json +1 -1
  156. package/artifacts/contracts/utils/IdentityFix.sol/IdentityFix.dbg.json +1 -1
  157. package/artifacts/contracts/utils/LastauthReduction.sol/LastauthReduction.dbg.json +4 -0
  158. package/artifacts/contracts/utils/LastauthReduction.sol/LastauthReduction.json +81 -0
  159. package/artifacts/contracts/utils/MultiCall.sol/Multicall.dbg.json +1 -1
  160. package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.dbg.json +1 -1
  161. package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
  162. package/artifacts/contracts/utils/OneTimePayments.sol/OneTimePayments.dbg.json +1 -1
  163. package/artifacts/contracts/utils/OneTimePaymentsV2.sol/OneTimePaymentsV2.dbg.json +1 -1
  164. package/artifacts/contracts/utils/ProtocolUpgrade.sol/OldMarketMaker.dbg.json +1 -1
  165. package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.dbg.json +1 -1
  166. package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
  167. package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.dbg.json +1 -1
  168. package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.dbg.json +1 -1
  169. package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.dbg.json +1 -1
  170. package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.dbg.json +1 -1
  171. package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
  172. package/contracts/utils/BulkWhitelist.sol +51 -0
  173. package/contracts/utils/LastauthReduction.sol +92 -0
  174. package/package.json +15 -17
  175. package/releases/deployment.json +611 -599
  176. package/scripts/analytics/activeStakers.ts +25 -0
  177. package/scripts/analytics/activeUsersCount.ts +80 -26
  178. package/scripts/analytics/activeWalletsStats.ts +138 -18
  179. package/scripts/fv.ts +135 -16
  180. package/scripts/proposals/identityAuthPeriod.ts +229 -0
  181. package/scripts/utils.ts +25 -1
  182. package/types/contracts/utils/BulkWhitelist.ts +153 -0
  183. package/types/contracts/utils/LastauthReduction.ts +168 -0
  184. package/types/contracts/utils/index.ts +2 -0
  185. package/types/factories/contracts/utils/BulkWhitelist__factory.ts +123 -0
  186. package/types/factories/contracts/utils/LastauthReduction__factory.ts +134 -0
  187. package/types/factories/contracts/utils/index.ts +2 -0
  188. package/types/hardhat.d.ts +18 -0
  189. package/types/index.ts +4 -0
@@ -0,0 +1,25 @@
1
+ import { uniq } from "lodash";
2
+ import fs from "fs";
3
+ import { network, ethers } from "hardhat";
4
+ import { Contract, Provider, setMulticallAddress } from "ethers-multicall";
5
+ import release from "../../releases/deployment.json"
6
+ import { SimpleStakingV2 } from "../../types";
7
+
8
+ setMulticallAddress(122, "0x3CE6158b7278Bf6792e014FA7B4f3c6c46fe9410");
9
+
10
+ setMulticallAddress(42220, "0x188C1bf697B66474dC3eaa119Ae691a8352537e3");
11
+
12
+ const main = async () => {
13
+
14
+ const c1 = await ethers.getContractAt("SimpleStakingV2", release["production-mainnet"].StakingContractsV3[0][0]) as SimpleStakingV2
15
+ const c2 = await ethers.getContractAt("SimpleStakingV2", release["production-mainnet"].StakingContractsV3[1][0]) as SimpleStakingV2
16
+ const f = c1.filters.Staked()
17
+ const events = await c1.queryFilter(f, 14338550)
18
+ const events2 = await c2.queryFilter(f, 14338550)
19
+ const stakers = uniq(events.concat(events2).map(_ => _.args[0]))
20
+ console.log(stakers)
21
+ const res = (await Promise.all(stakers.map(async s => [s, await c1.balanceOf(s), await c2.balanceOf(s)]))).filter(_ => _[1].gt(0) || _[2].gt(0))
22
+ console.log(events.length)
23
+ console.log(res)
24
+ }
25
+ main()
@@ -1,5 +1,7 @@
1
- import { range, chunk, uniq } from "lodash";
2
- import { ethers as Ethers } from "hardhat";
1
+ import { range, chunk, uniq, mapValues, groupBy } from "lodash";
2
+ import { ethers, ethers as Ethers } from "hardhat";
3
+ import fs from "fs";
4
+ import { bulkGetLastAuth } from "../utils";
3
5
 
4
6
  const ONE_DAY = 24 * 60 * 60;
5
7
  const ONE_HOUR = 60 * 60;
@@ -19,28 +21,27 @@ const main = async () => {
19
21
  for (let day of daysAgo) {
20
22
  const query = `
21
23
  {
22
- walletStats(first:1000, where: { lastClaimed_lte: ${curDay},lastClaimed_gt: ${
23
- curDay - ONE_DAY
24
- } isActiveUser: true }) {
24
+ walletStats(first:1000, where: { lastClaimed_lte: ${curDay},lastClaimed_gt: ${curDay - ONE_DAY
25
+ } isActiveUser: true }) {
25
26
  id
26
27
  }
27
28
  }
28
29
  `;
29
30
 
30
31
  console.log("fetching inactive users since:", { curDay, day }, JSON.stringify({ query }));
31
- const {
32
- data: { walletStats }
33
- } = await fetch("https://api.thegraph.com/subgraphs/name/gooddollar/gooddollarfuse", {
32
+ const result = await fetch("https://api.thegraph.com/subgraphs/name/gooddollar/gooddollarfuse", {
34
33
  method: "post",
35
34
  body: JSON.stringify({ query }),
36
35
  headers: { "Content-Type": "application/json" }
37
36
  }).then(_ => _.json());
38
37
 
39
- console.log("got inactive wallets:", walletStats.length);
40
- if (walletStats) {
41
- const accounts = walletStats.map(_ => _.id);
42
- allActive.push(...accounts);
43
- }
38
+
39
+ console.log("got inactive wallets:", result);
40
+ // if (walletStats) {
41
+ // const accounts = walletStats.map(_ => _.id);
42
+ // allActive.push(...accounts);
43
+ // }
44
+
44
45
  // for (let tofish of chunk(accounts, 50)) {
45
46
  // const tx = await ubiScheme.fishMulti(tofish, { gasLimit: 2000000 });
46
47
  // console.log("fishing tx:", tx, tofish);
@@ -54,32 +55,83 @@ const main = async () => {
54
55
  console.log("active claimers:", unique.length);
55
56
  };
56
57
 
58
+ const countClaimersUsingExplorer = async () => {
59
+ let claimers = [] //JSON.parse(fs.readFileSync("claimers.json").toString())
60
+ const curBlock = await ethers.provider.getBlockNumber()
61
+ const DAYS = 1
62
+ let fromBlock = curBlock - 60 * 60 * 24 * DAYS / 5 //roughly DAYS of blocks
63
+ const querySize = 90// 15 min of blocks
64
+ const blockRanges = range(fromBlock, curBlock, querySize)
65
+ const chunks = chunk(blockRanges, 10)
66
+ for (let idx in chunks) {
67
+ const toFetch = chunks[idx]
68
+ const ps = toFetch.map(async fromBlock => {
69
+ let toBlock = fromBlock + querySize
70
+ toBlock = toBlock > curBlock ? curBlock : toBlock
71
+ const result = await fetch(`https://explorer.celo.org/mainnet/api?module=logs&action=getLogs&fromBlock=${fromBlock}&toBlock=${toBlock}&address=0x43d72ff17701b2da814620735c39c620ce0ea4a1&topic0=0x89ed24731df6b066e4c5186901fffdba18cd9a10f07494aff900bdee260d1304`).then(_ => _.json())
72
+ fromBlock = toBlock
73
+ const addrs = result.result.map(_ => ethers.utils.defaultAbiCoder.decode(["address"], _.topics[1])[0])
74
+ claimers.push(...addrs);
75
+ console.log("claimers:", addrs.length, "block range:", { fromBlock, toBlock }, addrs[0])
76
+ })
77
+ await Promise.all(ps)
78
+ console.log(`${idx} out of ${chunks.length}`)
79
+ }
80
+
81
+ claimers = uniq(claimers)
82
+ fs.writeFileSync("claimers.json", JSON.stringify(claimers))
83
+ }
84
+
85
+ const countLastWhitelisted = async () => {
86
+ const claimers = JSON.parse(fs.readFileSync("claimers.json").toString())
87
+ const DAY = 60 * 60 * 24
88
+ let total = 0
89
+ let howOld = []
90
+ console.log("unique claimers:", claimers.length)
91
+ for (let bulk of chunk(claimers, 1000)) {
92
+ const results = await bulkGetLastAuth(bulk)
93
+ const older = results.filter(_ => _.toNumber() < Date.now() / 1000 - DAY * 180).length
94
+ bulk.forEach((_, i) => howOld.push([_, Math.ceil((Date.now() / 1000 - DAY * 180 - results[i].toNumber()) / (30 * DAY)).toFixed(0)]))
95
+ console.log(older, "out of", results.length)
96
+ total += older
97
+ }
98
+
99
+ howOld = howOld.filter(_ => Number(_[1]) > 0)
100
+ console.log({ total })
101
+ howOld = mapValues(groupBy(howOld, _ => _[1]), _ => _.length)
102
+ console.log(howOld)
103
+ }
104
+
57
105
  const countActive = async () => {
58
- const twoWeeksAgo = parseInt((Date.now() / 1000).toFixed(0)); //
59
106
 
60
- const hoursAgo: number[] = range(0, 24 * 14, 1);
61
- let curDay = twoWeeksAgo;
107
+ const hoursAgo: number[] = range(0, 24 * 30, 1);
108
+ let curDay = parseInt((Date.now() / 1000).toFixed(0));
62
109
  const allActive = [];
63
110
  for (let hour of hoursAgo) {
64
111
  const query = `
65
112
  {
66
- walletStats(first:1000, where: { lastClaimed_lte: ${curDay},lastClaimed_gt: ${
67
- curDay - ONE_HOUR
68
- } isActiveUser: true }) {
113
+ walletStats(first:1000, where: { lastClaimed_lte: ${curDay},lastClaimed_gt: ${curDay - ONE_HOUR
114
+ } isActiveUser: true }) {
69
115
  id
70
116
  }
71
117
  }
72
118
  `;
73
119
 
74
120
  console.log("fetching active users since:", { curDay, hour }, JSON.stringify({ query }));
121
+ const result =
122
+
123
+ await fetch("https://gateway-arbitrum.network.thegraph.com/api/3c409250a317ce7b0c6a7a8b9a409ef8/subgraphs/id/F7314rxGdcpKPC1nN5KCoFW84EGRoUyzseY2sAT9PEkw", {
124
+ // await fetch("https://gateway.thegraph.com/api/3c409250a317ce7b0c6a7a8b9a409ef8/subgraphs/id/5cAhhzm7LSqGiFibV1odbbgZWiRmZsYjYrmaoj87UxFd", {
125
+ method: "post",
126
+ body: JSON.stringify({ query }),
127
+ headers: { "Content-Type": "application/json", "origin": "https://wallet.gooddollar.org" }
128
+
129
+ }).then(_ => _.json());
130
+
131
+ console.log(result)
75
132
  const {
76
133
  data: { walletStats }
77
- } = await fetch("https://api.thegraph.com/subgraphs/name/gooddollar/gooddollarfuse", {
78
- method: "post",
79
- body: JSON.stringify({ query }),
80
- headers: { "Content-Type": "application/json" }
81
- }).then(_ => _.json());
82
-
134
+ } = result
83
135
  console.log("got active wallets:", walletStats.length);
84
136
  if (walletStats) {
85
137
  const accounts = walletStats.map(_ => _.id);
@@ -99,4 +151,6 @@ const countActive = async () => {
99
151
  };
100
152
 
101
153
  //main();
102
- countActive();
154
+ // countActive();
155
+ // countClaimersUsingExplorer()
156
+ countLastWhitelisted()
@@ -1,24 +1,88 @@
1
- import { maxBy, range, sortBy } from "lodash";
1
+ import { maxBy, range, sortBy, flatten } from "lodash";
2
2
  import PromisePool from "async-promise-pool";
3
3
  import fs from "fs";
4
4
  import { ethers } from "hardhat";
5
5
 
6
+ const today = new Date().toLocaleDateString().replace(/\//g, "");
7
+ console.log({ today });
6
8
  /****
7
9
  * Fetch token holders and their last activity date
8
10
  * can be used to create stats about active users and how much G$ isnt active
9
11
  */
10
12
  const main = async (chain = "fuse") => {
11
- const explorer = chain === "fuse" ? "https://explorer.fuse.io" : "https://explorer.celo.org";
12
- const subgraph = chain === "fuse" ? "https://api.thegraph.com/subgraphs/name/gooddollar/gooddollarfuse" : "https://";
13
+ let result = [];
14
+ let balances = {};
15
+ let curPage = 1;
16
+ let maxResult;
17
+ const fuseExplorer = "https://explorer.fuse.io/api";
18
+ const celoExplorer = "https://explorer.celo.org/mainnet/api";
19
+ const fuseSubgraph =
20
+ "https://gateway.thegraph.com/api/9048669a7632776aae01a191c4939445/subgraphs/id/5cAhhzm7LSqGiFibV1odbbgZWiRmZsYjYrmaoj87UxFd";
21
+ const celoSubgraph =
22
+ "https://gateway.thegraph.com/api/9048669a7632776aae01a191c4939445/subgraphs/id/F7314rxGdcpKPC1nN5KCoFW84EGRoUyzseY2sAT9PEkw";
23
+ do {
24
+ const pages = range(curPage, curPage + 5, 1);
25
+ curPage += 5;
26
+ const ps = pages.map(p =>
27
+ fetch(
28
+ `${fuseExplorer}?module=token&action=getTokenHolders&contractaddress=0x495d133B938596C9984d462F007B676bDc57eCEC&page=${p}&offset=10000`
29
+ )
30
+ .then(_ => _.json())
31
+ .then(_ => _.result)
32
+ );
33
+ const results = await Promise.all(ps);
34
+ result = result.concat(...results);
35
+ maxResult = maxBy(results, "length");
36
+ console.log(maxResult.length, result.length);
37
+ } while (maxResult.length === 10000);
38
+ result.forEach(
39
+ r =>
40
+ (balances[r.address.toLowerCase()] = {
41
+ balance: Number(r.value) / 100,
42
+ fuseBalance: Number(r.value) / 100,
43
+ lastSeen: 0
44
+ })
45
+ );
46
+
47
+ console.log("fetching celo balances....");
48
+ curPage = 1;
49
+ result = [];
50
+ do {
51
+ const pages = range(curPage, curPage + 3, 1);
52
+ curPage += 3;
53
+ const ps = pages.map(p =>
54
+ fetch(
55
+ `${celoExplorer}?module=token&action=getTokenHolders&contractaddress=0x62B8B11039FcfE5aB0C56E502b1C372A3d2a9c7A&page=${p}&offset=10000`
56
+ )
57
+ .then(_ => _.json())
58
+ .then(_ => _.result)
59
+ );
60
+ const results = await Promise.all(ps);
61
+ result = result.concat(...results);
62
+ maxResult = maxBy(results, "length");
63
+ console.log(maxResult.length, result.length);
64
+ } while (maxResult.length === 10000);
65
+
66
+ result.forEach(
67
+ r =>
68
+ (balances[r.address.toLowerCase()] = {
69
+ ...balances[r.address.toLowerCase()],
70
+ celoBalance: Number(r.value) / 1e18,
71
+ balance: Number(balances[r.address.toLowerCase()]?.fuseBalance || 0) + Number(r.value) / 1e18,
72
+ lastSeen: 0
73
+ })
74
+ );
75
+
76
+ fs.writeFileSync(`activeWalletsBalances-${today}.json`, JSON.stringify(balances));
13
77
 
14
- const balances = await getFuseBalances();
78
+ balances = JSON.parse(fs.readFileSync(`activeWalletsBalances-${today}.json`).toString());
15
79
 
16
80
  const EPOCH = 60 * 60 * 6;
17
- const pool = new PromisePool({ concurrency: 30 });
81
+ const pool = new PromisePool({ concurrency: 10 });
18
82
  const lastUsed = {};
19
83
  const epochs = range(1596045730, (Date.now() / 1000).toFixed(0), EPOCH);
20
84
 
21
- const graphQuery = async (start, skip) => {
85
+ const graphQuery = async (start, skip, subgraph, retry = 3) => {
22
86
  const query = `{
23
87
  walletStats(first: 1000 skip:${skip} where: { dateAppeared_gte: ${start} dateAppeared_lt:${start + EPOCH} }) {
24
88
  id
@@ -31,7 +95,7 @@ const main = async (chain = "fuse") => {
31
95
  }`;
32
96
  // console.log({ query });
33
97
  try {
34
- const { data = {}, errors } = await fetch("https://api.thegraph.com/subgraphs/name/gooddollar/gooddollarfuse", {
98
+ const { data = {}, errors } = await fetch(subgraph, {
35
99
  method: "POST",
36
100
  headers: {
37
101
  "Content-Type": "application/json"
@@ -39,27 +103,36 @@ const main = async (chain = "fuse") => {
39
103
  body: JSON.stringify({ query })
40
104
  }).then(_ => _.json());
41
105
  errors && console.log({ errors });
106
+ if (errors) {
107
+ console.log("query failed:", { subgraph, start, skip, retrying: retry > 0 });
108
+ if (retry > 0) {
109
+ return graphQuery(start, skip, subgraph, retry - 1);
110
+ }
111
+ return [];
112
+ }
113
+ // console.log("query ok:", { subgraph, start, skip, records: data.walletStats.length })
42
114
  if (data?.walletStats?.length === 1000) {
43
- return data.walletStats.concat(await graphQuery(start, skip + 1000));
115
+ return data.walletStats.concat(await graphQuery(start, skip + 1000, subgraph));
44
116
  }
45
117
  return data.walletStats || [];
46
118
  } catch (error) {
47
- console.log({ query, error });
119
+ console.log({ query, error, subgraph });
48
120
  return [];
49
121
  }
50
122
  };
51
123
  epochs.forEach(e => {
52
124
  pool.add(async () => {
53
- const walletStats = await graphQuery(e, 0);
125
+ const walletStats = flatten(await Promise.all([graphQuery(e, 0, fuseSubgraph), graphQuery(e, 0, celoSubgraph)]));
54
126
  walletStats.forEach(w => {
55
127
  balances[w.id.toLowerCase()] = {
128
+ ...balances[w.id.toLowerCase()],
56
129
  lastSeen: Math.max(
130
+ balances[w.id.toLowerCase()]?.lastSeen,
57
131
  Number(w.lastClaimed),
58
132
  Number(w.lastTransactionFrom),
59
133
  Number(w.lastTransactionTo),
60
134
  Number(w.dateAppeared)
61
- ),
62
- balance: balances[w.id.toLowerCase()]?.balance || w.balance
135
+ )
63
136
  };
64
137
  });
65
138
  console.log({ curDate: e, records: walletStats.length });
@@ -67,7 +140,7 @@ const main = async (chain = "fuse") => {
67
140
  });
68
141
 
69
142
  await pool.all();
70
- fs.writeFileSync("activeWalletsLastUsed.json", JSON.stringify(balances));
143
+ fs.writeFileSync(`activeWalletsLastUsed-${today}.json`, JSON.stringify(balances));
71
144
  // console.log({ lastUsed });
72
145
  };
73
146
 
@@ -85,8 +158,46 @@ function arrayToCsv(data) {
85
158
  )
86
159
  .join("\r\n"); // rows starting on new lines
87
160
  }
161
+
162
+ const fix = async () => {
163
+ const balances = JSON.parse(fs.readFileSync(`activeWalletsLastUsed-${today}.json`).toString());
164
+
165
+ let result = [];
166
+
167
+ let missing = 0;
168
+ for (let addr in balances) {
169
+ const r = balances[addr];
170
+ if (!r.fuseBalance && !r.celoBalance) {
171
+ console.log("missing:", addr);
172
+ missing += 1;
173
+ continue;
174
+ }
175
+ r.celoBalance = (r.celoBalance || 0) * 100;
176
+ r.balance = r.celoBalance + r.fuseBalance;
177
+ }
178
+
179
+ console.log("missing balance", missing);
180
+ console.log(sortBy(Object.entries(balances), _ => -_.balance).slice(0, 10));
181
+
182
+ fs.writeFileSync(`activeWalletsLastUsed-${today}.json`, JSON.stringify(balances));
183
+ };
88
184
  const etl = async () => {
89
- const balances = JSON.parse(fs.readFileSync("activeWalletsLastUsed.json").toString());
185
+ /** Convert a 2D array into a CSV string
186
+ */
187
+ function arrayToCsv(data) {
188
+ return data
189
+ .map(
190
+ row =>
191
+ row
192
+ .map(String) // convert every value to String
193
+ .map(v => v.replaceAll('"', '""')) // escape double colons
194
+ .map(v => `"${v}"`) // quote it
195
+ .join(",") // comma-separated
196
+ )
197
+ .join("\r\n"); // rows starting on new lines
198
+ }
199
+
200
+ const balances = JSON.parse(fs.readFileSync(`activeWalletsLastUsed-${today}.json`).toString());
90
201
 
91
202
  let result = [];
92
203
 
@@ -95,22 +206,30 @@ const etl = async () => {
95
206
  if (!r.balance) {
96
207
  continue;
97
208
  }
98
- result.push([addr, r.balance / 100, r.lastSeen, false]);
209
+ result.push([addr, r.balance, r.lastSeen, false, r.fuseBalance, r.celoBalance]);
99
210
  }
211
+ result = sortBy(result, _ => -_[1]);
100
212
  const top100 = result.slice(0, 100);
101
213
  const pool = new PromisePool({ concurrency: 30 });
102
214
  const provider = new ethers.providers.JsonRpcBatchProvider("https://rpc.fuse.io");
215
+ const celoprovider = new ethers.providers.JsonRpcBatchProvider("https://forno.celo.org");
103
216
 
104
217
  for (let idx in top100) {
105
218
  pool.add(async () => {
106
219
  const record = top100[idx];
107
- let isContract = (await provider.getCode(record[0]).catch(e => "0x")) !== "0x";
220
+ let isContract =
221
+ (
222
+ await Promise.all([
223
+ provider.getCode(record[0]).catch(e => "0x"),
224
+ celoprovider.getCode(record[0]).catch(e => "0x")
225
+ ])
226
+ ).find(_ => _ !== "0x") !== undefined;
108
227
  record[3] = isContract;
109
228
  });
110
229
  }
111
230
  await pool.all();
112
231
  console.log({ top100 });
113
- fs.writeFileSync("activeWalletsLastUsed.csv", arrayToCsv(sortBy(result, _ => -Number(_[1]))));
232
+ fs.writeFileSync(`activeWalletsLastUsed-${today}.csv`, arrayToCsv(result));
114
233
  };
115
234
 
116
235
  const getFuseBalances = async (refetch = true) => {
@@ -177,5 +296,6 @@ const fundsByLastSeen = async () => {
177
296
  };
178
297
  getFuseBalances(false).catch(e => console.log(e));
179
298
  // main().catch(e => console.log(e));
180
- // etl();
299
+ // fix();
300
+ etl();
181
301
  // fundsByLastSeen();
package/scripts/fv.ts CHANGED
@@ -1,9 +1,23 @@
1
- import fetch from "cross-fetch";
2
1
  import fs from "fs";
3
2
  import { chunk, uniqBy } from "lodash";
3
+ import delay from "delay";
4
4
  import { bulkIsWhitelisted, bulkLastAuth } from "./utils";
5
5
 
6
6
  //create tunnel to fv server ssh -L 9090:server:8080 -N user@server -i sshkey
7
+
8
+ const saveImages = async a => {
9
+ const i1 = await fetch("http://localhost:9090/enrollment-3d/" + a[1]).then(_ => _.json());
10
+ const i2 = await fetch("http://localhost:9090/enrollment-3d/" + a[2]).then(_ => _.json());
11
+ if (i1.auditTrailBase64 && i2.auditTrailBase64) {
12
+ fs.writeFileSync("fvimages/" + a.join("_") + "-a.jpg", i1.auditTrailBase64, {
13
+ encoding: "base64"
14
+ });
15
+ fs.writeFileSync("fvimages/" + a.join("_") + "-b.jpg", i2.auditTrailBase64, {
16
+ encoding: "base64"
17
+ });
18
+ } else console.log("not found", a, !!i1.auditTrailBase64, !!i2.auditTrailBase64);
19
+ };
20
+
7
21
  const main = async () => {
8
22
  const data = JSON.parse(fs.readFileSync("fvtriplets2.txt").toString());
9
23
  const triplets = uniqBy(chunk(data, 3), _ => _.join("_"));
@@ -20,22 +34,125 @@ const main = async () => {
20
34
  return fs.existsSync(key) === false;
21
35
  });
22
36
  console.log({ notfetched });
23
- const ps = notfetched.map(async a => {
24
- const i1 = await fetch("http://localhost:9090/enrollment-3d/" + a[1]).then(_ => _.json());
25
- const i2 = await fetch("http://localhost:9090/enrollment-3d/" + a[2]).then(_ => _.json());
26
- if (i1.auditTrailBase64 && i2.auditTrailBase64) {
27
- fs.writeFileSync("fvimages/" + a.join("_") + "-a.jpg", i1.auditTrailBase64, {
28
- encoding: "base64"
29
- });
30
- fs.writeFileSync("fvimages/" + a.join("_") + "-b.jpg", i2.auditTrailBase64, {
31
- encoding: "base64"
32
- });
33
- } else console.log("not found", a, !!i1.auditTrailBase64, !!i2.auditTrailBase64);
34
- });
37
+ const ps = notfetched.map(saveImages);
35
38
 
36
39
  await Promise.all(ps);
37
40
  };
38
41
 
42
+ // check which ids have been indexed, if not then make sure they are whitelisted
43
+ const checkIndexedOrDelete = async () => {
44
+ const data = JSON.parse(
45
+ "[" + fs.readFileSync("fvids.json").toString().replace(/\n$/, "").replaceAll(/\n/g, ",\n") + "]"
46
+ );
47
+ const triplets = uniqBy(data, _ => _["wallet"]);
48
+
49
+ const accounts = triplets.map(_ => _["wallet"]);
50
+ console.log("Total accounts:", accounts.length, accounts[0]);
51
+ let whitelisted = [];
52
+ for (let batch of chunk(accounts, 200)) {
53
+ whitelisted.push(...(await bulkIsWhitelistedFuse(batch)));
54
+ }
55
+ const failed = triplets.filter(_ => whitelisted.includes(_["wallet"]) === false);
56
+
57
+ console.log("Total whitelisted:", whitelisted.length);
58
+ console.log("Total not whitelisted:", failed.length);
59
+ let ps = [];
60
+
61
+ ps = [];
62
+ for (let record of triplets) {
63
+ const isEnrolled = fetch("http://localhost:9090/enrollment-3d/" + record["identifier"].slice(0, 42))
64
+ .then(_ => _.json())
65
+ .then(_ => _.success);
66
+ // const isEnrolled = "unknown";
67
+ const isIndexed = fetch("http://localhost:9090/3d-db/get", {
68
+ method: "POST",
69
+ body: JSON.stringify({ identifier: record["identifier"].slice(0, 42), groupName: "GoodDollar" })
70
+ })
71
+ .then(_ => _.json())
72
+ .then(_ => _.success);
73
+
74
+ ps.push(
75
+ Promise.all([isEnrolled, isIndexed]).then(_ => ({
76
+ ...record,
77
+ isEnrolled: _[0],
78
+ isIndexed: _[1],
79
+ isWhitelisted: whitelisted.includes(record.wallet)
80
+ }))
81
+ );
82
+ if (ps.length % 50 === 0) {
83
+ console.log("waiting...", ps.length);
84
+ await Promise.all(ps);
85
+ }
86
+ }
87
+ console.log("waiting...", ps.length);
88
+ const r = await Promise.all(ps);
89
+ const toDelete = r.filter(
90
+ _ => (_.isWhitelisted && (!_.isEnrolled || !_.isIndexed)) || (!_.isWhitelisted && _.isIndexed && !_.isEnrolled)
91
+ );
92
+ const toWhitelist = r.filter(_ => !_.isWhitelisted && _.isEnrolled && _.isIndexed);
93
+
94
+ console.log("toDelete:", toDelete.length);
95
+
96
+ console.log("toWhitelist:", toWhitelist.length);
97
+ fs.writeFileSync("fvIndexedOrEnrolled.json", JSON.stringify(r));
98
+ };
99
+
100
+ const fixInvalidIndexed = async () => {
101
+ const indexedOrEnrolled = JSON.parse(fs.readFileSync("fvIndexedOrEnrolled.json").toString());
102
+ const toDelete = indexedOrEnrolled.filter(
103
+ _ => (_.isWhitelisted && (!_.isEnrolled || !_.isIndexed)) || (!_.isWhitelisted && _.isIndexed && !_.isEnrolled)
104
+ );
105
+ const toWhitelist = indexedOrEnrolled.filter(_ => !_.isWhitelisted && _.isEnrolled && _.isIndexed);
106
+
107
+ console.log("toDelete:", toDelete.length);
108
+
109
+ console.log("toWhitelist:", toWhitelist.length);
110
+
111
+ console.log(toWhitelist);
112
+ return;
113
+ let ps = [];
114
+ for (let record of toWhitelist) {
115
+ ps.push(fetch(`https://goodserver.gooddollar.org/syncWhitelist/${record.wallet}`).then(_ => _.json()));
116
+ if (ps.length > 0 && ps.length % 3 === 0) {
117
+ console.log("waiting...", ps.length);
118
+ await Promise.all(ps).catch(e => console.log(e));
119
+ console.log("waiting 60 seconds for rate limit");
120
+ await delay(50000);
121
+ }
122
+ }
123
+ if (ps.length > 0) {
124
+ console.log("waiting...", ps.length);
125
+ await Promise.all(ps).catch(e => console.log(e));
126
+ }
127
+
128
+ const removeWhitelist = toDelete.filter(_ => _.isWhitelisted).map(_ => _.wallet);
129
+ // removeWhitelist.push(...toWhitelist.map(_ => _.wallet));
130
+ ps = [];
131
+ for (let record of toDelete) {
132
+ if (record.isIndexed) {
133
+ // console.log("removing record from index and queuing for whitelist removal", record.wallet);
134
+ const isIndexed = fetch("http://localhost:9090/3d-db/delete", {
135
+ method: "POST",
136
+ body: JSON.stringify({ identifier: record["identifier"].slice(0, 42), groupName: "GoodDollar" })
137
+ }).then(_ => _.json());
138
+
139
+ ps.push(
140
+ isIndexed.then(_ => {
141
+ if (!_.success) throw new Error(`delete index failed: ${record.wallet}`);
142
+ })
143
+ );
144
+ }
145
+ if (ps.length > 0 && ps.length % 10 === 0) {
146
+ console.log("waiting...", ps.length);
147
+ await Promise.all(ps).catch(e => console.log(e));
148
+ }
149
+ }
150
+ console.log("waiting...", ps.length);
151
+ await Promise.all(ps).catch(e => console.log(e));
152
+ console.log({ removeWhitelist }, removeWhitelist.length);
153
+ fs.writeFileSync("removeWhitelist.json", JSON.stringify(removeWhitelist));
154
+ };
155
+
39
156
  const deleteIdentifiers = async password => {
40
157
  const data = JSON.parse(fs.readFileSync("fvtriplets2.txt").toString());
41
158
  const triplets = uniqBy(chunk(data, 3), _ => _.join("_"));
@@ -89,7 +206,9 @@ const deleteIdentifiers = async password => {
89
206
  const res = await Promise.all(ps);
90
207
  console.log(res);
91
208
  };
92
-
209
+ // checkIndexedOrDelete();
210
+ fixInvalidIndexed();
211
+ // console.log(process.env.ADMIN_PASSWORD);
212
+ // deleteIdentifiers(process.env.ADMIN_PASSWORD);
93
213
  // main();
94
- console.log(process.env.ADMIN_PASSWORD);
95
- deleteIdentifiers(process.env.ADMIN_PASSWORD);
214
+ saveImages(["", "", ""]);