File tree Expand file tree Collapse file tree 8 files changed +13
-8
lines changed
calculation/src/main/java/org/cardanofoundation/rewards/calculation
main/java/org/cardanofoundation/rewards/validation
test/java/org/cardanofoundation/rewards/validation/data/provider Expand file tree Collapse file tree 8 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ public static PoolRewardCalculationResult calculatePoolRewardInEpoch(final Strin
155155
156156 final BigInteger poolStake = poolStateCurrentEpoch .getActiveStake ();
157157 final BigInteger poolPledge = poolStateCurrentEpoch .getPledge ();
158- final BigDecimal poolMargin = BigDecimal . valueOf ( poolStateCurrentEpoch .getMargin () );
158+ final BigDecimal poolMargin = poolStateCurrentEpoch .getMargin ();
159159 final BigInteger poolFixedCost = poolStateCurrentEpoch .getFixedCost ();
160160 final int blocksPoolHasMinted = poolStateCurrentEpoch .getBlockCount ();
161161
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ public class PoolRewardCalculationResult {
2525 BigDecimal apparentPoolPerformance ;
2626 BigInteger poolFee ;
2727 BigInteger distributedPoolReward ;
28- Double poolMargin ;
28+ BigDecimal poolMargin ;
2929 BigInteger poolCost ;
3030 Set <String > poolOwnerStakeAddresses ;
3131 BigInteger unspendableEarnedRewards ;
Original file line number Diff line number Diff line change 22
33import lombok .*;
44
5+ import java .math .BigDecimal ;
56import java .math .BigInteger ;
67import java .util .HashSet ;
78
@@ -17,7 +18,7 @@ public class PoolState {
1718 private HashSet <String > owners ;
1819 private BigInteger ownerActiveStake ;
1920 private BigInteger poolFees ;
20- private Double margin ;
21+ private BigDecimal margin ;
2122 private BigInteger fixedCost ;
2223 private BigInteger pledge ;
2324 private HashSet <Delegator > delegators ;
Original file line number Diff line number Diff line change 22
33import lombok .*;
44
5+ import java .math .BigDecimal ;
56import java .math .BigInteger ;
67import java .util .HashSet ;
78import java .util .List ;
@@ -16,7 +17,7 @@ public class PoolUpdate {
1617 private String poolId ;
1718 private Integer activeEpoch ;
1819 private Integer retiringEpoch ;
19- private Double margin ;
20+ private BigDecimal margin ;
2021 private BigInteger fixedCost ;
2122 private BigInteger pledge ;
2223 private String rewardAddress ;
Original file line number Diff line number Diff line change 66import org .hibernate .annotations .Immutable ;
77import org .springframework .context .annotation .Profile ;
88
9+ import java .math .BigDecimal ;
910import java .math .BigInteger ;
1011
1112@ Entity
@@ -24,7 +25,7 @@ public class DbSyncPoolUpdate {
2425 private DbSyncPoolHash pool ;
2526
2627 private BigInteger pledge ;
27- private Double margin ;
28+ private BigDecimal margin ;
2829 @ Column (name = "active_epoch_no" )
2930 private Long activeEpochNumber ;
3031
Original file line number Diff line number Diff line change 11package org .cardanofoundation .rewards .validation .entity .projection ;
22
3+ import java .math .BigDecimal ;
34import java .math .BigInteger ;
45
56public interface LatestPoolUpdate {
67 Long getId ();
78 String getPoolId ();
89 BigInteger getPledge ();
910 BigInteger getFixedCost ();
10- Double getMargin ();
11+ BigDecimal getMargin ();
1112 String getRewardAddress ();
1213}
Original file line number Diff line number Diff line change 22
33import org .cardanofoundation .rewards .calculation .domain .PoolState ;
44
5+ import java .math .BigDecimal ;
56import java .math .BigInteger ;
67
78public class PoolHistoryMapper {
@@ -12,7 +13,7 @@ public static PoolState fromKoiosPoolHistory(rest.koios.client.backend.api.pool.
1213 return PoolState .builder ()
1314 .activeStake (new BigInteger (poolHistory .getActiveStake ()))
1415 .poolFees (new BigInteger (poolHistory .getPoolFees ()))
15- .margin (Double . parseDouble (String .valueOf (poolHistory .getMargin ())))
16+ .margin (new BigDecimal (String .valueOf (poolHistory .getMargin ())))
1617 .fixedCost (new BigInteger (String .valueOf (poolHistory .getFixedCost ())))
1718 .blockCount (poolHistory .getBlockCnt ())
1819 .epoch (poolHistory .getEpochNo ())
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ public void testGetPoolHistory() {
8080 Assertions .assertEquals (poolState .getActiveStake (), new BigInteger ("27523186299296" ));
8181 Assertions .assertEquals (poolState .getBlockCount (), 10 );
8282 Assertions .assertEquals (poolState .getFixedCost (), new BigInteger ("340000000" ));
83- Assertions .assertEquals (poolState .getMargin (), 0.009 );
83+ Assertions .assertEquals (poolState .getMargin (), new BigDecimal ( " 0.009" ) );
8484 Assertions .assertEquals (poolState .getPoolFees (), new BigInteger ("475116283" ));
8585 }
8686
You can’t perform that action at this time.
0 commit comments