@@ -3,7 +3,7 @@ import { CborReader, CborWriter } from '../CBOR';
3
3
import { HexBlob , InvalidArgumentError } from '@cardano-sdk/util' ;
4
4
import { UnitInterval } from '../Common' ;
5
5
6
- const POOL_VOTING_THRESHOLDS_SIZE = 4 ;
6
+ const POOL_VOTING_THRESHOLDS_SIZE = 5 ;
7
7
8
8
/**
9
9
* Governance actions are ratified through on-chain voting. Different
@@ -17,6 +17,7 @@ export class PoolVotingThresholds {
17
17
#committeeNormal: UnitInterval ;
18
18
#committeeNoConfidence: UnitInterval ;
19
19
#hardForkInitiation: UnitInterval ;
20
+ #securityRelevantParamVotingThreshold: UnitInterval ;
20
21
#originalBytes: HexBlob | undefined = undefined ;
21
22
22
23
/**
@@ -35,12 +36,14 @@ export class PoolVotingThresholds {
35
36
motionNoConfidence : UnitInterval ,
36
37
committeeNormal : UnitInterval ,
37
38
committeeNoConfidence : UnitInterval ,
38
- hardForkInitiation : UnitInterval
39
+ hardForkInitiation : UnitInterval ,
40
+ securityRelevantParamVotingThreshold : UnitInterval
39
41
) {
40
42
this . #motionNoConfidence = motionNoConfidence ;
41
43
this . #committeeNormal = committeeNormal ;
42
44
this . #committeeNoConfidence = committeeNoConfidence ;
43
45
this . #hardForkInitiation = hardForkInitiation ;
46
+ this . #securityRelevantParamVotingThreshold = securityRelevantParamVotingThreshold ;
44
47
}
45
48
46
49
/**
@@ -59,13 +62,15 @@ export class PoolVotingThresholds {
59
62
// , unit_interval ; committee normal
60
63
// , unit_interval ; committee no confidence
61
64
// , unit_interval ; hard fork initiation
65
+ // , unit_interval ; security relevant parameter voting threshold
62
66
// ]
63
67
writer . writeStartArray ( POOL_VOTING_THRESHOLDS_SIZE ) ;
64
68
65
69
writer . writeEncodedValue ( Buffer . from ( this . #motionNoConfidence. toCbor ( ) , 'hex' ) ) ;
66
70
writer . writeEncodedValue ( Buffer . from ( this . #committeeNormal. toCbor ( ) , 'hex' ) ) ;
67
71
writer . writeEncodedValue ( Buffer . from ( this . #committeeNoConfidence. toCbor ( ) , 'hex' ) ) ;
68
72
writer . writeEncodedValue ( Buffer . from ( this . #hardForkInitiation. toCbor ( ) , 'hex' ) ) ;
73
+ writer . writeEncodedValue ( Buffer . from ( this . #securityRelevantParamVotingThreshold. toCbor ( ) , 'hex' ) ) ;
69
74
70
75
return writer . encodeAsHex ( ) ;
71
76
}
@@ -91,14 +96,16 @@ export class PoolVotingThresholds {
91
96
const committeeNormal = UnitInterval . fromCbor ( HexBlob . fromBytes ( reader . readEncodedValue ( ) ) ) ;
92
97
const committeeNoConfidence = UnitInterval . fromCbor ( HexBlob . fromBytes ( reader . readEncodedValue ( ) ) ) ;
93
98
const hardForkInitiation = UnitInterval . fromCbor ( HexBlob . fromBytes ( reader . readEncodedValue ( ) ) ) ;
99
+ const securityRelevantParamVotingThreshold = UnitInterval . fromCbor ( HexBlob . fromBytes ( reader . readEncodedValue ( ) ) ) ;
94
100
95
101
reader . readEndArray ( ) ;
96
102
97
103
const thresholds = new PoolVotingThresholds (
98
104
motionNoConfidence ,
99
105
committeeNormal ,
100
106
committeeNoConfidence ,
101
- hardForkInitiation
107
+ hardForkInitiation ,
108
+ securityRelevantParamVotingThreshold
102
109
) ;
103
110
104
111
thresholds . #originalBytes = cbor ;
@@ -107,7 +114,7 @@ export class PoolVotingThresholds {
107
114
}
108
115
109
116
/**
110
- * Creates a Core PoolVotingThresholdsSHOLDS_SIZE object from the current PoolVotingThresholds object.
117
+ * Creates a Core PoolVotingThresholds object from the current PoolVotingThresholds object.
111
118
*
112
119
* @returns The Core Prices object.
113
120
*/
@@ -116,7 +123,8 @@ export class PoolVotingThresholds {
116
123
commiteeNoConfidence : this . #committeeNoConfidence. toCore ( ) ,
117
124
committeeNormal : this . #committeeNormal. toCore ( ) ,
118
125
hardForkInitiation : this . #hardForkInitiation. toCore ( ) ,
119
- motionNoConfidence : this . #motionNoConfidence. toCore ( )
126
+ motionNoConfidence : this . #motionNoConfidence. toCore ( ) ,
127
+ securityRelevantParamVotingThreshold : this . #securityRelevantParamVotingThreshold. toCore ( )
120
128
} ;
121
129
}
122
130
@@ -130,7 +138,8 @@ export class PoolVotingThresholds {
130
138
UnitInterval . fromCore ( core . motionNoConfidence ) ,
131
139
UnitInterval . fromCore ( core . committeeNormal ) ,
132
140
UnitInterval . fromCore ( core . commiteeNoConfidence ) ,
133
- UnitInterval . fromCore ( core . hardForkInitiation )
141
+ UnitInterval . fromCore ( core . hardForkInitiation ) ,
142
+ UnitInterval . fromCore ( core . securityRelevantParamVotingThreshold )
134
143
) ;
135
144
}
136
145
@@ -223,4 +232,13 @@ export class PoolVotingThresholds {
223
232
hardForkInitiation ( ) : UnitInterval {
224
233
return this . #hardForkInitiation;
225
234
}
235
+
236
+ /**
237
+ * Gets the security relevant parameter voting threshold
238
+ *
239
+ * @returns security relevant parameter voting threshold.
240
+ */
241
+ securityRelevantParamVotingThreshold ( ) : UnitInterval {
242
+ return this . #securityRelevantParamVotingThreshold;
243
+ }
226
244
}
0 commit comments