Skip to content

Commit 53afaa1

Browse files
committed
WIP registration
1 parent 0ef6110 commit 53afaa1

File tree

5 files changed

+32
-12
lines changed

5 files changed

+32
-12
lines changed

src/aiken-example/haskell/aiken-example.cabal

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ common lang
5454

5555
library
5656
import: lang
57-
exposed-modules: Wst.Aiken.Blueprint
57+
exposed-modules:
58+
Wst.Aiken.Blueprint
59+
Wst.Aiken.Offchain
60+
5861
hs-source-dirs: lib
5962
build-depends:
6063
, aeson
@@ -63,6 +66,7 @@ library
6366
, cardano-api
6467
, containers
6568
, text
69+
, wst-poc
6670

6771
test-suite wst-aiken-test
6872
import: lang

src/aiken-example/haskell/lib/Wst/Aiken/Blueprint.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ deserialise Preamble{plutusVersion = BlueprintScriptVersion v} validators =
9595
deserialiseScript :: AnyPlutusScriptVersion -> BlueprintValidator -> Either String (BlueprintKey, ScriptInAnyLang)
9696
deserialiseScript (C.AnyPlutusScriptVersion v) BlueprintValidator{title, compiledCode} =
9797
let lng = C.PlutusScriptLanguage v
98-
in fmap ((title,) . C.ScriptInAnyLang lng . C.PlutusScript v) (deserialisePlutus v compiledCode)
98+
in fmap ((title,) . C.ScriptInAnyLang lng) (deserialisePlutus v compiledCode)
9999

100-
deserialisePlutus :: forall lang. (C.HasTypeProxy lang) => C.PlutusScriptVersion lang -> Text -> Either String (C.PlutusScript lang)
101-
deserialisePlutus _ text = first show $ C.deserialiseFromCBOR (C.proxyToAsType $ Proxy @(C.PlutusScript lang)) (TE.encodeUtf8 text)
100+
deserialisePlutus :: forall lang. (C.IsScriptLanguage lang) => C.PlutusScriptVersion lang -> Text -> Either String (C.Script lang)
101+
deserialisePlutus _ text = first show $ C.deserialiseFromCBOR (C.proxyToAsType $ Proxy @(C.Script lang)) (TE.encodeUtf8 text)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
-- | Off-chain code for the aiken example
2+
module Wst.Aiken.Offchain
3+
( register,
4+
)
5+
where
6+
7+
import Wst.Offchain.BuildTx.DirectorySet (InsertNodeArgs (..))
8+
import Wst.Offchain.BuildTx.DirectorySet qualified as Directory
9+
10+
-- | Register the policy
11+
register :: (Applicative m) => m ()
12+
register = do
13+
let args =
14+
InsertNodeArgs
15+
{ inaNewKey = undefined
16+
}
17+
pure ()

src/aiken-example/haskell/test/Wst/Aiken/Test.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ module Wst.Aiken.Test(
77
import Cardano.Api qualified as C
88
import Data.Functor (void)
99
import Data.Map qualified as Map
10-
import Data.Maybe (isJust)
1110
import Paths_aiken_example qualified as Pkg
1211
import Test.Tasty (TestTree, testGroup)
13-
import Test.Tasty.HUnit (Assertion, assertBool, assertEqual, testCase)
12+
import Test.Tasty.HUnit (Assertion, assertEqual, testCase)
1413
import Wst.Aiken.Blueprint (Blueprint (..))
1514
import Wst.Aiken.Blueprint qualified as Blueprint
1615

@@ -31,7 +30,7 @@ deserialiseScript = do
3130
>>= \case
3231
(C.ScriptInAnyLang (C.PlutusScriptLanguage C.PlutusScriptV3) script) -> do
3332
let hsh = C.hashScript script
34-
assertEqual "Script hash" "cc068514c844ed3f6c6d0f131b20cda83dbd50f340242b5740d0f81f" hsh
33+
assertEqual "Script hash" "9c4802ae9a38d64cf970d68f34f55c6504c749c64fe0968fea77dac8" hsh
3534
_ -> fail "Unexpected script language"
3635

3736
loadExample :: IO Blueprint

src/regulated-stablecoin/lib/Wst/Offchain/BuildTx/DirectorySet.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ initDirectorySet = Utils.inBabbage @era $ do
8484
prependTxOut output
8585

8686

87-
{-| Data for a new node to be inserted into the directory
87+
{-| Data for a new node to be inserted into the directory
8888
-}
8989
data InsertNodeArgs =
9090
InsertNodeArgs
91-
{ inaNewKey :: CurrencySymbol
92-
, inaTransferLogic :: C.StakeCredential
93-
, inaIssuerLogic :: C.StakeCredential
94-
, inaGlobalStateCS :: Maybe CurrencySymbol
91+
{ inaNewKey :: CurrencySymbol -- ^ currency symbol of the CIP-0143 token
92+
, inaTransferLogic :: C.StakeCredential -- ^ Stake validator for transfers
93+
, inaIssuerLogic :: C.StakeCredential -- ^ Stake validator for minting and burning
94+
, inaGlobalStateCS :: Maybe CurrencySymbol -- ^ Currency symbol of an NFT that identifies a UTxO with global parameters specific to the new token
9595
}
9696

9797
insertDirectoryNode :: forall era env m. (MonadReader env m, Env.HasDirectoryEnv env, C.IsBabbageBasedEra era, MonadBuildTx era m, C.HasScriptLanguageInEra C.PlutusScriptV3 era, MonadBlockchain era m) => UTxODat era ProgrammableLogicGlobalParams -> UTxODat era DirectorySetNode -> InsertNodeArgs -> m ()

0 commit comments

Comments
 (0)