This commit is contained in:
pradyuman-verma 2021-11-19 21:24:42 +05:30
parent 6cb9c6d226
commit 060a35f723
No known key found for this signature in database
GPG Key ID: 03CEE9087D1D5E4C
2 changed files with 14 additions and 17 deletions

View File

@ -1,22 +1,19 @@
pragma solidity ^0.7.6; pragma solidity ^0.7.6;
pragma abicoder v2; pragma abicoder v2;
import { import {UniswapV3Pool, ISwapRouter} from "./interface.sol";
UniswapV3Pool,
ISwapRouter
} from "./interface.sol";
import {SqrtPriceMath} from "./libraries/SqrtPriceMath.sol"; import {SqrtPriceMath} from "./libraries/SqrtPriceMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
contract Helpers { contract Helpers {
using SafeERC20 for IERC20; using SafeERC20 for IERC20;
ISwapRouter constant public router = ISwapRouter public constant router =
ISwapRouter(0xE592427A0AEce92De3Edee1F18E0157C05861564); ISwapRouter(0xE592427A0AEce92De3Edee1F18E0157C05861564);
UniswapV3Pool constant public state = UniswapV3Pool public constant state =
UniswapV3Pool(0xCEda10b4d3bdE429DdA3A6daB87b38360313CBdB); UniswapV3Pool(0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640);
function getPriceLimit(uint256 amountIn, bool zeroForOne) function getPriceLimit(uint256 amountIn, bool zeroForOne)
public public

View File

@ -23,8 +23,8 @@ const TICK_SPACINGS = {
10000: 200, 10000: 200,
}; };
const USDT_ADDR = "0xdac17f958d2ee523a2206206994597c13d831ec7"; const USDC_ADDR = "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8";
const DAI_ADDR = "0x6b175474e89094c44da98b954eedeac495271d0f"; const WETH_ADDR = "0x82af49447d8a07e3bd95bd0d56f35241523fbab1";
describe("Uniswap-sell-beta", function() { describe("Uniswap-sell-beta", function() {
let UniswapSellBeta, uniswapSellBeta; let UniswapSellBeta, uniswapSellBeta;
@ -38,17 +38,17 @@ describe("Uniswap-sell-beta", function() {
}); });
it("Should have contracts deployed.", async function() { it("Should have contracts deployed.", async function() {
expect(uniswapSellBeta.address).to.be.true; expect(uniswapSellBeta.address).to.exist;
}); });
it("Should Perfrom a swap", async () => { it("Should Perfrom a swap", async () => {
const tx = await uniswapSellBeta.sell( const tx = await uniswapSellBeta.sell(
USDT_ADDR, USDC_ADDR,
DAI_ADDR, WETH_ADDR,
ethers.utils.parseEther("1.0"), ethers.utils.parseUnits("0.000000000001"),
ethers.utils.parseEther("10.0"), ethers.utils.parseUnits("10.0"),
true, ethers.utils.parseUnits("1.0"),
{ value: ethers.utils.parseEther("10.0") } true
); );
console.log(tx); console.log(tx);
}); });