Skip to content

Commit

Permalink
Add TxCertPoolRegister and TxCertPoolRetire to TxCert (#5666)
Browse files Browse the repository at this point in the history
  • Loading branch information
zliu41 authored Dec 7, 2023
1 parent ec78172 commit bd343cf
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@
data TxCert | TxCert_match where
TxCertAuthHotCommittee : Credential -> Credential -> TxCert
TxCertDelegStaking : Credential -> Delegatee -> TxCert
TxCertPoolRegister : bytestring -> bytestring -> TxCert
TxCertPoolRetire : bytestring -> integer -> TxCert
TxCertRegDRep :
Credential ->
(\k v -> List (Tuple2 k v))
Expand Down Expand Up @@ -490,10 +492,10 @@
{all dead. TxCert}
(equalsInteger 7 index)
(/\dead ->
TxCertAuthHotCommittee
(`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData`
TxCertPoolRegister
(unBData
(headList {data} args))
(`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData`
(unBData
(headList
{data}
(tailList
Expand All @@ -504,15 +506,51 @@
{all dead. TxCert}
(equalsInteger 8 index)
(/\dead ->
TxCertResignColdCommittee
(`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData`
TxCertPoolRetire
(unBData
(headList
{data}
args)))
args))
(unIData
(headList
{data}
(tailList
{data}
args))))
(/\dead ->
traceError
{TxCert}
reconstructCaseError)
ifThenElse
{all dead. TxCert}
(equalsInteger 9 index)
(/\dead ->
TxCertAuthHotCommittee
(`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData`
(headList
{data}
args))
(`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData`
(headList
{data}
(tailList
{data}
args))))
(/\dead ->
ifThenElse
{all dead. TxCert}
(equalsInteger
10
index)
(/\dead ->
TxCertResignColdCommittee
(`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData`
(headList
{data}
args)))
(/\dead ->
traceError
{TxCert}
reconstructCaseError)
{all dead. dead})
{all dead. dead})
{all dead. dead})
{all dead. dead})
{all dead. dead})
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2774
2832
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@
data TxCert | TxCert_match where
TxCertAuthHotCommittee : Credential -> Credential -> TxCert
TxCertDelegStaking : Credential -> Delegatee -> TxCert
TxCertPoolRegister : bytestring -> bytestring -> TxCert
TxCertPoolRetire : bytestring -> integer -> TxCert
TxCertRegDRep :
Credential ->
(\k v -> List (Tuple2 k v))
Expand Down Expand Up @@ -459,10 +461,10 @@
{all dead. TxCert}
(equalsInteger 7 index)
(/\dead ->
TxCertAuthHotCommittee
(`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData`
TxCertPoolRegister
(unBData
(headList {data} args))
(`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData`
(unBData
(headList
{data}
(tailList
Expand All @@ -473,15 +475,51 @@
{all dead. TxCert}
(equalsInteger 8 index)
(/\dead ->
TxCertResignColdCommittee
(`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData`
TxCertPoolRetire
(unBData
(headList
{data}
args)))
args))
(unIData
(headList
{data}
(tailList
{data}
args))))
(/\dead ->
traceError
{TxCert}
reconstructCaseError)
ifThenElse
{all dead. TxCert}
(equalsInteger 9 index)
(/\dead ->
TxCertAuthHotCommittee
(`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData`
(headList
{data}
args))
(`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData`
(headList
{data}
(tailList
{data}
args))))
(/\dead ->
ifThenElse
{all dead. TxCert}
(equalsInteger
10
index)
(/\dead ->
TxCertResignColdCommittee
(`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData`
(headList
{data}
args)))
(/\dead ->
traceError
{TxCert}
reconstructCaseError)
{all dead. dead})
{all dead. dead})
{all dead. dead})
{all dead. dead})
{all dead. dead})
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2714
2772
5 changes: 5 additions & 0 deletions plutus-ledger-api/changelog.d/20231206_051204_unsafeFixIO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

### Changed

- Added two constructors, `TxCertPoolRegister` and `TxCertPoolRetire`, to
`PlutusLedgerApi.V3.Contexts.TxCert`.
14 changes: 12 additions & 2 deletions plutus-ledger-api/src/PlutusLedgerApi/V3/Contexts.hs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ data TxCert
TxCertUpdateDRep DRepCredential
| -- | UnRegister a DRep with mandatory refund value
TxCertUnRegDRep DRepCredential V2.Value
| -- | A digest of the PoolParams
TxCertPoolRegister
-- | poolId
V2.PubKeyHash
-- | pool VFR
V2.PubKeyHash
| -- | The retirement certificate and the Epoch in which the retirement will take place
TxCertPoolRetire V2.PubKeyHash Haskell.Integer
| -- | Authorize a Hot credential for a specific Committee member's cold credential
TxCertAuthHotCommittee ColdCommitteeCredential HotCommitteeCredential
| TxCertResignColdCommittee ColdCommitteeCredential
Expand Down Expand Up @@ -443,8 +451,10 @@ PlutusTx.makeIsDataIndexed
, ('TxCertRegDRep, 4)
, ('TxCertUpdateDRep, 5)
, ('TxCertUnRegDRep, 6)
, ('TxCertAuthHotCommittee, 7)
, ('TxCertResignColdCommittee, 8)
, ('TxCertPoolRegister, 7)
, ('TxCertPoolRetire, 8)
, ('TxCertAuthHotCommittee, 9)
, ('TxCertResignColdCommittee, 10)
]

PlutusTx.makeLift ''Voter
Expand Down

0 comments on commit bd343cf

Please sign in to comment.