UNPKG

1.06 kBJavaScriptView Raw
1// We require the Buidler Runtime Environment explicitly here. This is optional
2// but useful for running the script in a standalone fashion through `node <script>`.
3// When running the script with `buidler run <script>` you'll find the Buidler
4// Runtime Environment's members available in the global scope.
5const bre = require("@nomiclabs/buidler");
6
7async function main() {
8 // Buidler always runs the compile task when running scripts through it.
9 // If this runs in a standalone fashion you may want to call compile manually
10 // to make sure everything is compiled
11 // await bre.run('compile');
12
13 // We get the contract to deploy
14 const Greeter = await ethers.getContractFactory("Greeter");
15 const greeter = await Greeter.deploy("Hello, Buidler!");
16
17 await greeter.deployed();
18
19 console.log("Greeter deployed to:", greeter.address);
20}
21
22// We recommend this pattern to be able to use async/await everywhere
23// and properly handle errors.
24main()
25 .then(() => process.exit(0))
26 .catch(error => {
27 console.error(error);
28 process.exit(1);
29 });