add script to deploy SNT/STT

This commit is contained in:
Ricardo Guilherme Schmidt 2023-06-28 20:03:00 -03:00
parent 9ba151266d
commit cbeb1afdd8
No known key found for this signature in database
GPG Key ID: 3F95A3AD0B607030
2 changed files with 45 additions and 32 deletions

View File

@ -1,32 +0,0 @@
// We require the Hardhat Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
//
// You can also run a script with `npx hardhat run <script>`. If you do that, Hardhat
// will compile your contracts, add the Hardhat Runtime Environment's members to the
// global scope, and execute the script.
const hre = require("hardhat");
async function main() {
const currentTimestampInSeconds = Math.round(Date.now() / 1000);
const unlockTime = currentTimestampInSeconds + 60;
const lockedAmount = hre.ethers.utils.parseEther("0.001");
const Lock = await hre.ethers.getContractFactory("Lock");
const lock = await Lock.deploy(unlockTime, { value: lockedAmount });
await lock.deployed();
console.log(
`Lock with ${ethers.utils.formatEther(
lockedAmount
)}ETH and unlock timestamp ${unlockTime} deployed to ${lock.address}`
);
}
// 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;
});

45
scripts/deploySNT.js Normal file
View File

@ -0,0 +1,45 @@
// We require the Hardhat Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
//
// You can also run a script with `npx hardhat run <script>`. If you do that, Hardhat
// will compile your contracts, add the Hardhat Runtime Environment's members to the
// global scope, and execute the script.
const hre = require("hardhat");
async function main() {
const [deployer] = await ethers.getSigners();
console.log(`Deploying contracts to ${network.name} (${network.config.chainId}) with the account: ${deployer.address}`);
const miniMeTokenFactory = await ethers.deployContract("MiniMeTokenFactory");
const miniMeToken = await ethers.deployContract(
"MiniMeToken", [
miniMeTokenFactory.target,
ethers.ZeroAddress,
0,
network.config.chainId == 1 ? "Status Network Token" : "Status Test Token",
18,
network.config.chainId == 1 ? "SNT" : "STT",
true
]);
const tokenController = await ethers.deployContract(
network.config.chainId == 1 ? "SNTPlaceHolder" : "SNTFaucet",
[
deployer,
tokenController.target
]
);
await miniMeToken.changeController(tokenController.address);
console.log(
`${network.config.chainId == 1 ? "SNT" : "STT"} ${miniMeToken.target} controlled by ${await miniMeToken.controller()}`
);
console.log(
`${network.config.chainId == 1 ? "SNTPlaceHolder" : "SNTFaucet"} ${tokenController.target} owned by ${await tokenController.owner()}`
);
}
// 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;
});