pub trait CustomInterchainTokenExecutable {
type Error: Into<Error>;
// Required methods
fn __interchain_token_service(env: &Env) -> Address;
fn __authorized_execute_with_token(
env: &Env,
source_chain: String,
message_id: String,
source_address: Bytes,
payload: Bytes,
token_id: BytesN<32>,
token_address: Address,
amount: i128,
) -> Result<(), Self::Error>;
}Expand description
This trait must be implemented by a contract to be compatible with the InterchainTokenExecutableInterface.
To make a contract executable by the interchain token service contract, it must implement the InterchainTokenExecutableInterface trait.
For security purposes and convenience, sender authorization and other commonly shared code necessary to implement that trait can be automatically generated with the InterchainTokenExecutable derive macro.
All parts that are specific to an individual ITS executable contract are collected in this CustomInterchainTokenExecutable trait and must be implemented by the contract to be compatible with the InterchainTokenExecutableInterface trait.
Do NOT add the implementation of CustomInterchainTokenExecutable to the public interface of the contract, i.e. do not annotate the impl block with #[contractimpl]
Required Associated Types§
Sourcetype Error: Into<Error>
type Error: Into<Error>
The type of error the CustomInterchainTokenExecutable::__authorized_execute_with_token function returns. Generally matches the error type of the whole contract.
Required Methods§
Sourcefn __interchain_token_service(env: &Env) -> Address
fn __interchain_token_service(env: &Env) -> Address
Returns the address of the interchain token service contract that is authorized to execute arbitrary payloads on this contract
The custom execution logic that takes in an arbitrary payload and a token. At the time this function is called, the calling address has already been verified as the correct interchain token service contract.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".