Skip to content

Commit e7ed7b8

Browse files
authored
Merge pull request #1 from mlabs-haskell/ak/init-endpoint
Ak/init endpoint
2 parents 69f58cc + 829df49 commit e7ed7b8

File tree

15 files changed

+550
-0
lines changed

15 files changed

+550
-0
lines changed

mlabs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist-newstyle/

mlabs/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Revision history for mlabs
2+
3+
## 0.1.0.0 -- YYYY-mm-dd
4+
5+
* First version. Released on an unsuspecting world.

mlabs/Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
hoogle: requires_nix_shell
3+
hoogle server --local --port 8008
4+
5+
build: requires_nix_shell
6+
cabal build all
7+
8+
repl: requires_nix_shell
9+
cabal new-repl
10+
11+
test: requires_nix_shell
12+
cabal test all
13+
14+
watch: requires_nix_shell
15+
ghcid "-c cabal new-repl"
16+
17+
# Target to use as dependency to fail if not inside nix-shell
18+
requires_nix_shell:
19+
@ [ -v IN_NIX_SHELL ] || echo "The $(MAKECMDGOALS) target must be run from inside nix-shell"
20+
@ [ -v IN_NIX_SHELL ] || (echo " run 'nix-shell --pure' first" && false)
21+

mlabs/Setup.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import Distribution.Simple
2+
main = defaultMain

mlabs/app/Main.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module Main where
2+
3+
main :: IO ()
4+
main = putStrLn "Hello, Haskell!"

mlabs/mlabs-plutus-use-cases.cabal

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
cabal-version: >=1.10
2+
-- Initial package description 'mlabs-plutus-use-cases.cabal' generated by 'cabal init'.
3+
-- For further documentation, see http://haskell.org/cabal/users-guide/
4+
5+
name: mlabs-plutus-use-caases
6+
version: 0.1.0.0
7+
-- synopsis:
8+
-- description:
9+
-- bug-reports:
10+
-- license:
11+
license-file: LICENSE
12+
author: mlabs
13+
maintainer: [email protected]
14+
-- copyright:
15+
-- category:
16+
build-type: Simple
17+
extra-source-files: CHANGELOG.md
18+
Hs-Source-Dirs: src/
19+
20+
21+
library
22+
Ghc-Options: -Wall
23+
build-depends: base >=4.14 && <4.15
24+
, aeson
25+
, bytestring
26+
, containers
27+
, playground-common
28+
, plutus-core
29+
, plutus-contract
30+
, plutus-ledger
31+
, plutus-tx
32+
, plutus-tx-plugin
33+
, plutus-pab
34+
, prettyprinter
35+
, lens
36+
, text
37+
, freer-extras
38+
default-language: Haskell2010
39+
hs-source-dirs: src/
40+
exposed-modules:
41+
Mlabs.Lending
42+
default-extensions: ExplicitForAll
43+
FlexibleContexts
44+
ScopedTypeVariables
45+
DeriveAnyClass
46+
DeriveGeneric StandaloneDeriving DeriveLift
47+
GeneralizedNewtypeDeriving DeriveFunctor DeriveFoldable DeriveTraversable
48+
MonoLocalBinds
49+
MultiParamTypeClasses
50+
RecordWildCards
51+
OverloadedStrings
52+
TypeFamilies
53+
QuasiQuotes
54+
TemplateHaskell
55+
DataKinds
56+
TypeOperators
57+
58+
executable mlabs-plutus-use-caases
59+
main-is: Main.hs
60+
hs-source-dirs: app/
61+
-- other-modules:
62+
-- other-extensions:
63+
build-depends: base >=4.14 && <4.15
64+
, aeson
65+
, bytestring
66+
, containers
67+
, playground-common
68+
, plutus-core
69+
, plutus-contract
70+
, plutus-ledger
71+
, plutus-tx
72+
, plutus-tx-plugin
73+
, plutus-pab
74+
, prettyprinter
75+
, lens
76+
, text
77+
, freer-extras
78+
-- hs-source-dirs:
79+
default-language: Haskell2010
80+
81+
Test-suite mlabs-plutus-use-cases-tests
82+
Type: exitcode-stdio-1.0
83+
Ghc-options: -Wall -threaded -rtsopts
84+
Default-Language: Haskell2010
85+
Build-Depends: base >=4.9 && <5
86+
, mlabs-plutus-use-cases
87+
, text
88+
, tasty
89+
, tasty-hunit
90+
hs-source-dirs: test
91+
Main-is: Main.hs
92+
Other-modules: Test.Lending
93+
default-extensions:
94+
RecordWildCards
95+
OverloadedStrings
96+
QuasiQuotes
97+

mlabs/nix/default.nix

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{ sourcesFile ? ./sources.json, system ? builtins.currentSystem }: rec {
2+
sources = import ./sources.nix { inherit sourcesFile system; };
3+
plutus = import sources.plutus {
4+
# See: https://github.com/input-output-hk/plutus/blob/893a887eac83409131b2038820a14962c6796776/ci.nix#L5
5+
rev = "fake";
6+
};
7+
pkgs = plutus.pkgs;
8+
pab = import ./pab.nix { inherit plutus; };
9+
}

