Skip to content

Commit 36b8fdc

Browse files
committed
Merge branch 'master' into t4/metadata-2
2 parents bdb6f74 + 9ca5939 commit 36b8fdc

File tree

31 files changed

+1266
-624
lines changed

31 files changed

+1266
-624
lines changed

.github/format.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/workflows/integrate.yaml

Lines changed: 0 additions & 79 deletions
This file was deleted.

Makefile

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
.PHONY: hoogle pab_servers_all pab_servers_all pab_db clean_db \
66
nix_build_lib nix_build_examples build test accept_pirs watch ghci readme_contents \
7-
format lint requires_nix_shell
7+
format lint requires_nix_shell
88

99
usage:
1010
@echo "usage: make <command> [OPTIONS]"
@@ -25,8 +25,10 @@ usage:
2525
@echo " ghci -- Run cabal v2-repl bot-plutus-interface"
2626
@echo " format -- Apply source code formatting with fourmolu"
2727
@echo " format_check -- Check source code formatting without making changes"
28-
@echo " nixfmt -- Apply nix formatting with nixfmt"
29-
@echo " nixfmt_check -- Check nix files for format errors"
28+
@echo " cabalfmt -- Apply cabal formatting with cabal-fmt"
29+
@echo " cabalfmt_check -- Check cabal files for formatting errors without making changes"
30+
@echo " nixpkgsfmt -- Apply nix formatting with nixfmt"
31+
@echo " nixpkgsfmt_check -- Check nix files for format errors"
3032
@echo " lint -- Check the sources with hlint"
3133
@echo " readme_contents -- Add table of contents to README"
3234
@echo " update_plutus -- Update plutus version with niv"
@@ -68,7 +70,7 @@ ghci: requires_nix_shell
6870
cabal v2-repl $(GHC_FLAGS) bot-plutus-interface
6971

7072
# Source dirs to run fourmolu on
71-
FORMAT_SOURCES := $(shell git ls-tree -r HEAD --full-tree --name-only | grep -E '.*\.hs' )
73+
FORMAT_SOURCES := $(shell fd -e hs)
7274

7375
# Extensions we need to tell fourmolu about
7476
FORMAT_EXTENSIONS := -o -XTemplateHaskell -o -XTypeApplications -o -XImportQualifiedPost -o -XPatternSynonyms -o -fplugin=RecordDotPreprocessor
@@ -81,14 +83,23 @@ format: requires_nix_shell
8183
format_check: requires_nix_shell
8284
fourmolu --mode check --check-idempotence $(FORMAT_EXTENSIONS) $(FORMAT_SOURCES)
8385

86+
# Cabal package definitions
87+
CABAL_SOURCES := $(shell fd -e cabal)
88+
89+
cabalfmt: requires_nix_shell
90+
cabal-fmt --inplace $(CABAL_SOURCES)
91+
92+
cabalfmt_check: requires_nix_shell
93+
cabal-fmt --check $(CABAL_SOURCES)
94+
8495
# Nix files to format
85-
NIX_SOURCES := $(shell git ls-tree -r HEAD --full-tree --name-only | grep -E '.*\.nix' )
96+
NIX_SOURCES := $(shell fd -e nix)
8697

87-
nixfmt: requires_nix_shell
88-
nixfmt $(NIX_SOURCES)
98+
nixpkgsfmt: requires_nix_shell
99+
nixpkgs-fmt $(NIX_SOURCES)
89100

90-
nixfmt_check: requires_nix_shell
91-
nixfmt --check $(NIX_SOURCES)
101+
nixpkgsfmt_check: requires_nix_shell
102+
nixpkgs-fmt --check $(NIX_SOURCES)
92103

