Skip to main content

IReceiptTokenManager

Git Source

Inherits: IERC6909, IERC6909Wrappable

Title: IReceiptTokenManager

Interface for the contract that creates and manages receipt tokens

Functions​

createToken​

Creates a new receipt token

The caller (msg.sender) becomes the owner of the token for security

function createToken(
IERC20 asset_,
uint8 depositPeriod_,
address operator_,
string memory operatorName_
) external returns (uint256 tokenId);

Parameters

NameTypeDescription
asset_IERC20The underlying asset
depositPeriod_uint8The deposit period
operator_addressThe operator address
operatorName_stringThe operator name for token metadata

Returns

NameTypeDescription
tokenIduint256The created token ID

mint​

Mints tokens to a recipient

Gated to the owner (creator) of the token

function mint(address to_, uint256 tokenId_, uint256 amount_, bool shouldWrap_) external;

Parameters

NameTypeDescription
to_addressThe recipient
tokenId_uint256The token ID
amount_uint256The amount to mint
shouldWrap_boolWhether to wrap as ERC20

burn​

Burns tokens from a holder

Gated to the owner (creator) of the token

function burn(address from_, uint256 tokenId_, uint256 amount_, bool isWrapped_) external;

Parameters

NameTypeDescription
from_addressThe holder
tokenId_uint256The token ID
amount_uint256The amount to burn
isWrapped_boolWhether the tokens are wrapped

getReceiptTokenId​

Generates a receipt token ID

function getReceiptTokenId(
address owner_,
IERC20 asset_,
uint8 depositPeriod_,
address operator_
) external pure returns (uint256 tokenId);

Parameters

NameTypeDescription
owner_addressThe owner address
asset_IERC20The asset
depositPeriod_uint8The deposit period
operator_addressThe operator

Returns

NameTypeDescription
tokenIduint256The generated token ID

getTokenName​

Returns the name of a receipt token

function getTokenName(uint256 tokenId_) external view returns (string memory name);

Parameters

NameTypeDescription
tokenId_uint256The ID of the receipt token

Returns

NameTypeDescription
namestringThe name of the receipt token

getTokenSymbol​

Returns the symbol of a receipt token

function getTokenSymbol(uint256 tokenId_) external view returns (string memory symbol);

Parameters

NameTypeDescription
tokenId_uint256The ID of the receipt token

Returns

NameTypeDescription
symbolstringThe symbol of the receipt token

getTokenDecimals​

Returns the decimals of a receipt token

function getTokenDecimals(uint256 tokenId_) external view returns (uint8 decimals);

Parameters

NameTypeDescription
tokenId_uint256The ID of the receipt token

Returns

NameTypeDescription
decimalsuint8The decimals of the receipt token

getTokenOwner​

Gets the owner of a token

function getTokenOwner(uint256 tokenId_) external view returns (address owner);

Parameters

NameTypeDescription
tokenId_uint256The token ID

Returns

NameTypeDescription
owneraddressThe token owner

getTokenAsset​

Gets the asset of a token

function getTokenAsset(uint256 tokenId_) external view returns (IERC20 asset);

Parameters

NameTypeDescription
tokenId_uint256The token ID

Returns

NameTypeDescription
assetIERC20The underlying asset

getTokenDepositPeriod​

Gets the deposit period of a token

function getTokenDepositPeriod(uint256 tokenId_) external view returns (uint8 depositPeriod);

Parameters

NameTypeDescription
tokenId_uint256The token ID

Returns

NameTypeDescription
depositPerioduint8The deposit period

getTokenOperator​

Gets the operator of a token

function getTokenOperator(uint256 tokenId_) external view returns (address operator);

Parameters

NameTypeDescription
tokenId_uint256The token ID

Returns

NameTypeDescription
operatoraddressThe operator address

Events​

TokenCreated​

event TokenCreated(
uint256 indexed tokenId,
address indexed owner,
address indexed asset,
uint8 depositPeriod,
address operator
);

Parameters

NameTypeDescription
tokenIduint256
owneraddress
assetaddress
depositPerioduint8
operatoraddress

Errors​

ReceiptTokenManager_TokenExists​

error ReceiptTokenManager_TokenExists(uint256 tokenId);

Parameters

NameTypeDescription
tokenIduint256

ReceiptTokenManager_NotOwner​

error ReceiptTokenManager_NotOwner(address caller, address owner);

Parameters

NameTypeDescription
calleraddress
owneraddress

ReceiptTokenManager_InvalidParams​

error ReceiptTokenManager_InvalidParams(string reason);

Parameters

NameTypeDescription
reasonstring