Sonic Blaze Testnet

Contract

0x861D5c465d33ac29Ee7f429F7DbAA8241Fe57E8b

Overview

S Balance

Sonic Blaze LogoSonic Blaze LogoSonic Blaze Logo0 S

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Basics63113532024-12-23 12:18:292 days ago1734956309IN
0x861D5c46...41Fe57E8b
0 S0.000148541.1

Latest 2 internal transactions

Parent Transaction Hash Block From To
63114442024-12-23 12:18:562 days ago1734956336
0x861D5c46...41Fe57E8b
0 S
63113642024-12-23 12:18:322 days ago1734956312
0x861D5c46...41Fe57E8b
0 S
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x4Fb50724...6f8C1CF62
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
PeerToPlayFactory

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)

File 1 of 1 : index.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/**
 * @title PeerToPlayFactory
 * @dev Main Contract For PeerToPlay Smart Accounts. This is also a factory contract, which deploys new PeerToPlay Smart Accounts
 * and serves as a registry for PeerToPlay Smart Accounts.
 */

/**
 * @dev Interface for account functionality in PeerToPlay.
 */
interface AccountInterface {
    /**
     * @dev Returns the version of the account.
     */
    function version() external view returns (uint);

    /**
     * @dev Enables an authority for the account.
     * @param authority The address to be authorized.
     */
    function enable(address authority) external;

    /**
     * @dev Executes multiple function calls within the account.
     * @param _targets The target addresses to call.
     * @param _datas The data (call data) for each target.
     * @param _origin The origin address of the call.
     * @return responses The responses from each call.
     */
    function cast(
        address[] calldata _targets,
        bytes[] calldata _datas,
        address _origin
    ) external payable returns (bytes32[] memory responses);
}

/**
 * @dev Interface for list registry.
 */
interface ListInterface {
    /**
     * @dev Initializes the account in the list.
     * @param _account The account address to initialize.
     */
    function init(address _account) external;
}

/**
 * @title AddressIndex
 * @dev Contract to manage the master address, connectors, and account versions.
 */
contract AddressIndex {
    event LogNewMaster(address indexed master);
    event LogUpdateMaster(address indexed master);
    event LogNewAccount(
        address indexed _newAccount,
        address indexed _connectors
    );

    // New master address.
    address private newMaster;
    // Current master address.
    address public master;
    // List registry address.
    address public list;

    // Connectors mapping for account versions.
    mapping(uint => address) public connectors;
    // Account modules mapping for versions.
    mapping(uint => address) public account;
    // Total version count of account modules.
    uint public versionCount;

    /**
     * @dev Modifier to restrict function access to the master address.
     */
    modifier isMaster() {
        require(msg.sender == master, "not-master");
        _;
    }

    /**
     * @dev Initiates the master address change.
     * @param _newMaster The new master address.
     */
    function changeMaster(address _newMaster) external isMaster {
        require(_newMaster != master, "already-a-master");
        require(_newMaster != address(0), "not-valid-address");
        require(newMaster != _newMaster, "already-a-new-master");
        newMaster = _newMaster;
        emit LogNewMaster(_newMaster);
    }

    /**
     * @dev Finalizes the master address update.
     */
    function updateMaster() external {
        require(newMaster != address(0), "not-valid-address");
        require(msg.sender == newMaster, "not-master");
        master = newMaster;
        newMaster = address(0);
        emit LogUpdateMaster(master);
    }

    /**
     * @dev Adds a new account module.
     * @param _newAccount The new account module address.
     * @param _connectors The connectors registry module address.
     */
    function addNewAccount(
        address _newAccount,
        address _connectors
    ) external isMaster {
        require(_newAccount != address(0), "not-valid-address");
        versionCount++;
        require(
            AccountInterface(_newAccount).version() == versionCount,
            "not-valid-version"
        );
        account[versionCount] = _newAccount;
        if (_connectors != address(0)) connectors[versionCount] = _connectors;
        emit LogNewAccount(_newAccount, _connectors);
    }
}

/**
 * @title CloneFactory
 * @dev Contract to clone other contracts.
 */
