Skip to content

Commit

Permalink
Merge pull request #200 from mlabs-haskell/szg251/tx-info
Browse files Browse the repository at this point in the history
Add ScriptContext opaques for Rust and Haskell
  • Loading branch information
szg251 authored Jun 24, 2024
2 parents de770f9 + 1cd6b41 commit 9ae3705
Show file tree
Hide file tree
Showing 273 changed files with 21,871 additions and 6,121 deletions.
6 changes: 6 additions & 0 deletions extras/dev-shells/build.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
imports = [
./plutus-haskell/build.nix
./prelude-haskell/build.nix
];
}
1 change: 1 addition & 0 deletions extras/dev-shells/plutus-haskell/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake .#dev-plutus-haskell
49 changes: 49 additions & 0 deletions extras/dev-shells/plutus-haskell/build.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{ inputs, ... }:
{
perSystem = { config, system, ... }:
let
hsFlake = inputs.flake-lang.lib.${system}.haskellPlutusFlake {
src = ./.;

name = "dev-plutus-haskell";

inherit (config.settings.haskell) index-state compiler-nix-name;

dependencies = [
# Haskell native backend
"${config.packages.lbr-prelude-haskell-src}"
"${config.packages.lbf-prelude-haskell}"
"${config.packages.lbr-plutus-haskell-src}"
"${config.packages.lbf-plutus-haskell}"

# PlutusTx backend
"${config.packages.lbr-plutustx-src}"
"${config.packages.lbf-plutus-plutustx}"
"${config.packages.lbf-prelude-plutustx}"

# Plutarch backend
"${config.packages.lbr-plutarch-src}"
"${config.packages.lbf-prelude-plutarch}"
"${config.packages.lbf-plutus-plutarch}"

# Plutarch itself
"${inputs.plutarch}"
"${inputs.plutarch}/plutarch-extra"
];

devShellTools = config.settings.shell.tools ++ [
config.packages.lbf-prelude-to-haskell
config.packages.lbf-plutus-to-haskell
config.packages.lbf-plutus-to-plutarch
config.packages.lbf-plutus-to-plutustx
];

devShellHook = config.settings.shell.hook;
};
in
{
# Develop Plutus applications with Haskell, Plutarch and PlutusTx
devShells.dev-plutus-haskell = hsFlake.devShell;
packages.play-plutus-haskell-lib = hsFlake.packages."plutus-haskell:lib:plutus-haskell";
};
}
3 changes: 3 additions & 0 deletions extras/dev-shells/plutus-haskell/cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
packages: ./.

tests: true
109 changes: 109 additions & 0 deletions extras/dev-shells/plutus-haskell/plutus-haskell.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
cabal-version: 3.0
name: plutus-haskell
version: 0.1.0.0
synopsis: Dev shell for LambdaBuffers Plutus Haskell
author: Drazen Popovic
maintainer: [email protected]

flag dev
description: Enable non-strict compilation for development
manual: True

common common-language
ghc-options:
-Wall -Wcompat -fprint-explicit-foralls -fprint-explicit-kinds
-fwarn-missing-import-lists -Weverything -Wno-unsafe
-Wno-missing-safe-haskell-mode -Wno-implicit-prelude
-Wno-missing-kind-signatures -Wno-all-missed-specializations

if !flag(dev)
ghc-options: -Werror

default-extensions:
BangPatterns
BinaryLiterals
ConstrainedClassMethods
ConstraintKinds
DataKinds
DeriveAnyClass
DeriveDataTypeable
DeriveFoldable
DeriveFunctor
DeriveGeneric
DeriveLift
DeriveTraversable
DerivingStrategies
DerivingVia
DoAndIfThenElse
DuplicateRecordFields
EmptyCase
EmptyDataDecls
EmptyDataDeriving
ExistentialQuantification
ExplicitForAll
ExplicitNamespaces
FlexibleContexts
FlexibleInstances
ForeignFunctionInterface
GADTSyntax
GeneralizedNewtypeDeriving
HexFloatLiterals
ImportQualifiedPost
InstanceSigs
KindSignatures
LambdaCase
MonomorphismRestriction
MultiParamTypeClasses
NamedFieldPuns
NamedWildCards
NoStarIsType
NumericUnderscores
OverloadedLabels
OverloadedStrings
PackageImports
PartialTypeSignatures
PatternGuards
PolyKinds
PostfixOperators
RankNTypes
RecordWildCards
RelaxedPolyRec
ScopedTypeVariables
StandaloneDeriving
StandaloneKindSignatures
TemplateHaskell
TraditionalRecordSyntax
TupleSections
TypeApplications
TypeFamilies
TypeOperators
TypeSynonymInstances
ViewPatterns

default-language: Haskell2010

library
import: common-language
build-depends:
, aeson >=2.2
, base >=4.16
, bytestring >=0.11
, containers >=0.6
, lbf-plutus >=0.1
, lbf-plutus-plutarch >=0.1
, lbf-plutus-plutustx >=0.1
, lbf-prelude >=0.1
, lbf-prelude-plutarch >=0.1
, lbf-prelude-plutustx >=0.1
, lbr-plutarch >=0.1
, lbr-plutus >=0.1
, lbr-plutustx >=0.1
, lbr-prelude >=0.1
, plutarch >=1.5
, plutarch-extra >=1.2
, plutus-ledger-api >=1.20
, plutus-tx >=1.1
, text >=2.0

hs-source-dirs: src
exposed-modules: LambdaBuffers.Plutus.Play
26 changes: 26 additions & 0 deletions extras/dev-shells/plutus-haskell/src/LambdaBuffers/Plutus/Play.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module LambdaBuffers.Plutus.Play () where

import "aeson" Data.Aeson ()
import "bytestring" Data.ByteString ()
import "containers" Data.Map ()
import "containers" Data.Set ()
import "lbf-prelude" LambdaBuffers.Prelude ()
import "lbr-prelude" LambdaBuffers.Runtime.Prelude ()
import "text" Data.Text ()

import "lbf-plutus" LambdaBuffers.Plutus.V1 ()
import "lbr-plutus" LambdaBuffers.Runtime.Plutus ()

import "lbf-plutus-plutustx" LambdaBuffers.Plutus.V1.PlutusTx ()
import "lbf-plutus-plutustx" LambdaBuffers.Plutus.V2.PlutusTx ()
import "lbf-prelude-plutustx" LambdaBuffers.Prelude.PlutusTx ()
import "lbr-plutustx" LambdaBuffers.Runtime.PlutusTx.List ()
import "plutus-ledger-api" PlutusLedgerApi.Common ()
import "plutus-tx" PlutusTx ()

import "lbf-plutus-plutarch" LambdaBuffers.Plutus.V1.Plutarch ()
import "lbf-plutus-plutarch" LambdaBuffers.Plutus.V2.Plutarch ()
import "lbf-prelude-plutarch" LambdaBuffers.Prelude.Plutarch ()
import "lbr-plutarch" LambdaBuffers.Runtime.Plutarch ()
import "plutarch" Plutarch ()
import "plutarch-extra" Plutarch.Extra ()
1 change: 1 addition & 0 deletions extras/dev-shells/prelude-haskell/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake .#dev-prelude-haskell
27 changes: 27 additions & 0 deletions extras/dev-shells/prelude-haskell/build.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{ inputs, ... }:
{
perSystem = { config, system, ... }:
let
hsFlake = inputs.flake-lang.lib.${system}.haskellFlake {
src = ./.;

name = "dev-prelude-haskell";

inherit (config.settings.haskell) index-state compiler-nix-name;

dependencies = [
"${config.packages.lbr-prelude-haskell-src}"
"${config.packages.lbf-prelude-haskell}"
];

devShellTools = config.settings.shell.tools ++ [ config.packages.lbf-prelude-to-haskell ];
devShellHook = config.settings.shell.hook;
};
in
{
# Develop Prelude applications with Haskell
devShells.dev-prelude-haskell = hsFlake.devShell;
packages.play-prelude-haskell-lib = hsFlake.packages."prelude-haskell:lib:prelude-haskell";
};
}

3 changes: 3 additions & 0 deletions extras/dev-shells/prelude-haskell/cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
packages: ./.

tests: true
97 changes: 97 additions & 0 deletions extras/dev-shells/prelude-haskell/prelude-haskell.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
cabal-version: 3.0
name: prelude-haskell
version: 0.1.0.0
synopsis: Dev shell for LambdaBuffers Prelude Haskell
author: Drazen Popovic
maintainer: [email protected]

flag dev
description: Enable non-strict compilation for development
manual: True

common common-language
ghc-options:
-Wall -Wcompat -fprint-explicit-foralls -fprint-explicit-kinds
-fwarn-missing-import-lists -Weverything -Wno-unsafe
-Wno-missing-safe-haskell-mode -Wno-implicit-prelude
-Wno-missing-kind-signatures -Wno-all-missed-specializations

if !flag(dev)
ghc-options: -Werror

default-extensions:
BangPatterns
BinaryLiterals
ConstrainedClassMethods
ConstraintKinds
DataKinds
DeriveAnyClass
DeriveDataTypeable
DeriveFoldable
DeriveFunctor
DeriveGeneric
DeriveLift
DeriveTraversable
DerivingStrategies
DerivingVia
DoAndIfThenElse
DuplicateRecordFields
EmptyCase
EmptyDataDecls
EmptyDataDeriving
ExistentialQuantification
ExplicitForAll
ExplicitNamespaces
FlexibleContexts
FlexibleInstances
ForeignFunctionInterface
GADTSyntax
GeneralizedNewtypeDeriving
HexFloatLiterals
ImportQualifiedPost
InstanceSigs
KindSignatures
LambdaCase
MonomorphismRestriction
MultiParamTypeClasses
NamedFieldPuns
NamedWildCards
NoStarIsType
NumericUnderscores
OverloadedLabels
OverloadedStrings
PackageImports
PartialTypeSignatures
PatternGuards
PolyKinds
PostfixOperators
RankNTypes
RecordWildCards
RelaxedPolyRec
ScopedTypeVariables
StandaloneDeriving
StandaloneKindSignatures
TemplateHaskell
TraditionalRecordSyntax
TupleSections
TypeApplications
TypeFamilies
TypeOperators
TypeSynonymInstances
ViewPatterns

