Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
colll78 committed Dec 18, 2024
2 parents b64743c + 67090f1 commit 37e9c43
Show file tree
Hide file tree
Showing 25 changed files with 118 additions and 972 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ haddocks/
.envrc
get-protocol-parameters.sh
protocol-parameters-mainnet.json
.pre-commit-config.yaml
1 change: 0 additions & 1 deletion .pre-commit-config.yaml

This file was deleted.

7 changes: 7 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,10 @@ source-repository-package
.
plutarch-ledger-api
plutarch-extra

source-repository-package
type: git
location: https://github.com/input-output-hk/catalyst-onchain-libs
tag: 25996ca26f1b33ffef611bc81423aae5841e297f
subdir:
src/plutarch-onchain-lib
2 changes: 1 addition & 1 deletion compiled/alwaysFail.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"cborHex": "5840583e010000225335738921314c5b6c69622f536d617274546f6b656e732f436f6e7472616374732f50726f746f636f6c506172616d732e68733a36365d001601",
"cborHex": "5840583e010000225335738921314c5b6c69622f536d617274546f6b656e732f436f6e7472616374732f50726f746f636f6c506172616d732e68733a36395d001601",
"description": "Always Fail",
"type": "PlutusScriptV3"
}
2 changes: 1 addition & 1 deletion compiled/permissionedMinting.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"cborHex": "5902b15902ae010000225335738921314c5b6c69622f536d617274546f6b656e732f436f6e7472616374732f50726f746f636f6c506172616d732e68733a35375d001533357346a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3231365d0013232300223300200200123002233002002001225335738921194c5b2e2f506c7574617263682f4c6973742e68733a3139375d00153335573e002294054ccd5cd19baf3574200200829444c008d5d100099299ab9c49012c4c5b2e2f506c7574617263682f44617461526570722f496e7465726e616c2f4669656c642e68733a3237385d00137586ae84c94cd5ce2481194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d001357446ae88004c94cd5ce2481264c5b2e2f506c7574617263682f44617461526570722f496e7465726e616c2e68733a3431325d00135573c6ea80040054cd5ce2492c4c5b2e2f506c7574617263682f44617461526570722f496e7465726e616c2f4669656c642e68733a3237385d0013574264a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234345d001001325335738921264c5b2e2f506c7574617263682f44617461526570722f496e7465726e616c2e68733a3431325d00135573c6ea80040045261601",
"cborHex": "5902b15902ae010000225335738921314c5b6c69622f536d617274546f6b656e732f436f6e7472616374732f50726f746f636f6c506172616d732e68733a36305d001533357346a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3231365d0013232300223300200200123002233002002001225335738921194c5b2e2f506c7574617263682f4c6973742e68733a3139375d00153335573e002294054ccd5cd19baf3574200200829444c008d5d100099299ab9c49012c4c5b2e2f506c7574617263682f44617461526570722f496e7465726e616c2f4669656c642e68733a3237385d00137586ae84c94cd5ce2481194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d001357446ae88004c94cd5ce2481264c5b2e2f506c7574617263682f44617461526570722f496e7465726e616c2e68733a3431325d00135573c6ea80040054cd5ce2492c4c5b2e2f506c7574617263682f44617461526570722f496e7465726e616c2f4669656c642e68733a3237385d0013574264a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234345d001001325335738921264c5b2e2f506c7574617263682f44617461526570722f496e7465726e616c2e68733a3431325d00135573c6ea80040045261601",
"description": "Permissioned Minting",
"type": "PlutusScriptV3"
}
2 changes: 1 addition & 1 deletion compiled/permissionedTransfer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"cborHex": "5902b75902b4010000225335738921374c5b6c69622f536d617274546f6b656e732f436f6e7472616374732f4578616d706c655472616e736665724c6f6769632e68733a39325d001533357346a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3231365d0013232300223300200200123002233002002001225335738921194c5b2e2f506c7574617263682f4c6973742e68733a3139375d00153335573e002294054ccd5cd19baf3574200200829444c008d5d100099299ab9c49012c4c5b2e2f506c7574617263682f44617461526570722f496e7465726e616c2f4669656c642e68733a3237385d00137586ae84c94cd5ce2481194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d001357446ae88004c94cd5ce2481264c5b2e2f506c7574617263682f44617461526570722f496e7465726e616c2e68733a3431325d00135573c6ea80040054cd5ce2492c4c5b2e2f506c7574617263682f44617461526570722f496e7465726e616c2f4669656c642e68733a3237385d0013574264a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234345d001001325335738921264c5b2e2f506c7574617263682f44617461526570722f496e7465726e616c2e68733a3431325d00135573c6ea80040045261601",
"cborHex": "5902b75902b4010000225335738921374c5b6c69622f536d617274546f6b656e732f436f6e7472616374732f4578616d706c655472616e736665724c6f6769632e68733a39355d001533357346a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3231365d0013232300223300200200123002233002002001225335738921194c5b2e2f506c7574617263682f4c6973742e68733a3139375d00153335573e002294054ccd5cd19baf3574200200829444c008d5d100099299ab9c49012c4c5b2e2f506c7574617263682f44617461526570722f496e7465726e616c2f4669656c642e68733a3237385d00137586ae84c94cd5ce2481194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d00135744a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234365d001357446ae88004c94cd5ce2481264c5b2e2f506c7574617263682f44617461526570722f496e7465726e616c2e68733a3431325d00135573c6ea80040054cd5ce2492c4c5b2e2f506c7574617263682f44617461526570722f496e7465726e616c2f4669656c642e68733a3237385d0013574264a66ae71241194c5b2e2f506c7574617263682f4c6973742e68733a3234345d001001325335738921264c5b2e2f506c7574617263682f44617461526570722f496e7465726e616c2e68733a3431325d00135573c6ea80040045261601",
"description": "Permissioned Transfer",
"type": "PlutusScriptV3"
}
12 changes: 11 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,17 @@
inherit inputs;
repoRoot = ./.;
outputs = import ./nix/outputs.nix;
systems = [ "x86_64-linux" "x86_64-darwin" ];
systems = [ "x86_64-linux" ]; # "x86_64-darwin" ];
};

nixConfig = {
extra-substituters = [
"https://cache.iog.io"
];
extra-trusted-public-keys = [
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
];
allow-import-from-derivation = true;
};

}
1 change: 1 addition & 0 deletions nix/project.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
let
sha256map = {
"https://github.com/colll78/plutarch-plutus"."b2379767c7f1c70acf28206bf922f128adc02f28" = "sha256-mhuW2CHxnc6FDWuMcjW/51PKuPOdYc4yxz+W5RmlQew=";
"https://github.com/input-output-hk/catalyst-onchain-libs"."25996ca26f1b33ffef611bc81423aae5841e297f" = "sha256-NUh+l97+eO27Ppd8Bx0yMl0E5EV+p7+7GuFun1B8gRc=";
};

modules = [{ }];
Expand Down
17 changes: 1 addition & 16 deletions src/app/Main.hs → src/exe/export-smart-tokens/Main.hs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{-# OPTIONS_GHC -Wno-unused-imports #-}
{-# OPTIONS_GHC -Wno-unused-top-binds #-}
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
{-# HLINT ignore "Eta reduce" #-}

{-# LANGUAGE OverloadedStrings #-}
module Main (main) where

import Cardano.Binary qualified as CBOR
Expand All @@ -13,7 +9,6 @@ import Data.Bifunctor (
)
import Data.ByteString.Base16 qualified as Base16
import Data.ByteString.Lazy qualified as LBS
import Data.Default (def)
import Data.Text (
Text,
pack,
Expand All @@ -24,7 +19,6 @@ import Plutarch (
TracingMode (..),
LogLevel (..),
compile,
printScript,
)
import Plutarch.Evaluate (
evalScript,
Expand All @@ -36,7 +30,6 @@ import PlutusLedgerApi.V2 (
Data,
ExBudget,
)
import System.IO
import SmartTokens.Contracts.ProgrammableLogicBase (mkProgrammableLogicBase, mkProgrammableLogicGlobal)
import SmartTokens.Contracts.Issuance (mkProgrammableLogicMinting)
import SmartTokens.Contracts.ProtocolParams (mkProtocolParametersMinting, alwaysFailScript, mkPermissionedMinting)
Expand Down Expand Up @@ -72,14 +65,6 @@ writePlutusScriptTraceBind :: String -> FilePath -> ClosedTerm a -> IO ()
writePlutusScriptTraceBind title filepath term =
writePlutusScript (Tracing LogInfo DoTracingAndBinds) title filepath term

writePlutusScriptTrace :: String -> FilePath -> ClosedTerm a -> IO ()
writePlutusScriptTrace title filepath term =
writePlutusScript (Tracing LogInfo DoTracing) title filepath term

writePlutusScriptNoTrace :: String -> FilePath -> ClosedTerm a -> IO ()
writePlutusScriptNoTrace title filepath term =
writePlutusScript NoTracing title filepath term

main :: IO ()
main = do
putStrLn "Writing Plutus Scripts to files"
Expand Down
File renamed without changes.
148 changes: 0 additions & 148 deletions src/lib/Plutarch/Extra/Record.hs

This file was deleted.

5 changes: 4 additions & 1 deletion src/lib/SmartTokens/Contracts/ExampleTransferLogic.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedRecordDot #-}
{-# LANGUAGE QualifiedDo #-}
module SmartTokens.Contracts.ExampleTransferLogic (
mkPermissionedTransfer,
mkFreezeAndSeizeTransfer,
Expand Down Expand Up @@ -48,7 +51,7 @@ import Plutarch.Prelude
PListLike(pcons, ptail, pelimList, phead),
PUnit, (#||) )
import Plutarch.Builtin ( pasByteStr, pasConstr, pforgetData )
import SmartTokens.Core.Utils
import Plutarch.Core.Utils
( pisRewarding,
phasDataCS,
pelemAtFast,
Expand Down
13 changes: 8 additions & 5 deletions src/lib/SmartTokens/Contracts/Issuance.hs
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{-# LANGUAGE QualifiedDo #-}
{-# LANGUAGE OverloadedRecordDot #-}
{-# LANGUAGE OverloadedStrings #-}
module SmartTokens.Contracts.Issuance (
mkProgrammableLogicMinting,
) where

import Plutarch.LedgerApi.V3
import Plutarch.LedgerApi.V3 (PCredential, PScriptContext, PScriptInfo(PMintingScript))
import Plutarch.Monadic qualified as P
import Plutarch.Prelude
import Plutarch.Builtin
import Plutarch.LedgerApi.Value
import SmartTokens.Core.Utils
import Plutarch.Unsafe
import Plutarch.Builtin (pfromDataImpl, pdataImpl)
import Plutarch.LedgerApi.Value (PCurrencySymbol, pvalueOf)
import Plutarch.Core.Utils (ptryLookupValue, pheadSingleton, pand'List, (#>), pvalidateConditions)
import Plutarch.Unsafe (punsafeCoerce)
import Plutarch.Internal.PlutusType (PlutusType(pcon', pmatch'))
--import SmartTokens.Types.PTokenDirectory (PDirectorySetNode)

Expand Down
12 changes: 10 additions & 2 deletions src/lib/SmartTokens/Contracts/ProgrammableLogicBase.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
{-# OPTIONS_GHC -Wno-unused-do-bind #-}
{-# OPTIONS_GHC -Wno-partial-type-signatures #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE QualifiedDo #-}
{-# LANGUAGE OverloadedRecordDot #-}
module SmartTokens.Contracts.ProgrammableLogicBase (
mkProgrammableLogicBase,
mkProgrammableLogicGlobal
Expand Down Expand Up @@ -133,8 +141,8 @@ pvalueFromCred = phoistAcyclic $ plam $ \cred sigs scripts inputs ->
pif (ptxSignedByPkh # pkh # sigs)
(acc <> pfromData txInF.value)
perror
PScriptCredential ((pfield @"_0" #) -> scriptHash) ->
pif (pelem # punsafeCoerce scriptHash # scripts)
PScriptCredential ((pfield @"_0" #) -> scriptHash_) ->
pif (pelem # punsafeCoerce scriptHash_ # scripts)
(acc <> pfromData txInF.value)
perror
_ -> perror
Expand Down
5 changes: 4 additions & 1 deletion src/lib/SmartTokens/Contracts/ProtocolParams.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{-# LANGUAGE QualifiedDo #-}
{-# LANGUAGE OverloadedRecordDot #-}
{-# LANGUAGE OverloadedStrings #-}
module SmartTokens.Contracts.ProtocolParams (
mkProtocolParametersMinting,
alwaysFailScript,
Expand All @@ -22,7 +25,7 @@ import Plutarch.Prelude
psndBuiltin,
pletFields,
PUnit, pfield )
import SmartTokens.Core.Utils
import Plutarch.Core.Utils
( pheadSingleton,
ptryLookupValue,
phasUTxO,
Expand Down
Loading

0 comments on commit 37e9c43

Please sign in to comment.