Scripts
Most of Vulcan's modules used for testing can be used in Scripts
but not all the functions are
recommended to be used in this context. A few examples are:
Accounts
: Only the functions in theaccountsSafe
library should be used. If there is a need to useunsafe
functions use theaccountsUnsafe
module exported invulcan/script.sol
.Context
: Only the functions in thectxSafe
library should be used. If there is a need to useunsafe
functions use thectxUnsafe
module exported invulcan/script.sol
;Forks
: None of the functions in this module should be used. If there is a need to useunsafe
functions use theforksUnsafe
module exported invulcan/script.sol
.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import {MyContract} from "src/MyContract.sol";
import {Script, ctx, println, request} from "vulcan/script.sol";
contract DeployScript is Script {
function run() public {
ctx.startBroadcast();
new MyContract();
ctx.stopBroadcast();
println("Notifying API");
request
.create()
.post("https://my-api.io/webhook/notify/deployment")
.send()
.expect("Failed to trigger webhook");
}
}