ZTP-165

Introduction

What is the Protocol ZTP-165

ZTP165 provides a protocol standard similar to ZEP165 and ERC165 for detecting smart contract interfaces on the ZTP blockchain. It specifies how smart contracts can declare and validate their supported interfaces, ensuring compatibility and ease of integration between different smart contracts.

The ZTP165 standard introduces a way for contracts on the ZTP blockchain to explicitly declare the interfaces they support. This allows other contracts to interact seamlessly with them, by querying supported interfaces and adjusting their functionality accordingly.

Protocol Overview

Interface Function

Contracts implementing ZTP165 must include the following function:

const IZEP165 = {
  supportsInterface: function() {
    return this;
  }
};

Support Interface Function

this.supportsInterface = function(interfaceId) {
    let iface1 = Utils.sha256(JSON.stringify(IZEP165), 1);
    let iface2 = Utils.sha256(JSON.stringify(IOptimismMintableZTP20), 1);
    return interfaceId === iface1 || interfaceId === iface2;
};

Support Interface Validation in Init Function

Usage

Full ZTP-165 contract example:

Last updated