5

Does it save gas to link to the bytecode of an interface? I tested this is solidity remix and using the interface to link bytecode instead of the full contract, didn't seem to reduce any gas costs for deployment. Am I mistaken that the bytecode of an interface is smaller than the full contract?

1 Answer 1

1

I'm not entirely clear on what the situation is, so my answer might not be relevant to what you're looking for (or indeed it may be mistaken).

My understanding is that if you're deploying a contract that interfaces with another, the interfaced contract doesn't get compiled into the deployed contract's bytecode; all that is compiled is what is necessary for the deployed contract to interface with the provided functions, i.e. the function signatures in the interfaced contract.

By that reasoning, linking the interfaced contract's ABI vs the full contract would not reduce gas costs because in both cases only the function signatures are included and the implementation of the interfaced contract's functions is not used.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.