Skip to main content

Step 6: Protocol Interaction

At this point custody is solved. The vault is registered, DST is in the vault, and the investor has a binding registry entry. The rest of this step is whatever your protocol actually does.

The integration guide is intentionally short here because the registrar does not constrain protocol logic. What we can document is the surface other contracts use to gate their behavior on registration, and the events you should emit so observers can monitor the lifecycle.

Compliance boundary

VaultRegistrar only answers one question:

Does this vault belong to this investor identity?

It does not enforce DeFi logic, manage positions, or take custody. The compliance boundary is a single read:

function isRegistered(address vault, address investor) external view returns (bool);

A downstream protocol contract can use it as a gate:

function acceptDeposit(address vault, uint256 amount) external {
require(
vaultRegistrar.isRegistered(vault, investorOf[msg.sender]),
"VAULT_NOT_REGISTERED"
);
// ...accept deposit
}

Implementation note: isRegistered works by hashing registry.getInvestor(vault) and registry.getInvestor(investor) and comparing. Both must be non-empty. So a vault that was once registered cannot be "unregistered" via this gate — see step 7 for the off-ramp story.

Sample interaction (vault → strategy)

function deployIntoStrategy(
address vault,
address strategy,
uint256 amount
) external onlyOperator {
MinimalVault(vault).withdraw(dsToken, strategy, amount);
}

In production you'll usually want one of:

  1. The vault itself calls the target strategy directly (more isolation, more code per vault).
  2. The vault grants a bounded ERC-20 allowance to a trusted strategy adapter (less code per vault, riskier if the adapter is compromised).
  3. The factory pulls funds out of the vault and into a shared strategy account (simplest, weakest isolation).

The registrar is silent on which you pick.

Events you should emit

The registrar emits VaultRegistered and InvestorSignatureVerified for you. To make off-chain monitoring tractable, your protocol should also emit events at every state transition:

event Deposit(address indexed investor, address indexed vault, uint256 amount);
event StrategyEntered(address indexed investor, address indexed vault, uint256 amount, bytes data);
event StrategyExited(address indexed investor, address indexed vault, uint256 amount, bytes data);
event Withdraw(address indexed investor, address indexed vault, uint256 amount);

A subgraph or any indexer that watches VaultRegistered from the registrar plus Deposit / Withdraw from your protocol gives you a complete view of every investor's lifecycle.

Operator checklist

  • Downstream contracts that consume vaults gate on isRegistered(vault, investor).
  • Strategy contracts emit deposit/withdraw events with the investor wallet indexed.
  • You have a way to enumerate active investors (typically by indexing the registrar's VaultRegistered event off-chain).

Next step

Step 7: Return Tokens