πŸ“‘EIP-1967 Transparent Proxy

EIP-1967, also known as ERC-1967, is a standard that defines specific storage slots for proxy contracts in Ethereum. It ensures that proxies store the address of their logic.

Used Code from other Frameworks/Smart Contracts (direct imports)

Imported packages:

"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol";
"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20VotesUpgradeable.sol";
"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
"./IPancakeSwapV2Factory.sol";

Background on EIP-1967

EIP-1967, formally titled "Standard Proxy Storage Slots," is an Ethereum Improvement Proposal aimed at standardizing how proxy contracts store critical information. Proxy contracts are a common pattern in Ethereum for creating upgradable smart contracts. These contracts delegate calls to a separate logic contract (implementation), allowing the logic to be updated without altering the proxy's address, which is crucial for maintaining state and compatibility with existing interactions.

This standardization prevents storage clashes between the proxy and logic contract, ensuring compatibility with tools like block explorers and enabling automated detection of proxy contracts. According to EIP 1967 Storage Slots for Proxies arrow-up-right, EIP-1967 is used by both the Universal Upgradeable Proxy Standard (UUPS) and the Transparent Upgradeable Proxy Pattern, highlighting its widespread adoption.

Role of Proxy Contracts in Upgradability

Smart contracts on Ethereum are immutable once deployed, meaning their code cannot be changed. However, for projects requiring flexibility, upgradability is essential. Proxy contracts address this by acting as a facade: they delegate calls to an implementation contract, and the implementation can be swapped out for a new version during upgrades. This is particularly useful for:

  • Fixing bugs or security vulnerabilities without redeploying.

  • Adding new features or improving functionality.

  • Maintaining backward compatibility with existing users, tokens, or other contracts.

Without a proxy, upgrading would involve deploying a new contract and migrating all state, which is complex, gas-intensive, and risky. EIP-1967, as noted in EIP-1967 Standard Proxy Storage Slots arrow-up-rightensures a consistent storage layout, making it easier for off-chain tools to interact with and display proxy information.

Last updated