Skip to content

Commit

Permalink
Normalise to total stake in getNonMyopicMemberRewards
Browse files Browse the repository at this point in the history
We were using the max supply previously, this makes it consistent with how
rewards are calculated.
  • Loading branch information
kantp committed Sep 14, 2020
1 parent 4b74173 commit 081cce7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Expand Up @@ -78,8 +78,9 @@ getNonMyopicMemberRewards globals ss creds =
(\cred -> (cred, Map.mapWithKey (mkNMMRewards $ memShare cred) poolData))
(Set.toList creds)
where
total = fromIntegral $ maxLovelaceSupply globals
toShare (Coin x) = StakeShare (x % total)
maxSupply = Coin . fromIntegral $ maxLovelaceSupply globals
Coin totalStake = circulation es maxSupply
toShare (Coin x) = StakeShare (x % totalStake)
memShare (Right cred) = toShare $ Map.findWithDefault (Coin 0) cred (EB.unStake stake)
memShare (Left coin) = toShare coin
es = nesEs ss
Expand All @@ -97,7 +98,7 @@ getNonMyopicMemberRewards globals ss creds =
(\k p -> (percentile' (histLookup k), p, toShare . fold . EB.unStake $ EB.poolStake k delegs stake))
poolParams
histLookup k = fromMaybe mempty (Map.lookup k ls)
topPools = getTopRankedPools rPot (Coin total) pp poolParams (fmap percentile' ls)
topPools = getTopRankedPools rPot (Coin totalStake) pp poolParams (fmap percentile' ls)
mkNMMRewards ms k (ap, poolp, sigma) =
if checkPledge poolp
then nonMyopicMemberRew pp poolp rPot s ms nmps ap
Expand Down
Expand Up @@ -274,10 +274,10 @@ getTopRankedPools ::
Map (KeyHash 'StakePool era) (PoolParams era) ->
Map (KeyHash 'StakePool era) PerformanceEstimate ->
Set (KeyHash 'StakePool era)
getTopRankedPools rPot totalStake pp poolParams aps =
Set.fromList $
fmap fst $
take (fromIntegral $ _nOpt pp) (sortBy (flip compare `on` snd) rankings)
getTopRankedPools rPot totalStake pp poolParams aps =
where
pdata = Map.toList $ Map.intersectionWith (,) poolParams aps
rankings =
Expand Down

0 comments on commit 081cce7

Please sign in to comment.