@gooddollar/goodprotocol 1.0.3-beta.0 → 1.0.3-beta.4

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/hardhat.config.ts CHANGED
@@ -57,6 +57,10 @@ const hhconfig: HardhatUserConfig = {
57
57
  accountsBalance: "10000000000000000000000000"
58
58
  }
59
59
  },
60
+ test: {
61
+ allowUnlimitedContractSize: true,
62
+ url: "http://127.0.0.1:8545/"
63
+ },
60
64
  develop: {
61
65
  gasPrice: 1000000000, //1 gwei
62
66
  url: "http://127.0.0.1:8545/",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddollar/goodprotocol",
3
- "version": "1.0.3-beta.0",
3
+ "version": "1.0.3-beta.4",
4
4
  "description": "GoodDollar Protocol",
5
5
  "scripts": {
6
6
  "build": "scripts/build.sh deploy",
@@ -0,0 +1,52 @@
1
+ import { get, range, chunk, flatten, mergeWith, sortBy, uniq } from "lodash";
2
+ import coreContracts from "../../releases/deployment.json";
3
+ import { ethers as Ethers } from "hardhat";
4
+ import fetch from "node-fetch";
5
+ import { request, gql } from "graphql-request";
6
+ import { Retrier } from "@jsier/retrier";
7
+ import PromisePool from "async-promise-pool";
8
+
9
+ const ONE_DAY = 24 * 60 * 60;
10
+
11
+ const main = async () => {
12
+ const signer = (await Ethers.getSigners())[0];
13
+ console.log("signer:", signer.address);
14
+ const ubiScheme = new Ethers.Contract(
15
+ "0xD7aC544F8A570C4d8764c3AAbCF6870CBD960D0D",
16
+ ["function fishMulti(address[] tofish)"]
17
+ ).connect(signer);
18
+ const twoWeeksAgo =
19
+ parseInt((Date.now() / 1000).toFixed(0)) - 24 * 60 * 60 * 14;
20
+
21
+ const daysAgo: number[] = range(0, 180, 1);
22
+ let curDay = twoWeeksAgo;
23
+ for (let day of daysAgo) {
24
+ const query = gql`
25
+ {
26
+ walletStats(first:1000, where: { lastClaimed_lt: ${curDay},lastClaimed_gt: ${
27
+ curDay - 24 * 60 * 60
28
+ } isActiveUser: true }) {
29
+ id
30
+ }
31
+ }
32
+ `;
33
+
34
+ console.log("fetching inactive users since:", { curDay, day });
35
+ const { walletStats } = await request(
36
+ "https://api.thegraph.com/subgraphs/name/gooddollar/gooddollarfuse",
37
+ query
38
+ );
39
+ console.log("got inactive wallets:", walletStats.length);
40
+ const accounts = walletStats.map(_ => _.id);
41
+ for (let tofish of chunk(accounts, 50)) {
42
+ const tx = await ubiScheme.fishMulti(tofish, { gasLimit: 2000000 });
43
+ console.log("fishing tx:", tx, tofish);
44
+ const res = await tx.wait();
45
+ console.log("fishing tx result:", res);
46
+ }
47
+
48
+ curDay = curDay - ONE_DAY;
49
+ }
50
+ };
51
+
52
+ main();
@@ -74,7 +74,7 @@ export const main = async (
74
74
  if (isProduction && networkName.includes("mainnet")) {
75
75
  GAS_SETTINGS.gasLimit = 6000000;
76
76
  GAS_SETTINGS.maxFeePerGas = ethers.utils.parseUnits("80", "gwei");
77
- } else if (!networkName.includes("mainnet")) {
77
+ } else if (isProduction && !networkName.includes("mainnet")) {
78
78
  //case we are on fusefuse
79
79
  GAS_SETTINGS = {
80
80
  gasLimit: 6000000,
@@ -355,6 +355,7 @@ export const main = async (
355
355
 
356
356
  if (contract.isUpgradable !== false) {
357
357
  if (isCoverage) {
358
+ console.log("Deploying:", contract.name, "using proxy");
358
359
  //coverage has large contracts doesnt work with proxy factory
359
360
  const tx = await upgrades.deployProxy(Contract, args, {
360
361
  initializer: contract.initializer,
@@ -364,6 +365,7 @@ export const main = async (
364
365
  await countTotalGas(tx, contract.name);
365
366
  return tx;
366
367
  }
368
+ console.log("Deploying:", contract.name, "using proxyfactory");
367
369
  const encoded = Contract.interface.encodeFunctionData(
368
370
  contract.initializer || "initialize",
369
371
  args
@@ -394,6 +396,7 @@ export const main = async (
394
396
  } else {
395
397
  //for some reason deploying with link library via proxy doesnt work on hardhat test env
396
398
  if (isTest === false) {
399
+ console.log("Deploying:", contract.name, "using proxyfactory code");
397
400
  const constructor = Contract.interface.encodeDeploy(args);
398
401
  const bytecode = ethers.utils.solidityPack(
399
402
  ["bytes", "bytes"],
@@ -411,6 +414,7 @@ export const main = async (
411
414
  )
412
415
  );
413
416
  } else {
417
+ console.log("Deploying:", contract.name, "using regular");
414
418
  const tx = await Contract.deploy(...args, GAS_SETTINGS);
415
419
  await countTotalGas(tx, contract.name);
416
420
  const impl = await tx.deployed();
@@ -944,7 +948,7 @@ export const main = async (
944
948
  !isMainnet && (await performUpgradeFuse(release));
945
949
  console.log("upgraded contracts", { totalGas });
946
950
  }
947
- if (!isTest && !isCoverage) {
951
+ if (isMainnet && !isTest && !isCoverage) {
948
952
  await verifyContracts(release);
949
953
  }
950
954
 
@@ -952,7 +956,7 @@ export const main = async (
952
956
  return release;
953
957
  // await proveNewRep();
954
958
  };
955
- if (network.name !== "hardhat") {
959
+ if (network.name !== "hardhat" && process.argv[1].includes("upgradeToV2.ts")) {
956
960
  main(name, false)
957
961
  .catch(e => {
958
962
  console.log(e);