Ethereum and EVM Compatible Blockchains (beta) Actions

action

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

  • 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
}


action

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

  • 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
}


action

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

  • 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
}


action

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

  • Name
    contract_address
    Description

    The contract address from the transaction receipt.

  • Name
    logs
    Description

    The decoded contract logs from the transaction receipt.

Example using check_confirmations

action "confirm_deployment" "evm::check_confirmations" {
    tx_hash = action.some_deploying_action.tx_hash
}


action

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

  • 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
}


action

send_eth

The evm::send_eth is coming soon.

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
    recipient_address
    Type
    required
    Description

    The EVM address of the recipient.

  • Name
    amount
    Type
    optional
    Description

    The amount to send, in WEI (1 ETH = 10^18 WEI).

  • 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
    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

  • Name
    tx_hash
    Description

    The hash of the transaction.

Example using send_eth

// Coming soon


action

deploy_contract

The evm::deploy_contract is coming soon.

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
    chain_id
    Type
    optional
    Description

    The chain id.

  • Name
    signer
    Type
    required
    Description

    A reference to a signer construct, which will be used to sign the transaction.

  • 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. The evm::get_contract_from_foundry_project and evm::get_contract_from_hardhat_project functions can be used to retrieve the contract object.

  • Name
    initializer
    Type
    optional
    Description

    An optional array of initializer functions + arguments to call on the contract that is deployed to the proxy contract.

  • Name
    constructor_args
    Type
    optional
    Description

    The optional constructor arguments for the deployed contract.

  • Name
    create_opcode
    Type
    optional
    Description

    The create opcode to use for deployment. Options are 'create' and 'create2'. The default is 'create2'.

  • Name
    create2
    Type
    optional
    Description

    Options for deploying the contract with the CREATE2 opcode, overwriting txtx default options.

  • Name
    proxied
    Type
    optional
    Description

    Deploys the contract via a proxy contract. The default is false.

  • Name
    proxy
    Type
    optional
    Description

    Options for deploying the contract via a proxy contract, overwriting txtx default options.

  • 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
    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
    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
    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

  • Name
    tx_hash
    Description

    The hash of the transaction.

  • Name
    abi
    Description

    The deployed contract ABI, if it was provided as a contract input.

  • Name
    contract_address
    Description

    The address of the deployed transaction.

Example using deploy_contract

action "my_contract" "evm::deploy_contract" {
    contract = evm::get_contract_from_foundry_project("MyContract")
    signer = signer.deployer
    create2 {
        salt = "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
    }
}


Was this page helpful?