Verified contractPartialMIT
BatchDepositConsolidation
Address0x4ff41fa0f4e77129c4c0607994050473c2067e6d
- Balance
0 ETH
- Transactions
29
- Compiler
solc 0.8.30
- Same code
Only this contract
Details
- Compiler
- solc 0.8.30+commit.73712a01
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- prague
- License
- MIT
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 23,434,185
- Creation transaction
- 0xba2a69bedb…b5ed9e66bc
BatchDepositConsolidation.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.30;
// 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);
}
contract BatchDepositConsolidation {
IDepositContract public immutable depositContract;
uint constant private pubkeyLength = 48;
uint constant private signatureLength = 96;
uint constant private depositDataRootLength = 32;
uint constant private depositArgsLength =
pubkeyLength +
signatureLength +
depositDataRootLength;
constructor(IDepositContract _depositContract) {
require(address(_depositContract) != address(0),
"deposit contract");
depositContract = _depositContract;
}
function batchDeposit(uint validUntil, address withdrawAddress, bytes1 withdrawType, uint256[] calldata values, bytes calldata args) external payable {
require(
block.timestamp < validUntil,
"deposit data agreed upon deadline");
require(
args.length % depositArgsLength == 0,
"wrong input"
);
uint count = args.length / depositArgsLength;
require(count == values.length, "mismatched num of args");
uint signatureStart;
uint depositDataRootStart;
uint depositDataRootEnd;
bytes memory rawWithdrawAuthority = abi.encodePacked(withdrawType, hex"0000000000000000000000", withdrawAddress);
for (uint j = 0; j < count; j++) {
unchecked
{
signatureStart = j * depositArgsLength + pubkeyLength;
depositDataRootStart = signatureStart + signatureLength;
depositDataRootEnd = depositDataRootStart + depositDataRootLength;
}
depositContract.deposit{value: values[j] }(
args[j * depositArgsLength : signatureStart],
rawWithdrawAuthority,
args[signatureStart : depositDataRootStart],
// bytes32 depositDataRoot
bytes32(args[depositDataRootStart : depositDataRootEnd])
);
}
}
}Compiler settingsShow
{
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "prague"
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.