Skip to main content

CLBTokenLib.sol

CLBTokenLib

Provides utility functions for working with CLB tokens.

encodeId

function encodeId(int16 tradingFeeRate) internal pure returns (uint256)

Encode the CLB token ID of ERC1155 token type

If tradingFeeRate is negative, it adds DIRECTION_PRECISION to the absolute fee rate. Otherwise it returns the fee rate directly.

  • Return Values:

    NameTypeDescription
    [0]uint256id The ID of ERC1155 token

decodeId

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

Decode the trading fee rate from the CLB token ID of ERC1155 token type

If id is greater than or equal to DIRECTION_PRECISION, then it substracts DIRECTION_PRECISION from id and returns the negation of the substracted value. Otherwise it returns id directly.

  • Return Values:

    NameTypeDescription
    tradingFeeRateint16The trading fee rate

tradingFeeRates

function tradingFeeRates() internal pure returns (uint16[36])

Retrieves the array of supported trading fee rates.

This function returns the array of supported trading fee rates, ranging from the minimum fee rate to the maximum fee rate with step increments.

  • Return Values:

    NameTypeDescription
    [0]uint16[36]tradingFeeRates The array of supported trading fee rates.

feeRateIndex

function feeRateIndex(uint16 feeRate) internal pure returns (uint256)

tokenIds

function tokenIds() internal pure returns (uint256[])