Giter Site home page Giter Site logo

Comments (2)

Magicking avatar Magicking commented on July 1, 2024

Adding contract code for easy debugging

pragma solidity <=0.8.0;
pragma experimental ABIEncoderV2;

// 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 MD {
    IDepositContract public deposit_contract;
    constructor()  {
        deposit_contract = IDepositContract(0x07b39F4fDE4A38bACe212b546dAc87C58DfE3fDC); // Medalla deposit contract address
    }
    
    function DepMulti(bytes[] memory pubkey, bytes[] memory withdrawal_credentials, bytes[] memory signature, bytes32[] memory deposit_data_root) public payable {
        require(pubkey.length == withdrawal_credentials.length);
        require(pubkey.length == signature.length);
        require(pubkey.length == deposit_data_root.length);
        for (uint i = 0; i < pubkey.length; i++) {
            deposit_contract.deposit{value:32000000000000000000}(pubkey[i], withdrawal_credentials[i],signature[i],deposit_data_root[i]);
        }
    }
}

from eth2-beaconchain-explorer.

guybrush avatar guybrush commented on July 1, 2024

Thank you very much, I did not think about multiple deposits in a single tx!

from eth2-beaconchain-explorer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.