prysm-pulse/contracts/validator_registration.sol
Raul Jordan 4d5d229f0f beacon: Define a Core Blockchain Package and Persisted Structure for Beacon (#278)
Former-commit-id: bbd5b46e7f64f762350d6fb496492207e70d7130 [formerly 43a37f7139b7d1d90f0c27a7406b63bdf390ad96]
Former-commit-id: bb7a2ff0a7619f8de0bd38cd2c9eb0de7c189edb
2018-07-19 11:31:50 -05:00

35 lines
1.1 KiB
Solidity

pragma solidity 0.4.23;
contract ValidatorRegistration {
event ValidatorRegistered(
bytes32 indexed pubKey,
uint256 withdrawalShardID,
address indexed withdrawalAddressbytes32,
bytes32 indexed 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);
}
}