default-language: Haskell2010

library
import: common-language
build-depends:
, aeson >=2.2
, base >=4.16
, bytestring >=0.11
, containers >=0.6
, lbf-prelude >=0.1
, lbr-prelude >=0.1
, text >=2.0

hs-source-dirs: src
exposed-modules: LambdaBuffers.Prelude.Play
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module LambdaBuffers.Prelude.Play () where

import "aeson" Data.Aeson ()
import "bytestring" Data.ByteString ()
import "containers" Data.Map ()
import "containers" Data.Set ()
import "lbf-prelude" LambdaBuffers.Prelude ()
import "lbr-prelude" LambdaBuffers.Runtime.Prelude ()
import "text" Data.Text ()
9 changes: 6 additions & 3 deletions extras/lbf-nix/build.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
lbg-haskell = "${config.packages.lbg-haskell}/bin/lbg-haskell";
lbg-typescript = "${config.packages.lbg-typescript}/bin/lbg-typescript";
lbg-plutarch = "${config.packages.lbg-plutarch}/bin/lbg-plutarch";
lbg-plutustx = "${config.packages.lbg-plutustx}/bin/lbg-plutustx";
lbg-purescript = "${config.packages.lbg-purescript}/bin/lbg-purescript";
lbg-rust = "${config.packages.lbg-rust}/bin/lbg-rust";

Expand All @@ -14,9 +15,11 @@
lbfBuild = import ./lbf-build.nix pkgs config.packages.lbf;
lbfHaskell = import ./lbf-haskell.nix pkgs config.packages.lbf lbg-haskell;
lbfPreludeHaskell = import ./lbf-prelude-hs.nix pkgs config.packages.lbf lbg-haskell;
lbfPlutusHaskell = import ./lbf-plutus-hs-plutustx.nix pkgs config.packages.lbf lbg-haskell;
lbfPlutarch' = import ./lbf-plutarch.nix pkgs config.packages.lbf lbg-plutarch;
lbfPlutarch = import ./lbf-plutus-plutarch.nix pkgs config.packages.lbf lbg-plutarch;
lbfPlutusHaskell = import ./lbf-plutus-hs.nix pkgs config.packages.lbf lbg-haskell;
lbfPlutarchBase = import ./lbf-plutarch-base.nix pkgs config.packages.lbf lbg-plutarch;
lbfPlutarch = import ./lbf-plutarch.nix pkgs config.packages.lbf lbg-plutarch;
lbfPlutusTxBase = import ./lbf-plutustx-base.nix pkgs config.packages.lbf lbg-plutustx;
lbfPlutusTx = import ./lbf-plutustx.nix pkgs config.packages.lbf lbg-plutustx;
lbfPurescript = import ./lbf-purescript.nix pkgs config.packages.lbf lbg-purescript;
lbfPreludePurescript = import ./lbf-prelude-purescript.nix pkgs config.packages.lbf lbg-purescript;
lbfPlutusPurescript = import ./lbf-plutus-purescript.nix pkgs config.packages.lbf lbg-purescript;
Expand Down
3 changes: 3 additions & 0 deletions extras/lbf-nix/lbf-plutarch-base.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Build .lbf schemas and generate Haskell's Plutarch library.
pkgs: lbf: lbg-plutarch: lbfPlutarchOpts:
import ./lbf-haskell.nix pkgs lbf lbg-plutarch lbfPlutarchOpts
29 changes: 27 additions & 2 deletions extras/lbf-nix/lbf-plutarch.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# Build .lbf schemas and generate Haskell's Plutarch library.
# Build .lbf schemas that use LB Plutus (and by extension LB Prelude) package and targets Haskell's Plutarch library.
pkgs: lbf: lbg-plutarch: lbfPlutarchOpts:
import ./lbf-haskell.nix pkgs lbf lbg-plutarch lbfPlutarchOpts
let
utils = import ./utils.nix pkgs;

lbfPlutarch = import ./lbf-plutarch-base.nix pkgs lbf lbg-plutarch;
lbfPlutarchOptsForPlutus = utils.overrideAttrs
{
imports = {
default = [ ];
override = libs: libs ++ [ ../../libs/lbf-prelude ../../libs/lbf-plutus ];
};
dependencies = {
default = [ ];
override = deps: deps ++ [ "lbf-prelude-plutarch" "lbf-plutus-plutarch" ];
};
classes = {
default = [ ];
override = cls: cls ++ [ "Prelude.Eq" "Plutus.V1.PlutusData" ];
};
configs = {
default = [ ];
override = _: [ ../../lambda-buffers-codegen/data/plutarch-prelude.json ../../lambda-buffers-codegen/data/plutarch-plutus.json ];
};
}
lbfPlutarchOpts;
in
lbfPlutarch lbfPlutarchOptsForPlutus
File renamed without changes.
Loading

0 comments on commit 9ae3705

Please sign in to comment.