Get outOfGas error when try to supplytokens to contract

Here is my code of market contract:https://github.com/compolabs/sway-lend/blob/beta-4/contracts/market/src/main.sw

I try to call supplyBase fn, and also I have 0.5ETH ,but keep getting outOfGas error. Tried to increase gasLimit from 1 to 100000 but it didn’t help anyway


const  marketContract = MarketAbi__factory.connect(market, wallet);

    return market.functions
      .supply_base()
      .callParams({
        forward: {
          amount: this.tokenAmount.toString(),
          assetId: this.baseToken.assetId,
        },
      })
      .txParams({ gasPrice: 100000 })
      .call();
  

Abis that I use:https://github.com/compolabs/sway-lend/tree/beta-4/frontend/src/contracts
“fuels”: “^0.54.0”,

@sway Interesting. Can you try specifying the gasLimit instead of gasPrice? You can use the same value.

Same error

Found solution , added gasLimit to callParams

instead of

 return market.functions
      .supply_base()
      .callParams({
        forward: {
          amount: this.tokenAmount.toString(),
          assetId: this.baseToken.assetId,
        },
      })
     .txParams({ gasPrice: 100000 })
      .call();

changed to

return market.functions
      .supply_base()
      .callParams({
        forward: {
          amount: this.tokenAmount.toString(),
          assetId: this.baseToken.assetId,
        },
        gasLimit: 100000,
      })
      .call();
1 Like

Oh compolabs, fastest gun in town :cowboy_hat_face:

Actually, this might be a problem.

Follow-up issue:

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.