ERC-1363 (Payable Tokens)

The ERC-1363 standard, also known as the payable token standard, is an upgrade to ERC-20 tokens. While ERC-20 tokens can only be sent from one person to another, ERC-1363 tokens can trigger actions in a smart contract immediately after being sent or approved for spending.

For example, if you use one of these tokens to pay for a subscription, the contract can instantly recognize the payment and activate your subscription with no extra steps. This makes the standard useful for quick transactions like buying services, paying invoices, or managing subscriptions, all in one easy step.

Note: Hedera’s system contract functions do not natively support ERC-1363 functionalities on HTS tokens. However, standard ERC-1363 functions can still be implemented within a smart contract and deployed on the network, similar to other EVM-compatible chains.

Interface ERC-1363 Functions

transferAndCall
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

Transfers tokens and calls a function on the recipient contract in a single transaction.

approveAndCall
function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);

Additional References

For a more in-depth understanding, please see the below links:

1. Function Implementations and Interactions

  • ERC-1363 Interface Specification: Description: This section defines the ERC1363 interface, detailing functions like transferAndCall and approveAndCall, and explains how they interact with recipient contracts. Link: ERC-1363 Interface Specification

2. Supporting Contracts

  • IERC1363Receiver Interface: Description: Defines the interface for contracts that want to handle incoming token transfers, specifying the onTransferReceived function. Link: IERC1363Receiver Interface

  • IERC1363Spender Interface: Description: Specifies the interface for contracts that intend to handle token approvals, detailing the onApprovalReceived function. Link: IERC1363Spender Interface

3. Token Logic Examples

  • ERC-1363 Reference Implementation: Description: Provides a comprehensive implementation of the ERC-1363 standard, including how token transfers and approvals are handled with immediate contract interactions. Link: ERC-1363 Reference Implementation

4. ERC-165 Compliance

  • ERC-165 Standard Overview: Description: Offers an understanding of the ERC-165 standard, which ERC-1363 utilizes to ensure recipient contracts implement the necessary interfaces. ERC-165 compliance is essential because it allows contracts to query whether a recipient implements required functions like onTransferReceived or onApprovalReceived, ensuring seamless interaction and preventing errors. Link: ERC-165 Standard Overview

5. Practical Examples

  • ERC1363Payable Contract Example: Description: An example contract demonstrating how to accept ERC-1363 token transfers and approvals, including handling the onTransferReceived and onApprovalReceived functions. Link: ERC1363Payable Contract Example


Contributor: @sumanair

Last updated

Was this helpful?