Skip to content

Latest commit

 

History

History
308 lines (272 loc) · 10.1 KB

Vault.md

File metadata and controls

308 lines (272 loc) · 10.1 KB

Vault Contract (Vault.sol)

View Source: contracts/core/liquidity/Vault.sol

↗ Extends: WithFlashLoan

Vault

When a cover is created, a corresponding liquidity pool is also constituted. An instance of this contract represents the liquidity pool of a cover. The vaults are denominated in a single stablecoin and may be less susceptible to underwriting risks associated with cryptocurrency price volatility.

When requested by the Cover Contract, the VaultFactory contract deploys a vault. Per cover, only one vault is permitted. Since the vault contract is not upgradable, some of the validation logic of it is outsourced to the VaultDelegate contract.

The vault contract is also an ERC-20 token, commonly known as POD (or Proof of Deposit). As there is always on-chain stablecoin liquidity available for withdrawal, PODs are fully redeemable and also income or loss bearing certificates (loss if the cover had an event that resulted in a claims payout). Unlike cxTokens, PODs can be freely transferred, staked, and exchanged on secondary marketplaces.

Disclaimer:

The protocol does not provide any warranty, guarantee, or endorsement for the peg of this stablecoin or any other stablecoin we may use on a different chain.

Both risk poolers (underwriters) and policyholders must agree to utilize the same stablecoin to interfact with the protocol. Note that the Neptune Mutual protocol only covers risks related to smart contracts and, to a certain extent, frontend attacks. We don't cover risks arising from teams losing private keys because of gross misconduct or negligence. We don't cover people who put their money at risk in trading activities like margin calls, leverage trading, or liquidation. We don't cover 51% attack or any other type of consensus attack. We don't cover bridge hacks and a whole variety of other exclusions.

Functions

Contructs this contract

function (IStore store, bytes32 coverKey, string tokenName, string tokenSymbol, IERC20 stablecoin) public nonpayable VaultBase 

Arguments

Name Type Description
store IStore Provide store instance
coverKey bytes32 Provide a cover key that doesn't have a vault deployed
tokenName string Enter the token name of the POD. Example: Uniswap nDAI or Uniswap nUSDC
tokenSymbol string Enter the token symbol of the POD. Example: UNI-NDAI or UNI-NUSDC.
stablecoin IERC20 Provide an instance of the stablecoin this vault supports.
Source Code
constructor(
    IStore store,
    bytes32 coverKey,
    string memory tokenName,
    string memory tokenSymbol,
    IERC20 stablecoin
  ) VaultBase(store, coverKey, tokenName, tokenSymbol, stablecoin) {}

getInfo

Gets information of a given vault by the cover key Warning: this function does not validate the input argument.

function getInfo(address you) external view
returns(struct IVault.VaultInfoType)

Arguments

Name Type Description
you address The address for which the info will be customized
Source Code
function getInfo(address you) external view override returns (VaultInfoType memory) {
    return delgate().getInfoImplementation(key, you);
  }

version

Version number of this contract

function version() external pure
returns(bytes32)

Arguments

Name Type Description
Source Code
function version() external pure override returns (bytes32) {
    return "v0.1";
  }

getName

Name of this contract

function getName() external pure
returns(bytes32)

Arguments

Name Type Description
Source Code
function getName() external pure override returns (bytes32) {
    return ProtoUtilV1.CNAME_LIQUIDITY_VAULT;
  }

Contracts