forked from XLNT/auction-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
46 lines (40 loc) · 1.07 KB
/
script.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
require("dotenv").config();
const Web3 = require("web3");
const contract = require("truffle-contract");
const HillCoreContract = require("./build/contracts/HillCore.json");
const host = process.env.RPC_HOST || "127.0.0.1";
const port = process.env.RPC_PORT || 7545;
global.web3 = new Web3(
new Web3.providers.HttpProvider(`http://${host}:${port}`)
);
global.accounts = global.web3.eth.accounts;
global.acct0 = global.accounts[0];
global.acct1 = global.accounts[1];
const HillCore = contract(HillCoreContract);
HillCore.setProvider(global.web3.currentProvider);
let hillCore;
HillCore.deployed()
.then(_hillCore => {
hillCore = _hillCore;
return hillCore.totalSupply();
})
.then(totalSupply => {
return hillCore.generate(
totalSupply,
acct1,
`Hill Number: ${totalSupply}`,
{
from: acct0,
gas: 1000000
}
);
})
.then(() => {
return hillCore.totalSupply();
})
.then(totalSupply => {
console.log("TOTAL SUPPLY", totalSupply.toString());
})
.catch(error => {
console.log("ERROR : ", error);
});