Say I have a contract Foo
with method bar
that has a gas cost per call of x
, now say I choose to implement a proxy contract Proxy
for interacting with Foo
to allow for upgradability to FooV2
if the need arises, what additional gas cost is incurred for invoking Foo.bar()
via the Proxy
contract as opposed to directly calling it? I'm assuming it should be a fixed static additional gas independent of the method called.
-
Based on my understanding this OpenZeppelin forum discussion it varies based on the proxy pattern from [~1500, ~3000], though I'm not sure if the overhead is independent of the implementation contract method, etc. forum.openzeppelin.com/t/…– MShakeGDec 29, 2021 at 20:33
-
It is not fixed the input data has to be copied into memory and the same with the returned data.– Ismael ♦Jan 2, 2022 at 5:04
1 Answer
There's no static answer for this. It depends on storage layout as well as overall layout of proxy contract. But it is in range of few hundred to few thousand more. In your case, should be few hundred.