A deployed smart contract has public view functions that searchs into mapping of struct with a for loop.
The problem is that in the 500 loop lap of data (there are 10,000 indexes and growing..) the blockchain return:
{ "code": -32000, "message": "out of gas" } Then, contract is now useless. Any idea of how to control the GASLEFT and exit of the loop before OUT of GAS?
Thanks!