Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion MetaLamp/nft-marketplace/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ cabal.project.local~
.ghc.environment.*
.psc-ide-port
config/plutus-pab.local.yaml
deployment/env/env.local.sh
config/chain-index-config.local.json
deployment/env/env.local.sh

19 changes: 19 additions & 0 deletions MetaLamp/nft-marketplace/config/chain-index-config.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"cicSlotConfig": {
"scSlotLength": 1000,
"scSlotZeroTime": 1596059091000
},
"cicPort": 9083,
"cicSecurityParam": 2160,
"cicSocketPath": "<NODE_PATH>/configuration/sockets/node.socket",
"cicDbPath": "<NODE_PATH>/chain-index.db",
"cicNetworkId": {
"contents": {
"unNetworkMagic": 1097911063
},
"tag": "Testnet"
},
"cicStoreFrom": {
"unBlockNo": 0
}
}
16 changes: 6 additions & 10 deletions MetaLamp/nft-marketplace/deployment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,16 @@ docker exec -ti cardano-node bash

### Start chain-index

Go to another terminal tab and export variables
Copy `./config/chain-index-config.template.json` to the `./config/chain-index-config.local.json`, and change <NODE_PATH> to your node path directory.

```
source env/env.local.sh
```

Go to the `plutus-apps` project and run chain-index:
Go to the `plutus-apps` project from new terminal window and run chain-index:

```
cd plutus-apps

nix build -f default.nix plutus-apps.haskell.packages.plutus-chain-index.components.exes.plutus-chain-index

./result/bin/plutus-chain-index --socket-path ${NODE_PATH}/configuration/sockets/node.socket --db-path ${NODE_PATH}/chain-index.db --network-id 1097911063 start-index
./result/bin/plutus-chain-index --config ../plutus-use-cases/MetaLamp/nft-marketplace/config/chain-index-config.local.json start-index
```

Sometimes the error with `node.socket` permission can occur, you can change file permissions to read, write and execute for all:
Expand All @@ -60,7 +56,7 @@ sudo chmod 777 ${NODE_PATH}/configuration/sockets/node.socket

### Set up the PAB

Copy `./config/plutus-pab.template.yaml` to the `plutus-pab.local.yaml`, and change <NODE_PATH> to your node path directory.
Copy `./config/plutus-pab.template.yaml` to the `./config/plutus-pab.local.yaml`, and change <NODE_PATH> to your node path directory.

### Create a wallet

Expand All @@ -69,10 +65,10 @@ Save a wallet passphrase, it is required for the next step.

### Run Dapp

Go to the `plutus-use-cases/MetaLamp/nft-marketplace`, enter the nix shell and run the `pab-app`:
Go to the `plutus-use-cases/MetaLamp/nft-marketplace`, enter the nix shell and run migrations to create pab database, then run the PAB application itself:

```
cabal exec pab-app -- --config ./config/plutus-pab.local.yaml migrate (creates database)
cabal exec pab-app -- --config ./config/plutus-pab.local.yaml migrate

cabal exec pab-app -- --config ./config/plutus-pab.local.yaml --passphrase "WALLET_PASSPHRASE" webserver
```
Expand Down
2 changes: 1 addition & 1 deletion MetaLamp/nft-marketplace/plutus-starter.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ executable generate-typescript
plutus-contract,
plutus-ledger-api,
plutus-tx

test-suite test
import: lang
type: exitcode-stdio-1.0
Expand Down
10 changes: 10 additions & 0 deletions MetaLamp/nft-marketplace/test/Marketplace/Spec/Auction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@

module Marketplace.Spec.Auction
( tests
, startAnAuctionTrace
, startAnAuctionTrace'
, completeAnAuctionTrace
, completeAnAuctionTrace'
, bidOnAuctionTrace
, bidOnAuctionTrace'
, buyOnAuctionTrace
, cancelAuctionWithBidsTrace
, cancelAuctionWithoutBidsTrace
, cancelAuctionWhenTimeIsOverTrace
) where

import Control.Lens (_2, _Right, (&),
Expand Down
6 changes: 5 additions & 1 deletion MetaLamp/nft-marketplace/test/Marketplace/Spec/Bundles.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
{-# LANGUAGE TypeApplications #-}

module Marketplace.Spec.Bundles
( tests, bundleTrace
( tests
, bundleTrace
, bundleErrorTrace
, unbundleTrace
, unbundleErrorTrace
) where

import Control.Lens ((^.), (^?))
Expand Down
4 changes: 3 additions & 1 deletion MetaLamp/nft-marketplace/test/Marketplace/Spec/CreateNft.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
{-# LANGUAGE TypeApplications #-}

module Marketplace.Spec.CreateNft
( tests, createNftTrace
( tests
, createNftTrace
, createNftTrace'
) where

import Control.Lens (_2, (&), (.~),
Expand Down
6 changes: 6 additions & 0 deletions MetaLamp/nft-marketplace/test/Marketplace/Spec/Sale.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@

module Marketplace.Spec.Sale
( tests
, openSaleTrace
, openSaleTrace'
, closeSaleTrace
, closeSaleTrace'
, buyItemTrace
, buyItemTrace'
) where

import Control.Lens (_2, _Left, (&),
Expand Down
6 changes: 4 additions & 2 deletions MetaLamp/nft-marketplace/test/Marketplace/Spec/Start.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NumericUnderscores #-}
{-# LANGUAGE OverloadedStrings #-}

{-# LANGUAGE TypeApplications #-}
module Marketplace.Spec.Start
( tests, startTrace
) where
Expand Down Expand Up @@ -36,7 +37,8 @@ tests =

startTrace :: Trace.EmulatorTrace ()
startTrace = do
_ <- Trace.activateContractWallet Fixtures.ownerWallet $ void startContract
h <- Trace.activateContractWallet Fixtures.ownerWallet Marketplace.ownerEndpoints
_ <- Trace.callEndpoint @"start" h startMarketplaceParams
_ <- Trace.waitNSlots 50
pure ()

Expand Down