IPool
Git Source Inherits: IPoolEvents Author: @oscarsernarosero @mpetersoCode55 @cirsteve function signatures for all PoolsFunctions
swap
This is the main function of the pool to swap.| Name | Type | Description |
|---|---|---|
_tokenIn | address | the address of the token being given to the pool in exchange for another token |
_amountIn | uint256 | the amount of the ERC20 _tokenIn to exchange into the Pool |
_minOut | uint256 | the amount of the other token in the pair minimum to be received for the _amountIn of _tokenIn. |
| Name | Type | Description |
|---|---|---|
amountOut | uint256 | the actual amount of the token coming out of the Pool as result of the swap |
lpFeeAmount | uint256 | the amount of the Y token that’s being dedicated to fees for the LP |
protocolFeeAmount | uint256 | the amount of the Y token that’s being dedicated to fees for the protocol |
spotPrice
This is the function to retrieve the current spot price of the x token.| Name | Type | Description |
|---|---|---|
sPrice | uint256 | the price in YToken Decimals |
simSwap
This is a simulation of the swap function. Useful to get marginal price.| Name | Type | Description |
|---|---|---|
_tokenIn | address | the address of the token being sold |
_amountIn | uint256 | the amount of the ERC20 _tokenIn to sell to the Pool |
| Name | Type | Description |
|---|---|---|
amountOut | uint256 | the amount of the token coming out of the Pool as result of the swap (main returned value) |
lpFeeAmount | uint256 | the amount of the Y token that’s being dedicated to fees for the LP |
protocolFeeAmount | uint256 | the amount of the Y token that’s being dedicated to fees for the protocol |
simSwapReversed
lpFeeAmount and protocolFeeAmount are already factored in the amountIn. This is useful only to know how much of the amountIn will go towards fees. This is a simulation of the swap function from the perspective of purchasing a specific amount. Useful to get marginal price.| Name | Type | Description |
|---|---|---|
_tokenout | address | the address of the token being bought |
_amountOut | uint256 | the amount of the ERC20 _tokenOut to buy from the Pool |
| Name | Type | Description |
|---|---|---|
amountIn | uint256 | the amount necessary of the token coming into the Pool for the desired amountOut of the swap (main returned value) |
lpFeeAmount | uint256 | the amount of the Y token that’s being dedicated to fees for the LP |
protocolFeeAmount | uint256 | the amount of the Y token that’s being dedicated to fees for the protocol |
xToken
this value is immutable A function to get the address of the x token of the pool.| Name | Type | Description |
|---|---|---|
<none> | address | the address of the x token of the pool |
yToken
this value is immutable A function to get the address of the Y token of the pool.| Name | Type | Description |
|---|---|---|
<none> | address | the address of the Y token of the pool |
enableSwaps
This is the function to activate/deactivate trading.| Name | Type | Description |
|---|---|---|
_enable | bool | pass True to enable or False to disable |
addXSupply
This is the function to add XToken liquidity to the pool.| Name | Type | Description |
|---|---|---|
_amount | uint256 | the amount of X token to transfer from the sender to the pool |
closePool
This function can be called only if the flag liquidityRemovalAllowed was set to true at construction time. This function closes the pool by removing all liquidity from it.setLPFee
This is the function to update the LP fees per trading.| Name | Type | Description |
|---|---|---|
_fee | uint16 | percentage of the transaction that will get collected as fees (in percentage basis points: 10000 -> 100.00%; 500 -> 5.00%; 1 -> 0.01%) |
setProtocolFee
This is the function to update the protocol fees per trading.| Name | Type | Description |
|---|---|---|
_protocolFee | uint16 | percentage of the transaction that will get collected as fees (in percentage basis points: 10000 -> 100.00%; 500 -> 5.00%; 1 -> 0.01%) |
proposeProtocolFeeCollector
that only the current fee collector address can call this function function to propose a new protocol fee collector| Name | Type | Description |
|---|---|---|
_protocolFeeCollector | address | the new fee collector |
confirmProtocolFeeCollector
that only the already proposed fee collector can call this function function to confirm a new protocol fee collectorcollectLPFees
This function collects the fees from the Pool.withdrawRevenue
This function allows the owner of the pool to pull accrued revenue from the Pool.collectProtocolFees
This function collects the protocol fees from the Pool.xTokenLiquidity
This function gets the liquidity in the pool for xToken in WAD.| Name | Type | Description |
|---|---|---|
<none> | uint256 | the liquidity in the pool for xToken in WAD |
yTokenLiquidity
This function gets the liquidity in the pool for yToken in WAD| Name | Type | Description |
|---|---|---|
<none> | uint256 | the liquidity in the pool for yToken in WAD |
lpFee
fee percentage for swaps for the LP| Name | Type | Description |
|---|---|---|
<none> | uint16 | the percentage for swaps in basis points that will go towards the LP |
protocolFee
fee percentage for swaps for the protocol| Name | Type | Description |
|---|---|---|
<none> | uint16 | the percentage for swaps in basis points that will go towards the protocol |
protocolFeeCollector
protocol-fee collector address| Name | Type | Description |
|---|---|---|
<none> | address | the current protocolFeeCollector address |
proposedProtocolFeeCollector
proposed protocol-fee collector address| Name | Type | Description |
|---|---|---|
<none> | address | the current proposedProtocolFeeCollector address |
collectedLPFees
tells current LP fees accumulated in the pool| Name | Type | Description |
|---|---|---|
<none> | uint256 | currently claimable LP fee balance |
collectedProtocolFees
tells current protocol fees accumulated in the pool| Name | Type | Description |
|---|---|---|
<none> | uint256 | currently claimable protocol fee balance |
liquidityRemovalAllowed
this value is immutable if true, the pool could be closed effectively pulling out all of the liquidity| Name | Type | Description |
|---|---|---|
<none> | bool | liquidityRemovalAllowed |
x
Outstanding liquidity can be calculated as x - xMin. tells the current value of x.| Name | Type | Description |
|---|---|---|
<none> | uint256 | x expressed in xToken decimals |