@gooddollar/goodprotocol 1.0.23 → 1.0.26-beta.0
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/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/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/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/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 +7 -0
- package/package.json +7 -6
- package/patches/@nomiclabs+hardhat-etherscan+3.0.3.patch +41 -0
- package/patches/@openzeppelin+hardhat-upgrades+1.7.0.patch +67 -0
- package/patches/@openzeppelin+upgrades-core+1.4.2.patch +21 -0
- package/scripts/misc/faucetStats.ts +103 -0
- package/scripts/upgradeToV2/upgradeToV2.ts +22 -7
- package/test/FuseFaucet.test.ts +168 -0
- package/test/InvitesV1.test.ts +354 -0
- package/test/staking/FuseStaking.test.ts +152 -0
- 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
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
diff --git a/node_modules/@nomiclabs/hardhat-etherscan/dist/src/ChainConfig.js b/node_modules/@nomiclabs/hardhat-etherscan/dist/src/ChainConfig.js
|
|
2
|
+
index 007d740..139c489 100644
|
|
3
|
+
--- a/node_modules/@nomiclabs/hardhat-etherscan/dist/src/ChainConfig.js
|
|
4
|
+
+++ b/node_modules/@nomiclabs/hardhat-etherscan/dist/src/ChainConfig.js
|
|
5
|
+
@@ -10,6 +10,13 @@ exports.chainConfig = {
|
|
6
|
+
browserURL: "https://etherscan.io",
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
|
+
+ celo: {
|
|
10
|
+
+ chainId: 42220,
|
|
11
|
+
+ urls: {
|
|
12
|
+
+ apiURL: "https://api.celoscan.xyz/api",
|
|
13
|
+
+ browserURL: "https://celoscan.xyz",
|
|
14
|
+
+ },
|
|
15
|
+
+ },
|
|
16
|
+
harmony: {
|
|
17
|
+
chainId: 1666600000,
|
|
18
|
+
urls: {
|
|
19
|
+
diff --git a/node_modules/@nomiclabs/hardhat-etherscan/dist/src/types.d.ts b/node_modules/@nomiclabs/hardhat-etherscan/dist/src/types.d.ts
|
|
20
|
+
index 0a9efc3..88bdaac 100644
|
|
21
|
+
--- a/node_modules/@nomiclabs/hardhat-etherscan/dist/src/types.d.ts
|
|
22
|
+
+++ b/node_modules/@nomiclabs/hardhat-etherscan/dist/src/types.d.ts
|
|
23
|
+
@@ -1,4 +1,4 @@
|
|
24
|
+
-declare type Chain = "mainnet" | "ropsten" | "rinkeby" | "goerli" | "kovan" | "bsc" | "bscTestnet" | "heco" | "hecoTestnet" | "opera" | "ftmTestnet" | "optimisticEthereum" | "optimisticKovan" | "polygon" | "polygonMumbai" | "arbitrumOne" | "arbitrumTestnet" | "avalanche" | "avalancheFujiTestnet" | "moonbeam" | "moonriver" | "moonbaseAlpha" | "harmony" | "harmonyTest" | "xdai" | "sokol" | "aurora" | "auroraTestnet";
|
|
25
|
+
+declare type Chain = "celo" | "mainnet" | "ropsten" | "rinkeby" | "goerli" | "kovan" | "bsc" | "bscTestnet" | "heco" | "hecoTestnet" | "opera" | "ftmTestnet" | "optimisticEthereum" | "optimisticKovan" | "polygon" | "polygonMumbai" | "arbitrumOne" | "arbitrumTestnet" | "avalanche" | "avalancheFujiTestnet" | "moonbeam" | "moonriver" | "moonbaseAlpha" | "harmony" | "harmonyTest" | "xdai" | "sokol" | "aurora" | "auroraTestnet";
|
|
26
|
+
export declare type ChainConfig = {
|
|
27
|
+
[Network in Chain]: EtherscanChainConfig;
|
|
28
|
+
};
|
|
29
|
+
diff --git a/node_modules/@nomiclabs/hardhat-etherscan/src/types.ts b/node_modules/@nomiclabs/hardhat-etherscan/src/types.ts
|
|
30
|
+
index b88e8fa..4c658b2 100644
|
|
31
|
+
--- a/node_modules/@nomiclabs/hardhat-etherscan/src/types.ts
|
|
32
|
+
+++ b/node_modules/@nomiclabs/hardhat-etherscan/src/types.ts
|
|
33
|
+
@@ -36,7 +36,7 @@ type Chain =
|
|
34
|
+
| "sokol"
|
|
35
|
+
// aurora
|
|
36
|
+
| "aurora"
|
|
37
|
+
- | "auroraTestnet";
|
|
38
|
+
+ | "auroraTestnet" | "celo";
|
|
39
|
+
|
|
40
|
+
export type ChainConfig = {
|
|
41
|
+
[Network in Chain]: EtherscanChainConfig;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
diff --git a/node_modules/@openzeppelin/hardhat-upgrades/dist/deploy-proxy.d.ts b/node_modules/@openzeppelin/hardhat-upgrades/dist/deploy-proxy.d.ts
|
|
2
|
+
index 2405883..5879166 100644
|
|
3
|
+
--- a/node_modules/@openzeppelin/hardhat-upgrades/dist/deploy-proxy.d.ts
|
|
4
|
+
+++ b/node_modules/@openzeppelin/hardhat-upgrades/dist/deploy-proxy.d.ts
|
|
5
|
+
@@ -7,6 +7,7 @@ export interface DeployFunction {
|
|
6
|
+
}
|
|
7
|
+
export interface DeployOptions extends ValidationOptions {
|
|
8
|
+
initializer?: string | false;
|
|
9
|
+
+ proxyFactory?: any;
|
|
10
|
+
}
|
|
11
|
+
export declare function makeDeployProxy(hre: HardhatRuntimeEnvironment): DeployFunction;
|
|
12
|
+
//# sourceMappingURL=deploy-proxy.d.ts.map
|
|
13
|
+
|
|
14
|
+
diff --git a/node_modules/@openzeppelin/hardhat-upgrades/dist/deploy-proxy.js b/node_modules/@openzeppelin/hardhat-upgrades/dist/deploy-proxy.js
|
|
15
|
+
index 8dbb62a..d0761f4 100644
|
|
16
|
+
--- a/node_modules/@openzeppelin/hardhat-upgrades/dist/deploy-proxy.js
|
|
17
|
+
+++ b/node_modules/@openzeppelin/hardhat-upgrades/dist/deploy-proxy.js
|
|
18
|
+
@@ -26,14 +26,15 @@ function makeDeployProxy(hre) {
|
|
19
|
+
let proxyDeployment;
|
|
20
|
+
switch (kind) {
|
|
21
|
+
case 'uups': {
|
|
22
|
+
- const ProxyFactory = await utils_1.getProxyFactory(hre, ImplFactory.signer);
|
|
23
|
+
+ const ProxyFactory = await (opts.proxyFactory || utils_1.getProxyFactory(hre, ImplFactory.signer))
|
|
24
|
+
proxyDeployment = Object.assign({ kind }, await utils_1.deploy(ProxyFactory, impl, data));
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
case 'transparent': {
|
|
28
|
+
const AdminFactory = await utils_1.getProxyAdminFactory(hre, ImplFactory.signer);
|
|
29
|
+
const adminAddress = await upgrades_core_1.fetchOrDeployAdmin(provider, () => utils_1.deploy(AdminFactory));
|
|
30
|
+
- const TransparentUpgradeableProxyFactory = await utils_1.getTransparentUpgradeableProxyFactory(hre, ImplFactory.signer);
|
|
31
|
+
+ const TransparentUpgradeableProxyFactory = await (opts.proxyFactory || utils_1.getTransparentUpgradeableProxyFactory(hre, ImplFactory.signer))
|
|
32
|
+
+
|
|
33
|
+
proxyDeployment = Object.assign({ kind }, await utils_1.deploy(TransparentUpgradeableProxyFactory, impl, adminAddress, data));
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
diff --git a/node_modules/@openzeppelin/hardhat-upgrades/src/deploy-proxy.ts b/node_modules/@openzeppelin/hardhat-upgrades/src/deploy-proxy.ts
|
|
37
|
+
index c8beb0d..b187875 100644
|
|
38
|
+
--- a/node_modules/@openzeppelin/hardhat-upgrades/src/deploy-proxy.ts
|
|
39
|
+
+++ b/node_modules/@openzeppelin/hardhat-upgrades/src/deploy-proxy.ts
|
|
40
|
+
@@ -25,6 +25,7 @@ export interface DeployFunction {
|
|
41
|
+
|
|
42
|
+
export interface DeployOptions extends ValidationOptions {
|
|
43
|
+
initializer?: string | false;
|
|
44
|
+
+ proxyFactory?: any;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function makeDeployProxy(hre: HardhatRuntimeEnvironment): DeployFunction {
|
|
48
|
+
@@ -59,7 +60,8 @@ export function makeDeployProxy(hre: HardhatRuntimeEnvironment): DeployFunction
|
|
49
|
+
let proxyDeployment: Required<ProxyDeployment>;
|
|
50
|
+
switch (kind) {
|
|
51
|
+
case 'uups': {
|
|
52
|
+
- const ProxyFactory = await getProxyFactory(hre, ImplFactory.signer);
|
|
53
|
+
+ const ProxyFactory = await (opts.proxyFactory || getProxyFactory(hre, ImplFactory.signer));
|
|
54
|
+
+
|
|
55
|
+
proxyDeployment = Object.assign({ kind }, await deploy(ProxyFactory, impl, data));
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
@@ -67,7 +69,8 @@ export function makeDeployProxy(hre: HardhatRuntimeEnvironment): DeployFunction
|
|
59
|
+
case 'transparent': {
|
|
60
|
+
const AdminFactory = await getProxyAdminFactory(hre, ImplFactory.signer);
|
|
61
|
+
const adminAddress = await fetchOrDeployAdmin(provider, () => deploy(AdminFactory));
|
|
62
|
+
- const TransparentUpgradeableProxyFactory = await getTransparentUpgradeableProxyFactory(hre, ImplFactory.signer);
|
|
63
|
+
+ const TransparentUpgradeableProxyFactory = await (opts.proxyFactory || getTransparentUpgradeableProxyFactory(hre, ImplFactory.signer););
|
|
64
|
+
+
|
|
65
|
+
proxyDeployment = Object.assign(
|
|
66
|
+
{ kind },
|
|
67
|
+
await deploy(TransparentUpgradeableProxyFactory, impl, adminAddress, data),
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
diff --git a/node_modules/@openzeppelin/upgrades-core/dist/provider.js b/node_modules/@openzeppelin/upgrades-core/dist/provider.js
|
|
2
|
+
index 1fd10da..d80cf45 100644
|
|
3
|
+
--- a/node_modules/@openzeppelin/upgrades-core/dist/provider.js
|
|
4
|
+
+++ b/node_modules/@openzeppelin/upgrades-core/dist/provider.js
|
|
5
|
+
@@ -33,14 +33,14 @@ async function getTransactionByHash(provider, txHash) {
|
|
6
|
+
return provider.send('eth_getTransactionByHash', [txHash]);
|
|
7
|
+
}
|
|
8
|
+
exports.getTransactionByHash = getTransactionByHash;
|
|
9
|
+
-exports.networkNames = Object.freeze({
|
|
10
|
+
+exports.networkNames = {
|
|
11
|
+
1: 'mainnet',
|
|
12
|
+
2: 'morden',
|
|
13
|
+
3: 'ropsten',
|
|
14
|
+
4: 'rinkeby',
|
|
15
|
+
5: 'goerli',
|
|
16
|
+
42: 'kovan',
|
|
17
|
+
-});
|
|
18
|
+
+};
|
|
19
|
+
async function isDevelopmentNetwork(provider) {
|
|
20
|
+
const chainId = await getChainId(provider);
|
|
21
|
+
// 1337 => ganache and geth --dev
|
|
@@ -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));
|
|
@@ -88,8 +88,8 @@ export const main = async (
|
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
const
|
|
92
|
-
const isTest = network.name === "hardhat" ||
|
|
91
|
+
const isDappTest = networkName.startsWith("dapptest");
|
|
92
|
+
const isTest = network.name === "hardhat" || isDappTest;
|
|
93
93
|
const isCoverage = process.env.CODE_COVERAGE;
|
|
94
94
|
const isDevelop = !isProduction;
|
|
95
95
|
const isMainnet = networkName.includes("mainnet");
|
|
@@ -99,7 +99,7 @@ export const main = async (
|
|
|
99
99
|
};
|
|
100
100
|
console.log(`networkName ${networkName}`, {
|
|
101
101
|
isTest,
|
|
102
|
-
|
|
102
|
+
isDappTest,
|
|
103
103
|
isCoverage,
|
|
104
104
|
isMainnet,
|
|
105
105
|
isDevelop
|
|
@@ -843,14 +843,30 @@ export const main = async (
|
|
|
843
843
|
// Promise.resolve(["0x9999c40c8b88c740076b15d2e708db6a7a071b53", 13888])
|
|
844
844
|
// ];
|
|
845
845
|
let deployed;
|
|
846
|
-
if (!isRopsten || isTest) {
|
|
846
|
+
if (!isDappTest && (!isRopsten || isTest)) {
|
|
847
847
|
const aaveps = aaveTokens.map(async token => {
|
|
848
848
|
let rewardsPerBlock = (protocolSettings.staking.rewardsPerBlock / 2) //aave gets half of the rewards
|
|
849
849
|
.toFixed(0);
|
|
850
|
-
console.log("deployStakingContracts", {
|
|
850
|
+
console.log("deployStakingContracts aave", {
|
|
851
851
|
token,
|
|
852
852
|
settings: protocolSettings.staking,
|
|
853
|
-
rewardsPerBlock
|
|
853
|
+
rewardsPerBlock,
|
|
854
|
+
params: [
|
|
855
|
+
token.address,
|
|
856
|
+
get(protocolSettings, "aave.lendingPool", dao.AaveLendingPool),
|
|
857
|
+
release.NameService,
|
|
858
|
+
protocolSettings.staking.fullRewardsThreshold, //blocks before switching for 0.5x rewards to 1x multiplier
|
|
859
|
+
token.usdOracle,
|
|
860
|
+
|
|
861
|
+
get(
|
|
862
|
+
protocolSettings,
|
|
863
|
+
"aave.incentiveController",
|
|
864
|
+
dao.AaveIncentiveController
|
|
865
|
+
),
|
|
866
|
+
token.aaveUsdOracle,
|
|
867
|
+
token.swapPath,
|
|
868
|
+
GAS_SETTINGS
|
|
869
|
+
]
|
|
854
870
|
});
|
|
855
871
|
const tx = await (
|
|
856
872
|
await aavefactory[
|
|
@@ -861,7 +877,6 @@ export const main = async (
|
|
|
861
877
|
release.NameService,
|
|
862
878
|
protocolSettings.staking.fullRewardsThreshold, //blocks before switching for 0.5x rewards to 1x multiplier
|
|
863
879
|
token.usdOracle,
|
|
864
|
-
|
|
865
880
|
get(
|
|
866
881
|
protocolSettings,
|
|
867
882
|
"aave.incentiveController",
|
|
@@ -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
|
+
});
|