Skip to content

Commit

Permalink
stake field of BaseAddr should be optional
Browse files Browse the repository at this point in the history
This closes issue #606.
  • Loading branch information
williamdemeo authored and Soupstraw committed Nov 12, 2024
1 parent bb05c86 commit 8efbcad
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Ledger/Address.lagda
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ data isScript : Credential → Type where
record BaseAddr : Type where
field net : Network
pay : Credential
stake : Credential
stake : Maybe Credential

record BootstrapAddr : Type where
field net : Network
Expand Down Expand Up @@ -106,7 +106,7 @@ isScriptRwdAddr = isScript ∘ RwdAddr.stake
payCred (inj₁ record {pay = pay}) = pay
payCred (inj₂ record {pay = pay}) = pay

stakeCred (inj₁ record {stake = stake}) = just stake
stakeCred (inj₁ record {stake = stake}) = stake
stakeCred (inj₂ _) = nothing

netId (inj₁ record {net = net}) = net
Expand Down
4 changes: 2 additions & 2 deletions src/ScriptVerification/HelloWorld.agda
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ initEnv = createEnv 0
initTxOut : TxOut
initTxOut = inj₁ (record { net = 0 ;
pay = ScriptObj 777 ;
stake = ScriptObj 777 })
stake = just (ScriptObj 777) })
, 10 , nothing , nothing

script : TxIn × TxOut
Expand All @@ -52,7 +52,7 @@ succeedTx = record { body = record
∷ (5
, ((inj₁ (record { net = 0 ;
pay = KeyHashObj 5 ;
stake = KeyHashObj 5 }))
stake = just (KeyHashObj 5) }))
, (1000000000000 - 10000000000) , nothing , nothing))
∷ [])
; txfee = 10000000000
Expand Down
2 changes: 1 addition & 1 deletion src/ScriptVerification/Lib.agda
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ createUTxO : (index : ℕ)
Maybe (D ⊎ DataHash)
TxIn × TxOut
createUTxO index wallet value d = (index , index)
, (inj₁ (record { net = 0 ; pay = KeyHashObj wallet ; stake = KeyHashObj wallet })
, (inj₁ (record { net = 0 ; pay = KeyHashObj wallet ; stake = just (KeyHashObj wallet) })
, value , d , nothing)

createInitUtxoState : (wallets : ℕ)
Expand Down
6 changes: 3 additions & 3 deletions src/ScriptVerification/SucceedIfNumber.agda
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ initEnv = createEnv 0
initTxOut : TxOut
initTxOut = inj₁ (record { net = 0 ;
pay = ScriptObj 777 ;
stake = ScriptObj 777 })
stake = just (ScriptObj 777) })
, 10 , just (inj₂ 99) , nothing

-- initTxOut for script without datum reference
initTxOut' : TxOut
initTxOut' = inj₁ (record { net = 0 ;
pay = ScriptObj 888 ;
stake = ScriptObj 888 })
stake = just (ScriptObj 888) })
, 10 , nothing , nothing

scriptDatum : TxIn × TxOut
Expand All @@ -74,7 +74,7 @@ succeedTx = record { body = record
∷ (5
, ((inj₁ (record { net = 0 ;
pay = KeyHashObj 5 ;
stake = KeyHashObj 5 }))
stake = just (KeyHashObj 5) }))
, (1000000000000 - 10000000000) , nothing , nothing))
∷ [])
; txfee = 10000000000
Expand Down

0 comments on commit 8efbcad

Please sign in to comment.