Initial commit with 🏗️ create-eth @ 2.0.4
This commit is contained in:
29
packages/hardhat/deploy/00_deploy_diceGame.ts
Normal file
29
packages/hardhat/deploy/00_deploy_diceGame.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { HardhatRuntimeEnvironment } from "hardhat/types";
|
||||
import { DeployFunction } from "hardhat-deploy/types";
|
||||
import { ethers } from "hardhat/";
|
||||
import { DiceGame } from "../typechain-types/";
|
||||
|
||||
const deployDiceGame: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
||||
const { deployer } = await hre.getNamedAccounts();
|
||||
const { deploy } = hre.deployments;
|
||||
|
||||
await deploy("DiceGame", {
|
||||
from: deployer,
|
||||
value: String(ethers.parseEther("0.05")),
|
||||
log: true,
|
||||
});
|
||||
|
||||
// Simple example on how get the deployed dice game contract
|
||||
const diceGame: DiceGame = await ethers.getContract("DiceGame");
|
||||
|
||||
const diceGameAddress = await diceGame.getAddress();
|
||||
|
||||
console.log("Deployed Dice Game Contract Address", diceGameAddress);
|
||||
|
||||
const balance = await ethers.provider.getBalance(diceGameAddress);
|
||||
console.log("Deployed Dice Game Contract Balance", ethers.formatEther(balance.toString()));
|
||||
};
|
||||
|
||||
export default deployDiceGame;
|
||||
|
||||
deployDiceGame.tags = ["DiceGame"];
|
||||
33
packages/hardhat/deploy/01_deploy_riggedRoll.ts
Normal file
33
packages/hardhat/deploy/01_deploy_riggedRoll.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { HardhatRuntimeEnvironment } from "hardhat/types";
|
||||
import { DeployFunction } from "hardhat-deploy/types";
|
||||
import { ethers } from "hardhat/";
|
||||
import { DiceGame, RiggedRoll } from "../typechain-types";
|
||||
|
||||
const deployRiggedRoll: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
||||
const { deployer } = await hre.getNamedAccounts();
|
||||
const { deploy } = hre.deployments;
|
||||
|
||||
const diceGame: DiceGame = await ethers.getContract("DiceGame");
|
||||
const diceGameAddress = await diceGame.getAddress();
|
||||
|
||||
// Uncomment to deploy RiggedRoll contract
|
||||
// await deploy("RiggedRoll", {
|
||||
// from: deployer,
|
||||
// log: true,
|
||||
// args: [diceGameAddress],
|
||||
// autoMine: true,
|
||||
// });
|
||||
|
||||
// const riggedRoll: RiggedRoll = await ethers.getContract("RiggedRoll", deployer);
|
||||
|
||||
// Please replace the text "Your Address" with your own address.
|
||||
// try {
|
||||
// await riggedRoll.transferOwnership("Your Address");
|
||||
// } catch (err) {
|
||||
// console.log(err);
|
||||
// }
|
||||
};
|
||||
|
||||
export default deployRiggedRoll;
|
||||
|
||||
deployRiggedRoll.tags = ["RiggedRoll"];
|
||||
Reference in New Issue
Block a user