Skip to main content

SolCall

Trait SolCall 

Source
pub trait SolCall: Sized {
    type Parameters<'a>: SolType<Token<'a> = Self::Token<'a>>;
    type Token<'a>: TokenSeq<'a>;
    type Return;
    type ReturnTuple<'a>: SolType<Token<'a> = Self::ReturnToken<'a>>;
    type ReturnToken<'a>: TokenSeq<'a>;

    const SIGNATURE: &'static str;
    const SELECTOR: [u8; 4];
Show 14 methods // Required methods fn new(tuple: <Self::Parameters<'_> as SolType>::RustType) -> Self; fn tokenize(&self) -> Self::Token<'_>; fn tokenize_returns(ret: &Self::Return) -> Self::ReturnToken<'_>; fn abi_decode_returns(data: &[u8]) -> Result<Self::Return, Error>; fn abi_decode_returns_validate(data: &[u8]) -> Result<Self::Return, Error>; // Provided methods fn abi_encoded_size(&self) -> usize { ... } fn abi_decode_raw(data: &[u8]) -> Result<Self, Error> { ... } fn abi_decode_raw_validate(data: &[u8]) -> Result<Self, Error> { ... } fn abi_decode(data: &[u8]) -> Result<Self, Error> { ... } fn abi_decode_validate(data: &[u8]) -> Result<Self, Error> { ... } fn abi_encode_raw(&self, out: &mut Vec<u8>) { ... } fn abi_encode(&self) -> Vec<u8> { ... } fn abi_encode_returns(ret: &Self::Return) -> Vec<u8> { ... } fn abi_encode_returns_tuple<'a, E>(e: &'a E) -> Vec<u8> where E: SolTypeValue<Self::ReturnTuple<'a>> { ... }
}
Expand description

Re-exported alloy ABI types for use with generated calls. A Solidity function call.

§Implementer’s Guide

It should not be necessary to implement this trait manually. Instead, use the sol! procedural macro to parse Solidity syntax into types that implement this trait.

Required Associated Constants§

Source

const SIGNATURE: &'static str

The function’s ABI signature.

Source

const SELECTOR: [u8; 4]

The function selector: keccak256(SIGNATURE)[0..4]

Required Associated Types§

Source

type Parameters<'a>: SolType<Token<'a> = Self::Token<'a>>

The underlying tuple type which represents this type’s arguments.

If this type has no arguments, this will be the unit type ().

Source

type Token<'a>: TokenSeq<'a>

The arguments’ corresponding TokenSeq type.

Source

type Return

The function’s return struct.

Source

type ReturnTuple<'a>: SolType<Token<'a> = Self::ReturnToken<'a>>

The underlying tuple type which represents this type’s return values.

If this type has no return values, this will be the unit type ().

Source

type ReturnToken<'a>: TokenSeq<'a>

The returns’ corresponding TokenSeq type.

Required Methods§

Source

fn new(tuple: <Self::Parameters<'_> as SolType>::RustType) -> Self

Convert from the tuple type used for ABI encoding and decoding.

Source

fn tokenize(&self) -> Self::Token<'_>

Tokenize the call’s arguments.

Source

fn tokenize_returns(ret: &Self::Return) -> Self::ReturnToken<'_>

Tokenize the call’s return values.

Source

fn abi_decode_returns(data: &[u8]) -> Result<Self::Return, Error>

ABI decode this call’s return values from the given slice.

Source

fn abi_decode_returns_validate(data: &[u8]) -> Result<Self::Return, Error>

ABI decode this call’s return values from the given slice, with validation.

This is the same as abi_decode_returns, but performs validation checks on the decoded return tuple.

Provided Methods§

Source

fn abi_encoded_size(&self) -> usize

The size of the encoded data in bytes, without its selector.

Source

fn abi_decode_raw(data: &[u8]) -> Result<Self, Error>

ABI decode this call’s arguments from the given slice, without its selector.

Source

fn abi_decode_raw_validate(data: &[u8]) -> Result<Self, Error>

ABI decode this call’s arguments from the given slice, without its selector, with validation.

This is the same as abi_decode_raw, but performs validation checks on the decoded parameters tuple.

Source

fn abi_decode(data: &[u8]) -> Result<Self, Error>

ABI decode this call’s arguments from the given slice, with the selector.

Source

fn abi_decode_validate(data: &[u8]) -> Result<Self, Error>

ABI decode this call’s arguments from the given slice, with the selector, with validation.

This is the same as abi_decode, but performs validation checks on the decoded parameters tuple.

Source

fn abi_encode_raw(&self, out: &mut Vec<u8>)

ABI encode the call to the given buffer without its selector.

Source

fn abi_encode(&self) -> Vec<u8>

ABI encode the call to the given buffer with its selector.

Source

fn abi_encode_returns(ret: &Self::Return) -> Vec<u8>

ABI encode the call’s return value.

Source

fn abi_encode_returns_tuple<'a, E>(e: &'a E) -> Vec<u8>
where E: SolTypeValue<Self::ReturnTuple<'a>>,

ABI encode the call’s return values.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl SolCall for allowanceCall

