TEA & APE Tokens
LP token (ERC1155) and leveraged token (ERC20) interfaces.
SIR Protocol uses two token types to represent positions:
TEA — an ERC1155 token representing LP positions. One token ID per vault, all managed by the Vault contract.
APE — a standard ERC20 token representing leveraged positions. One contract per vault, deployed as a minimal clone.
Minting and burning of both tokens happens through the Vault contract. The interfaces below cover transfers, approvals, and queries.
TEA (ERC1155 LP Token)
TEA is managed by the Vault contract (which inherits from TEA). Each vault has a unique token ID equal to its vaultId.
balanceOf
Returns the TEA balance of an account in a specific vault.
function balanceOf(address account, uint256 vaultId) public view returns (uint256)account
address
The account to query
vaultId
uint256
The vault (token ID) to query
balanceOfBatch
Returns TEA balances for multiple account/vault pairs in a single call.
owners
address[]
Array of accounts
vaultIds
uint256[]
Array of vault IDs (must match owners length)
totalSupply
Returns the total supply of TEA for a specific vault.
vaultId
uint256
The vault to query
lockEnd
Returns the timestamp when a user's TEA position in a vault becomes unlocked. Returns 0 if never locked.
account
address
The account to query
vaultId
uint256
The vault to query
paramsById
Returns the vault parameters for a given vault ID.
vaultId
uint48
The vault ID
Returns: VaultParameters — (debtToken, collateralToken, leverageTier).
numberOfVaults
Returns the total number of vaults that have been created.
uri
Returns the ERC1155 metadata URI for a vault. Returns a data: URL encoding a JSON object with name, symbol, decimals, chain ID, token addresses, leverage tier, and total supply.
vaultId
uint256
The vault to query
supportsInterface
ERC165 interface detection. Returns true for ERC165, ERC1155, and ERC1155MetadataURI.
safeTransferFrom
Transfers TEA from one account to another.
from
address
Sender address
to
address
Recipient address
vaultId
uint256
The vault (token ID)
amount
uint256
Amount of TEA to transfer
data
bytes
Additional data for onERC1155Received callback
On MegaETH, transfers will revert with
TransferToLowerLockEndif the sender's lock end timestamp exceeds the recipient's. This prevents circumventing lock periods by transferring to an unlocked wallet.
safeBatchTransferFrom
Batch transfers TEA across multiple vaults.
from
address
Sender address
to
address
Recipient address
vaultIds
uint256[]
Array of vault IDs
amounts
uint256[]
Array of amounts (must match vaultIds length)
data
bytes
Additional data for onERC1155BatchReceived callback
setApprovalForAll
Grants or revokes operator approval for all TEA transfers.
operator
address
The operator address
approved
bool
Whether to approve or revoke
isApprovedForAll
Checks if an operator is approved for all TEA transfers on behalf of an account.
APE (ERC20 Leveraged Token)
Each vault has its own APE contract deployed as a minimal clone. APE tokens represent leveraged positions and are standard ERC20 tokens with EIP-2612 permit support.
leverageTier
Returns the leverage tier for this APE token (stored as an immutable argument in the clone).
Returns: int8 — leverage tier from -2 to +2.
DOMAIN_SEPARATOR
Returns the EIP-712 domain separator for permit signatures.
nonces
Returns the current permit nonce for an address (EIP-2612).
Standard ERC20
APE implements the full ERC20 interface plus EIP-2612 permit:
name
name() returns (string)
symbol
symbol() returns (string)
decimals
decimals() returns (uint8)
totalSupply
totalSupply() returns (uint256)
balanceOf
balanceOf(address account) returns (uint256)
transfer
transfer(address to, uint256 amount) returns (bool)
transferFrom
transferFrom(address from, address to, uint256 amount) returns (bool)
approve
approve(address spender, uint256 amount) returns (bool)
increaseAllowance
increaseAllowance(address spender, uint256 amount) returns (bool)
decreaseAllowance
decreaseAllowance(address spender, uint256 amount) returns (bool)
allowance
allowance(address owner, address spender) returns (uint256)
permit
permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s)
APE decimals match the collateral token's decimals. Transfers to
address(0)are not permitted.
Last updated