Uniswap V2

Decentralized Exchange.

UniswapV2-v1.1 connector triggers methods like deposit, withdraw, buy, sell. You can view details like source code, ABIs on Etherscan.

  • Use 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee to indicate ETH.
  • use -1 or dsa.maxValue for the maximum amount in function.
  • If not sure about the arguments getId and setId, pass 0.

Deposit

Deposit Liquidity to a Uniswap v2 pool.

spells.add({
  connector: "UNISWAP-V2-A",
  method: "deposit",
  args: [tokenA, tokenB, amtA, unitAmt, slippage, getId, setId]
});
Parameter Type Description
tokenA address The address of token A.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
tokenB address The address of token B.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
amtA uint256 The amount of A tokens to deposit.
unitAmt uint256 The unit amount of of amtB/amtA with slippage.
slippage uint256 Slippage amount.
getId uint256 ID to retrieve amtA.
setId uint256 ID stores the amount of pools tokens received.

Withdraw

Withdraw Liquidity from a Uniswap v2 pool.

spells.add({
  connector: "UNISWAP-V2-A",
  method: "withdraw",
  args: [tokenA, tokenB, uniAmt, unitAmtA, unitAmtB, getId, setIds]
});
Parameter Type Description
tokenA address The address of token A.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
tokenB address The address of token B.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
uniAmt uint256 The amount of pool tokens to withdraw.
unitAmtA uint256 The unit amount of amtA/uniAmt with slippage.
unitAmtB uint256 The unit amount of amtB/uniAmt with slippage.
getId uint256 ID to retrieve uniAmt.
setIds uint256[] Array of IDs to store the amount tokens received.

Buy

Buy a token using a Uniswap v2

spells.add({
  connector: "UNISWAP-V2-A",
  method: "buy",
  args: [buyAddr, sellAddr, buyAmt, unitAmt, getId, setId]
});
Parameter Type Description
buyAddr address The address of the token to buy.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
sellAddr address The address of the token to sell.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
buyAmt uint256 The amount of tokens to buy.
unitAmt uint256 The unit amount of sellAmt/buyAmt with slippage.
getId uint256 ID to retrieve buyAmt.
setId uint256 ID to store the amount of tokens sold.

Sell

Sell a token using a Uniswap v2

spells.add({
  connector: "UNISWAP-V2-A",
  method: "sell",
  args: [buyAddr, sellAddr, sellAmt, unitAmt, getId, setId]
});
Parameter Type Description
buyAddr address The address of the token to buy.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
sellAddr address The address of the token to sell.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
sellAmt uint256 The amount of the token to sell.
unitAmt uint256 The unit amount of buyAmt/sellAmt with slippage.
getId uint256 ID to retrieve sellAmt.
setId uint256 ID stores the amount of token brought.

If you still can't find something you're looking for or have any questions, ask them at our developers community on Discord or simply send an Email.

Our team is excited about assisting you to build an application using Instadapp Developer Platform. Your questions and feedback help us make a better development environment for future developers.