Skip to content

IIVPContract#

Internal interface for helper contracts handling functionality for an associated VPToken.

Functions#

batchVotePowerOfAt#

Defined in IIVPContract (Docs, Source).

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

Get the vote power of a set of addresses at a given block number.

Parameters Type Description
_owners address[] The list of addresses being queried.
_blockNumber uint256 The block number being queried.
Returns Type Description
[0] uint256[] Vote power of each address at _blockNumber, including any delegation received.

cleanupBlockNumber#

Defined in IICleanable (Docs, Source).

function cleanupBlockNumber(
) external view returns (
    uint256);

Get the current cleanup block number set with setCleanupBlockNumber.

Returns Type Description
[0] uint256 The currently set cleanup block number.

delegate#

Defined in IIVPContract (Docs, Source).

function delegate(
    address _from,
    address _to,
    uint256 _balance,
    uint256 _bips
) external;

Delegate _bips percentage of voting power from a delegator address to a delegatee address.

Parameters Type Description
_from address The address of the delegator.
_to address The address of the delegatee.
_balance uint256 The delegator's current balance
_bips uint256 The percentage of voting power to be delegated expressed in basis points (1/100 of one percent). Not cumulative: every call resets the delegation value (and a value of 0 revokes delegation).

delegateExplicit#

Defined in IIVPContract (Docs, Source).

function delegateExplicit(
    address _from,
    address _to,
    uint256 _balance,
    uint256 _amount
) external;

Explicitly delegate _amount tokens of voting power from a delegator address to a delegatee address.

Parameters Type Description
_from address The address of the delegator.
_to address The address of the delegatee.
_balance uint256 The delegator's current balance.
_amount uint256 An explicit vote power amount to be delegated. Not cumulative: every call resets the delegation value (and a value of 0 undelegates _to).

delegatesOf#

Defined in IIVPContract (Docs, Source).

function delegatesOf(
    address _owner
) external view returns (
    address[] _delegateAddresses,
    uint256[] _bips,
    uint256 _count,
    uint256 _delegationMode);

Get the percentages and addresses being delegated to by a vote power delegator.

Parameters Type Description
_owner address The address of the delegator being queried.
Returns Type Description
_delegateAddresses address[] Array of delegatee addresses.
_bips uint256[] Array of delegation percents specified in basis points (1/100 or 1 percent), for each delegatee.
_count uint256 The number of returned delegatees.
_delegationMode uint256 The mode of the delegation (NOTSET=0, PERCENTAGE=1, AMOUNT=2). See Delegatable.DelegationMode.

delegatesOfAt#

Defined in IIVPContract (Docs, Source).

function delegatesOfAt(
    address _owner,
    uint256 _blockNumber
) external view returns (
    address[] _delegateAddresses,
    uint256[] _bips,
    uint256 _count,
    uint256 _delegationMode);

Get the percentages and addresses being delegated to by a vote power delegator, at a given block.

Parameters Type Description
_owner address The address of the delegator being queried.
_blockNumber uint256 The block number being queried.
Returns Type Description
_delegateAddresses address[] Array of delegatee addresses.
_bips uint256[] Array of delegation percents specified in basis points (1/100 or 1 percent), for each delegatee.
_count uint256 The number of returned delegatees.
_delegationMode uint256 The mode of the delegation (NOTSET=0, PERCENTAGE=1, AMOUNT=2). See Delegatable.DelegationMode.

delegationModeOf#

Defined in IIVPContract (Docs, Source).

function delegationModeOf(
    address _who
) external view returns (
    uint256);

Get the delegation mode of an address. This mode determines whether vote power is allocated by percentage or by explicit value and cannot be changed once set with delegate or delegateExplicit.

Parameters Type Description
_who address The address being queried.
Returns Type Description
[0] uint256 Delegation mode (NOTSET=0, PERCENTAGE=1, AMOUNT=2). See Delegatable.DelegationMode.

isReplacement#

Defined in IIVPContract (Docs, Source).

function isReplacement(
) external view returns (
    bool);

Return true if this IIVPContract is configured to be used as a replacement for other contract. It means that vote powers are not necessarily correct at the initialization, therefore every method that reads vote power must check whether it is initialized for that address and block.

ownerToken#

Defined in IIVPContract (Docs, Source).

function ownerToken(
) external view returns (
    contract IVPToken);

The VPToken (or some other contract) that owns this VPContract. All state changing methods may be called only from this address. This is because original msg.sender is typically sent in a parameter and we must make sure that it cannot be faked by directly calling IIVPContract methods. Owner token is also used in case of replacement to recover vote powers from balances.

revokeDelegationAt#

Defined in IIVPContract (Docs, Source).

function revokeDelegationAt(
    address _from,
    address _to,
    uint256 _balance,
    uint256 _blockNumber
) external;

Revoke all vote power delegation from a delegator address to a delegatee address at a given block. Only affects the reads via votePowerOfAtCached in the block _blockNumber. This method should be used only to prevent rogue delegate voting in the current voting block. To stop delegating use delegate or delegateExplicit with value of 0, or undelegateAll/ undelegateAllExplicit.

Parameters Type Description
_from address The address of the delegator.
_to address Address of the delegatee.
_balance uint256 The delegator's current balance.
_blockNumber uint256 The block number at which to revoke delegation. Must be in the past.

setCleanerContract#

Defined in IICleanable (Docs, Source).

function setCleanerContract(
    address _cleanerContract
) external;

Set the contract that is allowed to call history cleaning methods.

Parameters Type Description
_cleanerContract address Address of the cleanup contract. Usually this will be an instance of CleanupBlockNumberManager.

