u
u
upgradable
Search…
Broken Proxy
Try this:
1
contract Proxy {
2
3
address public implementation;
4
5
function setAddress(address a) external {
6
implementation = a;
7
}
8
9
function () external payable {
10
address impl = implementation;
11
assembly {
12
let ptr := mload(0x40)
13
calldatacopy(ptr, 0, calldatasize)
14
let result := delegatecall(gas, impl, ptr, calldatasize, 0, 0)
15
let size := returndatasize
16
returndatacopy(ptr, 0, size)
17
18
switch result
19
case 0 { revert(ptr, size) }
20
default { return(ptr, size) }
21
}
22
23
}
24
25
}
26
Copied!
And use this contract to delegate to:
1
contract Score {
2
uint public score;
3
4
function setScore(uint _score) external {
5
score = _score;
6
}
7
}
Copied!
Fix this contract.
Try This
1
contract Score {
2
bytes32 myHash = keccak256("This is awesome");
3
uint public score;
4
5
function setScore(uint _score) external {
6
score = _score;
7
}
8
}
Copied!
Last modified 2yr ago
Copy link