TrussDocs

Policies

Sub-account policies

The allocation and execution policies on sub-accounts, the hooks each one exposes, and every function that calls them.

Sub-accounts are where a vault's capital is put to work. Two kinds of policy limit that. The allocation policy limits how much USDC the vault may send into each sub-account. Execution policies limit what a tracked sub-account's swap and lend modules may do with it. This page lists each hook and every function that calls it.

Key points

  • The allocation policy is asked on every push of USDC into a sub-account, and never when capital comes back.
  • Every module on a tracked sub-account has an execution policy, asked before and after each execution.
  • The policies that exist today meter flows with limits that start at zero, so nothing moves until a limit is raised.
  • Attested sub-accounts have no execution policy. Their calls are checked against the call shapes their verifier allows.

The allocation policy

applyAllocationPolicy(subAccount, assetsToPush, policyData) checks and meters one push, and reverts to refuse. policyData is passed through from the caller, in a format the policy defines.

FunctionWhen it is asked
pushToSubAccount on the vault, which calls the sub-account's depositOnce the sub-account is confirmed active and unpaused, before the USDC moves

It is not asked when a sub-account sends capital back (returnAssetsToVault), when the vault asks for it back (requestAssetsFromSubAccount), or when a sub-account funds an instant withdrawal. With no policy bound, pushes have no cap or rate limit.

SubAccountAllocationPolicy is one contract per vault. The factory binds it on every sub-account it deploys; a sub-account added to a live vault needs it bound with setSubAccountAllocationPolicy. For each sub-account it keeps a cap on net deployed principal, which is what was pushed less what came back, and a push rate limit. Gains do not count toward the cap. Caps sit under a ceiling fixed at deployment.

Execution policies

Each execution on a tracked sub-account calls its module's policy twice:

  1. applyExecutionPolicy(subAccount, module, intent, targets, policyData) runs before the module acts. It sees the intended input and output, the tolerance, and the addresses the module will call.
  2. recordExecutionOutcome(subAccount, module, intent, spent, received) runs after, with what the sub-account measured. It can still refuse, which reverts the whole execution.
FunctionCallerWhen
executeModuleThe VaultAdmin, or a vault manager or trader given that sub-accountEvery swap or lend execution
fundInstantRedemptionThe vault, during an instant withdrawalWhen the default source withdraws from its lending venue

addModule checks that the policy's moduleType() matches its module's family. Only a live sub-account of the vault can call a policy's hooks.

The execution policies that exist today

PolicyOne perWhat it checksWhat it meters
SubAccountSwapPolicySwap moduleThe swap's tolerance is within a ceiling fixed when the policy is created, below 100%, with no factory maximumFlow out and in per asset, from what was measured
SubAccountLendPolicyVaultThe call's tolerance is within a ceiling fixed at deployment, under the factory's maximum. A call names one venue and no other targetsSupply per venue, before the call. Withdrawals are never metered, so a venue can always be left

The policy bounds the tolerance; the sub-account itself checks that what came back is worth at least what went in, less that tolerance, at oracle prices. A venue or asset whose limit was never raised refuses any amount. Raising a limit or a cap waits HIGH. Lowering one is immediate, and the Sentry holds the lowers. See Rate limits.

Where to read more

PageWhat it covers
PoliciesEvery slot, and what exists today
Tracked sub-accountsModules, executions and how a tracked sub-account is valued
Attested sub-accountsCall shapes and the verifier that checks them
Rate limitsEvery limit these policies keep, and who changes it
Who can call whatThe tier and holders of every policy setting