setCleanupBlockNumber#

Defined in IICleanable (Docs, Source).

function setCleanupBlockNumber(
    uint256 _blockNumber
) external;

Set the cleanup block number. Historic data for the blocks before cleanupBlockNumber can be erased. History before that block should never be used since it can be inconsistent. In particular, cleanup block number must be lower than the current vote power block.

Parameters Type Description
_blockNumber uint256 The new cleanup block number.

undelegateAll#

Defined in IIVPContract (Docs, Source).

function undelegateAll(
    address _from,
    uint256 _balance
) external;

Undelegate all voting power for a delegator address. Can only be used with percentage delegation. Does not reset delegation mode back to NOTSET.

Parameters Type Description
_from address The address of the delegator.
_balance uint256 The delegator's current balance.

undelegateAllExplicit#

Defined in IIVPContract (Docs, Source).

function undelegateAllExplicit(
    address _from,
    address[] _delegateAddresses
) external returns (
    uint256);

Undelegate all explicit vote power by amount for a delegator address. Can only be used with explicit delegation. Does not reset delegation mode back to NOTSET.

Parameters Type Description
_from address The address of the delegator.
_delegateAddresses address[] Explicit delegation does not store delegatees' addresses, so the caller must supply them.
Returns Type Description
[0] uint256 The amount still delegated (in case the list of delegates was incomplete).

undelegatedVotePowerOf#

Defined in IIVPContract (Docs, Source).

function undelegatedVotePowerOf(
    address _owner,
    uint256 _balance
) external view returns (
    uint256);

Compute the current undelegated vote power of an address.

Parameters Type Description
_owner address The address being queried.
_balance uint256 Current balance of that address.
Returns Type Description
[0] uint256 The unallocated vote power of _owner, this is, the amount of vote power currently not being delegated to other addresses.

undelegatedVotePowerOfAt#

Defined in IIVPContract (Docs, Source).

function undelegatedVotePowerOfAt(
    address _owner,
    uint256 _balance,
    uint256 _blockNumber
) external view returns (
    uint256);

Compute the undelegated vote power of an address at a given block.

Parameters Type Description
_owner address The address being queried.
_balance uint256
_blockNumber uint256 The block number being queried.
Returns Type Description
[0] uint256 The unallocated vote power of _owner, this is, the amount of vote power that was not being delegated to other addresses at that block number.

updateAtTokenTransfer#

Defined in IIVPContract (Docs, Source).

function updateAtTokenTransfer(
    address _from,
    address _to,
    uint256 _fromBalance,
    uint256 _toBalance,
    uint256 _amount
) external;

Update vote powers when tokens are transferred. Also update delegated vote powers for percentage delegation and check for enough funds for explicit delegations.

Parameters Type Description
_from address Source account of the transfer.
_to address Destination account of the transfer.
_fromBalance uint256 Balance of the source account before the transfer.
_toBalance uint256 Balance of the destination account before the transfer.
_amount uint256 Amount that has been transferred.

votePowerFromTo#

Defined in IIVPContract (Docs, Source).

function votePowerFromTo(
    address _from,
    address _to,
    uint256 _balance
) external view returns (
    uint256);

Get current delegated vote power from a delegator to a delegatee.

Parameters Type Description
_from address Address of the delegator.
_to address Address of the delegatee.
_balance uint256 The delegator's current balance.
Returns Type Description
[0] uint256 The delegated vote power.

votePowerFromToAt#

Defined in IIVPContract (Docs, Source).

function votePowerFromToAt(
    address _from,
    address _to,
    uint256 _balance,
    uint256 _blockNumber
) external view returns (
    uint256);

Get delegated the vote power from a delegator to a delegatee at a given block number.

Parameters Type Description
_from address Address of the delegator.
_to address Address of the delegatee.
_balance uint256 The delegator's current balance.
_blockNumber uint256 The block number being queried.
Returns Type Description
[0] uint256 The delegated vote power.

votePowerOf#

Defined in IIVPContract (Docs, Source).

function votePowerOf(
    address _who
) external view returns (
    uint256);

Get the current vote power of an address.

Parameters Type Description
_who address The address being queried.
Returns Type Description
[0] uint256 Current vote power of _who, including any delegation received.

votePowerOfAt#

Defined in IIVPContract (Docs, Source).

function votePowerOfAt(
    address _who,
    uint256 _blockNumber
) external view returns (
    uint256);

Get the vote power of an address at a given block number

Parameters Type Description
_who address The address being queried.
_blockNumber uint256 The block number being queried.
Returns Type Description
[0] uint256 Vote power of _who at _blockNumber, including any delegation received.

votePowerOfAtCached#

Defined in IIVPContract (Docs, Source).

function votePowerOfAtCached(
    address _who,
    uint256 _blockNumber
) external returns (
    uint256);

Get the vote power of an address at a given block number. Reads/updates cache and upholds revocations.

Parameters Type Description
_who address The address being queried.
_blockNumber uint256 The block number being queried.
Returns Type Description
[0] uint256 Vote power of _who at _blockNumber, including any delegation received.

votePowerOfAtIgnoringRevocation#

Defined in IIVPContract (Docs, Source).

function votePowerOfAtIgnoringRevocation(
    address _who,
    uint256 _blockNumber
) external view returns (
    uint256);

Get the vote power of an address at a given block number, ignoring revocation information and cache.

Parameters Type Description
_who address The address being queried.
_blockNumber uint256 The block number being queried.
Returns Type Description
[0] uint256 Vote power of _who at _blockNumber, including any delegation received. Result doesn't change if vote power is revoked.