Skip to content

Commit f189aa5

Browse files
committed
minter削除
1 parent 1e38753 commit f189aa5

File tree

4 files changed

+88
-8
lines changed

4 files changed

+88
-8
lines changed

.env.example

+5
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
INFRA_API_KEY=https://rinkeby.infura.io/v3/
22
PRIVATE_KEY=0xabc123
3+
MINTER_ADDRESS=0x...
4+
TO_ADDRESS=0x...
5+
MINT_AMOUNT=1000000
6+
7+

.gitignore

+7-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,10 @@
66
coverage.json
77
/coverage
88
/gasEstimate
9-
/.VSCoderCounter
9+
/.VSCoderCounter
10+
build/
11+
node_modules/
12+
node_modules
13+
.pnpm-store/
14+
.vscode/
15+
pnpm-lock.yaml

hardhat.config.ts

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
import { HardhatUserConfig } from "hardhat/config";
3+
import "@nomicfoundation/hardhat-viem";
4+
import '@nomiclabs/hardhat-truffle5';
5+
// require("@nomiclabs/hardhat-waffle")
6+
import '@openzeppelin/hardhat-upgrades';
7+
import 'hardhat-contract-sizer';
8+
import 'solidity-coverage';
9+
import 'dotenv';
10+
11+
const config: HardhatUserConfig = {
12+
solidity: {
13+
compilers: [
14+
{
15+
version: '0.8.11',
16+
settings: {
17+
optimizer: {
18+
enabled: true,
19+
runs: 3000,
20+
},
21+
},
22+
},
23+
{
24+
version: '0.4.24',
25+
}
26+
]
27+
},
28+
29+
networks: {
30+
hardhat: {
31+
chainId: 1337,
32+
allowUnlimitedContractSize: false,
33+
},
34+
35+
anvil: {
36+
url: "http://127.0.0.1:8545",
37+
chainId: 31337,
38+
accounts: {
39+
mnemonic: "test test test test test test test test test test test junk",
40+
},
41+
},
42+
},
43+
};
44+
45+
export default config;

script/Deployscript.ts

+31-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,39 @@
11
import '@nomicfoundation/hardhat-viem';
22
import hre from 'hardhat';
3-
import { Account, getContract } from 'viem';
3+
import { Account, getContract } from 'viem';
44
import { anvil } from 'viem/chains';
5+
import dotenv from 'dotenv';
6+
import yargs from 'yargs';
7+
8+
dotenv.config();
59

610
// anvil
711
// 別のターミナルを開く
812
// pnpm hardhat test src/tests/jpyc-tests/jpyc-balance2.test.ts --network localhost
13+
const argv = yargs(process.argv.slice(2))
14+
.option('minterAddress', {
15+
type: 'string',
16+
description: 'Address of the minter'
17+
})
18+
.option('toAddress', {
19+
type: 'string',
20+
description: 'Address to mint tokens to'
21+
})
22+
.option('amount', {
23+
type: 'number',
24+
description: 'Amount of tokens to mint'
25+
})
26+
.argv;
27+
928

1029
let JPYC_ADMIN_ACCOUNT: Account;
11-
(async () => {
30+
31+
async function initializeAdminAccount() {
1232
const [jpycAdmin] = await hre.viem.getWalletClients({
1333
chain: anvil
14-
})
34+
});
1535
JPYC_ADMIN_ACCOUNT = jpycAdmin.account;
16-
})();
36+
}
1737

1838
async function deployJpyc() {
1939
const jpycImpl = await hre.viem.deployContract("FiatTokenV1", []);
@@ -85,19 +105,23 @@ async function mintTokens(jpyc: any, minterAddress: string, toAddress: string, a
85105

86106
//デプロイ用、mint用のスクリプト to addressの指定をお願いします。
87107
async function main() {
108+
await initializeAdminAccount();
88109
const { jpyc } = await deployJpyc();
89110
const symbol = await jpyc.read.symbol();
90111
const name = await jpyc.read.name();
91-
const minterAddress = await jpyc.read.minter();
92-
const toAddress = "";
112+
113+
const minterAddress = argv.minterAddress || process.env.MINTER_ADDRESS || JPYC_ADMIN_ACCOUNT.address;
114+
const toAddress = argv.toAddress || process.env.TO_ADDRESS || "0x70997970C51812dc3A010C7d01b50e0d17dc79C8";
115+
const amount = BigInt(argv.amount || process.env.MINT_AMOUNT || 1000000);
93116

94117

95-
await mintTokens(jpyc,minterAddress as string, toAddress, 1000000n);
118+
await mintTokens(jpyc,minterAddress as string, toAddress, amount);
96119

97120
console.log("token deployed:", jpyc.address);
98121
console.log("token symbol:", symbol);
99122
console.log("token name:", name);
100123
console.log("to address:",toAddress);
124+
console.log("to address balance:",await jpyc.read.balanceOf([toAddress]));
101125

102126
}
103127

0 commit comments

Comments
 (0)