Skip to content

Commit 33ae790

Browse files
Add abstract functions and types for handling time
1 parent 27c23f2 commit 33ae790

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

src/Ledger/Conway/Foreign/HSLedger/ExternalStructures.agda

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,14 @@ instance
129129
(inj₁ x) HSTimelock.tlScriptSize x
130130
(inj₂ x) HSPlutusScript.psScriptSize x
131131
; valContext = λ _ _ zero
132+
; UTCTime =
133+
; POSIXTimeRange =
134+
; EpochInfo =
135+
; SystemStart =
136+
; EI = tt
137+
; SysSt = tt
138+
; epochInfoSlotToUTCTime = λ _ _ _ nothing
139+
; transVITime = λ _ _ _ tt
132140
}
133141

134142
open import Ledger.Core.Specification.Address Network KeyHash ScriptHash using () public

src/Ledger/Conway/Specification/Abstract.lagda.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,22 @@ record indexOf : Type where
2828
indexOfVote : GovVoter → List GovVoter → Maybe Ix
2929
indexOfProposal : GovProposal → List GovProposal → Maybe Ix
3030
31-
record AbstractFunctions : Type where
32-
field txscriptfee : Prices → ExUnits → Coin
31+
ValidityInterval = Maybe Slot × Maybe Slot
32+
33+
record AbstractFunctions : Type₁ where
34+
field UTCTime : Type
35+
POSIXTimeRange : Type
36+
EpochInfo : Type
37+
SystemStart : Type
38+
EI : EpochInfo
39+
SysSt : SystemStart
40+
txscriptfee : Prices → ExUnits → Coin
3341
serSize : Value → MemoryEstimate
3442
indexOfImp : indexOf
3543
runPLCScript : CostModel → P2Script → ExUnits → List Data → Bool
3644
scriptSize : Script → ℕ
3745
valContext : TxInfo → ScriptPurpose → Data
3846
getLanguageView : PParams → Language → LangDepView
47+
epochInfoSlotToUTCTime : EpochInfo → SystemStart → Slot → Maybe UTCTime
48+
transVITime : EpochInfo → SystemStart → ValidityInterval → POSIXTimeRange
3949
```

src/Test/AbstractImplementation.agda

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module Test.AbstractImplementation
1010
(valContext' : TxInfo ScriptPurpose D)
1111
where
1212

13-
open import Ledger.Prelude using (nothing; _,_)
13+
open import Ledger.Prelude using (nothing; _,_; ℕ; ⊤; tt; id)
1414

1515
open import Test.LedgerImplementation T D
1616
renaming (SVTransactionStructure to SVTransactionStructure')
@@ -34,4 +34,12 @@ SVAbstractFunctions = record
3434
; runPLCScript = λ { x (sh , script) x₂ x₃ script x₃ }
3535
; scriptSize = λ _ 0
3636
; valContext = valContext'
37+
; UTCTime =
38+
; POSIXTimeRange =
39+
; EpochInfo =
40+
; SystemStart =
41+
; EI = tt
42+
; SysSt = tt
43+
; epochInfoSlotToUTCTime = λ _ _ _ nothing
44+
; transVITime = λ _ _ _ tt
3745
}

0 commit comments

Comments
 (0)