Delegate Staking

Subnets can be staked to for a portion of each epoch's emissions.

Add

Users can add balance to a subnet by calling add_to_delegate_stake with the subnet ID and balance, they want to transfer to the subnet.

pub fn add_to_delegate_stake(
    origin: OriginFor<T>, 
    subnet_id: u32,
    stake_to_be_added: u128,
)

Remove

Users can remove their delegate stake balance by calling remove_delegate_stake with the subnet ID to remove from and the shares to remove. Shares are converted to balance internally.

pub fn remove_delegate_stake(
    origin: OriginFor<T>, 
    subnet_id: u32, 
    shares_to_be_removed: u128
)

Transfer

Users can transfer delegate stake shares from one account to another by calling transfer_delegate_stake with the subnet ID, to account ID, and shares to transfer.

pub fn transfer_delegate_stake(
    origin: OriginFor<T>, 
    subnet_id: u32, 
    to_account_id: T::AccountId,
    delegate_stake_shares_to_transfer: u128
)

Users can donate and increase the overall delegate stake balance in the subnets pool by calling donate_delegate_stake with the subnet ID they want to increase the pool balance of, and the amount to transfer to the subnet.

This will increase the balance of all current delegate stakers.

This function is useful for airdropping rewards to subnet delegate stakers.

pub fn donate_delegate_stake(
    origin: OriginFor<T>, 
    subnet_id: u32,
    amount: u128,
)

Swap & Queue

Users can swap delegate stake between subnets by calling swap_delegate_stake with the subnet ID to remove stake from and the subnet ID to add stake to, with the shares they want to remove from the from_subnet_id.

This will queue the swap to the new subnet and be fulfilled in one epoch.

See how to update a swap queue.

pub fn swap_delegate_stake(
    origin: OriginFor<T>, 
    from_subnet_id: u32, 
    to_subnet_id: u32, 
    delegate_stake_shares_to_swap: u128
)

Last updated