Verified contractExactMIT
Proxy
Address0x30e69da9bc8b1f43bcb2604152ccbe65fefa680f
- Balance
0 ETH
- Transactions
93
- Compiler
solc 0.8.7
- Same code
11 more contracts
Details
- Compiler
- solc 0.8.7+commit.e28d00a7
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- london
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 14,680,598
- Creation transaction
- 0xc4ec3129dc…03b80058fb
- Proxy implementation
- 0x65eede3c…133a6128MetaAndMagicSale
- Main copy (most transactions)
- 0xc4a5025c…4dad58eb
contracts/Proxy.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
/// @dev Proxy for NFT Factory
contract Proxy {
// Storage for this proxy
bytes32 private constant IMPLEMENTATION_SLOT = bytes32(0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc);
bytes32 private constant ADMIN_SLOT = bytes32(0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103);
constructor(address impl) {
require(impl != address(0));
_setSlotValue(IMPLEMENTATION_SLOT, bytes32(uint256(uint160(impl))));
_setSlotValue(ADMIN_SLOT, bytes32(uint256(uint160(msg.sender))));
}
function setImplementation(address newImpl) public {
require(msg.sender == _getAddress(ADMIN_SLOT));
_setSlotValue(IMPLEMENTATION_SLOT, bytes32(uint256(uint160(newImpl))));
}
function setAdmin(address newAdmin) public {
require(msg.sender == _getAddress(ADMIN_SLOT));
_setSlotValue(ADMIN_SLOT, bytes32(uint256(uint160(newAdmin))));
}
function implementation() public view returns (address impl) {
impl = address(uint160(uint256(_getSlotValue(IMPLEMENTATION_SLOT))));
}
function _getAddress(bytes32 key) internal view returns (address add) {
add = address(uint160(uint256(_getSlotValue(key))));
}
function _getSlotValue(bytes32 slot_) internal view returns (bytes32 value_) {
assembly {
value_ := sload(slot_)
}
}
function _setSlotValue(bytes32 slot_, bytes32 value_) internal {
assembly {
sstore(slot_, value_)
}
}
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _delegate(address implementation__) internal virtual {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation__, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
receive() external payable {}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
* function in the contract matches the call data.
*/
fallback() external payable virtual {
_delegate(_getAddress(IMPLEMENTATION_SLOT));
}
}
Compiler settingsShow
{
"metadata": {
"bytecodeHash": "ipfs"
},
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "london",
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.