Skip to content

PChainStake#

Helper contract handling all the vote power and balance functionality for the PChainStakeMirror.

Functions#

balanceHistoryCleanup#

Defined in CheckPointable (Docs, Source).

function balanceHistoryCleanup(
    address _owner,
    uint256 _count
) external returns (
    uint256);

Delete balance checkpoints that expired (i.e. are before cleanupBlockNumber). Method can only be called from the cleanerContract (which may be a proxy to external cleaners).

Parameters Type Description
_owner address balance owner account address
_count uint256 maximum number of checkpoints to delete
Returns Type Description
[0] uint256 the number of checkpoints deleted

batchVotePowerOfAt#

Defined in PChainStake (Docs, Source).

function batchVotePowerOfAt(
    bytes20[] _owners,
    uint256 _blockNumber
) external view returns (
    uint256[] _votePowers);

Return vote powers for several node ids in a batch.

Parameters Type Description
_owners bytes20[]
_blockNumber uint256 The block number at which to fetch.
Returns Type Description
_votePowers uint256[] A list of vote powers.

stakesHistoryCleanup#

Defined in PChainStake (Docs, Source).

function stakesHistoryCleanup(
    address _owner,
    uint256 _count
) external returns (
    uint256);

Delete stakes checkpoints that expired (i.e. are before cleanupBlockNumber). Method can only be called from the cleanerContract (which may be a proxy to external cleaners).

Parameters Type Description
_owner address Balance owner account address.
_count uint256 Maximum number of checkpoints to delete.
Returns Type Description
[0] uint256 Number of deleted checkpoints.

stakesOf#

Defined in PChainStake (Docs, Source).

function stakesOf(
    address _owner
) external view returns (
    bytes20[] _nodeIds,
    uint256[] _amounts);

Get the amounts and node ids being staked to by a vote power owner.

Parameters Type Description
_owner address The address being queried.
Returns Type Description
_nodeIds bytes20[] Array of node ids.
_amounts uint256[] Array of staked amounts, for each node id.

stakesOfAt#

Defined in PChainStake (Docs, Source).

function stakesOfAt(
    address _owner,
    uint256 _blockNumber
) external view returns (
    bytes20[] _nodeIds,
    uint256[] _amounts);

Get the amounts and node ids being staked to by a vote power owner, at a given block.

Parameters Type Description
_owner address The address being queried.
_blockNumber uint256 The block number being queried.
Returns Type Description
_nodeIds bytes20[] Array of node ids.
_amounts uint256[] Array of staked amounts, for each node id.

totalSupplyCacheCleanup#

Defined in CheckPointable (Docs, Source).

function totalSupplyCacheCleanup(
    uint256 _blockNumber
) external returns (
    uint256);

Delete total supply cache entry that expired (i.e. is before cleanupBlockNumber). Method can only be called from the cleanerContract (which may be a proxy to external cleaners).

Parameters Type Description
_blockNumber uint256 the block number for which total supply value was cached
Returns Type Description
[0] uint256 the number of cache entries deleted (always 0 or 1)

totalSupplyHistoryCleanup#

Defined in CheckPointable (Docs, Source).

function totalSupplyHistoryCleanup(
    uint256 _count
) external returns (
    uint256);

Delete total supply checkpoints that expired (i.e. are before cleanupBlockNumber). Method can only be called from the cleanerContract (which may be a proxy to external cleaners).

Parameters Type Description
_count uint256 maximum number of checkpoints to delete
Returns Type Description
[0] uint256 the number of checkpoints deleted

totalVotePower#

Defined in PChainStake (Docs, Source).

function totalVotePower(
) external view returns (
    uint256);

Get the current total vote power.

