Core
Core contract of Platypus protocol
contracts/pool/Core.sol
Title: Core
Notice: Handles math operations of Platypus protocol.
Details: Uses DSMath to compute using WAD and RAY.
Remark:
1 WAD = 10**18
1 RAY = 10**27
function _slippageFun
Core._slippage(k, n, c1, xThreshold, x)
Notice: Yellow Paper Def. 2.4 (Price Slippage Curve)
Arguments
name | type | description |
|
| K slippage parameter in WAD |
|
| N slippage parameter |
|
| C1 slippage parmeter in WAD |
|
| xThreshold slippage parameter in WAD |
|
| coverage ratio in WAD |
Output
name | type | description |
| The result of price slippage curve |
function _slippage
Core._slippage(k, n, c1, xThreshold, cash, liability, cashChange, addCash)
Notice: Yellow Paper Def. 2.4 (Asset Slippage)
Arguments
name | type | description |
|
| K slippage parameter in WAD |
|
| N slippage parameter |
|
| C1 slippage parameter |
|
| xThreshold slippage parameter in WAD |
|
| cash position of asset in WAD |
|
| cashChange of asset in WAD |
|
| true if we are adding cash, false otherwise |
Output
name | type | description |
| result of one-sided asset slippage |
function _swappingSlippage
Core._swappingSlippage(si, sj)
Notice: Yellow Paper Def. 2.5 (Swapping Slippage). Calculates 1 - (Si - Sj).
Arguments
name | type | description |
|
| si slippage parameter in WAD |
|
| sj slippage parameter |
Output
name | type | description |
| result of swapping slippage (1- Si->j) |
function _haircut
Core._haircut(amount, rate)
Notice: Yellow Paper Def. 4.0 (Haircut).
Arguments
name | type | description |
|
| The amount that will receive this discount |
|
| The rate to be applied |
Output
name | type | description |
| the result of operation |
function _dividend
Core._dividend(amount, ratio)
Notice: Applies dividend to amount
Arguments
name | type | description |
|
| The amount that will receive the discount |
|
| The ratio to be applied in dividend |
Output
name | type | description |
| The result of operation |
function _withdrawalFee
Core._withdrawalFee(k, n, c1, xThreshold, cash, liability, amount)
Notice: Yellow Paper Def. 6.2 (Withdrawal Fee)
Arguments
name | type | description |
|
| K slippage parameter in WAD |
|
| N slippage parameter |
|
| C1 slippage parameter in WAD |
|
| xThreshold slippage parameter in WAD |
|
| cash position of asset in WAD |
|
| liability position of asset in WAD |
|
| amount to be withdrawn in WAD |
Output
name | type | description |
| The final fee to be applied |
function _depositFee
Core._depositFee(k, n, c1, xThreshold, cash, liability, amount)
Notice: Yellow Paper Def. 7.2 (Deposit Fee)
Arguments
name | type | description |
|
| K slippage parameter in WAD |
|
| N slippage parameter |
|
| C1 slippage parameter in WAD |
|
| xThreshold slippage parameter in WAD |
|
| cash position of asset in WAD |
|
| liability position of asset in WAD |
|
| amount to be deposited in WAD |
Output
name | type | description |
| The final fee to be applied |
Last updated