Wombat Exchange
Wombat Exchange
Search…
βŒƒK
Links

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

event AssetAdded

***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

event AssetRemoved

***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

event Deposit

***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

event FillPool

***Pool.FillPool(token, amount) ***
Arguments
name
type
description
token
address
not indexed
amount
uint256
not indexed

event OwnershipTransferred

***Pool.OwnershipTransferred(previousOwner, newOwner) ***
Arguments
name
type
description
previousOwner
address
indexed
newOwner
address
indexed

event Paused

***Pool.Paused(account) ***
Arguments
name
type
description
account
address
not indexed

event PausedAsset

***Pool.PausedAsset(asset, account) ***
Arguments
name
type
description
asset
address
not indexed
account
address
not indexed

event SetAmpFactor

***Pool.SetAmpFactor(value) ***
Arguments
name
type
description
value
uint256
not indexed

event SetDev

***Pool.SetDev(addr) ***
Arguments
name
type
description
addr
address
not indexed

event SetFee

***Pool.SetFee(lpDividendRatio, retentionRatio) ***
Arguments
name
type
description
lpDividendRatio
uint256
not indexed
retentionRatio
uint256
not indexed

event SetFeeTo

***Pool.SetFeeTo(addr) ***
Arguments
name
type
description
addr
address
not indexed

event SetHaircutRate

***Pool.SetHaircutRate(value) ***
Arguments
name
type
description
value
uint256
not indexed

event SetMasterWombat

***Pool.SetMasterWombat(addr) ***
Arguments
name
type
description
addr
address
not indexed

event SetMintFeeThreshold

***Pool.SetMintFeeThreshold(value) ***
Arguments
name
type
description
value
uint256
not indexed

event Swap

***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

event TransferTipBucket

***Pool.TransferTipBucket(token, amount, to) ***
Arguments
name
type
description
token
address
not indexed
amount
uint256
not indexed
to
address
not indexed

event Unpaused

***Pool.Unpaused(account) ***
Arguments
name
type
description
account
address
not indexed

event UnpausedAsset

***Pool.UnpausedAsset(asset, account) ***
Arguments
name
type
description
asset
address
not indexed
account
address
not indexed

event Withdraw

***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

function addAsset

***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

function addressOfAsset

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
​

function ampFactor

Pool.ampFactor() view
Notice: Amplification factor
Outputs
name
type
description
​
uint256
​

function deposit

***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

function dev

Pool.dev() view
Notice: Dev address
Outputs
name
type
description
​
address
​

function exchangeRate

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

function feeTo

Pool.feeTo() view
Outputs
name
type
description
​
address
​

function fillPool

***Pool.fillPool(token, amount) ***
Arguments
name
type
description
token
address
​
amount
uint256
​

function getTokens

Pool.getTokens() view
Notice: Return list of tokens in the pool
Outputs
name
type
description
​
address[]
​

function globalEquilCovRatio

Pool.globalEquilCovRatio() view
Outputs
name
type
description
equilCovRatio
uint256
​
invariantInUint
uint256
​

function haircutRate

Pool.haircutRate() view
Notice: Haircut rate
Outputs
name
type
description
​
uint256
​

function initialize

***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
​

function lpDividendRatio

Pool.lpDividendRatio() view
Notice: LP dividend ratio : the ratio of haircut that should distribute to LP
Outputs
name
type
description
​
uint256
​

function masterWombat

Pool.masterWombat() view
Outputs
name
type
description
​
address
​

function mintFee

***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

function mintFeeThreshold

Pool.mintFeeThreshold() view
Notice: The threshold to mint fee (unit: WAD)
Outputs
name
type
description
​
uint256
​

function owner

Pool.owner() view
Details: Returns the address of the current owner.
Outputs
name
type
description
​
address
​

function pause

***Pool.pause() ***
Details: pause pool, restricting certain operations

function pauseAsset

***Pool.pauseAsset(token) ***
Details: pause asset, restricting deposit and swap operations
Arguments
name
type
description
token
address
​

function paused

Pool.paused() view
Details: Returns true if the contract is paused, and false otherwise.
Outputs
name
type
description
​
bool
​

function quoteAmountIn

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

function quotePotentialDeposit

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

function quotePotentialSwap

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 the fromAsset
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

function quotePotentialWithdraw

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

function quotePotentialWithdrawFromOtherAsset

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

function removeAsset

***Pool.removeAsset(token) ***
Notice: Removes asset from asset struct
Details: Can only be called by owner
Arguments
name
type
description
token
address
The address of token to remove

function renounceOwnership

***Pool.renounceOwnership() ***
Details: Leaves the contract without owner. It will not be possible to call onlyOwner functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.

function retentionRatio

Pool.retentionRatio() view
Notice: Retention ratio: the ratio of haircut that should stay in the pool
Outputs
name
type
description
​
uint256
​

function setAmpFactor

***Pool.setAmpFactor(ampFactor_) ***
Notice: Changes the pools amplification factor. Can only be set by the contract owner.
Arguments
name
type
description
ampFactor_
uint256
new pool's amplification factor

function setDev

***Pool.setDev(dev_) ***
Notice: Changes the contract dev. Can only be set by the contract owner.
Arguments
name
type
description
dev_
address
new contract dev address

function setFee

***Pool.setFee(lpDividendRatio_, retentionRatio_) ***
Arguments
name
type
description
lpDividendRatio_
uint256
​