helpers::stake_pool_helpers
Module 0xc0ded0c0::stake_pool_helpers
0xc0ded0c0::stake_pool_helpers
module helpers::stake_pool_helpers
helpers::stake_pool_helpers
This module queries aptos_framework::stake
and aptos_framework::staking_config
to get information about a stake pool and current staking information.
use 0x1::stake;
use 0x1::staking_config;
use 0x1::timestamp;
use 0xc0ded0c0::math;
Constants
Validator is in state active
const VALIDATOR_STATUS_ACTIVE: u64 = 2;
Validator is in state inactive
const VALIDATOR_STATUS_INACTIVE: u64 = 4;
Validator is in state pending_active
const VALIDATOR_STATUS_PENDING_ACTIVE: u64 = 1;
Validator is in state pending_inactive
const VALIDATOR_STATUS_PENDING_INACTIVE: u64 = 3;
Function get_framework_min_stake
get_framework_min_stake
Returns the minimum stake a stake pool must have to become active.
public fun get_framework_min_stake(): u64
Function get_stake_pool_inactive_balance
get_stake_pool_inactive_balance
Returns the inactive stake of a stake pool.
public fun get_stake_pool_inactive_balance(stake_pool_address: address): u64
Function get_stake_pool_total_withdrawable_amount
get_stake_pool_total_withdrawable_amount
Returns the total amount which can be withdrawn from a stake pool.
public fun get_stake_pool_total_withdrawable_amount(stake_pool_address: address): u64
Function get_stake_pool_total
get_stake_pool_total
Returns the total amount of stake in the stake pool.
public fun get_stake_pool_total(stake_pool_address: address): u64
Function get_stake_pool_maximum_possible_reward_this_epoch
get_stake_pool_maximum_possible_reward_this_epoch
Returns the maximum possible reward that the stake pool can earn in the current epoch.
public fun get_stake_pool_maximum_possible_reward_this_epoch(stake_pool_address: address): u64
Function get_stake_pool_non_withdrawing_balance
get_stake_pool_non_withdrawing_balance
Return the balance which cannot be withdrawn (without unstaking) from the stake pool.
public fun get_stake_pool_non_withdrawing_balance(stake_pool_address: address): u64
Function get_stake_pool_total_after_current_epoch_generation
get_stake_pool_total_after_current_epoch_generation
This function is needed so to prevent last moment stake attack from a delegator to steal rewards. This assumes the validator has 100% proposal success in the current epoch, and thus is a disadvantage to new stakers. However, the discrepancy is small enough to be tolerated for now.
See get_num_new_shares_to_mint()
in delegation_state
module to see its usage.
public fun get_stake_pool_total_after_current_epoch_generation(stake_pool_address: address): u64
Function has_lockup_duration_passed
has_lockup_duration_passed
Returns whether a lockup duration has passed since change_timestamp
A change in lockup duration will affect this function. It is intended.
public fun has_lockup_duration_passed(change_timestamp: u64): bool
Last updated