github foundry-rs/forge-std v1.8.2

latest releases: v1.9.4, v1.9.3, v1.9.2...
6 months ago

Featured Changes

Expand to see the full set of new cheats
/// Gets the environment variable `name` and returns true if it exists, else returns false.
function envExists(string calldata name) external view returns (bool result);

/// Returns true if `forge` command was executed in given context.
function isContext(ForgeContext context) external view returns (bool result);

/// Gets the current `block.blobbasefee`.
/// You should use this instead of `block.blobbasefee` if you use `vm.blobBaseFee`, as `block.blobbasefee` is assumed to be constant across a transaction,
/// and as a result will get optimized out by the compiler.
/// See https://github.com/foundry-rs/foundry/issues/6180
function getBlobBaseFee() external view returns (uint256 blobBaseFee);

/// Gets the gas used in the last call.
function lastCallGas() external view returns (Gas memory gas);

/// Signs `digest` with signer provided to script using the secp256k1 curve.
/// If `--sender` is provided, the signer with provided address is used, otherwise,
/// if exactly one signer is provided to the script, that signer is used.
/// Raises error if signer passed through `--sender` does not match any unlocked signers or
/// if `--sender` is not provided and not exactly one signer is passed to the script.
function sign(bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s);

/// Signs `digest` with signer provided to script using the secp256k1 curve.
/// Raises error if none of the signers passed into the script have provided address.
function sign(address signer, bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s);

/// Prompts the user for a string value in the terminal.
function prompt(string calldata promptText) external returns (string memory input);

/// Prompts the user for an address in the terminal.
function promptAddress(string calldata promptText) external returns (address);

/// Prompts the user for a hidden string value in the terminal.
function promptSecret(string calldata promptText) external returns (string memory input);

/// Prompts the user for uint256 in the terminal.
function promptUint(string calldata promptText) external returns (uint256);

/// See `serializeJson`.
function serializeUintToHex(string calldata objectKey, string calldata valueKey, uint256 value)
    external
    returns (string memory json);

/// Returns the index of the first occurrence of a `key` in an `input` string.
/// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `key` is not found.
/// Returns 0 in case of an empty `key`.
function indexOf(string calldata input, string calldata key) external pure returns (uint256);

/// Returns ENS namehash for provided string.
function ensNamehash(string calldata name) external pure returns (bytes32);

/// Sets `block.blobbasefee`
function blobBaseFee(uint256 newBlobBaseFee) external;

/// Sets the blobhashes in the transaction.
/// Not available on EVM versions before Cancun.
/// If used on unsupported EVM versions it will revert.
function blobhashes(bytes32[] calldata hashes) external;

/// Gets the blockhashes from the current transaction.
/// Not available on EVM versions before Cancun.
/// If used on unsupported EVM versions it will revert.
function getBlobhashes() external view returns (bytes32[] memory hashes);

/// Sets `block.prevrandao`.
/// Not available on EVM versions before Paris. Use `difficulty` instead.
/// If used on unsupported EVM versions it will revert.
function prevrandao(uint256 newPrevrandao) external;

Other Changes

New Contributors

Full Changelog: v1.8.1...v1.8.2

Don't miss a new forge-std release

NewReleases is sending notifications on new releases.