How Does the ‘Delegatecall’ Opcode Enable the Proxy Pattern?

The 'delegatecall' opcode executes code from a specified target contract (the logic contract) but crucially runs it within the context of the calling contract (the proxy contract). This means that any state changes made by the logic contract's code are saved to the storage of the proxy contract, effectively allowing the proxy to maintain its state while using external, changeable logic.

What Is the Relative Gas Cost of a ‘Delegatecall’ Compared to a Regular ‘Call’?
How Does a contract’S Storage Layout Become Critical With’delegatecall’?
What Happens to a Contract’s State Variables during a Mutable Upgrade?
What Is the Security Vulnerability Known as “Storage Collision” in Proxy Patterns?
What Is the Primary Difference between a ‘View’ Function and a ‘State-Changing’ Function?
Does the Proxy Pattern Affect the Cost of Contract Deployment?
What Is the Role of a Proxy Contract in Maintaining Upgradability?
What Is the Difference between ‘Call’ and ‘Delegatecall’?

Glossar