Roles and permissions
Operator multicalls
How operator keys in a Truss vault hold their roles through an OwnedMulticall, how one is set up at deployment, and how keys are added, rotated and removed.
An operator multicall is a small contract that holds an operator's roles for it. Its one owner key is fixed for the contract's life, and only that key can use it. Vault managers, settlers, allocators, donors and traders all act through one.
Key points
- Roles are granted to the multicall, not to the key, and only its owner can call it.
- One transaction can make several restricted calls across contracts, all or nothing.
- Ownership can never be transferred or given up, so rotating a key means a new multicall and a new grant.
- Removing a key means revoking its multicall's roles, which leaves other keys untouched.
Why operator keys use one
A multicall lets an operator batch restricted calls across the vault and its sub-accounts. For example, a vault manager can send USDC to a sub-account and lend it in one transaction. If any call fails, none of them happen. The address holding the roles also stays the same for the multicall's life, so a grant to it is a grant to that one key.
How it is set up at deployment
The factory deploys one multicall for each key in the vault manager, settler, allocator, donor and trader lists, and grants the roles to it. Each vault manager key gets a multicall of its own. A key named in several of the other four lists gets one shared multicall, which holds each of those profiles.
The vault's address book, from the factory's bookOf(vault) or its VaultDeployed event, lists them as
vaultManagers, settlers, allocators, donors and traders. subAccountTraders lists, for each
sub-account, the trader multicalls that act on it.
How a call runs
The owner sends multicall(targets, calls), two lists of the same length: the contracts to call, and the encoded
call for each. Each call is made by the multicall, so the target sees the multicall as the caller. The first call
that fails reverts the whole batch. The multicall emits Executed(target, data, result) for each call, and sends
no native token.
address[] memory targets = new address[](2);
bytes[] memory calls = new bytes[](2);
targets[0] = vault;
calls[0] = abi.encodeCall(TrussVault.pushToSubAccount, (subAccount, amount, ""));
targets[1] = subAccount;
calls[1] = abi.encodeCall(TrackedSubAccount.executeModule, (lendModule, intent, executionData, ""));
OwnedMulticall(myMulticall).multicall(targets, calls);
A delayed role, such as a vault manager's fee raise, is scheduled and later run through the same multicall. This
is different from the multicall(bytes[]) on the vault and each sub-account, which batches calls to that one
contract and checks each against the original caller.
Adding, rotating and removing a key
To add a key after launch, anyone deploys a new OwnedMulticall with that key as its owner. The roles are then
granted to it:
| New key | Who grants | When it can act |
|---|---|---|
| Settler or donor | VaultAdmin or a vault manager | At once |
| Allocator | VaultAdmin or a vault manager | After the HIGH grant delay |
| Trader | VaultAdmin or a vault manager | Returns at once, and executes after the HIGH grant delay |
| Vault manager | VaultAdmin | After the CRITICAL tier |
A key added after launch is not in the address book, so watch RoleGranted and RoleRevoked on the access
manager. To rotate a key, add its replacement, then remove the old one. Removing a key revokes its multicall's
roles, which is immediate. A vault manager's fee raises are the exception: revoking them waits CRITICAL, and the
VaultAdmin cancels any raise it schedules meanwhile.
Where to read more
| Page | What it covers |
|---|---|
| Profiles | What each operator profile can do |
| Tiers and timelocks | Grant delays and the five-day setback |
| Building multicall batches | Building batches for common operations |
| Rotate a key | The steps to replace a key |