Skip to content

Instantly share code, notes, and snippets.

@NaoyaTabakomori
Created December 28, 2018 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NaoyaTabakomori/1d6e203ac7fe2c6154edcb42aacbdb0c to your computer and use it in GitHub Desktop.
Save NaoyaTabakomori/1d6e203ac7fe2c6154edcb42aacbdb0c to your computer and use it in GitHub Desktop.
クリアのご褒美としてトークンをおねだりする
var fs = require('fs');
var Web3 = require('web3');
var web3 = new Web3('wss://ropsten.infura.io/ws');
var santaClausABI = JSON.parse(fs.readFileSync('./build/contracts/SantaClaus.json')).abi;
var santaClausAddress = '0x05d9cbEe05e82D492ad66842fc7C0Cb363B384EA';
var santaClaus = new web3.eth.Contract(santaClausABI, santaClausAddress);
var address = 'your address';
var privkey = 'your priv key';
async function giveMeToken() {
web3.eth.defaultAccount = address;
web3.eth.accounts.wallet.add(privkey);
var pray = await santaClaus.methods.requestToken().send({
from: address,
gas: 4700000,
gasPrice: 20000000000,
});
console.log(pray);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment