文件 1 的 1:Proxy.sol
pragma solidity 0.6.12;
contract Proxy {
uint256 constant PROXIABLE_SLOT = 0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7;
constructor(address contractLogic) public {
require(contractLogic != address(0), "Contract Logic cannot be 0x0");
assembly {
sstore(PROXIABLE_SLOT, contractLogic)
}
}
fallback() external payable {
assembly {
let contractLogic := sload(PROXIABLE_SLOT)
let ptr := mload(0x40)
calldatacopy(ptr, 0x0, calldatasize())
let success := delegatecall(gas(), contractLogic, ptr, calldatasize(), 0, 0)
let retSz := returndatasize()
returndatacopy(ptr, 0, retSz)
switch success
case 0 {
revert(ptr, retSz)
}
default {
return(ptr, retSz)
}
}
}
}
{
"compilationTarget": {
"Proxy.sol": "Proxy"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}