onflow/flow-core-contracts

Add `removeStake` function to staking collection

Closed this issue · 0 comments

Issue To Be Solved

Users need to be able to transfer their staking objects if needed, so they need a way to remove them from a collection.

Suggest A Solution

  • Add a removeStake(nodeID: String, delegatorID: UInt32?): @AnyResource function that returns the specified staking object
  • The object cannot be removed if there are any locked tokens used
  • Subtract the total amount of tokens stored in the staking object from unlockedTokensUsed
  • Add the addStake function to the public interface
  • Create a transaction to remove a staking object and transfer it to another account's staking collection
  • Add a test for transferring