Complete the code to declare the proxy contract's storage variable for the implementation address.
address public [1];owner or admin instead of implementation.public.The proxy contract stores the address of the implementation contract in a variable named implementation.
Complete the fallback function to delegate calls to the implementation contract.
fallback() external payable {
(bool success, ) = [1].delegatecall(msg.data);
require(success, "Delegatecall failed");
}owner or msg.sender instead of implementation.call instead of delegatecall.The fallback function uses delegatecall to forward calls to the implementation contract.
Fix the error in the upgrade function to correctly update the implementation address.
function upgradeTo(address newImplementation) external {
require(newImplementation != address(0), "Invalid address");
[1] = newImplementation;
}owner or admin instead of implementation.The upgrade function must update the implementation address to the new contract address.
Fill both blanks to create a mapping for admin addresses and a modifier to restrict access.
mapping(address => bool) public [1]; modifier only[2]() { require(admins[msg.sender], "Not admin"); _; }
The mapping is named admins and the modifier is onlyAdmins to restrict function calls to admins.
Fill all three blanks to write a dictionary comprehension that maps function selectors to implementation addresses if the selector is valid.
mapping(bytes4 => address) public [1] = { [2]: [3] for selector in selectors if isValid(selector) };
selectors with the key variable selector.This comprehension creates a mapping named selectorToImpl from each valid selector to the implementation address.