SABT

This Solidity smart contract defines a standard Account Bound Token (SABT) contract. Let's break down the variables, events, functions, and internal functions present in this contract:

State Variables

NameTypeVisibility

membership

address

Public

metadata

address

Public

index

uint32

Public

metaIds

mapping(uint32 => uint16)

Private

Modifiers

onlyRole

Restricts the execution of a function to only accounts that have a specific role assigned.

Functions

constructor

Initializes the SABT contract and sets the deployer as the default admin role.

initialize

Initializes the SABT contract with the provided membership and metadata contract addresses.

Parameters

ParameterTypeDescription

membership_

address

The address of the membership contract.

metadata_

address

The address of the metadata contract.

mint

Mints a new SABT token for a specified membership.

Parameters

ParameterTypeDescription

to_

address

The address to mint the token to.

metaId_

uint16

The ID of the token to mint.

Returns the UID (unique identifier) of the minted token.

meta

Retrieves the metadata of a token by its meta ID.

Parameters

ParameterTypeDescription

metaId_

uint16

The meta ID of the token.

Returns the metadata of the token.

metaId

Retrieves the meta ID of a membership token by its UID.

Parameters

ParameterTypeDescription

uid_

uint32

The UID of the membership token.

Returns the meta ID of the membership token.

setMetaId

Sets the meta ID of a membership token.

Parameters

ParameterTypeDescription

uid_

uint32

The UID of the membership token.

metaId_

uint16

The new meta ID for the membership token.

transfer

Transfers a token from the sender to the specified address.

Parameters

ParameterTypeDescription

_to

address

The address to transfer the token to.

_id

uint256

The ID of the token to transfer.

supportsInterface

Checks if a contract supports a specific interface.

Parameters

ParameterTypeDescription

interfaceId

bytes4

The interface ID to check.

Returns true if the contract supports the interface; otherwise, false.

Last updated