title: Sushiswap pairadress contract .estimateGas.swap throws server error
body: <p>I'm working on an arbitrage trading bot, using ethers.js in my JavaScript file that is calling my flashloan smartcontract, testing on Kovan.</p>
  <p>I deployed a flashloan smartcontract on the kovan network.
  0x236f6860b31F6226d5937EC0Bd9465B12C2b20cA</p>
  <p>In my JavaScript file, I want to estimate the gas that will be used when I call this contract.
  However, I'm always receiving a server error.</p>
  <p>When I call this flashloan contract from my pair contract address, it does work.
  So I assume the problem is not inside the flashloan smartcontract that is called.</p>
  <p>This is part of my code:</p>
  <pre><code>const provider = new ethers.providers.InfuraProvider(&quot;kovan&quot;, kovanKey);
  const wallet = new ethers.Wallet(privateKey, provider);
  let pairAd2 = &quot;0x052AE8b0F7E5c610937920e46ED265c2063Cb7B8&quot;;
  let  uniToken0Token1 = new ethers.Contract(
            pairAd2,
             UniV2Pair.abi, wallet,
           );
  const gl = await uniToken0Token1.estimateGas.swap(
                 0,
                 10,
                 flashLoanerAddress,
                 ethers.utils.toUtf8Bytes('1')
               );
  </code></pre>
  <p>This will throw this error:</p>
  <pre><code>processing response error (body=&quot;{\&quot;jsonrpc\&quot;:\&quot;2.0\&quot;,\&quot;id\&quot;:45,\&quot;error\&quot;:{\&quot;code\&quot;:-32016,\&quot;data\&quot;:\&quot;Reverted\&quot;,\&quot;message\&quot;:\&quot;The execution failed due to an exception.\&quot;}}&quot;, error={&quot;code&quot;:-32016,&quot;data&quot;:&quot;Reverted&quot;}, requestBody=&quot;{\&quot;method\&quot;:\&quot;eth_estimateGas\&quot;,\&quot;params\&quot;:[{\&quot;from\&quot;:\&quot;0x8da6ae9837c8bb55fc6c0a0ec1ee3000942af8f4\&quot;,\&quot;to\&quot;:\&quot;0x4d027027af6dfa0a14332223fedfc8289d205088\&quot;,\&quot;data\&quot;:\&quot;0x022c0d9f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000236f6860b31f6226d5937ec0bd9465b12c2b20ca000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000013100000000000000000000000000000000000000000000000000000000000000\&quot;}],\&quot;id\&quot;:45,\&quot;jsonrpc\&quot;:\&quot;2.0\&quot;}&quot;, requestMethod=&quot;POST&quot;, url=&quot;https://kovan.infura.io/v3/.................&quot;, code=SERVER_ERROR, version=web/5.5.1)
   reason: 'processing response error',
    code: 'SERVER_ERROR',
    body: '{&quot;jsonrpc&quot;:&quot;2.0&quot;,&quot;id&quot;:45,&quot;error&quot;:{&quot;code&quot;:-32016,&quot;data&quot;:&quot;Reverted&quot;,&quot;message&quot;:&quot;The execution failed due to an exception.&quot;}}',
  .
  .
  .
   code: -32016,
      data: 'Reverted'
    },
    requestBody: '{&quot;method&quot;:&quot;eth_estimateGas&quot;,&quot;params&quot;:[{&quot;from&quot;:&quot;0x8da6ae9837c8bb55fc6c0a0ec1ee3000942af8f4&quot;,&quot;to&quot;:&quot;0x4d027027af6dfa0a14332223fedfc8289d205088&quot;,&quot;data&quot;:&quot;0x022c0d9f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000236f6860b31f6226d5937ec0bd9465b12c2b20ca000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000013100000000000000000000000000000000000000000000000000000000000000&quot;}],&quot;id&quot;:45,&quot;jsonrpc&quot;:&quot;2.0&quot;}',
    requestMethod: 'POST',
    url: 'https://kovan.infura.io/v3/......................'
  </code></pre>
  <p>Which I don't understand, I've been searching for days.</p>
  <p>Or how can I see more information maybe about the error/cause?</p>