Skip to content

Commit 19d3fd1

Browse files
committed
Add doc/ledger-reward-events.md
1 parent 340b96b commit 19d3fd1

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

doc/ledger-reward-events.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Ledger Reward Events
2+
3+
This is an ambit claim of what data the ledger events should provide from the point of view of
4+
`db-sync`.
5+
6+
## Prologue
7+
8+
In the context of `db-sync` and the `ledger`, the word "reward" is slightly misleading and should
9+
not be narrowly defined as only being payments of staking rewards, but defined much more broadly as
10+
any and all payments to a stake address. None of these payments are recorded on the block chain as
11+
part of regular transactions.
12+
13+
Payments to stake addresses are made for one of following reasons:
14+
* Staking rewards for being a member of a stake pool.
15+
* Staking rewards for being an owner of a stake pool.
16+
* MIR payments from the treasury.
17+
* MIR payments from the reserves.
18+
* Refunds of the stake pool deposit payment when a pool is de-registered.
19+
20+
Currently, the ledger provides the following reward related events:
21+
* `LEDeltaReward`
22+
* `LEMirTransfer`
23+
* `LERetiredPools`
24+
* `LETotalRewards`
25+
26+
These events are currently only used by `db-sync` but it is my understanding that in the future,
27+
other programs will also start using these.
28+
29+
30+
## The Desired Ledger Event Functionality
31+
32+
* Every event should carry an `EpochNo` field to make debugging and validation on the `db-sync` side
33+
easier.
34+
* A single `LETotalRewards` event should be emitted for every epoch in the Shelley era and later.
35+
* `LETotalRewards` should include all payments to stake addresses for a given epoch. That means
36+
all staking rewards (member and owner), all MIR payments and all stake pool deposit refunds.
37+
* `LEDeltaReward` should only ever contain pool membership or pool ownership rewards.
38+
* The sum of all `LEDeltaReward`, `LEMirTransfer` and `LERetiredPools` amounts for an epoch should
39+
always be the same as the sum of `LETotalRewards` event amounts for that epoch.
40+
* The `LETotalRewards` must be the last reward related event for a given epoch to be emitted from
41+
the ledger.
42+
* For the Shelley Era (ie after Byron and before Mary), for the `LETotalRewards` event, all staking
43+
addresses should only contain one staking reward amount (if an address receives both an ownership
44+
and a membership reward, the later will be dropped).

0 commit comments

Comments
 (0)