-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultitransfer
More file actions
53 lines (47 loc) · 1.76 KB
/
multitransfer
File metadata and controls
53 lines (47 loc) · 1.76 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const csv = require('csv-parser');
const fs = require('fs');
const { ethers } = require('ethers');
const results = [];
const pk = ""; // 프라이빗키 넣으세요
const provider = new ethers.providers.JsonRpcProvider("https://mainnet.infura.io/");
// const provider = new ethers.getDefaultProvider();
let walletWithProvider = new ethers.Wallet(pk, provider)
const abi = [
"function balanceOf(address _owner) view returns (uint256)",
"function owner() view returns (address)",
"function name() view returns (string)",
"function totalSupply() view returns (uint256)",
"function decimals() view returns (uint8)",
"function symbol() view returns (string)",
"function transfer(address _to, uint256 value) returns (bool success)",
]
const contract = new ethers.Contract("0xE9E73E1aE76D17A16cC53E3e87a9a7dA00000000", abi, walletWithProvider);
// walletWithProvider.getTransactionCount().then(res => {
let nonce = 10232
const file = "list.csv"
fs.createReadStream(file)
.pipe(csv())
.on('data', (data) => results.push(data))
.on('end', () => {
for(const res of results) {
const tx = {
to: res['to'],
value: ethers.utils.parseEther(res['amount']),
};
// console.log(tx);
nonce = nonce + 1
overrides = {
gasPrice: 180 * 1000000000, // 가스값!!!!
nonce: nonce,
}
console.log(tx, res['amount'], overrides)
try {
// if(nonce > 10461) {
contract.transfer(tx.to, tx.value, overrides).then((tx) => { console.log(tx.hash) });
// }
} catch (e) {
console.error(tx, e)
}
}
});
// });