Proxy contract
Course: Upgradable staking contract - chapter 5
To ensure smooth upgradability, we should introduce a proxy contract that lets us upgrade from one implementation to another
pragma solidity ^0.8.0;
contract StakingProxy { uint256 public totalStaked; mapping(address => uint256) public stakedBalances;
address public implementation;
constructor(address _implementation) { implementation = _implementation; }
fallback() external payable { // Forward the call to the implementation contract (bool success, ) = implementation.delegatecall(msg.data); require(success, "Delegatecall failed"); }}$1bAssignment
Section titled “Assignment”Write the end to end test for it