mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-21 06:48:12 +00:00
Document the interface using Doxygen/Natspec commands (#3)
This commit is contained in:
parent
9fe3c2f62c
commit
86dd9d9dca
@ -3,7 +3,10 @@
|
||||
pragma solidity 0.6.8;
|
||||
|
||||
// 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,
|
||||
@ -12,6 +15,12 @@ interface IDepositContract {
|
||||
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,
|
||||
@ -19,8 +28,12 @@ interface IDepositContract {
|
||||
bytes32 deposit_data_root
|
||||
) external payable;
|
||||
|
||||
/// @notice Query the current deposit count.
|
||||
/// @return The deposit count encoded as a little endian 64-bit number.
|
||||
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);
|
||||
}
|
||||
|
||||
@ -37,6 +50,8 @@ interface ERC165 {
|
||||
|
||||
// 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 GWEI = 1e9;
|
||||
|
||||
@ -55,6 +70,8 @@ contract DepositContract is IDepositContract, ERC165 {
|
||||
zero_hashes[height + 1] = sha256(abi.encodePacked(zero_hashes[height], zero_hashes[height]));
|
||||
}
|
||||
|
||||
/// @notice Query the current deposit root hash.
|
||||
/// @return The deposit root hash.
|
||||
function get_deposit_root() override external view returns (bytes32) {
|
||||
bytes32 node;
|
||||
uint size = deposit_count;
|
||||
@ -72,10 +89,18 @@ contract DepositContract is IDepositContract, ERC165 {
|
||||
));
|
||||
}
|
||||
|
||||
/// @notice Query the current deposit count.
|
||||
/// @return The deposit count encoded as a little endian 64-bit number.
|
||||
function get_deposit_count() override external view returns (bytes memory) {
|
||||
return to_little_endian_64(uint64(deposit_count));
|
||||
}
|
||||
|
||||
/// @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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user