title: Etherjs: TypeError: contract.XXX is not a function
body: <p>I'm trying to call a function named &quot;remove_liquidity_one_coin&quot; from a smartcontract on FTM network, but I get following error and cannot figure out why:</p>
  <p><code>TypeError: curveContract.remove_liquidity_one_coin is not a function</code></p>
  <p>Usually, when I want to call functions of a contract, I take the ABI, the contract address, then I instantiate it and I can use its functions.</p>
  <p>For the contract below, It works well for &quot;read&quot; functions, but not &quot;write&quot; functions like <code>remove_liquidity_one_coin</code>.</p>
  <p>Here is the simplified code I use:</p>
  <pre class="lang-js prettyprint-override"><code>let signer = new ethers.Wallet(privateKey, provider)
  let contractAddress = &quot;0xa58f16498c288c357e28ee899873ff2b55d7c437&quot;
  let contractAbi = [...] // ABI of the contract. In this case: https://api.ftmscan.com/api?module=contract&amp;action=getabi&amp;address=0x3cabd83bca606768939b843f91df8f4963dbc079&amp;format=raw
  let curveContract = new ethers.Contract(contractAddress, contractAbi, signer)
  
  // Read function =&gt; works
  let liquidityToRemove = await curveContract.calc_withdraw_one_coin(
              lpTokenToWidraw, // Amount to withdraw
              0 // Index of the token to withdraw
  );
  
  // Write function =&gt; doesn't work
  let receivedCoins = await curveContract.remove_liquidity_one_coin(
      liquidityToRemove, // Amount to withdraw
      0, // Index of the token to receive
      expectedAmount // Expected amount to withdraw
  );   
  </code></pre>
  <p>Do you know what I am missing?</p>
  <p><strong>Edit</strong>
  I ended by using only the Abi of the functions I want. Example:</p>
  <pre><code>let signer = new ethers.Wallet(privateKey, provider)
  let contractAddress = &quot;0xa58f16498c288c357e28ee899873ff2b55d7c437&quot;
  let functionAbi = [&quot;function remove_liquidity_one_coin(uint256 burn_amount, int128 i, uint256 min_received) public returns (uint256)&quot;];
  let curveContract = new ethers.Contract(contractAddress, functionAbi, signer)
  
  // Write function =&gt; works
  let receivedCoins = await curveContract.remove_liquidity_one_coin(
      liquidityToRemove, // Amount to withdraw
      0, // Index of the token to receive
      expectedAmount // Expected amount to withdraw
  );
  </code></pre>