It depends. Gas price is set for each instruction in the EVM, and you can see exactly which instructions will be run in a smart contract. In this sense, you can absolutely know how much gas a function in a contract will cost. The tricky part is that there can be loops/jumps that will change how many times a function runs, and that can't be known sometimes.
You are viewing a single comment's thread from: