Skip to main content

IPrimitiveEngineEvents.sol

Read code on GitHub

Events

Allocate

Adds liquidity of risky and stable tokens to a specified poolId

Solidity
event Allocate(address indexed from, address indexed recipient, bytes32 indexed poolId, uint256 delRisky, uint256 delStable, uint256 delLiquidity)

Parameters

NameTypeDescription
from indexedaddressMethod caller msg.sender
recipient indexedaddressAddress that receives liquidity
poolId indexedbytes32Keccak256 hash of the engine address, strike, sigma, maturity, and gamma
delRiskyuint256Amount of risky tokens deposited
delStableuint256Amount of stable tokens deposited
delLiquidityuint256Amount of liquidity granted to recipient

Create

Creates a pool with liquidity

Solidity
event Create(address indexed from, uint128 strike, uint32 sigma, uint32 indexed maturity, uint32 indexed gamma, uint256 delRisky, uint256 delStable, uint256 delLiquidity)
Details

Keccak256 hash of the engine address, strike, sigma, maturity, and gamma

Parameters

NameTypeDescription
from indexedaddressCalling msg.sender of the create function
strikeuint128Marginal price of the pool's risky token at maturity, with the same decimals as the stable token, valid [0, 2^128-1]
sigmauint32AKA Implied Volatility in basis points, determines the price impact of swaps, valid for (1, 10_000_000)
maturity indexeduint32Timestamp which starts the BUFFER countdown until swaps will cease, in seconds, valid for (block.timestamp, 2^32-1]
gamma indexeduint32Multiplied against swap in amounts to apply fee, equal to 1 - fee % but units are in basis points, valid for (9000, 10_000)
delRiskyuint256Amount of risky tokens deposited
delStableuint256Amount of stable tokens deposited
delLiquidityuint256Amount of liquidity granted to recipient

Deposit

Added stable and/or risky tokens to a margin account

Solidity
event Deposit(address indexed from, address indexed recipient, uint256 delRisky, uint256 delStable)

Parameters

NameTypeDescription
from indexedaddressMethod caller msg.sender
recipient indexedaddressMargin account recieving deposits
delRiskyuint256Amount of risky tokens deposited
delStableuint256Amount of stable tokens deposited

Remove

Adds liquidity of risky and stable tokens to a specified poolId

Solidity
event Remove(address indexed from, bytes32 indexed poolId, uint256 delRisky, uint256 delStable, uint256 delLiquidity)

Parameters

NameTypeDescription
from indexedaddressMethod caller msg.sender
poolId indexedbytes32Keccak256 hash of the engine address, strike, sigma, maturity, and gamma
delRiskyuint256Amount of risky tokens deposited
delStableuint256Amount of stable tokens deposited
delLiquidityuint256Amount of liquidity decreased from from

Swap

Swaps between risky and stable assets

Solidity
event Swap(address indexed from, address indexed recipient, bytes32 indexed poolId, bool riskyForStable, uint256 deltaIn, uint256 deltaOut)

Parameters

NameTypeDescription
from indexedaddressMethod caller msg.sender
recipient indexedaddressAddress that receives deltaOut amount of tokens
poolId indexedbytes32Keccak256 hash of the engine address, strike, sigma, maturity, and gamma
riskyForStableboolIf true, swaps risky to stable, else swaps stable to risky
deltaInuint256Amount of tokens added to reserves
deltaOutuint256Amount of tokens removed from reserves

UpdateLastTimestamp

Updates the time until expiry of the pool with poolId

Solidity
event UpdateLastTimestamp(bytes32 indexed poolId)

Parameters

NameTypeDescription
poolId indexedbytes32Keccak256 hash of the engine address, strike, sigma, maturity, and gamma

Withdraw

Removes stable and/or risky from a margin account

Solidity
event Withdraw(address indexed from, address indexed recipient, uint256 delRisky, uint256 delStable)

Parameters

NameTypeDescription
from indexedaddressMethod caller msg.sender
recipient indexedaddressAddress that tokens are sent to
delRiskyuint256Amount of risky tokens withdrawn
delStableuint256Amount of stable tokens withdrawn