From b363b326f3ff0dbcc082bc9f09e5c21074745cfc Mon Sep 17 00:00:00 2001 From: fanghr Date: Fri, 13 May 2022 20:13:18 +0800 Subject: [PATCH] add `make ps_bridge` subcommand --- Makefile | 7 ++++++- agora-purescript-bridge/Options.hs | 2 +- agora/Agora/AuthorityToken.hs | 5 +++-- agora/Agora/Stake.hs | 3 ++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 3077e0b..dbc3fd6 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # This really ought to be `/usr/bin/env bash`, but nix flakes don't like that. SHELL := /bin/sh -.PHONY: hoogle format haddock usage tag lint +.PHONY: hoogle format haddock usage tag lint ps_bridge usage: @echo "usage: make [OPTIONS]" @@ -12,6 +12,7 @@ usage: @echo " haddock -- Generate Haddock docs for project" @echo " tag -- Generate CTAGS and ETAGS files for project" @echo " lint -- Get hlint suggestions for project" + @echo " ps_bridge -- Generate purescript bridge files" hoogle: pkill hoogle || true @@ -43,3 +44,7 @@ tag: lint: hlint agora agora-bench agora-test + +PS_BRIDGE_OUTPUT_DIR := agora-purescript-bridge/ +ps_bridge: + cabal run exe:agora-purescript-bridge -- -o $(PS_BRIDGE_OUTPUT_DIR) \ No newline at end of file diff --git a/agora-purescript-bridge/Options.hs b/agora-purescript-bridge/Options.hs index cd1d1cc..f4d2d27 100644 --- a/agora-purescript-bridge/Options.hs +++ b/agora-purescript-bridge/Options.hs @@ -46,6 +46,6 @@ parseOptions = Opt.execParser p srcFilePath :: FilePath -> FilePath srcFilePath path = fromRelDir $ fromJust $ do - dir <- parseRelDir $ path + dir <- parseRelDir path srcSubDir <- parseRelDir "src" return $ dir srcSubDir diff --git a/agora/Agora/AuthorityToken.hs b/agora/Agora/AuthorityToken.hs index cac8869..ae6a7ce 100644 --- a/agora/Agora/AuthorityToken.hs +++ b/agora/Agora/AuthorityToken.hs @@ -24,10 +24,10 @@ import Plutarch.Api.V1 ( PTxOut (..), ) import Plutarch.Api.V1.AssocMap (PMap (PMap)) +import Plutarch.Api.V1.Extra (passetClass, passetClassValueOf) import Plutarch.Api.V1.Value (PValue (PValue)) import Plutarch.Builtin (pforgetData) import Plutus.V1.Ledger.Value (AssetClass (AssetClass)) -import Plutarch.Api.V1.Extra (passetClass, passetClassValueOf) -------------------------------------------------------------------------------- @@ -55,7 +55,8 @@ import Agora.Utils ( newtype AuthorityToken = AuthorityToken { authority :: AssetClass -- ^ Token that must move in order for minting this to be valid. - } deriving stock (GHC.Generic) + } + deriving stock (GHC.Generic) -------------------------------------------------------------------------------- diff --git a/agora/Agora/Stake.hs b/agora/Agora/Stake.hs index 351eab6..a33f632 100644 --- a/agora/Agora/Stake.hs +++ b/agora/Agora/Stake.hs @@ -81,7 +81,8 @@ data Stake = Stake { gtClassRef :: Tagged GTTag AssetClass -- ^ Used when inlining the AssetClass of a 'PDiscrete' in the script code. , proposalSTClass :: AssetClass - } deriving stock (GHC.Generic) + } + deriving stock (GHC.Generic) {- | A lock placed on a Stake datum in order to prevent depositing and withdrawing when votes are in place.