Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0xa7E616fB7B71Dd90CB068839069373C5eC0484a9
Balance 0 ETH
Nonce 5562
Code Size 3184 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

3184 bytes
0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063321c48f21461005c5780638798b89e146100a65780639437497a1461012a578063b054a9e8146101ae578063fc399c7914610232575b600080fd5b61006461028e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100e8600480360360208110156100bc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506102b6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61016c6004803603602081101561014057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061031e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101f0600480360360208110156101c457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610394565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102746004803603602081101561024857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506106f8565b604051808215151515815260200191505060405180910390f35b60007f0000000000000000000000005825c125a20d233cf83d464b2047f8e81b5ac711905090565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061038d82604051602001808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014019150506040516020818303038152906040528051906020012061038161080f565b8051906020012061095f565b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561041b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180610be8602a913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104fe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180610c126029913960400191505060405180910390fd5b6000610568600084604051602001808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014019150506040516020818303038152906040528051906020012061056361080f565b610974565b90508073ffffffffffffffffffffffffffffffffffffffff166319ab453c846040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b1580156105e957600080fd5b505af11580156105fd573d6000803e3d6000fd5b50505050806000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fca0b7dde26052d34217ef1a0cee48085a07ca32da0a918609937a307d496bbf560405160405180910390a480915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166000808473ffffffffffffffffffffffffffffffffffffffff166399988c5d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561075a57600080fd5b505afa15801561076e573d6000803e3d6000fd5b505050506040513d602081101561078457600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b60606000693d602d80600a3d3981f360b01b9050600069363d3d373d3d3d363d7360b01b905060007f0000000000000000000000005825c125a20d233cf83d464b2047f8e81b5ac71160601b905060006e5af43d82803e903d91602b57fd5bf360881b905083838383604051602001808575ffffffffffffffffffffffffffffffffffffffffffff191675ffffffffffffffffffffffffffffffffffffffffffff19168152600a018475ffffffffffffffffffffffffffffffffffffffffffff191675ffffffffffffffffffffffffffffffffffffffffffff19168152600a01836bffffffffffffffffffffffff19166bffffffffffffffffffffffff191681526014018270ffffffffffffffffffffffffffffffffff191670ffffffffffffffffffffffffffffffffff19168152600f0194505050505060405160208183030381529060405294505050505090565b600061096c838330610b1e565b905092915050565b600080844710156109ed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f437265617465323a20696e73756666696369656e742062616c616e636500000081525060200191505060405180910390fd5b600083511415610a65576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f437265617465323a2062797465636f6465206c656e677468206973207a65726f81525060200191505060405180910390fd5b8383516020850187f59050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610b13576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f437265617465323a204661696c6564206f6e206465706c6f790000000000000081525060200191505060405180910390fd5b809150509392505050565b60008060ff60f81b83868660405160200180857effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526001018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018381526020018281526020019450505050506040516020818303038152906040528051906020012090508060001c915050939250505056fe57463a3a63726561746557616c6c65743a6f776e657220616464726573732063616e6e6f74206265203057463a3a63726561746557616c6c65743a6f776e657220616c7265616479206861732077616c6c6574a264697066735822122056f1e2501142291e9c69e540418415f4dc9314ff0ddf3846ce25a0816608dc9a64736f6c634300060b0033

Verified Source Code Full Match

Compiler: v0.6.11+commit.5ef660b1 EVM: istanbul Optimization: No
Create2.sol 61 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;

// import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Create2.sol";

/**
 * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.
 * `CREATE2` can be used to compute in advance the address where a smart
 * contract will be deployed, which allows for interesting new mechanisms known
 * as 'counterfactual interactions'.
 *
 * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more
 * information.
 */

library Create2 {
    /**
     * @dev Deploys a contract using `CREATE2`. The address where the contract
     * will be deployed can be known in advance via {computeAddress}.
     *
     * The bytecode for a contract can be obtained from Solidity with
     * `type(contractName).creationCode`.
     *
     * Requirements:
     *
     * - `bytecode` must not be empty.
     * - `salt` must have not been used for `bytecode` already.
     * - the factory must have a balance of at least `amount`.
     * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.
     */
    function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address) {
        address addr;
        require(address(this).balance >= amount, "Create2: insufficient balance");
        require(bytecode.length != 0, "Create2: bytecode length is zero");
        // solhint-disable-next-line no-inline-assembly
        assembly {
            addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)
        }
        require(addr != address(0), "Create2: Failed on deploy");
        return addr;
    }

    /**
     * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the
     * `bytecodeHash` or `salt` will result in a new destination address.
     */
    function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {
        return computeAddress(salt, bytecodeHash, address(this));
    }

    /**
     * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at
     * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.
     */
    function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address) {
        bytes32 _data = keccak256(
            abi.encodePacked(bytes1(0xff), deployer, salt, bytecodeHash)
        );
        return address(uint160(uint256(_data)));
    }
}
WalletFactory.sol 72 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;

