forked from neptune-mutual-blue/protocol
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFakeUniswapV2RouterLike.sol
81 lines (68 loc) · 1.72 KB
/
FakeUniswapV2RouterLike.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Neptune Mutual Protocol (https://neptunemutual.com)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import "../dependencies/uniswap-v2/IUniswapV2RouterLike.sol";
contract FakeUniswapV2RouterLike is IUniswapV2RouterLike {
address public tokenA;
address public tokenB;
function factory() external view override returns (address) {
return address(this);
}
function getAmountOut(
uint256 amountIn,
uint256,
uint256
) external pure override returns (uint256) {
return amountIn * 2;
}
function getAmountIn(
uint256 amountOut,
uint256,
uint256
) external pure override returns (uint256) {
return amountOut * 2;
}
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;
}
function quote(
uint256 amountA,
uint256,
uint256
) public pure virtual override returns (uint256 amountB) {
return amountA;
}
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;
}
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;
}
}