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
membership
address
Public
metadata
address
Public
index
uint32
Public
metaIds
mapping(uint32 => uint16)
Private
Modifiers
onlyRole
onlyRole
Restricts the execution of a function to only accounts that have a specific role assigned.
Functions
constructor
constructor
Initializes the SABT contract and sets the deployer as the default admin role.
initialize
initialize
Initializes the SABT contract with the provided membership and metadata contract addresses.
Parameters
membership_
address
The address of the membership contract.
metadata_
address
The address of the metadata contract.
mint
mint
Mints a new SABT token for a specified membership.
Parameters
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
meta
Retrieves the metadata of a token by its meta ID.
Parameters
metaId_
uint16
The meta ID of the token.
Returns the metadata of the token.
metaId
metaId
Retrieves the meta ID of a membership token by its UID.
Parameters
uid_
uint32
The UID of the membership token.
Returns the meta ID of the membership token.
setMetaId
setMetaId
Sets the meta ID of a membership token.
Parameters
uid_
uint32
The UID of the membership token.
metaId_
uint16
The new meta ID for the membership token.
transfer
transfer
Transfers a token from the sender to the specified address.
Parameters
_to
address
The address to transfer the token to.
_id
uint256
The ID of the token to transfer.
supportsInterface
supportsInterface
Checks if a contract supports a specific interface.
Parameters
interfaceId
bytes4
The interface ID to check.
Returns true if the contract supports the interface; otherwise, false.
Last updated