Core protocol functions

Core functions to issue and settle derivative assets using DIVA Protocol

Create a contingent pool

function createContingentPool(
    PoolParams calldata _poolParams
) 
    external;

where PoolParams contains the following list of parameters in the corresponding order:

Parameter
Type
Category
Description

referenceAsset

string

Event

The metric or event whose outcome will determine the payout for long and short position tokens.

expiryTime

uint96

Event

Expiration time of position tokens expressed as a unix timestamp in seconds. The value of the reference asset observed at that point in time determines the payoffs for long and short position tokens.

floor

uint256

Payoff

Value of the reference asset at or below which the long token pays out 0 and the short token 1 (max payout). Input expects an integer with 18 decimals.

inflection

uint256

Payoff

Value of the reference asset at which the long token pays out gradient and the short token 1-gradient. Input expects an integer with 18 decimals.

cap

uint256

Payoff

Value of the reference asset at or above which the long token pays out 1 (max payout) and the short token 0. Input expects an integer with 18 decimals.

gradient

uint256

Payoff

Long token payout at inflection (value between 0 and 1). Input expects an integer with 18 decimals.

collateralAmount

uint256

Payoff

Collateral amount to be deposited into the pool to back the position tokens. Input expects an integer with collateral token decimals.

collateralToken

address

Settlement asset

Address of the ERC20 collateral token.

dataProvider

address

Oracle

Ethereum account (EOA or smart contract) that will report the final reference asset value.

capacity

uint256

Pool size

Maximum collateral amount that a contingent pool can accept. Choose a large number (e.g., 2**256 - 1) for unlimited size. Input expects an integer with collateral token decimals.

Adding liquidity

Add liquidity to an existing pool using the following function:

function addLiquidity(
    uint256 _poolId,                // Id of the pool that a user wants to add collateral to
    uint256 _collateralAmountIncr   // Incremental collateral amount to be added to the pool expressed as an integer with collateral token decimals
) 
    external;

Removing liquidity

Remove liquidity from an existing pool using the following function:

function removeLiquidity(
    uint256 _poolId,  // Id of the pool that a user wants to remove collateral from 
    uint256 _amount   // Number of position tokens to return (expressed as an integer with position token decimals)
) 
    external;

Last updated