Skip to content

Instantly share code, notes, and snippets.

@imqdee
Last active March 10, 2023 18:57
Show Gist options
  • Select an option

  • Save imqdee/26d7a2abc5ccc6b27e6502da29b81d44 to your computer and use it in GitHub Desktop.

Select an option

Save imqdee/26d7a2abc5ccc6b27e6502da29b81d44 to your computer and use it in GitHub Desktop.

Cast overview

Play with the following cast commands

  • Convert an UTF8 text to hexidecimal
  • Convert an ETH amount into wei
  • Convert wei into an ETH amount
  • Get the zero hash
  • Get the zero address
  • Get the maximum value of a uint256 type
  • Get the minimum value of a uint256 type
  • Parses a string from bytes32 encoding
  • Formats a string into bytes32 encoding
  • Convert hex data to an ASCII string
  • Convert an address to a checksummed format (EIP-55)
  • Right-pads hex data to 32 bytes
  • Get the function signatures for the given selector
  • Get the event signature for a given topic 0
  • Get the timestamp of a block
  • Get the balance of an account
  • Get information about a block
  • Get the latest block number
  • Get the Ethereum chain ID
  • Get the bytecode of a contract
  • Compute the contract address from a given nonce and deployer address
  • Estimate the gas cost of a transaction
  • Get the source code of a contract from Etherscan
  • Get the current gas price
  • Compute the storage slot for an entry in a mapping
  • Hash arbitrary data using keccak-256
  • Perform an ENS reverse lookup
  • Perform an ENS lookup
  • Get the nonce for an account
  • Pretty print calldata
  • Get the transaction receipt for a transaction
  • Runs a published transaction in a local environment and prints the trace
  • Sign and publish a transaction
  • Get the selector for a function
  • Get the raw value of a contract's storage slot
  • Get information about a transaction
  • Create a random keypair
  • Generate a vanity address
  •  Sign a message by passing manually a private key
  •  Sign a message using a ledger device
  • Verify the signature of a message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment