mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 19:40:37 +00:00
923e727819
Former-commit-id: 4857afb2c25835b643cd58dd90b114695154b50f [formerly 5d2c723def807289eb72e6c35ce7036ef70f837e] Former-commit-id: 79c8f081748e29e00b61ace851f74c2252865729
35 lines
1.1 KiB
Solidity
35 lines
1.1 KiB
Solidity
pragma solidity 0.4.23;
|
|
|
|
contract ValidatorRegistration {
|
|
event ValidatorRegistered(
|
|
bytes32 pubKey,
|
|
uint256 withdrawalShardID,
|
|
address withdrawalAddressbytes32,
|
|
bytes32 randaoCommitment
|
|
);
|
|
|
|
mapping (bytes32 => bool) public usedPubkey;
|
|
|
|
uint public constant VALIDATOR_DEPOSIT = 32 ether;
|
|
|
|
// Validator registers by sending a transaction of 32ETH to
|
|
// the following deposit function. The deposit function takes in
|
|
// validator's public key, withdrawal shard ID (which shard
|
|
// to send the deposit back to), withdrawal address (which address
|
|
// to send the deposit back to) and randao commitment.
|
|
function deposit(
|
|
bytes32 _pubkey,
|
|
uint _withdrawalShardID,
|
|
address _withdrawalAddressbytes32,
|
|
bytes32 _randaoCommitment
|
|
)
|
|
public payable
|
|
{
|
|
require(msg.value == VALIDATOR_DEPOSIT);
|
|
require(!usedPubkey[_pubkey]);
|
|
|
|
usedPubkey[_pubkey] = true;
|
|
|
|
emit ValidatorRegistered(_pubkey, _withdrawalShardID, _withdrawalAddressbytes32, _randaoCommitment);
|
|
}
|
|
} |