@gooddollar/goodprotocol 1.0.7-beta.2 → 1.0.7-beta.3

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 (94) hide show
  1. package/artifacts/contracts/DAOStackInterfaces.sol/Avatar.dbg.json +1 -1
  2. package/artifacts/contracts/DAOStackInterfaces.sol/Controller.dbg.json +1 -1
  3. package/artifacts/contracts/DAOStackInterfaces.sol/GlobalConstraintInterface.dbg.json +1 -1
  4. package/artifacts/contracts/DAOStackInterfaces.sol/IntVoteInterface.dbg.json +1 -1
  5. package/artifacts/contracts/DAOStackInterfaces.sol/ReputationInterface.dbg.json +1 -1
  6. package/artifacts/contracts/DAOStackInterfaces.sol/SchemeRegistrar.dbg.json +1 -1
  7. package/artifacts/contracts/Interfaces.sol/AggregatorV3Interface.dbg.json +1 -1
  8. package/artifacts/contracts/Interfaces.sol/ERC20.dbg.json +1 -1
  9. package/artifacts/contracts/Interfaces.sol/IAaveIncentivesController.dbg.json +1 -1
  10. package/artifacts/contracts/Interfaces.sol/IAdminWallet.dbg.json +1 -1
  11. package/artifacts/contracts/Interfaces.sol/IDonationStaking.dbg.json +1 -1
  12. package/artifacts/contracts/Interfaces.sol/IERC2917.dbg.json +1 -1
  13. package/artifacts/contracts/Interfaces.sol/IFirstClaimPool.dbg.json +1 -1
  14. package/artifacts/contracts/Interfaces.sol/IGoodDollar.dbg.json +1 -1
  15. package/artifacts/contracts/Interfaces.sol/IGoodStaking.dbg.json +1 -1
  16. package/artifacts/contracts/Interfaces.sol/IHasRouter.dbg.json +1 -1
  17. package/artifacts/contracts/Interfaces.sol/IIdentity.dbg.json +1 -1
  18. package/artifacts/contracts/Interfaces.sol/ILendingPool.dbg.json +1 -1
  19. package/artifacts/contracts/Interfaces.sol/INameService.dbg.json +1 -1
  20. package/artifacts/contracts/Interfaces.sol/IUBIScheme.dbg.json +1 -1
  21. package/artifacts/contracts/Interfaces.sol/ProxyAdmin.dbg.json +1 -1
  22. package/artifacts/contracts/Interfaces.sol/Reserve.dbg.json +1 -1
  23. package/artifacts/contracts/Interfaces.sol/Staking.dbg.json +1 -1
  24. package/artifacts/contracts/Interfaces.sol/Uniswap.dbg.json +1 -1
  25. package/artifacts/contracts/Interfaces.sol/UniswapFactory.dbg.json +1 -1
  26. package/artifacts/contracts/Interfaces.sol/UniswapPair.dbg.json +1 -1
  27. package/artifacts/contracts/Interfaces.sol/cERC20.dbg.json +1 -1
  28. package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
  29. package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
  30. package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
  31. package/artifacts/contracts/governance/GovarnanceStaking.sol/GovernanceStaking.dbg.json +1 -1
  32. package/artifacts/contracts/governance/MultiBaseGovernanceShareField.sol/MultiBaseGovernanceShareField.dbg.json +1 -1
  33. package/artifacts/contracts/governance/Reputation.sol/Reputation.dbg.json +1 -1
  34. package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
  35. package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
  36. package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
  37. package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
  38. package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
  39. package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.json +6 -6
  40. package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
  41. package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
  42. package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
  43. package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
  44. package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
  45. package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
  46. package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
  47. package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
  48. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
  49. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
  50. package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
  51. package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
  52. package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
  53. package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
  54. package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
  55. package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
  56. package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
  57. package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
  58. package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
  59. package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
  60. package/artifacts/contracts/reserve/GoodReserveCDai.sol/ContributionCalc.dbg.json +1 -1
  61. package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.dbg.json +1 -1
  62. package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
  63. package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
  64. package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.dbg.json +1 -1
  65. package/artifacts/contracts/staking/SimpleStaking.sol/SimpleStaking.dbg.json +1 -1
  66. package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.dbg.json +1 -1
  67. package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
  68. package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.json +3 -3
  69. package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
  70. package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.json +4 -4
  71. package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
  72. package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.json +2 -2
  73. package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
  74. package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.json +4 -4
  75. package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
  76. package/artifacts/contracts/unaudited-foundation/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
  77. package/artifacts/contracts/unaudited-foundation/InvitesV1.sol/InvitesV1.dbg.json +1 -1
  78. package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
  79. package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
  80. package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
  81. package/artifacts/contracts/utils/DSMath.sol/DSMath.dbg.json +1 -1
  82. package/artifacts/contracts/utils/DataTypes.sol/DataTypes.dbg.json +1 -1
  83. package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
  84. package/artifacts/contracts/utils/ProtocolUpgrade.sol/OldMarketMaker.dbg.json +1 -1
  85. package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.dbg.json +1 -1
  86. package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
  87. package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
  88. package/contracts/staking/aave/GoodAaveStaking.sol +4 -3
  89. package/contracts/staking/compound/GoodCompoundStaking.sol +4 -3
  90. package/package.json +1 -1
  91. package/scripts/deployFullDAO.ts +7 -7
  92. package/scripts/misc/goodgiveback.ts +65 -0
  93. package/scripts/verify.ts +60 -47
  94. package/truffle-config.js +12 -0
