Withdraw Directly on Chain

Navigate to Polygonscan and paste in the contract address (listed below) for the contract you need to interact with and then navigate to the "Contract" section to interact with the contract.

For every Write Contract call, you will need to unlock the wallet on Polygonscan by pressing the Connect to web3 button under the Contract page and unlock your wallet:

Smart Contracts

  • V3 exchange: 0x3253a7e75539edaeb1db608ce6ef9aa1ac9126b6

  • Farms v1 (Single): 0xb9c951c85c8646dafcdc0ad99d326c621abbadce

  • Farms v2 (Dual): 0xb17c0f6b1c34cd3ee989c0df5b560de909f89f95

LP Token Withdrawal from Farms

  1. Verify the correct farms by finding its PID. Withdrawing from farms requires a PID so you will need to know the PID where you farmed.

If you know the farm, you can find the "Farm ID" here

If you don't know what farms you had assets at, you can find out by following this guide:

  • 1.1: Navigate to the farms contract (v1 or v2) on Polygonscan, navigate to Read Contract and call the userInfofunction and input the farms PID and your wallet address and press query, like this:

      • If the Amountfield is a non zero value, it means that you have a farm in this contract and you can proceed to the next step.

  • 1.2: On the same farms page on PolygonScan, navigate to the WriteContractfield, select the withdraw function and input the farms PID and the amount found on the userInfo field, then press write and sign the transaction. This should withdraw the LP tokens to your wallet, to be deposited to exchange

  • 1.3: On the same farms page, query the poolInfo function by passing the PID to be used later (Depositing LP tokens to exchange steps)

Deposit LP Tokens to IDEX to Unwind

  1. After you have withdrawn your LP tokens from farms, you must deposit the LP tokens to the exchange

    • 1.1: Check how much you have in your balances. Query the balanceOf function on the LP contract itself to get the full value:

    • 1.2: Copy the full amount value and navigate to the exchange contract on Polygonscan, click on Write Contract then select depositTokenByAddress and input the amount on the quantityInAssetUnits field and the lpToken contract copied from Farms Withdrawal, 2, i tokenAddressfield then hit write and sign the transaction

Note: If you receive an error when depositing LP tokens to the contract, make sure that you haven't revoked (Ie: removed allowance, 0 approval). If you somehow revoked the contract, you will need to manually approve the LP tokens for the exchange contract.

  • How to check if you have allowance (approved)

    1. Navigate to the LP token contract, then ReadContract and expand the Allowancefunction

    2. 2.1: Input your wallet address on the owner field and the exchange contract address on the spender field and click query to view the allowance

      • 2.2: If the call returns 115792089237316195423570985008687907853269984665640564039457584007913129639935 it means you approved and have the max value as allowance. If it's less but not receiving any errors, then you can proceed.

    3. If you don't have an allowance for the contract, you'll need to approve manually. First check your LP token balance by navigating to the LP contract > Read Only > then click balanceOf function to expand it and input your wallet address and copy the balance:

    4. Once you have copied their balance, then you’ll need to approve it. On the same LP token page, navigate to the Write Contract page then click expandthe approve function and the user can input the exchange contract on the spender field, and the balance they copied from step #3 on the amount field, then click write and sign the transaction.

Unwinding LP Tokens

  1. First, navigate to the LP contract on Polygonscan and select Read Only. Now find the baseAssetAddress and quoteAssetAddress, click to expand and copy the addresses

  2. Navigate to the exchange contract and click Write Contract and scroll down to removeLiquidityExit and paste the baseAssetAddress and quoteAssetAddress on the fields, click write then sign the transaction:

Withdrawing Tokens

  1. To initiate token withdrawals, you must call the exitWallet function from the exchange contract.

Note: To check if you have funds inside the contract, navigate to the exchange contract then click on Read Only function. Expand loadBalanceInAssetUnitsByAddress or similar functions (loadBalanceInAssetUnitsBySymbol, loadBalanceInPipsByAddress…) and enter the details on the fields. For example: For loadBalanceInAssetUnitsByAddress you will need to enter the wallet address and the asset’s contract address (if you have LP deposited, you will need to query the LP token contract address, or the token address if just tokens)

  1. Navigate to the exchange contract then Write Contract and scroll down to withdrawExit function. Click to expand and enter the asset’s contract address. Click write and sign the transaction:

Last updated