-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAddAirdropUsers.js
106 lines (78 loc) · 2.49 KB
/
AddAirdropUsers.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
require("dotenv").config()
Web3 = require("web3");
//const userRewards =require('./eligible_claim2/001-addAddresses_add.json');
const usersAirdrop =require('');
//const rewards ='./rewards.json';
const SingDaoBondedStakingABI = require('./build/contracts/SDAOBondedTokenStake.json')
const PORT = process.env.PORT || 5001
//Commander import
const { Command } = require('commander');
const program = new Command();
program.version('0.0.1');
console.log(`Running on mainnet ........`);
networkId = "1"; //"42"; //"97"; //
ETH_NODE_URL= 'https://mainnet.infura.io/v3/'+process.env.InfuraKey;
var web3 = new Web3(ETH_NODE_URL);
let minABI = [
{
"constant":true,
"inputs":[{"name":"_owner","type":"address"}],
"name":"balanceOf",
"outputs":[{"name":"balance","type":"uint256"}],
"type":"function"
},
// decimals
{
"constant":true,
"inputs":[],
"name":"decimals",
"outputs":[{"name":"","type":"uint8"}],
"type":"function"
},
{
"constant": false,
"inputs": [
{
"name": "_spender",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
];
async function AddAdddresesSDAO(){
const account = web3.eth.accounts.privateKeyToAccount(process.env.PRIVATE_KEY); //process.env.PRIVATE_KEY_KOVAN
web3.eth.accounts.wallet.add(account);
web3.eth.defaultAccount = account.address;
console.log(account.address)
var SingDaoBondedStaking = new web3.eth.Contract(SingDaoBondedStakingABI.abi, process.env.BONDED_STAKING_CONTRACT);
// var SingDaoToken = new web3.eth.Contract(minABI, process.env.SINGDAO_TOKEN_CONTRACT);
try {
var AddAirdropClaimer = await SingDaoAirdrop.methods.airDropStakes("0",usersAirdrop.addresses,usersAirdrop.rewards).send({
'from': account.address,
'gas': 2500000,
'gasPrice': 14000000000,
}, function(error, data){
console.log(error);
//console.log(data)
console.log("Transaction ID init : " .cyan + data)
console.log("check transaction at https://etherscan.io/tx/"+data)
});
} catch(error){
console.log(error);
}
}
AddAdddresesSDAO();