ETH Price: $2,367.89 (+7.91%)
 

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DfnsSmartAccount

Compiler Version
v0.8.29+commit.ab55807c

Optimization Enabled:
No with 200 runs

Other Settings:
cancun EvmVersion
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.29;

/**
 * @title DfnsSmartAccount - This contract support batch execution of transactions.
 * The only storage is a nonce to prevent replay attacks.
 * The contract is intended to be used with EIP-7702 where EOA delegates to this contract.
 */
contract DfnsSmartAccount {
    struct Storage {
        uint256 nonce;
    }

    // keccak256("DfnsSmartAccount") & (~0xff)
    bytes32 private constant _STORAGE = 0x10ee8db8a0021e326896fcf9b44ce61becefe5f52e3dfd0bb294aee9b73bc000;
    // keccak256("EIP712Domain(uint256 chainId,address verifyingContract)");
    bytes32 private constant _DOMAIN_TYPEHASH = 0x47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218;
    // keccak256("HandleOps(bytes32 data,uint256 nonce)")
    bytes32 private constant _HANDLEOPS_TYPEHASH = 0x4f8bb4631e6552ac29b9d6bacf60ff8b5481e2af7c2104fe0261045fa6988111;

    address private immutable ENTRY_POINT;

    error InvalidSignature();

    /**
     * @dev Sends multiple transactions with signature validation and reverts all if one fails.
     * @param userOps Encoded User Ops.
     * @param r The r part of the signature.
     * @param vs The v and s part of the signature.
     */
    function handleOps(bytes memory userOps, uint256 r, uint256 vs) public payable {
        Storage storage $ = _storage();
        uint256 nonce = $.nonce;

        // Calculate the hash of transactions data and nonce for signature verification
        bytes32 domainSeparator = keccak256(abi.encode(_DOMAIN_TYPEHASH, block.chainid, address(this)));
        bytes32 structHash = keccak256(abi.encode(_HANDLEOPS_TYPEHASH, keccak256(userOps), nonce));
        bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));

        // Verify the signature
        require(_isValidSignature(digest, r, vs), InvalidSignature());

        // Update nonce for the sender to prevent replay attacks
        unchecked {
            $.nonce = nonce + 1;
        }

        /* solhint-disable no-inline-assembly */
        assembly ("memory-safe") {
            let length := mload(userOps)
            let i := 0x20
            for {} lt(i, length) {} {
                let to := shr(0x60, mload(add(userOps, i)))
                let value := mload(add(userOps, add(i, 0x14)))
                let dataLength := mload(add(userOps, add(i, 0x34)))
                let data := add(userOps, add(i, 0x54))
                let success := call(gas(), to, value, data, dataLength, 0, 0)

                if eq(success, 0) {
                    returndatacopy(0, 0, returndatasize())
                    revert(0, returndatasize())
                }
                i := add(i, add(0x54, dataLength))
            }
        }
        /* solhint-enable no-inline-assembly */
    }

    /**
     * @dev Validates the signature by extracting `v` and `s` from `vs` and using `ecrecover`.
     * @param hash The hash of the signed data.
     * @param r The r part of the signature.
     * @param vs The v and s part of the signature combined.
     * @return bool True if the signature is valid, false otherwise.
     */
    function _isValidSignature(bytes32 hash, uint256 r, uint256 vs) internal view returns (bool) {
        unchecked {
            uint256 v = (vs >> 255) + 27;
            uint256 s = vs & 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;

            return address(this) == ecrecover(hash, uint8(v), bytes32(r), bytes32(s));
        }
    }

    function _storage() private pure returns (Storage storage $) {
        assembly ("memory-safe") {
            $.slot := _STORAGE
        }
    }

    function getNonce() external view returns (uint256) {
        return _storage().nonce;
    }
}

