Skip to main content

NoDelegateCall

Git Source

This contract implements logic to prevent delegate calls.

State Variables

ORIGINAL

The address of the original contract that was deployed.

address private immutable ORIGINAL;

Functions

constructor

Sets the original contract address.

constructor();

noDelegateCall

Prevents delegate calls.

modifier noDelegateCall();

_preventDelegateCall

This function checks whether the current call is a delegate call, and reverts if it is.

  • A private function is used instead of inlining this logic in a modifier because Solidity copies modifiers into every function that uses them. The ORIGINAL address would get copied in every place the modifier is used, which would increase the contract size. By using a function instead, we can avoid this duplication of code and reduce the overall size of the contract.
function _preventDelegateCall() private view;