Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update staking interface contract #307

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 44 additions & 7 deletions precompiles/staking/StakingInterface.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ pragma solidity >=0.8.3;
address constant STAKING_ADDRESS = 0x0000000000000000000000000000000000000800;

/// @dev The Staking contract's instance.
Staking constant STAKING_CONTRACT = Staking(
STAKING_ADDRESS
);
Staking constant STAKING_CONTRACT = Staking(STAKING_ADDRESS);

/// @title Pallet Staking Interface
/// @dev The interface through which solidity contracts will interact with Staking pALLET
Expand All @@ -16,19 +14,19 @@ Staking constant STAKING_CONTRACT = Staking(
/// @custom:address 0x0000000000000000000000000000000000000800
interface Staking {
/// @dev Get current era
/// @return era
/// @return era
function currentEra() external view returns (uint32);

/// @dev Get min nominator bond
/// @return min nominator bond
/// @return min nominator bond
function minNominatorBond() external view returns (uint256);

/// @dev Get min validator bond
/// @return min validator bond
/// @return min validator bond
function minValidatorBond() external view returns (uint256);

/// @dev Min Active stake
/// @return min active stake
/// @return min active stake
function minActiveStake() external view returns (uint256);

/// @dev Validator count
Expand Down Expand Up @@ -58,4 +56,43 @@ interface Staking {
/// @return Total stake in era.
function erasTotalStake(uint32 eraIndex) external view returns (uint256);

/// @dev Nominate a set of validators.
/// @param targets Array of validators' addresses to nominate.
function nominate(bytes32[] calldata targets) external;

/// @dev Bond tokens for staking.
/// @param value Amount of tokens to bond.
/// @param payee Address to receive staking rewards.
function bond(uint256 value, bytes32 payee) external;

/// @dev Bond additional tokens for staking.
/// @param maxAdditional Amount of additional tokens to bond.
function bondExtra(uint256 maxAdditional) external;

/// @dev Unbond a portion of the staked tokens.
/// @param value Amount of tokens to unbond.
function unbond(uint256 value) external;

/// @dev Withdraw unbonded tokens after the unbonding period.
/// @param numSlashingSpans Number of slashing spans for a validator.
function withdrawUnbonded(uint32 numSlashingSpans) external;

/// @dev Stop nominating and become inactive in staking.
function chill() external;

/// @dev Set the reward destination for staking rewards.
/// @param payee The reward destination type (0-Staked, 1-Stash, 2-Controller).
function setPayee(uint8 payee) external;

/// @dev (Re-)set the controller to the stash.
function setController() external;

/// @dev Trigger payout for a validator and era.
/// @param validatorStash The stash address of the validator.
/// @param era The era index for which to trigger the payout.
function payoutStakers(bytes32 validatorStash, uint32 era) external;

/// @dev Rebond a portion of the unbonded tokens.
/// @param value Amount of tokens to rebond.
function rebond(uint256 value) external;
}
Loading