PoSRegister
This contract is used let user participate in PoS chain. If anyone want to become a PoS node, he need to interact with this contract. This contract provide serveral methods to increase or decrease PoS votes:
register
- Regist in PoS chain to become a PoS nodeincreaseStake
- Increase PoS stakeretire
- Decrease PoS stake
Also several methods to query one account's PoS info:
getVotes
- Query one account's votes info, will returntotalStakedVotes
andtotalUnlockedVotes
identifierToAddress
- Query one PoS account's binded PoW addressaddressToIdentifier
- Query one PoW account's binded PoS address
Interface
PoSRegister
's hex40 contract address is 0x0888000000000000000000000000000000000005
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;
interface PoSRegister {
/**
* @dev Register PoS account
* @param indentifier - PoS account address to register
* @param votePower - votes count
* @param blsPubKey - BLS public key
* @param vrfPubKey - VRF public key
* @param blsPubKeyProof - BLS public key's proof of legality, used to against some attack, generated by conflux-rust fullnode
*/
function register(
bytes32 indentifier,
uint64 votePower,
bytes calldata blsPubKey,
bytes calldata vrfPubKey,
bytes[2] calldata blsPubKeyProof
) external;
/**
* @dev Increase specified number votes for msg.sender
* @param votePower - count of votes to increase
*/
function increaseStake(uint64 votePower) external;
/**
* @dev Retire specified number votes for msg.sender
* @param votePower - count of votes to retire
*/
function retire(uint64 votePower) external;
/**
* @dev Query PoS account's lock info. Include "totalStakedVotes" and "totalUnlockedVotes"
* @param identifier - PoS address
*/
function getVotes(bytes32 identifier) external view returns (uint256, uint256);
/**
* @dev Query the PoW address binding with specified PoS address
* @param identifier - PoS address
*/
function identifierToAddress(bytes32 identifier) external view returns (address);
/**
* @dev Query the PoS address binding with specified PoW address
* @param addr - PoW address
*/
function addressToIdentifier(address addr) external view returns (bytes32);
/**
* @dev Emitted when register method executed successfully
*/
event Register(bytes32 indexed identifier, bytes blsPubKey, bytes vrfPubKey);
/**
* @dev Emitted when increaseStake method executed successfully
*/
event IncreaseStake(bytes32 indexed identifier, uint64 votePower);
/**
* @dev Emitted when retire method executed successfully
*/
event Retire(bytes32 indexed identifier, uint64 votePower);
}