Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jaredponn/plutip
https://github.com/jaredponn/plutip
Last synced: 15 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/jaredponn/plutip
- Owner: jaredponn
- License: apache-2.0
- Created: 2022-12-19T18:50:59.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-19T18:51:06.000Z (about 2 years ago)
- Last Synced: 2024-04-24T07:48:18.669Z (10 months ago)
- Language: Haskell
- Size: 734 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Plutip
A Cardano tool to spin up private network and run Plutus contracts on it
## Requirements
If your project is importing and making use of `Plutip`s library you will need to make sure that the following executables are present in your `PATH`:
- `cardano-cli` executable available in the environment
- `cardano-node` executable available in the environmentAnd the following ghc flag must to be set for the test execution: `-Wall -threaded -rtsopts`
## Usage
Plutip provides a tasty interface for executing Plutus contracts on a local cluster.
depend on each other.```haskell
tests :: TestTree
tests =
withCluster
"Integration tests"
[ assertExecution "Get utxos" (initAndAssertAda 100 100)
(withContract $ const GetUtxos.getUtxos)
[shouldSucceed]
, assertExecution "Throws Contract error" (initAda 100)
(withContract $ const GetUtxos.getUtxosThrowsErr)
[shouldFail]
, assertExecution "Throws Exception" (initAda 100)
(withContract $ const GetUtxos.getUtxosThrowsEx)
[shouldFail]
, assertExecution
"Pay wallet-to-wallet"
(initAda 300 <> initAndAssertAda 100 110)
(withContract $ \[w1] ->
PayToWallet.payTo (ledgerPaymentPkh w1) 10_000_000)
[shouldSuceed]
, assertExecution
"Lock at script then spend - budget overspend"
(initAda 100)
(withContract $
const LockUnlock.lockThenSpend)
[shouldFail]
, assertExecutionWith
[ShowTrace, ShowBudgets]
"Lock at script then spend - validation fail"
(initAda 100)
(withContract $
const LockUnlockValidationFail.lockThenSpend)
[shouldFail]
]
```For more, see `Test.Plutip.LocalCluster` `Test.Plutip.Contract`.
More examples could be found [here](test/Spec/Integration.hs).
## Known limitations
At the moment underlying mechanisms that execute contract do not support `awaitTxConfirmed`. As one possible solution, `waitNSlots n` can be used instead. We are working on it.