-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.js
More file actions
49 lines (41 loc) · 1.36 KB
/
deploy.js
File metadata and controls
49 lines (41 loc) · 1.36 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
const HDWalletProvider = require("truffle-hdwallet-provider");
const Web3 = require("web3");
const BigNumber = require('bignumber.js');
BigNumber.config({ EXPONENTIAL_AT: 1e+9 })
const { tokenVesting } = require('./compile');
const provider = new HDWalletProvider(
"brand accuse source mesh guilt version siren risk electric proof bulb time",
"http://localhost:8545"
);
const web3 = new Web3(provider);
const {
SECONDS_PER_MONTH,
VESTED_TOKENS,
CLIFF_DURATION,
TOTAL_VEST_DURATION,
} = require('./config');
const tokens = (tokens) => new BigNumber(tokens).multipliedBy(1e+18).toString();
const deploy = async () => {
const accounts = await web3.eth.getAccounts();
console.log("Attempting to deploy from ", accounts[0]);
const result = await new web3.eth.Contract(JSON.parse(tokenVesting.interface))
.deploy({
data: tokenVesting.bytecode,
arguments: [
BENEFICIARYADDRESS, // bene
TOKENADDRESS, // token
STARTINGTIME- Date.now() / 1000, // start
CLIFF_DURATION, //cliff
TOTAL_VEST_DURATION, // vestDuration
SET_REVOKABLE, //revoke
tokens(VESTED_TOKENS), // tokensPerMonth
]
});
result = result.send({
gas: await result.estimateGas(),
from: accounts[0]
});
result.setProvider(provider);
console.log("Contract deployed to: ", result.options.address);
};
deploy();