Skip to main content

CLBToken.sol

CLBToken

CLBToken is an ERC1155 token contract that represents Liquidity Bin tokens. CLBToken allows minting and burning of tokens by the Chromatic Market contract.

market

contract IChromaticMarket market

OnlyAccessableByMarket

error OnlyAccessableByMarket()

Throws an error indicating that the caller is not a registered market.

onlyMarket

modifier onlyMarket()

Modifier to restrict access to the Chromatic Market contract. Only the market contract is allowed to call functions with this modifier. Reverts with an error if the caller is not the market contract.

constructor

constructor() public

Initializes the CLBToken contract. The constructor sets the market contract address as the caller.

decimals

function decimals() public view returns (uint8)

Retrieves the number of decimals used for token amounts.

  • Return Values:

    NameTypeDescription
    [0]uint8The number of decimals used for token amounts.

totalSupply

function totalSupply(uint256 id) public view virtual returns (uint256)

Total amount of tokens in with a given id.

  • Parameters:

    NameTypeDescription
    iduint256The token ID for which to retrieve the total supply.
  • Return Values:

    NameTypeDescription
    [0]uint256The total supply of tokens for the given token ID.

totalSupplyBatch

function totalSupplyBatch(uint256[] ids) public view virtual returns (uint256[])

Total amounts of tokens in with the given ids.

  • Parameters:

    NameTypeDescription
    idsuint256[]The token IDs for which to retrieve the total supply.
  • Return Values:

    NameTypeDescription
    [0]uint256[]The total supples of tokens for the given token IDs.

mint

function mint(address to, uint256 id, uint256 amount, bytes data) external

This function can only be called by the Chromatic Market contract.

  • Parameters:

    NameTypeDescription
    toaddressThe address to which the minted tokens will be assigned.
    iduint256The token ID to mint.
    amountuint256The amount of tokens to mint.
    databytesAdditional data to pass during the minting process.

burn

function burn(address from, uint256 id, uint256 amount) external

This function can only be called by the Chromatic Market contract.

  • Parameters:

    NameTypeDescription
    fromaddressThe address from which to burn tokens.
    iduint256The token ID to burn.
    amountuint256The amount of tokens to burn.

name

function name(uint256 id) public view returns (string)

Retrieves the name of a token.

  • Parameters:

    NameTypeDescription
    iduint256The token ID for which to retrieve the name.
  • Return Values:

    NameTypeDescription
    [0]stringThe name of the token.

description

function description(uint256 id) public view returns (string)

Retrieves the description of a token.

  • Parameters:

    NameTypeDescription
    iduint256The token ID for which to retrieve the description.
  • Return Values:

    NameTypeDescription
    [0]stringThe description of the token.

image

function image(uint256 id) public view returns (string)

Retrieves the image URI of a token.

  • Parameters:

    NameTypeDescription
    iduint256The token ID for which to retrieve the image URI.
  • Return Values:

    NameTypeDescription
    [0]stringThe image URI of the token.

uri

function uri(uint256 id) public view returns (string)

_Returns the URI for token type id.

If the \{id\} substring is present in the URI, it must be replaced by clients with the actual token type ID._

decodeId

function decodeId(uint256 id) internal pure returns (int16 tradingFeeRate)

Decodes a token ID into a trading fee rate.

  • Parameters:

    NameTypeDescription
    iduint256The token ID to decode.
  • Return Values:

    NameTypeDescription
    tradingFeeRateint16The decoded trading fee rate.