Uniswap

Decentralized Exchange

Uniswap connector triggers the methods like buy, sell, deposit, withdraw tokens You can view details like source code, ABIs on Etherscan.

  • Use 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee to indicate ETH.
  • Slippage amount is in percentage. For example, use 2 * 10 ** 16 to denote 2%.
  • If not sure about the arguments getId and setId, pass 0.

Buy

Buy tokens.

spells.add({
  connector: "uniswap",
  method: "buy",
  args: [buyAddr, sellAddr, buyAmt, unitAmt, getId, setId]
});
ParameterTypeDescription
buyAddraddressThe token address to buy.
sellAddraddressThe token address to sell.
buyAmtnumberThe amount of tokens to buy.
unitAmtnumberThe unit amount of sellAmt/buyAmt with slippage.
getIdnumberID fetches the buy amount of buy token.
setIdnumberID stores the sold amount of sell token.

Sell

Sell ETH/ERC20 tokens.

spells.add({
  connector: "uniswap",
  method: "sell",
mad    args: [buyAddr, sellAddr, sellAmt, unitAmt, getId, setId]
});
ParameterTypeDescription
buyAddraddressThe token address to buy.
sellAddraddressThe token address to sell.
sellAmtnumberThe amount of tokens to sell.
unitAmtnumberThe unit amount of sellAmt/buyAmt with slippage.
getIdnumberID fetches the sell amount of sell token.
setIdnumberID stores the bought amount of buy token.

Deposit

Deposit Liquidity.

spells.add({
  connector: "uniswap",
  method: "deposit",
  args: [tokenA, tokenB, amtA, unitAmt, slippage, getId, setId]
});
ParameterTypeDescription
tokenAaddressThe token A address.
tokenBaddressThe token B address.
amtAnumberThe amount of token A.
unitAmtnumberThe unit amount of amtB/amtA with slippage.
slippagenumberThe slippage amount.
getIdnumberID fetches the amount of token to deposit.
setIdnumberID stores the amount of token deposited.

Withdraw

Withdraw Liquidity.

spells.add({
  connector: "uniswap",
  method: "withdraw",
  args: [tokenA, tokenB, uniAmt, unitAmtA, unitAmtB, getId, setIds]
});
ParameterTypeDescription
tokenAaddressThe token A address.
tokenBaddressThe token B address.
uniAmtnumberThe uni token amount.
unitAmtAnumberThe unit amount of amtA/uniAmt with slippage.
unitAmtBnumberunit amount of amtB/uniAmt with slippage.
getIdnumberID fetches the uni token amount to withdraw.
setIdsnumber arrayID stores the amount of tokenA and tokenB withdrawn. If not sure, pass `["0", "0"]`

If you still can't find something you're looking for or have any questions, ask them at our developers community on Telegram, 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.

Best way to stay connected with our progress.