Pool
Manages deposits, withdrawals and swaps. Holds a mapping of assets and parameters.
contracts/wombat-core/pool/Pool.sol
Title: Pool
Notice: Manages deposits, withdrawals and swaps. Holds a mapping of assets and parameters.
Details: The main entry-point of Wombat protocol Note: All variables are 18 decimals, except from that of underlying tokens
***Pool.AssetAdded(token, asset) ***
Notice: An event thats emitted when an asset is added to Pool
Arguments
name | type | description |
token | address | indexed |
asset | address | indexed |
***Pool.AssetRemoved(token, asset) ***
Notice: An event thats emitted when asset is removed from Pool
Arguments
name | type | description |
token | address | indexed |
asset | address | indexed |
***Pool.Deposit(sender, token, amount, liquidity, to) ***
Notice: An event thats emitted when a deposit is made to Pool
Arguments
name | type | description |
sender | address | indexed |
token | address | not indexed |
amount | uint256 | not indexed |
liquidity | uint256 | not indexed |
to | address | indexed |
***Pool.FillPool(token, amount) ***
Arguments
name | type | description |
token | address | not indexed |
amount | uint256 | not indexed |
***Pool.OwnershipTransferred(previousOwner, newOwner) ***
Arguments
name | type | description |
previousOwner | address | indexed |
newOwner | address | indexed |
***Pool.Paused(account) ***
Arguments
name | type | description |
account | address | not indexed |
***Pool.PausedAsset(asset, account) ***
Arguments
name | type | description |
asset | address | not indexed |
account | address | not indexed |
***Pool.SetAmpFactor(value) ***
Arguments
name | type | description |
value | uint256 | not indexed |
***Pool.SetDev(addr) ***
Arguments
name | type | description |
addr | address | not indexed |
***Pool.SetFee(lpDividendRatio, retentionRatio) ***
Arguments
name | type | description |
lpDividendRatio | uint256 | not indexed |
retentionRatio | uint256 | not indexed |
***Pool.SetFeeTo(addr) ***
Arguments
name | type | description |
addr | address | not indexed |
***Pool.SetHaircutRate(value) ***
Arguments
name | type | description |
value | uint256 | not indexed |
***Pool.SetMasterWombat(addr) ***
Arguments
name | type | description |
addr | address | not indexed |
***Pool.SetMintFeeThreshold(value) ***
Arguments
name | type | description |
value | uint256 | not indexed |
***Pool.Swap(sender, fromToken, toToken, fromAmount, toAmount, to) ***
Notice: An event thats emitted when a swap is made in Pool
Arguments
name | type | description |
sender | address | indexed |
fromToken | address | not indexed |
toToken | address | not indexed |
fromAmount | uint256 | not indexed |
toAmount | uint256 | not indexed |
to | address | indexed |
***Pool.TransferTipBucket(token, amount, to) ***
Arguments
name | type | description |
token | address | not indexed |
amount | uint256 | not indexed |
to | address | not indexed |
***Pool.Unpaused(account) ***
Arguments
name | type | description |
account | address | not indexed |
***Pool.UnpausedAsset(asset, account) ***
Arguments
name | type | description |
asset | address | not indexed |
account | address | not indexed |
***Pool.Withdraw(sender, token, amount, liquidity, to) ***
Notice: An event thats emitted when a withdrawal is made from Pool
Arguments
name | type | description |
sender | address | indexed |
token | address | not indexed |
amount | uint256 | not indexed |
liquidity | uint256 | not indexed |
to | address | indexed |
***Pool.addAsset(token, asset) ***
Notice: Adds asset to pool, reverts if asset already exists in pool
Arguments
name | type | description |
token | address | The address of token |
asset | address | The address of the Wombat Asset contract |
Pool.addressOfAsset(token) view
Notice: Gets Asset corresponding to ERC20 token. Reverts if asset does not exists in Pool.
Details: to be used externally
Arguments
name | type | description |
token | address | The address of ERC20 token |
Outputs
name | type | description |
| address | |
Pool.ampFactor() view
Notice: Amplification factor
Outputs
name | type | description |
| uint256 | |
***Pool.deposit(token, amount, minimumLiquidity, to, deadline, shouldStake) ***
Notice: Deposits amount of tokens into pool ensuring deadline
Details: Asset needs to be created and added to pool before any operation. This function assumes tax free token.
Arguments
name | type | description |
token | address | The token address to be deposited |
amount | uint256 | The amount to be deposited |
minimumLiquidity | uint256 | |
to | address | The user accountable for deposit, receiving the Wombat assets (lp) |
deadline | uint256 | The deadline to be respected |
shouldStake | bool | |
Outputs
name | type | description |
liquidity | uint256 | Total asset liquidity minted |
Pool.dev() view
Notice: Dev address
Outputs
name | type | description |
| address | |
Pool.exchangeRate(token) view
Notice: Returns the exchange rate of the LP token
Arguments
name | type | description |
token | address | The address of the token |
Outputs
name | type | description |
xr | uint256 | The exchange rate of LP token |
Pool.feeTo() view
Outputs
name | type | description |
| address | |
***Pool.fillPool(token, amount) ***
Arguments
name | type | description |
token | address | |
amount | uint256 | |
Pool.getTokens() view
Notice: Return list of tokens in the pool
Outputs
name | type | description |
| address[] | |
Pool.globalEquilCovRatio() view
Outputs
name | type | description |
equilCovRatio | uint256 | |
invariantInUint | uint256 | |
Pool.haircutRate() view
Notice: Haircut rate
Outputs
name | type | description |
| uint256 | |
***Pool.initialize(ampFactor_, haircutRate_) ***
Notice: Initializes pool. Dev is set to be the account calling this function.
Arguments
name | type | description |
ampFactor_ | uint256 | |
haircutRate_ | uint256 | |
Pool.lpDividendRatio() view
Notice: LP dividend ratio : the ratio of haircut that should distribute to LP
Outputs
name | type | description |
| uint256 | |
Pool.masterWombat() view
Outputs
name | type | description |
| address | |
***Pool.mintFee(token) ***
Notice: Send fee collected to the fee beneficiary
Arguments
name | type | description |
token | address | The address of the token to collect fee |
Pool.mintFeeThreshold() view
Notice: The threshold to mint fee (unit: WAD)
Outputs
name | type | description |
| uint256 | |
Pool.owner() view
Details: Returns the address of the current owner.
Outputs
name | type | description |
| address | |
***Pool.pause() ***
Details: pause pool, restricting certain operations
***Pool.pauseAsset(token) ***
Details: pause asset, restricting deposit and swap operations
Arguments
name | type | description |
token | address | |
Pool.paused() view
Details: Returns true if the contract is paused, and false otherwise.
Outputs
name | type | description |
| bool | |
Pool.quoteAmountIn(fromToken, toToken, toAmount) view
Notice: Returns the minimum input asset amount required to buy the given output asset amount (accounting for fees and slippage)
Details: To be used by frontend
Arguments
name | type | description |
fromToken | address | The initial ERC20 token |
toToken | address | The token wanted by user |
toAmount | int256 | The given output amount |
Outputs
name | type | description |
amountIn | uint256 | The input amount required |
haircut | uint256 | The haircut that would be applied |
Pool.quotePotentialDeposit(token, amount) view
Notice: Quotes potential deposit from pool
Details: To be used by frontend
Arguments
name | type | description |
token | address | The token to deposit by user |
amount | uint256 | The amount to deposit |
Outputs
name | type | description |
liquidity | uint256 | The potential liquidity user would receive |
reward | uint256 | reward |
Pool.quotePotentialSwap(fromToken, toToken, fromAmount) view
Notice: Given an input asset amount and token addresses, calculates the maximum output token amount (accounting for fees and slippage).
Details: In reverse quote, the haircut is in thefromAsset
Arguments
name | type | description |
fromToken | address | The initial ERC20 token |
toToken | address | The token wanted by user |
fromAmount | int256 | The given input amount |
Outputs
name | type | description |
potentialOutcome | uint256 | The potential amount user would receive |
haircut | uint256 | The haircut that would be applied |
Pool.quotePotentialWithdraw(token, liquidity) view
Notice: Quotes potential withdrawal from pool
Details: To be used by frontend
Arguments
name | type | description |
token | address | The token to be withdrawn by user |
liquidity | uint256 | The liquidity (amount of lp assets) to be withdrawn |
Outputs
name | type | description |
amount | uint256 | The potential amount user would receive |
fee | uint256 | The fee that would be applied |
Pool.quotePotentialWithdrawFromOtherAsset(fromToken, toToken, liquidity) view
Notice: Quotes potential withdrawal from other asset from the pool
Details: To be used by frontend
Arguments
name | type | description |
fromToken | address | The corresponding token user holds the LP (Asset) from |
toToken | address | The token wanting to be withdrawn (needs to be well covered) |
liquidity | uint256 | The liquidity (amount of the lp assets) to be withdrawn |
Outputs
name | type | description |
amount | uint256 | The potential amount user would receive |
withdrewAmount | uint256 | The amount of the from-token that is withdrew |
***Pool.removeAsset(token) ***
Notice: Removes asset from asset struct
Details: Can only be called by owner