-
Notifications
You must be signed in to change notification settings - Fork 0
/
merkle.js
37 lines (28 loc) · 859 Bytes
/
merkle.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const { Wallet } = require('ethers');
function generateRandomAmount() {
return Math.floor(Math.random() * 100000000000000000000);
}
function generateRandomTokenIds(count) {
const tokenIds = [];
while (tokenIds.length < count) {
const tokenId = Math.floor(Math.random() * count) + 1;
if (!tokenIds.includes(tokenId)) {
tokenIds.push(tokenId);
}
}
return tokenIds;
}
function generateAddresses(count) {
const addresses = [];
const tokenIds = generateRandomTokenIds(count);
for (let i = 0; i < count; i++) {
const wallet = Wallet.createRandom();
const address = wallet.address;
const amount = generateRandomAmount();
const tokenId = tokenIds[i];
addresses.push(`${address},${amount},${tokenId}`);
}
return addresses;
}
const addresses = generateAddresses(500);
console.log(addresses.join('\n'));