Settings
{
  "remappings": [
    "forge-std/=lib/forge-std/src/"
  ],
  "optimizer": {
    "enabled": false,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "cancun",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"getNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"userOps","type":"bytes"},{"internalType":"uint256","name":"r","type":"uint256"},{"internalType":"uint256","name":"vs","type":"uint256"}],"name":"handleOps","outputs":[],"stateMutability":"payable","type":"function"}]

60a0604052348015600e575f5ffd5b506080516107066100245f395f50506107065ff3fe608060405260043610610028575f3560e01c806374fa41211461002c578063d087d28814610048575b5f5ffd5b61004660048036038101906100419190610473565b610072565b005b348015610053575f5ffd5b5061005c610200565b60405161006991906104ee565b60405180910390f35b5f61007b610211565b90505f815f015490505f7f47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a794692185f1b46306040516020016100bc9392919061055e565b6040516020818303038152906040528051906020012090505f7f4f8bb4631e6552ac29b9d6bacf60ff8b5481e2af7c2104fe0261045fa69881115f1b87805190602001208460405160200161011393929190610593565b6040516020818303038152906040528051906020012090505f828260405160200161013f92919061063c565b604051602081830303815290604052805190602001209050610162818888610238565b610198576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018401855f0181905550875160205b818110156101f457808a015160601c601482018b0151603483018c0151605484018d015f5f838386885af15f81036101e2573d5f5f3e3d5ffd5b826054018601955050505050506101a8565b50505050505050505050565b5f610209610211565b5f0154905090565b5f7f10ee8db8a0021e326896fcf9b44ce61becefe5f52e3dfd0bb294aee9b73bc000905090565b5f5f601b60ff84901c0190505f7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8416905060018683875f1b845f1b6040515f8152602001604052604051610290949392919061068d565b6020604051602081039080840390855afa1580156102b0573d5f5f3e3d5ffd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff1614925050509392505050565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6103528261030c565b810181811067ffffffffffffffff821117156103715761037061031c565b5b80604052505050565b5f6103836102f3565b905061038f8282610349565b919050565b5f67ffffffffffffffff8211156103ae576103ad61031c565b5b6103b78261030c565b9050602081019050919050565b828183375f83830152505050565b5f6103e46103df84610394565b61037a565b905082815260208101848484011115610400576103ff610308565b5b61040b8482856103c4565b509392505050565b5f82601f83011261042757610426610304565b5b81356104378482602086016103d2565b91505092915050565b5f819050919050565b61045281610440565b811461045c575f5ffd5b50565b5f8135905061046d81610449565b92915050565b5f5f5f6060848603121561048a576104896102fc565b5b5f84013567ffffffffffffffff8111156104a7576104a6610300565b5b6104b386828701610413565b93505060206104c48682870161045f565b92505060406104d58682870161045f565b9150509250925092565b6104e881610440565b82525050565b5f6020820190506105015f8301846104df565b92915050565b5f819050919050565b61051981610507565b82525050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6105488261051f565b9050919050565b6105588161053e565b82525050565b5f6060820190506105715f830186610510565b61057e60208301856104df565b61058b604083018461054f565b949350505050565b5f6060820190506105a65f830186610510565b6105b36020830185610510565b6105c060408301846104df565b949350505050565b5f81905092915050565b7f19010000000000000000000000000000000000000000000000000000000000005f82015250565b5f6106066002836105c8565b9150610611826105d2565b600282019050919050565b5f819050919050565b61063661063182610507565b61061c565b82525050565b5f610646826105fa565b91506106528285610625565b6020820191506106628284610625565b6020820191508190509392505050565b5f60ff82169050919050565b61068781610672565b82525050565b5f6080820190506106a05f830187610510565b6106ad602083018661067e565b6106ba6040830185610510565b6106c76060830184610510565b9594505050505056fea2646970667358221220183bdad4d5eb41321768cef7a758bbf3df56dae565a5070e0f36300aa08f27c664736f6c634300081d0033

Deployed Bytecode

0x608060405260043610610028575f3560e01c806374fa41211461002c578063d087d28814610048575b5f5ffd5b61004660048036038101906100419190610473565b610072565b005b348015610053575f5ffd5b5061005c610200565b60405161006991906104ee565b60405180910390f35b5f61007b610211565b90505f815f015490505f7f47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a794692185f1b46306040516020016100bc9392919061055e565b6040516020818303038152906040528051906020012090505f7f4f8bb4631e6552ac29b9d6bacf60ff8b5481e2af7c2104fe0261045fa69881115f1b87805190602001208460405160200161011393929190610593565b6040516020818303038152906040528051906020012090505f828260405160200161013f92919061063c565b604051602081830303815290604052805190602001209050610162818888610238565b610198576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018401855f0181905550875160205b818110156101f457808a015160601c601482018b0151603483018c0151605484018d015f5f838386885af15f81036101e2573d5f5f3e3d5ffd5b826054018601955050505050506101a8565b50505050505050505050565b5f610209610211565b5f0154905090565b5f7f10ee8db8a0021e326896fcf9b44ce61becefe5f52e3dfd0bb294aee9b73bc000905090565b5f5f601b60ff84901c0190505f7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8416905060018683875f1b845f1b6040515f8152602001604052604051610290949392919061068d565b6020604051602081039080840390855afa1580156102b0573d5f5f3e3d5ffd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff1614925050509392505050565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6103528261030c565b810181811067ffffffffffffffff821117156103715761037061031c565b5b80604052505050565b5f6103836102f3565b905061038f8282610349565b919050565b5f67ffffffffffffffff8211156103ae576103ad61031c565b5b6103b78261030c565b9050602081019050919050565b828183375f83830152505050565b5f6103e46103df84610394565b61037a565b905082815260208101848484011115610400576103ff610308565b5b61040b8482856103c4565b509392505050565b5f82601f83011261042757610426610304565b5b81356104378482602086016103d2565b91505092915050565b5f819050919050565b61045281610440565b811461045c575f5ffd5b50565b5f8135905061046d81610449565b92915050565b5f5f5f6060848603121561048a576104896102fc565b5b5f84013567ffffffffffffffff8111156104a7576104a6610300565b5b6104b386828701610413565b93505060206104c48682870161045f565b92505060406104d58682870161045f565b9150509250925092565b6104e881610440565b82525050565b5f6020820190506105015f8301846104df565b92915050565b5f819050919050565b61051981610507565b82525050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6105488261051f565b9050919050565b6105588161053e565b82525050565b5f6060820190506105715f830186610510565b61057e60208301856104df565b61058b604083018461054f565b949350505050565b5f6060820190506105a65f830186610510565b6105b36020830185610510565b6105c060408301846104df565b949350505050565b5f81905092915050565b7f19010000000000000000000000000000000000000000000000000000000000005f82015250565b5f6106066002836105c8565b9150610611826105d2565b600282019050919050565b5f819050919050565b61063661063182610507565b61061c565b82525050565b5f610646826105fa565b91506106528285610625565b6020820191506106628284610625565b6020820191508190509392505050565b5f60ff82169050919050565b61068781610672565b82525050565b5f6080820190506106a05f830187610510565b6106ad602083018661067e565b6106ba6040830185610510565b6106c76060830184610510565b9594505050505056fea2646970667358221220183bdad4d5eb41321768cef7a758bbf3df56dae565a5070e0f36300aa08f27c664736f6c634300081d0033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
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.