Source Code
Overview
S Balance
More Info
ContractCreator
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
PeerToPlayImplementationM1
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 PeerToPlayAccount * @dev Smart contract for managing PeerToPlay smart account wallet. */ interface ConnectorsInterface { /** * @dev Checks if the provided connector names are valid and returns their corresponding addresses. * @param connectorNames Array of connector names to validate. * @return bool indicating if all names are valid, and an array of connector addresses. */ function isConnectors( string[] calldata connectorNames ) external view returns (bool, address[] memory); } /** * @title Constants * @dev Contract that defines immutable constants such as the factory and connectors addresses. */ contract Constants is Variables { // Address of the PeerToPlayFactory contract. address internal immutable peerToPlayFactory; // Address of the connectors module. address public immutable connectorsM1; constructor(address _peerToPlayFactory, address _connectors) { connectorsM1 = _connectors; peerToPlayFactory = _peerToPlayFactory; } } /** * @title PeerToPlayImplementationM1 * @dev Contract for executing delegated calls to connectors for PeerToPlay smart accounts. */ contract PeerToPlayImplementationM1 is Constants { constructor( address _peerToPlayFactory, address _connectors ) Constants(_peerToPlayFactory, _connectors) {} /** * @dev Decodes the event data from the response of a delegated call. * @param response The response bytes from the call. * @return _eventCode The event code as a string. * @return _eventParams The parameters of the event as bytes. */ function decodeEvent( bytes memory response ) internal pure returns (string memory _eventCode, bytes memory _eventParams) { if (response.length > 0) { (_eventCode, _eventParams) = abi.decode(response, (string, bytes)); } } /** * @dev Emitted when a cast operation is executed from the PeerToPlay account. * @param origin The origin address initiating the cast. * @param sender The sender address performing the cast. * @param value The amount of Ether sent with the cast. * @param targetsNames The names of the target connectors. * @param targets The addresses of the target connectors. * @param eventNames The names of the events triggered. * @param eventParams The parameters of the triggered events. */ event LogCast( address indexed origin, address indexed sender, uint256 value, string[] targetsNames, address[] targets, string[] eventNames, bytes[] eventParams ); receive() external payable {} /** * @dev Delegate a call to a connector. * @param _target The address of the connector to delegate to. * @param _data The calldata for the function call. * @return response The response bytes from the delegated call. */ function spell( address _target, bytes memory _data ) internal returns (bytes memory response) { require(_target != address(0), "target-invalid"); assembly { let succeeded := delegatecall( gas(), _target, add(_data, 0x20), mload(_data), 0, 0 ) let size := returndatasize() response := mload(0x40) mstore( 0x40, add(response, and(add(add(size, 0x20), 0x1f), not(0x1f))) ) mstore(response, size) returndatacopy(add(response, 0x20), 0, size) switch iszero(succeeded) case 1 { // Revert if the delegatecall failed returndatacopy(0x00, 0x00, size) revert(0x00, size) } } } /** * @dev Executes multiple delegated calls to connectors. * @param _targetNames An array of target connector names. * @param _datas An array of calldata for each target connector. * @param _origin The address that initiated the cast. * @return Dummy return value to comply with PeerToPlayFactory buildWithCast function. */ function cast( string[] calldata _targetNames, bytes[] calldata _datas, address _origin ) external payable returns ( bytes32 // Dummy return to fix PeerToPlayFactory buildWithCast function ) { uint256 _length = _targetNames.length; require( _auth[msg.sender] || msg.sender == peerToPlayFactory, "1: permission-denied" ); require(_length != 0, "1: length-invalid"); require(_length == _datas.length, "1: array-length-invalid"); string[] memory eventNames = new string[](_length); bytes[] memory eventParams = new bytes[](_length); (bool isOk, address[] memory _targets) = ConnectorsInterface( connectorsM1 ).isConnectors(_targetNames); require(isOk, "1: not-connector"); for (uint i = 0; i < _length; i++) { bytes memory response = spell(_targets[i], _datas[i]); (eventNames[i], eventParams[i]) = decodeEvent(response); } emit LogCast( _origin, msg.sender, msg.value, _targetNames, _targets, eventNames, eventParams ); } }
// 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": {} }
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_peerToPlayFactory","type":"address"},{"internalType":"address","name":"_connectors","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"origin","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"string[]","name":"targetsNames","type":"string[]"},{"indexed":false,"internalType":"address[]","name":"targets","type":"address[]"},{"indexed":false,"internalType":"string[]","name":"eventNames","type":"string[]"},{"indexed":false,"internalType":"bytes[]","name":"eventParams","type":"bytes[]"}],"name":"LogCast","type":"event"},{"inputs":[{"internalType":"string[]","name":"_targetNames","type":"string[]"},{"internalType":"bytes[]","name":"_datas","type":"bytes[]"},{"internalType":"address","name":"_origin","type":"address"}],"name":"cast","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"connectorsM1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60c060405234801561001057600080fd5b50604051610b92380380610b9283398101604081905261002f91610062565b6001600160a01b0390811660a05216608052610095565b80516001600160a01b038116811461005d57600080fd5b919050565b6000806040838503121561007557600080fd5b61007e83610046565b915061008c60208401610046565b90509250929050565b60805160a051610ad36100bf60003960008181604b01526102750152600060d10152610ad36000f3fe60806040526004361061002d5760003560e01c80636254a08f146100395780639304c9341461008a57600080fd5b3661003457005b600080fd5b34801561004557600080fd5b5061006d7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b61009d6100983660046105b2565b6100ab565b604051908152602001610081565b33600090815260208190526040812054859060ff16806100f35750336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016145b61013b5760405162461bcd60e51b81526020600482015260146024820152730c4e881c195c9b5a5cdcda5bdb8b59195b9a595960621b60448201526064015b60405180910390fd5b8060000361017f5760405162461bcd60e51b81526020600482015260116024820152700c4e881b195b99dd1a0b5a5b9d985b1a59607a1b6044820152606401610132565b8084146101ce5760405162461bcd60e51b815260206004820152601760248201527f313a2061727261792d6c656e6774682d696e76616c69640000000000000000006044820152606401610132565b60008167ffffffffffffffff8111156101e9576101e9610636565b60405190808252806020026020018201604052801561021c57816020015b60608152602001906001900390816102075790505b50905060008267ffffffffffffffff81111561023a5761023a610636565b60405190808252806020026020018201604052801561026d57816020015b60608152602001906001900390816102585790505b5090506000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a0a32c0b8c8c6040518363ffffffff1660e01b81526004016102c1929190610707565b600060405180830381865afa1580156102de573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103069190810190610754565b915091508161034a5760405162461bcd60e51b815260206004820152601060248201526f189d103737ba16b1b7b73732b1ba37b960811b6044820152606401610132565b60005b8581101561042b5760006103d283838151811061036c5761036c610822565b60200260200101518c8c8581811061038657610386610822565b90506020028101906103989190610838565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061048f92505050565b90506103dd81610522565b8784815181106103ef576103ef610822565b6020026020010187858151811061040857610408610822565b6020026020010182905282905250505080806104239061087f565b91505061034d565b50336001600160a01b0316876001600160a01b03167ff6d9b29bbf2ae698de33670961ec53f895af65801d2cdaced431cc6129865347348e8e868a8a6040516104799695949392919061092a565b60405180910390a3505050505095945050505050565b60606001600160a01b0383166104d85760405162461bcd60e51b815260206004820152600e60248201526d1d185c99d95d0b5a5b9d985b1a5960921b6044820152606401610132565b600080835160208501865af43d6040519250601f19601f6020830101168301604052808352806000602085013e81156001810361051957816000803e816000fd5b50505092915050565b60608060008351111561054957828060200190518101906105439190610a0e565b90925090505b915091565b60008083601f84011261056057600080fd5b50813567ffffffffffffffff81111561057857600080fd5b6020830191508360208260051b850101111561059357600080fd5b9250929050565b6001600160a01b03811681146105af57600080fd5b50565b6000806000806000606086880312156105ca57600080fd5b853567ffffffffffffffff808211156105e257600080fd5b6105ee89838a0161054e565b9097509550602088013591508082111561060757600080fd5b506106148882890161054e565b90945092505060408601356106288161059a565b809150509295509295909350565b634e487b7160e01b600052604160045260246000fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b81835260006020808501808196508560051b810191508460005b878110156106fa5782840389528135601e198836030181126106b057600080fd5b8701858101903567ffffffffffffffff8111156106cc57600080fd5b8036038213156106db57600080fd5b6106e686828461064c565b9a87019a955050509084019060010161068f565b5091979650505050505050565b60208152600061071b602083018486610675565b949350505050565b604051601f8201601f1916810167ffffffffffffffff8111828210171561074c5761074c610636565b604052919050565b6000806040838503121561076757600080fd5b8251801515811461077757600080fd5b8092505060208084015167ffffffffffffffff8082111561079757600080fd5b818601915086601f8301126107ab57600080fd5b8151818111156107bd576107bd610636565b8060051b91506107ce848301610723565b81815291830184019184810190898411156107e857600080fd5b938501935b8385101561081257845192506108028361059a565b82825293850193908501906107ed565b8096505050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811261084f57600080fd5b83018035915067ffffffffffffffff82111561086a57600080fd5b60200191503681900382131561059357600080fd5b60006001820161089f57634e487b7160e01b600052601160045260246000fd5b5060010190565b60005b838110156108c15781810151838201526020016108a9565b50506000910152565b600081518084526020808501808196508360051b8101915082860160005b858110156106fa5782840389528151805180865261090b818888018985016108a6565b99860199601f01601f19169490940185019350908401906001016108e8565b8681526000602060a08184015261094560a08401888a610675565b838103604085015286518082528288019183019060005b818110156109815783516001600160a01b03168352928401929184019160010161095c565b5050848103606086015261099581886108ca565b9250505082810360808401526109ab81856108ca565b9998505050505050505050565b600067ffffffffffffffff8311156109d2576109d2610636565b6109e5601f8401601f1916602001610723565b90508281528383830111156109f957600080fd5b610a078360208301846108a6565b9392505050565b60008060408385031215610a2157600080fd5b825167ffffffffffffffff80821115610a3957600080fd5b818501915085601f830112610a4d57600080fd5b610a5c868351602085016109b8565b93506020850151915080821115610a7257600080fd5b508301601f81018513610a8457600080fd5b610a93858251602084016109b8565b915050925092905056fea2646970667358221220c54a059109ba9e6a3727c2f1f00d24d8d7b07b526112b39d04f8ee3df205390464736f6c634300081400330000000000000000000000004fb50724220d7dc1d796542c5e4cbf36f8c1cf62000000000000000000000000ef1912ac1e3c571147fc891a444c7999814ce36e
Deployed Bytecode
0x60806040526004361061002d5760003560e01c80636254a08f146100395780639304c9341461008a57600080fd5b3661003457005b600080fd5b34801561004557600080fd5b5061006d7f000000000000000000000000ef1912ac1e3c571147fc891a444c7999814ce36e81565b6040516001600160a01b0390911681526020015b60405180910390f35b61009d6100983660046105b2565b6100ab565b604051908152602001610081565b33600090815260208190526040812054859060ff16806100f35750336001600160a01b037f0000000000000000000000004fb50724220d7dc1d796542c5e4cbf36f8c1cf6216145b61013b5760405162461bcd60e51b81526020600482015260146024820152730c4e881c195c9b5a5cdcda5bdb8b59195b9a595960621b60448201526064015b60405180910390fd5b8060000361017f5760405162461bcd60e51b81526020600482015260116024820152700c4e881b195b99dd1a0b5a5b9d985b1a59607a1b6044820152606401610132565b8084146101ce5760405162461bcd60e51b815260206004820152601760248201527f313a2061727261792d6c656e6774682d696e76616c69640000000000000000006044820152606401610132565b60008167ffffffffffffffff8111156101e9576101e9610636565b60405190808252806020026020018201604052801561021c57816020015b60608152602001906001900390816102075790505b50905060008267ffffffffffffffff81111561023a5761023a610636565b60405190808252806020026020018201604052801561026d57816020015b60608152602001906001900390816102585790505b5090506000807f000000000000000000000000ef1912ac1e3c571147fc891a444c7999814ce36e6001600160a01b031663a0a32c0b8c8c6040518363ffffffff1660e01b81526004016102c1929190610707565b600060405180830381865afa1580156102de573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103069190810190610754565b915091508161034a5760405162461bcd60e51b815260206004820152601060248201526f189d103737ba16b1b7b73732b1ba37b960811b6044820152606401610132565b60005b8581101561042b5760006103d283838151811061036c5761036c610822565b60200260200101518c8c8581811061038657610386610822565b90506020028101906103989190610838565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061048f92505050565b90506103dd81610522565b8784815181106103ef576103ef610822565b6020026020010187858151811061040857610408610822565b6020026020010182905282905250505080806104239061087f565b91505061034d565b50336001600160a01b0316876001600160a01b03167ff6d9b29bbf2ae698de33670961ec53f895af65801d2cdaced431cc6129865347348e8e868a8a6040516104799695949392919061092a565b60405180910390a3505050505095945050505050565b60606001600160a01b0383166104d85760405162461bcd60e51b815260206004820152600e60248201526d1d185c99d95d0b5a5b9d985b1a5960921b6044820152606401610132565b600080835160208501865af43d6040519250601f19601f6020830101168301604052808352806000602085013e81156001810361051957816000803e816000fd5b50505092915050565b60608060008351111561054957828060200190518101906105439190610a0e565b90925090505b915091565b60008083601f84011261056057600080fd5b50813567ffffffffffffffff81111561057857600080fd5b6020830191508360208260051b850101111561059357600080fd5b9250929050565b6001600160a01b03811681146105af57600080fd5b50565b6000806000806000606086880312156105ca57600080fd5b853567ffffffffffffffff808211156105e257600080fd5b6105ee89838a0161054e565b9097509550602088013591508082111561060757600080fd5b506106148882890161054e565b90945092505060408601356106288161059a565b809150509295509295909350565b634e487b7160e01b600052604160045260246000fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b81835260006020808501808196508560051b810191508460005b878110156106fa5782840389528135601e198836030181126106b057600080fd5b8701858101903567ffffffffffffffff8111156106cc57600080fd5b8036038213156106db57600080fd5b6106e686828461064c565b9a87019a955050509084019060010161068f565b5091979650505050505050565b60208152600061071b602083018486610675565b949350505050565b604051601f8201601f1916810167ffffffffffffffff8111828210171561074c5761074c610636565b604052919050565b6000806040838503121561076757600080fd5b8251801515811461077757600080fd5b8092505060208084015167ffffffffffffffff8082111561079757600080fd5b818601915086601f8301126107ab57600080fd5b8151818111156107bd576107bd610636565b8060051b91506107ce848301610723565b81815291830184019184810190898411156107e857600080fd5b938501935b8385101561081257845192506108028361059a565b82825293850193908501906107ed565b8096505050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811261084f57600080fd5b83018035915067ffffffffffffffff82111561086a57600080fd5b60200191503681900382131561059357600080fd5b60006001820161089f57634e487b7160e01b600052601160045260246000fd5b5060010190565b60005b838110156108c15781810151838201526020016108a9565b50506000910152565b600081518084526020808501808196508360051b8101915082860160005b858110156106fa5782840389528151805180865261090b818888018985016108a6565b99860199601f01601f19169490940185019350908401906001016108e8565b8681526000602060a08184015261094560a08401888a610675565b838103604085015286518082528288019183019060005b818110156109815783516001600160a01b03168352928401929184019160010161095c565b5050848103606086015261099581886108ca565b9250505082810360808401526109ab81856108ca565b9998505050505050505050565b600067ffffffffffffffff8311156109d2576109d2610636565b6109e5601f8401601f1916602001610723565b90508281528383830111156109f957600080fd5b610a078360208301846108a6565b9392505050565b60008060408385031215610a2157600080fd5b825167ffffffffffffffff80821115610a3957600080fd5b818501915085601f830112610a4d57600080fd5b610a5c868351602085016109b8565b93506020850151915080821115610a7257600080fd5b508301601f81018513610a8457600080fd5b610a93858251602084016109b8565b915050925092905056fea2646970667358221220c54a059109ba9e6a3727c2f1f00d24d8d7b07b526112b39d04f8ee3df205390464736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000004fb50724220d7dc1d796542c5e4cbf36f8c1cf62000000000000000000000000ef1912ac1e3c571147fc891a444c7999814ce36e
-----Decoded View---------------
Arg [0] : _peerToPlayFactory (address): 0x4Fb50724220d7DC1D796542c5E4CBF36f8C1CF62
Arg [1] : _connectors (address): 0xef1912Ac1E3C571147Fc891A444c7999814cE36E
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000004fb50724220d7dc1d796542c5e4cbf36f8c1cf62
Arg [1] : 000000000000000000000000ef1912ac1e3c571147fc891a444c7999814ce36e
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
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.