Skip to content

Commit

Permalink
Merge pull request #237 from onflow/reward-slashing
Browse files Browse the repository at this point in the history
Adds rewards slashing transaction
  • Loading branch information
joshuahannan authored Apr 27, 2023
2 parents cf11f85 + 10b7840 commit f0bd6d9
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions templates/capability_set_slashing_nodes.cdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import FlowIDTableStaking from 0x8624b52f9ddcd04a

/// This transaction uses a staking admin capability
/// to set a list of nodes whose rewards will be decreased
/// during the next rewards payout
transaction(nodesToSlash: {String: UFix64}) {

// Local variable for a reference to the ID Table Admin object
let adminRef: &FlowIDTableStaking.Admin

prepare(acct: AuthAccount) {
let adminCapability = acct.copy<Capability>(from: FlowIDTableStaking.StakingAdminStoragePath)
?? panic("Could not get capability from account storage")

// borrow a reference to the admin object
self.adminRef = adminCapability.borrow<&FlowIDTableStaking.Admin>()
?? panic("Could not borrow reference to staking admin")
}

execute {
self.adminRef.setNonOperationalNodesList(nodesToSlash)
}
}

0 comments on commit f0bd6d9

Please sign in to comment.