contract CloneFactory is AddressIndex {
    /**
     * @dev Creates a new clone of the specified account version.
     * @param version The account module version to clone.
     * @return result The address of the created clone.
     */
    function createClone(uint version) internal returns (address result) {
        bytes20 targetBytes = bytes20(account[version]);
        // solium-disable-next-line security/no-inline-assembly
        assembly {
            let clone := mload(0x40)
            mstore(
                clone,
                0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000
            )
            mstore(add(clone, 0x14), targetBytes)
            mstore(
                add(clone, 0x28),
                0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
            )
            result := create(0, clone, 0x37)
        }
    }

    /**
     * @dev Checks if a specified address is a clone of a given account version.
     * @param version The account module version.
     * @param query The address to check.
     * @return result Boolean indicating if the address is a clone.
     */
    function isClone(
        uint version,
        address query
    ) external view returns (bool result) {
        bytes20 targetBytes = bytes20(account[version]);
        // solium-disable-next-line security/no-inline-assembly
        assembly {
            let clone := mload(0x40)
            mstore(
                clone,
                0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000
            )
            mstore(add(clone, 0xa), targetBytes)
            mstore(
                add(clone, 0x1e),
                0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
            )

            let other := add(clone, 0x40)
            extcodecopy(query, other, 0, 0x2d)
            result := and(
                eq(mload(clone), mload(other)),
                eq(mload(add(clone, 0xd)), mload(add(other, 0xd)))
            )
        }
    }
}

/**
 * @title PeerToPlayFactory
 * @dev Main contract for creating and managing PeerToPlay Smart Accounts.
 */
contract PeerToPlayFactory is CloneFactory {
    event LogAccountCreated(
        address sender,
        address indexed owner,
        address indexed account,
        address indexed origin
    );

    /**
     * @dev Creates a PeerToPlay Smart Account and performs a cast operation.
     * @param _owner The owner of the PeerToPlay Smart Account.
     * @param accountVersion The account module version.
     * @param _targets Target addresses for the cast function.
     * @param _datas Data (call data) for each target.
     * @param _origin The origin of the account creation.
     * @return _account The address of the created account.
     */
    function buildWithCast(
        address _owner,
        uint accountVersion,
        address[] calldata _targets,
        bytes[] calldata _datas,
        address _origin
    ) external payable returns (address _account) {
        _account = build(_owner, accountVersion, _origin);
        if (_targets.length > 0)
            AccountInterface(_account).cast{value: msg.value}(
                _targets,
                _datas,
                _origin
            );
    }

    /**
     * @dev Creates a PeerToPlay Smart Account.
     * @param _owner The owner of the PeerToPlay Smart Account.
     * @param accountVersion The account module version.
     * @param _origin The origin of the account creation.
     * @return _account The address of the created account.
     */
    function build(
        address _owner,
        uint accountVersion,
        address _origin
    ) public returns (address _account) {
        require(
            accountVersion != 0 && accountVersion <= versionCount,
            "not-valid-account"
        );
        _account = createClone(accountVersion);
        ListInterface(list).init(_account);
        AccountInterface(_account).enable(_owner);
        emit LogAccountCreated(msg.sender, _owner, _account, _origin);
    }

    /**
     * @dev Sets up initial configuration for the PeerToPlayFactory contract.
     * This function can only be called once.
     * @param _master The master address.
     * @param _list The list registry address.
     * @param _account The initial account module address.
     * @param _connectors The connectors registry module address.
     */
    function setBasics(
        address _master,
        address _list,
        address _account,
        address _connectors
    ) external {
        require(
            master == address(0) &&
                list == address(0) &&
                account[1] == address(0) &&
                connectors[1] == address(0) &&
                versionCount == 0,
            "already-defined"
        );
        master = _master;
        list = _list;
        versionCount++;
        account[versionCount] = _account;
        connectors[versionCount] = _connectors;
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "evmVersion": "paris",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"origin","type":"address"}],"name":"LogAccountCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_newAccount","type":"address"},{"indexed":true,"internalType":"address","name":"_connectors","type":"address"}],"name":"LogNewAccount","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"master","type":"address"}],"name":"LogNewMaster","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"master","type":"address"}],"name":"LogUpdateMaster","type":"event"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"account","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newAccount","type":"address"},{"internalType":"address","name":"_connectors","type":"address"}],"name":"addNewAccount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"accountVersion","type":"uint256"},{"internalType":"address","name":"_origin","type":"address"}],"name":"build","outputs":[{"internalType":"address","name":"_account","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"accountVersion","type":"uint256"},{"internalType":"address[]","name":"_targets","type":"address[]"},{"internalType":"bytes[]","name":"_datas","type":"bytes[]"},{"internalType":"address","name":"_origin","type":"address"}],"name":"buildWithCast","outputs":[{"internalType":"address","name":"_account","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_newMaster","type":"address"}],"name":"changeMaster","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"connectors","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"version","type":"uint256"},{"internalType":"address","name":"query","type":"address"}],"name":"isClone","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"list","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"master","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_master","type":"address"},{"internalType":"address","name":"_list","type":"address"},{"internalType":"address","name":"_account","type":"address"},{"internalType":"address","name":"_connectors","type":"address"}],"name":"setBasics","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateMaster","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"versionCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

