-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from FhenixProtocol/v0.3.x
v3.0
- Loading branch information
Showing
16 changed files
with
3,401 additions
and
3,444 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { DeployFunction } from "hardhat-deploy/types"; | ||
import { HardhatRuntimeEnvironment } from "hardhat/types"; | ||
|
||
/** | ||
* Deploys a contract named "Counter" using the deployer account and | ||
* constructor arguments set to the deployer address | ||
* | ||
* @param hre HardhatRuntimeEnvironment object. | ||
*/ | ||
const deployCounter: DeployFunction = async function ( | ||
hre: HardhatRuntimeEnvironment, | ||
) { | ||
/* | ||
On localhost, the deployer account is the one that comes with Hardhat, which is already funded. | ||
When deploying to live networks (e.g `yarn deploy --network goerli`), the deployer account | ||
should have sufficient balance to pay for the gas fees for contract creation. | ||
You can generate a random account with `yarn generate` which will fill DEPLOYER_PRIVATE_KEY | ||
with a random private key in the .env file (then used on hardhat.config.ts) | ||
You can run the `yarn account` command to check your balance in every network. | ||
*/ | ||
const { deployer } = await hre.getNamedAccounts(); | ||
const { deploy } = hre.deployments; | ||
|
||
if (hre.network.name === "hardhat" && process.argv.includes("deploy")) { | ||
console.warn("Warning: you are deploying to the in-process Hardhat network, but this network gets destroyed right after the deployment task ends."); | ||
} | ||
// Fund the account before deploying. | ||
if (hre.network.name === "localfhenix") { | ||
if ((await hre.ethers.provider.getBalance(deployer)) === 0n) { | ||
await hre.fhenixjs.getFunds(deployer); | ||
console.log("Received tokens from the local faucet. Ready to deploy..."); | ||
} | ||
} | ||
|
||
await deploy("Counter", { | ||
from: deployer, | ||
// Contract constructor arguments | ||
args: [], | ||
log: true, | ||
// autoMine: can be passed to the deploy function to make the deployment process faster on local networks by | ||
// automatically mining the contract deployment transaction. There is no effect on live networks. | ||
autoMine: true, | ||
}); | ||
}; | ||
|
||
export default deployCounter; | ||
|
||
// Tags are useful if you have multiple deploy files and only want to run one of them. | ||
// e.g. yarn deploy --tags Counter | ||
deployCounter.tags = ["Counter"]; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.