Ethereum and EVM Compatible Blockchains (beta) Actions
sign_transfer
The evm::sign_transfer
action encodes an ETH transfer transaction, signs it with the provided signer data, and broadcasts it to the network.
Inputs
- Name
description
- Type
- optional
- Description
A description of the transaction
- Name
signer
- Type
- required
- Description
A reference to a signer construct, which will be used to sign the transaction.
- Name
to
- Type
- required
- Description
The address of the recipient of the transfer.
- Name
amount
- Type
- required
- Description
The amount, in WEI, to transfer.
- Name
type
- Type
- optional
- Description
The transaction type. Options are 'Legacy', 'EIP2930', 'EIP1559', 'EIP4844'. The default is 'EIP1559'.
- Name
max_fee_per_gas
- Type
- optional
- Description
Sets the max fee per gas of an EIP1559 transaction.
- Name
max_priority_fee_per_gas
- Type
- optional
- Description
Sets the max priority fee per gas of an EIP1559 transaction.
- Name
chain_id
- Type
- optional
- Description
The chain id.
- Name
nonce
- Type
- optional
- Description
The account nonce of the signer. This value will be retrieved from the network if omitted.
- Name
gas_limit
- Type
- optional
- Description
Sets the maximum amount of gas that should be used to execute this transaction.
- Name
gas_price
- Type
- optional
- Description
Sets the gas price for Legacy transactions.
- Name
rpc_api_url
- Type
- optional
- Description
The URL of the EVM API used to fetch and fill transaction data and to broadcast it to the network.
Outputs
When the sign_transfer
action is successfully executed, the following outputs are attached to the action
- Name
tx_hash
- Description
The transaction hash
Example using sign_transfer
// Coming soon
call_contract
The evm::call_contract
action encodes a contract call transaction, signs it with the provided signer data, and broadcasts it to the network.
Inputs
- Name
description
- Type
- optional
- Description
A description of the transaction.
- Name
rpc_api_url
- Type
- optional
- Description
The URL of the EVM API used to broadcast the transaction.
- Name
signer
- Type
- required
- Description
A reference to a signer construct, which will be used to sign the transaction.
- Name
contract_address
- Type
- required
- Description
The address of the contract being called.
- Name
contract_abi
- Type
- optional
- Description
The contract ABI, optionally used to check input arguments before sending the transaction to the chain.
- Name
function_name
- Type
- required
- Description
The contract function to invoke.
- Name
function_args
- Type
- optional
- Description
The contract function arguments
- Name
amount
- Type
- optional
- Description
The amount, in WEI, to transfer.
- Name
type
- Type
- optional
- Description
The transaction type. Options are 'Legacy', 'EIP2930', 'EIP1559', 'EIP4844'. The default is 'EIP1559'.
- Name
max_fee_per_gas
- Type
- optional
- Description
Sets the max fee per gas of an EIP1559 transaction. This value will be retrieved from the network if omitted.
- Name
max_priority_fee_per_gas
- Type
- optional
- Description
Sets the max priority fee per gas of an EIP1559 transaction. This value will be retrieved from the network if omitted.
- Name
chain_id
- Type
- optional
- Description
The chain id.
- Name
nonce
- Type
- optional
- Description
The account nonce of the signer. This value will be retrieved from the network if omitted.
- Name
gas_limit
- Type
- optional
- Description
Sets the maximum amount of gas that should be used to execute this transaction. This value will be retrieved from the network if omitted.
- Name
gas_price
- Type
- optional
- Description
Sets the gas price for Legacy transactions. This value will be retrieved from the network if omitted.
Outputs
When the call_contract
action is successfully executed, the following outputs are attached to the action
- Name
tx_hash
- Description
The hash of the transaction.
Example using call_contract
action "call_some_contract" "evm::call_contract" {
contract_address = input.contract_address
function_name = "myFunction"
function_args = [evm::bytes("0x1234")]
signer = signer.operator
}
eth_call
The evm::eth_call
command simulates an Ethereum transaction using the eth_call
RPC endpoint.
Inputs
- Name
description
- Type
- optional
- Description
A description of the call.
- Name
rpc_api_url
- Type
- optional
- Description
The URL of the EVM API used to send the RPC request.
- Name
contract_address
- Type
- required
- Description
The address of the contract being called.
- Name
contract_abi
- Type
- optional
- Description
The contract ABI, optionally used to check input arguments before sending the transaction to the chain.
- Name
signer
- Type
- required
- Description
The address that will be used as the sender of this contract call.
- Name
function_name
- Type
- optional
- Description
The contract function to call.
- Name
function_args
- Type
- optional
- Description
The contract function arguments.
- Name
amount
- Type
- optional
- Description
The amount, in Wei, to send in the transaction.
- Name
type
- Type
- optional
- Description
The transaction type. Options are 'Legacy', 'EIP2930', 'EIP1559', 'EIP4844'. The default is 'EIP1559'. This value will be retrieved from the network if omitted.
- Name
max_fee_per_gas
- Type
- optional
- Description
Sets the max fee per gas of an EIP1559 transaction. This value will be retrieved from the network if omitted.
- Name
max_priority_fee_per_gas
- Type
- optional
- Description
Sets the max priority fee per gas of an EIP1559 transaction. This value will be retrieved from the network if omitted.
- Name
chain_id
- Type
- optional
- Description
The chain id.
- Name
nonce
- Type
- optional
- Description
The account nonce of the sender. This value will be retrieved from the network if omitted.
- Name
gas_limit
- Type
- optional
- Description
Sets the maximum amount of gas that should be used to execute this transaction. This value will be retrieved from the network if omitted.
- Name
gas_price
- Type
- optional
- Description
Sets the gas price for Legacy transactions. This value will be retrieved from the network if omitted.
Outputs
When the eth_call
action is successfully executed, the following outputs are attached to the action
- Name
result
- Description
The contract call result.
Example using eth_call
action "call_some_contract" "evm::eth_call" {
contract_address = input.contract_address
function_name = "myFunction"
function_args = [evm::bytes("0x1234")]
signer = signer.operator.address
}
deploy_contract
The evm::deploy_contract
action encodes a contract deployment transaction, signs it with the provided signer data, and broadcasts it to the network.
Inputs
- Name
description
- Type
- optional
- Description
A description of the transaction
- Name
rpc_api_url
- Type
- optional
- Description
The URL of the EVM API used to broadcast the transaction.
- Name
signer
- Type
- required
- Description
A reference to a signer construct, which will be used to sign the transaction.
- Name
amount
- Type
- optional
- Description
The amount, in WEI, to send with the deployment.
- Name
type
- Type
- optional
- Description
The transaction type. Options are 'Legacy', 'EIP2930', 'EIP1559', 'EIP4844'. The default is 'EIP1559'. This value will be retrieved from the network if omitted.
- Name
max_fee_per_gas
- Type
- optional
- Description
Sets the max fee per gas of an EIP1559 transaction. This value will be retrieved from the network if omitted.
- Name
max_priority_fee_per_gas
- Type
- optional
- Description
Sets the max priority fee per gas of an EIP1559 transaction. This value will be retrieved from the network if omitted.
- Name
chain_id
- Type
- optional
- Description
The chain id.
- Name
nonce
- Type
- optional
- Description
The account nonce of the signer. This value will be retrieved from the network if omitted.
- Name
gas_limit
- Type
- optional
- Description
Sets the maximum amount of gas that should be used to execute this transaction. This value will be retrieved from the network if omitted.
- Name
gas_price
- Type
- optional
- Description
Sets the gas price for Legacy transactions. This value will be retrieved from the network if omitted.
- Name
contract
- Type
- required
- Description
The contract to deploy. At a minimum, this should be an object with a key
bytecode
and the contract bytecode. The abi field can also be provided to add type checking for the constructor arguments. Theevm::get_contract_from_foundry_project
andevm::get_contract_from_hardhat_project
functions can be used to retrieve the contract object.
- Name
constructor_args
- Type
- optional
- Description
The optional constructor arguments for the deployed contract.
- Name
confirmations
- Type
- optional
- Description
Once the transaction is included on a block, the number of blocks to await before the transaction is considered successful and Runbook execution continues. The default is 1.
- Name
verify
- Type
- optional
- Description
Coming soon.
- Name
block_explorer_api_key
- Type
- optional
- Description
Coming soon.
Outputs
When the deploy_contract
action is successfully executed, the following outputs are attached to the action
- Name
tx_hash
- Description
The hash of the transaction.
Example using deploy_contract
action "my_contract" "evm::deploy_contract" {
contract = evm::get_contract_from_foundry_project("MyContract")
signer = signer.deployer
}
verify_contract
The evm::verify_contract
is coming soon. This action sends the required contract deployment artifacts to a block explorer to verify the contract with the explorer.
Inputs
- Name
block_explorer_api_key
- Type
- required
- Description
The URL of the block explorer used to verify the contract.
- Name
contract_address
- Type
- required
- Description
The contract address to verify.
- Name
artifacts
- Type
- required
- Description
An object containing the deployment artifacts. Schema:
{ "abi": String, "bytecode": String, "source": String, "compiler_version": String, "contract_name": String, "optimizer_enabled": Bool, "optimizer_runs": UInt, "evn_version": String }
Outputs
When the verify_contract
action is successfully executed, the following outputs are attached to the action
- Name
result
- Description
The contract verification result.
Example using verify_contract
action "verify_contract" "evm::verify_contract" {
contract_address = evm::address(env.MY_CONTRACT_ADDRESS)
artifacts = action.artifacts
}
check_confirmations
The evm::check_confirmations
action polls the network until the provided tx_hash
has been confirmed by confirmations
blocks.
Inputs
- Name
tx_hash
- Type
- required
- Description
The transaction hash to check.
- Name
rpc_api_url
- Type
- required
- Description
The URL of the EVM API used to poll for the transaction's inclusion in a block.
- Name
chain_id
- Type
- required
- Description
The chain ID of the network to check the transaction on.
- Name
confirmations
- Type
- optional
- Description
Once the transaction is included on a block, the number of blocks to await before the transaction is considered successful and Runbook execution continues. The default is 1.
Outputs
When the check_confirmations
action is successfully executed, the following outputs are attached to the action
- Name
contract_address
- Description
The contract address from the transaction receipt.
Example using check_confirmations
action "confirm_deployment" "evm::check_confirmations" {
tx_hash = action.some_deploying_action.tx_hash
}
sign_transaction
The evm::sign_transaction
command signs an EVM transaction.
Inputs
- Name
description
- Type
- optional
- Description
A description of the transaction
- Name
transaction_payload_bytes
- Type
- required
- Description
The unsigned transaction payload bytes.
- Name
signer
- Type
- required
- Description
A reference to a signer construct, which will be used to sign the transaction payload.
Outputs
When the sign_transaction
action is successfully executed, the following outputs are attached to the action
- Name
tx_hash
- Description
The hash of the transaction.
Example using sign_transaction
action "signed_tx" "evm::sign_transaction" {
description = "Deploy a new contract"
transaction_payload_bytes = "0x1234567890abcdef"
signer = signer.operator
}
deploy_contract_create2
The evm::deploy_contract_create2
action deploys an EVM contract using a Create2 proxy contract.
The Create2 proxy contract is used to deploy the contract at a deterministic address based on the contract's bytecode and the salt value.
If the contract has already been deployed, the action will not deploy it again.
By default, Foundry's factory contract (0x4e59b44847b379578588920cA78FbF26c0B4956C
) is used.
Inputs
- Name
description
- Type
- optional
- Description
A description of the transaction
- Name
rpc_api_url
- Type
- optional
- Description
The URL of the EVM API used to broadcast the transaction.
- Name
signer
- Type
- required
- Description
A reference to a signer construct, which will be used to sign the transaction.
- Name
create2_factory_address
- Type
- optional
- Description
To deploy the contract with an alternative factory, provide the address of the factory contract.
- Name
create2_factory_abi
- Type
- optional
- Description
The ABI of the alternative create2 factory contract, optionally used to check input arguments before sending the transaction to the chain.
- Name
create2_factory_function_name
- Type
- optional
- Description
If an alternative create2 factory is used, the name of the function to call.
- Name
create2_factory_function_args
- Type
- optional
- Description
If an alternative create2 factory is used, the arguments to pass to the function.
- Name
amount
- Type
- optional
- Description
The amount, in WEI, to send with the deployment.
- Name
type
- Type
- optional
- Description
The transaction type. Options are 'Legacy', 'EIP2930', 'EIP1559', 'EIP4844'. The default is 'EIP1559'.
- Name
max_fee_per_gas
- Type
- optional
- Description
Sets the max fee per gas of an EIP1559 transaction. This value will be retrieved from the network if omitted.
- Name
max_priority_fee_per_gas
- Type
- optional
- Description
Sets the max priority fee per gas of an EIP1559 transaction. This value will be retrieved from the network if omitted.
- Name
chain_id
- Type
- optional
- Description
The chain id.
- Name
nonce
- Type
- optional
- Description
The account nonce of the signer. This value will be retrieved from the network if omitted.
- Name
gas_limit
- Type
- optional
- Description
Sets the maximum amount of gas that should be used to execute this transaction. This value will be retrieved from the network if omitted.
- Name
gas_price
- Type
- optional
- Description
Sets the gas price for Legacy transactions. This value will be retrieved from the network if omitted.
- Name
contract
- Type
- required
- Description
The contract to deploy. At a minimum, this should be an object with a key
bytecode
and the contract bytecode. The abi field can also be provided to add type checking for the constructor arguments. Theevm::get_contract_from_foundry_project
andevm::get_contract_from_hardhat_project
functions can be used to retrieve the contract object.
- Name
constructor_args
- Type
- optional
- Description
The optional constructor arguments for the deployed contract.
- Name
expected_contract_address
- Type
- optional
- Description
The contract address that the deployment should yield. If the deployment does not yield this address, the action will fail. If this field is omitted, the any deployed address will be accepted.
- Name
salt
- Type
- optional
- Description
The salt value used to calculate the contract address. This value must be a 32-byte hex string.
- Name
confirmations
- Type
- optional
- Description
Once the transaction is included on a block, the number of blocks to await before the transaction is considered successful and Runbook execution continues. The default is 1.
- Name
verify
- Type
- optional
- Description
Coming soon.
- Name
block_explorer_api_key
- Type
- optional
- Description
Coming soon.
Outputs
When the deploy_contract_create2
action is successfully executed, the following outputs are attached to the action
- Name
tx_hash
- Description
The hash of the transaction.
- Name
contract_address
- Description
The address of the deployed transaction.
Example using deploy_contract_create2
action "my_contract" "evm::deploy_contract_create2" {
contract = evm::get_contract_from_foundry_project("MyContract")
salt = "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
signer = signer.deployer
}