Returns Type Description
[0] uint256 The current total vote power (sum of all accounts' vote powers).

totalVotePowerAt#

Defined in PChainStake (Docs, Source).

function totalVotePowerAt(
    uint256 _blockNumber
) external view returns (
    uint256);

Get the total vote power at block _blockNumber

Parameters Type Description
_blockNumber uint256 The block number at which to fetch.
Returns Type Description
[0] uint256 The total vote power at the block (sum of all accounts' vote powers).

totalVotePowerAtCached#

Defined in PChainStake (Docs, Source).

function totalVotePowerAtCached(
    uint256 _blockNumber
) external returns (
    uint256);

Get the total vote power at block _blockNumber using cache. It tries to read the cached value and if not found, reads the actual value and stores it in cache. Can only be used if _blockNumber is in the past, otherwise reverts.

Parameters Type Description
_blockNumber uint256 The block number at which to fetch.
Returns Type Description
[0] uint256 The total vote power at the block (sum of all accounts' vote powers).

votePowerCacheCleanup#

Defined in PChainStake (Docs, Source).

function votePowerCacheCleanup(
    bytes20 _nodeId,
    uint256 _blockNumber
) external returns (
    uint256);

Delete vote power cache entry that expired (i.e. is before cleanupBlockNumber). Method can only be called from the cleanerContract (which may be a proxy to external cleaners).

Parameters Type Description
_nodeId bytes20 vote power node id
_blockNumber uint256 the block number for which total supply value was cached
Returns Type Description
[0] uint256 the number of cache entries deleted (always 0 or 1)

votePowerFromTo#

Defined in PChainStake (Docs, Source).

function votePowerFromTo(
    address _owner,
    bytes20 _nodeId
) external view returns (
    uint256 _votePower);

Get current staked vote power from _owner staked to _nodeId.

Parameters Type Description
_owner address Address of vote power owner.
_nodeId bytes20 Node id.
Returns Type Description
_votePower uint256 The staked vote power.

votePowerFromToAt#

Defined in PChainStake (Docs, Source).

function votePowerFromToAt(
    address _owner,
    bytes20 _nodeId,
    uint256 _blockNumber
) external view returns (
    uint256 _votePower);

Get current staked vote power from _owner staked to _nodeId at _blockNumber.

Parameters Type Description
_owner address Address of vote power owner.
_nodeId bytes20 Node id.
_blockNumber uint256 The block number at which to fetch.
Returns Type Description
_votePower uint256 The staked vote power.

votePowerHistoryCleanup#

Defined in PChainStake (Docs, Source).

function votePowerHistoryCleanup(
    bytes20 _nodeId,
    uint256 _count
) external returns (
    uint256);

Delete vote power checkpoints that expired (i.e. are before cleanupBlockNumber). Method can only be called from the cleanerContract (which may be a proxy to external cleaners).

Parameters Type Description
_nodeId bytes20 vote power node id
_count uint256 maximum number of checkpoints to delete
Returns Type Description
[0] uint256 the number of checkpoints deleted

votePowerOf#

Defined in PChainStake (Docs, Source).

function votePowerOf(
    bytes20 _nodeId
) external view returns (
    uint256);

Get the current vote power of _nodeId.

Parameters Type Description
_nodeId bytes20 The node id to get voting power.
Returns Type Description
[0] uint256 Current vote power of _nodeId.

votePowerOfAt#

Defined in PChainStake (Docs, Source).

function votePowerOfAt(
    bytes20 _nodeId,
    uint256 _blockNumber
) external view returns (
    uint256);

Get the vote power of _nodeId at block _blockNumber

Parameters Type Description
_nodeId bytes20 The node id to get voting power.
_blockNumber uint256 The block number at which to fetch.
Returns Type Description
[0] uint256 Vote power of _nodeId at _blockNumber.

votePowerOfAtCached#

Defined in PChainStake (Docs, Source).

function votePowerOfAtCached(
    bytes20 _nodeId,
    uint256 _blockNumber
) external returns (
    uint256);

Get the vote power of _owner at block _blockNumber using cache. It tries to read the cached value and if not found, reads the actual value and stores it in cache. Can only be used if _blockNumber is in the past, otherwise reverts.

Parameters Type Description
_nodeId bytes20
_blockNumber uint256 The block number at which to fetch.
Returns Type Description
[0] uint256 Vote power of _owner at _blockNumber.

Variables#

cleanerContract#

Defined in CheckPointable (Docs, Source).

    address cleanerContract

Address of the contract that is allowed to call methods for history cleaning.