Periphery
Voltz Periphery Contract
Periphery.sol is a smart contract that is a wrapper around Voltz Core that abstracts away the complexity of interacting with the core directly.
The mintOrBurn function performs two operations in a single transaction:
- It adds or removes position liquidity from a Voltz IRS pool
- It optionally adds margin in terms of underlying tokens to the position’s margin account
function mintOrBurn(IPeriphery.MintOrBurnParams params) external nonpayable returns (int256 positionMarginRequirement)
Parameters
Name | Type | Description |
---|---|---|
params | MintOrBurnParams | Parameters necessary to initiate a mint or a burn |
MintOrBurnParams
Name | Type | Description |
---|---|---|
marginEngine | address | A Margin Engine address that uniquely identifies an IRS pool on Voltz Protocol |
tickLower | int24 | The lower tick of the position for which to add or remove liquidity |
tickUpper | int24 | The upper tick of the position for which to add or remove liquidity |
notional | uint256 | The amount of notional in underlying tokens the liquidity provider wants to remove or deposit into their active liquidity position |
isMint | bool | If true, add liquidity to the position, if false, remove liquidity from the position |
marginDelta | marginDelta | The delta applied to the margin account of the position in underlying tokens. |
Returns
Name | Type | Description |
---|---|---|
positionMarginRequirement | int256 | The Initial Margin Requirement of the position following a mint or a burn |
The swap function performs two operations in a single transaction:
- It enters into Fixed or Variable Taker Interest Rate Swaps with a Voltz IRS pool
- It optionally adds margin in terms of underlying tokens to the position’s margin account
function swap(IPeriphery.SwapPeripheryParams params) external nonpayable returns (int256 _fixedTokenDelta, int256 _variableTokenDelta, uint256 _cumulativeFeeIncurred, int256 _fixedTokenDeltaUnbalanced, int256 _marginRequirement, int24 _tickAfter)
Parameters
Name | Type | Description |
---|---|---|
params | SwapPeripheryParams | Parameters necessary to initiate an Interest Rate Swap via Voltz Protocol |
SwapPeripheryParams
Name | Type | Description |
---|---|---|
marginEngine | address | A Margin Engine address that uniquely identifies an IRS pool on Voltz Protocol |
isFT | bool | If true, initiate a Fixed Taker Interest Rate Swap, if false initiate a Variable Taker Interest Rate Swap |
notional | uint256 | Notional in underlying tokens of the Interest Rate Swap |
sqrtPriceLimitX96 | uint160 | The Q64.96 sqrt price limit. If dealing with a variable taker swap, the sqrt price of the vAMM cannot be less than this value. If dealing with a fixed taker swap, the sqrt price cannot be more than this value. |
tickLower | int24 | The lower tick of the position for which to add or remove liquidity |
tickUpper | int24 | The upper tick of the position for which to add or remove liquidity |
marginDelta | uint256 | The delta applied to the margin account of the position in underlying tokens. |
This function computes the amount of liquidity received for a given notional amount and price range by:
- Calculating the notional amount divided by the square root delta of the upper and lower ticks to get the amount of returned liquidity
Name | Type | Description |
---|---|---|
sqrtRatioAX96 | uint160 | A sqrt price representing the first tick boundary |
sqrtRatioBX96 | uint160 | A sqrt price representing the second tick boundary |
notionalAmount | uint256 | The amount of notional being sent in |
Name | Type | Description |
---|---|---|
liquidity | uint128 | The amount of returned liquidity |
Last modified 1yr ago