setup stuff

This commit is contained in:
Moon Man 2023-08-19 23:19:59 -04:00
parent 98af8dccad
commit fa4ede8fbc
3 changed files with 19 additions and 8 deletions

View File

@ -1,7 +1,8 @@
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import "hardhat-contract-sizer";
import "dotenv/config";
import dotenv from "dotenv";
dotenv.config({ path: `.env.${process.env.NODE_ENV || "local"}` });
const config: HardhatUserConfig = {
solidity: {

View File

@ -1,21 +1,27 @@
import { ethers } from "hardhat";
import "dotenv/config";
import fs from "fs/promises";
import dotenv from "dotenv";
const env = process.env.NODE_ENV || "local";
dotenv.config({ path: `.env.${env}` });
async function main() {
if (!process.env.BRIDGE_ADDRESS) throw "Bridge address not defined";
if (!process.env.ETH_TOKEN) throw "10grans Ethereum token address not defined";
if (!process.env.BASE_BRIDGE_ADDRESS) throw "Bridge address not defined";
const tenGransAddress = (await fs.readFile(`.10grans-eth-address.${env}`, "utf-8")).trim();
const TENGRANS = await ethers.deployContract(
"TenGransBaseToken",
[
process.env.BRIDGE_ADDRESS,
process.env.ETH_TOKEN
process.env.BASE_BRIDGE_ADDRESS,
tenGransAddress
]
);
await TENGRANS.waitForDeployment();
const deployedAddress = await TENGRANS.getAddress();
console.log(`Base 10grans deployed to: ${deployedAddress}`);
await fs.writeFile(`.10grans-base-address.${env}`, deployedAddress);
console.log(`Base 10grans deployed to: ${TENGRANS.target}`);
}
// We recommend this pattern to be able to use async/await everywhere

View File

@ -1,11 +1,15 @@
import { ethers } from "hardhat";
import fs from "fs/promises";
const env = process.env.NODE_ENV || "local";
async function main() {
const TENGRANS = await ethers.deployContract("TenGransEthToken");
await TENGRANS.waitForDeployment();
const deployedAddress = await TENGRANS.getAddress();
console.log(`Ethereum 10grans deployed to: ${TENGRANS.target}`);
console.log(`Ethereum 10grans deployed to: ${deployedAddress}`);
await fs.writeFile(`.10grans-eth-address.${env}`, deployedAddress);
}
// We recommend this pattern to be able to use async/await everywhere