Web3 Dictionary Logo
Web3 Dictionary
Contribute

Categories

AllBlockchainDappsDAOsDeFiNFTsRegulationSecuritySmart ContractsTokenomicsWalletsWeb3 GamingOthers
  1. Web3 Dictionary
  2. Smart Contracts
  3. Delegatecall
Smart Contracts

Delegatecall

A low-level Solidity function that executes code from another contract while preserving the calling contract's context.

Last Updated

2026-03-19

Related Concepts

Smart ContractSolidityContract CallProxy Contract
Web3-Explorer Logo

Scale Blockchain Infra

AD

Smart contracts, protocol integrations, and scalable architecture for high-performance Web3 products.

See Blockchain Services

What is Delegatecall?

A delegate call is a low-level function in Solidity that allows a contract to execute code from another contract while keeping the context (storage and balance) of the calling contract.

How does Delegatecall work?

  1. Contract A calls Contract B using delegatecall.
  2. The code from Contract B is executed.
  3. Any changes to storage happen in Contract A's memory space.
  4. The value of msg.sender and msg.value remain what they were for Contract A.
  5. It is essentially like Contract A "borrowing" the logic of Contract B to use on its own data.

Why does Delegatecall matter?

It is the foundation of "Proxy Contracts" and "Upgradeable Smart Contracts." It allows developers to change the logic of a protocol (by pointing to a new implementation contract) without moving the user's data or funds.

Key features of Delegatecall

  • Preserves the calling contract's state
  • Executes external logic in local context
  • Foundation for upgradeability
  • More gas-efficient for certain patterns
  • High security risk if implemented incorrectly

Examples of Delegatecall

  • A "Proxy" contract delegating to an "Implementation" contract.
  • Using a "Library" in Solidity to perform math or string operations.
  • The "Diamond Standard" (ERC-2535) for building modular, multi-contract systems.

External References

  • Solidity Docs: Delegatecall
  • Ethereum.org: Upgrading Smart Contracts