Skip to content

Commit

Permalink
Merge pull request #40 from bloxbean/gov_refactor
Browse files Browse the repository at this point in the history
refactor: Rename gov protocol params and Conway era enum
  • Loading branch information
satran004 authored Jan 20, 2024
2 parents e9eb81d + 7339c5b commit 8f1b8d8
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static Era getEra(int value) {
case 6:
return Era.Babbage;
case 7:
return Era.CONWAY;
return Era.Conway;
default:
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
@Builder
@ToString
public class DrepVoteThresholds {
private BigDecimal motionNoConfidence;
private BigDecimal committeeNormal;
private BigDecimal committeeNoConfidence;
private BigDecimal updateConstitution;
private BigDecimal hardForkInitiation;
private BigDecimal ppNetworkGroup;
private BigDecimal ppEconomicGroup;
private BigDecimal ppTechnicalGroup;
private BigDecimal ppGovernanceGroup;
private BigDecimal treasuryWithdrawal;
private BigDecimal dvtMotionNoConfidence;
private BigDecimal dvtCommitteeNormal;
private BigDecimal dvtCommitteeNoConfidence;
private BigDecimal dvtUpdateToConstitution;
private BigDecimal dvtHardForkInitiation;
private BigDecimal dvtPPNetworkGroup;
private BigDecimal dvtPPEconomicGroup;
private BigDecimal dvtPPTechnicalGroup;
private BigDecimal dvtPPGovGroup;
private BigDecimal dvtTreasuryWithdrawal;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public enum Era {
Mary(4),
Alonzo(5),
Babbage(6),
CONWAY(7);
Conway(7);

public final int value;
Era(int value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
@Builder
@ToString
public class PoolVotingThresholds {
private BigDecimal motionNoConfidence;
private BigDecimal committeeNormal;
private BigDecimal committeeNoConfidence;
private BigDecimal hardForkInitiation;
private BigDecimal pvtMotionNoConfidence;
private BigDecimal pvtCommitteeNormal;
private BigDecimal pvtCommitteeNoConfidence;
private BigDecimal pvtHardForkInitiation;
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ public class ProtocolParamUpdate {

//Conway era fields
private PoolVotingThresholds poolVotingThresholds; //25
private DrepVoteThresholds dRepVoteThresholds; //26
private Integer minCommitteeSize; //27
private Integer committeeTermLimit; //28
private Integer governanceActionValidityPeriod; //29
private BigInteger governanceActionDeposit; //30
private DrepVoteThresholds drepVotingThresholds; //26
private Integer committeeMinSize; //27
private Integer committeeMaxTermLength; //28
private Integer govActionLifetime; //29
private BigInteger govActionDeposit; //30
private BigInteger drepDeposit; //31
private Integer drepInactivityPeriod; //32
private Integer drepActivity; //32
}
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,13 @@ public ProtocolParamUpdate getProtocolParams(Map genesisProtocolParamsMap) {
.collateralPercent(collateralPercent)
.maxCollateralInputs(maxCollateralPercent)
.poolVotingThresholds(poolVotingThresholds)
.dRepVoteThresholds(drepVoteThresholds)
.minCommitteeSize(minCommitteeSize)
.committeeTermLimit(committeeTermLimit)
.governanceActionValidityPeriod(goveranceActionValidityPeriod)
.governanceActionDeposit(governanceActionDeposit)
.drepVotingThresholds(drepVoteThresholds)
.committeeMinSize(minCommitteeSize)
.committeeMaxTermLength(committeeTermLimit)
.govActionLifetime(goveranceActionValidityPeriod)
.govActionDeposit(governanceActionDeposit)
.drepDeposit(drepDeposit)
.drepInactivityPeriod(drepInactivityPeriod)
.drepActivity(drepInactivityPeriod)
.build();
return protocolParamUpdate;
}
Expand Down Expand Up @@ -291,10 +291,10 @@ private PoolVotingThresholds deserializePoolVotingThresholds(DataItem itemDI) {
BigDecimal hardForkInitiation = toRationalNumber((RationalNumber) poolVotingThresholds.get(3));

return PoolVotingThresholds.builder()
.motionNoConfidence(motionNoConfidence)
.committeeNormal(committeeNormal)
.committeeNoConfidence(committeeNoConfidence)
.hardForkInitiation(hardForkInitiation)
.pvtMotionNoConfidence(motionNoConfidence)
.pvtCommitteeNormal(committeeNormal)
.pvtCommitteeNoConfidence(committeeNoConfidence)
.pvtHardForkInitiation(hardForkInitiation)
.build();

}
Expand Down Expand Up @@ -332,16 +332,16 @@ private DrepVoteThresholds deserializeDrepVoteThresholds(DataItem itemDI) {
BigDecimal treasuryWithdrawal = toRationalNumber((RationalNumber) drepVotingThresholds.get(9));

return DrepVoteThresholds.builder()
.motionNoConfidence(motionNoConfidence)
.committeeNormal(committeeNormal)
.committeeNoConfidence(committeeNoConfidence)
.updateConstitution(updateConstitution)
.hardForkInitiation(hardForkInitiation)
.ppNetworkGroup(ppNetworkGroup)
.ppEconomicGroup(ppEconomicGroup)
.ppTechnicalGroup(ppTechnicalGroup)
.ppGovernanceGroup(ppGovernanceGroup)
.treasuryWithdrawal(treasuryWithdrawal)
.dvtMotionNoConfidence(motionNoConfidence)
.dvtCommitteeNormal(committeeNormal)
.dvtCommitteeNoConfidence(committeeNoConfidence)
.dvtUpdateToConstitution(updateConstitution)
.dvtHardForkInitiation(hardForkInitiation)
.dvtPPNetworkGroup(ppNetworkGroup)
.dvtPPEconomicGroup(ppEconomicGroup)
.dvtPPTechnicalGroup(ppTechnicalGroup)
.dvtPPGovGroup(ppGovernanceGroup)
.dvtTreasuryWithdrawal(treasuryWithdrawal)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -447,29 +447,29 @@ public CurrentProtocolParamQueryResult deserializeResult(DataItem[] di) {
.collateralPercent(collateralPercent)
.maxCollateralInputs(maxCollateralInputs)
.poolVotingThresholds(PoolVotingThresholds.builder()
.motionNoConfidence(motionNoConfidence)
.committeeNormal(committeeNormal)
.committeeNoConfidence(committeeNoConfidence)
.hardForkInitiation(hardForkInitiation)
.pvtMotionNoConfidence(motionNoConfidence)
.pvtCommitteeNormal(committeeNormal)
.pvtCommitteeNoConfidence(committeeNoConfidence)
.pvtHardForkInitiation(hardForkInitiation)
.build())
.dRepVoteThresholds(DrepVoteThresholds.builder()
.motionNoConfidence(dvtMotionNoConfidence)
.committeeNormal(dvtCommitteeNormal)
.committeeNoConfidence(dvtCommitteeNoConfidence)
.updateConstitution(dvtUpdateToConstitution)
.hardForkInitiation(dvtHardForkInitiation)
.ppNetworkGroup(dvtPPNetworkGroup)
.ppEconomicGroup(dvtPPEconomicGroup)
.ppTechnicalGroup(dvtPPTechnicalGroup)
.ppGovernanceGroup(dvtPPGovGroup)
.treasuryWithdrawal(dvtTreasuryWithdrawal)
.drepVotingThresholds(DrepVoteThresholds.builder()
.dvtMotionNoConfidence(dvtMotionNoConfidence)
.dvtCommitteeNormal(dvtCommitteeNormal)
.dvtCommitteeNoConfidence(dvtCommitteeNoConfidence)
.dvtUpdateToConstitution(dvtUpdateToConstitution)
.dvtHardForkInitiation(dvtHardForkInitiation)
.dvtPPNetworkGroup(dvtPPNetworkGroup)
.dvtPPEconomicGroup(dvtPPEconomicGroup)
.dvtPPTechnicalGroup(dvtPPTechnicalGroup)
.dvtPPGovGroup(dvtPPGovGroup)
.dvtTreasuryWithdrawal(dvtTreasuryWithdrawal)
.build())
.minCommitteeSize(minCommitteeSize)
.committeeTermLimit(committeeTermLimit)
.governanceActionValidityPeriod(governanceActionValidityPeriod)
.governanceActionDeposit(governanceActionDeposit)
.committeeMinSize(minCommitteeSize)
.committeeMaxTermLength(committeeTermLimit)
.govActionLifetime(governanceActionValidityPeriod)
.govActionDeposit(governanceActionDeposit)
.drepDeposit(drepDeposit)
.drepInactivityPeriod(drepInactivityPeriod)
.drepActivity(drepInactivityPeriod)
.build();

return new CurrentProtocolParamQueryResult(protocolParams);
Expand Down

0 comments on commit 8f1b8d8

Please sign in to comment.