Contract’s don’t (more accurately almost never) pay for gas. Gas estimation is done when sending by the end user.
Some parts of gas estimation can be done statically, but some of the cost of certain operations are dependent on the data being loaded from the state. I’d like a tool to set an upper bound on gas usage (current approach is to execute the tx on pending state and add 10-30%), but solidity does not provide one.
Some parts of gas estimation can be done statically, but some of the cost of certain operations are dependent on the data being loaded from the state. I’d like a tool to set an upper bound on gas usage (current approach is to execute the tx on pending state and add 10-30%), but solidity does not provide one.