93104
# Check with hlint, currently I couldn't get --refactor to work
94105
lint: requires_nix_shell
@@ -124,4 +135,3 @@ update_plutus:
124135
build_path = dist-newstyle/build/x86_64-linux/ghc-8.10.4.20210212/bot-plutus-interface-0.1
125136
clear_build:
126137
@[ ! -e $(build_path) ] || rm -rf $(build_path)
127-

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ main = do
8787
, -- | Slot configuration of the network, the default value can be used for the mainnet
8888
pcSlotConfig = def
8989
, pcOwnPubKeyHash = "0f45aaf1b2959db6e5ff94dbb1f823bf257680c3c723ac2d49f97546"
90+
, pcOwnStakePubKeyHash = Nothing
9091
, -- Directory name of the script and data files
9192
pcScriptFileDir = "./scripts"
9293
, -- Directory for the signing key file(s)
@@ -96,11 +97,11 @@ main = do
9697
, -- Dry run mode will build the tx, but skip the submit step
9798
pcDryRun = False
9899
, pcLogLevel = Debug
99-
, -- | Forced budget for scripts, as optional (CPU Steps, Memory Units)
100-
pcForceBudget = Nothing
101100
, -- Protocol params file location relative to the cardano-cli working directory (needed for the cli)
102101
, pcProtocolParamsFile = "./protocol.json"
103102
, pcEnableTxEndpoint = True
103+
-- Save some stats during contract run (only transactions execution budgets supported atm)
104+
, pcCollectStats = False
104105
}
105106
BotPlutusInterface.runPAB @MyContracts pabConf
106107
```

bot-plutus-interface.cabal

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,20 @@ library
7676
import: common-lang
7777
exposed-modules:
7878
BotPlutusInterface
79+
BotPlutusInterface.Balance
80+
BotPlutusInterface.BodyBuilder
7981
BotPlutusInterface.CardanoCLI
8082
BotPlutusInterface.ChainIndex
8183
BotPlutusInterface.Contract
8284
BotPlutusInterface.Effects
85+
BotPlutusInterface.ExBudget
8386
BotPlutusInterface.Files
84-
BotPlutusInterface.Balance
87+
BotPlutusInterface.Helpers
88+
BotPlutusInterface.QueryNode
89+
BotPlutusInterface.Server
8590
BotPlutusInterface.Types
8691
BotPlutusInterface.UtxoParser
87-
BotPlutusInterface.Server
92+
8893
build-depends:
8994
, aeson ^>=1.5.0.0
9095
, attoparsec >=0.13.2.2
@@ -93,6 +98,7 @@ library
9398
, cardano-crypto
9499
, cardano-ledger-alonzo
95100
, cardano-prelude
101+
, cardano-slotting
96102
, containers
97103
, data-default
98104
, data-default-class
@@ -146,10 +152,11 @@ test-suite bot-plutus-interface-test
146152
main-is: Spec.hs
147153
ghc-options: -fplugin-opt PlutusTx.Plugin:defer-errors
148154
other-modules:
149-
Spec.BotPlutusInterface.Contract
150155
Spec.BotPlutusInterface.Balance
151-
Spec.BotPlutusInterface.UtxoParser
156+
Spec.BotPlutusInterface.Contract
157+
Spec.BotPlutusInterface.ContractStats
152158
Spec.BotPlutusInterface.Server
159+
Spec.BotPlutusInterface.UtxoParser
153160
Spec.MockContract
154161

155162
build-depends:
@@ -199,8 +206,8 @@ test-suite bot-plutus-interface-test
199206
, tasty-quickcheck
200207
, temporary
201208
, text ^>=1.2.4.0
202-
, uuid
203209
, utf8-string
210+
, uuid
204211
, warp
205212

206213
hs-source-dirs: test

cabal.project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
index-state: 2022-01-22T00:00:00Z
22

3-
packages: ./.
3+
packages: ./bot-plutus-interface.cabal
44
./examples/plutus-game/plutus-game.cabal
55
./examples/plutus-transfer/plutus-transfer.cabal
66
./examples/plutus-nft/plutus-nft.cabal

examples/plutus-game/app/Main.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,15 @@ main = do
6161
, pcTipPollingInterval = 10_000_000
6262
, pcSlotConfig = def
6363
, pcOwnPubKeyHash = "0f45aaf1b2959db6e5ff94dbb1f823bf257680c3c723ac2d49f97546"
64+
, pcOwnStakePubKeyHash = Nothing
6465
, pcScriptFileDir = "./scripts"
6566
, pcSigningKeyFileDir = "./signing-keys"
6667
, pcTxFileDir = "./txs"
6768
, pcDryRun = True
6869
, pcLogLevel = Debug
6970
, pcProtocolParamsFile = "./protocol.json"
70-
, pcForceBudget = Just (1000, 1000)
7171
, pcEnableTxEndpoint = True
7272
, pcMetadataDir = "./metadata"
73+
, pcCollectStats = False
7374
}
7475
BotPlutusInterface.runPAB @GameContracts pabConf

examples/plutus-game/guess.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CONTRACT_INST_ID=$(curl --location --request POST 'localhost:9080/api/contract/a
66
"caID": {
77
"tag": "Guess",
88
"contents": {
9-
"guessGameId": 2,
9+
"guessGameId": 3,
1010
"guessSecret": "secret"
1111
}
1212
}

examples/plutus-game/lock.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CONTRACT_INST_ID=$(curl --location --request POST 'localhost:9080/api/contract/a
66
"caID": {
77
"tag": "Lock",
88
"contents": {
9-
"lockGameId": 2,
9+
"lockGameId": 3,
1010
"lockAmount": 1000000,
1111
"lockSecret": "secret"
1212
}

examples/plutus-game/plutus-game.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ library
7676
build-depends:
7777
, aeson ^>=1.5.0.0
7878
, attoparsec >=0.13.2.2
79+
, bot-plutus-interface
7980
, bytestring ^>=0.10.12.0
8081
, cardano-api
8182
, cardano-crypto

0 commit comments

Comments
 (0)