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

event AssetRemoved

***Pool.AssetRemoved(token, asset) ***

Notice: An event thats emitted when asset is removed from Pool

Arguments

event Deposit

***Pool.Deposit(sender, token, amount, liquidity, to) ***

Notice: An event thats emitted when a deposit is made to Pool

Arguments

event FillPool

***Pool.FillPool(token, amount) ***

Arguments

event OwnershipTransferred

***Pool.OwnershipTransferred(previousOwner, newOwner) ***

Arguments

event Paused

***Pool.Paused(account) ***

Arguments

event PausedAsset

***Pool.PausedAsset(asset, account) ***

Arguments

event SetAmpFactor

***Pool.SetAmpFactor(value) ***

Arguments

event SetDev

***Pool.SetDev(addr) ***

Arguments

event SetFee

***Pool.SetFee(lpDividendRatio, retentionRatio) ***

Arguments

event SetFeeTo

***Pool.SetFeeTo(addr) ***

Arguments

event SetHaircutRate

***Pool.SetHaircutRate(value) ***

Arguments

event SetMasterWombat

***Pool.SetMasterWombat(addr) ***

Arguments

event SetMintFeeThreshold

***Pool.SetMintFeeThreshold(value) ***

Arguments

event Swap

***Pool.Swap(sender, fromToken, toToken, fromAmount, toAmount, to) ***

Notice: An event thats emitted when a swap is made in Pool

Arguments

event TransferTipBucket

***Pool.TransferTipBucket(token, amount, to) ***

Arguments

event Unpaused

***Pool.Unpaused(account) ***

Arguments

event UnpausedAsset

***Pool.UnpausedAsset(asset, account) ***

Arguments

event Withdraw

***Pool.Withdraw(sender, token, amount, liquidity, to) ***

Notice: An event thats emitted when a withdrawal is made from Pool

Arguments

function addAsset

***Pool.addAsset(token, asset) ***

Notice: Adds asset to pool, reverts if asset already exists in pool

Arguments

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

Outputs

function ampFactor

Pool.ampFactor() view

Notice: Amplification factor

Outputs

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

Outputs

function dev

Pool.dev() view

Notice: Dev address

Outputs

function exchangeRate

Pool.exchangeRate(token) view

Notice: Returns the exchange rate of the LP token

Arguments

Outputs

function feeTo

Pool.feeTo() view

Outputs

function fillPool

***Pool.fillPool(token, amount) ***

Arguments

function getTokens

Pool.getTokens() view

Notice: Return list of tokens in the pool

Outputs

function globalEquilCovRatio

Pool.globalEquilCovRatio() view

Outputs

function haircutRate

Pool.haircutRate() view

Notice: Haircut rate

Outputs

function initialize

***Pool.initialize(ampFactor_, haircutRate_) ***

Notice: Initializes pool. Dev is set to be the account calling this function.

Arguments

function lpDividendRatio

Pool.lpDividendRatio() view

Notice: LP dividend ratio : the ratio of haircut that should distribute to LP

Outputs

function masterWombat

Pool.masterWombat() view

Outputs

function mintFee

***Pool.mintFee(token) ***

Notice: Send fee collected to the fee beneficiary

Arguments

function mintFeeThreshold

Pool.mintFeeThreshold() view

Notice: The threshold to mint fee (unit: WAD)

Outputs

function owner

Pool.owner() view

Details: Returns the address of the current owner.

Outputs

function pause

***Pool.pause() ***

Details: pause pool, restricting certain operations

function pauseAsset

***Pool.pauseAsset(token) ***

Details: pause asset, restricting deposit and swap operations

Arguments

function paused

Pool.paused() view

Details: Returns true if the contract is paused, and false otherwise.

Outputs

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

Outputs

function quotePotentialDeposit

Pool.quotePotentialDeposit(token, amount) view

Notice: Quotes potential deposit from pool

Details: To be used by frontend

Arguments

Outputs

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

Outputs

function quotePotentialWithdraw

Pool.quotePotentialWithdraw(token, liquidity) view

Notice: Quotes potential withdrawal from pool

Details: To be used by frontend

Arguments

Outputs

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

Outputs

function removeAsset

***Pool.removeAsset(token) ***

Notice: Removes asset from asset struct

Details: Can only be called by owner

Arguments

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

function setAmpFactor

***Pool.setAmpFactor(ampFactor_) ***

Notice: Changes the pools amplification factor. Can only be set by the contract owner.

Arguments

function setDev

***Pool.setDev(dev_) ***

Notice: Changes the contract dev. Can only be set by the contract owner.

Arguments

function setFee

***Pool.setFee(lpDividendRatio_, retentionRatio_) ***

Arguments

function setFeeTo

***Pool.setFeeTo(feeTo_) ***

Notice: Changes the fee beneficiary. Can only be set by the contract owner. This value cannot be set to 0 to avoid unsettled fee.

Arguments

function setHaircutRate

***Pool.setHaircutRate(haircutRate_) ***

Notice: Changes the pools haircutRate. Can only be set by the contract owner.

Arguments

function setMasterWombat

***Pool.setMasterWombat(masterWombat_) ***

Arguments

function setMintFeeThreshold

***Pool.setMintFeeThreshold(mintFeeThreshold_) ***

Notice: Set min fee to mint

Arguments

function swap

***Pool.swap(fromToken, toToken, fromAmount, minimumToAmount, to, deadline) ***

Notice: Swap fromToken for toToken, ensures deadline and minimumToAmount and sends quoted amount to to address

Details: This function assumes tax free token.

Arguments

Outputs

function tipBucketBalance

Pool.tipBucketBalance(token) view

Arguments

Outputs

function transferOwnership

***Pool.transferOwnership(newOwner) ***

Details: Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.

Arguments

function transferTipBucket

***Pool.transferTipBucket(token, amount, to) ***

Arguments

function unpause

***Pool.unpause() ***

Details: unpause pool, enabling certain operations

function unpauseAsset

***Pool.unpauseAsset(token) ***

Details: unpause asset, enabling deposit and swap operations

Arguments

function withdraw

***Pool.withdraw(token, liquidity, minimumAmount, to, deadline) ***

Notice: Withdraws liquidity amount of asset to to address ensuring minimum amount required

Arguments

Outputs

function withdrawFromOtherAsset

***Pool.withdrawFromOtherAsset(fromToken, toToken, liquidity, minimumAmount, to, deadline) ***

Notice: Enables withdrawing liquidity from an asset using LP from a different asset

Arguments

Outputs

Last updated