Skip to content

Commit d95b170

Browse files
authored
feat: initial rewards calculation formulas (#1260)
Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
1 parent df73e42 commit d95b170

File tree

6 files changed

+1778
-0
lines changed

6 files changed

+1778
-0
lines changed

internal/test/ledger/ledger.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ type MockLedgerState struct {
2626
MockUtxos []common.Utxo
2727
MockStakeRegistration []common.StakeRegistrationCertificate
2828
MockPoolRegistration []common.PoolRegistrationCertificate
29+
MockAdaPots common.AdaPots
30+
MockRewardSnapshot common.RewardSnapshot
2931
}
3032

3133
func (ls MockLedgerState) NetworkId() uint {
@@ -89,3 +91,26 @@ func (ls MockLedgerState) TimeToSlot(t time.Time) (uint64, error) {
8991
// TODO
9092
return 0, nil
9193
}
94+
95+
func (ls MockLedgerState) CalculateRewards(
96+
pots common.AdaPots,
97+
snapshot common.RewardSnapshot,
98+
params common.RewardParameters,
99+
) (*common.RewardCalculationResult, error) {
100+
return common.CalculateRewards(pots, snapshot, params)
101+
}
102+
103+
func (ls MockLedgerState) GetAdaPots() common.AdaPots {
104+
return ls.MockAdaPots
105+
}
106+
107+
func (ls MockLedgerState) UpdateAdaPots(pots common.AdaPots) error {
108+
// Mock implementation - doesn't modify state
109+
return nil
110+
}
111+
112+
func (ls MockLedgerState) GetRewardSnapshot(
113+
epoch uint64,
114+
) (common.RewardSnapshot, error) {
115+
return ls.MockRewardSnapshot, nil
116+
}

0 commit comments

Comments
 (0)