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
Name | Type | Visibility |
---|---|---|
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
Parameter | Type | Description |
---|---|---|
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
Parameter | Type | Description |
---|---|---|
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
Parameter | Type | Description |
---|---|---|
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
Parameter | Type | Description |
---|---|---|
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
Parameter | Type | Description |
---|---|---|
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
Parameter | Type | Description |
---|---|---|
_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
Parameter | Type | Description |
---|---|---|
interfaceId | bytes4 | The interface ID to check. |
Returns true if the contract supports the interface; otherwise, false.
Last updated