@gooddollar/goodprotocol 1.0.25 → 1.0.27
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/FuseFaucet.min.json +1 -0
- package/artifacts/abis/FuseStakingV3.min.json +1 -0
- package/artifacts/abis/IConsensus.min.json +1 -0
- package/artifacts/abis/InvitesV1.min.json +1 -0
- package/artifacts/abis/PegSwap.min.json +1 -0
- 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/fuseFaucet/FuseFaucet.sol/FuseFaucet.dbg.json +4 -0
- package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.json +325 -0
- 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/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/invite/InvitesV1.sol/InvitesV1.dbg.json +4 -0
- package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.json +492 -0
- 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/EthUSDMockOracle.sol/EthUSDMockOracle.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/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/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/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 +4 -0
- package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.json +733 -0
- package/artifacts/contracts/staking/FuseStakingV3.sol/IConsensus.dbg.json +4 -0
- package/artifacts/contracts/staking/FuseStakingV3.sol/IConsensus.json +104 -0
- package/artifacts/contracts/staking/FuseStakingV3.sol/PegSwap.dbg.json +4 -0
- package/artifacts/contracts/staking/FuseStakingV3.sol/PegSwap.json +34 -0
- 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/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
- 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/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/MultiCall.sol/Multicall.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/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/fuseFaucet/FuseFaucet.sol +172 -0
- package/contracts/invite/InvitesV1.sol +316 -0
- package/contracts/staking/FuseStakingV3.sol +641 -0
- package/hardhat.config.ts +18 -1
- package/package.json +12 -12
- package/scripts/bulkProof.ts +0 -5
- package/scripts/misc/faucetStats.ts +103 -0
- package/scripts/multichain-deploy/basicdao-deploy.ts +0 -1
- package/scripts/upgradeScheme.ts +7 -12
- package/scripts/upgradeToV2/upgradeToV2.ts +22 -15
- package/scripts/upgradeToV2/upgradeToV2Recover.ts +0 -8
- package/test/FuseFaucet.test.ts +168 -0
- package/test/InvitesV1.test.ts +354 -0
- package/test/staking/FuseStaking.test.ts +152 -0
- package/test/utils/ProtocolUpgrade.test.ts +1 -4
- package/types/FuseFaucet.ts +498 -0
- package/types/FuseStakingV3.ts +1234 -0
- package/types/IConsensus.ts +225 -0
- package/types/InvitesV1.ts +797 -0
- package/types/OwnableUpgradeable.ts +166 -0
- package/types/PegSwap.ts +112 -0
- package/types/factories/FuseFaucet__factory.ts +373 -0
- package/types/factories/FuseStakingV3__factory.ts +781 -0
- package/types/factories/IConsensus__factory.ts +116 -0
- package/types/factories/InvitesV1__factory.ts +540 -0
- package/types/factories/OwnableUpgradeable__factory.ts +78 -0
- package/types/factories/PegSwap__factory.ts +46 -0
- package/types/hardhat.d.ts +54 -0
- package/types/index.ts +12 -0
- package/yarn.lock +320 -217
- package/patches/@nomiclabs+hardhat-etherscan+3.0.3.patch +0 -41
- package/patches/@openzeppelin+hardhat-upgrades+1.7.0.patch +0 -67
- package/patches/@openzeppelin+upgrades-core+1.4.2.patch +0 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddollar/goodprotocol",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.27",
|
|
4
4
|
"description": "GoodDollar Protocol",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "scripts/build.sh deploy",
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"daoUpgrade": "hardhat run scripts/upgradeToV2/upgradeToV2.ts",
|
|
15
15
|
"deployOldDAO": "hardhat run scripts/test/localOldDaoDeploy.ts",
|
|
16
16
|
"runNode": "hardhat node &",
|
|
17
|
-
"testDAOUpgrade": "yarn runNode
|
|
18
|
-
"testDAOUpgradeFuse": "yarn runNode
|
|
19
|
-
"deployTestOld": "yarn runNode
|
|
20
|
-
"deployTest": "yarn runNode
|
|
17
|
+
"testDAOUpgrade": "yarn runNode & yarn compile && yarn deployOldDAO --network develop-mainnet && yarn daoUpgrade --network develop-mainnet",
|
|
18
|
+
"testDAOUpgradeFuse": "yarn runNode & yarn compile && yarn deployOldDAO --network develop && yarn daoUpgrade --network develop",
|
|
19
|
+
"deployTestOld": "yarn runNode & yarn compile && hardhat run scripts/test/singleOldDaoDeploy.ts --network dapptest && yarn daoUpgrade --network dapptest && yarn daoUpgrade --network dapptest-mainnet && hardhat run scripts/test/simulateInterest.ts --network dapptest",
|
|
20
|
+
"deployTest": "yarn runNode & yarn compile && hardhat run scripts/deployFullDAO.ts --network dapptest && hardhat run scripts/deployFullDAO.ts --network dapptest-mainnet && hardhat run scripts/test/simulateInterest.ts --network dapptest"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"artifacts/contracts",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@jsier/retrier": "^1.2.4",
|
|
60
60
|
"@openzeppelin/contracts": "^4.5.0",
|
|
61
61
|
"@openzeppelin/contracts-upgradeable": "^4.3.2",
|
|
62
|
-
"@typechain/hardhat": "^
|
|
62
|
+
"@typechain/hardhat": "^6.1.2",
|
|
63
63
|
"async-promise-pool": "^1.0.4",
|
|
64
64
|
"ethers-multicall": "^0.2.1",
|
|
65
65
|
"openzeppelin-solidity": "^4.3.2",
|
|
@@ -73,10 +73,10 @@
|
|
|
73
73
|
"@babel/polyfill": "*",
|
|
74
74
|
"@babel/preset-env": "*",
|
|
75
75
|
"@babel/register": "*",
|
|
76
|
-
"@nomiclabs/hardhat-ethers": "^2.
|
|
77
|
-
"@nomiclabs/hardhat-etherscan": "^3.0
|
|
76
|
+
"@nomiclabs/hardhat-ethers": "^2.1.1",
|
|
77
|
+
"@nomiclabs/hardhat-etherscan": "^3.1.0",
|
|
78
78
|
"@nomiclabs/hardhat-waffle": "^2.0.3",
|
|
79
|
-
"@openzeppelin/hardhat-upgrades": "1.
|
|
79
|
+
"@openzeppelin/hardhat-upgrades": "^1.20.0",
|
|
80
80
|
"@typechain/ethers-v5": "^8.0.2",
|
|
81
81
|
"@types/mocha": "*",
|
|
82
82
|
"@types/node": "*",
|
|
@@ -93,9 +93,9 @@
|
|
|
93
93
|
"fs-extra": "9.0.0",
|
|
94
94
|
"graphql": "^15.5.0",
|
|
95
95
|
"graphql-request": "^3.4.0",
|
|
96
|
-
"hardhat": "^2.
|
|
97
|
-
"hardhat-contract-sizer": "^2.
|
|
98
|
-
"hardhat-gas-reporter": "^1.0.
|
|
96
|
+
"hardhat": "^2.10.2",
|
|
97
|
+
"hardhat-contract-sizer": "^2.6.1",
|
|
98
|
+
"hardhat-gas-reporter": "^1.0.8",
|
|
99
99
|
"lodash": "^4.17.21",
|
|
100
100
|
"merkle-tree-solidity": "*",
|
|
101
101
|
"mocha": "^9.1.2",
|
package/scripts/bulkProof.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import { chunk } from "lodash";
|
|
3
3
|
import { ethers, upgrades, network } from "hardhat";
|
|
4
|
-
import { networkNames } from "@openzeppelin/upgrades-core";
|
|
5
4
|
import GReputationABI from "../artifacts/contracts/governance/GReputation.sol/GReputation.json";
|
|
6
5
|
import BulkProofABI from "../artifacts/contracts/utils/BulkProof.sol/BulkProof.json";
|
|
7
6
|
|
|
@@ -12,14 +11,10 @@ import MerkleTree, {
|
|
|
12
11
|
import { BigNumber } from "ethers";
|
|
13
12
|
|
|
14
13
|
console.log({
|
|
15
|
-
networkNames,
|
|
16
14
|
network: network.name,
|
|
17
15
|
upgrade: process.env.UPGRADE
|
|
18
16
|
});
|
|
19
17
|
const { name: networkName } = network;
|
|
20
|
-
networkNames[1] = networkName;
|
|
21
|
-
networkNames[122] = networkName;
|
|
22
|
-
networkNames[3] = networkName;
|
|
23
18
|
|
|
24
19
|
export const bulkProof = async () => {
|
|
25
20
|
console.log("signer", await ethers.getSigners());
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { range, sortBy, toPairs } from "lodash";
|
|
2
|
+
import fetch from "node-fetch";
|
|
3
|
+
import PromisePool from "async-promise-pool";
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import { ethers } from "hardhat";
|
|
6
|
+
import { start } from "repl";
|
|
7
|
+
import { JsonRpcProvider } from "@ethersproject/providers";
|
|
8
|
+
import { off } from "process";
|
|
9
|
+
|
|
10
|
+
function arrayToCsv(data) {
|
|
11
|
+
return data
|
|
12
|
+
.map(
|
|
13
|
+
row =>
|
|
14
|
+
row
|
|
15
|
+
.map(String) // convert every value to String
|
|
16
|
+
.map(v => v.replaceAll('"', '""')) // escape double colons
|
|
17
|
+
.map(v => `"${v}"`) // quote it
|
|
18
|
+
.join(",") // comma-separated
|
|
19
|
+
)
|
|
20
|
+
.join("\r\n"); // rows starting on new lines
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const main = async () => {
|
|
24
|
+
const archive = new JsonRpcProvider("https://explorer-node.fuse.io");
|
|
25
|
+
const blockStep = 10000;
|
|
26
|
+
const pool = new PromisePool({ concurrency: 10 });
|
|
27
|
+
|
|
28
|
+
let faucet = await ethers.getContractAt(
|
|
29
|
+
["event WalletTopped(address indexed user, uint256 amount)"],
|
|
30
|
+
"0x01ab5966C1d742Ae0CFF7f14cC0F4D85156e83d9"
|
|
31
|
+
);
|
|
32
|
+
const endBlock = Number(await ethers.provider.getBlockNumber());
|
|
33
|
+
const daysBack = 30;
|
|
34
|
+
const dayBlocks = 12 * 60 * 24;
|
|
35
|
+
const startBlock = endBlock - dayBlocks * daysBack;
|
|
36
|
+
const days = range(startBlock, endBlock, dayBlocks);
|
|
37
|
+
const dailyBalance = [];
|
|
38
|
+
for (let day of days) {
|
|
39
|
+
dailyBalance.push(
|
|
40
|
+
(
|
|
41
|
+
await archive.getBalance(
|
|
42
|
+
"0x01ab5966C1d742Ae0CFF7f14cC0F4D85156e83d9",
|
|
43
|
+
day
|
|
44
|
+
)
|
|
45
|
+
)
|
|
46
|
+
.div(1e10)
|
|
47
|
+
.toNumber() / 1e8
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
let curBlock = startBlock;
|
|
51
|
+
|
|
52
|
+
const toppingsByAddress = {};
|
|
53
|
+
const toppingsByAmount = {};
|
|
54
|
+
let totalToppings = 0;
|
|
55
|
+
let totalAmount = 0;
|
|
56
|
+
console.log({ dailyBalance });
|
|
57
|
+
console.log({ startBlock, endBlock });
|
|
58
|
+
while (curBlock <= endBlock) {
|
|
59
|
+
const fromBlock = curBlock;
|
|
60
|
+
const toBlock = Math.min(fromBlock + blockStep, endBlock);
|
|
61
|
+
pool.add(async () => {
|
|
62
|
+
const f = faucet.filters.WalletTopped();
|
|
63
|
+
const events = await faucet
|
|
64
|
+
.queryFilter(f, fromBlock, toBlock)
|
|
65
|
+
.catch(e => {
|
|
66
|
+
console.log("failed", { fromBlock, toBlock });
|
|
67
|
+
return [];
|
|
68
|
+
});
|
|
69
|
+
events.forEach(e => {
|
|
70
|
+
totalToppings += 1;
|
|
71
|
+
totalAmount += Number(e.args.amount);
|
|
72
|
+
toppingsByAddress[e.args.user] =
|
|
73
|
+
(toppingsByAddress[e.args.user] || 0) + 1;
|
|
74
|
+
toppingsByAmount[e.args.amount] =
|
|
75
|
+
(toppingsByAmount[e.args.amount] || 0) + 1;
|
|
76
|
+
});
|
|
77
|
+
console.log("fetched events", {
|
|
78
|
+
fromBlock,
|
|
79
|
+
toBlock,
|
|
80
|
+
events: events.length
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
curBlock += blockStep;
|
|
84
|
+
}
|
|
85
|
+
await pool.all();
|
|
86
|
+
|
|
87
|
+
const topToppers = sortBy(toPairs(toppingsByAddress), "1").reverse();
|
|
88
|
+
const topAmounts = sortBy(toPairs(toppingsByAmount), "1").reverse();
|
|
89
|
+
const totalWallets = topToppers.length;
|
|
90
|
+
|
|
91
|
+
const avgToppingsPerWallet = totalToppings / totalWallets;
|
|
92
|
+
const avgToppingAmount = totalAmount / totalToppings;
|
|
93
|
+
|
|
94
|
+
fs.writeFileSync("topToppers.csv", arrayToCsv(topToppers));
|
|
95
|
+
fs.writeFileSync("topAmounts.csv", arrayToCsv(topAmounts));
|
|
96
|
+
console.log({
|
|
97
|
+
totalAmount,
|
|
98
|
+
totalToppings,
|
|
99
|
+
avgToppingsPerWallet,
|
|
100
|
+
avgToppingAmount
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
main().catch(e => console.log(e));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { network, ethers, upgrades, run } from "hardhat";
|
|
2
|
-
import { networkNames } from "@openzeppelin/upgrades-core";
|
|
3
2
|
import { isFunction, get, omitBy } from "lodash";
|
|
4
3
|
import { getImplementationAddress } from "@openzeppelin/upgrades-core";
|
|
5
4
|
import pressAnyKey from "press-any-key";
|
package/scripts/upgradeScheme.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { ethers, upgrades, network } from "hardhat";
|
|
2
|
-
import { networkNames } from "@openzeppelin/upgrades-core";
|
|
3
2
|
import { getSettings, releaser } from "../../scripts/getMigrationSettings";
|
|
4
3
|
import { SchemeRegistrar } from "../types";
|
|
5
4
|
import { getFounders } from "./getFounders";
|
|
6
5
|
|
|
7
|
-
console.log({
|
|
6
|
+
console.log({ network: network.name, upgrade: process.env.UPGRADE });
|
|
8
7
|
const { name: networkName } = network;
|
|
9
|
-
networkNames[1] = networkName;
|
|
10
|
-
networkNames[122] = networkName;
|
|
11
|
-
networkNames[3] = networkName;
|
|
12
8
|
|
|
13
9
|
export const proposeUpgradeScheme = async (daoAddresses, schemeAddress) => {
|
|
14
10
|
console.log("proposing conntract upgrade to DAO", {
|
|
@@ -47,7 +43,10 @@ export const voteUpgradeScheme = async (network, daoAddresses, proposalId) => {
|
|
|
47
43
|
);
|
|
48
44
|
|
|
49
45
|
const founders = await getFounders(network);
|
|
50
|
-
console.log("voteUpgradeScheme", {
|
|
46
|
+
console.log("voteUpgradeScheme", {
|
|
47
|
+
absoluteVote: absoluteVote.address,
|
|
48
|
+
founders
|
|
49
|
+
});
|
|
51
50
|
await Promise.all(
|
|
52
51
|
founders.slice(0, Math.ceil(founders.length / 2)).map(f =>
|
|
53
52
|
absoluteVote
|
|
@@ -59,12 +58,8 @@ export const voteUpgradeScheme = async (network, daoAddresses, proposalId) => {
|
|
|
59
58
|
};
|
|
60
59
|
|
|
61
60
|
const main = async () => {
|
|
62
|
-
const {
|
|
63
|
-
|
|
64
|
-
modelAddresses,
|
|
65
|
-
upgradableAddresses,
|
|
66
|
-
founders
|
|
67
|
-
} = await getSettings(networkName);
|
|
61
|
+
const { daoAddresses, modelAddresses, upgradableAddresses, founders } =
|
|
62
|
+
await getSettings(networkName);
|
|
68
63
|
|
|
69
64
|
// const implementation = "0x7fca2b3e1047291f65c2c914083d970c027f4290";
|
|
70
65
|
// const deployedProxy = upgradableAddresses.FuseStaking;
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { network, ethers, upgrades, run } from "hardhat";
|
|
11
|
-
import { networkNames } from "@openzeppelin/upgrades-core";
|
|
12
11
|
import { isFunction, get, omitBy } from "lodash";
|
|
13
12
|
import { getImplementationAddress } from "@openzeppelin/upgrades-core";
|
|
14
13
|
import pressAnyKey from "press-any-key";
|
|
@@ -53,7 +52,6 @@ const countTotalGas = async (tx, name) => {
|
|
|
53
52
|
};
|
|
54
53
|
|
|
55
54
|
console.log({
|
|
56
|
-
networkNames,
|
|
57
55
|
network: network.name,
|
|
58
56
|
upgrade: process.env.UPGRADE
|
|
59
57
|
});
|
|
@@ -64,12 +62,6 @@ export const main = async (
|
|
|
64
62
|
isPerformUpgrade = true,
|
|
65
63
|
olddao?
|
|
66
64
|
): Promise<{ [key: string]: any }> => {
|
|
67
|
-
if (networkName.startsWith("dapptest") === false) {
|
|
68
|
-
networkNames[1] = networkName;
|
|
69
|
-
networkNames[122] = networkName;
|
|
70
|
-
networkNames[3] = networkName;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
65
|
const isProduction = networkName.startsWith("production");
|
|
74
66
|
if (isProduction && networkName.includes("mainnet")) {
|
|
75
67
|
GAS_SETTINGS.gasLimit = 6000000;
|
|
@@ -88,8 +80,8 @@ export const main = async (
|
|
|
88
80
|
};
|
|
89
81
|
}
|
|
90
82
|
|
|
91
|
-
const
|
|
92
|
-
const isTest = network.name === "hardhat" ||
|
|
83
|
+
const isDappTest = networkName.startsWith("dapptest");
|
|
84
|
+
const isTest = network.name === "hardhat" || isDappTest;
|
|
93
85
|
const isCoverage = process.env.CODE_COVERAGE;
|
|
94
86
|
const isDevelop = !isProduction;
|
|
95
87
|
const isMainnet = networkName.includes("mainnet");
|
|
@@ -99,7 +91,7 @@ export const main = async (
|
|
|
99
91
|
};
|
|
100
92
|
console.log(`networkName ${networkName}`, {
|
|
101
93
|
isTest,
|
|
102
|
-
|
|
94
|
+
isDappTest,
|
|
103
95
|
isCoverage,
|
|
104
96
|
isMainnet,
|
|
105
97
|
isDevelop
|
|
@@ -843,14 +835,30 @@ export const main = async (
|
|
|
843
835
|
// Promise.resolve(["0x9999c40c8b88c740076b15d2e708db6a7a071b53", 13888])
|
|
844
836
|
// ];
|
|
845
837
|
let deployed;
|
|
846
|
-
if (!isRopsten || isTest) {
|
|
838
|
+
if (!isDappTest && (!isRopsten || isTest)) {
|
|
847
839
|
const aaveps = aaveTokens.map(async token => {
|
|
848
840
|
let rewardsPerBlock = (protocolSettings.staking.rewardsPerBlock / 2) //aave gets half of the rewards
|
|
849
841
|
.toFixed(0);
|
|
850
|
-
console.log("deployStakingContracts", {
|
|
842
|
+
console.log("deployStakingContracts aave", {
|
|
851
843
|
token,
|
|
852
844
|
settings: protocolSettings.staking,
|
|
853
|
-
rewardsPerBlock
|
|
845
|
+
rewardsPerBlock,
|
|
846
|
+
params: [
|
|
847
|
+
token.address,
|
|
848
|
+
get(protocolSettings, "aave.lendingPool", dao.AaveLendingPool),
|
|
849
|
+
release.NameService,
|
|
850
|
+
protocolSettings.staking.fullRewardsThreshold, //blocks before switching for 0.5x rewards to 1x multiplier
|
|
851
|
+
token.usdOracle,
|
|
852
|
+
|
|
853
|
+
get(
|
|
854
|
+
protocolSettings,
|
|
855
|
+
"aave.incentiveController",
|
|
856
|
+
dao.AaveIncentiveController
|
|
857
|
+
),
|
|
858
|
+
token.aaveUsdOracle,
|
|
859
|
+
token.swapPath,
|
|
860
|
+
GAS_SETTINGS
|
|
861
|
+
]
|
|
854
862
|
});
|
|
855
863
|
const tx = await (
|
|
856
864
|
await aavefactory[
|
|
@@ -861,7 +869,6 @@ export const main = async (
|
|
|
861
869
|
release.NameService,
|
|
862
870
|
protocolSettings.staking.fullRewardsThreshold, //blocks before switching for 0.5x rewards to 1x multiplier
|
|
863
871
|
token.usdOracle,
|
|
864
|
-
|
|
865
872
|
get(
|
|
866
873
|
protocolSettings,
|
|
867
874
|
"aave.incentiveController",
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { network, ethers, upgrades, run } from "hardhat";
|
|
11
|
-
import { networkNames } from "@openzeppelin/upgrades-core";
|
|
12
11
|
import { isFunction, get, omitBy } from "lodash";
|
|
13
12
|
import { getImplementationAddress } from "@openzeppelin/upgrades-core";
|
|
14
13
|
|
|
@@ -53,7 +52,6 @@ const countTotalGas = async (tx, name) => {
|
|
|
53
52
|
};
|
|
54
53
|
|
|
55
54
|
console.log({
|
|
56
|
-
networkNames,
|
|
57
55
|
network: network.name,
|
|
58
56
|
upgrade: process.env.UPGRADE
|
|
59
57
|
});
|
|
@@ -64,12 +62,6 @@ export const main = async (
|
|
|
64
62
|
isPerformUpgrade = true,
|
|
65
63
|
olddao?
|
|
66
64
|
): Promise<{ [key: string]: any }> => {
|
|
67
|
-
if (networkName.startsWith("dapptest") === false) {
|
|
68
|
-
networkNames[1] = networkName;
|
|
69
|
-
networkNames[122] = networkName;
|
|
70
|
-
networkNames[3] = networkName;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
65
|
const isProduction = networkName.startsWith("production");
|
|
74
66
|
if (isProduction && networkName.includes("mainnet")) {
|
|
75
67
|
GAS_SETTINGS.gasLimit = 6000000;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import hre, { ethers, upgrades } from "hardhat";
|
|
2
|
+
import { expect } from "chai";
|
|
3
|
+
import { FuseFaucet, IGoodDollar, IIdentity } from "../types";
|
|
4
|
+
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address";
|
|
5
|
+
import { createDAO } from "./helpers";
|
|
6
|
+
|
|
7
|
+
const BN = ethers.BigNumber;
|
|
8
|
+
|
|
9
|
+
describe("FuseFaucet", () => {
|
|
10
|
+
let faucet: FuseFaucet, founder: SignerWithAddress;
|
|
11
|
+
let user1 = ethers.Wallet.createRandom().connect(ethers.provider);
|
|
12
|
+
let user2 = ethers.Wallet.createRandom().connect(ethers.provider);
|
|
13
|
+
let signers;
|
|
14
|
+
|
|
15
|
+
let avatar, gd: IGoodDollar, Controller, id: IIdentity;
|
|
16
|
+
|
|
17
|
+
before(async () => {
|
|
18
|
+
[founder, ...signers] = await ethers.getSigners();
|
|
19
|
+
|
|
20
|
+
const FuseFaucetF = await ethers.getContractFactory("FuseFaucet");
|
|
21
|
+
|
|
22
|
+
let {
|
|
23
|
+
daoCreator,
|
|
24
|
+
controller,
|
|
25
|
+
avatar: av,
|
|
26
|
+
gd: gooddollar,
|
|
27
|
+
identity
|
|
28
|
+
} = await createDAO();
|
|
29
|
+
|
|
30
|
+
Controller = controller;
|
|
31
|
+
avatar = av;
|
|
32
|
+
|
|
33
|
+
// await daoCreator.setSchemes(
|
|
34
|
+
// avatar,
|
|
35
|
+
// [identity],
|
|
36
|
+
// [ethers.constants.HashZero],
|
|
37
|
+
// ["0x0000001F"],
|
|
38
|
+
// ""
|
|
39
|
+
// );
|
|
40
|
+
|
|
41
|
+
faucet = (await upgrades.deployProxy(FuseFaucetF, [identity], {
|
|
42
|
+
kind: "transparent"
|
|
43
|
+
})) as FuseFaucet;
|
|
44
|
+
|
|
45
|
+
gd = (await ethers.getContractAt(
|
|
46
|
+
"IGoodDollar",
|
|
47
|
+
gooddollar,
|
|
48
|
+
founder
|
|
49
|
+
)) as IGoodDollar;
|
|
50
|
+
id = (await ethers.getContractAt(
|
|
51
|
+
"IIdentity",
|
|
52
|
+
identity,
|
|
53
|
+
founder
|
|
54
|
+
)) as IIdentity;
|
|
55
|
+
|
|
56
|
+
await founder.sendTransaction({
|
|
57
|
+
value: ethers.utils.parseEther("1"),
|
|
58
|
+
to: faucet.address
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("should have balance", async () => {
|
|
63
|
+
const balance = await ethers.provider.getBalance(faucet.address);
|
|
64
|
+
expect(balance).to.equal(ethers.utils.parseEther("1"));
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("should let new user top once", async () => {
|
|
68
|
+
expect(await faucet.canTop(user1.address)).to.true;
|
|
69
|
+
const tx = await (await faucet.topWallet(user1.address)).wait();
|
|
70
|
+
const balance = await ethers.provider.getBalance(user1.address);
|
|
71
|
+
expect(balance).to.equal(await faucet.toppingAmount());
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it("should not let new user top more than once", async () => {
|
|
75
|
+
await user1.sendTransaction({
|
|
76
|
+
to: ethers.constants.AddressZero,
|
|
77
|
+
value: ethers.utils.parseUnits("400000", "gwei")
|
|
78
|
+
});
|
|
79
|
+
expect(await faucet.canTop(user1.address)).to.false;
|
|
80
|
+
await expect(faucet.topWallet(user1.address)).to.revertedWith(
|
|
81
|
+
"User not whitelisted or not first time"
|
|
82
|
+
);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("should not refund gas when reverted", async () => {
|
|
86
|
+
const balance = await ethers.provider.getBalance(founder.address);
|
|
87
|
+
const faucetBalance = await ethers.provider.getBalance(faucet.address);
|
|
88
|
+
expect(await faucet.canTop(user1.address)).to.false;
|
|
89
|
+
await expect(faucet.topWallet(user1.address)).to.revertedWith(
|
|
90
|
+
"User not whitelisted or not first time"
|
|
91
|
+
);
|
|
92
|
+
const balanceAfter = await ethers.provider.getBalance(founder.address);
|
|
93
|
+
const faucetBalanceAfter = await ethers.provider.getBalance(faucet.address);
|
|
94
|
+
expect(faucetBalanceAfter).to.eq(faucetBalance);
|
|
95
|
+
expect(balanceAfter).to.lt(balance);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it("should let user top again once identified", async () => {
|
|
99
|
+
await id.addWhitelistedWithDID(user1.address, "did:1");
|
|
100
|
+
expect(await faucet.canTop(user1.address)).to.true;
|
|
101
|
+
const tx = await (await faucet.topWallet(user1.address)).wait();
|
|
102
|
+
console.log(tx.gasUsed.toString());
|
|
103
|
+
const balance = await ethers.provider.getBalance(user1.address);
|
|
104
|
+
expect(balance).to.equal(await faucet.toppingAmount());
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it("should not let identified user top over daily limit", async () => {
|
|
108
|
+
await user1.sendTransaction({
|
|
109
|
+
to: ethers.constants.AddressZero,
|
|
110
|
+
value: ethers.utils.parseUnits("400000", "gwei")
|
|
111
|
+
});
|
|
112
|
+
const tx = await (await faucet.topWallet(user1.address)).wait();
|
|
113
|
+
await user1.sendTransaction({
|
|
114
|
+
to: ethers.constants.AddressZero,
|
|
115
|
+
value: ethers.utils.parseUnits("400000", "gwei")
|
|
116
|
+
});
|
|
117
|
+
expect(await faucet.canTop(user1.address)).to.false;
|
|
118
|
+
await expect(faucet.topWallet(user1.address)).to.revertedWith(
|
|
119
|
+
"max daily toppings"
|
|
120
|
+
);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// it("should not top if wallet not half empty", async () => {
|
|
124
|
+
// expect(await faucet.canTop(founder.address)).to.false;
|
|
125
|
+
// await expect(faucet.topWallet(founder.address)).to.revertedWith(
|
|
126
|
+
// "User balance above minimum"
|
|
127
|
+
// );
|
|
128
|
+
// });
|
|
129
|
+
|
|
130
|
+
it("should not let user top over weekly limit", async () => {
|
|
131
|
+
for (let i = 0; i < 3; i++) {
|
|
132
|
+
await ethers.provider.send("evm_increaseTime", [60 * 60 * 24]);
|
|
133
|
+
await (await faucet.topWallet(user1.address)).wait();
|
|
134
|
+
await user1.sendTransaction({
|
|
135
|
+
to: ethers.constants.AddressZero,
|
|
136
|
+
value: ethers.utils.parseUnits("500000", "gwei")
|
|
137
|
+
});
|
|
138
|
+
// await (await faucet.topWallet(user1.address)).wait();
|
|
139
|
+
// await user1.sendTransaction({
|
|
140
|
+
// to: ethers.constants.AddressZero,
|
|
141
|
+
// value: ethers.utils.parseUnits("500000", "gwei"),
|
|
142
|
+
// });
|
|
143
|
+
}
|
|
144
|
+
// await (await faucet.topWallet(user1.address)).wait();
|
|
145
|
+
// await user1.sendTransaction({
|
|
146
|
+
// to: ethers.constants.AddressZero,
|
|
147
|
+
// value: ethers.utils.parseUnits("500000", "gwei"),
|
|
148
|
+
// });
|
|
149
|
+
await ethers.provider.send("evm_increaseTime", [60 * 60 * 24]);
|
|
150
|
+
|
|
151
|
+
expect(await faucet.canTop(user1.address)).to.false;
|
|
152
|
+
await expect(faucet.topWallet(user1.address)).to.revertedWith(
|
|
153
|
+
"User wallet has been topped too many times this week"
|
|
154
|
+
);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it("should reimburse gas costs", async () => {
|
|
158
|
+
const balance = await ethers.provider.getBalance(founder.address);
|
|
159
|
+
const tx = await (
|
|
160
|
+
await faucet.topWallet(user2.address, { gasPrice: 1e9 })
|
|
161
|
+
).wait();
|
|
162
|
+
// const gasCosts = tx.gasUsed.mul(1e9);
|
|
163
|
+
// const afterRefund = gasCosts.sub(await faucet["gasRefund()"]());
|
|
164
|
+
const balanceAfter = await ethers.provider.getBalance(founder.address);
|
|
165
|
+
const diff = balance.sub(balanceAfter).toNumber();
|
|
166
|
+
expect(diff).to.lt(10000);
|
|
167
|
+
});
|
|
168
|
+
});
|