TrussDocs

Integrating with a vault

Deposits and redemptions

The calls an integration makes to open, claim, cancel and transfer deposit and redemption requests on a Truss vault, and to redeem instantly.

Each request on a Truss vault has an id, a controller and an owner. The owner supplies the USDC or shares; the controller claims, cancels or transfers the request. This page gives the calls that open, check, claim, cancel and transfer requests, and the instant redemption calls. All are on the vault contract. The Flow of funds pages explain what happens at each step.

Key points

  • A request is opened by its owner or the owner's operator. A share allowance alone cannot open a redemption.
  • A partly filled request is pending for its remainder and claimable for its fill at the same time.
  • Claims walk a controller's fills oldest first, and can be made in parts.
  • Cancelling is free at any age, and RequestCancelled reports what went back.

Opening a request, and operators

function requestDeposit(uint256 assets, address controller, address owner) returns (uint256 requestId);
function requestRedeem(uint256 shares, address controller, address owner) returns (uint256 requestId);
function setOperator(address operator, bool approved) returns (bool);
function isOperator(address controller, address operator) view returns (bool);

The caller must be the owner or an operator the owner approved; otherwise the call reverts with NotControllerOrOperator. A deposit needs a USDC approval to the vault first; a redemption needs no share approval. Below the vault's minimum the call reverts with BelowMinimum. A bound holder or withdrawal policy refuses with HolderNotAllowed or WithdrawalNotAllowed. Watch DepositRequest and RedeemRequest.

An operator acts for a controller on every request: it can open, cancel, claim and transfer them. Approve only an address you would trust with the whole position.

Checking a request

ViewReturns
getRequest(requestId)The whole record: kind, state, controller, creation time and remaining
pendingDepositRequest(requestId, controller)USDC not yet settled, or zero if controller does not own it
pendingRedeemRequest(requestId, controller)Shares not yet settled
claimableDepositRequest(requestId, controller)USDC settled into shares the controller has not claimed
claimableRedeemRequest(requestId, controller)Shares settled whose USDC the controller has not claimed
getClaimable(requestId, controller)What one fill still owes, in and out
maxMint, maxDeposit, maxRedeem, maxWithdrawWhat a controller can claim across all its requests

A fill emits RequestFilled with what was consumed, what became claimable and what remains. maxRedeem and maxWithdraw read zero for a controller a bound withdrawal policy refuses.

Claiming

function deposit(uint256 assets, address receiver, address controller) returns (uint256 shares);
function mint(uint256 shares, address receiver, address controller) returns (uint256 assets);
function redeem(uint256 shares, address receiver, address controller) returns (uint256 assets);
function withdraw(uint256 assets, address receiver, address controller) returns (uint256 shares);
function claimDepositFor(address controller) returns (uint256 shares);
function claimRedeemFor(address controller) returns (uint256 assets);

The first four take an amount, so a large queue can be claimed in chunks; the caller must be the controller or its operator. Anyone may call claimDepositFor and claimRedeemFor, which deliver everything claimable to the controller. Claims emit the ERC-4626 Deposit and Withdraw events. Anyone can add requests to a controller's queue, so an integration that is the controller for many users should expect claims it did not make.

Cancelling, transferring and redeeming instantly

function cancelDepositRequest(uint256 requestId);
function cancelRedeemRequest(uint256 requestId);
function transferDepositRequest(uint256 requestId, address oldController, address newController);
function transferRedeemRequest(uint256 requestId, address oldController, address newController);
function requestRedeemAndExecute(uint256 shares, address controller, address owner, address receiver, uint256 minAssets)
    returns (uint256 requestId, uint256 assets);
function executeRedeemRequest(uint256 requestId, uint256 shares, address receiver, uint256 minAssets)
    returns (uint256 assets);

A cancel returns everything still pending to the controller and emits RequestCancelled(requestId, controller, returned). A transfer moves the whole pending balance; the new controller must pass the bound policies.

The instant calls revert unless the full payout, at least minAssets, can be paid now. Quote first on the vault's instant redemption policy: previewInstantRedeem(controller, shares) returns the payout, fee shares and the split by source, and maxInstantRedeem(controller) the most shares that holder can redeem. Both read zero where the call would be refused. Watch InstantRedeemed.

Where to read more

PageWhat it covers
Reading vault stateThe other views an integration reads
Standards and deviationsWhere these calls depart from the standards
Instant withdrawalsLimits and refusals on the instant path