Source§

const SIGNATURE: &'static str = "allowance(address,address)"

Source§

const SELECTOR: [u8; 4]

Source§

type Parameters<'a> = (Address, Address)

Source§

type Token<'a> = <<allowanceCall as SolCall>::Parameters<'a> as SolType>::Token<'a>

Source§

type Return = Uint<256, 4>

Source§

type ReturnTuple<'a> = (Uint<256>,)

Source§

type ReturnToken<'a> = <<allowanceCall as SolCall>::ReturnTuple<'a> as SolType>::Token<'a>

Source§

impl SolCall for approveCall

Source§

const SIGNATURE: &'static str = "approve(address,uint256)"

Source§

const SELECTOR: [u8; 4]

Source§

type Parameters<'a> = (Address, Uint<256>)

Source§

type Token<'a> = <<approveCall as SolCall>::Parameters<'a> as SolType>::Token<'a>

Source§

type Return = bool

Source§

type ReturnTuple<'a> = (Bool,)

Source§

type ReturnToken<'a> = <<approveCall as SolCall>::ReturnTuple<'a> as SolType>::Token<'a>

Source§

impl SolCall for balanceOfCall

Source§

const SIGNATURE: &'static str = "balanceOf(address)"

Source§

const SELECTOR: [u8; 4]

Source§

type Parameters<'a> = (Address,)

Source§

type Token<'a> = <<balanceOfCall as SolCall>::Parameters<'a> as SolType>::Token<'a>

Source§

type Return = Uint<256, 4>

Source§

type ReturnTuple<'a> = (Uint<256>,)

Source§

type ReturnToken<'a> = <<balanceOfCall as SolCall>::ReturnTuple<'a> as SolType>::Token<'a>

Source§

impl SolCall for decimalsCall

Source§

const SIGNATURE: &'static str = "decimals()"

Source§

const SELECTOR: [u8; 4]

Source§

type Parameters<'a> = ()

Source§

type Token<'a> = <<decimalsCall as SolCall>::Parameters<'a> as SolType>::Token<'a>

Source§

type Return = u8

Source§

type ReturnTuple<'a> = (Uint<8>,)

Source§

type ReturnToken<'a> = <<decimalsCall as SolCall>::ReturnTuple<'a> as SolType>::Token<'a>

Source§

impl SolCall for nameCall

Source§

const SIGNATURE: &'static str = "name()"

Source§

const SELECTOR: [u8; 4]

Source§

type Parameters<'a> = ()

Source§

type Token<'a> = <<nameCall as SolCall>::Parameters<'a> as SolType>::Token<'a>

Source§

type Return = String

Source§

type ReturnTuple<'a> = (String,)

Source§

type ReturnToken<'a> = <<nameCall as SolCall>::ReturnTuple<'a> as SolType>::Token<'a>

Source§

impl SolCall for symbolCall

Source§

const SIGNATURE: &'static str = "symbol()"

Source§

const SELECTOR: [u8; 4]

Source§

type Parameters<'a> = ()

Source§

type Token<'a> = <<symbolCall as SolCall>::Parameters<'a> as SolType>::Token<'a>

Source§

type Return = String

Source§

type ReturnTuple<'a> = (String,)

Source§

type ReturnToken<'a> = <<symbolCall as SolCall>::ReturnTuple<'a> as SolType>::Token<'a>

Source§

impl SolCall for totalSupplyCall

Source§

const SIGNATURE: &'static str = "totalSupply()"

Source§

const SELECTOR: [u8; 4]

Source§

type Parameters<'a> = ()

Source§

type Token<'a> = <<totalSupplyCall as SolCall>::Parameters<'a> as SolType>::Token<'a>

Source§

type Return = Uint<256, 4>

Source§

type ReturnTuple<'a> = (Uint<256>,)

Source§

type ReturnToken<'a> = <<totalSupplyCall as SolCall>::ReturnTuple<'a> as SolType>::Token<'a>

Source§

impl SolCall for transferCall

Source§

const SIGNATURE: &'static str = "transfer(address,uint256)"

Source§

const SELECTOR: [u8; 4]

Source§

type Parameters<'a> = (Address, Uint<256>)

Source§

type Token<'a> = <<transferCall as SolCall>::Parameters<'a> as SolType>::Token<'a>

Source§

type Return = bool

Source§

type ReturnTuple<'a> = (Bool,)

Source§

type ReturnToken<'a> = <<transferCall as SolCall>::ReturnTuple<'a> as SolType>::Token<'a>

Source§

impl SolCall for transferFromCall

Source§

const SIGNATURE: &'static str = "transferFrom(address,address,uint256)"

Source§

const SELECTOR: [u8; 4]

Source§

type Parameters<'a> = (Address, Address, Uint<256>)

Source§

type Token<'a> = <<transferFromCall as SolCall>::Parameters<'a> as SolType>::Token<'a>

Source§

type Return = bool

Source§

type ReturnTuple<'a> = (Bool,)

Source§

type ReturnToken<'a> = <<transferFromCall as SolCall>::ReturnTuple<'a> as SolType>::Token<'a>