Only delegate calls to view or pure functions from a proxy


Is there a way to restrict the fallback of a proxy to use delegatecall only for pure or view functions of the logic contract and revert for functions that would potentially modify the logic contracts state?

1 Like

Emmm, I think if a function was declared as view and pure, then it can not change the contract state. You can find more about view function in the solidity doc.

1 Like

Hi @mattsse,

Welcome to the community :wave:.

I am not sure if you can tell if a function is pure/view from Solidity, so I am not sure if this is possible.

It’s not possible to detect. There is a proposed IS_STATIC opcode that would allow detecting that the context is a static call, as is generally the case for view functions.