For leads
Create a vault, allow tokens, trade, and tighten risk.
Anyone can call createVault. The caller becomes that vault's Lead. There is no separate Lead allowlist.
Create a vault
function createVault(
IERC20 asset,
string calldata name,
string calldata symbol,
VaultParams calldata params,
bytes32 salt
) external returns (address vault);- Name length is 1 to 64 bytes. Symbol length is 1 to 16 bytes.
- The asset must be a contract, and
decimals()must return at most 18. - The CREATE2 salt is
keccak256(abi.encode(msg.sender, salt)). VaultParamsis checked against the protocol caps. See Fees and Risk and safety.
Tokens the vault may hold
The factory owner allowlists tokens globally. The Lead then calls setTokenAllowed to turn a listed token on for this vault. The asset, the share token, and the zero address cannot be allowlisted as positions. A trade into a token the Lead has not allowed reverts with TokenNotAllowed.
Trade
Only the Lead can call executeTrade. The adapter must be on the factory list. The call approves the adapter for amountIn, swaps, then clears the approval.
- The output balance must rise by at least
minAmountOut, or the trade reverts withSlippage. - The spent amount cannot exceed
amountIn, and no unrelated position or idle asset may fall. That revert isPositionStolenorExcessSpend. - The trade's value cannot exceed
maxTradeBpsof gross assets. - A new position cannot exceed
maxPositionBpsof gross assets. The vault holds at most 16 position tokens. - Spending the asset cannot leave idle assets below
minIdleBps. - A stale oracle or an already tripped breaker reverts the trade.
Tighten only
tighten lets the Lead lower either fee, lengthen the cooldown, shrink the position cap, shrink the drawdown allowance, raise the idle floor, or shrink the trade cap. A change in the other direction reverts with FeeIncrease or RiskLoosen.
poke crystallizes fees without a deposit or a trade. The Lead does not set the protocol fee. That is the factory owner's parameter.