Skip to content

Instantly share code, notes, and snippets.

@BogdanHabic
Last active July 27, 2021 16:08
Show Gist options
  • Save BogdanHabic/6a0330f06a6f779b7584dc1225e059e8 to your computer and use it in GitHub Desktop.
Save BogdanHabic/6a0330f06a6f779b7584dc1225e059e8 to your computer and use it in GitHub Desktop.
// We require the Hardhat Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
// When running the script with `hardhat run <script>` you'll find the Hardhat
// Runtime Environment's members available in the global scope.
const hre = require("@nomiclabs/hardhat");
async function main() {
// Hardhat always runs the compile task when running scripts through it.
// If this runs in a standalone fashion you may want to call compile manually
// to make sure everything is compiled
// await hre.run('compile');
// We get the contract to deploy
const Greeter = await hre.ethers.getContractFactory("Greeter");
const greeter = await Greeter.deploy("Hello, Hardhat!");
await greeter.deployed();
await hre.tenderly.persistArtifacts({
name: "Greeter",
address:greeter.address
});
console.log("Greeter deployed to:", greeter.address);
console.log("Changing greeting");
await greeter.setGreeting("Zdravo, Graditelju!");
console.log("Greeting changed!");
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
.then(() => process.exit(0))
.catch(error => {
console.error(error);
process.exit(1);
});
@cpecorari
Copy link

Needs a persist at the end to export transaction : await hre.tenderly.persistArtifacts({name: "Greeter", address:greeter.address})

@BogdanHabic
Copy link
Author

BogdanHabic commented Jul 27, 2021

Hey @cpecorari, I've updated the gist to reflect this!

@cpecorari
Copy link

Thanks ! 👍 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment