Vault Manager
The Twyne Vault Manager manages global Twyne parameters, including: allowed assets, allowed liquidation LTVs, addresses of key components (such as the oracle router), safety buffer (aka external liquidation buffer) and other governance configuration parameters. This contract will be owned by the Twyne multisig.
There are no user-facing functions in this contract, all state-modifying functions are admin controlled. Some view functions may be useful for protocols or bots integrating with Twyne.
Function Calls
Set oracle
Sets the oracle used by Twyne collateral vaults.
/// @notice Set oracleRouter address. Governance-only.
function setOracleRouter(address _oracle) external onlyOwner;Whitelist intermediate vault
Intermediate vaults are deployed by Twyne governance. A new intermediate vault can be added to Twyne’s onchain system via:
/// @notice Set a collateral vault's intermediate vault. Governance-only.
/// @param _intermediateVault address of the intermediate vault.
function setIntermediateVault(IEVault _intermediateVault) external onlyOwner;It adds the intermediate vault to this mapping:
mapping(address collateralAddress => address intermediateVault) internal intermediateVaults;Whitelist target vault
Collateral vaults are deployed with an intermediate and target vault. Collateral vaults reserve credit from intermediate vault and borrows from target vault. For each intermediate vault, VaultManager maintains a list of target vaults. Thus, a collateral vault can be deployed only when its intermediate and target vault is whitelisted.
It adds the target vault to this mapping:
Remove target vault from whitelist
Removes the target vault from the whitelist for a particular intermediate vault. This blocks creation of collateral vaults which uses this specific intermediate vault and target vault pair.
It removes the target vault from this mapping:
Note that existing collateral vaults using this pair will continue functioning normally.
Set maximum liquidation LTV
Every borrower can set a liquidation LTV for its collateral vault. A range check is performed on this value to ensure Twyne works correctly. The upper bound of this range is set by:
It updates the maximum liquidation LTV stored in this mapping:
Set external liquidation buffer
The lower bound on the user-specified liquidation LTV is given by: liqLTVe∗extLiqBuffer
Where liqLTVe is the external lending market’s liquidation LTV, and extLiqBuffer is value between 0 and 1. Realistically, this buffer will vary from 0.9 to 1.
This buffer can be set for each collateral asset via:
Set collateral vault factory
Anyone can deploy collateral vaults via the collateral vault factory. Twyne governance can change the factory address via:
Arbitrary external call
VaultManager can do an arbitrary external call via:
Note the actions performed by Twyne governance is still limited by the callee smart contract.
Set LTV parameters for intermediate vaults
The collateral vault factory, at the time of collateral vault creation, sets LTV parameters under which the collateral vault can borrow from its intermediate vault:
This operation is done via VaultManager.setLTV(...):
Set resolved vault
Each collateral vault at the time of its deployment signals the oracle router that it needs to price it:
This operation is done via:
Last updated

