ETH Price: $2,503.48 (-2.84%)

Transaction Decoder

Block:
16447165 at Jan-20-2023 09:37:35 AM +UTC
Transaction Fee:
0.000834009377094576 ETH $2.09
Gas Used:
50,634 Gas / 16.471331064 Gwei

Emitted Events:

159 DepositContract.DepositEvent( pubkey=0xAD4A697018A989B13BB04147EEEEE5A9375022C5B1F1596BC3D966CD5A8379061E575EF83B5B4421C20499857796092C, withdrawal_credentials=0x000CF7BB53A662CDC4D39CC7BBFB29B4898EBBAB940978D4D9893AA7B7412FF9, amount=0x0040597307000000, signature=0xA5D619364C11731008CA946E6AE96FF46B53CBCC3E84575F61C6CD120B99A6AA949EFE944129280A64E7089A251B5B720CE890588CF89591E2DD3F1A7D0728901B7EAC482FBF8CD6A7840B6AA309AE3F181ED33BBBADF33890F7AFA5C8834BFD, index=0xC6DF070000000000 )

Account State Difference:

  Address   Before After State Difference Code
0x00000000...03d7705Fa
(Beacon Deposit Contract)
16,136,535.1068024281441391 Eth16,136,567.1068024281441391 Eth32
0x7c2FC96f...801298868
32.591098737485811188 Eth
Nonce: 10
0.590264728108716612 Eth
Nonce: 11
32.000834009377094576
(beaverbuild)
77.515264080309249805 Eth77.515340031309249805 Eth0.000075951

Execution Trace