import "../interfaces/IQredoWalletImplementation.sol";
import "../interfaces/IWalletFactory.sol";
import "../libraries/Create2.sol";

contract WalletFactory is IWalletFactory {

    mapping(address => address) private walletOwner;
    address immutable private _template;

    constructor(address _template_) public {
        require(_template_ != address(0), "WF::constructor:_template_ address cannot be 0");
        _template = _template_;
    }

    function computeFutureWalletAddress(address _walletOwner) external override view returns(address _walletAddress) {
        return Create2.computeAddress(
                    keccak256(abi.encodePacked(_walletOwner)),
                    keccak256(getBytecode())
                );
    }
   
    function createWallet(address _walletOwner) external override returns (address _walletAddress) {
        require(_walletOwner != address(0), "WF::createWallet:owner address cannot be 0");
        require(walletOwner[_walletOwner] == address(0), "WF::createWallet:owner already has wallet");
        address wallet = Create2.deploy(
                0,
                keccak256(abi.encodePacked(_walletOwner)),
                getBytecode()
            );
        IQredoWalletImplementation(wallet).init(_walletOwner);
        walletOwner[_walletOwner] = address(wallet);
        emit WalletCreated(msg.sender, address(wallet), _walletOwner);
        return wallet;
    }

    /**
      * @dev Returns template address of the current {owner};
    */
    function getWalletByOwner(address owner) external override view returns (address _wallet) {
        return walletOwner[owner];
    }

    function verifyWallet(address wallet) external override view returns (bool _validWallet) {
        return walletOwner[IQredoWalletImplementation(wallet).getWalletOwnerAddress()] != address(0);
    }

    /**
      * @dev Returns template address;
    */
    function getTemplate() external override view returns (address template){
        return _template;
    }

    /**
      * @dev EIP-1167 Minimal Proxy Bytecode with included Creation code.
      * More information on EIP-1167 Minimal Proxy and the full bytecode 
      * read more here: 
      * (https://blog.openzeppelin.com/deep-dive-into-the-minimal-proxy-contract)
    */
    function getBytecode() private view returns (bytes memory) {
        bytes10 creation = 0x3d602d80600a3d3981f3;
        bytes10 runtimePrefix = 0x363d3d373d3d3d363d73;
        bytes20 targetBytes = bytes20(_template);
        bytes15 runtimeSuffix = 0x5af43d82803e903d91602b57fd5bf3;
        return abi.encodePacked(creation, runtimePrefix, targetBytes, runtimeSuffix);
    }
}


IWalletFactory.sol 12 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;

interface IWalletFactory {
    function computeFutureWalletAddress(address _walletOwner) external view returns(address _walletAddress);
    function createWallet(address owner) external returns (address _walletAddress);
    function getTemplate() external view returns (address template);
    function getWalletByOwner(address owner) external view returns (address _wallet);
    function verifyWallet(address wallet) external  view returns (bool _validWallet);
    
    event WalletCreated(address indexed caller, address indexed wallet, address indexed owner);
}
IQredoWalletImplementation.sol 14 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;

interface IQredoWalletImplementation {
    function init(address _walletOwner) external;
    function invoke(bytes memory signature, address _to, uint256 _value, bytes calldata _data) external returns (bytes memory _result);
    function getBalance(address tokenAddress) external view returns(uint256 _balance);
    function getNonce() external view returns(uint256 nonce);
    function getWalletOwnerAddress() external view returns(address _walletOwner);
    
    event Invoked(address indexed sender, address indexed target, uint256 value, uint256 indexed nonce, bytes data);
    event Received(address indexed sender, uint indexed value, bytes data);
    event Fallback(address indexed sender, uint indexed value, bytes data);
}

Read Contract

computeFutureWalletAddress 0x9437497a → address
getTemplate 0x321c48f2 → address
getWalletByOwner 0x8798b89e → address
verifyWallet 0xfc399c79 → bool

Write Contract 1 functions

These functions modify contract state and require a wallet transaction to execute.

createWallet 0xb054a9e8
address _walletOwner
returns: address

Recent Transactions

No transactions found for this address