@gooddollar/goodprotocol 1.0.0-beta.32 → 1.0.0-beta.42
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/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/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/ClaimersDistribution.sol/ClaimersDistribution.json +2 -2
- package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
- package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.json +60 -21
- package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
- package/artifacts/contracts/governance/GReputation.sol/GReputation.json +2 -2
- package/artifacts/contracts/governance/GovarnanceStaking.sol/GovernanceStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/GovarnanceStaking.sol/GovernanceStaking.json +2 -2
- 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/Reputation.sol/Reputation.json +2 -2
- package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
- package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.json +2 -2
- package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.json +2 -2
- package/artifacts/contracts/mocks/AaveUSDMockOracle.sol/AaveUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/AaveUSDMockOracle.sol/AaveUSDMockOracle.json +2 -2
- package/artifacts/contracts/mocks/BatUSDMockOracle.sol/BatUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/BatUSDMockOracle.sol/BatUSDMockOracle.json +2 -2
- package/artifacts/contracts/mocks/CompUsdMockOracle.sol/CompUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/CompUsdMockOracle.sol/CompUSDMockOracle.json +2 -2
- package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.json +2 -2
- package/artifacts/contracts/mocks/DaiEthPriceMockOracle.sol/DaiEthPriceMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/DaiEthPriceMockOracle.sol/DaiEthPriceMockOracle.json +2 -2
- package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.json +2 -2
- package/artifacts/contracts/mocks/EthUSDMockOracle.sol/EthUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/EthUSDMockOracle.sol/EthUSDMockOracle.json +2 -2
- package/artifacts/contracts/mocks/GasPriceMockOracle.sol/GasPriceMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/GasPriceMockOracle.sol/GasPriceMockOracle.json +2 -2
- 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/GoodFundManagerTest.sol/GoodFundManagerTest.json +2 -2
- package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.json +2 -2
- package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.json +2 -2
- package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.json +2 -2
- package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.json +2 -2
- package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.json +2 -2
- package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.json +2 -2
- package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.json +2 -2
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +4 -0
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.json +224 -0
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +4 -0
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.json +198 -0
- package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.json +2 -2
- package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.json +2 -2
- package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.json +2 -2
- package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.json +2 -2
- package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.json +2 -2
- package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.json +2 -2
- package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.json +2 -2
- package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.json +2 -2
- package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.json +2 -2
- package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.json +2 -2
- 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/reserve/GoodReserveCDai.sol/GoodReserveCDai.json +2 -2
- package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
- package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.json +2 -2
- package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.json +2 -2
- package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.dbg.json +1 -1
- package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.json +2 -2
- 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/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.json +2 -2
- 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 +4 -4
- package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.json +6 -6
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.json +2 -2
- package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
- package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.json +2 -2
- package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOContract.sol/DAOContract.json +2 -2
- package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.json +2 -2
- package/artifacts/contracts/utils/DSMath.sol/DSMath.dbg.json +1 -1
- package/artifacts/contracts/utils/DSMath.sol/DSMath.json +2 -2
- package/artifacts/contracts/utils/DataTypes.sol/DataTypes.dbg.json +1 -1
- package/artifacts/contracts/utils/DataTypes.sol/DataTypes.json +2 -2
- package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
- package/artifacts/contracts/utils/NameService.sol/NameService.json +2 -2
- 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/ProtocolUpgrade.sol/ProtocolUpgrade.json +7 -2
- package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.json +7 -2
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.dbg.json +4 -0
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.json +95 -0
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.dbg.json +4 -0
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.json +185 -0
- package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.json +2 -2
- package/contracts/governance/CompoundVotingMachine.sol +99 -83
- package/contracts/governance/GovarnanceStaking.sol +3 -5
- package/contracts/mocks/UpgradableMocks.sol +31 -0
- package/contracts/utils/DAOUpgradeableContract.sol +1 -1
- package/contracts/utils/ProtocolUpgrade.sol +7 -14
- package/contracts/utils/ProtocolUpgradeFuse.sol +2 -2
- package/contracts/utils/ProxyFactory1967.sol +153 -0
- package/hardhat.config.ts +1 -1
- package/package.json +8 -8
- package/releases/deploy-settings.json +3 -3
- package/releases/deployment.json +1 -1
- package/releases/olddao.json +1 -1
- package/scripts/gdx/gdxAirdropCalculation.ts +11 -10
- package/scripts/governance/airdropCalculation.ts +235 -65
- package/scripts/releaser.js +11 -5
- package/scripts/upgradeToV2/upgradeToV2.ts +353 -228
- package/test/governance/CompoundVotingMachine.daoscheme.ts +124 -10
- package/test/governance/CompoundVotingMachine.guardian.test.ts +38 -7
- package/test/localOldDaoDeploy.ts +24 -24
- package/test/staking/DonationsStaking.test.ts +13 -12
- package/test/utils/ProxyFactory.test.ts +102 -0
- package/tsconfig.json +1 -1
- package/yarn.lock +253 -32
- package/test/simulateInterest.ts +0 -85
|
@@ -21,6 +21,8 @@ const quantile = (sorted, q) => {
|
|
|
21
21
|
return sum;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
+
let ETH_SNAPSHOT_BLOCK = 13320531; //first blocka after 12pm Sep-29-2021 12:00:20 PM +UTC
|
|
25
|
+
|
|
24
26
|
export const airdrop = (ethers: typeof Ethers, ethSnapshotBlock) => {
|
|
25
27
|
const getBuyingAddresses = async (addresses = {}, isContracts = {}) => {
|
|
26
28
|
const provider = new ethers.providers.InfuraProvider();
|
|
@@ -43,9 +45,7 @@ export const airdrop = (ethers: typeof Ethers, ethSnapshotBlock) => {
|
|
|
43
45
|
swaphelper = swaphelper.connect(provider);
|
|
44
46
|
|
|
45
47
|
const step = 100000;
|
|
46
|
-
const snapshotBlock = parseInt(
|
|
47
|
-
ethSnapshotBlock || (await provider.getBlockNumber())
|
|
48
|
-
);
|
|
48
|
+
const snapshotBlock = parseInt(ethSnapshotBlock || ETH_SNAPSHOT_BLOCK);
|
|
49
49
|
// const blocks = range(startBlock, endBlock, step);
|
|
50
50
|
const blocks = range(10575670, snapshotBlock, step);
|
|
51
51
|
const filter = reserve.filters.TokenPurchased();
|
|
@@ -117,13 +117,13 @@ export const airdrop = (ethers: typeof Ethers, ethSnapshotBlock) => {
|
|
|
117
117
|
|
|
118
118
|
const collectAirdropData = async () => {
|
|
119
119
|
return getBuyingAddresses().then(r =>
|
|
120
|
-
fs.writeFileSync("buyBalances.json", JSON.stringify(r))
|
|
120
|
+
fs.writeFileSync("airdrop/buyBalances.json", JSON.stringify(r))
|
|
121
121
|
);
|
|
122
122
|
};
|
|
123
123
|
|
|
124
124
|
const buildMerkleTree = () => {
|
|
125
125
|
const { addresses, isContracts } = JSON.parse(
|
|
126
|
-
fs.readFileSync("buyBalances.json").toString()
|
|
126
|
+
fs.readFileSync("airdrop/buyBalances.json").toString()
|
|
127
127
|
// fs.readFileSync("test/gdx_airdrop_test.json").toString()
|
|
128
128
|
);
|
|
129
129
|
let toTree: Array<[string, number]> = Object.entries(addresses).map(
|
|
@@ -133,11 +133,12 @@ export const airdrop = (ethers: typeof Ethers, ethSnapshotBlock) => {
|
|
|
133
133
|
);
|
|
134
134
|
|
|
135
135
|
toTree = sortBy(toTree, "1").reverse();
|
|
136
|
-
|
|
136
|
+
const totalGDX = toTree.reduce((acc, v) => acc + v[1], 0);
|
|
137
137
|
console.log({
|
|
138
138
|
isContracts,
|
|
139
139
|
toTree,
|
|
140
|
-
numberOfAccounts: toTree.length
|
|
140
|
+
numberOfAccounts: toTree.length,
|
|
141
|
+
totalGDX
|
|
141
142
|
});
|
|
142
143
|
|
|
143
144
|
const sorted = toTree.map(_ => _[1]);
|
|
@@ -174,21 +175,21 @@ export const airdrop = (ethers: typeof Ethers, ethSnapshotBlock) => {
|
|
|
174
175
|
const proof = merkleTree.getProof(elements[0]).map(_ => _.toString("hex"));
|
|
175
176
|
console.log({ merkleRoot, proof, sampleProofFor: toTree[0] });
|
|
176
177
|
fs.writeFileSync(
|
|
177
|
-
"gdxairdrop.json",
|
|
178
|
+
"airdrop/gdxairdrop.json",
|
|
178
179
|
JSON.stringify({ treeData, merkleRoot })
|
|
179
180
|
);
|
|
180
181
|
};
|
|
181
182
|
|
|
182
183
|
const getProof = addr => {
|
|
183
184
|
const { treeData, merkleRoot } = JSON.parse(
|
|
184
|
-
fs.readFileSync("gdxairdrop.json").toString()
|
|
185
|
+
fs.readFileSync("airdrop/gdxairdrop.json").toString()
|
|
185
186
|
);
|
|
186
187
|
|
|
187
188
|
const elements = Object.entries(treeData as Tree).map(e =>
|
|
188
189
|
Buffer.from(e[1].hash.slice(2), "hex")
|
|
189
190
|
);
|
|
190
191
|
|
|
191
|
-
const merkleTree = new MerkleTree(elements,
|
|
192
|
+
const merkleTree = new MerkleTree(elements, false);
|
|
192
193
|
const proof = merkleTree
|
|
193
194
|
.getProof(Buffer.from(treeData[addr].hash.slice(2), "hex"))
|
|
194
195
|
.map(_ => "0x" + _.toString("hex"));
|
|
@@ -86,18 +86,27 @@ const quantile = (sorted, q) => {
|
|
|
86
86
|
return sum;
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
-
let FUSE_SNAPSHOT_BLOCK =
|
|
90
|
-
let ETH_SNAPSHOT_BLOCK =
|
|
89
|
+
let FUSE_SNAPSHOT_BLOCK = 13175510; //September-29-2021 03:00:00 PM +3 UTC
|
|
90
|
+
let ETH_SNAPSHOT_BLOCK = 13320531; //first blocka after 12pm Sep-29-2021 12:00:20 PM +UTC
|
|
91
91
|
|
|
92
92
|
export const airdrop = (
|
|
93
93
|
ethers: typeof Ethers,
|
|
94
94
|
ethplorer_key,
|
|
95
95
|
etherscan_key
|
|
96
96
|
) => {
|
|
97
|
+
const fusePoktProvider = new ethers.providers.JsonRpcProvider({
|
|
98
|
+
url: "https://fuse-mainnet.gateway.pokt.network/v1/lb/60ee374fc6318362996a1fb0",
|
|
99
|
+
user: "",
|
|
100
|
+
password: "d57939c260bdf0a6f22550e2350b4312" //end point will be removed, so its ok to keep clear text password
|
|
101
|
+
});
|
|
102
|
+
|
|
97
103
|
const fuseProvider = new ethers.providers.JsonRpcProvider(
|
|
98
104
|
"https://rpc.fuse.io"
|
|
99
105
|
);
|
|
100
106
|
|
|
107
|
+
const fuseGDProvider = new ethers.providers.JsonRpcProvider(
|
|
108
|
+
"https://gooddollar-rpc.fuse.io"
|
|
109
|
+
);
|
|
101
110
|
const fuseArchiveProvider = new ethers.providers.JsonRpcBatchProvider(
|
|
102
111
|
"https://explorer-node.fuse.io/"
|
|
103
112
|
);
|
|
@@ -553,40 +562,65 @@ export const airdrop = (
|
|
|
553
562
|
return addresses;
|
|
554
563
|
};
|
|
555
564
|
|
|
556
|
-
const getFuseHolders = async (
|
|
565
|
+
const getFuseHolders = async (
|
|
566
|
+
addresses: Balances = {},
|
|
567
|
+
onlyBalances = false,
|
|
568
|
+
onlyFailed = false
|
|
569
|
+
) => {
|
|
570
|
+
console.log(
|
|
571
|
+
"getFuseHolders",
|
|
572
|
+
{ onlyBalances, onlyFailed },
|
|
573
|
+
Object.keys(addresses).length
|
|
574
|
+
);
|
|
557
575
|
const toFetch = {};
|
|
558
576
|
|
|
559
577
|
const step = 1000;
|
|
560
578
|
const gdNonArchive = gd.connect(fuseProvider);
|
|
561
579
|
|
|
580
|
+
const contracts = [gdNonArchive, gd.connect(fuseGDProvider)];
|
|
562
581
|
const latestBlock = FUSE_SNAPSHOT_BLOCK; //await ubiContract.provider.getBlockNumber();
|
|
563
582
|
const blocks = range(6400000, latestBlock, step);
|
|
564
583
|
const filter = gdNonArchive.filters.Transfer();
|
|
565
584
|
|
|
566
|
-
const pool = new PromisePool({ concurrency:
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
585
|
+
const pool = new PromisePool({ concurrency: 70 });
|
|
586
|
+
let addrs;
|
|
587
|
+
|
|
588
|
+
let idx = 0;
|
|
589
|
+
if (!onlyBalances) {
|
|
590
|
+
blocks.forEach(bc => {
|
|
591
|
+
pool.add(async () => {
|
|
592
|
+
const options = { limit: 20, delay: 2000 };
|
|
593
|
+
const retrier = new Retrier(options);
|
|
594
|
+
// Query the filter (the latest could be omitted)
|
|
595
|
+
const logs = await retrier.resolve(attempt => {
|
|
596
|
+
console.log("fetching block transfer logs", { attempt, bc });
|
|
597
|
+
|
|
598
|
+
return contracts[idx++ % contracts.length].queryFilter(
|
|
599
|
+
filter,
|
|
600
|
+
bc,
|
|
601
|
+
Math.min(bc + step - 1, latestBlock)
|
|
602
|
+
);
|
|
603
|
+
});
|
|
575
604
|
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
bc,
|
|
579
|
-
Math.min(bc + step - 1, latestBlock)
|
|
580
|
-
);
|
|
605
|
+
logs.forEach(l => (toFetch[l.args.to.toLowerCase()] = true));
|
|
606
|
+
console.log("found Transfer logs in block:", { bc }, logs.length);
|
|
581
607
|
});
|
|
582
|
-
|
|
583
|
-
logs.forEach(l => (toFetch[l.args.to.toLowerCase()] = true));
|
|
584
|
-
console.log("found Transfer logs in block:", { bc }, logs.length);
|
|
585
608
|
});
|
|
586
|
-
});
|
|
587
|
-
|
|
588
|
-
await pool.all();
|
|
589
609
|
|
|
610
|
+
await pool.all();
|
|
611
|
+
addrs = Object.keys(toFetch);
|
|
612
|
+
fs.writeFileSync("airdrop/addrs.tmp", JSON.stringify(addrs));
|
|
613
|
+
} else {
|
|
614
|
+
if (onlyFailed) {
|
|
615
|
+
addrs = JSON.parse(fs.readFileSync("airdrop/failed.tmp").toString());
|
|
616
|
+
console.log(
|
|
617
|
+
"existing failed",
|
|
618
|
+
addrs.map(addr => addresses[addr])
|
|
619
|
+
);
|
|
620
|
+
} else {
|
|
621
|
+
addrs = JSON.parse(fs.readFileSync("airdrop/addrs.tmp").toString());
|
|
622
|
+
}
|
|
623
|
+
}
|
|
590
624
|
// for (let blockChunk of chunk(blocks, 30)) {
|
|
591
625
|
// // Get the filter (the second null could be omitted)
|
|
592
626
|
// const ps = blockChunk.map(async bc => {
|
|
@@ -607,16 +641,19 @@ export const airdrop = (
|
|
|
607
641
|
// });
|
|
608
642
|
// await Promise.all(ps);
|
|
609
643
|
// }
|
|
610
|
-
|
|
644
|
+
|
|
611
645
|
console.log("found G$ holders, fetching balacnes...:", addrs.length);
|
|
612
|
-
|
|
646
|
+
|
|
613
647
|
let fetched = 0;
|
|
614
648
|
const balancesPool = new PromisePool({ concurrency: 10 });
|
|
615
649
|
|
|
650
|
+
let failed = [];
|
|
616
651
|
for (let addrChunk of chunk(addrs, 50)) {
|
|
617
652
|
balancesPool.add(async () => {
|
|
618
653
|
const ps = addrChunk.map(async uAddress => {
|
|
619
|
-
const curBalance =
|
|
654
|
+
const curBalance = onlyFailed
|
|
655
|
+
? 0
|
|
656
|
+
: get(addresses, `${uAddress}.balance`, 0);
|
|
620
657
|
const isNotContract = get(
|
|
621
658
|
addresses,
|
|
622
659
|
`${uAddress}.isNotContract`,
|
|
@@ -625,8 +662,12 @@ export const airdrop = (
|
|
|
625
662
|
);
|
|
626
663
|
const balance = await gd
|
|
627
664
|
.balanceOf(uAddress)
|
|
628
|
-
.then(_ => _.toNumber(), { blockTag: FUSE_SNAPSHOT_BLOCK })
|
|
629
|
-
|
|
665
|
+
.then(_ => _.toNumber(), { blockTag: FUSE_SNAPSHOT_BLOCK })
|
|
666
|
+
.catch(e => {
|
|
667
|
+
failed.push(uAddress);
|
|
668
|
+
return 0;
|
|
669
|
+
});
|
|
670
|
+
|
|
630
671
|
addresses[uAddress] = updateBalance(addresses[uAddress], {
|
|
631
672
|
balance: curBalance + balance,
|
|
632
673
|
isNotContract
|
|
@@ -637,7 +678,11 @@ export const airdrop = (
|
|
|
637
678
|
console.log("fetched fuse balances:", fetched);
|
|
638
679
|
});
|
|
639
680
|
}
|
|
681
|
+
|
|
640
682
|
await balancesPool.all();
|
|
683
|
+
console.log("fuseHolders failed:", failed.length);
|
|
684
|
+
if (!onlyFailed)
|
|
685
|
+
fs.writeFileSync("airdrop/failed.tmp", JSON.stringify(failed));
|
|
641
686
|
return addresses;
|
|
642
687
|
};
|
|
643
688
|
|
|
@@ -778,12 +823,21 @@ export const airdrop = (
|
|
|
778
823
|
balances: Balances = {},
|
|
779
824
|
ubiContract = ubi
|
|
780
825
|
) => {
|
|
826
|
+
const ubiFuse = ubiContract.connect(fuseProvider);
|
|
827
|
+
const ubiPokt = ubiContract.connect(fusePoktProvider);
|
|
828
|
+
const ubiGD = ubiContract.connect(fuseGDProvider);
|
|
829
|
+
|
|
781
830
|
const pool = new PromisePool({ concurrency: 50 });
|
|
782
831
|
const step = 1000;
|
|
783
832
|
const latestBlock = FUSE_SNAPSHOT_BLOCK; //await ubiContract.provider.getBlockNumber();
|
|
784
|
-
const blocks = range(
|
|
833
|
+
const blocks = range(
|
|
834
|
+
ubiContract === ubi ? 6276288 : 9376522,
|
|
835
|
+
ubiContract === ubi ? 9497482 : latestBlock,
|
|
836
|
+
step
|
|
837
|
+
);
|
|
785
838
|
const filter = ubiContract.filters.UBIClaimed();
|
|
786
|
-
|
|
839
|
+
const contracts = [ubiFuse, ubiGD];
|
|
840
|
+
let idx = 0;
|
|
787
841
|
blocks.forEach(bc => {
|
|
788
842
|
pool.add(async () => {
|
|
789
843
|
const options = { limit: 20, delay: 2000 };
|
|
@@ -792,7 +846,7 @@ export const airdrop = (
|
|
|
792
846
|
const logs = await retrier.resolve(attempt => {
|
|
793
847
|
console.log("fetching block ubiclaimed logs", { attempt, bc });
|
|
794
848
|
|
|
795
|
-
return
|
|
849
|
+
return contracts[idx++ % contracts.length].queryFilter(
|
|
796
850
|
filter,
|
|
797
851
|
bc,
|
|
798
852
|
Math.min(bc + step - 1, latestBlock)
|
|
@@ -803,7 +857,7 @@ export const airdrop = (
|
|
|
803
857
|
// Print out all the values:
|
|
804
858
|
logs.map(log => {
|
|
805
859
|
const uAddress = log.args.from.toLowerCase();
|
|
806
|
-
const claims = get(
|
|
860
|
+
const claims = get(balances, `${uAddress}.claims`, 0) + 1;
|
|
807
861
|
balances[uAddress] = updateBalance(balances[uAddress], {
|
|
808
862
|
claims
|
|
809
863
|
});
|
|
@@ -834,12 +888,8 @@ export const airdrop = (
|
|
|
834
888
|
};
|
|
835
889
|
|
|
836
890
|
const collectAirdropData = async (fuseBlock, ethBlock) => {
|
|
837
|
-
FUSE_SNAPSHOT_BLOCK = parseInt(
|
|
838
|
-
|
|
839
|
-
);
|
|
840
|
-
ETH_SNAPSHOT_BLOCK = parseInt(
|
|
841
|
-
ethBlock || (await poktArchiveProvider.getBlockNumber())
|
|
842
|
-
);
|
|
891
|
+
FUSE_SNAPSHOT_BLOCK = parseInt(fuseBlock || FUSE_SNAPSHOT_BLOCK);
|
|
892
|
+
ETH_SNAPSHOT_BLOCK = parseInt(ethBlock || ETH_SNAPSHOT_BLOCK);
|
|
843
893
|
|
|
844
894
|
console.log({
|
|
845
895
|
FUSE_SNAPSHOT_BLOCK,
|
|
@@ -855,42 +905,54 @@ export const airdrop = (
|
|
|
855
905
|
getFuseSwapBalances(
|
|
856
906
|
"https://graph.fuse.io/subgraphs/name/fuseio/fuseswap",
|
|
857
907
|
GD_FUSE
|
|
858
|
-
).then(r =>
|
|
908
|
+
).then(r =>
|
|
909
|
+
fs.writeFileSync("airdrop/fuseswapBalances.json", JSON.stringify(r))
|
|
910
|
+
)
|
|
859
911
|
);
|
|
912
|
+
|
|
860
913
|
ps[1] = _timer(
|
|
861
914
|
"getUniswapBalances",
|
|
862
915
|
getUniswapBalances().then(r =>
|
|
863
|
-
fs.writeFileSync("uniswapBalances.json", JSON.stringify(r))
|
|
916
|
+
fs.writeFileSync("airdrop/uniswapBalances.json", JSON.stringify(r))
|
|
864
917
|
)
|
|
865
918
|
);
|
|
919
|
+
|
|
866
920
|
ps[2] = _timer(
|
|
867
921
|
"getClaimsPerAddress",
|
|
868
922
|
getClaimsPerAddress()
|
|
869
923
|
.then(r => getClaimsPerAddress(r, ubinew))
|
|
870
|
-
.then(r =>
|
|
924
|
+
.then(r =>
|
|
925
|
+
fs.writeFileSync("airdrop/claimBalances.json", JSON.stringify(r))
|
|
926
|
+
)
|
|
871
927
|
);
|
|
928
|
+
|
|
872
929
|
ps[3] = _timer(
|
|
873
930
|
"getEthPlorerHolders",
|
|
874
931
|
getEthPlorerHolders().then(r =>
|
|
875
|
-
fs.writeFileSync("ethBalances.json", JSON.stringify(r))
|
|
932
|
+
fs.writeFileSync("airdrop/ethBalances.json", JSON.stringify(r))
|
|
876
933
|
)
|
|
877
934
|
);
|
|
935
|
+
|
|
878
936
|
// ps[4] = _timer(
|
|
879
937
|
// "getBlockScoutHolders",
|
|
880
938
|
// getBlockScoutHolders().then(r =>
|
|
881
939
|
// fs.writeFileSync("fuseBalances.json", JSON.stringify(r))
|
|
882
940
|
// ));
|
|
941
|
+
|
|
942
|
+
// const balances = JSON.parse(
|
|
943
|
+
// fs.readFileSync("airdrop/fuseBalances.json").toString()
|
|
944
|
+
// );
|
|
883
945
|
ps[4] = _timer(
|
|
884
946
|
"getFuseHolders",
|
|
885
|
-
getFuseHolders().then(r =>
|
|
886
|
-
fs.writeFileSync("fuseBalances.json", JSON.stringify(r))
|
|
947
|
+
getFuseHolders({}).then(r =>
|
|
948
|
+
fs.writeFileSync("airdrop/fuseBalances.json", JSON.stringify(r))
|
|
887
949
|
)
|
|
888
950
|
);
|
|
889
951
|
|
|
890
952
|
ps[5] = _timer(
|
|
891
953
|
"getStakersBalance",
|
|
892
954
|
getStakersBalance().then(r =>
|
|
893
|
-
fs.writeFileSync("stakersBalances.json", JSON.stringify(r))
|
|
955
|
+
fs.writeFileSync("airdrop/stakersBalances.json", JSON.stringify(r))
|
|
894
956
|
)
|
|
895
957
|
);
|
|
896
958
|
|
|
@@ -901,13 +963,15 @@ export const airdrop = (
|
|
|
901
963
|
// const files = ["test/testnetBalances.json"].map(f =>
|
|
902
964
|
// JSON.parse(fs.readFileSync(f).toString())
|
|
903
965
|
// );
|
|
966
|
+
|
|
967
|
+
const folder = "airdrop";
|
|
904
968
|
const files = [
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
969
|
+
`${folder}/claimBalances.json`,
|
|
970
|
+
`${folder}/ethBalances.json`,
|
|
971
|
+
`${folder}/fuseBalances.json`,
|
|
972
|
+
`${folder}/uniswapBalances.json`,
|
|
973
|
+
`${folder}/fuseswapBalances.json`,
|
|
974
|
+
`${folder}/stakersBalances.json`
|
|
911
975
|
].map(f => JSON.parse(fs.readFileSync(f).toString()));
|
|
912
976
|
|
|
913
977
|
const merge = (obj1, obj2, key) => {
|
|
@@ -927,28 +991,126 @@ export const airdrop = (
|
|
|
927
991
|
|
|
928
992
|
const data: Balances = mergeWith(files[0], ...files.slice(1), merge);
|
|
929
993
|
|
|
994
|
+
//switch shoppingio wallet
|
|
995
|
+
const shoppingio = data["0x2a18975b0bc72e28e09381cae19451aaaf4b771b"];
|
|
996
|
+
delete data["0x2a18975b0bc72e28e09381cae19451aaaf4b771b"];
|
|
997
|
+
data["0xAA0ded62E992F8FE5Dd184fCa9B468C6060f9683"] = shoppingio;
|
|
998
|
+
|
|
930
999
|
let { totalSupply, totalClaims, balances } = calcRelativeRep(data);
|
|
931
1000
|
|
|
932
1001
|
const CLAIMER_REP_ALLOCATION = 48000000;
|
|
933
1002
|
const HOLDER_REP_ALLOCATION = 24000000;
|
|
934
1003
|
const STAKER_REP_ALLOCATION = 24000000;
|
|
935
1004
|
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
1005
|
+
const ETORO = [
|
|
1006
|
+
"0xf79b804bae955ae4cd8e8b0331c4bc437104804f",
|
|
1007
|
+
"0x61ec01ad0937ebc10d448d259a2bbb1556b61e38"
|
|
1008
|
+
];
|
|
1009
|
+
const EtoroOfficial =
|
|
1010
|
+
"0x61ec01ad0937ebc10d448d259a2bbb1556b61e38".toLowerCase();
|
|
1011
|
+
const FoundationOfficial =
|
|
1012
|
+
"0x66582D24FEaD72555adaC681Cc621caCbB208324".toLowerCase();
|
|
1013
|
+
|
|
1014
|
+
const TEAM = [
|
|
1015
|
+
"0x5AeE2397b39B479B72bcfbDA114512BD3329E5aC",
|
|
1016
|
+
"0x330a78895b150007d1c00a471202ce0A9df046f2",
|
|
1017
|
+
"0x642ADC7965938D649192FF634e5Ab40df728b1bB",
|
|
1018
|
+
"0xA8Eb8eFeAcF45623816Eb2D1B1653BAC4245a358",
|
|
1019
|
+
"0x18C532F20C3a916b3989fCe4A3C6693F936a16C6",
|
|
1020
|
+
"0xA5eb500FcD5f85d30b38A84B433F343F100267d9",
|
|
1021
|
+
"0x9BA0721F9a83A8d90bA52Eaa1799ec08d164B7A0",
|
|
1022
|
+
"0xEFe1890bE2AAdaDF74FE3EaE72904Bd2FC926A63",
|
|
1023
|
+
"0xA48840D89a761502A4a7d995c74f3864D651A87F",
|
|
1024
|
+
"0x884e76001F9A807E0bA3b6d4574539D2FC0fcC4f",
|
|
1025
|
+
"0x75A57224f7b7380b92B0e04f7358775203058Eb2",
|
|
1026
|
+
"0xDEb250aDD368b74ebCCd59862D62fa4Fb57E09D4",
|
|
1027
|
+
"0x18C0416357937cf576e8277e3C3d806095D071B7",
|
|
1028
|
+
"0x7982D1883d43B2EF4a341fCFffc5e72f9e8D365b",
|
|
1029
|
+
"0x2CD2645dAe0ebC45642d131E4be1ea9e0Dc28e4A",
|
|
1030
|
+
"0xdBB617A5E3e21695058Ae4AbfAe4f2793775D3E3",
|
|
1031
|
+
"0x647481c033A4A2E816175cE115a0804adf793891",
|
|
1032
|
+
"0x3abdC9ed5f5dE6A74CFeb42a82087C853E160E76"
|
|
1033
|
+
].map(_ => _.toLowerCase());
|
|
1034
|
+
|
|
1035
|
+
const eToroRep = ETORO.map(addr => {
|
|
1036
|
+
const data = balances[addr];
|
|
1037
|
+
console.log("Found eToro record for redistribution", data);
|
|
1038
|
+
let rep =
|
|
1039
|
+
data.claimRepShare * CLAIMER_REP_ALLOCATION +
|
|
1040
|
+
data.gdRepShare * HOLDER_REP_ALLOCATION +
|
|
1041
|
+
data.stakeRepShare * STAKER_REP_ALLOCATION;
|
|
1042
|
+
return rep;
|
|
1043
|
+
}).reduce((acc, rep) => acc + rep, 0);
|
|
1044
|
+
|
|
1045
|
+
ETORO.forEach(addr => delete balances[addr]);
|
|
1046
|
+
|
|
1047
|
+
let toTree: Array<
|
|
1048
|
+
[string, number, boolean, number, number, number, number]
|
|
1049
|
+
> = Object.entries(balances).map(([addr, data]) => {
|
|
1050
|
+
let rep =
|
|
1051
|
+
data.claimRepShare * CLAIMER_REP_ALLOCATION +
|
|
1052
|
+
data.gdRepShare * HOLDER_REP_ALLOCATION +
|
|
1053
|
+
data.stakeRepShare * STAKER_REP_ALLOCATION;
|
|
1054
|
+
|
|
1055
|
+
return [
|
|
1056
|
+
addr,
|
|
1057
|
+
rep,
|
|
1058
|
+
!data.isNotContract,
|
|
1059
|
+
data.claimRepShare * CLAIMER_REP_ALLOCATION,
|
|
1060
|
+
data.gdRepShare * HOLDER_REP_ALLOCATION,
|
|
1061
|
+
data.stakeRepShare * STAKER_REP_ALLOCATION,
|
|
1062
|
+
0
|
|
1063
|
+
];
|
|
1064
|
+
});
|
|
942
1065
|
|
|
943
|
-
|
|
1066
|
+
//split etoro's rep between team,etoro and foundation
|
|
1067
|
+
const foundationEtoroRepShare = 8640000;
|
|
1068
|
+
const teamRepShare = (eToroRep - 8640000 * 2) / TEAM.length;
|
|
1069
|
+
const foundationRecord = toTree.find(x => x[0] === FoundationOfficial);
|
|
1070
|
+
foundationRecord[1] += foundationEtoroRepShare;
|
|
1071
|
+
foundationRecord[6] = foundationEtoroRepShare;
|
|
1072
|
+
console.log("Foundation updated record:", foundationRecord);
|
|
1073
|
+
|
|
1074
|
+
const etoroRecord: [
|
|
1075
|
+
string,
|
|
1076
|
+
number,
|
|
1077
|
+
boolean,
|
|
1078
|
+
number,
|
|
1079
|
+
number,
|
|
1080
|
+
number,
|
|
1081
|
+
number
|
|
1082
|
+
] = [
|
|
1083
|
+
EtoroOfficial,
|
|
1084
|
+
foundationEtoroRepShare,
|
|
1085
|
+
false,
|
|
1086
|
+
0,
|
|
1087
|
+
0,
|
|
1088
|
+
0,
|
|
1089
|
+
foundationEtoroRepShare
|
|
1090
|
+
];
|
|
1091
|
+
|
|
1092
|
+
console.log("eToro updated record:", etoroRecord);
|
|
1093
|
+
|
|
1094
|
+
toTree.push(etoroRecord);
|
|
1095
|
+
|
|
1096
|
+
TEAM.forEach(addr => {
|
|
1097
|
+
let record = toTree.find(x => x[0] === addr);
|
|
1098
|
+
if (!record) {
|
|
1099
|
+
record = [addr, 0, false, 0, 0, 0, 0];
|
|
1100
|
+
toTree.push(record);
|
|
1101
|
+
console.log("added TEAM missing record:", addr);
|
|
944
1102
|
}
|
|
945
|
-
|
|
1103
|
+
record[1] += teamRepShare;
|
|
1104
|
+
record[6] = teamRepShare;
|
|
1105
|
+
console.log("TEAM updated record:", record);
|
|
1106
|
+
});
|
|
1107
|
+
|
|
946
1108
|
toTree = sortBy(toTree, "1")
|
|
947
1109
|
.reverse()
|
|
948
1110
|
.filter(x => x[1] > 0);
|
|
949
1111
|
|
|
950
1112
|
console.log({ toTree });
|
|
951
|
-
const topContracts = toTree.filter(_ => _[2] ===
|
|
1113
|
+
const topContracts = toTree.filter(_ => _[2] === true);
|
|
952
1114
|
const totalReputationAirdrop = toTree.reduce((c, a) => c + a[1], 0);
|
|
953
1115
|
console.log({
|
|
954
1116
|
topContracts,
|
|
@@ -959,7 +1121,7 @@ export const airdrop = (
|
|
|
959
1121
|
});
|
|
960
1122
|
|
|
961
1123
|
const sorted = toTree.map(_ => _[1]);
|
|
962
|
-
fs.writeFileSync(
|
|
1124
|
+
fs.writeFileSync(`${folder}/reptree.json`, JSON.stringify(toTree));
|
|
963
1125
|
console.log("Reputation Distribution");
|
|
964
1126
|
[0.001, 0.01, 0.1, 0.5].forEach(q =>
|
|
965
1127
|
console.log({
|
|
@@ -1032,12 +1194,20 @@ export const airdrop = (
|
|
|
1032
1194
|
proofFor: toTree[0],
|
|
1033
1195
|
lastProofFor: toTree[toTree.length - 1]
|
|
1034
1196
|
});
|
|
1035
|
-
fs.writeFileSync(
|
|
1197
|
+
fs.writeFileSync(
|
|
1198
|
+
`${folder}/airdrop.json`,
|
|
1199
|
+
JSON.stringify({
|
|
1200
|
+
treeData,
|
|
1201
|
+
merkleRoot,
|
|
1202
|
+
ETH_SNAPSHOT_BLOCK,
|
|
1203
|
+
FUSE_SNAPSHOT_BLOCK
|
|
1204
|
+
})
|
|
1205
|
+
);
|
|
1036
1206
|
};
|
|
1037
1207
|
|
|
1038
1208
|
const getProof = addr => {
|
|
1039
1209
|
const { treeData, merkleRoot } = JSON.parse(
|
|
1040
|
-
fs.readFileSync("airdrop.json").toString()
|
|
1210
|
+
fs.readFileSync("airdrop/airdrop.json").toString()
|
|
1041
1211
|
);
|
|
1042
1212
|
|
|
1043
1213
|
let entries = Object.entries(treeData as Tree);
|
|
@@ -1052,7 +1222,7 @@ export const airdrop = (
|
|
|
1052
1222
|
calculated: calcMerkleRoot
|
|
1053
1223
|
});
|
|
1054
1224
|
|
|
1055
|
-
const addrData = treeData[addr];
|
|
1225
|
+
const addrData = treeData[addr] || treeData[addr.toLowerCase()];
|
|
1056
1226
|
const proofFor = Buffer.from(addrData.hash.slice(2), "hex");
|
|
1057
1227
|
|
|
1058
1228
|
const proof = merkleTree.getProof(proofFor);
|
|
@@ -1063,7 +1233,7 @@ export const airdrop = (
|
|
|
1063
1233
|
checkProofOrdered(proof, merkleTree.getRoot(), proofFor, proofIndex)
|
|
1064
1234
|
);
|
|
1065
1235
|
const hexProof = proof.map(_ => "0x" + _.toString("hex"));
|
|
1066
|
-
console.log({ proofIndex, proof: hexProof, [addr]:
|
|
1236
|
+
console.log({ proofIndex, proof: hexProof, [addr]: addrData });
|
|
1067
1237
|
};
|
|
1068
1238
|
|
|
1069
1239
|
return { buildMerkleTree, collectAirdropData, getProof };
|
package/scripts/releaser.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
const fse = require("fs-extra");
|
|
2
2
|
|
|
3
|
-
module.exports = async function(
|
|
3
|
+
module.exports = async function (
|
|
4
|
+
deployment,
|
|
5
|
+
network,
|
|
6
|
+
filename = "deployment",
|
|
7
|
+
log = true
|
|
8
|
+
) {
|
|
4
9
|
const dir = "releases/";
|
|
5
10
|
console.log("releaser:", { network, dir });
|
|
6
11
|
const previousDeployment =
|
|
@@ -10,9 +15,10 @@ module.exports = async function(deployment, network, filename = "deployment") {
|
|
|
10
15
|
...previousDeployment,
|
|
11
16
|
[network]: { ...previousDeployment[network], ...deployment }
|
|
12
17
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
log &&
|
|
19
|
+
console.log("releaser:", {
|
|
20
|
+
previousDeployment: previousDeployment[network],
|
|
21
|
+
finalDeployment: finalDeployment[network]
|
|
22
|
+
});
|
|
17
23
|
return fse.writeJson(dir + `/${filename}.json`, finalDeployment);
|
|
18
24
|
};
|