Skip to main content

SFT (ERC-1155)

Pallet Precompile

Use this precompile to interact with the sft runtime pallet to create an ERC-1155 collection.

Contract Address

0x00000000000000000000000000000000000006c3

Solidity Interfaces

interface TRNSFT is IERC165 {
event InitializeSftCollection(address indexed collectionOwner, address indexed precompileAddress);

function initializeCollection(address owner, bytes calldata name, bytes calldata metadataPath, address[] calldata royaltyAddresses, uint32[] calldata royaltyEntitlements) external returns (address, uint32);
}

Token Precompile

Contract Address

The ERC-1155 contract address for The Root Network native semi-fungible tokens uses the following format:

0xBBBBBBBB[4-byte-collection-id]000000000000000000000000
tip

To make things easier, the @therootnetwork/evm provides a handy function to convert token asset ID to its equivalent contract address.

import { collectionIdToERC1155Address } from "@therootnetwork/evm";

const COLLECTION_ID = 1;
const COLLECTION_CONTRACT_ADDRESS = collectionIdToERC1155Address(COLLECTION_ID);

Solidity Interfaces

interface IERC1155 is IERC165 {
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values);
event ApprovalForAll(address indexed account, address indexed operator, bool approved);

function balanceOf(address owner, uint256 id) external view returns (uint256);
function balanceOfBatch(address[] calldata owners, uint256[] calldata ids) external view returns (uint256[] memory);
function setApprovalForAll(address operator, bool approved) external;
function isApprovedForAll(address account, address operator) external view returns (bool);
function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;
function safeBatchTransferFrom(address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data) external;
}
interface IERC1155Burnable is IERC1155 {
function burn(address account, uint256 id, uint256 value) external;
function burnBatch(address account, uint256[] calldata ids, uint256[] calldata values) external;
}
interface IERC1155Supply is IERC1155 {
function totalSupply(uint256 id) external view returns (uint256);
function exists(uint256 id) external view returns (bool);
}
interface IERC1155MetadataURI is IERC1155 {
function uri(uint256 id) external view returns (string memory);
}
interface TRN1155 is IERC165 {
event TokenCreated(uint32 indexed serialNumber);
event MaxSupplyUpdated(uint128 indexed maxSupply);
event BaseURIUpdated(string baseURI);

function createToken(bytes calldata name, uint128 initialIssuance, uint128 maxIssuance, address tokenOwner) external returns (uint32);
function mint(address owner, uint256 id, uint256 amount) external;
function mintBatch(address owner, uint256[] calldata ids, uint256[] calldata amounts) external;
function setMaxSupply(uint256 id, uint32 maxSupply) external;
function setBaseURI(bytes calldata baseURI) external;
}
interface Ownable is IERC165 {
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

function owner() external view returns (address);
function renounceOwnership() external;
function transferOwnership(address owner) external;
}