wormhole/ethereum/forge-test/rv-helpers/KEVMCheats.sol

39 lines
2.1 KiB
Solidity
Raw Normal View History

// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.9.0;
pragma experimental ABIEncoderV2;
interface KEVMCheatsBase {
// Expects a call using the CALL opcode to an address with the specified calldata.
function expectRegularCall(address,bytes calldata) external;
// Expects a call using the CALL opcode to an address with the specified msg.value and calldata.
function expectRegularCall(address,uint256,bytes calldata) external;
// Expects a static call to an address with the specified calldata.
function expectStaticCall(address,bytes calldata) external;
// Expects a delegate call to an address with the specified calldata.
function expectDelegateCall(address,bytes calldata) external;
// Expects that no contract calls are made after invoking the cheatcode.
function expectNoCall() external;
// Expects the given address to deploy a new contract, using the CREATE opcode, with the specified value and bytecode.
function expectCreate(address,uint256,bytes calldata) external;
// Expects the given address to deploy a new contract, using the CREATE2 opcode, with the specified value and bytecode (appended with a bytes32 salt).
function expectCreate2(address,uint256,bytes calldata) external;
// Makes the storage of the given address completely symbolic.
function symbolicStorage(address) external;
// Adds an address to the whitelist.
function allowCallsToAddress(address) external;
// Adds an address and a storage slot to the whitelist.
function allowChangesToStorage(address,uint256) external;
// Set the current <gas> cell
function infiniteGas() external;
}
abstract contract KEVMCheats {
KEVMCheatsBase public constant kevm = KEVMCheatsBase(address(uint160(uint256(keccak256("hevm cheat code")))));
// Checks if an address matches one of the built-in addresses.
function notBuiltinAddress(address addr) internal pure returns (bool) {
return (addr != address(645326474426547203313410069153905908525362434349) &&
addr != address(1032069922050249630382865877677304880282300743300));
}
}