Router

contracts/wombat-core/libraries/WombatRouter.sol

Title: WombatRouter

Notice: Allows routing on different wombat pools

Details: Owner is allowed and required to approve token spending by pools via approveSpendingByPool function. With great thanks to the uniswap team for your contribution to the opensource community reference: https://github.com/Uniswap/v2-periphery/blob/master/contracts/UniswapV2Router02.sol

constructor

constructor(_wNative)

Arguments

event OwnershipTransferred

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

Arguments

function addLiquidityNative

WombatRouter.addLiquidityNative(pool, minimumLiquidity, to, deadline, shouldStake) payable

Arguments

Outputs

function approveSpendingByPool

***WombatRouter.approveSpendingByPool(tokens, pool) ***

Notice: approve spending of router tokens by pool

Details: needs to be done after asset deployment for router to be able to support the tokens

Arguments

function getAmountIn

WombatRouter.getAmountIn(tokenPath, poolPath, amountOut) view

Notice: Returns the minimum input asset amount required to buy the given output asset amount (accounting for fees and slippage) Note: This function should be used as estimation only. The actual swap amount might be different due to precision error (the error is typically under 1e-6)

Arguments

Outputs

function getAmountOut

WombatRouter.getAmountOut(tokenPath, poolPath, amountIn) view

Notice: Given an input asset amount and an array of token addresses, calculates the maximum output token amount (accounting for fees and slippage).

Arguments

Outputs

function owner

WombatRouter.owner() view

Details: Returns the address of the current owner.

Outputs

function removeLiquidityFromOtherAssetAsNative

***WombatRouter.removeLiquidityFromOtherAssetAsNative(pool, fromToken, liquidity, minimumAmount, to, deadline) ***

Arguments

Outputs

function removeLiquidityNative

***WombatRouter.removeLiquidityNative(pool, liquidity, minimumAmount, to, deadline) ***

Arguments

Outputs

function renounceOwnership

***WombatRouter.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 swapExactNativeForTokens

WombatRouter.swapExactNativeForTokens(tokenPath, poolPath, minimumamountOut, to, deadline) payable

Arguments

Outputs

function swapExactTokensForNative

***WombatRouter.swapExactTokensForNative(tokenPath, poolPath, amountIn, minimumamountOut, to, deadline) ***

Arguments

Outputs

function swapExactTokensForTokens

***WombatRouter.swapExactTokensForTokens(tokenPath, poolPath, amountIn, minimumamountOut, to, deadline) ***

Notice: Swaps an exact amount of input tokens for as many output tokens as possible, along the route determined by the path

Arguments

Outputs

function transferOwnership

***WombatRouter.transferOwnership(newOwner) ***

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

Arguments

function wNative

WombatRouter.wNative() view

Outputs

Last updated