Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions basic/06-ethersjs-waffle/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const fs = require("fs");
const SimpleToken = require("./build/SimpleToken.json");

const { ethers } = require("ethers");
Expand Down Expand Up @@ -27,7 +26,7 @@ let bal;

// support eip1559
async function getGasPrice () {
return await web3Provider.getFeeData().then(async function (res) {
return await web3Provider.getFeeData().then(function (res) {
let maxFeePerGas = res.maxFeePerGas;
let maxPriorityFeePerGas = res.maxPriorityFeePerGas;
console.log("maxFeePerGas: ", maxFeePerGas.toString());
Expand All @@ -52,6 +51,7 @@ async function checkBalance () {
checkBalance();

let token;

async function deploy () {
let option = await getGasPrice();
// 常见合约工厂实例
Expand All @@ -60,19 +60,24 @@ async function deploy () {
SimpleToken.bytecode,
wallet
);

console.log('start deploy')

token = await simpletoken.deploy("HEHE", "HH", 1, 100000000);

console.log(token.target);

await token.waitForDeployment();
console.log('deployed')

tx = await token.transfer(
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
ethers.parseEther("0.00000000001"),
option
);
await tx.wait();
console.log('hash', tx.hash);

let bal = await token.balanceOf(wallet.address);
console.log(bal.toString());
}
Expand Down
1 change: 1 addition & 0 deletions basic/08-hardhat-graph/scripts/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ async function main() {
const Token = await ethers.getContractFactory('SimpleToken');
const token = await Token.deploy('HHToken', 'HHT', 1, 100000000);

await token.waitForDeployment();

console.log('Contract address:', token.target);

Expand Down