When i deploy a smartcontract with remix, i can call functions in order to test it.
I do not really know if this is remix or metamask which is doing this job: Before validating the transaction, i have a popup which tells me if the execution of the function will cause an error. And i know how much gas the function will consume.
So i suppose there is a kind of "pre-execution" of the smartcontract's code, before sending the transaction.
What i want to know if it is possible to do the same thing inside a solidity smartcontract.
Is it possible to know how much gas is necessary before calling an external contract inside a solidity function ? And is it possible to pre-execute it in order to see if it will fails ?
Thanks