dethcrypto / TypeChain

🔌 TypeScript bindings for Ethereum smart contracts
MIT License
2.73k stars 353 forks source link

Overrides for `staticCall` and `staticCallResult` should always be viewOverrides in ethers-v6 #861

Closed paco0x closed 10 months ago

paco0x commented 10 months ago

Now the staticCall and staticCallResult is using the overrides same the state mutability defined on the contract function. Thus we can not use override properties like 'blockTag' for staticCall in a historical block.

e.g.

Contract A {
    function x() external payable returns(unit);
}

Use staticCall for this function with a blockTag:

const result  = await a.x.staticCall({blockTag: 100000})

But the payableOverrides is not allowing us to use blockTag in the overrides. So we should always use viewOverides in staticCall and staticCallResult parameters.