@@ -20,9 +20,9 @@ contract GoodCompoundStaking is SimpleStaking {
20
20
  address public compUsdOracle;
21
21
 
22
22
  // Gas cost to collect interest from this staking contract
23
- uint32 public collectInterestGasCost = 250000;
23
+ uint32 public collectInterestGasCost;
24
24
  // Gas cost to collect COMP rewards
25
- uint32 public compCollectGasCost = 150000;
25
+ uint32 public compCollectGasCost;
26
26
 
27
27
  address[] public tokenToDaiSwapPath;
28
28
 
@@ -75,7 +75,8 @@ contract GoodCompoundStaking is SimpleStaking {
75
75
  tokenToDaiSwapPath = _tokenToDaiSwapPath;
76
76
  comp = ERC20(nameService.getAddress("COMP"));
77
77
  uniswapContract = Uniswap(nameService.getAddress("UNISWAP_ROUTER"));
78
-
78
+ collectInterestGasCost = 250000;
79
+ compCollectGasCost = 150000;
79
80
  _approveTokens();
80
81
  }
81
82
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddollar/goodprotocol",
3
- "version": "1.0.7-beta.2",
3
+ "version": "1.0.7-beta.3",
4
4
  "description": "GoodDollar Protocol",
5
5
  "scripts": {
6
6
  "build": "scripts/build.sh deploy",
@@ -219,13 +219,13 @@ export const createDAO = async () => {
219
219
  BancorFormula: release.BancorFormula,
220
220
  Avatar: release.Avatar,
221
221
  Controller: release.Controller,
222
- DAIUsdOracle: release.DAIUsdOracle || ethers.constants.AddressZero,
223
- COMPUsdOracle: release.COMPUsdOracle || ethers.constants.AddressZero,
224
- USDCUsdOracle: release.USDCUsdOracle || ethers.constants.AddressZero,
225
- AAVEUsdOracle: release.AAVEUsdOracle || ethers.constants.AddressZero,
226
- AaveLendingPool: ethers.constants.AddressZero,
227
- AaveIncentiveController: ethers.constants.AddressZero,
228
- GasPriceOracle: release.GasPriceOracle || ethers.constants.AddressZero,
222
+ DAIUsdOracle: release.DAIUsdOracle,
223
+ COMPUsdOracle: release.COMPUsdOracle,
224
+ USDCUsdOracle: release.USDCUsdOracle,
225
+ AAVEUsdOracle: release.AAVEUsdOracle,
226
+ AaveLendingPool: null,
227
+ AaveIncentiveController: null,
228
+ GasPriceOracle: release.GasPriceOracle,
229
229
  cDAI: release.cDAI || ethers.constants.AddressZero,
230
230
  DAI: release.DAI || ethers.constants.AddressZero,
231
231
  COMP: release.COMP || ethers.constants.AddressZero,
@@ -0,0 +1,65 @@
1
+ import { get, range, chunk, flatten, mergeWith, sortBy, uniq } 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
+ const fuseProvider = new ethers.providers.JsonRpcProvider(
9
+ "https://rpc.fuse.io"
10
+ );
11
+ const ethcallProvider = new Provider(fuseProvider, 122);
12
+
13
+ const GD_FUSE = "0x495d133b938596c9984d462f007b676bdc57ecec";
14
+ const IDENTITY_FUSE = "0xFa8d865A962ca8456dF331D78806152d3aC5B84F";
15
+
16
+ let gd = new ethers.Contract(
17
+ GD_FUSE,
18
+ [
19
+ "event Transfer(address indexed from, address indexed to, uint amount)",
20
+ "function balanceOf(address) view returns(uint256)"
21
+ ],
22
+ fuseProvider
23
+ );
24
+ const identityContract = new Contract(IDENTITY_FUSE, Identity.abi);
25
+
26
+ const getDonations = async recipient => {
27
+ const filter = gd.filters.Transfer(null, recipient);
28
+ const events = await gd.queryFilter(filter, 14300689, 14800689);
29
+ console.log("events found:", events.length);
30
+ const agg = {};
31
+ events.forEach(e => {
32
+ const { from, amount } = e.args;
33
+ agg[from] = (agg[from] || 0) + amount.toNumber();
34
+ });
35
+ const donators = Object.keys(agg);
36
+ const calls = donators.map(d => identityContract.isWhitelisted(d));
37
+ const result = await ethcallProvider.all(calls);
38
+ const final = donators.map((d, i) => [recipient, d, agg[d], result[i]]);
39
+ return final;
40
+ };
41
+ const main = async () => {
42
+ const recipients = [
43
+ "0x4c841e892d24faf01e7738800db8aed1160098ca",
44
+ "0xf8b4c7098d195d12c1336a09fddaa9afa11bd097",
45
+ "0x834f750aaab09d14a1101a15b185121f9a1475b2",
46
+ "0x956e72df332ee17ecb3d641fca1f600ea19d1d09",
47
+ "0x13dfefdc4713b98c07abdd9f7d93d2b8db716e6c",
48
+ "0xbbc680560a88cf06c9ae8a36b209288577d9a143",
49
+ "0x626c86ff4749043df4dd5e9dce650325955a4e6d",
50
+ "0x82a92d1949498d494189152a040aeb0ef0175730",
51
+ "0x27fb119b81b26104c0865435b741b6031bb35bb6",
52
+ "0x6214D6b492528fc5517f57499c436A5FF72B6D5B"
53
+ ];
54
+ const results = await Promise.all(recipients.map(r => getDonations(r)));
55
+
56
+ // console.log(flatten(flatten(results)));
57
+
58
+ fs.writeFileSync(
59
+ "goodgive.csv",
60
+ flatten(results)
61
+ .map(_ => _.join(","))
62
+ .join("\n")
63
+ );
64
+ };
65
+ main().catch(e => console.log(e));
package/scripts/verify.ts CHANGED
@@ -1,54 +1,67 @@
1
- import fs from "fs"
2
- import { isArray } from "lodash"
1
+ import fs from "fs";
2
+ import { isArray } from "lodash";
3
3
  import type EthersT from "ethers";
4
- import type HreT from "hardhat"
5
- import { HardhatEthersHelpers } from "@nomiclabs/hardhat-ethers/types"
6
- import { execSync } from "child_process"
7
- type Ethers = typeof EthersT.ethers & HardhatEthersHelpers
8
- type HRE = typeof HreT
4
+ import type HreT from "hardhat";
5
+ import { HardhatEthersHelpers } from "@nomiclabs/hardhat-ethers/types";
6
+ import { execSync } from "child_process";
7
+ type Ethers = typeof EthersT.ethers & HardhatEthersHelpers;
8
+ type HRE = typeof HreT;
9
9
 
10
- let ethers:Ethers
10
+ let ethers: Ethers;
11
11
  export const verify = async (hre: HRE) => {
12
- console.log("truffle compiling....")
13
- const Verify = require("truffle-plugin-verify") //not imported because of bug
14
- const truffleOutput = execSync("npx truffle compile").toString("utf8")
15
- console.log({truffleOutput})
16
- ethers = hre.ethers
17
- const deployed = JSON.parse(fs.readFileSync("releases/deployment.json").toString())
18
- const contracts = deployed[hre.network.name]
19
-
20
- const contractPairs = (await Promise.all(Object.entries(contracts).map(async (entry) => {
21
- if(isArray(entry[1]))
22
- return
23
- const addr = await getImplementationAddress(entry[1])
24
- return entry[0]+'@'+addr
25
- }))).filter(_ => _)
12
+ console.log("truffle compiling....");
13
+ const Verify = require("truffle-plugin-verify"); //not imported because of bug
14
+ const truffleOutput = execSync("npx truffle compile").toString("utf8");
15
+ console.log({ truffleOutput });
16
+ ethers = hre.ethers;
17
+ const deployed = JSON.parse(
18
+ fs.readFileSync("releases/deployment.json").toString()
19
+ );
20
+ const contracts = deployed[hre.network.name];
26
21
 
27
- contractPairs.unshift()
22
+ const contractPairs = (
23
+ await Promise.all(
24
+ Object.entries(contracts).map(async entry => {
25
+ if (isArray(entry[1])) return;
26
+ if (
27
+ typeof entry[1] !== "string" ||
28
+ (entry[1] as string).startsWith("0x") === false
29
+ )
30
+ return;
31
+ const addr = await getImplementationAddress(entry[1]);
32
+ return entry[0] + "@" + addr;
33
+ })
34
+ )
35
+ ).filter(_ => _);
28
36
 
29
- const config = {
30
- debug: false,
31
- network_id: hre.network.config.chainId,
32
- api_keys: {
33
- etherscan: hre.config.etherscan.apiKey
34
- },
35
- working_directory: ".",
36
- contracts_build_directory: "build/contracts",
37
- '_':contractPairs
38
- }
39
- return Verify(config)
37
+ contractPairs.unshift();
38
+
39
+ const config = {
40
+ debug: false,
41
+ network_id: hre.network.config.chainId,
42
+ api_keys: {
43
+ etherscan: hre.config.etherscan.apiKey
44
+ },
45
+ working_directory: ".",
46
+ contracts_build_directory: "build/contracts",
47
+ _: contractPairs
48
+ };
49
+ return Verify(config);
40
50
  };
41
51
 
42
- const getImplementationAddress = async (addr) => {
43
- let proxy = await ethers.provider.getStorageAt(addr,"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc")
44
- let res = addr
45
- if(proxy != ethers.constants.HashZero)
46
- res = "0x"+proxy.slice(-40)
47
- else {
48
- const code = await ethers.getDefaultProvider().getCode(addr)
49
- if(code.startsWith("0x363d3d373d3d3d363d73"))
50
- res = "0x"+code.slice(22,62)
51
- }
52
- console.log("impl address for:",addr,res)
53
- return res
54
- }
52
+ const getImplementationAddress = async addr => {
53
+ console.log("finding impl for:", addr);
54
+ let proxy = await ethers.provider.getStorageAt(
55
+ addr,
56
+ "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"
57
+ );
58
+ let res = addr;
59
+ if (proxy != ethers.constants.HashZero) res = "0x" + proxy.slice(-40);
60
+ else {
61
+ const code = await ethers.getDefaultProvider().getCode(addr);
62
+ if (code.startsWith("0x363d3d373d3d3d363d73"))
63
+ res = "0x" + code.slice(22, 62);
64
+ }
65
+ console.log("impl address for:", addr, res);
66
+ return res;
67
+ };
package/truffle-config.js CHANGED
@@ -70,6 +70,18 @@ module.exports = {
70
70
  timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50)
71
71
  skipDryRun: true // Skip dry run before migrations? (default: false for public nets )
72
72
  },
73
+ ropsten: {
74
+ provider: () =>
75
+ new HDWalletProvider(
76
+ mnemonic,
77
+ `https://ropsten.infura.io/v3/YOUR-PROJECT-ID`
78
+ ),
79
+ network_id: 3, // Ropsten's id
80
+ gas: 5000000, // Ropsten has a lower block limit than mainnet
81
+ confirmations: 2, // # of confs to wait between deployments. (default: 0)
82
+ timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50)
83
+ skipDryRun: true // Skip dry run before migrations? (default: false for public nets )
84
+ },
73
85
  fuse: {
74
86
  provider: () => new HDWalletProvider(mnemonic, `https://rpc.fuse.io`),
75
87
  network_id: 122, // Ropsten's id