Skip to main content
Version: v6

Metadata Title Picture

"All" ABI Mode

The "all" ABI mode is declared in the contract's manifest file (i.e. the Cargo.toml file) as follows:

[package.metadata.ink-lang]
abi = "all"

When the "all" ABI is specified, the ink! code generator follows both the ink! and Solidity ABI specifications, and generates entry points for both calling conventions. This means:

  • For each message, two selectors are generated, one for ink! and another for Solidity ABI.
  • Each selector is ABI specific and its entry point uses the corresponding input/output encoding/decoding scheme (i.e. entry points for ink! selectors use Parity's SCALE Codec, while entry points for Solidity selectors use Solidity ABI encoding/decoding for input/output encoding/decoding).
  • Message selector manual overrides (using the selector attribute) are respected for ink! ABI entry points but ignored for Solidity ABI entry points (i.e. Solidity selectors are always generated according to the Solidity ABI specification for function selectors).
  • Multiple constructors are supported (as per the ink! ABI), however, if multiple constructors are defined, then one of the constructors must be annotated with the default attribute to identify it as the constructor to use for Solidity ABI encoded instantiation. Note that if only a single constructor is defined, then the default attribute annotation is unnecessary.
  • Generated call builders (and contract references) support both ink! and Solidity ABI calling conventions, by accepting an ABI marker type (i.e. ink::abi::Ink or ink::abi::Sol) as a generic type parameter which specifies the ABI specification to use for calls.
note

Your contract sizes will get larger if you support both the ink! and Solidity ABI.

note

The "all" ABI mode can only be used if all message argument and return types, the argument and return type of the constructor used for Solidity ABI encoded instantiation, and event argument types can be mapped to equivalent Solidity ABI types (more details here).