Guides
Bind a policy
How to bind, replace or remove a deposit, holder or withdrawal policy on a live vault, and what a policy must satisfy first.
A policy is a separate contract the vault asks before it lets something happen, such as who may hold its shares. Binding one to a live vault is a single call at the CRITICAL tier, so holders see it coming. The policy must be deployed for this vault first.
Key points
- A policy must name this vault and answer to the vault's AccessManager, or the vault refuses it.
- Binding, replacing and removing a policy each wait the CRITICAL tier, and are the VaultAdmin's alone.
- Replacing the deposit policy drops the deposit cap, unless the new policy enforces one.
- A holder or withdrawal policy can be bound at deployment instead, with no wait.
Steps
- Deploy the policy against this vault and its AccessManager. Its
vault()must return this vault and itsauthority()the vault's AccessManager. - Decide who may change it. A policy's own restricted functions, such as editing a list, answer to the vault's AccessManager. Until they are mapped to a role, they answer to the admin role, so only the VaultAdmin can call them, each at the CRITICAL tier. Mapping them to another role is itself an admin change at that tier.
- Schedule the binding on the vault with
setDepositPolicy(policy),setHolderPolicy(policy)orsetWithdrawalPolicy(policy)(CRITICAL, VaultAdmin). - Wait the CRITICAL delay, then execute it.
- Check that
depositPolicy(),holderPolicy()orwithdrawalPolicy()on the vault returns the policy. TheVaultDepositPolicySet,VaultHolderPolicySetorVaultWithdrawalPolicySetevent records the change.
Replacing or removing a policy
The same setter replaces a policy, or removes it when given the zero address. Both wait the CRITICAL tier, like binding. Without a deposit policy the vault checks nothing on a deposit request, so removing or replacing the deposit-cap policy removes the cap unless the new policy keeps one.
A policy that reverts, or answers anything other than a clear yes, refuses everyone it is asked about. Test a new policy's answers before binding it, because undoing a bad one also waits CRITICAL.
Binding at deployment
The deployer can name a holder and a withdrawal policy when the vault is deployed, or pass the zero address for none. A policy named there is bound before the vault goes live, through the same checks, without the CRITICAL wait. It must be deployed first against the vault and AccessManager addresses the factory predicts. The deposit-cap policy is always bound at deployment.
Where to read more
| Page | What it covers |
|---|---|
| Vault policies | Where each policy is asked, and what it can refuse |
| Building a policy | What a policy contract must provide |
| Using policies for compliance | Allowlists, denylists and other uses |
| Tiers and timelocks | Scheduling a CRITICAL change |