Comment on page
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**181 RAY = 10**27
Core._slippage(k, n, c1, xThreshold, x)
Notice: Yellow Paper Def. 2.4 (Price Slippage Curve)
Arguments
name | type | description |
k | uint256 | K slippage parameter in WAD |
n | uint256 | N slippage parameter |
c1 | uint256 | C1 slippage parmeter in WAD |
xThreshold | uint256 | xThreshold slippage parameter in WAD |
x | uint256 | coverage ratio in WAD |
Output
name | type | description |
| uint256 | The result of price slippage curve |
Core._slippage(k, n, c1, xThreshold, cash, liability, cashChange, addCash)
Notice: Yellow Paper Def. 2.4 (Asset Slippage)
Arguments
name | type | description |
k | uint256 | K slippage parameter in WAD |
n | uint256 | N slippage parameter |
c1 | uint256 | C1 slippage parameter |
xThreshold | uint256 | xThreshold slippage parameter in WAD |
cash | uint256 | cash position of asset in WAD |
cashChange | uint256 | cashChange of asset in WAD |
addCash | bool | true if we are adding cash, false otherwise |
Output
name | type | description |
| uint256 | result of one-sided asset slippage |
Core._swappingSlippage(si, sj)
Notice: Yellow Paper Def. 2.5 (Swapping Slippage). Calculates 1 - (Si - Sj).
Arguments
name | type | description |
si | uint256 | si slippage parameter in WAD |
sj | uint256 | sj slippage parameter |
Output
name | type | description |
| uint256 | result of swapping slippage (1- Si->j) |
Core._haircut(amount, rate)
Notice: Yellow Paper Def. 4.0 (Haircut).
Arguments
name | type | description |
amount | uint256 | The amount that will receive this discount |
rate | uint256 | The rate to be applied |
Output
name | type | description |
| uint256 | the result of operation |
Core._dividend(amount, ratio)
Notice: Applies dividend to amount
Arguments
name | type | description |
amount | uint256 | The amount that will receive the discount |
ratio | uint256 | The ratio to be applied in dividend |
Output
name | type | description |
| uint256 | The result of operation |
Core._withdrawalFee(k, n, c1, xThreshold, cash, liability, amount)
Notice: Yellow Paper Def. 6.2 (Withdrawal Fee)
Arguments
name | type | description |
k | uint256 | K slippage parameter in WAD |
n | uint256 | N slippage parameter |
c1 | uint256 | C1 slippage parameter in WAD |
xThreshold | uint256 | xThreshold slippage parameter in WAD |
cash | uint256 | cash position of asset in WAD |
liability | uint256 | liability position of asset in WAD |
amount | uint256 | amount to be withdrawn in WAD |
Output
name | type | description |
| uint256 | The final fee to be applied |
Core._depositFee(k, n, c1, xThreshold, cash, liability, amount)
Notice: Yellow Paper Def. 7.2 (Deposit Fee)
Arguments
name | type | description |
k | uint256 | K slippage parameter in WAD |
n | uint256 | N slippage parameter |
c1 | uint256 | C1 slippage parameter in WAD |
xThreshold | uint256 | xThreshold slippage parameter in WAD |
cash | uint256 | cash position of asset in WAD |
liability | uint256 | liability position of asset in WAD |
amount | uint256 | amount to be deposited in WAD |
Output
name | type | description |
| uint256 | The final fee to be applied |
Last modified 2yr ago