-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #237 from onflow/reward-slashing
Adds rewards slashing transaction
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |