# Standards and deviations

> Where a Truss vault follows ERC-4626, ERC-7540, ERC-7575, ERC-8161 and ERC-20, and each place it departs from them, with the reason.

Source: https://docs.trusslabs.io/vaults/developers/standards

A Truss vault implements ERC-4626 as ERC-7540 extends it for asynchronous deposits and redemptions. It also
implements ERC-7575, with the vault contract as its own share token, and ERC-8161. Tools built for these standards
mostly work unchanged. This page lists each place the vault goes beyond or against their text, why, and what an
integration should do about it. The source repository's conformance tests check the behaviour each standard requires.

> **Key points**
>
> - Deposits and redemptions are requests. The ERC-4626 previews revert, and the claim functions pay at each request's settled price.
> - The share price views keep answering at the last fresh price while the NAV is stale, and say so through `nav()`.
> - Requests can be cancelled for free, transferred under ERC-8161, and on some vaults redeemed instantly.
> - A vault may restrict who holds or redeems shares, and may be deployed with forced transfers.

## Where the vault departs from the standards

| Standard | What differs | Why |
|---|---|---|
| ERC-4626 | The underlying must transfer exact amounts: no fee on transfer, no rebasing | The vault is built for USDC |
| ERC-4626 | `totalAssets` and `convertTo*` revert during one of the vault's own calls, and while an attested sub-account's NAV awaits re-anchoring | A half-updated book, or a NAV known to be wrong, would misprice the share |
| ERC-4626 | While the NAV is stale, the price views answer the last fresh price. Check `nav().isStale` and `observedAt` | A market reading the price keeps working through a feed lapse |
| ERC-4626 | `previewDeposit`, `previewMint`, `previewWithdraw` and `previewRedeem` revert with `PreviewNotSupported` | ERC-7540 requires it: the price is set at settlement |
| ERC-4626 | `deposit`, `mint`, `withdraw` and `redeem` claim settled requests, each at the price it settled at | ERC-7540 defines them so |
| ERC-7540 | `requestRedeemAndExecute` opens, fills and claims a redemption in one call; `executeRedeemRequest` does the same for a pending one | Immediate liquidity within the instant window |
| ERC-7540 | `claimDepositFor` and `claimRedeemFor` let anyone deliver a controller's claim, to the controller only | A keeper can complete claims. Expect claims you did not make |
| ERC-7540 | Only the owner or its operator can open a redemption. A share allowance alone cannot. Use `setOperator` | A request carries control, so only an operator may hand it away |
| ERC-7540 | Both kinds of request can be cancelled, for the whole remainder and for free | A holder the settler does not serve can leave the queue |
| ERC-7540, ERC-20 | A bound holder policy refuses an address it does not allow wherever shares or a pending request arrive. A bound withdrawal policy refuses a controller or receiver on the way out. The fee recipient is never refused shares | Restricted share classes. Read `holderPolicy()` and `withdrawalPolicy()` |
| ERC-8161 | A transfer moves the whole pending balance, and the bound policies are asked about the new controller | One controller per request, and none the policies refuse |
| ERC-20, ERC-7540, ERC-8161 | On a vault deployed with forced transfers, the VaultAdmin or a VaultManager can move a holder's shares, requests and fills without consent | Lost keys and court orders. Read `forcedTransfersEnabled()`, fixed at deployment |

## ERC-8161, not plain ERC-7540

ERC-8161 extends ERC-7540 so that a pending request can change hands. That is what lets a holder sell a queued
request before it settles; see [Selling a pending request](https://docs.trusslabs.io/vaults/flow-of-funds/selling-a-pending-request.md). An
integration written for plain ERC-7540 still works, but should expect a request's controller to change while it is
pending, and watch `TransferDepositRequest` and `TransferRedeemRequest`.

## Calls on the concrete contracts only

A few calls are on no interface, because they belong to this implementation. Read them from each contract's own ABI:
`silo()`, `highWaterMark()`, `queuedFeeAssets()` and `crystalliseFees()` on the vault; `syncNav()` on an attested
sub-account, which anyone may call; `window()` on the instant redemption policy; and every restricted lever.

## Where to read more

| Page | What it covers |
|---|---|
| [Deposits and redemptions](https://docs.trusslabs.io/vaults/developers/deposits-and-redemptions.md) | The calls these rows describe |
| [Reading vault state](https://docs.trusslabs.io/vaults/developers/reading-state.md) | The price, NAV and policy views |
| [Vault policies](https://docs.trusslabs.io/vaults/policies/vault-policies.md) | The holder and withdrawal policies |
| [Forced transfers](https://docs.trusslabs.io/vaults/compliance/forced-transfers.md) | What a forced transfer moves, and who can make one |
