For the complete documentation index, see llms.txt. This page is also available as Markdown.

KAP-1155

The following standard outlines a smart contract interface that can represent any number of fungible and non-fungible token types on KUB. This multi-token standard supports an adminTransfer function designed to create transactions on behalf of NFT holders if they have been a victim of a fraudulent transaction. It is proposed by deriving the ERC-1155 standard of Ethereum with additional functions related to adminTransfer.

The id argument contained in each function's argument set indicates a specific token or token type in a transaction.

Token Interface

IAdminProjectRouter

isSuperAdmin

Check whether _addr is the Super Admin role in _project.

function isSuperAdmin(address _addr, string calldata _project) external view returns (bool)

isAdmin

Check whether _addr is the Admin role in _project.

function isAdmin(address _addr, string calldata _project) external view returns (bool)

IKYCBitkubChain

kycsLevel

Returns the KYC Level of _addr.

function kycsLevel(address _addr) external view returns (uint256)

setKycCompleted

Set the KYC Level _level of _addr.

IKAP165

supportsInterface

Check whether the contract implements interfaceID, and interfaceID is not 0xffffffff.

  • MUST return the constant value true if 0x01ffc9a7 is passed through the interfaceID argument. This signifies KAP-165 support.

  • MUST return the constant value true if 0x4e2312e0 is passed through the interfaceID argument. This signifies KAP-1155 IKAP1155Receiver support.

IKAP1155

balanceOf

Return the balance of account by id token ID.

balanceOfBatch

Returns multiple balances of accounts by id token ID.

setApprovalForAll

Enable or disable approval for a third party operator to manage all of msg.sender's assets.

approve true if the operator is approved, false to revoke approval.

Emits the ApprovalForAll event. The contract MUST allow multiple operators per owner.

isApprovedForAll

Check whether operator is an approved operator for owner.

NOTE: Query if an address operator is an authorized operator for another address owner.

adminTransfer

Transfers amount amount of id token ID from the sender address to the recipient address specified, and MUST fire the TransferSingle event to reflect the balance change.

NOTE: This function can only be called by the Committee address required in the constructor. This function is designed to create transactions automatically on behalf of token holders if they have been a victim of a fraudulent transaction. This method works similarly to the safeTransferFrom method.

internalTransfer

Transfers amount amount of id token ID from the sender address to the recipient address internally and MUST fire the TransferSingle event to reflect the balance change.

The function SHOULD throw if the message caller's account balance for token id is lower than the amount sent. Tokens can be transferred between internal addresses that have completed KYC for both the address sender and the address recipient using the internalTransfer function.

NOTE: This function can only be called by the Super Admin and the Transfer Router.

externalTransfer

Transfers amount amount of id token ID from the sender address to the recipient address externally and MUST fire the TransferSingle event to reflect the balance change.

The function SHOULD throw if the message caller’s account balance for token id is lower than the amount sent. Tokens can be transferred between internal addresses that have completed KYC for both the address sender and the address recipient using the internalTransfer function.

NOTE: This function can only be called by the Super Admin and the Transfer Router.

safeTransferFrom

Transfers amount amount of an id token ID from the from address to the to address specified (with safety call). The caller must be approved to manage the token being transferred out of the from account.

  • MUST revert if to is the zero address.

  • MUST revert if balance of holder for token id is lower than the amount sent.

  • MUST revert on any other error.

  • MUST emit the TransferSingle event to reflect the balance change (see "Safe Transfer Rules" section of the standard).

After the above conditions are met, this function MUST check if to is a smart contract (code size > 0). If so, it MUST call onKAP1155Received on to and act appropriately.

safeBatchTransferFrom

