Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions contracts/FlowIDTableStaking.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ access(all) contract FlowIDTableStaking {
/// Epoch
access(all) event NewEpoch(totalStaked: UFix64, totalRewardPayout: UFix64, newEpochCounter: UInt64)
access(all) event EpochTotalRewardsPaid(total: UFix64, fromFees: UFix64, minted: UFix64, feesBurned: UFix64, epochCounterForRewards: UInt64)
// The single parameter is a map from node ID to the percentage of theirs and their delegator's rewards
// that will remain after being withheld from the node at each subsequent payout, until the withholding map is modified again.
access(all) event NodeRewardWithholdingsUpdated(nodeRewardsPercentageRemaining: {String: UFix64})

/// Node
access(all) event NewNodeCreated(nodeID: String, role: UInt8, amountCommitted: UFix64)
Expand All @@ -52,6 +55,7 @@ access(all) contract FlowIDTableStaking {
access(all) event RewardTokensWithdrawn(nodeID: String, amount: UFix64)
access(all) event NetworkingAddressUpdated(nodeID: String, newAddress: String)
access(all) event NodeWeightChanged(nodeID: String, newWeight: UInt64)
access(all) event NodeRewardsWithheld(nodeID: String, percentageRemaining: UFix64)

/// Delegator
access(all) event NewDelegatorCreated(nodeID: String, delegatorID: UInt32)
Expand Down Expand Up @@ -945,6 +949,8 @@ access(all) contract FlowIDTableStaking {
message: "Percentage value to decrease rewards payout should be between 0 and 1"
)
}

emit NodeRewardWithholdingsUpdated(nodeRewardsPercentageRemaining: nodeIDs)
FlowIDTableStaking.account.storage.load<{String: UFix64}>(from: /storage/idTableNonOperationalNodesList)
FlowIDTableStaking.account.storage.save<{String: UFix64}>(nodeIDs, to: /storage/idTableNonOperationalNodesList)
}
Expand Down Expand Up @@ -1338,6 +1344,8 @@ access(all) contract FlowIDTableStaking {
// Its delegator's rewards are also decreased to the same percentage
let rewardDecreaseToPercentage = nonOperationalNodes[nodeID]!

emit NodeRewardsWithheld(nodeID: nodeID, percentageRemaining: rewardDecreaseToPercentage)

sumStakeFromNonOperationalStakers = sumStakeFromNonOperationalStakers + nodeRecord.tokensStaked.balance

// Calculate the normal reward amount, then the rewards left after the decrease
Expand Down
6 changes: 3 additions & 3 deletions lib/go/contracts/internal/assets/assets.go

Large diffs are not rendered by default.

Loading