IVaultRegistry

Git Source

Functions

getNumberOfVaults

Gets the total number of vaults in the registry.

function getNumberOfVaults() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The 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

NameTypeDescription
vaultaddressThe proxy address of the vault.
assetaddressThe address for the token deposited in the vault.
vaultTypebytes32The type of the vault.
sideTradeSideThe trade side of the vault.
optionTypeOptionTypeThe option type of the vault.

removeVault

Removes a vault from the registry.

function removeVault(address vault) external;

Parameters

NameTypeDescription
vaultaddressThe proxy address of the vault.

isVault

Returns whether the given address is a vault

function isVault(address vault) external view returns (bool);

Parameters

NameTypeDescription
vaultaddressThe address to check

Returns

NameTypeDescription
<none>boolWhether 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

NameTypeDescription
vaultaddressThe proxy address of the vault.
assetaddressThe address for the token deposited in the vault.
vaultTypebytes32The type of the vault.
sideTradeSideThe trade side of the vault.
optionTypeOptionTypeThe 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

NameTypeDescription
vaultaddressThe proxy address of the vault.
tokenPairsTokenPair[]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

NameTypeDescription
vaultaddressThe proxy address of the vault.
tokenPairsToRemoveTokenPair[]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

NameTypeDescription
vaultaddressThe proxy address of the vault.

Returns

NameTypeDescription
<none>VaultThe 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

NameTypeDescription
vaultaddressThe proxy address of the vault.

Returns

NameTypeDescription
<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

NameTypeDescription
<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

NameTypeDescription
assetsaddress[]The accepted assets (empty list for all assets).
sideTradeSideThe trade side.
optionTypeOptionTypeThe option type.

Returns

NameTypeDescription
<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

NameTypeDescription
assetaddressThe desired asset.

Returns

NameTypeDescription
<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

NameTypeDescription
tokenPairTokenPairThe desired token pair.

Returns

NameTypeDescription
<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

NameTypeDescription
sideTradeSideThe trade side.

Returns

NameTypeDescription
<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

NameTypeDescription
optionTypeOptionTypeThe option type.

Returns

NameTypeDescription
<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

NameTypeDescription
vaultTypebytes32The vault type.

Returns

NameTypeDescription
<none>Vault[]All the vaults of type vaultType.

getImplementation

Gets the implementation for the vaultType.

function getImplementation(bytes32 vaultType) external view returns (address);

Parameters

NameTypeDescription
vaultTypebytes32The vault type.

Returns

NameTypeDescription
<none>addressThe implementation address.

setImplementation

Sets the implementation for the vaultType.

function setImplementation(bytes32 vaultType, address implementation) external;

Parameters

NameTypeDescription
vaultTypebytes32The vault type.
implementationaddressThe 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
}