mlabs/nix/pab.nix

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{ plutus, pkgs ? plutus.pkgs }: rec {
2+
# PAB setup
3+
plutus_pab_exes = plutus.plutus-pab.pab-exes;
4+
plutus_pab_client = plutus.plutus-pab.client;
5+
6+
plutus_pab_db_path = "/tmp";
7+
plutus_pab_confs = import ./pab_conf.nix {
8+
db-path = plutus_pab_db_path;
9+
client = plutus_pab_client;
10+
};
11+
12+
# Annoyingly, the mkConf from Pab has a fixed name...
13+
# The plutus build by default misses this
14+
plutus_pab_conf_dir = with plutus_pab_confs;
15+
pkgs.linkFarm "plutus_pab_envs" [
16+
17+
{
18+
inherit (pab_env1) name;
19+
path = plutus.plutus-pab.mkConf pab_env1;
20+
}
21+
22+
{
23+
inherit (pab_env2) name;
24+
path = plutus.plutus-pab.mkConf pab_env2;
25+
}
26+
27+
];
28+
29+
plutus_ledger_with_docs =
30+
plutus.plutus.haskell.packages.plutus-ledger.components.library.override {
31+
doHaddock = true;
32+
configureFlags = [ "-f defer-plugin-errors" ];
33+
};
34+
35+
env_variables = {
36+
PAB_CONFIG_PATH = plutus_pab_conf_dir;
37+
PAB_CLIENT_PATH = plutus_pab_client;
38+
PAB_DB1_PATH = plutus_pab_confs.pab_env1.db-file;
39+
PAB_DB2_PATH = plutus_pab_confs.pab_env2.db-file;
40+
};
41+
42+
}

mlabs/nix/pab_conf.nix

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# This set is fed in as arguments to a derivation which
2+
# generates a config file.
3+
{ nodeserver-port ? "9082", client, db-path ? "./.tmp" }: {
4+
pab_env1 = {
5+
inherit client nodeserver-port;
6+
name = "pab_env1.yaml";
7+
8+
# DB
9+
db-file = "${db-path}/pab_env1.db";
10+
11+
# Ports
12+
webserver-port = "9080";
13+
walletserver-port = "9081";
14+
chain-index-port = "9083";
15+
signing-process-port = "9084";
16+
metadata-server-port = "9085";
17+
18+
# Wallet 1
19+
wallet = "1";
20+
};
21+
22+
pab_env2 = {
23+
inherit client nodeserver-port;
24+
name = "pab_env2.yaml";
25+
26+
# DB
27+
db-file = "${db-path}/pab_env2.db";
28+
29+
webserver-port = "9090";
30+
walletserver-port = "9091";
31+
chain-index-port = "9093";
32+
signing-process-port = "9094";
33+
metadata-server-port = "9095";
34+
35+
wallet = "2";
36+
};
37+
38+
}

mlabs/nix/sources.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"niv": {
3+
"branch": "master",
4+
"description": "Easy dependency management for Nix projects",
5+
"homepage": "https://github.com/nmattia/niv",
6+
"owner": "nmattia",
7+
"repo": "niv",
8+
"rev": "af958e8057f345ee1aca714c1247ef3ba1c15f5e",
9+
"sha256": "1qjavxabbrsh73yck5dcq8jggvh3r2jkbr6b5nlz5d9yrqm9255n",
10+
"type": "tarball",
11+
"url": "https://github.com/nmattia/niv/archive/af958e8057f345ee1aca714c1247ef3ba1c15f5e.tar.gz",
12+
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
13+
},
14+
"nixpkgs": {
15+
"branch": "release-20.03",
16+
"description": "Nix Packages collection",
17+
"homepage": "",
18+
"owner": "NixOS",
19+
"repo": "nixpkgs",
20+
"rev": "6d1a044fc9ff3cc96fca5fa3ba9c158522bbf2a5",
21+
"sha256": "07a3nyrj3pwl017ig0rbn5rbmbf14gl3vqggvkyrdby01726p5fg",
22+
"type": "tarball",
23+
"url": "https://github.com/NixOS/nixpkgs/archive/6d1a044fc9ff3cc96fca5fa3ba9c158522bbf2a5.tar.gz",
24+
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
25+
},
26+
"plutus": {
27+
"branch": "master",
28+
"description": "The Plutus language implementation and tools",
29+
"homepage": "",
30+
"owner": "input-output-hk",
31+
"repo": "plutus",
32+
"rev": "62be7a2d6dff285ad72d5bc6f5f11991ffae888b",
33+
"sha256": "05l6iw0gp8l8b940552c5dcsc70amynmkcjpa63j9gr61izqaf58",
34+
"type": "tarball",
35+
"url": "https://github.com/input-output-hk/plutus/archive/62be7a2d6dff285ad72d5bc6f5f11991ffae888b.tar.gz",
36+
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
37+
}
38+
}

0 commit comments

Comments
 (0)