mirror of
				https://github.com/Instadapp/dsa-connectors.git
				synced 2024-07-29 22:37:00 +00:00 
			
		
		
		
	minor fix
This commit is contained in:
		
							parent
							
								
									69ce278335
								
							
						
					
					
						commit
						4fadaa0515
					
				| 
						 | 
				
			
			@ -58,7 +58,7 @@ abstract contract Helpers is ISwapRouter {
 | 
			
		|||
        TransferHelper.safeApprove(tokenIn, address(router), amountIn);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function getSingleInput(ISwapRouter.ExactInputSingleParams memory params)
 | 
			
		||||
    function swapSingleInput(ISwapRouter.ExactInputSingleParams memory params)
 | 
			
		||||
        public
 | 
			
		||||
        returns (uint256)
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,5 +32,5 @@ interface ISwapRouter {
 | 
			
		|||
    function exactInputSingle(ExactInputSingleParams calldata params)
 | 
			
		||||
        external
 | 
			
		||||
        payable
 | 
			
		||||
        returns (uint256 amountOut);
 | 
			
		||||
        returns (uint256);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,18 +8,17 @@ abstract contract uniswapSellBeta is Helpers {
 | 
			
		|||
        address tokenIn,
 | 
			
		||||
        address tokenOut,
 | 
			
		||||
        uint24 fee,
 | 
			
		||||
        uint256 amountIn,
 | 
			
		||||
        uint256 amountOutMinimum,
 | 
			
		||||
        bool zeroForOne
 | 
			
		||||
    ) public returns (uint256 amountOut) {
 | 
			
		||||
        approveTransfer(tokenIn, msg.sender, address(this), amountIn);
 | 
			
		||||
        amountOut = getSingleInput(
 | 
			
		||||
    ) public payable returns (uint256 amountOut) {
 | 
			
		||||
        approveTransfer(tokenIn, msg.sender, address(this), msg.value);
 | 
			
		||||
        amountOut = swapSingleInput(
 | 
			
		||||
            getParams(
 | 
			
		||||
                tokenIn,
 | 
			
		||||
                tokenOut,
 | 
			
		||||
                msg.sender,
 | 
			
		||||
                fee,
 | 
			
		||||
                amountIn,
 | 
			
		||||
                msg.value,
 | 
			
		||||
                amountOutMinimum,
 | 
			
		||||
                zeroForOne
 | 
			
		||||
            )
 | 
			
		||||
| 
						 | 
				
			
			@ -27,6 +26,6 @@ abstract contract uniswapSellBeta is Helpers {
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
abstract contract UniswapSellBetaArbitrum is uniswapSellBeta {
 | 
			
		||||
    string public constant name = "UniswapSample-v1";
 | 
			
		||||
contract UniswapSellBetaArbitrum is uniswapSellBeta {
 | 
			
		||||
    string public constant name = "UniswapSellBeta";
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										55
									
								
								test/uniswap-sell-beta/uniswap-sell-beta.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								test/uniswap-sell-beta/uniswap-sell-beta.js
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,55 @@
 | 
			
		|||
const { expect } = require("chai");
 | 
			
		||||
const hre = require("hardhat");
 | 
			
		||||
const { web3, deployments, waffle, ethers } = hre;
 | 
			
		||||
const { provider, deployContract } = waffle;
 | 
			
		||||
const deployAndEnableConnector = require("../../scripts/deployAndEnableConnector.js");
 | 
			
		||||
const buildDSAv2 = require("../../scripts/buildDSAv2");
 | 
			
		||||
const encodeSpells = require("../../scripts/encodeSpells.js");
 | 
			
		||||
 | 
			
		||||
const addresses = require("../../scripts/constant/addresses");
 | 
			
		||||
const abis = require("../../scripts/constant/abis");
 | 
			
		||||
 | 
			
		||||
const UniswapSellBetaArtifacts = require("../../artifacts/contracts/arbitrum/connectors/uniswap-sell-beta/main.sol/UniswapSellBetaArbitrum.json");
 | 
			
		||||
 | 
			
		||||
const FeeAmount = {
 | 
			
		||||
  LOW: 500,
 | 
			
		||||
  MEDIUM: 3000,
 | 
			
		||||
  HIGH: 10000,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const TICK_SPACINGS = {
 | 
			
		||||
  500: 10,
 | 
			
		||||
  3000: 60,
 | 
			
		||||
  10000: 200,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const USDT_ADDR = "0xdac17f958d2ee523a2206206994597c13d831ec7";
 | 
			
		||||
const DAI_ADDR = "0x6b175474e89094c44da98b954eedeac495271d0f";
 | 
			
		||||
 | 
			
		||||
describe("Uniswap-sell-beta", function() {
 | 
			
		||||
  let UniswapSellBeta, uniswapSellBeta;
 | 
			
		||||
  before(async () => {
 | 
			
		||||
    UniswapSellBeta = await ethers.getContractFactory(
 | 
			
		||||
      "UniswapSellBetaArbitrum"
 | 
			
		||||
    );
 | 
			
		||||
    uniswapSellBeta = await UniswapSellBeta.deploy();
 | 
			
		||||
    [owner, add1, add2] = await ethers.getSigners();
 | 
			
		||||
    await uniswapSellBeta.deployed();
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it("Should have contracts deployed.", async function() {
 | 
			
		||||
    expect(uniswapSellBeta.address).to.be.true;
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it("Should Perfrom a swap", async () => {
 | 
			
		||||
    const tx = await uniswapSellBeta.sell(
 | 
			
		||||
      USDT_ADDR,
 | 
			
		||||
      DAI_ADDR,
 | 
			
		||||
      ethers.utils.parseEther("1.0"),
 | 
			
		||||
      ethers.utils.parseEther("10.0"),
 | 
			
		||||
      true,
 | 
			
		||||
      { value: ethers.utils.parseEther("10.0") }
 | 
			
		||||
    );
 | 
			
		||||
    console.log(tx);
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user