@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.
- 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/ILendingPool.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/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/GovarnanceStaking.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/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.json +6 -6
- package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.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/OverMintTester.sol/OverMintTester.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
- package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.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/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/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/DonationsStaking.sol/DonationsStaking.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/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.json +3 -3
- package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.json +4 -4
- package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.json +2 -2
- package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.json +4 -4
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
- package/artifacts/contracts/unaudited-foundation/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
- package/artifacts/contracts/unaudited-foundation/InvitesV1.sol/InvitesV1.dbg.json +1 -1
- package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.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/NameService.sol/NameService.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/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
- package/contracts/staking/aave/GoodAaveStaking.sol +4 -3
- package/contracts/staking/compound/GoodCompoundStaking.sol +4 -3
- package/package.json +1 -1
- package/scripts/deployFullDAO.ts +7 -7
- package/scripts/misc/goodgiveback.ts +65 -0
- package/scripts/verify.ts +60 -47
- 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
|
|
23
|
+
uint32 public collectInterestGasCost;
|
|
24
24
|
// Gas cost to collect COMP rewards
|
|
25
|
-
uint32 public compCollectGasCost
|
|
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
package/scripts/deployFullDAO.ts
CHANGED
|
@@ -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
|
|
223
|
-
COMPUsdOracle: release.COMPUsdOracle
|
|
224
|
-
USDCUsdOracle: release.USDCUsdOracle
|
|
225
|
-
AAVEUsdOracle: release.AAVEUsdOracle
|
|
226
|
-
AaveLendingPool:
|
|
227
|
-
AaveIncentiveController:
|
|
228
|
-
GasPriceOracle: release.GasPriceOracle
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|