Skip to content

Commit

Permalink
Check whether pledge is met in getNonMyopicMemberRewards.
Browse files Browse the repository at this point in the history
This makes sure that pools that do not currently meet their pledge do not get
listed as pools with a high non-myopic member reward.
  • Loading branch information
Philipp Kant authored and Jared Corduan committed Jul 9, 2020
1 parent 12b13f3 commit ffb93d5
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ where

import Data.Map (Map)
import qualified Data.Map as Map
import Data.Maybe (fromMaybe)
import Data.Ratio ((%))
import Data.Set (Set)
import qualified Data.Set as Set
Expand Down Expand Up @@ -70,10 +71,20 @@ getNonMyopicMemberRewards globals ss creds =
ls
poolParams
topPools = getTopRankedPools rPot (Coin total) pp poolParams (fmap percentile' ls)
mkNMMRewards ms k (ap, poolp, sigma) = nonMyopicMemberRew pp poolp rPot s ms nmps ap
mkNMMRewards ms k (ap, poolp, sigma) =
if checkPledge poolp
then nonMyopicMemberRew pp poolp rPot s ms nmps ap
else 0
where
s = (toShare . _poolPledge) poolp
nmps = nonMyopicStake k sigma s pp topPools
checkPledge pool =
let ostake =
Set.foldl'
(\c o -> c + (fromMaybe (Coin 0) $ Map.lookup (KeyHashObj o) (unStake stake)))
(Coin 0)
(_poolOwners pool)
in _poolPledge poolp <= ostake

-- | Get the full UTxO.
getUTxO ::
Expand Down

0 comments on commit ffb93d5

Please sign in to comment.