IVaultRegistry
Functions
getNumberOfVaults
Gets the total number of vaults in the registry.
function getNumberOfVaults() external view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The total number of vaults in the registry. |
addVault
Adds a vault to the registry.
function addVault(address vault, address asset, bytes32 vaultType, TradeSide side, OptionType optionType) external;
Parameters
Name | Type | Description |
---|---|---|
vault | address | The proxy address of the vault. |
asset | address | The address for the token deposited in the vault. |
vaultType | bytes32 | The type of the vault. |
side | TradeSide | The trade side of the vault. |
optionType | OptionType | The option type of the vault. |
removeVault
Removes a vault from the registry.
function removeVault(address vault) external;
Parameters
Name | Type | Description |
---|---|---|
vault | address | The proxy address of the vault. |
isVault
Returns whether the given address is a vault
function isVault(address vault) external view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
vault | address | The address to check |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | Whether the given address is a vault |
updateVault
Updates a vault in the registry.
function updateVault(address vault, address asset, bytes32 vaultType, TradeSide side, OptionType optionType) external;
Parameters
Name | Type | Description |
---|---|---|
vault | address | The proxy address of the vault. |
asset | address | The address for the token deposited in the vault. |
vaultType | bytes32 | The type of the vault. |
side | TradeSide | The trade side of the vault. |
optionType | OptionType | The option type of the vault. |
addSupportedTokenPairs
Adds a set of supported token pairs to the vault.
function addSupportedTokenPairs(address vault, TokenPair[] memory tokenPairs) external;
Parameters
Name | Type | Description |
---|---|---|
vault | address | The proxy address of the vault. |
tokenPairs | TokenPair[] | The token pairs to add. |
removeSupportedTokenPairs
Removes a set of supported token pairs from the vault.
function removeSupportedTokenPairs(address vault, TokenPair[] memory tokenPairsToRemove) external;
Parameters
Name | Type | Description |
---|---|---|
vault | address | The proxy address of the vault. |
tokenPairsToRemove | TokenPair[] | The token pairs to remove. |
getVault
Gets the vault at the specified by the proxy address.
function getVault(address vault) external view returns (Vault memory);
Parameters
Name | Type | Description |
---|---|---|
vault | address | The proxy address of the vault. |
Returns
Name | Type | Description |
---|---|---|
<none> | Vault | The vault associated with the proxy address. |
getSupportedTokenPairs
Gets the token supports supported for trading within the vault.
function getSupportedTokenPairs(address vault) external view returns (TokenPair[] memory);
Parameters
Name | Type | Description |
---|---|---|
vault | address | The proxy address of the vault. |
Returns
Name | Type | Description |
---|---|---|
<none> | TokenPair[] | The token pairs supported for trading within the vault. |
getVaults
Gets all vaults in the registry.
function getVaults() external view returns (Vault[] memory);
Returns
Name | Type | Description |
---|---|---|
<none> | Vault[] | All vaults in the registry. |
getVaultsByFilter
Gets all vaults with trade side side
and option type optionType
.
function getVaultsByFilter(address[] memory assets, TradeSide side, OptionType optionType)
external
view
returns (Vault[] memory);
Parameters
Name | Type | Description |
---|---|---|
assets | address[] | The accepted assets (empty list for all assets). |
side | TradeSide | The trade side. |
optionType | OptionType | The option type. |
Returns
Name | Type | Description |
---|---|---|
<none> | Vault[] | All vaults meeting all of the passed filter criteria. |
getVaultsByAsset
Gets all vaults with asset
as their deposit token.
function getVaultsByAsset(address asset) external view returns (Vault[] memory);
Parameters
Name | Type | Description |
---|---|---|
asset | address | The desired asset. |
Returns
Name | Type | Description |
---|---|---|
<none> | Vault[] | All vaults with asset as their deposit token. |
getVaultsByTokenPair
Gets all vaults with tokenPair
in their trading set.
function getVaultsByTokenPair(TokenPair memory tokenPair) external view returns (Vault[] memory);
Parameters
Name | Type | Description |
---|---|---|
tokenPair | TokenPair | The desired token pair. |
Returns
Name | Type | Description |
---|---|---|
<none> | Vault[] | All vaults with tokenPair in their trading set. |
getVaultsByTradeSide
Gets all vaults with trade side side
.
function getVaultsByTradeSide(TradeSide side) external view returns (Vault[] memory);
Parameters
Name | Type | Description |
---|---|---|
side | TradeSide | The trade side. |
Returns
Name | Type | Description |
---|---|---|
<none> | Vault[] | All vaults with trade side side . |
getVaultsByOptionType
Gets all vaults with option type optionType
.
function getVaultsByOptionType(OptionType optionType) external view returns (Vault[] memory);
Parameters
Name | Type | Description |
---|---|---|
optionType | OptionType | The option type. |
Returns
Name | Type | Description |
---|---|---|
<none> | Vault[] | All vaults with option type optionType . |
getVaultsByType
Gets all the vaults of type vaultType
.
function getVaultsByType(bytes32 vaultType) external view returns (Vault[] memory);
Parameters
Name | Type | Description |
---|---|---|
vaultType | bytes32 | The vault type. |
Returns
Name | Type | Description |
---|---|---|
<none> | Vault[] | All the vaults of type vaultType . |
getImplementation
Gets the implementation for the vaultType.
function getImplementation(bytes32 vaultType) external view returns (address);
Parameters
Name | Type | Description |
---|---|---|
vaultType | bytes32 | The vault type. |
Returns
Name | Type | Description |
---|---|---|
<none> | address | The implementation address. |
setImplementation
Sets the implementation for the vaultType.
function setImplementation(bytes32 vaultType, address implementation) external;
Parameters
Name | Type | Description |
---|---|---|
vaultType | bytes32 | The vault type. |
implementation | address | The implementation contract address |
Events
VaultImplementationSet
event VaultImplementationSet(bytes32 indexed vaultType, address implementation);
VaultAdded
event VaultAdded(
address indexed vault, address indexed asset, bytes32 vaultType, TradeSide side, OptionType optionType
);
VaultRemoved
event VaultRemoved(address indexed vault);
VaultUpdated
event VaultUpdated(
address indexed vault, address indexed asset, bytes32 vaultType, TradeSide side, OptionType optionType
);
SupportedTokenPairAdded
event SupportedTokenPairAdded(
address indexed vault, address indexed base, address indexed quote, address oracleAdapter
);
SupportedTokenPairRemoved
event SupportedTokenPairRemoved(
address indexed vault, address indexed base, address indexed quote, address oracleAdapter
);
Structs
Vault
struct Vault {
address vault;
address asset;
bytes32 vaultType;
TradeSide side;
OptionType optionType;
}
TokenPair
struct TokenPair {
address base;
address quote;
address oracleAdapter;
}
Enums
TradeSide
enum TradeSide {
Buy,
Sell,
Both
}
OptionType
enum OptionType {
Call,
Put,
Both
}