1

I have a smart contract in vyper (SomeContract) that gets called within another smart contract:

some_contract: address = _some_contract
SomeContract(some_contract).foo() # Is there a cost incurred here with SomeContract()?
SomeContract(some_contract).foo()

vs

some_contract: SomeContract = SomeContract(_some_contract)
some_contract.foo()
some_contract.foo()

Does using SomeContract(some_contract) to obtain an abstraction cost gas?

Which of the two versions is cheaper?

1

No, the expression SomeContract(some_contract) is resolved during compilation time.

It has no runtime impact whatsoever (gas cost or other).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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