Skip to content

Latest commit

 

History

History
402 lines (345 loc) · 10.5 KB

FakeUniswapV2RouterLike.md

File metadata and controls

402 lines (345 loc) · 10.5 KB

FakeUniswapV2RouterLike.sol

View Source: contracts/fakes/FakeUniswapV2RouterLike.sol

↗ Extends: IUniswapV2RouterLike

FakeUniswapV2RouterLike

Contract Members

Constants & Variables

address public tokenA;
address public tokenB;

Functions

factory

function factory() external view
returns(address)

Arguments

Name Type Description
Source Code
function factory() external view override returns (address) {
    return address(this);
  }

getAmountOut

function getAmountOut(uint256 amountIn, uint256 , uint256 ) external pure
returns(uint256)

Arguments

Name Type Description
amountIn uint256
uint256
uint256
Source Code
function getAmountOut(
    uint256 amountIn,
    uint256,
    uint256
  ) external pure override returns (uint256) {
    return amountIn * 2;
  }

getAmountIn

function getAmountIn(uint256 amountOut, uint256 , uint256 ) external pure
returns(uint256)

Arguments

Name Type Description
amountOut uint256
uint256
uint256
Source Code
function getAmountIn(
    uint256 amountOut,
    uint256,
    uint256
  ) external pure override returns (uint256) {
    return amountOut * 2;
  }

getAmountsOut

function getAmountsOut(uint256 multiplier, address[] ) external pure
returns(uint256[])

Arguments

Name Type Description
multiplier uint256
address[]
Source Code
function getAmountsOut(uint256 multiplier, address[] calldata) external pure override returns (uint256[] memory) {
    uint256[] memory amounts = new uint256[](2);

    amounts[0] = multiplier;
    amounts[1] = multiplier;

    return amounts;
  }

quote

function quote(uint256 amountA, uint256 , uint256 ) public pure
returns(amountB uint256)

Arguments

Name Type Description
amountA uint256
uint256
uint256
Source Code
function quote(
    uint256 amountA,
    uint256,
    uint256
  ) public pure virtual override returns (uint256 amountB) {
    return amountA;
  }

getAmountsIn

function getAmountsIn(uint256 multiplier, address[] ) external pure
returns(uint256[])

Arguments

Name Type Description
multiplier uint256
address[]
Source Code
function getAmountsIn(uint256 multiplier, address[] calldata) external pure override returns (uint256[] memory) {
    uint256[] memory amounts = new uint256[](2);

    amounts[0] = multiplier;
    amounts[1] = multiplier;

    return amounts;
  }

addLiquidity

function addLiquidity(address _tokenA, address _tokenB, uint256 _amountADesired, uint256 _amountBDesired, uint256 , uint256 , address , uint256 ) external nonpayable
returns(amountA uint256, amountB uint256, liquidity uint256)

Arguments

Name Type Description
_tokenA address
_tokenB address
_amountADesired uint256
_amountBDesired uint256
uint256
uint256
address
uint256
Source Code
function addLiquidity(
    address _tokenA,
    address _tokenB,
    uint256 _amountADesired,
    uint256 _amountBDesired,
    uint256,
    uint256,
    address,
    uint256
  )
    external
    override
    returns (
      uint256 amountA,
      uint256 amountB,
      uint256 liquidity
    )
  {
    tokenA = _tokenA;
    tokenB = _tokenB;

    amountA = _amountADesired;
    amountB = _amountBDesired;
    liquidity = 1;
  }

Contracts