ETH 32 DepositContract.deposit( pubkey=0xAD4A697018A989B13BB04147EEEEE5A9375022C5B1F1596BC3D966CD5A8379061E575EF83B5B4421C20499857796092C, withdrawal_credentials=0x000CF7BB53A662CDC4D39CC7BBFB29B4898EBBAB940978D4D9893AA7B7412FF9, signature=0xA5D619364C11731008CA946E6AE96FF46B53CBCC3E84575F61C6CD120B99A6AA949EFE944129280A64E7089A251B5B720CE890588CF89591E2DD3F1A7D0728901B7EAC482FBF8CD6A7840B6AA309AE3F181ED33BBBADF33890F7AFA5C8834BFD, deposit_data_root=F4EF325E25D29BFAB683B6B4F5C86C1453643E131123F2BB58D0122E9395005A )
  • Null: 0x000...002.ad4a6970( )
  • Null: 0x000...002.a5d61936( )
  • Null: 0x000...002.1b7eac48( )
  • Null: 0x000...002.e74dea78( )
  • Null: 0x000...002.920cf6a0( )
  • Null: 0x000...002.00405973( )
  • Null: 0x000...002.3c65b6de( )
    // ┏━━━┓━┏┓━┏┓━━┏━━━┓━━┏━━━┓━━━━┏━━━┓━━━━━━━━━━━━━━━━━━━┏┓━━━━━┏━━━┓━━━━━━━━━┏┓━━━━━━━━━━━━━━┏┓━
    // ┃┏━━┛┏┛┗┓┃┃━━┃┏━┓┃━━┃┏━┓┃━━━━┗┓┏┓┃━━━━━━━━━━━━━━━━━━┏┛┗┓━━━━┃┏━┓┃━━━━━━━━┏┛┗┓━━━━━━━━━━━━┏┛┗┓
    // ┃┗━━┓┗┓┏┛┃┗━┓┗┛┏┛┃━━┃┃━┃┃━━━━━┃┃┃┃┏━━┓┏━━┓┏━━┓┏━━┓┏┓┗┓┏┛━━━━┃┃━┗┛┏━━┓┏━┓━┗┓┏┛┏━┓┏━━┓━┏━━┓┗┓┏┛
    // ┃┏━━┛━┃┃━┃┏┓┃┏━┛┏┛━━┃┃━┃┃━━━━━┃┃┃┃┃┏┓┃┃┏┓┃┃┏┓┃┃━━┫┣┫━┃┃━━━━━┃┃━┏┓┃┏┓┃┃┏┓┓━┃┃━┃┏┛┗━┓┃━┃┏━┛━┃┃━
    // ┃┗━━┓━┃┗┓┃┃┃┃┃┃┗━┓┏┓┃┗━┛┃━━━━┏┛┗┛┃┃┃━┫┃┗┛┃┃┗┛┃┣━━┃┃┃━┃┗┓━━━━┃┗━┛┃┃┗┛┃┃┃┃┃━┃┗┓┃┃━┃┗┛┗┓┃┗━┓━┃┗┓
    // ┗━━━┛━┗━┛┗┛┗┛┗━━━┛┗┛┗━━━┛━━━━┗━━━┛┗━━┛┃┏━┛┗━━┛┗━━┛┗┛━┗━┛━━━━┗━━━┛┗━━┛┗┛┗┛━┗━┛┗┛━┗━━━┛┗━━┛━┗━┛
    // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┃┃━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┗┛━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    
    // SPDX-License-Identifier: CC0-1.0
    
    pragma solidity 0.6.11;
    
    // This interface is designed to be compatible with the Vyper version.
    /// @notice This is the Ethereum 2.0 deposit contract interface.
    /// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs
    interface IDepositContract {
        /// @notice A processed deposit event.
        event DepositEvent(
            bytes pubkey,
            bytes withdrawal_credentials,
            bytes amount,
            bytes signature,
            bytes index
        );
    
        /// @notice Submit a Phase 0 DepositData object.
        /// @param pubkey A BLS12-381 public key.
        /// @param withdrawal_credentials Commitment to a public key for withdrawals.
        /// @param signature A BLS12-381 signature.
        /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object.
        /// Used as a protection against malformed input.
        function deposit(
            bytes calldata pubkey,
            bytes calldata withdrawal_credentials,
            bytes calldata signature,
            bytes32 deposit_data_root
        ) external payable;
    
        /// @notice Query the current deposit root hash.
        /// @return The deposit root hash.
        function get_deposit_root() external view returns (bytes32);
    
        /// @notice Query the current deposit count.
        /// @return The deposit count encoded as a little endian 64-bit number.
        function get_deposit_count() external view returns (bytes memory);
    }
    
    // Based on official specification in https://eips.ethereum.org/EIPS/eip-165
    interface ERC165 {
        /// @notice Query if a contract implements an interface
        /// @param interfaceId The interface identifier, as specified in ERC-165
        /// @dev Interface identification is specified in ERC-165. This function
        ///  uses less than 30,000 gas.
        /// @return `true` if the contract implements `interfaceId` and
        ///  `interfaceId` is not 0xffffffff, `false` otherwise
        function supportsInterface(bytes4 interfaceId) external pure returns (bool);
    }
    
    // This is a rewrite of the Vyper Eth2.0 deposit contract in Solidity.
    // It tries to stay as close as possible to the original source code.
    /// @notice This is the Ethereum 2.0 deposit contract interface.
    /// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs
    contract DepositContract is IDepositContract, ERC165 {
        uint constant DEPOSIT_CONTRACT_TREE_DEPTH = 32;
        // NOTE: this also ensures `deposit_count` will fit into 64-bits
        uint constant MAX_DEPOSIT_COUNT = 2**DEPOSIT_CONTRACT_TREE_DEPTH - 1;
    
        bytes32[DEPOSIT_CONTRACT_TREE_DEPTH] branch;
        uint256 deposit_count;
    
        bytes32[DEPOSIT_CONTRACT_TREE_DEPTH] zero_hashes;
    
        constructor() public {
            // Compute hashes in empty sparse Merkle tree
            for (uint height = 0; height < DEPOSIT_CONTRACT_TREE_DEPTH - 1; height++)
                zero_hashes[height + 1] = sha256(abi.encodePacked(zero_hashes[height], zero_hashes[height]));
        }
    
        function get_deposit_root() override external view returns (bytes32) {
            bytes32 node;
            uint size = deposit_count;
            for (uint height = 0; height < DEPOSIT_CONTRACT_TREE_DEPTH; height++) {
                if ((size & 1) == 1)
                    node = sha256(abi.encodePacked(branch[height], node));
                else
                    node = sha256(abi.encodePacked(node, zero_hashes[height]));
                size /= 2;
            }
            return sha256(abi.encodePacked(
                node,
                to_little_endian_64(uint64(deposit_count)),
                bytes24(0)
            ));
        }
    
        function get_deposit_count() override external view returns (bytes memory) {
            return to_little_endian_64(uint64(deposit_count));
        }
    
        function deposit(
            bytes calldata pubkey,
            bytes calldata withdrawal_credentials,
            bytes calldata signature,
            bytes32 deposit_data_root
        ) override external payable {
            // Extended ABI length checks since dynamic types are used.
            require(pubkey.length == 48, "DepositContract: invalid pubkey length");
            require(withdrawal_credentials.length == 32, "DepositContract: invalid withdrawal_credentials length");
            require(signature.length == 96, "DepositContract: invalid signature length");
    
            // Check deposit amount
            require(msg.value >= 1 ether, "DepositContract: deposit value too low");
            require(msg.value % 1 gwei == 0, "DepositContract: deposit value not multiple of gwei");
            uint deposit_amount = msg.value / 1 gwei;
            require(deposit_amount <= type(uint64).max, "DepositContract: deposit value too high");
    
            // Emit `DepositEvent` log
            bytes memory amount = to_little_endian_64(uint64(deposit_amount));
            emit DepositEvent(
                pubkey,
                withdrawal_credentials,
                amount,
                signature,
                to_little_endian_64(uint64(deposit_count))
            );
    
            // Compute deposit data root (`DepositData` hash tree root)
            bytes32 pubkey_root = sha256(abi.encodePacked(pubkey, bytes16(0)));
            bytes32 signature_root = sha256(abi.encodePacked(
                sha256(abi.encodePacked(signature[:64])),
                sha256(abi.encodePacked(signature[64:], bytes32(0)))
            ));
            bytes32 node = sha256(abi.encodePacked(
                sha256(abi.encodePacked(pubkey_root, withdrawal_credentials)),
                sha256(abi.encodePacked(amount, bytes24(0), signature_root))
            ));
    
            // Verify computed and expected deposit data roots match
            require(node == deposit_data_root, "DepositContract: reconstructed DepositData does not match supplied deposit_data_root");
    
            // Avoid overflowing the Merkle tree (and prevent edge case in computing `branch`)
            require(deposit_count < MAX_DEPOSIT_COUNT, "DepositContract: merkle tree full");
    
            // Add deposit data root to Merkle tree (update a single `branch` node)
            deposit_count += 1;
            uint size = deposit_count;
            for (uint height = 0; height < DEPOSIT_CONTRACT_TREE_DEPTH; height++) {
                if ((size & 1) == 1) {
                    branch[height] = node;
                    return;
                }
                node = sha256(abi.encodePacked(branch[height], node));
                size /= 2;
            }
            // As the loop should always end prematurely with the `return` statement,
            // this code should be unreachable. We assert `false` just to be safe.
            assert(false);
        }
    
        function supportsInterface(bytes4 interfaceId) override external pure returns (bool) {
            return interfaceId == type(ERC165).interfaceId || interfaceId == type(IDepositContract).interfaceId;
        }
    
        function to_little_endian_64(uint64 value) internal pure returns (bytes memory ret) {
            ret = new bytes(8);
            bytes8 bytesValue = bytes8(value);
            // Byteswapping during copying to bytes.
            ret[0] = bytesValue[7];
            ret[1] = bytesValue[6];
            ret[2] = bytesValue[5];
            ret[3] = bytesValue[4];
            ret[4] = bytesValue[3];
            ret[5] = bytesValue[2];
            ret[6] = bytesValue[1];
            ret[7] = bytesValue[0];
        }
    }