Skip to content

Latest commit

 

History

History
47 lines (31 loc) · 930 Bytes

cast-sig.md

File metadata and controls

47 lines (31 loc) · 930 Bytes

cast sig

NAME

cast-sig - Get the selector for a function.

SYNOPSIS

cast sig [options] sig

DESCRIPTION

Get the selector for a function.

The signature (sig) is a fragment in the form <function name>(<types...>).

OPTIONS

{{#include common-options.md}}

EXAMPLES

  1. Get the selector for the function transfer(address,uint256):

    cast sig "transfer(address,uint256)"
  2. Get the selector for a function that expects a struct:

    contract Test {
        struct MyStruct {
            address addr;
            uint256 amount;
        }
        function myfunction(MyStruct memory t) public pure {}
    }

    Structs are encoded as tuples (see struct encoding).

    cast sig "myfunction((address,uint256))"

SEE ALSO

cast, struct encoding