pragma solidity ^0.6.8;
pragma experimental ABIEncoderV2;
contract ZoraProxyStorage {
address public implementation;
address public admin;
modifier onlyAdmin() {
require(
admin == msg.sender,
"ZoraProxyStorage: only admin"
);
_;
}
}
// SPDX-License-Identifier: MIT
contract ZoraProxy is ZoraProxyStorage {
/* ============ Constructor ============ */
constructor(
address _implementation,
address _admin
)
public
{
implementation = _implementation;
admin = _admin;
}
function setAdmin(
address _admin
)
public
onlyAdmin
{
admin = _admin;
}
function setImplementation(
address _implementation
)
public
onlyAdmin
{
implementation = _implementation;
}
fallback() external payable {
// solium-disable-next-line security/no-inline-assembly
assembly {
let target := sload(0)
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), target, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch result
case 0 {revert(0, returndatasize())}
default {return (0, returndatasize())}
}
}
}
{
"compilationTarget": {
"ZoraProxy.sol": "ZoraProxy"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"_implementation","type":"address"},{"internalType":"address","name":"_admin","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"setAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_implementation","type":"address"}],"name":"setImplementation","outputs":[],"stateMutability":"nonpayable","type":"function"}]