ASIP-2: Safe Trustless Smart Contract ASC20-Token Escrow

This ASIP is LIVE

Specification

Add a new smart contract event into the Avascriptions Protocol:

event avascriptions_protocol_TransferASC20TokenForListing(
    address indexed from,
    address indexed to,
    bytes32 id
);

Event signature:

// "0xe2750d6418e3719830794d3db788aa72febcd657bcd18ed8f1facdbf61a69a9a"
keccak256("avascriptions_protocol_TransferASC20TokenForListing(address,address,bytes32)")

When a contract emits this event, the protocol should register a valid ASC-20 tokens transfer from the emitting contract to recipient, provided:

  1. from: the address of the user who initiated the valid list.

  2. to: the address of the token recipient.

  3. id: the avasription ID of the listing transaction.

After receiving this event, the indexer needs to retrieve corresponding information from the previously recorded list avascription. It's necessary to verify whether the contract address and the initiator's address match the previously recorded listing. If they match, the ASC-20 tokens are transferred according to the tick and amount information recorded in the listing.

Rationale

ASIP-2 is primarily designed to facilitate secure escrowing of ASC-20 tokens by smart contracts.

The concept of smart contract escrow involves sending ASC-20 tokens to a smart contract, where the tokens are owned by the contract, yet the sender retains certain control over them—usually the ability to withdraw them or direct the smart contract to transfer them to another party.

Marketplaces represent a prevalent use case for smart contract ASC-20 token escrows. Presently, individuals cannot grant smart contracts permission to transfer their ASC-20 tokens. Therefore, to list an ASC-20 token for sale, it must first be transferred to the marketplace contract.

While the introduction of avascriptions_protocol_TransferASC20Token in ASIP-1 grants smart contracts the capability to send and receive ASC-20 tokens and function as marketplaces or escrows, ASIP-1 alone doesn't equip smart contracts with the necessary information to operate securely as escrows without additional assistance.

The aim of ASIP-2 is to empower smart contracts to overcome this limitation.

Last updated