Deployed Bytecode

0x6080604052600436106100a75760003560e01c80638aad29e1116100645780638aad29e1146101ba578063a4bb8e7d146101de578063bb7e70ef146101fe578063cf1a0ddc1461021e578063ee97f7f314610233578063f4ff78bf1461025357600080fd5b80630f560cd7146100ac57806313ede1a1146100e95780632dd7c6581461011f5780634e9c4ddc146101555780634f5b256114610177578063743681891461018a575b600080fd5b3480156100b857600080fd5b506002546100cc906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100f557600080fd5b506100cc610104366004610a73565b6003602052600090815260409020546001600160a01b031681565b34801561012b57600080fd5b506100cc61013a366004610a73565b6004602052600090815260409020546001600160a01b031681565b34801561016157600080fd5b50610175610170366004610aa8565b610273565b005b6100cc610185366004610b27565b61042c565b34801561019657600080fd5b506101aa6101a5366004610bc2565b6104cb565b60405190151581526020016100e0565b3480156101c657600080fd5b506101d060055481565b6040519081526020016100e0565b3480156101ea57600080fd5b506101756101f9366004610be5565b610546565b34801561020a57600080fd5b506100cc610219366004610c39565b6106bf565b34801561022a57600080fd5b50610175610824565b34801561023f57600080fd5b506001546100cc906001600160a01b031681565b34801561025f57600080fd5b5061017561026e366004610c75565b6108c8565b6001546001600160a01b031633146102a65760405162461bcd60e51b815260040161029d90610c97565b60405180910390fd5b6001600160a01b0382166102cc5760405162461bcd60e51b815260040161029d90610cbb565b600580549060006102dc83610ce6565b9190505550600554826001600160a01b03166354fd4d506040518163ffffffff1660e01b8152600401602060405180830381865afa158015610322573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103469190610d0d565b146103875760405162461bcd60e51b81526020600482015260116024820152703737ba16bb30b634b216bb32b939b4b7b760791b604482015260640161029d565b600554600090815260046020526040902080546001600160a01b0319166001600160a01b03848116919091179091558116156103e857600554600090815260036020526040902080546001600160a01b0319166001600160a01b0383161790555b806001600160a01b0316826001600160a01b03167f4b477433704e6bdb6bac955ead37fc90c6c7d9bea88b826f03b22d6ca886d4fd60405160405180910390a35050565b60006104398888846106bf565b905084156104c05760405163e0e90acf60e01b81526001600160a01b0382169063e0e90acf903490610477908a908a908a908a908a90600401610d4f565b60006040518083038185885af1158015610495573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f191682016040526104be9190810190610e5d565b505b979650505050505050565b60008281526004602052604080822054815169363d3d373d3d3d363d7360b01b815260609190911b6bffffffffffffffffffffffff1916600a82018190526e5af43d82803e903d91602b57fd5bf360881b601e830152918101602d8482873c600d810151600d83015114815183511416935050505092915050565b6001546001600160a01b031615801561056857506002546001600160a01b0316155b80156105a65750600160005260046020527fabd6e7cb50984ff9c2f3e18a2660c3353dadf4e3291deeb275dae2cd1e44fe05546001600160a01b0316155b80156105e45750600160005260036020527fa15bc60c955c405d20d9149c709e2460f1c2d9a497496a7f46004d1772c3054c546001600160a01b0316155b80156105f05750600554155b61062e5760405162461bcd60e51b815260206004820152600f60248201526e185b1c9958591e4b5919599a5b9959608a1b604482015260640161029d565b600180546001600160a01b038087166001600160a01b03199283161790925560028054928616929091169190911790556005805490600061066e83610ce6565b909155505060058054600090815260046020908152604080832080546001600160a01b039788166001600160a01b031991821617909155935483526003909152902080549290931691161790555050565b600082158015906106d257506005548311155b6107125760405162461bcd60e51b81526020600482015260116024820152701b9bdd0b5d985b1a590b5858d8dbdd5b9d607a1b604482015260640161029d565b61071b83610a05565b60025460405163066ad14f60e21b81526001600160a01b0380841660048301529293509116906319ab453c90602401600060405180830381600087803b15801561076457600080fd5b505af1158015610778573d6000803e3d6000fd5b5050604051630b7f436d60e31b81526001600160a01b03878116600483015284169250635bfa1b689150602401600060405180830381600087803b1580156107bf57600080fd5b505af11580156107d3573d6000803e3d6000fd5b50506040513381526001600160a01b03808616935084811692508716907f83435eca805f6256e4aa778ee8b2e8aec7485fa4b643a0fff05b7df6bf6883899060200160405180910390a49392505050565b6000546001600160a01b031661084c5760405162461bcd60e51b815260040161029d90610cbb565b6000546001600160a01b031633146108765760405162461bcd60e51b815260040161029d90610c97565b60008054600180546001600160a01b0383166001600160a01b03199182168117909255909116825560405190917f9ac7c65ebc1e9c5f94a0f9daaed02afefea79ae48162d49f30ab33b6e1637a1d91a2565b6001546001600160a01b031633146108f25760405162461bcd60e51b815260040161029d90610c97565b6001546001600160a01b03908116908216036109435760405162461bcd60e51b815260206004820152601060248201526f30b63932b0b23c96b096b6b0b9ba32b960811b604482015260640161029d565b6001600160a01b0381166109695760405162461bcd60e51b815260040161029d90610cbb565b6000546001600160a01b038083169116036109bd5760405162461bcd60e51b815260206004820152601460248201527330b63932b0b23c96b096b732bb96b6b0b9ba32b960611b604482015260640161029d565b600080546001600160a01b0319166001600160a01b038316908117825560405190917ff2a8c544d5befa20af407e43fa5a05305e50163fb8d06fda74206f0dc08b680f91a250565b600081815260046020526040808220549051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b815260609190911b6bffffffffffffffffffffffff1916601482018190526e5af43d82803e903d91602b57fd5bf360881b60288301529060378184f0949350505050565b600060208284031215610a8557600080fd5b5035919050565b80356001600160a01b0381168114610aa357600080fd5b919050565b60008060408385031215610abb57600080fd5b610ac483610a8c565b9150610ad260208401610a8c565b90509250929050565b60008083601f840112610aed57600080fd5b50813567ffffffffffffffff811115610b0557600080fd5b6020830191508360208260051b8501011115610b2057600080fd5b9250929050565b600080600080600080600060a0888a031215610b4257600080fd5b610b4b88610a8c565b965060208801359550604088013567ffffffffffffffff80821115610b6f57600080fd5b610b7b8b838c01610adb565b909750955060608a0135915080821115610b9457600080fd5b50610ba18a828b01610adb565b9094509250610bb4905060808901610a8c565b905092959891949750929550565b60008060408385031215610bd557600080fd5b82359150610ad260208401610a8c565b60008060008060808587031215610bfb57600080fd5b610c0485610a8c565b9350610c1260208601610a8c565b9250610c2060408601610a8c565b9150610c2e60608601610a8c565b905092959194509250565b600080600060608486031215610c4e57600080fd5b610c5784610a8c565b925060208401359150610c6c60408501610a8c565b90509250925092565b600060208284031215610c8757600080fd5b610c9082610a8c565b9392505050565b6020808252600a90820152693737ba16b6b0b9ba32b960b11b604082015260600190565b6020808252601190820152706e6f742d76616c69642d6164647265737360781b604082015260600190565b600060018201610d0657634e487b7160e01b600052601160045260246000fd5b5060010190565b600060208284031215610d1f57600080fd5b5051919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6060808252810185905260008660808301825b88811015610d90576001600160a01b03610d7b84610a8c565b16825260209283019290910190600101610d62565b506020915083810382850152808682528282019050828760051b8301018860005b89811015610e2157848303601f190184528135368c9003601e19018112610dd757600080fd5b8b01868101903567ffffffffffffffff811115610df357600080fd5b803603821315610e0257600080fd5b610e0d858284610d26565b958801959450505090850190600101610db1565b50506001600160a01b03871660408701529350610e3d92505050565b9695505050505050565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215610e7057600080fd5b825167ffffffffffffffff80821115610e8857600080fd5b818501915085601f830112610e9c57600080fd5b815181811115610eae57610eae610e47565b8060051b604051601f19603f83011681018181108582111715610ed357610ed3610e47565b604052918252848201925083810185019188831115610ef157600080fd5b938501935b82851015610f0f57845184529385019392850192610ef6565b9897505050505050505056fea2646970667358221220dea074d1a1087f9107d74d30e26b1d2218715d70217d254d1310d06da4d3bd4364736f6c63430008140033

Block Transaction Gas Used Reward
view all blocks produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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.