Skip to main content

interface_id

Function interface_id 

Source
pub fn interface_id(interface_name: Option<&str>, version_str: &str) -> [u8; 8]
Expand description

Derive the interface ID of an (interface name, version) pair: the identity of an interface at a major version, shared by every entrypoint the interface exports.

Truncated to 8 bytes exactly like contract_entrypoint_id, and for the same reason: the ID is a name, derived from (interface, MAJOR) that anyone may declare, so its width only has to keep honestly distinct interfaces apart, not resist an adversary. The preimage carries its own domain tag so an interface ID never collides with an entrypoint ID preimage. #[contract] emits it as Trait::INTERFACE_ID and <Iface>Entrypoints::INTERFACE_ID; thruput-erc165-if is the on-chain query surface for it.