add deploy script for OwnerToken

This commit is contained in:
0xb337r007 2023-07-21 10:04:02 +02:00
parent 14c9b0b627
commit dd24b30d89
2 changed files with 42 additions and 2 deletions

View File

@ -2,6 +2,11 @@ import { ethers } from "hardhat";
import { pn } from "./utils"; import { pn } from "./utils";
async function main() { async function main() {
const TestToken = await ethers.getContractFactory("Currency");
const testToken = await TestToken.deploy();
const ownerTokenAddress = testToken.address;
const masterTokenAddress = testToken.address;
const CollectibleV1 = await ethers.getContractFactory("CollectibleV1"); const CollectibleV1 = await ethers.getContractFactory("CollectibleV1");
const contract = await CollectibleV1.deploy( const contract = await CollectibleV1.deploy(
"Test", "Test",
@ -9,13 +14,19 @@ async function main() {
100, 100,
true, true,
true, true,
"http://local.dev" "http://local.dev",
ownerTokenAddress,
masterTokenAddress
); );
const instance = await contract.deployed(); const instance = await contract.deployed();
const tx = instance.deployTransaction; const tx = instance.deployTransaction;
const rec = await tx.wait(); const rec = await tx.wait();
console.log("CollectibleV1 deployed. Gas used:", pn(rec.gasUsed)); console.log(
`CollectibleV1 deployed at ${instance.address}. Gas used: ${pn(
rec.gasUsed
)}`
);
} }
// We recommend this pattern to be able to use async/await everywhere // We recommend this pattern to be able to use async/await everywhere
// and properly handle errors. // and properly handle errors.

View File

@ -0,0 +1,29 @@
import { ethers } from "hardhat";
import { pn } from "./utils";
async function main() {
const CollectibleV1 = await ethers.getContractFactory("OwnerToken");
const contract = await CollectibleV1.deploy(
"Test",
"TEST",
"http://local.dev",
"Test 2",
"TEST 2",
"http://local2.dev",
"0x12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678"
);
const instance = await contract.deployed();
const tx = instance.deployTransaction;
const rec = await tx.wait();
console.log(
`OwnerToken deployed at ${instance.address}. Gas used: ${pn(rec.gasUsed)}`
);
console.log("Master token deployed at", rec.events[0].args.masterToken);
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});