Transfers amounts amount of ids token ID from the from address to the to address specified (with safety call). The caller must be approved to manage the tokens being transferred out of the from account.

  • MUST revert if to is the zero address.

  • MUST revert if the length of ids is not the same as the length of amounts.

  • MUST revert if any of the balance(s) of the holder(s) for token(s) in ids is lower than the respective amount(s) in amounts sent to the recipient.

  • MUST revert on any other error.

  • MUST emit TransferSingle or TransferBatch event(s) such that all the balance changes are reflected (see "Safe Transfer Rules" section of the standard).

Balance changes and events MUST follow the ordering of the arrays ( ids[0]/ amounts[0] before ids[1]/ amounts[1], etc).

After the above conditions for the transfer(s) in the batch are met, this function MUST check if to is a smart contract (code size > 0). If so, it MUST call the relevant IKAP1155Receiver hook(s) on to and act appropriately (see "Safe Transfer Rules" section of the standard).

Events

TransferSingle

Either TransferSingle or TransferBatch MUST emit when tokens are transferred, including zero value transfers as well as minting or burning.

The operator MUST be the address of an account/contract that is approved to make the transfer (SHOULD be msg.sender).

The from MUST be the address of the holder whose balance is decreased.

The to MUST be the address of the recipient whose balance is increased.

The id MUST be the token type being transferred.

The value MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by.

When minting/creating tokens, the from argument MUST be set to 0x0 (zero address).

When burning/destroying tokens, the to argument MUST be set to 0x0 (zero address).

TransferBatch

Either TransferSingle or TransferBatch MUST emit when tokens are transferred, including zero value transfers as well as minting or burning.

The operator MUST be the address of an account/contract that is approved to make the transfer (SHOULD be msg.sender).

The from MUST be the address of the holder whose balance is decreased.

The to MUST be the address of the recipient whose balance is increased.

The ids MUST be the list of tokens being transferred.

The values MUST be the list of numbers of tokens (matching the list and order of tokens specified in ids) the holder balance is decreased by and match what the recipient's balance is increased by.

When minting/creating tokens, the from argument MUST be set to 0x0 (zero address).

When burning/destroying tokens, the to argument MUST be set to 0x0 (zero address).

ApprovalForAll

This event MUST be emitted when approval for an operator address to manage all tokens for an account address is enabled or disabled (absence of an event assumes disabled).

URI

This event MUST be emitted when the URI is updated for a token ID. URIs are defined in RFC 3986. The URI MUST point to a JSON file that conforms to the "KAP1155 Metadata URI JSON Schema".

IKAP1155Receiver

onKAP1155Received

Handle the receipt of a single KAP1155 token type. A KAP1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a safeTransferFrom after the balance has been updated.

This function MUST return bytes4(keccak256("onKAP1155Received(address,address,uint256,uint256,bytes)")) (i.e. 0xf23a6e61) if it accepts the transfer.

This function MUST revert if it rejects the transfer.

Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller.

onKAP1155BatchReceived

Handle the receipt of multiple KAP1155 token types. A KAP1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a safeBatchTransferFrom after the balances have been updated.

This function MUST return bytes4(keccak256("onKAP1155BatchReceived(address,address,uint256[],uint256[],bytes)")) (i.e. 0xbc197c81) if it accepts the transfer(s).

This function MUST revert if it rejects the transfer(s).

Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller.

IKAP1155Metadata

name

A descriptive name for a collection of tokens in this contract.

symbol

An abbreviated name for tokens in this contract.

uri

A distinct Uniform Resource Identifier (URI) for a given asset.

throw if tokenID is not a valid token. URIs are defined in RFC 3986. The URI may point to a JSON file that conforms to the “KAP1155 Metadata JSON Schema”.

kapURI

A distinct Uniform Resource Identifier (URI) for a given asset that is kept in the IPFS service.

throw if tokenID is not a valid token. URIs are defined in RFC 3986. The URI may point to a JSON file that conforms to the “KAP1155 Metadata JSON Schema”.

IKAP1155Enumerable

totalSupply

Returns a count of valid tokens tracked by this contract, where each one of them has an assigned and queryable owner not equal to the zero address.

Last updated