Source Code
Overview
S Balance
0 S
More Info
ContractCreator
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x6021C87F...f5Aa61E59 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
PeerToPlayDefaultImplementation
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {Variables} from "../variables.sol"; /** * @title Index Interface * @dev Interface to retrieve the list address from the PeerToPlayFactory. */ interface IndexInterface { /** * @dev Returns the address of the list contract. */ function list() external view returns (address); } /** * @title List Interface * @dev Interface for adding and removing authorized users in PeerToPlay. */ interface ListInterface { /** * @dev Adds authorization for a user. * @param user Address of the user. */ function addAuth(address user) external; /** * @dev Removes authorization for a user. * @param user Address of the user. */ function removeAuth(address user) external; } /** * @title Constants * @dev Defines constants and immutable variables used in the PeerToPlay contract. */ contract Constants is Variables { uint256 public constant implementationVersion = 1; // PeerToPlayFactory Address. address public immutable peerToPlayFactory; // The Account Module Version. uint256 public constant version = 1; constructor(address _peerToPlayFactory) { peerToPlayFactory = _peerToPlayFactory; } } /** * @title Record * @dev Provides functionality to enable and disable user authorization, and token receiver functions. */ contract Record is Constants { constructor(address _peerToPlayFactory) Constants(_peerToPlayFactory) {} event LogEnableUser(address indexed user); event LogDisableUser(address indexed user); /** * @dev Checks if a user is authorized. * @param user Address of the user. * @return bool True if authorized, otherwise false. */ function isAuth(address user) public view returns (bool) { return _auth[user]; } /** * @dev Enables a new user by adding them to the authorized list. * @param user Address of the user to enable. */ function enable(address user) public { require( msg.sender == address(this) || msg.sender == peerToPlayFactory, "not-self-index" ); require(user != address(0), "not-valid"); require(!_auth[user], "already-enabled"); _auth[user] = true; ListInterface(IndexInterface(peerToPlayFactory).list()).addAuth(user); emit LogEnableUser(user); } /** * @dev Disables a user by removing them from the authorized list. * @param user Address of the user to disable. */ function disable(address user) public { require(msg.sender == address(this), "not-self"); require(user != address(0), "not-valid"); require(_auth[user], "already-disabled"); delete _auth[user]; ListInterface(IndexInterface(peerToPlayFactory).list()).removeAuth( user ); emit LogDisableUser(user); } /** * @dev ERC721 token receiver function to handle the receipt of ERC721 tokens. * @return bytes4 Function selector for ERC721 token receipt. */ function onERC721Received( address, address, uint256, bytes calldata ) external returns (bytes4) { return 0x150b7a02; // bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")) } /** * @dev ERC1155 token receiver function to handle the receipt of single ERC1155 tokens. * @return bytes4 Function selector for single ERC1155 token receipt. */ function onERC1155Received( address, address, uint256, uint256, bytes memory ) external returns (bytes4) { return 0xf23a6e61; // bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)")) } /** * @dev ERC1155 batch token receiver function to handle the receipt of multiple ERC1155 tokens. * @return bytes4 Function selector for batch ERC1155 token receipt. */ function onERC1155BatchReceived( address, address, uint256[] calldata, uint256[] calldata, bytes calldata ) external returns (bytes4) { return 0xbc197c81; // bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)")) } } /** * @title PeerToPlayDefaultImplementation * @dev Main contract for PeerToPlay default implementation, inherits Record functionalities. */ contract PeerToPlayDefaultImplementation is Record { constructor(address _peerToPlayFactory) Record(_peerToPlayFactory) {} /** * @dev Fallback function to receive Ether directly. */ receive() external payable {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title Variables * @dev This contract manages the authorization settings for the platform. */ contract Variables { /// @dev Mapping of address to boolean indicating authorization status. mapping (address => bool) internal _auth; }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
[{"inputs":[{"internalType":"address","name":"_peerToPlayFactory","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"LogDisableUser","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"LogEnableUser","type":"event"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"disable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"enable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"implementationVersion","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"isAuth","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"peerToPlayFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Deployed Bytecode
0x60806040526004361061008a5760003560e01c80635bfa1b68116100595780635bfa1b681461014c578063ab23b6181461016e578063bc197c81146101ba578063e6c09edf146101e9578063f23a6e611461020957600080fd5b806306bfcec614610096578063150b7a02146100be5780632520e7ff1461010357806354fd4d501461009657600080fd5b3661009157005b600080fd5b3480156100a257600080fd5b506100ab600181565b6040519081526020015b60405180910390f35b3480156100ca57600080fd5b506100ea6100d93660046106ef565b630a85bd0160e11b95945050505050565b6040516001600160e01b031990911681526020016100b5565b34801561010f57600080fd5b5061013c61011e366004610762565b6001600160a01b031660009081526020819052604090205460ff1690565b60405190151581526020016100b5565b34801561015857600080fd5b5061016c610167366004610762565b610235565b005b34801561017a57600080fd5b506101a27f0000000000000000000000009fc1c2eee94b288db1b8fdc46026ab034c15d73281565b6040516001600160a01b0390911681526020016100b5565b3480156101c657600080fd5b506100ea6101d53660046107cb565b63bc197c8160e01b98975050505050505050565b3480156101f557600080fd5b5061016c610204366004610762565b610482565b34801561021557600080fd5b506100ea6102243660046108a0565b63f23a6e6160e01b95945050505050565b3330148061026b5750336001600160a01b037f0000000000000000000000009fc1c2eee94b288db1b8fdc46026ab034c15d73216145b6102ad5760405162461bcd60e51b815260206004820152600e60248201526d0dcdee85ae6cad8cc5ad2dcc8caf60931b60448201526064015b60405180910390fd5b6001600160a01b0381166102ef5760405162461bcd60e51b81526020600482015260096024820152681b9bdd0b5d985b1a5960ba1b60448201526064016102a4565b6001600160a01b03811660009081526020819052604090205460ff161561034a5760405162461bcd60e51b815260206004820152600f60248201526e185b1c9958591e4b595b98589b1959608a1b60448201526064016102a4565b6001600160a01b0380821660009081526020818152604091829020805460ff191660011790558151630f560cd760e01b815291517f0000000000000000000000009fc1c2eee94b288db1b8fdc46026ab034c15d73290931692630f560cd79260048082019392918290030181865afa1580156103ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ee919061098a565b604051632a11112760e11b81526001600160a01b0383811660048301529190911690635422224e90602401600060405180830381600087803b15801561043357600080fd5b505af1158015610447573d6000803e3d6000fd5b50506040516001600160a01b03841692507ff2655ca50c134f2081360f02a1bf4714b79d312ffc82f90953fbb323f76d2e169150600090a250565b3330146104bc5760405162461bcd60e51b81526020600482015260086024820152673737ba16b9b2b63360c11b60448201526064016102a4565b6001600160a01b0381166104fe5760405162461bcd60e51b81526020600482015260096024820152681b9bdd0b5d985b1a5960ba1b60448201526064016102a4565b6001600160a01b03811660009081526020819052604090205460ff166105595760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e4b591a5cd8589b195960821b60448201526064016102a4565b6001600160a01b0380821660009081526020818152604091829020805460ff191690558151630f560cd760e01b815291517f0000000000000000000000009fc1c2eee94b288db1b8fdc46026ab034c15d73290931692630f560cd79260048082019392918290030181865afa1580156105d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105fa919061098a565b604051630fe7fb2360e31b81526001600160a01b0383811660048301529190911690637f3fd91890602401600060405180830381600087803b15801561063f57600080fd5b505af1158015610653573d6000803e3d6000fd5b50506040516001600160a01b03841692507f872bc86c6a0d7426cb60e1e35fda9dc5fbc0ddbd5564ecb5ca309626f7462abe9150600090a250565b6001600160a01b03811681146106a357600080fd5b50565b60008083601f8401126106b857600080fd5b50813567ffffffffffffffff8111156106d057600080fd5b6020830191508360208285010111156106e857600080fd5b9250929050565b60008060008060006080868803121561070757600080fd5b85356107128161068e565b945060208601356107228161068e565b935060408601359250606086013567ffffffffffffffff81111561074557600080fd5b610751888289016106a6565b969995985093965092949392505050565b60006020828403121561077457600080fd5b813561077f8161068e565b9392505050565b60008083601f84011261079857600080fd5b50813567ffffffffffffffff8111156107b057600080fd5b6020830191508360208260051b85010111156106e857600080fd5b60008060008060008060008060a0898b0312156107e757600080fd5b88356107f28161068e565b975060208901356108028161068e565b9650604089013567ffffffffffffffff8082111561081f57600080fd5b61082b8c838d01610786565b909850965060608b013591508082111561084457600080fd5b6108508c838d01610786565b909650945060808b013591508082111561086957600080fd5b506108768b828c016106a6565b999c989b5096995094979396929594505050565b634e487b7160e01b600052604160045260246000fd5b600080600080600060a086880312156108b857600080fd5b85356108c38161068e565b945060208601356108d38161068e565b93506040860135925060608601359150608086013567ffffffffffffffff808211156108fe57600080fd5b818801915088601f83011261091257600080fd5b8135818111156109245761092461088a565b604051601f8201601f19908116603f0116810190838211818310171561094c5761094c61088a565b816040528281528b602084870101111561096557600080fd5b8260208601602083013760006020848301015280955050505050509295509295909350565b60006020828403121561099c57600080fd5b815161077f8161068e56fea2646970667358221220b9695b0d12664970467c2c5acab03367ac4fdfaca6527f324e419bfbd124b20564736f6c63430008140033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.