diff --git a/README.md b/README.md index 6f62fadb..ac62917c 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ This repository houses on-chain smart contracts, Haskell off-chain interaction l ## Structure of repository +- [`geniusyield-onchain`](./geniusyield-onchain/) houses on-chain smart contracts. - [`geniusyield-dex-api`](./geniusyield-dex-api/) provides off-chain code to interact with our DEX. See it's [`README.md`](./geniusyield-dex-api/README.md) for more information about it. - [`geniusyield-server-lib`](./geniusyield-server-lib/) serves endpoints using our off-chain code to easily interact with GeniusYield DEX in language of user's choice. - [`geniusyield-orderbot-lib`](./geniusyield-orderbot-lib/) cater to additional requirements such as building up of an order-book, receiving price feed, etc. diff --git a/cabal.project b/cabal.project index e26882e6..2263a5cb 100644 --- a/cabal.project +++ b/cabal.project @@ -20,6 +20,7 @@ packages: geniusyield-dex-api geniusyield-orderbot-lib geniusyield-server-lib + geniusyield-onchain/geniusyield-common -- TODO: Default value should be @direct@ in upcoming 3.10 version of cabal, omit this line then. test-show-details: direct diff --git a/geniusyield-dex-api/CHANGELOG.md b/geniusyield-dex-api/CHANGELOG.md index 8c193623..8bca76a1 100644 --- a/geniusyield-dex-api/CHANGELOG.md +++ b/geniusyield-dex-api/CHANGELOG.md @@ -1,5 +1,10 @@ # Revision history for geniusyield-dex-api +## 0.2.0.0 -- 2024-04-17 + +* Adds support for v1.1 family of scripts. +* Adds CIP-20 metadata messages on transactions. + ## 0.1.0.0 -- 2023-12-22 * First version. diff --git a/geniusyield-dex-api/data/compiled-scripts/partial-order-config.uplc b/geniusyield-dex-api/data/compiled-scripts/partial-order-config.uplc deleted file mode 100644 index fe761cb6..00000000 Binary files a/geniusyield-dex-api/data/compiled-scripts/partial-order-config.uplc and /dev/null differ diff --git a/geniusyield-dex-api/geniusyield-dex-api.cabal b/geniusyield-dex-api/geniusyield-dex-api.cabal index 1776e486..9cb137ad 100644 --- a/geniusyield-dex-api/geniusyield-dex-api.cabal +++ b/geniusyield-dex-api/geniusyield-dex-api.cabal @@ -4,7 +4,7 @@ name: geniusyield-dex-api -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change -version: 0.1.0.0 +version: 0.2.0.0 synopsis: API code to interact with GeniusYield DEX. description: API code to interact with GeniusYield DEX. Learn more about GeniusYield by visiting https://www.geniusyield.co/. @@ -21,11 +21,6 @@ extra-doc-files: README.md tested-with: GHC ==9.2.8 -data-dir: data -data-files: - compiled-scripts/minting-policy.txt - compiled-scripts/partial-order-config.uplc - compiled-scripts/partial-order.txt source-repository head type: git @@ -59,6 +54,7 @@ library import: common hs-source-dirs: src exposed-modules: + GeniusYield.Api.Dex.Constants GeniusYield.Api.Dex.PartialOrder GeniusYield.Api.Dex.PartialOrderConfig GeniusYield.Api.Dex.Types @@ -71,21 +67,27 @@ library GeniusYield.Scripts.Dex.PartialOrderConfig GeniusYield.Scripts.Dex.PartialOrderConfig.Internal GeniusYield.Scripts.Dex.PartialOrderNft + GeniusYield.Scripts.Dex.Version build-depends: , aeson - , base ^>=4.16.4.0 + , base ^>=4.16.4.0 , bytestring , containers + , data-default , file-embed , http-types + , lens , mtl + , some + , strict , swagger2 , text -- Dependencies whose version is fixed by @cabal.project@ file. build-depends: , atlas-cardano + , geniusyield-common , ply-core -- Cardano libraries which are not on hackage. Their version is pinned in @cabal.project@ file or derived from other related dependencies. diff --git a/geniusyield-dex-api/src/GeniusYield/Api/Dex/Constants.hs b/geniusyield-dex-api/src/GeniusYield/Api/Dex/Constants.hs new file mode 100644 index 00000000..09f6e3b9 --- /dev/null +++ b/geniusyield-dex-api/src/GeniusYield/Api/Dex/Constants.hs @@ -0,0 +1,109 @@ +module GeniusYield.Api.Dex.Constants ( + poRefsMainnet, + poRefsPreprod, + poConfigAddrMainnet, + poConfigAddrPreprod, + DEXInfo (..), + dexInfoDefaultMainnet, + dexInfoDefaultPreprod, +) where + +import GeniusYield.Api.Dex.PartialOrderConfig (PORef (..), PORefs (..)) +import GeniusYield.OnChain.Common.Scripts.DEX.Data +import GeniusYield.Scripts (HasPartialOrderConfigAddr (..), HasPartialOrderNftScript (..), HasPartialOrderScript (..)) +import GeniusYield.Scripts.Dex.Version (POCVersion (POCVersion1, POCVersion1_1)) +import GeniusYield.Types (GYAddress, unsafeAddressFromText) +import PlutusLedgerApi.V1 (Address) +import PlutusLedgerApi.V1.Scripts (ScriptHash) +import PlutusLedgerApi.V1.Value (AssetClass) +import Ply (ScriptRole (..), TypedScript) + +poRefsMainnet ∷ PORefs +poRefsMainnet = + PORefs + { porV1 = + PORef + { porValRef = "062f97b0e64130bc18b4a227299a62d6d59a4ea852a4c90db3de2204a2cd19ea#2", + porRefNft = "fae686ea8f21d567841d703dea4d4221c2af071a6f2b433ff07c0af2.4aff78908ef2dce98bfe435fb3fd2529747b1c4564dff5adebedf4e46d0fc63d", + porMintRef = "062f97b0e64130bc18b4a227299a62d6d59a4ea852a4c90db3de2204a2cd19ea#1" + }, + porV1_1 = + PORef + { porValRef = "c8adf3262d769f5692847501791c0245068ed5b6746e7699d23152e94858ada7#2", + porRefNft = "fae686ea8f21d567841d703dea4d4221c2af071a6f2b433ff07c0af2.682fd5d4b0d834a3aa219880fa193869b946ffb80dba5532abca0910c55ad5cd", + porMintRef = "c8adf3262d769f5692847501791c0245068ed5b6746e7699d23152e94858ada7#1" + } + } + +poRefsPreprod ∷ PORefs +poRefsPreprod = + PORefs + { porV1 = + PORef + { porValRef = "be6f8dc16d4e8d5aad566ff6b5ffefdda574817a60d503e2a0ea95f773175050#2", + porRefNft = "fae686ea8f21d567841d703dea4d4221c2af071a6f2b433ff07c0af2.8309f9861928a55d37e84f6594b878941edce5e351f7904c2c63b559bde45c5c", + porMintRef = "be6f8dc16d4e8d5aad566ff6b5ffefdda574817a60d503e2a0ea95f773175050#1" + }, + porV1_1 = + PORef + { porValRef = "16647d6365020555d905d6e0edcf08b90a567886f875b40b3d7cec1c70482624#2", + porRefNft = "fae686ea8f21d567841d703dea4d4221c2af071a6f2b433ff07c0af2.b5121487c7661f202bc1f95cbc16f0fce720a0a9d3dba63a9f128e617f2ddedc", + porMintRef = "16647d6365020555d905d6e0edcf08b90a567886f875b40b3d7cec1c70482624#1" + } + } + +poConfigAddrMainnet ∷ POCVersion → GYAddress +poConfigAddrMainnet = + let v1Addr = unsafeAddressFromText "addr1w9zr09hgj7z6vz3d7wnxw0u4x30arsp5k8avlcm84utptls8uqd0z" + v1_1Addr = unsafeAddressFromText "addr1wxcqkdhe7qcfkqcnhlvepe7zmevdtsttv8vdfqlxrztaq2gge58rd" + in \case + POCVersion1 → v1Addr + POCVersion1_1 → v1_1Addr + +poConfigAddrPreprod ∷ POCVersion → GYAddress +poConfigAddrPreprod = + let v1Addr = unsafeAddressFromText "addr_test1wrgvy8fermjrruaf7fnndtmpuw4xx4cnvfqjp5zqu8kscfcvh32qk" + v1_1Addr = unsafeAddressFromText "addr_test1wqzy2cay2twmcq68ypk4wjyppz6e4vjj4udhvkp7dfjet2quuh3la" + in \case + POCVersion1 → v1Addr + POCVersion1_1 → v1_1Addr + +-- | Type that encapsulates the scripts needed for the dex api. +data DEXInfo = DEXInfo + { dexPartialOrderValidator ∷ !(TypedScript 'ValidatorRole '[Address, AssetClass]), + dexNftPolicy ∷ !(POCVersion → TypedScript 'MintingPolicyRole '[ScriptHash, Address, AssetClass]), + dexPartialOrderConfigAddr ∷ !(POCVersion → GYAddress), + dexPORefs ∷ !PORefs + } + +instance HasPartialOrderScript DEXInfo where + getPartialOrderValidator = dexPartialOrderValidator + +instance HasPartialOrderNftScript DEXInfo where + getPartialOrderNftPolicy = dexNftPolicy + +instance HasPartialOrderConfigAddr DEXInfo where + getPartialOrderConfigAddr = dexPartialOrderConfigAddr + +nftPolicy ∷ POCVersion → TypedScript 'MintingPolicyRole '[ScriptHash, Address, AssetClass] +nftPolicy = \case + POCVersion1 → nftPolicyV1 + POCVersion1_1 → nftPolicyV1_1 + +dexInfoDefaultMainnet ∷ DEXInfo +dexInfoDefaultMainnet = + DEXInfo + { dexPartialOrderValidator = orderValidator, + dexNftPolicy = nftPolicy, + dexPartialOrderConfigAddr = poConfigAddrMainnet, + dexPORefs = poRefsMainnet + } + +dexInfoDefaultPreprod ∷ DEXInfo +dexInfoDefaultPreprod = + DEXInfo + { dexPartialOrderValidator = orderValidator, + dexNftPolicy = nftPolicy, + dexPartialOrderConfigAddr = poConfigAddrPreprod, + dexPORefs = poRefsPreprod + } diff --git a/geniusyield-dex-api/src/GeniusYield/Api/Dex/PartialOrder.hs b/geniusyield-dex-api/src/GeniusYield/Api/Dex/PartialOrder.hs index ffe55e29..15d45a8f 100644 --- a/geniusyield-dex-api/src/GeniusYield/Api/Dex/PartialOrder.hs +++ b/geniusyield-dex-api/src/GeniusYield/Api/Dex/PartialOrder.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE LambdaCase #-} + {- | Module : GeniusYield.Api.Dex.PartialOrder Copyright : (c) 2023 GYELD GMBH @@ -7,6 +9,7 @@ Stability : develop -} module GeniusYield.Api.Dex.PartialOrder ( PORefs (..), + PORef (..), -- * PartialOrderInfo PartialOrderInfo (..), @@ -28,6 +31,7 @@ module GeniusYield.Api.Dex.PartialOrder ( -- * Queries partialOrders, partialOrdersHavingAsset, + partialOrdersWithTransformerPredicate, orderByNft, getPartialOrderInfo, getPartialOrdersInfos, @@ -44,49 +48,46 @@ module GeniusYield.Api.Dex.PartialOrder ( completelyFillMultiplePartialOrders, fillMultiplePartialOrders', cancelPartialOrder, - cancelPartialOrder', cancelMultiplePartialOrders, + cancelMultiplePartialOrders', -- * Utilities partialOrderAddr, partialOrderPrice, partialOrderPrice', + roundFunctionForPOCVersion, + getVersionsInOrders, + preferentiallySelectLatestVersion, + preferentiallySelectLatestPocd, ) where import Control.Monad.Except (ExceptT (..), liftEither, runExceptT) import Control.Monad.Reader (ask) +import Data.Bifunctor (Bifunctor) import Data.Foldable (foldlM) import Data.Map.Merge.Strict qualified as Map import Data.Map.Strict qualified as Map import Data.Maybe (fromJust) import Data.Ratio ((%)) import Data.Set qualified as Set +import Data.Strict.Tuple (Pair (..), (:!:)) import Data.Swagger qualified as Swagger import Data.Text qualified as Text -import GeniusYield.Api.Dex.PartialOrderConfig (fetchPartialOrderConfig) +import GeniusYield.Api.Dex.PartialOrderConfig (PORef (..), PORefs (..), RefPocd (..), RefPocds, SomePORef (..), SomeRefPocd (..), fetchPartialOrderConfig, fetchPartialOrderConfigs, selectPor, selectRefPocd, selectV1RefPocd, selectV1_1RefPocd, withSomePORef) import GeniusYield.Api.Dex.Types (GYDexApiMonad, GYDexApiQueryMonad, HasDexScripts) import GeniusYield.HTTP.Errors import GeniusYield.Imports import GeniusYield.Scripts.Dex.Nft (gyExpectedTokenName, mkNftRedeemer) import GeniusYield.Scripts.Dex.PartialOrder (PartialOrderAction (..), PartialOrderContainedFee (..), PartialOrderDatum (..), PartialOrderFeeOutput (..), partialOrderValidator) -import GeniusYield.Scripts.Dex.PartialOrderConfig (PartialOrderConfigInfoF (..)) +import GeniusYield.Scripts.Dex.PartialOrderConfig (PartialOrderConfigInfo, PartialOrderConfigInfoF (..)) import GeniusYield.Scripts.Dex.PartialOrderNft (partialOrderNftMintingPolicy) +import GeniusYield.Scripts.Dex.Version import GeniusYield.TxBuilder import GeniusYield.Types import Network.HTTP.Types.Status import PlutusTx.AssocMap qualified as PlutusTx import PlutusTx.Ratio qualified as PlutusTx -data PORefs = PORefs - { -- | The reference NFT. - porRefNft ∷ !GYAssetClass, - -- | The location of the reference NFT minting policy reference script. - porMintRef ∷ !GYTxOutRef, - -- | The location of the validator reference script. - porValRef ∷ !GYTxOutRef - } - deriving (Show) - data PodException = PodNftNotAvailable | PodNonPositiveAmount !Integer @@ -105,6 +106,8 @@ data PodException PodNotAllOrderRefsPresent !(Set.Set GYTxOutRef) -- ^ Missing output refs. + | -- | Such an order does not belong to supported swap script credentials. + PodOrderDoesntBelongToScript !GYTxOutRef deriving stock (Show) deriving anyclass (Exception) @@ -163,6 +166,12 @@ instance IsGYApiError PodException where gaeHttpStatus = status400, gaeMsg = Text.pack $ "Not all of given references are present, missing ones: " ++ show missingRefs } + toApiError (PodOrderDoesntBelongToScript ref) = + GYApiError + { gaeErrorCode = "ORDER_DOESNT_BELONG_TO_SCRIPT", + gaeHttpStatus = status400, + gaeMsg = Text.pack $ "Order doesn't belong to supported swap script credentials: " ++ show ref + } ------------------------------------------------------------------------------- -- Order info @@ -173,7 +182,7 @@ data POIContainedFee = POIContainedFee poifOfferedTokens ∷ !Natural, poifAskedTokens ∷ !Natural } - deriving stock (Eq, Show, Generic) + deriving stock (Show, Generic, Eq) deriving anyclass (Swagger.ToSchema) instance Semigroup POIContainedFee where @@ -224,9 +233,11 @@ data PartialOrderInfo = PartialOrderInfo -- | Address of the order UTxO. poiUTxOAddr ∷ !GYAddress, -- | Caching the CS to avoid recalculating for it. - poiNFTCS ∷ !GYMintingPolicyId + poiNFTCS ∷ !GYMintingPolicyId, + -- | Version of the partial order. + poiVersion ∷ !POCVersion } - deriving stock (Eq, Show, Generic) + deriving stock (Show, Eq, Generic) deriving anyclass (Swagger.ToSchema) poiContainedFeeToPlutus ∷ POIContainedFee → PartialOrderContainedFee @@ -274,19 +285,21 @@ poiContainedFeeToValue POIContainedFee {..} offAC askAC = valueSingleton GYLovel partialOrderInfoToIn ∷ HasDexScripts a ⇒ a + → POCVersion → PORefs → PartialOrderInfo → PartialOrderAction → GYTxIn 'PlutusV2 -partialOrderInfoToIn a PORefs {..} oi@PartialOrderInfo {..} oa = - GYTxIn - { gyTxInTxOutRef = poiRef, - gyTxInWitness = - GYTxInWitnessScript - (GYInReference porValRef $ validatorToScript $ partialOrderValidator a porRefNft) - (datumFromPlutusData $ partialOrderInfoToPartialOrderDatum oi) - $ redeemerFromPlutusData oa - } +partialOrderInfoToIn a pocVersion pors oi@PartialOrderInfo {..} oa = + let SomePORef PORef {..} = selectPor pors pocVersion + in GYTxIn + { gyTxInTxOutRef = poiRef, + gyTxInWitness = + GYTxInWitnessScript + (GYInReference porValRef $ validatorToScript $ partialOrderValidator a pocVersion porRefNft) + (datumFromPlutusData $ partialOrderInfoToPartialOrderDatum oi) + $ redeemerFromPlutusData oa + } partialOrderInfoToPayment ∷ PartialOrderInfo → GYValue → GYTxOut 'PlutusV2 partialOrderInfoToPayment oi v = mkGYTxOut (poiOwnerAddr oi) v (datumFromPlutusData $ txOutRefToPlutus $ poiRef oi) @@ -294,6 +307,14 @@ partialOrderInfoToPayment oi v = mkGYTxOut (poiOwnerAddr oi) v (datumFromPlutusD partialOrderPrice ∷ PartialOrderInfo → Natural → GYValue partialOrderPrice oi@PartialOrderInfo {poiAskedAsset} amt = valueSingleton poiAskedAsset $ fromIntegral $ partialOrderPrice' oi amt +roundFunctionForPOCVersion1_1 ∷ Integral a ⇒ Rational → a +roundFunctionForPOCVersion1_1 = floor + +roundFunctionForPOCVersion ∷ Integral a ⇒ POCVersion → Rational → a +roundFunctionForPOCVersion = \case + POCVersion1 → ceiling + POCVersion1_1 → roundFunctionForPOCVersion1_1 + partialOrderPrice' ∷ PartialOrderInfo → Natural → Natural partialOrderPrice' PartialOrderInfo {poiPrice} amt = ceiling $ rationalToGHC poiPrice * toRational amt @@ -314,27 +335,44 @@ expectedPaymentWithDeposit poi@PartialOrderInfo {..} isCompleteFill = -- script address ------------------------------------------------------------------------------- -partialOrderAddr ∷ GYDexApiQueryMonad m a ⇒ PORefs → m GYAddress -partialOrderAddr PORefs {..} = do +partialOrderAddr ∷ ∀ v m a. (GYDexApiQueryMonad m a, SingPOCVersionI v) ⇒ PORef v → m GYAddress +partialOrderAddr PORef {..} = do a ← ask - scriptAddress $ partialOrderValidator a porRefNft + scriptAddress $ partialOrderValidator a (fromSingPOCVersion $ singPOCVersion @v) porRefNft + +partialOrderAddrTuple ∷ GYDexApiQueryMonad m a ⇒ PORefs → m (GYAddress :!: GYAddress) +partialOrderAddrTuple PORefs {..} = do + addrV1 ← partialOrderAddr porV1 + addrV1_1 ← partialOrderAddr porV1_1 + pure $ addrV1 :!: addrV1_1 ------------------------------------------------------------------------------- -- partial order NFT policy ------------------------------------------------------------------------------- partialOrderNftPolicy - ∷ GYDexApiQueryMonad m a - ⇒ PORefs + ∷ ∀ v m a + . (GYDexApiQueryMonad m a, SingPOCVersionI v) + ⇒ PORef v → m (GYMintingPolicy 'PlutusV2) -- ^ The minting policy of the partial order NFT. -partialOrderNftPolicy PORefs {..} = do +partialOrderNftPolicy por = do a ← ask - pure $ partialOrderNftMintingPolicy a porRefNft + pure $ partialOrderNftPolicy' a por + +partialOrderNftPolicy' + ∷ ∀ v a + . (SingPOCVersionI v, HasDexScripts a) + ⇒ a + → PORef v + → GYMintingPolicy 'PlutusV2 + -- ^ The minting policy of the partial order NFT. +partialOrderNftPolicy' a PORef {..} = partialOrderNftMintingPolicy a (fromSingPOCVersion $ singPOCVersion @v) porRefNft partialOrderNftPolicyId - ∷ GYDexApiQueryMonad m a - ⇒ PORefs + ∷ ∀ v m a + . (GYDexApiQueryMonad m a, SingPOCVersionI v) + ⇒ PORef v → m GYMintingPolicyId -- ^ The minting policy id of the partial order NFT. partialOrderNftPolicyId por = @@ -355,18 +393,40 @@ partialOrdersHavingAsset ⇒ PORefs → Maybe GYAssetClass → m (Map.Map GYTxOutRef PartialOrderInfo) -partialOrdersHavingAsset por hasAsset = do - addr ← partialOrderAddr por - let paymentCred = addressToPaymentCredential addr & fromJust - utxosWithDatums ← utxosAtPaymentCredentialWithDatums paymentCred hasAsset - policyId ← partialOrderNftPolicyId por - let datums = utxosDatumsPure utxosWithDatums - iwither - ( \oref vod → - either (const Nothing) Just - <$> runExceptT (makePartialOrderInfo policyId oref vod) - ) - datums +partialOrdersHavingAsset pors hasAsset = do + addrTuple ← partialOrderAddrTuple pors + let pV1 :!: pV1_1 = applyToBoth (fromJust . addressToPaymentCredential) addrTuple + utxosWithDatumsV1 ← utxosAtPaymentCredentialWithDatums pV1 hasAsset + -- TODO: Add support in Atlas to query multiple payment credentials in one go. + utxosWithDatumsV1_1 ← utxosAtPaymentCredentialWithDatums pV1_1 hasAsset + policyIdV1 ← partialOrderNftPolicyId (porV1 pors) + policyIdV1_1 ← partialOrderNftPolicyId (porV1_1 pors) + let datumsV1 = utxosDatumsPure utxosWithDatumsV1 + datumsV1_1 = utxosDatumsPure utxosWithDatumsV1_1 + m1 ← + iwither + ( \oref vod → + either (const Nothing) Just + <$> runExceptT (makePartialOrderInfo policyIdV1 oref vod POCVersion1) + ) + datumsV1 + m1_1 ← + iwither + ( \oref vod → + either (const Nothing) Just + <$> runExceptT (makePartialOrderInfo policyIdV1_1 oref vod POCVersion1_1) + ) + datumsV1_1 + pure $! m1 <> m1_1 + +partialOrdersWithTransformerPredicate + ∷ GYDexApiQueryMonad m a + ⇒ PORefs + → (PartialOrderInfo → Maybe b) + → m [b] +partialOrdersWithTransformerPredicate pors transformerPredicate = do + ois ← Map.elems <$> partialOrders pors + pure $ mapMaybe transformerPredicate ois orderByNft ∷ GYDexApiQueryMonad m a @@ -379,29 +439,48 @@ orderByNft por orderNft = do [oi] → pure $ Just oi _ → pure Nothing +getPartialOrderVersion ∷ GYDexApiQueryMonad m a ⇒ PORefs → (GYAddress :!: GYTxOutRef) → m POCVersion +getPartialOrderVersion pors outxo = do + ps ← applyToBoth addressToPaymentCredential <$> partialOrderAddrTuple pors + getPartialOrderVersion' ps outxo + +getPartialOrderVersion' ∷ GYDexApiQueryMonad m a ⇒ (Maybe GYPaymentCredential :!: Maybe GYPaymentCredential) → (GYAddress :!: GYTxOutRef) → m POCVersion +getPartialOrderVersion' (p1 :!: p1_1) (addr :!: oref) = do + let pc = addressToPaymentCredential addr + if + | p1 == pc → pure POCVersion1 + | p1_1 == pc → pure POCVersion1_1 + | otherwise → throwAppError $ PodOrderDoesntBelongToScript oref + getPartialOrderInfo ∷ GYDexApiQueryMonad m a ⇒ PORefs → GYTxOutRef → m PartialOrderInfo -getPartialOrderInfo por orderRef = do +getPartialOrderInfo pors orderRef = do utxoWithDatum ← utxoAtTxOutRefWithDatum' orderRef + let utxo = fst utxoWithDatum + pocVersion ← getPartialOrderVersion pors (utxoAddress utxo :!: utxoRef utxo) vod ← utxoDatumPure' utxoWithDatum - policyId ← partialOrderNftPolicyId por + policyId ← withSomePORef (selectPor pors pocVersion) partialOrderNftPolicyId - runExceptT (makePartialOrderInfo policyId orderRef vod) >>= liftEither + runExceptT (makePartialOrderInfo policyId orderRef vod pocVersion) >>= liftEither getPartialOrdersInfos ∷ GYDexApiQueryMonad m a ⇒ PORefs → [GYTxOutRef] → m (Map.Map GYTxOutRef PartialOrderInfo) -getPartialOrdersInfos por orderRefs = do +getPartialOrdersInfos pors orderRefs = do utxosWithDatums ← utxosAtTxOutRefsWithDatums orderRefs + ps ← applyToBoth addressToPaymentCredential <$> partialOrderAddrTuple pors let vod = utxosDatumsPure utxosWithDatums when (Map.size vod /= length orderRefs) $ throwAppError $ PodNotAllOrderRefsPresent $ Set.fromList orderRefs `Set.difference` Map.keysSet vod - policyId ← partialOrderNftPolicyId por - runExceptT (Map.traverseWithKey (makePartialOrderInfo policyId) vod) >>= liftEither + let makePartialOrderInfo' oref v@(addr, _, _) = do + pocVersion ← getPartialOrderVersion' ps (addr :!: oref) + policyId ← withSomePORef (selectPor pors pocVersion) partialOrderNftPolicyId + makePartialOrderInfo policyId oref v pocVersion + runExceptT (Map.traverseWithKey makePartialOrderInfo' vod) >>= liftEither getPartialOrdersInfos' ∷ GYDexApiQueryMonad m a ⇒ PORefs → [(GYTxOutRef, Natural)] → m [(PartialOrderInfo, Natural)] getPartialOrdersInfos' por ordersWithTokenBuyAmount = do @@ -415,8 +494,9 @@ makePartialOrderInfo ⇒ GYMintingPolicyId → GYTxOutRef → (GYAddress, GYValue, PartialOrderDatum) + → POCVersion → ExceptT GYTxMonadException m PartialOrderInfo -makePartialOrderInfo policyId orderRef (utxoAddr, v, PartialOrderDatum {..}) = do +makePartialOrderInfo policyId orderRef (utxoAddr, v, PartialOrderDatum {..}) pocVersion = do addr ← addressFromPlutus' podOwnerAddr key ← pubKeyHashFromPlutus' podOwnerKey @@ -448,7 +528,8 @@ makePartialOrderInfo policyId orderRef (utxoAddr, v, PartialOrderDatum {..}) = d poiContainedPayment = fromInteger podContainedPayment, poiUTxOValue = v, poiUTxOAddr = utxoAddr, - poiNFTCS = policyId + poiNFTCS = policyId, + poiVersion = pocVersion } ------------------------------------------------------------------------------- @@ -473,9 +554,30 @@ placePartialOrder → Maybe GYStakeCredential -- ^ Stake credential of user. We do not support pointer reference. → m (GYTxSkeleton 'PlutusV2) -placePartialOrder por@PORefs {..} addr (offerAmt, offerAC) priceAC price start end stakeCred = do - (cfgRef, pocd) ← fetchPartialOrderConfig porRefNft - placePartialOrder' por addr (offerAmt, offerAC) priceAC price start end 0 0 stakeCred cfgRef pocd +placePartialOrder pors = placePartialOrderWithVersion pors defaultPOCVersion + +placePartialOrderWithVersion + ∷ GYDexApiMonad m a + ⇒ PORefs + → POCVersion + → GYAddress + -- ^ Order owner + → (Natural, GYAssetClass) + -- ^ Amount and asset to offer. + → GYAssetClass + -- ^ The asset being asked for as payment. + → GYRational + -- ^ The price for one unit of the offered asset. + → Maybe GYTime + -- ^ The earliest time when the order can be filled (optional). + → Maybe GYTime + -- ^ The latest time when the order can be filled (optional). + → Maybe GYStakeCredential + -- ^ Stake credential of user. We do not support pointer reference. + → m (GYTxSkeleton 'PlutusV2) +placePartialOrderWithVersion pors pocVersion addr (offerAmt, offerAC) priceAC price start end stakeCred = do + SomeRefPocd (RefPocd (cfgRef :!: pocd)) ← fetchPartialOrderConfig pocVersion pors + placePartialOrderWithVersion' pors pocVersion addr (offerAmt, offerAC) priceAC price start end 0 0 stakeCred cfgRef pocd placePartialOrder' ∷ (GYDexApiMonad m a, HasCallStack) @@ -501,7 +603,34 @@ placePartialOrder' → GYTxOutRef → PartialOrderConfigInfoF GYAddress → m (GYTxSkeleton 'PlutusV2) -placePartialOrder' por@PORefs {..} addr (offerAmt, offerAC) priceAC price start end addLov addOff stakeCred cfgRef pocd = do +placePartialOrder' pors = placePartialOrderWithVersion' pors defaultPOCVersion + +placePartialOrderWithVersion' + ∷ (GYDexApiMonad m a, HasCallStack) + ⇒ PORefs + → POCVersion + → GYAddress + -- ^ Order owner + → (Natural, GYAssetClass) + -- ^ Amount and asset to offer. + → GYAssetClass + -- ^ The asset being asked for as payment. + → GYRational + -- ^ The price for one unit of the offered asset. + → Maybe GYTime + -- ^ The earliest time when the order can be filled (optional). + → Maybe GYTime + -- ^ The latest time when the order can be filled (optional). + → Natural + -- ^ Additional lovelace fee. + → Natural + -- ^ Additional fee in offered tokens. + → Maybe GYStakeCredential + -- ^ Stake credential of user. We do not support pointer reference. + → GYTxOutRef + → PartialOrderConfigInfoF GYAddress + → m (GYTxSkeleton 'PlutusV2) +placePartialOrderWithVersion' pors pocVersion addr (offerAmt, offerAC) priceAC price start end addLov addOff stakeCred cfgRef pocd = do when (offerAmt == 0) $ throwAppError $ PodNonPositiveAmount $ toInteger offerAmt when (price <= 0) $ throwAppError $ PodNonPositivePrice price when (offerAC == priceAC) $ throwAppError $ PodNonDifferentAssets offerAC @@ -510,11 +639,13 @@ placePartialOrder' por@PORefs {..} addr (offerAmt, offerAC) priceAC price start (Just start', Just end') → when (end' < start') $ throwAppError $ PodEndEarlierThanStart start' end' _ → pure () + let por@(SomePORef PORef {..}) = selectPor pors pocVersion + pkh ← addressToPubKeyHash' addr - outAddr ← partialOrderAddr por + outAddr ← withSomePORef por partialOrderAddr nid ← networkId let outAddr' = addressFromCredential nid (addressToPaymentCredential outAddr & fromJust) stakeCred - policy ← partialOrderNftPolicy por + policy ← withSomePORef por partialOrderNftPolicy nftRef ← someUTxOWithoutRefScript let nftName = gyExpectedTokenName nftRef @@ -528,7 +659,7 @@ placePartialOrder' por@PORefs {..} addr (offerAmt, offerAC) priceAC price start nftV = valueSingleton nft 1 offerAmt' = toInteger offerAmt makerFeeFlat = fromIntegral addLov + pociMakerFeeFlat pocd - makerFeeOff = (+) (fromIntegral addOff) $ ceiling $ toRational offerAmt * rationalToGHC (pociMakerFeeRatio pocd) + makerFeeOff = (+) (fromIntegral addOff) $ roundFunctionForPOCVersion pocVersion $ toRational offerAmt * rationalToGHC (pociMakerFeeRatio pocd) makerFee = valueFromLovelace makerFeeFlat <> valueSingleton offerAC makerFeeOff @@ -569,6 +700,7 @@ placePartialOrder' por@PORefs {..} addr (offerAmt, offerAC) priceAC price start <> mustHaveOutput o <> mustMint (GYMintReference porMintRef $ mintingPolicyToScript policy) nftRedeemer nftName 1 <> mustHaveRefInput cfgRef + <> mustHaveTxMetadata stampPlaced -- | Fills an order. If the provided amount of offered tokens to buy is equal to the offered amount, then we completely fill the order. Otherwise, it gets partially filled. fillPartialOrder @@ -578,7 +710,7 @@ fillPartialOrder -- ^ The order reference. → Natural -- ^ The amount of offered tokens to buy. - → Maybe (GYTxOutRef, PartialOrderConfigInfoF GYAddress) + → Maybe SomeRefPocd → Natural -- ^ Additional taker fee in payment tokens. → m (GYTxSkeleton 'PlutusV2) @@ -597,7 +729,7 @@ fillPartialOrder' -- ^ The order information. → Natural -- ^ The amount of offered tokens to buy. - → Maybe (GYTxOutRef, PartialOrderConfigInfoF GYAddress) + → Maybe SomeRefPocd → Natural -- ^ Additional taker fee in payment tokens. → m (GYTxSkeleton 'PlutusV2) @@ -612,7 +744,7 @@ completelyFillPartialOrder ⇒ PORefs → GYTxOutRef -- ^ The order reference. - → Maybe (GYTxOutRef, PartialOrderConfigInfoF GYAddress) + → Maybe SomeRefPocd → Natural -- ^ Additional taker fee in payment tokens. → m (GYTxSkeleton 'PlutusV2) @@ -628,31 +760,33 @@ partiallyFillPartialOrder -- ^ The order reference. → Natural -- ^ The amount of offered tokens to buy. - → Maybe (GYTxOutRef, PartialOrderConfigInfoF GYAddress) + → Maybe SomeRefPocd → Natural -- ^ Additional taker fee in payment tokens. → m (GYTxSkeleton 'PlutusV2) -partiallyFillPartialOrder por orderRef amt mRefPocd addTakerFee = do - oi ← getPartialOrderInfo por orderRef +partiallyFillPartialOrder pors orderRef amt mRefPocd addTakerFee = do + oi ← getPartialOrderInfo pors orderRef - mkSkeletonPartiallyFillPartialOrder por oi amt mRefPocd addTakerFee + mkSkeletonPartiallyFillPartialOrder pors oi amt mRefPocd addTakerFee -- | Creates the complete fill skeleton of a partial order. mkSkeletonCompletelyFillPartialOrder ∷ (HasCallStack, GYDexApiQueryMonad m a) ⇒ PORefs → PartialOrderInfo - → Maybe (GYTxOutRef, PartialOrderConfigInfoF GYAddress) + → Maybe SomeRefPocd → Natural → m (GYTxSkeleton 'PlutusV2) -mkSkeletonCompletelyFillPartialOrder por@PORefs {..} oi@PartialOrderInfo {..} mRefPocd addTakerFee = do +mkSkeletonCompletelyFillPartialOrder pors oi@PartialOrderInfo {..} mRefPocd addTakerFee = do + pocVersion ← getPartialOrderVersion pors (poiUTxOAddr :!: poiRef) + let por@(SomePORef PORef {..}) = selectPor pors pocVersion cs ← validFillRangeConstraints poiStart poiEnd gycs ← ask - script ← mintingPolicyToScript <$> partialOrderNftPolicy por - (cfgRef, pocd) ← + script ← mintingPolicyToScript <$> withSomePORef por partialOrderNftPolicy + SomeRefPocd (RefPocd (cfgRef :!: pocd)) ← case mRefPocd of - Just (cfgRef', pocd') → pure (cfgRef', pocd') - Nothing → fetchPartialOrderConfig porRefNft + Just refPocd → pure refPocd + Nothing → fetchPartialOrderConfig pocVersion pors let containedFee = poiGetContainedFeeValue oi fee = containedFee <> valueFromLovelace (fromIntegral poiTakerLovelaceFlatFee) <> valueSingleton poiAskedAsset (fromIntegral addTakerFee) -- Note that SC is fine if @addTakerFee@ is not included. @@ -673,12 +807,13 @@ mkSkeletonCompletelyFillPartialOrder por@PORefs {..} oi@PartialOrderInfo {..} mR expectedValueOut = expectedPaymentWithDeposit oi True return $ - mustHaveInput (partialOrderInfoToIn gycs por oi CompleteFill) + mustHaveInput (partialOrderInfoToIn gycs pocVersion pors oi CompleteFill) <> mustHaveRefInput cfgRef <> mustHaveOutput (partialOrderInfoToPayment oi expectedValueOut) <> feeOutput <> mustMint (GYMintReference porMintRef script) nothingRedeemer poiNFT (-1) <> cs + <> mustHaveTxMetadata stampFilled -- | Creates the partial fill skeleton of a partial order. mkSkeletonPartiallyFillPartialOrder @@ -687,17 +822,18 @@ mkSkeletonPartiallyFillPartialOrder → PartialOrderInfo → Natural -- ^ The amount of offered tokens to buy. - → Maybe (GYTxOutRef, PartialOrderConfigInfoF GYAddress) + → Maybe SomeRefPocd → Natural → m (GYTxSkeleton 'PlutusV2) -mkSkeletonPartiallyFillPartialOrder por@PORefs {..} oi@PartialOrderInfo {..} amt mRefPocd addTakerFee = do +mkSkeletonPartiallyFillPartialOrder pors oi@PartialOrderInfo {..} amt mRefPocd addTakerFee = do + pocVersion ← getPartialOrderVersion pors (poiUTxOAddr :!: poiRef) when (amt == 0) . throwAppError $ PodNonPositiveAmount $ toInteger amt when (amt >= poiOfferedAmount) . throwAppError $ PodRequestedAmountGreaterOrEqualToOfferedAmount amt poiOfferedAmount - (cfgRef, _pocd) ← + SomeRefPocd (RefPocd (cfgRef :!: _pocd)) ← case mRefPocd of - Just (cfgRef', pocd') → pure (cfgRef', pocd') - Nothing → fetchPartialOrderConfig porRefNft + Just refPocd → pure refPocd + Nothing → fetchPartialOrderConfig pocVersion pors let price' = partialOrderPrice oi amt od = @@ -716,48 +852,76 @@ mkSkeletonPartiallyFillPartialOrder por@PORefs {..} oi@PartialOrderInfo {..} amt gycs ← ask return $ - mustHaveInput (partialOrderInfoToIn gycs por oi $ PartialFill $ toInteger amt) + mustHaveInput (partialOrderInfoToIn gycs pocVersion pors oi $ PartialFill $ toInteger amt) <> mustHaveOutput o <> cs <> mustHaveRefInput cfgRef + <> mustHaveTxMetadata stampFilled cancelPartialOrder ∷ (HasCallStack, GYDexApiMonad m a) ⇒ PORefs → GYTxOutRef - -- ^ The order reference. → m (GYTxSkeleton 'PlutusV2) -cancelPartialOrder por orderRef = do - poi ← getPartialOrderInfo por orderRef - cancelMultiplePartialOrders por [poi] +cancelPartialOrder por orderRef = cancelMultiplePartialOrders por (pure orderRef) -cancelPartialOrder' +-- | Cancel multiple partial orders. +cancelMultiplePartialOrders ∷ (HasCallStack, GYDexApiMonad m a) ⇒ PORefs - → PartialOrderInfo - -- ^ The order information. + → [GYTxOutRef] → m (GYTxSkeleton 'PlutusV2) -cancelPartialOrder' por poi = cancelMultiplePartialOrders por [poi] +cancelMultiplePartialOrders pors orderRefs = do + ois ← Map.elems <$> getPartialOrdersInfos pors orderRefs + cancelMultiplePartialOrders' pors ois + +getVersionsInOrders ∷ [PartialOrderInfo] → Set POCVersion +getVersionsInOrders = foldl' (\acc PartialOrderInfo {..} → Set.insert poiVersion acc) Set.empty + +addCfgRefInputs ∷ Set POCVersion → RefPocds → GYTxSkeleton 'PlutusV2 +addCfgRefInputs versionsSet cfgRefs = + let RefPocd (cfgRefV1 :!: _) = selectV1RefPocd cfgRefs + RefPocd (cfgRefV1_1 :!: _) = selectV1_1RefPocd cfgRefs + in ( if Set.member POCVersion1 versionsSet + then mustHaveRefInput cfgRefV1 + else mempty + ) + <> ( if Set.member POCVersion1_1 versionsSet + then mustHaveRefInput cfgRefV1_1 + else mempty + ) + +preferentiallySelectLatestVersion ∷ Set POCVersion → POCVersion +preferentiallySelectLatestVersion versionsSet = fromMaybe maxBound (Set.lookupMax versionsSet) + +-- | If there is a version 1.1 order in the set, then preferentially select it's config reference datum. Idea behind this is that when orders we are interacting with are all of same version, then we select that version's config reference datum but if it's a mixed bag, we select for the latest version. +preferentiallySelectLatestPocd ∷ Set POCVersion → RefPocds → PartialOrderConfigInfo +preferentiallySelectLatestPocd versionsSet cfgRefs = + let overallVersion = preferentiallySelectLatestVersion versionsSet + SomeRefPocd (RefPocd (_ :!: pocd)) = selectRefPocd cfgRefs overallVersion + in pocd -- | Cancel multiple partial orders. -cancelMultiplePartialOrders +cancelMultiplePartialOrders' ∷ (HasCallStack, GYDexApiMonad m a) ⇒ PORefs → [PartialOrderInfo] → m (GYTxSkeleton 'PlutusV2) -cancelMultiplePartialOrders por@PORefs {..} ois = do +cancelMultiplePartialOrders' pors ois = do gycs ← ask - script ← mintingPolicyToScript <$> partialOrderNftPolicy por - (cfgRef, pocd) ← fetchPartialOrderConfig porRefNft + cfgRefs ← fetchPartialOrderConfigs pors + let versionsSet = getVersionsInOrders ois + let pocd = preferentiallySelectLatestPocd versionsSet cfgRefs let (!feeOutputMap, !totalRequiredFees, !accumulatedSkeleton) = foldl' ( \(!mapAcc, !feeAcc, !skelAcc) poi@PartialOrderInfo {..} → - let skelAdd = - mustHaveInput (partialOrderInfoToIn gycs por poi PartialCancel) + let por@(SomePORef PORef {..}) = selectPor pors poiVersion + skelAdd = + mustHaveInput (partialOrderInfoToIn gycs poiVersion pors poi PartialCancel) <> mustHaveOutput (partialOrderInfoToPayment poi (expectedPaymentWithDeposit poi False)) <> mustBeSignedBy poiOwnerKey - <> mustMint (GYMintReference porMintRef script) nothingRedeemer poiNFT (-1) + <> mustMint (GYMintReference porMintRef (withSomePORef por (partialOrderNftPolicy' gycs) & mintingPolicyToScript)) nothingRedeemer poiNFT (-1) in if poiPartialFills == 0 || poiContainedFee == mempty then (mapAcc, feeAcc, skelAcc <> skelAdd) else @@ -777,25 +941,26 @@ cancelMultiplePartialOrders por@PORefs {..} ois = do pure $ feeOutput <> accumulatedSkeleton - <> mustHaveRefInput cfgRef + <> addCfgRefInputs versionsSet cfgRefs + <> mustHaveTxMetadata stampCancel -- | Fills multiple orders. If the provided amount of offered tokens to buy in an order is equal to the offered amount, then we completely fill the order. Otherwise, it gets partially filled. fillMultiplePartialOrders ∷ (HasCallStack, GYDexApiMonad m a) ⇒ PORefs → [(GYTxOutRef, Natural)] - → Maybe (GYTxOutRef, PartialOrderConfigInfoF GYAddress) + → Maybe RefPocds → m (GYTxSkeleton 'PlutusV2) -fillMultiplePartialOrders por ordersWithTokenBuyAmount mRefPocd = do - ordersWithTokenBuyAmount' ← getPartialOrdersInfos' por ordersWithTokenBuyAmount - fillMultiplePartialOrders' por ordersWithTokenBuyAmount' mRefPocd mempty +fillMultiplePartialOrders pors ordersWithTokenBuyAmount mRefPocd = do + ordersWithTokenBuyAmount' ← getPartialOrdersInfos' pors ordersWithTokenBuyAmount + fillMultiplePartialOrders' pors ordersWithTokenBuyAmount' mRefPocd mempty -- | Completely fill multiple orders. completelyFillMultiplePartialOrders ∷ (HasCallStack, GYDexApiMonad m a) ⇒ PORefs → [GYTxOutRef] - → Maybe (GYTxOutRef, PartialOrderConfigInfoF GYAddress) + → Maybe RefPocds → m (GYTxSkeleton 'PlutusV2) completelyFillMultiplePartialOrders por ordersRefs mRefPocd = do orders ← getPartialOrdersInfos por ordersRefs @@ -806,17 +971,20 @@ fillMultiplePartialOrders' ∷ (HasCallStack, GYDexApiMonad m a) ⇒ PORefs → [(PartialOrderInfo, Natural)] - → Maybe (GYTxOutRef, PartialOrderConfigInfoF GYAddress) + → Maybe RefPocds → GYValue + -- ^ Additional taker fee. → m (GYTxSkeleton 'PlutusV2) -fillMultiplePartialOrders' por orders mRefPocd addTakerFee = do - (cfgRef, pocd) ← +fillMultiplePartialOrders' pors orders mRefPocd addTakerFee = do + cfgRefs ← case mRefPocd of - Just (cfgRef', pocd') → pure (cfgRef', pocd') - Nothing → fetchPartialOrderConfig (porRefNft por) + Just refPocds → pure refPocds + Nothing → fetchPartialOrderConfigs pors gycs ← ask - - let buildWithFeeOutput = do + let versionsSet = getVersionsInOrders $ map fst orders + pocd = preferentiallySelectLatestPocd versionsSet cfgRefs + cfgRefInputs = addCfgRefInputs versionsSet cfgRefs + buildWithFeeOutput = do let (!feeOutputMap, !totalContainedFee, !maxTakerFee) = foldl' ( \(!mapAcc, !feeAcc, !prevMaxTakerFee) (PartialOrderInfo {..}, amtToFill) → @@ -834,18 +1002,18 @@ fillMultiplePartialOrders' por orders mRefPocd addTakerFee = do | fee == mempty = mempty | otherwise = mustHaveOutput $ mkGYTxOut (pociFeeAddr pocd) (fee <> addTakerFee) $ datumFromPlutusData $ PartialOrderFeeOutput feeOutputMap mempty Nothing - script ← mintingPolicyToScript <$> partialOrderNftPolicy por foldlM ( \(!prevSkel) (poi@PartialOrderInfo {..}, amt) → do commonCheck amt poiOfferedAmount cs ← validFillRangeConstraints poiStart poiEnd - let skel = + let por@(SomePORef PORef {..}) = selectPor pors poiVersion + skel = if amt == poiOfferedAmount then let expectedValueOut = expectedPaymentWithDeposit poi True - in mustHaveInput (partialOrderInfoToIn gycs por poi CompleteFill) + in mustHaveInput (partialOrderInfoToIn gycs poiVersion pors poi CompleteFill) <> mustHaveOutput (partialOrderInfoToPayment poi expectedValueOut) - <> mustMint (GYMintReference (porMintRef por) script) nothingRedeemer poiNFT (-1) + <> mustMint (GYMintReference porMintRef (withSomePORef por (partialOrderNftPolicy' gycs) & mintingPolicyToScript)) nothingRedeemer poiNFT (-1) <> cs else let price' = partialOrderPrice poi amt @@ -859,13 +1027,13 @@ fillMultiplePartialOrders' por orders mRefPocd addTakerFee = do expectedValueOut = poiUTxOValue <> price' `valueMinus` valueSingleton poiOfferedAsset (toInteger amt) o = mkGYTxOut poiUTxOAddr expectedValueOut (datumFromPlutusData od) - in mustHaveInput (partialOrderInfoToIn gycs por poi $ PartialFill $ toInteger amt) + in mustHaveInput (partialOrderInfoToIn gycs poiVersion pors poi $ PartialFill $ toInteger amt) <> mustHaveOutput o <> cs pure $! prevSkel <> skel ) - (mustHaveRefInput cfgRef <> feeOutput) + (cfgRefInputs <> feeOutput <> mustHaveTxMetadata stampFilled) orders let buildWithoutFeeOutput = do @@ -891,14 +1059,14 @@ fillMultiplePartialOrders' por orders mRefPocd addTakerFee = do pure $! prevSkel - <> mustHaveInput (partialOrderInfoToIn gycs por poi $ PartialFill $ toInteger amt) + <> mustHaveInput (partialOrderInfoToIn gycs poiVersion pors poi $ PartialFill $ toInteger amt) <> mustHaveOutput o <> cs ) - (mustHaveRefInput cfgRef) + (cfgRefInputs <> mustHaveTxMetadata stampFilled) (zip [(1 ∷ Natural) ..] orders) - - if isJust $ find (\(PartialOrderInfo {..}, amt) → amt == poiOfferedAmount) orders + -- If all orders are of same version, we can keep earlier logic of not requiring fee output when all orders are filled partially. + if (Set.size versionsSet > 1) || isJust (find (\(PartialOrderInfo {..}, amt) → amt == poiOfferedAmount) orders) then buildWithFeeOutput else buildWithoutFeeOutput where @@ -906,6 +1074,9 @@ fillMultiplePartialOrders' por orders mRefPocd addTakerFee = do when (amt == 0) . throwAppError $ PodNonPositiveAmount $ toInteger amt when (amt > poiOfferedAmount) . throwAppError $ PodRequestedAmountGreaterThanOfferedAmount amt poiOfferedAmount +applyToBoth ∷ Bifunctor p ⇒ (c → d) → p c c → p d d +applyToBoth f = bimap f f + -- | Exceptions raised while (partially) filling (partial) orders. data FillOrderException = -- | Attempt to (partially) fill an order too early. @@ -951,3 +1122,9 @@ validFillRangeConstraints mstart mend = (<>) <$> startConstraint <*> endConstrai if now <= endSlot then return $ isInvalidAfter $ min endSlot $ unsafeAdvanceSlot now 120 else throwAppError $ TooLateFill {foeEnd = endSlot, foeNow = now} + +-- | Metadata stamps +stampPlaced, stampFilled, stampCancel ∷ Maybe GYTxMetadata +stampPlaced = metadataMsg "GeniusYield: Order placed" +stampFilled = metadataMsg "GeniusYield: Order filled" +stampCancel = metadataMsg "GeniusYield: Order canceled" diff --git a/geniusyield-dex-api/src/GeniusYield/Api/Dex/PartialOrderConfig.hs b/geniusyield-dex-api/src/GeniusYield/Api/Dex/PartialOrderConfig.hs index e62b97d7..00bfde26 100644 --- a/geniusyield-dex-api/src/GeniusYield/Api/Dex/PartialOrderConfig.hs +++ b/geniusyield-dex-api/src/GeniusYield/Api/Dex/PartialOrderConfig.hs @@ -6,12 +6,30 @@ Maintainer : support@geniusyield.co Stability : develop -} module GeniusYield.Api.Dex.PartialOrderConfig ( + PORef (..), + SomePORef (..), + withSomePORef, + PORefs (..), PocdException (..), - -- partialOrderConfigAddr', fetchPartialOrderConfig, + unsafeFetchPartialOrderConfig, + fetchPartialOrderConfig', + unsafeFetchPartialOrderConfig', + RefPocd (..), + SomeRefPocd (..), + withSomeRefPocd, + RefPocds, + selectV1RefPocd, + selectV1_1RefPocd, + selectRefPocd, + selectRefPocd', + selectPor, + selectPor', + fetchPartialOrderConfigs, ) where import Control.Monad.Reader (ask) +import Data.Strict.Tuple (Pair (..)) import Data.Text qualified as Txt import GeniusYield.Api.Dex.Types import GeniusYield.HTTP.Errors (GYApiError (..), IsGYApiError (..)) @@ -20,6 +38,7 @@ import GeniusYield.Scripts.Dex.PartialOrderConfig ( HasPartialOrderConfigAddr (getPartialOrderConfigAddr), PartialOrderConfigInfoF (..), ) +import GeniusYield.Scripts.Dex.Version import GeniusYield.TxBuilder ( GYTxQueryMonad (utxosAtAddressWithDatums), addressFromPlutus', @@ -34,6 +53,31 @@ import GeniusYield.Types ( ) import Network.HTTP.Types (status400) +data PORef (v ∷ POCVersion) = PORef + { -- | The reference NFT. + porRefNft ∷ !GYAssetClass, + -- | The location of the reference NFT minting policy reference script. + porMintRef ∷ !GYTxOutRef, + -- | The location of the validator reference script. + porValRef ∷ !GYTxOutRef + } + deriving stock (Show, Generic) + deriving anyclass (FromJSON, ToJSON) + +data SomePORef = ∀ v. SingPOCVersionI v ⇒ SomePORef (PORef v) + +withSomePORef ∷ SomePORef → (∀ v. SingPOCVersionI v ⇒ PORef v → r) → r +withSomePORef (SomePORef por) f = f por + +data PORefs = PORefs + { -- | For the V1 version of partial order family of contract. + porV1 ∷ !(PORef 'POCVersion1), + -- | For the V1_1 version of partial order family of contract. + porV1_1 ∷ !(PORef 'POCVersion1_1) + } + deriving stock (Show, Generic) + deriving anyclass (FromJSON, ToJSON) + newtype PocdException = PocdException GYAssetClass deriving stock (Show) deriving anyclass (Exception) @@ -43,24 +87,72 @@ instance IsGYApiError PocdException where GYApiError { gaeErrorCode = "PARTIAL_ORDER_CONFIG_NOT_FOUND", gaeHttpStatus = status400, - gaeMsg = Txt.pack $ "Partial order config not found for NFT: " <> show nftToken + gaeMsg = Txt.pack $ printf "Partial order config not found for NFT: %s" nftToken } --- partialOrderConfigAddr' ∷ GYDexApiQueryMonad m a ⇒ GYAssetClass → m GYAddress --- partialOrderConfigAddr' nftToken = do --- nid ← networkId --- a ← ask --- pure $ partialOrderConfigAddr a nid nftToken +newtype RefPocd (v ∷ POCVersion) = RefPocd (Pair GYTxOutRef (PartialOrderConfigInfoF GYAddress)) + +data SomeRefPocd = ∀ v. SingPOCVersionI v ⇒ SomeRefPocd (RefPocd v) + +withSomeRefPocd ∷ SomeRefPocd → (∀ v. SingPOCVersionI v ⇒ RefPocd v → r) → r +withSomeRefPocd (SomeRefPocd por) f = f por + +newtype RefPocds = RefPocds (Pair (RefPocd 'POCVersion1) (RefPocd 'POCVersion1_1)) + +selectV1RefPocd ∷ RefPocds → RefPocd 'POCVersion1 +selectV1RefPocd (RefPocds (p :!: _)) = p + +selectV1_1RefPocd ∷ RefPocds → RefPocd 'POCVersion1_1 +selectV1_1RefPocd (RefPocds (_ :!: p)) = p -fetchPartialOrderConfig ∷ GYDexApiQueryMonad m a ⇒ GYAssetClass → m (GYTxOutRef, PartialOrderConfigInfoF GYAddress) -fetchPartialOrderConfig nftToken = do - -- addr ← partialOrderConfigAddr' nftToken +selectRefPocd ∷ RefPocds → POCVersion → SomeRefPocd +selectRefPocd refPocds pocVersion = withSomeSingPOCVersion (toSingPOCVersion pocVersion) (\(_ ∷ SingPOCVersion v) → SomeRefPocd (selectRefPocd' @v refPocds)) + +selectRefPocd' ∷ ∀ v. SingPOCVersionI v ⇒ RefPocds → RefPocd v +selectRefPocd' refPocds = case (singPOCVersion @v) of + SingPOCVersion1 → selectV1RefPocd refPocds + SingPOCVersion1_1 → selectV1_1RefPocd refPocds + +selectPor ∷ PORefs → POCVersion → SomePORef +selectPor pors pocVersion = withSomeSingPOCVersion (toSingPOCVersion pocVersion) (\(_ ∷ SingPOCVersion v) → SomePORef (selectPor' @v pors)) + +selectPor' ∷ ∀ v. SingPOCVersionI v ⇒ PORefs → PORef v +selectPor' PORefs {..} = case (singPOCVersion @v) of + SingPOCVersion1 → porV1 + SingPOCVersion1_1 → porV1_1 + +fetchPartialOrderConfig ∷ GYDexApiQueryMonad m a ⇒ POCVersion → PORefs → m SomeRefPocd +fetchPartialOrderConfig pocVersion pors = + let SomePORef PORef {..} = selectPor pors pocVersion + in unsafeFetchPartialOrderConfig pocVersion porRefNft + +-- | Unsafe as it takes NFT's asset class where this NFT might not belong to the given version. +unsafeFetchPartialOrderConfig ∷ GYDexApiQueryMonad m a ⇒ POCVersion → GYAssetClass → m SomeRefPocd +unsafeFetchPartialOrderConfig pocVersion nftToken = + withSomeSingPOCVersion (toSingPOCVersion pocVersion) $ \(_ ∷ SingPOCVersion v) → SomeRefPocd <$> unsafeFetchPartialOrderConfig' @v nftToken + +-- | Unsafe as it takes NFT's asset class where this NFT might not belong to the given version. +unsafeFetchPartialOrderConfig' ∷ ∀ v m a. (GYDexApiQueryMonad m a, SingPOCVersionI v) ⇒ GYAssetClass → m (RefPocd v) +unsafeFetchPartialOrderConfig' nftToken = do a ← ask - let addr = getPartialOrderConfigAddr a + let pocVersion = fromSingPOCVersion $ singPOCVersion @v + addr = getPartialOrderConfigAddr a pocVersion utxos ← utxosAtAddressWithDatums addr $ Just nftToken case utxos of [p@(utxo, Just _)] → do (_, _, d') ← utxoDatumPure' p feeAddr ← addressFromPlutus' $ pociFeeAddr d' - pure (utxoRef utxo, feeAddr <$ d') + pure $ RefPocd $ utxoRef utxo :!: feeAddr <$ d' _ → throwAppError $ PocdException nftToken + +fetchPartialOrderConfig' ∷ ∀ v m a. (GYDexApiQueryMonad m a, SingPOCVersionI v) ⇒ PORefs → m (RefPocd v) +fetchPartialOrderConfig' pors = do + let pocVersion = fromSingPOCVersion $ singPOCVersion @v + SomePORef PORef {..} = selectPor pors pocVersion + unsafeFetchPartialOrderConfig' @v porRefNft + +fetchPartialOrderConfigs ∷ GYDexApiQueryMonad m a ⇒ PORefs → m RefPocds +fetchPartialOrderConfigs pors = do + refPocd1 ← fetchPartialOrderConfig' @'POCVersion1 pors + refPocd1_1 ← fetchPartialOrderConfig' @'POCVersion1_1 pors + pure $ RefPocds $ refPocd1 :!: refPocd1_1 diff --git a/geniusyield-dex-api/src/GeniusYield/Scripts/Dex/Data.hs b/geniusyield-dex-api/src/GeniusYield/Scripts/Dex/Data.hs index 22ed804b..e58b72cb 100644 --- a/geniusyield-dex-api/src/GeniusYield/Scripts/Dex/Data.hs +++ b/geniusyield-dex-api/src/GeniusYield/Scripts/Dex/Data.hs @@ -1,32 +1,11 @@ module GeniusYield.Scripts.Dex.Data ( orderValidator, - nftPolicy, + nftPolicyV1, + nftPolicyV1_1, ) where -import Data.Aeson qualified as Aeson -import Data.ByteString (ByteString) -import Data.FileEmbed -import PlutusLedgerApi.V1 (Address) -import PlutusLedgerApi.V1.Scripts (ScriptHash) -import PlutusLedgerApi.V1.Value (AssetClass) -import Ply ( - ScriptRole (..), - TypedScript, +import GeniusYield.OnChain.Common.Scripts.DEX.Data ( + nftPolicyV1, + nftPolicyV1_1, + orderValidator, ) -import Ply.Core.Internal.Reify (ReifyRole, ReifyTypenames) -import Ply.Core.TypedReader (mkTypedScript) - -readScript ∷ ∀ r l. (ReifyRole r, ReifyTypenames l) ⇒ ByteString → TypedScript r l -readScript bs = - let envelope = either (error "GeniusYield.Scripts.Dex.Data.readScript: Failed to read envelope") id $ Aeson.eitherDecodeStrict' bs - in either (error "GeniusYield.Scripts.Dex.Data.readScript: Failed to create typed script") id $ mkTypedScript @r @l envelope - -orderValidator ∷ (TypedScript 'ValidatorRole '[Address, AssetClass]) -orderValidator = - let fileBS = $(makeRelativeToProject "./data/compiled-scripts/partial-order.txt" >>= embedFile) - in readScript fileBS - -nftPolicy ∷ (TypedScript 'MintingPolicyRole '[ScriptHash, Address, AssetClass]) -nftPolicy = - let fileBS = $(makeRelativeToProject "./data/compiled-scripts/minting-policy.txt" >>= embedFile) - in readScript fileBS diff --git a/geniusyield-dex-api/src/GeniusYield/Scripts/Dex/PartialOrder.hs b/geniusyield-dex-api/src/GeniusYield/Scripts/Dex/PartialOrder.hs index 69711f23..4d4ab3cf 100644 --- a/geniusyield-dex-api/src/GeniusYield/Scripts/Dex/PartialOrder.hs +++ b/geniusyield-dex-api/src/GeniusYield/Scripts/Dex/PartialOrder.hs @@ -25,6 +25,7 @@ module GeniusYield.Scripts.Dex.PartialOrder ( import GHC.Generics (Generic) import GeniusYield.Scripts.Common import GeniusYield.Scripts.Dex.PartialOrderConfig (HasPartialOrderConfigAddr (getPartialOrderConfigAddr)) +import GeniusYield.Scripts.Dex.Version (POCVersion) import GeniusYield.Types import PlutusLedgerApi.V1 (Address, POSIXTime, PubKeyHash, TokenName, TxOutRef, Value) import PlutusLedgerApi.V1.Value (AssetClass) @@ -117,16 +118,17 @@ data PartialOrderAction PlutusTx.makeIsDataIndexed ''PartialOrderAction [('PartialCancel, 0), ('PartialFill, 1), ('CompleteFill, 2)] -partialOrderValidator ∷ (HasPartialOrderScript a, HasPartialOrderConfigAddr a) ⇒ a → GYAssetClass → GYValidator 'PlutusV2 -partialOrderValidator a ac = +partialOrderValidator ∷ (HasPartialOrderScript a, HasPartialOrderConfigAddr a) ⇒ a → POCVersion → GYAssetClass → GYValidator 'PlutusV2 +partialOrderValidator a pocVersion ac = validatorFromPly $ getPartialOrderValidator a - # addressToPlutus (getPartialOrderConfigAddr a) + # addressToPlutus (getPartialOrderConfigAddr a pocVersion) # assetClassToPlutus ac partialOrderValidatorHash ∷ (HasPartialOrderScript a, HasPartialOrderConfigAddr a) ⇒ a + → POCVersion → GYAssetClass → GYValidatorHash -partialOrderValidatorHash a = validatorHash . partialOrderValidator a +partialOrderValidatorHash a pocVersion = validatorHash . partialOrderValidator a pocVersion diff --git a/geniusyield-dex-api/src/GeniusYield/Scripts/Dex/PartialOrderConfig.hs b/geniusyield-dex-api/src/GeniusYield/Scripts/Dex/PartialOrderConfig.hs index 7b80bd4a..72254a60 100644 --- a/geniusyield-dex-api/src/GeniusYield/Scripts/Dex/PartialOrderConfig.hs +++ b/geniusyield-dex-api/src/GeniusYield/Scripts/Dex/PartialOrderConfig.hs @@ -7,40 +7,27 @@ Stability : develop -} module GeniusYield.Scripts.Dex.PartialOrderConfig ( -- * Typeclass - HasPartialOrderConfigScript (..), HasPartialOrderConfigAddr (..), -- * Datum PartialOrderConfigDatum (..), PartialOrderConfigInfoF (..), PartialOrderConfigInfo, - - -- * Validator - mkPartialOrderConfigValidator, - - -- * Address - partialOrderConfigAddr, - partialOrderConfigPlutusAddr, ) where import GHC.Generics (Generic) import GeniusYield.Scripts.Dex.PartialOrderConfig.Internal (PartialOrderConfigDatum (..)) +import GeniusYield.Scripts.Dex.Version (POCVersion) import GeniusYield.Types -import PlutusCore.Version (plcVersion100) import PlutusLedgerApi.V1 qualified as Plutus -import PlutusLedgerApi.V1.Value (AssetClass) import PlutusTx ( BuiltinData, FromData (fromBuiltinData), ToData (toBuiltinData), ) -import PlutusTx qualified - -class HasPartialOrderConfigScript a where - getPartialOrderConfigValidator ∷ a → PlutusTx.CompiledCode (AssetClass → BuiltinData → BuiltinData → BuiltinData → ()) class HasPartialOrderConfigAddr a where - getPartialOrderConfigAddr ∷ a → GYAddress + getPartialOrderConfigAddr ∷ a → POCVersion → GYAddress data PartialOrderConfigInfoF addr = PartialOrderConfigInfo { -- | Public key hashes of the potential signatories. @@ -103,15 +90,3 @@ instance FromData (PartialOrderConfigInfoF Plutus.Address) where where fromEither ∷ Either e a → Maybe a fromEither = either (const Nothing) Just - -mkPartialOrderConfigValidator ∷ HasPartialOrderConfigScript a ⇒ a → GYAssetClass → GYValidator 'PlutusV2 -mkPartialOrderConfigValidator script ac = - let val = getPartialOrderConfigValidator script `PlutusTx.unsafeApplyCode` PlutusTx.liftCode plcVersion100 (assetClassToPlutus ac) - in validatorFromPlutus val - -partialOrderConfigAddr ∷ HasPartialOrderConfigScript a ⇒ a → GYNetworkId → GYAssetClass → GYAddress -partialOrderConfigAddr script nid ac = - addressFromValidator nid $ mkPartialOrderConfigValidator script ac - -partialOrderConfigPlutusAddr ∷ HasPartialOrderConfigScript a ⇒ a → GYAssetClass → Plutus.Address -partialOrderConfigPlutusAddr script ac = addressToPlutus $ partialOrderConfigAddr script GYMainnet ac diff --git a/geniusyield-dex-api/src/GeniusYield/Scripts/Dex/PartialOrderNft.hs b/geniusyield-dex-api/src/GeniusYield/Scripts/Dex/PartialOrderNft.hs index 61be2fa5..76799242 100644 --- a/geniusyield-dex-api/src/GeniusYield/Scripts/Dex/PartialOrderNft.hs +++ b/geniusyield-dex-api/src/GeniusYield/Scripts/Dex/PartialOrderNft.hs @@ -16,6 +16,7 @@ module GeniusYield.Scripts.Dex.PartialOrderNft ( import GeniusYield.Scripts.Common import GeniusYield.Scripts.Dex.PartialOrder (HasPartialOrderScript, partialOrderValidator) import GeniusYield.Scripts.Dex.PartialOrderConfig (HasPartialOrderConfigAddr (getPartialOrderConfigAddr)) +import GeniusYield.Scripts.Dex.Version (POCVersion) import GeniusYield.Types ( GYAssetClass, GYMintingPolicy, @@ -30,18 +31,19 @@ import PlutusLedgerApi.V1.Value (AssetClass) import Ply (ScriptRole (..), TypedScript, (#)) class HasPartialOrderNftScript a where - getPartialOrderNftPolicy ∷ a → TypedScript 'MintingPolicyRole '[ScriptHash, Address, AssetClass] + getPartialOrderNftPolicy ∷ a → POCVersion → TypedScript 'MintingPolicyRole '[ScriptHash, Address, AssetClass] partialOrderNftMintingPolicy ∷ (HasPartialOrderNftScript a, HasPartialOrderScript a, HasPartialOrderConfigAddr a) ⇒ a + → POCVersion → GYAssetClass → GYMintingPolicy 'PlutusV2 -partialOrderNftMintingPolicy a ac = +partialOrderNftMintingPolicy a pocVersion ac = mintingPolicyFromPly $ - getPartialOrderNftPolicy a + getPartialOrderNftPolicy a pocVersion # scriptPlutusHash (validatorToScript v) - # addressToPlutus (getPartialOrderConfigAddr a) + # addressToPlutus (getPartialOrderConfigAddr a pocVersion) # assetClassToPlutus ac where - v = partialOrderValidator a ac + v = partialOrderValidator a pocVersion ac diff --git a/geniusyield-dex-api/src/GeniusYield/Scripts/Dex/Version.hs b/geniusyield-dex-api/src/GeniusYield/Scripts/Dex/Version.hs new file mode 100644 index 00000000..79dbc55b --- /dev/null +++ b/geniusyield-dex-api/src/GeniusYield/Scripts/Dex/Version.hs @@ -0,0 +1,87 @@ +module GeniusYield.Scripts.Dex.Version ( + POCVersion (..), + defaultPOCVersion, + SingPOCVersion (..), + toSingPOCVersion, + fromSingPOCVersion, + SingPOCVersionI (..), + SomeSingPOCVersion (..), + withSomeSingPOCVersion, +) where + +import Control.Lens ((?~)) +import Data.Aeson (FromJSON, ToJSON) +import Data.Aeson qualified as Aeson +import Data.Default (Default (..)) +import Data.GADT.Compare +import Data.Swagger qualified as Swagger +import Data.Swagger.Internal.Schema qualified as Swagger +import Data.Type.Equality ((:~:) (..)) +import GHC.Generics (Generic) +import GeniusYield.Imports ((&)) + +{- | Version of the family of partial order contracts. + +>>> maxBound :: POCVersion +POCVersion1_1 +-} +data POCVersion = POCVersion1 | POCVersion1_1 + deriving stock (Eq, Ord, Show, Enum, Bounded, Generic) + deriving anyclass (FromJSON, ToJSON) + +instance Default POCVersion where + def = maxBound + +-- | Same as @def@ but grep friendly. +defaultPOCVersion ∷ POCVersion +defaultPOCVersion = def + +instance Swagger.ToParamSchema POCVersion where + toParamSchema _ = mempty & Swagger.type_ ?~ Swagger.SwaggerString & Swagger.enum_ ?~ map Aeson.toJSON [minBound ∷ POCVersion .. maxBound] + +instance Swagger.ToSchema POCVersion where + declareNamedSchema p = + pure $ + Swagger.named "POCVersion" $ + Swagger.paramSchemaToSchema p + & Swagger.example ?~ Aeson.toJSON POCVersion1 + & Swagger.description ?~ "Version of the family of partial order contracts" + +data SingPOCVersion (v ∷ POCVersion) where + SingPOCVersion1 ∷ SingPOCVersion 'POCVersion1 + SingPOCVersion1_1 ∷ SingPOCVersion 'POCVersion1_1 + +data SomeSingPOCVersion where + SomeSingPOCVersion ∷ SingPOCVersionI v ⇒ SingPOCVersion v → SomeSingPOCVersion + +toSingPOCVersion ∷ POCVersion → SomeSingPOCVersion +toSingPOCVersion POCVersion1 = SomeSingPOCVersion SingPOCVersion1 +toSingPOCVersion POCVersion1_1 = SomeSingPOCVersion SingPOCVersion1_1 + +fromSingPOCVersion ∷ SingPOCVersion v → POCVersion +fromSingPOCVersion SingPOCVersion1 = POCVersion1 +fromSingPOCVersion SingPOCVersion1_1 = POCVersion1_1 + +withSomeSingPOCVersion ∷ SomeSingPOCVersion → (∀ v. SingPOCVersionI v ⇒ SingPOCVersion v → r) → r +withSomeSingPOCVersion (SomeSingPOCVersion s) f = f s + +class SingPOCVersionI (v ∷ POCVersion) where + singPOCVersion ∷ SingPOCVersion v + +instance SingPOCVersionI 'POCVersion1 where + singPOCVersion = SingPOCVersion1 + +instance SingPOCVersionI 'POCVersion1_1 where + singPOCVersion = SingPOCVersion1_1 + +instance GEq SingPOCVersion where + geq SingPOCVersion1 SingPOCVersion1 = Just Refl + geq SingPOCVersion1 SingPOCVersion1_1 = Nothing + geq SingPOCVersion1_1 SingPOCVersion1 = Nothing + geq SingPOCVersion1_1 SingPOCVersion1_1 = Just Refl + +instance GCompare SingPOCVersion where + gcompare SingPOCVersion1 SingPOCVersion1 = GEQ + gcompare SingPOCVersion1 SingPOCVersion1_1 = GLT + gcompare SingPOCVersion1_1 SingPOCVersion1 = GGT + gcompare SingPOCVersion1_1 SingPOCVersion1_1 = GEQ diff --git a/geniusyield-onchain/LICENSE b/geniusyield-onchain/LICENSE new file mode 100644 index 00000000..dff1fbd5 --- /dev/null +++ b/geniusyield-onchain/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2023 GYELD GMBH + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/geniusyield-onchain/README.md b/geniusyield-onchain/README.md new file mode 100644 index 00000000..c6266b04 --- /dev/null +++ b/geniusyield-onchain/README.md @@ -0,0 +1,4 @@ +# GeniusYield Onchain Smart Contracts + +* [DEX Contracts](./src/GeniusYield/OnChain/DEX/). + diff --git a/geniusyield-onchain/app/Main.hs b/geniusyield-onchain/app/Main.hs new file mode 100644 index 00000000..01931a47 --- /dev/null +++ b/geniusyield-onchain/app/Main.hs @@ -0,0 +1,55 @@ +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE OverloadedStrings #-} + +module Main where + +import Control.Exception (throwIO) +import Control.Monad.IO.Class (liftIO) +import Control.Monad.Trans.Except +import Data.Text (Text) +import qualified Data.Text as Txt +import System.Directory (createDirectoryIfMissing) +import System.FilePath (()) + +import Ply +import Ply.Core.Internal.Reify (ReifyRole, + ReifyTypenames) +import Ply.Core.Serialize +import Ply.Core.TypedReader + +import GeniusYield.OnChain.Common.Scripts + +import GeniusYield.OnChain.DEX.NFT.Compiled (optimizedNftPolicy) +import GeniusYield.OnChain.DEX.PartialOrder.Compiled (optimizedPartialOrderValidator, + optimizedPartialOrderValidatorWithTracing) +import GeniusYield.OnChain.DEX.PartialOrderConfig.Compiled (optimizedPartialOrderConfigValidator, + optimizedPartialOrderConfigValidatorWithTracing) +import GeniusYield.OnChain.DEX.PartialOrderNFT.Compiled (optimizedPartialOrderNftPolicy, + optimizedPartialOrderNftPolicyWithTracing) +import GeniusYield.OnChain.DEX.PartialOrderNFTV1_1.Compiled + +main :: IO () +main = do + createDirectoryIfMissing False scriptStorage + runExceptT writeScripts >>= \case + Left e -> throwIO . userError $ Txt.unpack e + Right a -> pure a + +writeScripts :: ExceptT Text IO () +writeScripts = do + writeScriptHelper dex'NFTFile optimizedNftPolicy + writeScriptHelper dex'PartialOrderFile optimizedPartialOrderValidator + writeScriptHelper dex'PartialOrderFileTracing optimizedPartialOrderValidatorWithTracing + writeScriptHelper dex'PartialOrderNFTFile optimizedPartialOrderNftPolicy + writeScriptHelper dex'PartialOrderNFTFileTracing optimizedPartialOrderNftPolicyWithTracing + writeScriptHelper dex'PartialOrderNFTV1_1File optimizedPartialOrderNftV1_1Policy + writeScriptHelper dex'PartialOrderNFTV1_1FileTracing optimizedPartialOrderNftV1_1PolicyWithTracing + writeScriptHelper dex'PartialOrderConfigFile optimizedPartialOrderConfigValidator + writeScriptHelper dex'PartialOrderConfigFileTracing optimizedPartialOrderConfigValidatorWithTracing + +scriptStorage :: FilePath +scriptStorage = "geniusyield-common/data/compiled-scripts" + +writeScriptHelper :: (ReifyRole rl, ReifyTypenames params) => FilePath -> Either Text (TypedScript rl params) -> ExceptT Text IO () +writeScriptHelper name script = except script + >>= liftIO . writeEnvelope (scriptStorage name) . typedScriptToEnvelope (Txt.pack name) diff --git a/geniusyield-onchain/cabal.project b/geniusyield-onchain/cabal.project new file mode 100644 index 00000000..bd956c28 --- /dev/null +++ b/geniusyield-onchain/cabal.project @@ -0,0 +1,58 @@ +repository cardano-haskell-packages + url: https://input-output-hk.github.io/cardano-haskell-packages + secure: True + root-keys: + 3e0cce471cf09815f930210f7827266fd09045445d65923e6d0238a6cd15126f + 443abb7fb497a134c343faf52f0b659bd7999bc06b7f63fa76dc99d631f9bea1 + a86a1f6ce86c449c46666bda44268677abf29b5b2d2eb5ec7af903ec2f117a82 + bcec67e8e99cabfa7764d75ad9b158d72bfacf70ca1d0ec8bc6b4406d1bf8413 + c00aae8461a256275598500ea0e187588c35a5d5d7454fb57eac18d9edb86a56 + d4a35cd3121aa00d18544bb0ac01c3e1691d618f462c46129271bccf39f7e8ee + +index-state: + , hackage.haskell.org 2022-11-14T00:20:02Z + , cardano-haskell-packages 2022-11-17T04:56:26Z + +packages: . +packages: geniusyield-common + +write-ghc-environment-files: never + +tests: true + +test-show-details: direct + +source-repository-package + type: git + --sha256: sha256-K4FNHQUpq4V0XkP1AUfnwFtOc2BMK007dv9aAgFStVs= + location: https://github.com/Plutonomicon/plutarch-plutus.git + tag: 95e40b42a1190191d0a07e3e4e938b72e6f75268 + subdir: + . + plutarch-extra + +source-repository-package + type: git + --sha256: sha256-wVFNBK6JOTKQX9Ov/SbEmN+ZA79HITQ/axLOmJUJV5o= + location: https://github.com/well-typed/plutonomy + tag: 14b9bd46084db1b785b3a99d55f7f10d38165ee8 + +source-repository-package + type: git + location: https://github.com/mlabs-haskell/ply.git + tag: b8cf54f57a3ec8543781f1b205544175f3341355 + --sha256: sha256-Fhvs1dCI9fHizJOHdqek7JmjifZHLVSutYAJR3IXNQE= + subdir: + ply-core + ply-plutarch + +with-compiler: ghc-9.2.8 + +constraints: + dependent-sum >= 0.7.1.0 + +package nothunks + flags: +vector + +package plutonomy + flags: +CHaP diff --git a/geniusyield-onchain/fixtures/nftpolicy-aggressive.txt b/geniusyield-onchain/fixtures/nftpolicy-aggressive.txt new file mode 100644 index 00000000..c6fa694f --- /dev/null +++ b/geniusyield-onchain/fixtures/nftpolicy-aggressive.txt @@ -0,0 +1,48 @@ +let* fstPair!! = fstPair# ! ! + sndPair!! = sndPair# ! ! + equalsInteger_1 = equalsInteger# 1# + chooseList!! = chooseList# ! ! + ifThenElse! = ifThenElse# ! + tailList! = tailList# ! + headList! = headList# ! + zComb = \ f -> let* x = \ y -> f (\ u -> y y u) in f (\ v -> x x v) + x_0 = \ x_1 -> zComb (\ x_2 x_3 -> chooseList!! x_3 (\ ~ -> False#) (\ ~ -> ifThenElse! (x_1 (headList! x_3)) (\ ~ -> True#) (\ ~ -> x_2 (tailList! x_3)) !) !) + x_4 = + \ x_5 -> + let* x_6 = bData# x_5 + in \ x_7 -> + zComb + (\ x_8 x_9 -> + chooseList!! x_9 (\ ~ x_a x_b -> x_b !) (\ ~ -> ifThenElse! (equalsData# (fstPair!! (headList! x_9)) x_6) (\ ~ -> let* x_c = unMapData# (sndPair!! (headList! x_9)) in \ x_d x_e -> x_d x_c) (\ ~ -> x_8 (tailList! x_9)) !) !) + x_7 + x_f = \ x_g -> tailList! (tailList! (tailList! (tailList! x_g))) + x_h = \ x_i -> sndPair!! (unConstrData# x_i) + x_j = \ x_k -> let* x_m = unConstrData# (headList! (tailList! (x_h x_k))); x_x = sndPair!! x_m in ifThenElse! (equalsInteger# 0# (fstPair!! x_m)) (\ ~ -> unBData# (headList! x_x)) (\ ~ -> ERROR) ! + tt = ()# + x_n = \ x_p x_r -> ifThenElse! x_p x_r (\ ~ -> False#) +in \ x_s x_t -> + let* x_u = unConstrData# x_s + x_x_0 = sndPair!! x_u + in ifThenElse! + (equalsInteger_1 (fstPair!! x_u)) + (\ ~ -> ifThenElse! (x_0 (\ x_v -> lessThanEqualsInteger# 0# (unIData# (sndPair!! x_v))) (x_4 (x_j x_t) (unMapData# (headList! (x_f (x_h (headList! (x_h x_t)))))) (\ x_w -> x_w) (\ ~ -> ERROR))) (\ ~ -> ERROR) (\ ~ -> tt) !) + (\ ~ -> + let* x_x = headList! (x_h x_t) + headList!_x_x = headList! x_x_0 + x_headList!_x_x = x_h headList!_x_x + x_y = sha2_256# (consByteString# (unIData# (headList! (tailList! x_headList!_x_x))) (unBData# (headList! (x_h (headList! x_headList!_x_x))))) + x_z = x_4 (x_j x_t) (unMapData# (headList! (x_f (x_h x_x)))) (\ x_10 -> x_10) (\ ~ -> ERROR) + in chooseList!! + x_z + (\ ~ -> ERROR) + (\ ~ -> + ifThenElse! + (x_n + (x_0 (\ x_11 -> equalsData# (listData# (x_h headList!_x_x)) (listData# (x_h (headList! (x_h x_11))))) (unListData# (headList! (x_h x_x)))) + (\ ~ -> x_n (nullList# ! (tailList! x_z)) (\ ~ -> x_n (equalsInteger_1 (unIData# (sndPair!! (headList! x_z)))) (\ ~ -> equalsByteString# (unBData# (fstPair!! (headList! x_z))) x_y) !) !) + !) + (\ ~ -> tt) + (\ ~ -> ERROR) + !) + !) + ! diff --git a/geniusyield-onchain/fixtures/nftpolicy-optimized.txt b/geniusyield-onchain/fixtures/nftpolicy-optimized.txt new file mode 100644 index 00000000..c6fa694f --- /dev/null +++ b/geniusyield-onchain/fixtures/nftpolicy-optimized.txt @@ -0,0 +1,48 @@ +let* fstPair!! = fstPair# ! ! + sndPair!! = sndPair# ! ! + equalsInteger_1 = equalsInteger# 1# + chooseList!! = chooseList# ! ! + ifThenElse! = ifThenElse# ! + tailList! = tailList# ! + headList! = headList# ! + zComb = \ f -> let* x = \ y -> f (\ u -> y y u) in f (\ v -> x x v) + x_0 = \ x_1 -> zComb (\ x_2 x_3 -> chooseList!! x_3 (\ ~ -> False#) (\ ~ -> ifThenElse! (x_1 (headList! x_3)) (\ ~ -> True#) (\ ~ -> x_2 (tailList! x_3)) !) !) + x_4 = + \ x_5 -> + let* x_6 = bData# x_5 + in \ x_7 -> + zComb + (\ x_8 x_9 -> + chooseList!! x_9 (\ ~ x_a x_b -> x_b !) (\ ~ -> ifThenElse! (equalsData# (fstPair!! (headList! x_9)) x_6) (\ ~ -> let* x_c = unMapData# (sndPair!! (headList! x_9)) in \ x_d x_e -> x_d x_c) (\ ~ -> x_8 (tailList! x_9)) !) !) + x_7 + x_f = \ x_g -> tailList! (tailList! (tailList! (tailList! x_g))) + x_h = \ x_i -> sndPair!! (unConstrData# x_i) + x_j = \ x_k -> let* x_m = unConstrData# (headList! (tailList! (x_h x_k))); x_x = sndPair!! x_m in ifThenElse! (equalsInteger# 0# (fstPair!! x_m)) (\ ~ -> unBData# (headList! x_x)) (\ ~ -> ERROR) ! + tt = ()# + x_n = \ x_p x_r -> ifThenElse! x_p x_r (\ ~ -> False#) +in \ x_s x_t -> + let* x_u = unConstrData# x_s + x_x_0 = sndPair!! x_u + in ifThenElse! + (equalsInteger_1 (fstPair!! x_u)) + (\ ~ -> ifThenElse! (x_0 (\ x_v -> lessThanEqualsInteger# 0# (unIData# (sndPair!! x_v))) (x_4 (x_j x_t) (unMapData# (headList! (x_f (x_h (headList! (x_h x_t)))))) (\ x_w -> x_w) (\ ~ -> ERROR))) (\ ~ -> ERROR) (\ ~ -> tt) !) + (\ ~ -> + let* x_x = headList! (x_h x_t) + headList!_x_x = headList! x_x_0 + x_headList!_x_x = x_h headList!_x_x + x_y = sha2_256# (consByteString# (unIData# (headList! (tailList! x_headList!_x_x))) (unBData# (headList! (x_h (headList! x_headList!_x_x))))) + x_z = x_4 (x_j x_t) (unMapData# (headList! (x_f (x_h x_x)))) (\ x_10 -> x_10) (\ ~ -> ERROR) + in chooseList!! + x_z + (\ ~ -> ERROR) + (\ ~ -> + ifThenElse! + (x_n + (x_0 (\ x_11 -> equalsData# (listData# (x_h headList!_x_x)) (listData# (x_h (headList! (x_h x_11))))) (unListData# (headList! (x_h x_x)))) + (\ ~ -> x_n (nullList# ! (tailList! x_z)) (\ ~ -> x_n (equalsInteger_1 (unIData# (sndPair!! (headList! x_z)))) (\ ~ -> equalsByteString# (unBData# (fstPair!! (headList! x_z))) x_y) !) !) + !) + (\ ~ -> tt) + (\ ~ -> ERROR) + !) + !) + ! diff --git a/geniusyield-onchain/fixtures/nftpolicy-original.txt b/geniusyield-onchain/fixtures/nftpolicy-original.txt new file mode 100644 index 00000000..3c5dcd87 --- /dev/null +++ b/geniusyield-onchain/fixtures/nftpolicy-original.txt @@ -0,0 +1,49 @@ +let* x = fstPair# ! ! + x_0 = sndPair# ! ! + x_1 = \ x_2 -> x_0 (unConstrData# x_2) + x_3 = headList# ! + x_4 = tailList# ! + x_5 = ifThenElse# ! + x_6 = \ x_7 -> let* x_8 = unConstrData# (x_3 (x_4 (x_1 x_7))); x_9 = x x_8; x_a = x_0 x_8 in x_5 (equalsInteger# 0# x_9) (\ ~ -> unBData# (x_3 x_a)) (\ ~ -> ERROR) ! + x_b = \ x_c -> x_4 (x_4 x_c) + x_d = \ x_e -> x_4 (x_b x_e) + x_f = \ x_g -> x_4 (x_d x_g) + x_h = \ x_i -> let* x_j = unMapData# (x_0 x_i) in \ x_k x_m -> x_k x_j + x_n = chooseList# ! ! + x_p = \ x_r -> let* x_s = \ x_t -> x_r (\ x_u -> x_t x_t x_u) in x_r (\ x_v -> x_s x_s x_v) + x_w = \ x_x x_y x_z -> x_p (\ x_10 x_11 -> x_n x_11 (\ ~ x_12 x_13 -> x_13 !) (\ ~ -> x_5 (equalsData# (x (x_3 x_11)) x_y) (\ ~ -> x_x (x_3 x_11)) (\ ~ -> x_10 (x_4 x_11)) !) !) x_z + x_14 = \ x_15 -> x_w x_h (bData# x_15) + x_16 = \ ~ -> False# + x_17 = \ x_18 x_19 -> x_5 x_18 x_19 x_16 + x_1a = \ ~ -> True# + x_1b = \ x_1c -> x_5 x_1c x_1a + x_1d = \ x_1e -> x_p (\ x_1f x_1g -> x_n x_1g (\ ~ -> False#) (\ ~ -> x_1b (x_1e (x_3 x_1g)) (\ ~ -> x_1f (x_4 x_1g)) !) !) +in \ x_1h x_1i -> + let* x_1j = unConstrData# x_1h + x_1k = x x_1j + x_1m = x_0 x_1j + in x_5 + (equalsInteger# 1# x_1k) + (\ ~ -> let* x_1n = x_6 x_1i; x_1p = x_3 (x_1 x_1i) in x_5 (x_1d (\ x_1r -> lessThanEqualsInteger# 0# (unIData# (x_0 x_1r))) (x_14 x_1n (unMapData# (x_3 (x_f (x_1 x_1p)))) (\ x_1s -> x_1s) (\ ~ -> ERROR))) (\ ~ -> ERROR) (\ ~ -> ()#) !) + (\ ~ -> + let* x_1t = x_3 (x_1 x_1i) + x_1u = x_3 x_1m + x_1v = x_1 x_1u + x_1w = sha2_256# (consByteString# (unIData# (x_3 (x_4 x_1v))) (let* x_1x = x_3 x_1v in unBData# (x_3 (x_1 x_1x)))) + x_1y = x_6 x_1i + x_1z = x_14 x_1y (unMapData# (x_3 (x_f (x_1 x_1t)))) (\ x_20 -> x_20) (\ ~ -> ERROR) + in x_n + x_1z + (\ ~ -> ERROR) + (\ ~ -> + x_5 + (x_17 + (let* x_21 = unListData# (x_3 (x_1 x_1t)) + in x_1d (\ x_22 -> let* x_23 = x_3 (x_1 x_22) in equalsData# (listData# (x_1 x_1u)) (listData# (x_1 x_23))) x_21) + (\ ~ -> x_17 (nullList# ! (x_4 x_1z)) (\ ~ -> x_17 (equalsInteger# (unIData# (x_0 (x_3 x_1z))) 1#) (\ ~ -> equalsByteString# (unBData# (x (x_3 x_1z))) x_1w) !) !) + !) + (\ ~ -> ()#) + (\ ~ -> ERROR) + !) + !) + ! diff --git a/geniusyield-onchain/fixtures/partialorder-aggressive.txt b/geniusyield-onchain/fixtures/partialorder-aggressive.txt new file mode 100644 index 00000000..c5a31dc9 --- /dev/null +++ b/geniusyield-onchain/fixtures/partialorder-aggressive.txt @@ -0,0 +1,861 @@ +let* sndPair!! = sndPair# ! ! + fstPair!! = fstPair# ! ! + constrData_0 = constrData# 0# + lessThanInteger_0 = lessThanInteger# 0# + equalsInteger_32 = equalsInteger# 32# + equalsInteger_28 = equalsInteger# 28# + equalsInteger_2 = equalsInteger# 2# + equalsInteger_1 = equalsInteger# 1# + equalsInteger_0 = equalsInteger# 0# + __ = []# + _00 = 0#d + ~__ = \ ~ -> __ + equalsData_listData___ = equalsData# (listData# []#) + cse = \ x -> x 0# 1# + chooseList!! = chooseList# ! ! + ifThenElse! = ifThenElse# ! + headList! = headList# ! + tailList! = tailList# ! + zComb = \ f -> let* x_0 = \ y -> f (\ u -> y y u) in f (\ v -> x_0 x_0 v) + x_1 = zComb (\ x_2 x_3 x_4 -> chooseList!! x_4 (\ ~ x_5 x_6 -> x_6 !) (\ ~ -> ifThenElse! (x_3 (headList! x_4)) (\ ~ -> let* x_7 = headList! x_4 in \ x_8 x_9 -> x_8 x_7) (\ ~ -> x_2 x_3 (tailList! x_4)) !) !) + x_a = zComb (\ x_b x_c x_d -> ifThenElse! (equalsInteger_0 x_d) (\ ~ -> x_c) (\ ~ -> x_b x_d (modInteger# x_c x_d)) !) + x_e = \ x_f -> sndPair!! (unConstrData# x_f) + x_g = \ x_h x_i -> equalsData# (listData# (x_e x_h)) (listData# (x_e x_i)) + x_j = \ x_k x_m -> ifThenElse! x_k x_m (\ ~ -> False#) + x_n = + \ x_p -> + let* x_r = bData# x_p + in \ x_s x_t x_u -> zComb (\ x_v x_w -> chooseList!! x_w (\ ~ -> x_s) (\ ~ -> ifThenElse! (equalsData# (fstPair!! (headList! x_w)) x_r) (\ ~ -> x_t (sndPair!! (headList! x_w))) (\ ~ -> x_v (tailList! x_w)) !) !) x_u + x_x = \ x_y x_z x_10 -> x_n x_z 0# (\ x_11 -> x_n x_10 0# unIData# (unMapData# x_11)) x_y + x_12 = \ x_13 x_14 -> x_x x_13 (unBData# (headList! (x_e x_14))) (unBData# (headList! (tailList! (x_e x_14)))) + tt = ()# + mkCons! = mkCons# ! + const = \ u1 v1 -> u1 + flipConst = \ u2 v2 -> v2 + x_15 = + \ x_16 x_17 x_18 -> + zComb + (\ x_19 x_1a -> + x_1a + (\ x_1b x_1c -> chooseList!! x_1b (\ ~ -> x_1c) (\ ~ -> x_19 flipConst (headList! x_1b) (tailList! x_1b) x_1c) !) + (\ x_1d x_1e x_1f -> + chooseList!! + x_1f + (\ ~ -> mkCons! x_1d x_1e) + (\ ~ -> + let* x_1g = headList! x_1f + x_1h = fstPair!! x_1d + x_x = fstPair!! x_1g + in ifThenElse! + (equalsData# x_1h x_x) + (\ ~ -> mkCons! (mkPairData# x_1h (x_16 (sndPair!! x_1d) (sndPair!! x_1g))) (x_19 const x_1e (tailList! x_1f))) + (\ ~ -> ifThenElse! (lessThanByteString# (unBData# x_1h) (unBData# x_x)) (\ ~ -> mkCons! x_1d (x_19 flipConst x_1g (tailList! x_1f) x_1e)) (\ ~ -> mkCons! x_1g (x_19 flipConst x_1d x_1e (tailList! x_1f))) !) + !) + !)) + const + x_17 + x_18 + x_1i = \ x_1j x_1k x_1m -> x_15 (\ x_1n x_1p -> mapData# (x_15 (\ x_1r x_1s -> iData# (x_1j (unIData# x_1r) (unIData# x_1s))) (unMapData# x_1n) (unMapData# x_1p))) x_1k x_1m + x_1t = subtractInteger# 0# + x_1u = \ x_1v x_1w -> zComb (\ x_1x x_1y -> chooseList!! x_1y ~__ (\ ~ -> mkCons! (mkPairData# (fstPair!! (headList! x_1y)) (x_1v (sndPair!! (headList! x_1y)))) (x_1x (tailList! x_1y))) !) x_1w + x_1z = \ x_20 x_21 -> x_1i addInteger# x_20 (x_1u (\ x_22 -> mapData# (x_1u (\ x_23 -> iData# (x_1t (unIData# x_23))) (unMapData# x_22))) x_21) + x_24 = \ x_25 x_26 -> constrData_0 (mkCons! (bData# x_25) (mkCons! (bData# x_26) []#)) + x_27 = \ x_28 x_29 -> mkCons! (mkPairData# x_28 x_29) __ + x_2a = \ x_2b x_2c -> let* x_2d = headList! (x_e x_2b); x_2e = headList! (tailList! (x_e x_2b)) in ifThenElse! (lessThanEqualsInteger# (unIData# x_2c) 0#) ~__ (\ ~ -> x_27 x_2d (mapData# (x_27 x_2e x_2c))) ! + x_2f = \ x_2g x_2h x_2i -> zComb (\ x_2j x_2k -> chooseList!! x_2k (\ ~ x_2m x_2n -> x_2n !) (\ ~ -> ifThenElse! (equalsData# (fstPair!! (headList! x_2k)) x_2h) (\ ~ -> x_2g (headList! x_2k)) (\ ~ -> x_2j (tailList! x_2k)) !) !) x_2i + x_2p = \ x_2r -> x_2f (\ x_2s -> let* x_2t = sndPair!! x_2s in \ x_2u x_2v -> x_2u x_2t) (bData# x_2r) + x_2w = + \ x_2x x_2y -> + let* x_2z = \ x_30 x_31 -> x_j (equalsData# x_30 x_2x) (\ ~ -> x_g x_31 x_2y) ! + in \ x_32 -> + zComb + (\ x_33 x_34 -> + chooseList!! + x_34 + ~__ + (\ ~ -> + let* x_x_0 = x_e (headList! x_34) + headList!_x_x = headList! x_x_0 + x_35 = unConstrData# (headList! (tailList! (tailList! x_x_0))) + x_36 = fstPair!! x_35 + x_37 = sndPair!! x_35 + in ifThenElse! + (ifThenElse! + (equalsInteger_0 x_36) + (\ ~ -> False#) + (\ ~ -> ifThenElse! (equalsInteger_1 x_36) (\ ~ -> x_2p (unBData# (headList! x_37)) x_32 (\ x_38 -> x_2z x_38 headList!_x_x) (\ ~ -> False#)) (\ ~ -> x_2z (headList! x_37) headList!_x_x) !) + !) + (\ ~ -> unMapData# (headList! (tailList! (x_e (headList! x_34))))) + (\ ~ -> x_33 (tailList! x_34)) + !) + !) + x_39 = \ x_3a -> zComb (\ x_3b x_3c -> chooseList!! x_3c (\ ~ -> True#) (\ ~ -> x_j (x_3a (headList! x_3c)) (\ ~ -> x_3b (tailList! x_3c)) !) !) + x_3d = \ x_3e x_3f -> x_39 (\ x_3g -> x_3e (unMapData# (sndPair!! x_3g))) x_3f + x_3h = \ x_3i x_3j -> x_39 (\ x_3k -> x_3i (unIData# (sndPair!! x_3k))) x_3j + x_3m = \ x_3n x_3p -> x_3d (\ x_3r -> x_3h (lessThanEqualsInteger# 0#) x_3r) (x_1z x_3n x_3p) + x_3s = \ x_3t -> zComb (\ x_3u x_3v x_3w -> chooseList!! x_3w (\ ~ -> x_3v) (\ ~ -> x_3u (x_3t x_3v (headList! x_3w)) (tailList! x_3w)) !) + x_3x = \ x_3y -> ifThenElse! x_3y (\ ~ -> True#) + x_3z = \ x_40 -> ifThenElse! (x_3d (\ x_41 -> x_3h lessThanInteger_0 x_41) x_40) (\ ~ -> x_40) (\ ~ -> ERROR) ! + x_42 = + \ x_43 -> + zComb + (\ x_44 x_45 -> + chooseList!! x_45 (\ ~ x_46 -> x_43) (\ ~ -> let* x_47 = unBData# (fstPair!! (headList! x_45)) in \ x_48 -> ifThenElse! (x_48 x_47) (\ ~ -> ERROR) (\ ~ -> x_44 (tailList! x_45) (\ x_49 -> lessThanByteString# x_49 x_47)) !) !) + x_43 + (\ x_4a -> False#) + x_4b = \ x_4c -> zComb (\ x_4d x_4e -> chooseList!! x_4e ~__ (\ ~ -> mkCons! (x_4c (headList! x_4e)) (x_4d (tailList! x_4e))) !) + x_4f = + \ x_4g x_4h x_4i x_4j x_4k x_4m -> + x_1 + (\ x_4n -> x_g (headList! (x_e x_4n)) x_4i) + x_4g + (\ x_4p -> + let* x_4r = tailList! (x_e x_4p) + x_4s = unConstrData# (headList! (tailList! x_4r)) + x_x_1 = fstPair!! x_4s + x_x_2 = sndPair!! x_4s + x_x_3 = + x_e + (ifThenElse! + (equalsInteger_0 x_x_1) + (\ ~ -> ERROR) + (\ ~ -> + ifThenElse! + (equalsInteger_2 x_x_1) + (\ ~ -> + let* headList!_x_x_0 = headList! x_x_2 + unConstrData_headList!_x_x = unConstrData# headList!_x_x_0 + x_unConstrData_headList!_x_x = sndPair!! unConstrData_headList!_x_x + x_4t = + ifThenElse! + (equalsInteger_0 (fstPair!! unConstrData_headList!_x_x)) + (\ ~ -> + let* x_4u = + x_4b + (\ x_4v -> + let* x_4w = unConstrData# (fstPair!! x_4v) + x_4x = + x_4b + (\ x_4y -> + let* lengthOfByteString_x = lengthOfByteString# (unBData# (fstPair!! x_4y)) + x_4z = + x_4b + (\ x_50 -> + let* x_51 = unIData# (sndPair!! x_50) + in mkPairData# (ifThenElse! (lessThanEqualsInteger# (lengthOfByteString# (unBData# (fstPair!! x_50))) 32#) (\ ~ -> fstPair!! x_50) (\ ~ -> ERROR) !) (sndPair!! x_50)) + (unMapData# (sndPair!! x_4y)) + x_52 = x_42 (unMapData# (sndPair!! x_4y)) + in mkPairData# + (ifThenElse! (x_3x (equalsInteger_0 lengthOfByteString_x) (\ ~ -> equalsInteger_28 lengthOfByteString_x) !) (\ ~ -> fstPair!! x_4y) (\ ~ -> ERROR) !) + (sndPair!! x_4y)) + (unMapData# (sndPair!! x_4v)) + x_x_4 = sndPair!! x_4w + x_53 = x_42 (unMapData# (sndPair!! x_4v)) + x_54 = + ifThenElse! + (equalsInteger_0 (fstPair!! x_4w)) + (\ ~ -> + let* unConstrData_headList!_x_x_0 = unConstrData# (headList! x_x_4) + in ifThenElse! + (equalsInteger_0 (fstPair!! unConstrData_headList!_x_x_0)) + (\ ~ -> + let* x_unConstrData_headList!_x_x_0 = sndPair!! unConstrData_headList!_x_x_0 + in ifThenElse! + (equalsData_listData___ (listData# (tailList! x_unConstrData_headList!_x_x_0))) + (\ ~ -> + ifThenElse! + (equalsInteger_32 (lengthOfByteString# (unBData# (headList! x_unConstrData_headList!_x_x_0)))) + (\ ~ -> + let* tailList!_x_x = tailList! x_x_4 + x_55 = unIData# (headList! tailList!_x_x) + x_56 = chooseList!! (tailList! tailList!_x_x) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_57 = x_3z (unMapData# (sndPair!! x_4v)) + in mkPairData# (fstPair!! x_4v) (sndPair!! x_4v)) + (unMapData# (headList! x_unConstrData_headList!_x_x)) + x_58 = tailList! x_unConstrData_headList!_x_x + x_59 = headList! x_58 + x_5a = + x_4b + (\ x_5b -> + let* lengthOfByteString_x_0 = lengthOfByteString# (unBData# (fstPair!! x_5b)) + x_5c = + x_4b + (\ x_5d -> + let* x_5e = unIData# (sndPair!! x_5d) + in mkPairData# (ifThenElse! (lessThanEqualsInteger# (lengthOfByteString# (unBData# (fstPair!! x_5d))) 32#) (\ ~ -> fstPair!! x_5d) (\ ~ -> ERROR) !) (sndPair!! x_5d)) + (unMapData# (sndPair!! x_5b)) + x_5f = x_42 (unMapData# (sndPair!! x_5b)) + in mkPairData# (ifThenElse! (x_3x (equalsInteger_0 lengthOfByteString_x_0) (\ ~ -> equalsInteger_28 lengthOfByteString_x_0) !) (\ ~ -> fstPair!! x_5b) (\ ~ -> ERROR) !) (sndPair!! x_5b)) + (unMapData# x_59) + x_5g = x_42 (unMapData# x_59) + x_5h = x_3z (unMapData# x_59) + x_5i = tailList! x_58 + x_5j = unConstrData# (headList! x_5i) + x_5k = fstPair!! x_5j + x_5m = sndPair!! x_5j + x_5n = + ifThenElse! + (equalsInteger_0 x_5k) + (\ ~ -> + let* x_5p = unConstrData# (headList! x_5m) + x_5r = sndPair!! x_5p + x_5s = + ifThenElse! + (equalsInteger_0 (fstPair!! x_5p)) + (\ ~ -> + let* x_5t = unConstrData# (headList! x_5r) + in ifThenElse! + (equalsInteger_0 (fstPair!! x_5t)) + (\ ~ -> + let* x_5u = sndPair!! x_5t + in ifThenElse! + (equalsData_listData___ (listData# (tailList! x_5u))) + (\ ~ -> + ifThenElse! + (equalsInteger_32 (lengthOfByteString# (unBData# (headList! x_5u)))) + (\ ~ -> let* x_5v = tailList! x_5r; x_5w = unIData# (headList! x_5v); x_5x = chooseList!! (tailList! x_5v) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_5y = chooseList!! (tailList! x_5m) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ifThenElse! (equalsInteger_1 x_5k) (\ ~ -> let* x_5z = chooseList!! x_5m (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_60 = chooseList!! (tailList! x_5i) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + in headList!_x_x_0) + (\ ~ -> + x_2p + (unBData# (headList! x_x_2)) + x_4h + (\ x_61 -> + let* x_62 = unConstrData# x_61 + x_x_5 = sndPair!! x_62 + x_63 = + ifThenElse! + (equalsInteger_0 (fstPair!! x_62)) + (\ ~ -> + let* x_64 = + x_4b + (\ x_65 -> + let* x_66 = unConstrData# (fstPair!! x_65) + x_67 = + x_4b + (\ x_68 -> + let* lengthOfByteString_x_1 = lengthOfByteString# (unBData# (fstPair!! x_68)) + x_69 = + x_4b + (\ x_6a -> + let* x_6b = unIData# (sndPair!! x_6a) + in mkPairData# + (ifThenElse! (lessThanEqualsInteger# (lengthOfByteString# (unBData# (fstPair!! x_6a))) 32#) (\ ~ -> fstPair!! x_6a) (\ ~ -> ERROR) !) + (sndPair!! x_6a)) + (unMapData# (sndPair!! x_68)) + x_6c = x_42 (unMapData# (sndPair!! x_68)) + in mkPairData# + (ifThenElse! (x_3x (equalsInteger_0 lengthOfByteString_x_1) (\ ~ -> equalsInteger_28 lengthOfByteString_x_1) !) (\ ~ -> fstPair!! x_68) (\ ~ -> ERROR) !) + (sndPair!! x_68)) + (unMapData# (sndPair!! x_65)) + x_x_6 = sndPair!! x_66 + x_6d = x_42 (unMapData# (sndPair!! x_65)) + x_6e = + ifThenElse! + (equalsInteger_0 (fstPair!! x_66)) + (\ ~ -> + let* unConstrData_headList!_x_x_1 = unConstrData# (headList! x_x_6) + in ifThenElse! + (equalsInteger_0 (fstPair!! unConstrData_headList!_x_x_1)) + (\ ~ -> + let* x_unConstrData_headList!_x_x_1 = sndPair!! unConstrData_headList!_x_x_1 + in ifThenElse! + (equalsData_listData___ (listData# (tailList! x_unConstrData_headList!_x_x_1))) + (\ ~ -> + ifThenElse! + (equalsInteger_32 (lengthOfByteString# (unBData# (headList! x_unConstrData_headList!_x_x_1)))) + (\ ~ -> + let* tailList!_x_x_0 = tailList! x_x_6 + x_6f = unIData# (headList! tailList!_x_x_0) + x_6g = chooseList!! (tailList! tailList!_x_x_0) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_6h = x_3z (unMapData# (sndPair!! x_65)) + in mkPairData# (fstPair!! x_65) (sndPair!! x_65)) + (unMapData# (headList! x_x_5)) + tailList!_x_x_1 = tailList! x_x_5 + headList!_tailList!_x_x = headList! tailList!_x_x_1 + x_6i = + x_4b + (\ x_6j -> + let* lengthOfByteString_x_2 = lengthOfByteString# (unBData# (fstPair!! x_6j)) + x_6k = + x_4b + (\ x_6m -> + let* x_6n = unIData# (sndPair!! x_6m) + in mkPairData# (ifThenElse! (lessThanEqualsInteger# (lengthOfByteString# (unBData# (fstPair!! x_6m))) 32#) (\ ~ -> fstPair!! x_6m) (\ ~ -> ERROR) !) (sndPair!! x_6m)) + (unMapData# (sndPair!! x_6j)) + x_6p = x_42 (unMapData# (sndPair!! x_6j)) + in mkPairData# (ifThenElse! (x_3x (equalsInteger_0 lengthOfByteString_x_2) (\ ~ -> equalsInteger_28 lengthOfByteString_x_2) !) (\ ~ -> fstPair!! x_6j) (\ ~ -> ERROR) !) (sndPair!! x_6j)) + (unMapData# headList!_tailList!_x_x) + x_6r = x_42 (unMapData# headList!_tailList!_x_x) + x_6s = x_3z (unMapData# headList!_tailList!_x_x) + tailList!_tailList!_x_x = tailList! tailList!_x_x_1 + x_6t = unConstrData# (headList! tailList!_tailList!_x_x) + x_6u = fstPair!! x_6t + x_6v = sndPair!! x_6t + x_6w = + ifThenElse! + (equalsInteger_0 x_6u) + (\ ~ -> + let* x_6x = unConstrData# (headList! x_6v) + x_6y = sndPair!! x_6x + x_6z = + ifThenElse! + (equalsInteger_0 (fstPair!! x_6x)) + (\ ~ -> + let* x_70 = unConstrData# (headList! x_6y) + in ifThenElse! + (equalsInteger_0 (fstPair!! x_70)) + (\ ~ -> + let* x_71 = sndPair!! x_70 + in ifThenElse! + (equalsData_listData___ (listData# (tailList! x_71))) + (\ ~ -> + ifThenElse! + (equalsInteger_32 (lengthOfByteString# (unBData# (headList! x_71)))) + (\ ~ -> let* x_72 = tailList! x_6y; x_73 = unIData# (headList! x_72); x_74 = chooseList!! (tailList! x_72) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_75 = chooseList!! (tailList! x_6v) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ifThenElse! (equalsInteger_1 x_6u) (\ ~ -> let* x_76 = chooseList!! x_6v (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_77 = chooseList!! (tailList! tailList!_tailList!_x_x) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + in x_61) + (\ ~ -> ERROR)) + !) + !) + unMapData_headList!_x_x = unMapData# (headList! x_x_3) + in ifThenElse! + (x_3m + (x_1z (unMapData# (headList! x_4r)) (unMapData# (headList! (tailList! x_x_3)))) + (x_1i addInteger# (x_3s (\ x_78 x_79 -> x_1i addInteger# x_78 (unMapData# (sndPair!! x_79))) __ unMapData_headList!_x_x) (x_2a (x_24 ""#b ""#b) x_4j))) + (\ ~ -> x_4m unMapData_headList!_x_x) + (\ ~ -> ERROR) + !) + (\ ~ -> x_4k) + x_7a = \ x_7b -> let* x_7c = unMapData# (sndPair!! x_7b) in \ x_7d x_7e -> x_7d x_7c + x_7f = 0# + x_7g = + \ x_7h x_7i -> + zComb + (\ x_7j x_7k x_7m -> + chooseList!! + x_7k + (\ ~ -> x_39 (\ x_7n -> lessThanEqualsInteger# x_7f (unIData# (sndPair!! x_7n))) x_7m) + (\ ~ -> + let* x_7p = unIData# (sndPair!! (headList! x_7k)) + in chooseList!! + x_7m + (\ ~ -> x_j (lessThanEqualsInteger# x_7p x_7f) (\ ~ -> x_39 (\ x_7r -> lessThanEqualsInteger# (unIData# (sndPair!! x_7r)) x_7f) (tailList! x_7k)) !) + (\ ~ -> + let* x_7s = unIData# (sndPair!! (headList! x_7m)) + x_7t = unBData# (fstPair!! (headList! x_7k)) + x_7u = unBData# (fstPair!! (headList! x_7m)) + in ifThenElse! + (equalsByteString# x_7t x_7u) + (\ ~ -> x_j (lessThanEqualsInteger# x_7p x_7s) (\ ~ -> x_7j (tailList! x_7k) (tailList! x_7m)) !) + (\ ~ -> + ifThenElse! + (lessThanByteString# x_7t x_7u) + (\ ~ -> x_j (lessThanEqualsInteger# x_7p x_7f) (\ ~ -> x_7j (tailList! x_7k) x_7m) !) + (\ ~ -> x_j (lessThanEqualsInteger# x_7f x_7s) (\ ~ -> x_7j x_7k (tailList! x_7m)) !) + !) + !) + !) + !) + x_7h + x_7i + x_lessThanEqualsInteger = + \ x_7v x_7w -> + zComb + (\ x_7x x_7y x_7z -> + chooseList!! + x_7y + (\ ~ -> x_39 (\ x_80 -> x_7g __ (unMapData# (sndPair!! x_80))) x_7z) + (\ ~ -> + let* x_81 = unMapData# (sndPair!! (headList! x_7y)) + in chooseList!! + x_7z + (\ ~ -> x_j (x_7g x_81 __) (\ ~ -> x_39 (\ x_82 -> x_7g (unMapData# (sndPair!! x_82)) __) (tailList! x_7y)) !) + (\ ~ -> + let* x_83 = unMapData# (sndPair!! (headList! x_7z)) + x_84 = unBData# (fstPair!! (headList! x_7y)) + x_85 = unBData# (fstPair!! (headList! x_7z)) + in ifThenElse! + (equalsByteString# x_84 x_85) + (\ ~ -> x_j (x_7g x_81 x_83) (\ ~ -> x_7x (tailList! x_7y) (tailList! x_7z)) !) + (\ ~ -> ifThenElse! (lessThanByteString# x_84 x_85) (\ ~ -> x_j (x_7g x_81 __) (\ ~ -> x_7x (tailList! x_7y) x_7z) !) (\ ~ -> x_j (x_7g __ x_83) (\ ~ -> x_7x x_7y (tailList! x_7z)) !) !) + !) + !) + !) + x_7v + x_7w + x_86 = \ x_87 x_88 x_89 x_8a x_8b -> x_1i addInteger# (x_2a (x_24 ""#b ""#b) x_89) (x_1i addInteger# (x_2a x_87 x_8a) (x_2a x_88 x_8b)) + x_8c = \ x_8d x_8e -> x_8d (\ x_8f x_8g -> x_8e (\ x_8h x_8i -> lessThanInteger# (multiplyInteger# x_8i x_8f) (multiplyInteger# x_8h x_8g))) + x_8j = \ x_8k x_8m -> x_8k (\ x_8n x_8p -> x_8m (\ x_8r x_8s -> equalsInteger# (multiplyInteger# x_8s x_8n) (multiplyInteger# x_8r x_8p))) + x_8t = \ x_8u -> ifThenElse! (lessThanEqualsInteger# x_8u -1#) (\ ~ -> x_1t x_8u) (\ ~ -> x_8u) ! + x_8v = + \ x_8w x_8x -> + x_8w + (\ x_8y x_8z -> + x_8x + (\ x_90 x_91 -> + let* x_92 = multiplyInteger# x_8y x_90 + x_93 = multiplyInteger# x_8z x_91 + x_94 = x_8t x_92 + x_95 = x_8t x_93 + x_96 = x_a (ifThenElse! (lessThanEqualsInteger# x_94 x_95) (\ ~ -> x_95) (\ ~ -> x_94) !) (ifThenElse! (lessThanEqualsInteger# x_94 x_95) (\ ~ -> x_94) (\ ~ -> x_95) !) + x_97 = ifThenElse! (equalsInteger_0 x_93) (\ ~ -> 0#) (\ ~ -> ifThenElse! (lessThanEqualsInteger# x_93 0#) (\ ~ -> -1#) (\ ~ -> 1#) !) ! + x_98 = multiplyInteger# x_97 (divideInteger# x_92 x_96) + x_99 = multiplyInteger# x_97 (divideInteger# x_93 x_96) + in \ x_9a -> x_9a x_98 x_99)) + x_9b = \ x_9c x_9d -> x_9d x_9c 1# + x_9e = \ x_9f -> equalsInteger_1 (fstPair!! (unConstrData# x_9f)) + x_9g = + \ x_9h x_9i -> + let* x_9j = x_e x_9h + x_9k = x_e x_9i + headList!_x = headList! x_9j + headList!_x_0 = headList! x_9k + x_9m = unConstrData# headList!_x + x_9n = unConstrData# headList!_x_0 + x_x_7 = fstPair!! x_9m + x_x_8 = fstPair!! x_9n + in ifThenElse! + (ifThenElse! + (lessThanInteger# x_x_7 x_x_8) + (\ ~ -> True#) + (\ ~ -> + ifThenElse! + (equalsInteger# x_x_7 x_x_8) + (\ ~ -> let* x_x_9 = sndPair!! x_9m; x_x_a = sndPair!! x_9n in ifThenElse! (equalsInteger_1 x_x_7) (\ ~ -> lessThanInteger# (unIData# (headList! x_x_9)) (unIData# (headList! x_x_a))) (\ ~ -> False#) !) + (\ ~ -> False#) + !) + !) + (\ ~ -> True#) + (\ ~ -> + let* x_9p = unConstrData# headList!_x + x_x_b = fstPair!! x_9p + x_x_c = sndPair!! x_9p + in ifThenElse! + (ifThenElse! + (equalsInteger_1 x_x_b) + (\ ~ -> let* x_9r = unConstrData# headList!_x_0; x_x_d = sndPair!! x_9r in ifThenElse! (equalsInteger_1 (fstPair!! x_9r)) (\ ~ -> equalsData# (listData# x_x_c) (listData# x_x_d)) (\ ~ -> False#) !) + (\ ~ -> + ifThenElse! + (equalsInteger_2 x_x_b) + (\ ~ -> let* x_9s = unConstrData# headList!_x_0; x_x_e = sndPair!! x_9s in ifThenElse! (equalsInteger_2 (fstPair!! x_9s)) (\ ~ -> equalsData# (listData# x_x_c) (listData# x_x_e)) (\ ~ -> False#) !) + (\ ~ -> let* x_9t = unConstrData# headList!_x_0; x_x_f = sndPair!! x_9t in ifThenElse! (equalsInteger_0 (fstPair!! x_9t)) (\ ~ -> equalsData# (listData# x_x_c) (listData# x_x_f)) (\ ~ -> False#) !) + !) + !) + (\ ~ -> ifThenElse! (x_9e (headList! (tailList! x_9j))) (x_9e (headList! (tailList! x_9k))) True#) + (\ ~ -> False#) + !) + ! + x_9u = \ x_9v x_9w -> let* x_9x = x_e x_9v; x_9y = x_e x_9w in x_j (x_9g (headList! x_9x) (headList! x_9y)) (\ ~ -> x_9g (headList! (tailList! x_9y)) (headList! (tailList! x_9x))) ! + x_9z = \ x_a0 -> constrData# (ifThenElse! x_a0 1# 0#) []# + x_a1 = \ x_a2 -> constrData_0 (mkCons! (constrData# 1# (mkCons! (iData# x_a2) []#)) (mkCons! (x_9z True#) []#)) + x_a3 = + \ x_a4 x_a5 -> + let* x_a6 = unConstrData# x_a5 + x_x_g = sndPair!! x_a6 + in ifThenElse! (equalsInteger_1 (fstPair!! x_a6)) (\ ~ -> True#) (\ ~ -> x_9u (constrData_0 (mkCons! (x_a1 (unIData# (headList! x_x_g))) (mkCons! (constrData_0 (mkCons! (constrData# 2# []#) (mkCons! (x_9z True#) []#))) []#))) x_a4) ! + x_a7 = + \ x_a8 x_a9 -> + let* x_aa = unConstrData# x_a9 + x_x_h = sndPair!! x_aa + in ifThenElse! (equalsInteger_1 (fstPair!! x_aa)) (\ ~ -> True#) (\ ~ -> x_9u (constrData_0 (mkCons! (constrData_0 (mkCons! (constrData_0 []#) (mkCons! (x_9z True#) []#))) (mkCons! (x_a1 (unIData# (headList! x_x_h))) []#))) x_a8) ! +in \ x_ab x_ac x_ad -> + let* x_ae = x_e x_ab + tailList!_x = tailList! x_ae + tailList!_tailList!_x = tailList! tailList!_x + x_af = tailList! tailList!_tailList!_x + x_ag = tailList! x_af + x_ah = tailList! x_ag + x_ai = tailList! x_ah + x_aj = tailList! x_ai + x_ak = tailList! x_aj + x_am = tailList! x_ak + x_an = tailList! x_am + x_ap = tailList! x_an + x_ar = tailList! x_ap + x_as = tailList! x_ar + x_at = x_e x_ad + x_au = unConstrData# (headList! (tailList! x_at)) + x_av = sndPair!! x_au + in ifThenElse! + (equalsInteger_1 (fstPair!! x_au)) + (\ ~ -> + let* x_aw = headList! x_av + x_headList!_x = x_e (headList! x_at) + tailList!_x_headList!_x = tailList! x_headList!_x + x_ax = tailList! tailList!_x_headList!_x + x_ay = tailList! (tailList! x_ax) + x_az = tailList! (tailList! (tailList! x_ay)) + x_b0 = tailList! x_az + in x_1 + (\ x_b1 -> x_g x_aw (headList! (x_e x_b1))) + (unListData# (headList! x_headList!_x)) + (\ x_b2 -> + let* x_b3 = unBData# (headList! x_aj) + x_b4 = x_e (headList! (tailList! (x_e x_b2))) + x_b5 = unMapData# (headList! (tailList! x_b4)) + x_x_x = + tailList! + (tailList! + (x_e + (x_1 + (\ x_b6 -> + let* x_x_i = x_e (headList! (tailList! (x_e x_b6))) + in x_j + (x_g (headList! x_x_i) <0 <0 "\168\129\214\&6\159\167\&17}\130\216\ACK\216\222\178\ACKxx\DC2\154^-\249l%\229\160\142">, <1>>#d) + (\ ~ -> equalsInteger_1 (x_12 (unMapData# (headList! (tailList! x_x_i))) <0 "\190\CAN\194\156\DEL\SI\252\165\195\230\205V\249}\240\248*1\227\ETB\233\155\250\ETX\ESC;\SI\227", "47454e53">#d)) + !) + (unListData# (headList! tailList!_x_headList!_x)) + (\ x_b7 -> + let* unConstrData_headList!_x_x_x = unConstrData# (headList! (tailList! (tailList! (x_e (headList! (tailList! (x_e x_b7))))))) + x_b8 = sndPair!! unConstrData_headList!_x_x_x + in ifThenElse! (equalsInteger_2 (fstPair!! unConstrData_headList!_x_x_x)) (\ ~ -> headList! x_b8) (\ ~ -> ERROR) !) + (\ ~ -> ERROR)))) + unBData_headList!_x_x_x = unBData# (headList! x_x_x) + headList!_tailList!_x_x_x = headList! (tailList! x_x_x) + in ifThenElse! + (equalsInteger_1 (x_x x_b5 unBData_headList!_x_x_x x_b3)) + (\ ~ -> + let* x_b9 = unMapData# (headList! (tailList! (tailList! x_b0))) + x_ba = unListData# (headList! x_ax) + x_bb = unMapData# (headList! x_ay) + x_bc = x_x x_bb unBData_headList!_x_x_x x_b3 + x_bd = unIData# (headList! x_ag) + x_be = headList! tailList!_tailList!_x + x_bf = headList! x_ah + x_bg = headList! x_ai + headList!_tailList!_x = headList! tailList!_x + x_bh = headList! x_as + x_bi = unConstrData# x_ac + x_x_j = fstPair!! x_bi + x_x_k = sndPair!! x_bi + x_bj = \ x_bk -> x_1z x_b5 (x_1i addInteger# (x_2a (x_24 unBData_headList!_x_x_x x_b3) 1#d) (x_1i addInteger# (x_2a x_be (iData# x_bd)) x_bk)) + x_bm = + \ x_bn -> + let* x_bp = x_e x_bg + x_br = unIData# (headList! x_bp) + x_bs = unIData# (headList! (tailList! x_bp)) + x_bt = x_8v (x_9b x_bn) (\ x_bu -> x_bu x_br x_bs) + x_x_m = x_bt quotientInteger# + in ifThenElse! (x_8c x_bt cse) (\ ~ -> x_x_m) (\ ~ -> ifThenElse! (x_8j x_bt (x_9b (x_bt quotientInteger#))) (\ ~ -> x_x_m) (\ ~ -> addInteger# 1# x_x_m) !) ! + in ifThenElse! + (equalsInteger_0 x_x_j) + (\ ~ -> + let* bData_unBData_headList!_x = bData# (unBData# (headList! x_ae)) + in ifThenElse! + (zComb + (\ x_bv x_bw -> chooseList!! x_bw (\ ~ -> False#) (\ ~ -> ifThenElse! (equalsData# (headList! x_bw) bData_unBData_headList!_x) (\ ~ -> True#) (\ ~ -> x_bv (tailList! x_bw)) !) !) + (unListData# (headList! x_b0))) + (\ ~ -> + ifThenElse! + (equalsInteger# x_bc (x_1t 1#)) + (\ ~ -> + let* x_bx = x_e x_bh + x_by = tailList! x_bx + x_bz = headList! x_bx + x_c0 = headList! x_by + x_c1 = headList! (tailList! x_by) + in ifThenElse! + (x_3m (x_2w x_aw headList!_tailList!_x x_b9 x_ba) (x_bj (x_86 x_be x_bf x_bz x_c0 x_c1))) + (\ ~ -> + ifThenElse! + (x_3x (equalsInteger_0 (unIData# (headList! x_an))) (\ ~ -> x_g x_bh (constrData_0 (mkCons! _00 (mkCons! _00 (mkCons! _00 []#))))) !) + (\ ~ -> tt) + (\ ~ -> + ifThenElse! + (x_4f + x_ba + x_b9 + headList!_tailList!_x_x_x + _00 + False# + (\ x_c2 -> + x_2f + x_7a + x_aw + x_c2 + (\ x_c3 -> + let* x_c4 = unIData# x_c0 + x_c5 = unIData# (headList! x_af) + x_c6 = x_8v (x_9b x_bd) (\ x_c7 -> x_c7 x_c4 x_c5) + x_x_n = x_c6 quotientInteger# + in x_lessThanEqualsInteger + (x_86 + x_be + x_bf + x_bz + (iData# + (subtractInteger# + (unIData# x_c0) + (ifThenElse! + (x_8c x_c6 cse) + (\ ~ -> ifThenElse! (x_8j x_c6 (x_9b (x_c6 quotientInteger#))) (\ ~ -> x_x_n) (\ ~ -> subtractInteger# x_x_n 1#) !) + (\ ~ -> x_x_n) + !))) + x_c1) + x_c3) + (\ ~ -> False#))) + (\ ~ -> tt) + (\ ~ -> ERROR) + !) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_x_j) + (\ ~ -> + let* unIData_headList!_x_x = unIData# (headList! x_x_k) + in ifThenElse! + (lessThanInteger_0 unIData_headList!_x_x) + (\ ~ -> + ifThenElse! + (lessThanInteger# unIData_headList!_x_x x_bd) + (\ ~ -> + let* x_c8 = headList! x_az + in ifThenElse! + (x_a3 x_c8 (headList! x_ak)) + (\ ~ -> + ifThenElse! + (x_a7 x_c8 (headList! x_am)) + (\ ~ -> + let* x_c9 = x_e x_bh + x_ca = tailList! x_c9 + x_cb = headList! x_c9 + x_cc = headList! x_ca + x_cd = unIData# (headList! (tailList! x_ca)) + x_unIData_headList!_x_x = x_bm unIData_headList!_x_x + x_ce = addInteger# (unIData# (headList! (tailList! x_as))) x_unIData_headList!_x_x + x_cf = headList! x_ar + x_cg = x_2a (x_24 ""#b ""#b) x_cf + x_ch = x_4f x_ba x_b9 headList!_tailList!_x_x_x x_cf False# (\ x_ci -> True#) + headList!_x_1 = headList! x_b4 + in zComb + (\ x_cj x_ck -> + chooseList!! + x_ck + (\ ~ x_cm x_cn x_cp -> x_cp !) + (\ ~ x_cr -> + let* x_x_p = x_e (headList! x_ck) + in ifThenElse! + (x_g headList!_x_1 (headList! x_x_p)) + (\ ~ -> + x_2f + x_7a + (bData# unBData_headList!_x_x_x) + (unMapData# (headList! (tailList! x_x_p))) + (\ x_cs -> + chooseList!! + x_cs + (\ ~ x_ct x_cu -> x_cu !) + (\ ~ -> + let* x_cv = unBData# (fstPair!! (headList! x_cs)) + in ifThenElse! + (equalsInteger_1 (unIData# (sndPair!! (headList! x_cs)))) + (\ ~ -> ifThenElse! (equalsInteger_0 (x_x x_bb unBData_headList!_x_x_x x_cv)) (\ ~ x_cw x_cx -> x_cw x_cv) (\ ~ x_cy x_cz -> x_cz !) !) + (\ ~ x_d0 x_d1 -> x_d1 !) + !) + !) + (\ ~ x_d2 x_d3 -> x_d3 !)) + (\ ~ x_d4 x_d5 -> x_d5 !) + ! + (\ x_d6 -> + ifThenElse! + (equalsByteString# x_d6 x_b3) + (\ ~ -> let* x_d7 = headList! x_ck in \ x_d8 x_d9 -> x_d8 (\ x_da -> x_da x_cr x_d7)) + (\ ~ -> x_cj (tailList! x_ck) False#) + !) + (\ ~ -> x_cj (tailList! x_ck) x_cr)) + !) + x_ba + True# + (\ x_db -> + x_db + (\ x_dc x_dd -> + let* x_de = x_1i addInteger# (x_2a x_bf (iData# x_unIData_headList!_x_x)) (x_1z x_b5 (x_2a x_be (iData# unIData_headList!_x_x))) + in ifThenElse! + (x_j x_dc (\ ~ -> ifThenElse! x_ch False# True#) !) + (\ ~ -> let* x_df = x_1i addInteger# x_de x_cg; x_dg = iData# (addInteger# (unIData# x_cb) (unIData# x_cf)) in \ x_dh -> x_dh x_df x_dg) + (\ ~ x_di -> x_di x_de x_cb) + ! + (\ x_dj x_dk -> + let* x_dm = tailList! (x_e x_dd) + x_dn = unConstrData# (headList! (tailList! x_dm)) + x_dp = fstPair!! x_dn + x_dr = sndPair!! x_dn + x_ds = + ifThenElse! + (equalsInteger_0 x_dp) + (\ ~ -> ERROR) + (\ ~ -> ifThenElse! (equalsInteger_2 x_dp) (\ ~ -> headList! x_dr) (\ ~ -> x_2p (unBData# (headList! x_dr)) x_b9 (\ x_dt -> x_dt) (\ ~ -> ERROR)) !) + ! + unMapData_headList!_x = unMapData# (headList! x_dm) + x_du = x_1z unMapData_headList!_x x_dj + x_dv = x_12 x_du x_bf + x_dw = ifThenElse! (x_g x_bf (x_24 ""#b ""#b)) (\ ~ -> 0#) (\ ~ -> x_12 x_du (x_24 ""#b ""#b)) ! + in ifThenElse! + (x_3m unMapData_headList!_x x_dj) + (\ ~ -> + ifThenElse! + (equalsData# + x_ds + (constrData_0 + (mkCons! + (headList! x_ae) + (mkCons! + headList!_tailList!_x + (mkCons! + x_be + (mkCons! + (headList! x_af) + (mkCons! + (iData# (subtractInteger# x_bd unIData_headList!_x_x)) + (mkCons! + x_bf + (mkCons! + x_bg + (mkCons! + (bData# x_b3) + (mkCons! + (headList! x_ak) + (mkCons! + (headList! x_am) + (mkCons! + (iData# (addInteger# (unIData# (headList! x_an)) 1#)) + (mkCons! + (headList! x_ap) + (mkCons! + x_cf + (mkCons! + (constrData_0 + (mkCons! + (iData# (addInteger# (unIData# x_dk) x_dw)) + (mkCons! x_cc (mkCons! (iData# (addInteger# x_cd x_dv)) []#)))) + (mkCons! (iData# x_ce) []#))))))))))))))))) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger# + (x_3s + (\ x_dx x_dy -> + addInteger# + x_dx + (zComb + (\ x_dz x_e0 x_e1 -> chooseList!! x_e1 (\ ~ -> x_e0) (\ ~ -> x_dz (addInteger# x_e0 1#) (tailList! x_e1)) !) + 0# + (unMapData# (sndPair!! x_dy)))) + 0# + unMapData_headList!_x) + 10#) + (\ ~ -> tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !))) + (\ ~ -> ERROR)) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger# x_bc (x_1t 1#)) + (\ ~ -> + let* x_e2 = headList! x_az + in ifThenElse! + (x_a3 x_e2 (headList! x_ak)) + (\ ~ -> + ifThenElse! + (x_a7 x_e2 (headList! x_am)) + (\ ~ -> + let* x_e3 = x_e x_bh + x_e4 = tailList! x_e3 + x_e5 = x_86 x_be x_bf (headList! x_e3) (headList! x_e4) (headList! (tailList! x_e4)) + in ifThenElse! + (x_3m (x_2w x_aw headList!_tailList!_x x_b9 x_ba) (x_1i addInteger# (x_bj x_e5) (x_2a x_bf (iData# (x_bm x_bd))))) + (\ ~ -> + let* x_e6 = headList! x_ar + x_e7 = x_g x_bh (constrData_0 (mkCons! _00 (mkCons! _00 (mkCons! _00 []#)))) + in ifThenElse! + (x_4f + x_ba + x_b9 + headList!_tailList!_x_x_x + x_e6 + (x_j x_e7 (\ ~ -> equalsData# x_e6 _00) !) + (\ x_e8 -> x_2f x_7a x_aw x_e8 (\ x_e9 -> x_lessThanEqualsInteger x_e5 x_e9) (\ ~ -> x_e7))) + (\ ~ -> tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + !) + !) + (\ ~ -> tt) + !) + (\ ~ -> ERROR)) + (\ ~ -> ERROR) + ! diff --git a/geniusyield-onchain/fixtures/partialorder-optimized.txt b/geniusyield-onchain/fixtures/partialorder-optimized.txt new file mode 100644 index 00000000..c5a31dc9 --- /dev/null +++ b/geniusyield-onchain/fixtures/partialorder-optimized.txt @@ -0,0 +1,861 @@ +let* sndPair!! = sndPair# ! ! + fstPair!! = fstPair# ! ! + constrData_0 = constrData# 0# + lessThanInteger_0 = lessThanInteger# 0# + equalsInteger_32 = equalsInteger# 32# + equalsInteger_28 = equalsInteger# 28# + equalsInteger_2 = equalsInteger# 2# + equalsInteger_1 = equalsInteger# 1# + equalsInteger_0 = equalsInteger# 0# + __ = []# + _00 = 0#d + ~__ = \ ~ -> __ + equalsData_listData___ = equalsData# (listData# []#) + cse = \ x -> x 0# 1# + chooseList!! = chooseList# ! ! + ifThenElse! = ifThenElse# ! + headList! = headList# ! + tailList! = tailList# ! + zComb = \ f -> let* x_0 = \ y -> f (\ u -> y y u) in f (\ v -> x_0 x_0 v) + x_1 = zComb (\ x_2 x_3 x_4 -> chooseList!! x_4 (\ ~ x_5 x_6 -> x_6 !) (\ ~ -> ifThenElse! (x_3 (headList! x_4)) (\ ~ -> let* x_7 = headList! x_4 in \ x_8 x_9 -> x_8 x_7) (\ ~ -> x_2 x_3 (tailList! x_4)) !) !) + x_a = zComb (\ x_b x_c x_d -> ifThenElse! (equalsInteger_0 x_d) (\ ~ -> x_c) (\ ~ -> x_b x_d (modInteger# x_c x_d)) !) + x_e = \ x_f -> sndPair!! (unConstrData# x_f) + x_g = \ x_h x_i -> equalsData# (listData# (x_e x_h)) (listData# (x_e x_i)) + x_j = \ x_k x_m -> ifThenElse! x_k x_m (\ ~ -> False#) + x_n = + \ x_p -> + let* x_r = bData# x_p + in \ x_s x_t x_u -> zComb (\ x_v x_w -> chooseList!! x_w (\ ~ -> x_s) (\ ~ -> ifThenElse! (equalsData# (fstPair!! (headList! x_w)) x_r) (\ ~ -> x_t (sndPair!! (headList! x_w))) (\ ~ -> x_v (tailList! x_w)) !) !) x_u + x_x = \ x_y x_z x_10 -> x_n x_z 0# (\ x_11 -> x_n x_10 0# unIData# (unMapData# x_11)) x_y + x_12 = \ x_13 x_14 -> x_x x_13 (unBData# (headList! (x_e x_14))) (unBData# (headList! (tailList! (x_e x_14)))) + tt = ()# + mkCons! = mkCons# ! + const = \ u1 v1 -> u1 + flipConst = \ u2 v2 -> v2 + x_15 = + \ x_16 x_17 x_18 -> + zComb + (\ x_19 x_1a -> + x_1a + (\ x_1b x_1c -> chooseList!! x_1b (\ ~ -> x_1c) (\ ~ -> x_19 flipConst (headList! x_1b) (tailList! x_1b) x_1c) !) + (\ x_1d x_1e x_1f -> + chooseList!! + x_1f + (\ ~ -> mkCons! x_1d x_1e) + (\ ~ -> + let* x_1g = headList! x_1f + x_1h = fstPair!! x_1d + x_x = fstPair!! x_1g + in ifThenElse! + (equalsData# x_1h x_x) + (\ ~ -> mkCons! (mkPairData# x_1h (x_16 (sndPair!! x_1d) (sndPair!! x_1g))) (x_19 const x_1e (tailList! x_1f))) + (\ ~ -> ifThenElse! (lessThanByteString# (unBData# x_1h) (unBData# x_x)) (\ ~ -> mkCons! x_1d (x_19 flipConst x_1g (tailList! x_1f) x_1e)) (\ ~ -> mkCons! x_1g (x_19 flipConst x_1d x_1e (tailList! x_1f))) !) + !) + !)) + const + x_17 + x_18 + x_1i = \ x_1j x_1k x_1m -> x_15 (\ x_1n x_1p -> mapData# (x_15 (\ x_1r x_1s -> iData# (x_1j (unIData# x_1r) (unIData# x_1s))) (unMapData# x_1n) (unMapData# x_1p))) x_1k x_1m + x_1t = subtractInteger# 0# + x_1u = \ x_1v x_1w -> zComb (\ x_1x x_1y -> chooseList!! x_1y ~__ (\ ~ -> mkCons! (mkPairData# (fstPair!! (headList! x_1y)) (x_1v (sndPair!! (headList! x_1y)))) (x_1x (tailList! x_1y))) !) x_1w + x_1z = \ x_20 x_21 -> x_1i addInteger# x_20 (x_1u (\ x_22 -> mapData# (x_1u (\ x_23 -> iData# (x_1t (unIData# x_23))) (unMapData# x_22))) x_21) + x_24 = \ x_25 x_26 -> constrData_0 (mkCons! (bData# x_25) (mkCons! (bData# x_26) []#)) + x_27 = \ x_28 x_29 -> mkCons! (mkPairData# x_28 x_29) __ + x_2a = \ x_2b x_2c -> let* x_2d = headList! (x_e x_2b); x_2e = headList! (tailList! (x_e x_2b)) in ifThenElse! (lessThanEqualsInteger# (unIData# x_2c) 0#) ~__ (\ ~ -> x_27 x_2d (mapData# (x_27 x_2e x_2c))) ! + x_2f = \ x_2g x_2h x_2i -> zComb (\ x_2j x_2k -> chooseList!! x_2k (\ ~ x_2m x_2n -> x_2n !) (\ ~ -> ifThenElse! (equalsData# (fstPair!! (headList! x_2k)) x_2h) (\ ~ -> x_2g (headList! x_2k)) (\ ~ -> x_2j (tailList! x_2k)) !) !) x_2i + x_2p = \ x_2r -> x_2f (\ x_2s -> let* x_2t = sndPair!! x_2s in \ x_2u x_2v -> x_2u x_2t) (bData# x_2r) + x_2w = + \ x_2x x_2y -> + let* x_2z = \ x_30 x_31 -> x_j (equalsData# x_30 x_2x) (\ ~ -> x_g x_31 x_2y) ! + in \ x_32 -> + zComb + (\ x_33 x_34 -> + chooseList!! + x_34 + ~__ + (\ ~ -> + let* x_x_0 = x_e (headList! x_34) + headList!_x_x = headList! x_x_0 + x_35 = unConstrData# (headList! (tailList! (tailList! x_x_0))) + x_36 = fstPair!! x_35 + x_37 = sndPair!! x_35 + in ifThenElse! + (ifThenElse! + (equalsInteger_0 x_36) + (\ ~ -> False#) + (\ ~ -> ifThenElse! (equalsInteger_1 x_36) (\ ~ -> x_2p (unBData# (headList! x_37)) x_32 (\ x_38 -> x_2z x_38 headList!_x_x) (\ ~ -> False#)) (\ ~ -> x_2z (headList! x_37) headList!_x_x) !) + !) + (\ ~ -> unMapData# (headList! (tailList! (x_e (headList! x_34))))) + (\ ~ -> x_33 (tailList! x_34)) + !) + !) + x_39 = \ x_3a -> zComb (\ x_3b x_3c -> chooseList!! x_3c (\ ~ -> True#) (\ ~ -> x_j (x_3a (headList! x_3c)) (\ ~ -> x_3b (tailList! x_3c)) !) !) + x_3d = \ x_3e x_3f -> x_39 (\ x_3g -> x_3e (unMapData# (sndPair!! x_3g))) x_3f + x_3h = \ x_3i x_3j -> x_39 (\ x_3k -> x_3i (unIData# (sndPair!! x_3k))) x_3j + x_3m = \ x_3n x_3p -> x_3d (\ x_3r -> x_3h (lessThanEqualsInteger# 0#) x_3r) (x_1z x_3n x_3p) + x_3s = \ x_3t -> zComb (\ x_3u x_3v x_3w -> chooseList!! x_3w (\ ~ -> x_3v) (\ ~ -> x_3u (x_3t x_3v (headList! x_3w)) (tailList! x_3w)) !) + x_3x = \ x_3y -> ifThenElse! x_3y (\ ~ -> True#) + x_3z = \ x_40 -> ifThenElse! (x_3d (\ x_41 -> x_3h lessThanInteger_0 x_41) x_40) (\ ~ -> x_40) (\ ~ -> ERROR) ! + x_42 = + \ x_43 -> + zComb + (\ x_44 x_45 -> + chooseList!! x_45 (\ ~ x_46 -> x_43) (\ ~ -> let* x_47 = unBData# (fstPair!! (headList! x_45)) in \ x_48 -> ifThenElse! (x_48 x_47) (\ ~ -> ERROR) (\ ~ -> x_44 (tailList! x_45) (\ x_49 -> lessThanByteString# x_49 x_47)) !) !) + x_43 + (\ x_4a -> False#) + x_4b = \ x_4c -> zComb (\ x_4d x_4e -> chooseList!! x_4e ~__ (\ ~ -> mkCons! (x_4c (headList! x_4e)) (x_4d (tailList! x_4e))) !) + x_4f = + \ x_4g x_4h x_4i x_4j x_4k x_4m -> + x_1 + (\ x_4n -> x_g (headList! (x_e x_4n)) x_4i) + x_4g + (\ x_4p -> + let* x_4r = tailList! (x_e x_4p) + x_4s = unConstrData# (headList! (tailList! x_4r)) + x_x_1 = fstPair!! x_4s + x_x_2 = sndPair!! x_4s + x_x_3 = + x_e + (ifThenElse! + (equalsInteger_0 x_x_1) + (\ ~ -> ERROR) + (\ ~ -> + ifThenElse! + (equalsInteger_2 x_x_1) + (\ ~ -> + let* headList!_x_x_0 = headList! x_x_2 + unConstrData_headList!_x_x = unConstrData# headList!_x_x_0 + x_unConstrData_headList!_x_x = sndPair!! unConstrData_headList!_x_x + x_4t = + ifThenElse! + (equalsInteger_0 (fstPair!! unConstrData_headList!_x_x)) + (\ ~ -> + let* x_4u = + x_4b + (\ x_4v -> + let* x_4w = unConstrData# (fstPair!! x_4v) + x_4x = + x_4b + (\ x_4y -> + let* lengthOfByteString_x = lengthOfByteString# (unBData# (fstPair!! x_4y)) + x_4z = + x_4b + (\ x_50 -> + let* x_51 = unIData# (sndPair!! x_50) + in mkPairData# (ifThenElse! (lessThanEqualsInteger# (lengthOfByteString# (unBData# (fstPair!! x_50))) 32#) (\ ~ -> fstPair!! x_50) (\ ~ -> ERROR) !) (sndPair!! x_50)) + (unMapData# (sndPair!! x_4y)) + x_52 = x_42 (unMapData# (sndPair!! x_4y)) + in mkPairData# + (ifThenElse! (x_3x (equalsInteger_0 lengthOfByteString_x) (\ ~ -> equalsInteger_28 lengthOfByteString_x) !) (\ ~ -> fstPair!! x_4y) (\ ~ -> ERROR) !) + (sndPair!! x_4y)) + (unMapData# (sndPair!! x_4v)) + x_x_4 = sndPair!! x_4w + x_53 = x_42 (unMapData# (sndPair!! x_4v)) + x_54 = + ifThenElse! + (equalsInteger_0 (fstPair!! x_4w)) + (\ ~ -> + let* unConstrData_headList!_x_x_0 = unConstrData# (headList! x_x_4) + in ifThenElse! + (equalsInteger_0 (fstPair!! unConstrData_headList!_x_x_0)) + (\ ~ -> + let* x_unConstrData_headList!_x_x_0 = sndPair!! unConstrData_headList!_x_x_0 + in ifThenElse! + (equalsData_listData___ (listData# (tailList! x_unConstrData_headList!_x_x_0))) + (\ ~ -> + ifThenElse! + (equalsInteger_32 (lengthOfByteString# (unBData# (headList! x_unConstrData_headList!_x_x_0)))) + (\ ~ -> + let* tailList!_x_x = tailList! x_x_4 + x_55 = unIData# (headList! tailList!_x_x) + x_56 = chooseList!! (tailList! tailList!_x_x) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_57 = x_3z (unMapData# (sndPair!! x_4v)) + in mkPairData# (fstPair!! x_4v) (sndPair!! x_4v)) + (unMapData# (headList! x_unConstrData_headList!_x_x)) + x_58 = tailList! x_unConstrData_headList!_x_x + x_59 = headList! x_58 + x_5a = + x_4b + (\ x_5b -> + let* lengthOfByteString_x_0 = lengthOfByteString# (unBData# (fstPair!! x_5b)) + x_5c = + x_4b + (\ x_5d -> + let* x_5e = unIData# (sndPair!! x_5d) + in mkPairData# (ifThenElse! (lessThanEqualsInteger# (lengthOfByteString# (unBData# (fstPair!! x_5d))) 32#) (\ ~ -> fstPair!! x_5d) (\ ~ -> ERROR) !) (sndPair!! x_5d)) + (unMapData# (sndPair!! x_5b)) + x_5f = x_42 (unMapData# (sndPair!! x_5b)) + in mkPairData# (ifThenElse! (x_3x (equalsInteger_0 lengthOfByteString_x_0) (\ ~ -> equalsInteger_28 lengthOfByteString_x_0) !) (\ ~ -> fstPair!! x_5b) (\ ~ -> ERROR) !) (sndPair!! x_5b)) + (unMapData# x_59) + x_5g = x_42 (unMapData# x_59) + x_5h = x_3z (unMapData# x_59) + x_5i = tailList! x_58 + x_5j = unConstrData# (headList! x_5i) + x_5k = fstPair!! x_5j + x_5m = sndPair!! x_5j + x_5n = + ifThenElse! + (equalsInteger_0 x_5k) + (\ ~ -> + let* x_5p = unConstrData# (headList! x_5m) + x_5r = sndPair!! x_5p + x_5s = + ifThenElse! + (equalsInteger_0 (fstPair!! x_5p)) + (\ ~ -> + let* x_5t = unConstrData# (headList! x_5r) + in ifThenElse! + (equalsInteger_0 (fstPair!! x_5t)) + (\ ~ -> + let* x_5u = sndPair!! x_5t + in ifThenElse! + (equalsData_listData___ (listData# (tailList! x_5u))) + (\ ~ -> + ifThenElse! + (equalsInteger_32 (lengthOfByteString# (unBData# (headList! x_5u)))) + (\ ~ -> let* x_5v = tailList! x_5r; x_5w = unIData# (headList! x_5v); x_5x = chooseList!! (tailList! x_5v) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_5y = chooseList!! (tailList! x_5m) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ifThenElse! (equalsInteger_1 x_5k) (\ ~ -> let* x_5z = chooseList!! x_5m (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_60 = chooseList!! (tailList! x_5i) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + in headList!_x_x_0) + (\ ~ -> + x_2p + (unBData# (headList! x_x_2)) + x_4h + (\ x_61 -> + let* x_62 = unConstrData# x_61 + x_x_5 = sndPair!! x_62 + x_63 = + ifThenElse! + (equalsInteger_0 (fstPair!! x_62)) + (\ ~ -> + let* x_64 = + x_4b + (\ x_65 -> + let* x_66 = unConstrData# (fstPair!! x_65) + x_67 = + x_4b + (\ x_68 -> + let* lengthOfByteString_x_1 = lengthOfByteString# (unBData# (fstPair!! x_68)) + x_69 = + x_4b + (\ x_6a -> + let* x_6b = unIData# (sndPair!! x_6a) + in mkPairData# + (ifThenElse! (lessThanEqualsInteger# (lengthOfByteString# (unBData# (fstPair!! x_6a))) 32#) (\ ~ -> fstPair!! x_6a) (\ ~ -> ERROR) !) + (sndPair!! x_6a)) + (unMapData# (sndPair!! x_68)) + x_6c = x_42 (unMapData# (sndPair!! x_68)) + in mkPairData# + (ifThenElse! (x_3x (equalsInteger_0 lengthOfByteString_x_1) (\ ~ -> equalsInteger_28 lengthOfByteString_x_1) !) (\ ~ -> fstPair!! x_68) (\ ~ -> ERROR) !) + (sndPair!! x_68)) + (unMapData# (sndPair!! x_65)) + x_x_6 = sndPair!! x_66 + x_6d = x_42 (unMapData# (sndPair!! x_65)) + x_6e = + ifThenElse! + (equalsInteger_0 (fstPair!! x_66)) + (\ ~ -> + let* unConstrData_headList!_x_x_1 = unConstrData# (headList! x_x_6) + in ifThenElse! + (equalsInteger_0 (fstPair!! unConstrData_headList!_x_x_1)) + (\ ~ -> + let* x_unConstrData_headList!_x_x_1 = sndPair!! unConstrData_headList!_x_x_1 + in ifThenElse! + (equalsData_listData___ (listData# (tailList! x_unConstrData_headList!_x_x_1))) + (\ ~ -> + ifThenElse! + (equalsInteger_32 (lengthOfByteString# (unBData# (headList! x_unConstrData_headList!_x_x_1)))) + (\ ~ -> + let* tailList!_x_x_0 = tailList! x_x_6 + x_6f = unIData# (headList! tailList!_x_x_0) + x_6g = chooseList!! (tailList! tailList!_x_x_0) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_6h = x_3z (unMapData# (sndPair!! x_65)) + in mkPairData# (fstPair!! x_65) (sndPair!! x_65)) + (unMapData# (headList! x_x_5)) + tailList!_x_x_1 = tailList! x_x_5 + headList!_tailList!_x_x = headList! tailList!_x_x_1 + x_6i = + x_4b + (\ x_6j -> + let* lengthOfByteString_x_2 = lengthOfByteString# (unBData# (fstPair!! x_6j)) + x_6k = + x_4b + (\ x_6m -> + let* x_6n = unIData# (sndPair!! x_6m) + in mkPairData# (ifThenElse! (lessThanEqualsInteger# (lengthOfByteString# (unBData# (fstPair!! x_6m))) 32#) (\ ~ -> fstPair!! x_6m) (\ ~ -> ERROR) !) (sndPair!! x_6m)) + (unMapData# (sndPair!! x_6j)) + x_6p = x_42 (unMapData# (sndPair!! x_6j)) + in mkPairData# (ifThenElse! (x_3x (equalsInteger_0 lengthOfByteString_x_2) (\ ~ -> equalsInteger_28 lengthOfByteString_x_2) !) (\ ~ -> fstPair!! x_6j) (\ ~ -> ERROR) !) (sndPair!! x_6j)) + (unMapData# headList!_tailList!_x_x) + x_6r = x_42 (unMapData# headList!_tailList!_x_x) + x_6s = x_3z (unMapData# headList!_tailList!_x_x) + tailList!_tailList!_x_x = tailList! tailList!_x_x_1 + x_6t = unConstrData# (headList! tailList!_tailList!_x_x) + x_6u = fstPair!! x_6t + x_6v = sndPair!! x_6t + x_6w = + ifThenElse! + (equalsInteger_0 x_6u) + (\ ~ -> + let* x_6x = unConstrData# (headList! x_6v) + x_6y = sndPair!! x_6x + x_6z = + ifThenElse! + (equalsInteger_0 (fstPair!! x_6x)) + (\ ~ -> + let* x_70 = unConstrData# (headList! x_6y) + in ifThenElse! + (equalsInteger_0 (fstPair!! x_70)) + (\ ~ -> + let* x_71 = sndPair!! x_70 + in ifThenElse! + (equalsData_listData___ (listData# (tailList! x_71))) + (\ ~ -> + ifThenElse! + (equalsInteger_32 (lengthOfByteString# (unBData# (headList! x_71)))) + (\ ~ -> let* x_72 = tailList! x_6y; x_73 = unIData# (headList! x_72); x_74 = chooseList!! (tailList! x_72) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_75 = chooseList!! (tailList! x_6v) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ifThenElse! (equalsInteger_1 x_6u) (\ ~ -> let* x_76 = chooseList!! x_6v (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_77 = chooseList!! (tailList! tailList!_tailList!_x_x) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + in x_61) + (\ ~ -> ERROR)) + !) + !) + unMapData_headList!_x_x = unMapData# (headList! x_x_3) + in ifThenElse! + (x_3m + (x_1z (unMapData# (headList! x_4r)) (unMapData# (headList! (tailList! x_x_3)))) + (x_1i addInteger# (x_3s (\ x_78 x_79 -> x_1i addInteger# x_78 (unMapData# (sndPair!! x_79))) __ unMapData_headList!_x_x) (x_2a (x_24 ""#b ""#b) x_4j))) + (\ ~ -> x_4m unMapData_headList!_x_x) + (\ ~ -> ERROR) + !) + (\ ~ -> x_4k) + x_7a = \ x_7b -> let* x_7c = unMapData# (sndPair!! x_7b) in \ x_7d x_7e -> x_7d x_7c + x_7f = 0# + x_7g = + \ x_7h x_7i -> + zComb + (\ x_7j x_7k x_7m -> + chooseList!! + x_7k + (\ ~ -> x_39 (\ x_7n -> lessThanEqualsInteger# x_7f (unIData# (sndPair!! x_7n))) x_7m) + (\ ~ -> + let* x_7p = unIData# (sndPair!! (headList! x_7k)) + in chooseList!! + x_7m + (\ ~ -> x_j (lessThanEqualsInteger# x_7p x_7f) (\ ~ -> x_39 (\ x_7r -> lessThanEqualsInteger# (unIData# (sndPair!! x_7r)) x_7f) (tailList! x_7k)) !) + (\ ~ -> + let* x_7s = unIData# (sndPair!! (headList! x_7m)) + x_7t = unBData# (fstPair!! (headList! x_7k)) + x_7u = unBData# (fstPair!! (headList! x_7m)) + in ifThenElse! + (equalsByteString# x_7t x_7u) + (\ ~ -> x_j (lessThanEqualsInteger# x_7p x_7s) (\ ~ -> x_7j (tailList! x_7k) (tailList! x_7m)) !) + (\ ~ -> + ifThenElse! + (lessThanByteString# x_7t x_7u) + (\ ~ -> x_j (lessThanEqualsInteger# x_7p x_7f) (\ ~ -> x_7j (tailList! x_7k) x_7m) !) + (\ ~ -> x_j (lessThanEqualsInteger# x_7f x_7s) (\ ~ -> x_7j x_7k (tailList! x_7m)) !) + !) + !) + !) + !) + x_7h + x_7i + x_lessThanEqualsInteger = + \ x_7v x_7w -> + zComb + (\ x_7x x_7y x_7z -> + chooseList!! + x_7y + (\ ~ -> x_39 (\ x_80 -> x_7g __ (unMapData# (sndPair!! x_80))) x_7z) + (\ ~ -> + let* x_81 = unMapData# (sndPair!! (headList! x_7y)) + in chooseList!! + x_7z + (\ ~ -> x_j (x_7g x_81 __) (\ ~ -> x_39 (\ x_82 -> x_7g (unMapData# (sndPair!! x_82)) __) (tailList! x_7y)) !) + (\ ~ -> + let* x_83 = unMapData# (sndPair!! (headList! x_7z)) + x_84 = unBData# (fstPair!! (headList! x_7y)) + x_85 = unBData# (fstPair!! (headList! x_7z)) + in ifThenElse! + (equalsByteString# x_84 x_85) + (\ ~ -> x_j (x_7g x_81 x_83) (\ ~ -> x_7x (tailList! x_7y) (tailList! x_7z)) !) + (\ ~ -> ifThenElse! (lessThanByteString# x_84 x_85) (\ ~ -> x_j (x_7g x_81 __) (\ ~ -> x_7x (tailList! x_7y) x_7z) !) (\ ~ -> x_j (x_7g __ x_83) (\ ~ -> x_7x x_7y (tailList! x_7z)) !) !) + !) + !) + !) + x_7v + x_7w + x_86 = \ x_87 x_88 x_89 x_8a x_8b -> x_1i addInteger# (x_2a (x_24 ""#b ""#b) x_89) (x_1i addInteger# (x_2a x_87 x_8a) (x_2a x_88 x_8b)) + x_8c = \ x_8d x_8e -> x_8d (\ x_8f x_8g -> x_8e (\ x_8h x_8i -> lessThanInteger# (multiplyInteger# x_8i x_8f) (multiplyInteger# x_8h x_8g))) + x_8j = \ x_8k x_8m -> x_8k (\ x_8n x_8p -> x_8m (\ x_8r x_8s -> equalsInteger# (multiplyInteger# x_8s x_8n) (multiplyInteger# x_8r x_8p))) + x_8t = \ x_8u -> ifThenElse! (lessThanEqualsInteger# x_8u -1#) (\ ~ -> x_1t x_8u) (\ ~ -> x_8u) ! + x_8v = + \ x_8w x_8x -> + x_8w + (\ x_8y x_8z -> + x_8x + (\ x_90 x_91 -> + let* x_92 = multiplyInteger# x_8y x_90 + x_93 = multiplyInteger# x_8z x_91 + x_94 = x_8t x_92 + x_95 = x_8t x_93 + x_96 = x_a (ifThenElse! (lessThanEqualsInteger# x_94 x_95) (\ ~ -> x_95) (\ ~ -> x_94) !) (ifThenElse! (lessThanEqualsInteger# x_94 x_95) (\ ~ -> x_94) (\ ~ -> x_95) !) + x_97 = ifThenElse! (equalsInteger_0 x_93) (\ ~ -> 0#) (\ ~ -> ifThenElse! (lessThanEqualsInteger# x_93 0#) (\ ~ -> -1#) (\ ~ -> 1#) !) ! + x_98 = multiplyInteger# x_97 (divideInteger# x_92 x_96) + x_99 = multiplyInteger# x_97 (divideInteger# x_93 x_96) + in \ x_9a -> x_9a x_98 x_99)) + x_9b = \ x_9c x_9d -> x_9d x_9c 1# + x_9e = \ x_9f -> equalsInteger_1 (fstPair!! (unConstrData# x_9f)) + x_9g = + \ x_9h x_9i -> + let* x_9j = x_e x_9h + x_9k = x_e x_9i + headList!_x = headList! x_9j + headList!_x_0 = headList! x_9k + x_9m = unConstrData# headList!_x + x_9n = unConstrData# headList!_x_0 + x_x_7 = fstPair!! x_9m + x_x_8 = fstPair!! x_9n + in ifThenElse! + (ifThenElse! + (lessThanInteger# x_x_7 x_x_8) + (\ ~ -> True#) + (\ ~ -> + ifThenElse! + (equalsInteger# x_x_7 x_x_8) + (\ ~ -> let* x_x_9 = sndPair!! x_9m; x_x_a = sndPair!! x_9n in ifThenElse! (equalsInteger_1 x_x_7) (\ ~ -> lessThanInteger# (unIData# (headList! x_x_9)) (unIData# (headList! x_x_a))) (\ ~ -> False#) !) + (\ ~ -> False#) + !) + !) + (\ ~ -> True#) + (\ ~ -> + let* x_9p = unConstrData# headList!_x + x_x_b = fstPair!! x_9p + x_x_c = sndPair!! x_9p + in ifThenElse! + (ifThenElse! + (equalsInteger_1 x_x_b) + (\ ~ -> let* x_9r = unConstrData# headList!_x_0; x_x_d = sndPair!! x_9r in ifThenElse! (equalsInteger_1 (fstPair!! x_9r)) (\ ~ -> equalsData# (listData# x_x_c) (listData# x_x_d)) (\ ~ -> False#) !) + (\ ~ -> + ifThenElse! + (equalsInteger_2 x_x_b) + (\ ~ -> let* x_9s = unConstrData# headList!_x_0; x_x_e = sndPair!! x_9s in ifThenElse! (equalsInteger_2 (fstPair!! x_9s)) (\ ~ -> equalsData# (listData# x_x_c) (listData# x_x_e)) (\ ~ -> False#) !) + (\ ~ -> let* x_9t = unConstrData# headList!_x_0; x_x_f = sndPair!! x_9t in ifThenElse! (equalsInteger_0 (fstPair!! x_9t)) (\ ~ -> equalsData# (listData# x_x_c) (listData# x_x_f)) (\ ~ -> False#) !) + !) + !) + (\ ~ -> ifThenElse! (x_9e (headList! (tailList! x_9j))) (x_9e (headList! (tailList! x_9k))) True#) + (\ ~ -> False#) + !) + ! + x_9u = \ x_9v x_9w -> let* x_9x = x_e x_9v; x_9y = x_e x_9w in x_j (x_9g (headList! x_9x) (headList! x_9y)) (\ ~ -> x_9g (headList! (tailList! x_9y)) (headList! (tailList! x_9x))) ! + x_9z = \ x_a0 -> constrData# (ifThenElse! x_a0 1# 0#) []# + x_a1 = \ x_a2 -> constrData_0 (mkCons! (constrData# 1# (mkCons! (iData# x_a2) []#)) (mkCons! (x_9z True#) []#)) + x_a3 = + \ x_a4 x_a5 -> + let* x_a6 = unConstrData# x_a5 + x_x_g = sndPair!! x_a6 + in ifThenElse! (equalsInteger_1 (fstPair!! x_a6)) (\ ~ -> True#) (\ ~ -> x_9u (constrData_0 (mkCons! (x_a1 (unIData# (headList! x_x_g))) (mkCons! (constrData_0 (mkCons! (constrData# 2# []#) (mkCons! (x_9z True#) []#))) []#))) x_a4) ! + x_a7 = + \ x_a8 x_a9 -> + let* x_aa = unConstrData# x_a9 + x_x_h = sndPair!! x_aa + in ifThenElse! (equalsInteger_1 (fstPair!! x_aa)) (\ ~ -> True#) (\ ~ -> x_9u (constrData_0 (mkCons! (constrData_0 (mkCons! (constrData_0 []#) (mkCons! (x_9z True#) []#))) (mkCons! (x_a1 (unIData# (headList! x_x_h))) []#))) x_a8) ! +in \ x_ab x_ac x_ad -> + let* x_ae = x_e x_ab + tailList!_x = tailList! x_ae + tailList!_tailList!_x = tailList! tailList!_x + x_af = tailList! tailList!_tailList!_x + x_ag = tailList! x_af + x_ah = tailList! x_ag + x_ai = tailList! x_ah + x_aj = tailList! x_ai + x_ak = tailList! x_aj + x_am = tailList! x_ak + x_an = tailList! x_am + x_ap = tailList! x_an + x_ar = tailList! x_ap + x_as = tailList! x_ar + x_at = x_e x_ad + x_au = unConstrData# (headList! (tailList! x_at)) + x_av = sndPair!! x_au + in ifThenElse! + (equalsInteger_1 (fstPair!! x_au)) + (\ ~ -> + let* x_aw = headList! x_av + x_headList!_x = x_e (headList! x_at) + tailList!_x_headList!_x = tailList! x_headList!_x + x_ax = tailList! tailList!_x_headList!_x + x_ay = tailList! (tailList! x_ax) + x_az = tailList! (tailList! (tailList! x_ay)) + x_b0 = tailList! x_az + in x_1 + (\ x_b1 -> x_g x_aw (headList! (x_e x_b1))) + (unListData# (headList! x_headList!_x)) + (\ x_b2 -> + let* x_b3 = unBData# (headList! x_aj) + x_b4 = x_e (headList! (tailList! (x_e x_b2))) + x_b5 = unMapData# (headList! (tailList! x_b4)) + x_x_x = + tailList! + (tailList! + (x_e + (x_1 + (\ x_b6 -> + let* x_x_i = x_e (headList! (tailList! (x_e x_b6))) + in x_j + (x_g (headList! x_x_i) <0 <0 "\168\129\214\&6\159\167\&17}\130\216\ACK\216\222\178\ACKxx\DC2\154^-\249l%\229\160\142">, <1>>#d) + (\ ~ -> equalsInteger_1 (x_12 (unMapData# (headList! (tailList! x_x_i))) <0 "\190\CAN\194\156\DEL\SI\252\165\195\230\205V\249}\240\248*1\227\ETB\233\155\250\ETX\ESC;\SI\227", "47454e53">#d)) + !) + (unListData# (headList! tailList!_x_headList!_x)) + (\ x_b7 -> + let* unConstrData_headList!_x_x_x = unConstrData# (headList! (tailList! (tailList! (x_e (headList! (tailList! (x_e x_b7))))))) + x_b8 = sndPair!! unConstrData_headList!_x_x_x + in ifThenElse! (equalsInteger_2 (fstPair!! unConstrData_headList!_x_x_x)) (\ ~ -> headList! x_b8) (\ ~ -> ERROR) !) + (\ ~ -> ERROR)))) + unBData_headList!_x_x_x = unBData# (headList! x_x_x) + headList!_tailList!_x_x_x = headList! (tailList! x_x_x) + in ifThenElse! + (equalsInteger_1 (x_x x_b5 unBData_headList!_x_x_x x_b3)) + (\ ~ -> + let* x_b9 = unMapData# (headList! (tailList! (tailList! x_b0))) + x_ba = unListData# (headList! x_ax) + x_bb = unMapData# (headList! x_ay) + x_bc = x_x x_bb unBData_headList!_x_x_x x_b3 + x_bd = unIData# (headList! x_ag) + x_be = headList! tailList!_tailList!_x + x_bf = headList! x_ah + x_bg = headList! x_ai + headList!_tailList!_x = headList! tailList!_x + x_bh = headList! x_as + x_bi = unConstrData# x_ac + x_x_j = fstPair!! x_bi + x_x_k = sndPair!! x_bi + x_bj = \ x_bk -> x_1z x_b5 (x_1i addInteger# (x_2a (x_24 unBData_headList!_x_x_x x_b3) 1#d) (x_1i addInteger# (x_2a x_be (iData# x_bd)) x_bk)) + x_bm = + \ x_bn -> + let* x_bp = x_e x_bg + x_br = unIData# (headList! x_bp) + x_bs = unIData# (headList! (tailList! x_bp)) + x_bt = x_8v (x_9b x_bn) (\ x_bu -> x_bu x_br x_bs) + x_x_m = x_bt quotientInteger# + in ifThenElse! (x_8c x_bt cse) (\ ~ -> x_x_m) (\ ~ -> ifThenElse! (x_8j x_bt (x_9b (x_bt quotientInteger#))) (\ ~ -> x_x_m) (\ ~ -> addInteger# 1# x_x_m) !) ! + in ifThenElse! + (equalsInteger_0 x_x_j) + (\ ~ -> + let* bData_unBData_headList!_x = bData# (unBData# (headList! x_ae)) + in ifThenElse! + (zComb + (\ x_bv x_bw -> chooseList!! x_bw (\ ~ -> False#) (\ ~ -> ifThenElse! (equalsData# (headList! x_bw) bData_unBData_headList!_x) (\ ~ -> True#) (\ ~ -> x_bv (tailList! x_bw)) !) !) + (unListData# (headList! x_b0))) + (\ ~ -> + ifThenElse! + (equalsInteger# x_bc (x_1t 1#)) + (\ ~ -> + let* x_bx = x_e x_bh + x_by = tailList! x_bx + x_bz = headList! x_bx + x_c0 = headList! x_by + x_c1 = headList! (tailList! x_by) + in ifThenElse! + (x_3m (x_2w x_aw headList!_tailList!_x x_b9 x_ba) (x_bj (x_86 x_be x_bf x_bz x_c0 x_c1))) + (\ ~ -> + ifThenElse! + (x_3x (equalsInteger_0 (unIData# (headList! x_an))) (\ ~ -> x_g x_bh (constrData_0 (mkCons! _00 (mkCons! _00 (mkCons! _00 []#))))) !) + (\ ~ -> tt) + (\ ~ -> + ifThenElse! + (x_4f + x_ba + x_b9 + headList!_tailList!_x_x_x + _00 + False# + (\ x_c2 -> + x_2f + x_7a + x_aw + x_c2 + (\ x_c3 -> + let* x_c4 = unIData# x_c0 + x_c5 = unIData# (headList! x_af) + x_c6 = x_8v (x_9b x_bd) (\ x_c7 -> x_c7 x_c4 x_c5) + x_x_n = x_c6 quotientInteger# + in x_lessThanEqualsInteger + (x_86 + x_be + x_bf + x_bz + (iData# + (subtractInteger# + (unIData# x_c0) + (ifThenElse! + (x_8c x_c6 cse) + (\ ~ -> ifThenElse! (x_8j x_c6 (x_9b (x_c6 quotientInteger#))) (\ ~ -> x_x_n) (\ ~ -> subtractInteger# x_x_n 1#) !) + (\ ~ -> x_x_n) + !))) + x_c1) + x_c3) + (\ ~ -> False#))) + (\ ~ -> tt) + (\ ~ -> ERROR) + !) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_x_j) + (\ ~ -> + let* unIData_headList!_x_x = unIData# (headList! x_x_k) + in ifThenElse! + (lessThanInteger_0 unIData_headList!_x_x) + (\ ~ -> + ifThenElse! + (lessThanInteger# unIData_headList!_x_x x_bd) + (\ ~ -> + let* x_c8 = headList! x_az + in ifThenElse! + (x_a3 x_c8 (headList! x_ak)) + (\ ~ -> + ifThenElse! + (x_a7 x_c8 (headList! x_am)) + (\ ~ -> + let* x_c9 = x_e x_bh + x_ca = tailList! x_c9 + x_cb = headList! x_c9 + x_cc = headList! x_ca + x_cd = unIData# (headList! (tailList! x_ca)) + x_unIData_headList!_x_x = x_bm unIData_headList!_x_x + x_ce = addInteger# (unIData# (headList! (tailList! x_as))) x_unIData_headList!_x_x + x_cf = headList! x_ar + x_cg = x_2a (x_24 ""#b ""#b) x_cf + x_ch = x_4f x_ba x_b9 headList!_tailList!_x_x_x x_cf False# (\ x_ci -> True#) + headList!_x_1 = headList! x_b4 + in zComb + (\ x_cj x_ck -> + chooseList!! + x_ck + (\ ~ x_cm x_cn x_cp -> x_cp !) + (\ ~ x_cr -> + let* x_x_p = x_e (headList! x_ck) + in ifThenElse! + (x_g headList!_x_1 (headList! x_x_p)) + (\ ~ -> + x_2f + x_7a + (bData# unBData_headList!_x_x_x) + (unMapData# (headList! (tailList! x_x_p))) + (\ x_cs -> + chooseList!! + x_cs + (\ ~ x_ct x_cu -> x_cu !) + (\ ~ -> + let* x_cv = unBData# (fstPair!! (headList! x_cs)) + in ifThenElse! + (equalsInteger_1 (unIData# (sndPair!! (headList! x_cs)))) + (\ ~ -> ifThenElse! (equalsInteger_0 (x_x x_bb unBData_headList!_x_x_x x_cv)) (\ ~ x_cw x_cx -> x_cw x_cv) (\ ~ x_cy x_cz -> x_cz !) !) + (\ ~ x_d0 x_d1 -> x_d1 !) + !) + !) + (\ ~ x_d2 x_d3 -> x_d3 !)) + (\ ~ x_d4 x_d5 -> x_d5 !) + ! + (\ x_d6 -> + ifThenElse! + (equalsByteString# x_d6 x_b3) + (\ ~ -> let* x_d7 = headList! x_ck in \ x_d8 x_d9 -> x_d8 (\ x_da -> x_da x_cr x_d7)) + (\ ~ -> x_cj (tailList! x_ck) False#) + !) + (\ ~ -> x_cj (tailList! x_ck) x_cr)) + !) + x_ba + True# + (\ x_db -> + x_db + (\ x_dc x_dd -> + let* x_de = x_1i addInteger# (x_2a x_bf (iData# x_unIData_headList!_x_x)) (x_1z x_b5 (x_2a x_be (iData# unIData_headList!_x_x))) + in ifThenElse! + (x_j x_dc (\ ~ -> ifThenElse! x_ch False# True#) !) + (\ ~ -> let* x_df = x_1i addInteger# x_de x_cg; x_dg = iData# (addInteger# (unIData# x_cb) (unIData# x_cf)) in \ x_dh -> x_dh x_df x_dg) + (\ ~ x_di -> x_di x_de x_cb) + ! + (\ x_dj x_dk -> + let* x_dm = tailList! (x_e x_dd) + x_dn = unConstrData# (headList! (tailList! x_dm)) + x_dp = fstPair!! x_dn + x_dr = sndPair!! x_dn + x_ds = + ifThenElse! + (equalsInteger_0 x_dp) + (\ ~ -> ERROR) + (\ ~ -> ifThenElse! (equalsInteger_2 x_dp) (\ ~ -> headList! x_dr) (\ ~ -> x_2p (unBData# (headList! x_dr)) x_b9 (\ x_dt -> x_dt) (\ ~ -> ERROR)) !) + ! + unMapData_headList!_x = unMapData# (headList! x_dm) + x_du = x_1z unMapData_headList!_x x_dj + x_dv = x_12 x_du x_bf + x_dw = ifThenElse! (x_g x_bf (x_24 ""#b ""#b)) (\ ~ -> 0#) (\ ~ -> x_12 x_du (x_24 ""#b ""#b)) ! + in ifThenElse! + (x_3m unMapData_headList!_x x_dj) + (\ ~ -> + ifThenElse! + (equalsData# + x_ds + (constrData_0 + (mkCons! + (headList! x_ae) + (mkCons! + headList!_tailList!_x + (mkCons! + x_be + (mkCons! + (headList! x_af) + (mkCons! + (iData# (subtractInteger# x_bd unIData_headList!_x_x)) + (mkCons! + x_bf + (mkCons! + x_bg + (mkCons! + (bData# x_b3) + (mkCons! + (headList! x_ak) + (mkCons! + (headList! x_am) + (mkCons! + (iData# (addInteger# (unIData# (headList! x_an)) 1#)) + (mkCons! + (headList! x_ap) + (mkCons! + x_cf + (mkCons! + (constrData_0 + (mkCons! + (iData# (addInteger# (unIData# x_dk) x_dw)) + (mkCons! x_cc (mkCons! (iData# (addInteger# x_cd x_dv)) []#)))) + (mkCons! (iData# x_ce) []#))))))))))))))))) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger# + (x_3s + (\ x_dx x_dy -> + addInteger# + x_dx + (zComb + (\ x_dz x_e0 x_e1 -> chooseList!! x_e1 (\ ~ -> x_e0) (\ ~ -> x_dz (addInteger# x_e0 1#) (tailList! x_e1)) !) + 0# + (unMapData# (sndPair!! x_dy)))) + 0# + unMapData_headList!_x) + 10#) + (\ ~ -> tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !))) + (\ ~ -> ERROR)) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger# x_bc (x_1t 1#)) + (\ ~ -> + let* x_e2 = headList! x_az + in ifThenElse! + (x_a3 x_e2 (headList! x_ak)) + (\ ~ -> + ifThenElse! + (x_a7 x_e2 (headList! x_am)) + (\ ~ -> + let* x_e3 = x_e x_bh + x_e4 = tailList! x_e3 + x_e5 = x_86 x_be x_bf (headList! x_e3) (headList! x_e4) (headList! (tailList! x_e4)) + in ifThenElse! + (x_3m (x_2w x_aw headList!_tailList!_x x_b9 x_ba) (x_1i addInteger# (x_bj x_e5) (x_2a x_bf (iData# (x_bm x_bd))))) + (\ ~ -> + let* x_e6 = headList! x_ar + x_e7 = x_g x_bh (constrData_0 (mkCons! _00 (mkCons! _00 (mkCons! _00 []#)))) + in ifThenElse! + (x_4f + x_ba + x_b9 + headList!_tailList!_x_x_x + x_e6 + (x_j x_e7 (\ ~ -> equalsData# x_e6 _00) !) + (\ x_e8 -> x_2f x_7a x_aw x_e8 (\ x_e9 -> x_lessThanEqualsInteger x_e5 x_e9) (\ ~ -> x_e7))) + (\ ~ -> tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + !) + !) + (\ ~ -> tt) + !) + (\ ~ -> ERROR)) + (\ ~ -> ERROR) + ! diff --git a/geniusyield-onchain/fixtures/partialorder-original.txt b/geniusyield-onchain/fixtures/partialorder-original.txt new file mode 100644 index 00000000..e97f1a36 --- /dev/null +++ b/geniusyield-onchain/fixtures/partialorder-original.txt @@ -0,0 +1,863 @@ +let* x = sndPair# ! ! + x_0 = \ x_1 -> x (unConstrData# x_1) + x_2 = tailList# ! + x_3 = headList# ! + x_4 = fstPair# ! ! + x_5 = \ x_6 -> x_2 (x_2 x_6) + x_7 = ifThenElse# ! + x_8 = chooseList# ! ! + x_9 = \ x_a -> let* x_b = \ x_c -> x_a (\ x_d -> x_c x_c x_d) in x_a (\ x_e -> x_b x_b x_e) + x_f = \ x_g x_h x_i x_j -> x_9 (\ x_k x_m -> x_8 x_m (\ ~ -> x_h) (\ ~ -> x_7 (equalsData# (x_4 (x_3 x_m)) x_g) (\ ~ -> x_i (x (x_3 x_m))) (\ ~ -> x_k (x_2 x_m)) !) !) x_j + x_n = \ x_p -> x_f (bData# x_p) + x_r = \ x_s x_t x_u -> x_n x_t 0# (\ x_v -> x_n x_u 0# unIData# (unMapData# x_v)) x_s + x_w = \ x_x x_y -> let* x_z = unBData# (x_3 (x_0 x_y)); x_10 = unBData# (x_3 (x_2 (x_0 x_y))) in x_r x_x x_z x_10 + x_11 = \ x_12 x_13 -> equalsData# (listData# (x_0 x_12)) (listData# (x_0 x_13)) + x_14 = \ ~ -> False# + x_15 = \ x_16 x_17 -> x_7 x_16 x_17 x_14 + x_18 = x_9 (\ x_19 x_1a x_1b -> x_8 x_1b (\ ~ x_1c x_1d -> x_1d !) (\ ~ -> x_7 (x_1a (x_3 x_1b)) (\ ~ -> let* x_1e = x_3 x_1b in \ x_1f x_1g -> x_1f x_1e) (\ ~ -> x_19 x_1a (x_2 x_1b)) !) !) + x_1h = \ x_1i -> let* x_1j = 1# in \ x_1k -> x_1k x_1i x_1j + x_1m = \ x_1n -> subtractInteger# 0# x_1n + x_1p = \ x_1r -> x_7 (lessThanEqualsInteger# x_1r -1#) (\ ~ -> x_1m x_1r) (\ ~ -> x_1r) ! + x_1s = \ x_1t x_1u -> x_7 (lessThanEqualsInteger# x_1t x_1u) (\ ~ -> x_1t) (\ ~ -> x_1u) ! + x_1v = \ x_1w x_1x -> x_7 (lessThanEqualsInteger# x_1w x_1x) (\ ~ -> x_1x) (\ ~ -> x_1w) ! + x_1y = x_9 (\ x_1z x_20 x_21 -> x_7 (equalsInteger# x_21 0#) (\ ~ -> x_20) (\ ~ -> x_1z x_21 (modInteger# x_20 x_21)) !) + x_22 = \ x_23 x_24 -> let* x_25 = x_1p x_23; x_26 = x_1p x_24 in x_1y (x_1v x_25 x_26) (x_1s x_25 x_26) + x_27 = + \ x_28 -> + x_28 + (\ x_29 x_2a -> + let* x_2b = x_22 x_29 x_2a + x_2c = x_7 (equalsInteger# x_2a 0#) (\ ~ -> 0#) (\ ~ -> x_7 (lessThanEqualsInteger# x_2a 0#) (\ ~ -> -1#) (\ ~ -> 1#) !) ! + x_2d = multiplyInteger# x_2c (divideInteger# x_29 x_2b) + x_2e = multiplyInteger# x_2c (divideInteger# x_2a x_2b) + in \ x_2f -> x_2f x_2d x_2e) + x_2g = \ x_2h x_2i -> x_2h (\ x_2j x_2k -> x_2i (\ x_2m x_2n -> x_27 (let* x_2p = multiplyInteger# x_2j x_2m; x_2r = multiplyInteger# x_2k x_2n in \ x_2s -> x_2s x_2p x_2r))) + x_2t = \ x_2u -> x_2u quotientInteger# + x_2v = \ x_2w x_2x -> x_2w (\ x_2y x_2z -> x_2x (\ x_30 x_31 -> equalsInteger# (multiplyInteger# x_31 x_2y) (multiplyInteger# x_30 x_2z))) + x_32 = \ x_33 x_34 -> x_33 (\ x_35 x_36 -> x_34 (\ x_37 x_38 -> lessThanInteger# (multiplyInteger# x_38 x_35) (multiplyInteger# x_37 x_36))) + x_39 = []# + x_3a = mkCons# ! + x_3b = \ x_3c x_3d -> x_3a (mkPairData# x_3c x_3d) x_39 + x_3e = \ x_3f x_3g x_3h -> x_7 (lessThanEqualsInteger# (unIData# x_3h) 0#) (\ ~ -> x_39) (\ ~ -> x_3b x_3f (mapData# (x_3b x_3g x_3h))) ! + x_3i = \ x_3j x_3k -> let* x_3m = x_3 (x_0 x_3j); x_3n = x_3 (x_2 (x_0 x_3j)) in x_3e x_3m x_3n x_3k + x_3p = + \ x_3r x_3s -> + let* x_3t = \ x_3u x_3v -> x_8 x_3u (\ ~ -> x_3v) (\ ~ -> x_3s (\ x_3w x_3x -> x_3x) (x_3 x_3u) (x_2 x_3u) x_3v) ! + x_3y = + \ x_3z x_40 x_41 -> + x_8 + x_41 + (\ ~ -> x_3a x_3z x_40) + (\ ~ -> + let* x_42 = x_3 x_41 + x_43 = x_4 x_3z + x_44 = x_4 x_42 + in x_7 + (equalsData# x_43 x_44) + (\ ~ -> x_3a (mkPairData# x_43 (x_3r (x x_3z) (x x_42))) (x_3s (\ x_45 x_46 -> x_45) x_40 (x_2 x_41))) + (\ ~ -> x_7 (lessThanByteString# (unBData# x_43) (unBData# x_44)) (\ ~ -> x_3a x_3z (x_3s (\ x_47 x_48 -> x_48) x_42 (x_2 x_41) x_40)) (\ ~ -> x_3a x_42 (x_3s (\ x_49 x_4a -> x_4a) x_3z x_40 (x_2 x_41))) !) + !) + ! + in \ x_4b -> x_4b x_3t x_3y + x_4c = \ x_4d -> x_9 (x_3p x_4d) + x_4e = \ x_4f x_4g x_4h -> x_4c x_4f (\ x_4i x_4j -> x_4i) x_4g x_4h + x_4k = \ x_4m -> x_4e (\ x_4n x_4p -> iData# (x_4m (unIData# x_4n) (unIData# x_4p))) + x_4r = \ x_4s -> x_4e (\ x_4t x_4u -> mapData# (x_4s (unMapData# x_4t) (unMapData# x_4u))) + x_4v = \ x_4w x_4x x_4y -> x_4r (\ x_4z x_50 -> x_4k x_4w x_4z x_50) x_4x x_4y + x_51 = []# + x_52 = \ x_53 x_54 -> constrData# 0# (x_3a (bData# x_53) (x_3a (bData# x_54) x_51)) + x_55 = \ x_56 x_57 -> x_9 (\ x_58 x_59 -> x_8 x_59 (\ ~ -> x_39) (\ ~ -> x_3a (mkPairData# (x_4 (x_3 x_59)) (x_56 (x (x_3 x_59)))) (x_58 (x_2 x_59))) !) x_57 + x_5a = \ x_5b -> x_55 (\ x_5c -> iData# (x_5b (unIData# x_5c))) + x_5d = \ x_5e -> x_55 (\ x_5f -> mapData# (x_5e (unMapData# x_5f))) + x_5g = \ x_5h x_5i -> x_5d (\ x_5j -> x_5a x_5h x_5j) x_5i + x_5k = \ x_5m x_5n -> x_4v addInteger# x_5m (x_5g x_1m x_5n) + x_5p = ""#b + x_5r = \ x_5s x_5t x_5u x_5v x_5w -> x_4v addInteger# (x_3i (x_52 x_5p x_5p) x_5u) (x_4v addInteger# (x_3i x_5s x_5v) (x_3i x_5t x_5w)) + x_5x = \ x_5y -> x_9 (\ x_5z x_60 -> x_8 x_60 (\ ~ -> True#) (\ ~ -> x_15 (x_5y (x_3 x_60)) (\ ~ -> x_5z (x_2 x_60)) !) !) + x_61 = + \ x_62 x_63 x_64 x_65 -> + x_9 + (\ x_66 x_67 x_68 -> + x_8 + x_67 + (\ ~ -> x_5x (\ x_69 -> x_62 x_63 (unIData# (x x_69))) x_68) + (\ ~ -> + let* x_6a = unIData# (x (x_3 x_67)) + in x_8 + x_68 + (\ ~ -> x_15 (x_62 x_6a x_63) (\ ~ -> x_5x (\ x_6b -> x_62 (unIData# (x x_6b)) x_63) (x_2 x_67)) !) + (\ ~ -> + let* x_6c = unIData# (x (x_3 x_68)) + x_6d = unBData# (x_4 (x_3 x_67)) + x_6e = unBData# (x_4 (x_3 x_68)) + in x_7 + (equalsByteString# x_6d x_6e) + (\ ~ -> x_15 (x_62 x_6a x_6c) (\ ~ -> x_66 (x_2 x_67) (x_2 x_68)) !) + (\ ~ -> x_7 (lessThanByteString# x_6d x_6e) (\ ~ -> x_15 (x_62 x_6a x_63) (\ ~ -> x_66 (x_2 x_67) x_68) !) (\ ~ -> x_15 (x_62 x_63 x_6c) (\ ~ -> x_66 x_67 (x_2 x_68)) !) !) + !) + !) + !) + x_64 + x_65 + x_6f = + \ x_6g x_6h x_6i x_6j -> + x_9 + (\ x_6k x_6m x_6n -> + x_8 + x_6m + (\ ~ -> x_5x (\ x_6p -> x_6g x_6h (unMapData# (x x_6p))) x_6n) + (\ ~ -> + let* x_6r = unMapData# (x (x_3 x_6m)) + in x_8 + x_6n + (\ ~ -> x_15 (x_6g x_6r x_6h) (\ ~ -> x_5x (\ x_6s -> x_6g (unMapData# (x x_6s)) x_6h) (x_2 x_6m)) !) + (\ ~ -> + let* x_6t = unMapData# (x (x_3 x_6n)) + x_6u = unBData# (x_4 (x_3 x_6m)) + x_6v = unBData# (x_4 (x_3 x_6n)) + in x_7 + (equalsByteString# x_6u x_6v) + (\ ~ -> x_15 (x_6g x_6r x_6t) (\ ~ -> x_6k (x_2 x_6m) (x_2 x_6n)) !) + (\ ~ -> x_7 (lessThanByteString# x_6u x_6v) (\ ~ -> x_15 (x_6g x_6r x_6h) (\ ~ -> x_6k (x_2 x_6m) x_6n) !) (\ ~ -> x_15 (x_6g x_6h x_6t) (\ ~ -> x_6k x_6m (x_2 x_6n)) !) !) + !) + !) + !) + x_6i + x_6j + x_6w = \ x_6x -> x_6f (x_61 x_6x 0#) x_39 + x_6y = x_6w lessThanEqualsInteger# + x_6z = \ x_70 -> let* x_71 = unMapData# (x x_70) in \ x_72 x_73 -> x_72 x_71 + x_74 = \ x_75 x_76 x_77 -> x_9 (\ x_78 x_79 -> x_8 x_79 (\ ~ x_7a x_7b -> x_7b !) (\ ~ -> x_7 (equalsData# (x_4 (x_3 x_79)) x_76) (\ ~ -> x_75 (x_3 x_79)) (\ ~ -> x_78 (x_2 x_79)) !) !) x_77 + x_7c = \ x_7d -> x_74 x_6z x_7d + x_7e = \ x_7f -> x_9 (\ x_7g x_7h -> x_8 x_7h (\ ~ -> x_39) (\ ~ -> x_3a (x_7f (x_3 x_7h)) (x_7g (x_2 x_7h))) !) + x_7i = + \ x_7j -> + x_9 (\ x_7k x_7m -> x_8 x_7m (\ ~ x_7n -> x_7j) (\ ~ -> let* x_7p = unBData# (x_4 (x_3 x_7m)) in \ x_7r -> x_7 (x_7r x_7p) (\ ~ -> ERROR) (\ ~ -> x_7k (x_2 x_7m) (\ x_7s -> lessThanByteString# x_7s x_7p)) !) !) x_7j (\ x_7t -> False#) + x_7u = \ ~ -> True# + x_7v = \ x_7w -> x_7 x_7w x_7u + x_7x = \ x_7y x_7z -> x_5x (\ x_80 -> x_7y (unIData# (x x_80))) x_7z + x_81 = \ x_82 x_83 -> x_5x (\ x_84 -> x_82 (unMapData# (x x_84))) x_83 + x_85 = \ x_86 -> x_7 (x_81 (\ x_87 -> x_7x (\ x_88 -> lessThanInteger# 0# x_88) x_87) x_86) (\ ~ -> x_86) (\ ~ -> ERROR) ! + x_89 = \ x_8a -> let* x_8b = x x_8a in \ x_8c x_8d -> x_8c x_8b + x_8e = \ x_8f -> x_74 x_89 (bData# x_8f) + x_8g = + \ x_8h x_8i -> + let* x_8j = unConstrData# x_8h + x_8k = x_4 x_8j + x_8m = x x_8j + in x_7 + (equalsInteger# 0# x_8k) + (\ ~ -> ERROR) + (\ ~ -> + x_7 + (equalsInteger# 2# x_8k) + (\ ~ -> + let* x_8n = x_3 x_8m + x_8p = unConstrData# x_8n + x_8r = x_4 x_8p + x_8s = x x_8p + x_8t = + x_7 + (equalsInteger# 0# x_8r) + (\ ~ -> + let* x_8u = x_3 x_8s + x_8v = unMapData# x_8u + x_8w = + x_7e + (\ x_8x -> + mkPairData# + (let* x_8y = unConstrData# (x_4 x_8x) + x_8z = x_4 x_8y + x_90 = x x_8y + x_91 = + x_7 + (equalsInteger# 0# x_8z) + (\ ~ -> + let* x_92 = x_3 x_90 + x_93 = unConstrData# x_92 + in x_7 + (equalsInteger# (x_4 x_93) 0#) + (\ ~ -> + let* x_94 = x x_93 + in x_7 + (equalsData# (listData# x_51) (listData# (x_2 x_94))) + (\ ~ -> + let* x_95 = unBData# (x_3 x_94) + in x_7 + (equalsInteger# (lengthOfByteString# x_95) 32#) + (\ ~ -> let* x_96 = x_2 x_90; x_97 = x_3 x_96; x_98 = unIData# x_97; x_99 = x_2 x_96; x_9a = x_8 x_99 (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + in x_4 x_8x) + (let* x_9b = unMapData# (x x_8x) + x_9c = + x_7e + (\ x_9d -> + mkPairData# + (let* x_9e = unBData# (x_4 x_9d) + x_9f = lengthOfByteString# x_9e + in x_7 (x_7v (equalsInteger# x_9f 0#) (\ ~ -> equalsInteger# x_9f 28#) !) (\ ~ -> x_4 x_9d) (\ ~ -> ERROR) !) + (let* x_9g = unMapData# (x x_9d) + x_9h = + x_7e + (\ x_9i -> + mkPairData# + (let* x_9j = unBData# (x_4 x_9i) + in x_7 (lessThanEqualsInteger# (lengthOfByteString# x_9j) 32#) (\ ~ -> x_4 x_9i) (\ ~ -> ERROR) !) + (let* x_9k = unIData# (x x_9i) + in x x_9i)) + x_9g + x_9m = x_7i (unMapData# (x x_9d)) + in x x_9d)) + x_9b + x_9n = x_7i (unMapData# (x x_8x)) + x_9p = x_85 (unMapData# (x x_8x)) + in x x_8x)) + x_8v + x_9r = x_2 x_8s + x_9s = x_3 x_9r + x_9t = unMapData# x_9s + x_9u = + x_7e + (\ x_9v -> + mkPairData# + (let* x_9w = unBData# (x_4 x_9v) + x_9x = lengthOfByteString# x_9w + in x_7 (x_7v (equalsInteger# x_9x 0#) (\ ~ -> equalsInteger# x_9x 28#) !) (\ ~ -> x_4 x_9v) (\ ~ -> ERROR) !) + (let* x_9y = unMapData# (x x_9v) + x_9z = + x_7e + (\ x_a0 -> + mkPairData# (let* x_a1 = unBData# (x_4 x_a0) in x_7 (lessThanEqualsInteger# (lengthOfByteString# x_a1) 32#) (\ ~ -> x_4 x_a0) (\ ~ -> ERROR) !) (let* x_a2 = unIData# (x x_a0) in x x_a0)) + x_9y + x_a3 = x_7i (unMapData# (x x_9v)) + in x x_9v)) + x_9t + x_a4 = x_7i (unMapData# x_9s) + x_a5 = x_85 (unMapData# x_9s) + x_a6 = x_2 x_9r + x_a7 = x_3 x_a6 + x_a8 = unConstrData# x_a7 + x_a9 = x_4 x_a8 + x_aa = x x_a8 + x_ab = + x_7 + (equalsInteger# 0# x_a9) + (\ ~ -> + let* x_ac = x_3 x_aa + x_ad = unConstrData# x_ac + x_ae = x_4 x_ad + x_af = x x_ad + x_ag = + x_7 + (equalsInteger# 0# x_ae) + (\ ~ -> + let* x_ah = x_3 x_af + x_ai = unConstrData# x_ah + in x_7 + (equalsInteger# (x_4 x_ai) 0#) + (\ ~ -> + let* x_aj = x x_ai + in x_7 + (equalsData# (listData# x_51) (listData# (x_2 x_aj))) + (\ ~ -> + let* x_ak = unBData# (x_3 x_aj) + in x_7 + (equalsInteger# (lengthOfByteString# x_ak) 32#) + (\ ~ -> let* x_am = x_2 x_af; x_an = x_3 x_am; x_ap = unIData# x_an; x_ar = x_2 x_am; x_as = x_8 x_ar (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_at = x_2 x_aa + x_au = x_8 x_at (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> x_7 (equalsInteger# 1# x_a9) (\ ~ -> let* x_av = x_8 x_aa (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) (\ ~ -> ERROR) !) + ! + x_aw = x_2 x_a6 + x_ax = x_8 x_aw (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + ! + in x_8n) + (\ ~ -> + x_8e + (unBData# (x_3 x_8m)) + x_8i + (\ x_ay -> + let* x_az = unConstrData# x_ay + x_b0 = x_4 x_az + x_b1 = x x_az + x_b2 = + x_7 + (equalsInteger# 0# x_b0) + (\ ~ -> + let* x_b3 = x_3 x_b1 + x_b4 = unMapData# x_b3 + x_b5 = + x_7e + (\ x_b6 -> + mkPairData# + (let* x_b7 = unConstrData# (x_4 x_b6) + x_b8 = x_4 x_b7 + x_b9 = x x_b7 + x_ba = + x_7 + (equalsInteger# 0# x_b8) + (\ ~ -> + let* x_bb = x_3 x_b9 + x_bc = unConstrData# x_bb + in x_7 + (equalsInteger# (x_4 x_bc) 0#) + (\ ~ -> + let* x_bd = x x_bc + in x_7 + (equalsData# (listData# x_51) (listData# (x_2 x_bd))) + (\ ~ -> + let* x_be = unBData# (x_3 x_bd) + in x_7 + (equalsInteger# (lengthOfByteString# x_be) 32#) + (\ ~ -> let* x_bf = x_2 x_b9; x_bg = x_3 x_bf; x_bh = unIData# x_bg; x_bi = x_2 x_bf; x_bj = x_8 x_bi (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + in x_4 x_b6) + (let* x_bk = unMapData# (x x_b6) + x_bm = + x_7e + (\ x_bn -> + mkPairData# + (let* x_bp = unBData# (x_4 x_bn) + x_br = lengthOfByteString# x_bp + in x_7 (x_7v (equalsInteger# x_br 0#) (\ ~ -> equalsInteger# x_br 28#) !) (\ ~ -> x_4 x_bn) (\ ~ -> ERROR) !) + (let* x_bs = unMapData# (x x_bn) + x_bt = + x_7e + (\ x_bu -> + mkPairData# + (let* x_bv = unBData# (x_4 x_bu) + in x_7 (lessThanEqualsInteger# (lengthOfByteString# x_bv) 32#) (\ ~ -> x_4 x_bu) (\ ~ -> ERROR) !) + (let* x_bw = unIData# (x x_bu) + in x x_bu)) + x_bs + x_bx = x_7i (unMapData# (x x_bn)) + in x x_bn)) + x_bk + x_by = x_7i (unMapData# (x x_b6)) + x_bz = x_85 (unMapData# (x x_b6)) + in x x_b6)) + x_b4 + x_c0 = x_2 x_b1 + x_c1 = x_3 x_c0 + x_c2 = unMapData# x_c1 + x_c3 = + x_7e + (\ x_c4 -> + mkPairData# + (let* x_c5 = unBData# (x_4 x_c4) + x_c6 = lengthOfByteString# x_c5 + in x_7 (x_7v (equalsInteger# x_c6 0#) (\ ~ -> equalsInteger# x_c6 28#) !) (\ ~ -> x_4 x_c4) (\ ~ -> ERROR) !) + (let* x_c7 = unMapData# (x x_c4) + x_c8 = + x_7e + (\ x_c9 -> + mkPairData# + (let* x_ca = unBData# (x_4 x_c9) + in x_7 (lessThanEqualsInteger# (lengthOfByteString# x_ca) 32#) (\ ~ -> x_4 x_c9) (\ ~ -> ERROR) !) + (let* x_cb = unIData# (x x_c9) + in x x_c9)) + x_c7 + x_cc = x_7i (unMapData# (x x_c4)) + in x x_c4)) + x_c2 + x_cd = x_7i (unMapData# x_c1) + x_ce = x_85 (unMapData# x_c1) + x_cf = x_2 x_c0 + x_cg = x_3 x_cf + x_ch = unConstrData# x_cg + x_ci = x_4 x_ch + x_cj = x x_ch + x_ck = + x_7 + (equalsInteger# 0# x_ci) + (\ ~ -> + let* x_cm = x_3 x_cj + x_cn = unConstrData# x_cm + x_cp = x_4 x_cn + x_cr = x x_cn + x_cs = + x_7 + (equalsInteger# 0# x_cp) + (\ ~ -> + let* x_ct = x_3 x_cr + x_cu = unConstrData# x_ct + in x_7 + (equalsInteger# (x_4 x_cu) 0#) + (\ ~ -> + let* x_cv = x x_cu + in x_7 + (equalsData# (listData# x_51) (listData# (x_2 x_cv))) + (\ ~ -> + let* x_cw = unBData# (x_3 x_cv) + in x_7 + (equalsInteger# (lengthOfByteString# x_cw) 32#) + (\ ~ -> let* x_cx = x_2 x_cr; x_cy = x_3 x_cx; x_cz = unIData# x_cy; x_d0 = x_2 x_cx; x_d1 = x_8 x_d0 (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_d2 = x_2 x_cj + x_d3 = x_8 x_d2 (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> x_7 (equalsInteger# 1# x_ci) (\ ~ -> let* x_d4 = x_8 x_cj (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) (\ ~ -> ERROR) !) + ! + x_d5 = x_2 x_cf + x_d6 = x_8 x_d5 (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + ! + in x_ay) + (\ ~ -> ERROR)) + !) + ! + x_d7 = \ x_d8 -> unMapData# (x x_d8) + x_d9 = \ x_da -> x_9 (\ x_db x_dc x_dd -> x_8 x_dd (\ ~ -> x_dc) (\ ~ -> x_db (x_da x_dc (x_3 x_dd)) (x_2 x_dd)) !) + x_de = \ x_df -> x_81 (\ x_dg -> x_7x (\ x_dh -> lessThanEqualsInteger# 0# x_dh) x_dg) x_df + x_di = \ x_dj x_dk -> x_de (x_5k x_dj x_dk) + x_dm = \ x_dn x_dp -> x_11 (x_3 (x_0 x_dp)) x_dn + x_dr = + \ x_ds x_dt x_du x_dv x_dw x_dx -> + x_18 + (x_dm x_du) + x_ds + (\ x_dy -> + let* x_dz = x_2 (x_0 x_dy) + x_e0 = unMapData# (x_3 x_dz) + x_e1 = x_8g (x_3 (x_2 x_dz)) x_dt + x_e2 = x_0 x_e1 + x_e3 = unMapData# (x_3 x_e2) + x_e4 = unMapData# (x_3 (x_2 x_e2)) + x_e5 = x_d9 (\ x_e6 x_e7 -> let* x_e8 = x_d7 x_e7 in x_4v addInteger# x_e6 x_e8) x_39 x_e3 + x_e9 = x_5k x_e0 x_e4 + in x_7 (x_di x_e9 (x_4v addInteger# x_e5 (x_3i (x_52 x_5p x_5p) x_dv))) (\ ~ -> x_dx x_e3) (\ ~ -> ERROR) !) + (\ ~ -> x_dw) + x_ea = + \ x_eb x_ec x_ed -> + let* x_ee = \ x_ef x_eg -> x_15 (equalsData# x_ef x_eb) (\ ~ -> x_11 x_eg x_ec) ! + in x_9 + (\ x_eh x_ei -> + x_8 + x_ei + (\ ~ -> x_39) + (\ ~ -> + x_7 + (let* x_ej = x_3 x_ei + x_ek = x_0 x_ej + x_em = x_3 (x_2 (x_2 x_ek)) + x_en = x_3 x_ek + x_ep = unConstrData# x_em + x_er = x_4 x_ep + x_es = x x_ep + in x_7 (equalsInteger# 0# x_er) (\ ~ -> False#) (\ ~ -> x_7 (equalsInteger# 1# x_er) (\ ~ -> x_8e (unBData# (x_3 x_es)) x_ed (\ x_et -> x_ee x_et x_en) (\ ~ -> False#)) (\ ~ -> let* x_eu = x_3 x_es in x_ee x_eu x_en) !) !) + (\ ~ -> let* x_ev = x_3 x_ei in unMapData# (x_3 (x_2 (x_0 x_ev)))) + (\ ~ -> x_eh (x_2 x_ei)) + !) + !) + x_ew = \ x_ex -> constrData# (x_7 x_ex 1# 0#) x_51 + x_ey = \ x_ez -> constrData# 0# (x_3a (constrData# 1# (x_3a (iData# x_ez) x_51)) (x_3a (x_ew True#) x_51)) + x_f0 = \ x_f1 -> constrData# 0# (x_3a (constrData# 0# (x_3a (constrData# 0# x_51) (x_3a (x_ew True#) x_51))) (x_3a (x_ey x_f1) x_51)) + x_f2 = \ x_f3 -> equalsInteger# (x_4 (unConstrData# x_f3)) 1# + x_f4 = + \ x_f5 x_f6 -> + let* x_f7 = unConstrData# x_f5 + x_f8 = x_4 x_f7 + x_f9 = x x_f7 + in x_7 + (equalsInteger# 1# x_f8) + (\ ~ -> let* x_fa = unConstrData# x_f6; x_fb = x_4 x_fa; x_fc = x x_fa in x_7 (equalsInteger# 1# x_fb) (\ ~ -> equalsData# (listData# x_f9) (listData# x_fc)) (\ ~ -> False#) !) + (\ ~ -> + x_7 + (equalsInteger# 2# x_f8) + (\ ~ -> let* x_fd = unConstrData# x_f6; x_fe = x_4 x_fd; x_ff = x x_fd in x_7 (equalsInteger# 2# x_fe) (\ ~ -> equalsData# (listData# x_f9) (listData# x_ff)) (\ ~ -> False#) !) + (\ ~ -> let* x_fg = unConstrData# x_f6; x_fh = x_4 x_fg; x_fi = x x_fg in x_7 (equalsInteger# 0# x_fh) (\ ~ -> equalsData# (listData# x_f9) (listData# x_fi)) (\ ~ -> False#) !) + !) + ! + x_fj = + \ x_fk x_fm -> + let* x_fn = unConstrData# x_fk + x_fp = unConstrData# x_fm + x_fr = x_4 x_fn + x_fs = x_4 x_fp + in x_7 + (lessThanInteger# x_fr x_fs) + (\ ~ -> True#) + (\ ~ -> x_7 (equalsInteger# x_fr x_fs) (\ ~ -> let* x_ft = x x_fn; x_fu = x x_fp in x_7 (equalsInteger# 1# x_fr) (\ ~ -> lessThanInteger# (unIData# (x_3 x_ft)) (unIData# (x_3 x_fu))) (\ ~ -> False#) !) (\ ~ -> False#) !) + ! + x_fv = + \ x_fw x_fx -> + let* x_fy = x_0 x_fw + x_fz = x_0 x_fx + x_g0 = x_3 x_fy + x_g1 = x_3 x_fz + in x_7 (x_fj x_g0 x_g1) (\ ~ -> True#) (\ ~ -> x_7 (x_f4 x_g0 x_g1) (\ ~ -> let* x_g2 = x_2 x_fy; x_g3 = x_2 x_fz in x_7 (x_f2 (x_3 x_g2)) (x_f2 (x_3 x_g3)) True#) (\ ~ -> False#) !) ! + x_g4 = \ x_g5 x_g6 -> let* x_g7 = x_0 x_g5; x_g8 = x_0 x_g6 in x_15 (x_fv (x_3 x_g7) (x_3 x_g8)) (\ ~ -> x_fv (x_3 (x_2 x_g8)) (x_3 (x_2 x_g7))) ! + x_g9 = \ x_ga x_gb -> let* x_gc = unConstrData# x_gb; x_gd = x_4 x_gc; x_ge = x x_gc in x_7 (equalsInteger# 1# x_gd) (\ ~ -> True#) (\ ~ -> x_g4 (x_f0 (unIData# (x_3 x_ge))) x_ga) ! + x_gf = \ x_gg -> constrData# 0# (x_3a (x_ey x_gg) (x_3a (constrData# 0# (x_3a (constrData# 2# x_51) (x_3a (x_ew True#) x_51))) x_51)) + x_gh = \ x_gi x_gj -> let* x_gk = unConstrData# x_gj; x_gm = x_4 x_gk; x_gn = x x_gk in x_7 (equalsInteger# 1# x_gm) (\ ~ -> True#) (\ ~ -> x_g4 (x_gf (unIData# (x_3 x_gn))) x_gi) ! + x_gp = <0 <0 "\168\129\214\&6\159\167\&17}\130\216\ACK\216\222\178\ACKxx\DC2\154^-\249l%\229\160\142">, <1>>#d + x_gr = <0 "\190\CAN\194\156\DEL\SI\252\165\195\230\205V\249}\240\248*1\227\ETB\233\155\250\ETX\ESC;\SI\227", "47454e53">#d +in \ x_gs x_gt x_gu -> + let* x_gv = x_0 x_gs + x_gw = x_2 x_gv + x_gx = x_2 x_gw + x_gy = x_2 x_gx + x_gz = x_2 x_gy + x_h0 = x_2 x_gz + x_h1 = x_2 x_h0 + x_h2 = x_2 x_h1 + x_h3 = x_2 x_h2 + x_h4 = x_2 x_h3 + x_h5 = x_2 x_h4 + x_h6 = x_2 x_h5 + x_h7 = x_2 x_h6 + x_h8 = x_2 x_h7 + x_h9 = x_0 x_gu + x_ha = unConstrData# (x_3 (x_2 x_h9)) + x_hb = x_4 x_ha + x_hc = x x_ha + in x_7 + (equalsInteger# 1# x_hb) + (\ ~ -> + let* x_hd = x_3 x_hc + x_he = x_0 (x_3 x_h9) + x_hf = x_2 x_he + x_hg = x_2 x_hf + x_hh = x_2 (x_2 x_hg) + x_hi = x_5 (x_2 x_hh) + x_hj = x_2 x_hi + x_hk = unListData# (x_3 x_he) + in x_18 + (\ x_hm -> x_11 x_hd (x_3 (x_0 x_hm))) + x_hk + (\ x_hn -> + let* x_hp = unBData# (x_3 x_h2) + x_hr = x_0 (x_3 (x_2 (x_0 x_hn))) + x_hs = unMapData# (x_3 (x_2 x_hr)) + x_ht = unListData# (x_3 x_hf) + x_hu = + x_18 + (\ x_hv -> let* x_hw = x_3 (x_2 (x_0 x_hv)); x_hx = x_0 x_hw in x_15 (x_11 (x_3 x_hx) x_gp) (\ ~ -> equalsInteger# (x_w (unMapData# (x_3 (x_2 x_hx))) x_gr) 1#) !) + x_ht + (\ x_hy -> let* x_hz = x_3 (x_2 (x_0 x_hy)); x_i0 = x_3 (x_5 (x_0 x_hz)); x_i1 = unConstrData# x_i0; x_i2 = x_4 x_i1; x_i3 = x x_i1 in x_7 (equalsInteger# 2# x_i2) (\ ~ -> x_3 x_i3) (\ ~ -> ERROR) !) + (\ ~ -> ERROR) + x_i4 = x_5 (x_0 x_hu) + x_i5 = unBData# (x_3 x_i4) + x_i6 = x_3 (x_2 x_i4) + in x_7 + (equalsInteger# (x_r x_hs x_i5 x_hp) 1#) + (\ ~ -> + let* x_i7 = unMapData# (x_3 (x_2 (x_2 x_hj))) + x_i8 = unListData# (x_3 x_hg) + x_i9 = unMapData# (x_3 x_hh) + x_ia = x_r x_i9 x_i5 x_hp + x_ib = unIData# (x_3 x_gz) + x_ic = x_3 x_gx + x_id = x_3 x_h0 + x_ie = x_3 x_h1 + x_if = x_3 x_gw + x_ig = x_3 x_h8 + x_ih = + \ x_ii -> + let* x_ij = x_2g (x_1h x_ii) (let* x_ik = x_0 x_ie; x_im = unIData# (x_3 x_ik); x_in = unIData# (x_3 (x_2 x_ik)) in \ x_ip -> x_ip x_im x_in) + x_ir = x_1h (x_2t x_ij) + x_is = x_2t x_ij + in x_7 (x_32 x_ij (let* x_it = 0#; x_iu = 1# in \ x_iv -> x_iv x_it x_iu)) (\ ~ -> x_is) (\ ~ -> x_7 (x_2v x_ij x_ir) (\ ~ -> x_is) (\ ~ -> addInteger# 1# x_is) !) ! + x_iw = \ x_ix -> x_5k x_hs (x_4v addInteger# (x_3i (x_52 x_i5 x_hp) (iData# 1#)) (x_4v addInteger# (x_3i x_ic (iData# x_ib)) x_ix)) + x_iy = unConstrData# x_gt + x_iz = x_4 x_iy + x_j0 = x x_iy + in x_7 + (equalsInteger# 0# x_iz) + (\ ~ -> + x_7 + (let* x_j1 = unBData# (x_3 x_gv) + x_j2 = unListData# (x_3 x_hj) + x_j3 = bData# x_j1 + in x_9 (\ x_j4 x_j5 -> x_8 x_j5 (\ ~ -> False#) (\ ~ -> x_7 (equalsData# (x_3 x_j5) x_j3) (\ ~ -> True#) (\ ~ -> x_j4 (x_2 x_j5)) !) !) x_j2) + (\ ~ -> + x_7 + (equalsInteger# x_ia (x_1m 1#)) + (\ ~ -> + let* x_j6 = x_0 x_ig + x_j7 = x_2 x_j6 + x_j8 = x_3 x_j6 + x_j9 = x_3 x_j7 + x_ja = x_3 (x_2 x_j7) + in x_7 + (x_di (x_ea x_hd x_if x_i7 x_i8) (x_iw (x_5r x_ic x_id x_j8 x_j9 x_ja))) + (\ ~ -> + let* x_jb = unIData# (x_3 x_h5) + in x_7 + (x_7v (equalsInteger# x_jb 0#) (\ ~ -> x_11 x_ig (let* x_jc = iData# 0# in constrData# 0# (x_3a x_jc (x_3a x_jc (x_3a x_jc x_51))))) !) + (\ ~ -> ()#) + (\ ~ -> + x_7 + (x_dr + x_i8 + x_i7 + x_i6 + (iData# 0#) + False# + (\ x_jd -> + x_7c + x_hd + x_jd + (\ x_je -> + x_6y + (x_5r + x_ic + x_id + x_j8 + (iData# + (subtractInteger# + (unIData# x_j9) + (let* x_jf = x_2g (x_1h x_ib) (let* x_jg = unIData# x_j9; x_jh = unIData# (x_3 x_gy) in \ x_ji -> x_ji x_jg x_jh) + x_jj = x_1h (x_2t x_jf) + x_jk = x_2t x_jf + in x_7 + (x_32 x_jf (let* x_jm = 0#; x_jn = 1# in \ x_jp -> x_jp x_jm x_jn)) + (\ ~ -> x_7 (x_2v x_jf x_jj) (\ ~ -> x_jk) (\ ~ -> subtractInteger# x_jk 1#) !) + (\ ~ -> x_jk) + !))) + x_ja) + x_je) + (\ ~ -> False#))) + (\ ~ -> ()#) + (\ ~ -> ERROR) + !) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> + x_7 + (equalsInteger# 1# x_iz) + (\ ~ -> + let* x_jr = unIData# (x_3 x_j0) + in x_7 + (lessThanInteger# 0# x_jr) + (\ ~ -> + x_7 + (lessThanInteger# x_jr x_ib) + (\ ~ -> + let* x_js = x_3 x_hi + in x_7 + (x_gh x_js (x_3 x_h3)) + (\ ~ -> + x_7 + (x_g9 x_js (x_3 x_h4)) + (\ ~ -> + let* x_jt = x_0 x_ig + x_ju = x_2 x_jt + x_jv = x_3 x_jt + x_jw = x_3 x_ju + x_jx = unIData# (x_3 (x_2 x_ju)) + x_jy = unIData# (x_3 (x_2 x_h8)) + x_jz = x_ih x_jr + x_k0 = addInteger# x_jy x_jz + x_k1 = x_3 x_h7 + x_k2 = x_3i (x_52 x_5p x_5p) x_k1 + x_k3 = x_dr x_i8 x_i7 x_i6 x_k1 False# (\ x_k4 -> True#) + x_k5 = x_3 x_hr + in x_9 + (\ x_k6 x_k7 -> + x_8 + x_k7 + (\ ~ x_k8 x_k9 x_ka -> x_ka !) + (\ ~ x_kb -> + let* x_kc = x_3 x_k7 + x_kd = x_0 x_kc + in x_7 + (x_11 x_k5 (x_3 x_kd)) + (\ ~ -> + x_74 + x_6z + (bData# x_i5) + (unMapData# (x_3 (x_2 x_kd))) + (\ x_ke -> + x_8 + x_ke + (\ ~ x_kf x_kg -> x_kg !) + (\ ~ -> + let* x_kh = unBData# (x_4 (x_3 x_ke)) + in x_7 + (equalsInteger# (unIData# (x (x_3 x_ke))) 1#) + (\ ~ -> let* x_ki = x_r x_i9 x_i5 x_kh in x_7 (equalsInteger# x_ki 0#) (\ ~ x_kj x_kk -> x_kj x_kh) (\ ~ x_km x_kn -> x_kn !) !) + (\ ~ x_kp x_kr -> x_kr !) + !) + !) + (\ ~ x_ks x_kt -> x_kt !)) + (\ ~ x_ku x_kv -> x_kv !) + ! + (\ x_kw -> + x_7 (equalsByteString# x_kw x_hp) (\ ~ -> let* x_kx = x_3 x_k7; x_ky = \ x_kz -> x_kz x_kb x_kx in \ x_m0 x_m1 -> x_m0 x_ky) (\ ~ -> x_k6 (x_2 x_k7) False#) !) + (\ ~ -> x_k6 (x_2 x_k7) x_kb)) + !) + x_i8 + True# + (\ x_m2 -> + x_m2 + (\ x_m3 x_m4 -> + let* x_m5 = x_3i x_id (iData# x_jz) + x_m6 = x_3i x_ic (iData# x_jr) + x_m7 = x_4v addInteger# x_m5 (x_5k x_hs x_m6) + in x_7 + (x_15 x_m3 (\ ~ -> x_7 x_k3 False# True#) !) + (\ ~ -> let* x_m8 = x_4v addInteger# x_m7 x_k2; x_m9 = iData# (addInteger# (unIData# x_jv) (unIData# x_k1)) in \ x_ma -> x_ma x_m8 x_m9) + (\ ~ x_mb -> x_mb x_m7 x_jv) + ! + (\ x_mc x_md -> + let* x_me = x_2 (x_0 x_m4) + x_mf = x_3 (x_2 x_me) + x_mg = unConstrData# x_mf + x_mh = x_4 x_mg + x_mi = x x_mg + x_mj = + x_7 + (equalsInteger# 0# x_mh) + (\ ~ -> ERROR) + (\ ~ -> x_7 (equalsInteger# 2# x_mh) (\ ~ -> x_3 x_mi) (\ ~ -> x_8e (unBData# (x_3 x_mi)) x_i7 (\ x_mk -> x_mk) (\ ~ -> ERROR)) !) + ! + x_mm = unMapData# (x_3 x_me) + x_mn = x_5k x_mm x_mc + x_mp = x_w x_mn x_id + x_mr = x_7 (x_11 x_id (x_52 x_5p x_5p)) (\ ~ -> 0#) (\ ~ -> x_w x_mn (x_52 x_5p x_5p)) ! + in x_7 + (x_di x_mm x_mc) + (\ ~ -> + x_7 + (equalsData# + x_mj + (constrData# + 0# + (x_3a + (x_3 x_gv) + (x_3a + x_if + (x_3a + x_ic + (x_3a + (x_3 x_gy) + (x_3a + (iData# (subtractInteger# x_ib x_jr)) + (x_3a + x_id + (x_3a + x_ie + (x_3a + (bData# x_hp) + (x_3a + (x_3 x_h3) + (x_3a + (x_3 x_h4) + (x_3a + (iData# (addInteger# (unIData# (x_3 x_h5)) 1#)) + (x_3a + (x_3 x_h6) + (x_3a + x_k1 + (x_3a + (constrData# + 0# + (x_3a + (iData# (addInteger# (unIData# x_md) x_mr)) + (x_3a x_jw (x_3a (iData# (addInteger# x_jx x_mp)) x_51)))) + (x_3a (iData# x_k0) x_51))))))))))))))))) + (\ ~ -> + x_7 + (lessThanEqualsInteger# + (x_d9 + (\ x_ms x_mt -> + addInteger# + x_ms + (x_9 (\ x_mu x_mv x_mw -> x_8 x_mw (\ ~ -> x_mv) (\ ~ -> x_mu (addInteger# x_mv 1#) (x_2 x_mw)) !) 0# (unMapData# (x x_mt)))) + 0# + x_mm) + 10#) + (\ ~ -> ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !))) + (\ ~ -> ERROR)) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> + x_7 + (equalsInteger# x_ia (x_1m 1#)) + (\ ~ -> + let* x_mx = x_3 x_hi + in x_7 + (x_gh x_mx (x_3 x_h3)) + (\ ~ -> + x_7 + (x_g9 x_mx (x_3 x_h4)) + (\ ~ -> + let* x_my = x_0 x_ig + x_mz = x_2 x_my + x_n0 = x_3 x_my + x_n1 = x_3 x_mz + x_n2 = x_3 (x_2 x_mz) + x_n3 = x_5r x_ic x_id x_n0 x_n1 x_n2 + in x_7 + (x_di (x_ea x_hd x_if x_i7 x_i8) (x_4v addInteger# (x_iw x_n3) (x_3i x_id (iData# (x_ih x_ib))))) + (\ ~ -> + let* x_n4 = x_3 x_h7 + x_n5 = x_11 x_ig (let* x_n6 = iData# 0# in constrData# 0# (x_3a x_n6 (x_3a x_n6 (x_3a x_n6 x_51)))) + x_n7 = x_15 x_n5 (\ ~ -> equalsData# x_n4 (iData# 0#)) ! + in x_7 (x_dr x_i8 x_i7 x_i6 x_n4 x_n7 (\ x_n8 -> x_7c x_hd x_n8 (\ x_n9 -> x_6y x_n3 x_n9) (\ ~ -> x_n5))) (\ ~ -> ()#) (\ ~ -> ERROR) !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + !) + !) + (\ ~ -> ()#) + !) + (\ ~ -> ERROR)) + (\ ~ -> ERROR) + ! diff --git a/geniusyield-onchain/fixtures/partialorderconfig-aggressive.txt b/geniusyield-onchain/fixtures/partialorderconfig-aggressive.txt new file mode 100644 index 00000000..59620f50 --- /dev/null +++ b/geniusyield-onchain/fixtures/partialorderconfig-aggressive.txt @@ -0,0 +1,513 @@ +let* sndPair!! = sndPair# ! ! + fstPair!! = fstPair# ! ! + listData___ = \ ~ -> listData# []# + lessThanEqualsInteger_1 = lessThanEqualsInteger# 1# + lessThanEqualsInteger_0 = lessThanEqualsInteger# 0# + equalsInteger_28 = equalsInteger# 28# + equalsInteger_1 = equalsInteger# 1# + equalsInteger_0 = equalsInteger# 0# + multiplyInteger_1 = multiplyInteger# 1# + 1000000000 = 1000000000# + _d8799f581cbe18 = <0 "\190\CAN\194\156\DEL\SI\252\165\195\230\205V\249}\240\248*1\227\ETB\233\155\250\ETX\ESC;\SI\227", "47454e53">#d + chooseList!! = chooseList# ! ! + ifThenElse! = ifThenElse# ! + tailList! = tailList# ! + headList! = headList# ! + zComb = \ f -> let* x = \ y -> f (\ u -> y y u) in f (\ v -> x x v) + x_0 = zComb (\ x_1 x_2 x_3 -> chooseList!! x_3 (\ ~ x_4 x_5 -> x_5 !) (\ ~ -> ifThenElse! (x_2 (headList! x_3)) (\ ~ -> let* x_6 = headList! x_3 in \ x_7 x_8 -> x_7 x_6) (\ ~ -> x_1 x_2 (tailList! x_3)) !) !) + x_9 = zComb (\ x_a x_b x_c -> chooseList!! x_c (\ ~ -> x_b) (\ ~ -> x_a (addInteger# x_b 1#) (tailList! x_c)) !) 0# + x_d = \ x_e -> sndPair!! (unConstrData# x_e) + x_f = \ x_g x_h -> equalsData# (listData# (x_d x_g)) (listData# (x_d x_h)) + tt = ()# + x_i = + \ x_j -> + let* x_k = bData# x_j + in \ x_m x_n x_p -> zComb (\ x_r x_s -> chooseList!! x_s (\ ~ -> x_m) (\ ~ -> ifThenElse! (equalsData# (fstPair!! (headList! x_s)) x_k) (\ ~ -> x_n (sndPair!! (headList! x_s))) (\ ~ -> x_r (tailList! x_s)) !) !) x_p + x_t = \ x_u x_v -> let* x_w = unBData# (headList! (tailList! (x_d x_v))) in x_i (unBData# (headList! (x_d x_v))) 0# (\ x_x -> x_i x_w 0# unIData# (unMapData# x_x)) x_u + mkCons! = mkCons# ! + x_y = \ x_z x_10 x_11 -> x_10 x_z + x_12 = \ x_13 -> ifThenElse! x_13 (\ ~ -> True#) + x_14 = \ x_15 -> ifThenElse! (lessThanEqualsInteger# x_15 0#) (\ ~ -> ERROR) (\ ~ -> x_15) ! + x_16 = \ x_17 -> zComb (\ x_18 x_19 -> chooseList!! x_19 (\ ~ -> []#) (\ ~ -> mkCons! (x_17 (headList! x_19)) (x_18 (tailList! x_19))) !) +in \ x_1a x_1b x_1c -> + let* x_1d = x_d x_1c + x_headList!_x = x_d (headList! x_1d) + x_1e = tailList! (tailList! x_headList!_x) + x_1f = tailList! (tailList! (tailList! (tailList! (tailList! (tailList! x_1e))))) + x_1g = unConstrData# (headList! (tailList! x_1d)) + x_1h = sndPair!! x_1g + in ifThenElse! + (equalsInteger_1 (fstPair!! x_1g)) + (\ ~ -> + let* x_1i = headList! x_1h + in x_0 + (\ x_1j -> x_f x_1i (headList! (x_d x_1j))) + (unListData# (headList! x_headList!_x)) + (\ x_1k -> + let* x_1m = x_d (headList! (tailList! (x_d x_1k))) + in ifThenElse! + (equalsInteger_1 (x_t (unMapData# (headList! (tailList! x_1m))) _d8799f581cbe18)) + (\ ~ -> + let* x_1n = x_d x_1a + tailList!_x = tailList! x_1n + unIData_headList!_tailList!_x = unIData# (headList! tailList!_x) + in ifThenElse! + (zComb + (\ x_1p x_1r -> + chooseList!! + x_1r + (\ ~ x_1s -> lessThanEqualsInteger# unIData_headList!_tailList!_x) + (\ ~ x_1t x_1u -> + ifThenElse! + (lessThanEqualsInteger# unIData_headList!_tailList!_x x_1u) + (\ ~ -> True#) + (\ ~ -> + let* x_1v = headList! x_1r + in zComb + (\ x_1w x_1x -> + chooseList!! + x_1x + (\ ~ x_1y x_1z -> x_1z !) + (\ ~ -> + ifThenElse! (equalsData# (headList! x_1x) x_1v) (\ ~ -> x_y (tailList! x_1x)) (\ ~ -> x_1w (tailList! x_1x) (\ x_20 -> x_y (mkCons! (headList! x_1x) x_20)) (\ ~ x_21 x_22 -> x_22 !)) !) + !) + x_1t + (\ x_23 -> x_1p (tailList! x_1r) x_23 (addInteger# x_1u 1#)) + (\ ~ -> x_1p (tailList! x_1r) x_1t x_1u)) + !) + !) + (unListData# (headList! x_1f)) + (unListData# (headList! x_1n)) + 0#) + (\ ~ -> + let* x_24 = unListData# (headList! x_1e) + headList!_x = headList! x_1m + tailList!_x_x = + tailList! + (x_d + (x_0 + (\ x_25 -> let* x_26 = x_d x_25 in ifThenElse! (equalsInteger_1 (x_t (unMapData# (headList! (tailList! x_26))) _d8799f581cbe18)) (\ ~ -> x_f headList!_x (headList! x_26)) (\ ~ -> False#) !) + x_24 + (\ x_27 -> x_27) + (\ ~ -> ERROR))) + in ifThenElse! + (lessThanEqualsInteger# + (zComb (\ x_28 x_29 x_2a -> chooseList!! x_2a (\ ~ -> x_29) (\ ~ -> x_28 (addInteger# x_29 (x_9 (unMapData# (sndPair!! (headList! x_2a))))) (tailList! x_2a)) !) 0# (unMapData# (headList! tailList!_x_x))) + 10#) + (\ ~ -> + let* x_2b = unMapData# (headList! (tailList! (tailList! x_1f))) + x_2c = unConstrData# (headList! (tailList! tailList!_x_x)) + x_2d = fstPair!! x_2c + x_2e = sndPair!! x_2c + x_x = + x_d + (ifThenElse! + (equalsInteger_1 x_2d) + (\ ~ -> + let* x_2f = bData# (unBData# (headList! x_2e)) + in zComb + (\ x_2g x_2h -> + chooseList!! + x_2h + (\ ~ x_2i x_2j -> x_2j !) + (\ ~ -> ifThenElse! (equalsData# (fstPair!! (headList! x_2h)) x_2f) (\ ~ -> let* x_2k = sndPair!! (headList! x_2h) in \ x_2m x_2n -> x_2m x_2k) (\ ~ -> x_2g (tailList! x_2h)) !) + !) + x_2b + (\ x_2p -> + let* x_2r = unConstrData# x_2p + x_x_0 = sndPair!! x_2r + x_2s = + ifThenElse! + (equalsInteger_0 (fstPair!! x_2r)) + (\ ~ -> + let* x_2t = x_16 (\ x_2u -> ifThenElse! (equalsInteger_28 (lengthOfByteString# (unBData# x_2u))) (\ ~ -> x_2u) (\ ~ -> ERROR) !) (unListData# (headList! x_x_0)) + tailList!_x_x_0 = tailList! x_x_0 + x_2v = unIData# (headList! tailList!_x_x_0) + tailList!_tailList!_x_x = tailList! tailList!_x_x_0 + x_2w = lengthOfByteString# (unBData# (headList! tailList!_tailList!_x_x)) + in ifThenElse! + (x_12 (equalsInteger_0 x_2w) (\ ~ -> equalsInteger_28 x_2w) !) + (\ ~ -> + let* x_2x = tailList! tailList!_tailList!_x_x + x_2y = unConstrData# (headList! x_2x) + x_2z = sndPair!! x_2y + x_30 = + ifThenElse! + (equalsInteger_0 (fstPair!! x_2y)) + (\ ~ -> + let* x_31 = unConstrData# (headList! x_2z) + x_32 = fstPair!! x_31 + x_33 = sndPair!! x_31 + x_34 = + ifThenElse! + (equalsInteger_0 x_32) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_33)))) + (\ ~ -> let* x_35 = chooseList!! (tailList! x_33) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_32) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_33)))) + (\ ~ -> let* x_36 = chooseList!! (tailList! x_33) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_37 = tailList! x_2z + x_38 = unConstrData# (headList! x_37) + x_39 = fstPair!! x_38 + x_3a = sndPair!! x_38 + x_3b = + ifThenElse! + (equalsInteger_0 x_39) + (\ ~ -> + let* x_3c = unConstrData# (headList! x_3a) + x_3d = fstPair!! x_3c + x_3e = sndPair!! x_3c + x_3f = + ifThenElse! + (equalsInteger_0 x_3d) + (\ ~ -> + let* x_3g = unConstrData# (headList! x_3e) + x_3h = fstPair!! x_3g + x_3i = sndPair!! x_3g + x_3j = + ifThenElse! + (equalsInteger_0 x_3h) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_3i)))) + (\ ~ -> let* x_3k = chooseList!! (tailList! x_3i) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_3h) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_3i)))) + (\ ~ -> let* x_3m = chooseList!! (tailList! x_3i) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_3n = chooseList!! (tailList! x_3e) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_3d) + (\ ~ -> + let* x_3p = unIData# (headList! x_3e) + x_3r = tailList! x_3e + x_3s = unIData# (headList! x_3r) + x_3t = tailList! x_3r + x_3u = unIData# (headList! x_3t) + x_3v = chooseList!! (tailList! x_3t) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + ! + x_3w = chooseList!! (tailList! x_3a) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ifThenElse! (equalsInteger_1 x_39) (\ ~ -> let* x_3x = chooseList!! x_3a (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_3y = chooseList!! (tailList! x_37) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + x_3z = tailList! x_2x + x_40 = unIData# (headList! x_3z) + x_41 = tailList! x_3z + x_42 = unConstrData# (headList! x_41) + in ifThenElse! + (equalsInteger_0 (fstPair!! x_42)) + (\ ~ -> + let* x_43 = sndPair!! x_42 + x_44 = unIData# (headList! x_43) + x_45 = tailList! x_43 + x_46 = iData# (x_14 (unIData# (headList! x_45))) + in ifThenElse! + (equalsData# (listData# (tailList! x_45)) (listData___ !)) + (\ ~ -> + let* x_47 = tailList! x_41 + x_48 = unIData# (headList! x_47) + x_49 = tailList! x_47 + x_4a = unIData# (headList! x_49) + x_4b = chooseList!! (tailList! x_49) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + in x_2p) + (\ ~ -> ERROR)) + (\ ~ -> + ifThenElse! + (equalsInteger# 2# x_2d) + (\ ~ -> + let* x_4c = headList! x_2e + x_4d = unConstrData# x_4c + x_4e = sndPair!! x_4d + x_4f = + ifThenElse! + (equalsInteger_0 (fstPair!! x_4d)) + (\ ~ -> + let* x_4g = x_16 (\ x_4h -> ifThenElse! (equalsInteger_28 (lengthOfByteString# (unBData# x_4h))) (\ ~ -> x_4h) (\ ~ -> ERROR) !) (unListData# (headList! x_4e)) + x_4i = tailList! x_4e + x_4j = unIData# (headList! x_4i) + x_4k = tailList! x_4i + x_4m = lengthOfByteString# (unBData# (headList! x_4k)) + in ifThenElse! + (x_12 (equalsInteger_0 x_4m) (\ ~ -> equalsInteger_28 x_4m) !) + (\ ~ -> + let* x_4n = tailList! x_4k + x_4p = unConstrData# (headList! x_4n) + x_4r = sndPair!! x_4p + x_4s = + ifThenElse! + (equalsInteger_0 (fstPair!! x_4p)) + (\ ~ -> + let* x_4t = unConstrData# (headList! x_4r) + x_4u = fstPair!! x_4t + x_4v = sndPair!! x_4t + x_4w = + ifThenElse! + (equalsInteger_0 x_4u) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_4v)))) + (\ ~ -> let* x_4x = chooseList!! (tailList! x_4v) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_4u) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_4v)))) + (\ ~ -> let* x_4y = chooseList!! (tailList! x_4v) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_4z = tailList! x_4r + x_50 = unConstrData# (headList! x_4z) + x_51 = fstPair!! x_50 + x_52 = sndPair!! x_50 + x_53 = + ifThenElse! + (equalsInteger_0 x_51) + (\ ~ -> + let* x_54 = unConstrData# (headList! x_52) + x_55 = fstPair!! x_54 + x_56 = sndPair!! x_54 + x_57 = + ifThenElse! + (equalsInteger_0 x_55) + (\ ~ -> + let* x_58 = unConstrData# (headList! x_56) + x_59 = fstPair!! x_58 + x_5a = sndPair!! x_58 + x_5b = + ifThenElse! + (equalsInteger_0 x_59) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_5a)))) + (\ ~ -> let* x_5c = chooseList!! (tailList! x_5a) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_59) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_5a)))) + (\ ~ -> let* x_5d = chooseList!! (tailList! x_5a) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_5e = chooseList!! (tailList! x_56) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_55) + (\ ~ -> + let* x_5f = unIData# (headList! x_56) + x_5g = tailList! x_56 + x_5h = unIData# (headList! x_5g) + x_5i = tailList! x_5g + x_5j = unIData# (headList! x_5i) + x_5k = chooseList!! (tailList! x_5i) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + ! + x_5m = chooseList!! (tailList! x_52) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ifThenElse! (equalsInteger_1 x_51) (\ ~ -> let* x_5n = chooseList!! x_52 (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_5p = chooseList!! (tailList! x_4z) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + x_5r = tailList! x_4n + x_5s = unIData# (headList! x_5r) + x_5t = tailList! x_5r + x_5u = unConstrData# (headList! x_5t) + in ifThenElse! + (equalsInteger_0 (fstPair!! x_5u)) + (\ ~ -> + let* x_5v = sndPair!! x_5u + x_5w = unIData# (headList! x_5v) + x_5x = tailList! x_5v + x_5y = iData# (x_14 (unIData# (headList! x_5x))) + in ifThenElse! + (equalsData# (listData# (tailList! x_5x)) (listData___ !)) + (\ ~ -> + let* x_5z = tailList! x_5t + x_60 = unIData# (headList! x_5z) + x_61 = tailList! x_5z + x_62 = unIData# (headList! x_61) + x_63 = chooseList!! (tailList! x_61) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + in x_4c) + (\ ~ -> ERROR) + !) + !) + tailList!_x_x_1 = tailList! x_x + tailList!_tailList!_x_x_0 = tailList! tailList!_x_x_1 + x_64 = tailList! tailList!_tailList!_x_x_0 + x_65 = tailList! x_64 + x_66 = tailList! x_65 + x_67 = tailList! x_66 + unListData_headList!_x_x = unListData# (headList! x_x) + in ifThenElse! + (zComb + (\ x_68 x_69 -> + chooseList!! + x_69 + (\ ~ -> True#) + (\ ~ -> + let* x_6a = headList! x_69 + in ifThenElse! + (zComb (\ x_6b x_6c -> chooseList!! x_6c (\ ~ -> False#) (\ ~ -> ifThenElse! (equalsData# (headList! x_6c) x_6a) (\ ~ -> True#) (\ ~ -> x_6b (tailList! x_6c)) !) !) (tailList! x_69)) + (\ ~ -> False#) + (\ ~ -> x_68 (tailList! x_69)) + !) + !) + unListData_headList!_x_x) + (\ ~ -> + let* x_unListData_headList!_x_x = x_9 unListData_headList!_x_x + in ifThenElse! + (lessThanEqualsInteger# x_unListData_headList!_x_x 10#) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger_1 x_unListData_headList!_x_x) + (\ ~ -> + let* x_6d = unIData# (headList! tailList!_x_x_1) + in ifThenElse! + (lessThanEqualsInteger_1 x_6d) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger# x_6d x_unListData_headList!_x_x) + (\ ~ -> + ifThenElse! + (equalsData# (headList! (tailList! tailList!_x)) (headList! tailList!_tailList!_x_x_0)) + (\ ~ -> + let* x_6e = headList! x_64 + in ifThenElse! + (x_0 (\ x_6f -> equalsData# (headList! (x_d x_6f)) x_6e) x_24 (\ x_6g -> True#) (\ ~ -> False#)) + (\ ~ -> + let* x_6h = unIData# (headList! x_65) + in ifThenElse! + (lessThanEqualsInteger_0 x_6h) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger# x_6h 1000000000) + (\ ~ -> + let* x_6i = unIData# (headList! x_67) + in ifThenElse! + (lessThanEqualsInteger_0 x_6i) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger# x_6i 1000000000) + (\ ~ -> + let* x_6j = unIData# (headList! (tailList! x_67)) + in ifThenElse! + (lessThanEqualsInteger_0 x_6j) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger# x_6j 1000000000) + (\ ~ -> + let* x_6k = headList! x_66 + in ifThenElse! + (lessThanEqualsInteger_0 (unIData# (headList! (x_d x_6k)))) + (\ ~ -> + let* x_6m = x_d x_6k + in ifThenElse! + (lessThanEqualsInteger# + (multiplyInteger_1 (unIData# (headList! x_6m))) + (multiplyInteger_1 (unIData# (headList! (tailList! x_6m))))) + (\ ~ -> tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> tt) + !) + (\ ~ -> ERROR)) + (\ ~ -> ERROR) + ! diff --git a/geniusyield-onchain/fixtures/partialorderconfig-optimized.txt b/geniusyield-onchain/fixtures/partialorderconfig-optimized.txt new file mode 100644 index 00000000..59620f50 --- /dev/null +++ b/geniusyield-onchain/fixtures/partialorderconfig-optimized.txt @@ -0,0 +1,513 @@ +let* sndPair!! = sndPair# ! ! + fstPair!! = fstPair# ! ! + listData___ = \ ~ -> listData# []# + lessThanEqualsInteger_1 = lessThanEqualsInteger# 1# + lessThanEqualsInteger_0 = lessThanEqualsInteger# 0# + equalsInteger_28 = equalsInteger# 28# + equalsInteger_1 = equalsInteger# 1# + equalsInteger_0 = equalsInteger# 0# + multiplyInteger_1 = multiplyInteger# 1# + 1000000000 = 1000000000# + _d8799f581cbe18 = <0 "\190\CAN\194\156\DEL\SI\252\165\195\230\205V\249}\240\248*1\227\ETB\233\155\250\ETX\ESC;\SI\227", "47454e53">#d + chooseList!! = chooseList# ! ! + ifThenElse! = ifThenElse# ! + tailList! = tailList# ! + headList! = headList# ! + zComb = \ f -> let* x = \ y -> f (\ u -> y y u) in f (\ v -> x x v) + x_0 = zComb (\ x_1 x_2 x_3 -> chooseList!! x_3 (\ ~ x_4 x_5 -> x_5 !) (\ ~ -> ifThenElse! (x_2 (headList! x_3)) (\ ~ -> let* x_6 = headList! x_3 in \ x_7 x_8 -> x_7 x_6) (\ ~ -> x_1 x_2 (tailList! x_3)) !) !) + x_9 = zComb (\ x_a x_b x_c -> chooseList!! x_c (\ ~ -> x_b) (\ ~ -> x_a (addInteger# x_b 1#) (tailList! x_c)) !) 0# + x_d = \ x_e -> sndPair!! (unConstrData# x_e) + x_f = \ x_g x_h -> equalsData# (listData# (x_d x_g)) (listData# (x_d x_h)) + tt = ()# + x_i = + \ x_j -> + let* x_k = bData# x_j + in \ x_m x_n x_p -> zComb (\ x_r x_s -> chooseList!! x_s (\ ~ -> x_m) (\ ~ -> ifThenElse! (equalsData# (fstPair!! (headList! x_s)) x_k) (\ ~ -> x_n (sndPair!! (headList! x_s))) (\ ~ -> x_r (tailList! x_s)) !) !) x_p + x_t = \ x_u x_v -> let* x_w = unBData# (headList! (tailList! (x_d x_v))) in x_i (unBData# (headList! (x_d x_v))) 0# (\ x_x -> x_i x_w 0# unIData# (unMapData# x_x)) x_u + mkCons! = mkCons# ! + x_y = \ x_z x_10 x_11 -> x_10 x_z + x_12 = \ x_13 -> ifThenElse! x_13 (\ ~ -> True#) + x_14 = \ x_15 -> ifThenElse! (lessThanEqualsInteger# x_15 0#) (\ ~ -> ERROR) (\ ~ -> x_15) ! + x_16 = \ x_17 -> zComb (\ x_18 x_19 -> chooseList!! x_19 (\ ~ -> []#) (\ ~ -> mkCons! (x_17 (headList! x_19)) (x_18 (tailList! x_19))) !) +in \ x_1a x_1b x_1c -> + let* x_1d = x_d x_1c + x_headList!_x = x_d (headList! x_1d) + x_1e = tailList! (tailList! x_headList!_x) + x_1f = tailList! (tailList! (tailList! (tailList! (tailList! (tailList! x_1e))))) + x_1g = unConstrData# (headList! (tailList! x_1d)) + x_1h = sndPair!! x_1g + in ifThenElse! + (equalsInteger_1 (fstPair!! x_1g)) + (\ ~ -> + let* x_1i = headList! x_1h + in x_0 + (\ x_1j -> x_f x_1i (headList! (x_d x_1j))) + (unListData# (headList! x_headList!_x)) + (\ x_1k -> + let* x_1m = x_d (headList! (tailList! (x_d x_1k))) + in ifThenElse! + (equalsInteger_1 (x_t (unMapData# (headList! (tailList! x_1m))) _d8799f581cbe18)) + (\ ~ -> + let* x_1n = x_d x_1a + tailList!_x = tailList! x_1n + unIData_headList!_tailList!_x = unIData# (headList! tailList!_x) + in ifThenElse! + (zComb + (\ x_1p x_1r -> + chooseList!! + x_1r + (\ ~ x_1s -> lessThanEqualsInteger# unIData_headList!_tailList!_x) + (\ ~ x_1t x_1u -> + ifThenElse! + (lessThanEqualsInteger# unIData_headList!_tailList!_x x_1u) + (\ ~ -> True#) + (\ ~ -> + let* x_1v = headList! x_1r + in zComb + (\ x_1w x_1x -> + chooseList!! + x_1x + (\ ~ x_1y x_1z -> x_1z !) + (\ ~ -> + ifThenElse! (equalsData# (headList! x_1x) x_1v) (\ ~ -> x_y (tailList! x_1x)) (\ ~ -> x_1w (tailList! x_1x) (\ x_20 -> x_y (mkCons! (headList! x_1x) x_20)) (\ ~ x_21 x_22 -> x_22 !)) !) + !) + x_1t + (\ x_23 -> x_1p (tailList! x_1r) x_23 (addInteger# x_1u 1#)) + (\ ~ -> x_1p (tailList! x_1r) x_1t x_1u)) + !) + !) + (unListData# (headList! x_1f)) + (unListData# (headList! x_1n)) + 0#) + (\ ~ -> + let* x_24 = unListData# (headList! x_1e) + headList!_x = headList! x_1m + tailList!_x_x = + tailList! + (x_d + (x_0 + (\ x_25 -> let* x_26 = x_d x_25 in ifThenElse! (equalsInteger_1 (x_t (unMapData# (headList! (tailList! x_26))) _d8799f581cbe18)) (\ ~ -> x_f headList!_x (headList! x_26)) (\ ~ -> False#) !) + x_24 + (\ x_27 -> x_27) + (\ ~ -> ERROR))) + in ifThenElse! + (lessThanEqualsInteger# + (zComb (\ x_28 x_29 x_2a -> chooseList!! x_2a (\ ~ -> x_29) (\ ~ -> x_28 (addInteger# x_29 (x_9 (unMapData# (sndPair!! (headList! x_2a))))) (tailList! x_2a)) !) 0# (unMapData# (headList! tailList!_x_x))) + 10#) + (\ ~ -> + let* x_2b = unMapData# (headList! (tailList! (tailList! x_1f))) + x_2c = unConstrData# (headList! (tailList! tailList!_x_x)) + x_2d = fstPair!! x_2c + x_2e = sndPair!! x_2c + x_x = + x_d + (ifThenElse! + (equalsInteger_1 x_2d) + (\ ~ -> + let* x_2f = bData# (unBData# (headList! x_2e)) + in zComb + (\ x_2g x_2h -> + chooseList!! + x_2h + (\ ~ x_2i x_2j -> x_2j !) + (\ ~ -> ifThenElse! (equalsData# (fstPair!! (headList! x_2h)) x_2f) (\ ~ -> let* x_2k = sndPair!! (headList! x_2h) in \ x_2m x_2n -> x_2m x_2k) (\ ~ -> x_2g (tailList! x_2h)) !) + !) + x_2b + (\ x_2p -> + let* x_2r = unConstrData# x_2p + x_x_0 = sndPair!! x_2r + x_2s = + ifThenElse! + (equalsInteger_0 (fstPair!! x_2r)) + (\ ~ -> + let* x_2t = x_16 (\ x_2u -> ifThenElse! (equalsInteger_28 (lengthOfByteString# (unBData# x_2u))) (\ ~ -> x_2u) (\ ~ -> ERROR) !) (unListData# (headList! x_x_0)) + tailList!_x_x_0 = tailList! x_x_0 + x_2v = unIData# (headList! tailList!_x_x_0) + tailList!_tailList!_x_x = tailList! tailList!_x_x_0 + x_2w = lengthOfByteString# (unBData# (headList! tailList!_tailList!_x_x)) + in ifThenElse! + (x_12 (equalsInteger_0 x_2w) (\ ~ -> equalsInteger_28 x_2w) !) + (\ ~ -> + let* x_2x = tailList! tailList!_tailList!_x_x + x_2y = unConstrData# (headList! x_2x) + x_2z = sndPair!! x_2y + x_30 = + ifThenElse! + (equalsInteger_0 (fstPair!! x_2y)) + (\ ~ -> + let* x_31 = unConstrData# (headList! x_2z) + x_32 = fstPair!! x_31 + x_33 = sndPair!! x_31 + x_34 = + ifThenElse! + (equalsInteger_0 x_32) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_33)))) + (\ ~ -> let* x_35 = chooseList!! (tailList! x_33) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_32) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_33)))) + (\ ~ -> let* x_36 = chooseList!! (tailList! x_33) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_37 = tailList! x_2z + x_38 = unConstrData# (headList! x_37) + x_39 = fstPair!! x_38 + x_3a = sndPair!! x_38 + x_3b = + ifThenElse! + (equalsInteger_0 x_39) + (\ ~ -> + let* x_3c = unConstrData# (headList! x_3a) + x_3d = fstPair!! x_3c + x_3e = sndPair!! x_3c + x_3f = + ifThenElse! + (equalsInteger_0 x_3d) + (\ ~ -> + let* x_3g = unConstrData# (headList! x_3e) + x_3h = fstPair!! x_3g + x_3i = sndPair!! x_3g + x_3j = + ifThenElse! + (equalsInteger_0 x_3h) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_3i)))) + (\ ~ -> let* x_3k = chooseList!! (tailList! x_3i) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_3h) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_3i)))) + (\ ~ -> let* x_3m = chooseList!! (tailList! x_3i) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_3n = chooseList!! (tailList! x_3e) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_3d) + (\ ~ -> + let* x_3p = unIData# (headList! x_3e) + x_3r = tailList! x_3e + x_3s = unIData# (headList! x_3r) + x_3t = tailList! x_3r + x_3u = unIData# (headList! x_3t) + x_3v = chooseList!! (tailList! x_3t) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + ! + x_3w = chooseList!! (tailList! x_3a) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ifThenElse! (equalsInteger_1 x_39) (\ ~ -> let* x_3x = chooseList!! x_3a (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_3y = chooseList!! (tailList! x_37) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + x_3z = tailList! x_2x + x_40 = unIData# (headList! x_3z) + x_41 = tailList! x_3z + x_42 = unConstrData# (headList! x_41) + in ifThenElse! + (equalsInteger_0 (fstPair!! x_42)) + (\ ~ -> + let* x_43 = sndPair!! x_42 + x_44 = unIData# (headList! x_43) + x_45 = tailList! x_43 + x_46 = iData# (x_14 (unIData# (headList! x_45))) + in ifThenElse! + (equalsData# (listData# (tailList! x_45)) (listData___ !)) + (\ ~ -> + let* x_47 = tailList! x_41 + x_48 = unIData# (headList! x_47) + x_49 = tailList! x_47 + x_4a = unIData# (headList! x_49) + x_4b = chooseList!! (tailList! x_49) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + in x_2p) + (\ ~ -> ERROR)) + (\ ~ -> + ifThenElse! + (equalsInteger# 2# x_2d) + (\ ~ -> + let* x_4c = headList! x_2e + x_4d = unConstrData# x_4c + x_4e = sndPair!! x_4d + x_4f = + ifThenElse! + (equalsInteger_0 (fstPair!! x_4d)) + (\ ~ -> + let* x_4g = x_16 (\ x_4h -> ifThenElse! (equalsInteger_28 (lengthOfByteString# (unBData# x_4h))) (\ ~ -> x_4h) (\ ~ -> ERROR) !) (unListData# (headList! x_4e)) + x_4i = tailList! x_4e + x_4j = unIData# (headList! x_4i) + x_4k = tailList! x_4i + x_4m = lengthOfByteString# (unBData# (headList! x_4k)) + in ifThenElse! + (x_12 (equalsInteger_0 x_4m) (\ ~ -> equalsInteger_28 x_4m) !) + (\ ~ -> + let* x_4n = tailList! x_4k + x_4p = unConstrData# (headList! x_4n) + x_4r = sndPair!! x_4p + x_4s = + ifThenElse! + (equalsInteger_0 (fstPair!! x_4p)) + (\ ~ -> + let* x_4t = unConstrData# (headList! x_4r) + x_4u = fstPair!! x_4t + x_4v = sndPair!! x_4t + x_4w = + ifThenElse! + (equalsInteger_0 x_4u) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_4v)))) + (\ ~ -> let* x_4x = chooseList!! (tailList! x_4v) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_4u) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_4v)))) + (\ ~ -> let* x_4y = chooseList!! (tailList! x_4v) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_4z = tailList! x_4r + x_50 = unConstrData# (headList! x_4z) + x_51 = fstPair!! x_50 + x_52 = sndPair!! x_50 + x_53 = + ifThenElse! + (equalsInteger_0 x_51) + (\ ~ -> + let* x_54 = unConstrData# (headList! x_52) + x_55 = fstPair!! x_54 + x_56 = sndPair!! x_54 + x_57 = + ifThenElse! + (equalsInteger_0 x_55) + (\ ~ -> + let* x_58 = unConstrData# (headList! x_56) + x_59 = fstPair!! x_58 + x_5a = sndPair!! x_58 + x_5b = + ifThenElse! + (equalsInteger_0 x_59) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_5a)))) + (\ ~ -> let* x_5c = chooseList!! (tailList! x_5a) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_59) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_5a)))) + (\ ~ -> let* x_5d = chooseList!! (tailList! x_5a) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_5e = chooseList!! (tailList! x_56) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_55) + (\ ~ -> + let* x_5f = unIData# (headList! x_56) + x_5g = tailList! x_56 + x_5h = unIData# (headList! x_5g) + x_5i = tailList! x_5g + x_5j = unIData# (headList! x_5i) + x_5k = chooseList!! (tailList! x_5i) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + ! + x_5m = chooseList!! (tailList! x_52) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ifThenElse! (equalsInteger_1 x_51) (\ ~ -> let* x_5n = chooseList!! x_52 (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_5p = chooseList!! (tailList! x_4z) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + x_5r = tailList! x_4n + x_5s = unIData# (headList! x_5r) + x_5t = tailList! x_5r + x_5u = unConstrData# (headList! x_5t) + in ifThenElse! + (equalsInteger_0 (fstPair!! x_5u)) + (\ ~ -> + let* x_5v = sndPair!! x_5u + x_5w = unIData# (headList! x_5v) + x_5x = tailList! x_5v + x_5y = iData# (x_14 (unIData# (headList! x_5x))) + in ifThenElse! + (equalsData# (listData# (tailList! x_5x)) (listData___ !)) + (\ ~ -> + let* x_5z = tailList! x_5t + x_60 = unIData# (headList! x_5z) + x_61 = tailList! x_5z + x_62 = unIData# (headList! x_61) + x_63 = chooseList!! (tailList! x_61) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + in x_4c) + (\ ~ -> ERROR) + !) + !) + tailList!_x_x_1 = tailList! x_x + tailList!_tailList!_x_x_0 = tailList! tailList!_x_x_1 + x_64 = tailList! tailList!_tailList!_x_x_0 + x_65 = tailList! x_64 + x_66 = tailList! x_65 + x_67 = tailList! x_66 + unListData_headList!_x_x = unListData# (headList! x_x) + in ifThenElse! + (zComb + (\ x_68 x_69 -> + chooseList!! + x_69 + (\ ~ -> True#) + (\ ~ -> + let* x_6a = headList! x_69 + in ifThenElse! + (zComb (\ x_6b x_6c -> chooseList!! x_6c (\ ~ -> False#) (\ ~ -> ifThenElse! (equalsData# (headList! x_6c) x_6a) (\ ~ -> True#) (\ ~ -> x_6b (tailList! x_6c)) !) !) (tailList! x_69)) + (\ ~ -> False#) + (\ ~ -> x_68 (tailList! x_69)) + !) + !) + unListData_headList!_x_x) + (\ ~ -> + let* x_unListData_headList!_x_x = x_9 unListData_headList!_x_x + in ifThenElse! + (lessThanEqualsInteger# x_unListData_headList!_x_x 10#) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger_1 x_unListData_headList!_x_x) + (\ ~ -> + let* x_6d = unIData# (headList! tailList!_x_x_1) + in ifThenElse! + (lessThanEqualsInteger_1 x_6d) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger# x_6d x_unListData_headList!_x_x) + (\ ~ -> + ifThenElse! + (equalsData# (headList! (tailList! tailList!_x)) (headList! tailList!_tailList!_x_x_0)) + (\ ~ -> + let* x_6e = headList! x_64 + in ifThenElse! + (x_0 (\ x_6f -> equalsData# (headList! (x_d x_6f)) x_6e) x_24 (\ x_6g -> True#) (\ ~ -> False#)) + (\ ~ -> + let* x_6h = unIData# (headList! x_65) + in ifThenElse! + (lessThanEqualsInteger_0 x_6h) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger# x_6h 1000000000) + (\ ~ -> + let* x_6i = unIData# (headList! x_67) + in ifThenElse! + (lessThanEqualsInteger_0 x_6i) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger# x_6i 1000000000) + (\ ~ -> + let* x_6j = unIData# (headList! (tailList! x_67)) + in ifThenElse! + (lessThanEqualsInteger_0 x_6j) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger# x_6j 1000000000) + (\ ~ -> + let* x_6k = headList! x_66 + in ifThenElse! + (lessThanEqualsInteger_0 (unIData# (headList! (x_d x_6k)))) + (\ ~ -> + let* x_6m = x_d x_6k + in ifThenElse! + (lessThanEqualsInteger# + (multiplyInteger_1 (unIData# (headList! x_6m))) + (multiplyInteger_1 (unIData# (headList! (tailList! x_6m))))) + (\ ~ -> tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> tt) + !) + (\ ~ -> ERROR)) + (\ ~ -> ERROR) + ! diff --git a/geniusyield-onchain/fixtures/partialorderconfig-original.txt b/geniusyield-onchain/fixtures/partialorderconfig-original.txt new file mode 100644 index 00000000..a87bc784 --- /dev/null +++ b/geniusyield-onchain/fixtures/partialorderconfig-original.txt @@ -0,0 +1,583 @@ +let* x = sndPair# ! ! + x_0 = \ x_1 -> x (unConstrData# x_1) + x_2 = headList# ! + x_3 = tailList# ! + x_4 = fstPair# ! ! + x_5 = \ x_6 x_7 -> equalsData# (listData# (x_0 x_6)) (listData# (x_0 x_7)) + x_8 = ifThenElse# ! + x_9 = chooseList# ! ! + x_a = \ x_b -> let* x_c = \ x_d -> x_b (\ x_e -> x_d x_d x_e) in x_b (\ x_f -> x_c x_c x_f) + x_g = \ x_h x_i x_j x_k -> x_a (\ x_m x_n -> x_9 x_n (\ ~ -> x_i) (\ ~ -> x_8 (equalsData# (x_4 (x_2 x_n)) x_h) (\ ~ -> x_j (x (x_2 x_n))) (\ ~ -> x_m (x_3 x_n)) !) !) x_k + x_p = \ x_r -> x_g (bData# x_r) + x_s = \ x_t x_u x_v -> x_p x_u 0# (\ x_w -> x_p x_v 0# unIData# (unMapData# x_w)) x_t + x_x = \ x_y x_z -> let* x_10 = unBData# (x_2 (x_0 x_z)); x_11 = unBData# (x_2 (x_3 (x_0 x_z))) in x_s x_y x_10 x_11 + x_12 = x_a (\ x_13 x_14 x_15 -> x_9 x_15 (\ ~ x_16 x_17 -> x_17 !) (\ ~ -> x_8 (x_14 (x_2 x_15)) (\ ~ -> let* x_18 = x_2 x_15 in \ x_19 x_1a -> x_19 x_18) (\ ~ -> x_13 x_14 (x_3 x_15)) !) !) + x_1b = mkCons# ! + x_1c = []# + x_1d = \ x_1e -> x_a (\ x_1f x_1g -> x_9 x_1g (\ ~ -> x_1c) (\ ~ -> x_1b (x_1e (x_2 x_1g)) (x_1f (x_3 x_1g))) !) + x_1h = \ x_1i -> x_8 (lessThanEqualsInteger# x_1i 0#) (\ ~ -> ERROR) (\ ~ -> x_1i) ! + x_1j = \ ~ -> True# + x_1k = \ x_1m -> x_8 x_1m x_1j + x_1n = x_a (\ x_1p x_1r x_1s -> x_9 x_1s (\ ~ -> x_1r) (\ ~ -> x_1p (addInteger# x_1r 1#) (x_3 x_1s)) !) 0# + x_1t = 1000000000# + x_1u = \ x_1v x_1w x_1x -> x_1w x_1v + x_1y = <0 "\190\CAN\194\156\DEL\SI\252\165\195\230\205V\249}\240\248*1\227\ETB\233\155\250\ETX\ESC;\SI\227", "47454e53">#d +in \ x_1z x_20 x_21 -> + let* x_22 = x_0 x_21 + x_23 = x_0 (x_2 x_22) + x_24 = x_3 (x_3 x_23) + x_25 = x_3 x_24 + x_26 = x_3 (x_3 (x_3 (x_3 (x_3 x_25)))) + x_27 = unConstrData# (x_2 (x_3 x_22)) + x_28 = x_4 x_27 + x_29 = x x_27 + in x_8 + (equalsInteger# 1# x_28) + (\ ~ -> + let* x_2a = x_2 x_29 + x_2b = unListData# (x_2 x_23) + in x_12 + (\ x_2c -> x_5 x_2a (x_2 (x_0 x_2c))) + x_2b + (\ x_2d -> + let* x_2e = x_0 (x_2 (x_3 (x_0 x_2d))) + in x_8 + (equalsInteger# (x_x (unMapData# (x_2 (x_3 x_2e))) x_1y) 1#) + (\ ~ -> + let* x_2f = x_0 x_1z + x_2g = x_3 x_2f + in x_8 + (let* x_2h = unListData# (x_2 x_26) + x_2i = unListData# (x_2 x_2f) + x_2j = unIData# (x_2 x_2g) + in x_a + (\ x_2k x_2m -> + x_9 + x_2m + (\ ~ x_2n x_2p -> lessThanEqualsInteger# x_2j x_2p) + (\ ~ x_2r x_2s -> + x_8 + (lessThanEqualsInteger# x_2j x_2s) + (\ ~ -> True#) + (\ ~ -> + let* x_2t = x_2 x_2m + in x_a + (\ x_2u x_2v -> + x_9 + x_2v + (\ ~ x_2w x_2x -> x_2x !) + (\ ~ -> x_8 (equalsData# (x_2 x_2v) x_2t) (\ ~ -> x_1u (x_3 x_2v)) (\ ~ -> x_2u (x_3 x_2v) (\ x_2y -> x_1u (x_1b (x_2 x_2v) x_2y)) (\ ~ x_2z x_30 -> x_30 !)) !) + !) + x_2r + (\ x_31 -> x_2k (x_3 x_2m) x_31 (addInteger# x_2s 1#)) + (\ ~ -> x_2k (x_3 x_2m) x_2r x_2s)) + !) + !) + x_2h + x_2i + 0#) + (\ ~ -> + let* x_32 = unListData# (x_2 x_24) + x_33 = x_2 x_2e + x_34 = + x_12 + (\ x_35 -> let* x_36 = x_0 x_35; x_37 = equalsInteger# (x_x (unMapData# (x_2 (x_3 x_36))) x_1y) 1#; x_38 = \ ~ -> x_5 x_33 (x_2 x_36) in x_8 x_37 x_38 (\ ~ -> False#) !) + x_32 + (\ x_39 -> x_39) + (\ ~ -> ERROR) + x_3a = x_3 (x_0 x_34) + in x_8 + (lessThanEqualsInteger# + (let* x_3b = unMapData# (x_2 x_3a) + x_3c = \ x_3d x_3e -> addInteger# x_3d (x_1n (unMapData# (x x_3e))) + in x_a (\ x_3f x_3g x_3h -> x_9 x_3h (\ ~ -> x_3g) (\ ~ -> x_3f (x_3c x_3g (x_2 x_3h)) (x_3 x_3h)) !) 0# x_3b) + 10#) + (\ ~ -> + let* x_3i = x_2 (x_3 x_3a) + x_3j = unMapData# (x_2 (x_3 (x_3 x_26))) + x_3k = unConstrData# x_3i + x_3m = x_4 x_3k + x_3n = x x_3k + x_3p = + x_8 + (equalsInteger# 1# x_3m) + (\ ~ -> + let* x_3r = unBData# (x_2 x_3n) + x_3s = \ x_3t -> let* x_3u = x x_3t in \ x_3v x_3w -> x_3v x_3u + x_3x = bData# x_3r + in x_a + (\ x_3y x_3z -> x_9 x_3z (\ ~ x_40 x_41 -> x_41 !) (\ ~ -> x_8 (equalsData# (x_4 (x_2 x_3z)) x_3x) (\ ~ -> x_3s (x_2 x_3z)) (\ ~ -> x_3y (x_3 x_3z)) !) !) + x_3j + (\ x_42 -> + let* x_43 = unConstrData# x_42 + x_44 = x_4 x_43 + x_45 = x x_43 + x_46 = + x_8 + (equalsInteger# 0# x_44) + (\ ~ -> + let* x_47 = x_2 x_45 + x_48 = x_1d (\ x_49 -> let* x_4a = unBData# x_49 in x_8 (equalsInteger# (lengthOfByteString# x_4a) 28#) (\ ~ -> x_49) (\ ~ -> ERROR) !) (unListData# x_47) + x_4b = x_3 x_45 + x_4c = x_2 x_4b + x_4d = unIData# x_4c + x_4e = x_3 x_4b + x_4f = x_2 x_4e + x_4g = unBData# x_4f + x_4h = lengthOfByteString# x_4g + in x_8 + (x_1k (equalsInteger# x_4h 0#) (\ ~ -> equalsInteger# x_4h 28#) !) + (\ ~ -> + let* x_4i = x_3 x_4e + x_4j = x_2 x_4i + x_4k = unConstrData# x_4j + x_4m = x_4 x_4k + x_4n = x x_4k + x_4p = + x_8 + (equalsInteger# 0# x_4m) + (\ ~ -> + let* x_4r = x_2 x_4n + x_4s = unConstrData# x_4r + x_4t = x_4 x_4s + x_4u = x x_4s + x_4v = + x_8 + (equalsInteger# 0# x_4t) + (\ ~ -> + let* x_4w = x_2 x_4u + x_4x = unBData# x_4w + in x_8 + (equalsInteger# (lengthOfByteString# x_4x) 28#) + (\ ~ -> let* x_4y = x_3 x_4u; x_4z = x_9 x_4y (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> + x_8 + (equalsInteger# 1# x_4t) + (\ ~ -> + let* x_50 = x_2 x_4u + x_51 = unBData# x_50 + in x_8 + (equalsInteger# (lengthOfByteString# x_51) 28#) + (\ ~ -> let* x_52 = x_3 x_4u; x_53 = x_9 x_52 (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_54 = x_3 x_4n + x_55 = x_2 x_54 + x_56 = unConstrData# x_55 + x_57 = x_4 x_56 + x_58 = x x_56 + x_59 = + x_8 + (equalsInteger# 0# x_57) + (\ ~ -> + let* x_5a = x_2 x_58 + x_5b = unConstrData# x_5a + x_5c = x_4 x_5b + x_5d = x x_5b + x_5e = + x_8 + (equalsInteger# 0# x_5c) + (\ ~ -> + let* x_5f = x_2 x_5d + x_5g = unConstrData# x_5f + x_5h = x_4 x_5g + x_5i = x x_5g + x_5j = + x_8 + (equalsInteger# 0# x_5h) + (\ ~ -> + let* x_5k = x_2 x_5i + x_5m = unBData# x_5k + in x_8 + (equalsInteger# (lengthOfByteString# x_5m) 28#) + (\ ~ -> let* x_5n = x_3 x_5i; x_5p = x_9 x_5n (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> + x_8 + (equalsInteger# 1# x_5h) + (\ ~ -> + let* x_5r = x_2 x_5i + x_5s = unBData# x_5r + in x_8 + (equalsInteger# (lengthOfByteString# x_5s) 28#) + (\ ~ -> let* x_5t = x_3 x_5i; x_5u = x_9 x_5t (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_5v = x_3 x_5d + x_5w = x_9 x_5v (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> + x_8 + (equalsInteger# 1# x_5c) + (\ ~ -> + let* x_5x = x_2 x_5d + x_5y = unIData# x_5x + x_5z = x_3 x_5d + x_60 = x_2 x_5z + x_61 = unIData# x_60 + x_62 = x_3 x_5z + x_63 = x_2 x_62 + x_64 = unIData# x_63 + x_65 = x_3 x_62 + x_66 = x_9 x_65 (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + !) + ! + x_67 = x_3 x_58 + x_68 = x_9 x_67 (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> x_8 (equalsInteger# 1# x_57) (\ ~ -> let* x_69 = x_9 x_58 (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) (\ ~ -> ERROR) !) + ! + x_6a = x_3 x_54 + x_6b = x_9 x_6a (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + ! + x_6c = x_3 x_4i + x_6d = x_2 x_6c + x_6e = unIData# x_6d + x_6f = x_3 x_6c + x_6g = x_2 x_6f + x_6h = unConstrData# x_6g + in x_8 + (equalsInteger# (x_4 x_6h) 0#) + (\ ~ -> + let* x_6i = x x_6h + x_6j = unIData# (x_2 x_6i) + x_6k = x_3 x_6i + x_6m = unIData# (x_2 x_6k) + x_6n = x_1h x_6m + x_6p = iData# x_6n + in x_8 + (equalsData# (listData# (x_3 x_6k)) (listData# x_1c)) + (\ ~ -> + let* x_6r = x_3 x_6f + x_6s = x_2 x_6r + x_6t = unIData# x_6s + x_6u = x_3 x_6r + x_6v = x_2 x_6u + x_6w = unIData# x_6v + x_6x = x_3 x_6u + x_6y = x_9 x_6x (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + in x_42) + (\ ~ -> ERROR)) + (\ ~ -> + x_8 + (equalsInteger# 2# x_3m) + (\ ~ -> + let* x_6z = x_2 x_3n + x_70 = unConstrData# x_6z + x_71 = x_4 x_70 + x_72 = x x_70 + x_73 = + x_8 + (equalsInteger# 0# x_71) + (\ ~ -> + let* x_74 = x_2 x_72 + x_75 = x_1d (\ x_76 -> let* x_77 = unBData# x_76 in x_8 (equalsInteger# (lengthOfByteString# x_77) 28#) (\ ~ -> x_76) (\ ~ -> ERROR) !) (unListData# x_74) + x_78 = x_3 x_72 + x_79 = x_2 x_78 + x_7a = unIData# x_79 + x_7b = x_3 x_78 + x_7c = x_2 x_7b + x_7d = unBData# x_7c + x_7e = lengthOfByteString# x_7d + in x_8 + (x_1k (equalsInteger# x_7e 0#) (\ ~ -> equalsInteger# x_7e 28#) !) + (\ ~ -> + let* x_7f = x_3 x_7b + x_7g = x_2 x_7f + x_7h = unConstrData# x_7g + x_7i = x_4 x_7h + x_7j = x x_7h + x_7k = + x_8 + (equalsInteger# 0# x_7i) + (\ ~ -> + let* x_7m = x_2 x_7j + x_7n = unConstrData# x_7m + x_7p = x_4 x_7n + x_7r = x x_7n + x_7s = + x_8 + (equalsInteger# 0# x_7p) + (\ ~ -> + let* x_7t = x_2 x_7r + x_7u = unBData# x_7t + in x_8 + (equalsInteger# (lengthOfByteString# x_7u) 28#) + (\ ~ -> let* x_7v = x_3 x_7r; x_7w = x_9 x_7v (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> + x_8 + (equalsInteger# 1# x_7p) + (\ ~ -> + let* x_7x = x_2 x_7r + x_7y = unBData# x_7x + in x_8 + (equalsInteger# (lengthOfByteString# x_7y) 28#) + (\ ~ -> let* x_7z = x_3 x_7r; x_80 = x_9 x_7z (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_81 = x_3 x_7j + x_82 = x_2 x_81 + x_83 = unConstrData# x_82 + x_84 = x_4 x_83 + x_85 = x x_83 + x_86 = + x_8 + (equalsInteger# 0# x_84) + (\ ~ -> + let* x_87 = x_2 x_85 + x_88 = unConstrData# x_87 + x_89 = x_4 x_88 + x_8a = x x_88 + x_8b = + x_8 + (equalsInteger# 0# x_89) + (\ ~ -> + let* x_8c = x_2 x_8a + x_8d = unConstrData# x_8c + x_8e = x_4 x_8d + x_8f = x x_8d + x_8g = + x_8 + (equalsInteger# 0# x_8e) + (\ ~ -> + let* x_8h = x_2 x_8f + x_8i = unBData# x_8h + in x_8 + (equalsInteger# (lengthOfByteString# x_8i) 28#) + (\ ~ -> let* x_8j = x_3 x_8f; x_8k = x_9 x_8j (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> + x_8 + (equalsInteger# 1# x_8e) + (\ ~ -> + let* x_8m = x_2 x_8f + x_8n = unBData# x_8m + in x_8 + (equalsInteger# (lengthOfByteString# x_8n) 28#) + (\ ~ -> let* x_8p = x_3 x_8f; x_8r = x_9 x_8p (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_8s = x_3 x_8a + x_8t = x_9 x_8s (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> + x_8 + (equalsInteger# 1# x_89) + (\ ~ -> + let* x_8u = x_2 x_8a + x_8v = unIData# x_8u + x_8w = x_3 x_8a + x_8x = x_2 x_8w + x_8y = unIData# x_8x + x_8z = x_3 x_8w + x_90 = x_2 x_8z + x_91 = unIData# x_90 + x_92 = x_3 x_8z + x_93 = x_9 x_92 (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + !) + ! + x_94 = x_3 x_85 + x_95 = x_9 x_94 (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> x_8 (equalsInteger# 1# x_84) (\ ~ -> let* x_96 = x_9 x_85 (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) (\ ~ -> ERROR) !) + ! + x_97 = x_3 x_81 + x_98 = x_9 x_97 (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + ! + x_99 = x_3 x_7f + x_9a = x_2 x_99 + x_9b = unIData# x_9a + x_9c = x_3 x_99 + x_9d = x_2 x_9c + x_9e = unConstrData# x_9d + in x_8 + (equalsInteger# (x_4 x_9e) 0#) + (\ ~ -> + let* x_9f = x x_9e + x_9g = unIData# (x_2 x_9f) + x_9h = x_3 x_9f + x_9i = unIData# (x_2 x_9h) + x_9j = x_1h x_9i + x_9k = iData# x_9j + in x_8 + (equalsData# (listData# (x_3 x_9h)) (listData# x_1c)) + (\ ~ -> + let* x_9m = x_3 x_9c + x_9n = x_2 x_9m + x_9p = unIData# x_9n + x_9r = x_3 x_9m + x_9s = x_2 x_9r + x_9t = unIData# x_9s + x_9u = x_3 x_9r + x_9v = x_9 x_9u (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + in x_6z) + (\ ~ -> ERROR) + !) + ! + x_9w = x_0 x_3p + x_9x = x_3 x_9w + x_9y = x_3 x_9x + x_9z = x_3 x_9y + x_a0 = x_3 x_9z + x_a1 = x_3 x_a0 + x_a2 = x_3 x_a1 + x_a3 = unListData# (x_2 x_9w) + in x_8 + (x_a + (\ x_a4 x_a5 -> + x_9 + x_a5 + (\ ~ -> True#) + (\ ~ -> + x_8 + (let* x_a6 = x_2 x_a5 + in x_a (\ x_a7 x_a8 -> x_9 x_a8 (\ ~ -> False#) (\ ~ -> x_8 (equalsData# (x_2 x_a8) x_a6) (\ ~ -> True#) (\ ~ -> x_a7 (x_3 x_a8)) !) !) (x_3 x_a5)) + (\ ~ -> False#) + (\ ~ -> x_a4 (x_3 x_a5)) + !) + !) + x_a3) + (\ ~ -> + let* x_a9 = x_1n x_a3 + in x_8 + (lessThanEqualsInteger# x_a9 10#) + (\ ~ -> + x_8 + (lessThanEqualsInteger# 1# x_a9) + (\ ~ -> + let* x_aa = unIData# (x_2 x_9x) + in x_8 + (lessThanEqualsInteger# 1# x_aa) + (\ ~ -> + x_8 + (lessThanEqualsInteger# x_aa x_a9) + (\ ~ -> + x_8 + (equalsData# (x_2 (x_3 x_2g)) (x_2 x_9y)) + (\ ~ -> + let* x_ab = x_2 x_9z + in x_8 + (x_12 (\ x_ac -> equalsData# (x_2 (x_0 x_ac)) x_ab) x_32 (\ x_ad -> True#) (\ ~ -> False#)) + (\ ~ -> + let* x_ae = unIData# (x_2 x_a0) + in x_8 + (lessThanEqualsInteger# 0# x_ae) + (\ ~ -> + x_8 + (lessThanEqualsInteger# x_ae x_1t) + (\ ~ -> + let* x_af = unIData# (x_2 x_a2) + in x_8 + (lessThanEqualsInteger# 0# x_af) + (\ ~ -> + x_8 + (lessThanEqualsInteger# x_af x_1t) + (\ ~ -> + let* x_ag = unIData# (x_2 (x_3 x_a2)) + in x_8 + (lessThanEqualsInteger# 0# x_ag) + (\ ~ -> + x_8 + (lessThanEqualsInteger# x_ag x_1t) + (\ ~ -> + let* x_ah = x_2 x_a1 + in x_8 + (lessThanEqualsInteger# 0# (unIData# (x_2 (x_0 x_ah)))) + (\ ~ -> + x_8 + (let* x_ai = x_0 x_ah + x_aj = unIData# (x_2 x_ai) + x_ak = unIData# (x_2 (x_3 x_ai)) + x_am = \ x_an -> x_an x_aj x_ak + x_ap = 1# + x_ar = 1# + x_as = \ x_at -> x_at x_ap x_ar + in x_am + (\ x_au x_av -> + x_as + (\ x_aw x_ax -> + lessThanEqualsInteger# (multiplyInteger# x_ax x_au) (multiplyInteger# x_aw x_av)))) + (\ ~ -> ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ()#) + !) + (\ ~ -> ERROR)) + (\ ~ -> ERROR) + ! diff --git a/geniusyield-onchain/fixtures/partialordernftpolicy-aggressive.txt b/geniusyield-onchain/fixtures/partialordernftpolicy-aggressive.txt new file mode 100644 index 00000000..569fc981 --- /dev/null +++ b/geniusyield-onchain/fixtures/partialordernftpolicy-aggressive.txt @@ -0,0 +1,938 @@ +let* sndPair!! = sndPair# ! ! + fstPair!! = fstPair# ! ! + listData___ = \ ~ -> listData# []# + lessThanEqualsInteger_0 = lessThanEqualsInteger# 0# + lessThanInteger_0 = lessThanInteger# 0# + equalsInteger_28 = equalsInteger# 28# + equalsInteger_2 = equalsInteger# 2# + equalsInteger_1 = equalsInteger# 1# + equalsInteger_0 = equalsInteger# 0# + multiplyInteger_1 = multiplyInteger# 1# + __ = []# + _01 = 1#d + _00 = 0#d + ~__ = \ ~ -> __ + chooseList!! = chooseList# ! ! + ifThenElse! = ifThenElse# ! + headList! = headList# ! + tailList! = tailList# ! + zComb = \ f -> let* x = \ y -> f (\ u -> y y u) in f (\ v -> x x v) + x_0 = zComb (\ x_1 x_2 x_3 -> chooseList!! x_3 (\ ~ x_4 x_5 -> x_5 !) (\ ~ -> ifThenElse! (x_2 (headList! x_3)) (\ ~ -> let* x_6 = headList! x_3 in \ x_7 x_8 -> x_7 x_6) (\ ~ -> x_1 x_2 (tailList! x_3)) !) !) + x_9 = zComb (\ x_a x_b x_c -> ifThenElse! (equalsInteger_0 x_c) (\ ~ -> x_b) (\ ~ -> x_a x_c (modInteger# x_b x_c)) !) + x_d = \ x_e -> sndPair!! (unConstrData# x_e) + x_f = \ x_g -> ifThenElse! x_g (\ ~ -> True#) + x_h = \ x_i -> zComb (\ x_j x_k -> chooseList!! x_k (\ ~ -> False#) (\ ~ -> x_f (x_i (headList! x_k)) (\ ~ -> x_j (tailList! x_k)) !) !) + x_m = \ x_n x_p x_r -> zComb (\ x_s x_t -> chooseList!! x_t (\ ~ x_u x_v -> x_v !) (\ ~ -> ifThenElse! (equalsData# (fstPair!! (headList! x_t)) x_p) (\ ~ -> x_n (headList! x_t)) (\ ~ -> x_s (tailList! x_t)) !) !) x_r + x_w = \ x_x -> x_m (\ x_y -> let* x_z = unMapData# (sndPair!! x_y) in \ x_10 x_11 -> x_10 x_z) (bData# x_x) + tt = ()# + x_12 = \ x_13 -> tailList! (tailList! (tailList! (tailList! x_13))) + x_14 = \ x_15 x_16 -> ifThenElse! x_15 x_16 (\ ~ -> False#) + x_17 = \ x_18 x_19 -> equalsData# (listData# (x_d x_18)) (listData# (x_d x_19)) + x_1a = + \ x_1b -> + let* x_1c = bData# x_1b + in \ x_1d x_1e x_1f -> zComb (\ x_1g x_1h -> chooseList!! x_1h (\ ~ -> x_1d) (\ ~ -> ifThenElse! (equalsData# (fstPair!! (headList! x_1h)) x_1c) (\ ~ -> x_1e (sndPair!! (headList! x_1h))) (\ ~ -> x_1g (tailList! x_1h)) !) !) x_1f + x_1i = \ x_1j x_1k -> let* x_1m = unBData# (headList! (tailList! (x_d x_1k))) in x_1a (unBData# (headList! (x_d x_1k))) 0# (\ x_1n -> x_1a x_1m 0# unIData# (unMapData# x_1n)) x_1j + nullList! = nullList# ! + mkCons! = mkCons# ! + x_1p = \ x_1r x_1s -> constrData# 0# (mkCons! (bData# x_1r) (mkCons! (bData# x_1s) []#)) + x_1t = \ x_1u -> ifThenElse! (lessThanEqualsInteger# x_1u 0#) (\ ~ -> ERROR) (\ ~ -> x_1u) ! + x_1v = \ x_1w -> ifThenElse! x_1w False# True# + x_1x = subtractInteger# 0# + const = \ u1 v1 -> u1 + flipConst = \ u2 v2 -> v2 + x_1y = + \ x_1z x_20 x_21 -> + zComb + (\ x_22 x_23 -> + x_23 + (\ x_24 x_25 -> chooseList!! x_24 (\ ~ -> x_25) (\ ~ -> x_22 flipConst (headList! x_24) (tailList! x_24) x_25) !) + (\ x_26 x_27 x_28 -> + chooseList!! + x_28 + (\ ~ -> mkCons! x_26 x_27) + (\ ~ -> + let* x_29 = headList! x_28 + x_2a = fstPair!! x_26 + x_x = fstPair!! x_29 + in ifThenElse! + (equalsData# x_2a x_x) + (\ ~ -> mkCons! (mkPairData# x_2a (x_1z (sndPair!! x_26) (sndPair!! x_29))) (x_22 const x_27 (tailList! x_28))) + (\ ~ -> ifThenElse! (lessThanByteString# (unBData# x_2a) (unBData# x_x)) (\ ~ -> mkCons! x_26 (x_22 flipConst x_29 (tailList! x_28) x_27)) (\ ~ -> mkCons! x_29 (x_22 flipConst x_26 x_27 (tailList! x_28))) !) + !) + !)) + const + x_20 + x_21 + x_2b = \ x_2c x_2d x_2e -> x_1y (\ x_2f x_2g -> mapData# (x_1y (\ x_2h x_2i -> iData# (x_2c (unIData# x_2h) (unIData# x_2i))) (unMapData# x_2f) (unMapData# x_2g))) x_2d x_2e + x_2j = \ x_2k -> zComb (\ x_2m x_2n -> chooseList!! x_2n (\ ~ -> True#) (\ ~ -> x_14 (x_2k (headList! x_2n)) (\ ~ -> x_2m (tailList! x_2n)) !) !) + x_2p = \ x_2r x_2s -> zComb (\ x_2t x_2u -> chooseList!! x_2u ~__ (\ ~ -> mkCons! (mkPairData# (fstPair!! (headList! x_2u)) (x_2r (sndPair!! (headList! x_2u)))) (x_2t (tailList! x_2u))) !) x_2s + x_2v = + \ x_2w x_2x -> + x_2j (\ x_2y -> x_2j (\ x_2z -> lessThanEqualsInteger_0 (unIData# (sndPair!! x_2z))) (unMapData# (sndPair!! x_2y))) (x_2b addInteger# x_2w (x_2p (\ x_30 -> mapData# (x_2p (\ x_31 -> iData# (x_1x (unIData# x_31))) (unMapData# x_30))) x_2x)) + x_32 = + \ x_33 -> + let* x_34 = x_33 quotientInteger# + in ifThenElse! + (x_33 (\ x_35 x_36 -> lessThanInteger# (multiplyInteger_1 x_35) (multiplyInteger# 0# x_36))) + (\ ~ -> x_34) + (\ ~ -> ifThenElse! (x_33 (\ x_37 x_38 -> equalsInteger# (multiplyInteger_1 x_37) (multiplyInteger# (x_33 quotientInteger#) x_38))) (\ ~ -> x_34) (\ ~ -> addInteger# 1# x_34) !) + ! + x_39 = \ x_3a -> ifThenElse! (lessThanEqualsInteger# x_3a -1#) (\ ~ -> x_1x x_3a) (\ ~ -> x_3a) ! + x_3b = + \ x_3c x_3d -> + x_3c + (\ x_3e x_3f -> + x_3d + (\ x_3g x_3h -> + let* x_3i = multiplyInteger# x_3e x_3g + x_3j = multiplyInteger# x_3f x_3h + x_3k = x_39 x_3i + x_3m = x_39 x_3j + x_3n = x_9 (ifThenElse! (lessThanEqualsInteger# x_3k x_3m) (\ ~ -> x_3m) (\ ~ -> x_3k) !) (ifThenElse! (lessThanEqualsInteger# x_3k x_3m) (\ ~ -> x_3k) (\ ~ -> x_3m) !) + x_3p = ifThenElse! (equalsInteger_0 x_3j) (\ ~ -> 0#) (\ ~ -> ifThenElse! (lessThanEqualsInteger# x_3j 0#) (\ ~ -> -1#) (\ ~ -> 1#) !) ! + x_3r = multiplyInteger# x_3p (divideInteger# x_3i x_3n) + x_3s = multiplyInteger# x_3p (divideInteger# x_3j x_3n) + in \ x_3t -> x_3t x_3r x_3s)) + x_3u = \ x_3v -> let* x_3w = x_d x_3v; unIData_headList!_x = unIData# (headList! x_3w); unIData_headList!_tailList!_x = unIData# (headList! (tailList! x_3w)) in \ x_3x -> x_3x unIData_headList!_x unIData_headList!_tailList!_x + x_3y = \ x_3z x_40 -> x_40 x_3z 1# + x_41 = \ x_42 x_43 -> zComb (\ x_44 x_45 -> chooseList!! x_45 ~__ (\ ~ -> let* x_46 = x_44 (tailList! x_45) in x_42 (sndPair!! (headList! x_45)) (\ x_47 -> mkCons! (mkPairData# (fstPair!! (headList! x_45)) x_47) x_46) (\ ~ -> x_46)) !) x_43 + x_48 = + \ x_49 -> + x_41 + (\ x_4a -> + let* x_4b = x_41 (\ x_4c -> ifThenElse! (equalsData# x_4c _00) (\ ~ x_4d x_4e -> x_4e !) (\ ~ x_4f x_4g -> x_4f x_4c) !) (unMapData# x_4a) + in ifThenElse! (nullList! x_4b) (\ ~ x_4h x_4i -> x_4i !) (\ ~ x_4j x_4k -> x_4j x_4b) ! (\ x_4m -> let* x_4n = mapData# x_4m in \ x_4p x_4r -> x_4p x_4n) (\ ~ x_4s x_4t -> x_4t !)) + x_49 + x_4u = \ x_4v x_4w -> mkCons! (mkPairData# x_4v x_4w) __ + x_4x = \ x_4y x_4z -> let* x_50 = headList! (x_d x_4y); x_51 = headList! (tailList! (x_d x_4y)) in ifThenElse! (lessThanEqualsInteger# (unIData# x_4z) 0#) ~__ (\ ~ -> x_4u x_50 (mapData# (x_4u x_51 x_4z))) ! + x_52 = \ x_53 x_54 x_55 x_56 x_57 -> x_2b addInteger# (x_4x (x_1p ""#b ""#b) x_55) (x_2b addInteger# (x_4x x_53 x_56) (x_4x x_54 x_57)) + x_58 = \ x_59 x_5a -> let* x_5b = headList! (x_d x_59); x_5c = headList! (tailList! (x_d x_59)) in ifThenElse! (equalsData# x_5a _00) ~__ (\ ~ -> x_4u x_5b (mapData# (x_4u x_5c x_5a))) ! +in \ x_5d x_5e -> + let* x_5f = unConstrData# (headList! (tailList! (x_d x_5e))) + x_x_0 = sndPair!! x_5f + x_5g = ifThenElse! (equalsInteger_0 (fstPair!! x_5f)) (\ ~ -> unBData# (headList! x_x_0)) (\ ~ -> ERROR) ! + x_x_1 = x_d (headList! (x_d x_5e)) + tailList!_x_x = tailList! x_x_1 + tailList!_tailList!_x_x = tailList! tailList!_x_x + x_5h = tailList! (tailList! tailList!_tailList!_x_x) + x_5i = unMapData# (headList! x_5h) + x_5j = unConstrData# x_5d + x_x_2 = sndPair!! x_5j + in ifThenElse! + (equalsInteger_0 (fstPair!! x_5j)) + (\ ~ -> + let* headList!_x_x = headList! x_x_2 + x_x_x = + x_12 + (x_d + (x_0 + (\ x_5k -> + let* x_x_3 = x_d (headList! (tailList! (x_d x_5k))) + in x_14 + (x_17 (headList! x_x_3) <0 <0 "\168\129\214\&6\159\167\&17}\130\216\ACK\216\222\178\ACKxx\DC2\154^-\249l%\229\160\142">, <1>>#d) + (\ ~ -> equalsInteger_1 (x_1i (unMapData# (headList! (tailList! x_x_3))) <0 "\190\CAN\194\156\DEL\SI\252\165\195\230\205V\249}\240\248*1\227\ETB\233\155\250\ETX\ESC;\SI\227", "47454e53">#d)) + !) + (unListData# (headList! tailList!_x_x)) + (\ x_5m -> + let* unConstrData_headList!_x_x_x = unConstrData# (headList! (tailList! (tailList! (x_d (headList! (tailList! (x_d x_5m))))))) + x_5n = sndPair!! unConstrData_headList!_x_x_x + in ifThenElse! (equalsInteger_2 (fstPair!! unConstrData_headList!_x_x_x)) (\ ~ -> headList! x_5n) (\ ~ -> ERROR) !) + (\ ~ -> ERROR))) + tailList!_x_x_x = tailList! x_x_x + tailList!_tailList!_x_x_x = tailList! tailList!_x_x_x + x_headList!_x_x = x_d headList!_x_x + x_5p = sha2_256# (consByteString# (unIData# (headList! (tailList! x_headList!_x_x))) (unBData# (headList! (x_d (headList! x_headList!_x_x))))) + unListData_headList!_x_x = unListData# (headList! x_x_1) + x_5r = unListData# (headList! tailList!_tailList!_x_x) + x_5s = unMapData# (headList! (tailList! (x_12 (tailList! x_5h)))) + unIData_headList!_x_x_x = unIData# (headList! x_x_x) + headList!_tailList!_x_x_x = headList! tailList!_x_x_x + x_5t = unIData# (headList! tailList!_tailList!_x_x_x) + x_5u = unIData# (headList! (tailList! tailList!_tailList!_x_x_x)) + x_5v = x_w x_5g x_5i (\ x_5w -> x_5w) (\ ~ -> ERROR) + in chooseList!! + x_5v + (\ ~ -> ERROR) + (\ ~ -> + ifThenElse! + (x_14 + (x_h (\ x_5x -> x_17 headList!_x_x (headList! (x_d x_5x))) unListData_headList!_x_x) + (\ ~ -> x_14 (nullList! (tailList! x_5v)) (\ ~ -> x_14 (equalsInteger_1 (unIData# (sndPair!! (headList! x_5v)))) (\ ~ -> equalsByteString# (unBData# (fstPair!! (headList! x_5v))) x_5p) !) !) + !) + (\ ~ -> + let* x_5y = x_1p x_5g x_5p + in x_0 + (\ x_5z -> equalsInteger_1 (x_1i (unMapData# (headList! (tailList! (x_d x_5z)))) x_5y)) + x_5r + (\ x_60 -> + let* unConstrData_headList!_x_x = unConstrData# (headList! (x_d (headList! (x_d x_60)))) + x_unConstrData_headList!_x_x = sndPair!! unConstrData_headList!_x_x + in ifThenElse! + (ifThenElse! + (equalsInteger_0 (fstPair!! unConstrData_headList!_x_x)) + (\ ~ -> False#) + (\ ~ -> equalsByteString# #e2f9d92651c75a28717bf5622e6164e25133d856e9c02ea21a234dfc#b (unBData# (headList! x_unConstrData_headList!_x_x))) + !) + (\ ~ -> + let* unConstrData_x = unConstrData# (headList! (tailList! (tailList! (x_d x_60)))) + x_unConstrData_x = fstPair!! unConstrData_x + x_unConstrData_x_0 = sndPair!! unConstrData_x + x_x_x_0 = + tailList! + (tailList! + (x_d + (ifThenElse! + (equalsInteger_1 x_unConstrData_x) + (\ ~ -> + x_m + (\ x_61 -> let* x_62 = sndPair!! x_61 in \ x_63 x_64 -> x_63 x_62) + (bData# (unBData# (headList! x_unConstrData_x_0))) + x_5s + (\ x_65 -> + let* x_66 = unConstrData# x_65 + x_x_4 = sndPair!! x_66 + x_67 = + ifThenElse! + (equalsInteger_0 (fstPair!! x_66)) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_x_4)))) + (\ ~ -> + let* tailList!_x_x_0 = tailList! x_x_4 + x_68 = unConstrData# (headList! tailList!_x_x_0) + x_69 = sndPair!! x_68 + x_6a = + ifThenElse! + (equalsInteger_0 (fstPair!! x_68)) + (\ ~ -> + let* x_6b = unConstrData# (headList! x_69) + x_6c = fstPair!! x_6b + x_6d = sndPair!! x_6b + x_6e = + ifThenElse! + (equalsInteger_0 x_6c) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_6d)))) + (\ ~ -> let* x_6f = chooseList!! (tailList! x_6d) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_6c) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_6d)))) + (\ ~ -> let* x_6g = chooseList!! (tailList! x_6d) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_6h = tailList! x_69 + x_6i = unConstrData# (headList! x_6h) + x_6j = fstPair!! x_6i + x_6k = sndPair!! x_6i + x_6m = + ifThenElse! + (equalsInteger_0 x_6j) + (\ ~ -> + let* x_6n = unConstrData# (headList! x_6k) + x_6p = fstPair!! x_6n + x_6r = sndPair!! x_6n + x_6s = + ifThenElse! + (equalsInteger_0 x_6p) + (\ ~ -> + let* x_6t = unConstrData# (headList! x_6r) + x_6u = fstPair!! x_6t + x_6v = sndPair!! x_6t + x_6w = + ifThenElse! + (equalsInteger_0 x_6u) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_6v)))) + (\ ~ -> let* x_6x = chooseList!! (tailList! x_6v) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_6u) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_6v)))) + (\ ~ -> let* x_6y = chooseList!! (tailList! x_6v) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_6z = chooseList!! (tailList! x_6r) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_6p) + (\ ~ -> + let* x_70 = unIData# (headList! x_6r) + x_71 = tailList! x_6r + x_72 = unIData# (headList! x_71) + x_73 = tailList! x_71 + x_74 = unIData# (headList! x_73) + x_75 = chooseList!! (tailList! x_73) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + ! + x_76 = chooseList!! (tailList! x_6k) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ifThenElse! (equalsInteger_1 x_6j) (\ ~ -> let* x_77 = chooseList!! x_6k (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_78 = chooseList!! (tailList! x_6h) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + tailList!_tailList!_x_x_0 = tailList! tailList!_x_x_0 + x_79 = unConstrData# (headList! tailList!_tailList!_x_x_0) + x_7a = sndPair!! x_79 + x_7b = + ifThenElse! + (equalsInteger_0 (fstPair!! x_79)) + (\ ~ -> + let* x_7c = lengthOfByteString# (unBData# (headList! x_7a)) + in ifThenElse! + (x_f (equalsInteger_0 x_7c) (\ ~ -> equalsInteger_28 x_7c) !) + (\ ~ -> + let* x_7d = tailList! x_7a + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_7d))) 32#) + (\ ~ -> let* x_7e = chooseList!! (tailList! x_7d) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_7f = tailList! tailList!_tailList!_x_x_0 + x_7g = unIData# (headList! x_7f) + x_7h = tailList! x_7f + x_7i = unIData# (headList! x_7h) + x_7j = tailList! x_7h + x_7k = unConstrData# (headList! x_7j) + x_7m = sndPair!! x_7k + x_7n = + ifThenElse! + (equalsInteger_0 (fstPair!! x_7k)) + (\ ~ -> + let* x_7p = lengthOfByteString# (unBData# (headList! x_7m)) + in ifThenElse! + (x_f (equalsInteger_0 x_7p) (\ ~ -> equalsInteger_28 x_7p) !) + (\ ~ -> + let* x_7r = tailList! x_7m + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_7r))) 32#) + (\ ~ -> let* x_7s = chooseList!! (tailList! x_7r) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_7t = tailList! x_7j + x_7u = unConstrData# (headList! x_7t) + in ifThenElse! + (equalsInteger_0 (fstPair!! x_7u)) + (\ ~ -> + let* x_7v = sndPair!! x_7u + x_7w = unIData# (headList! x_7v) + x_7x = tailList! x_7v + x_7y = iData# (x_1t (unIData# (headList! x_7x))) + in ifThenElse! + (equalsData# (listData# (tailList! x_7x)) (listData___ !)) + (\ ~ -> + let* x_7z = tailList! x_7t + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_7z))) 32#) + (\ ~ -> + let* x_80 = tailList! x_7z + x_81 = unConstrData# (headList! x_80) + x_82 = fstPair!! x_81 + x_83 = sndPair!! x_81 + x_84 = + ifThenElse! + (equalsInteger_0 x_82) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger_0 (unIData# (headList! x_83))) + (\ ~ -> let* x_85 = chooseList!! (tailList! x_83) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! (equalsInteger_1 x_82) (\ ~ -> let* x_86 = chooseList!! x_83 (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_87 = tailList! x_80 + x_88 = unConstrData# (headList! x_87) + x_89 = fstPair!! x_88 + x_8a = sndPair!! x_88 + x_8b = + ifThenElse! + (equalsInteger_0 x_89) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger_0 (unIData# (headList! x_8a))) + (\ ~ -> let* x_8c = chooseList!! (tailList! x_8a) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! (equalsInteger_1 x_89) (\ ~ -> let* x_8d = chooseList!! x_8a (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_8e = tailList! x_87 + x_8f = unIData# (headList! x_8e) + x_8g = tailList! x_8e + x_8h = unIData# (headList! x_8g) + x_8i = tailList! x_8g + x_8j = unIData# (headList! x_8i) + x_8k = tailList! x_8i + x_8m = unConstrData# (headList! x_8k) + x_8n = sndPair!! x_8m + x_8p = + ifThenElse! + (equalsInteger_0 (fstPair!! x_8m)) + (\ ~ -> + let* x_8r = unIData# (headList! x_8n) + x_8s = tailList! x_8n + x_8t = unIData# (headList! x_8s) + x_8u = tailList! x_8s + x_8v = unIData# (headList! x_8u) + x_8w = chooseList!! (tailList! x_8u) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + x_8x = tailList! x_8k + x_8y = unIData# (headList! x_8x) + x_8z = chooseList!! (tailList! x_8x) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + in x_65) + (\ ~ -> ERROR)) + (\ ~ -> + ifThenElse! + (equalsInteger_2 x_unConstrData_x) + (\ ~ -> + let* headList!_x_unConstrData_x = headList! x_unConstrData_x_0 + x_90 = unConstrData# headList!_x_unConstrData_x + x_91 = sndPair!! x_90 + x_92 = + ifThenElse! + (equalsInteger_0 (fstPair!! x_90)) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_91)))) + (\ ~ -> + let* x_93 = tailList! x_91 + x_94 = unConstrData# (headList! x_93) + x_95 = sndPair!! x_94 + x_96 = + ifThenElse! + (equalsInteger_0 (fstPair!! x_94)) + (\ ~ -> + let* x_97 = unConstrData# (headList! x_95) + x_98 = fstPair!! x_97 + x_99 = sndPair!! x_97 + x_9a = + ifThenElse! + (equalsInteger_0 x_98) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_99)))) + (\ ~ -> let* x_9b = chooseList!! (tailList! x_99) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_98) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_99)))) + (\ ~ -> let* x_9c = chooseList!! (tailList! x_99) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_9d = tailList! x_95 + x_9e = unConstrData# (headList! x_9d) + x_9f = fstPair!! x_9e + x_9g = sndPair!! x_9e + x_9h = + ifThenElse! + (equalsInteger_0 x_9f) + (\ ~ -> + let* x_9i = unConstrData# (headList! x_9g) + x_9j = fstPair!! x_9i + x_9k = sndPair!! x_9i + x_9m = + ifThenElse! + (equalsInteger_0 x_9j) + (\ ~ -> + let* x_9n = unConstrData# (headList! x_9k) + x_9p = fstPair!! x_9n + x_9r = sndPair!! x_9n + x_9s = + ifThenElse! + (equalsInteger_0 x_9p) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_9r)))) + (\ ~ -> let* x_9t = chooseList!! (tailList! x_9r) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_9p) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_9r)))) + (\ ~ -> let* x_9u = chooseList!! (tailList! x_9r) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_9v = chooseList!! (tailList! x_9k) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_9j) + (\ ~ -> + let* x_9w = unIData# (headList! x_9k) + x_9x = tailList! x_9k + x_9y = unIData# (headList! x_9x) + x_9z = tailList! x_9x + x_a0 = unIData# (headList! x_9z) + x_a1 = chooseList!! (tailList! x_9z) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + ! + x_a2 = chooseList!! (tailList! x_9g) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ifThenElse! (equalsInteger_1 x_9f) (\ ~ -> let* x_a3 = chooseList!! x_9g (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_a4 = chooseList!! (tailList! x_9d) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + x_a5 = tailList! x_93 + x_a6 = unConstrData# (headList! x_a5) + x_a7 = sndPair!! x_a6 + x_a8 = + ifThenElse! + (equalsInteger_0 (fstPair!! x_a6)) + (\ ~ -> + let* x_a9 = lengthOfByteString# (unBData# (headList! x_a7)) + in ifThenElse! + (x_f (equalsInteger_0 x_a9) (\ ~ -> equalsInteger_28 x_a9) !) + (\ ~ -> + let* x_aa = tailList! x_a7 + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_aa))) 32#) + (\ ~ -> let* x_ab = chooseList!! (tailList! x_aa) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_ac = tailList! x_a5 + x_ad = unIData# (headList! x_ac) + x_ae = tailList! x_ac + x_af = unIData# (headList! x_ae) + x_ag = tailList! x_ae + x_ah = unConstrData# (headList! x_ag) + x_ai = sndPair!! x_ah + x_aj = + ifThenElse! + (equalsInteger_0 (fstPair!! x_ah)) + (\ ~ -> + let* x_ak = lengthOfByteString# (unBData# (headList! x_ai)) + in ifThenElse! + (x_f (equalsInteger_0 x_ak) (\ ~ -> equalsInteger_28 x_ak) !) + (\ ~ -> + let* x_am = tailList! x_ai + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_am))) 32#) + (\ ~ -> let* x_an = chooseList!! (tailList! x_am) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_ap = tailList! x_ag + x_ar = unConstrData# (headList! x_ap) + in ifThenElse! + (equalsInteger_0 (fstPair!! x_ar)) + (\ ~ -> + let* x_as = sndPair!! x_ar + x_at = unIData# (headList! x_as) + x_au = tailList! x_as + x_av = iData# (x_1t (unIData# (headList! x_au))) + in ifThenElse! + (equalsData# (listData# (tailList! x_au)) (listData___ !)) + (\ ~ -> + let* x_aw = tailList! x_ap + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_aw))) 32#) + (\ ~ -> + let* x_ax = tailList! x_aw + x_ay = unConstrData# (headList! x_ax) + x_az = fstPair!! x_ay + x_b0 = sndPair!! x_ay + x_b1 = + ifThenElse! + (equalsInteger_0 x_az) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger_0 (unIData# (headList! x_b0))) + (\ ~ -> let* x_b2 = chooseList!! (tailList! x_b0) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! (equalsInteger_1 x_az) (\ ~ -> let* x_b3 = chooseList!! x_b0 (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_b4 = tailList! x_ax + x_b5 = unConstrData# (headList! x_b4) + x_b6 = fstPair!! x_b5 + x_b7 = sndPair!! x_b5 + x_b8 = + ifThenElse! + (equalsInteger_0 x_b6) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger_0 (unIData# (headList! x_b7))) + (\ ~ -> let* x_b9 = chooseList!! (tailList! x_b7) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! (equalsInteger_1 x_b6) (\ ~ -> let* x_ba = chooseList!! x_b7 (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_bb = tailList! x_b4 + x_bc = unIData# (headList! x_bb) + x_bd = tailList! x_bb + x_be = unIData# (headList! x_bd) + x_bf = tailList! x_bd + x_bg = unIData# (headList! x_bf) + x_bh = tailList! x_bf + x_bi = unConstrData# (headList! x_bh) + x_bj = sndPair!! x_bi + x_bk = + ifThenElse! + (equalsInteger_0 (fstPair!! x_bi)) + (\ ~ -> + let* x_bm = unIData# (headList! x_bj) + x_bn = tailList! x_bj + x_bp = unIData# (headList! x_bn) + x_br = tailList! x_bn + x_bs = unIData# (headList! x_br) + x_bt = chooseList!! (tailList! x_br) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + x_bu = tailList! x_bh + x_bv = unIData# (headList! x_bu) + x_bw = chooseList!! (tailList! x_bu) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + in headList!_x_unConstrData_x) + (\ ~ -> ERROR) + !) + !))) + tailList!_x_x_x_0 = tailList! x_x_x_0 + tailList!_tailList!_x_x_x_0 = tailList! tailList!_x_x_x_0 + x_bx = tailList! tailList!_tailList!_x_x_x_0 + x_by = tailList! x_bx + x_bz = tailList! x_by + x_c0 = tailList! x_bz + x_c1 = tailList! x_c0 + x_c2 = tailList! x_c1 + x_c3 = tailList! x_c2 + x_c4 = tailList! x_c3 + x_c5 = tailList! x_c4 + x_c6 = unIData# (headList! tailList!_tailList!_x_x_x_0) + x_c7 = unIData# (headList! tailList!_x_x_x_0) + x_c8 = unIData# (headList! x_c2) + x_c9 = unIData# (headList! (tailList! x_c5)) + x_ca = unIData# (headList! (x_d (headList! x_by))) + x_cb = headList! x_c3 + x_cc = unIData# (headList! x_c4) + x_cd = x_d (headList! x_c5) + x_ce = tailList! x_cd + x_cf = headList! x_cd + x_cg = headList! x_ce + x_ch = headList! (tailList! x_ce) + headList!_x_x_x = headList! x_x_x_0 + x_ci = headList! x_bx + x_cj = unConstrData# (headList! x_c0) + x_ck = sndPair!! x_cj + in ifThenElse! + (equalsInteger_1 (fstPair!! x_cj)) + (\ ~ -> + let* x_cm = unConstrData# (headList! x_c1) + x_cn = fstPair!! x_cm + x_cp = sndPair!! x_cm + in ifThenElse! + (lessThanInteger_0 x_c6) + (\ ~ -> + ifThenElse! + (equalsInteger# x_c7 x_c6) + (\ ~ -> + ifThenElse! + (equalsByteString# (unBData# (headList! x_bz)) x_5p) + (\ ~ -> + ifThenElse! + (equalsInteger_0 x_c8) + (\ ~ -> + ifThenElse! + (lessThanInteger_0 x_ca) + (\ ~ -> + ifThenElse! + (x_1v (x_17 headList!_x_x_x x_ci)) + (\ ~ -> + ifThenElse! + True# + (\ ~ -> + ifThenElse! + (equalsData# x_cb x_cf) + (\ ~ -> + ifThenElse! + (equalsInteger# x_cc x_5t) + (\ ~ -> + ifThenElse! + (x_2v + (unMapData# (headList! (tailList! (x_d x_60)))) + (x_48 + (x_2b + addInteger# + (x_58 headList!_x_x_x (iData# x_c6)) + (x_48 + (x_2b + addInteger# + (x_58 x_5y _01) + (x_48 (x_2b addInteger# (x_58 (x_1p ""#b ""#b) (iData# x_5u)) (x_52 headList!_x_x_x x_ci x_cf x_cg x_ch)))))))) + (\ ~ -> + ifThenElse! + (equalsInteger_0 (unIData# x_ch)) + (\ ~ -> + ifThenElse! + (x_14 + (lessThanEqualsInteger# unIData_headList!_x_x_x (unIData# x_cf)) + (\ ~ -> lessThanEqualsInteger# (x_32 (x_3b (x_3u headList!_tailList!_x_x_x) (x_3y x_c6))) (unIData# x_cg)) + !) + (\ ~ -> ifThenElse! (equalsInteger_0 x_c9) (\ ~ -> tt) (\ ~ -> ERROR) !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> + let* x_cr = unConstrData# (headList! x_c1) + x_cs = sndPair!! x_cr + in ifThenElse! + (equalsInteger_0 (fstPair!! x_cr)) + (\ ~ -> + ifThenElse! + (lessThanInteger_0 x_c6) + (\ ~ -> + ifThenElse! + (equalsInteger# x_c7 x_c6) + (\ ~ -> + ifThenElse! + (equalsByteString# (unBData# (headList! x_bz)) x_5p) + (\ ~ -> + ifThenElse! + (equalsInteger_0 x_c8) + (\ ~ -> + ifThenElse! + (lessThanInteger_0 x_ca) + (\ ~ -> + ifThenElse! + (x_1v (x_17 headList!_x_x_x x_ci)) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger# (unIData# (headList! x_ck)) (unIData# (headList! x_cs))) + (\ ~ -> + ifThenElse! + (equalsData# x_cb x_cf) + (\ ~ -> + ifThenElse! + (equalsInteger# x_cc x_5t) + (\ ~ -> + ifThenElse! + (x_2v + (unMapData# (headList! (tailList! (x_d x_60)))) + (x_48 + (x_2b + addInteger# + (x_58 headList!_x_x_x (iData# x_c6)) + (x_48 + (x_2b + addInteger# + (x_58 x_5y _01) + (x_48 (x_2b addInteger# (x_58 (x_1p ""#b ""#b) (iData# x_5u)) (x_52 headList!_x_x_x x_ci x_cf x_cg x_ch)))))))) + (\ ~ -> + ifThenElse! + (equalsInteger_0 (unIData# x_ch)) + (\ ~ -> + ifThenElse! + (x_14 + (lessThanEqualsInteger# unIData_headList!_x_x_x (unIData# x_cf)) + (\ ~ -> lessThanEqualsInteger# (x_32 (x_3b (x_3u headList!_tailList!_x_x_x) (x_3y x_c6))) (unIData# x_cg)) + !) + (\ ~ -> ifThenElse! (equalsInteger_0 x_c9) (\ ~ -> tt) (\ ~ -> ERROR) !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (lessThanInteger_0 x_c6) + (\ ~ -> + ifThenElse! + (equalsInteger# x_c7 x_c6) + (\ ~ -> + ifThenElse! + (equalsByteString# (unBData# (headList! x_bz)) x_5p) + (\ ~ -> + ifThenElse! + (equalsInteger_0 x_c8) + (\ ~ -> + ifThenElse! + (lessThanInteger_0 x_ca) + (\ ~ -> + ifThenElse! + (x_1v (x_17 headList!_x_x_x x_ci)) + (\ ~ -> + ifThenElse! + True# + (\ ~ -> + ifThenElse! + (equalsData# x_cb x_cf) + (\ ~ -> + ifThenElse! + (equalsInteger# x_cc x_5t) + (\ ~ -> + ifThenElse! + (x_2v + (unMapData# (headList! (tailList! (x_d x_60)))) + (x_48 + (x_2b + addInteger# + (x_58 headList!_x_x_x (iData# x_c6)) + (x_48 + (x_2b + addInteger# + (x_58 x_5y _01) + (x_48 (x_2b addInteger# (x_58 (x_1p ""#b ""#b) (iData# x_5u)) (x_52 headList!_x_x_x x_ci x_cf x_cg x_ch)))))))) + (\ ~ -> + ifThenElse! + (equalsInteger_0 (unIData# x_ch)) + (\ ~ -> + ifThenElse! + (x_14 + (lessThanEqualsInteger# unIData_headList!_x_x_x (unIData# x_cf)) + (\ ~ -> lessThanEqualsInteger# (x_32 (x_3b (x_3u headList!_tailList!_x_x_x) (x_3y x_c6))) (unIData# x_cg)) + !) + (\ ~ -> ifThenElse! (equalsInteger_0 x_c9) (\ ~ -> tt) (\ ~ -> ERROR) !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + !) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR)) + (\ ~ -> ERROR) + !) + !) + (\ ~ -> ifThenElse! (x_h (\ x_ct -> lessThanEqualsInteger_0 (unIData# (sndPair!! x_ct))) (x_w x_5g x_5i (\ x_cu -> x_cu) (\ ~ -> ERROR))) (\ ~ -> ERROR) (\ ~ -> tt) !) + ! diff --git a/geniusyield-onchain/fixtures/partialordernftpolicy-optimized.txt b/geniusyield-onchain/fixtures/partialordernftpolicy-optimized.txt new file mode 100644 index 00000000..569fc981 --- /dev/null +++ b/geniusyield-onchain/fixtures/partialordernftpolicy-optimized.txt @@ -0,0 +1,938 @@ +let* sndPair!! = sndPair# ! ! + fstPair!! = fstPair# ! ! + listData___ = \ ~ -> listData# []# + lessThanEqualsInteger_0 = lessThanEqualsInteger# 0# + lessThanInteger_0 = lessThanInteger# 0# + equalsInteger_28 = equalsInteger# 28# + equalsInteger_2 = equalsInteger# 2# + equalsInteger_1 = equalsInteger# 1# + equalsInteger_0 = equalsInteger# 0# + multiplyInteger_1 = multiplyInteger# 1# + __ = []# + _01 = 1#d + _00 = 0#d + ~__ = \ ~ -> __ + chooseList!! = chooseList# ! ! + ifThenElse! = ifThenElse# ! + headList! = headList# ! + tailList! = tailList# ! + zComb = \ f -> let* x = \ y -> f (\ u -> y y u) in f (\ v -> x x v) + x_0 = zComb (\ x_1 x_2 x_3 -> chooseList!! x_3 (\ ~ x_4 x_5 -> x_5 !) (\ ~ -> ifThenElse! (x_2 (headList! x_3)) (\ ~ -> let* x_6 = headList! x_3 in \ x_7 x_8 -> x_7 x_6) (\ ~ -> x_1 x_2 (tailList! x_3)) !) !) + x_9 = zComb (\ x_a x_b x_c -> ifThenElse! (equalsInteger_0 x_c) (\ ~ -> x_b) (\ ~ -> x_a x_c (modInteger# x_b x_c)) !) + x_d = \ x_e -> sndPair!! (unConstrData# x_e) + x_f = \ x_g -> ifThenElse! x_g (\ ~ -> True#) + x_h = \ x_i -> zComb (\ x_j x_k -> chooseList!! x_k (\ ~ -> False#) (\ ~ -> x_f (x_i (headList! x_k)) (\ ~ -> x_j (tailList! x_k)) !) !) + x_m = \ x_n x_p x_r -> zComb (\ x_s x_t -> chooseList!! x_t (\ ~ x_u x_v -> x_v !) (\ ~ -> ifThenElse! (equalsData# (fstPair!! (headList! x_t)) x_p) (\ ~ -> x_n (headList! x_t)) (\ ~ -> x_s (tailList! x_t)) !) !) x_r + x_w = \ x_x -> x_m (\ x_y -> let* x_z = unMapData# (sndPair!! x_y) in \ x_10 x_11 -> x_10 x_z) (bData# x_x) + tt = ()# + x_12 = \ x_13 -> tailList! (tailList! (tailList! (tailList! x_13))) + x_14 = \ x_15 x_16 -> ifThenElse! x_15 x_16 (\ ~ -> False#) + x_17 = \ x_18 x_19 -> equalsData# (listData# (x_d x_18)) (listData# (x_d x_19)) + x_1a = + \ x_1b -> + let* x_1c = bData# x_1b + in \ x_1d x_1e x_1f -> zComb (\ x_1g x_1h -> chooseList!! x_1h (\ ~ -> x_1d) (\ ~ -> ifThenElse! (equalsData# (fstPair!! (headList! x_1h)) x_1c) (\ ~ -> x_1e (sndPair!! (headList! x_1h))) (\ ~ -> x_1g (tailList! x_1h)) !) !) x_1f + x_1i = \ x_1j x_1k -> let* x_1m = unBData# (headList! (tailList! (x_d x_1k))) in x_1a (unBData# (headList! (x_d x_1k))) 0# (\ x_1n -> x_1a x_1m 0# unIData# (unMapData# x_1n)) x_1j + nullList! = nullList# ! + mkCons! = mkCons# ! + x_1p = \ x_1r x_1s -> constrData# 0# (mkCons! (bData# x_1r) (mkCons! (bData# x_1s) []#)) + x_1t = \ x_1u -> ifThenElse! (lessThanEqualsInteger# x_1u 0#) (\ ~ -> ERROR) (\ ~ -> x_1u) ! + x_1v = \ x_1w -> ifThenElse! x_1w False# True# + x_1x = subtractInteger# 0# + const = \ u1 v1 -> u1 + flipConst = \ u2 v2 -> v2 + x_1y = + \ x_1z x_20 x_21 -> + zComb + (\ x_22 x_23 -> + x_23 + (\ x_24 x_25 -> chooseList!! x_24 (\ ~ -> x_25) (\ ~ -> x_22 flipConst (headList! x_24) (tailList! x_24) x_25) !) + (\ x_26 x_27 x_28 -> + chooseList!! + x_28 + (\ ~ -> mkCons! x_26 x_27) + (\ ~ -> + let* x_29 = headList! x_28 + x_2a = fstPair!! x_26 + x_x = fstPair!! x_29 + in ifThenElse! + (equalsData# x_2a x_x) + (\ ~ -> mkCons! (mkPairData# x_2a (x_1z (sndPair!! x_26) (sndPair!! x_29))) (x_22 const x_27 (tailList! x_28))) + (\ ~ -> ifThenElse! (lessThanByteString# (unBData# x_2a) (unBData# x_x)) (\ ~ -> mkCons! x_26 (x_22 flipConst x_29 (tailList! x_28) x_27)) (\ ~ -> mkCons! x_29 (x_22 flipConst x_26 x_27 (tailList! x_28))) !) + !) + !)) + const + x_20 + x_21 + x_2b = \ x_2c x_2d x_2e -> x_1y (\ x_2f x_2g -> mapData# (x_1y (\ x_2h x_2i -> iData# (x_2c (unIData# x_2h) (unIData# x_2i))) (unMapData# x_2f) (unMapData# x_2g))) x_2d x_2e + x_2j = \ x_2k -> zComb (\ x_2m x_2n -> chooseList!! x_2n (\ ~ -> True#) (\ ~ -> x_14 (x_2k (headList! x_2n)) (\ ~ -> x_2m (tailList! x_2n)) !) !) + x_2p = \ x_2r x_2s -> zComb (\ x_2t x_2u -> chooseList!! x_2u ~__ (\ ~ -> mkCons! (mkPairData# (fstPair!! (headList! x_2u)) (x_2r (sndPair!! (headList! x_2u)))) (x_2t (tailList! x_2u))) !) x_2s + x_2v = + \ x_2w x_2x -> + x_2j (\ x_2y -> x_2j (\ x_2z -> lessThanEqualsInteger_0 (unIData# (sndPair!! x_2z))) (unMapData# (sndPair!! x_2y))) (x_2b addInteger# x_2w (x_2p (\ x_30 -> mapData# (x_2p (\ x_31 -> iData# (x_1x (unIData# x_31))) (unMapData# x_30))) x_2x)) + x_32 = + \ x_33 -> + let* x_34 = x_33 quotientInteger# + in ifThenElse! + (x_33 (\ x_35 x_36 -> lessThanInteger# (multiplyInteger_1 x_35) (multiplyInteger# 0# x_36))) + (\ ~ -> x_34) + (\ ~ -> ifThenElse! (x_33 (\ x_37 x_38 -> equalsInteger# (multiplyInteger_1 x_37) (multiplyInteger# (x_33 quotientInteger#) x_38))) (\ ~ -> x_34) (\ ~ -> addInteger# 1# x_34) !) + ! + x_39 = \ x_3a -> ifThenElse! (lessThanEqualsInteger# x_3a -1#) (\ ~ -> x_1x x_3a) (\ ~ -> x_3a) ! + x_3b = + \ x_3c x_3d -> + x_3c + (\ x_3e x_3f -> + x_3d + (\ x_3g x_3h -> + let* x_3i = multiplyInteger# x_3e x_3g + x_3j = multiplyInteger# x_3f x_3h + x_3k = x_39 x_3i + x_3m = x_39 x_3j + x_3n = x_9 (ifThenElse! (lessThanEqualsInteger# x_3k x_3m) (\ ~ -> x_3m) (\ ~ -> x_3k) !) (ifThenElse! (lessThanEqualsInteger# x_3k x_3m) (\ ~ -> x_3k) (\ ~ -> x_3m) !) + x_3p = ifThenElse! (equalsInteger_0 x_3j) (\ ~ -> 0#) (\ ~ -> ifThenElse! (lessThanEqualsInteger# x_3j 0#) (\ ~ -> -1#) (\ ~ -> 1#) !) ! + x_3r = multiplyInteger# x_3p (divideInteger# x_3i x_3n) + x_3s = multiplyInteger# x_3p (divideInteger# x_3j x_3n) + in \ x_3t -> x_3t x_3r x_3s)) + x_3u = \ x_3v -> let* x_3w = x_d x_3v; unIData_headList!_x = unIData# (headList! x_3w); unIData_headList!_tailList!_x = unIData# (headList! (tailList! x_3w)) in \ x_3x -> x_3x unIData_headList!_x unIData_headList!_tailList!_x + x_3y = \ x_3z x_40 -> x_40 x_3z 1# + x_41 = \ x_42 x_43 -> zComb (\ x_44 x_45 -> chooseList!! x_45 ~__ (\ ~ -> let* x_46 = x_44 (tailList! x_45) in x_42 (sndPair!! (headList! x_45)) (\ x_47 -> mkCons! (mkPairData# (fstPair!! (headList! x_45)) x_47) x_46) (\ ~ -> x_46)) !) x_43 + x_48 = + \ x_49 -> + x_41 + (\ x_4a -> + let* x_4b = x_41 (\ x_4c -> ifThenElse! (equalsData# x_4c _00) (\ ~ x_4d x_4e -> x_4e !) (\ ~ x_4f x_4g -> x_4f x_4c) !) (unMapData# x_4a) + in ifThenElse! (nullList! x_4b) (\ ~ x_4h x_4i -> x_4i !) (\ ~ x_4j x_4k -> x_4j x_4b) ! (\ x_4m -> let* x_4n = mapData# x_4m in \ x_4p x_4r -> x_4p x_4n) (\ ~ x_4s x_4t -> x_4t !)) + x_49 + x_4u = \ x_4v x_4w -> mkCons! (mkPairData# x_4v x_4w) __ + x_4x = \ x_4y x_4z -> let* x_50 = headList! (x_d x_4y); x_51 = headList! (tailList! (x_d x_4y)) in ifThenElse! (lessThanEqualsInteger# (unIData# x_4z) 0#) ~__ (\ ~ -> x_4u x_50 (mapData# (x_4u x_51 x_4z))) ! + x_52 = \ x_53 x_54 x_55 x_56 x_57 -> x_2b addInteger# (x_4x (x_1p ""#b ""#b) x_55) (x_2b addInteger# (x_4x x_53 x_56) (x_4x x_54 x_57)) + x_58 = \ x_59 x_5a -> let* x_5b = headList! (x_d x_59); x_5c = headList! (tailList! (x_d x_59)) in ifThenElse! (equalsData# x_5a _00) ~__ (\ ~ -> x_4u x_5b (mapData# (x_4u x_5c x_5a))) ! +in \ x_5d x_5e -> + let* x_5f = unConstrData# (headList! (tailList! (x_d x_5e))) + x_x_0 = sndPair!! x_5f + x_5g = ifThenElse! (equalsInteger_0 (fstPair!! x_5f)) (\ ~ -> unBData# (headList! x_x_0)) (\ ~ -> ERROR) ! + x_x_1 = x_d (headList! (x_d x_5e)) + tailList!_x_x = tailList! x_x_1 + tailList!_tailList!_x_x = tailList! tailList!_x_x + x_5h = tailList! (tailList! tailList!_tailList!_x_x) + x_5i = unMapData# (headList! x_5h) + x_5j = unConstrData# x_5d + x_x_2 = sndPair!! x_5j + in ifThenElse! + (equalsInteger_0 (fstPair!! x_5j)) + (\ ~ -> + let* headList!_x_x = headList! x_x_2 + x_x_x = + x_12 + (x_d + (x_0 + (\ x_5k -> + let* x_x_3 = x_d (headList! (tailList! (x_d x_5k))) + in x_14 + (x_17 (headList! x_x_3) <0 <0 "\168\129\214\&6\159\167\&17}\130\216\ACK\216\222\178\ACKxx\DC2\154^-\249l%\229\160\142">, <1>>#d) + (\ ~ -> equalsInteger_1 (x_1i (unMapData# (headList! (tailList! x_x_3))) <0 "\190\CAN\194\156\DEL\SI\252\165\195\230\205V\249}\240\248*1\227\ETB\233\155\250\ETX\ESC;\SI\227", "47454e53">#d)) + !) + (unListData# (headList! tailList!_x_x)) + (\ x_5m -> + let* unConstrData_headList!_x_x_x = unConstrData# (headList! (tailList! (tailList! (x_d (headList! (tailList! (x_d x_5m))))))) + x_5n = sndPair!! unConstrData_headList!_x_x_x + in ifThenElse! (equalsInteger_2 (fstPair!! unConstrData_headList!_x_x_x)) (\ ~ -> headList! x_5n) (\ ~ -> ERROR) !) + (\ ~ -> ERROR))) + tailList!_x_x_x = tailList! x_x_x + tailList!_tailList!_x_x_x = tailList! tailList!_x_x_x + x_headList!_x_x = x_d headList!_x_x + x_5p = sha2_256# (consByteString# (unIData# (headList! (tailList! x_headList!_x_x))) (unBData# (headList! (x_d (headList! x_headList!_x_x))))) + unListData_headList!_x_x = unListData# (headList! x_x_1) + x_5r = unListData# (headList! tailList!_tailList!_x_x) + x_5s = unMapData# (headList! (tailList! (x_12 (tailList! x_5h)))) + unIData_headList!_x_x_x = unIData# (headList! x_x_x) + headList!_tailList!_x_x_x = headList! tailList!_x_x_x + x_5t = unIData# (headList! tailList!_tailList!_x_x_x) + x_5u = unIData# (headList! (tailList! tailList!_tailList!_x_x_x)) + x_5v = x_w x_5g x_5i (\ x_5w -> x_5w) (\ ~ -> ERROR) + in chooseList!! + x_5v + (\ ~ -> ERROR) + (\ ~ -> + ifThenElse! + (x_14 + (x_h (\ x_5x -> x_17 headList!_x_x (headList! (x_d x_5x))) unListData_headList!_x_x) + (\ ~ -> x_14 (nullList! (tailList! x_5v)) (\ ~ -> x_14 (equalsInteger_1 (unIData# (sndPair!! (headList! x_5v)))) (\ ~ -> equalsByteString# (unBData# (fstPair!! (headList! x_5v))) x_5p) !) !) + !) + (\ ~ -> + let* x_5y = x_1p x_5g x_5p + in x_0 + (\ x_5z -> equalsInteger_1 (x_1i (unMapData# (headList! (tailList! (x_d x_5z)))) x_5y)) + x_5r + (\ x_60 -> + let* unConstrData_headList!_x_x = unConstrData# (headList! (x_d (headList! (x_d x_60)))) + x_unConstrData_headList!_x_x = sndPair!! unConstrData_headList!_x_x + in ifThenElse! + (ifThenElse! + (equalsInteger_0 (fstPair!! unConstrData_headList!_x_x)) + (\ ~ -> False#) + (\ ~ -> equalsByteString# #e2f9d92651c75a28717bf5622e6164e25133d856e9c02ea21a234dfc#b (unBData# (headList! x_unConstrData_headList!_x_x))) + !) + (\ ~ -> + let* unConstrData_x = unConstrData# (headList! (tailList! (tailList! (x_d x_60)))) + x_unConstrData_x = fstPair!! unConstrData_x + x_unConstrData_x_0 = sndPair!! unConstrData_x + x_x_x_0 = + tailList! + (tailList! + (x_d + (ifThenElse! + (equalsInteger_1 x_unConstrData_x) + (\ ~ -> + x_m + (\ x_61 -> let* x_62 = sndPair!! x_61 in \ x_63 x_64 -> x_63 x_62) + (bData# (unBData# (headList! x_unConstrData_x_0))) + x_5s + (\ x_65 -> + let* x_66 = unConstrData# x_65 + x_x_4 = sndPair!! x_66 + x_67 = + ifThenElse! + (equalsInteger_0 (fstPair!! x_66)) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_x_4)))) + (\ ~ -> + let* tailList!_x_x_0 = tailList! x_x_4 + x_68 = unConstrData# (headList! tailList!_x_x_0) + x_69 = sndPair!! x_68 + x_6a = + ifThenElse! + (equalsInteger_0 (fstPair!! x_68)) + (\ ~ -> + let* x_6b = unConstrData# (headList! x_69) + x_6c = fstPair!! x_6b + x_6d = sndPair!! x_6b + x_6e = + ifThenElse! + (equalsInteger_0 x_6c) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_6d)))) + (\ ~ -> let* x_6f = chooseList!! (tailList! x_6d) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_6c) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_6d)))) + (\ ~ -> let* x_6g = chooseList!! (tailList! x_6d) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_6h = tailList! x_69 + x_6i = unConstrData# (headList! x_6h) + x_6j = fstPair!! x_6i + x_6k = sndPair!! x_6i + x_6m = + ifThenElse! + (equalsInteger_0 x_6j) + (\ ~ -> + let* x_6n = unConstrData# (headList! x_6k) + x_6p = fstPair!! x_6n + x_6r = sndPair!! x_6n + x_6s = + ifThenElse! + (equalsInteger_0 x_6p) + (\ ~ -> + let* x_6t = unConstrData# (headList! x_6r) + x_6u = fstPair!! x_6t + x_6v = sndPair!! x_6t + x_6w = + ifThenElse! + (equalsInteger_0 x_6u) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_6v)))) + (\ ~ -> let* x_6x = chooseList!! (tailList! x_6v) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_6u) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_6v)))) + (\ ~ -> let* x_6y = chooseList!! (tailList! x_6v) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_6z = chooseList!! (tailList! x_6r) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_6p) + (\ ~ -> + let* x_70 = unIData# (headList! x_6r) + x_71 = tailList! x_6r + x_72 = unIData# (headList! x_71) + x_73 = tailList! x_71 + x_74 = unIData# (headList! x_73) + x_75 = chooseList!! (tailList! x_73) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + ! + x_76 = chooseList!! (tailList! x_6k) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ifThenElse! (equalsInteger_1 x_6j) (\ ~ -> let* x_77 = chooseList!! x_6k (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_78 = chooseList!! (tailList! x_6h) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + tailList!_tailList!_x_x_0 = tailList! tailList!_x_x_0 + x_79 = unConstrData# (headList! tailList!_tailList!_x_x_0) + x_7a = sndPair!! x_79 + x_7b = + ifThenElse! + (equalsInteger_0 (fstPair!! x_79)) + (\ ~ -> + let* x_7c = lengthOfByteString# (unBData# (headList! x_7a)) + in ifThenElse! + (x_f (equalsInteger_0 x_7c) (\ ~ -> equalsInteger_28 x_7c) !) + (\ ~ -> + let* x_7d = tailList! x_7a + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_7d))) 32#) + (\ ~ -> let* x_7e = chooseList!! (tailList! x_7d) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_7f = tailList! tailList!_tailList!_x_x_0 + x_7g = unIData# (headList! x_7f) + x_7h = tailList! x_7f + x_7i = unIData# (headList! x_7h) + x_7j = tailList! x_7h + x_7k = unConstrData# (headList! x_7j) + x_7m = sndPair!! x_7k + x_7n = + ifThenElse! + (equalsInteger_0 (fstPair!! x_7k)) + (\ ~ -> + let* x_7p = lengthOfByteString# (unBData# (headList! x_7m)) + in ifThenElse! + (x_f (equalsInteger_0 x_7p) (\ ~ -> equalsInteger_28 x_7p) !) + (\ ~ -> + let* x_7r = tailList! x_7m + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_7r))) 32#) + (\ ~ -> let* x_7s = chooseList!! (tailList! x_7r) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_7t = tailList! x_7j + x_7u = unConstrData# (headList! x_7t) + in ifThenElse! + (equalsInteger_0 (fstPair!! x_7u)) + (\ ~ -> + let* x_7v = sndPair!! x_7u + x_7w = unIData# (headList! x_7v) + x_7x = tailList! x_7v + x_7y = iData# (x_1t (unIData# (headList! x_7x))) + in ifThenElse! + (equalsData# (listData# (tailList! x_7x)) (listData___ !)) + (\ ~ -> + let* x_7z = tailList! x_7t + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_7z))) 32#) + (\ ~ -> + let* x_80 = tailList! x_7z + x_81 = unConstrData# (headList! x_80) + x_82 = fstPair!! x_81 + x_83 = sndPair!! x_81 + x_84 = + ifThenElse! + (equalsInteger_0 x_82) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger_0 (unIData# (headList! x_83))) + (\ ~ -> let* x_85 = chooseList!! (tailList! x_83) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! (equalsInteger_1 x_82) (\ ~ -> let* x_86 = chooseList!! x_83 (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_87 = tailList! x_80 + x_88 = unConstrData# (headList! x_87) + x_89 = fstPair!! x_88 + x_8a = sndPair!! x_88 + x_8b = + ifThenElse! + (equalsInteger_0 x_89) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger_0 (unIData# (headList! x_8a))) + (\ ~ -> let* x_8c = chooseList!! (tailList! x_8a) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! (equalsInteger_1 x_89) (\ ~ -> let* x_8d = chooseList!! x_8a (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_8e = tailList! x_87 + x_8f = unIData# (headList! x_8e) + x_8g = tailList! x_8e + x_8h = unIData# (headList! x_8g) + x_8i = tailList! x_8g + x_8j = unIData# (headList! x_8i) + x_8k = tailList! x_8i + x_8m = unConstrData# (headList! x_8k) + x_8n = sndPair!! x_8m + x_8p = + ifThenElse! + (equalsInteger_0 (fstPair!! x_8m)) + (\ ~ -> + let* x_8r = unIData# (headList! x_8n) + x_8s = tailList! x_8n + x_8t = unIData# (headList! x_8s) + x_8u = tailList! x_8s + x_8v = unIData# (headList! x_8u) + x_8w = chooseList!! (tailList! x_8u) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + x_8x = tailList! x_8k + x_8y = unIData# (headList! x_8x) + x_8z = chooseList!! (tailList! x_8x) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + in x_65) + (\ ~ -> ERROR)) + (\ ~ -> + ifThenElse! + (equalsInteger_2 x_unConstrData_x) + (\ ~ -> + let* headList!_x_unConstrData_x = headList! x_unConstrData_x_0 + x_90 = unConstrData# headList!_x_unConstrData_x + x_91 = sndPair!! x_90 + x_92 = + ifThenElse! + (equalsInteger_0 (fstPair!! x_90)) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_91)))) + (\ ~ -> + let* x_93 = tailList! x_91 + x_94 = unConstrData# (headList! x_93) + x_95 = sndPair!! x_94 + x_96 = + ifThenElse! + (equalsInteger_0 (fstPair!! x_94)) + (\ ~ -> + let* x_97 = unConstrData# (headList! x_95) + x_98 = fstPair!! x_97 + x_99 = sndPair!! x_97 + x_9a = + ifThenElse! + (equalsInteger_0 x_98) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_99)))) + (\ ~ -> let* x_9b = chooseList!! (tailList! x_99) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_98) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_99)))) + (\ ~ -> let* x_9c = chooseList!! (tailList! x_99) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_9d = tailList! x_95 + x_9e = unConstrData# (headList! x_9d) + x_9f = fstPair!! x_9e + x_9g = sndPair!! x_9e + x_9h = + ifThenElse! + (equalsInteger_0 x_9f) + (\ ~ -> + let* x_9i = unConstrData# (headList! x_9g) + x_9j = fstPair!! x_9i + x_9k = sndPair!! x_9i + x_9m = + ifThenElse! + (equalsInteger_0 x_9j) + (\ ~ -> + let* x_9n = unConstrData# (headList! x_9k) + x_9p = fstPair!! x_9n + x_9r = sndPair!! x_9n + x_9s = + ifThenElse! + (equalsInteger_0 x_9p) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_9r)))) + (\ ~ -> let* x_9t = chooseList!! (tailList! x_9r) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_9p) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_9r)))) + (\ ~ -> let* x_9u = chooseList!! (tailList! x_9r) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_9v = chooseList!! (tailList! x_9k) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_9j) + (\ ~ -> + let* x_9w = unIData# (headList! x_9k) + x_9x = tailList! x_9k + x_9y = unIData# (headList! x_9x) + x_9z = tailList! x_9x + x_a0 = unIData# (headList! x_9z) + x_a1 = chooseList!! (tailList! x_9z) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + ! + x_a2 = chooseList!! (tailList! x_9g) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ifThenElse! (equalsInteger_1 x_9f) (\ ~ -> let* x_a3 = chooseList!! x_9g (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_a4 = chooseList!! (tailList! x_9d) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + x_a5 = tailList! x_93 + x_a6 = unConstrData# (headList! x_a5) + x_a7 = sndPair!! x_a6 + x_a8 = + ifThenElse! + (equalsInteger_0 (fstPair!! x_a6)) + (\ ~ -> + let* x_a9 = lengthOfByteString# (unBData# (headList! x_a7)) + in ifThenElse! + (x_f (equalsInteger_0 x_a9) (\ ~ -> equalsInteger_28 x_a9) !) + (\ ~ -> + let* x_aa = tailList! x_a7 + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_aa))) 32#) + (\ ~ -> let* x_ab = chooseList!! (tailList! x_aa) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_ac = tailList! x_a5 + x_ad = unIData# (headList! x_ac) + x_ae = tailList! x_ac + x_af = unIData# (headList! x_ae) + x_ag = tailList! x_ae + x_ah = unConstrData# (headList! x_ag) + x_ai = sndPair!! x_ah + x_aj = + ifThenElse! + (equalsInteger_0 (fstPair!! x_ah)) + (\ ~ -> + let* x_ak = lengthOfByteString# (unBData# (headList! x_ai)) + in ifThenElse! + (x_f (equalsInteger_0 x_ak) (\ ~ -> equalsInteger_28 x_ak) !) + (\ ~ -> + let* x_am = tailList! x_ai + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_am))) 32#) + (\ ~ -> let* x_an = chooseList!! (tailList! x_am) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_ap = tailList! x_ag + x_ar = unConstrData# (headList! x_ap) + in ifThenElse! + (equalsInteger_0 (fstPair!! x_ar)) + (\ ~ -> + let* x_as = sndPair!! x_ar + x_at = unIData# (headList! x_as) + x_au = tailList! x_as + x_av = iData# (x_1t (unIData# (headList! x_au))) + in ifThenElse! + (equalsData# (listData# (tailList! x_au)) (listData___ !)) + (\ ~ -> + let* x_aw = tailList! x_ap + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_aw))) 32#) + (\ ~ -> + let* x_ax = tailList! x_aw + x_ay = unConstrData# (headList! x_ax) + x_az = fstPair!! x_ay + x_b0 = sndPair!! x_ay + x_b1 = + ifThenElse! + (equalsInteger_0 x_az) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger_0 (unIData# (headList! x_b0))) + (\ ~ -> let* x_b2 = chooseList!! (tailList! x_b0) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! (equalsInteger_1 x_az) (\ ~ -> let* x_b3 = chooseList!! x_b0 (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_b4 = tailList! x_ax + x_b5 = unConstrData# (headList! x_b4) + x_b6 = fstPair!! x_b5 + x_b7 = sndPair!! x_b5 + x_b8 = + ifThenElse! + (equalsInteger_0 x_b6) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger_0 (unIData# (headList! x_b7))) + (\ ~ -> let* x_b9 = chooseList!! (tailList! x_b7) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! (equalsInteger_1 x_b6) (\ ~ -> let* x_ba = chooseList!! x_b7 (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_bb = tailList! x_b4 + x_bc = unIData# (headList! x_bb) + x_bd = tailList! x_bb + x_be = unIData# (headList! x_bd) + x_bf = tailList! x_bd + x_bg = unIData# (headList! x_bf) + x_bh = tailList! x_bf + x_bi = unConstrData# (headList! x_bh) + x_bj = sndPair!! x_bi + x_bk = + ifThenElse! + (equalsInteger_0 (fstPair!! x_bi)) + (\ ~ -> + let* x_bm = unIData# (headList! x_bj) + x_bn = tailList! x_bj + x_bp = unIData# (headList! x_bn) + x_br = tailList! x_bn + x_bs = unIData# (headList! x_br) + x_bt = chooseList!! (tailList! x_br) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + x_bu = tailList! x_bh + x_bv = unIData# (headList! x_bu) + x_bw = chooseList!! (tailList! x_bu) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + in headList!_x_unConstrData_x) + (\ ~ -> ERROR) + !) + !))) + tailList!_x_x_x_0 = tailList! x_x_x_0 + tailList!_tailList!_x_x_x_0 = tailList! tailList!_x_x_x_0 + x_bx = tailList! tailList!_tailList!_x_x_x_0 + x_by = tailList! x_bx + x_bz = tailList! x_by + x_c0 = tailList! x_bz + x_c1 = tailList! x_c0 + x_c2 = tailList! x_c1 + x_c3 = tailList! x_c2 + x_c4 = tailList! x_c3 + x_c5 = tailList! x_c4 + x_c6 = unIData# (headList! tailList!_tailList!_x_x_x_0) + x_c7 = unIData# (headList! tailList!_x_x_x_0) + x_c8 = unIData# (headList! x_c2) + x_c9 = unIData# (headList! (tailList! x_c5)) + x_ca = unIData# (headList! (x_d (headList! x_by))) + x_cb = headList! x_c3 + x_cc = unIData# (headList! x_c4) + x_cd = x_d (headList! x_c5) + x_ce = tailList! x_cd + x_cf = headList! x_cd + x_cg = headList! x_ce + x_ch = headList! (tailList! x_ce) + headList!_x_x_x = headList! x_x_x_0 + x_ci = headList! x_bx + x_cj = unConstrData# (headList! x_c0) + x_ck = sndPair!! x_cj + in ifThenElse! + (equalsInteger_1 (fstPair!! x_cj)) + (\ ~ -> + let* x_cm = unConstrData# (headList! x_c1) + x_cn = fstPair!! x_cm + x_cp = sndPair!! x_cm + in ifThenElse! + (lessThanInteger_0 x_c6) + (\ ~ -> + ifThenElse! + (equalsInteger# x_c7 x_c6) + (\ ~ -> + ifThenElse! + (equalsByteString# (unBData# (headList! x_bz)) x_5p) + (\ ~ -> + ifThenElse! + (equalsInteger_0 x_c8) + (\ ~ -> + ifThenElse! + (lessThanInteger_0 x_ca) + (\ ~ -> + ifThenElse! + (x_1v (x_17 headList!_x_x_x x_ci)) + (\ ~ -> + ifThenElse! + True# + (\ ~ -> + ifThenElse! + (equalsData# x_cb x_cf) + (\ ~ -> + ifThenElse! + (equalsInteger# x_cc x_5t) + (\ ~ -> + ifThenElse! + (x_2v + (unMapData# (headList! (tailList! (x_d x_60)))) + (x_48 + (x_2b + addInteger# + (x_58 headList!_x_x_x (iData# x_c6)) + (x_48 + (x_2b + addInteger# + (x_58 x_5y _01) + (x_48 (x_2b addInteger# (x_58 (x_1p ""#b ""#b) (iData# x_5u)) (x_52 headList!_x_x_x x_ci x_cf x_cg x_ch)))))))) + (\ ~ -> + ifThenElse! + (equalsInteger_0 (unIData# x_ch)) + (\ ~ -> + ifThenElse! + (x_14 + (lessThanEqualsInteger# unIData_headList!_x_x_x (unIData# x_cf)) + (\ ~ -> lessThanEqualsInteger# (x_32 (x_3b (x_3u headList!_tailList!_x_x_x) (x_3y x_c6))) (unIData# x_cg)) + !) + (\ ~ -> ifThenElse! (equalsInteger_0 x_c9) (\ ~ -> tt) (\ ~ -> ERROR) !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> + let* x_cr = unConstrData# (headList! x_c1) + x_cs = sndPair!! x_cr + in ifThenElse! + (equalsInteger_0 (fstPair!! x_cr)) + (\ ~ -> + ifThenElse! + (lessThanInteger_0 x_c6) + (\ ~ -> + ifThenElse! + (equalsInteger# x_c7 x_c6) + (\ ~ -> + ifThenElse! + (equalsByteString# (unBData# (headList! x_bz)) x_5p) + (\ ~ -> + ifThenElse! + (equalsInteger_0 x_c8) + (\ ~ -> + ifThenElse! + (lessThanInteger_0 x_ca) + (\ ~ -> + ifThenElse! + (x_1v (x_17 headList!_x_x_x x_ci)) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger# (unIData# (headList! x_ck)) (unIData# (headList! x_cs))) + (\ ~ -> + ifThenElse! + (equalsData# x_cb x_cf) + (\ ~ -> + ifThenElse! + (equalsInteger# x_cc x_5t) + (\ ~ -> + ifThenElse! + (x_2v + (unMapData# (headList! (tailList! (x_d x_60)))) + (x_48 + (x_2b + addInteger# + (x_58 headList!_x_x_x (iData# x_c6)) + (x_48 + (x_2b + addInteger# + (x_58 x_5y _01) + (x_48 (x_2b addInteger# (x_58 (x_1p ""#b ""#b) (iData# x_5u)) (x_52 headList!_x_x_x x_ci x_cf x_cg x_ch)))))))) + (\ ~ -> + ifThenElse! + (equalsInteger_0 (unIData# x_ch)) + (\ ~ -> + ifThenElse! + (x_14 + (lessThanEqualsInteger# unIData_headList!_x_x_x (unIData# x_cf)) + (\ ~ -> lessThanEqualsInteger# (x_32 (x_3b (x_3u headList!_tailList!_x_x_x) (x_3y x_c6))) (unIData# x_cg)) + !) + (\ ~ -> ifThenElse! (equalsInteger_0 x_c9) (\ ~ -> tt) (\ ~ -> ERROR) !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (lessThanInteger_0 x_c6) + (\ ~ -> + ifThenElse! + (equalsInteger# x_c7 x_c6) + (\ ~ -> + ifThenElse! + (equalsByteString# (unBData# (headList! x_bz)) x_5p) + (\ ~ -> + ifThenElse! + (equalsInteger_0 x_c8) + (\ ~ -> + ifThenElse! + (lessThanInteger_0 x_ca) + (\ ~ -> + ifThenElse! + (x_1v (x_17 headList!_x_x_x x_ci)) + (\ ~ -> + ifThenElse! + True# + (\ ~ -> + ifThenElse! + (equalsData# x_cb x_cf) + (\ ~ -> + ifThenElse! + (equalsInteger# x_cc x_5t) + (\ ~ -> + ifThenElse! + (x_2v + (unMapData# (headList! (tailList! (x_d x_60)))) + (x_48 + (x_2b + addInteger# + (x_58 headList!_x_x_x (iData# x_c6)) + (x_48 + (x_2b + addInteger# + (x_58 x_5y _01) + (x_48 (x_2b addInteger# (x_58 (x_1p ""#b ""#b) (iData# x_5u)) (x_52 headList!_x_x_x x_ci x_cf x_cg x_ch)))))))) + (\ ~ -> + ifThenElse! + (equalsInteger_0 (unIData# x_ch)) + (\ ~ -> + ifThenElse! + (x_14 + (lessThanEqualsInteger# unIData_headList!_x_x_x (unIData# x_cf)) + (\ ~ -> lessThanEqualsInteger# (x_32 (x_3b (x_3u headList!_tailList!_x_x_x) (x_3y x_c6))) (unIData# x_cg)) + !) + (\ ~ -> ifThenElse! (equalsInteger_0 x_c9) (\ ~ -> tt) (\ ~ -> ERROR) !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + !) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR)) + (\ ~ -> ERROR) + !) + !) + (\ ~ -> ifThenElse! (x_h (\ x_ct -> lessThanEqualsInteger_0 (unIData# (sndPair!! x_ct))) (x_w x_5g x_5i (\ x_cu -> x_cu) (\ ~ -> ERROR))) (\ ~ -> ERROR) (\ ~ -> tt) !) + ! diff --git a/geniusyield-onchain/fixtures/partialordernftpolicy-original.txt b/geniusyield-onchain/fixtures/partialordernftpolicy-original.txt new file mode 100644 index 00000000..605eb11d --- /dev/null +++ b/geniusyield-onchain/fixtures/partialordernftpolicy-original.txt @@ -0,0 +1,1024 @@ +let* x = sndPair# ! ! + x_0 = \ x_1 -> x (unConstrData# x_1) + x_2 = tailList# ! + x_3 = headList# ! + x_4 = fstPair# ! ! + x_5 = ifThenElse# ! + x_6 = \ x_7 -> let* x_8 = unMapData# (x x_7) in \ x_9 x_a -> x_9 x_8 + x_b = chooseList# ! ! + x_c = \ x_d -> let* x_e = \ x_f -> x_d (\ x_g -> x_f x_f x_g) in x_d (\ x_h -> x_e x_e x_h) + x_i = \ x_j x_k x_m -> x_c (\ x_n x_p -> x_b x_p (\ ~ x_r x_s -> x_s !) (\ ~ -> x_5 (equalsData# (x_4 (x_3 x_p)) x_k) (\ ~ -> x_j (x_3 x_p)) (\ ~ -> x_n (x_2 x_p)) !) !) x_m + x_t = \ x_u -> x_i x_6 (bData# x_u) + x_v = \ ~ -> True# + x_w = \ x_x -> x_5 x_x x_v + x_y = \ x_z -> x_c (\ x_10 x_11 -> x_b x_11 (\ ~ -> False#) (\ ~ -> x_w (x_z (x_3 x_11)) (\ ~ -> x_10 (x_2 x_11)) !) !) + x_12 = \ x_13 -> x_2 (x_2 x_13) + x_14 = \ x_15 x_16 x_17 x_18 -> x_c (\ x_19 x_1a -> x_b x_1a (\ ~ -> x_16) (\ ~ -> x_5 (equalsData# (x_4 (x_3 x_1a)) x_15) (\ ~ -> x_17 (x (x_3 x_1a))) (\ ~ -> x_19 (x_2 x_1a)) !) !) x_18 + x_1b = \ x_1c -> x_14 (bData# x_1c) + x_1d = \ x_1e x_1f x_1g -> x_1b x_1f 0# (\ x_1h -> x_1b x_1g 0# unIData# (unMapData# x_1h)) x_1e + x_1i = \ x_1j x_1k -> let* x_1m = unBData# (x_3 (x_0 x_1k)); x_1n = unBData# (x_3 (x_2 (x_0 x_1k))) in x_1d x_1j x_1m x_1n + x_1p = \ x_1r x_1s -> equalsData# (listData# (x_0 x_1r)) (listData# (x_0 x_1s)) + x_1t = \ ~ -> False# + x_1u = \ x_1v x_1w -> x_5 x_1v x_1w x_1t + x_1x = x_c (\ x_1y x_1z x_20 -> x_b x_20 (\ ~ x_21 x_22 -> x_22 !) (\ ~ -> x_5 (x_1z (x_3 x_20)) (\ ~ -> let* x_23 = x_3 x_20 in \ x_24 x_25 -> x_24 x_23) (\ ~ -> x_1y x_1z (x_2 x_20)) !) !) + x_26 = \ x_27 -> x_2 (x_12 x_27) + x_28 = \ x_29 -> x_2 (x_26 x_29) + x_2a = []# + x_2b = mkCons# ! + x_2c = \ x_2d x_2e -> constrData# 0# (x_2b (bData# x_2d) (x_2b (bData# x_2e) x_2a)) + x_2f = \ x_2g -> x_5 (lessThanEqualsInteger# x_2g 0#) (\ ~ -> ERROR) (\ ~ -> x_2g) ! + x_2h = []# + x_2i = \ x_2j x_2k -> x_2b (mkPairData# x_2j x_2k) x_2h + x_2m = \ x_2n x_2p x_2r -> x_5 (equalsData# x_2r (iData# 0#)) (\ ~ -> x_2h) (\ ~ -> x_2i x_2n (mapData# (x_2i x_2p x_2r))) ! + x_2s = \ x_2t x_2u -> let* x_2v = x_3 (x_0 x_2t); x_2w = x_3 (x_2 (x_0 x_2t)) in x_2m x_2v x_2w x_2u + x_2x = ""#b + x_2y = \ x_2z x_30 x_31 -> x_5 (lessThanEqualsInteger# (unIData# x_31) 0#) (\ ~ -> x_2h) (\ ~ -> x_2i x_2z (mapData# (x_2i x_30 x_31))) ! + x_32 = \ x_33 x_34 -> let* x_35 = x_3 (x_0 x_33); x_36 = x_3 (x_2 (x_0 x_33)) in x_2y x_35 x_36 x_34 + x_37 = + \ x_38 x_39 -> + let* x_3a = \ x_3b x_3c -> x_b x_3b (\ ~ -> x_3c) (\ ~ -> x_39 (\ x_3d x_3e -> x_3e) (x_3 x_3b) (x_2 x_3b) x_3c) ! + x_3f = + \ x_3g x_3h x_3i -> + x_b + x_3i + (\ ~ -> x_2b x_3g x_3h) + (\ ~ -> + let* x_3j = x_3 x_3i + x_3k = x_4 x_3g + x_3m = x_4 x_3j + in x_5 + (equalsData# x_3k x_3m) + (\ ~ -> x_2b (mkPairData# x_3k (x_38 (x x_3g) (x x_3j))) (x_39 (\ x_3n x_3p -> x_3n) x_3h (x_2 x_3i))) + (\ ~ -> x_5 (lessThanByteString# (unBData# x_3k) (unBData# x_3m)) (\ ~ -> x_2b x_3g (x_39 (\ x_3r x_3s -> x_3s) x_3j (x_2 x_3i) x_3h)) (\ ~ -> x_2b x_3j (x_39 (\ x_3t x_3u -> x_3u) x_3g x_3h (x_2 x_3i))) !) + !) + ! + in \ x_3v -> x_3v x_3a x_3f + x_3w = \ x_3x -> x_c (x_37 x_3x) + x_3y = \ x_3z x_40 x_41 -> x_3w x_3z (\ x_42 x_43 -> x_42) x_40 x_41 + x_44 = \ x_45 -> x_3y (\ x_46 x_47 -> iData# (x_45 (unIData# x_46) (unIData# x_47))) + x_48 = \ x_49 -> x_3y (\ x_4a x_4b -> mapData# (x_49 (unMapData# x_4a) (unMapData# x_4b))) + x_4c = \ x_4d x_4e x_4f -> x_48 (\ x_4g x_4h -> x_44 x_4d x_4g x_4h) x_4e x_4f + x_4i = \ x_4j x_4k x_4m x_4n x_4p -> x_4c addInteger# (x_32 (x_2c x_2x x_2x) x_4m) (x_4c addInteger# (x_32 x_4j x_4n) (x_32 x_4k x_4p)) + x_4r = \ x_4s x_4t -> x_c (\ x_4u x_4v -> x_b x_4v (\ ~ -> x_2h) (\ ~ -> let* x_4w = x_4u (x_2 x_4v) in x_4s (x (x_3 x_4v)) (\ x_4x -> x_2b (mkPairData# (x_4 (x_3 x_4v)) x_4x) x_4w) (\ ~ -> x_4w)) !) x_4t + x_4y = nullList# ! + x_4z = \ x_50 -> x_4r (\ x_51 -> x_50 (unMapData# x_51) (\ x_52 -> let* x_53 = mapData# x_52 in \ x_54 x_55 -> x_54 x_53) (\ ~ x_56 x_57 -> x_57 !)) + x_58 = \ x_59 -> x_4z (\ x_5a -> let* x_5b = x_4r (\ x_5c -> x_5 (equalsData# x_5c (iData# 0#)) (\ ~ x_5d x_5e -> x_5e !) (\ ~ x_5f x_5g -> x_5f x_5c) !) x_5a in x_5 (x_4y x_5b) (\ ~ x_5h x_5i -> x_5i !) (\ ~ x_5j x_5k -> x_5j x_5b) !) x_59 + x_5m = \ x_5n -> let* x_5p = 1# in \ x_5r -> x_5r x_5n x_5p + x_5s = \ x_5t -> let* x_5u = x_0 x_5t; x_5v = unIData# (x_3 x_5u); x_5w = unIData# (x_3 (x_2 x_5u)) in \ x_5x -> x_5x x_5v x_5w + x_5y = \ x_5z -> subtractInteger# 0# x_5z + x_60 = \ x_61 -> x_5 (lessThanEqualsInteger# x_61 -1#) (\ ~ -> x_5y x_61) (\ ~ -> x_61) ! + x_62 = \ x_63 x_64 -> x_5 (lessThanEqualsInteger# x_63 x_64) (\ ~ -> x_63) (\ ~ -> x_64) ! + x_65 = \ x_66 x_67 -> x_5 (lessThanEqualsInteger# x_66 x_67) (\ ~ -> x_67) (\ ~ -> x_66) ! + x_68 = x_c (\ x_69 x_6a x_6b -> x_5 (equalsInteger# x_6b 0#) (\ ~ -> x_6a) (\ ~ -> x_69 x_6b (modInteger# x_6a x_6b)) !) + x_6c = \ x_6d x_6e -> let* x_6f = x_60 x_6d; x_6g = x_60 x_6e in x_68 (x_65 x_6f x_6g) (x_62 x_6f x_6g) + x_6h = + \ x_6i -> + x_6i + (\ x_6j x_6k -> + let* x_6m = x_6c x_6j x_6k + x_6n = x_5 (equalsInteger# x_6k 0#) (\ ~ -> 0#) (\ ~ -> x_5 (lessThanEqualsInteger# x_6k 0#) (\ ~ -> -1#) (\ ~ -> 1#) !) ! + x_6p = multiplyInteger# x_6n (divideInteger# x_6j x_6m) + x_6r = multiplyInteger# x_6n (divideInteger# x_6k x_6m) + in \ x_6s -> x_6s x_6p x_6r) + x_6t = \ x_6u x_6v -> x_6u (\ x_6w x_6x -> x_6v (\ x_6y x_6z -> x_6h (let* x_70 = multiplyInteger# x_6w x_6y; x_71 = multiplyInteger# x_6x x_6z in \ x_72 -> x_72 x_70 x_71))) + x_73 = \ x_74 -> x_74 quotientInteger# + x_75 = \ x_76 x_77 -> x_76 (\ x_78 x_79 -> x_77 (\ x_7a x_7b -> equalsInteger# (multiplyInteger# x_7b x_78) (multiplyInteger# x_7a x_79))) + x_7c = \ x_7d x_7e -> x_7d (\ x_7f x_7g -> x_7e (\ x_7h x_7i -> lessThanInteger# (multiplyInteger# x_7i x_7f) (multiplyInteger# x_7h x_7g))) + x_7j = \ x_7k -> let* x_7m = x_5m (x_73 x_7k); x_7n = x_73 x_7k in x_5 (x_7c x_7k (let* x_7p = 0#; x_7r = 1# in \ x_7s -> x_7s x_7p x_7r)) (\ ~ -> x_7n) (\ ~ -> x_5 (x_75 x_7k x_7m) (\ ~ -> x_7n) (\ ~ -> addInteger# 1# x_7n) !) ! + x_7t = \ x_7u x_7v -> x_c (\ x_7w x_7x -> x_b x_7x (\ ~ -> x_2h) (\ ~ -> x_2b (mkPairData# (x_4 (x_3 x_7x)) (x_7u (x (x_3 x_7x)))) (x_7w (x_2 x_7x))) !) x_7v + x_7y = \ x_7z -> x_7t (\ x_80 -> iData# (x_7z (unIData# x_80))) + x_81 = \ x_82 -> x_7t (\ x_83 -> mapData# (x_82 (unMapData# x_83))) + x_84 = \ x_85 x_86 -> x_81 (\ x_87 -> x_7y x_85 x_87) x_86 + x_88 = \ x_89 x_8a -> x_4c addInteger# x_89 (x_84 x_5y x_8a) + x_8b = \ x_8c -> x_c (\ x_8d x_8e -> x_b x_8e (\ ~ -> True#) (\ ~ -> x_1u (x_8c (x_3 x_8e)) (\ ~ -> x_8d (x_2 x_8e)) !) !) + x_8f = \ x_8g x_8h -> x_8b (\ x_8i -> x_8g (unIData# (x x_8i))) x_8h + x_8j = \ x_8k x_8m -> x_8b (\ x_8n -> x_8k (unMapData# (x x_8n))) x_8m + x_8p = \ x_8r -> x_8j (\ x_8s -> x_8f (\ x_8t -> lessThanEqualsInteger# 0# x_8t) x_8s) x_8r + x_8u = \ x_8v x_8w -> x_8p (x_88 x_8v x_8w) + x_8x = \ x_8y -> x_5 x_8y False# True# + x_8z = #e2f9d92651c75a28717bf5622e6164e25133d856e9c02ea21a234dfc#b + x_90 = <0 <0 "\168\129\214\&6\159\167\&17}\130\216\ACK\216\222\178\ACKxx\DC2\154^-\249l%\229\160\142">, <1>>#d + x_91 = <0 "\190\CAN\194\156\DEL\SI\252\165\195\230\205V\249}\240\248*1\227\ETB\233\155\250\ETX\ESC;\SI\227", "47454e53">#d +in \ x_92 x_93 -> + let* x_94 = unConstrData# (x_3 (x_2 (x_0 x_93))) + x_95 = x_4 x_94 + x_96 = x x_94 + x_97 = x_5 (equalsInteger# 0# x_95) (\ ~ -> unBData# (x_3 x_96)) (\ ~ -> ERROR) ! + x_98 = x_3 (x_0 x_93) + x_99 = x_0 x_98 + x_9a = x_2 x_99 + x_9b = x_2 x_9a + x_9c = x_2 (x_2 x_9b) + x_9d = unMapData# (x_3 x_9c) + x_9e = unConstrData# x_92 + x_9f = x_4 x_9e + x_9g = x x_9e + in x_5 + (equalsInteger# 0# x_9f) + (\ ~ -> + let* x_9h = x_3 x_9g + x_9i = unListData# (x_3 x_9a) + x_9j = + x_1x + (\ x_9k -> let* x_9m = x_3 (x_2 (x_0 x_9k)); x_9n = x_0 x_9m in x_1u (x_1p (x_3 x_9n) x_90) (\ ~ -> equalsInteger# (x_1i (unMapData# (x_3 (x_2 x_9n))) x_91) 1#) !) + x_9i + (\ x_9p -> let* x_9r = x_3 (x_2 (x_0 x_9p)); x_9s = x_3 (x_12 (x_0 x_9r)); x_9t = unConstrData# x_9s; x_9u = x_4 x_9t; x_9v = x x_9t in x_5 (equalsInteger# 2# x_9u) (\ ~ -> x_3 x_9v) (\ ~ -> ERROR) !) + (\ ~ -> ERROR) + x_9w = x_28 (x_0 x_9j) + x_9x = x_2 x_9w + x_9y = x_2 x_9x + x_9z = x_0 x_9h + x_a0 = sha2_256# (consByteString# (unIData# (x_3 (x_2 x_9z))) (let* x_a1 = x_3 x_9z in unBData# (x_3 (x_0 x_a1)))) + x_a2 = unListData# (x_3 x_99) + x_a3 = unListData# (x_3 x_9b) + x_a4 = unMapData# (x_3 (let* x_a5 = x_2 x_9c in x_2 (x_28 x_a5))) + x_a6 = unIData# (x_3 x_9w) + x_a7 = x_3 x_9x + x_a8 = unIData# (x_3 x_9y) + x_a9 = unIData# (x_3 (x_2 x_9y)) + x_aa = x_t x_97 x_9d (\ x_ab -> x_ab) (\ ~ -> ERROR) + in x_b + x_aa + (\ ~ -> ERROR) + (\ ~ -> + x_5 + (x_1u (x_y (\ x_ac -> x_1p x_9h (x_3 (x_0 x_ac))) x_a2) (\ ~ -> x_1u (x_4y (x_2 x_aa)) (\ ~ -> x_1u (equalsInteger# (unIData# (x (x_3 x_aa))) 1#) (\ ~ -> equalsByteString# (unBData# (x_4 (x_3 x_aa))) x_a0) !) !) !) + (\ ~ -> + let* x_ad = x_2c x_97 x_a0 + in x_1x + (\ x_ae -> equalsInteger# (x_1i (unMapData# (x_3 (x_2 (x_0 x_ae)))) x_ad) 1#) + x_a3 + (\ x_af -> + x_5 + (let* x_ag = x_3 (x_0 x_af) + x_ah = unConstrData# (x_3 (x_0 x_ag)) + x_ai = x_4 x_ah + x_aj = x x_ah + in x_5 (equalsInteger# 0# x_ai) (\ ~ -> False#) (\ ~ -> equalsByteString# x_8z (unBData# (x_3 x_aj))) !) + (\ ~ -> + let* x_ak = x_3 (x_12 (x_0 x_af)) + x_am = unConstrData# x_ak + x_an = x_4 x_am + x_ap = x x_am + x_ar = + x_5 + (equalsInteger# 1# x_an) + (\ ~ -> + let* x_as = unBData# (x_3 x_ap) + in x_i + (\ x_at -> let* x_au = x x_at in \ x_av x_aw -> x_av x_au) + (bData# x_as) + x_a4 + (\ x_ax -> + let* x_ay = unConstrData# x_ax + x_az = x_4 x_ay + x_b0 = x x_ay + x_b1 = + x_5 + (equalsInteger# 0# x_az) + (\ ~ -> + let* x_b2 = x_3 x_b0 + x_b3 = unBData# x_b2 + in x_5 + (equalsInteger# (lengthOfByteString# x_b3) 28#) + (\ ~ -> + let* x_b4 = x_2 x_b0 + x_b5 = x_3 x_b4 + x_b6 = unConstrData# x_b5 + x_b7 = x_4 x_b6 + x_b8 = x x_b6 + x_b9 = + x_5 + (equalsInteger# 0# x_b7) + (\ ~ -> + let* x_ba = x_3 x_b8 + x_bb = unConstrData# x_ba + x_bc = x_4 x_bb + x_bd = x x_bb + x_be = + x_5 + (equalsInteger# 0# x_bc) + (\ ~ -> + let* x_bf = x_3 x_bd + x_bg = unBData# x_bf + in x_5 + (equalsInteger# (lengthOfByteString# x_bg) 28#) + (\ ~ -> let* x_bh = x_2 x_bd; x_bi = x_b x_bh (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> + x_5 + (equalsInteger# 1# x_bc) + (\ ~ -> + let* x_bj = x_3 x_bd + x_bk = unBData# x_bj + in x_5 + (equalsInteger# (lengthOfByteString# x_bk) 28#) + (\ ~ -> let* x_bm = x_2 x_bd; x_bn = x_b x_bm (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_bp = x_2 x_b8 + x_br = x_3 x_bp + x_bs = unConstrData# x_br + x_bt = x_4 x_bs + x_bu = x x_bs + x_bv = + x_5 + (equalsInteger# 0# x_bt) + (\ ~ -> + let* x_bw = x_3 x_bu + x_bx = unConstrData# x_bw + x_by = x_4 x_bx + x_bz = x x_bx + x_c0 = + x_5 + (equalsInteger# 0# x_by) + (\ ~ -> + let* x_c1 = x_3 x_bz + x_c2 = unConstrData# x_c1 + x_c3 = x_4 x_c2 + x_c4 = x x_c2 + x_c5 = + x_5 + (equalsInteger# 0# x_c3) + (\ ~ -> + let* x_c6 = x_3 x_c4 + x_c7 = unBData# x_c6 + in x_5 + (equalsInteger# (lengthOfByteString# x_c7) 28#) + (\ ~ -> let* x_c8 = x_2 x_c4; x_c9 = x_b x_c8 (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> + x_5 + (equalsInteger# 1# x_c3) + (\ ~ -> + let* x_ca = x_3 x_c4 + x_cb = unBData# x_ca + in x_5 + (equalsInteger# (lengthOfByteString# x_cb) 28#) + (\ ~ -> let* x_cc = x_2 x_c4; x_cd = x_b x_cc (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_ce = x_2 x_bz + x_cf = x_b x_ce (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> + x_5 + (equalsInteger# 1# x_by) + (\ ~ -> + let* x_cg = x_3 x_bz + x_ch = unIData# x_cg + x_ci = x_2 x_bz + x_cj = x_3 x_ci + x_ck = unIData# x_cj + x_cm = x_2 x_ci + x_cn = x_3 x_cm + x_cp = unIData# x_cn + x_cr = x_2 x_cm + x_cs = x_b x_cr (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + !) + ! + x_ct = x_2 x_bu + x_cu = x_b x_ct (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> x_5 (equalsInteger# 1# x_bt) (\ ~ -> let* x_cv = x_b x_bu (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) (\ ~ -> ERROR) !) + ! + x_cw = x_2 x_bp + x_cx = x_b x_cw (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + ! + x_cy = x_2 x_b4 + x_cz = x_3 x_cy + x_d0 = unConstrData# x_cz + x_d1 = x_4 x_d0 + x_d2 = x x_d0 + x_d3 = + x_5 + (equalsInteger# 0# x_d1) + (\ ~ -> + let* x_d4 = x_3 x_d2 + x_d5 = unBData# x_d4 + x_d6 = lengthOfByteString# x_d5 + in x_5 + (x_w (equalsInteger# x_d6 0#) (\ ~ -> equalsInteger# x_d6 28#) !) + (\ ~ -> + let* x_d7 = x_2 x_d2 + x_d8 = x_3 x_d7 + x_d9 = unBData# x_d8 + in x_5 + (lessThanEqualsInteger# (lengthOfByteString# x_d9) 32#) + (\ ~ -> let* x_da = x_2 x_d7; x_db = x_b x_da (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_dc = x_2 x_cy + x_dd = x_3 x_dc + x_de = unIData# x_dd + x_df = x_2 x_dc + x_dg = x_3 x_df + x_dh = unIData# x_dg + x_di = x_2 x_df + x_dj = x_3 x_di + x_dk = unConstrData# x_dj + x_dm = x_4 x_dk + x_dn = x x_dk + x_dp = + x_5 + (equalsInteger# 0# x_dm) + (\ ~ -> + let* x_dr = x_3 x_dn + x_ds = unBData# x_dr + x_dt = lengthOfByteString# x_ds + in x_5 + (x_w (equalsInteger# x_dt 0#) (\ ~ -> equalsInteger# x_dt 28#) !) + (\ ~ -> + let* x_du = x_2 x_dn + x_dv = x_3 x_du + x_dw = unBData# x_dv + in x_5 + (lessThanEqualsInteger# (lengthOfByteString# x_dw) 32#) + (\ ~ -> let* x_dx = x_2 x_du; x_dy = x_b x_dx (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_dz = x_2 x_di + x_e0 = x_3 x_dz + x_e1 = unConstrData# x_e0 + in x_5 + (equalsInteger# (x_4 x_e1) 0#) + (\ ~ -> + let* x_e2 = x x_e1 + x_e3 = unIData# (x_3 x_e2) + x_e4 = x_2 x_e2 + x_e5 = unIData# (x_3 x_e4) + x_e6 = x_2f x_e5 + x_e7 = iData# x_e6 + in x_5 + (equalsData# (listData# (x_2 x_e4)) (listData# x_2a)) + (\ ~ -> + let* x_e8 = x_2 x_dz + x_e9 = x_3 x_e8 + x_ea = unBData# x_e9 + in x_5 + (lessThanEqualsInteger# (lengthOfByteString# x_ea) 32#) + (\ ~ -> + let* x_eb = x_2 x_e8 + x_ec = x_3 x_eb + x_ed = unConstrData# x_ec + x_ee = x_4 x_ed + x_ef = x x_ed + x_eg = + x_5 + (equalsInteger# 0# x_ee) + (\ ~ -> + let* x_eh = x_3 x_ef + x_ei = unIData# x_eh + in x_5 + (lessThanEqualsInteger# 0# x_ei) + (\ ~ -> let* x_ej = x_2 x_ef; x_ek = x_b x_ej (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> x_5 (equalsInteger# 1# x_ee) (\ ~ -> let* x_em = x_b x_ef (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) (\ ~ -> ERROR) !) + ! + x_en = x_2 x_eb + x_ep = x_3 x_en + x_er = unConstrData# x_ep + x_es = x_4 x_er + x_et = x x_er + x_eu = + x_5 + (equalsInteger# 0# x_es) + (\ ~ -> + let* x_ev = x_3 x_et + x_ew = unIData# x_ev + in x_5 + (lessThanEqualsInteger# 0# x_ew) + (\ ~ -> let* x_ex = x_2 x_et; x_ey = x_b x_ex (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> x_5 (equalsInteger# 1# x_es) (\ ~ -> let* x_ez = x_b x_et (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) (\ ~ -> ERROR) !) + ! + x_f0 = x_2 x_en + x_f1 = x_3 x_f0 + x_f2 = unIData# x_f1 + x_f3 = x_2 x_f0 + x_f4 = x_3 x_f3 + x_f5 = unIData# x_f4 + x_f6 = x_2 x_f3 + x_f7 = x_3 x_f6 + x_f8 = unIData# x_f7 + x_f9 = x_2 x_f6 + x_fa = x_3 x_f9 + x_fb = unConstrData# x_fa + x_fc = x_4 x_fb + x_fd = x x_fb + x_fe = + x_5 + (equalsInteger# 0# x_fc) + (\ ~ -> + let* x_ff = x_3 x_fd + x_fg = unIData# x_ff + x_fh = x_2 x_fd + x_fi = x_3 x_fh + x_fj = unIData# x_fi + x_fk = x_2 x_fh + x_fm = x_3 x_fk + x_fn = unIData# x_fm + x_fp = x_2 x_fk + x_fr = x_b x_fp (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + ! + x_fs = x_2 x_f9 + x_ft = x_3 x_fs + x_fu = unIData# x_ft + x_fv = x_2 x_fs + x_fw = x_b x_fv (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + in x_ax) + (\ ~ -> ERROR)) + (\ ~ -> + x_5 + (equalsInteger# 2# x_an) + (\ ~ -> + let* x_fx = x_3 x_ap + x_fy = unConstrData# x_fx + x_fz = x_4 x_fy + x_g0 = x x_fy + x_g1 = + x_5 + (equalsInteger# 0# x_fz) + (\ ~ -> + let* x_g2 = x_3 x_g0 + x_g3 = unBData# x_g2 + in x_5 + (equalsInteger# (lengthOfByteString# x_g3) 28#) + (\ ~ -> + let* x_g4 = x_2 x_g0 + x_g5 = x_3 x_g4 + x_g6 = unConstrData# x_g5 + x_g7 = x_4 x_g6 + x_g8 = x x_g6 + x_g9 = + x_5 + (equalsInteger# 0# x_g7) + (\ ~ -> + let* x_ga = x_3 x_g8 + x_gb = unConstrData# x_ga + x_gc = x_4 x_gb + x_gd = x x_gb + x_ge = + x_5 + (equalsInteger# 0# x_gc) + (\ ~ -> + let* x_gf = x_3 x_gd + x_gg = unBData# x_gf + in x_5 + (equalsInteger# (lengthOfByteString# x_gg) 28#) + (\ ~ -> let* x_gh = x_2 x_gd; x_gi = x_b x_gh (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> + x_5 + (equalsInteger# 1# x_gc) + (\ ~ -> + let* x_gj = x_3 x_gd + x_gk = unBData# x_gj + in x_5 + (equalsInteger# (lengthOfByteString# x_gk) 28#) + (\ ~ -> let* x_gm = x_2 x_gd; x_gn = x_b x_gm (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_gp = x_2 x_g8 + x_gr = x_3 x_gp + x_gs = unConstrData# x_gr + x_gt = x_4 x_gs + x_gu = x x_gs + x_gv = + x_5 + (equalsInteger# 0# x_gt) + (\ ~ -> + let* x_gw = x_3 x_gu + x_gx = unConstrData# x_gw + x_gy = x_4 x_gx + x_gz = x x_gx + x_h0 = + x_5 + (equalsInteger# 0# x_gy) + (\ ~ -> + let* x_h1 = x_3 x_gz + x_h2 = unConstrData# x_h1 + x_h3 = x_4 x_h2 + x_h4 = x x_h2 + x_h5 = + x_5 + (equalsInteger# 0# x_h3) + (\ ~ -> + let* x_h6 = x_3 x_h4 + x_h7 = unBData# x_h6 + in x_5 + (equalsInteger# (lengthOfByteString# x_h7) 28#) + (\ ~ -> let* x_h8 = x_2 x_h4; x_h9 = x_b x_h8 (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> + x_5 + (equalsInteger# 1# x_h3) + (\ ~ -> + let* x_ha = x_3 x_h4 + x_hb = unBData# x_ha + in x_5 + (equalsInteger# (lengthOfByteString# x_hb) 28#) + (\ ~ -> let* x_hc = x_2 x_h4; x_hd = x_b x_hc (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_he = x_2 x_gz + x_hf = x_b x_he (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> + x_5 + (equalsInteger# 1# x_gy) + (\ ~ -> + let* x_hg = x_3 x_gz + x_hh = unIData# x_hg + x_hi = x_2 x_gz + x_hj = x_3 x_hi + x_hk = unIData# x_hj + x_hm = x_2 x_hi + x_hn = x_3 x_hm + x_hp = unIData# x_hn + x_hr = x_2 x_hm + x_hs = x_b x_hr (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + !) + ! + x_ht = x_2 x_gu + x_hu = x_b x_ht (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> x_5 (equalsInteger# 1# x_gt) (\ ~ -> let* x_hv = x_b x_gu (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) (\ ~ -> ERROR) !) + ! + x_hw = x_2 x_gp + x_hx = x_b x_hw (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + ! + x_hy = x_2 x_g4 + x_hz = x_3 x_hy + x_i0 = unConstrData# x_hz + x_i1 = x_4 x_i0 + x_i2 = x x_i0 + x_i3 = + x_5 + (equalsInteger# 0# x_i1) + (\ ~ -> + let* x_i4 = x_3 x_i2 + x_i5 = unBData# x_i4 + x_i6 = lengthOfByteString# x_i5 + in x_5 + (x_w (equalsInteger# x_i6 0#) (\ ~ -> equalsInteger# x_i6 28#) !) + (\ ~ -> + let* x_i7 = x_2 x_i2 + x_i8 = x_3 x_i7 + x_i9 = unBData# x_i8 + in x_5 + (lessThanEqualsInteger# (lengthOfByteString# x_i9) 32#) + (\ ~ -> let* x_ia = x_2 x_i7; x_ib = x_b x_ia (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_ic = x_2 x_hy + x_id = x_3 x_ic + x_ie = unIData# x_id + x_if = x_2 x_ic + x_ig = x_3 x_if + x_ih = unIData# x_ig + x_ii = x_2 x_if + x_ij = x_3 x_ii + x_ik = unConstrData# x_ij + x_im = x_4 x_ik + x_in = x x_ik + x_ip = + x_5 + (equalsInteger# 0# x_im) + (\ ~ -> + let* x_ir = x_3 x_in + x_is = unBData# x_ir + x_it = lengthOfByteString# x_is + in x_5 + (x_w (equalsInteger# x_it 0#) (\ ~ -> equalsInteger# x_it 28#) !) + (\ ~ -> + let* x_iu = x_2 x_in + x_iv = x_3 x_iu + x_iw = unBData# x_iv + in x_5 + (lessThanEqualsInteger# (lengthOfByteString# x_iw) 32#) + (\ ~ -> let* x_ix = x_2 x_iu; x_iy = x_b x_ix (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_iz = x_2 x_ii + x_j0 = x_3 x_iz + x_j1 = unConstrData# x_j0 + in x_5 + (equalsInteger# (x_4 x_j1) 0#) + (\ ~ -> + let* x_j2 = x x_j1 + x_j3 = unIData# (x_3 x_j2) + x_j4 = x_2 x_j2 + x_j5 = unIData# (x_3 x_j4) + x_j6 = x_2f x_j5 + x_j7 = iData# x_j6 + in x_5 + (equalsData# (listData# (x_2 x_j4)) (listData# x_2a)) + (\ ~ -> + let* x_j8 = x_2 x_iz + x_j9 = x_3 x_j8 + x_ja = unBData# x_j9 + in x_5 + (lessThanEqualsInteger# (lengthOfByteString# x_ja) 32#) + (\ ~ -> + let* x_jb = x_2 x_j8 + x_jc = x_3 x_jb + x_jd = unConstrData# x_jc + x_je = x_4 x_jd + x_jf = x x_jd + x_jg = + x_5 + (equalsInteger# 0# x_je) + (\ ~ -> + let* x_jh = x_3 x_jf + x_ji = unIData# x_jh + in x_5 + (lessThanEqualsInteger# 0# x_ji) + (\ ~ -> let* x_jj = x_2 x_jf; x_jk = x_b x_jj (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> x_5 (equalsInteger# 1# x_je) (\ ~ -> let* x_jm = x_b x_jf (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) (\ ~ -> ERROR) !) + ! + x_jn = x_2 x_jb + x_jp = x_3 x_jn + x_jr = unConstrData# x_jp + x_js = x_4 x_jr + x_jt = x x_jr + x_ju = + x_5 + (equalsInteger# 0# x_js) + (\ ~ -> + let* x_jv = x_3 x_jt + x_jw = unIData# x_jv + in x_5 + (lessThanEqualsInteger# 0# x_jw) + (\ ~ -> let* x_jx = x_2 x_jt; x_jy = x_b x_jx (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> x_5 (equalsInteger# 1# x_js) (\ ~ -> let* x_jz = x_b x_jt (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) (\ ~ -> ERROR) !) + ! + x_k0 = x_2 x_jn + x_k1 = x_3 x_k0 + x_k2 = unIData# x_k1 + x_k3 = x_2 x_k0 + x_k4 = x_3 x_k3 + x_k5 = unIData# x_k4 + x_k6 = x_2 x_k3 + x_k7 = x_3 x_k6 + x_k8 = unIData# x_k7 + x_k9 = x_2 x_k6 + x_ka = x_3 x_k9 + x_kb = unConstrData# x_ka + x_kc = x_4 x_kb + x_kd = x x_kb + x_ke = + x_5 + (equalsInteger# 0# x_kc) + (\ ~ -> + let* x_kf = x_3 x_kd + x_kg = unIData# x_kf + x_kh = x_2 x_kd + x_ki = x_3 x_kh + x_kj = unIData# x_ki + x_kk = x_2 x_kh + x_km = x_3 x_kk + x_kn = unIData# x_km + x_kp = x_2 x_kk + x_kr = x_b x_kp (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + ! + x_ks = x_2 x_k9 + x_kt = x_3 x_ks + x_ku = unIData# x_kt + x_kv = x_2 x_ks + x_kw = x_b x_kv (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + in x_fx) + (\ ~ -> ERROR) + !) + ! + x_kx = x_12 (x_0 x_ar) + x_ky = x_2 x_kx + x_kz = x_2 x_ky + x_m0 = x_2 x_kz + x_m1 = x_2 x_m0 + x_m2 = x_2 x_m1 + x_m3 = x_2 x_m2 + x_m4 = x_2 x_m3 + x_m5 = x_2 x_m4 + x_m6 = x_2 x_m5 + x_m7 = x_2 x_m6 + x_m8 = x_2 x_m7 + x_m9 = unIData# (x_3 x_kz) + x_ma = unIData# (x_3 x_ky) + x_mb = unIData# (x_3 x_m5) + x_mc = x_3 x_m1 + x_md = x_3 x_m8 + x_me = unIData# (x_3 (x_2 x_m8)) + x_mf = unIData# (x_3 (x_0 x_mc)) + x_mg = x_3 x_m6 + x_mh = unIData# (x_3 x_m7) + x_mi = x_0 x_md + x_mj = x_2 x_mi + x_mk = x_3 x_mi + x_mm = x_3 x_mj + x_mn = x_3 (x_2 x_mj) + x_mp = x_3 x_kx + x_mr = x_3 x_m0 + x_ms = unConstrData# (x_3 x_m3) + x_mt = x_4 x_ms + x_mu = x x_ms + in x_5 + (equalsInteger# 1# x_mt) + (\ ~ -> + let* x_mv = unConstrData# (x_3 x_m4) + x_mw = x_4 x_mv + x_mx = x x_mv + in x_5 + (lessThanInteger# 0# x_m9) + (\ ~ -> + x_5 + (equalsInteger# x_ma x_m9) + (\ ~ -> + x_5 + (equalsByteString# (unBData# (x_3 x_m2)) x_a0) + (\ ~ -> + x_5 + (equalsInteger# 0# x_mb) + (\ ~ -> + x_5 + (lessThanInteger# 0# x_mf) + (\ ~ -> + x_5 + (x_8x (x_1p x_mp x_mr)) + (\ ~ -> + x_5 + True# + (\ ~ -> + x_5 + (equalsData# x_mg x_mk) + (\ ~ -> + x_5 + (equalsInteger# x_mh x_a8) + (\ ~ -> + let* x_my = x_2s x_mp (iData# x_m9) + x_mz = x_2s x_ad (iData# 1#) + x_n0 = x_2s (x_2c x_2x x_2x) (iData# x_a9) + x_n1 = x_4i x_mp x_mr x_mk x_mm x_mn + x_n2 = x_58 (x_4c addInteger# x_my (x_58 (x_4c addInteger# x_mz (x_58 (x_4c addInteger# x_n0 x_n1))))) + x_n3 = unMapData# (x_3 (x_2 (x_0 x_af))) + in x_5 + (x_8u x_n3 x_n2) + (\ ~ -> + x_5 + (equalsInteger# (unIData# x_mn) 0#) + (\ ~ -> + x_5 + (x_1u (lessThanEqualsInteger# x_a6 (unIData# x_mk)) (\ ~ -> lessThanEqualsInteger# (x_7j (x_6t (x_5s x_a7) (x_5m x_m9))) (unIData# x_mm)) !) + (\ ~ -> x_5 (equalsInteger# x_me 0#) (\ ~ -> ()#) (\ ~ -> ERROR) !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> + let* x_n4 = unConstrData# (x_3 x_m4) + x_n5 = x_4 x_n4 + x_n6 = x x_n4 + in x_5 + (equalsInteger# 0# x_n5) + (\ ~ -> + x_5 + (lessThanInteger# 0# x_m9) + (\ ~ -> + x_5 + (equalsInteger# x_ma x_m9) + (\ ~ -> + x_5 + (equalsByteString# (unBData# (x_3 x_m2)) x_a0) + (\ ~ -> + x_5 + (equalsInteger# 0# x_mb) + (\ ~ -> + x_5 + (lessThanInteger# 0# x_mf) + (\ ~ -> + x_5 + (x_8x (x_1p x_mp x_mr)) + (\ ~ -> + x_5 + (lessThanEqualsInteger# (unIData# (x_3 x_mu)) (unIData# (x_3 x_n6))) + (\ ~ -> + x_5 + (equalsData# x_mg x_mk) + (\ ~ -> + x_5 + (equalsInteger# x_mh x_a8) + (\ ~ -> + let* x_n7 = x_2s x_mp (iData# x_m9) + x_n8 = x_2s x_ad (iData# 1#) + x_n9 = x_2s (x_2c x_2x x_2x) (iData# x_a9) + x_na = x_4i x_mp x_mr x_mk x_mm x_mn + x_nb = x_58 (x_4c addInteger# x_n7 (x_58 (x_4c addInteger# x_n8 (x_58 (x_4c addInteger# x_n9 x_na))))) + x_nc = unMapData# (x_3 (x_2 (x_0 x_af))) + in x_5 + (x_8u x_nc x_nb) + (\ ~ -> + x_5 + (equalsInteger# (unIData# x_mn) 0#) + (\ ~ -> + x_5 + (x_1u + (lessThanEqualsInteger# x_a6 (unIData# x_mk)) + (\ ~ -> lessThanEqualsInteger# (x_7j (x_6t (x_5s x_a7) (x_5m x_m9))) (unIData# x_mm)) + !) + (\ ~ -> x_5 (equalsInteger# x_me 0#) (\ ~ -> ()#) (\ ~ -> ERROR) !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> + x_5 + (lessThanInteger# 0# x_m9) + (\ ~ -> + x_5 + (equalsInteger# x_ma x_m9) + (\ ~ -> + x_5 + (equalsByteString# (unBData# (x_3 x_m2)) x_a0) + (\ ~ -> + x_5 + (equalsInteger# 0# x_mb) + (\ ~ -> + x_5 + (lessThanInteger# 0# x_mf) + (\ ~ -> + x_5 + (x_8x (x_1p x_mp x_mr)) + (\ ~ -> + x_5 + True# + (\ ~ -> + x_5 + (equalsData# x_mg x_mk) + (\ ~ -> + x_5 + (equalsInteger# x_mh x_a8) + (\ ~ -> + let* x_nd = x_2s x_mp (iData# x_m9) + x_ne = x_2s x_ad (iData# 1#) + x_nf = x_2s (x_2c x_2x x_2x) (iData# x_a9) + x_ng = x_4i x_mp x_mr x_mk x_mm x_mn + x_nh = x_58 (x_4c addInteger# x_nd (x_58 (x_4c addInteger# x_ne (x_58 (x_4c addInteger# x_nf x_ng))))) + x_ni = unMapData# (x_3 (x_2 (x_0 x_af))) + in x_5 + (x_8u x_ni x_nh) + (\ ~ -> + x_5 + (equalsInteger# (unIData# x_mn) 0#) + (\ ~ -> + x_5 + (x_1u + (lessThanEqualsInteger# x_a6 (unIData# x_mk)) + (\ ~ -> lessThanEqualsInteger# (x_7j (x_6t (x_5s x_a7) (x_5m x_m9))) (unIData# x_mm)) + !) + (\ ~ -> x_5 (equalsInteger# x_me 0#) (\ ~ -> ()#) (\ ~ -> ERROR) !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + !) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR)) + (\ ~ -> ERROR) + !) + !) + (\ ~ -> x_5 (x_y (\ x_nj -> lessThanEqualsInteger# 0# (unIData# (x x_nj))) (x_t x_97 x_9d (\ x_nk -> x_nk) (\ ~ -> ERROR))) (\ ~ -> ERROR) (\ ~ -> ()#) !) + ! diff --git a/geniusyield-onchain/fixtures/partialordernftpolicyV1_1-aggressive.txt b/geniusyield-onchain/fixtures/partialordernftpolicyV1_1-aggressive.txt new file mode 100644 index 00000000..f3df0fdf --- /dev/null +++ b/geniusyield-onchain/fixtures/partialordernftpolicyV1_1-aggressive.txt @@ -0,0 +1,938 @@ +let* sndPair!! = sndPair# ! ! + fstPair!! = fstPair# ! ! + listData___ = \ ~ -> listData# []# + lessThanEqualsInteger_0 = lessThanEqualsInteger# 0# + lessThanInteger_0 = lessThanInteger# 0# + equalsInteger_28 = equalsInteger# 28# + equalsInteger_2 = equalsInteger# 2# + equalsInteger_1 = equalsInteger# 1# + equalsInteger_0 = equalsInteger# 0# + multiplyInteger_1 = multiplyInteger# 1# + __ = []# + _01 = 1#d + _00 = 0#d + ~__ = \ ~ -> __ + chooseList!! = chooseList# ! ! + ifThenElse! = ifThenElse# ! + headList! = headList# ! + tailList! = tailList# ! + zComb = \ f -> let* x = \ y -> f (\ u -> y y u) in f (\ v -> x x v) + x_0 = zComb (\ x_1 x_2 x_3 -> chooseList!! x_3 (\ ~ x_4 x_5 -> x_5 !) (\ ~ -> ifThenElse! (x_2 (headList! x_3)) (\ ~ -> let* x_6 = headList! x_3 in \ x_7 x_8 -> x_7 x_6) (\ ~ -> x_1 x_2 (tailList! x_3)) !) !) + x_9 = zComb (\ x_a x_b x_c -> ifThenElse! (equalsInteger_0 x_c) (\ ~ -> x_b) (\ ~ -> x_a x_c (modInteger# x_b x_c)) !) + x_d = \ x_e -> sndPair!! (unConstrData# x_e) + x_f = \ x_g -> ifThenElse! x_g (\ ~ -> True#) + x_h = \ x_i -> zComb (\ x_j x_k -> chooseList!! x_k (\ ~ -> False#) (\ ~ -> x_f (x_i (headList! x_k)) (\ ~ -> x_j (tailList! x_k)) !) !) + x_m = \ x_n x_p x_r -> zComb (\ x_s x_t -> chooseList!! x_t (\ ~ x_u x_v -> x_v !) (\ ~ -> ifThenElse! (equalsData# (fstPair!! (headList! x_t)) x_p) (\ ~ -> x_n (headList! x_t)) (\ ~ -> x_s (tailList! x_t)) !) !) x_r + x_w = \ x_x -> x_m (\ x_y -> let* x_z = unMapData# (sndPair!! x_y) in \ x_10 x_11 -> x_10 x_z) (bData# x_x) + tt = ()# + x_12 = \ x_13 -> tailList! (tailList! (tailList! (tailList! x_13))) + x_14 = \ x_15 x_16 -> ifThenElse! x_15 x_16 (\ ~ -> False#) + x_17 = \ x_18 x_19 -> equalsData# (listData# (x_d x_18)) (listData# (x_d x_19)) + x_1a = + \ x_1b -> + let* x_1c = bData# x_1b + in \ x_1d x_1e x_1f -> zComb (\ x_1g x_1h -> chooseList!! x_1h (\ ~ -> x_1d) (\ ~ -> ifThenElse! (equalsData# (fstPair!! (headList! x_1h)) x_1c) (\ ~ -> x_1e (sndPair!! (headList! x_1h))) (\ ~ -> x_1g (tailList! x_1h)) !) !) x_1f + x_1i = \ x_1j x_1k -> let* x_1m = unBData# (headList! (tailList! (x_d x_1k))) in x_1a (unBData# (headList! (x_d x_1k))) 0# (\ x_1n -> x_1a x_1m 0# unIData# (unMapData# x_1n)) x_1j + nullList! = nullList# ! + mkCons! = mkCons# ! + x_1p = \ x_1r x_1s -> constrData# 0# (mkCons! (bData# x_1r) (mkCons! (bData# x_1s) []#)) + x_1t = \ x_1u -> ifThenElse! (lessThanEqualsInteger# x_1u 0#) (\ ~ -> ERROR) (\ ~ -> x_1u) ! + x_1v = \ x_1w -> ifThenElse! x_1w False# True# + x_1x = subtractInteger# 0# + const = \ u1 v1 -> u1 + flipConst = \ u2 v2 -> v2 + x_1y = + \ x_1z x_20 x_21 -> + zComb + (\ x_22 x_23 -> + x_23 + (\ x_24 x_25 -> chooseList!! x_24 (\ ~ -> x_25) (\ ~ -> x_22 flipConst (headList! x_24) (tailList! x_24) x_25) !) + (\ x_26 x_27 x_28 -> + chooseList!! + x_28 + (\ ~ -> mkCons! x_26 x_27) + (\ ~ -> + let* x_29 = headList! x_28 + x_2a = fstPair!! x_26 + x_x = fstPair!! x_29 + in ifThenElse! + (equalsData# x_2a x_x) + (\ ~ -> mkCons! (mkPairData# x_2a (x_1z (sndPair!! x_26) (sndPair!! x_29))) (x_22 const x_27 (tailList! x_28))) + (\ ~ -> ifThenElse! (lessThanByteString# (unBData# x_2a) (unBData# x_x)) (\ ~ -> mkCons! x_26 (x_22 flipConst x_29 (tailList! x_28) x_27)) (\ ~ -> mkCons! x_29 (x_22 flipConst x_26 x_27 (tailList! x_28))) !) + !) + !)) + const + x_20 + x_21 + x_2b = \ x_2c x_2d x_2e -> x_1y (\ x_2f x_2g -> mapData# (x_1y (\ x_2h x_2i -> iData# (x_2c (unIData# x_2h) (unIData# x_2i))) (unMapData# x_2f) (unMapData# x_2g))) x_2d x_2e + x_2j = \ x_2k -> zComb (\ x_2m x_2n -> chooseList!! x_2n (\ ~ -> True#) (\ ~ -> x_14 (x_2k (headList! x_2n)) (\ ~ -> x_2m (tailList! x_2n)) !) !) + x_2p = \ x_2r x_2s -> zComb (\ x_2t x_2u -> chooseList!! x_2u ~__ (\ ~ -> mkCons! (mkPairData# (fstPair!! (headList! x_2u)) (x_2r (sndPair!! (headList! x_2u)))) (x_2t (tailList! x_2u))) !) x_2s + x_2v = + \ x_2w x_2x -> + x_2j (\ x_2y -> x_2j (\ x_2z -> lessThanEqualsInteger_0 (unIData# (sndPair!! x_2z))) (unMapData# (sndPair!! x_2y))) (x_2b addInteger# x_2w (x_2p (\ x_30 -> mapData# (x_2p (\ x_31 -> iData# (x_1x (unIData# x_31))) (unMapData# x_30))) x_2x)) + x_32 = + \ x_33 -> + let* x_34 = x_33 quotientInteger# + in ifThenElse! + (x_33 (\ x_35 x_36 -> lessThanInteger# (multiplyInteger_1 x_35) (multiplyInteger# 0# x_36))) + (\ ~ -> ifThenElse! (x_33 (\ x_37 x_38 -> equalsInteger# (multiplyInteger_1 x_37) (multiplyInteger# (x_33 quotientInteger#) x_38))) (\ ~ -> x_34) (\ ~ -> subtractInteger# x_34 1#) !) + (\ ~ -> x_34) + ! + x_39 = \ x_3a -> ifThenElse! (lessThanEqualsInteger# x_3a -1#) (\ ~ -> x_1x x_3a) (\ ~ -> x_3a) ! + x_3b = + \ x_3c x_3d -> + x_3c + (\ x_3e x_3f -> + x_3d + (\ x_3g x_3h -> + let* x_3i = multiplyInteger# x_3e x_3g + x_3j = multiplyInteger# x_3f x_3h + x_3k = x_39 x_3i + x_3m = x_39 x_3j + x_3n = x_9 (ifThenElse! (lessThanEqualsInteger# x_3k x_3m) (\ ~ -> x_3m) (\ ~ -> x_3k) !) (ifThenElse! (lessThanEqualsInteger# x_3k x_3m) (\ ~ -> x_3k) (\ ~ -> x_3m) !) + x_3p = ifThenElse! (equalsInteger_0 x_3j) (\ ~ -> 0#) (\ ~ -> ifThenElse! (lessThanEqualsInteger# x_3j 0#) (\ ~ -> -1#) (\ ~ -> 1#) !) ! + x_3r = multiplyInteger# x_3p (divideInteger# x_3i x_3n) + x_3s = multiplyInteger# x_3p (divideInteger# x_3j x_3n) + in \ x_3t -> x_3t x_3r x_3s)) + x_3u = \ x_3v -> let* x_3w = x_d x_3v; unIData_headList!_x = unIData# (headList! x_3w); unIData_headList!_tailList!_x = unIData# (headList! (tailList! x_3w)) in \ x_3x -> x_3x unIData_headList!_x unIData_headList!_tailList!_x + x_3y = \ x_3z x_40 -> x_40 x_3z 1# + x_41 = \ x_42 x_43 -> zComb (\ x_44 x_45 -> chooseList!! x_45 ~__ (\ ~ -> let* x_46 = x_44 (tailList! x_45) in x_42 (sndPair!! (headList! x_45)) (\ x_47 -> mkCons! (mkPairData# (fstPair!! (headList! x_45)) x_47) x_46) (\ ~ -> x_46)) !) x_43 + x_48 = + \ x_49 -> + x_41 + (\ x_4a -> + let* x_4b = x_41 (\ x_4c -> ifThenElse! (equalsData# x_4c _00) (\ ~ x_4d x_4e -> x_4e !) (\ ~ x_4f x_4g -> x_4f x_4c) !) (unMapData# x_4a) + in ifThenElse! (nullList! x_4b) (\ ~ x_4h x_4i -> x_4i !) (\ ~ x_4j x_4k -> x_4j x_4b) ! (\ x_4m -> let* x_4n = mapData# x_4m in \ x_4p x_4r -> x_4p x_4n) (\ ~ x_4s x_4t -> x_4t !)) + x_49 + x_4u = \ x_4v x_4w -> mkCons! (mkPairData# x_4v x_4w) __ + x_4x = \ x_4y x_4z -> let* x_50 = headList! (x_d x_4y); x_51 = headList! (tailList! (x_d x_4y)) in ifThenElse! (lessThanEqualsInteger# (unIData# x_4z) 0#) ~__ (\ ~ -> x_4u x_50 (mapData# (x_4u x_51 x_4z))) ! + x_52 = \ x_53 x_54 x_55 x_56 x_57 -> x_2b addInteger# (x_4x (x_1p ""#b ""#b) x_55) (x_2b addInteger# (x_4x x_53 x_56) (x_4x x_54 x_57)) + x_58 = \ x_59 x_5a -> let* x_5b = headList! (x_d x_59); x_5c = headList! (tailList! (x_d x_59)) in ifThenElse! (equalsData# x_5a _00) ~__ (\ ~ -> x_4u x_5b (mapData# (x_4u x_5c x_5a))) ! +in \ x_5d x_5e -> + let* x_5f = unConstrData# (headList! (tailList! (x_d x_5e))) + x_x_0 = sndPair!! x_5f + x_5g = ifThenElse! (equalsInteger_0 (fstPair!! x_5f)) (\ ~ -> unBData# (headList! x_x_0)) (\ ~ -> ERROR) ! + x_x_1 = x_d (headList! (x_d x_5e)) + tailList!_x_x = tailList! x_x_1 + tailList!_tailList!_x_x = tailList! tailList!_x_x + x_5h = tailList! (tailList! tailList!_tailList!_x_x) + x_5i = unMapData# (headList! x_5h) + x_5j = unConstrData# x_5d + x_x_2 = sndPair!! x_5j + in ifThenElse! + (equalsInteger_0 (fstPair!! x_5j)) + (\ ~ -> + let* headList!_x_x = headList! x_x_2 + x_x_x = + x_12 + (x_d + (x_0 + (\ x_5k -> + let* x_x_3 = x_d (headList! (tailList! (x_d x_5k))) + in x_14 + (x_17 (headList! x_x_3) <0 <0 "\168\129\214\&6\159\167\&17}\130\216\ACK\216\222\178\ACKxx\DC2\154^-\249l%\229\160\142">, <1>>#d) + (\ ~ -> equalsInteger_1 (x_1i (unMapData# (headList! (tailList! x_x_3))) <0 "\190\CAN\194\156\DEL\SI\252\165\195\230\205V\249}\240\248*1\227\ETB\233\155\250\ETX\ESC;\SI\227", "47454e53">#d)) + !) + (unListData# (headList! tailList!_x_x)) + (\ x_5m -> + let* unConstrData_headList!_x_x_x = unConstrData# (headList! (tailList! (tailList! (x_d (headList! (tailList! (x_d x_5m))))))) + x_5n = sndPair!! unConstrData_headList!_x_x_x + in ifThenElse! (equalsInteger_2 (fstPair!! unConstrData_headList!_x_x_x)) (\ ~ -> headList! x_5n) (\ ~ -> ERROR) !) + (\ ~ -> ERROR))) + tailList!_x_x_x = tailList! x_x_x + tailList!_tailList!_x_x_x = tailList! tailList!_x_x_x + x_headList!_x_x = x_d headList!_x_x + x_5p = sha2_256# (consByteString# (unIData# (headList! (tailList! x_headList!_x_x))) (unBData# (headList! (x_d (headList! x_headList!_x_x))))) + unListData_headList!_x_x = unListData# (headList! x_x_1) + x_5r = unListData# (headList! tailList!_tailList!_x_x) + x_5s = unMapData# (headList! (tailList! (x_12 (tailList! x_5h)))) + unIData_headList!_x_x_x = unIData# (headList! x_x_x) + headList!_tailList!_x_x_x = headList! tailList!_x_x_x + x_5t = unIData# (headList! tailList!_tailList!_x_x_x) + x_5u = unIData# (headList! (tailList! tailList!_tailList!_x_x_x)) + x_5v = x_w x_5g x_5i (\ x_5w -> x_5w) (\ ~ -> ERROR) + in chooseList!! + x_5v + (\ ~ -> ERROR) + (\ ~ -> + ifThenElse! + (x_14 + (x_h (\ x_5x -> x_17 headList!_x_x (headList! (x_d x_5x))) unListData_headList!_x_x) + (\ ~ -> x_14 (nullList! (tailList! x_5v)) (\ ~ -> x_14 (equalsInteger_1 (unIData# (sndPair!! (headList! x_5v)))) (\ ~ -> equalsByteString# (unBData# (fstPair!! (headList! x_5v))) x_5p) !) !) + !) + (\ ~ -> + let* x_5y = x_1p x_5g x_5p + in x_0 + (\ x_5z -> equalsInteger_1 (x_1i (unMapData# (headList! (tailList! (x_d x_5z)))) x_5y)) + x_5r + (\ x_60 -> + let* unConstrData_headList!_x_x = unConstrData# (headList! (x_d (headList! (x_d x_60)))) + x_unConstrData_headList!_x_x = sndPair!! unConstrData_headList!_x_x + in ifThenElse! + (ifThenElse! + (equalsInteger_0 (fstPair!! unConstrData_headList!_x_x)) + (\ ~ -> False#) + (\ ~ -> equalsByteString# #e2f9d92651c75a28717bf5622e6164e25133d856e9c02ea21a234dfc#b (unBData# (headList! x_unConstrData_headList!_x_x))) + !) + (\ ~ -> + let* unConstrData_x = unConstrData# (headList! (tailList! (tailList! (x_d x_60)))) + x_unConstrData_x = fstPair!! unConstrData_x + x_unConstrData_x_0 = sndPair!! unConstrData_x + x_x_x_0 = + tailList! + (tailList! + (x_d + (ifThenElse! + (equalsInteger_1 x_unConstrData_x) + (\ ~ -> + x_m + (\ x_61 -> let* x_62 = sndPair!! x_61 in \ x_63 x_64 -> x_63 x_62) + (bData# (unBData# (headList! x_unConstrData_x_0))) + x_5s + (\ x_65 -> + let* x_66 = unConstrData# x_65 + x_x_4 = sndPair!! x_66 + x_67 = + ifThenElse! + (equalsInteger_0 (fstPair!! x_66)) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_x_4)))) + (\ ~ -> + let* tailList!_x_x_0 = tailList! x_x_4 + x_68 = unConstrData# (headList! tailList!_x_x_0) + x_69 = sndPair!! x_68 + x_6a = + ifThenElse! + (equalsInteger_0 (fstPair!! x_68)) + (\ ~ -> + let* x_6b = unConstrData# (headList! x_69) + x_6c = fstPair!! x_6b + x_6d = sndPair!! x_6b + x_6e = + ifThenElse! + (equalsInteger_0 x_6c) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_6d)))) + (\ ~ -> let* x_6f = chooseList!! (tailList! x_6d) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_6c) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_6d)))) + (\ ~ -> let* x_6g = chooseList!! (tailList! x_6d) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_6h = tailList! x_69 + x_6i = unConstrData# (headList! x_6h) + x_6j = fstPair!! x_6i + x_6k = sndPair!! x_6i + x_6m = + ifThenElse! + (equalsInteger_0 x_6j) + (\ ~ -> + let* x_6n = unConstrData# (headList! x_6k) + x_6p = fstPair!! x_6n + x_6r = sndPair!! x_6n + x_6s = + ifThenElse! + (equalsInteger_0 x_6p) + (\ ~ -> + let* x_6t = unConstrData# (headList! x_6r) + x_6u = fstPair!! x_6t + x_6v = sndPair!! x_6t + x_6w = + ifThenElse! + (equalsInteger_0 x_6u) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_6v)))) + (\ ~ -> let* x_6x = chooseList!! (tailList! x_6v) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_6u) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_6v)))) + (\ ~ -> let* x_6y = chooseList!! (tailList! x_6v) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_6z = chooseList!! (tailList! x_6r) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_6p) + (\ ~ -> + let* x_70 = unIData# (headList! x_6r) + x_71 = tailList! x_6r + x_72 = unIData# (headList! x_71) + x_73 = tailList! x_71 + x_74 = unIData# (headList! x_73) + x_75 = chooseList!! (tailList! x_73) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + ! + x_76 = chooseList!! (tailList! x_6k) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ifThenElse! (equalsInteger_1 x_6j) (\ ~ -> let* x_77 = chooseList!! x_6k (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_78 = chooseList!! (tailList! x_6h) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + tailList!_tailList!_x_x_0 = tailList! tailList!_x_x_0 + x_79 = unConstrData# (headList! tailList!_tailList!_x_x_0) + x_7a = sndPair!! x_79 + x_7b = + ifThenElse! + (equalsInteger_0 (fstPair!! x_79)) + (\ ~ -> + let* x_7c = lengthOfByteString# (unBData# (headList! x_7a)) + in ifThenElse! + (x_f (equalsInteger_0 x_7c) (\ ~ -> equalsInteger_28 x_7c) !) + (\ ~ -> + let* x_7d = tailList! x_7a + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_7d))) 32#) + (\ ~ -> let* x_7e = chooseList!! (tailList! x_7d) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_7f = tailList! tailList!_tailList!_x_x_0 + x_7g = unIData# (headList! x_7f) + x_7h = tailList! x_7f + x_7i = unIData# (headList! x_7h) + x_7j = tailList! x_7h + x_7k = unConstrData# (headList! x_7j) + x_7m = sndPair!! x_7k + x_7n = + ifThenElse! + (equalsInteger_0 (fstPair!! x_7k)) + (\ ~ -> + let* x_7p = lengthOfByteString# (unBData# (headList! x_7m)) + in ifThenElse! + (x_f (equalsInteger_0 x_7p) (\ ~ -> equalsInteger_28 x_7p) !) + (\ ~ -> + let* x_7r = tailList! x_7m + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_7r))) 32#) + (\ ~ -> let* x_7s = chooseList!! (tailList! x_7r) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_7t = tailList! x_7j + x_7u = unConstrData# (headList! x_7t) + in ifThenElse! + (equalsInteger_0 (fstPair!! x_7u)) + (\ ~ -> + let* x_7v = sndPair!! x_7u + x_7w = unIData# (headList! x_7v) + x_7x = tailList! x_7v + x_7y = iData# (x_1t (unIData# (headList! x_7x))) + in ifThenElse! + (equalsData# (listData# (tailList! x_7x)) (listData___ !)) + (\ ~ -> + let* x_7z = tailList! x_7t + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_7z))) 32#) + (\ ~ -> + let* x_80 = tailList! x_7z + x_81 = unConstrData# (headList! x_80) + x_82 = fstPair!! x_81 + x_83 = sndPair!! x_81 + x_84 = + ifThenElse! + (equalsInteger_0 x_82) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger_0 (unIData# (headList! x_83))) + (\ ~ -> let* x_85 = chooseList!! (tailList! x_83) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! (equalsInteger_1 x_82) (\ ~ -> let* x_86 = chooseList!! x_83 (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_87 = tailList! x_80 + x_88 = unConstrData# (headList! x_87) + x_89 = fstPair!! x_88 + x_8a = sndPair!! x_88 + x_8b = + ifThenElse! + (equalsInteger_0 x_89) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger_0 (unIData# (headList! x_8a))) + (\ ~ -> let* x_8c = chooseList!! (tailList! x_8a) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! (equalsInteger_1 x_89) (\ ~ -> let* x_8d = chooseList!! x_8a (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_8e = tailList! x_87 + x_8f = unIData# (headList! x_8e) + x_8g = tailList! x_8e + x_8h = unIData# (headList! x_8g) + x_8i = tailList! x_8g + x_8j = unIData# (headList! x_8i) + x_8k = tailList! x_8i + x_8m = unConstrData# (headList! x_8k) + x_8n = sndPair!! x_8m + x_8p = + ifThenElse! + (equalsInteger_0 (fstPair!! x_8m)) + (\ ~ -> + let* x_8r = unIData# (headList! x_8n) + x_8s = tailList! x_8n + x_8t = unIData# (headList! x_8s) + x_8u = tailList! x_8s + x_8v = unIData# (headList! x_8u) + x_8w = chooseList!! (tailList! x_8u) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + x_8x = tailList! x_8k + x_8y = unIData# (headList! x_8x) + x_8z = chooseList!! (tailList! x_8x) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + in x_65) + (\ ~ -> ERROR)) + (\ ~ -> + ifThenElse! + (equalsInteger_2 x_unConstrData_x) + (\ ~ -> + let* headList!_x_unConstrData_x = headList! x_unConstrData_x_0 + x_90 = unConstrData# headList!_x_unConstrData_x + x_91 = sndPair!! x_90 + x_92 = + ifThenElse! + (equalsInteger_0 (fstPair!! x_90)) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_91)))) + (\ ~ -> + let* x_93 = tailList! x_91 + x_94 = unConstrData# (headList! x_93) + x_95 = sndPair!! x_94 + x_96 = + ifThenElse! + (equalsInteger_0 (fstPair!! x_94)) + (\ ~ -> + let* x_97 = unConstrData# (headList! x_95) + x_98 = fstPair!! x_97 + x_99 = sndPair!! x_97 + x_9a = + ifThenElse! + (equalsInteger_0 x_98) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_99)))) + (\ ~ -> let* x_9b = chooseList!! (tailList! x_99) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_98) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_99)))) + (\ ~ -> let* x_9c = chooseList!! (tailList! x_99) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_9d = tailList! x_95 + x_9e = unConstrData# (headList! x_9d) + x_9f = fstPair!! x_9e + x_9g = sndPair!! x_9e + x_9h = + ifThenElse! + (equalsInteger_0 x_9f) + (\ ~ -> + let* x_9i = unConstrData# (headList! x_9g) + x_9j = fstPair!! x_9i + x_9k = sndPair!! x_9i + x_9m = + ifThenElse! + (equalsInteger_0 x_9j) + (\ ~ -> + let* x_9n = unConstrData# (headList! x_9k) + x_9p = fstPair!! x_9n + x_9r = sndPair!! x_9n + x_9s = + ifThenElse! + (equalsInteger_0 x_9p) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_9r)))) + (\ ~ -> let* x_9t = chooseList!! (tailList! x_9r) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_9p) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_9r)))) + (\ ~ -> let* x_9u = chooseList!! (tailList! x_9r) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_9v = chooseList!! (tailList! x_9k) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_9j) + (\ ~ -> + let* x_9w = unIData# (headList! x_9k) + x_9x = tailList! x_9k + x_9y = unIData# (headList! x_9x) + x_9z = tailList! x_9x + x_a0 = unIData# (headList! x_9z) + x_a1 = chooseList!! (tailList! x_9z) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + ! + x_a2 = chooseList!! (tailList! x_9g) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ifThenElse! (equalsInteger_1 x_9f) (\ ~ -> let* x_a3 = chooseList!! x_9g (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_a4 = chooseList!! (tailList! x_9d) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + x_a5 = tailList! x_93 + x_a6 = unConstrData# (headList! x_a5) + x_a7 = sndPair!! x_a6 + x_a8 = + ifThenElse! + (equalsInteger_0 (fstPair!! x_a6)) + (\ ~ -> + let* x_a9 = lengthOfByteString# (unBData# (headList! x_a7)) + in ifThenElse! + (x_f (equalsInteger_0 x_a9) (\ ~ -> equalsInteger_28 x_a9) !) + (\ ~ -> + let* x_aa = tailList! x_a7 + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_aa))) 32#) + (\ ~ -> let* x_ab = chooseList!! (tailList! x_aa) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_ac = tailList! x_a5 + x_ad = unIData# (headList! x_ac) + x_ae = tailList! x_ac + x_af = unIData# (headList! x_ae) + x_ag = tailList! x_ae + x_ah = unConstrData# (headList! x_ag) + x_ai = sndPair!! x_ah + x_aj = + ifThenElse! + (equalsInteger_0 (fstPair!! x_ah)) + (\ ~ -> + let* x_ak = lengthOfByteString# (unBData# (headList! x_ai)) + in ifThenElse! + (x_f (equalsInteger_0 x_ak) (\ ~ -> equalsInteger_28 x_ak) !) + (\ ~ -> + let* x_am = tailList! x_ai + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_am))) 32#) + (\ ~ -> let* x_an = chooseList!! (tailList! x_am) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_ap = tailList! x_ag + x_ar = unConstrData# (headList! x_ap) + in ifThenElse! + (equalsInteger_0 (fstPair!! x_ar)) + (\ ~ -> + let* x_as = sndPair!! x_ar + x_at = unIData# (headList! x_as) + x_au = tailList! x_as + x_av = iData# (x_1t (unIData# (headList! x_au))) + in ifThenElse! + (equalsData# (listData# (tailList! x_au)) (listData___ !)) + (\ ~ -> + let* x_aw = tailList! x_ap + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_aw))) 32#) + (\ ~ -> + let* x_ax = tailList! x_aw + x_ay = unConstrData# (headList! x_ax) + x_az = fstPair!! x_ay + x_b0 = sndPair!! x_ay + x_b1 = + ifThenElse! + (equalsInteger_0 x_az) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger_0 (unIData# (headList! x_b0))) + (\ ~ -> let* x_b2 = chooseList!! (tailList! x_b0) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! (equalsInteger_1 x_az) (\ ~ -> let* x_b3 = chooseList!! x_b0 (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_b4 = tailList! x_ax + x_b5 = unConstrData# (headList! x_b4) + x_b6 = fstPair!! x_b5 + x_b7 = sndPair!! x_b5 + x_b8 = + ifThenElse! + (equalsInteger_0 x_b6) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger_0 (unIData# (headList! x_b7))) + (\ ~ -> let* x_b9 = chooseList!! (tailList! x_b7) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! (equalsInteger_1 x_b6) (\ ~ -> let* x_ba = chooseList!! x_b7 (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_bb = tailList! x_b4 + x_bc = unIData# (headList! x_bb) + x_bd = tailList! x_bb + x_be = unIData# (headList! x_bd) + x_bf = tailList! x_bd + x_bg = unIData# (headList! x_bf) + x_bh = tailList! x_bf + x_bi = unConstrData# (headList! x_bh) + x_bj = sndPair!! x_bi + x_bk = + ifThenElse! + (equalsInteger_0 (fstPair!! x_bi)) + (\ ~ -> + let* x_bm = unIData# (headList! x_bj) + x_bn = tailList! x_bj + x_bp = unIData# (headList! x_bn) + x_br = tailList! x_bn + x_bs = unIData# (headList! x_br) + x_bt = chooseList!! (tailList! x_br) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + x_bu = tailList! x_bh + x_bv = unIData# (headList! x_bu) + x_bw = chooseList!! (tailList! x_bu) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + in headList!_x_unConstrData_x) + (\ ~ -> ERROR) + !) + !))) + tailList!_x_x_x_0 = tailList! x_x_x_0 + tailList!_tailList!_x_x_x_0 = tailList! tailList!_x_x_x_0 + x_bx = tailList! tailList!_tailList!_x_x_x_0 + x_by = tailList! x_bx + x_bz = tailList! x_by + x_c0 = tailList! x_bz + x_c1 = tailList! x_c0 + x_c2 = tailList! x_c1 + x_c3 = tailList! x_c2 + x_c4 = tailList! x_c3 + x_c5 = tailList! x_c4 + x_c6 = unIData# (headList! tailList!_tailList!_x_x_x_0) + x_c7 = unIData# (headList! tailList!_x_x_x_0) + x_c8 = unIData# (headList! x_c2) + x_c9 = unIData# (headList! (tailList! x_c5)) + x_ca = unIData# (headList! (x_d (headList! x_by))) + x_cb = headList! x_c3 + x_cc = unIData# (headList! x_c4) + x_cd = x_d (headList! x_c5) + x_ce = tailList! x_cd + x_cf = headList! x_cd + x_cg = headList! x_ce + x_ch = headList! (tailList! x_ce) + headList!_x_x_x = headList! x_x_x_0 + x_ci = headList! x_bx + x_cj = unConstrData# (headList! x_c0) + x_ck = sndPair!! x_cj + in ifThenElse! + (equalsInteger_1 (fstPair!! x_cj)) + (\ ~ -> + let* x_cm = unConstrData# (headList! x_c1) + x_cn = fstPair!! x_cm + x_cp = sndPair!! x_cm + in ifThenElse! + (lessThanInteger_0 x_c6) + (\ ~ -> + ifThenElse! + (equalsInteger# x_c7 x_c6) + (\ ~ -> + ifThenElse! + (equalsByteString# (unBData# (headList! x_bz)) x_5p) + (\ ~ -> + ifThenElse! + (equalsInteger_0 x_c8) + (\ ~ -> + ifThenElse! + (lessThanInteger_0 x_ca) + (\ ~ -> + ifThenElse! + (x_1v (x_17 headList!_x_x_x x_ci)) + (\ ~ -> + ifThenElse! + True# + (\ ~ -> + ifThenElse! + (equalsData# x_cb x_cf) + (\ ~ -> + ifThenElse! + (equalsInteger# x_cc x_5t) + (\ ~ -> + ifThenElse! + (x_2v + (unMapData# (headList! (tailList! (x_d x_60)))) + (x_48 + (x_2b + addInteger# + (x_58 headList!_x_x_x (iData# x_c6)) + (x_48 + (x_2b + addInteger# + (x_58 x_5y _01) + (x_48 (x_2b addInteger# (x_58 (x_1p ""#b ""#b) (iData# x_5u)) (x_52 headList!_x_x_x x_ci x_cf x_cg x_ch)))))))) + (\ ~ -> + ifThenElse! + (equalsInteger_0 (unIData# x_ch)) + (\ ~ -> + ifThenElse! + (x_14 + (lessThanEqualsInteger# unIData_headList!_x_x_x (unIData# x_cf)) + (\ ~ -> lessThanEqualsInteger# (x_32 (x_3b (x_3u headList!_tailList!_x_x_x) (x_3y x_c6))) (unIData# x_cg)) + !) + (\ ~ -> ifThenElse! (equalsInteger_0 x_c9) (\ ~ -> tt) (\ ~ -> ERROR) !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> + let* x_cr = unConstrData# (headList! x_c1) + x_cs = sndPair!! x_cr + in ifThenElse! + (equalsInteger_1 (fstPair!! x_cr)) + (\ ~ -> + ifThenElse! + (lessThanInteger_0 x_c6) + (\ ~ -> + ifThenElse! + (equalsInteger# x_c7 x_c6) + (\ ~ -> + ifThenElse! + (equalsByteString# (unBData# (headList! x_bz)) x_5p) + (\ ~ -> + ifThenElse! + (equalsInteger_0 x_c8) + (\ ~ -> + ifThenElse! + (lessThanInteger_0 x_ca) + (\ ~ -> + ifThenElse! + (x_1v (x_17 headList!_x_x_x x_ci)) + (\ ~ -> + ifThenElse! + True# + (\ ~ -> + ifThenElse! + (equalsData# x_cb x_cf) + (\ ~ -> + ifThenElse! + (equalsInteger# x_cc x_5t) + (\ ~ -> + ifThenElse! + (x_2v + (unMapData# (headList! (tailList! (x_d x_60)))) + (x_48 + (x_2b + addInteger# + (x_58 headList!_x_x_x (iData# x_c6)) + (x_48 + (x_2b + addInteger# + (x_58 x_5y _01) + (x_48 (x_2b addInteger# (x_58 (x_1p ""#b ""#b) (iData# x_5u)) (x_52 headList!_x_x_x x_ci x_cf x_cg x_ch)))))))) + (\ ~ -> + ifThenElse! + (equalsInteger_0 (unIData# x_ch)) + (\ ~ -> + ifThenElse! + (x_14 + (lessThanEqualsInteger# unIData_headList!_x_x_x (unIData# x_cf)) + (\ ~ -> lessThanEqualsInteger# (x_32 (x_3b (x_3u headList!_tailList!_x_x_x) (x_3y x_c6))) (unIData# x_cg)) + !) + (\ ~ -> ifThenElse! (equalsInteger_0 x_c9) (\ ~ -> tt) (\ ~ -> ERROR) !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (lessThanInteger_0 x_c6) + (\ ~ -> + ifThenElse! + (equalsInteger# x_c7 x_c6) + (\ ~ -> + ifThenElse! + (equalsByteString# (unBData# (headList! x_bz)) x_5p) + (\ ~ -> + ifThenElse! + (equalsInteger_0 x_c8) + (\ ~ -> + ifThenElse! + (lessThanInteger_0 x_ca) + (\ ~ -> + ifThenElse! + (x_1v (x_17 headList!_x_x_x x_ci)) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger# (unIData# (headList! x_ck)) (unIData# (headList! x_cs))) + (\ ~ -> + ifThenElse! + (equalsData# x_cb x_cf) + (\ ~ -> + ifThenElse! + (equalsInteger# x_cc x_5t) + (\ ~ -> + ifThenElse! + (x_2v + (unMapData# (headList! (tailList! (x_d x_60)))) + (x_48 + (x_2b + addInteger# + (x_58 headList!_x_x_x (iData# x_c6)) + (x_48 + (x_2b + addInteger# + (x_58 x_5y _01) + (x_48 (x_2b addInteger# (x_58 (x_1p ""#b ""#b) (iData# x_5u)) (x_52 headList!_x_x_x x_ci x_cf x_cg x_ch)))))))) + (\ ~ -> + ifThenElse! + (equalsInteger_0 (unIData# x_ch)) + (\ ~ -> + ifThenElse! + (x_14 + (lessThanEqualsInteger# unIData_headList!_x_x_x (unIData# x_cf)) + (\ ~ -> lessThanEqualsInteger# (x_32 (x_3b (x_3u headList!_tailList!_x_x_x) (x_3y x_c6))) (unIData# x_cg)) + !) + (\ ~ -> ifThenElse! (equalsInteger_0 x_c9) (\ ~ -> tt) (\ ~ -> ERROR) !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + !) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR)) + (\ ~ -> ERROR) + !) + !) + (\ ~ -> ifThenElse! (x_h (\ x_ct -> lessThanEqualsInteger_0 (unIData# (sndPair!! x_ct))) (x_w x_5g x_5i (\ x_cu -> x_cu) (\ ~ -> ERROR))) (\ ~ -> ERROR) (\ ~ -> tt) !) + ! diff --git a/geniusyield-onchain/fixtures/partialordernftpolicyV1_1-optimized.txt b/geniusyield-onchain/fixtures/partialordernftpolicyV1_1-optimized.txt new file mode 100644 index 00000000..f3df0fdf --- /dev/null +++ b/geniusyield-onchain/fixtures/partialordernftpolicyV1_1-optimized.txt @@ -0,0 +1,938 @@ +let* sndPair!! = sndPair# ! ! + fstPair!! = fstPair# ! ! + listData___ = \ ~ -> listData# []# + lessThanEqualsInteger_0 = lessThanEqualsInteger# 0# + lessThanInteger_0 = lessThanInteger# 0# + equalsInteger_28 = equalsInteger# 28# + equalsInteger_2 = equalsInteger# 2# + equalsInteger_1 = equalsInteger# 1# + equalsInteger_0 = equalsInteger# 0# + multiplyInteger_1 = multiplyInteger# 1# + __ = []# + _01 = 1#d + _00 = 0#d + ~__ = \ ~ -> __ + chooseList!! = chooseList# ! ! + ifThenElse! = ifThenElse# ! + headList! = headList# ! + tailList! = tailList# ! + zComb = \ f -> let* x = \ y -> f (\ u -> y y u) in f (\ v -> x x v) + x_0 = zComb (\ x_1 x_2 x_3 -> chooseList!! x_3 (\ ~ x_4 x_5 -> x_5 !) (\ ~ -> ifThenElse! (x_2 (headList! x_3)) (\ ~ -> let* x_6 = headList! x_3 in \ x_7 x_8 -> x_7 x_6) (\ ~ -> x_1 x_2 (tailList! x_3)) !) !) + x_9 = zComb (\ x_a x_b x_c -> ifThenElse! (equalsInteger_0 x_c) (\ ~ -> x_b) (\ ~ -> x_a x_c (modInteger# x_b x_c)) !) + x_d = \ x_e -> sndPair!! (unConstrData# x_e) + x_f = \ x_g -> ifThenElse! x_g (\ ~ -> True#) + x_h = \ x_i -> zComb (\ x_j x_k -> chooseList!! x_k (\ ~ -> False#) (\ ~ -> x_f (x_i (headList! x_k)) (\ ~ -> x_j (tailList! x_k)) !) !) + x_m = \ x_n x_p x_r -> zComb (\ x_s x_t -> chooseList!! x_t (\ ~ x_u x_v -> x_v !) (\ ~ -> ifThenElse! (equalsData# (fstPair!! (headList! x_t)) x_p) (\ ~ -> x_n (headList! x_t)) (\ ~ -> x_s (tailList! x_t)) !) !) x_r + x_w = \ x_x -> x_m (\ x_y -> let* x_z = unMapData# (sndPair!! x_y) in \ x_10 x_11 -> x_10 x_z) (bData# x_x) + tt = ()# + x_12 = \ x_13 -> tailList! (tailList! (tailList! (tailList! x_13))) + x_14 = \ x_15 x_16 -> ifThenElse! x_15 x_16 (\ ~ -> False#) + x_17 = \ x_18 x_19 -> equalsData# (listData# (x_d x_18)) (listData# (x_d x_19)) + x_1a = + \ x_1b -> + let* x_1c = bData# x_1b + in \ x_1d x_1e x_1f -> zComb (\ x_1g x_1h -> chooseList!! x_1h (\ ~ -> x_1d) (\ ~ -> ifThenElse! (equalsData# (fstPair!! (headList! x_1h)) x_1c) (\ ~ -> x_1e (sndPair!! (headList! x_1h))) (\ ~ -> x_1g (tailList! x_1h)) !) !) x_1f + x_1i = \ x_1j x_1k -> let* x_1m = unBData# (headList! (tailList! (x_d x_1k))) in x_1a (unBData# (headList! (x_d x_1k))) 0# (\ x_1n -> x_1a x_1m 0# unIData# (unMapData# x_1n)) x_1j + nullList! = nullList# ! + mkCons! = mkCons# ! + x_1p = \ x_1r x_1s -> constrData# 0# (mkCons! (bData# x_1r) (mkCons! (bData# x_1s) []#)) + x_1t = \ x_1u -> ifThenElse! (lessThanEqualsInteger# x_1u 0#) (\ ~ -> ERROR) (\ ~ -> x_1u) ! + x_1v = \ x_1w -> ifThenElse! x_1w False# True# + x_1x = subtractInteger# 0# + const = \ u1 v1 -> u1 + flipConst = \ u2 v2 -> v2 + x_1y = + \ x_1z x_20 x_21 -> + zComb + (\ x_22 x_23 -> + x_23 + (\ x_24 x_25 -> chooseList!! x_24 (\ ~ -> x_25) (\ ~ -> x_22 flipConst (headList! x_24) (tailList! x_24) x_25) !) + (\ x_26 x_27 x_28 -> + chooseList!! + x_28 + (\ ~ -> mkCons! x_26 x_27) + (\ ~ -> + let* x_29 = headList! x_28 + x_2a = fstPair!! x_26 + x_x = fstPair!! x_29 + in ifThenElse! + (equalsData# x_2a x_x) + (\ ~ -> mkCons! (mkPairData# x_2a (x_1z (sndPair!! x_26) (sndPair!! x_29))) (x_22 const x_27 (tailList! x_28))) + (\ ~ -> ifThenElse! (lessThanByteString# (unBData# x_2a) (unBData# x_x)) (\ ~ -> mkCons! x_26 (x_22 flipConst x_29 (tailList! x_28) x_27)) (\ ~ -> mkCons! x_29 (x_22 flipConst x_26 x_27 (tailList! x_28))) !) + !) + !)) + const + x_20 + x_21 + x_2b = \ x_2c x_2d x_2e -> x_1y (\ x_2f x_2g -> mapData# (x_1y (\ x_2h x_2i -> iData# (x_2c (unIData# x_2h) (unIData# x_2i))) (unMapData# x_2f) (unMapData# x_2g))) x_2d x_2e + x_2j = \ x_2k -> zComb (\ x_2m x_2n -> chooseList!! x_2n (\ ~ -> True#) (\ ~ -> x_14 (x_2k (headList! x_2n)) (\ ~ -> x_2m (tailList! x_2n)) !) !) + x_2p = \ x_2r x_2s -> zComb (\ x_2t x_2u -> chooseList!! x_2u ~__ (\ ~ -> mkCons! (mkPairData# (fstPair!! (headList! x_2u)) (x_2r (sndPair!! (headList! x_2u)))) (x_2t (tailList! x_2u))) !) x_2s + x_2v = + \ x_2w x_2x -> + x_2j (\ x_2y -> x_2j (\ x_2z -> lessThanEqualsInteger_0 (unIData# (sndPair!! x_2z))) (unMapData# (sndPair!! x_2y))) (x_2b addInteger# x_2w (x_2p (\ x_30 -> mapData# (x_2p (\ x_31 -> iData# (x_1x (unIData# x_31))) (unMapData# x_30))) x_2x)) + x_32 = + \ x_33 -> + let* x_34 = x_33 quotientInteger# + in ifThenElse! + (x_33 (\ x_35 x_36 -> lessThanInteger# (multiplyInteger_1 x_35) (multiplyInteger# 0# x_36))) + (\ ~ -> ifThenElse! (x_33 (\ x_37 x_38 -> equalsInteger# (multiplyInteger_1 x_37) (multiplyInteger# (x_33 quotientInteger#) x_38))) (\ ~ -> x_34) (\ ~ -> subtractInteger# x_34 1#) !) + (\ ~ -> x_34) + ! + x_39 = \ x_3a -> ifThenElse! (lessThanEqualsInteger# x_3a -1#) (\ ~ -> x_1x x_3a) (\ ~ -> x_3a) ! + x_3b = + \ x_3c x_3d -> + x_3c + (\ x_3e x_3f -> + x_3d + (\ x_3g x_3h -> + let* x_3i = multiplyInteger# x_3e x_3g + x_3j = multiplyInteger# x_3f x_3h + x_3k = x_39 x_3i + x_3m = x_39 x_3j + x_3n = x_9 (ifThenElse! (lessThanEqualsInteger# x_3k x_3m) (\ ~ -> x_3m) (\ ~ -> x_3k) !) (ifThenElse! (lessThanEqualsInteger# x_3k x_3m) (\ ~ -> x_3k) (\ ~ -> x_3m) !) + x_3p = ifThenElse! (equalsInteger_0 x_3j) (\ ~ -> 0#) (\ ~ -> ifThenElse! (lessThanEqualsInteger# x_3j 0#) (\ ~ -> -1#) (\ ~ -> 1#) !) ! + x_3r = multiplyInteger# x_3p (divideInteger# x_3i x_3n) + x_3s = multiplyInteger# x_3p (divideInteger# x_3j x_3n) + in \ x_3t -> x_3t x_3r x_3s)) + x_3u = \ x_3v -> let* x_3w = x_d x_3v; unIData_headList!_x = unIData# (headList! x_3w); unIData_headList!_tailList!_x = unIData# (headList! (tailList! x_3w)) in \ x_3x -> x_3x unIData_headList!_x unIData_headList!_tailList!_x + x_3y = \ x_3z x_40 -> x_40 x_3z 1# + x_41 = \ x_42 x_43 -> zComb (\ x_44 x_45 -> chooseList!! x_45 ~__ (\ ~ -> let* x_46 = x_44 (tailList! x_45) in x_42 (sndPair!! (headList! x_45)) (\ x_47 -> mkCons! (mkPairData# (fstPair!! (headList! x_45)) x_47) x_46) (\ ~ -> x_46)) !) x_43 + x_48 = + \ x_49 -> + x_41 + (\ x_4a -> + let* x_4b = x_41 (\ x_4c -> ifThenElse! (equalsData# x_4c _00) (\ ~ x_4d x_4e -> x_4e !) (\ ~ x_4f x_4g -> x_4f x_4c) !) (unMapData# x_4a) + in ifThenElse! (nullList! x_4b) (\ ~ x_4h x_4i -> x_4i !) (\ ~ x_4j x_4k -> x_4j x_4b) ! (\ x_4m -> let* x_4n = mapData# x_4m in \ x_4p x_4r -> x_4p x_4n) (\ ~ x_4s x_4t -> x_4t !)) + x_49 + x_4u = \ x_4v x_4w -> mkCons! (mkPairData# x_4v x_4w) __ + x_4x = \ x_4y x_4z -> let* x_50 = headList! (x_d x_4y); x_51 = headList! (tailList! (x_d x_4y)) in ifThenElse! (lessThanEqualsInteger# (unIData# x_4z) 0#) ~__ (\ ~ -> x_4u x_50 (mapData# (x_4u x_51 x_4z))) ! + x_52 = \ x_53 x_54 x_55 x_56 x_57 -> x_2b addInteger# (x_4x (x_1p ""#b ""#b) x_55) (x_2b addInteger# (x_4x x_53 x_56) (x_4x x_54 x_57)) + x_58 = \ x_59 x_5a -> let* x_5b = headList! (x_d x_59); x_5c = headList! (tailList! (x_d x_59)) in ifThenElse! (equalsData# x_5a _00) ~__ (\ ~ -> x_4u x_5b (mapData# (x_4u x_5c x_5a))) ! +in \ x_5d x_5e -> + let* x_5f = unConstrData# (headList! (tailList! (x_d x_5e))) + x_x_0 = sndPair!! x_5f + x_5g = ifThenElse! (equalsInteger_0 (fstPair!! x_5f)) (\ ~ -> unBData# (headList! x_x_0)) (\ ~ -> ERROR) ! + x_x_1 = x_d (headList! (x_d x_5e)) + tailList!_x_x = tailList! x_x_1 + tailList!_tailList!_x_x = tailList! tailList!_x_x + x_5h = tailList! (tailList! tailList!_tailList!_x_x) + x_5i = unMapData# (headList! x_5h) + x_5j = unConstrData# x_5d + x_x_2 = sndPair!! x_5j + in ifThenElse! + (equalsInteger_0 (fstPair!! x_5j)) + (\ ~ -> + let* headList!_x_x = headList! x_x_2 + x_x_x = + x_12 + (x_d + (x_0 + (\ x_5k -> + let* x_x_3 = x_d (headList! (tailList! (x_d x_5k))) + in x_14 + (x_17 (headList! x_x_3) <0 <0 "\168\129\214\&6\159\167\&17}\130\216\ACK\216\222\178\ACKxx\DC2\154^-\249l%\229\160\142">, <1>>#d) + (\ ~ -> equalsInteger_1 (x_1i (unMapData# (headList! (tailList! x_x_3))) <0 "\190\CAN\194\156\DEL\SI\252\165\195\230\205V\249}\240\248*1\227\ETB\233\155\250\ETX\ESC;\SI\227", "47454e53">#d)) + !) + (unListData# (headList! tailList!_x_x)) + (\ x_5m -> + let* unConstrData_headList!_x_x_x = unConstrData# (headList! (tailList! (tailList! (x_d (headList! (tailList! (x_d x_5m))))))) + x_5n = sndPair!! unConstrData_headList!_x_x_x + in ifThenElse! (equalsInteger_2 (fstPair!! unConstrData_headList!_x_x_x)) (\ ~ -> headList! x_5n) (\ ~ -> ERROR) !) + (\ ~ -> ERROR))) + tailList!_x_x_x = tailList! x_x_x + tailList!_tailList!_x_x_x = tailList! tailList!_x_x_x + x_headList!_x_x = x_d headList!_x_x + x_5p = sha2_256# (consByteString# (unIData# (headList! (tailList! x_headList!_x_x))) (unBData# (headList! (x_d (headList! x_headList!_x_x))))) + unListData_headList!_x_x = unListData# (headList! x_x_1) + x_5r = unListData# (headList! tailList!_tailList!_x_x) + x_5s = unMapData# (headList! (tailList! (x_12 (tailList! x_5h)))) + unIData_headList!_x_x_x = unIData# (headList! x_x_x) + headList!_tailList!_x_x_x = headList! tailList!_x_x_x + x_5t = unIData# (headList! tailList!_tailList!_x_x_x) + x_5u = unIData# (headList! (tailList! tailList!_tailList!_x_x_x)) + x_5v = x_w x_5g x_5i (\ x_5w -> x_5w) (\ ~ -> ERROR) + in chooseList!! + x_5v + (\ ~ -> ERROR) + (\ ~ -> + ifThenElse! + (x_14 + (x_h (\ x_5x -> x_17 headList!_x_x (headList! (x_d x_5x))) unListData_headList!_x_x) + (\ ~ -> x_14 (nullList! (tailList! x_5v)) (\ ~ -> x_14 (equalsInteger_1 (unIData# (sndPair!! (headList! x_5v)))) (\ ~ -> equalsByteString# (unBData# (fstPair!! (headList! x_5v))) x_5p) !) !) + !) + (\ ~ -> + let* x_5y = x_1p x_5g x_5p + in x_0 + (\ x_5z -> equalsInteger_1 (x_1i (unMapData# (headList! (tailList! (x_d x_5z)))) x_5y)) + x_5r + (\ x_60 -> + let* unConstrData_headList!_x_x = unConstrData# (headList! (x_d (headList! (x_d x_60)))) + x_unConstrData_headList!_x_x = sndPair!! unConstrData_headList!_x_x + in ifThenElse! + (ifThenElse! + (equalsInteger_0 (fstPair!! unConstrData_headList!_x_x)) + (\ ~ -> False#) + (\ ~ -> equalsByteString# #e2f9d92651c75a28717bf5622e6164e25133d856e9c02ea21a234dfc#b (unBData# (headList! x_unConstrData_headList!_x_x))) + !) + (\ ~ -> + let* unConstrData_x = unConstrData# (headList! (tailList! (tailList! (x_d x_60)))) + x_unConstrData_x = fstPair!! unConstrData_x + x_unConstrData_x_0 = sndPair!! unConstrData_x + x_x_x_0 = + tailList! + (tailList! + (x_d + (ifThenElse! + (equalsInteger_1 x_unConstrData_x) + (\ ~ -> + x_m + (\ x_61 -> let* x_62 = sndPair!! x_61 in \ x_63 x_64 -> x_63 x_62) + (bData# (unBData# (headList! x_unConstrData_x_0))) + x_5s + (\ x_65 -> + let* x_66 = unConstrData# x_65 + x_x_4 = sndPair!! x_66 + x_67 = + ifThenElse! + (equalsInteger_0 (fstPair!! x_66)) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_x_4)))) + (\ ~ -> + let* tailList!_x_x_0 = tailList! x_x_4 + x_68 = unConstrData# (headList! tailList!_x_x_0) + x_69 = sndPair!! x_68 + x_6a = + ifThenElse! + (equalsInteger_0 (fstPair!! x_68)) + (\ ~ -> + let* x_6b = unConstrData# (headList! x_69) + x_6c = fstPair!! x_6b + x_6d = sndPair!! x_6b + x_6e = + ifThenElse! + (equalsInteger_0 x_6c) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_6d)))) + (\ ~ -> let* x_6f = chooseList!! (tailList! x_6d) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_6c) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_6d)))) + (\ ~ -> let* x_6g = chooseList!! (tailList! x_6d) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_6h = tailList! x_69 + x_6i = unConstrData# (headList! x_6h) + x_6j = fstPair!! x_6i + x_6k = sndPair!! x_6i + x_6m = + ifThenElse! + (equalsInteger_0 x_6j) + (\ ~ -> + let* x_6n = unConstrData# (headList! x_6k) + x_6p = fstPair!! x_6n + x_6r = sndPair!! x_6n + x_6s = + ifThenElse! + (equalsInteger_0 x_6p) + (\ ~ -> + let* x_6t = unConstrData# (headList! x_6r) + x_6u = fstPair!! x_6t + x_6v = sndPair!! x_6t + x_6w = + ifThenElse! + (equalsInteger_0 x_6u) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_6v)))) + (\ ~ -> let* x_6x = chooseList!! (tailList! x_6v) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_6u) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_6v)))) + (\ ~ -> let* x_6y = chooseList!! (tailList! x_6v) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_6z = chooseList!! (tailList! x_6r) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_6p) + (\ ~ -> + let* x_70 = unIData# (headList! x_6r) + x_71 = tailList! x_6r + x_72 = unIData# (headList! x_71) + x_73 = tailList! x_71 + x_74 = unIData# (headList! x_73) + x_75 = chooseList!! (tailList! x_73) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + ! + x_76 = chooseList!! (tailList! x_6k) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ifThenElse! (equalsInteger_1 x_6j) (\ ~ -> let* x_77 = chooseList!! x_6k (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_78 = chooseList!! (tailList! x_6h) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + tailList!_tailList!_x_x_0 = tailList! tailList!_x_x_0 + x_79 = unConstrData# (headList! tailList!_tailList!_x_x_0) + x_7a = sndPair!! x_79 + x_7b = + ifThenElse! + (equalsInteger_0 (fstPair!! x_79)) + (\ ~ -> + let* x_7c = lengthOfByteString# (unBData# (headList! x_7a)) + in ifThenElse! + (x_f (equalsInteger_0 x_7c) (\ ~ -> equalsInteger_28 x_7c) !) + (\ ~ -> + let* x_7d = tailList! x_7a + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_7d))) 32#) + (\ ~ -> let* x_7e = chooseList!! (tailList! x_7d) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_7f = tailList! tailList!_tailList!_x_x_0 + x_7g = unIData# (headList! x_7f) + x_7h = tailList! x_7f + x_7i = unIData# (headList! x_7h) + x_7j = tailList! x_7h + x_7k = unConstrData# (headList! x_7j) + x_7m = sndPair!! x_7k + x_7n = + ifThenElse! + (equalsInteger_0 (fstPair!! x_7k)) + (\ ~ -> + let* x_7p = lengthOfByteString# (unBData# (headList! x_7m)) + in ifThenElse! + (x_f (equalsInteger_0 x_7p) (\ ~ -> equalsInteger_28 x_7p) !) + (\ ~ -> + let* x_7r = tailList! x_7m + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_7r))) 32#) + (\ ~ -> let* x_7s = chooseList!! (tailList! x_7r) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_7t = tailList! x_7j + x_7u = unConstrData# (headList! x_7t) + in ifThenElse! + (equalsInteger_0 (fstPair!! x_7u)) + (\ ~ -> + let* x_7v = sndPair!! x_7u + x_7w = unIData# (headList! x_7v) + x_7x = tailList! x_7v + x_7y = iData# (x_1t (unIData# (headList! x_7x))) + in ifThenElse! + (equalsData# (listData# (tailList! x_7x)) (listData___ !)) + (\ ~ -> + let* x_7z = tailList! x_7t + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_7z))) 32#) + (\ ~ -> + let* x_80 = tailList! x_7z + x_81 = unConstrData# (headList! x_80) + x_82 = fstPair!! x_81 + x_83 = sndPair!! x_81 + x_84 = + ifThenElse! + (equalsInteger_0 x_82) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger_0 (unIData# (headList! x_83))) + (\ ~ -> let* x_85 = chooseList!! (tailList! x_83) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! (equalsInteger_1 x_82) (\ ~ -> let* x_86 = chooseList!! x_83 (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_87 = tailList! x_80 + x_88 = unConstrData# (headList! x_87) + x_89 = fstPair!! x_88 + x_8a = sndPair!! x_88 + x_8b = + ifThenElse! + (equalsInteger_0 x_89) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger_0 (unIData# (headList! x_8a))) + (\ ~ -> let* x_8c = chooseList!! (tailList! x_8a) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! (equalsInteger_1 x_89) (\ ~ -> let* x_8d = chooseList!! x_8a (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_8e = tailList! x_87 + x_8f = unIData# (headList! x_8e) + x_8g = tailList! x_8e + x_8h = unIData# (headList! x_8g) + x_8i = tailList! x_8g + x_8j = unIData# (headList! x_8i) + x_8k = tailList! x_8i + x_8m = unConstrData# (headList! x_8k) + x_8n = sndPair!! x_8m + x_8p = + ifThenElse! + (equalsInteger_0 (fstPair!! x_8m)) + (\ ~ -> + let* x_8r = unIData# (headList! x_8n) + x_8s = tailList! x_8n + x_8t = unIData# (headList! x_8s) + x_8u = tailList! x_8s + x_8v = unIData# (headList! x_8u) + x_8w = chooseList!! (tailList! x_8u) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + x_8x = tailList! x_8k + x_8y = unIData# (headList! x_8x) + x_8z = chooseList!! (tailList! x_8x) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + in x_65) + (\ ~ -> ERROR)) + (\ ~ -> + ifThenElse! + (equalsInteger_2 x_unConstrData_x) + (\ ~ -> + let* headList!_x_unConstrData_x = headList! x_unConstrData_x_0 + x_90 = unConstrData# headList!_x_unConstrData_x + x_91 = sndPair!! x_90 + x_92 = + ifThenElse! + (equalsInteger_0 (fstPair!! x_90)) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_91)))) + (\ ~ -> + let* x_93 = tailList! x_91 + x_94 = unConstrData# (headList! x_93) + x_95 = sndPair!! x_94 + x_96 = + ifThenElse! + (equalsInteger_0 (fstPair!! x_94)) + (\ ~ -> + let* x_97 = unConstrData# (headList! x_95) + x_98 = fstPair!! x_97 + x_99 = sndPair!! x_97 + x_9a = + ifThenElse! + (equalsInteger_0 x_98) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_99)))) + (\ ~ -> let* x_9b = chooseList!! (tailList! x_99) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_98) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_99)))) + (\ ~ -> let* x_9c = chooseList!! (tailList! x_99) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_9d = tailList! x_95 + x_9e = unConstrData# (headList! x_9d) + x_9f = fstPair!! x_9e + x_9g = sndPair!! x_9e + x_9h = + ifThenElse! + (equalsInteger_0 x_9f) + (\ ~ -> + let* x_9i = unConstrData# (headList! x_9g) + x_9j = fstPair!! x_9i + x_9k = sndPair!! x_9i + x_9m = + ifThenElse! + (equalsInteger_0 x_9j) + (\ ~ -> + let* x_9n = unConstrData# (headList! x_9k) + x_9p = fstPair!! x_9n + x_9r = sndPair!! x_9n + x_9s = + ifThenElse! + (equalsInteger_0 x_9p) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_9r)))) + (\ ~ -> let* x_9t = chooseList!! (tailList! x_9r) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_9p) + (\ ~ -> + ifThenElse! + (equalsInteger_28 (lengthOfByteString# (unBData# (headList! x_9r)))) + (\ ~ -> let* x_9u = chooseList!! (tailList! x_9r) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_9v = chooseList!! (tailList! x_9k) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> + ifThenElse! + (equalsInteger_1 x_9j) + (\ ~ -> + let* x_9w = unIData# (headList! x_9k) + x_9x = tailList! x_9k + x_9y = unIData# (headList! x_9x) + x_9z = tailList! x_9x + x_a0 = unIData# (headList! x_9z) + x_a1 = chooseList!! (tailList! x_9z) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + ! + x_a2 = chooseList!! (tailList! x_9g) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ifThenElse! (equalsInteger_1 x_9f) (\ ~ -> let* x_a3 = chooseList!! x_9g (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_a4 = chooseList!! (tailList! x_9d) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + x_a5 = tailList! x_93 + x_a6 = unConstrData# (headList! x_a5) + x_a7 = sndPair!! x_a6 + x_a8 = + ifThenElse! + (equalsInteger_0 (fstPair!! x_a6)) + (\ ~ -> + let* x_a9 = lengthOfByteString# (unBData# (headList! x_a7)) + in ifThenElse! + (x_f (equalsInteger_0 x_a9) (\ ~ -> equalsInteger_28 x_a9) !) + (\ ~ -> + let* x_aa = tailList! x_a7 + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_aa))) 32#) + (\ ~ -> let* x_ab = chooseList!! (tailList! x_aa) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_ac = tailList! x_a5 + x_ad = unIData# (headList! x_ac) + x_ae = tailList! x_ac + x_af = unIData# (headList! x_ae) + x_ag = tailList! x_ae + x_ah = unConstrData# (headList! x_ag) + x_ai = sndPair!! x_ah + x_aj = + ifThenElse! + (equalsInteger_0 (fstPair!! x_ah)) + (\ ~ -> + let* x_ak = lengthOfByteString# (unBData# (headList! x_ai)) + in ifThenElse! + (x_f (equalsInteger_0 x_ak) (\ ~ -> equalsInteger_28 x_ak) !) + (\ ~ -> + let* x_am = tailList! x_ai + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_am))) 32#) + (\ ~ -> let* x_an = chooseList!! (tailList! x_am) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_ap = tailList! x_ag + x_ar = unConstrData# (headList! x_ap) + in ifThenElse! + (equalsInteger_0 (fstPair!! x_ar)) + (\ ~ -> + let* x_as = sndPair!! x_ar + x_at = unIData# (headList! x_as) + x_au = tailList! x_as + x_av = iData# (x_1t (unIData# (headList! x_au))) + in ifThenElse! + (equalsData# (listData# (tailList! x_au)) (listData___ !)) + (\ ~ -> + let* x_aw = tailList! x_ap + in ifThenElse! + (lessThanEqualsInteger# (lengthOfByteString# (unBData# (headList! x_aw))) 32#) + (\ ~ -> + let* x_ax = tailList! x_aw + x_ay = unConstrData# (headList! x_ax) + x_az = fstPair!! x_ay + x_b0 = sndPair!! x_ay + x_b1 = + ifThenElse! + (equalsInteger_0 x_az) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger_0 (unIData# (headList! x_b0))) + (\ ~ -> let* x_b2 = chooseList!! (tailList! x_b0) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! (equalsInteger_1 x_az) (\ ~ -> let* x_b3 = chooseList!! x_b0 (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_b4 = tailList! x_ax + x_b5 = unConstrData# (headList! x_b4) + x_b6 = fstPair!! x_b5 + x_b7 = sndPair!! x_b5 + x_b8 = + ifThenElse! + (equalsInteger_0 x_b6) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger_0 (unIData# (headList! x_b7))) + (\ ~ -> let* x_b9 = chooseList!! (tailList! x_b7) (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! (equalsInteger_1 x_b6) (\ ~ -> let* x_ba = chooseList!! x_b7 (\ ~ -> tt) (\ ~ -> ERROR) ! in tt) (\ ~ -> ERROR) !) + ! + x_bb = tailList! x_b4 + x_bc = unIData# (headList! x_bb) + x_bd = tailList! x_bb + x_be = unIData# (headList! x_bd) + x_bf = tailList! x_bd + x_bg = unIData# (headList! x_bf) + x_bh = tailList! x_bf + x_bi = unConstrData# (headList! x_bh) + x_bj = sndPair!! x_bi + x_bk = + ifThenElse! + (equalsInteger_0 (fstPair!! x_bi)) + (\ ~ -> + let* x_bm = unIData# (headList! x_bj) + x_bn = tailList! x_bj + x_bp = unIData# (headList! x_bn) + x_br = tailList! x_bn + x_bs = unIData# (headList! x_br) + x_bt = chooseList!! (tailList! x_br) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + ! + x_bu = tailList! x_bh + x_bv = unIData# (headList! x_bu) + x_bw = chooseList!! (tailList! x_bu) (\ ~ -> tt) (\ ~ -> ERROR) ! + in tt) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + in headList!_x_unConstrData_x) + (\ ~ -> ERROR) + !) + !))) + tailList!_x_x_x_0 = tailList! x_x_x_0 + tailList!_tailList!_x_x_x_0 = tailList! tailList!_x_x_x_0 + x_bx = tailList! tailList!_tailList!_x_x_x_0 + x_by = tailList! x_bx + x_bz = tailList! x_by + x_c0 = tailList! x_bz + x_c1 = tailList! x_c0 + x_c2 = tailList! x_c1 + x_c3 = tailList! x_c2 + x_c4 = tailList! x_c3 + x_c5 = tailList! x_c4 + x_c6 = unIData# (headList! tailList!_tailList!_x_x_x_0) + x_c7 = unIData# (headList! tailList!_x_x_x_0) + x_c8 = unIData# (headList! x_c2) + x_c9 = unIData# (headList! (tailList! x_c5)) + x_ca = unIData# (headList! (x_d (headList! x_by))) + x_cb = headList! x_c3 + x_cc = unIData# (headList! x_c4) + x_cd = x_d (headList! x_c5) + x_ce = tailList! x_cd + x_cf = headList! x_cd + x_cg = headList! x_ce + x_ch = headList! (tailList! x_ce) + headList!_x_x_x = headList! x_x_x_0 + x_ci = headList! x_bx + x_cj = unConstrData# (headList! x_c0) + x_ck = sndPair!! x_cj + in ifThenElse! + (equalsInteger_1 (fstPair!! x_cj)) + (\ ~ -> + let* x_cm = unConstrData# (headList! x_c1) + x_cn = fstPair!! x_cm + x_cp = sndPair!! x_cm + in ifThenElse! + (lessThanInteger_0 x_c6) + (\ ~ -> + ifThenElse! + (equalsInteger# x_c7 x_c6) + (\ ~ -> + ifThenElse! + (equalsByteString# (unBData# (headList! x_bz)) x_5p) + (\ ~ -> + ifThenElse! + (equalsInteger_0 x_c8) + (\ ~ -> + ifThenElse! + (lessThanInteger_0 x_ca) + (\ ~ -> + ifThenElse! + (x_1v (x_17 headList!_x_x_x x_ci)) + (\ ~ -> + ifThenElse! + True# + (\ ~ -> + ifThenElse! + (equalsData# x_cb x_cf) + (\ ~ -> + ifThenElse! + (equalsInteger# x_cc x_5t) + (\ ~ -> + ifThenElse! + (x_2v + (unMapData# (headList! (tailList! (x_d x_60)))) + (x_48 + (x_2b + addInteger# + (x_58 headList!_x_x_x (iData# x_c6)) + (x_48 + (x_2b + addInteger# + (x_58 x_5y _01) + (x_48 (x_2b addInteger# (x_58 (x_1p ""#b ""#b) (iData# x_5u)) (x_52 headList!_x_x_x x_ci x_cf x_cg x_ch)))))))) + (\ ~ -> + ifThenElse! + (equalsInteger_0 (unIData# x_ch)) + (\ ~ -> + ifThenElse! + (x_14 + (lessThanEqualsInteger# unIData_headList!_x_x_x (unIData# x_cf)) + (\ ~ -> lessThanEqualsInteger# (x_32 (x_3b (x_3u headList!_tailList!_x_x_x) (x_3y x_c6))) (unIData# x_cg)) + !) + (\ ~ -> ifThenElse! (equalsInteger_0 x_c9) (\ ~ -> tt) (\ ~ -> ERROR) !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> + let* x_cr = unConstrData# (headList! x_c1) + x_cs = sndPair!! x_cr + in ifThenElse! + (equalsInteger_1 (fstPair!! x_cr)) + (\ ~ -> + ifThenElse! + (lessThanInteger_0 x_c6) + (\ ~ -> + ifThenElse! + (equalsInteger# x_c7 x_c6) + (\ ~ -> + ifThenElse! + (equalsByteString# (unBData# (headList! x_bz)) x_5p) + (\ ~ -> + ifThenElse! + (equalsInteger_0 x_c8) + (\ ~ -> + ifThenElse! + (lessThanInteger_0 x_ca) + (\ ~ -> + ifThenElse! + (x_1v (x_17 headList!_x_x_x x_ci)) + (\ ~ -> + ifThenElse! + True# + (\ ~ -> + ifThenElse! + (equalsData# x_cb x_cf) + (\ ~ -> + ifThenElse! + (equalsInteger# x_cc x_5t) + (\ ~ -> + ifThenElse! + (x_2v + (unMapData# (headList! (tailList! (x_d x_60)))) + (x_48 + (x_2b + addInteger# + (x_58 headList!_x_x_x (iData# x_c6)) + (x_48 + (x_2b + addInteger# + (x_58 x_5y _01) + (x_48 (x_2b addInteger# (x_58 (x_1p ""#b ""#b) (iData# x_5u)) (x_52 headList!_x_x_x x_ci x_cf x_cg x_ch)))))))) + (\ ~ -> + ifThenElse! + (equalsInteger_0 (unIData# x_ch)) + (\ ~ -> + ifThenElse! + (x_14 + (lessThanEqualsInteger# unIData_headList!_x_x_x (unIData# x_cf)) + (\ ~ -> lessThanEqualsInteger# (x_32 (x_3b (x_3u headList!_tailList!_x_x_x) (x_3y x_c6))) (unIData# x_cg)) + !) + (\ ~ -> ifThenElse! (equalsInteger_0 x_c9) (\ ~ -> tt) (\ ~ -> ERROR) !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> + ifThenElse! + (lessThanInteger_0 x_c6) + (\ ~ -> + ifThenElse! + (equalsInteger# x_c7 x_c6) + (\ ~ -> + ifThenElse! + (equalsByteString# (unBData# (headList! x_bz)) x_5p) + (\ ~ -> + ifThenElse! + (equalsInteger_0 x_c8) + (\ ~ -> + ifThenElse! + (lessThanInteger_0 x_ca) + (\ ~ -> + ifThenElse! + (x_1v (x_17 headList!_x_x_x x_ci)) + (\ ~ -> + ifThenElse! + (lessThanEqualsInteger# (unIData# (headList! x_ck)) (unIData# (headList! x_cs))) + (\ ~ -> + ifThenElse! + (equalsData# x_cb x_cf) + (\ ~ -> + ifThenElse! + (equalsInteger# x_cc x_5t) + (\ ~ -> + ifThenElse! + (x_2v + (unMapData# (headList! (tailList! (x_d x_60)))) + (x_48 + (x_2b + addInteger# + (x_58 headList!_x_x_x (iData# x_c6)) + (x_48 + (x_2b + addInteger# + (x_58 x_5y _01) + (x_48 (x_2b addInteger# (x_58 (x_1p ""#b ""#b) (iData# x_5u)) (x_52 headList!_x_x_x x_ci x_cf x_cg x_ch)))))))) + (\ ~ -> + ifThenElse! + (equalsInteger_0 (unIData# x_ch)) + (\ ~ -> + ifThenElse! + (x_14 + (lessThanEqualsInteger# unIData_headList!_x_x_x (unIData# x_cf)) + (\ ~ -> lessThanEqualsInteger# (x_32 (x_3b (x_3u headList!_tailList!_x_x_x) (x_3y x_c6))) (unIData# x_cg)) + !) + (\ ~ -> ifThenElse! (equalsInteger_0 x_c9) (\ ~ -> tt) (\ ~ -> ERROR) !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + !) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR)) + (\ ~ -> ERROR) + !) + !) + (\ ~ -> ifThenElse! (x_h (\ x_ct -> lessThanEqualsInteger_0 (unIData# (sndPair!! x_ct))) (x_w x_5g x_5i (\ x_cu -> x_cu) (\ ~ -> ERROR))) (\ ~ -> ERROR) (\ ~ -> tt) !) + ! diff --git a/geniusyield-onchain/fixtures/partialordernftpolicyV1_1-original.txt b/geniusyield-onchain/fixtures/partialordernftpolicyV1_1-original.txt new file mode 100644 index 00000000..8a781b19 --- /dev/null +++ b/geniusyield-onchain/fixtures/partialordernftpolicyV1_1-original.txt @@ -0,0 +1,1024 @@ +let* x = sndPair# ! ! + x_0 = \ x_1 -> x (unConstrData# x_1) + x_2 = tailList# ! + x_3 = headList# ! + x_4 = fstPair# ! ! + x_5 = ifThenElse# ! + x_6 = \ x_7 -> let* x_8 = unMapData# (x x_7) in \ x_9 x_a -> x_9 x_8 + x_b = chooseList# ! ! + x_c = \ x_d -> let* x_e = \ x_f -> x_d (\ x_g -> x_f x_f x_g) in x_d (\ x_h -> x_e x_e x_h) + x_i = \ x_j x_k x_m -> x_c (\ x_n x_p -> x_b x_p (\ ~ x_r x_s -> x_s !) (\ ~ -> x_5 (equalsData# (x_4 (x_3 x_p)) x_k) (\ ~ -> x_j (x_3 x_p)) (\ ~ -> x_n (x_2 x_p)) !) !) x_m + x_t = \ x_u -> x_i x_6 (bData# x_u) + x_v = \ ~ -> True# + x_w = \ x_x -> x_5 x_x x_v + x_y = \ x_z -> x_c (\ x_10 x_11 -> x_b x_11 (\ ~ -> False#) (\ ~ -> x_w (x_z (x_3 x_11)) (\ ~ -> x_10 (x_2 x_11)) !) !) + x_12 = \ x_13 -> x_2 (x_2 x_13) + x_14 = \ x_15 x_16 x_17 x_18 -> x_c (\ x_19 x_1a -> x_b x_1a (\ ~ -> x_16) (\ ~ -> x_5 (equalsData# (x_4 (x_3 x_1a)) x_15) (\ ~ -> x_17 (x (x_3 x_1a))) (\ ~ -> x_19 (x_2 x_1a)) !) !) x_18 + x_1b = \ x_1c -> x_14 (bData# x_1c) + x_1d = \ x_1e x_1f x_1g -> x_1b x_1f 0# (\ x_1h -> x_1b x_1g 0# unIData# (unMapData# x_1h)) x_1e + x_1i = \ x_1j x_1k -> let* x_1m = unBData# (x_3 (x_0 x_1k)); x_1n = unBData# (x_3 (x_2 (x_0 x_1k))) in x_1d x_1j x_1m x_1n + x_1p = \ x_1r x_1s -> equalsData# (listData# (x_0 x_1r)) (listData# (x_0 x_1s)) + x_1t = \ ~ -> False# + x_1u = \ x_1v x_1w -> x_5 x_1v x_1w x_1t + x_1x = x_c (\ x_1y x_1z x_20 -> x_b x_20 (\ ~ x_21 x_22 -> x_22 !) (\ ~ -> x_5 (x_1z (x_3 x_20)) (\ ~ -> let* x_23 = x_3 x_20 in \ x_24 x_25 -> x_24 x_23) (\ ~ -> x_1y x_1z (x_2 x_20)) !) !) + x_26 = \ x_27 -> x_2 (x_12 x_27) + x_28 = \ x_29 -> x_2 (x_26 x_29) + x_2a = []# + x_2b = mkCons# ! + x_2c = \ x_2d x_2e -> constrData# 0# (x_2b (bData# x_2d) (x_2b (bData# x_2e) x_2a)) + x_2f = \ x_2g -> x_5 (lessThanEqualsInteger# x_2g 0#) (\ ~ -> ERROR) (\ ~ -> x_2g) ! + x_2h = []# + x_2i = \ x_2j x_2k -> x_2b (mkPairData# x_2j x_2k) x_2h + x_2m = \ x_2n x_2p x_2r -> x_5 (equalsData# x_2r (iData# 0#)) (\ ~ -> x_2h) (\ ~ -> x_2i x_2n (mapData# (x_2i x_2p x_2r))) ! + x_2s = \ x_2t x_2u -> let* x_2v = x_3 (x_0 x_2t); x_2w = x_3 (x_2 (x_0 x_2t)) in x_2m x_2v x_2w x_2u + x_2x = ""#b + x_2y = \ x_2z x_30 x_31 -> x_5 (lessThanEqualsInteger# (unIData# x_31) 0#) (\ ~ -> x_2h) (\ ~ -> x_2i x_2z (mapData# (x_2i x_30 x_31))) ! + x_32 = \ x_33 x_34 -> let* x_35 = x_3 (x_0 x_33); x_36 = x_3 (x_2 (x_0 x_33)) in x_2y x_35 x_36 x_34 + x_37 = + \ x_38 x_39 -> + let* x_3a = \ x_3b x_3c -> x_b x_3b (\ ~ -> x_3c) (\ ~ -> x_39 (\ x_3d x_3e -> x_3e) (x_3 x_3b) (x_2 x_3b) x_3c) ! + x_3f = + \ x_3g x_3h x_3i -> + x_b + x_3i + (\ ~ -> x_2b x_3g x_3h) + (\ ~ -> + let* x_3j = x_3 x_3i + x_3k = x_4 x_3g + x_3m = x_4 x_3j + in x_5 + (equalsData# x_3k x_3m) + (\ ~ -> x_2b (mkPairData# x_3k (x_38 (x x_3g) (x x_3j))) (x_39 (\ x_3n x_3p -> x_3n) x_3h (x_2 x_3i))) + (\ ~ -> x_5 (lessThanByteString# (unBData# x_3k) (unBData# x_3m)) (\ ~ -> x_2b x_3g (x_39 (\ x_3r x_3s -> x_3s) x_3j (x_2 x_3i) x_3h)) (\ ~ -> x_2b x_3j (x_39 (\ x_3t x_3u -> x_3u) x_3g x_3h (x_2 x_3i))) !) + !) + ! + in \ x_3v -> x_3v x_3a x_3f + x_3w = \ x_3x -> x_c (x_37 x_3x) + x_3y = \ x_3z x_40 x_41 -> x_3w x_3z (\ x_42 x_43 -> x_42) x_40 x_41 + x_44 = \ x_45 -> x_3y (\ x_46 x_47 -> iData# (x_45 (unIData# x_46) (unIData# x_47))) + x_48 = \ x_49 -> x_3y (\ x_4a x_4b -> mapData# (x_49 (unMapData# x_4a) (unMapData# x_4b))) + x_4c = \ x_4d x_4e x_4f -> x_48 (\ x_4g x_4h -> x_44 x_4d x_4g x_4h) x_4e x_4f + x_4i = \ x_4j x_4k x_4m x_4n x_4p -> x_4c addInteger# (x_32 (x_2c x_2x x_2x) x_4m) (x_4c addInteger# (x_32 x_4j x_4n) (x_32 x_4k x_4p)) + x_4r = \ x_4s x_4t -> x_c (\ x_4u x_4v -> x_b x_4v (\ ~ -> x_2h) (\ ~ -> let* x_4w = x_4u (x_2 x_4v) in x_4s (x (x_3 x_4v)) (\ x_4x -> x_2b (mkPairData# (x_4 (x_3 x_4v)) x_4x) x_4w) (\ ~ -> x_4w)) !) x_4t + x_4y = nullList# ! + x_4z = \ x_50 -> x_4r (\ x_51 -> x_50 (unMapData# x_51) (\ x_52 -> let* x_53 = mapData# x_52 in \ x_54 x_55 -> x_54 x_53) (\ ~ x_56 x_57 -> x_57 !)) + x_58 = \ x_59 -> x_4z (\ x_5a -> let* x_5b = x_4r (\ x_5c -> x_5 (equalsData# x_5c (iData# 0#)) (\ ~ x_5d x_5e -> x_5e !) (\ ~ x_5f x_5g -> x_5f x_5c) !) x_5a in x_5 (x_4y x_5b) (\ ~ x_5h x_5i -> x_5i !) (\ ~ x_5j x_5k -> x_5j x_5b) !) x_59 + x_5m = \ x_5n -> let* x_5p = 1# in \ x_5r -> x_5r x_5n x_5p + x_5s = \ x_5t -> let* x_5u = x_0 x_5t; x_5v = unIData# (x_3 x_5u); x_5w = unIData# (x_3 (x_2 x_5u)) in \ x_5x -> x_5x x_5v x_5w + x_5y = \ x_5z -> subtractInteger# 0# x_5z + x_60 = \ x_61 -> x_5 (lessThanEqualsInteger# x_61 -1#) (\ ~ -> x_5y x_61) (\ ~ -> x_61) ! + x_62 = \ x_63 x_64 -> x_5 (lessThanEqualsInteger# x_63 x_64) (\ ~ -> x_63) (\ ~ -> x_64) ! + x_65 = \ x_66 x_67 -> x_5 (lessThanEqualsInteger# x_66 x_67) (\ ~ -> x_67) (\ ~ -> x_66) ! + x_68 = x_c (\ x_69 x_6a x_6b -> x_5 (equalsInteger# x_6b 0#) (\ ~ -> x_6a) (\ ~ -> x_69 x_6b (modInteger# x_6a x_6b)) !) + x_6c = \ x_6d x_6e -> let* x_6f = x_60 x_6d; x_6g = x_60 x_6e in x_68 (x_65 x_6f x_6g) (x_62 x_6f x_6g) + x_6h = + \ x_6i -> + x_6i + (\ x_6j x_6k -> + let* x_6m = x_6c x_6j x_6k + x_6n = x_5 (equalsInteger# x_6k 0#) (\ ~ -> 0#) (\ ~ -> x_5 (lessThanEqualsInteger# x_6k 0#) (\ ~ -> -1#) (\ ~ -> 1#) !) ! + x_6p = multiplyInteger# x_6n (divideInteger# x_6j x_6m) + x_6r = multiplyInteger# x_6n (divideInteger# x_6k x_6m) + in \ x_6s -> x_6s x_6p x_6r) + x_6t = \ x_6u x_6v -> x_6u (\ x_6w x_6x -> x_6v (\ x_6y x_6z -> x_6h (let* x_70 = multiplyInteger# x_6w x_6y; x_71 = multiplyInteger# x_6x x_6z in \ x_72 -> x_72 x_70 x_71))) + x_73 = \ x_74 -> x_74 quotientInteger# + x_75 = \ x_76 x_77 -> x_76 (\ x_78 x_79 -> x_77 (\ x_7a x_7b -> equalsInteger# (multiplyInteger# x_7b x_78) (multiplyInteger# x_7a x_79))) + x_7c = \ x_7d x_7e -> x_7d (\ x_7f x_7g -> x_7e (\ x_7h x_7i -> lessThanInteger# (multiplyInteger# x_7i x_7f) (multiplyInteger# x_7h x_7g))) + x_7j = \ x_7k -> let* x_7m = x_5m (x_73 x_7k); x_7n = x_73 x_7k in x_5 (x_7c x_7k (let* x_7p = 0#; x_7r = 1# in \ x_7s -> x_7s x_7p x_7r)) (\ ~ -> x_5 (x_75 x_7k x_7m) (\ ~ -> x_7n) (\ ~ -> subtractInteger# x_7n 1#) !) (\ ~ -> x_7n) ! + x_7t = \ x_7u x_7v -> x_c (\ x_7w x_7x -> x_b x_7x (\ ~ -> x_2h) (\ ~ -> x_2b (mkPairData# (x_4 (x_3 x_7x)) (x_7u (x (x_3 x_7x)))) (x_7w (x_2 x_7x))) !) x_7v + x_7y = \ x_7z -> x_7t (\ x_80 -> iData# (x_7z (unIData# x_80))) + x_81 = \ x_82 -> x_7t (\ x_83 -> mapData# (x_82 (unMapData# x_83))) + x_84 = \ x_85 x_86 -> x_81 (\ x_87 -> x_7y x_85 x_87) x_86 + x_88 = \ x_89 x_8a -> x_4c addInteger# x_89 (x_84 x_5y x_8a) + x_8b = \ x_8c -> x_c (\ x_8d x_8e -> x_b x_8e (\ ~ -> True#) (\ ~ -> x_1u (x_8c (x_3 x_8e)) (\ ~ -> x_8d (x_2 x_8e)) !) !) + x_8f = \ x_8g x_8h -> x_8b (\ x_8i -> x_8g (unIData# (x x_8i))) x_8h + x_8j = \ x_8k x_8m -> x_8b (\ x_8n -> x_8k (unMapData# (x x_8n))) x_8m + x_8p = \ x_8r -> x_8j (\ x_8s -> x_8f (\ x_8t -> lessThanEqualsInteger# 0# x_8t) x_8s) x_8r + x_8u = \ x_8v x_8w -> x_8p (x_88 x_8v x_8w) + x_8x = \ x_8y -> x_5 x_8y False# True# + x_8z = #e2f9d92651c75a28717bf5622e6164e25133d856e9c02ea21a234dfc#b + x_90 = <0 <0 "\168\129\214\&6\159\167\&17}\130\216\ACK\216\222\178\ACKxx\DC2\154^-\249l%\229\160\142">, <1>>#d + x_91 = <0 "\190\CAN\194\156\DEL\SI\252\165\195\230\205V\249}\240\248*1\227\ETB\233\155\250\ETX\ESC;\SI\227", "47454e53">#d +in \ x_92 x_93 -> + let* x_94 = unConstrData# (x_3 (x_2 (x_0 x_93))) + x_95 = x_4 x_94 + x_96 = x x_94 + x_97 = x_5 (equalsInteger# 0# x_95) (\ ~ -> unBData# (x_3 x_96)) (\ ~ -> ERROR) ! + x_98 = x_3 (x_0 x_93) + x_99 = x_0 x_98 + x_9a = x_2 x_99 + x_9b = x_2 x_9a + x_9c = x_2 (x_2 x_9b) + x_9d = unMapData# (x_3 x_9c) + x_9e = unConstrData# x_92 + x_9f = x_4 x_9e + x_9g = x x_9e + in x_5 + (equalsInteger# 0# x_9f) + (\ ~ -> + let* x_9h = x_3 x_9g + x_9i = unListData# (x_3 x_9a) + x_9j = + x_1x + (\ x_9k -> let* x_9m = x_3 (x_2 (x_0 x_9k)); x_9n = x_0 x_9m in x_1u (x_1p (x_3 x_9n) x_90) (\ ~ -> equalsInteger# (x_1i (unMapData# (x_3 (x_2 x_9n))) x_91) 1#) !) + x_9i + (\ x_9p -> let* x_9r = x_3 (x_2 (x_0 x_9p)); x_9s = x_3 (x_12 (x_0 x_9r)); x_9t = unConstrData# x_9s; x_9u = x_4 x_9t; x_9v = x x_9t in x_5 (equalsInteger# 2# x_9u) (\ ~ -> x_3 x_9v) (\ ~ -> ERROR) !) + (\ ~ -> ERROR) + x_9w = x_28 (x_0 x_9j) + x_9x = x_2 x_9w + x_9y = x_2 x_9x + x_9z = x_0 x_9h + x_a0 = sha2_256# (consByteString# (unIData# (x_3 (x_2 x_9z))) (let* x_a1 = x_3 x_9z in unBData# (x_3 (x_0 x_a1)))) + x_a2 = unListData# (x_3 x_99) + x_a3 = unListData# (x_3 x_9b) + x_a4 = unMapData# (x_3 (let* x_a5 = x_2 x_9c in x_2 (x_28 x_a5))) + x_a6 = unIData# (x_3 x_9w) + x_a7 = x_3 x_9x + x_a8 = unIData# (x_3 x_9y) + x_a9 = unIData# (x_3 (x_2 x_9y)) + x_aa = x_t x_97 x_9d (\ x_ab -> x_ab) (\ ~ -> ERROR) + in x_b + x_aa + (\ ~ -> ERROR) + (\ ~ -> + x_5 + (x_1u (x_y (\ x_ac -> x_1p x_9h (x_3 (x_0 x_ac))) x_a2) (\ ~ -> x_1u (x_4y (x_2 x_aa)) (\ ~ -> x_1u (equalsInteger# (unIData# (x (x_3 x_aa))) 1#) (\ ~ -> equalsByteString# (unBData# (x_4 (x_3 x_aa))) x_a0) !) !) !) + (\ ~ -> + let* x_ad = x_2c x_97 x_a0 + in x_1x + (\ x_ae -> equalsInteger# (x_1i (unMapData# (x_3 (x_2 (x_0 x_ae)))) x_ad) 1#) + x_a3 + (\ x_af -> + x_5 + (let* x_ag = x_3 (x_0 x_af) + x_ah = unConstrData# (x_3 (x_0 x_ag)) + x_ai = x_4 x_ah + x_aj = x x_ah + in x_5 (equalsInteger# 0# x_ai) (\ ~ -> False#) (\ ~ -> equalsByteString# x_8z (unBData# (x_3 x_aj))) !) + (\ ~ -> + let* x_ak = x_3 (x_12 (x_0 x_af)) + x_am = unConstrData# x_ak + x_an = x_4 x_am + x_ap = x x_am + x_ar = + x_5 + (equalsInteger# 1# x_an) + (\ ~ -> + let* x_as = unBData# (x_3 x_ap) + in x_i + (\ x_at -> let* x_au = x x_at in \ x_av x_aw -> x_av x_au) + (bData# x_as) + x_a4 + (\ x_ax -> + let* x_ay = unConstrData# x_ax + x_az = x_4 x_ay + x_b0 = x x_ay + x_b1 = + x_5 + (equalsInteger# 0# x_az) + (\ ~ -> + let* x_b2 = x_3 x_b0 + x_b3 = unBData# x_b2 + in x_5 + (equalsInteger# (lengthOfByteString# x_b3) 28#) + (\ ~ -> + let* x_b4 = x_2 x_b0 + x_b5 = x_3 x_b4 + x_b6 = unConstrData# x_b5 + x_b7 = x_4 x_b6 + x_b8 = x x_b6 + x_b9 = + x_5 + (equalsInteger# 0# x_b7) + (\ ~ -> + let* x_ba = x_3 x_b8 + x_bb = unConstrData# x_ba + x_bc = x_4 x_bb + x_bd = x x_bb + x_be = + x_5 + (equalsInteger# 0# x_bc) + (\ ~ -> + let* x_bf = x_3 x_bd + x_bg = unBData# x_bf + in x_5 + (equalsInteger# (lengthOfByteString# x_bg) 28#) + (\ ~ -> let* x_bh = x_2 x_bd; x_bi = x_b x_bh (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> + x_5 + (equalsInteger# 1# x_bc) + (\ ~ -> + let* x_bj = x_3 x_bd + x_bk = unBData# x_bj + in x_5 + (equalsInteger# (lengthOfByteString# x_bk) 28#) + (\ ~ -> let* x_bm = x_2 x_bd; x_bn = x_b x_bm (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_bp = x_2 x_b8 + x_br = x_3 x_bp + x_bs = unConstrData# x_br + x_bt = x_4 x_bs + x_bu = x x_bs + x_bv = + x_5 + (equalsInteger# 0# x_bt) + (\ ~ -> + let* x_bw = x_3 x_bu + x_bx = unConstrData# x_bw + x_by = x_4 x_bx + x_bz = x x_bx + x_c0 = + x_5 + (equalsInteger# 0# x_by) + (\ ~ -> + let* x_c1 = x_3 x_bz + x_c2 = unConstrData# x_c1 + x_c3 = x_4 x_c2 + x_c4 = x x_c2 + x_c5 = + x_5 + (equalsInteger# 0# x_c3) + (\ ~ -> + let* x_c6 = x_3 x_c4 + x_c7 = unBData# x_c6 + in x_5 + (equalsInteger# (lengthOfByteString# x_c7) 28#) + (\ ~ -> let* x_c8 = x_2 x_c4; x_c9 = x_b x_c8 (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> + x_5 + (equalsInteger# 1# x_c3) + (\ ~ -> + let* x_ca = x_3 x_c4 + x_cb = unBData# x_ca + in x_5 + (equalsInteger# (lengthOfByteString# x_cb) 28#) + (\ ~ -> let* x_cc = x_2 x_c4; x_cd = x_b x_cc (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_ce = x_2 x_bz + x_cf = x_b x_ce (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> + x_5 + (equalsInteger# 1# x_by) + (\ ~ -> + let* x_cg = x_3 x_bz + x_ch = unIData# x_cg + x_ci = x_2 x_bz + x_cj = x_3 x_ci + x_ck = unIData# x_cj + x_cm = x_2 x_ci + x_cn = x_3 x_cm + x_cp = unIData# x_cn + x_cr = x_2 x_cm + x_cs = x_b x_cr (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + !) + ! + x_ct = x_2 x_bu + x_cu = x_b x_ct (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> x_5 (equalsInteger# 1# x_bt) (\ ~ -> let* x_cv = x_b x_bu (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) (\ ~ -> ERROR) !) + ! + x_cw = x_2 x_bp + x_cx = x_b x_cw (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + ! + x_cy = x_2 x_b4 + x_cz = x_3 x_cy + x_d0 = unConstrData# x_cz + x_d1 = x_4 x_d0 + x_d2 = x x_d0 + x_d3 = + x_5 + (equalsInteger# 0# x_d1) + (\ ~ -> + let* x_d4 = x_3 x_d2 + x_d5 = unBData# x_d4 + x_d6 = lengthOfByteString# x_d5 + in x_5 + (x_w (equalsInteger# x_d6 0#) (\ ~ -> equalsInteger# x_d6 28#) !) + (\ ~ -> + let* x_d7 = x_2 x_d2 + x_d8 = x_3 x_d7 + x_d9 = unBData# x_d8 + in x_5 + (lessThanEqualsInteger# (lengthOfByteString# x_d9) 32#) + (\ ~ -> let* x_da = x_2 x_d7; x_db = x_b x_da (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_dc = x_2 x_cy + x_dd = x_3 x_dc + x_de = unIData# x_dd + x_df = x_2 x_dc + x_dg = x_3 x_df + x_dh = unIData# x_dg + x_di = x_2 x_df + x_dj = x_3 x_di + x_dk = unConstrData# x_dj + x_dm = x_4 x_dk + x_dn = x x_dk + x_dp = + x_5 + (equalsInteger# 0# x_dm) + (\ ~ -> + let* x_dr = x_3 x_dn + x_ds = unBData# x_dr + x_dt = lengthOfByteString# x_ds + in x_5 + (x_w (equalsInteger# x_dt 0#) (\ ~ -> equalsInteger# x_dt 28#) !) + (\ ~ -> + let* x_du = x_2 x_dn + x_dv = x_3 x_du + x_dw = unBData# x_dv + in x_5 + (lessThanEqualsInteger# (lengthOfByteString# x_dw) 32#) + (\ ~ -> let* x_dx = x_2 x_du; x_dy = x_b x_dx (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_dz = x_2 x_di + x_e0 = x_3 x_dz + x_e1 = unConstrData# x_e0 + in x_5 + (equalsInteger# (x_4 x_e1) 0#) + (\ ~ -> + let* x_e2 = x x_e1 + x_e3 = unIData# (x_3 x_e2) + x_e4 = x_2 x_e2 + x_e5 = unIData# (x_3 x_e4) + x_e6 = x_2f x_e5 + x_e7 = iData# x_e6 + in x_5 + (equalsData# (listData# (x_2 x_e4)) (listData# x_2a)) + (\ ~ -> + let* x_e8 = x_2 x_dz + x_e9 = x_3 x_e8 + x_ea = unBData# x_e9 + in x_5 + (lessThanEqualsInteger# (lengthOfByteString# x_ea) 32#) + (\ ~ -> + let* x_eb = x_2 x_e8 + x_ec = x_3 x_eb + x_ed = unConstrData# x_ec + x_ee = x_4 x_ed + x_ef = x x_ed + x_eg = + x_5 + (equalsInteger# 0# x_ee) + (\ ~ -> + let* x_eh = x_3 x_ef + x_ei = unIData# x_eh + in x_5 + (lessThanEqualsInteger# 0# x_ei) + (\ ~ -> let* x_ej = x_2 x_ef; x_ek = x_b x_ej (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> x_5 (equalsInteger# 1# x_ee) (\ ~ -> let* x_em = x_b x_ef (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) (\ ~ -> ERROR) !) + ! + x_en = x_2 x_eb + x_ep = x_3 x_en + x_er = unConstrData# x_ep + x_es = x_4 x_er + x_et = x x_er + x_eu = + x_5 + (equalsInteger# 0# x_es) + (\ ~ -> + let* x_ev = x_3 x_et + x_ew = unIData# x_ev + in x_5 + (lessThanEqualsInteger# 0# x_ew) + (\ ~ -> let* x_ex = x_2 x_et; x_ey = x_b x_ex (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> x_5 (equalsInteger# 1# x_es) (\ ~ -> let* x_ez = x_b x_et (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) (\ ~ -> ERROR) !) + ! + x_f0 = x_2 x_en + x_f1 = x_3 x_f0 + x_f2 = unIData# x_f1 + x_f3 = x_2 x_f0 + x_f4 = x_3 x_f3 + x_f5 = unIData# x_f4 + x_f6 = x_2 x_f3 + x_f7 = x_3 x_f6 + x_f8 = unIData# x_f7 + x_f9 = x_2 x_f6 + x_fa = x_3 x_f9 + x_fb = unConstrData# x_fa + x_fc = x_4 x_fb + x_fd = x x_fb + x_fe = + x_5 + (equalsInteger# 0# x_fc) + (\ ~ -> + let* x_ff = x_3 x_fd + x_fg = unIData# x_ff + x_fh = x_2 x_fd + x_fi = x_3 x_fh + x_fj = unIData# x_fi + x_fk = x_2 x_fh + x_fm = x_3 x_fk + x_fn = unIData# x_fm + x_fp = x_2 x_fk + x_fr = x_b x_fp (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + ! + x_fs = x_2 x_f9 + x_ft = x_3 x_fs + x_fu = unIData# x_ft + x_fv = x_2 x_fs + x_fw = x_b x_fv (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + in x_ax) + (\ ~ -> ERROR)) + (\ ~ -> + x_5 + (equalsInteger# 2# x_an) + (\ ~ -> + let* x_fx = x_3 x_ap + x_fy = unConstrData# x_fx + x_fz = x_4 x_fy + x_g0 = x x_fy + x_g1 = + x_5 + (equalsInteger# 0# x_fz) + (\ ~ -> + let* x_g2 = x_3 x_g0 + x_g3 = unBData# x_g2 + in x_5 + (equalsInteger# (lengthOfByteString# x_g3) 28#) + (\ ~ -> + let* x_g4 = x_2 x_g0 + x_g5 = x_3 x_g4 + x_g6 = unConstrData# x_g5 + x_g7 = x_4 x_g6 + x_g8 = x x_g6 + x_g9 = + x_5 + (equalsInteger# 0# x_g7) + (\ ~ -> + let* x_ga = x_3 x_g8 + x_gb = unConstrData# x_ga + x_gc = x_4 x_gb + x_gd = x x_gb + x_ge = + x_5 + (equalsInteger# 0# x_gc) + (\ ~ -> + let* x_gf = x_3 x_gd + x_gg = unBData# x_gf + in x_5 + (equalsInteger# (lengthOfByteString# x_gg) 28#) + (\ ~ -> let* x_gh = x_2 x_gd; x_gi = x_b x_gh (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> + x_5 + (equalsInteger# 1# x_gc) + (\ ~ -> + let* x_gj = x_3 x_gd + x_gk = unBData# x_gj + in x_5 + (equalsInteger# (lengthOfByteString# x_gk) 28#) + (\ ~ -> let* x_gm = x_2 x_gd; x_gn = x_b x_gm (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_gp = x_2 x_g8 + x_gr = x_3 x_gp + x_gs = unConstrData# x_gr + x_gt = x_4 x_gs + x_gu = x x_gs + x_gv = + x_5 + (equalsInteger# 0# x_gt) + (\ ~ -> + let* x_gw = x_3 x_gu + x_gx = unConstrData# x_gw + x_gy = x_4 x_gx + x_gz = x x_gx + x_h0 = + x_5 + (equalsInteger# 0# x_gy) + (\ ~ -> + let* x_h1 = x_3 x_gz + x_h2 = unConstrData# x_h1 + x_h3 = x_4 x_h2 + x_h4 = x x_h2 + x_h5 = + x_5 + (equalsInteger# 0# x_h3) + (\ ~ -> + let* x_h6 = x_3 x_h4 + x_h7 = unBData# x_h6 + in x_5 + (equalsInteger# (lengthOfByteString# x_h7) 28#) + (\ ~ -> let* x_h8 = x_2 x_h4; x_h9 = x_b x_h8 (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> + x_5 + (equalsInteger# 1# x_h3) + (\ ~ -> + let* x_ha = x_3 x_h4 + x_hb = unBData# x_ha + in x_5 + (equalsInteger# (lengthOfByteString# x_hb) 28#) + (\ ~ -> let* x_hc = x_2 x_h4; x_hd = x_b x_hc (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + ! + x_he = x_2 x_gz + x_hf = x_b x_he (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> + x_5 + (equalsInteger# 1# x_gy) + (\ ~ -> + let* x_hg = x_3 x_gz + x_hh = unIData# x_hg + x_hi = x_2 x_gz + x_hj = x_3 x_hi + x_hk = unIData# x_hj + x_hm = x_2 x_hi + x_hn = x_3 x_hm + x_hp = unIData# x_hn + x_hr = x_2 x_hm + x_hs = x_b x_hr (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + !) + ! + x_ht = x_2 x_gu + x_hu = x_b x_ht (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> x_5 (equalsInteger# 1# x_gt) (\ ~ -> let* x_hv = x_b x_gu (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) (\ ~ -> ERROR) !) + ! + x_hw = x_2 x_gp + x_hx = x_b x_hw (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + ! + x_hy = x_2 x_g4 + x_hz = x_3 x_hy + x_i0 = unConstrData# x_hz + x_i1 = x_4 x_i0 + x_i2 = x x_i0 + x_i3 = + x_5 + (equalsInteger# 0# x_i1) + (\ ~ -> + let* x_i4 = x_3 x_i2 + x_i5 = unBData# x_i4 + x_i6 = lengthOfByteString# x_i5 + in x_5 + (x_w (equalsInteger# x_i6 0#) (\ ~ -> equalsInteger# x_i6 28#) !) + (\ ~ -> + let* x_i7 = x_2 x_i2 + x_i8 = x_3 x_i7 + x_i9 = unBData# x_i8 + in x_5 + (lessThanEqualsInteger# (lengthOfByteString# x_i9) 32#) + (\ ~ -> let* x_ia = x_2 x_i7; x_ib = x_b x_ia (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_ic = x_2 x_hy + x_id = x_3 x_ic + x_ie = unIData# x_id + x_if = x_2 x_ic + x_ig = x_3 x_if + x_ih = unIData# x_ig + x_ii = x_2 x_if + x_ij = x_3 x_ii + x_ik = unConstrData# x_ij + x_im = x_4 x_ik + x_in = x x_ik + x_ip = + x_5 + (equalsInteger# 0# x_im) + (\ ~ -> + let* x_ir = x_3 x_in + x_is = unBData# x_ir + x_it = lengthOfByteString# x_is + in x_5 + (x_w (equalsInteger# x_it 0#) (\ ~ -> equalsInteger# x_it 28#) !) + (\ ~ -> + let* x_iu = x_2 x_in + x_iv = x_3 x_iu + x_iw = unBData# x_iv + in x_5 + (lessThanEqualsInteger# (lengthOfByteString# x_iw) 32#) + (\ ~ -> let* x_ix = x_2 x_iu; x_iy = x_b x_ix (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + x_iz = x_2 x_ii + x_j0 = x_3 x_iz + x_j1 = unConstrData# x_j0 + in x_5 + (equalsInteger# (x_4 x_j1) 0#) + (\ ~ -> + let* x_j2 = x x_j1 + x_j3 = unIData# (x_3 x_j2) + x_j4 = x_2 x_j2 + x_j5 = unIData# (x_3 x_j4) + x_j6 = x_2f x_j5 + x_j7 = iData# x_j6 + in x_5 + (equalsData# (listData# (x_2 x_j4)) (listData# x_2a)) + (\ ~ -> + let* x_j8 = x_2 x_iz + x_j9 = x_3 x_j8 + x_ja = unBData# x_j9 + in x_5 + (lessThanEqualsInteger# (lengthOfByteString# x_ja) 32#) + (\ ~ -> + let* x_jb = x_2 x_j8 + x_jc = x_3 x_jb + x_jd = unConstrData# x_jc + x_je = x_4 x_jd + x_jf = x x_jd + x_jg = + x_5 + (equalsInteger# 0# x_je) + (\ ~ -> + let* x_jh = x_3 x_jf + x_ji = unIData# x_jh + in x_5 + (lessThanEqualsInteger# 0# x_ji) + (\ ~ -> let* x_jj = x_2 x_jf; x_jk = x_b x_jj (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> x_5 (equalsInteger# 1# x_je) (\ ~ -> let* x_jm = x_b x_jf (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) (\ ~ -> ERROR) !) + ! + x_jn = x_2 x_jb + x_jp = x_3 x_jn + x_jr = unConstrData# x_jp + x_js = x_4 x_jr + x_jt = x x_jr + x_ju = + x_5 + (equalsInteger# 0# x_js) + (\ ~ -> + let* x_jv = x_3 x_jt + x_jw = unIData# x_jv + in x_5 + (lessThanEqualsInteger# 0# x_jw) + (\ ~ -> let* x_jx = x_2 x_jt; x_jy = x_b x_jx (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> x_5 (equalsInteger# 1# x_js) (\ ~ -> let* x_jz = x_b x_jt (\ ~ -> ()#) (\ ~ -> ERROR) ! in ()#) (\ ~ -> ERROR) !) + ! + x_k0 = x_2 x_jn + x_k1 = x_3 x_k0 + x_k2 = unIData# x_k1 + x_k3 = x_2 x_k0 + x_k4 = x_3 x_k3 + x_k5 = unIData# x_k4 + x_k6 = x_2 x_k3 + x_k7 = x_3 x_k6 + x_k8 = unIData# x_k7 + x_k9 = x_2 x_k6 + x_ka = x_3 x_k9 + x_kb = unConstrData# x_ka + x_kc = x_4 x_kb + x_kd = x x_kb + x_ke = + x_5 + (equalsInteger# 0# x_kc) + (\ ~ -> + let* x_kf = x_3 x_kd + x_kg = unIData# x_kf + x_kh = x_2 x_kd + x_ki = x_3 x_kh + x_kj = unIData# x_ki + x_kk = x_2 x_kh + x_km = x_3 x_kk + x_kn = unIData# x_km + x_kp = x_2 x_kk + x_kr = x_b x_kp (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + ! + x_ks = x_2 x_k9 + x_kt = x_3 x_ks + x_ku = unIData# x_kt + x_kv = x_2 x_ks + x_kw = x_b x_kv (\ ~ -> ()#) (\ ~ -> ERROR) ! + in ()#) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + ! + in x_fx) + (\ ~ -> ERROR) + !) + ! + x_kx = x_12 (x_0 x_ar) + x_ky = x_2 x_kx + x_kz = x_2 x_ky + x_m0 = x_2 x_kz + x_m1 = x_2 x_m0 + x_m2 = x_2 x_m1 + x_m3 = x_2 x_m2 + x_m4 = x_2 x_m3 + x_m5 = x_2 x_m4 + x_m6 = x_2 x_m5 + x_m7 = x_2 x_m6 + x_m8 = x_2 x_m7 + x_m9 = unIData# (x_3 x_kz) + x_ma = unIData# (x_3 x_ky) + x_mb = unIData# (x_3 x_m5) + x_mc = x_3 x_m1 + x_md = x_3 x_m8 + x_me = unIData# (x_3 (x_2 x_m8)) + x_mf = unIData# (x_3 (x_0 x_mc)) + x_mg = x_3 x_m6 + x_mh = unIData# (x_3 x_m7) + x_mi = x_0 x_md + x_mj = x_2 x_mi + x_mk = x_3 x_mi + x_mm = x_3 x_mj + x_mn = x_3 (x_2 x_mj) + x_mp = x_3 x_kx + x_mr = x_3 x_m0 + x_ms = unConstrData# (x_3 x_m3) + x_mt = x_4 x_ms + x_mu = x x_ms + in x_5 + (equalsInteger# 1# x_mt) + (\ ~ -> + let* x_mv = unConstrData# (x_3 x_m4) + x_mw = x_4 x_mv + x_mx = x x_mv + in x_5 + (lessThanInteger# 0# x_m9) + (\ ~ -> + x_5 + (equalsInteger# x_ma x_m9) + (\ ~ -> + x_5 + (equalsByteString# (unBData# (x_3 x_m2)) x_a0) + (\ ~ -> + x_5 + (equalsInteger# 0# x_mb) + (\ ~ -> + x_5 + (lessThanInteger# 0# x_mf) + (\ ~ -> + x_5 + (x_8x (x_1p x_mp x_mr)) + (\ ~ -> + x_5 + True# + (\ ~ -> + x_5 + (equalsData# x_mg x_mk) + (\ ~ -> + x_5 + (equalsInteger# x_mh x_a8) + (\ ~ -> + let* x_my = x_2s x_mp (iData# x_m9) + x_mz = x_2s x_ad (iData# 1#) + x_n0 = x_2s (x_2c x_2x x_2x) (iData# x_a9) + x_n1 = x_4i x_mp x_mr x_mk x_mm x_mn + x_n2 = x_58 (x_4c addInteger# x_my (x_58 (x_4c addInteger# x_mz (x_58 (x_4c addInteger# x_n0 x_n1))))) + x_n3 = unMapData# (x_3 (x_2 (x_0 x_af))) + in x_5 + (x_8u x_n3 x_n2) + (\ ~ -> + x_5 + (equalsInteger# (unIData# x_mn) 0#) + (\ ~ -> + x_5 + (x_1u (lessThanEqualsInteger# x_a6 (unIData# x_mk)) (\ ~ -> lessThanEqualsInteger# (x_7j (x_6t (x_5s x_a7) (x_5m x_m9))) (unIData# x_mm)) !) + (\ ~ -> x_5 (equalsInteger# x_me 0#) (\ ~ -> ()#) (\ ~ -> ERROR) !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> + let* x_n4 = unConstrData# (x_3 x_m4) + x_n5 = x_4 x_n4 + x_n6 = x x_n4 + in x_5 + (equalsInteger# 1# x_n5) + (\ ~ -> + x_5 + (lessThanInteger# 0# x_m9) + (\ ~ -> + x_5 + (equalsInteger# x_ma x_m9) + (\ ~ -> + x_5 + (equalsByteString# (unBData# (x_3 x_m2)) x_a0) + (\ ~ -> + x_5 + (equalsInteger# 0# x_mb) + (\ ~ -> + x_5 + (lessThanInteger# 0# x_mf) + (\ ~ -> + x_5 + (x_8x (x_1p x_mp x_mr)) + (\ ~ -> + x_5 + True# + (\ ~ -> + x_5 + (equalsData# x_mg x_mk) + (\ ~ -> + x_5 + (equalsInteger# x_mh x_a8) + (\ ~ -> + let* x_n7 = x_2s x_mp (iData# x_m9) + x_n8 = x_2s x_ad (iData# 1#) + x_n9 = x_2s (x_2c x_2x x_2x) (iData# x_a9) + x_na = x_4i x_mp x_mr x_mk x_mm x_mn + x_nb = x_58 (x_4c addInteger# x_n7 (x_58 (x_4c addInteger# x_n8 (x_58 (x_4c addInteger# x_n9 x_na))))) + x_nc = unMapData# (x_3 (x_2 (x_0 x_af))) + in x_5 + (x_8u x_nc x_nb) + (\ ~ -> + x_5 + (equalsInteger# (unIData# x_mn) 0#) + (\ ~ -> + x_5 + (x_1u + (lessThanEqualsInteger# x_a6 (unIData# x_mk)) + (\ ~ -> lessThanEqualsInteger# (x_7j (x_6t (x_5s x_a7) (x_5m x_m9))) (unIData# x_mm)) + !) + (\ ~ -> x_5 (equalsInteger# x_me 0#) (\ ~ -> ()#) (\ ~ -> ERROR) !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> + x_5 + (lessThanInteger# 0# x_m9) + (\ ~ -> + x_5 + (equalsInteger# x_ma x_m9) + (\ ~ -> + x_5 + (equalsByteString# (unBData# (x_3 x_m2)) x_a0) + (\ ~ -> + x_5 + (equalsInteger# 0# x_mb) + (\ ~ -> + x_5 + (lessThanInteger# 0# x_mf) + (\ ~ -> + x_5 + (x_8x (x_1p x_mp x_mr)) + (\ ~ -> + x_5 + (lessThanEqualsInteger# (unIData# (x_3 x_mu)) (unIData# (x_3 x_n6))) + (\ ~ -> + x_5 + (equalsData# x_mg x_mk) + (\ ~ -> + x_5 + (equalsInteger# x_mh x_a8) + (\ ~ -> + let* x_nd = x_2s x_mp (iData# x_m9) + x_ne = x_2s x_ad (iData# 1#) + x_nf = x_2s (x_2c x_2x x_2x) (iData# x_a9) + x_ng = x_4i x_mp x_mr x_mk x_mm x_mn + x_nh = x_58 (x_4c addInteger# x_nd (x_58 (x_4c addInteger# x_ne (x_58 (x_4c addInteger# x_nf x_ng))))) + x_ni = unMapData# (x_3 (x_2 (x_0 x_af))) + in x_5 + (x_8u x_ni x_nh) + (\ ~ -> + x_5 + (equalsInteger# (unIData# x_mn) 0#) + (\ ~ -> + x_5 + (x_1u + (lessThanEqualsInteger# x_a6 (unIData# x_mk)) + (\ ~ -> lessThanEqualsInteger# (x_7j (x_6t (x_5s x_a7) (x_5m x_m9))) (unIData# x_mm)) + !) + (\ ~ -> x_5 (equalsInteger# x_me 0#) (\ ~ -> ()#) (\ ~ -> ERROR) !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR) + !) + !) + !) + (\ ~ -> ERROR) + !) + (\ ~ -> ERROR)) + (\ ~ -> ERROR) + !) + !) + (\ ~ -> x_5 (x_y (\ x_nj -> lessThanEqualsInteger# 0# (unIData# (x x_nj))) (x_t x_97 x_9d (\ x_nk -> x_nk) (\ ~ -> ERROR))) (\ ~ -> ERROR) (\ ~ -> ()#) !) + ! diff --git a/geniusyield-onchain/flake.lock b/geniusyield-onchain/flake.lock new file mode 100644 index 00000000..8f2d2721 --- /dev/null +++ b/geniusyield-onchain/flake.lock @@ -0,0 +1,918 @@ +{ + "nodes": { + "CHaP": { + "flake": false, + "locked": { + "lastModified": 1668433977, + "narHash": "sha256-JcfyzvIJeeXFu4nCJdR/uI9G5pmjcIZ79YxONKVy8GU=", + "owner": "input-output-hk", + "repo": "cardano-haskell-packages", + "rev": "7ba66a729344ced7636a419c99ddaba35d3f0b8f", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "ref": "repo", + "repo": "cardano-haskell-packages", + "type": "github" + } + }, + "HTTP": { + "flake": false, + "locked": { + "lastModified": 1451647621, + "narHash": "sha256-oHIyw3x0iKBexEo49YeUDV1k74ZtyYKGR2gNJXXRxts=", + "owner": "phadej", + "repo": "HTTP", + "rev": "9bc0996d412fef1787449d841277ef663ad9a915", + "type": "github" + }, + "original": { + "owner": "phadej", + "repo": "HTTP", + "type": "github" + } + }, + "blank": { + "locked": { + "lastModified": 1625557891, + "narHash": "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=", + "owner": "divnix", + "repo": "blank", + "rev": "5a5d2684073d9f563072ed07c871d577a6c614a8", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "blank", + "type": "github" + } + }, + "cabal-32": { + "flake": false, + "locked": { + "lastModified": 1603716527, + "narHash": "sha256-X0TFfdD4KZpwl0Zr6x+PLxUt/VyKQfX7ylXHdmZIL+w=", + "owner": "haskell", + "repo": "cabal", + "rev": "48bf10787e27364730dd37a42b603cee8d6af7ee", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "3.2", + "repo": "cabal", + "type": "github" + } + }, + "cabal-34": { + "flake": false, + "locked": { + "lastModified": 1640353650, + "narHash": "sha256-N1t6M3/wqj90AEdRkeC8i923gQYUpzSr8b40qVOZ1Rk=", + "owner": "haskell", + "repo": "cabal", + "rev": "942639c18c0cd8ec53e0a6f8d120091af35312cd", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "3.4", + "repo": "cabal", + "type": "github" + } + }, + "cabal-36": { + "flake": false, + "locked": { + "lastModified": 1641652457, + "narHash": "sha256-BlFPKP4C4HRUJeAbdembX1Rms1LD380q9s0qVDeoAak=", + "owner": "haskell", + "repo": "cabal", + "rev": "f27667f8ec360c475027dcaee0138c937477b070", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "3.6", + "repo": "cabal", + "type": "github" + } + }, + "cardano-shell": { + "flake": false, + "locked": { + "lastModified": 1608537748, + "narHash": "sha256-PulY1GfiMgKVnBci3ex4ptk2UNYMXqGjJOxcPy2KYT4=", + "owner": "input-output-hk", + "repo": "cardano-shell", + "rev": "9392c75087cb9a3d453998f4230930dea3a95725", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "cardano-shell", + "type": "github" + } + }, + "devshell": { + "inputs": { + "flake-utils": [ + "haskellNix", + "tullia", + "std", + "flake-utils" + ], + "nixpkgs": [ + "haskellNix", + "tullia", + "std", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1663445644, + "narHash": "sha256-+xVlcK60x7VY1vRJbNUEAHi17ZuoQxAIH4S4iUFUGBA=", + "owner": "numtide", + "repo": "devshell", + "rev": "e3dc3e21594fe07bdb24bdf1c8657acaa4cb8f66", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "dmerge": { + "inputs": { + "nixlib": [ + "haskellNix", + "tullia", + "std", + "nixpkgs" + ], + "yants": [ + "haskellNix", + "tullia", + "std", + "yants" + ] + }, + "locked": { + "lastModified": 1659548052, + "narHash": "sha256-fzI2gp1skGA8mQo/FBFrUAtY0GQkAIAaV/V127TJPyY=", + "owner": "divnix", + "repo": "data-merge", + "rev": "d160d18ce7b1a45b88344aa3f13ed1163954b497", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "data-merge", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1635892615, + "narHash": "sha256-harGbMZr4hzat2BWBU+Y5OYXlu+fVz7E4WeQzHi5o8A=", + "owner": "input-output-hk", + "repo": "flake-compat", + "rev": "eca47d3377946315596da653862d341ee5341318", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "locked": { + "lastModified": 1644229661, + "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "locked": { + "lastModified": 1653893745, + "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_4": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_5": { + "locked": { + "lastModified": 1653893745, + "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "ghc-8.6.5-iohk": { + "flake": false, + "locked": { + "lastModified": 1600920045, + "narHash": "sha256-DO6kxJz248djebZLpSzTGD6s8WRpNI9BTwUeOf5RwY8=", + "owner": "input-output-hk", + "repo": "ghc", + "rev": "95713a6ecce4551240da7c96b6176f980af75cae", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "ref": "release/8.6.5-iohk", + "repo": "ghc", + "type": "github" + } + }, + "gomod2nix": { + "inputs": { + "nixpkgs": "nixpkgs_2", + "utils": "utils" + }, + "locked": { + "lastModified": 1655245309, + "narHash": "sha256-d/YPoQ/vFn1+GTmSdvbSBSTOai61FONxB4+Lt6w/IVI=", + "owner": "tweag", + "repo": "gomod2nix", + "rev": "40d32f82fc60d66402eb0972e6e368aeab3faf58", + "type": "github" + }, + "original": { + "owner": "tweag", + "repo": "gomod2nix", + "type": "github" + } + }, + "hackage": { + "flake": false, + "locked": { + "lastModified": 1672791896, + "narHash": "sha256-zbISIhV/H66RkyJcrbynokbNewgda6xj96/2WYyNM6k=", + "owner": "input-output-hk", + "repo": "hackage.nix", + "rev": "21307956a6f92e39ecea0d54561d3c3b82075896", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "hackage.nix", + "type": "github" + } + }, + "haskellNix": { + "inputs": { + "HTTP": "HTTP", + "cabal-32": "cabal-32", + "cabal-34": "cabal-34", + "cabal-36": "cabal-36", + "cardano-shell": "cardano-shell", + "flake-compat": "flake-compat", + "flake-utils": "flake-utils_2", + "ghc-8.6.5-iohk": "ghc-8.6.5-iohk", + "hackage": "hackage", + "hpc-coveralls": "hpc-coveralls", + "hydra": "hydra", + "iserv-proxy": "iserv-proxy", + "nixpkgs": [ + "haskellNix", + "nixpkgs-unstable" + ], + "nixpkgs-2003": "nixpkgs-2003", + "nixpkgs-2105": "nixpkgs-2105", + "nixpkgs-2111": "nixpkgs-2111", + "nixpkgs-2205": "nixpkgs-2205", + "nixpkgs-2211": "nixpkgs-2211", + "nixpkgs-unstable": "nixpkgs-unstable", + "old-ghc-nix": "old-ghc-nix", + "stackage": "stackage", + "tullia": "tullia" + }, + "locked": { + "lastModified": 1672826296, + "narHash": "sha256-BBBEu/qrkqQ2VVf7Ty6Eqcm5W9GfdLxXPEnEhGiX2mQ=", + "owner": "input-output-hk", + "repo": "haskell.nix", + "rev": "e339ff5b2862443f19971c524a09169c10706aaa", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "haskell.nix", + "type": "github" + } + }, + "hpc-coveralls": { + "flake": false, + "locked": { + "lastModified": 1607498076, + "narHash": "sha256-8uqsEtivphgZWYeUo5RDUhp6bO9j2vaaProQxHBltQk=", + "owner": "sevanspowell", + "repo": "hpc-coveralls", + "rev": "14df0f7d229f4cd2e79f8eabb1a740097fdfa430", + "type": "github" + }, + "original": { + "owner": "sevanspowell", + "repo": "hpc-coveralls", + "type": "github" + } + }, + "hydra": { + "inputs": { + "nix": "nix", + "nixpkgs": [ + "haskellNix", + "hydra", + "nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1646878427, + "narHash": "sha256-KtbrofMtN8GlM7D+n90kixr7QpSlVmdN+vK5CA/aRzc=", + "owner": "NixOS", + "repo": "hydra", + "rev": "28b682b85b7efc5cf7974065792a1f22203a5927", + "type": "github" + }, + "original": { + "id": "hydra", + "type": "indirect" + } + }, + "iserv-proxy": { + "flake": false, + "locked": { + "lastModified": 1639165170, + "narHash": "sha256-QsWL/sBDL5GM8IXd/dE/ORiL4RvteEN+aok23tXgAoc=", + "rev": "6e95df7be6dd29680f983db07a057fc2f34f81f6", + "revCount": 7, + "type": "git", + "url": "https://gitlab.haskell.org/ghc/iserv-proxy.git" + }, + "original": { + "rev": "6e95df7be6dd29680f983db07a057fc2f34f81f6", + "type": "git", + "url": "https://gitlab.haskell.org/ghc/iserv-proxy.git" + } + }, + "lowdown-src": { + "flake": false, + "locked": { + "lastModified": 1633514407, + "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", + "owner": "kristapsdz", + "repo": "lowdown", + "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", + "type": "github" + }, + "original": { + "owner": "kristapsdz", + "repo": "lowdown", + "type": "github" + } + }, + "mdbook-kroki-preprocessor": { + "flake": false, + "locked": { + "lastModified": 1661755005, + "narHash": "sha256-1TJuUzfyMycWlOQH67LR63/ll2GDZz25I3JfScy/Jnw=", + "owner": "JoelCourtney", + "repo": "mdbook-kroki-preprocessor", + "rev": "93adb5716d035829efed27f65f2f0833a7d3e76f", + "type": "github" + }, + "original": { + "owner": "JoelCourtney", + "repo": "mdbook-kroki-preprocessor", + "type": "github" + } + }, + "n2c": { + "inputs": { + "flake-utils": "flake-utils_5", + "nixpkgs": [ + "haskellNix", + "tullia", + "std", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1665039323, + "narHash": "sha256-SAh3ZjFGsaCI8FRzXQyp56qcGdAqgKEfJWPCQ0Sr7tQ=", + "owner": "nlewo", + "repo": "nix2container", + "rev": "b008fe329ffb59b67bf9e7b08ede6ee792f2741a", + "type": "github" + }, + "original": { + "owner": "nlewo", + "repo": "nix2container", + "type": "github" + } + }, + "nix": { + "inputs": { + "lowdown-src": "lowdown-src", + "nixpkgs": "nixpkgs", + "nixpkgs-regression": "nixpkgs-regression" + }, + "locked": { + "lastModified": 1643066034, + "narHash": "sha256-xEPeMcNJVOeZtoN+d+aRwolpW8mFSEQx76HTRdlhPhg=", + "owner": "NixOS", + "repo": "nix", + "rev": "a1cd7e58606a41fcf62bf8637804cf8306f17f62", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "2.6.0", + "repo": "nix", + "type": "github" + } + }, + "nix-nomad": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-utils": [ + "haskellNix", + "tullia", + "nix2container", + "flake-utils" + ], + "gomod2nix": "gomod2nix", + "nixpkgs": [ + "haskellNix", + "tullia", + "nixpkgs" + ], + "nixpkgs-lib": [ + "haskellNix", + "tullia", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1658277770, + "narHash": "sha256-T/PgG3wUn8Z2rnzfxf2VqlR1CBjInPE0l1yVzXxPnt0=", + "owner": "tristanpemble", + "repo": "nix-nomad", + "rev": "054adcbdd0a836ae1c20951b67ed549131fd2d70", + "type": "github" + }, + "original": { + "owner": "tristanpemble", + "repo": "nix-nomad", + "type": "github" + } + }, + "nix2container": { + "inputs": { + "flake-utils": "flake-utils_3", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1658567952, + "narHash": "sha256-XZ4ETYAMU7XcpEeAFP3NOl9yDXNuZAen/aIJ84G+VgA=", + "owner": "nlewo", + "repo": "nix2container", + "rev": "60bb43d405991c1378baf15a40b5811a53e32ffa", + "type": "github" + }, + "original": { + "owner": "nlewo", + "repo": "nix2container", + "type": "github" + } + }, + "nixago": { + "inputs": { + "flake-utils": [ + "haskellNix", + "tullia", + "std", + "flake-utils" + ], + "nixago-exts": [ + "haskellNix", + "tullia", + "std", + "blank" + ], + "nixpkgs": [ + "haskellNix", + "tullia", + "std", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1661824785, + "narHash": "sha256-/PnwdWoO/JugJZHtDUioQp3uRiWeXHUdgvoyNbXesz8=", + "owner": "nix-community", + "repo": "nixago", + "rev": "8c1f9e5f1578d4b2ea989f618588d62a335083c3", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixago", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1632864508, + "narHash": "sha256-d127FIvGR41XbVRDPVvozUPQ/uRHbHwvfyKHwEt5xFM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "82891b5e2c2359d7e58d08849e4c89511ab94234", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-21.05-small", + "type": "indirect" + } + }, + "nixpkgs-2003": { + "locked": { + "lastModified": 1620055814, + "narHash": "sha256-8LEHoYSJiL901bTMVatq+rf8y7QtWuZhwwpKE2fyaRY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1db42b7fe3878f3f5f7a4f2dc210772fd080e205", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-20.03-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2105": { + "locked": { + "lastModified": 1659914493, + "narHash": "sha256-lkA5X3VNMKirvA+SUzvEhfA7XquWLci+CGi505YFAIs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "022caabb5f2265ad4006c1fa5b1ebe69fb0c3faf", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-21.05-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2111": { + "locked": { + "lastModified": 1659446231, + "narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "eabc38219184cc3e04a974fe31857d8e0eac098d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-21.11-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2205": { + "locked": { + "lastModified": 1663981975, + "narHash": "sha256-TKaxWAVJR+a5JJauKZqibmaM5e/Pi5tBDx9s8fl/kSE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "309faedb8338d3ae8ad8f1043b3ccf48c9cc2970", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-22.05-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2211": { + "locked": { + "lastModified": 1669997163, + "narHash": "sha256-vhjC0kZMFoN6jzK0GR+tBzKi5KgBXgehadfidW8+Va4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6f87491a54d8d64d30af6663cb3bf5d2ee7db958", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-22.11-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-regression": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "indirect" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1663905476, + "narHash": "sha256-0CSwRKaYravh9v6qSlBpM0gNg0UhKT2lL7Yn6Zbx7UM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e14f9fb57315f0d4abde222364f19f88c77d2b79", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1653581809, + "narHash": "sha256-Uvka0V5MTGbeOfWte25+tfRL3moECDh1VwokWSZUdoY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "83658b28fe638a170a19b8933aa008b30640fbd1", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1654807842, + "narHash": "sha256-ADymZpr6LuTEBXcy6RtFHcUZdjKTBRTMYwu19WOx17E=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "fc909087cc3386955f21b4665731dbdaceefb1d8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1665087388, + "narHash": "sha256-FZFPuW9NWHJteATOf79rZfwfRn5fE0wi9kRzvGfDHPA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "95fda953f6db2e9496d2682c4fc7b82f959878f7", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "old-ghc-nix": { + "flake": false, + "locked": { + "lastModified": 1631092763, + "narHash": "sha256-sIKgO+z7tj4lw3u6oBZxqIhDrzSkvpHtv0Kki+lh9Fg=", + "owner": "angerman", + "repo": "old-ghc-nix", + "rev": "af48a7a7353e418119b6dfe3cd1463a657f342b8", + "type": "github" + }, + "original": { + "owner": "angerman", + "ref": "master", + "repo": "old-ghc-nix", + "type": "github" + } + }, + "root": { + "inputs": { + "CHaP": "CHaP", + "flake-utils": "flake-utils", + "haskellNix": "haskellNix", + "nixpkgs": [ + "haskellNix", + "nixpkgs-unstable" + ] + } + }, + "stackage": { + "flake": false, + "locked": { + "lastModified": 1672790972, + "narHash": "sha256-8J6s+gFzjeGENyehEKdRyTJ4W+Dv4gLNBxt29cWtOS8=", + "owner": "input-output-hk", + "repo": "stackage.nix", + "rev": "5c1a68f2f6642fe7419c5c1c5f4d6668786f8bf7", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "stackage.nix", + "type": "github" + } + }, + "std": { + "inputs": { + "blank": "blank", + "devshell": "devshell", + "dmerge": "dmerge", + "flake-utils": "flake-utils_4", + "makes": [ + "haskellNix", + "tullia", + "std", + "blank" + ], + "mdbook-kroki-preprocessor": "mdbook-kroki-preprocessor", + "microvm": [ + "haskellNix", + "tullia", + "std", + "blank" + ], + "n2c": "n2c", + "nixago": "nixago", + "nixpkgs": "nixpkgs_4", + "yants": "yants" + }, + "locked": { + "lastModified": 1665513321, + "narHash": "sha256-D6Pacw9yf/HMs84KYuCxHXnNDL7v43gtcka5URagFqE=", + "owner": "divnix", + "repo": "std", + "rev": "94a90eedb9cfc115b12ae8f6622d9904788559e4", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "std", + "type": "github" + } + }, + "tullia": { + "inputs": { + "nix-nomad": "nix-nomad", + "nix2container": "nix2container", + "nixpkgs": [ + "haskellNix", + "nixpkgs" + ], + "std": "std" + }, + "locked": { + "lastModified": 1668711738, + "narHash": "sha256-CBjky16o9pqsGE1bWu6nRlRajgSXMEk+yaFQLibqXcE=", + "owner": "input-output-hk", + "repo": "tullia", + "rev": "ead1f515c251f0e060060ef0e2356a51d3dfe4b0", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "tullia", + "type": "github" + } + }, + "utils": { + "locked": { + "lastModified": 1653893745, + "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "yants": { + "inputs": { + "nixpkgs": [ + "haskellNix", + "tullia", + "std", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660507851, + "narHash": "sha256-BKjq7JnVuUR/xDtcv6Vm9GYGKAblisXrAgybor9hT/s=", + "owner": "divnix", + "repo": "yants", + "rev": "0b895ca02a8fa72bad50b454cb3e7d8a66407c96", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "yants", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/geniusyield-onchain/flake.nix b/geniusyield-onchain/flake.nix new file mode 100644 index 00000000..7f64ac55 --- /dev/null +++ b/geniusyield-onchain/flake.nix @@ -0,0 +1,47 @@ +{ + description = "geniusyield-onchain"; + + inputs = { + haskellNix.url = "github:input-output-hk/haskell.nix"; + nixpkgs.follows = "haskellNix/nixpkgs-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + CHaP = { + url = "github:input-output-hk/cardano-haskell-packages?ref=repo"; + flake = false; + }; + }; + + outputs = { self, nixpkgs, flake-utils, haskellNix, CHaP }: + flake-utils.lib.eachSystem [ "x86_64-linux" ] (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ + haskellNix.overlay + ]; + inherit (haskellNix) config; + }; + onchain = pkgs.haskell-nix.cabalProject' { + src = ./.; + compiler-nix-name = "ghc925"; + shell = { + # This is used by `nix develop .` to open a shell for use with + # `cabal`, `hlint` and `haskell-language-server` etc + tools = { + cabal = "3.8.1.0"; + haskell-language-server = { + version = "1.8.0.0"; + index-state = "2022-10-31T00:00:00Z"; + }; + hlint = "3.5"; + }; + # Non-Haskell shell tools go here + buildInputs = with pkgs; [ + git + ]; + }; + + inputMap = { "https://input-output-hk.github.io/cardano-haskell-packages" = CHaP; }; + }; + in onchain.flake { }); +} diff --git a/geniusyield-onchain/geniusyield-common/LICENSE b/geniusyield-onchain/geniusyield-common/LICENSE new file mode 100644 index 00000000..dff1fbd5 --- /dev/null +++ b/geniusyield-onchain/geniusyield-common/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2023 GYELD GMBH + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.NFT b/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.NFT new file mode 100644 index 00000000..87d9a073 --- /dev/null +++ b/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.NFT @@ -0,0 +1,9 @@ +{ + "cborHex": "59018a590187010000323232323232323232323232323232223232533300f301130130021533300f3300b23371290001bad3013001333300a30070033756601a60126010601a601000640022c2c200c26464646464a66602a0022c2a666028a6601466020466ebcdd398070029ba7300e3013300e00137586024601a00a2a660146ae8cc04c00454cc028c058dd6980b9809000899b8f375c6030602400200420162c666601c601600e6eacc044c034c030010800458dc919b8b375a602060220026eb8c040c02cc040004c028004c038008c034c02000cc044004dd5001111998060010008a504988c8c94ccc02ccdc3a4000601e00426eb8c02400458c034004dd5180398041801000918059baa0012300630063006300600123223300522533300b00112250011533300a3375e601c60100020082644460040066eacc034c0200044c008c024004004dd4800918011129998040008a50153330073003300500114a226004600c002464600446600400400246004466004004002ae855d12b9a5573e6e1d20025573caae741", + "description": "DEX.NFT", + "params": [], + "rawHex": "590187010000323232323232323232323232323232223232533300f301130130021533300f3300b23371290001bad3013001333300a30070033756601a60126010601a601000640022c2c200c26464646464a66602a0022c2a666028a6601466020466ebcdd398070029ba7300e3013300e00137586024601a00a2a660146ae8cc04c00454cc028c058dd6980b9809000899b8f375c6030602400200420162c666601c601600e6eacc044c034c030010800458dc919b8b375a602060220026eb8c040c02cc040004c028004c038008c034c02000cc044004dd5001111998060010008a504988c8c94ccc02ccdc3a4000601e00426eb8c02400458c034004dd5180398041801000918059baa0012300630063006300600123223300522533300b00112250011533300a3375e601c60100020082644460040066eacc034c0200044c008c024004004dd4800918011129998040008a50153330073003300500114a226004600c002464600446600400400246004466004004002ae855d12b9a5573e6e1d20025573caae741", + "role": "MintingPolicyRole", + "type": "PlutusScriptV2", + "version": "ScriptV2" +} \ No newline at end of file diff --git a/geniusyield-dex-api/data/compiled-scripts/partial-order.txt b/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrder similarity index 99% rename from geniusyield-dex-api/data/compiled-scripts/partial-order.txt rename to geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrder index 557cadab..e5cf09f6 100644 --- a/geniusyield-dex-api/data/compiled-scripts/partial-order.txt +++ b/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrder @@ -9,4 +9,4 @@ "role": "ValidatorRole", "type": "PlutusScriptV2", "version": "ScriptV2" -} +} \ No newline at end of file diff --git a/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrderConfig b/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrderConfig new file mode 100644 index 00000000..f89eb9b8 --- /dev/null +++ b/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrderConfig @@ -0,0 +1,11 @@ +{ + "cborHex": "5908a159089e0100003232323232323232323232323232323232323232323232323232322222323232323232533301a301f30240021323333017233015002301a30160013758603200c464a66603a6044660266eacc06cc0700040344c8c8c94ccc080cccc074894ccc08c00448dc4802091299981219b8900500114a2264666604444a666050002244a0022a66604e66ebcc09400400c4c06cc0980044ccc008c0980048c070cc074c098008004489400400c8ccc018c094014004cdc0001a4004266600a604800800600460440066eb0c078024dd6180f001a40002646464a66604666e24ccc0808894ccc09c00440084cc00ccdc000118109bab30313024001302500148000dd59810800a40282646464646464646464646464a66605e6605844a66606400229444c94ccc0c8cc0bc894ccc0d40045280a99981a19baf303200100314a2260046066002606200429404c00cc0c4008c0bc0040044c94ccc0c0cdc4800a40282a6660606070002264a66606260720022a66606266e2400400854ccc0c4cdd798179818009981780409929998191999817119baf3031302d00100201224a229404c94ccc0ccc0e800454ccc0cccdc480081a899299981a181d8008a99981a19b890010361325333035303c001153330353371200206e264a66606c607a6eb4c0d0c0c00044c94ccc0dccdc4981d1bad3035001303a375a606a606c002205e2c60600022c60660122c2c6eb4c0c8c0cc01c5858dd698188030b0b1bad303000716302f007161616375a605c0102c2c60540022c6eb0c0b001cc0b0004c0ac004c0a8004c0a4004c0a0004c09c004c0854ccc09cc0b00084c8cccc094894ccc0ac004489400454ccc0a8cdd7981a1814000801899111801001981a9814000898011814800802919191900229998159817981a801099191919192999818299811981a0008981b00089919191919191919299981c181e1821000899191919299981e19baf374e6076004a08a26464646464072a666082607e00420702c6eb4c0f4004c0f4008dd6981d800981d8030b1ba8302d375a607200260720046eb4c0dc004c10c00458dd5181a800981a8011bad3033001303300453330333037303d002132323232323232323232035533303d303b005103416533303b303f002132323232320385333040303e005103716533303e30420021323232323203b53330433041005103a1653330413045002153330413047371a6eb8c0fc0044c80e94ccc108c10000440e4585854ccc104c11800854ccc104c11cdc69bae303f00113203a533304230400011039161616304b0023049001375460780022a66607c60860042646464646464078a666088608400420762c6eb4c100004c100008dd6981f000981f0011bad303c0011630480023046001375460720022a6660766080004264068a66607800220662c2c608a00460860026ea8c0d8004c0d80154ccc0d8c0e800854ccc0d8c0f0dc69bae303400113202f53330373035001102e161615333036303b00215333036303c371a6eb8c0d00044c80bd4ccc0dcc0d400440b8585858c100008c0f8004dd518188008b181e8009baa302f001302f00216371a6eb8c0b4004c0b4008dd6981580098158011980e1299981618191b8d375c00220022c6eb0c0a400458c0d4004dd50008b1ba9375c604a0022a66604e66e1d2004002132323232004533302a302e303400213232323232533302f533022303300113035001132323232323232325333037303b3041001132323232533303b3375e6e9cc0e800941104c8c8c8c8c80e14ccc100c0f800840dc58dd6981e000981e0011bad303a001303a00616375060586eb4c0e0004c0e0008dd6981b00098210008b1baa30340013034002375a60640026064008a666064606c6078004264646464646464646464068a666078607400a20662ca666074607c0042646464646406ea66607e607a00a206c2ca66607a608200426464646464074a666084608000a20722ca66608060880042a666080608c6e34dd7181f00089901ca999820981f800881c0b0b0a99982018228010a99982018231b8d375c607c002264072a666082607e00220702c2c2c609400460900026ea8c0ec00454ccc0f4c1080084c8c8c8c8c8c80ed4ccc10cc10400840e858dd6981f800981f8011bad303d001303d002375a60760022c608e004608a0026ea8c0e000454ccc0e8c0fc0084c80cd4ccc0ec00440c85858c110008c108004dd5181a800981a802a99981a981c8010a99981a981d9b8d375c606600226405ca66606c6068002205a2c2c2a66606a60740042a66606a60766e34dd71819800899017299981b181a00088168b0b0b181f801181e8009baa303000116303c0013754605c002605c0042c6e34dd7181600098160011bad302a001302a0023301b2533302b3031371a6eb8004400458dd618140008b181a0009baa0013025001163031002302f0013754604460460046eacc084c088c08803058c084c070cccc0788c94ccc090c0a4cc068dd59811181180080a09980e80198110008a50301d001002200116301f0053758603c0142c6eb4c074004c074004c05c0304054c058c068c06cc05800458c06000458c090004dd5180b180b802180b180b180b180b180b180b000980a980a800980798098009807000918069129998098008a5eb804cc01cc00cc040004c008c04400494ccc03ccdc4800a40002c200246601c0022944888c00800d5d0111919998021bae300b3007002480008cccc014009200075a6eac00400cdd71805180598030009191111980591299980880088028a99980819baf301a300e00100613004301b300e00113002300f0010013752002931119baf374e60060046e9cc00c0048c048dd5000998011112999804800880109980199b8000248008c01c00520003001222533300800112250011533300730023005001132223002003300500113300300230060012323002233002002001230022330020020015742ae895cd2ab9f48202a35ae41cdc1240046e1d2000370e90011b87480e0dc4a40006e2520021374e97ae05573aaae79", + "description": "DEX.PartialOrderConfig", + "params": [ + "PlutusLedgerApi.V1.Value:AssetClass" + ], + "rawHex": "59089e0100003232323232323232323232323232323232323232323232323232322222323232323232533301a301f30240021323333017233015002301a30160013758603200c464a66603a6044660266eacc06cc0700040344c8c8c94ccc080cccc074894ccc08c00448dc4802091299981219b8900500114a2264666604444a666050002244a0022a66604e66ebcc09400400c4c06cc0980044ccc008c0980048c070cc074c098008004489400400c8ccc018c094014004cdc0001a4004266600a604800800600460440066eb0c078024dd6180f001a40002646464a66604666e24ccc0808894ccc09c00440084cc00ccdc000118109bab30313024001302500148000dd59810800a40282646464646464646464646464a66605e6605844a66606400229444c94ccc0c8cc0bc894ccc0d40045280a99981a19baf303200100314a2260046066002606200429404c00cc0c4008c0bc0040044c94ccc0c0cdc4800a40282a6660606070002264a66606260720022a66606266e2400400854ccc0c4cdd798179818009981780409929998191999817119baf3031302d00100201224a229404c94ccc0ccc0e800454ccc0cccdc480081a899299981a181d8008a99981a19b890010361325333035303c001153330353371200206e264a66606c607a6eb4c0d0c0c00044c94ccc0dccdc4981d1bad3035001303a375a606a606c002205e2c60600022c60660122c2c6eb4c0c8c0cc01c5858dd698188030b0b1bad303000716302f007161616375a605c0102c2c60540022c6eb0c0b001cc0b0004c0ac004c0a8004c0a4004c0a0004c09c004c0854ccc09cc0b00084c8cccc094894ccc0ac004489400454ccc0a8cdd7981a1814000801899111801001981a9814000898011814800802919191900229998159817981a801099191919192999818299811981a0008981b00089919191919191919299981c181e1821000899191919299981e19baf374e6076004a08a26464646464072a666082607e00420702c6eb4c0f4004c0f4008dd6981d800981d8030b1ba8302d375a607200260720046eb4c0dc004c10c00458dd5181a800981a8011bad3033001303300453330333037303d002132323232323232323232035533303d303b005103416533303b303f002132323232320385333040303e005103716533303e30420021323232323203b53330433041005103a1653330413045002153330413047371a6eb8c0fc0044c80e94ccc108c10000440e4585854ccc104c11800854ccc104c11cdc69bae303f00113203a533304230400011039161616304b0023049001375460780022a66607c60860042646464646464078a666088608400420762c6eb4c100004c100008dd6981f000981f0011bad303c0011630480023046001375460720022a6660766080004264068a66607800220662c2c608a00460860026ea8c0d8004c0d80154ccc0d8c0e800854ccc0d8c0f0dc69bae303400113202f53330373035001102e161615333036303b00215333036303c371a6eb8c0d00044c80bd4ccc0dcc0d400440b8585858c100008c0f8004dd518188008b181e8009baa302f001302f00216371a6eb8c0b4004c0b4008dd6981580098158011980e1299981618191b8d375c00220022c6eb0c0a400458c0d4004dd50008b1ba9375c604a0022a66604e66e1d2004002132323232004533302a302e303400213232323232533302f533022303300113035001132323232323232325333037303b3041001132323232533303b3375e6e9cc0e800941104c8c8c8c8c80e14ccc100c0f800840dc58dd6981e000981e0011bad303a001303a00616375060586eb4c0e0004c0e0008dd6981b00098210008b1baa30340013034002375a60640026064008a666064606c6078004264646464646464646464068a666078607400a20662ca666074607c0042646464646406ea66607e607a00a206c2ca66607a608200426464646464074a666084608000a20722ca66608060880042a666080608c6e34dd7181f00089901ca999820981f800881c0b0b0a99982018228010a99982018231b8d375c607c002264072a666082607e00220702c2c2c609400460900026ea8c0ec00454ccc0f4c1080084c8c8c8c8c8c80ed4ccc10cc10400840e858dd6981f800981f8011bad303d001303d002375a60760022c608e004608a0026ea8c0e000454ccc0e8c0fc0084c80cd4ccc0ec00440c85858c110008c108004dd5181a800981a802a99981a981c8010a99981a981d9b8d375c606600226405ca66606c6068002205a2c2c2a66606a60740042a66606a60766e34dd71819800899017299981b181a00088168b0b0b181f801181e8009baa303000116303c0013754605c002605c0042c6e34dd7181600098160011bad302a001302a0023301b2533302b3031371a6eb8004400458dd618140008b181a0009baa0013025001163031002302f0013754604460460046eacc084c088c08803058c084c070cccc0788c94ccc090c0a4cc068dd59811181180080a09980e80198110008a50301d001002200116301f0053758603c0142c6eb4c074004c074004c05c0304054c058c068c06cc05800458c06000458c090004dd5180b180b802180b180b180b180b180b180b000980a980a800980798098009807000918069129998098008a5eb804cc01cc00cc040004c008c04400494ccc03ccdc4800a40002c200246601c0022944888c00800d5d0111919998021bae300b3007002480008cccc014009200075a6eac00400cdd71805180598030009191111980591299980880088028a99980819baf301a300e00100613004301b300e00113002300f0010013752002931119baf374e60060046e9cc00c0048c048dd5000998011112999804800880109980199b8000248008c01c00520003001222533300800112250011533300730023005001132223002003300500113300300230060012323002233002002001230022330020020015742ae895cd2ab9f48202a35ae41cdc1240046e1d2000370e90011b87480e0dc4a40006e2520021374e97ae05573aaae79", + "role": "ValidatorRole", + "type": "PlutusScriptV2", + "version": "ScriptV2" +} \ No newline at end of file diff --git a/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrderConfigTracing b/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrderConfigTracing new file mode 100644 index 00000000..2aa91a96 --- /dev/null +++ b/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrderConfigTracing @@ -0,0 +1,11 @@ +{ + "cborHex": "590f7a590f770100003232323232323232323232323232323232323232323232323232323232323232323232323232322222323232323232533301e302a3030002132333301b233015002301e30170013758603a00c464a666042605a660266eacc07cc0800040344c8c8c94ccc090cccc084894ccc09c00448dc4802091299981419b8900500114a2264666604c44a666058002244a0022a66605666ebcc0a400400c4c06cc0a80044ccc008c0a80048c070cc074c0a8008004489400400c8ccc018c0a4014004cdc0001a4004266600a6050008006004604c0066eb0c088024dd61811001a40002646464a66604e66e24ccc0908894ccc0ac00440084cc00ccdc000118111bab303d3028001302900148000dd59812800a40282646464646464646464646464a6660666606044a66606c00229444c94ccc0d8cc0cc894ccc0e40045280a99981c19baf303600100314a226004606e002606a00429404c00cc0d4008c0cc0040044c94ccc0d0cdc4800a40282a6660686088002264a66606a608a0022a66606a66e2400400854ccc0d4cdd79819981a0099819804099299981b1999819119baf3035302e00100201224a229404c94ccc0dcc11800454ccc0dccdc4800820099299981c18238008a99981c19b89001041132533303930480011533303933712002084264a66607460926eb4c0e0c0c40044c94ccc0eccdc498229bad30390013045375a60726074002205e2a6606292011468696768206d616b65722066656520726174696f0016303100115330304901186e65676174697665206d616b65722066656520726174696f00163037009153302f49011468696768206d696e20616461206465706f7369740016153302f491186e65676174697665206d696e20616461206465706f7369740016375a606c606e00e2a6605c92010e686967682074616b6572206665650016153302e491126e656761746976652074616b6572206665650016375a606a00c2a6605a9201136869676820666c6174206d616b6572206665650016153302d491176e6567617469766520666c6174206d616b6572206665650016375a606800e2a660589201176e6f74207061696420746f20666565206164647265737300163033007153302b490115706f63644e667453796d626f6c206368616e6765640016153302b4911d746f6f206d616e79207265717569726564207369676e61746f726965730016153302b4912b6e6f6e2d706f736974697665206e756d626572206f66207265717569726564207369676e61746f726965730016375a60640102a660549201186e6f6e2d706f736974697665207369676e61746f726965730016153302a49114746f6f206d616e79207369676e61746f726965730016302b00115330294901156475706c6963617465207369676e61746f7269657300163758606000e6060002605e002605c002605a002605800260560026044a666056606c0042a660429201156578706563746564206f757470757420646174756d00161533302b3038002132323232004533302e30393040002132323232325333033533022303e0011304100113232323232323232533303b3046304d001132323232533303f3375e6e9cc0f800941404c8c8c8c8c80e14ccc110c10800840dc54cc0e412058dd6982000098200011bad303e001303e006153303504316375060586eb4c0f0004c0f0008dd6981d00098270008a998188208b1baa30380013038002375a606c002606c008a66606c60826090004264646464646464646464068a666080607c00a20662a6606a0882ca66607c60920042646464646406ea666086608200a206c2a6607008e2ca666082609800426464646464074a66608c608800a20722a660760942ca666088609e0042a66608860a46e34dd7182100089901ca9998229821800881c0a9981d0248b0a9981d0258b0a99982218280010a99982218291b8d375c6084002264072a66608a608600220702a660740922c2a660740982c2a6607408c2c60ac00460a80026ea8c0fc00454ccc104c1340084c8c8c8c8c8c80ed4ccc11cc11400840e854cc0f012c58dd6982180098218011bad30410013041002375a607e0022a6606e0862c60a600460a20026ea8c0f000454ccc0f8c1280084c80cd4ccc0fc00440c854cc0d010c5854cc0d010058c140008c138004dd5181c800981c802a99981c98220010a99981c98239b8d375c606e00226405ca6660746070002205a2a6605e07c2c2a6605e0802c2a666072608a0042a666072608e6e34dd7181b800899017299981d181c00088168a9981781f0b0a998178208b0a9981781d8b182580118248009baa3034001153302c0381630480013754606400260640042a6605206c2c6e34dd7181800098180011bad302e001302e0023301b2533302f303d371a6eb8004400454cc0940d858dd618160008a998120180b18200009baa0013029001132333302922533302f00112250011533302e3375e608060580020062644460040066082605800226004605a00200a4646464008a66605e6074608200426464646464a666068a66046607e0022608400226464646464646464a666078608e609c002264646464a66608066ebcdd3981f80128288991919191901ca9998229821801081c0a9981d0248b1bad30410013041002375a607e002607e00c2a6606c0882c6ea0c0b4dd6981e800981e8011bad303b001304f0011533032042163754607200260720046eb4c0dc004c0dc0114ccc0dcc108c1240084c8c8c8c8c8c8c8c8c8c80d54ccc104c0fc01440d054cc0d8114594ccc0fcc1280084c8c8c8c8c80e14ccc110c10801440dc54cc0e4120594ccc108c1340084c8c8c8c8c80ed4ccc11cc11401440e854cc0f012c594ccc114c14000854ccc114c14cdc69bae304300113203a533304630440011039153303b04a16153303b04c16153330453051002153330453053371a6eb8c10c0044c80e94ccc118c11000440e454cc0ec1285854cc0ec1345854cc0ec11c58c15c008c154004dd518200008a9998211827001099191919191901e29998241823001081d8a9981e8260b1bad30440013044002375a608400260840046eb4c10000454cc0e011058c150008c148004dd5181e8008a99981f982580109901a299982000088198a9981a8220b0a9981a8208b182880118278009baa303a001303a005533303a30450021533303a3048371a6eb8c0e00044c80bd4ccc0ecc0e400440b854cc0c00fc5854cc0c01045854ccc0e8c11800854ccc0e8c120dc69bae303800113202f533303b3039001102e153303003f16153303004216153303003c16304c002304a0013754606a0022a6605a0722c60920026ea8c0cc004c0cc00854cc0a80dc58dc69bae30310013031002375a605e002605e004660384a666060607c6e34dd700088008a9981301b8b1bac302d001153302503116304100137540022a66044921166f757470757420646174756d206e6f7420666f756e64001637526eb8c0a4004c0f4008c0ec004dd5181318138011bab30253026302600c153301d49132636f6e74696e75696e67206f757470757427732076616c75652073686f756c642068617665203c3d20313020746f6b656e7300163025301d3333022232533302830343301a3756604c604e00202826603a006604c0022940c078004008800454cc0712411a6e6f20636f6e74696e75696e67206f757470757420666f756e6400163023005375860440142a66034921146d697373696e67207369676e61747572652873290016375a604200260420026030018202a602e603c603e602e0022a6602a921605061747465726e206d61746368206661696c75726520696e2027646f2720626c6f636b206174207372632f47656e6975735969656c642f4f6e436861696e2f4445582f5061727469616c4f72646572436f6e6669672e68733a35333a392d32320016301c00115330144901605061747465726e206d61746368206661696c75726520696e2027646f2720626c6f636b206174207372632f47656e6975735969656c642f4f6e436861696e2f4445582f5061727469616c4f72646572436f6e6669672e68733a35313a392d323300163030001375460346036008603460346034603460346034002603260320026020602e002601e0024602244a66602e002297ae01330073003301400130023015001253330133371200290000a9980499b964912a70747279506f7369746976653a206275696c64696e672077697468206e6f6e20706f7369746976653a2000300c00116100123301200114a24446004006ae8088c8cccc010dd718079804001240004666600a00490003ad37560020066eb8c038c03cc01c0048c8888cc03c894ccc054004401454ccc050cdd79813180900080309802181398090008980118098008009ba900149888cdd79ba73004002374e6008002ae708c074dd5000998029112999806000880109980199b8000248008c028005200030042232323372ca66601666e2000d20001491012d00149100533300b30160021300500113372c6008004600a00266e14c0140092014337086008002900a1299980398090008a4810130001533300730130011490101310015333007301400114901013200153330073370e90030008a49013300153330073370e90040008a49013400153330073370e90050008a49013500153330073370e90060008a49013600153330073370e90070008a49013700153330073370e90080008a49013800153330073370e90090008a490139001625333006337120029000899b81480000044004c0048894ccc020004489400454ccc01cc008c0140044c888c00800cc0140044cc00c008c0180048c8c0088cc0080080048c0088cc0080080055d0aba25734aae7d24013f7265616368656420656e64206f662073756d207768696c65207374696c6c206e6f7420686176696e6720666f756e642074686520636f6e7374727563746f72004901387074727946726f6d2843757272656e637953796d626f6c293a206d757374206265203238206279746573206c6f6e67206f7220656d707479004901337074727946726f6d2850526174696f6e616c44617461293a20636f6e7374727563746f72206669656c6473206c656e203e2032004901317074727946726f6d2850446174615265636f72645b5d293a206c697374206973206c6f6e676572207468616e207a65726f0049012f7074727946726f6d2850526174696f6e616c44617461293a20696e76616c696420636f6e7374727563746f722069640049012c7074727946726f6d28505075624b657948617368293a206d757374206265203238206279746573206c6f6e670049012c7074727946726f6d285053637269707448617368293a206d757374206265203238206279746573206c6f6e670048202a35ae41cdc1240046e1d2000370e90011b8748010dc3a40706e2520003712900109ba74bd702ab9d5573d", + "description": "DEX.PartialOrderConfigTracing", + "params": [ + "PlutusLedgerApi.V1.Value:AssetClass" + ], + "rawHex": "590f770100003232323232323232323232323232323232323232323232323232323232323232323232323232322222323232323232533301e302a3030002132333301b233015002301e30170013758603a00c464a666042605a660266eacc07cc0800040344c8c8c94ccc090cccc084894ccc09c00448dc4802091299981419b8900500114a2264666604c44a666058002244a0022a66605666ebcc0a400400c4c06cc0a80044ccc008c0a80048c070cc074c0a8008004489400400c8ccc018c0a4014004cdc0001a4004266600a6050008006004604c0066eb0c088024dd61811001a40002646464a66604e66e24ccc0908894ccc0ac00440084cc00ccdc000118111bab303d3028001302900148000dd59812800a40282646464646464646464646464a6660666606044a66606c00229444c94ccc0d8cc0cc894ccc0e40045280a99981c19baf303600100314a226004606e002606a00429404c00cc0d4008c0cc0040044c94ccc0d0cdc4800a40282a6660686088002264a66606a608a0022a66606a66e2400400854ccc0d4cdd79819981a0099819804099299981b1999819119baf3035302e00100201224a229404c94ccc0dcc11800454ccc0dccdc4800820099299981c18238008a99981c19b89001041132533303930480011533303933712002084264a66607460926eb4c0e0c0c40044c94ccc0eccdc498229bad30390013045375a60726074002205e2a6606292011468696768206d616b65722066656520726174696f0016303100115330304901186e65676174697665206d616b65722066656520726174696f00163037009153302f49011468696768206d696e20616461206465706f7369740016153302f491186e65676174697665206d696e20616461206465706f7369740016375a606c606e00e2a6605c92010e686967682074616b6572206665650016153302e491126e656761746976652074616b6572206665650016375a606a00c2a6605a9201136869676820666c6174206d616b6572206665650016153302d491176e6567617469766520666c6174206d616b6572206665650016375a606800e2a660589201176e6f74207061696420746f20666565206164647265737300163033007153302b490115706f63644e667453796d626f6c206368616e6765640016153302b4911d746f6f206d616e79207265717569726564207369676e61746f726965730016153302b4912b6e6f6e2d706f736974697665206e756d626572206f66207265717569726564207369676e61746f726965730016375a60640102a660549201186e6f6e2d706f736974697665207369676e61746f726965730016153302a49114746f6f206d616e79207369676e61746f726965730016302b00115330294901156475706c6963617465207369676e61746f7269657300163758606000e6060002605e002605c002605a002605800260560026044a666056606c0042a660429201156578706563746564206f757470757420646174756d00161533302b3038002132323232004533302e30393040002132323232325333033533022303e0011304100113232323232323232533303b3046304d001132323232533303f3375e6e9cc0f800941404c8c8c8c8c80e14ccc110c10800840dc54cc0e412058dd6982000098200011bad303e001303e006153303504316375060586eb4c0f0004c0f0008dd6981d00098270008a998188208b1baa30380013038002375a606c002606c008a66606c60826090004264646464646464646464068a666080607c00a20662a6606a0882ca66607c60920042646464646406ea666086608200a206c2a6607008e2ca666082609800426464646464074a66608c608800a20722a660760942ca666088609e0042a66608860a46e34dd7182100089901ca9998229821800881c0a9981d0248b0a9981d0258b0a99982218280010a99982218291b8d375c6084002264072a66608a608600220702a660740922c2a660740982c2a6607408c2c60ac00460a80026ea8c0fc00454ccc104c1340084c8c8c8c8c8c80ed4ccc11cc11400840e854cc0f012c58dd6982180098218011bad30410013041002375a607e0022a6606e0862c60a600460a20026ea8c0f000454ccc0f8c1280084c80cd4ccc0fc00440c854cc0d010c5854cc0d010058c140008c138004dd5181c800981c802a99981c98220010a99981c98239b8d375c606e00226405ca6660746070002205a2a6605e07c2c2a6605e0802c2a666072608a0042a666072608e6e34dd7181b800899017299981d181c00088168a9981781f0b0a998178208b0a9981781d8b182580118248009baa3034001153302c0381630480013754606400260640042a6605206c2c6e34dd7181800098180011bad302e001302e0023301b2533302f303d371a6eb8004400454cc0940d858dd618160008a998120180b18200009baa0013029001132333302922533302f00112250011533302e3375e608060580020062644460040066082605800226004605a00200a4646464008a66605e6074608200426464646464a666068a66046607e0022608400226464646464646464a666078608e609c002264646464a66608066ebcdd3981f80128288991919191901ca9998229821801081c0a9981d0248b1bad30410013041002375a607e002607e00c2a6606c0882c6ea0c0b4dd6981e800981e8011bad303b001304f0011533032042163754607200260720046eb4c0dc004c0dc0114ccc0dcc108c1240084c8c8c8c8c8c8c8c8c8c80d54ccc104c0fc01440d054cc0d8114594ccc0fcc1280084c8c8c8c8c80e14ccc110c10801440dc54cc0e4120594ccc108c1340084c8c8c8c8c80ed4ccc11cc11401440e854cc0f012c594ccc114c14000854ccc114c14cdc69bae304300113203a533304630440011039153303b04a16153303b04c16153330453051002153330453053371a6eb8c10c0044c80e94ccc118c11000440e454cc0ec1285854cc0ec1345854cc0ec11c58c15c008c154004dd518200008a9998211827001099191919191901e29998241823001081d8a9981e8260b1bad30440013044002375a608400260840046eb4c10000454cc0e011058c150008c148004dd5181e8008a99981f982580109901a299982000088198a9981a8220b0a9981a8208b182880118278009baa303a001303a005533303a30450021533303a3048371a6eb8c0e00044c80bd4ccc0ecc0e400440b854cc0c00fc5854cc0c01045854ccc0e8c11800854ccc0e8c120dc69bae303800113202f533303b3039001102e153303003f16153303004216153303003c16304c002304a0013754606a0022a6605a0722c60920026ea8c0cc004c0cc00854cc0a80dc58dc69bae30310013031002375a605e002605e004660384a666060607c6e34dd700088008a9981301b8b1bac302d001153302503116304100137540022a66044921166f757470757420646174756d206e6f7420666f756e64001637526eb8c0a4004c0f4008c0ec004dd5181318138011bab30253026302600c153301d49132636f6e74696e75696e67206f757470757427732076616c75652073686f756c642068617665203c3d20313020746f6b656e7300163025301d3333022232533302830343301a3756604c604e00202826603a006604c0022940c078004008800454cc0712411a6e6f20636f6e74696e75696e67206f757470757420666f756e6400163023005375860440142a66034921146d697373696e67207369676e61747572652873290016375a604200260420026030018202a602e603c603e602e0022a6602a921605061747465726e206d61746368206661696c75726520696e2027646f2720626c6f636b206174207372632f47656e6975735969656c642f4f6e436861696e2f4445582f5061727469616c4f72646572436f6e6669672e68733a35333a392d32320016301c00115330144901605061747465726e206d61746368206661696c75726520696e2027646f2720626c6f636b206174207372632f47656e6975735969656c642f4f6e436861696e2f4445582f5061727469616c4f72646572436f6e6669672e68733a35313a392d323300163030001375460346036008603460346034603460346034002603260320026020602e002601e0024602244a66602e002297ae01330073003301400130023015001253330133371200290000a9980499b964912a70747279506f7369746976653a206275696c64696e672077697468206e6f6e20706f7369746976653a2000300c00116100123301200114a24446004006ae8088c8cccc010dd718079804001240004666600a00490003ad37560020066eb8c038c03cc01c0048c8888cc03c894ccc054004401454ccc050cdd79813180900080309802181398090008980118098008009ba900149888cdd79ba73004002374e6008002ae708c074dd5000998029112999806000880109980199b8000248008c028005200030042232323372ca66601666e2000d20001491012d00149100533300b30160021300500113372c6008004600a00266e14c0140092014337086008002900a1299980398090008a4810130001533300730130011490101310015333007301400114901013200153330073370e90030008a49013300153330073370e90040008a49013400153330073370e90050008a49013500153330073370e90060008a49013600153330073370e90070008a49013700153330073370e90080008a49013800153330073370e90090008a490139001625333006337120029000899b81480000044004c0048894ccc020004489400454ccc01cc008c0140044c888c00800cc0140044cc00c008c0180048c8c0088cc0080080048c0088cc0080080055d0aba25734aae7d24013f7265616368656420656e64206f662073756d207768696c65207374696c6c206e6f7420686176696e6720666f756e642074686520636f6e7374727563746f72004901387074727946726f6d2843757272656e637953796d626f6c293a206d757374206265203238206279746573206c6f6e67206f7220656d707479004901337074727946726f6d2850526174696f6e616c44617461293a20636f6e7374727563746f72206669656c6473206c656e203e2032004901317074727946726f6d2850446174615265636f72645b5d293a206c697374206973206c6f6e676572207468616e207a65726f0049012f7074727946726f6d2850526174696f6e616c44617461293a20696e76616c696420636f6e7374727563746f722069640049012c7074727946726f6d28505075624b657948617368293a206d757374206265203238206279746573206c6f6e670049012c7074727946726f6d285053637269707448617368293a206d757374206265203238206279746573206c6f6e670048202a35ae41cdc1240046e1d2000370e90011b8748010dc3a40706e2520003712900109ba74bd702ab9d5573d", + "role": "ValidatorRole", + "type": "PlutusScriptV2", + "version": "ScriptV2" +} \ No newline at end of file diff --git a/geniusyield-dex-api/data/compiled-scripts/minting-policy.txt b/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrderNFT similarity index 99% rename from geniusyield-dex-api/data/compiled-scripts/minting-policy.txt rename to geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrderNFT index 8b8521bc..9a49952e 100644 --- a/geniusyield-dex-api/data/compiled-scripts/minting-policy.txt +++ b/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrderNFT @@ -10,4 +10,4 @@ "role": "MintingPolicyRole", "type": "PlutusScriptV2", "version": "ScriptV2" -} +} \ No newline at end of file diff --git a/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrderNFTTracing b/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrderNFTTracing new file mode 100644 index 00000000..69d27e34 --- /dev/null +++ b/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrderNFTTracing @@ -0,0 +1,13 @@ +{ + "cborHex": "591b68591b650100003232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232322222232323232323232323232533303b3058305f00213232323232323232323232323232533304a001153303e491276d696e74656420746f6b656e73206c6973742073686f756c64206e6f7420626520656d7074792e0016153330495330373303c23303700f3049304000100815330373033304700115330373067375a60dc6090002266e3cdd7183698240008048991999823118349981b1bab304a3049304100100200823232533304d533304d306a307100214a0266e3c084dd7182600089919191919191919191919191919191919191919191919191919191919191929998361844809848008010991929998371845809849008010a9998371847808090a99983719b870110121533306e3371e6eb8c1b40640b854ccc1b8c22c0404054ccc1b8c23c0403854ccc1b8c150cc16c01801454ccc1b8cdc49bad306d003375a60da0022a6660dc66ebc03402454ccc1b8cdc38060140a999837198269bab306d306c306402430473330507006608600c6ea0048c11cccc141c0198218128440098239998283803304333056488100488100375004e6666608800c00a01201000e2a6660dc6116026eb401c54ccc1b94cc170cdc48151bad009133712609866096609405260920246eb402054ccc1b8c22c0403c417854cc18c204045854cc18c214045854cc18c1dc5854cc18c210045854cc18c1c05854cc18c1c45854cc18c1f45854cc18c1d05854cc18c208045854cc18c1fc5854cc18c20c045854cc18c1f05854cc18c200045854ccc1b8c23c0404854ccc1b8cdc38088090a99983719b8f375c60da03205c2a6660dc6116020202a6660dc611e0201c2a6660dc60a8660b600c00a2a6660dc94454ccc1b8cdd78068048a99983719b8700c0281533306e3304d375660da60d860c8048608e6660a0e00cc10c018dd400918239998283803304302508801304733305070066086660ac91100488100375004e6666608800c00a01201000e2a6660dc6116026eb401c54ccc1b94cc170cdc48151bad009133712609866096609405260920246eb402054ccc1b8c22c0403c417854cc18c204045854cc18c214045854cc18c1dc5854cc18c210045854cc18c1c05854cc18c1c45854cc18c1f45854cc18c1d05854cc18c208045854cc18c1fc5854cc18c20c045854cc18c1f05854cc18c2000458c24804004dd5183580a899191929998379848008098a99983799b870120131533306f3371e6eb8c1b80680bc54ccc1bcc2300404454ccc1bcc2400403c54ccc1bcc154cc17001c01854ccc1bd288a99983799baf00e00a1533306f3370e01a0522a6660de6609c6eacc1b8c1b4c194094c120ccc145c0198220039ba801330483330517006608804c1120260906660a2e00cc110cc15d2210048810037500506666608a00e00c0140120102a6660de6118026eb402054ccc1bd4cc174cdc48159bad00a133712609a66098609605460940266eb402454ccc1bcc23004040417c54cc190208045854cc190218045854cc1901e05854cc190214045854cc1901c45854cc1901c85854cc1901f85854cc1901d45854cc19020c045854cc190200045854cc190210045854cc1901f45854cc1902040458c24c04008c24404004dd5183580a9848008009baa3069014306801630670183066306500330650023064002306200130593062008375a60c201060c00106eb4c17cc158c17c030dd6982f182e8021bad305d006375a60b80186eb4c16c028c164004c160004c15c004c158004c154004c150004c14c004c148004c144004c140004c13c004c138c138c1194ccc140c1b400854cc115241156578706563746564206f757470757420646174756d001615333050306f002132323232004533305330703077002153330533073371a6eb8c1480044c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c94ccc194c20804c224040044c8c8c8c94ccc1a4cdd79ba73067002508c01132533306a337126e34dd71834800a4080264646464646464646464646464646464646464646464640e2a6661020260fc00420e02a660ea114022c6eb4c1f8004c1f00114ccc1f4c26804c284040084c8c8c8c8c8c81cd4ccc20c04c2000400841c854cc1dc2300458dd6984000800983f0011bad307e001307c002375a60f80022a660e4102022c6142020026ea8c1e8004c1e0008dd6983c000983b0011bad30760013074002375a60e800260e400aa6660e66120020042a6660e6612a026eb4c1c80044c81914ccc1d0c1c4004418c54cc1a01f45854cc1a020c045854ccc1ccc244040084c81914ccc1d0004418c54cc1a01f45854cc1a01dc58c25c04008c25404004dd518378009836802a9998371845808010a9998371848009bad306d00113205f533306f306c001105e153306307816153306307e161533306e308c0100213205f533306f001105e153306307816153306307216309201002309001001375460d400260d00022a660be0e42c60ce00c2a660bc0e02c6ea0c13cdd6983380098328011bad3065001308a01001153305a07016375460c600260c2008a6660c460fe610c02004264a6660c6a660ae6100020022610602002264a6660c866e24dc69bae3063001481004c81554ccc194c188004415054cc1641b85854cc1641b058c18400854cc1601a058dc69bae3061001153305706616308601001375460be00260ba0046eb4c174004c16c008dd6982d800982c802299982d183b983f001099299982da99827983c0008983d800899299982e19b89371a6eb8c16c005204013204d533305d305a001104c1533051066161533051064163059002153305006016371a6eb8c16400454cc13c17858c1f8004dd5182b800982a802299982b1839983d0010991919191919191919190282999830182e80288278a9982a0348b299982f183d80109919191919029a999831983000288290a9982b8360b2999830983f0010991919191902b29998331831802882a8a9982d0378b29998321840808010a9998321842009b8d375c60c60022640aaa6660ca60c400220a82a660b20dc2c2a660b20e02c2a6660c86104020042a6660c86108026e34dd7183180089902aa9998329831000882a0a9982c8370b0a9982c8388b0a9982c8340b1844008011843008009baa306000115333061307f0021323232323232057533306730640021056153305b07016375a60c800260c40046eb4c188004c180008dd698300008a9982b0328b1842808011841808009baa305d0011533305e307c00213204f533305f001104e153305306816153305306216308201002308001001375460b400260b000aa6660b260ec0042a6660b260f26e34dd7182c000899025299982d182b80088248a998270318b0a998270328b0a99982c983b8010a99982c983c9b8d375c60b0002264094a6660b460ae00220922a6609c0c62c2a6609c0cc2c2a6609c0ba2c60fa00460f60026ea8c15400454cc12c16858c1e8004dd5182980098288008a9982402f8b0a9982402b8b183b8009baa001304f001133333042232223002003307600137526eb8c13c0040348c8c8c80114ccc14cc1c0c1dc00854ccc14cc1ccdc69bae30520011323232323232323232323232323232323232533306530820130890100113232323253330693375e6e9cc19c0094230044c94ccc1a8cdc49b8d375c60d2002902009919191919191919191919191919191919191919191919038a99984080983f00108380a9983a845008b1bad307e001307c004533307d309a0130a10100213232323232320735333083013080010021072153307708c0116375a61000200260fc0046eb4c1f8004c1f0008dd6983e0008a99839040808b1850808009baa307a0013078002375a60f000260ec0046eb4c1d8004c1d0008dd6983a0009839002a9998399848008010a999839984a809bad3072001132064533307430710011063153306807d16153306808301161533307330910100213206453330740011063153306807d16153306807716309701002309501001375460de00260da00aa6660dc6116020042a6660dc6120026eb4c1b40044c817d4ccc1bcc1b0004417854cc18c1e05854cc18c1f85854ccc1b8c230040084c817d4ccc1bc004417854cc18c1e05854cc18c1c858c24804008c24004004dd5183500098340008a9982f8390b18338030a9982f0380b1ba8304f375a60ce00260ca0046eb4c194004c2280400454cc1681c058dd5183180098308022999831183f9843008010992999831a9982b9840008008984180800899299983219b89371a6eb8c18c0052040132055533306530620011054153305906e16153305906c163061002153305806816371a6eb8c18400454cc15c19858c21804004dd5182f800982e8011bad305d001305b002375a60b600260b2008a6660b460ee60fc004264a6660b6a6609e60f0002260f6002264a6660b866e24dc69bae305b001481004c81354ccc174c168004413054cc1441985854cc14419058c16400854cc14018058dc69bae3059001153304f05e16307e001375460ae00260aa008a6660ac60e660f40042646464646464646464640a0a6660c060ba00a209e2a660a80d22ca6660bc60f6004264646464640a6a6660c660c000a20a42a660ae0d82ca6660c260fc004264646464640aca6660cc60c600a20aa2a660b40de2ca6660c86102020042a6660c86108026e34dd7183180089902aa9998329831000882a0a9982c8370b0a9982c8380b0a9998321841008010a9998321842009b8d375c60c60022640aaa6660ca60c400220a82a660b20dc2c2a660b20e22c2a660b20d02c611002004610c020026ea8c18000454ccc184c1fc0084c8c8c8c8c8c815d4ccc19cc190008415854cc16c1c058dd6983200098310011bad30620013060002375a60c00022a660ac0ca2c610a020046106020026ea8c17400454ccc178c1f00084c813d4ccc17c004413854cc14c1a05854cc14c18858c20804008c20004004dd5182d000982c002a99982c983b0010a99982c983c9b8d375c60b0002264094a6660b460ae00220922a6609c0c62c2a6609c0ca2c2a6660b260ee0042a6660b260f26e34dd7182c000899025299982d182b80088248a998270318b0a998270330b0a9982702e8b183e801183d8009baa3055001153304b05a16307a001375460a600260a20022a660900be2c2a660900ae2c60ee0026ea800454cc115241166f757470757420646174756d206e6f7420666f756e64001630740023072001375460986096609660860062a660849201206578706563746564204e465420746f20676f20746f207468652073637269707400163071001375460946082609460820022a6607e9215f5061747465726e206d61746368206661696c75726520696e2027646f2720626c6f636b206174207372632f47656e6975735969656c642f4f6e436861696e2f4445582f5061727469616c4f726465724e46542e68733a3135343a31332d3233001633031016009153303e49016745787065637465643a20312e29205554784f20636f6e73756d7074696f6e2e20322e29204d696e74656420416d6f756e742073686f756c6420626520312e20332e292056616c696420546f6b656e206e616d652e20342e2920436f727265637420646174756d2e00163333039015010200116375a608c608a0126eb4c114020c110020dd698218041bab304230413032304100c375860820186eb0c100034dc919b8b375a607e607c0026eb8c0fcc0d8c0fc004c0d4010c0f0004c0ec004c0acc0c8cccc0e08c94cc0b0cc0acc0f40040444c170cc0a4dd5981e981e0008081819981e181d98198009bac303b00723232533303f305e30630021303e0011533034490115657870656374656420696e6c696e6520646174756d00163063001375460786076607660666078607660660022a66062921197265666572656e636520696e707574206e6f7420666f756e640016303a0011533303b3302e2305e375a60c2002666605801000640022c2a660609201156578706563746564206f6e6c79206275726e696e670016102b305f00137540146eacc0dc004c0d4c0d4004c0d0004c0cc004c0a8c0ccc0a80114ccc0ccc140c15c0084dd718190008a99814249565061747465726e206d61746368206661696c75726520696e2027646f2720626c6f636b206174207372632f47656e6975735969656c642f4f6e436861696e2f506c7574617263682f54782e68733a3134383a332d31360016305700137546060605e604e002446464a66605e66ebc00c12011c4cc01c008dd3198038008019816981618120019816181180111111199808b8033006330174881004881000033330117006600c00a0046600c008002446464a66605a66e24dd6801a400008a26600a0046e98cc01400400cc0acc0a8c08800cc0a8c08400888cc04ccdd800100082291980111919a999815180a000891280089118010019191118010019ba60011225001330032533302a3375e002086244a00224460040066eac00400488cc094894ccc0ac0041084c8ccc014c140c0a80088cc054cdd81828181580180080108009801181400080091198008012400446464644660020060046eb4c098c094008dd69812800980d80091180111180191191919191919191911980080180119b820023370600c00666e08004cdc1803001299981718258020a40002a66605c66e2401120001480045200233024533302d3371200400220022004a66605a66e2400800440084004c098008c094008cdc100200119b82004002232533302430022233710608400466e0920000011001153330243002223370e608400466e08c011c20008800899b8048008004c005c21119802119802918239bad304a0013756609200266600ae00008cc00c8dd31980211ba83020375a0026eac00400488cc07c894ccc0940040f04cc034cdd818241811800980218249811800980118110008009180e9129998118008a5115330103003302100113002302000122233300422374c66600c446ea0cc01cdd68011bad00137560046eac004008004888cccc07488cc004894ccc09400840044cccc010020c08c008c0880080048894ccc0980044cc03800c0084c8c8c94ccc0a0cdd780100089980899bb00023300b304d006304d00333300800d005302600415333028337206eb8008dd700089980880319998040060019813002002899808801999980400600300298130021825801182500218120008028010009100091001119980d800a504a24a66603466e240052000153300f3372c92012a70747279506f7369746976653a206275696c64696e672077697468206e6f6e20706f7369746976653a20003012001161001223374a9000198019ba900233003375200297ae05740ae8c88c8cccc010dd7180b9807001240004666600a00490003ad37560020066eb8c058c054c0340048c8888cc058894ccc070004401454ccc06ccdd7981f980d000803098021820180d00089801180c8008009ba9001223375e6e9cc02c008dd398058009119980a0010008a50230103010301030100014988cc0088c888c00800cdd5981b0009ba90012223300e2253330140011225001153330133375e606e60240020082600a60240022600460220020024601644a666022002294054cc010c00cc03c0044c008c0380048cc034004528ab9c230303754002600c444a6660186052002200426600600266e18008004c01488c8c8cdcb299980619b88003480005241012d00149100533300c30290021300500113372c6008004600a00266e14c0140092014337086008002900a1299980418128008a4810130001533300830260011490101310015333008302700114901013200153330083370e90030008a49013300153330083370e90040008a49013400153330083370e90050008a49013500153330083370e90060008a49013600153330083370e90070008a49013700153330083370e90080008a49013800153330083370e90090008a4901390016253330073371200290008980100088009b8148000c0048894ccc020004489400454ccc01cc008c0180044c888c00800cc0180044cc00c008c0140048c8c0088cc0080080048c0088cc0080080055d12ba15734aae7d24147706f6454616b65724c6f76656c616365466c6174466565206973206e6f74207468652073616d65206173206d656e74696f6e656420696e20636f6e66696720636f6e747261637400490143706f644d616b65724c6f76656c616365466c6174466565206973206e6f742073616d652061732074686174206d656e74696f6e656420706f63664c6f76656c616365730049013f7265616368656420656e64206f662073756d207768696c65207374696c6c206e6f7420686176696e6720666f756e642074686520636f6e7374727563746f72004901387074727946726f6d2843757272656e637953796d626f6c293a206d757374206265203238206279746573206c6f6e67206f7220656d70747900490134706f644f6666657265644173736574206d75737420626520646966666572656e74207468616e20706f6441736b65644173736574004901337074727946726f6d2850526174696f6e616c44617461293a20636f6e7374727563746f72206669656c6473206c656e203e2032004901327074727946726f6d28546f6b656e4e616d65293a206d757374206265206174206d6f7374203332204279746573206c6f6e6700490131706f636641736b6564546f6b656e7320696e20706f64436f6e7461696e65644665652073686f756c64206265207a65726f004901317074727946726f6d2850446174615265636f72645b5d293a206c697374206973206c6f6e676572207468616e207a65726f0049012f7074727946726f6d2850526174696f6e616c44617461293a20696e76616c696420636f6e7374727563746f722069640049012c7074727946726f6d28505075624b657948617368293a206d757374206265203238206279746573206c6f6e670049012c7074727946726f6d285053637269707448617368293a206d757374206265203238206279746573206c6f6e670049012b6f66666572656420616d6f756e742073686f756c6420657175616c206f726967696e616c20616d6f756e74004901296f7264657220656e642073686f756c646e2774206265206561726c696572207468616e207374617274004901257074727946726f6d28504f53495854696d65293a206d75737420626520706f736974697665004901246e756d626572206f66207061727469616c2066696c6c73206d757374206265207a65726f004901216f66666572656420616d6f756e742073686f756c6420626520706f7369746976650049011e636f6e7461696e6564207061796d656e74206d757374206265207a65726f00490119706f645072696365206d75737420626520706f7369746976650049011277726f6e67206e616d6520666f72204e46540049010d6f6666657220746f6f206c6f770049010c6665657320746f6f206c6f770010034c010100004c010101004bd6f7b6301b8248008dc3a40006e1d2002370e90021b87480e0dc4240006e2520001374e97ae05573aaae79", + "description": "DEX.PartialOrderNFTTracing", + "params": [ + "PlutusLedgerApi.V1.Scripts:ScriptHash", + "PlutusLedgerApi.V1.Address:Address", + "PlutusLedgerApi.V1.Value:AssetClass" + ], + "rawHex": "591b650100003232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232322222232323232323232323232533303b3058305f00213232323232323232323232323232533304a001153303e491276d696e74656420746f6b656e73206c6973742073686f756c64206e6f7420626520656d7074792e0016153330495330373303c23303700f3049304000100815330373033304700115330373067375a60dc6090002266e3cdd7183698240008048991999823118349981b1bab304a3049304100100200823232533304d533304d306a307100214a0266e3c084dd7182600089919191919191919191919191919191919191919191919191919191919191929998361844809848008010991929998371845809849008010a9998371847808090a99983719b870110121533306e3371e6eb8c1b40640b854ccc1b8c22c0404054ccc1b8c23c0403854ccc1b8c150cc16c01801454ccc1b8cdc49bad306d003375a60da0022a6660dc66ebc03402454ccc1b8cdc38060140a999837198269bab306d306c306402430473330507006608600c6ea0048c11cccc141c0198218128440098239998283803304333056488100488100375004e6666608800c00a01201000e2a6660dc6116026eb401c54ccc1b94cc170cdc48151bad009133712609866096609405260920246eb402054ccc1b8c22c0403c417854cc18c204045854cc18c214045854cc18c1dc5854cc18c210045854cc18c1c05854cc18c1c45854cc18c1f45854cc18c1d05854cc18c208045854cc18c1fc5854cc18c20c045854cc18c1f05854cc18c200045854ccc1b8c23c0404854ccc1b8cdc38088090a99983719b8f375c60da03205c2a6660dc6116020202a6660dc611e0201c2a6660dc60a8660b600c00a2a6660dc94454ccc1b8cdd78068048a99983719b8700c0281533306e3304d375660da60d860c8048608e6660a0e00cc10c018dd400918239998283803304302508801304733305070066086660ac91100488100375004e6666608800c00a01201000e2a6660dc6116026eb401c54ccc1b94cc170cdc48151bad009133712609866096609405260920246eb402054ccc1b8c22c0403c417854cc18c204045854cc18c214045854cc18c1dc5854cc18c210045854cc18c1c05854cc18c1c45854cc18c1f45854cc18c1d05854cc18c208045854cc18c1fc5854cc18c20c045854cc18c1f05854cc18c2000458c24804004dd5183580a899191929998379848008098a99983799b870120131533306f3371e6eb8c1b80680bc54ccc1bcc2300404454ccc1bcc2400403c54ccc1bcc154cc17001c01854ccc1bd288a99983799baf00e00a1533306f3370e01a0522a6660de6609c6eacc1b8c1b4c194094c120ccc145c0198220039ba801330483330517006608804c1120260906660a2e00cc110cc15d2210048810037500506666608a00e00c0140120102a6660de6118026eb402054ccc1bd4cc174cdc48159bad00a133712609a66098609605460940266eb402454ccc1bcc23004040417c54cc190208045854cc190218045854cc1901e05854cc190214045854cc1901c45854cc1901c85854cc1901f85854cc1901d45854cc19020c045854cc190200045854cc190210045854cc1901f45854cc1902040458c24c04008c24404004dd5183580a9848008009baa3069014306801630670183066306500330650023064002306200130593062008375a60c201060c00106eb4c17cc158c17c030dd6982f182e8021bad305d006375a60b80186eb4c16c028c164004c160004c15c004c158004c154004c150004c14c004c148004c144004c140004c13c004c138c138c1194ccc140c1b400854cc115241156578706563746564206f757470757420646174756d001615333050306f002132323232004533305330703077002153330533073371a6eb8c1480044c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c94ccc194c20804c224040044c8c8c8c94ccc1a4cdd79ba73067002508c01132533306a337126e34dd71834800a4080264646464646464646464646464646464646464646464640e2a6661020260fc00420e02a660ea114022c6eb4c1f8004c1f00114ccc1f4c26804c284040084c8c8c8c8c8c81cd4ccc20c04c2000400841c854cc1dc2300458dd6984000800983f0011bad307e001307c002375a60f80022a660e4102022c6142020026ea8c1e8004c1e0008dd6983c000983b0011bad30760013074002375a60e800260e400aa6660e66120020042a6660e6612a026eb4c1c80044c81914ccc1d0c1c4004418c54cc1a01f45854cc1a020c045854ccc1ccc244040084c81914ccc1d0004418c54cc1a01f45854cc1a01dc58c25c04008c25404004dd518378009836802a9998371845808010a9998371848009bad306d00113205f533306f306c001105e153306307816153306307e161533306e308c0100213205f533306f001105e153306307816153306307216309201002309001001375460d400260d00022a660be0e42c60ce00c2a660bc0e02c6ea0c13cdd6983380098328011bad3065001308a01001153305a07016375460c600260c2008a6660c460fe610c02004264a6660c6a660ae6100020022610602002264a6660c866e24dc69bae3063001481004c81554ccc194c188004415054cc1641b85854cc1641b058c18400854cc1601a058dc69bae3061001153305706616308601001375460be00260ba0046eb4c174004c16c008dd6982d800982c802299982d183b983f001099299982da99827983c0008983d800899299982e19b89371a6eb8c16c005204013204d533305d305a001104c1533051066161533051064163059002153305006016371a6eb8c16400454cc13c17858c1f8004dd5182b800982a802299982b1839983d0010991919191919191919190282999830182e80288278a9982a0348b299982f183d80109919191919029a999831983000288290a9982b8360b2999830983f0010991919191902b29998331831802882a8a9982d0378b29998321840808010a9998321842009b8d375c60c60022640aaa6660ca60c400220a82a660b20dc2c2a660b20e02c2a6660c86104020042a6660c86108026e34dd7183180089902aa9998329831000882a0a9982c8370b0a9982c8388b0a9982c8340b1844008011843008009baa306000115333061307f0021323232323232057533306730640021056153305b07016375a60c800260c40046eb4c188004c180008dd698300008a9982b0328b1842808011841808009baa305d0011533305e307c00213204f533305f001104e153305306816153305306216308201002308001001375460b400260b000aa6660b260ec0042a6660b260f26e34dd7182c000899025299982d182b80088248a998270318b0a998270328b0a99982c983b8010a99982c983c9b8d375c60b0002264094a6660b460ae00220922a6609c0c62c2a6609c0cc2c2a6609c0ba2c60fa00460f60026ea8c15400454cc12c16858c1e8004dd5182980098288008a9982402f8b0a9982402b8b183b8009baa001304f001133333042232223002003307600137526eb8c13c0040348c8c8c80114ccc14cc1c0c1dc00854ccc14cc1ccdc69bae30520011323232323232323232323232323232323232533306530820130890100113232323253330693375e6e9cc19c0094230044c94ccc1a8cdc49b8d375c60d2002902009919191919191919191919191919191919191919191919038a99984080983f00108380a9983a845008b1bad307e001307c004533307d309a0130a10100213232323232320735333083013080010021072153307708c0116375a61000200260fc0046eb4c1f8004c1f0008dd6983e0008a99839040808b1850808009baa307a0013078002375a60f000260ec0046eb4c1d8004c1d0008dd6983a0009839002a9998399848008010a999839984a809bad3072001132064533307430710011063153306807d16153306808301161533307330910100213206453330740011063153306807d16153306807716309701002309501001375460de00260da00aa6660dc6116020042a6660dc6120026eb4c1b40044c817d4ccc1bcc1b0004417854cc18c1e05854cc18c1f85854ccc1b8c230040084c817d4ccc1bc004417854cc18c1e05854cc18c1c858c24804008c24004004dd5183500098340008a9982f8390b18338030a9982f0380b1ba8304f375a60ce00260ca0046eb4c194004c2280400454cc1681c058dd5183180098308022999831183f9843008010992999831a9982b9840008008984180800899299983219b89371a6eb8c18c0052040132055533306530620011054153305906e16153305906c163061002153305806816371a6eb8c18400454cc15c19858c21804004dd5182f800982e8011bad305d001305b002375a60b600260b2008a6660b460ee60fc004264a6660b6a6609e60f0002260f6002264a6660b866e24dc69bae305b001481004c81354ccc174c168004413054cc1441985854cc14419058c16400854cc14018058dc69bae3059001153304f05e16307e001375460ae00260aa008a6660ac60e660f40042646464646464646464640a0a6660c060ba00a209e2a660a80d22ca6660bc60f6004264646464640a6a6660c660c000a20a42a660ae0d82ca6660c260fc004264646464640aca6660cc60c600a20aa2a660b40de2ca6660c86102020042a6660c86108026e34dd7183180089902aa9998329831000882a0a9982c8370b0a9982c8380b0a9998321841008010a9998321842009b8d375c60c60022640aaa6660ca60c400220a82a660b20dc2c2a660b20e22c2a660b20d02c611002004610c020026ea8c18000454ccc184c1fc0084c8c8c8c8c8c815d4ccc19cc190008415854cc16c1c058dd6983200098310011bad30620013060002375a60c00022a660ac0ca2c610a020046106020026ea8c17400454ccc178c1f00084c813d4ccc17c004413854cc14c1a05854cc14c18858c20804008c20004004dd5182d000982c002a99982c983b0010a99982c983c9b8d375c60b0002264094a6660b460ae00220922a6609c0c62c2a6609c0ca2c2a6660b260ee0042a6660b260f26e34dd7182c000899025299982d182b80088248a998270318b0a998270330b0a9982702e8b183e801183d8009baa3055001153304b05a16307a001375460a600260a20022a660900be2c2a660900ae2c60ee0026ea800454cc115241166f757470757420646174756d206e6f7420666f756e64001630740023072001375460986096609660860062a660849201206578706563746564204e465420746f20676f20746f207468652073637269707400163071001375460946082609460820022a6607e9215f5061747465726e206d61746368206661696c75726520696e2027646f2720626c6f636b206174207372632f47656e6975735969656c642f4f6e436861696e2f4445582f5061727469616c4f726465724e46542e68733a3135343a31332d3233001633031016009153303e49016745787065637465643a20312e29205554784f20636f6e73756d7074696f6e2e20322e29204d696e74656420416d6f756e742073686f756c6420626520312e20332e292056616c696420546f6b656e206e616d652e20342e2920436f727265637420646174756d2e00163333039015010200116375a608c608a0126eb4c114020c110020dd698218041bab304230413032304100c375860820186eb0c100034dc919b8b375a607e607c0026eb8c0fcc0d8c0fc004c0d4010c0f0004c0ec004c0acc0c8cccc0e08c94cc0b0cc0acc0f40040444c170cc0a4dd5981e981e0008081819981e181d98198009bac303b00723232533303f305e30630021303e0011533034490115657870656374656420696e6c696e6520646174756d00163063001375460786076607660666078607660660022a66062921197265666572656e636520696e707574206e6f7420666f756e640016303a0011533303b3302e2305e375a60c2002666605801000640022c2a660609201156578706563746564206f6e6c79206275726e696e670016102b305f00137540146eacc0dc004c0d4c0d4004c0d0004c0cc004c0a8c0ccc0a80114ccc0ccc140c15c0084dd718190008a99814249565061747465726e206d61746368206661696c75726520696e2027646f2720626c6f636b206174207372632f47656e6975735969656c642f4f6e436861696e2f506c7574617263682f54782e68733a3134383a332d31360016305700137546060605e604e002446464a66605e66ebc00c12011c4cc01c008dd3198038008019816981618120019816181180111111199808b8033006330174881004881000033330117006600c00a0046600c008002446464a66605a66e24dd6801a400008a26600a0046e98cc01400400cc0acc0a8c08800cc0a8c08400888cc04ccdd800100082291980111919a999815180a000891280089118010019191118010019ba60011225001330032533302a3375e002086244a00224460040066eac00400488cc094894ccc0ac0041084c8ccc014c140c0a80088cc054cdd81828181580180080108009801181400080091198008012400446464644660020060046eb4c098c094008dd69812800980d80091180111180191191919191919191911980080180119b820023370600c00666e08004cdc1803001299981718258020a40002a66605c66e2401120001480045200233024533302d3371200400220022004a66605a66e2400800440084004c098008c094008cdc100200119b82004002232533302430022233710608400466e0920000011001153330243002223370e608400466e08c011c20008800899b8048008004c005c21119802119802918239bad304a0013756609200266600ae00008cc00c8dd31980211ba83020375a0026eac00400488cc07c894ccc0940040f04cc034cdd818241811800980218249811800980118110008009180e9129998118008a5115330103003302100113002302000122233300422374c66600c446ea0cc01cdd68011bad00137560046eac004008004888cccc07488cc004894ccc09400840044cccc010020c08c008c0880080048894ccc0980044cc03800c0084c8c8c94ccc0a0cdd780100089980899bb00023300b304d006304d00333300800d005302600415333028337206eb8008dd700089980880319998040060019813002002899808801999980400600300298130021825801182500218120008028010009100091001119980d800a504a24a66603466e240052000153300f3372c92012a70747279506f7369746976653a206275696c64696e672077697468206e6f6e20706f7369746976653a20003012001161001223374a9000198019ba900233003375200297ae05740ae8c88c8cccc010dd7180b9807001240004666600a00490003ad37560020066eb8c058c054c0340048c8888cc058894ccc070004401454ccc06ccdd7981f980d000803098021820180d00089801180c8008009ba9001223375e6e9cc02c008dd398058009119980a0010008a50230103010301030100014988cc0088c888c00800cdd5981b0009ba90012223300e2253330140011225001153330133375e606e60240020082600a60240022600460220020024601644a666022002294054cc010c00cc03c0044c008c0380048cc034004528ab9c230303754002600c444a6660186052002200426600600266e18008004c01488c8c8cdcb299980619b88003480005241012d00149100533300c30290021300500113372c6008004600a00266e14c0140092014337086008002900a1299980418128008a4810130001533300830260011490101310015333008302700114901013200153330083370e90030008a49013300153330083370e90040008a49013400153330083370e90050008a49013500153330083370e90060008a49013600153330083370e90070008a49013700153330083370e90080008a49013800153330083370e90090008a4901390016253330073371200290008980100088009b8148000c0048894ccc020004489400454ccc01cc008c0180044c888c00800cc0180044cc00c008c0140048c8c0088cc0080080048c0088cc0080080055d12ba15734aae7d24147706f6454616b65724c6f76656c616365466c6174466565206973206e6f74207468652073616d65206173206d656e74696f6e656420696e20636f6e66696720636f6e747261637400490143706f644d616b65724c6f76656c616365466c6174466565206973206e6f742073616d652061732074686174206d656e74696f6e656420706f63664c6f76656c616365730049013f7265616368656420656e64206f662073756d207768696c65207374696c6c206e6f7420686176696e6720666f756e642074686520636f6e7374727563746f72004901387074727946726f6d2843757272656e637953796d626f6c293a206d757374206265203238206279746573206c6f6e67206f7220656d70747900490134706f644f6666657265644173736574206d75737420626520646966666572656e74207468616e20706f6441736b65644173736574004901337074727946726f6d2850526174696f6e616c44617461293a20636f6e7374727563746f72206669656c6473206c656e203e2032004901327074727946726f6d28546f6b656e4e616d65293a206d757374206265206174206d6f7374203332204279746573206c6f6e6700490131706f636641736b6564546f6b656e7320696e20706f64436f6e7461696e65644665652073686f756c64206265207a65726f004901317074727946726f6d2850446174615265636f72645b5d293a206c697374206973206c6f6e676572207468616e207a65726f0049012f7074727946726f6d2850526174696f6e616c44617461293a20696e76616c696420636f6e7374727563746f722069640049012c7074727946726f6d28505075624b657948617368293a206d757374206265203238206279746573206c6f6e670049012c7074727946726f6d285053637269707448617368293a206d757374206265203238206279746573206c6f6e670049012b6f66666572656420616d6f756e742073686f756c6420657175616c206f726967696e616c20616d6f756e74004901296f7264657220656e642073686f756c646e2774206265206561726c696572207468616e207374617274004901257074727946726f6d28504f53495854696d65293a206d75737420626520706f736974697665004901246e756d626572206f66207061727469616c2066696c6c73206d757374206265207a65726f004901216f66666572656420616d6f756e742073686f756c6420626520706f7369746976650049011e636f6e7461696e6564207061796d656e74206d757374206265207a65726f00490119706f645072696365206d75737420626520706f7369746976650049011277726f6e67206e616d6520666f72204e46540049010d6f6666657220746f6f206c6f770049010c6665657320746f6f206c6f770010034c010100004c010101004bd6f7b6301b8248008dc3a40006e1d2002370e90021b87480e0dc4240006e2520001374e97ae05573aaae79", + "role": "MintingPolicyRole", + "type": "PlutusScriptV2", + "version": "ScriptV2" +} \ No newline at end of file diff --git a/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrderNFTV1_1 b/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrderNFTV1_1 new file mode 100644 index 00000000..b82d91b7 --- /dev/null +++ b/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrderNFTV1_1 @@ -0,0 +1,13 @@ +{ + "cborHex": "591157591154010000323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323222222323232323232323232325333038303f304600213232323232323232323232323232533304700116153330465330393303e23303900f304630410010081533039303530440011533039304e375a60aa608a002266e3cdd7182a18228008048991999821918281981c1bab30473046304200100200823232533304a533304a3051305800214a0266e3c084dd7182480089919191919191919191919191919191919191919191919191919191919191929998349838983b80109919192999836183b8098a99983619b870120131533306c3371e6eb8c1ac0680bc54ccc1b0c1cc04454ccc1b0c1dc03c54ccc1b0c15ccc17801c01854ccc1b1288a99983619baf00e00a1533306c3370e01a0522a6660d86609e6eacc1acc1a8c198094c120ccc149c0198220039ba801330483330527006608804c0e060906660a4e00cc110cc16522010048810037500506666608a00e00c0140120102a6660d860e66eb402054ccc1b14cc17ccdc48159bad00a133712609c66098609605460940266eb402454ccc1b0c1cc040418458585858585858585858585858c1e8008c1e0004dd5183400a8991929998359839983c8010a999835983b0090a99983599b870110121533306b3371e6eb8c1a80640b854ccc1acc1c804054ccc1acc1d803854ccc1acc158cc17401801454ccc1ad288a99983599baf00d0091533306b3370e0180502a6660d66609c6eacc1a8c1a4c194090c11cccc145c0198218031ba801230473330517006608604a0de608e6660a2e00cc10ccc16122100488100375004e6666608800c00a01201000e2a6660d660e46eb401c54ccc1ad4cc178cdc48151bad009133712609a66096609405260920246eb402054ccc1acc1c803c41805858585858585858585858585854ccc1acc1d804854ccc1accdc38088090a99983599b8f375c60d403205c2a6660d660e40202a6660d660ec01c2a6660d660ac660ba00c00a2a6660d666e24dd698350019bad306a0011533306b3375e01a0122a6660d666e1c0300a054ccc1accc138dd59835183498328121823999828b80330430063750024608e6660a2e00cc10c0941bcc11cccc145c0198219982c244100488100375004e6666608800c00a01201000e2a6660d660e46eb401c54ccc1ad4cc178cdc48151bad009133712609a66096609405260920246eb402054ccc1acc1c803c418058585858585858585858585858c1e4004dd5183400a983b8009baa3066014306501630640183063306200330620023061002305f001305a305f008375a60bc01060ba0106eb4c170c15cc170030dd6982d982d0021bad305a006375a60b20186eb4c160028c158004c154004c150004c14c004c148004c144004c140004c13c004c138004c134004c130004c12cc12cc11d4ccc134c1540084ccccc1108c888c00800cc174004dd49bae304c00100d232323200453330503057305e00215333050305a371a6eb8c13c0044c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c94ccc188c1a4c1c00044c8c8c8c94ccc198cdd79ba7306400250731325333067337126e34dd71833000a4080264646464646464646464646464646464646464646464640e6a6660fc60f600420e42c6eb4c1ec004c1e40114ccc1e8c20404c220040084c8c8c8c8c8c81d54ccc20004c1f400841d058dd6983e800983d8011bad307b0013079002375a60f20022c6110020026ea8c1dc004c1d4008dd6983a80098398011bad30730013071002375a60e200260de00aa6660e060ee0042a6660e060f86eb4c1bc0044c81994ccc1c4c1b80044194585854ccc1c0c1e00084c81994ccc1c400441945858c1f8008c1f0004dd518360009835002a99983598390010a999835983b9bad306a001132061533306c3069001106016161533306b3073002132061533306c0011060161630790023077001375460ce00260ca0022c60c800c2c6ea0c144dd6983200098310011bad3062001307100116375460c000260bc008a6660be60cc60da004264a6660c0a660b260ce002260d4002264a6660c266e24dc69bae3060001481004c815d4ccc188c17c00441585858c17800858dc69bae305e00116306d001375460b800260b40046eb4c168004c160008dd6982c000982b002299982b982f1832801099299982c299828982f80089831000899299982c99b89371a6eb8c160005204013204f533305a3057001104e1616305600216371a6eb8c15800458c194004dd5182a00098290022999829982d1830801099191919191919191919029299982e982d00288288b299982d98310010991919191902aa999830182e802882a0b299982f18328010991919191902c29998319830002882b8b299983098340010a99983098359b8d375c60c00022640aea6660c460be00220ac2c2c2a6660c260d20042a6660c260d66e34dd7183000089902ba999831182f800882b0b0b0b183780118368009baa305d0011533305e3066002132323232323205953330643061002105816375a60c200260be0046eb4c17c004c174008dd6982e8008b183600118350009baa305a0011533305b3063002132051533305c0011050161630690023067001375460ae00260aa00aa6660ac60ba0042a6660ac60c06e34dd7182a800899026299982b982a00088258b0b0a99982b182f0010a99982b18301b8d375c60aa002264098a6660ae60a800220962c2c2c60c800460c40026ea8c14800458c184004dd5182800098270008b0b182f0009baa001161533304d305600213232323200453330503057305e00215333050305a371a6eb8c13c0044c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c94ccc188c1a4c1c00044c8c8c8c94ccc198cdd79ba7306400250731325333067337126e34dd71833000a4080264646464646464646464646464646464646464646464640e6a6660fc60f600420e42c6eb4c1ec004c1e40114ccc1e8c20404c220040084c8c8c8c8c8c81d54ccc20004c1f400841d058dd6983e800983d8011bad307b0013079002375a60f20022c6110020026ea8c1dc004c1d4008dd6983a80098398011bad30730013071002375a60e200260de00aa6660e060ee0042a6660e060f86eb4c1bc0044c81994ccc1c4c1b80044194585854ccc1c0c1e00084c81994ccc1c400441945858c1f8008c1f0004dd518360009835002a99983598390010a999835983b9bad306a001132061533306c3069001106016161533306b3073002132061533306c0011060161630790023077001375460ce00260ca0022c60c800c2c6ea0c144dd6983200098310011bad3062001307100116375460c000260bc008a6660be60cc60da004264a6660c0a660b260ce002260d4002264a6660c266e24dc69bae3060001481004c815d4ccc188c17c00441585858c17800858dc69bae305e00116306d001375460b800260b40046eb4c168004c160008dd6982c000982b002299982b982f1832801099299982c299828982f80089831000899299982c99b89371a6eb8c160005204013204f533305a3057001104e1616305600216371a6eb8c15800458c194004dd5182a00098290022999829982d1830801099191919191919191919029299982e982d00288288b299982d98310010991919191902aa999830182e802882a0b299982f18328010991919191902c29998319830002882b8b299983098340010a99983098359b8d375c60c00022640aea6660c460be00220ac2c2c2a6660c260d20042a6660c260d66e34dd7183000089902ba999831182f800882b0b0b0b183780118368009baa305d0011533305e3066002132323232323205953330643061002105816375a60c200260be0046eb4c17c004c174008dd6982e8008b183600118350009baa305a0011533305b3063002132051533305c0011050161630690023067001375460ae00260aa00aa6660ac60ba0042a6660ac60c06e34dd7182a800899026299982b982a00088258b0b0a99982b182f0010a99982b18301b8d375c60aa002264098a6660ae60a800220962c2c2c60c800460c40026ea8c14800458c184004dd5182800098270008b0b182f0009baa001304c00116305b0023059001375460926090609060880062c60b00026ea8c11cc108c11cc10800458cc0cc05802458cccc0ec054040800458dd6982198210049bad30420083041008375a60800106eacc0fcc0f8c0d0c0f8030dd6181f0061bac303d00d372466e2cdd6981e181d8009bae303c3037303c001303600430390013038001302d3033333303523253302e3302d303a001011130433302b37566074607200202060686072607060680026eb0c0e001c8c8c94ccc0f0c114c1280084c0ec00458c128004dd5181c981c181c181a181c981c181a0008b181b8008a99981c19818118229bad3048001333302e00800320011616102d304600137540146eacc0d0004c0c8c0c8004c0c4004c0c0004c0acc0c0c0ac0114ccc0c0c0dcc0f80084dd718178008b181f0009baa302d302c3028001223232533302c3375e00605e05c26600e0046e98cc01c00400cc0a8c0a4c09400cc0a4c09000888888ccc049c0198031980ca45004881000033330127006600c00a0046600c008002446464a66605466e24dd6801a400005826600a0046e98cc01400400cc0a0c09cc08c00cc09cc08800888cc054cdd800100081611980111919a999813980b000891280089118010019191118010019ba6001122500133003253330273375e002054244a00224460040066eac00400488cc088894ccc0a00040a44c8ccc014c0dcc09c0088cc05ccdd8181b981400180080108009801181280080091198008012400446464644660020060046eb4c08cc088008dd69811000980e00091180111180191191919191919191911980080180119b820023370600c00666e08004cdc1803001299981598190020a40002a66605666e2401120001480045200233025533302a3371200400220022004a66605466e2400800440084004c028008c024008cdc100200119b8200400225333020337120029000898050008800919299981018011119b8830280023370490000008a99981018011119b873028002337046008e1000440044cdc0800a400420026002e1088cc0108cc0148c0b4dd698180009bab302f0013330057000046600646e98cc0108dd418059bad0013756002002446603644a66604200204426601c66ec0c0b8c07c004c010c0bcc07c004c008c0780040048c064894ccc07c0045288a998089801980e80089801180e000911199802111ba63330062237506600e6eb4008dd68009bab00237560020040024446666032446600244a666042004200226666008010603e004603c004002444a66604400226601e0060042646464a66604866ebc0080044cc048cdd8001198059819803181980199980400680298110020a99981219b90375c0046eb80044cc048018cccc02003000cc0880100144cc04800ccccc020030018014c088010c0c4008c0c0010c0800040140080048800488008dc0a4000466602c002941289299980a99b890014800058400488cdd2a4000660066ea4008cc00cdd4800a5eb815d02ba322323333004375c6024601a00490001199980280124000eb4dd58008019bae30113010300c001232222330112253330170011005153330163375e6048602a00200c26008604a602a0022600460280020026ea400488cdd79ba7300a002374e60140024466601e00400229408c02cc02cc02cc02c00526233002232223002003375660360026ea4004888cc024894ccc03c004489400454ccc038cdd7980e1806800802098029806800898011806000800918031129998060008a5015330043003300a00113002300900123300800114a24602c6ea8004c0088894ccc020c03c00440084cc00c004cdc30010009800911299980400089128008a9998039801180300089911180100198030008998018011802800919180111980100100091801119801001000aba25742ae6955cf8801a610100004c010101004bd6f7b6301b8248008dc3a40006e1d2002370e90021b87480e0dc4240006e2520001374e97ae05573aaae79", + "description": "DEX.PartialOrderNFTV1_1", + "params": [ + "PlutusLedgerApi.V1.Scripts:ScriptHash", + "PlutusLedgerApi.V1.Address:Address", + "PlutusLedgerApi.V1.Value:AssetClass" + ], + "rawHex": "591154010000323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323222222323232323232323232325333038303f304600213232323232323232323232323232533304700116153330465330393303e23303900f304630410010081533039303530440011533039304e375a60aa608a002266e3cdd7182a18228008048991999821918281981c1bab30473046304200100200823232533304a533304a3051305800214a0266e3c084dd7182480089919191919191919191919191919191919191919191919191919191919191929998349838983b80109919192999836183b8098a99983619b870120131533306c3371e6eb8c1ac0680bc54ccc1b0c1cc04454ccc1b0c1dc03c54ccc1b0c15ccc17801c01854ccc1b1288a99983619baf00e00a1533306c3370e01a0522a6660d86609e6eacc1acc1a8c198094c120ccc149c0198220039ba801330483330527006608804c0e060906660a4e00cc110cc16522010048810037500506666608a00e00c0140120102a6660d860e66eb402054ccc1b14cc17ccdc48159bad00a133712609c66098609605460940266eb402454ccc1b0c1cc040418458585858585858585858585858c1e8008c1e0004dd5183400a8991929998359839983c8010a999835983b0090a99983599b870110121533306b3371e6eb8c1a80640b854ccc1acc1c804054ccc1acc1d803854ccc1acc158cc17401801454ccc1ad288a99983599baf00d0091533306b3370e0180502a6660d66609c6eacc1a8c1a4c194090c11cccc145c0198218031ba801230473330517006608604a0de608e6660a2e00cc10ccc16122100488100375004e6666608800c00a01201000e2a6660d660e46eb401c54ccc1ad4cc178cdc48151bad009133712609a66096609405260920246eb402054ccc1acc1c803c41805858585858585858585858585854ccc1acc1d804854ccc1accdc38088090a99983599b8f375c60d403205c2a6660d660e40202a6660d660ec01c2a6660d660ac660ba00c00a2a6660d666e24dd698350019bad306a0011533306b3375e01a0122a6660d666e1c0300a054ccc1accc138dd59835183498328121823999828b80330430063750024608e6660a2e00cc10c0941bcc11cccc145c0198219982c244100488100375004e6666608800c00a01201000e2a6660d660e46eb401c54ccc1ad4cc178cdc48151bad009133712609a66096609405260920246eb402054ccc1acc1c803c418058585858585858585858585858c1e4004dd5183400a983b8009baa3066014306501630640183063306200330620023061002305f001305a305f008375a60bc01060ba0106eb4c170c15cc170030dd6982d982d0021bad305a006375a60b20186eb4c160028c158004c154004c150004c14c004c148004c144004c140004c13c004c138004c134004c130004c12cc12cc11d4ccc134c1540084ccccc1108c888c00800cc174004dd49bae304c00100d232323200453330503057305e00215333050305a371a6eb8c13c0044c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c94ccc188c1a4c1c00044c8c8c8c94ccc198cdd79ba7306400250731325333067337126e34dd71833000a4080264646464646464646464646464646464646464646464640e6a6660fc60f600420e42c6eb4c1ec004c1e40114ccc1e8c20404c220040084c8c8c8c8c8c81d54ccc20004c1f400841d058dd6983e800983d8011bad307b0013079002375a60f20022c6110020026ea8c1dc004c1d4008dd6983a80098398011bad30730013071002375a60e200260de00aa6660e060ee0042a6660e060f86eb4c1bc0044c81994ccc1c4c1b80044194585854ccc1c0c1e00084c81994ccc1c400441945858c1f8008c1f0004dd518360009835002a99983598390010a999835983b9bad306a001132061533306c3069001106016161533306b3073002132061533306c0011060161630790023077001375460ce00260ca0022c60c800c2c6ea0c144dd6983200098310011bad3062001307100116375460c000260bc008a6660be60cc60da004264a6660c0a660b260ce002260d4002264a6660c266e24dc69bae3060001481004c815d4ccc188c17c00441585858c17800858dc69bae305e00116306d001375460b800260b40046eb4c168004c160008dd6982c000982b002299982b982f1832801099299982c299828982f80089831000899299982c99b89371a6eb8c160005204013204f533305a3057001104e1616305600216371a6eb8c15800458c194004dd5182a00098290022999829982d1830801099191919191919191919029299982e982d00288288b299982d98310010991919191902aa999830182e802882a0b299982f18328010991919191902c29998319830002882b8b299983098340010a99983098359b8d375c60c00022640aea6660c460be00220ac2c2c2a6660c260d20042a6660c260d66e34dd7183000089902ba999831182f800882b0b0b0b183780118368009baa305d0011533305e3066002132323232323205953330643061002105816375a60c200260be0046eb4c17c004c174008dd6982e8008b183600118350009baa305a0011533305b3063002132051533305c0011050161630690023067001375460ae00260aa00aa6660ac60ba0042a6660ac60c06e34dd7182a800899026299982b982a00088258b0b0a99982b182f0010a99982b18301b8d375c60aa002264098a6660ae60a800220962c2c2c60c800460c40026ea8c14800458c184004dd5182800098270008b0b182f0009baa001161533304d305600213232323200453330503057305e00215333050305a371a6eb8c13c0044c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c94ccc188c1a4c1c00044c8c8c8c94ccc198cdd79ba7306400250731325333067337126e34dd71833000a4080264646464646464646464646464646464646464646464640e6a6660fc60f600420e42c6eb4c1ec004c1e40114ccc1e8c20404c220040084c8c8c8c8c8c81d54ccc20004c1f400841d058dd6983e800983d8011bad307b0013079002375a60f20022c6110020026ea8c1dc004c1d4008dd6983a80098398011bad30730013071002375a60e200260de00aa6660e060ee0042a6660e060f86eb4c1bc0044c81994ccc1c4c1b80044194585854ccc1c0c1e00084c81994ccc1c400441945858c1f8008c1f0004dd518360009835002a99983598390010a999835983b9bad306a001132061533306c3069001106016161533306b3073002132061533306c0011060161630790023077001375460ce00260ca0022c60c800c2c6ea0c144dd6983200098310011bad3062001307100116375460c000260bc008a6660be60cc60da004264a6660c0a660b260ce002260d4002264a6660c266e24dc69bae3060001481004c815d4ccc188c17c00441585858c17800858dc69bae305e00116306d001375460b800260b40046eb4c168004c160008dd6982c000982b002299982b982f1832801099299982c299828982f80089831000899299982c99b89371a6eb8c160005204013204f533305a3057001104e1616305600216371a6eb8c15800458c194004dd5182a00098290022999829982d1830801099191919191919191919029299982e982d00288288b299982d98310010991919191902aa999830182e802882a0b299982f18328010991919191902c29998319830002882b8b299983098340010a99983098359b8d375c60c00022640aea6660c460be00220ac2c2c2a6660c260d20042a6660c260d66e34dd7183000089902ba999831182f800882b0b0b0b183780118368009baa305d0011533305e3066002132323232323205953330643061002105816375a60c200260be0046eb4c17c004c174008dd6982e8008b183600118350009baa305a0011533305b3063002132051533305c0011050161630690023067001375460ae00260aa00aa6660ac60ba0042a6660ac60c06e34dd7182a800899026299982b982a00088258b0b0a99982b182f0010a99982b18301b8d375c60aa002264098a6660ae60a800220962c2c2c60c800460c40026ea8c14800458c184004dd5182800098270008b0b182f0009baa001304c00116305b0023059001375460926090609060880062c60b00026ea8c11cc108c11cc10800458cc0cc05802458cccc0ec054040800458dd6982198210049bad30420083041008375a60800106eacc0fcc0f8c0d0c0f8030dd6181f0061bac303d00d372466e2cdd6981e181d8009bae303c3037303c001303600430390013038001302d3033333303523253302e3302d303a001011130433302b37566074607200202060686072607060680026eb0c0e001c8c8c94ccc0f0c114c1280084c0ec00458c128004dd5181c981c181c181a181c981c181a0008b181b8008a99981c19818118229bad3048001333302e00800320011616102d304600137540146eacc0d0004c0c8c0c8004c0c4004c0c0004c0acc0c0c0ac0114ccc0c0c0dcc0f80084dd718178008b181f0009baa302d302c3028001223232533302c3375e00605e05c26600e0046e98cc01c00400cc0a8c0a4c09400cc0a4c09000888888ccc049c0198031980ca45004881000033330127006600c00a0046600c008002446464a66605466e24dd6801a400005826600a0046e98cc01400400cc0a0c09cc08c00cc09cc08800888cc054cdd800100081611980111919a999813980b000891280089118010019191118010019ba6001122500133003253330273375e002054244a00224460040066eac00400488cc088894ccc0a00040a44c8ccc014c0dcc09c0088cc05ccdd8181b981400180080108009801181280080091198008012400446464644660020060046eb4c08cc088008dd69811000980e00091180111180191191919191919191911980080180119b820023370600c00666e08004cdc1803001299981598190020a40002a66605666e2401120001480045200233025533302a3371200400220022004a66605466e2400800440084004c028008c024008cdc100200119b8200400225333020337120029000898050008800919299981018011119b8830280023370490000008a99981018011119b873028002337046008e1000440044cdc0800a400420026002e1088cc0108cc0148c0b4dd698180009bab302f0013330057000046600646e98cc0108dd418059bad0013756002002446603644a66604200204426601c66ec0c0b8c07c004c010c0bcc07c004c008c0780040048c064894ccc07c0045288a998089801980e80089801180e000911199802111ba63330062237506600e6eb4008dd68009bab00237560020040024446666032446600244a666042004200226666008010603e004603c004002444a66604400226601e0060042646464a66604866ebc0080044cc048cdd8001198059819803181980199980400680298110020a99981219b90375c0046eb80044cc048018cccc02003000cc0880100144cc04800ccccc020030018014c088010c0c4008c0c0010c0800040140080048800488008dc0a4000466602c002941289299980a99b890014800058400488cdd2a4000660066ea4008cc00cdd4800a5eb815d02ba322323333004375c6024601a00490001199980280124000eb4dd58008019bae30113010300c001232222330112253330170011005153330163375e6048602a00200c26008604a602a0022600460280020026ea400488cdd79ba7300a002374e60140024466601e00400229408c02cc02cc02cc02c00526233002232223002003375660360026ea4004888cc024894ccc03c004489400454ccc038cdd7980e1806800802098029806800898011806000800918031129998060008a5015330043003300a00113002300900123300800114a24602c6ea8004c0088894ccc020c03c00440084cc00c004cdc30010009800911299980400089128008a9998039801180300089911180100198030008998018011802800919180111980100100091801119801001000aba25742ae6955cf8801a610100004c010101004bd6f7b6301b8248008dc3a40006e1d2002370e90021b87480e0dc4240006e2520001374e97ae05573aaae79", + "role": "MintingPolicyRole", + "type": "PlutusScriptV2", + "version": "ScriptV2" +} \ No newline at end of file diff --git a/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrderNFTV1_1Tracing b/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrderNFTV1_1Tracing new file mode 100644 index 00000000..5b4ff930 --- /dev/null +++ b/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrderNFTV1_1Tracing @@ -0,0 +1,13 @@ +{ + "cborHex": "591b6c591b690100003232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232322222232323232323232323232533303b3058305f00213232323232323232323232323232533304a001153303e491276d696e74656420746f6b656e73206c6973742073686f756c64206e6f7420626520656d7074792e0016153330495330373303c23303700f3049304000100815330373033304700115330373067375a60dc6090002266e3cdd7183698240008048991999823118349981b1bab304a3049304100100200823232533304d533304d306a307100214a0266e3c084dd7182600089919191919191919191919191919191919191919191919191919191919191929998361844809848008010991929998371845809849008010a9998371847808090a99983719b870110121533306e3371e6eb8c1b40640b854ccc1b8c22c0404054ccc1b8c23c0403854ccc1b8c150cc16c01801454ccc1b8cdc49bad306d003375a60da0022a6660dc66ebc03402454ccc1b8cdc38060140a999837198269bab306d306c306402430473330507006608600c6ea0048c11cccc141c0198218128440098239998283803304333056488100488100375004e6666608800c00a01201000e2a6660dc6116026eb401c54ccc1b94cc170cdc48151bad009133712609866096609405260920246eb402054ccc1b8c22c0403c417854cc18c204045854cc18c214045854cc18c1dc5854cc18c210045854cc18c1c05854cc18c1c45854cc18c1f45854cc18c1d05854cc18c208045854cc18c1fc5854cc18c20c045854cc18c1f05854cc18c200045854ccc1b8c23c0404854ccc1b8cdc38088090a99983719b8f375c60da03205c2a6660dc6116020202a6660dc611e0201c2a6660dc60a8660b600c00a2a6660dc94454ccc1b8cdd78068048a99983719b8700c0281533306e3304d375660da60d860c8048608e6660a0e00cc10c018dd400918239998283803304302508801304733305070066086660ac91100488100375004e6666608800c00a01201000e2a6660dc6116026eb401c54ccc1b94cc170cdc48151bad009133712609866096609405260920246eb402054ccc1b8c22c0403c417854cc18c204045854cc18c214045854cc18c1dc5854cc18c210045854cc18c1c05854cc18c1c45854cc18c1f45854cc18c1d05854cc18c208045854cc18c1fc5854cc18c20c045854cc18c1f05854cc18c2000458c24804004dd5183580a899191929998379848008098a99983799b870120131533306f3371e6eb8c1b80680bc54ccc1bcc2300404454ccc1bcc2400403c54ccc1bcc154cc17001c01854ccc1bd288a99983799baf00e00a1533306f3370e01a0522a6660de6609c6eacc1b8c1b4c194094c120ccc145c0198220039ba801330483330517006608804c1120260906660a2e00cc110cc15d2210048810037500506666608a00e00c0140120102a6660de6118026eb402054ccc1bd4cc174cdc48159bad00a133712609a66098609605460940266eb402454ccc1bcc23004040417c54cc190208045854cc190218045854cc1901e05854cc190214045854cc1901c45854cc1901c85854cc1901f85854cc1901d45854cc19020c045854cc190200045854cc190210045854cc1901f45854cc1902040458c24c04008c24404004dd5183580a9848008009baa3069014306801630670183066306500330650023064002306200130593062008375a60c201060c00106eb4c17cc158c17c030dd6982f182e8021bad305d006375a60b80186eb4c16c028c164004c160004c15c004c158004c154004c150004c14c004c148004c144004c140004c13c004c138c138c1194ccc140c1b400854cc115241156578706563746564206f757470757420646174756d001615333050306f002132323232004533305330703077002153330533073371a6eb8c1480044c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c94ccc194c20804c224040044c8c8c8c94ccc1a4cdd79ba73067002508c01132533306a337126e34dd71834800a4080264646464646464646464646464646464646464646464640e2a6661020260fc00420e02a660ea114022c6eb4c1f8004c1f00114ccc1f4c26804c284040084c8c8c8c8c8c81cd4ccc20c04c2000400841c854cc1dc2300458dd6984000800983f0011bad307e001307c002375a60f80022a660e4102022c6142020026ea8c1e8004c1e0008dd6983c000983b0011bad30760013074002375a60e800260e400aa6660e66120020042a6660e6612a026eb4c1c80044c81914ccc1d0c1c4004418c54cc1a01f45854cc1a020c045854ccc1ccc244040084c81914ccc1d0004418c54cc1a01f45854cc1a01dc58c25c04008c25404004dd518378009836802a9998371845808010a9998371848009bad306d00113205f533306f306c001105e153306307816153306307e161533306e308c0100213205f533306f001105e153306307816153306307216309201002309001001375460d400260d00022a660be0e42c60ce00c2a660bc0e02c6ea0c13cdd6983380098328011bad3065001308a01001153305a07016375460c600260c2008a6660c460fe610c02004264a6660c6a660ae6100020022610602002264a6660c866e24dc69bae3063001481004c81554ccc194c188004415054cc1641b85854cc1641b058c18400854cc1601a058dc69bae3061001153305706616308601001375460be00260ba0046eb4c174004c16c008dd6982d800982c802299982d183b983f001099299982da99827983c0008983d800899299982e19b89371a6eb8c16c005204013204d533305d305a001104c1533051066161533051064163059002153305006016371a6eb8c16400454cc13c17858c1f8004dd5182b800982a802299982b1839983d0010991919191919191919190282999830182e80288278a9982a0348b299982f183d80109919191919029a999831983000288290a9982b8360b2999830983f0010991919191902b29998331831802882a8a9982d0378b29998321840808010a9998321842009b8d375c60c60022640aaa6660ca60c400220a82a660b20dc2c2a660b20e02c2a6660c86104020042a6660c86108026e34dd7183180089902aa9998329831000882a0a9982c8370b0a9982c8388b0a9982c8340b1844008011843008009baa306000115333061307f0021323232323232057533306730640021056153305b07016375a60c800260c40046eb4c188004c180008dd698300008a9982b0328b1842808011841808009baa305d0011533305e307c00213204f533305f001104e153305306816153305306216308201002308001001375460b400260b000aa6660b260ec0042a6660b260f26e34dd7182c000899025299982d182b80088248a998270318b0a998270328b0a99982c983b8010a99982c983c9b8d375c60b0002264094a6660b460ae00220922a6609c0c62c2a6609c0cc2c2a6609c0ba2c60fa00460f60026ea8c15400454cc12c16858c1e8004dd5182980098288008a9982402f8b0a9982402b8b183b8009baa001304f001133333042232223002003307600137526eb8c13c0040348c8c8c80114ccc14cc1c0c1dc00854ccc14cc1ccdc69bae30520011323232323232323232323232323232323232533306530820130890100113232323253330693375e6e9cc19c0094230044c94ccc1a8cdc49b8d375c60d2002902009919191919191919191919191919191919191919191919038a99984080983f00108380a9983a845008b1bad307e001307c004533307d309a0130a10100213232323232320735333083013080010021072153307708c0116375a61000200260fc0046eb4c1f8004c1f0008dd6983e0008a99839040808b1850808009baa307a0013078002375a60f000260ec0046eb4c1d8004c1d0008dd6983a0009839002a9998399848008010a999839984a809bad3072001132064533307430710011063153306807d16153306808301161533307330910100213206453330740011063153306807d16153306807716309701002309501001375460de00260da00aa6660dc6116020042a6660dc6120026eb4c1b40044c817d4ccc1bcc1b0004417854cc18c1e05854cc18c1f85854ccc1b8c230040084c817d4ccc1bc004417854cc18c1e05854cc18c1c858c24804008c24004004dd5183500098340008a9982f8390b18338030a9982f0380b1ba8304f375a60ce00260ca0046eb4c194004c2280400454cc1681c058dd5183180098308022999831183f9843008010992999831a9982b9840008008984180800899299983219b89371a6eb8c18c0052040132055533306530620011054153305906e16153305906c163061002153305806816371a6eb8c18400454cc15c19858c21804004dd5182f800982e8011bad305d001305b002375a60b600260b2008a6660b460ee60fc004264a6660b6a6609e60f0002260f6002264a6660b866e24dc69bae305b001481004c81354ccc174c168004413054cc1441985854cc14419058c16400854cc14018058dc69bae3059001153304f05e16307e001375460ae00260aa008a6660ac60e660f40042646464646464646464640a0a6660c060ba00a209e2a660a80d22ca6660bc60f6004264646464640a6a6660c660c000a20a42a660ae0d82ca6660c260fc004264646464640aca6660cc60c600a20aa2a660b40de2ca6660c86102020042a6660c86108026e34dd7183180089902aa9998329831000882a0a9982c8370b0a9982c8380b0a9998321841008010a9998321842009b8d375c60c60022640aaa6660ca60c400220a82a660b20dc2c2a660b20e22c2a660b20d02c611002004610c020026ea8c18000454ccc184c1fc0084c8c8c8c8c8c815d4ccc19cc190008415854cc16c1c058dd6983200098310011bad30620013060002375a60c00022a660ac0ca2c610a020046106020026ea8c17400454ccc178c1f00084c813d4ccc17c004413854cc14c1a05854cc14c18858c20804008c20004004dd5182d000982c002a99982c983b0010a99982c983c9b8d375c60b0002264094a6660b460ae00220922a6609c0c62c2a6609c0ca2c2a6660b260ee0042a6660b260f26e34dd7182c000899025299982d182b80088248a998270318b0a998270330b0a9982702e8b183e801183d8009baa3055001153304b05a16307a001375460a600260a20022a660900be2c2a660900ae2c60ee0026ea800454cc115241166f757470757420646174756d206e6f7420666f756e64001630740023072001375460986096609660860062a660849201206578706563746564204e465420746f20676f20746f207468652073637269707400163071001375460946082609460820022a6607e921635061747465726e206d61746368206661696c75726520696e2027646f2720626c6f636b206174207372632f47656e6975735969656c642f4f6e436861696e2f4445582f5061727469616c4f726465724e465456315f312e68733a3135343a31332d3233001633031016009153303e49016745787065637465643a20312e29205554784f20636f6e73756d7074696f6e2e20322e29204d696e74656420416d6f756e742073686f756c6420626520312e20332e292056616c696420546f6b656e206e616d652e20342e2920436f727265637420646174756d2e00163333039015010200116375a608c608a0126eb4c114020c110020dd698218041bab304230413032304100c375860820186eb0c100034dc919b8b375a607e607c0026eb8c0fcc0d8c0fc004c0d4010c0f0004c0ec004c0acc0c8cccc0e08c94cc0b0cc0acc0f40040444c170cc0a4dd5981e981e0008081819981e181d98198009bac303b00723232533303f305e30630021303e0011533034490115657870656374656420696e6c696e6520646174756d00163063001375460786076607660666078607660660022a66062921197265666572656e636520696e707574206e6f7420666f756e640016303a0011533303b3302e2305e375a60c2002666605801000640022c2a660609201156578706563746564206f6e6c79206275726e696e670016102b305f00137540146eacc0dc004c0d4c0d4004c0d0004c0cc004c0a8c0ccc0a80114ccc0ccc140c15c0084dd718190008a99814249565061747465726e206d61746368206661696c75726520696e2027646f2720626c6f636b206174207372632f47656e6975735969656c642f4f6e436861696e2f506c7574617263682f54782e68733a3134383a332d31360016305700137546060605e604e002446464a66605e66ebc00c12011c4cc01c008dd3198038008019816981618120019816181180111111199808b8033006330174881004881000033330117006600c00a0046600c008002446464a66605a66e24dd6801a400008a26600a0046e98cc01400400cc0acc0a8c08800cc0a8c08400888cc04ccdd800100082291980111919a999815180a000891280089118010019191118010019ba60011225001330032533302a3375e002086244a00224460040066eac00400488cc094894ccc0ac0041084c8ccc014c140c0a80088cc054cdd81828181580180080108009801181400080091198008012400446464644660020060046eb4c098c094008dd69812800980d80091180111180191191919191919191911980080180119b820023370600c00666e08004cdc1803001299981718258020a40002a66605c66e2401120001480045200233024533302d3371200400220022004a66605a66e2400800440084004c098008c094008cdc100200119b82004002232533302430022233710608400466e092000001153330243002223370e608400466e08c011c20008800899b81001480084004c005c21119802119802918239bad304a0013756609200266600ae00008cc00c8dd31980211ba83020375a0026eac00400488cc07c894ccc0940040f04cc034cdd818241811800980218249811800980118110008009180e9129998118008a5115330103003302100113002302000122233300422374c66600c446ea0cc01cdd68011bad00137560046eac004008004888cccc07488cc004894ccc09400840044cccc010020c08c008c0880080048894ccc0980044cc03800c0084c8c8c94ccc0a0cdd780100089980899bb00023300b304d006304d00333300800d005302600415333028337206eb8008dd700089980880319998040060019813002002899808801999980400600300298130021825801182500218120008028010009100091001119980d800a504a24a66603466e240052000153300f3372c92012a70747279506f7369746976653a206275696c64696e672077697468206e6f6e20706f7369746976653a20003012001161001223374a9000198019ba900233003375200297ae05740ae8c88c8cccc010dd7180b9807001240004666600a00490003ad37560020066eb8c058c054c0340048c8888cc058894ccc070004401454ccc06ccdd7981f980d000803098021820180d00089801180c8008009ba9001223375e6e9cc02c008dd398058009119980a0010008a50230103010301030100014988cc0088c888c00800cdd5981b0009ba90012223300e2253330140011225001153330133375e606e60240020082600a60240022600460220020024601644a666022002294054cc010c00cc03c0044c008c0380048cc034004528ab9c230303754002600c444a6660186052002200426600600266e18008004c01488c8c8cdcb299980619b88003480005241012d00149100533300c30290021300500113372c6008004600a00266e14c0140092014337086008002900a1299980418128008a4810130001533300830260011490101310015333008302700114901013200153330083370e90030008a49013300153330083370e90040008a49013400153330083370e90050008a49013500153330083370e90060008a49013600153330083370e90070008a49013700153330083370e90080008a49013800153330083370e90090008a4901390016253330073371200290008980100088009b8148000c0048894ccc020004489400454ccc01cc008c0180044c888c00800cc0180044cc00c008c0140048c8c0088cc0080080048c0088cc0080080055d12ba15734aae7d24147706f6454616b65724c6f76656c616365466c6174466565206973206e6f74207468652073616d65206173206d656e74696f6e656420696e20636f6e66696720636f6e747261637400490143706f644d616b65724c6f76656c616365466c6174466565206973206e6f742073616d652061732074686174206d656e74696f6e656420706f63664c6f76656c616365730049013f7265616368656420656e64206f662073756d207768696c65207374696c6c206e6f7420686176696e6720666f756e642074686520636f6e7374727563746f72004901387074727946726f6d2843757272656e637953796d626f6c293a206d757374206265203238206279746573206c6f6e67206f7220656d70747900490134706f644f6666657265644173736574206d75737420626520646966666572656e74207468616e20706f6441736b65644173736574004901337074727946726f6d2850526174696f6e616c44617461293a20636f6e7374727563746f72206669656c6473206c656e203e2032004901327074727946726f6d28546f6b656e4e616d65293a206d757374206265206174206d6f7374203332204279746573206c6f6e6700490131706f636641736b6564546f6b656e7320696e20706f64436f6e7461696e65644665652073686f756c64206265207a65726f004901317074727946726f6d2850446174615265636f72645b5d293a206c697374206973206c6f6e676572207468616e207a65726f0049012f7074727946726f6d2850526174696f6e616c44617461293a20696e76616c696420636f6e7374727563746f722069640049012c7074727946726f6d28505075624b657948617368293a206d757374206265203238206279746573206c6f6e670049012c7074727946726f6d285053637269707448617368293a206d757374206265203238206279746573206c6f6e670049012b6f66666572656420616d6f756e742073686f756c6420657175616c206f726967696e616c20616d6f756e74004901296f7264657220656e642073686f756c646e2774206265206561726c696572207468616e207374617274004901257074727946726f6d28504f53495854696d65293a206d75737420626520706f736974697665004901246e756d626572206f66207061727469616c2066696c6c73206d757374206265207a65726f004901216f66666572656420616d6f756e742073686f756c6420626520706f7369746976650049011e636f6e7461696e6564207061796d656e74206d757374206265207a65726f00490119706f645072696365206d75737420626520706f7369746976650049011277726f6e67206e616d6520666f72204e46540049010d6f6666657220746f6f206c6f770049010c6665657320746f6f206c6f770010034c010100004c010101004bd6f7b6301b8248008dc3a40006e1d2002370e90021b87480e0dc4240006e2520001374e97ae05573aaae79", + "description": "DEX.PartialOrderNFTV1_1Tracing", + "params": [ + "PlutusLedgerApi.V1.Scripts:ScriptHash", + "PlutusLedgerApi.V1.Address:Address", + "PlutusLedgerApi.V1.Value:AssetClass" + ], + "rawHex": "591b690100003232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232322222232323232323232323232533303b3058305f00213232323232323232323232323232533304a001153303e491276d696e74656420746f6b656e73206c6973742073686f756c64206e6f7420626520656d7074792e0016153330495330373303c23303700f3049304000100815330373033304700115330373067375a60dc6090002266e3cdd7183698240008048991999823118349981b1bab304a3049304100100200823232533304d533304d306a307100214a0266e3c084dd7182600089919191919191919191919191919191919191919191919191919191919191929998361844809848008010991929998371845809849008010a9998371847808090a99983719b870110121533306e3371e6eb8c1b40640b854ccc1b8c22c0404054ccc1b8c23c0403854ccc1b8c150cc16c01801454ccc1b8cdc49bad306d003375a60da0022a6660dc66ebc03402454ccc1b8cdc38060140a999837198269bab306d306c306402430473330507006608600c6ea0048c11cccc141c0198218128440098239998283803304333056488100488100375004e6666608800c00a01201000e2a6660dc6116026eb401c54ccc1b94cc170cdc48151bad009133712609866096609405260920246eb402054ccc1b8c22c0403c417854cc18c204045854cc18c214045854cc18c1dc5854cc18c210045854cc18c1c05854cc18c1c45854cc18c1f45854cc18c1d05854cc18c208045854cc18c1fc5854cc18c20c045854cc18c1f05854cc18c200045854ccc1b8c23c0404854ccc1b8cdc38088090a99983719b8f375c60da03205c2a6660dc6116020202a6660dc611e0201c2a6660dc60a8660b600c00a2a6660dc94454ccc1b8cdd78068048a99983719b8700c0281533306e3304d375660da60d860c8048608e6660a0e00cc10c018dd400918239998283803304302508801304733305070066086660ac91100488100375004e6666608800c00a01201000e2a6660dc6116026eb401c54ccc1b94cc170cdc48151bad009133712609866096609405260920246eb402054ccc1b8c22c0403c417854cc18c204045854cc18c214045854cc18c1dc5854cc18c210045854cc18c1c05854cc18c1c45854cc18c1f45854cc18c1d05854cc18c208045854cc18c1fc5854cc18c20c045854cc18c1f05854cc18c2000458c24804004dd5183580a899191929998379848008098a99983799b870120131533306f3371e6eb8c1b80680bc54ccc1bcc2300404454ccc1bcc2400403c54ccc1bcc154cc17001c01854ccc1bd288a99983799baf00e00a1533306f3370e01a0522a6660de6609c6eacc1b8c1b4c194094c120ccc145c0198220039ba801330483330517006608804c1120260906660a2e00cc110cc15d2210048810037500506666608a00e00c0140120102a6660de6118026eb402054ccc1bd4cc174cdc48159bad00a133712609a66098609605460940266eb402454ccc1bcc23004040417c54cc190208045854cc190218045854cc1901e05854cc190214045854cc1901c45854cc1901c85854cc1901f85854cc1901d45854cc19020c045854cc190200045854cc190210045854cc1901f45854cc1902040458c24c04008c24404004dd5183580a9848008009baa3069014306801630670183066306500330650023064002306200130593062008375a60c201060c00106eb4c17cc158c17c030dd6982f182e8021bad305d006375a60b80186eb4c16c028c164004c160004c15c004c158004c154004c150004c14c004c148004c144004c140004c13c004c138c138c1194ccc140c1b400854cc115241156578706563746564206f757470757420646174756d001615333050306f002132323232004533305330703077002153330533073371a6eb8c1480044c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c94ccc194c20804c224040044c8c8c8c94ccc1a4cdd79ba73067002508c01132533306a337126e34dd71834800a4080264646464646464646464646464646464646464646464640e2a6661020260fc00420e02a660ea114022c6eb4c1f8004c1f00114ccc1f4c26804c284040084c8c8c8c8c8c81cd4ccc20c04c2000400841c854cc1dc2300458dd6984000800983f0011bad307e001307c002375a60f80022a660e4102022c6142020026ea8c1e8004c1e0008dd6983c000983b0011bad30760013074002375a60e800260e400aa6660e66120020042a6660e6612a026eb4c1c80044c81914ccc1d0c1c4004418c54cc1a01f45854cc1a020c045854ccc1ccc244040084c81914ccc1d0004418c54cc1a01f45854cc1a01dc58c25c04008c25404004dd518378009836802a9998371845808010a9998371848009bad306d00113205f533306f306c001105e153306307816153306307e161533306e308c0100213205f533306f001105e153306307816153306307216309201002309001001375460d400260d00022a660be0e42c60ce00c2a660bc0e02c6ea0c13cdd6983380098328011bad3065001308a01001153305a07016375460c600260c2008a6660c460fe610c02004264a6660c6a660ae6100020022610602002264a6660c866e24dc69bae3063001481004c81554ccc194c188004415054cc1641b85854cc1641b058c18400854cc1601a058dc69bae3061001153305706616308601001375460be00260ba0046eb4c174004c16c008dd6982d800982c802299982d183b983f001099299982da99827983c0008983d800899299982e19b89371a6eb8c16c005204013204d533305d305a001104c1533051066161533051064163059002153305006016371a6eb8c16400454cc13c17858c1f8004dd5182b800982a802299982b1839983d0010991919191919191919190282999830182e80288278a9982a0348b299982f183d80109919191919029a999831983000288290a9982b8360b2999830983f0010991919191902b29998331831802882a8a9982d0378b29998321840808010a9998321842009b8d375c60c60022640aaa6660ca60c400220a82a660b20dc2c2a660b20e02c2a6660c86104020042a6660c86108026e34dd7183180089902aa9998329831000882a0a9982c8370b0a9982c8388b0a9982c8340b1844008011843008009baa306000115333061307f0021323232323232057533306730640021056153305b07016375a60c800260c40046eb4c188004c180008dd698300008a9982b0328b1842808011841808009baa305d0011533305e307c00213204f533305f001104e153305306816153305306216308201002308001001375460b400260b000aa6660b260ec0042a6660b260f26e34dd7182c000899025299982d182b80088248a998270318b0a998270328b0a99982c983b8010a99982c983c9b8d375c60b0002264094a6660b460ae00220922a6609c0c62c2a6609c0cc2c2a6609c0ba2c60fa00460f60026ea8c15400454cc12c16858c1e8004dd5182980098288008a9982402f8b0a9982402b8b183b8009baa001304f001133333042232223002003307600137526eb8c13c0040348c8c8c80114ccc14cc1c0c1dc00854ccc14cc1ccdc69bae30520011323232323232323232323232323232323232533306530820130890100113232323253330693375e6e9cc19c0094230044c94ccc1a8cdc49b8d375c60d2002902009919191919191919191919191919191919191919191919038a99984080983f00108380a9983a845008b1bad307e001307c004533307d309a0130a10100213232323232320735333083013080010021072153307708c0116375a61000200260fc0046eb4c1f8004c1f0008dd6983e0008a99839040808b1850808009baa307a0013078002375a60f000260ec0046eb4c1d8004c1d0008dd6983a0009839002a9998399848008010a999839984a809bad3072001132064533307430710011063153306807d16153306808301161533307330910100213206453330740011063153306807d16153306807716309701002309501001375460de00260da00aa6660dc6116020042a6660dc6120026eb4c1b40044c817d4ccc1bcc1b0004417854cc18c1e05854cc18c1f85854ccc1b8c230040084c817d4ccc1bc004417854cc18c1e05854cc18c1c858c24804008c24004004dd5183500098340008a9982f8390b18338030a9982f0380b1ba8304f375a60ce00260ca0046eb4c194004c2280400454cc1681c058dd5183180098308022999831183f9843008010992999831a9982b9840008008984180800899299983219b89371a6eb8c18c0052040132055533306530620011054153305906e16153305906c163061002153305806816371a6eb8c18400454cc15c19858c21804004dd5182f800982e8011bad305d001305b002375a60b600260b2008a6660b460ee60fc004264a6660b6a6609e60f0002260f6002264a6660b866e24dc69bae305b001481004c81354ccc174c168004413054cc1441985854cc14419058c16400854cc14018058dc69bae3059001153304f05e16307e001375460ae00260aa008a6660ac60e660f40042646464646464646464640a0a6660c060ba00a209e2a660a80d22ca6660bc60f6004264646464640a6a6660c660c000a20a42a660ae0d82ca6660c260fc004264646464640aca6660cc60c600a20aa2a660b40de2ca6660c86102020042a6660c86108026e34dd7183180089902aa9998329831000882a0a9982c8370b0a9982c8380b0a9998321841008010a9998321842009b8d375c60c60022640aaa6660ca60c400220a82a660b20dc2c2a660b20e22c2a660b20d02c611002004610c020026ea8c18000454ccc184c1fc0084c8c8c8c8c8c815d4ccc19cc190008415854cc16c1c058dd6983200098310011bad30620013060002375a60c00022a660ac0ca2c610a020046106020026ea8c17400454ccc178c1f00084c813d4ccc17c004413854cc14c1a05854cc14c18858c20804008c20004004dd5182d000982c002a99982c983b0010a99982c983c9b8d375c60b0002264094a6660b460ae00220922a6609c0c62c2a6609c0ca2c2a6660b260ee0042a6660b260f26e34dd7182c000899025299982d182b80088248a998270318b0a998270330b0a9982702e8b183e801183d8009baa3055001153304b05a16307a001375460a600260a20022a660900be2c2a660900ae2c60ee0026ea800454cc115241166f757470757420646174756d206e6f7420666f756e64001630740023072001375460986096609660860062a660849201206578706563746564204e465420746f20676f20746f207468652073637269707400163071001375460946082609460820022a6607e921635061747465726e206d61746368206661696c75726520696e2027646f2720626c6f636b206174207372632f47656e6975735969656c642f4f6e436861696e2f4445582f5061727469616c4f726465724e465456315f312e68733a3135343a31332d3233001633031016009153303e49016745787065637465643a20312e29205554784f20636f6e73756d7074696f6e2e20322e29204d696e74656420416d6f756e742073686f756c6420626520312e20332e292056616c696420546f6b656e206e616d652e20342e2920436f727265637420646174756d2e00163333039015010200116375a608c608a0126eb4c114020c110020dd698218041bab304230413032304100c375860820186eb0c100034dc919b8b375a607e607c0026eb8c0fcc0d8c0fc004c0d4010c0f0004c0ec004c0acc0c8cccc0e08c94cc0b0cc0acc0f40040444c170cc0a4dd5981e981e0008081819981e181d98198009bac303b00723232533303f305e30630021303e0011533034490115657870656374656420696e6c696e6520646174756d00163063001375460786076607660666078607660660022a66062921197265666572656e636520696e707574206e6f7420666f756e640016303a0011533303b3302e2305e375a60c2002666605801000640022c2a660609201156578706563746564206f6e6c79206275726e696e670016102b305f00137540146eacc0dc004c0d4c0d4004c0d0004c0cc004c0a8c0ccc0a80114ccc0ccc140c15c0084dd718190008a99814249565061747465726e206d61746368206661696c75726520696e2027646f2720626c6f636b206174207372632f47656e6975735969656c642f4f6e436861696e2f506c7574617263682f54782e68733a3134383a332d31360016305700137546060605e604e002446464a66605e66ebc00c12011c4cc01c008dd3198038008019816981618120019816181180111111199808b8033006330174881004881000033330117006600c00a0046600c008002446464a66605a66e24dd6801a400008a26600a0046e98cc01400400cc0acc0a8c08800cc0a8c08400888cc04ccdd800100082291980111919a999815180a000891280089118010019191118010019ba60011225001330032533302a3375e002086244a00224460040066eac00400488cc094894ccc0ac0041084c8ccc014c140c0a80088cc054cdd81828181580180080108009801181400080091198008012400446464644660020060046eb4c098c094008dd69812800980d80091180111180191191919191919191911980080180119b820023370600c00666e08004cdc1803001299981718258020a40002a66605c66e2401120001480045200233024533302d3371200400220022004a66605a66e2400800440084004c098008c094008cdc100200119b82004002232533302430022233710608400466e092000001153330243002223370e608400466e08c011c20008800899b81001480084004c005c21119802119802918239bad304a0013756609200266600ae00008cc00c8dd31980211ba83020375a0026eac00400488cc07c894ccc0940040f04cc034cdd818241811800980218249811800980118110008009180e9129998118008a5115330103003302100113002302000122233300422374c66600c446ea0cc01cdd68011bad00137560046eac004008004888cccc07488cc004894ccc09400840044cccc010020c08c008c0880080048894ccc0980044cc03800c0084c8c8c94ccc0a0cdd780100089980899bb00023300b304d006304d00333300800d005302600415333028337206eb8008dd700089980880319998040060019813002002899808801999980400600300298130021825801182500218120008028010009100091001119980d800a504a24a66603466e240052000153300f3372c92012a70747279506f7369746976653a206275696c64696e672077697468206e6f6e20706f7369746976653a20003012001161001223374a9000198019ba900233003375200297ae05740ae8c88c8cccc010dd7180b9807001240004666600a00490003ad37560020066eb8c058c054c0340048c8888cc058894ccc070004401454ccc06ccdd7981f980d000803098021820180d00089801180c8008009ba9001223375e6e9cc02c008dd398058009119980a0010008a50230103010301030100014988cc0088c888c00800cdd5981b0009ba90012223300e2253330140011225001153330133375e606e60240020082600a60240022600460220020024601644a666022002294054cc010c00cc03c0044c008c0380048cc034004528ab9c230303754002600c444a6660186052002200426600600266e18008004c01488c8c8cdcb299980619b88003480005241012d00149100533300c30290021300500113372c6008004600a00266e14c0140092014337086008002900a1299980418128008a4810130001533300830260011490101310015333008302700114901013200153330083370e90030008a49013300153330083370e90040008a49013400153330083370e90050008a49013500153330083370e90060008a49013600153330083370e90070008a49013700153330083370e90080008a49013800153330083370e90090008a4901390016253330073371200290008980100088009b8148000c0048894ccc020004489400454ccc01cc008c0180044c888c00800cc0180044cc00c008c0140048c8c0088cc0080080048c0088cc0080080055d12ba15734aae7d24147706f6454616b65724c6f76656c616365466c6174466565206973206e6f74207468652073616d65206173206d656e74696f6e656420696e20636f6e66696720636f6e747261637400490143706f644d616b65724c6f76656c616365466c6174466565206973206e6f742073616d652061732074686174206d656e74696f6e656420706f63664c6f76656c616365730049013f7265616368656420656e64206f662073756d207768696c65207374696c6c206e6f7420686176696e6720666f756e642074686520636f6e7374727563746f72004901387074727946726f6d2843757272656e637953796d626f6c293a206d757374206265203238206279746573206c6f6e67206f7220656d70747900490134706f644f6666657265644173736574206d75737420626520646966666572656e74207468616e20706f6441736b65644173736574004901337074727946726f6d2850526174696f6e616c44617461293a20636f6e7374727563746f72206669656c6473206c656e203e2032004901327074727946726f6d28546f6b656e4e616d65293a206d757374206265206174206d6f7374203332204279746573206c6f6e6700490131706f636641736b6564546f6b656e7320696e20706f64436f6e7461696e65644665652073686f756c64206265207a65726f004901317074727946726f6d2850446174615265636f72645b5d293a206c697374206973206c6f6e676572207468616e207a65726f0049012f7074727946726f6d2850526174696f6e616c44617461293a20696e76616c696420636f6e7374727563746f722069640049012c7074727946726f6d28505075624b657948617368293a206d757374206265203238206279746573206c6f6e670049012c7074727946726f6d285053637269707448617368293a206d757374206265203238206279746573206c6f6e670049012b6f66666572656420616d6f756e742073686f756c6420657175616c206f726967696e616c20616d6f756e74004901296f7264657220656e642073686f756c646e2774206265206561726c696572207468616e207374617274004901257074727946726f6d28504f53495854696d65293a206d75737420626520706f736974697665004901246e756d626572206f66207061727469616c2066696c6c73206d757374206265207a65726f004901216f66666572656420616d6f756e742073686f756c6420626520706f7369746976650049011e636f6e7461696e6564207061796d656e74206d757374206265207a65726f00490119706f645072696365206d75737420626520706f7369746976650049011277726f6e67206e616d6520666f72204e46540049010d6f6666657220746f6f206c6f770049010c6665657320746f6f206c6f770010034c010100004c010101004bd6f7b6301b8248008dc3a40006e1d2002370e90021b87480e0dc4240006e2520001374e97ae05573aaae79", + "role": "MintingPolicyRole", + "type": "PlutusScriptV2", + "version": "ScriptV2" +} \ No newline at end of file diff --git a/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrderTracing b/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrderTracing new file mode 100644 index 00000000..bcd7fc68 --- /dev/null +++ b/geniusyield-onchain/geniusyield-common/data/compiled-scripts/DEX.PartialOrderTracing @@ -0,0 +1,12 @@ +{ + "cborHex": "59192159191e01000032323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232222223232323232323232323232323232323232533304d30613067002132323232323232333305023304d0083054304f001375860a600c4646464646464a6660b660de6660a000800400c2646464646464646464646464646464a6660d460fc008264a6660d66106020022a6660d666e200040304c94ccc1b0cc148004c1ac0a054ccc1b0cc144004c1ac09c4c8c8c8c8c8c8c8c8c8c8c8ccccc1d0894ccc1e80044889400448c8cd4ccc1eccc1cc014c1e80044ccccc150128dd48111bab307a30790012533307d0011225001132533307d309101375a61300260f80042a6660fa6120026660e40400480022446004006244a002244a0026eb8c25804c1ec0044894004489400494ccc1f0cdc7800813899111801119800803802183d802099802983d00225013300430790030023074307900201b4a24600244646a6660f6a660e400626660f600c94128899191198008018011ba8337006eb4038dd680499982cb80001007123300100200e223232323232323232325333086013306100400b15333086013375e00a613e02660dc610a02094660dc046660dc04c660dc610a0208e660dc6ea0cdc081380e1983701299837012198371ba90313306e3085010423306e3085010413306e375066e00dd698428082024004660dc610a0207e660dc026660dc613e02660dc6ea0cdc01bad00a0013306e0173306e375066e000580092f5c0660dc6ea00512f5c02a66610c0266e24ccc18088cdc000119984280911299984600800880109980199b8000248008c224040052000375661460200290000022402820f22a660fe92132636f6e74696e75696e67206f757470757427732076616c75652073686f756c642068617665203c3d20313020746f6b656e730016153307f4912077726f6e6720646174756d20696e20636f6e74696e75696e67206f75747075740016153307f49127696e73756666696369656e742076616c756520696e20636f6e74696e75696e67206f757470757400165333085013307d0243305b4881004881001480004cc1e4008cc16d220100488100330780010233305f001008375661020200aa66610202612a02004266660b26eb8c20004004098800454cc1e9240160707265736f6c7665446174756d3a20446174756d206e6f7420666f756e6420696e207769746e657373206d617020636f72726573706f6e64696e6720746f20646174756d20686173682070726573656e7420696e2074686973206f7574707574001615333081013096010021308001001153307a49012c707265736f6c7665446174756d3a20457870656374656420646174756d20696e2074686973206f75747075740016309b01002309901001375460fa60f800260f660ee0086660b0e00cc138064dd40049982b0119982700d1ba801015330704911b636f6e74696e75696e67206f7574707574206e6f7420666f756e640016307502033333304501901a01b0024a04944cc120cc12922100488100001307202b337006eb4c1c4c1c00a4004c02401cdd69837983700198370011836801183580098330040a9983283b8b0a9983283b0b183500c8a99832248127616d6f756e74206d757374206265206c657373207468616e206f66666572656420616d6f756e740016153306449117616d6f756e74206d75737420626520706f7369746976650016375a60d20062a6660d460fe0082a6660d466e1c030c1692002132533306b33051001306a0271533306b33050001306a0261323232533306e33049333303c02100b01301233304c700600a0026608401a6ea0c01803c4c8c94ccc1c0cccccc1000500540580094cc19c0044cdd78010408091999982502001200091981e802800880108318a9983483e8b198338059844009982b840009982b840009982b84000a5eb80c1b409854cc19c1dc58ccccc0dc034030c1b0008c1b0004c1b0c1ac004c1a8004c19401c54cc1901d85854cc1901d458c1a406054cc18c1d8584c94ccc1accc1a0894ccc1b80045280a99983699baf306c00100314a22600460d60026eb0c1a806054ccc1accdc3806982da400426464646464a6660e066096666607c04601a02a028600e6666607402001e0060040022a6660e0a6608e6106026eb4c1bc0a84cc1a0030c22404cc16020404cc16020404cc160204052f5c020c62a6660e066666608002802a02c102029408ccccc1281000900048c8c8c8c8cc104ccccc100058054024dd419b81375a010a6660ec660d0004108022a6660ec660ce00460c66004e1040044cdc0800a4004200200e00a6002e10cc188c1840548cc00400c008dd6983901a1bad00414a020c62a660d20fa2c2a660d20f22c60dc60da00660da00460d800460d400260ca00e2a660c80ee2c2a660c8921136e6f74207369676e6564206279206f776e6572001637526eb8c1a40b88cc11804cccc121c01981f1982000880aa6010101003330487006607c0146ea002c0048c8c8c8c8c94ccc1b8cc1800081f0400454ccc1b8cc17c008c16cc009c20800899b8048008004c005c21982d182c8021198008018011bad306a3069002375a60d200260c600e6104020046100020026ea80acc18c06cc188098c184080c180080c17c088dd6982f00f9998298008028049bab305c00c375860b60186eacc168c164c1640204138c164c160008dd7182c000982b182b1829199982a11929982899829182c80081189837198271bab305930580010223053305830573053001375860ae01246464a6660b660e060ea004260b40022a660a892115657870656374656420696e6c696e6520646174756d00163075001375460b060ae60ae60a660b060ae60a60022a660a2921197265666572656e636520696e707574206e6f7420666f756e640016375660ac60aa00260a060aa60a860a00046eb8c15004854cc13524015a5061747465726e206d61746368206661696c75726520696e2027646f2720626c6f636b206174207372632f47656e6975735969656c642f4f6e436861696e2f4445582f5061727469616c4f726465722e68733a38343a392d323200163051001305030503050001304f304f001304e001304d0013048304d004304c001153304649015a5061747465726e206d61746368206661696c75726520696e2027646f2720626c6f636b206174207372632f47656e6975735969656c642f4f6e436861696e2f4445582f5061727469616c4f726465722e68733a37303a392d323300163067001375460946092002608801e608e002608c002608a00260880026086002608400260820026080002607e002607c002607a00260780026076002606c00644444666032e00cc03ccc045221004881000033330197006601e00a0046601e00800244666068444a66607600426603c46600e09a6eacc1580040044c94ccc0f000854cc0c8cc01c0041344cc07c8cc020dd5982b800827181c8018991919299981f19b8f00200115330353300a004003133007303c006303c0051533303e337200040022a6606a660140080a026600e607800c00a2a6606a660140a000626600e00c607800a6eb8c15cc0f0010dd7182b181d8021bab3056303a002375660aa607200400400244666066444a66607400426603a466e2401cdd6982a800800899299981d8010a9981899b8900100713301e2337126eb4c158004020c0e000c4c8c8c94ccc0f4cdc78010008a9981a19b89004003133007303b006303b0051533303d337200040022a6606866e240100284cc01cc0ec01801454cc0d0cdc4805001899803803181d8029bae3056303b004375c60aa60740086eb4c154c0e4008dd6982a181c001001000a400044644606644a66607200209026464646464a66607aa66607a60a0004294054ccc0f4c1440084cccc054dd7181e0008041198050008028a50133009303c0010041375660786076606e607800c2600e607600c60ae00460aa0026ea8c0e4c0e0c0e0008c0e0004c0c8c0dc004894cc0b4cdd78010020998170008019191118010019bab304d001222222333303223302f303630310010050062323232323232533303d33018330193756607800c6eacc0f0c0ec008ccc06dc019980b9119980eb80002375660b400209e002660226602691010048810000a130080011533036490128666565206f757470757427732076616c7565206973206c657373207468616e206578706563746564001637566076002606aa666076609c0042a660689201156578706563746564206f757470757420646174756d00161533303b304f00213333013375c60740020144646464008a66607c60a260b0004264646464646464646464646407aa666094608e00a20782a6608409c2ca66609060b600426464646407ea6660986092008207c2a660880a02ca66609460ba60c8004264a66609660bc60ca002264a66609860b66e9cc12800454ccc130c18cdc69bae304b0011323232042533304f304c0021041153304705316375a609800260940062a6608a0a82c2a6608a0a42c60cc0022a660880a42c6ea8c12400454cc10c13058c190004dd518238008a999824182e00109901e2999824800881d8a998208268b0a998208250b183100118300009baa304400130420053016375600660286eac008cc0488c8c8c8cdd82999822a9980e182c0018982d8018982f8020a9981f0240b1830002180b1bab305f0033301423233760a66608a66e24dc69bae305f002481004c17c00854cc0f812458c180008dd6982f8009bab305e002371a6eb8c170004dd5800981f800981e80119807919191919191919bb0305f00730600073017375660be00ca66608660ac60ba008264a66608860ae60bc002264a66608a60a86e9cc10c00454ccc114c170dc69bae3044001132323203b53330483045002103a153304004c16375a608a00260860082a6607c09a2c2a6607c0962c60be0022a6607a0962c6ea8c10800854cc0f011458c050dd5982e802182e00119808919191919bb0533304453301b30570031305a0031305e004153303d04716305f0043015375660bc0066602646466ec14ccc110cdc49b8d375c60bc00490200982f0010a9981e8240b182f8011bad305e001375660ba0046e34dd7182d8009bab305b002375460b20026eacc0f400454cc0dc10058c160004dd50008a9981a249166f757470757420646174756d206e6f7420666f756e640016132323232004533303e30513058002132323232323232323232323203d533304a3047005103c153304204e165333048305b00213232323203f533304c3049004103e153304405016533304a305d3064002132533304b305e3065001132533304c305b374e60940022a66609860c66e34dd7182580089919190212999827982600108208a998238298b1bad304c001304a0031533045054161533045052163066001153304405216375460920022a660860982c60c80026ea8c11c00454ccc120c1700084c80f14ccc12400440ec54cc1041345854cc10412858c188008c180004dd518220009821002980b1bab0033014375600466024464646466ec14ccc1154cc070c16000c4c16c00c4c17c01054cc0f812058c180010c058dd5982f8019980a11919bb05333045337126e34dd7182f80124080260be0042a6607c0922c60c00046eb4c17c004dd5982f0011b8d375c60b80026eac004c0fc004c0f4008cc03c8c8c8c8c8c8c8cdd8182f8039830003980b9bab305f00653330433056305d00413253330443057305e00113253330453054374e60860022a66608a60b86e34dd71822000899191901da9998241822801081d0a998200260b1bad30450013043004153303e04d16153303e04b16305f001153303d04b16375460840042a6607808a2c60286eacc174010c170008cc0448c8c8c8cdd8299982229980d982b8018982d0018982f0020a9981e8238b182f802180a9bab305e0033301323233760a66608866e24dc69bae305e002481004c17800854cc0f412058c17c008dd6982f0009bab305d002371a6eb8c16c004dd5982d8011baa30590013756607a0022a6606e0802c60b00026ea8004c0e8004c154008c14c004dd5181b981b000981a981880088011181691299981980082109980d18019818800980118180009199816112999819000890020991299981998008010a998162490c756e736f72746564206d6170001613300430310032337200020066eb8c12cc0c0004004928129998171980891980882380080088008a99813a49184e6567617469766520616d6f756e7420696e2056616c756500162232325333030337126eb400d2000040133005002374c6600a002006605c605a6052006605a6050004446602a66ec00080040fc88c114cc050dd48011980a1ba90014bd701198150008a51233002232223002003304500137520024446604e44a66605a002244a0022a66605866ebcc118c0ac0040104c014c0ac0044c008c0a80040048c0908894ccc0ac00440084cc00ccc010008c0a4004c0a000488cc0288cc028dc4a40000026600600400244666008e00008cc00c8dd31980211ba83018375a0026eac00400488cc088894ccc0a00040dc4cc03ccdd81820981300098021821181300098011812800800911199802111ba63330062237506600e6eb4008dd68009bab00237560020040024446666042446600244a666052004200226666008010604e004604c004002444a6660540022660220060042646464a66605866ebc0080044cc050cdd8001198059823803182380199980400680298150020a99981619b90375c0046eb80044cc050018cccc02003000cc0a80100144cc05000ccccc020030018014c0a8010c114008c110010c0a0004014008004880048800888cc0108c00cdd6981e0008009119801918019bab303b0010012301a22533302000114a22a6602c6006603c00226004603a002446464a66603e6066607200429444cc024c0e0cc01cc0e0cc01cc0e12f5c06600e60109452f5c06600e600c6eb4c0780052f5c000860720026ea800488c8c94ccc078c0c8c0e0008528899804181b9980318029bad301d001330063037330063374a900225eb80cc018c01d28a5eb812f5c000860700026ea80048c0cccc008cdd2a4004660046ea00052f5c06600460069452f5c0ae808cdd299980c000a4004900025eb8088c8c94cc044cc014c064008c0640044cc014c064c060004c064c060008c04c008c04800888c8c8c8c8c8c8c8c94ccc07d4ccc07ccdc40010008a511533301f3370e00400226464a666042606a008266e20dd698100011bad302000114a0607600860740082940528899191929998112999811181b001099192999812181c181f001099baf374e0066e9c004528181f0009baa0081533302230370021323253330243039303e00213375e6e9c00cdd38008a50303e001375401026464a666048606e607c004266ebcdd38019ba700114a0607c0026ea80204ccc088c038c084c08002cc038c084c080029288a50303c002303a001375400c6070004606e0046ea8008dd5001180c801180c001180900118088011181498179baa00122330010024800888c00888c00c88c8c8c8c8c8c8c8c88cc00400c008cdc100119b830060033370400266e0c0180094ccc074c0c0010520001533301d3371200890000a4002290011980ba99980e19b8900200110011002533301c33712004002200420026014004601200466e08010008cdc10020011299980919b89001480044c0080044004dc0a40004460044460064466e1ccdc100080219b82002003223002223003223371066e08004010cdc1001001a4c446660060046eb8c034c020004dd71806980618040009111999802001240004666600a00490003ad37560020064644446601844a666024002200a2a66602266ebcc0acc0400040184c010c0b0c0400044c008c03c004004dd4800911998058010008a50223375e6e9cc010008dd39802000ab9c2302237540026004444a6660106036002200426600600266e18008004c0048894ccc020004489400454ccc01cc008c0180044c888c00800cc0180044cc00c008c0140048c8c0088cc0080080048c0088cc0080080055d12ba15734aae7d24013f7265616368656420656e64206f662073756d207768696c65207374696c6c206e6f7420686176696e6720666f756e642074686520636f6e7374727563746f72004901387074727946726f6d2843757272656e637953796d626f6c293a206d757374206265203238206279746573206c6f6e67206f7220656d707479004901327074727946726f6d28546f6b656e4e616d65293a206d757374206265206174206d6f7374203332204279746573206c6f6e67004901317074727946726f6d2850446174615265636f72645b5d293a206c697374206973206c6f6e676572207468616e207a65726f0049012a7074727946726f6d2854784964293a20636f6e7374727563746f72206669656c6473206c656e203e2031004901267074727946726f6d2854784964293a20696e76616c696420636f6e7374727563746f72206964004901257074727946726f6d2854784964293a206d757374206265203332206279746573206c6f6e6700490114696e73756666696369656e74207061796d656e740049011066696c6c656420746f6f206561726c790049010f66696c6c656420746f6f206c6174650049010d4e4654206e6f74206275726e740049010c666565206e6f74207061696400233001480012002375e6e9d2f5c0200498010100004bd6f7b6301b8748000dc3a40046e1d2004370e901c1b8748100dc4240006e9520005573aaae79", + "description": "DEX.PartialOrderTracing", + "params": [ + "PlutusLedgerApi.V1.Address:Address", + "PlutusLedgerApi.V1.Value:AssetClass" + ], + "rawHex": "59191e01000032323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232222223232323232323232323232323232323232533304d30613067002132323232323232333305023304d0083054304f001375860a600c4646464646464a6660b660de6660a000800400c2646464646464646464646464646464a6660d460fc008264a6660d66106020022a6660d666e200040304c94ccc1b0cc148004c1ac0a054ccc1b0cc144004c1ac09c4c8c8c8c8c8c8c8c8c8c8c8ccccc1d0894ccc1e80044889400448c8cd4ccc1eccc1cc014c1e80044ccccc150128dd48111bab307a30790012533307d0011225001132533307d309101375a61300260f80042a6660fa6120026660e40400480022446004006244a002244a0026eb8c25804c1ec0044894004489400494ccc1f0cdc7800813899111801119800803802183d802099802983d00225013300430790030023074307900201b4a24600244646a6660f6a660e400626660f600c94128899191198008018011ba8337006eb4038dd680499982cb80001007123300100200e223232323232323232325333086013306100400b15333086013375e00a613e02660dc610a02094660dc046660dc04c660dc610a0208e660dc6ea0cdc081380e1983701299837012198371ba90313306e3085010423306e3085010413306e375066e00dd698428082024004660dc610a0207e660dc026660dc613e02660dc6ea0cdc01bad00a0013306e0173306e375066e000580092f5c0660dc6ea00512f5c02a66610c0266e24ccc18088cdc000119984280911299984600800880109980199b8000248008c224040052000375661460200290000022402820f22a660fe92132636f6e74696e75696e67206f757470757427732076616c75652073686f756c642068617665203c3d20313020746f6b656e730016153307f4912077726f6e6720646174756d20696e20636f6e74696e75696e67206f75747075740016153307f49127696e73756666696369656e742076616c756520696e20636f6e74696e75696e67206f757470757400165333085013307d0243305b4881004881001480004cc1e4008cc16d220100488100330780010233305f001008375661020200aa66610202612a02004266660b26eb8c20004004098800454cc1e9240160707265736f6c7665446174756d3a20446174756d206e6f7420666f756e6420696e207769746e657373206d617020636f72726573706f6e64696e6720746f20646174756d20686173682070726573656e7420696e2074686973206f7574707574001615333081013096010021308001001153307a49012c707265736f6c7665446174756d3a20457870656374656420646174756d20696e2074686973206f75747075740016309b01002309901001375460fa60f800260f660ee0086660b0e00cc138064dd40049982b0119982700d1ba801015330704911b636f6e74696e75696e67206f7574707574206e6f7420666f756e640016307502033333304501901a01b0024a04944cc120cc12922100488100001307202b337006eb4c1c4c1c00a4004c02401cdd69837983700198370011836801183580098330040a9983283b8b0a9983283b0b183500c8a99832248127616d6f756e74206d757374206265206c657373207468616e206f66666572656420616d6f756e740016153306449117616d6f756e74206d75737420626520706f7369746976650016375a60d20062a6660d460fe0082a6660d466e1c030c1692002132533306b33051001306a0271533306b33050001306a0261323232533306e33049333303c02100b01301233304c700600a0026608401a6ea0c01803c4c8c94ccc1c0cccccc1000500540580094cc19c0044cdd78010408091999982502001200091981e802800880108318a9983483e8b198338059844009982b840009982b840009982b84000a5eb80c1b409854cc19c1dc58ccccc0dc034030c1b0008c1b0004c1b0c1ac004c1a8004c19401c54cc1901d85854cc1901d458c1a406054cc18c1d8584c94ccc1accc1a0894ccc1b80045280a99983699baf306c00100314a22600460d60026eb0c1a806054ccc1accdc3806982da400426464646464a6660e066096666607c04601a02a028600e6666607402001e0060040022a6660e0a6608e6106026eb4c1bc0a84cc1a0030c22404cc16020404cc16020404cc160204052f5c020c62a6660e066666608002802a02c102029408ccccc1281000900048c8c8c8c8cc104ccccc100058054024dd419b81375a010a6660ec660d0004108022a6660ec660ce00460c66004e1040044cdc0800a4004200200e00a6002e10cc188c1840548cc00400c008dd6983901a1bad00414a020c62a660d20fa2c2a660d20f22c60dc60da00660da00460d800460d400260ca00e2a660c80ee2c2a660c8921136e6f74207369676e6564206279206f776e6572001637526eb8c1a40b88cc11804cccc121c01981f1982000880aa6010101003330487006607c0146ea002c0048c8c8c8c8c94ccc1b8cc1800081f0400454ccc1b8cc17c008c16cc009c20800899b8048008004c005c21982d182c8021198008018011bad306a3069002375a60d200260c600e6104020046100020026ea80acc18c06cc188098c184080c180080c17c088dd6982f00f9998298008028049bab305c00c375860b60186eacc168c164c1640204138c164c160008dd7182c000982b182b1829199982a11929982899829182c80081189837198271bab305930580010223053305830573053001375860ae01246464a6660b660e060ea004260b40022a660a892115657870656374656420696e6c696e6520646174756d00163075001375460b060ae60ae60a660b060ae60a60022a660a2921197265666572656e636520696e707574206e6f7420666f756e640016375660ac60aa00260a060aa60a860a00046eb8c15004854cc13524015a5061747465726e206d61746368206661696c75726520696e2027646f2720626c6f636b206174207372632f47656e6975735969656c642f4f6e436861696e2f4445582f5061727469616c4f726465722e68733a38343a392d323200163051001305030503050001304f304f001304e001304d0013048304d004304c001153304649015a5061747465726e206d61746368206661696c75726520696e2027646f2720626c6f636b206174207372632f47656e6975735969656c642f4f6e436861696e2f4445582f5061727469616c4f726465722e68733a37303a392d323300163067001375460946092002608801e608e002608c002608a00260880026086002608400260820026080002607e002607c002607a00260780026076002606c00644444666032e00cc03ccc045221004881000033330197006601e00a0046601e00800244666068444a66607600426603c46600e09a6eacc1580040044c94ccc0f000854cc0c8cc01c0041344cc07c8cc020dd5982b800827181c8018991919299981f19b8f00200115330353300a004003133007303c006303c0051533303e337200040022a6606a660140080a026600e607800c00a2a6606a660140a000626600e00c607800a6eb8c15cc0f0010dd7182b181d8021bab3056303a002375660aa607200400400244666066444a66607400426603a466e2401cdd6982a800800899299981d8010a9981899b8900100713301e2337126eb4c158004020c0e000c4c8c8c94ccc0f4cdc78010008a9981a19b89004003133007303b006303b0051533303d337200040022a6606866e240100284cc01cc0ec01801454cc0d0cdc4805001899803803181d8029bae3056303b004375c60aa60740086eb4c154c0e4008dd6982a181c001001000a400044644606644a66607200209026464646464a66607aa66607a60a0004294054ccc0f4c1440084cccc054dd7181e0008041198050008028a50133009303c0010041375660786076606e607800c2600e607600c60ae00460aa0026ea8c0e4c0e0c0e0008c0e0004c0c8c0dc004894cc0b4cdd78010020998170008019191118010019bab304d001222222333303223302f303630310010050062323232323232533303d33018330193756607800c6eacc0f0c0ec008ccc06dc019980b9119980eb80002375660b400209e002660226602691010048810000a130080011533036490128666565206f757470757427732076616c7565206973206c657373207468616e206578706563746564001637566076002606aa666076609c0042a660689201156578706563746564206f757470757420646174756d00161533303b304f00213333013375c60740020144646464008a66607c60a260b0004264646464646464646464646407aa666094608e00a20782a6608409c2ca66609060b600426464646407ea6660986092008207c2a660880a02ca66609460ba60c8004264a66609660bc60ca002264a66609860b66e9cc12800454ccc130c18cdc69bae304b0011323232042533304f304c0021041153304705316375a609800260940062a6608a0a82c2a6608a0a42c60cc0022a660880a42c6ea8c12400454cc10c13058c190004dd518238008a999824182e00109901e2999824800881d8a998208268b0a998208250b183100118300009baa304400130420053016375600660286eac008cc0488c8c8c8cdd82999822a9980e182c0018982d8018982f8020a9981f0240b1830002180b1bab305f0033301423233760a66608a66e24dc69bae305f002481004c17c00854cc0f812458c180008dd6982f8009bab305e002371a6eb8c170004dd5800981f800981e80119807919191919191919bb0305f00730600073017375660be00ca66608660ac60ba008264a66608860ae60bc002264a66608a60a86e9cc10c00454ccc114c170dc69bae3044001132323203b53330483045002103a153304004c16375a608a00260860082a6607c09a2c2a6607c0962c60be0022a6607a0962c6ea8c10800854cc0f011458c050dd5982e802182e00119808919191919bb0533304453301b30570031305a0031305e004153303d04716305f0043015375660bc0066602646466ec14ccc110cdc49b8d375c60bc00490200982f0010a9981e8240b182f8011bad305e001375660ba0046e34dd7182d8009bab305b002375460b20026eacc0f400454cc0dc10058c160004dd50008a9981a249166f757470757420646174756d206e6f7420666f756e640016132323232004533303e30513058002132323232323232323232323203d533304a3047005103c153304204e165333048305b00213232323203f533304c3049004103e153304405016533304a305d3064002132533304b305e3065001132533304c305b374e60940022a66609860c66e34dd7182580089919190212999827982600108208a998238298b1bad304c001304a0031533045054161533045052163066001153304405216375460920022a660860982c60c80026ea8c11c00454ccc120c1700084c80f14ccc12400440ec54cc1041345854cc10412858c188008c180004dd518220009821002980b1bab0033014375600466024464646466ec14ccc1154cc070c16000c4c16c00c4c17c01054cc0f812058c180010c058dd5982f8019980a11919bb05333045337126e34dd7182f80124080260be0042a6607c0922c60c00046eb4c17c004dd5982f0011b8d375c60b80026eac004c0fc004c0f4008cc03c8c8c8c8c8c8c8cdd8182f8039830003980b9bab305f00653330433056305d00413253330443057305e00113253330453054374e60860022a66608a60b86e34dd71822000899191901da9998241822801081d0a998200260b1bad30450013043004153303e04d16153303e04b16305f001153303d04b16375460840042a6607808a2c60286eacc174010c170008cc0448c8c8c8cdd8299982229980d982b8018982d0018982f0020a9981e8238b182f802180a9bab305e0033301323233760a66608866e24dc69bae305e002481004c17800854cc0f412058c17c008dd6982f0009bab305d002371a6eb8c16c004dd5982d8011baa30590013756607a0022a6606e0802c60b00026ea8004c0e8004c154008c14c004dd5181b981b000981a981880088011181691299981980082109980d18019818800980118180009199816112999819000890020991299981998008010a998162490c756e736f72746564206d6170001613300430310032337200020066eb8c12cc0c0004004928129998171980891980882380080088008a99813a49184e6567617469766520616d6f756e7420696e2056616c756500162232325333030337126eb400d2000040133005002374c6600a002006605c605a6052006605a6050004446602a66ec00080040fc88c114cc050dd48011980a1ba90014bd701198150008a51233002232223002003304500137520024446604e44a66605a002244a0022a66605866ebcc118c0ac0040104c014c0ac0044c008c0a80040048c0908894ccc0ac00440084cc00ccc010008c0a4004c0a000488cc0288cc028dc4a40000026600600400244666008e00008cc00c8dd31980211ba83018375a0026eac00400488cc088894ccc0a00040dc4cc03ccdd81820981300098021821181300098011812800800911199802111ba63330062237506600e6eb4008dd68009bab00237560020040024446666042446600244a666052004200226666008010604e004604c004002444a6660540022660220060042646464a66605866ebc0080044cc050cdd8001198059823803182380199980400680298150020a99981619b90375c0046eb80044cc050018cccc02003000cc0a80100144cc05000ccccc020030018014c0a8010c114008c110010c0a0004014008004880048800888cc0108c00cdd6981e0008009119801918019bab303b0010012301a22533302000114a22a6602c6006603c00226004603a002446464a66603e6066607200429444cc024c0e0cc01cc0e0cc01cc0e12f5c06600e60109452f5c06600e600c6eb4c0780052f5c000860720026ea800488c8c94ccc078c0c8c0e0008528899804181b9980318029bad301d001330063037330063374a900225eb80cc018c01d28a5eb812f5c000860700026ea80048c0cccc008cdd2a4004660046ea00052f5c06600460069452f5c0ae808cdd299980c000a4004900025eb8088c8c94cc044cc014c064008c0640044cc014c064c060004c064c060008c04c008c04800888c8c8c8c8c8c8c8c94ccc07d4ccc07ccdc40010008a511533301f3370e00400226464a666042606a008266e20dd698100011bad302000114a0607600860740082940528899191929998112999811181b001099192999812181c181f001099baf374e0066e9c004528181f0009baa0081533302230370021323253330243039303e00213375e6e9c00cdd38008a50303e001375401026464a666048606e607c004266ebcdd38019ba700114a0607c0026ea80204ccc088c038c084c08002cc038c084c080029288a50303c002303a001375400c6070004606e0046ea8008dd5001180c801180c001180900118088011181498179baa00122330010024800888c00888c00c88c8c8c8c8c8c8c8c88cc00400c008cdc100119b830060033370400266e0c0180094ccc074c0c0010520001533301d3371200890000a4002290011980ba99980e19b8900200110011002533301c33712004002200420026014004601200466e08010008cdc10020011299980919b89001480044c0080044004dc0a40004460044460064466e1ccdc100080219b82002003223002223003223371066e08004010cdc1001001a4c446660060046eb8c034c020004dd71806980618040009111999802001240004666600a00490003ad37560020064644446601844a666024002200a2a66602266ebcc0acc0400040184c010c0b0c0400044c008c03c004004dd4800911998058010008a50223375e6e9cc010008dd39802000ab9c2302237540026004444a6660106036002200426600600266e18008004c0048894ccc020004489400454ccc01cc008c0180044c888c00800cc0180044cc00c008c0140048c8c0088cc0080080048c0088cc0080080055d12ba15734aae7d24013f7265616368656420656e64206f662073756d207768696c65207374696c6c206e6f7420686176696e6720666f756e642074686520636f6e7374727563746f72004901387074727946726f6d2843757272656e637953796d626f6c293a206d757374206265203238206279746573206c6f6e67206f7220656d707479004901327074727946726f6d28546f6b656e4e616d65293a206d757374206265206174206d6f7374203332204279746573206c6f6e67004901317074727946726f6d2850446174615265636f72645b5d293a206c697374206973206c6f6e676572207468616e207a65726f0049012a7074727946726f6d2854784964293a20636f6e7374727563746f72206669656c6473206c656e203e2031004901267074727946726f6d2854784964293a20696e76616c696420636f6e7374727563746f72206964004901257074727946726f6d2854784964293a206d757374206265203332206279746573206c6f6e6700490114696e73756666696369656e74207061796d656e740049011066696c6c656420746f6f206561726c790049010f66696c6c656420746f6f206c6174650049010d4e4654206e6f74206275726e740049010c666565206e6f74207061696400233001480012002375e6e9d2f5c0200498010100004bd6f7b6301b8748000dc3a40046e1d2004370e901c1b8748100dc4240006e9520005573aaae79", + "role": "ValidatorRole", + "type": "PlutusScriptV2", + "version": "ScriptV2" +} \ No newline at end of file diff --git a/geniusyield-onchain/geniusyield-common/geniusyield-common.cabal b/geniusyield-onchain/geniusyield-common/geniusyield-common.cabal new file mode 100644 index 00000000..9d172e3e --- /dev/null +++ b/geniusyield-onchain/geniusyield-common/geniusyield-common.cabal @@ -0,0 +1,55 @@ +cabal-version: 3.0 +name: geniusyield-common +version: 0.1.0.0 +synopsis: Common code shared between GeniusYield onchain and offchain +license: Apache-2.0 +license-file: LICENSE +author: GeniusYield +maintainer: support@geniusyield.co +build-type: Simple +copyright: 2023 GYELD GMBH +data-dir: data +data-files: + compiled-scripts/DEX.NFT + compiled-scripts/DEX.PartialOrder + compiled-scripts/DEX.PartialOrderConfig + compiled-scripts/DEX.PartialOrderConfigTracing + compiled-scripts/DEX.PartialOrderNFT + compiled-scripts/DEX.PartialOrderNFTTracing + compiled-scripts/DEX.PartialOrderNFTV1_1 + compiled-scripts/DEX.PartialOrderNFTV1_1Tracing + compiled-scripts/DEX.PartialOrderTracing + +library + default-language: GHC2021 + default-extensions: + DataKinds + DeriveAnyClass + DerivingStrategies + DerivingVia + GADTs + LambdaCase + MultiWayIf + OverloadedStrings + RecordWildCards + RoleAnnotations + TemplateHaskell + TypeFamilies + UndecidableInstances + UnicodeSyntax + ViewPatterns + + ghc-options: -Wall + hs-source-dirs: src + exposed-modules: + GeniusYield.OnChain.Common.Scripts + GeniusYield.OnChain.Common.Scripts.DEX.Data + + build-depends: + , aeson + , base <5 + , bytestring + , file-embed + , plutus-ledger-api + , ply-core + , text diff --git a/geniusyield-onchain/geniusyield-common/src/GeniusYield/OnChain/Common/Scripts.hs b/geniusyield-onchain/geniusyield-common/src/GeniusYield/OnChain/Common/Scripts.hs new file mode 100644 index 00000000..92e3063d --- /dev/null +++ b/geniusyield-onchain/geniusyield-common/src/GeniusYield/OnChain/Common/Scripts.hs @@ -0,0 +1,38 @@ +module GeniusYield.OnChain.Common.Scripts + ( dex'NFTFile + , dex'PartialOrderFile + , dex'PartialOrderFileTracing + , dex'PartialOrderNFTFile + , dex'PartialOrderNFTFileTracing + , dex'PartialOrderNFTV1_1File + , dex'PartialOrderNFTV1_1FileTracing + , dex'PartialOrderConfigFile + , dex'PartialOrderConfigFileTracing + ) where + +dex'NFTFile :: FilePath +dex'NFTFile = "DEX.NFT" + +dex'PartialOrderFile :: FilePath +dex'PartialOrderFile = "DEX.PartialOrder" + +dex'PartialOrderFileTracing :: FilePath +dex'PartialOrderFileTracing = "DEX.PartialOrderTracing" + +dex'PartialOrderNFTFile :: FilePath +dex'PartialOrderNFTFile = "DEX.PartialOrderNFT" + +dex'PartialOrderNFTFileTracing :: FilePath +dex'PartialOrderNFTFileTracing = "DEX.PartialOrderNFTTracing" + +dex'PartialOrderNFTV1_1File :: FilePath +dex'PartialOrderNFTV1_1File = "DEX.PartialOrderNFTV1_1" + +dex'PartialOrderNFTV1_1FileTracing :: FilePath +dex'PartialOrderNFTV1_1FileTracing = "DEX.PartialOrderNFTV1_1Tracing" + +dex'PartialOrderConfigFile :: FilePath +dex'PartialOrderConfigFile = "DEX.PartialOrderConfig" + +dex'PartialOrderConfigFileTracing :: FilePath +dex'PartialOrderConfigFileTracing = "DEX.PartialOrderConfigTracing" \ No newline at end of file diff --git a/geniusyield-onchain/geniusyield-common/src/GeniusYield/OnChain/Common/Scripts/DEX/Data.hs b/geniusyield-onchain/geniusyield-common/src/GeniusYield/OnChain/Common/Scripts/DEX/Data.hs new file mode 100644 index 00000000..32236e81 --- /dev/null +++ b/geniusyield-onchain/geniusyield-common/src/GeniusYield/OnChain/Common/Scripts/DEX/Data.hs @@ -0,0 +1,38 @@ +module GeniusYield.OnChain.Common.Scripts.DEX.Data ( + orderValidator, + nftPolicyV1, + nftPolicyV1_1, +) where + +import Data.Aeson qualified as Aeson +import Data.ByteString (ByteString) +import Data.FileEmbed +import PlutusLedgerApi.V1 (Address) +import PlutusLedgerApi.V1.Scripts (ScriptHash) +import PlutusLedgerApi.V1.Value (AssetClass) +import Ply ( + ScriptRole (..), + TypedScript, + ) +import Ply.Core.Internal.Reify (ReifyRole, ReifyTypenames) +import Ply.Core.TypedReader (mkTypedScript) + +readScript ∷ ∀ r l. (ReifyRole r, ReifyTypenames l) ⇒ ByteString → TypedScript r l +readScript bs = + let envelope = either (error "GeniusYield.OnChain.Common.Scripts.DEX.Data.readScript: Failed to read envelope") id $ Aeson.eitherDecodeStrict' bs + in either (error "GeniusYield.OnChain.Common.Scripts.DEX.Data.readScript: Failed to create typed script") id $ mkTypedScript @r @l envelope + +orderValidator ∷ (TypedScript 'ValidatorRole '[Address, AssetClass]) +orderValidator = + let fileBS = $(makeRelativeToProject "./data/compiled-scripts/DEX.PartialOrder" >>= embedFile) + in readScript fileBS + +nftPolicyV1 ∷ (TypedScript 'MintingPolicyRole '[ScriptHash, Address, AssetClass]) +nftPolicyV1 = + let fileBS = $(makeRelativeToProject "./data/compiled-scripts/DEX.PartialOrderNFT" >>= embedFile) + in readScript fileBS + +nftPolicyV1_1 ∷ (TypedScript 'MintingPolicyRole '[ScriptHash, Address, AssetClass]) +nftPolicyV1_1 = + let fileBS = $(makeRelativeToProject "./data/compiled-scripts/DEX.PartialOrderNFTV1_1" >>= embedFile) + in readScript fileBS \ No newline at end of file diff --git a/geniusyield-onchain/geniusyield-onchain.cabal b/geniusyield-onchain/geniusyield-onchain.cabal new file mode 100644 index 00000000..59b86460 --- /dev/null +++ b/geniusyield-onchain/geniusyield-onchain.cabal @@ -0,0 +1,117 @@ +cabal-version: 3.0 +name: geniusyield-onchain +version: 0.1.0.0 +synopsis: GeniusYield onchain code +license: Apache-2.0 +license-file: LICENSE +author: GeniusYield +maintainer: support@geniusyield.co +build-type: Simple +copyright: 2023 GYELD GMBH + +common lang + default-language: GHC2021 + default-extensions: + DataKinds + DeriveAnyClass + DerivingStrategies + TypeFamilies + +library + import: lang + ghc-options: -Wall + + -- so unfoldings are present even when compiled without optmizations + ghc-options: + -fno-ignore-interface-pragmas -fno-omit-interface-pragmas + -Wno-partial-type-signatures + + -- expose all unfoldings, so plutustx compiler can do its job + ghc-options: -fexpose-all-unfoldings -fobject-code + hs-source-dirs: src + exposed-modules: + GeniusYield.OnChain.DEX.NFT + GeniusYield.OnChain.DEX.NFT.Compiled + GeniusYield.OnChain.DEX.PartialOrder + GeniusYield.OnChain.DEX.PartialOrder.Compiled + GeniusYield.OnChain.DEX.PartialOrder.Types + GeniusYield.OnChain.DEX.PartialOrderConfig + GeniusYield.OnChain.DEX.PartialOrderConfig.Compiled + GeniusYield.OnChain.DEX.PartialOrderNFT + GeniusYield.OnChain.DEX.PartialOrderNFT.Compiled + GeniusYield.OnChain.DEX.PartialOrderNFTV1_1 + GeniusYield.OnChain.DEX.PartialOrderNFTV1_1.Compiled + GeniusYield.OnChain.DEX.Utils + GeniusYield.OnChain.Plutarch.Api + GeniusYield.OnChain.Plutarch.Crypto + GeniusYield.OnChain.Plutarch.Run + GeniusYield.OnChain.Plutarch.Time + GeniusYield.OnChain.Plutarch.Tx + GeniusYield.OnChain.Plutarch.Types + GeniusYield.OnChain.Plutarch.Utils + GeniusYield.OnChain.Plutarch.Value + GeniusYield.OnChain.Utils + GeniusYield.Plutonomy + + build-depends: + , base <5 + , bytestring + , data-default + , geniusyield-common + , lens + , plutarch + , plutarch-extra + , plutonomy + , plutus-core + , plutus-ledger-api + , plutus-tx + , plutus-tx-plugin + , ply-core + , ply-plutarch + , text + +executable geniusyield-onchain-compiler + import: lang + ghc-options: -Wall -fwarn-incomplete-uni-patterns + + -- so unfoldings are present even when compiled without optmizations + ghc-options: + -fno-ignore-interface-pragmas -fno-omit-interface-pragmas + -Wno-partial-type-signatures + + ghc-options: + -O2 -threaded -rtsopts -with-rtsopts=-T -fplugin-opt + PlutusTx.Plugin:defer-errors + + hs-source-dirs: app + main-is: Main.hs + build-depends: + , base + , directory + , filepath + , geniusyield-common + , geniusyield-onchain + , ply-core + , text + , transformers + +test-suite geniusyield-onchain-tests + import: lang + type: exitcode-stdio-1.0 + main-is: geniusyield-onchain-tests.hs + hs-source-dirs: tests + ghc-options: -threaded -rtsopts + ghc-options: + -Wall -Wincomplete-uni-patterns -Wno-unticked-promoted-constructors + + build-depends: + , base + , data-default + , geniusyield-onchain + , plutonomy + , plutus-ledger-api + , plutus-tx + , ply-core + , ply-plutarch + , tasty + , text diff --git a/geniusyield-onchain/src/GeniusYield/OnChain/DEX/Anastasia_Labs____Genius_Yield_Audit.pdf b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/Anastasia_Labs____Genius_Yield_Audit.pdf new file mode 100644 index 00000000..fe5b7e4f Binary files /dev/null and b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/Anastasia_Labs____Genius_Yield_Audit.pdf differ diff --git a/geniusyield-onchain/src/GeniusYield/OnChain/DEX/NFT.hs b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/NFT.hs new file mode 100644 index 00000000..6fe8a378 --- /dev/null +++ b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/NFT.hs @@ -0,0 +1,93 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# OPTIONS_GHC -O2 -fspecialize-aggressively #-} + +module GeniusYield.OnChain.DEX.NFT (mkNFTPolicy) where + +import Prelude (($), (.)) + +import Plutarch.Api.V1 +import qualified Plutarch.Api.V1.AssocMap as PMap +import Plutarch.Prelude + +import GeniusYield.OnChain.Plutarch.Api +import qualified Plutarch.Api.V2 as PV2 + +mkNFTPolicy :: + Term s (PAsData (PMaybeData PTxOutRef) + :--> PV2.PScriptContext + :--> PUnit + ) +mkNFTPolicy = plam $ \mtxOutRef ctx -> policy (pfromData mtxOutRef) ctx + where + policy :: + Term s (PMaybeData PTxOutRef) + -> Term s PV2.PScriptContext + -> Term s PUnit + + policy txOutRef ctx = pmatch txOutRef + $ \case + PDNothing _ -> checkIfBurning # (pownSymbol # ctx) + # pfromData (pfield @"txInfo" # ctx) + + PDJust rec -> plet (pfield @"txInfo" # ctx) $ \info + -> plet (pfield @"_0" # rec) $ \ref + -> validateMinting # + ref # + (pexpectedTokenName # ref) # + info # + (mintedTokens_ # (pownSymbol # ctx) # info) + + validateMinting :: + Term s (PTxOutRef + :--> PTokenName + :--> PV2.PTxInfo + :--> PMap any PTokenName PInteger + :--> PUnit + ) + validateMinting = plam $ + \txOutRef tn info -> + let + hasUtxoConsumed = putxoConsumed # txOutRef # (pfield @"inputs" # info) + mintedTnAmt x = pfromData (psndBuiltin # x) + mintedTnName x = pfromData (pfstBuiltin # x) + errMsg = "Expected: 1.) UTxO consumption. 2.) Minted Amount should be 1. 3.) Valid Token name." + in + pelimList (\h t -> pif + ( hasUtxoConsumed + #&& pnull # t + #&& mintedTnAmt h #== 1 + #&& mintedTnName h #== tn + ) + (pconstant ()) + (ptraceError errMsg) + ) (ptraceError "minted tokens list should not be empty.") . pto + + checkIfBurning :: + Term s (PCurrencySymbol + :--> PV2.PTxInfo + :--> PUnit + ) + checkIfBurning = plam $ + \cs info -> pif + (pany # + plam (\v -> 0 #<= pfromData (psndBuiltin # v)) # + pto (mintedTokens_ # cs # info) + ) + (ptraceError "expected only burning") + (pconstant ()) + +mintedTokens_ :: + Term s (PCurrencySymbol + :--> PV2.PTxInfo + :--> PMap 'Sorted PTokenName PInteger + ) +mintedTokens_ = plam $ + \cs info -> + pmatch (PMap.plookup # cs # pto (pfromData $ pfield @"mint" # info)) $ + \case + PNothing -> perror + PJust m -> m diff --git a/geniusyield-onchain/src/GeniusYield/OnChain/DEX/NFT/Compiled.hs b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/NFT/Compiled.hs new file mode 100644 index 00000000..b3a58872 --- /dev/null +++ b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/NFT/Compiled.hs @@ -0,0 +1,31 @@ +module GeniusYield.OnChain.DEX.NFT.Compiled ( + originalNftPolicy, + optimizedNftPolicy +) where + + +import Data.Text (Text) +import Data.Default (def) + +import qualified Plutarch.Unsafe as PUNSAFE +import Plutarch.Prelude +import Ply hiding ((#)) +import Ply.Plutarch +import qualified Plutarch.Api.V2 as PV2 +import qualified Plutonomy + +import GeniusYield.OnChain.DEX.NFT +import GeniusYield.Plutonomy () + +originalNftPolicy :: Either Text (TypedScript 'MintingPolicyRole '[]) +originalNftPolicy = toTypedScript def mkNFTPolicy' + +optimizedNftPolicy :: Either Text (TypedScript 'MintingPolicyRole '[]) +optimizedNftPolicy = Plutonomy.optimizeUPLC <$> originalNftPolicy + +mkNFTPolicy' :: ClosedTerm PV2.PMintingPolicy +mkNFTPolicy' = plam $ \redm ctx -> + popaque $ mkNFTPolicy + # PUNSAFE.punsafeCoerce redm + # ctx + diff --git a/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrder.hs b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrder.hs new file mode 100644 index 00000000..d4b0e904 --- /dev/null +++ b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrder.hs @@ -0,0 +1,303 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE PartialTypeSignatures #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} + +module GeniusYield.OnChain.DEX.PartialOrder (mkPartialOrderValidator) where + +import Plutarch (Term, pcon, plam, type (:-->), unTermCont, (#$), (#)) +import Plutarch.Api.V1 (PAddress, PScriptPurpose (PSpending)) +import qualified Plutarch.Api.V2 as PV2 +import Plutarch.DataRepr (pdcons, pdnil, pfield) +import Plutarch.Extra.RationalData (prationalFromData) +import Plutarch.Prelude (PBool (..), PEq ((#==)), PInteger, PMaybe (..), PPair (..), + PPartialOrd ((#<), (#<=)), PUnit (..), getField, pdata, + pfromData, pif, pmatch, pnot, ptraceError, (#&&), (#||)) +import qualified Plutarch.Rational as PRational + +import GeniusYield.OnChain.DEX.PartialOrder.Types (PPartialOrderAction (..), + PPartialOrderContainedFee (PPartialOrderContainedFee), + PPartialOrderDatum (..)) +import Plutarch.Api.V1.AssocMap (plookup) +import Plutarch.Api.V1.Value (AmountGuarantees (..), KeyGuarantees (..), PValue, + pforgetPositive, pvalueOf) + +import GeniusYield.OnChain.DEX.Utils (pcheckValidFillTime, pcontinuingPartialOrder, + pfindFeeOutput, pfindMarkedRefInput, pgetContainedFeeValue, + pgetContainedFeeValue') +import GeniusYield.OnChain.Plutarch.Api (PAssetClass, pguardC, pguardC', pletC, pletFieldsC, + pmatchC, ppaidValuePlusInline, presolveDatum, ptxSignedBy, + toDatum) +import GeniusYield.OnChain.Plutarch.Utils (pceiling, pfindOwnInput, pfloor) +import GeniusYield.OnChain.Plutarch.Value (passetClass, passetClassValueOf, passetClassValuePositive, + pgeq, plovelace, psubtractValue, pvalTotalEntries) +import Plutarch.Unsafe (punsafeCoerce) + +mkPartialOrderValidator :: forall s. Term s + ( PAddress + :--> PAssetClass + :--> PPartialOrderDatum + :--> PPartialOrderAction + :--> PV2.PScriptContext + :--> PUnit + ) +mkPartialOrderValidator + = plam $ \refInputAddr refInputToken od oa ctx -> unTermCont $ do + odFs <- pletFieldsC @[ "podOwnerKey" + , "podOwnerAddr" + , "podOfferedAsset" + , "podOfferedOriginalAmount" + , "podOfferedAmount" + , "podAskedAsset" + , "podPrice" + , "podNFT" + , "podStart" + , "podEnd" + , "podPartialFills" + , "podMakerLovelaceFlatFee" + , "podTakerLovelaceFlatFee" + , "podContainedFee" + , "podContainedPayment" + ] od + + ctxFs <- pletFieldsC @["txInfo", "purpose"] ctx + + PSpending spRec <- pmatchC $ getField @"purpose" ctxFs + ownRef <- pletC $ pfield @"_0" # spRec + + info <- pletFieldsC + @[ "inputs" + , "referenceInputs" + , "outputs" + , "mint" + , "validRange" + , "signatories" + , "datums" + ] + $ getField @"txInfo" ctxFs + + PJust ownInput <- pmatchC $ pfindOwnInput # getField @"inputs" info # ownRef + nftTkName <- pletC $ getField @"podNFT" odFs + ownInpUtxo <- pletFieldsC @["value", "address"] $ pfield @"resolved" # ownInput + valueIn :: Term _ (PValue 'Sorted 'Positive) + <- pletC $ getField @"value" ownInpUtxo + markedRefDatum <- pletC $ pfindMarkedRefInput # getField @"referenceInputs" info # refInputAddr # refInputToken + markedRefDatumFs <- pletFieldsC + @'[ "pocdNftSymbol" + , "pocdFeeAddr" + ] markedRefDatum + nftSymbol <- pletC $ getField @"pocdNftSymbol" markedRefDatumFs + feeAddr <- pletC $ getField @"pocdFeeAddr" markedRefDatumFs + + -- Succeed immediately if there is no NFT. + pguardC' (pcon PUnit) $ pvalueOf # valueIn # nftSymbol # nftTkName #== 1 + + datums <- pletC $ getField @"datums" info + outputs <- pletC $ getField @"outputs" info + mint <- pletC $ getField @"mint" info + nftMintAmt <- pletC $ pvalueOf # mint # nftSymbol # nftTkName + offeredAmount <- pletC $ getField @"podOfferedAmount" odFs + offAC <- pletC $ getField @"podOfferedAsset" odFs + askAC <- pletC $ getField @"podAskedAsset" odFs + podPrice <- pletC $ getField @"podPrice" odFs + ownerAddr <- pletC $ getField @"podOwnerAddr" odFs + curContainedFee :: Term _ PPartialOrderContainedFee + <- pletC $ getField @"podContainedFee" odFs + (priceInteger :: Term s (PInteger :--> PInteger)) + <- pletC $ plam $ + \amt -> + pceiling #$ + (PRational.pfromInteger # amt) * (prationalFromData # podPrice) + + {- | Note that at any moment, an order UTxO contains:- + * An NFT. + * Remaining offered tokens. + * Payment for sold tokens. + * Initial deposit. + * Collected fees. + -} + curPaymentWithDeposit :: Term s (PValue 'Sorted 'Positive :--> PValue 'Sorted 'NoGuarantees) + <- pletC $ plam $ + \contFeeVal -> + let toSubtract = (passetClassValuePositive # (passetClass # nftSymbol # nftTkName) # pdata 1) <> (passetClassValuePositive # offAC # pdata offeredAmount) <> contFeeVal + -- In above, @contFeeVal@ is simply @pgetContainedFeeValue # curContainedFee # offAC # askAC@ but in case @curContainedFee@ is already destructured, it might be more efficient to construct value using destructured components and send it instead. + -- For complete fill case, one should also add payment for consumed tokens to know for outgoing payment. + in psubtractValue # valueIn # toSubtract + + pmatchC oa >>= \case + + PPartialCancel _ -> do + pguardC "not signed by owner" $ ptxSignedBy + # getField @"podOwnerKey" odFs + # getField @"signatories" info + pguardC "NFT not burnt" $ nftMintAmt #== -1 + + curContFeeHRec <- pletFieldsC @["pocfLovelaces", "pocfOfferedTokens", "pocfAskedTokens"] curContainedFee + feeLov <- pletC (getField @"pocfLovelaces" curContFeeHRec) + feeOff <- pletC (getField @"pocfOfferedTokens" curContFeeHRec) + feeAsk <- pletC (getField @"pocfAskedTokens" curContFeeHRec) + + -- Checking if payment is made specifically to `podOwnerAddr`. + let expectedPayment = curPaymentWithDeposit # (pgetContainedFeeValue' # offAC # askAC # feeLov # feeOff # feeAsk) + actualPayment = ppaidValuePlusInline # ownRef # ownerAddr # datums # outputs + + pguardC "insufficient payment" $ + pgeq # pforgetPositive actualPayment # expectedPayment + + (partialFills :: Term _ PInteger) <- pletC $ getField @"podPartialFills" odFs + pmatchC (partialFills #== 0 #|| curContainedFee #== mempty) >>= \case -- Note that later we subtract from this @curContainedFee@ to know for the required contained fee, but if required contained fee is @mempty@ then it can be mathematically shown that @curContainedFee@ is also @mempty@. + + PTrue -> pure . pcon $ PUnit -- no partial fills or no fees, maker fees go back to the maker + + PFalse -> do -- fees need to be paid + + pguardC "fee not paid" $ + pfindFeeOutput + # outputs + # datums + # feeAddr + # pdata 0 + # pcon PFalse + #$ plam $ \m -> + pmatch (plookup # ownRef # m) $ \case + PNothing -> pcon PFalse + PJust mentionedFee -> + + let originalOfferedAmount :: Term _ PInteger = getField @"podOfferedOriginalAmount" odFs + feeToRefund = pfloor #$ (PRational.pfromInteger # offeredAmount) * pcon (PRational.PRational (pfromData feeOff) (punsafeCoerce originalOfferedAmount)) -- We are using `punsafeCoerce` instead of `ptryPositive` as our NFT policy checks that original offered amount is positive. + in ((pgetContainedFeeValue' # offAC # askAC # feeLov # pdata (pfromData feeOff - feeToRefund) # feeAsk) #<= mentionedFee) + + pure . pcon $ PUnit + + PCompleteFill _ -> do + + pguardC "NFT not burnt" $ nftMintAmt #== -1 + + pcheckValidFillTime (getField @"validRange" info) (getField @"podStart" odFs) (getField @"podEnd" odFs) + + -- We must check that the payment to the maker is correct. + -- It is the sum of the payment from previous partial fills contained in the order + -- and the price of the remaining offered amount. + curContainedFeeValue <- pletC $ pgetContainedFeeValue # curContainedFee # offAC # askAC + let expectedPayment = (curPaymentWithDeposit # curContainedFeeValue) <> pforgetPositive (passetClassValuePositive # askAC # pdata (priceInteger # offeredAmount)) + actualPayment = ppaidValuePlusInline # ownRef # ownerAddr # datums # outputs + pguardC "insufficient payment" $ + pgeq # pforgetPositive actualPayment # expectedPayment + + -- We must check that the fees are paid. + -- They consist of the contained fees and the taker fee. + takerFeeInt <- pletC $ getField @"podTakerLovelaceFlatFee" odFs + isContainedFeeZero <- pletC $ curContainedFee #== mempty + isTotalFeeZero <- pletC $ isContainedFeeZero #&& takerFeeInt #== pdata 0 + pguardC "fee not paid" $ + pfindFeeOutput + # outputs + # datums + # feeAddr + # takerFeeInt + # isTotalFeeZero -- if fees are zero, we don't need a fee output + #$ plam $ \m -> + pmatch (plookup # ownRef # m) $ \case + PNothing -> isContainedFeeZero -- if contained fees are zero, it's fine not to have an entry in the map + PJust mentionedFee -> + curContainedFeeValue #<= mentionedFee -- contained fees paid + + pure . pcon $ PUnit + + PPartialFill pf -> do + amt <- pletC $ pfield @"_0" # pf + + pguardC "amount must be positive" + (0 #< amt) + pguardC "amount must be less than offered amount" + (amt #< offeredAmount) + + pcheckValidFillTime (getField @"validRange" info) (getField @"podStart" odFs) (getField @"podEnd" odFs) + + oldContainedFeeHRec <- pletFieldsC @[ + "pocfLovelaces" + , "pocfOfferedTokens" + , "pocfAskedTokens" + ] curContainedFee + oldContainedFeeLov <- pletC $ getField @"pocfLovelaces" oldContainedFeeHRec + oldContainedFeeOff <- pletC $ getField @"pocfOfferedTokens" oldContainedFeeHRec + oldContainedFeeAsk <- pletC $ getField @"pocfAskedTokens" oldContainedFeeHRec + oldContainedPayment <- pletC $ getField @"podContainedPayment" odFs + priceInteger' <- pletC $ priceInteger # amt + newContainedPayment <- pletC $ oldContainedPayment + priceInteger' + takerFeeInt <- pletC $ getField @"podTakerLovelaceFlatFee" odFs + takerFee <- pletC $ passetClassValuePositive # plovelace # takerFeeInt + + -- check whether there is a fee output (which must then contain the taker fee) + hasFeeOutput <- pletC $ pfindFeeOutput + # outputs + # datums + # feeAddr + # takerFeeInt + # pcon PFalse -- no fee output found; taker fees must be in the first continued partial order output + #$ plam $ \_ -> pcon PTrue -- fee output containing taker fees found + + -- search for "our" continuing output + pmatchC (pcontinuingPartialOrder # getField @"address" ownInpUtxo # nftSymbol # nftTkName # mint # outputs) >>= \case + PNothing -> pure $ ptraceError "continuing output not found" + PJust p -> do + PPair isFirst out <- pmatchC p + PPair expectedValueOut newContainedFeeLov <- pmatchC $ unTermCont $ do + price <- pletC $ passetClassValuePositive # askAC # pdata priceInteger' + sold <- pletC $ passetClassValuePositive # offAC # pdata amt + v <- pletC $ pforgetPositive price <> (psubtractValue # pforgetPositive valueIn # sold) + pure $ pif (isFirst #&& pnot # hasFeeOutput) + + -- taker fee must be included in our continuing output + (pcon $ PPair (v <> pforgetPositive takerFee) (pdata $ pfromData oldContainedFeeLov + pfromData takerFeeInt)) + + -- taker fee is either included in a fee output or in another continuing output; + -- in the latter case, we don't need to check anything, because the validator of that + -- order will do the check + (pcon $ PPair v oldContainedFeeLov) + + outFs <- pletFieldsC @'["value", "datum"] out + actualDatum <- pletC $ presolveDatum # getField @"datum" outFs # datums + actualValueOut :: Term _ (PValue 'Sorted 'Positive) + <- pletC $ getField @"value" outFs + diffActualExpectedValue <- pletC $ psubtractValue # pforgetPositive actualValueOut # expectedValueOut -- Note that all amounts in @diffActualExpectedValue@ are @>= 0@ by courtesy of a check done shortly later. + additionalAskTokens <- pletC $ passetClassValueOf # diffActualExpectedValue # askAC + additionalLovelaces <- pletC $ pif (askAC #== plovelace) 0 (passetClassValueOf # diffActualExpectedValue # plovelace) + let newContainedFeeDat = + pcon $ PPartialOrderContainedFee + $ pdcons @"pocfLovelaces" # pdata (pfromData newContainedFeeLov + additionalLovelaces) + #$ pdcons @"pocfOfferedTokens" # oldContainedFeeOff + #$ pdcons @"pocfAskedTokens" # pdata (oldContainedFeeAsk + additionalAskTokens) + #$ pdnil + let expectedDatum = + pcon $ PPartialOrderDatum + $ pdcons @"podOwnerKey" # getField @"podOwnerKey" odFs + #$ pdcons @"podOwnerAddr" # pdata ownerAddr + #$ pdcons @"podOfferedAsset" # pdata offAC + #$ pdcons @"podOfferedOriginalAmount" # getField @"podOfferedOriginalAmount" odFs + #$ pdcons @"podOfferedAmount" # pdata (offeredAmount - amt) + #$ pdcons @"podAskedAsset" # pdata askAC + #$ pdcons @"podPrice" # pdata podPrice + #$ pdcons @"podNFT" # pdata nftTkName + #$ pdcons @"podStart" # getField @"podStart" odFs + #$ pdcons @"podEnd" # getField @"podEnd" odFs + #$ pdcons @"podPartialFills" # pdata (getField @"podPartialFills" odFs + 1) + #$ pdcons @"podMakerLovelaceFlatFee" # getField @"podMakerLovelaceFlatFee" odFs + #$ pdcons @"podTakerLovelaceFlatFee" # takerFeeInt + #$ pdcons @"podContainedFee" # pdata newContainedFeeDat + #$ pdcons @"podContainedPayment" # pdata newContainedPayment + #$ pdnil + + pguardC "insufficient value in continuing output" + (pgeq # pforgetPositive actualValueOut # expectedValueOut) + pguardC "wrong datum in continuing output" + (actualDatum #== toDatum expectedDatum) + pguardC "continuing output's value should have <= 10 tokens" -- To prevent against token dust attack as order author should always be able to cancel their order. Note that filler cannot increase datum size arbitrarily. + (pvalTotalEntries # actualValueOut #<= 10) + + pure . pcon $ PUnit diff --git a/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrder/Compiled.hs b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrder/Compiled.hs new file mode 100644 index 00000000..5c4f012b --- /dev/null +++ b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrder/Compiled.hs @@ -0,0 +1,51 @@ +{-# LANGUAGE DataKinds #-} + +module GeniusYield.OnChain.DEX.PartialOrder.Compiled ( + originalPartialOrderValidator, + optimizedPartialOrderValidator, + optimizedPartialOrderValidatorWithTracing, +) where + +import PlutusLedgerApi.V1 +import PlutusLedgerApi.V1.Value (AssetClass) + +import Data.Default (def) +import Data.Text (Text) +import GeniusYield.OnChain.DEX.PartialOrder +import Plutarch +import Plutarch.Api.V1 +import qualified Plutarch.Api.V2 as PV2 +import qualified Plutarch.Unsafe as PUNSAFE +import qualified Plutonomy +import Ply hiding ((#)) +import Ply.Plutarch + +import GeniusYield.OnChain.Plutarch.Api (PAssetClass) +import GeniusYield.OnChain.Utils (desiredTracingMode) +import GeniusYield.Plutonomy () + +originalPartialOrderValidator :: Config -> Either Text (TypedScript 'ValidatorRole '[Address, AssetClass]) +originalPartialOrderValidator cnf = toTypedScript cnf mkPartialOrderValidator' + +optimizedPartialOrderValidator :: Either + Text + (TypedScript 'ValidatorRole '[Address, AssetClass]) +optimizedPartialOrderValidator = Plutonomy.optimizeUPLC <$> originalPartialOrderValidator def + +optimizedPartialOrderValidatorWithTracing :: Either + Text + (TypedScript 'ValidatorRole '[Address, AssetClass]) +optimizedPartialOrderValidatorWithTracing = Plutonomy.optimizeUPLC <$> originalPartialOrderValidator def {tracingMode = desiredTracingMode} + +mkPartialOrderValidator' :: + ClosedTerm ( PAddress + :--> PAssetClass + :--> PV2.PValidator + ) +mkPartialOrderValidator' = plam $ \refInputAddr refInputToken datm redm ctx -> + popaque $ mkPartialOrderValidator + # refInputAddr + # refInputToken + # PUNSAFE.punsafeCoerce datm + # PUNSAFE.punsafeCoerce redm + # ctx diff --git a/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrder/Types.hs b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrder/Types.hs new file mode 100644 index 00000000..ec68c85e --- /dev/null +++ b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrder/Types.hs @@ -0,0 +1,179 @@ +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DerivingVia #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} + +module GeniusYield.OnChain.DEX.PartialOrder.Types + ( PMaybePPOSIXTimeData (..) + , PPartialOrderFeeOutput (..) + , PPartialOrderContainedFee (..) + , PPartialOrderConfigDatum (..) + , PPartialOrderDatum (..) + , PPartialOrderAction (..) + , type PHasType + , type PartialOrderFeeOutputRec + , type PartialOrderContainedFeeRec + , type PartialOrderConfigRec + , type PartialOrderRec + ) where + +import GHC.TypeLits +import Plutarch +import Plutarch.Api.V1 +import Plutarch.DataRepr +import Plutarch.DataRepr.Internal +import Plutarch.DataRepr.Internal.HList.Utils +import Plutarch.Extra.RationalData +import Plutarch.Prelude + +import GeniusYield.OnChain.Plutarch.Types + +-- $setup +-- >>> :set -XDataKinds +-- >>> import GeniusYield.OnChain.Plutarch.Run +-- >>> import Plutarch.Prelude + +type PHasType l a fs = + (PUnLabel (IndexList (PLabelIndex l fs) fs) ~ a, KnownSymbol l, KnownNat (PLabelIndex l fs)) + +type PartialOrderFeeOutputRec + = '[ "pofdMentionedFees" ':= PMap 'Unsorted PTxOutRef (PValue 'Sorted 'Positive) + , "pofdReservedValue" ':= PValue 'Sorted 'Positive + , "pofdSpentUTxORef" ':= PMaybeData PTxOutRef -- Here we don't require @PAsData@ wrapper to get @PTryFrom@ instance, i.e., we don't need to put @PMaybeData (PAsData PTxOutRef)@ unlike for @PPOSIXTime@. + ] + +newtype PPartialOrderFeeOutput (s :: S) + = PPartialOrderFeeOutput (Term s (PDataRecord PartialOrderFeeOutputRec)) + deriving stock (Generic) + deriving anyclass (PlutusType, PIsData, PEq, PDataFields, PTryFrom PData) + +instance DerivePlutusType PPartialOrderFeeOutput where type DPTStrat _ = PlutusTypeData + +instance PTryFrom PData (PAsData PPartialOrderFeeOutput) + +type PartialOrderContainedFeeRec + = '[ "pocfLovelaces" ':= PInteger + , "pocfOfferedTokens" ':= PInteger + , "pocfAskedTokens" ':= PInteger + ] + +newtype PPartialOrderContainedFee (s :: S) + = PPartialOrderContainedFee (Term s (PDataRecord PartialOrderContainedFeeRec)) + deriving stock (Generic) + deriving anyclass (PlutusType, PIsData, PEq, PPartialOrd, PDataFields, PTryFrom PData) + +instance DerivePlutusType PPartialOrderContainedFee where type DPTStrat _ = PlutusTypeData + +instance PTryFrom PData (PAsData PPartialOrderContainedFee) + +-- | +-- >>> :{ +-- let a = +-- pcon $ PPartialOrderContainedFee +-- $ pdcons @"pocfLovelaces" # pdata 1 +-- #$ pdcons @"pocfOfferedTokens" # pdata 2 +-- #$ pdcons @"pocfAskedTokens" # pdata 3 +-- #$ pdnil +-- b = +-- pcon $ PPartialOrderContainedFee +-- $ pdcons @"pocfLovelaces" # pdata 2 +-- #$ pdcons @"pocfOfferedTokens" # pdata 1 +-- #$ pdcons @"pocfAskedTokens" # pdata 0 +-- #$ pdnil +-- in (evalT $ a <> b, evalT $ b <> mempty) +-- :} +-- (Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniData (Constr 0 [I 3,I 3,I 3])))}},ExBudget {exBudgetCPU = ExCPU 6087009, exBudgetMemory = ExMemory 17418},[]),Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniData (Constr 0 [I 2,I 1,I 0])))}},ExBudget {exBudgetCPU = ExCPU 6062009, exBudgetMemory = ExMemory 17254},[])) + +instance Semigroup (Term s PPartialOrderContainedFee) where + a <> b = + pletFields @["pocfLovelaces", "pocfOfferedTokens", "pocfAskedTokens"] a $ \a' -> + pletFields @["pocfLovelaces", "pocfOfferedTokens", "pocfAskedTokens"] b $ \b' -> + pcon $ PPartialOrderContainedFee + $ pdcons @"pocfLovelaces" # pdata (getField @"pocfLovelaces" a' + getField @"pocfLovelaces" b') + #$ pdcons @"pocfOfferedTokens" # pdata (getField @"pocfOfferedTokens" a' + getField @"pocfOfferedTokens" b') + #$ pdcons @"pocfAskedTokens" # pdata (getField @"pocfAskedTokens" a' + getField @"pocfAskedTokens" b') + #$ pdnil + +instance Monoid (Term s PPartialOrderContainedFee) where + mempty = + plet (pdata 0) $ \z -> + pcon $ PPartialOrderContainedFee + $ pdcons @"pocfLovelaces" # z + #$ pdcons @"pocfOfferedTokens" # z + #$ pdcons @"pocfAskedTokens" # z + #$ pdnil + +type PartialOrderConfigRec + = '[ "pocdSignatories" ':= PBuiltinList (PAsData PPubKeyHash) + , "pocdReqSignatories" ':= PInteger + , "pocdNftSymbol" ':= PCurrencySymbol + , "pocdFeeAddr" ':= PAddress + , "pocdMakerFeeFlat" ':= PInteger + , "pocdMakerFeeRatio" ':= PRationalData + , "pocdTakerFee" ':= PInteger + , "pocdMinDeposit" ':= PInteger + ] + +newtype PPartialOrderConfigDatum s + = PPartialOrderConfigDatum (Term s (PDataRecord PartialOrderConfigRec)) + deriving stock (Generic) + deriving anyclass (PlutusType, PIsData, PEq, PDataFields) + +instance DerivePlutusType PPartialOrderConfigDatum where type DPTStrat _ = PlutusTypeData + +instance PTryFrom PData (PAsData PPartialOrderConfigDatum) + +type PartialOrderRec + = '[ "podOwnerKey" ':= PPubKeyHash + , "podOwnerAddr" ':= PAddress + , "podOfferedAsset" ':= PAssetClass + , "podOfferedOriginalAmount" ':= PInteger + , "podOfferedAmount" ':= PInteger + , "podAskedAsset" ':= PAssetClass + , "podPrice" ':= PRationalData + , "podNFT" ':= PTokenName + , "podStart" ':= PMaybePPOSIXTimeData + , "podEnd" ':= PMaybePPOSIXTimeData + , "podPartialFills" ':= PInteger + , "podMakerLovelaceFlatFee" ':= PInteger + , "podTakerLovelaceFlatFee" ':= PInteger + , "podContainedFee" ':= PPartialOrderContainedFee + , "podContainedPayment" ':= PInteger + ] + +newtype PPartialOrderDatum s + = PPartialOrderDatum (Term s (PDataRecord PartialOrderRec)) + deriving stock (Generic) + deriving anyclass (PlutusType, PIsData, PEq, PDataFields) + +instance DerivePlutusType PPartialOrderDatum where type DPTStrat _ = PlutusTypeData + +instance PTryFrom PData (PAsData PPartialOrderDatum) + +-- | Plutarch's `PMaybeData` but specialised to `PPOSIXTime`. This was done to have `PTryFrom PData PMaybePPOSIXTimeData` instance as otherwise we were having instance of `PTryFrom PData (PMaybeData (PAsData PPOSIXTime))`, i.e., needed to add an extra `PAsData` wrapper around `PPOSIXTime`. +data PMaybePPOSIXTimeData (s :: S) + = PPDJust (Term s (PDataRecord '["_0" ':= PPOSIXTime])) + | PPDNothing (Term s (PDataRecord '[])) + deriving stock (Generic) + deriving anyclass (PlutusType, PIsData, PEq, PShow) +instance DerivePlutusType PMaybePPOSIXTimeData where type DPTStrat _ = PlutusTypeData +instance PTryFrom PData PMaybePPOSIXTimeData +instance PTryFrom PData (PAsData PMaybePPOSIXTimeData) + +data PPartialOrderAction (s :: S) + = PPartialCancel (Term s (PDataRecord '[])) + | PPartialFill (Term s (PDataRecord '["_0" ':= PInteger])) + | PCompleteFill (Term s (PDataRecord '[])) + deriving stock (Generic) + deriving anyclass (PlutusType, PIsData, PEq) + +instance DerivePlutusType PPartialOrderAction where type DPTStrat _ = PlutusTypeData + +instance PTryFrom PData (PAsData PPartialOrderAction) diff --git a/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrderConfig.hs b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrderConfig.hs new file mode 100644 index 00000000..0123394d --- /dev/null +++ b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrderConfig.hs @@ -0,0 +1,130 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE PartialTypeSignatures #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} + +module GeniusYield.OnChain.DEX.PartialOrderConfig (mkPartialOrderConfigValidator) where + +import GeniusYield.OnChain.DEX.PartialOrder.Types (PPartialOrderConfigDatum) +import GeniusYield.OnChain.Plutarch.Api (PAssetClass, pguardC, pguardC', phasSignatures, pletC, + pletFieldsC, pmatchC) +import GeniusYield.OnChain.Plutarch.Utils (pallUnique, pfindOwnInput, pgetContinuingOutputUsingNft, + pparseDatum') +import GeniusYield.OnChain.Plutarch.Value (passetClassValueOf, pvalTotalEntries) +import Plutarch (Term, pcon, plam, type (:-->), unTermCont, (#)) +import Plutarch.Api.V1 (PPubKeyHash, PScriptPurpose (PSpending)) +import qualified Plutarch.Api.V2 as PV2 +import Plutarch.DataRepr (pfield) +import Plutarch.Extra.RationalData +import Plutarch.List (pfind) +import Plutarch.Prelude (PAsData, PBool (..), PBuiltinList, PEq ((#==)), PInteger, + PMaybe (..), PPartialOrd ((#<=)), PUnit (..), getField, + pfromData, plength, pmatch) + +mkPartialOrderConfigValidator :: forall s. Term s + ( PAssetClass + :--> PPartialOrderConfigDatum + :--> PUnit + :--> PV2.PScriptContext + :--> PUnit + ) +mkPartialOrderConfigValidator + = plam $ \nftAC d _ ctx -> unTermCont $ do + + ctxFs <- pletFieldsC @["txInfo", "purpose"] ctx + info <- pletFieldsC + @[ "inputs" + , "outputs" + , "signatories" + , "datums" + ] + $ getField @"txInfo" ctxFs + + -- Find our own input, asserting spending validator. + -- Knowing own input is important to find the continuing output, as it must be at same address. + -- Additionally, we allow spending of an UTxO belonging to this validator if it lacks the required NFT. + PSpending spRec <- pmatchC $ getField @"purpose" ctxFs + ownRef <- pletC $ pfield @"_0" # spRec + PJust ownInput <- pmatchC $ pfindOwnInput # getField @"inputs" info # ownRef + ownInpUtxoFs <- pletFieldsC @["value", "address"] $ pfield @"resolved" # ownInput + + -- Succeed immediately if there is no NFT. + pguardC' (pcon PUnit) $ passetClassValueOf # getField @"value" ownInpUtxoFs # nftAC #== 1 + + dFs <- pletFieldsC @[ "pocdSignatories" + , "pocdReqSignatories" + , "pocdNftSymbol" + ] d + -- Assert multi-sig is correctly exercised. + pguardC "missing signature(s)" $ phasSignatures # getField @"signatories" info # getField @"pocdSignatories" dFs # getField @"pocdReqSignatories" dFs + + -- Find continuing output with updated datum. + outputs <- pletC $ getField @"outputs" info + ownOutUtxo <- pletC $ pgetContinuingOutputUsingNft # getField @"address" ownInpUtxoFs # nftAC # outputs + ownOutUtxoFs <- pletFieldsC @["value", "datum"] ownOutUtxo + -- Continuing output does not have more than 10 tokens. + pguardC "continuing output's value should have <= 10 tokens" $ pvalTotalEntries # getField @"value" ownOutUtxoFs #<= 10 + -- Assert new datum is of correct shape. Unlike PlutusTx, it checks whether credentials are of correct length, etc. + newDatum <- pletC $ pfromData $ pparseDatum' @PPartialOrderConfigDatum # getField @"datum" ownOutUtxoFs # getField @"datums" info + newDatumFs <- pletFieldsC @[ "pocdNftSymbol" + , "pocdMakerFeeFlat" + , "pocdMakerFeeRatio" + , "pocdTakerFee" + , "pocdMinDeposit" + , "pocdReqSignatories" + , "pocdSignatories" + , "pocdFeeAddr" + ] newDatum + + -- Check the fields of new datum and assert that they are bounded. + + -- @pocdSignatories@ are unique and their number lies b/w 1 & 10 (inclusive). + -- Note that it is possible to dissolve multi-sig by giving a single signatory for which no corresponding key is known. + newSigs :: Term _ (PBuiltinList (PAsData PPubKeyHash)) <- pletC $ getField @"pocdSignatories" newDatumFs + pguardC "duplicate signatories" $ pallUnique # newSigs + -- We are iterating over list of signatories twice (earlier when determining duplicates and now, to determine length) but performance is not a concern here. + newSigsNum <- pletC $ plength # newSigs + pguardC "too many signatories" $ newSigsNum #<= 10 + pguardC "non-positive signatories" $ 1 #<= newSigsNum + + -- @pocdReqSignatories@ is positive and not more than the number of signatories. + newReqSigs :: Term _ PInteger <- pletC $ getField @"pocdReqSignatories" newDatumFs + pguardC "non-positive number of required signatories" $ 1 #<= newReqSigs + pguardC "too many required signatories" $ newReqSigs #<= newSigsNum + + -- @pocdNftSymbol@ is not altered. + pguardC "pocdNftSymbol changed" $ getField @"pocdNftSymbol" dFs #== getField @"pocdNftSymbol" newDatumFs + + -- Even though we have checked the format of fee address when parsing the datum, but to be sure of any edges, we assert that an output is made to this address as part of this transaction. + newFeeAddr <- pletC $ getField @"pocdFeeAddr" newDatumFs + pguardC "not paid to fee address" $ + -- We are iterating over list of outputs twice (traversed earlier when finding continuing output) but performance is not a concern here. + pmatch (pfind # plam (\output -> pfield @"address" # output #== newFeeAddr) # outputs) $ \case + PNothing -> pcon PFalse + PJust _ -> pcon PTrue + + -- @pocdMakerFeeFlat@, @pocdTakerFee@ and @pocdMinDeposit@ are all non-negative and not more than 1000 ADA. + let lovelaceThreshold = 1000_000_000 + newMakerFeeFlat :: Term _ PInteger <- pletC $ getField @"pocdMakerFeeFlat" newDatumFs + pguardC "negative flat maker fee" $ 0 #<= newMakerFeeFlat + pguardC "high flat maker fee" $ newMakerFeeFlat #<= lovelaceThreshold + newTakerFee :: Term _ PInteger <- pletC $ getField @"pocdTakerFee" newDatumFs + pguardC "negative taker fee" $ 0 #<= newTakerFee + pguardC "high taker fee" $ newTakerFee #<= lovelaceThreshold + newMinDeposit :: Term _ PInteger <- pletC $ getField @"pocdMinDeposit" newDatumFs + pguardC "negative min ada deposit" $ 0 #<= newMinDeposit + pguardC "high min ada deposit" $ newMinDeposit #<= lovelaceThreshold + + -- @pocdMakerFeeRatio@ is non-negative and not more than 1. + newMakerFeeRatio :: Term _ PRationalData <- pletC $ getField @"pocdMakerFeeRatio" newDatumFs + pguardC "negative maker fee ratio" $ 0 #<= (pfield @"numerator" # newMakerFeeRatio :: Term _ PInteger) + -- Module @Plutarch.Extra.RationalData@ does not export constructor for @PRationalData@, so comparison is performed using `prationalFromData`. + pguardC "high maker fee ratio" $ prationalFromData # newMakerFeeRatio #<= 1 + + -- All good, we succeed. + pure . pcon $ PUnit diff --git a/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrderConfig/Compiled.hs b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrderConfig/Compiled.hs new file mode 100644 index 00000000..6ffc5e0c --- /dev/null +++ b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrderConfig/Compiled.hs @@ -0,0 +1,43 @@ +{-# LANGUAGE DataKinds #-} + +module GeniusYield.OnChain.DEX.PartialOrderConfig.Compiled ( + originalPartialOrderConfigValidator, + optimizedPartialOrderConfigValidator, + optimizedPartialOrderConfigValidatorWithTracing, +) where + +import Data.Default (def) +import Data.Text (Text) +import GeniusYield.OnChain.DEX.PartialOrderConfig +import GeniusYield.OnChain.Plutarch.Api (PAssetClass) +import GeniusYield.OnChain.Utils (desiredTracingMode) +import GeniusYield.Plutonomy () +import Plutarch +import qualified Plutarch.Api.V2 as PV2 +import qualified Plutarch.Unsafe as PUNSAFE +import qualified Plutonomy +import PlutusLedgerApi.V1.Value (AssetClass) +import Ply hiding ((#)) +import Ply.Plutarch + +type POConfigScript = TypedScript 'ValidatorRole '[AssetClass] + +originalPartialOrderConfigValidator :: Config -> Either Text POConfigScript +originalPartialOrderConfigValidator cnf = toTypedScript cnf mkPartialOrderConfigValidator' + +optimizedPartialOrderConfigValidator :: Either Text POConfigScript +optimizedPartialOrderConfigValidator = Plutonomy.optimizeUPLC <$> originalPartialOrderConfigValidator def + +optimizedPartialOrderConfigValidatorWithTracing :: Either Text POConfigScript +optimizedPartialOrderConfigValidatorWithTracing = Plutonomy.optimizeUPLC <$> originalPartialOrderConfigValidator def {tracingMode = desiredTracingMode} + +mkPartialOrderConfigValidator' :: + ClosedTerm ( PAssetClass + :--> PV2.PValidator + ) +mkPartialOrderConfigValidator' = plam $ \nftAC datm redm ctx -> + popaque $ mkPartialOrderConfigValidator + # nftAC + # PUNSAFE.punsafeCoerce datm + # PUNSAFE.punsafeCoerce redm + # ctx diff --git a/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrderNFT.hs b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrderNFT.hs new file mode 100644 index 00000000..29f065f1 --- /dev/null +++ b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrderNFT.hs @@ -0,0 +1,253 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE PartialTypeSignatures #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# OPTIONS_GHC -O2 -fspecialize-aggressively #-} + +module GeniusYield.OnChain.DEX.PartialOrderNFT (mkPartialOrderNFTPolicy) where + +import Prelude (Bool (..), Semigroup (..), pure, ($), (.)) + +import Plutarch.Api.V1 (AmountGuarantees (..), KeyGuarantees (Sorted, Unsorted), + PAddress, PCurrencySymbol, PDatum, PDatumHash, PMap, + PMaybeData (..), PTokenName, PTxOutRef, PValue) +import qualified Plutarch.Api.V1.AssocMap as PMap +import Plutarch.Api.V1.Scripts (PScriptHash) +import Plutarch.Api.V1.Value (pforgetPositive) +import qualified Plutarch.Api.V2 as PV2 +import Plutarch.Extra.RationalData (PRationalData, prationalFromData) +import Plutarch.Num (PNum ((#*))) +import Plutarch.Prelude (PAsData, PBuiltinList, PEq ((#==)), PInteger, + PListLike (pelimList, pnull), PMaybe (PJust, PNothing), + PPartialOrd ((#<), (#<=)), PUnit, Term, getField, pany, + pconstant, pdata, perror, pfield, pfromData, pfstBuiltin, + pif, plam, plet, pletFields, pmatch, pnot, psndBuiltin, + pto, ptraceError, type (:-->), unTermCont, (#$), (#&&), + (#)) +import qualified Plutarch.Rational as Rational + +import GeniusYield.OnChain.DEX.PartialOrder.Types (PMaybePPOSIXTimeData (..), PPartialOrderContainedFee (..), + PPartialOrderDatum (..)) +import GeniusYield.OnChain.DEX.Utils (pfindMarkedRefInput, pgetContainedFeeValue') +import GeniusYield.OnChain.Plutarch.Api (PAssetClass, pexpectedTokenName, pguardC, pletC, + pletFieldsC, pmatchC, pownSymbol, putxoConsumed) +import GeniusYield.OnChain.Plutarch.Utils (pceiling, pfindOutputWithNft, pisAddressForScript, + pparseDatum') +import GeniusYield.OnChain.Plutarch.Value (passetClass, passetClassValue, pgeq, plovelace) + +mkPartialOrderNFTPolicy :: + Term s (PScriptHash + :--> PAddress + :--> PAssetClass + :--> PAsData (PMaybeData PTxOutRef) + :--> PV2.PScriptContext + :--> PUnit + ) +mkPartialOrderNFTPolicy = plam $ \sh refInputAddr refInputToken mtxOutRef ctx -> + policy sh refInputAddr refInputToken (pfromData mtxOutRef) ctx + where + policy :: + Term s PScriptHash + -> Term s PAddress + -> Term s PAssetClass + -> Term s (PMaybeData PTxOutRef) + -> Term s PV2.PScriptContext + -> Term s PUnit + + policy sh refInputAddr refInputToken txOutRef ctx = + plet (pownSymbol # ctx) $ \ownSymbol -> + plet (pfield @"txInfo" # ctx) $ \info -> + pletFields @'[ "inputs" + , "referenceInputs" + , "outputs" + , "datums" + , "mint" + ] info $ \infoFs -> + plet (getField @"mint" infoFs) $ \mint -> + pmatch txOutRef $ \case + PDNothing _ -> checkIfBurning # ownSymbol # mint + + PDJust rec -> plet (pfield @"_0" # rec) $ \ref -> + plet (pfindMarkedRefInput # getField @"referenceInputs" infoFs # refInputAddr # refInputToken) $ \markedRefDatum -> + pletFields @'[ "pocdMakerFeeFlat" + , "pocdMakerFeeRatio" + , "pocdTakerFee" + , "pocdMinDeposit" + ] markedRefDatum $ \markedRefDatumFs -> + validateMinting # + sh # + ref # + ownSymbol # + (pexpectedTokenName # ref) # + getField @"inputs" infoFs # + getField @"outputs" infoFs # + getField @"datums" infoFs # + getField @"pocdMakerFeeFlat" markedRefDatumFs # + getField @"pocdMakerFeeRatio" markedRefDatumFs # + getField @"pocdTakerFee" markedRefDatumFs # + getField @"pocdMinDeposit" markedRefDatumFs # + (mintedTokens_ # ownSymbol # mint) + + validateMinting :: + Term s (PScriptHash + :--> PTxOutRef + :--> PCurrencySymbol + :--> PTokenName + :--> PBuiltinList PV2.PTxInInfo + :--> PBuiltinList PV2.PTxOut + :--> PMap 'Unsorted PDatumHash PDatum + :--> PInteger + :--> PRationalData + :--> PInteger + :--> PInteger + :--> PMap any PTokenName PInteger + :--> PUnit + ) + validateMinting = plam $ + \sh txOutRef cs tn inputs outputs datums makerFeeFlatContract makerFeeRatioContract takerFeeFlatContract deposit -> + let + hasUtxoConsumed = putxoConsumed # txOutRef # inputs + mintedTnAmt x = pfromData (psndBuiltin # x) + mintedTnName x = pfromData (pfstBuiltin # x) + errMsg = "Expected: 1.) UTxO consumption. 2.) Minted Amount should be 1. 3.) Valid Token name. 4.) Correct datum." + in + pelimList (\h t -> pif + ( hasUtxoConsumed + #&& pnull # t + #&& mintedTnAmt h #== 1 + #&& mintedTnName h #== tn + ) + (checkOutput # sh # deposit # outputs # datums # cs # tn # makerFeeFlatContract # makerFeeRatioContract # takerFeeFlatContract) + (ptraceError errMsg) + ) (ptraceError "minted tokens list should not be empty.") . pto + + checkIfBurning :: + Term s (PCurrencySymbol + :--> PValue 'Sorted 'NoGuarantees + :--> PUnit + ) + checkIfBurning = plam $ + \cs mint -> pif + (pany # + plam (\v -> 0 #<= pfromData (psndBuiltin # v)) # + pto (mintedTokens_ # cs # mint) + ) + (ptraceError "expected only burning") + (pconstant ()) + + checkOutput :: Term s (PScriptHash + :--> PInteger + :--> PBuiltinList PV2.PTxOut + :--> PMap 'Unsorted PDatumHash PDatum + :--> PCurrencySymbol + :--> PTokenName + :--> PInteger + :--> PRationalData + :--> PInteger + :--> PUnit + ) + checkOutput = plam $ + \sh deposit outputs datums cs tn makerFeeFlatContract makerFeeRatioContract takerFeeFlatContract -> unTermCont $ do + nftAC <- pletC $ passetClass # cs # tn + PJust txOut <- pmatchC $ pfindOutputWithNft # outputs # nftAC + + pguardC "expected NFT to go to the script" $ + pisAddressForScript # (pfield @"address" # txOut) # sh + + od <- pletC $ pparseDatum' @PPartialOrderDatum # (pfield @"datum" # txOut) # datums + odFs <- pletFieldsC @[ + "podOfferedAsset" + , "podOfferedOriginalAmount" + , "podOfferedAmount" + , "podAskedAsset" + , "podPrice" + , "podNFT" + , "podStart" + , "podEnd" + , "podPartialFills" + , "podMakerLovelaceFlatFee" + , "podTakerLovelaceFlatFee" + , "podContainedFee" + , "podContainedPayment" + ] od + + (offeredAmount :: Term _ PInteger) <- pletC $ getField @"podOfferedAmount" odFs + (offeredOriginalAmount :: Term _ PInteger) <- pletC $ getField @"podOfferedOriginalAmount" odFs + (partialFills :: Term _ PInteger) <- pletC $ getField @"podPartialFills" odFs + (askedPrice :: Term _ PRationalData) <- pletC $ getField @"podPrice" odFs + (containedFee :: Term _ PPartialOrderContainedFee) <- pletC $ getField @"podContainedFee" odFs + (containedPayment :: Term _ PInteger) <- pletC $ getField @"podContainedPayment" odFs + (askedPriceN :: Term _ PInteger) <- pletC $ pfield @"numerator" # askedPrice + makerFeeFlatDat <- pletC $ getField @"podMakerLovelaceFlatFee" odFs + takerFeeFlatDat <- pletC $ getField @"podTakerLovelaceFlatFee" odFs + + containedFeeHRec <- pletFieldsC @[ + "pocfLovelaces" + , "pocfOfferedTokens" + , "pocfAskedTokens" + ] containedFee + containedFeeLov <- pletC $ getField @"pocfLovelaces" containedFeeHRec + containedFeeOff <- pletC $ getField @"pocfOfferedTokens" containedFeeHRec + containedFeeAsk <- pletC $ getField @"pocfAskedTokens" containedFeeHRec + offeredAsset <- pletC $ getField @"podOfferedAsset" odFs + askedAsset <- pletC $ getField @"podAskedAsset" odFs + orderStart <- pmatchC $ getField @"podStart" odFs + orderEnd <- pmatchC $ getField @"podEnd" odFs + + pguardC "offered amount should be positive" $ + 0 #< offeredAmount + pguardC "offered amount should equal original amount" $ + offeredOriginalAmount #== offeredAmount + pguardC "wrong name for NFT" $ + getField @"podNFT" odFs #== tn + pguardC "number of partial fills must be zero" $ + 0 #== partialFills + pguardC "podPrice must be positive" $ + 0 #< askedPriceN + pguardC "podOfferedAsset must be different than podAskedAsset" $ + pnot #$ offeredAsset #== askedAsset + pguardC "order end shouldn't be earlier than start" $ + case (orderStart, orderEnd) of + (PPDJust orderStart', PPDJust orderEnd') -> orderStart' #<= orderEnd' + _otherwise -> pconstant True + pguardC "podMakerLovelaceFlatFee is not same as that mentioned pocfLovelaces" $ + makerFeeFlatDat #== containedFeeLov + pguardC "podTakerLovelaceFlatFee is not the same as mentioned in config contract" $ + takerFeeFlatDat #== takerFeeFlatContract + + offeredAssets <- pletC $ passetClassValue # offeredAsset # pdata offeredAmount + nft <- pletC $ passetClassValue # nftAC # pdata 1 + depositValue <- pletC $ passetClassValue # plovelace # pdata deposit + containedFee' <- pletC $ pforgetPositive $ pgetContainedFeeValue' # offeredAsset # askedAsset # containedFeeLov # containedFeeOff # containedFeeAsk + expectedOffer <- pletC $ offeredAssets <> nft <> depositValue <> containedFee' + actualOffer <- pletC $ pforgetPositive $ pfromData (pfield @"value" # txOut) + + pguardC "offer too low" $ + pgeq # actualOffer # expectedOffer + + + pguardC "pocfAskedTokens in podContainedFee should be zero" $ + pfromData containedFeeAsk #== 0 + + pguardC "fees too low" $ + makerFeeFlatContract #<= pfromData containedFeeLov + #&& pceiling # ((prationalFromData # makerFeeRatioContract) #* (Rational.pfromInteger # offeredAmount)) #<= pfromData containedFeeOff + + pguardC "contained payment must be zero" $ + containedPayment #== 0 + + pure . pconstant $ () + +mintedTokens_ :: + Term s (PCurrencySymbol + :--> PValue 'Sorted 'NoGuarantees + :--> PMap 'Sorted PTokenName PInteger + ) +mintedTokens_ = plam $ + \cs mint -> + pmatch (PMap.plookup # cs # pto mint) $ + \case + PNothing -> perror + PJust m -> m diff --git a/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrderNFT/Compiled.hs b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrderNFT/Compiled.hs new file mode 100644 index 00000000..2b51a578 --- /dev/null +++ b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrderNFT/Compiled.hs @@ -0,0 +1,48 @@ +module GeniusYield.OnChain.DEX.PartialOrderNFT.Compiled ( + originalPartialOrderNftPolicy, + optimizedPartialOrderNftPolicy, + optimizedPartialOrderNftPolicyWithTracing +) where + + +import Data.Default (def) +import Data.Text (Text) +import Plutarch (Config (tracingMode)) +import Plutarch.Api.V1 (PAddress) +import Plutarch.Api.V1.Scripts (PScriptHash) +import qualified Plutarch.Api.V2 as PV2 +import Plutarch.Prelude (ClosedTerm, plam, + popaque, type (:-->), + (#)) +import qualified Plutarch.Unsafe as PUNSAFE +import qualified Plutonomy +import PlutusLedgerApi.V1 (Address, ScriptHash) +import PlutusLedgerApi.V1.Value (AssetClass) +import Ply (ScriptRole (MintingPolicyRole), + TypedScript) +import Ply.Plutarch (toTypedScript) + +import GeniusYield.OnChain.DEX.PartialOrderNFT (mkPartialOrderNFTPolicy) +import GeniusYield.OnChain.Plutarch.Types (PAssetClass) +import GeniusYield.OnChain.Utils (desiredTracingMode) +import GeniusYield.Plutonomy () + +originalPartialOrderNftPolicy :: Config + -> Either Text (TypedScript 'MintingPolicyRole '[ScriptHash, Address, AssetClass]) +originalPartialOrderNftPolicy cnf = toTypedScript cnf mkPartialOrderNFTPolicy' + +optimizedPartialOrderNftPolicy :: Either Text (TypedScript 'MintingPolicyRole '[ScriptHash, Address, AssetClass]) +optimizedPartialOrderNftPolicy = Plutonomy.optimizeUPLC <$> originalPartialOrderNftPolicy def + +optimizedPartialOrderNftPolicyWithTracing :: Either Text (TypedScript 'MintingPolicyRole '[ScriptHash, Address, AssetClass]) +optimizedPartialOrderNftPolicyWithTracing = Plutonomy.optimizeUPLC <$> originalPartialOrderNftPolicy def {tracingMode = desiredTracingMode} + +mkPartialOrderNFTPolicy' :: ClosedTerm (PScriptHash :--> PAddress :--> PAssetClass :--> PV2.PMintingPolicy) +mkPartialOrderNFTPolicy' = plam $ \sh refInputAddr refInputToken redm ctx -> + popaque $ mkPartialOrderNFTPolicy + # sh + # refInputAddr + # refInputToken + # PUNSAFE.punsafeCoerce redm + # ctx + diff --git a/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrderNFTV1_1.hs b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrderNFTV1_1.hs new file mode 100644 index 00000000..6b9ecfcf --- /dev/null +++ b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrderNFTV1_1.hs @@ -0,0 +1,253 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE PartialTypeSignatures #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# OPTIONS_GHC -O2 -fspecialize-aggressively #-} + +module GeniusYield.OnChain.DEX.PartialOrderNFTV1_1 (mkPartialOrderNFTV1_1Policy) where + +import Prelude (Bool (..), Semigroup (..), pure, ($), (.)) + +import Plutarch.Api.V1 (AmountGuarantees (..), KeyGuarantees (Sorted, Unsorted), + PAddress, PCurrencySymbol, PDatum, PDatumHash, PMap, + PMaybeData (..), PTokenName, PTxOutRef, PValue) +import qualified Plutarch.Api.V1.AssocMap as PMap +import Plutarch.Api.V1.Scripts (PScriptHash) +import Plutarch.Api.V1.Value (pforgetPositive) +import qualified Plutarch.Api.V2 as PV2 +import Plutarch.Extra.RationalData (PRationalData, prationalFromData) +import Plutarch.Num (PNum ((#*))) +import Plutarch.Prelude (PAsData, PBuiltinList, PEq ((#==)), PInteger, + PListLike (pelimList, pnull), PMaybe (PJust, PNothing), + PPartialOrd ((#<), (#<=)), PUnit, Term, getField, pany, + pconstant, pdata, perror, pfield, pfromData, pfstBuiltin, + pif, plam, plet, pletFields, pmatch, pnot, psndBuiltin, + pto, ptraceError, type (:-->), unTermCont, (#$), (#&&), + (#)) +import qualified Plutarch.Rational as Rational + +import GeniusYield.OnChain.DEX.PartialOrder.Types (PMaybePPOSIXTimeData (..), PPartialOrderContainedFee (..), + PPartialOrderDatum (..)) +import GeniusYield.OnChain.DEX.Utils (pfindMarkedRefInput, pgetContainedFeeValue') +import GeniusYield.OnChain.Plutarch.Api (PAssetClass, pexpectedTokenName, pguardC, pletC, + pletFieldsC, pmatchC, pownSymbol, putxoConsumed) +import GeniusYield.OnChain.Plutarch.Utils (pfindOutputWithNft, pfloor, pisAddressForScript, + pparseDatum') +import GeniusYield.OnChain.Plutarch.Value (passetClass, passetClassValue, pgeq, plovelace) + +mkPartialOrderNFTV1_1Policy :: + Term s (PScriptHash + :--> PAddress + :--> PAssetClass + :--> PAsData (PMaybeData PTxOutRef) + :--> PV2.PScriptContext + :--> PUnit + ) +mkPartialOrderNFTV1_1Policy = plam $ \sh refInputAddr refInputToken mtxOutRef ctx -> + policy sh refInputAddr refInputToken (pfromData mtxOutRef) ctx + where + policy :: + Term s PScriptHash + -> Term s PAddress + -> Term s PAssetClass + -> Term s (PMaybeData PTxOutRef) + -> Term s PV2.PScriptContext + -> Term s PUnit + + policy sh refInputAddr refInputToken txOutRef ctx = + plet (pownSymbol # ctx) $ \ownSymbol -> + plet (pfield @"txInfo" # ctx) $ \info -> + pletFields @'[ "inputs" + , "referenceInputs" + , "outputs" + , "datums" + , "mint" + ] info $ \infoFs -> + plet (getField @"mint" infoFs) $ \mint -> + pmatch txOutRef $ \case + PDNothing _ -> checkIfBurning # ownSymbol # mint + + PDJust rec -> plet (pfield @"_0" # rec) $ \ref -> + plet (pfindMarkedRefInput # getField @"referenceInputs" infoFs # refInputAddr # refInputToken) $ \markedRefDatum -> + pletFields @'[ "pocdMakerFeeFlat" + , "pocdMakerFeeRatio" + , "pocdTakerFee" + , "pocdMinDeposit" + ] markedRefDatum $ \markedRefDatumFs -> + validateMinting # + sh # + ref # + ownSymbol # + (pexpectedTokenName # ref) # + getField @"inputs" infoFs # + getField @"outputs" infoFs # + getField @"datums" infoFs # + getField @"pocdMakerFeeFlat" markedRefDatumFs # + getField @"pocdMakerFeeRatio" markedRefDatumFs # + getField @"pocdTakerFee" markedRefDatumFs # + getField @"pocdMinDeposit" markedRefDatumFs # + (mintedTokens_ # ownSymbol # mint) + + validateMinting :: + Term s (PScriptHash + :--> PTxOutRef + :--> PCurrencySymbol + :--> PTokenName + :--> PBuiltinList PV2.PTxInInfo + :--> PBuiltinList PV2.PTxOut + :--> PMap 'Unsorted PDatumHash PDatum + :--> PInteger + :--> PRationalData + :--> PInteger + :--> PInteger + :--> PMap any PTokenName PInteger + :--> PUnit + ) + validateMinting = plam $ + \sh txOutRef cs tn inputs outputs datums makerFeeFlatContract makerFeeRatioContract takerFeeFlatContract deposit -> + let + hasUtxoConsumed = putxoConsumed # txOutRef # inputs + mintedTnAmt x = pfromData (psndBuiltin # x) + mintedTnName x = pfromData (pfstBuiltin # x) + errMsg = "Expected: 1.) UTxO consumption. 2.) Minted Amount should be 1. 3.) Valid Token name. 4.) Correct datum." + in + pelimList (\h t -> pif + ( hasUtxoConsumed + #&& pnull # t + #&& mintedTnAmt h #== 1 + #&& mintedTnName h #== tn + ) + (checkOutput # sh # deposit # outputs # datums # cs # tn # makerFeeFlatContract # makerFeeRatioContract # takerFeeFlatContract) + (ptraceError errMsg) + ) (ptraceError "minted tokens list should not be empty.") . pto + + checkIfBurning :: + Term s (PCurrencySymbol + :--> PValue 'Sorted 'NoGuarantees + :--> PUnit + ) + checkIfBurning = plam $ + \cs mint -> pif + (pany # + plam (\v -> 0 #<= pfromData (psndBuiltin # v)) # + pto (mintedTokens_ # cs # mint) + ) + (ptraceError "expected only burning") + (pconstant ()) + + checkOutput :: Term s (PScriptHash + :--> PInteger + :--> PBuiltinList PV2.PTxOut + :--> PMap 'Unsorted PDatumHash PDatum + :--> PCurrencySymbol + :--> PTokenName + :--> PInteger + :--> PRationalData + :--> PInteger + :--> PUnit + ) + checkOutput = plam $ + \sh deposit outputs datums cs tn makerFeeFlatContract makerFeeRatioContract takerFeeFlatContract -> unTermCont $ do + nftAC <- pletC $ passetClass # cs # tn + PJust txOut <- pmatchC $ pfindOutputWithNft # outputs # nftAC + + pguardC "expected NFT to go to the script" $ + pisAddressForScript # (pfield @"address" # txOut) # sh + + od <- pletC $ pparseDatum' @PPartialOrderDatum # (pfield @"datum" # txOut) # datums + odFs <- pletFieldsC @[ + "podOfferedAsset" + , "podOfferedOriginalAmount" + , "podOfferedAmount" + , "podAskedAsset" + , "podPrice" + , "podNFT" + , "podStart" + , "podEnd" + , "podPartialFills" + , "podMakerLovelaceFlatFee" + , "podTakerLovelaceFlatFee" + , "podContainedFee" + , "podContainedPayment" + ] od + + (offeredAmount :: Term _ PInteger) <- pletC $ getField @"podOfferedAmount" odFs + (offeredOriginalAmount :: Term _ PInteger) <- pletC $ getField @"podOfferedOriginalAmount" odFs + (partialFills :: Term _ PInteger) <- pletC $ getField @"podPartialFills" odFs + (askedPrice :: Term _ PRationalData) <- pletC $ getField @"podPrice" odFs + (containedFee :: Term _ PPartialOrderContainedFee) <- pletC $ getField @"podContainedFee" odFs + (containedPayment :: Term _ PInteger) <- pletC $ getField @"podContainedPayment" odFs + (askedPriceN :: Term _ PInteger) <- pletC $ pfield @"numerator" # askedPrice + makerFeeFlatDat <- pletC $ getField @"podMakerLovelaceFlatFee" odFs + takerFeeFlatDat <- pletC $ getField @"podTakerLovelaceFlatFee" odFs + + containedFeeHRec <- pletFieldsC @[ + "pocfLovelaces" + , "pocfOfferedTokens" + , "pocfAskedTokens" + ] containedFee + containedFeeLov <- pletC $ getField @"pocfLovelaces" containedFeeHRec + containedFeeOff <- pletC $ getField @"pocfOfferedTokens" containedFeeHRec + containedFeeAsk <- pletC $ getField @"pocfAskedTokens" containedFeeHRec + offeredAsset <- pletC $ getField @"podOfferedAsset" odFs + askedAsset <- pletC $ getField @"podAskedAsset" odFs + orderStart <- pmatchC $ getField @"podStart" odFs + orderEnd <- pmatchC $ getField @"podEnd" odFs + + pguardC "offered amount should be positive" $ + 0 #< offeredAmount + pguardC "offered amount should equal original amount" $ + offeredOriginalAmount #== offeredAmount + pguardC "wrong name for NFT" $ + getField @"podNFT" odFs #== tn + pguardC "number of partial fills must be zero" $ + 0 #== partialFills + pguardC "podPrice must be positive" $ + 0 #< askedPriceN + pguardC "podOfferedAsset must be different than podAskedAsset" $ + pnot #$ offeredAsset #== askedAsset + pguardC "order end shouldn't be earlier than start" $ + case (orderStart, orderEnd) of + (PPDJust orderStart', PPDJust orderEnd') -> orderStart' #<= orderEnd' + _otherwise -> pconstant True + pguardC "podMakerLovelaceFlatFee is not same as that mentioned pocfLovelaces" $ + makerFeeFlatDat #== containedFeeLov + pguardC "podTakerLovelaceFlatFee is not the same as mentioned in config contract" $ + takerFeeFlatDat #== takerFeeFlatContract + + offeredAssets <- pletC $ passetClassValue # offeredAsset # pdata offeredAmount + nft <- pletC $ passetClassValue # nftAC # pdata 1 + depositValue <- pletC $ passetClassValue # plovelace # pdata deposit + containedFee' <- pletC $ pforgetPositive $ pgetContainedFeeValue' # offeredAsset # askedAsset # containedFeeLov # containedFeeOff # containedFeeAsk + expectedOffer <- pletC $ offeredAssets <> nft <> depositValue <> containedFee' + actualOffer <- pletC $ pforgetPositive $ pfromData (pfield @"value" # txOut) + + pguardC "offer too low" $ + pgeq # actualOffer # expectedOffer + + + pguardC "pocfAskedTokens in podContainedFee should be zero" $ + pfromData containedFeeAsk #== 0 + + pguardC "fees too low" $ + makerFeeFlatContract #<= pfromData containedFeeLov + #&& pfloor # ((prationalFromData # makerFeeRatioContract) #* (Rational.pfromInteger # offeredAmount)) #<= pfromData containedFeeOff + + pguardC "contained payment must be zero" $ + containedPayment #== 0 + + pure . pconstant $ () + +mintedTokens_ :: + Term s (PCurrencySymbol + :--> PValue 'Sorted 'NoGuarantees + :--> PMap 'Sorted PTokenName PInteger + ) +mintedTokens_ = plam $ + \cs mint -> + pmatch (PMap.plookup # cs # pto mint) $ + \case + PNothing -> perror + PJust m -> m diff --git a/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrderNFTV1_1/Compiled.hs b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrderNFTV1_1/Compiled.hs new file mode 100644 index 00000000..e496b48f --- /dev/null +++ b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/PartialOrderNFTV1_1/Compiled.hs @@ -0,0 +1,49 @@ +module GeniusYield.OnChain.DEX.PartialOrderNFTV1_1.Compiled ( + originalPartialOrderNftV1_1Policy, + optimizedPartialOrderNftV1_1Policy, + optimizedPartialOrderNftV1_1PolicyWithTracing, +) where + +import Data.Default (def) +import Data.Text (Text) +import Plutarch (Config (tracingMode)) +import Plutarch.Api.V1 (PAddress) +import Plutarch.Api.V1.Scripts (PScriptHash) +import qualified Plutarch.Api.V2 as PV2 +import Plutarch.Prelude (ClosedTerm, plam, + popaque, + type (:-->), (#)) +import qualified Plutarch.Unsafe as PUNSAFE +import qualified Plutonomy +import PlutusLedgerApi.V1 (Address, + ScriptHash) +import PlutusLedgerApi.V1.Value (AssetClass) +import Ply (ScriptRole (MintingPolicyRole), + TypedScript) +import Ply.Plutarch (toTypedScript) + +import GeniusYield.OnChain.DEX.PartialOrderNFTV1_1 (mkPartialOrderNFTV1_1Policy) +import GeniusYield.OnChain.Plutarch.Types (PAssetClass) +import GeniusYield.OnChain.Utils (desiredTracingMode) +import GeniusYield.Plutonomy () + +originalPartialOrderNftV1_1Policy :: + Config -> + Either Text (TypedScript 'MintingPolicyRole '[ScriptHash, Address, AssetClass]) +originalPartialOrderNftV1_1Policy cnf = toTypedScript cnf mkPartialOrderNFTV1_1Policy' + +optimizedPartialOrderNftV1_1Policy :: Either Text (TypedScript 'MintingPolicyRole '[ScriptHash, Address, AssetClass]) +optimizedPartialOrderNftV1_1Policy = Plutonomy.optimizeUPLC <$> originalPartialOrderNftV1_1Policy def + +optimizedPartialOrderNftV1_1PolicyWithTracing :: Either Text (TypedScript 'MintingPolicyRole '[ScriptHash, Address, AssetClass]) +optimizedPartialOrderNftV1_1PolicyWithTracing = Plutonomy.optimizeUPLC <$> originalPartialOrderNftV1_1Policy def{tracingMode = desiredTracingMode} + +mkPartialOrderNFTV1_1Policy' :: ClosedTerm (PScriptHash :--> PAddress :--> PAssetClass :--> PV2.PMintingPolicy) +mkPartialOrderNFTV1_1Policy' = plam $ \sh refInputAddr refInputToken redm ctx -> + popaque $ + mkPartialOrderNFTV1_1Policy + # sh + # refInputAddr + # refInputToken + # PUNSAFE.punsafeCoerce redm + # ctx diff --git a/geniusyield-onchain/src/GeniusYield/OnChain/DEX/README.md b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/README.md new file mode 100644 index 00000000..d0b5debf --- /dev/null +++ b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/README.md @@ -0,0 +1,294 @@ +# DEX + +## Table of Content + +- [DEX](#dex) + - [Table of Content](#table-of-content) + - [Introduction](#introduction) + - [Audit report](#audit-report) + - [NFT](#nft) + - [Special NFT for Partially Fillable Orders](#special-nft-for-partially-fillable-orders) + - [Partially Fillable Orders](#partially-fillable-orders) + +## Introduction + +The purpose of the DEX smart contracts is to implement a _DEX_, a _Decentralized Exchange_, i.e. a means for users to swap (Cardano native) tokens, +which include ada and arbitrary custom tokens. This is _Decentralized_ in the sense that no central authority +(like a traditional, centralized exchange) is needed: Users can swap without needing to trust some authority or each other. + +Our DEX architecture is very open and extensible. + +In total, we at the moment have four different smart contracts powering our DEX: + + - [_Partially Fillable Orders_](#partially-fillable-orders). Order that can be filled in several transactions, each only taking part of the offered tokens and paying corresponding asked tokens. + - [_NFT_](#nft). A simple NFT minting policy which guarantees that any token seen with it's currency symbol is an NFT. + - [_Special NFT for Partially Fillable Orders_](#special-nft-for-partially-fillable-orders). This besides giving the same guarantees as our simple NFT minting policy, also guarantees that any UTxO seen with this token is a sensible order. Besides that, an NFT token in an order is also useful to track it's "identity" over it's lifetime. Note that there is no mutable state in the eUTxO-model, and one way to simulate it is to pass an NFT from the consumed UTxO to the new one being created (with modified value and/or datum) so as to identify "same" abstract order. + - [_Fee Configuration_](#fee-configuration). Governs fees charged to maker & taker when creating, filling an order respectively. + +## Audit Report + +Our DEX smart contracts have been audited by [Anastasia Labs](https://anastasialabs.com/) and report is available [here](./Anastasia_Labs____Genius_Yield_Audit.pdf). + +## NFT + + > **📃** + > Contract available [here](NFT.hs). + +The purpose of this minting policy is to guarantee that every token seen with this policy - independent of its token name - is an NFT, i.e. a _non-fungible token_, a token that can only exist at most once. + +The minting policy is _not_ parameterized and thus statically known, which makes it easy to use in other contracts that are in need of an NFT. + +Once one has convinced oneself that each token with this policy is indeed an NFT, one can simply use this policy whenever an NFT is required. + +This is achieved by making use of a redeemer for the minting transaction. The redeemer specifies an UTxO (via its `TxOutRef`) that has to be consumed by the minting transaction. The minting policy checks that the specified UTxO is indeed consumed, that exactly one token is minted (whereas arbitrary _burning_ is allowed) and that the token name of that one token is the _hash_ of the `TxOutRef` of that UTxO. + +It also checks that not more than one token is minted with script's own currency symbol in a single transaction. + +Since UTxO's are unique and can only exist once, this guarantees that only one token with this minting policy and token name can ever be minted (except, of course, if there is a _hash collision_, but we deem this risk to be negligible). + +## Special NFT for Partially Fillable Orders + + > **📃** + > Contract available [here](./PartialOrderNFT.hs). + + > **ⓘ** + > Before going over this section, it would be helpful to first understand our ["_Fee Configuration_"](#fee-configuration) contract. + +Our aim is to have our order validator consider only those orders which have a token minted by this minting policy where this minting policy would guarantee that any token minted under it would represent a valid order[^1], besides giving guarantees of our [simple NFT minting script](#nft). + +This contract is parameterized by: + +* Payment credential of validator which we use to insist that output UTxO having this newly minted NFT token, is indeed having an address whose payment credential is this given parameter. + > **💡** + > The reason why we consider payment credential instead of complete address is that in general we would like to have order UTxO placed at an address whose payment part is controlled by our validator however staking part would still belong to order creator, as until the order is filled, ada in order still belongs to the creator so it would be nice if it never misses the stake snapshot. +* An address and +* an asset class which we use to identify the desired reference input. Idea is to first mint an NFT token using our [simple NFT minting script](#nft) and then putting it at our [fee configuration](#fee-configuration) contract (whose address is the second parameter) with required datum to be referred by this script. + +This contract is roughly the same as our [simple NFT minting script](#nft) with more conditions in case redeemer is not `Nothing` checked by `checkOutput` function in contract, which are: + +- We identify the expected output as one having this newly minted token and assert that it is indeed going to our validator contract (using first payment credential parameter as described before). +- We parse the datum of this output UTxO, which does various checks like currency symbol is indeed of correct number of bytes (which is 28), etc. + + > **ⓘ** + > Following is the datum type of validator contract and it would be helpful to read the mentioned description (given as a comment string) for it's fields: + > ```haskell + > -- | Datum specifying a partial order. + > data PartialOrderDatum = PartialOrderDatum + > { podOwnerKey :: PubKeyHash -- ^ Public key hash of the owner. Order cancellations must be signed by this. + > , podOwnerAddr :: Address -- ^ Address of the owner. Payments must be made to this address. + > , podOfferedAsset :: AssetClass -- ^ The asset being offered. + > , podOfferedOriginalAmount :: Integer -- ^ Original number of units being offered. Initially, this would be same as `podOfferedAmount`. + > , podOfferedAmount :: Integer -- ^ The number of units being offered. + > , podAskedAsset :: AssetClass -- ^ The asset being asked for as payment. + > , podPrice :: PlutusTx.Rational -- ^ The price for one unit of the offered asset. + > , podNFT :: TokenName -- ^ Token name of the NFT identifying this order. + > , podStart :: Maybe POSIXTime -- ^ The time when the order can earliest be filled (optional). + > , podEnd :: Maybe POSIXTime -- ^ The time when the order can latest be filled (optional). + > , podPartialFills :: Integer -- ^ Number of partial fills order has undergone, initially would be 0. + > , podMakerLovelaceFlatFee :: Integer -- ^ Flat fee (in lovelace) paid by the maker. + > , podTakerLovelaceFlatFee :: Integer -- ^ Flat fee (in lovelace) paid by the taker. + > , podContainedFee :: PartialOrderContainedFee -- ^ Total fees contained in the order. + > , podContainedPayment :: Integer -- ^ Payment (in asked asset) contained in the order. + > } deriving (Generic, Show) + > + > -- | Representation of total fees contained in the order. + > data PartialOrderContainedFee = PartialOrderContainedFee + > { pocfLovelaces :: Integer -- ^ Fees explicitly charged in lovelaces, like flat lovelace fee collected from maker and taker(s). + > , pocfOfferedTokens :: Integer -- ^ Fees explicitly collected as percentage of offered tokens from maker. + > , pocfAskedTokens :: Integer -- ^ Fees explicitly collected as percentage of asked tokens from taker. + > } deriving (Generic, Show) + > ``` + +- Next we check values mentioned for in datum: + - `podOfferedAmount` is positive and is set same as `podOfferedOriginalAmount`. + - `podNFT` is set same as our newly minted NFT's token name. + - `podPartialFills` is zero. + - `podPrice` is positive. + - `podOfferedAsset` is different from `podAskedAsset`. + - If `podStart` & `podEnd` are both not `Nothing`, then mentioned start time must not be after mentioned end time. + - `podMakerLovelaceFlatFee` is same as `pocfLovelaces` (of `podContainedPayment`) as initially the contribution is entirely due to flat maker lovelace fee. Note that we match against `pocfLovelaces` and not `pocdMakerFeeFlat` as our off-chain code may put more flat lovelace fee then what is mentioned for by fee configuration script. + - `pocfLovelaces` is greater then or equal to `pocdMakerFeeFlat`. + - `pocfOfferedTokens` is greater then or equal to `⌈pocdMakerFeeRatio * podOfferedAmount⌉`, `⌊pocdMakerFeeRatio * podOfferedAmount⌋` for version 1 and 1.1 respectively. We later made it floor from earlier ceiling to allow NFT tokens. + - `podTakerLovelaceFlatFee` is same as `pocdTakerFee`. + - `pocfAskedTokens` is zero. + - `podContainedPayment` is zero. +- And lastly, we see if UTxO's value conforms to what is present for in the datum and have the required deposit. I.e., if `{A: N}` denote a value having an amount `N` of an asset class `A`, then UTxO's value should be greater than or equal to `{MINTED_NFT: 1} + {podOfferedAsset: podOfferedAmount} + {LOVELACE: pocdMinDeposit} + {LOVELACE: pocfLovelaces} + {podOfferedAsset: pocfOfferedTokens}` where `MINTED_NFT` denotes asset class of our newly minted NFT in question and `LOVELACE` denote asset class of lovelace. + + > **ⓘ What is the need of deposit (`pocdMinDeposit`)?** + > + > Every UTxO has minimum ada requirement which is proportional to it's size. As an order undergoes partial fills, it's miniminum ada requirements may increase which would thus be required to be paid for from _taker(s)_. Instead we can have the order creator commit some ada which would then be returned once a complete fill happens or when the order is cancelled. + +## Partially Fillable Orders + + > **📃** + > Contract available [here](./PartialOrder.hs). + +The partial order mechanism allows one to lock their offered tokens inside a validator, which +can then be either completely or partially filled/bought by another user. + +As described in earlier section, each order contains an NFT minted by our special minting policy to identify it and also to guarantee it's correctness. This simplifies off-chain event listener as it need not do various checks to know whether the UTxO indeed represents a valid order. Besides that, our validator also makes use of this special NFT minting policy to determine what all orders are being filled in this transaction so as to correctly charge taker fee _per transaction_ but more on that later! + +Note that in case an order UTxO, doesn't have this special NFT token (`TokenName` is fetched from `podNFT` field of datum and we'll see later how validator come to know about it's `CurrencySymbol`), then validator simply allows for it to be spent without any further checks. + +This order validator is parameterized over two arguments: + +- An address, which would be the address of our fee configuration validator. + +- Asset class of an NFT token. + + Idea is, our order validator need to determine the policy id (currency symbol) of our [special minting policy](#special-nft-for-partially-fillable-orders) contract. But as this policy in turn needs address (specifically, payment credential) of this partial order validator contract as a parameter, we find ourselves in chicken-egg situation. + + However, we do a trick where we first mint a simple NFT token, using our [simple NFT contract](#nft) contract, then we mention this newly minted token's asset class as parameter to this contract. Now once we have address of our order validator, we give it's payment credential to our [special NFT minting policy](#special-nft-for-partially-fillable-orders). Thus now we have minting policy id of our special NFT minting script. + + As a last step, we create an UTxO at our fee configuration validator (the first parameter to validator), with our initially minted NFT token (whose asset class is second parameter to validator) and with an inline datum specifying, among other fields, the minting policy id of our special NFT minting script. + + Note that even though our fee configuration validator allows spending of an UTxO belonging to it, but it does so under restrictions and one of the restriction is the required continuing output's datum does not mention different minting policy id. Thus, it's not possible for us to mention different minting policy id at a later point. Therefore, now we have solved for our chicken-egg problem. Validator would see whether there is any reference input belonging to address of first parameter, having a unit token with asset class as in second parameter and if so, it's inline datum would give the needed currency symbol of our special NFT minting script. + + > **💡** + > As a summary, the fact that we use an NFT token (**simple** NFT token!) in this reference input, means that there can only be one such reference input and given the restrictions of fee configuration validator, means we can't later spend this UTxO and generate a new one with different minting policy id in it's datum. Note that we could have instead put it at one-way address (which is a script that doesn't allow any UTxO to be spent from it) but have decided to club it with fee configuration script so as to not require an additional reference input in the transaction. + +Follow three interactions are possible with this validator: + +1. _Cancel_ - The order is cancelled, allowing the UTxO with the remaining offer amount to be reclaimed. + + Requirements: + - Must be signed by the owner of the order, identified by `podOwnerKey`. + - The NFT identifying the order must be burnt, lest it escapes into another UTxO. + - All the accumulated payment, along with initial ada deposit is paid to address given by `podOwnerAddr`. + - We put in the datum of this payment output, reference to the current UTxO being spent so as to not run afoul of double satisfaction problem. + - If order underwent zero partial fills (i.e., `podPartialFills` is zero) or contained fee is zero (i.e., `podContainedFee` is `mempty`) then we do not collect allocated maker fees otherwise there has to be a fee output. + - How do we know which output is a fee output? We find the first output going to the fee address, where this address is obtained from `pocdFeeAddr`. + - Datum of this fee output has type: + > ```haskell + > -- | Datum of the fee output. + > data PartialOrderFeeOutput = PartialOrderFeeOutput + > { pofdMentionedFees :: PlutusTx.Map TxOutRef Value + > -- ^ Map, mapping order being consumed to the collected fees. + > , pofdReservedValue :: Value + > -- ^ Value reserved in this UTxO which is not to be considered as fees. + > , pofdSpentUTxORef :: Maybe TxOutRef + > -- ^ If not @Nothing@, it mentions the UTxO being consumed, whose value is used to provide for UTxOs minimum ada requirement. + > } deriving (Generic, Show) + > ``` + Every UTxO, requires some minimum ada, proportional to it's size to be committed to it, thus total fee collected must have ada greater than or equal to this minimum. In future, our fee validator may help us provide an UTxO, with sufficient ada to which we can piggy back fees upon, in which case, collected fees need not satisfy minimum ada requirement. In such a case, this fee validator would check whether the continuing output has `pofdReservedValue` set as original value present and `pofdSpentUTxORef` contains `TxOutRef` of it's consumed UTxO, to prevent double satisfaction. + + `pofdMentionedFees` is main field of interest for our order validator. Our approach towards fee output is to charge fees _per_ transaction. So, if in a single transaction, there are multiple fills (partial or complete), we'll charge single taker fee. + + `pofdMentionedFees` contains a map of an order's `TxOutRef` to it's _"mentioned fees"_, essentially, it should be value corresponding to `podContainedFee` of that order. We can't simply put it as `PlutusTx.Map TxOutRef PartialOrderContainedFee` (instead of `PlutusTx.Map TxOutRef Value`) because different orders might have different offered/asked asset classes. + + Sum of values inside `pofdMentionedFees` fees map represent _"expected contained fees"_ that the off-chain code has put but our order validator would verify that corresponding value mentioned for it's `TxOutRef` is indeed greater than or equal to value corresponding to it's `podContainedFee`. + + - For the cancel case, since there are no taker fees, we would require that the actual value present in this fee output (minus the `pofdReservedValue`) is greater than or equal to the "expected contained fees". + + Also, instead of checking whether "mentioned fees" is greater than or equal to value corresponding to `podContainedFee`, we would rather use it's updated version which would have `pocfOfferedTokens` subtracted by `⌊pocfOfferedTokens * (podOfferedAmount / podOfferedOriginalAmount)⌋`. As we don't want the non-flat maker fee for offered tokens that have not been consumed. + + > **ⓘ** + > + > For brevity, let `a`, `b`, `m` denote `podOfferedAmount`, `podOfferedOriginalAmount` and `pocdMakerFeeRatio` respectively. + > + > If `F` denote the percentage maker fee that was initially charged (when order was created), then it is `⌈m * b⌉` and `⌊m * b⌋` for version 1 and version 1.1 family of DEX contracts respectively. Since the amount of order which actually got filled was `b - a`, percent maker fee that we actually want to be charged is `⌈m * (b - a)⌉` for version 1 and `⌊m * (b - a)⌋` for version 1.1 respectively. Which however isn't necessarily same as what is being checked by `PartialOrder.hs` contract, namely `F - ⌊(a / b) * F⌋` but the difference is at most 1 as following proofs show. + > + > For version 1, we want to show `⌈m * b⌉ - ⌊(a / b) * ⌈m * b⌉⌋ <= ⌈m * (b - a)⌉ + 1`. + > + > Working on left hand side, we find, + > + > `⌈m * b⌉ - ⌊(a / b) * ⌈m * b⌉⌋` + > + > `<= ⌈m * b⌉ - ⌊(a / b) * m * b⌋` + > + > `<= ⌈m * b⌉ - ⌊m * a⌋` + > + > `== ⌈m * b⌉ + ⌈-m * a⌉` since [negating the argument switches floor and ceiling and changes the sign](https://en.wikipedia.org/wiki/Floor_and_ceiling_functions) + > + > `== (⌈m * b⌉ + ⌈-m * a⌉ -1) + 1` + > + > `<= ⌈m * (b - a)⌉ + 1` since `⌈x⌉ + ⌈y⌉ - 1 <= ⌈x + y⌉` Q.E.D. + > + > And for version 1.1, we want to show `⌊m * b⌋ - ⌊(a / b) * ⌊m * b⌋⌋ <= ⌊m * (b - a)⌋ + 1`. + > + > `⌊m * b⌋ = m * b - d` for a suitable `0 <= d < 1` ...(1) + > + > `⌊(a / b) * ⌊m * b⌋⌋ = ⌊(a / b) * (m * b - d)⌋` because of (1) and further simplifies to `⌊m * a - a * d / b⌋ = m * a - a * d / b - e` for a suitable `0 <= e < 1` ...(2) + > + > `⌊m * (b - a)⌋ = m * (b - a) - f` for a suitable `0 <= f < 1` ...(3) + > + > `⌊m * b⌋ - ⌊(a / b) * ⌊m * b⌋⌋ = (m * b - d) - (m * a - a * d / b - e)` (because of (1) and (2)) + > + > `= m * (b - a) + d * (-1 + a / b) + e = m * (b - a) - f + f + d * (-1 + a / b) + e = ⌊m * (b - a)⌋ + f + d * (-1 + a / b) + e` (because of (3)) ...(4) + > + > The left hand side of (4) is an integer, so the right hand side must also be an integer. `⌊m * (b - a)⌋` is also an integer, so this implies that `f + d * (-1 + a / b) + e` must be an integer as well. + > + > Since `0 <= d < 1`, that means `-1 + a / b < d * (-1 + a / b) <= 0` (Note that `0 < a < b` and so `0 < a / b < 1`). This along with `0 <= e, f < 1` gives us `-1 + a / b < d * (-1 + a / b) + e + f < 2`. And since `-1 < -1 + a / b < 0`, we have `d * (-1 + a / b) + e + f` to be either `0` or `1`. + > + > Q.E.D. + +2. _Complete fill_ - The full offered amount is bought. + + Requirements: + - The NFT identifying the order must be burnt, lest it escapes into another UTxO. + - Transaction validity interval must be within order validity duration (defined by `podStart` & `podEnd`). + - All the previous accumulated payment, along with additional payment & initial ada deposit is paid to address given by `podOwnerAddr`. + - Additional payment (of the asked-for asset) must be greater than or equal to `⌈podOfferedAmount * podPrice⌉`. + - We put in the datum of this payment output, reference to the current UTxO being spent so as to not run afoul of double satisfaction problem. + - If the fee corresponding to this order is zero, i.e., value corresponding to `podContainedFee` along with value corresponding to `podTakerLovelaceFlatFee` is `mempty` then a fee output is not insisted for by this order. Otherwise, it does require a fee output, where actual value in fee output (minus the `pofdReservedValue`) must be greater than or equal to sum of "expected contained fees" and flat taker fees (obtained using `podTakerLovelaceFlatFee`). Also, in this fee output, the "mentioned fees" for this order must be greater than or equal to value corresponding to `podContainedFee`. Note that if we don't find an entry in this map for our own `TxOutRef` then `podContainedFee` must be checked to be `mempty`. + +3. _Partial fill_ - a portion of the offered amount is bought, by paying corresponding asked tokens. + + Requirements: + - The portion/amount must be positive, but less than the remaining total amount. Let's call it `amt`. + - Transaction validity interval must be within order validity duration (defined by `podStart` & `podEnd`). + - There must be (single) continuing output, where consumed offered tokens are deducted but the additional payment of `⌈amt * podPrice⌉` in asked tokens is added. Next we need to know whether taker fee should be present in this continuing output or not, for that we have two cases: + * There is no fee output. In this case, we would check whether our continuing output is first "continuing partial fill output" in a transaction or not. If our output is the first one, we'll add flat taker fee to it and also add `podTakerLovelaceFlatFee` to `pocfLovelaces`. + * There is a fee output. In this case, we'll not require added taker fee for our continuing output and would just check if the value in fee output (minus the `pofdReservedValue`) is greater than or equal to sum of "expected contained fees" and flat taker fee. + - Note that one may put additional ada and additional tokens of `podAskedAsset` then what is required to spend this UTxO. In such a case continuing output's datum fields corresponding to it, namely, `pocfLovelaces` and `pocfAskedTokens` must be suitably updated. + - Continuing output datum must match with expectations, which are: + * `podOfferedAmount` is deducted by `amt`. + * `podPartialFills` being incremented by 1. + * `podContainedFee` is updated as described earlier. + * `podContainedPayment` is increased by `⌈amt * podPrice⌉`. + * Rest of the fields are same as before. + +## Fee Configuration + + > **📃** + > Contract available [here](./PartialOrderConfig.hs). + +For our DEX, we want fees to be _enforced_ by our smart contracts and not just be at the liberty of off-chain code. Secondly, we want the option to _change_ fees without that change resulting in a different script and a different smart contract address. + +Note that change in flat taker fees, only apply to _new_ orders and therefore with respect to end users, update to these fee parameters does not affect old orders. + +Contract is parameterized by `AssetClass` of an NFT token (which we mint using our [simple NFT minting policy](#nft)) and uses it to require that UTxO being spent contains this token and also to identify continuing output. + +Following is the datum type of validator contract and it would be helpful to read the mentioned description (given as a comment string) for it's fields: + +```haskell +data PartialOrderConfigDatum = PartialOrderConfigDatum + { pocdSignatories :: [PubKeyHash] -- ^ Public key hashes of the potential signatories. + , pocdReqSignatories :: Integer -- ^ Number of required signatures. + , pocdNftSymbol :: CurrencySymbol -- ^ Currency symbol of the partial order Nft. + , pocdFeeAddr :: Address -- ^ Address to which fees are paid. + , pocdMakerFeeFlat :: Integer -- ^ Flat fee (in lovelace) paid by the maker. + , pocdMakerFeeRatio :: Rational -- ^ Proportional fee (in the offered token) paid by the maker. + , pocdTakerFee :: Integer -- ^ Flat fee (in lovelace) paid by the taker. + , pocdMinDeposit :: Integer -- ^ Minimum required deposit (in lovelace). + } deriving (Generic, P.Show) +``` + +And there is only one redeemer action of type unit `()`. + +Idea is to create an UTxO at our validator containing the mentioned NFT value and with desired datum. Then our other DEX contracts, such as [Partially Fillable Orders](#partially-fillable-orders) contract would use this UTxO as a reference input to know for some of the needed datum fields. + +Rules governing how this UTxO can be updated: + +* As mentioned before, UTxO being spent, must have unit token of the asset class given as parameter for further checks to be exercised, else we allow such an irrelevant UTxO to be spent. +* Transaction has at least `pocdReqSignatories` number of signatures coming from `pocdSignatories` signatories. +* In continuing output, we require that: + * `pocdSignatories` are all unique and within 1 & 10 (inclusive). + * `pocdReqSignatories` is positive and less than length of `pocdSignatories`. + * `pocdNftSymbol` remains same. This field holds the currency symbol of ["Special NFT for Partially Fillable Orders"](#special-nft-for-partially-fillable-orders) contract. Reason why it is stored is explained for in [Partially Fillable Orders](#partially-fillable-orders) contract. + * There is an output being made in a transaction to the new `pocdFeeAddr`, this guarantees that this address is valid. + * `pocdMakerFeeFlat`, `pocdTakerFee`, `pocdMinDeposit` are all non negative. Having them as negative would also violate some of the invariants assumed by ["Special NFT for Partially Fillable Orders"](#special-nft-for-partially-fillable-orders) script. Also, we require them to be less than 1000 ADA so as to bound our datum. + * `pocdMakerFeeRatio` is b/w 0 & 1 (inclusive). + + +[^1]: This also simplifies our off-chain event listener as it can just look for token minted by our policy script to know for valid order instead of performing various checks against the order UTxO. diff --git a/geniusyield-onchain/src/GeniusYield/OnChain/DEX/Utils.hs b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/Utils.hs new file mode 100644 index 00000000..ee185bad --- /dev/null +++ b/geniusyield-onchain/src/GeniusYield/OnChain/DEX/Utils.hs @@ -0,0 +1,216 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE PartialTypeSignatures #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} + +module GeniusYield.OnChain.DEX.Utils + ( pfindMarkedRefInput + , pfindFeeOutput + , pcontinuingPartialOrder + , pgetContainedFeeValue + , pgetContainedFeeValue' + , pcheckValidFillTime + ) where + +import Plutarch.Api.V1 (AmountGuarantees (..), KeyGuarantees (..), PAddress, + PCurrencySymbol, PDatum, PDatumHash, PMap (..), + PPOSIXTimeRange, PTokenName, PTxOutRef, PValue (..)) +import qualified Plutarch.Api.V2 as PV2 +import Plutarch.Extra.Map (pkvPairValue) +import Plutarch.Extra.TermCont (pguardC, pguardC', pletC, pletFieldsC, pmatchC) +import Plutarch.Prelude (PAsData, PBool (..), PBuiltinList, PBuiltinPair, + PEq ((#==)), PInteger, PListLike (..), + PMaybe (PJust, PNothing), PPair (..), Term, TermCont, + getField, pcon, pfield, pfind, pfoldl, pfromData, + pfstBuiltin, phoistAcyclic, pif, plam, plet, pletFields, + pmatch, precList, psndBuiltin, pto, ptraceError, + type (:-->), unTermCont, (#$), (#&&), (#)) + +import GeniusYield.OnChain.DEX.PartialOrder.Types (PMaybePPOSIXTimeData (PPDJust, PPDNothing), + PPartialOrderConfigDatum, PPartialOrderContainedFee, + PPartialOrderFeeOutput (..)) +import GeniusYield.OnChain.Plutarch.Api (pFrom, pTo, pcontains) +import GeniusYield.OnChain.Plutarch.Tx (presolveInlineDatum) +import GeniusYield.OnChain.Plutarch.Types (PAssetClass (..)) +import GeniusYield.OnChain.Plutarch.Utils (pparseDatum') +import GeniusYield.OnChain.Plutarch.Value (passetClassValueOf, passetClassValuePositive, pgeq, + plovelace, psubtractValue) +import Plutarch.Api.V1.AssocMap (plookup) +import Plutarch.Api.V1.Value (pforgetPositive, pvalueOf) +import Plutarch.Unsafe (punsafeCoerce) + +pfindMarkedRefInput :: Term s (PBuiltinList PV2.PTxInInfo + :--> PAddress + :--> PAssetClass + :--> PPartialOrderConfigDatum) +pfindMarkedRefInput = phoistAcyclic $ + plam $ \inputs reqAddr reqAsset -> + pmatch (pfind # (matches # reqAddr # reqAsset) # inputs) $ \case + PNothing -> ptraceError "reference input not found" + PJust markedRefInput -> punsafeCoerce . pto $ presolveInlineDatum #$ pfield @"datum" #$ pfield @"resolved" # markedRefInput -- Note that we are using `punsafeCoerce` here, so we don't verify whether datum is of correct type but since this UTxO is maintained by us, it would have correct structure. + where + matches :: Term s (PAddress :--> PAssetClass :--> PV2.PTxInInfo :--> PBool) + matches = phoistAcyclic $ + plam $ \reqAddr reqAsset txininfo -> + plet (pfield @"resolved" # txininfo) $ + \resolved -> + pletFields @'["address", "value"] resolved $ \resolved' -> + getField @"address" resolved' #== reqAddr + #&& passetClassValueOf # getField @"value" resolved' # reqAsset #== 1 + +pisFeeOutput :: Term s (PAddress :--> PV2.PTxOut :--> PBool) +pisFeeOutput = phoistAcyclic $ + plam $ \feeAddr txout -> + pfield @"address" # txout #== feeAddr + +pfindFeeOutput :: Term s (PBuiltinList PV2.PTxOut + :--> PMap 'Unsorted PDatumHash PDatum + :--> PAddress + :--> PAsData PInteger + :--> a + :--> ( PMap 'Unsorted PTxOutRef (PValue 'Sorted 'Positive) + :--> a) + :--> a) +pfindFeeOutput = phoistAcyclic $ + plam $ \outputs datums feeAddr takerFeeInt x f -> unTermCont $ + pmatchC (pfind # (pisFeeOutput # feeAddr) # outputs) >>= \case + PNothing -> pure x + PJust out -> do + + outFs <- pletFieldsC @'["value", "datum"] out + outputValue <- pletC $ getField @"value" outFs + dat <- pletC $ pfromData $ pparseDatum' @PPartialOrderFeeOutput # getField @"datum" outFs # datums -- Note that it is important that we parse this datum as few constraints like amounts in `pofdReservedValue` must be positive. + feeOutputHRec <- pletFieldsC @'["pofdMentionedFees", "pofdReservedValue"] dat + mentionedFees <- pletC $ getField @"pofdMentionedFees" feeOutputHRec + PMap kvs <- pmatchC mentionedFees + reservedValue <- pletC $ getField @"pofdReservedValue" feeOutputHRec + totalContainedFees <- pletC $ pfoldl + # plam (\acc kv -> + plet (pkvPairValue # kv) $ \containedFee -> + acc <> containedFee) + # mempty + # kvs + actualFees <- pletC $ psubtractValue # outputValue # reservedValue + -- In following, even though we have done `pforgetPositive`, it doesn't change the fact that there would not be any @<= 0@ entry in @expectedFees@, this in turn would guarantee (by a later check) that there is no @<= 0@ entry in @actualFees@. + let expectedFees = pforgetPositive (totalContainedFees <> (passetClassValuePositive # plovelace # takerFeeInt)) + pguardC "fee output's value is less than expected" $ pgeq # actualFees # expectedFees + pure $ f # mentionedFees + +-- | Given the currency symbol identifying partial orders, is the given output a continued partial order? +-- We need to check whether the output contains a token with the given symbol and that this token is not +-- being minted in the current transaction (in which case the output would be a freshly placed order). +-- If yes, return the corresponding token name; otherwise, return Nothing. +ppartialOrderToken :: Term s (PAddress :--> PCurrencySymbol :--> PValue 'Sorted 'NoGuarantees :--> PV2.PTxOut :--> PMaybe PTokenName) +ppartialOrderToken = phoistAcyclic $ + plam $ \ownAddr nftSymbol mint out -> unTermCont $ do + out' <- pletFieldsC @["value", "address"] out + pguardC' (pcon PNothing) (ownAddr #== getField @"address" out') + PValue m <- pmatchC $ getField @"value" out' + pmatchC (plookup # nftSymbol # m) >>= \case + PNothing -> pure . pcon $ PNothing -- the output doesn't contain the right NFT + PJust n -> do + PMap kvs <- pmatchC n + pure $ pelimList (f nftSymbol mint) (pcon PNothing) kvs + where + f :: Term s PCurrencySymbol + -> Term s (PValue 'Sorted 'NoGuarantees) + -> Term s (PBuiltinPair (PAsData PTokenName) (PAsData PInteger)) + -> Term s (PBuiltinList (PBuiltinPair (PAsData PTokenName) (PAsData PInteger))) + -> Term s (PMaybe PTokenName) + f nftSymbol mint kv _ = + plet (pfromData $ pfstBuiltin # kv) $ \nftTkName -> + pif (pfromData (psndBuiltin # kv) #== 1) -- We require non-zero value, to safeguard if map is not normalized. + ( + plet (pvalueOf # mint # nftSymbol # nftTkName) $ \minted -> + pif + (minted #== 0) + (pcon $ PJust nftTkName) -- the output is a continued partial order + (pcon PNothing) -- the output is a freshly placed order + ) + (pcon PNothing) + +-- | Given currency symbol and token name of the NFT identifying partial orders and a list of outputs, +-- tries to find an output containing that NFT. +-- If found, returns a boolean indicating whether the found output is the first partial order output in the list +-- and the output itself; otherwise, returns Nothing. +pcontinuingPartialOrder :: Term s ( PAddress + :--> PCurrencySymbol + :--> PTokenName + :--> PValue 'Sorted 'NoGuarantees + :--> PBuiltinList PV2.PTxOut + :--> PMaybe (PPair PBool PV2.PTxOut) + ) +pcontinuingPartialOrder = phoistAcyclic $ + plam $ \ownAddr nftSymbol nftTkName mint outputs -> + go ownAddr nftSymbol nftTkName mint # outputs # pcon PTrue + where + go :: Term s PAddress + -> Term s PCurrencySymbol + -> Term s PTokenName + -> Term s (PValue 'Sorted 'NoGuarantees) + -> Term s (PBuiltinList PV2.PTxOut :--> PBool :--> PMaybe (PPair PBool PV2.PTxOut)) + go ownAddr nftSymbol nftTkName mint = precList + (\self out xs -> plam $ \b -> + pmatch (ppartialOrderToken # ownAddr # nftSymbol # mint # out) $ \case + PNothing -> self # xs # b -- the output wasn't a continued partial order + PJust tn -> pif + (tn #== nftTkName) + (pcon $ PJust $ pcon (PPair b out)) -- we found the order we were looking for + (self # xs # pcon PFalse) -- we found a continued partial order, + -- but it was not the one we were looking for + ) + (\_self -> plam $ \_b -> pcon PNothing) + +pgetContainedFeeValue :: + Term s ( PPartialOrderContainedFee + :--> PAssetClass + :--> PAssetClass + :--> PValue 'Sorted 'Positive + ) +pgetContainedFeeValue = phoistAcyclic $ plam $ \containedFee offAC askAC + -> unTermCont $ do + containedFeeHRec <- pletFieldsC @[ + "pocfLovelaces" + , "pocfOfferedTokens" + , "pocfAskedTokens" + ] containedFee + + containedFeeLov <- pletC $ getField @"pocfLovelaces" containedFeeHRec + containedFeeOff <- pletC $ getField @"pocfOfferedTokens" containedFeeHRec + containedFeeAsk <- pletC $ getField @"pocfAskedTokens" containedFeeHRec + pure $ pgetContainedFeeValue' # offAC # askAC # containedFeeLov # containedFeeOff # containedFeeAsk + +pgetContainedFeeValue' :: + Term s ( PAssetClass + :--> PAssetClass + :--> PAsData PInteger + :--> PAsData PInteger + :--> PAsData PInteger + :--> PValue 'Sorted 'Positive + ) +pgetContainedFeeValue' = phoistAcyclic $ plam $ \offAC askAC lov off ask + -> passetClassValuePositive # plovelace # lov <> passetClassValuePositive # offAC # off <> passetClassValuePositive # askAC # ask + +pcheckValidStartTime :: Term s (PPOSIXTimeRange :--> PMaybePPOSIXTimeData :--> PBool) +pcheckValidStartTime = phoistAcyclic $ plam $ \validRange mstart' -> + pmatch mstart' $ \case + PPDNothing _ -> pcon PTrue + PPDJust rec -> pcontains # (pFrom # (pfield @"_0" # rec)) # validRange + +pcheckValidEndTime :: Term s (PPOSIXTimeRange :--> PMaybePPOSIXTimeData :--> PBool) +pcheckValidEndTime = phoistAcyclic $ plam $ \validRange mend' -> + pmatch mend' $ \case + PPDNothing _ -> pcon PTrue + PPDJust rec -> pcontains # (pTo # (pfield @"_0" # rec)) # validRange + +pcheckValidFillTime :: Term s PPOSIXTimeRange + -> Term s PMaybePPOSIXTimeData + -> Term s PMaybePPOSIXTimeData + -> TermCont s () +pcheckValidFillTime validRange' mstart' mend' = do + validRange <- pletC validRange' + pguardC "filled too early" $ pcheckValidStartTime # validRange # mstart' + pguardC "filled too late" $ pcheckValidEndTime # validRange # mend' diff --git a/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Api.hs b/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Api.hs new file mode 100644 index 00000000..3c7d9397 --- /dev/null +++ b/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Api.hs @@ -0,0 +1,7 @@ +module GeniusYield.OnChain.Plutarch.Api (module X) where + +import Plutarch.Extra.TermCont as X + +import GeniusYield.OnChain.Plutarch.Time as X +import GeniusYield.OnChain.Plutarch.Tx as X +import GeniusYield.OnChain.Plutarch.Types as X diff --git a/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Crypto.hs b/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Crypto.hs new file mode 100644 index 00000000..31aea073 --- /dev/null +++ b/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Crypto.hs @@ -0,0 +1,68 @@ +{-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DerivingVia #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +{-# OPTIONS_GHC -Wno-orphans #-} + +module GeniusYield.OnChain.Plutarch.Crypto ( PPubKey + , PSignature + , PSignedMessage + , pverifySignedMessage + ) where + +import Plutarch.Api.V1 +import qualified Plutarch.Api.V2 as PV2 +import Plutarch.Crypto +import Plutarch.DataRepr +import Plutarch.Prelude + +import GeniusYield.OnChain.Plutarch.Api (pguardC, pmatchC) +import GeniusYield.OnChain.Plutarch.Utils (pparseDatum) + +type PSignature :: PType +type PSignature = PByteString + +type PPubKey :: PType +type PPubKey = PByteString + +newtype PSignedMessage (a :: PType) (s :: S) + = PSignedMessage ( Term + s + ( PDataRecord + '[ "signature" ':= PSignature + , "messageHash" ':= PDatumHash + ] + ) + ) + deriving stock (Generic) + deriving anyclass (PlutusType, PIsData, PEq, PDataFields) + +instance DerivePlutusType (PSignedMessage a) where type DPTStrat _ = PlutusTypeData + +pverifySignedMessage :: forall (s :: S) (a :: PType). PTryFrom PData (PAsData a) => + Term s ( PPubKey + :--> PSignedMessage a + :--> PV2.PTxInfo + :--> PAsData a + ) +pverifySignedMessage = plam $ \pk signedMsg info + -> unTermCont $ do + a@(PDatumHash dh) <- pmatchC (pfield @"messageHash" # signedMsg) + let sig = pfield @"signature" # signedMsg + + pguardC "invalid signature" (pverifyEd25519Signature # pk # dh # sig) + + mtype <- pmatchC $ pparseDatum # pcon a #$ pfield @"datums" # info + + case mtype of + PNothing -> return $ ptraceError "datum not found" + PJust x -> return x diff --git a/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Run.hs b/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Run.hs new file mode 100644 index 00000000..55b4f28b --- /dev/null +++ b/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Run.hs @@ -0,0 +1,49 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE PartialTypeSignatures #-} +{-# LANGUAGE QuantifiedConstraints #-} +{-# LANGUAGE ScopedTypeVariables #-} + +module GeniusYield.OnChain.Plutarch.Run + ( applyArguments + , evalT + , evalSerialize + , evalWithArgsT + , evalWithArgsT' + ) where + +import Control.Lens.Combinators (over) +import Data.Bifunctor (first) +import Data.ByteString.Short (ShortByteString) +import Data.Default (def) +import Data.Text (Text, pack) +import Plutarch (ClosedTerm, compile) +import Plutarch.Evaluate (evalScript) +import Plutarch.Script (Script (Script, unScript), serialiseScript) +import PlutusCore.MkPlc (mkConstant, mkIterApp) +import PlutusLedgerApi.V1 (Data, ExBudget) +import UntypedPlutusCore (DeBruijn, DefaultFun, DefaultUni, Program, progTerm) + +applyArguments :: Script -> [Data] -> Script +applyArguments (Script p) args = + let termArgs = mkConstant () <$> args + applied t = mkIterApp () t termArgs + in Script $ over progTerm applied p + +evalSerialize :: ClosedTerm a -> Either Text ShortByteString +evalSerialize x = serialiseScript . (\(a, _, _) -> a) <$> evalT x + +evalT :: ClosedTerm a -> Either Text (Script, ExBudget, [Text]) +evalT x = evalWithArgsT x [] + +evalWithArgsT :: ClosedTerm a -> [Data] -> Either Text (Script, ExBudget, [Text]) +evalWithArgsT x args = do + cmp <- compile def x + let (escr, budg, trc) = evalScript $ applyArguments cmp args + scr <- first (pack . show) escr + pure (scr, budg, trc) + +evalWithArgsT' :: ClosedTerm a -> [Data] -> Either Text (Program DeBruijn DefaultUni DefaultFun (), ExBudget, [Text]) +evalWithArgsT' x args = + (\(res, budg, trcs) -> (unScript res, budg, trcs)) + <$> evalWithArgsT x args diff --git a/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Time.hs b/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Time.hs new file mode 100644 index 00000000..9e3c5bcb --- /dev/null +++ b/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Time.hs @@ -0,0 +1,114 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} + +module GeniusYield.OnChain.Plutarch.Time ( pcontains + , plowerbound + , pupperBound + , pinterval + , pFrom + , pTo + ) where + +import Plutarch.Api.V1 +import Plutarch.Extra.TermCont (pletFieldsC) +import Plutarch.Prelude + +{- | 'pcontains' is the plutarch level function that is similar to 'contains' defined in "Ledger". + The function checks whether the second interval 'PPOSIXTimeRange' is completely contained + withing first 'PPOSIXTimeRange'. +-} +pcontains :: + Term s (PPOSIXTimeRange + :--> PPOSIXTimeRange + :--> PBool + ) +pcontains = phoistAcyclic $ plam $ \interval1 interval2 + -> unTermCont $ do + v1 <- pletFieldsC @'["from", "to"] interval1 + v2 <- pletFieldsC @'["from", "to"] interval2 + + let lb1 = pfromData $ getField @"from" v1 + lb2 = pfromData $ getField @"from" v2 + + ub1 = pfromData $ getField @"to" v1 + ub2 = pfromData $ getField @"to" v2 + + return ( lb1 #<= lb2 + #&& ub2 #<= ub1 + ) + + +-- | 'plowerbound' is plutarch level function of 'lowerBound'. +plowerbound :: Term s (PPOSIXTime :--> PLowerBound PPOSIXTime) +plowerbound = phoistAcyclic $ plam $ \a + -> let + lbValue = pcon $ PFinite (pdcons @"_0" # pdata a # pdnil) + lb = PLowerBound (pdcons @"_0" # pdata lbValue #$ + pdcons @"_1" # pdata (pconstant True) # pdnil + ) + in + pcon lb + + +-- | 'pupperBound' is plutarch level function of 'upperBound'. +pupperBound :: Term s (PPOSIXTime :--> PUpperBound PPOSIXTime) +pupperBound = phoistAcyclic $ plam $ \a + -> let + ubValue = pcon $ PFinite (pdcons @"_0" # pdata a # pdnil) + ub = PUpperBound (pdcons @"_0" # pdata ubValue #$ + pdcons @"_1" # pdata (pconstant True) # pdnil + ) + in + pcon ub + +-- | 'pFrom' is the plutarch level function of 'from'. +pFrom :: + Term s (PPOSIXTime + :--> PInterval PPOSIXTime + ) +pFrom = phoistAcyclic $ plam $ \a + -> let + lb = plowerbound # a + ubValue = pcon $ PPosInf pdnil + ub = pcon $ PUpperBound (pdcons @"_0" # pdata ubValue #$ + pdcons @"_1" # pdata (pconstant True) # pdnil + ) + in + pcon $ PInterval (pdcons @"from" # pdata lb #$ + pdcons @"to" # pdata ub # pdnil + ) + +-- | 'pTo' is the plutarch level function of 'to'. +pTo :: + Term s (PPOSIXTime + :--> PInterval PPOSIXTime + ) +pTo = phoistAcyclic $ plam $ \a + -> let + lbValue = pcon $ PNegInf pdnil + lb = pcon $ PLowerBound (pdcons @"_0" # pdata lbValue #$ + pdcons @"_1" # pdata (pconstant True) # pdnil + ) + ub = pupperBound # a + in + pcon $ PInterval (pdcons @"from" # pdata lb #$ + pdcons @"to" # pdata ub # pdnil + ) + +-- | 'pinterval' is plutarch level function of 'interval'. +pinterval :: + Term s (PPOSIXTime + :--> PPOSIXTime + :--> PInterval PPOSIXTime + ) +pinterval = phoistAcyclic $ plam $ \lowerB upperB + -> let + lb = plowerbound # lowerB + ub = pupperBound # upperB + in + pcon $ PInterval (pdcons @"from" # pdata lb #$ + pdcons @"to" # pdata ub # pdnil + ) diff --git a/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Tx.hs b/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Tx.hs new file mode 100644 index 00000000..0a07f4c5 --- /dev/null +++ b/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Tx.hs @@ -0,0 +1,322 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} +{-# OPTIONS_GHC -Wno-unused-local-binds #-} + +module GeniusYield.OnChain.Plutarch.Tx ( pownUtxo + , putxoConsumed + , ptxSignedBy + , phasSignatures + , pfindTxOutByTxOutRef + , toDatum + , pownSymbol + , pexpectedTokenName + , ppaidValue + , ppaidValuePlusInline + , ppaidValueSum + , pmintedTokens + , pdecodeInlineDatum + , presolveInlineDatum + , presolveDatum + ) where + +import Plutarch.Api.V1 +import qualified Plutarch.Api.V1.AssocMap as PMap +import Plutarch.Api.V2 (POutputDatum (POutputDatumHash)) +import qualified Plutarch.Api.V2 as PV2 +import Plutarch.Builtin (pforgetData) +import Plutarch.Extra.TermCont (pletC, pletFieldsC, pmatchC) +import Plutarch.Prelude + +import GeniusYield.OnChain.Plutarch.Utils (pelem', pfromMaybe, ptryFromData) + +-- $setup +-- +-- >>> :set -XOverloadedStrings -XDataKinds +-- >>> import GeniusYield.OnChain.Plutarch.Run +-- >>> import Plutarch.Prelude +-- >>> import Plutarch +-- >>> import Plutarch.Api.V1 +-- >>> import Plutarch.Extra.Maybe (pjust, pnothing) +-- >>> import qualified PlutusTx +-- >>> import qualified PlutusLedgerApi.V1.Crypto as PlutusTx +-- +-- >>> let pub1 = pdata (pconstant "325b145b838462dcacef5352c2fc99d4b3cc7455de15851cd88d2903") +-- >>> let pub2 = pdata (pconstant "325b145b838462dcacef5352c2fc99d4b3cc7455de15851cd88d2904") +-- >>> let pub3 = pdata (pconstant "325b145b838462dcacef5352c2fc99d4b3cc7455de15851cd88d2905") +-- >>> let pub4 = pdata (pconstant "325b145b838462dcacef5352c2fc99d4b3cc7455de15851cd88d2906") + +-- | 'pownUtxo' returns the 'PTxOutRef' that tx is trying to spend, fails if 'PScriptContext' +-- doesn't have 'PSpending'. +pownUtxo :: + Term s (PV2.PScriptContext + :--> PTxOutRef + ) +pownUtxo = phoistAcyclic $ plam $ \ctx + -> unTermCont $ do + let purpose = pfromData $ pfield @"purpose" # ctx + PSpending x <- pmatchC purpose + return (pfield @"_0" # x) + + +-- | 'putxoConsumed' checks if a given utxo is consumed. +putxoConsumed :: + Term s (PTxOutRef + :--> PBuiltinList PV2.PTxInInfo + :--> PBool + ) +putxoConsumed = phoistAcyclic $ plam $ \txOutRef inputs + -> pany # + plam (\x -> txOutRef #== pfield @"outRef" # x) # inputs + +-- | 'ptxSignedBy' checks if a tx is signed by particular 'PPubKeyHash'. +ptxSignedBy :: + Term s (PPubKeyHash + :--> PBuiltinList (PAsData PPubKeyHash) + :--> PBool + ) +ptxSignedBy = phoistAcyclic $ plam $ \sig sigs + -> pelem # pdata sig # sigs + +-- | Determines if intersection of transaction signatories and authorized signatores satisfy the quorum. +-- +-- >>> evalT $ phasSignatures # pnil # pnil # 0 +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniBool True))}},ExBudget {exBudgetCPU = ExCPU 1760851, exBudgetMemory = ExMemory 6133},[]) +-- +-- >>> evalT $ phasSignatures # (pcons # pub1 # pnil) # (pcons # pub1 # pnil) # 1 +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniBool True))}},ExBudget {exBudgetCPU = ExCPU 6953448, exBudgetMemory = ExMemory 18659},[]) +-- +-- >>> evalT $ phasSignatures # (pcons # pub1 #$ pcons # pub1 # pnil) # (pcons # pub1 #$ pcons # pub2 # pnil) # 2 +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniBool False))}},ExBudget {exBudgetCPU = ExCPU 12275922, exBudgetMemory = ExMemory 31915},[]) +-- +-- >>> evalT $ phasSignatures # (pcons # pub4 #$ pcons # pub3 #$ pcons # pub2 # pnil) # (pcons # pub1 #$ pcons # pub2 #$ pcons # pub3 # pnil) # 2 +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniBool True))}},ExBudget {exBudgetCPU = ExCPU 30821725, exBudgetMemory = ExMemory 69123},[]) +-- +phasSignatures :: + Term s (PBuiltinList (PAsData PPubKeyHash) + -- ^ Transaction signatories. + :--> PBuiltinList (PAsData PPubKeyHash) + -- ^ Authorized signatories. + :--> PInteger + -- ^ Quorum. + :--> PBool + ) +phasSignatures = + phoistAcyclic $ + plam $ \txSignatories authorizedSignatores reqSigs -> + precList + (\self x xs -> plam $ \remAuthSignatories sigs -> + pif (reqSigs #<= sigs) + (pcon PTrue) + (pmatch (pelem' # x # remAuthSignatories) $ \case + PNothing -> self # xs # remAuthSignatories # sigs + PJust remAuthSignatories' -> self # xs # remAuthSignatories' # (sigs + 1) + ) + ) + (\_self -> plam $ \_remReqUniqueSignatories sigs -> reqSigs #<= sigs) + # txSignatories + # authorizedSignatores + # 0 + +-- | 'toDatum' Converts any 'PType' that has instance of 'PIsData' to 'PDatum'. +toDatum :: forall a s. PIsData a => Term s a -> Term s PDatum +toDatum = pcon . PDatum . pforgetData . pdata + +-- | 'pfindTxOutByTxOutRef' searches for 'PTxInInfo' given 'PTxOutRef' and returns 'PTxOut' of the +-- matched 'PTxInInfo', fails if such 'PTxInInfo' is not present. +pfindTxOutByTxOutRef :: + Term s (PTxOutRef + :--> PBuiltinList PV2.PTxInInfo + :--> PV2.PTxOut + ) +pfindTxOutByTxOutRef = phoistAcyclic $ plam $ \txOutRef inputs + -> precList (\self x xs + -> pif (pdata txOutRef #== pfield @"outRef" # x) + (pfield @"resolved" # x) + (self # xs) + ) + (const $ ptraceError "There's no TxInInfo that contains given TxOutRef.") + # inputs + +-- errors if the purpose isn't "Minting" +pownSymbol :: Term s (PV2.PScriptContext :--> PCurrencySymbol) +pownSymbol = phoistAcyclic $ plam $ \ctx -> unTermCont $ do + PMinting csRec <- pmatchC $ pfield @"purpose" # ctx + pure $ pfield @"_0" # csRec + +-- | 'pexpectedTokenName' is the 'psha2_256' hash of 'PTxId' + 'Integer' of the given 'PTxOutRef'. +pexpectedTokenName :: + Term s (PTxOutRef + :--> PTokenName + ) +pexpectedTokenName = phoistAcyclic $ plam $ \txOutRef + -> pletFields @["idx", "id"] txOutRef $ \v + -> pcon $ PTokenName $ psha2_256 #$ pconsBS # + getField @"idx" v # (pfield @"_0" #$ getField @"id" v) + +{- | 'ppaidValue' returns the first 'PValue' paid to a particular 'PAddress' in a given 'PTxInfo' output list, + This done by checking if the given `PAddress` and hash of given datum + is present in any of the output 'PTxOut' of `PTxInfo`. + Returns 'mempty' is nothing is paid. +-} +ppaidValue :: PIsData a => Term s (a + :--> PAddress + :--> PMap 'PMap.Unsorted PDatumHash PDatum + :--> PBuiltinList PV2.PTxOut + :--> PValue 'Sorted 'Positive) +ppaidValue = phoistAcyclic $ ppaidValueCore $ \f -> + precList + (\self x xs -> + pif (f # x) + (pfield @"value" # x) + (self # xs) + ) + (const mempty) + +{- | 'ppaidValuePlusInline' returns the first 'PValue' paid to a particular 'PAddress' in a given 'PTxInfo' output list + with a given datum. + This is done by checking if the given `PAddress` and given datum + are present in any of the outputs 'PTxOut' of `PTxInfo`. + Returns 'mempty' if nothing is paid. + + __NOTE:__ It's difference with respect to `ppaidValue` is that it supports matching against both inlined or non-inlined datum. +-} +ppaidValuePlusInline :: PIsData a + => Term s ( + a + :--> PAddress + :--> PMap 'PMap.Unsorted PDatumHash PDatum + :--> PBuiltinList PV2.PTxOut + :--> PValue 'Sorted 'Positive) +ppaidValuePlusInline = phoistAcyclic $ ppaidValueCorePlusInline $ \f -> + precList + (\self x xs -> + pif (f # x) + (pfield @"value" # x) + (self # xs) + ) + (const mempty) + +-- | Like 'ppaidValue', but sums up 'PValue's from multiple UTxOs if there are multiple matches. +ppaidValueSum :: PIsData a => Term s (a + :--> PAddress + :--> PMap 'PMap.Unsorted PDatumHash PDatum + :--> PBuiltinList PV2.PTxOut + :--> PValue 'Sorted 'Positive) +ppaidValueSum = phoistAcyclic $ ppaidValueCore $ \f -> + pfoldl + # plam + (\acc x -> + pif (f # x) + (acc <> (pfield @"value" # x)) + acc + ) + # mempty + +ppaidValueCore :: PIsData a + => (Term s (PV2.PTxOut :--> PBool) + -> Term s (PBuiltinList PV2.PTxOut :--> PValue 'Sorted 'Positive)) + -> Term s (a + :--> PAddress + :--> PMap 'PMap.Unsorted PDatumHash PDatum + :--> PBuiltinList PV2.PTxOut + :--> PValue 'Sorted 'Positive) +ppaidValueCore go = plam $ \ref addr datums -> unTermCont $ do + + expectedPaymentDatumHash <- pletC $ + pdcons + # (precList + (\self x' xs -> unTermCont $ do + dh <- pletC $ pfstBuiltin # x' + d <- pletC $ psndBuiltin # x' + pure $ pif (d #== pdata (toDatum ref)) + dh + (self # xs) + ) + (const $ ptraceError "Expected the datum to be present in the Tx.") + # pto datums + ) + # pdnil + + let f = plam $ \o' -> unTermCont $ do + o <- pletFieldsC @["datum", "address"] o' + outDatum <- pletC $ getField @"datum" o + pure $ outDatum #== pcon (POutputDatumHash expectedPaymentDatumHash) + #&& getField @"address" o #== addr + + pure $ go f + +ppaidValueCorePlusInline :: PIsData a + => (Term s (PV2.PTxOut :--> PBool) + -> Term s (PBuiltinList PV2.PTxOut :--> PValue 'Sorted 'Positive)) + -> Term s (a + :--> PAddress + :--> PMap 'PMap.Unsorted PDatumHash PDatum + :--> PBuiltinList PV2.PTxOut + :--> PValue 'Sorted 'Positive) +ppaidValueCorePlusInline go = plam $ \ref addr datums -> unTermCont $ do + commonCheck <- pletC $ plam $ \outDatum outAddr -> outDatum #== toDatum ref #&& outAddr #== addr + let f = plam $ \o' -> unTermCont $ do + o <- pletFieldsC @["datum", "address"] o' + outDatum' <- pletC $ getField @"datum" o + outAddr <- pletC $ getField @"address" o + pmatchC outDatum' >>= \case + PV2.PNoOutputDatum _ -> pure $ pconstant False + PV2.POutputDatum x -> do + outDatum <- pletC (pfield @"outputDatum" # x) + pure $ commonCheck # outDatum # outAddr + PV2.POutputDatumHash x -> pmatchC (PMap.plookup # (pfield @"datumHash" # x) # datums) >>= \case + PNothing -> pure $ pconstant False + PJust outDatum -> pure $ commonCheck # outDatum # outAddr + pure $ go f + +pmintedTokens :: + Term s (PCurrencySymbol + :--> PTokenName + :--> PV2.PTxInfo + :--> PInteger + ) +pmintedTokens = phoistAcyclic $ plam $ \cs tn info + -> unTermCont $ do + mint <- pletC . pto . pfromData $ pfield @"mint" # info + + PJust tnMap <- pmatchC $ PMap.plookup # cs # mint + return (pfromMaybe # 0 # (PMap.plookup # tn # tnMap)) + +pdecodeInlineDatum :: forall a s. (PTryFrom PData (PAsData a), PIsData a) + => Term s (PV2.POutputDatum :--> a) +pdecodeInlineDatum = phoistAcyclic $ + plam $ \od -> + pmatch od $ \case + PV2.POutputDatum datum -> + plet (pfield @"outputDatum" # datum) $ \datumResolved -> + (pfromData . ptryFromData @a . pto . pfromData) datumResolved + _ -> ptraceError "expected inline datum" + +presolveInlineDatum :: Term s (PV2.POutputDatum :--> PDatum) +presolveInlineDatum = phoistAcyclic $ + plam $ \od -> + pmatch od $ \case + PV2.POutputDatum datum -> (pfield @"outputDatum" # datum) + _ -> ptraceError "expected inline datum" + +-- | If the datum of output is inlined, we return it else if it contains hash, we try to find the corresponding datum from witness. +presolveDatum :: + Term s (PV2.POutputDatum + :--> PMap 'PMap.Unsorted PDatumHash PDatum + :--> PDatum + ) +presolveDatum = + phoistAcyclic $ + plam $ \outDatum' datums -> + pmatch outDatum' $ \case + PV2.PNoOutputDatum _ -> ptraceError "presolveDatum: Expected datum in this output" + PV2.POutputDatum x -> pfield @"outputDatum" # x + PV2.POutputDatumHash x -> + pmatch (PMap.plookup # (pfield @"datumHash" # x) # datums) $ \case + PNothing -> ptraceError "presolveDatum: Datum not found in witness map corresponding to datum hash present in this output" + PJust outDatum -> outDatum diff --git a/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Types.hs b/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Types.hs new file mode 100644 index 00000000..b0e0fcba --- /dev/null +++ b/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Types.hs @@ -0,0 +1,37 @@ +{-# LANGUAGE DataKinds #-} + +module GeniusYield.OnChain.Plutarch.Types where + +import Plutarch.Api.V1 +import Plutarch.DataRepr +import Plutarch.Extra.RationalData (PRationalData) +import Plutarch.Prelude +import PlutusLedgerApi.V1.Value (AssetClass) +import qualified PlutusTx.Ratio as PlutusTx +import Ply.Plutarch.Class (PlyArgOf) + +{- | 'PAssetClass' is the plutarch level type for 'AssetClass' defined in "Ledger.Value". +-} +newtype PAssetClass (s :: S) + = PAssetClass + ( Term + s + ( PDataRecord + '[ "currencySymbol" ':= PCurrencySymbol + , "tokenName" ':= PTokenName + ] + ) + ) + deriving stock (Generic) + deriving anyclass (PlutusType, PIsData, PEq, PDataFields, PTryFrom PData) + +instance DerivePlutusType PAssetClass where type DPTStrat _ = PlutusTypeData + +instance PTryFrom PData (PAsData PAssetClass) + +type instance PlyArgOf PAssetClass = AssetClass + +newtype Flip f a b = Flip (f b a) + deriving stock (Generic) + +type instance PlyArgOf PRationalData = PlutusTx.Rational diff --git a/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Utils.hs b/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Utils.hs new file mode 100644 index 00000000..30a836e9 --- /dev/null +++ b/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Utils.hs @@ -0,0 +1,286 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE PartialTypeSignatures #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} + +module GeniusYield.OnChain.Plutarch.Utils ( pfromMaybe + , ptoRational + , pceiling + , pfloor + , plookupTuple + , pmin + , ppairToRat + , pgetContinuingOutputUsingNft + , pgetContinuingOutputs + , pfindOwnInput + , pfindOutputWithNft + , pisAddressForScript + , pparseDatum + , pparseDatum' + , ptryFromData + , pelem' + , pallUnique + ) where + +import GeniusYield.OnChain.Plutarch.Types (PAssetClass (..)) +import GeniusYield.OnChain.Plutarch.Value (passetClassValueOf) +import Plutarch.Api.V1 (KeyGuarantees (Unsorted), PAddress, PCredential (..), PDatum, + PDatumHash, PMap, PTuple, PTxOutRef) +import qualified Plutarch.Api.V1.AssocMap as PMap +import Plutarch.Api.V1.Scripts (PScriptHash) +import qualified Plutarch.Api.V2 as PV2 +import Plutarch.Extra.Maybe (pjust) +import Plutarch.Num +import Plutarch.Positive (ptryPositive) +import Plutarch.Prelude hiding (psingleton) +import qualified Plutarch.Rational as PRational + +-- $setup +-- +-- >>> :set -XDataKinds +-- >>> import GeniusYield.OnChain.Plutarch.Run +-- >>> import Plutarch.Prelude +-- >>> import Plutarch.Extra.Maybe (pjust, pnothing) + +-- | 'pfromMaybe' is the plutarch level function that is similar to 'fromMaybe'. +pfromMaybe :: forall a s. Term s (a :--> PMaybe a :--> a) +pfromMaybe = phoistAcyclic $ plam $ \e a + -> pmatch a $ \case + PJust a' -> a' + PNothing -> e + +-- | 'pceiling' is the plutarch level function of 'ceiling'. +pceiling :: + Term s (PRational + :--> PInteger + ) +pceiling = phoistAcyclic $ plam $ \x + -> plet (PRational.pfromInteger #$ PRational.ptruncate # x) $ \y + -> plet (PRational.ptruncate # x) $ \z + -> pif + (x #< 0) + z + (pif + (x #== y) + z + (1 + z) + ) + +-- | 'pfloor' is the plutarch level function of 'floor'. +-- +-- >>> evalT $ pfloor # pcon (PRational 2 1) +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniInteger 2))}},ExBudget {exBudgetCPU = ExCPU 3590775, exBudgetMemory = ExMemory 9708},[]) +-- +-- >>> evalT $ pfloor # pcon (PRational 14 7) +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniInteger 2))}},ExBudget {exBudgetCPU = ExCPU 3590775, exBudgetMemory = ExMemory 9708},[]) +-- +-- >>> evalT $ pfloor # pcon (PRational 25 10) +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniInteger 2))}},ExBudget {exBudgetCPU = ExCPU 3590775, exBudgetMemory = ExMemory 9708},[]) +-- +-- >>> evalT $ pfloor # pcon (PRational 0 10) +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniInteger 0))}},ExBudget {exBudgetCPU = ExCPU 3590775, exBudgetMemory = ExMemory 9708},[]) +-- +-- >>> evalT $ pfloor # pcon (PRational (-1) 10) +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniInteger (-1)))}},ExBudget {exBudgetCPU = ExCPU 5606010, exBudgetMemory = ExMemory 14618},[]) +-- +-- >>> evalT $ pfloor # pcon (PRational (-4) 2) +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniInteger (-2)))}},ExBudget {exBudgetCPU = ExCPU 5307533, exBudgetMemory = ExMemory 14216},[]) +-- +-- >>> evalT $ pfloor # pcon (PRational (-17) 7) +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniInteger (-3)))}},ExBudget {exBudgetCPU = ExCPU 5606010, exBudgetMemory = ExMemory 14618},[]) +-- +pfloor :: + Term s (PRational + :--> PInteger + ) +pfloor = phoistAcyclic $ plam $ \x + -> plet (PRational.pfromInteger #$ PRational.ptruncate # x) $ \qtR + -> plet (PRational.ptruncate # x) $ \qt + -> pif (x #< 0) + (pif + (x #== qtR) + qt + (qt - 1) + ) + qt + +-- | 'pfind' that works with a Haskell level predicate. +pfind' :: + PIsListLike list a => + (Term s a -> Term s PBool) -> + Term s (list a :--> PMaybe a) +pfind' p = precList + (\self x xs + -> pif (p x) (pcon (PJust x)) (self # xs) + ) + (const $ pcon PNothing) + +-- | Find the value for a given key in an assoclist which uses 'PTuple's. +plookupTuple :: + (PEq a, PIsListLike list (PAsData (PTuple a b)), PIsData a, PIsData b) => + Term s (a :--> list (PAsData (PTuple a b)) :--> PMaybe b) +plookupTuple = phoistAcyclic $ plam $ \k xs + -> pmatch (pfind' (\p -> (pfield @"_0" # pfromData p) #== k) # xs) $ \case + PNothing -> pcon PNothing + PJust p -> pcon (PJust (pfield @"_1" # pfromData p)) + +-- | returns minimum of the two values. +pmin :: (POrd a) => + Term s ( a + :--> a + :--> a + ) +pmin = phoistAcyclic $ plam $ \x y -> pif (x #<= y) x y + +-- | converts a 'PBuiltinPair' with 'PInteger' and 'PPositive' into 'PRational'. +ppairToRat :: Term s (PBuiltinPair (PAsData PInteger) (PAsData PInteger) :--> PRational) +ppairToRat = phoistAcyclic $ plam $ \p -> pcon $ PRational (pfromData $ pfstBuiltin # p) (ptryPositive #$ pfromData $ psndBuiltin # p) + +ptoRational :: Integer -> Integer -> Term s PRational +ptoRational x y = pcon $ PRational (pfromInteger x) (pfromInteger y) + +pgetContinuingOutputUsingNft :: Term s (PAddress :--> PAssetClass :--> PBuiltinList PV2.PTxOut :--> PV2.PTxOut) +pgetContinuingOutputUsingNft = phoistAcyclic $ + plam $ \addressIn nftAC outputs -> + pmatch (pfind # (matches # addressIn # nftAC) # outputs) $ \case + PNothing -> ptraceError "no continuing output found" + PJust o -> o + where + matches :: Term s (PAddress :--> PAssetClass :--> PV2.PTxOut :--> PBool) + matches = phoistAcyclic $ + plam $ \addressIn nftAC txOut -> + pletFields @'["address", "value"] txOut $ \txOut' -> + (passetClassValueOf # getField @"value" txOut' # nftAC #== 1) #&& (addressIn #== getField @"address" txOut') + +-- V2 versions of some API utils from upstream. + +pgetContinuingOutputs :: Term s (PBuiltinList PV2.PTxInInfo :--> PBuiltinList PV2.PTxOut :--> PTxOutRef :--> PBuiltinList PV2.PTxOut) +pgetContinuingOutputs = phoistAcyclic $ + plam $ \inputs outputs outRef -> + pmatch (pfindOwnInput # inputs # outRef) $ \case + PJust tx -> do + let resolved = pfield @"resolved" # tx + outAddr = pfield @"address" # resolved + pfilter # (matches # outAddr) # outputs + PNothing -> + ptraceError "can't get any continuing outputs" + where + matches :: Term s (PAddress :--> PV2.PTxOut :--> PBool) + matches = phoistAcyclic $ + plam $ \adr txOut -> + adr #== pfield @"address" # txOut + +pfindOwnInput :: Term s (PBuiltinList PV2.PTxInInfo :--> PTxOutRef :--> PMaybe PV2.PTxInInfo) +pfindOwnInput = phoistAcyclic $ + plam $ \inputs outRef -> + pfind # (matches # outRef) # inputs + where + matches :: Term s (PTxOutRef :--> PV2.PTxInInfo :--> PBool) + matches = phoistAcyclic $ + plam $ \outref txininfo -> + outref #== pfield @"outRef" # txininfo + +-- | Finds the first output that contains the given NFT. +pfindOutputWithNft :: Term s (PBuiltinList PV2.PTxOut :--> PAssetClass :--> PMaybe PV2.PTxOut) +pfindOutputWithNft = phoistAcyclic $ + plam $ \outputs reqAsset -> + pfind # (matches # reqAsset) # outputs + where + matches :: Term s (PAssetClass :--> PV2.PTxOut :--> PBool) + matches = phoistAcyclic $ + plam $ \reqAsset txOut -> + passetClassValueOf # (pfield @"value" # txOut) # reqAsset #== 1 + +-- | Checks whether the given address belongs to the script with the given hash. +pisAddressForScript :: Term s (PAddress :--> PScriptHash :--> PBool) +pisAddressForScript = phoistAcyclic $ + plam $ \addr scrHash -> + pmatch (pfield @"credential" # addr) $ \case + PPubKeyCredential _ -> pconstant False + PScriptCredential x -> scrHash #== pfield @"_0" # x + +pparseDatum :: forall a s. PTryFrom PData (PAsData a) + => Term s (PDatumHash + :--> PMap 'Unsorted PDatumHash PDatum + :--> PMaybe (PAsData a) + ) +pparseDatum = phoistAcyclic $ + plam $ \dh datums -> + pmatch (PMap.plookup # dh # datums) $ \case + PNothing -> pcon PNothing + PJust datm -> pcon . PJust . ptryFromData $ pto datm + +pparseDatum' :: forall a s. PTryFrom PData (PAsData a) + => Term s (PV2.POutputDatum + :--> PMap 'Unsorted PDatumHash PDatum + :--> PAsData a + ) +pparseDatum' = phoistAcyclic $ + plam $ \od datums -> + pmatch od $ \case + PV2.PNoOutputDatum _ -> ptraceError "expected output datum" + PV2.POutputDatum x -> plet (pfield @"outputDatum" # x) $ + \(datm :: Term _ PDatum) -> + ptryFromData $ pto datm + PV2.POutputDatumHash x -> pmatch (PMap.plookup # (pfield @"datumHash" # x) # datums) $ \case + PNothing -> ptraceError "output datum not found" + PJust datm -> ptryFromData (pto datm) + +ptryFromData :: forall a s. PTryFrom PData (PAsData a) => Term s PData -> Term s (PAsData a) +ptryFromData x = unTermCont $ fst <$> tcont (ptryFrom @(PAsData a) x) + + +-- | / O(n) /. Like `pelem` but returns the list without the element if it is found. +-- +-- >>> evalT $ (pelem' # (1 :: Term s PInteger) #$ pcons @PList # 1 #$ pcons # 2 #$ pcons # 3 # pnil) #== (pjust #$ pcons @PList # 2 #$ pcons # 3 # pnil) +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniBool True))}},ExBudget {exBudgetCPU = ExCPU 6526567, exBudgetMemory = ExMemory 24706},[]) +-- +-- >>> evalT $ (pelem' # (2 :: Term s PInteger) #$ pcons @PList # 1 #$ pcons # 2 #$ pcons # 3 # pnil) #== (pjust #$ pcons @PList # 1 #$ pcons # 3 # pnil) +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniBool True))}},ExBudget {exBudgetCPU = ExCPU 8058056, exBudgetMemory = ExMemory 30108},[]) +-- +-- >>> evalT $ (pelem' # (3 :: Term s PInteger) #$ pcons @PList # 1 #$ pcons # 2 #$ pcons # 3 # pnil) #== (pjust #$ pcons @PList # 1 #$ pcons # 2 # pnil) +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniBool True))}},ExBudget {exBudgetCPU = ExCPU 9589545, exBudgetMemory = ExMemory 35510},[]) +-- +-- >>> evalT $ (pelem' # (4 :: Term s PInteger) #$ pcons @PList # 1 #$ pcons # 2 #$ pcons # 3 # pnil) #== pnothing +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniBool True))}},ExBudget {exBudgetCPU = ExCPU 5675567, exBudgetMemory = ExMemory 21006},[]) +-- +-- >>> evalT $ (pelem' # (4 :: Term s PInteger) # pcon PSNil) #== pnothing +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniBool True))}},ExBudget {exBudgetCPU = ExCPU 1288100, exBudgetMemory = ExMemory 5700},[]) +-- +-- >>> evalT $ (pelem' # (1 :: Term s PInteger) #$ pcons @PList # 1 # pnil) #== pjust # pnil +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniBool True))}},ExBudget {exBudgetCPU = ExCPU 3049589, exBudgetMemory = ExMemory 12102},[]) +-- +pelem' :: (PIsListLike list a, PEq a) => Term s (a :--> list a :--> PMaybe (list a)) +pelem' = + phoistAcyclic $ + plam $ \needle -> + precList + (\self x xs -> + pif (x #== needle) + (pjust # xs) + (pmatch (self # xs) $ \case + PNothing -> pcon PNothing + PJust xs' -> pjust #$ pcons # x # xs' + ) + ) + (\_self -> pcon PNothing) + +-- | Check if all the elements in the list are unique. +-- +-- >>> evalT $ (pallUnique #$ pcons @PList # (1 :: Term s PInteger) #$ pcons # 2 #$ pcons # 3 # pnil) #== (pcon PTrue) +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniBool True))}},ExBudget {exBudgetCPU = ExCPU 8815347, exBudgetMemory = ExMemory 32911},[]) +-- +-- >>> evalT $ (pallUnique #$ (pnil :: Term s (PList PInteger))) #== (pcon PTrue) +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniBool True))}},ExBudget {exBudgetCPU = ExCPU 1150212, exBudgetMemory = ExMemory 4402},[]) +-- +-- >>> evalT $ (pallUnique #$ pcons @PList # (1 :: Term s PInteger) #$ pcons # 2 #$ pcons # 3 #$ pcons # 2 # pnil) #== (pcon PFalse) +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniBool True))}},ExBudget {exBudgetCPU = ExCPU 8991769, exBudgetMemory = ExMemory 31514},[]) +-- +pallUnique :: (PIsListLike list a, PEq a) => Term s (list a :--> PBool) +pallUnique = phoistAcyclic $ + precList + (\self x xs -> pif (pelem # x # xs) (pcon PFalse) (self # xs)) + (const $ pcon PTrue) diff --git a/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Value.hs b/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Value.hs new file mode 100644 index 00000000..51252807 --- /dev/null +++ b/geniusyield-onchain/src/GeniusYield/OnChain/Plutarch/Value.hs @@ -0,0 +1,185 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE PartialTypeSignatures #-} +{-# LANGUAGE QuantifiedConstraints #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} + +module GeniusYield.OnChain.Plutarch.Value + ( psubtractValue + , passetClassValue + , passetClassValuePositive + , psingletonPositiveData + , passetClassValueOf + , pisNonNegative + , passetClass + , plovelace + , pgeq + , pleq + , pvalTotalEntries + ) where + +import Plutarch.Api.V1 (AmountGuarantees (..), KeyGuarantees (..), PCurrencySymbol, + PTokenName, PValue) +import qualified Plutarch.Api.V1.AssocMap as AssocMap +import qualified Plutarch.Api.V1.Value as PValue +import Plutarch.Extra.TermCont (pletC) +import qualified Plutarch.List as List +import Plutarch.Prelude +import PlutusLedgerApi.V1.Value (adaSymbol, adaToken) + +import GeniusYield.OnChain.Plutarch.Types (PAssetClass (..)) +import qualified Plutarch.Api.V1.AssocMap as PMap +import qualified Plutarch.Unsafe as PUNSAFE +import qualified PlutusTx.Monoid + +-- $setup +-- +-- >>> :set -XOverloadedStrings -XDataKinds +-- >>> import qualified GeniusYield.OnChain.Plutarch.Run as Run +-- >>> import qualified PlutusLedgerApi.V1.Value as PlutusTx +-- >>> import Plutarch.Prelude +-- >>> import Plutarch.Api.V1 +-- >>> import qualified PlutusTx +-- >>> import Plutarch.Unsafe (punsafeCoerce) +-- +-- >>> let tokenACS :: PlutusTx.CurrencySymbol = "12345678912345678912345678912345678912345678912345678912" +-- >>> let tokenAN :: PlutusTx.TokenName = "tokenA" +-- >>> let tokenA = PlutusTx.assetClass tokenACS tokenAN +-- +-- >>> let tokenBCS :: PlutusTx.CurrencySymbol = "12345678912345678912345678912345678912345678912345678913" +-- >>> let tokenBN :: PlutusTx.TokenName = "tokenB" +-- >>> let tokenB = PlutusTx.assetClass tokenBCS tokenBN +-- +-- >>> let valA = PlutusTx.assetClassValue tokenA 123456789 +-- >>> let valA' = PlutusTx.assetClassValue (PlutusTx.assetClass tokenACS "tokenA'") 123456789 +-- >>> let valB = PlutusTx.assetClassValue tokenB 123456789 +-- +-- >>> :{ +-- f :: Term s (PValue 'Sorted 'NoGuarantees :--> PValue 'Sorted 'NoGuarantees :--> PValue 'Sorted 'NoGuarantees) +-- f = phoistAcyclic $ plam $ \v1 v2 -> v1 <> v2 +-- :} +-- +-- To measure memory consumption of joining values, compared to joining two @PPartialOrderContainedFee@. +-- +-- >>> Run.evalT $ f # (punsafeCoerce (pconstant valA)) # (punsafeCoerce (pconstant valB)) +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf (DefaultUniApply DefaultUniProtoList (DefaultUniApply (DefaultUniApply DefaultUniProtoPair DefaultUniData) DefaultUniData)) [(B "\DC24Vx\145#Eg\137\DC24Vx\145#Eg\137\DC24Vx\145#Eg\137\DC2",Map [(B "tokenA",I 123456789)]),(B "\DC24Vx\145#Eg\137\DC24Vx\145#Eg\137\DC24Vx\145#Eg\137\DC3",Map [(B "tokenB",I 123456789)])]))}},ExBudget {exBudgetCPU = ExCPU 8204258, exBudgetMemory = ExMemory 25020},[]) + +-- FIXME: Eventually there should be a utility function in upstream Plutarch +-- for casting values to NoGuarantees. When that function exists, +-- replace the PUNSAFE.punsafeCoerce with it +psubtractValue :: Term s + ( PValue 'Sorted anyG + :--> PValue 'Sorted anyG + :--> PValue 'Sorted 'NoGuarantees) +psubtractValue = phoistAcyclic $ plam $ \v1 v2 -> + PValue.punionWith # plam (+) + # v1 + # PlutusTx.Monoid.inv (PUNSAFE.punsafeCoerce v2 :: Term _ (PValue 'Sorted 'NoGuarantees)) + +{- | 'passetClassValueOf' is the plutarch level function that is similar to 'assetClassValueOf' + defined in "Ledger". 'passetClassValueOf' returns 'PInteger' if the given 'PAssetClass' + is present in the 'PValue', else return 0. +-} +passetClassValueOf :: + Term s (PValue anyK anyG + :--> PAssetClass + :--> PInteger + ) +passetClassValueOf = phoistAcyclic $ plam $ \v ac -> unTermCont $ do + cs <- pletC $ pfield @"currencySymbol" # ac + tn <- pletC $ pfield @"tokenName" # ac + pure $ PValue.pvalueOf # v # cs # tn + +-- | creates a singleton value from the 'PAssetClass' and it's amount. +passetClassValue :: + Term s ( PAssetClass + :--> PAsData PInteger + :--> PValue 'Sorted 'NonZero + ) +passetClassValue = phoistAcyclic $ plam $ \ac v + -> unTermCont $ do + + cs <- pletC $ pfield @"currencySymbol" # ac + tn <- pletC $ pfield @"tokenName" # ac + pure $ PValue.psingletonData # cs # tn # v + +-- | Creates a singleton value from the 'PAssetClass' and it's amount, where amount is checked to be positive. +passetClassValuePositive :: + Term s ( PAssetClass + :--> PAsData PInteger + :--> PValue 'Sorted 'Positive + ) +passetClassValuePositive = phoistAcyclic $ plam $ \ac v + -> unTermCont $ do + + cs <- pletC $ pfield @"currencySymbol" # ac + tn <- pletC $ pfield @"tokenName" # ac + pure $ psingletonPositiveData # cs # tn # v + +-- | Construct a singleton 'PValue' containing only the given positive quantity of the given currency, taking data-encoded parameters. Implementation is a slightly modified version of @psingletonData@ defined [here](https://github.com/Plutonomicon/plutarch-plutus/blob/c14ad83479706566fe22e7b7b50b696043326c8f/Plutarch/Api/V1/Value.hs#L283-L305). +-- +-- >>> Run.evalWithArgsT psingletonPositiveData [PlutusTx.toData tokenACS, PlutusTx.toData tokenAN, PlutusTx.toData 2] +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf (DefaultUniApply DefaultUniProtoList (DefaultUniApply (DefaultUniApply DefaultUniProtoPair DefaultUniData) DefaultUniData)) [(B "\DC24Vx\145#Eg\137\DC24Vx\145#Eg\137\DC24Vx\145#Eg\137\DC2",Map [(B "tokenA",I 2)])]))}},ExBudget {exBudgetCPU = ExCPU 2173250, exBudgetMemory = ExMemory 6794},[]) +-- +-- >>> Run.evalWithArgsT psingletonPositiveData [PlutusTx.toData tokenACS, PlutusTx.toData tokenAN, PlutusTx.toData (-2)] +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf (DefaultUniApply DefaultUniProtoList (DefaultUniApply (DefaultUniApply DefaultUniProtoPair DefaultUniData) DefaultUniData)) []))}},ExBudget {exBudgetCPU = ExCPU 1134410, exBudgetMemory = ExMemory 3634},[]) +-- +psingletonPositiveData :: + Term + s + ( PAsData PCurrencySymbol + :--> PAsData PTokenName + :--> PAsData PInteger + :--> PValue 'Sorted 'Positive + ) +psingletonPositiveData = phoistAcyclic $ + plam $ \symbol token amount -> + pif + (pfromData amount #<= 0) + mempty + ( PUNSAFE.punsafeDowncast + ( AssocMap.psingletonData + # symbol + #$ pdata + $ AssocMap.psingletonData # token # amount + ) + ) + +-- | Check if a 'PValue' is non negative (all amounts are greater than equal to 0). +pisNonNegative :: forall any s. (forall s'. Semigroup (Term s' (PValue 'Sorted any))) => Term s (PValue 'Sorted any :--> PBool) +pisNonNegative = phoistAcyclic $ plam $ \x -> PMap.pall # plam (\submap -> PMap.pall # plam (0 #<=) # submap) # pto x + +passetClass :: Term s (PCurrencySymbol :--> PTokenName :--> PAssetClass) +passetClass = phoistAcyclic $ + plam $ \cs tk -> + pcon $ PAssetClass $ pdcons @"currencySymbol" # pdata cs #$ pdcons @"tokenName" # pdata tk # pdnil + +plovelace :: ClosedTerm PAssetClass +plovelace = passetClass # pconstant adaSymbol # pconstant adaToken + +pgeq :: Term s (PValue 'Sorted any :--> PValue 'Sorted any :--> PBool) +pgeq = phoistAcyclic $ plam $ \v1 v2 -> pisNonNegative #$ psubtractValue # v1 # v2 + +pleq :: Term s (PValue 'Sorted any :--> PValue 'Sorted any :--> PBool) +pleq = phoistAcyclic $ plam $ \v1 v2 -> pgeq # v2 # v1 + +-- | Gives the total entries present in the value. Note that logic of this function requires @Positive@ guarantee. +-- +-- >>> Run.evalT $ pvalTotalEntries # mempty +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniInteger 0))}},ExBudget {exBudgetCPU = ExCPU 1141454, exBudgetMemory = ExMemory 4332},[]) +-- +-- >>> Run.evalT $ pvalTotalEntries # punsafeCoerce (pconstant valA) +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniInteger 1))}},ExBudget {exBudgetCPU = ExCPU 4538328, exBudgetMemory = ExMemory 14192},[]) +-- +-- >>> Run.evalT $ pvalTotalEntries # punsafeCoerce (pconstant (valA <> valB)) +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniInteger 2))}},ExBudget {exBudgetCPU = ExCPU 7935202, exBudgetMemory = ExMemory 24052},[]) +-- +-- >>> Run.evalT $ pvalTotalEntries # punsafeCoerce (pconstant (valA <> valA' <> valB)) +-- Right (Script {unScript = Program {_progAnn = (), _progVer = Version () 1 0 0, _progTerm = Constant () (Some (ValueOf DefaultUniInteger 3))}},ExBudget {exBudgetCPU = ExCPU 9025215, exBudgetMemory = ExMemory 27018},[]) +-- +pvalTotalEntries :: Term s (PValue 'Sorted 'Positive :--> PInteger) +pvalTotalEntries = phoistAcyclic $ plam $ \v -> List.pfoldl # f # 0 # pto (pto v) + where + f = plam $ \acc tokenMap' -> acc + (List.plength #$ pto (pfromData $ psndBuiltin # tokenMap')) diff --git a/geniusyield-onchain/src/GeniusYield/OnChain/Utils.hs b/geniusyield-onchain/src/GeniusYield/OnChain/Utils.hs new file mode 100644 index 00000000..8ee4b68d --- /dev/null +++ b/geniusyield-onchain/src/GeniusYield/OnChain/Utils.hs @@ -0,0 +1,120 @@ +{-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE OverloadedStrings #-} +{-# OPTIONS -fno-strictness -fno-spec-constr -fno-specialise #-} + +module GeniusYield.OnChain.Utils + ( paidValue + , paidValue' + , integerToBuiltinByteString, builtinByteStringToHex + , ceiling + , mintedTokens + , notSignedBy + , desiredTracingMode + ) where + +import Plutarch (TracingMode (DoTracing)) +import PlutusLedgerApi.V1 +import qualified PlutusTx.AssocMap as Map +import PlutusTx.Prelude +import PlutusTx.Ratio + +{-# INLINABLE paidValue #-} +paidValue :: ScriptContext -> Address -> Value +paidValue ctx' = case scriptContextPurpose ctx' of + Spending x -> paidValue' x $ scriptContextTxInfo ctx' + _ -> error () + +{-# INLINABLE paidValue' #-} +paidValue' :: TxOutRef -> TxInfo -> Address -> Value +paidValue' ownUTxO' info' addr = go $ txInfoOutputs info' + where + go :: [TxOut] -> Value + go xs = + let + o = head xs + in + if p o + then txOutValue o + else go $ tail xs + + expectedHash :: Maybe DatumHash + expectedHash = go' $ txInfoData info' + where + go' :: [(DatumHash, Datum)] -> Maybe DatumHash + go' xs = + let + (dh, d) = head xs + in + if d == expectedDatum + then Just dh + else go' $ tail xs + + expectedDatum :: Datum + expectedDatum = Datum $ toBuiltinData ownUTxO' + + p :: TxOut -> Bool + p o = (txOutAddress o == addr) && (txOutDatumHash o == expectedHash) + +{-# INLINABLE integerToBuiltinByteString #-} +integerToBuiltinByteString :: Integer -> BuiltinByteString +integerToBuiltinByteString n + | n < 0 = traceError "only non-negative Integers can be converted" + | n == 0 = 48 `consByteString` emptyByteString + | otherwise = go n emptyByteString + where + go :: Integer -> BuiltinByteString -> BuiltinByteString + go m acc + | m == 0 = acc + | otherwise = + let + m' = m `divide` 10 + r = m `modulo` 10 + in + go m' $ consByteString (r + 48) acc + +{-# INLINABLE builtinByteStringToHex #-} +builtinByteStringToHex :: BuiltinByteString -> BuiltinByteString +builtinByteStringToHex s = go (lengthOfByteString s - 1) emptyByteString + where + go :: Integer -> BuiltinByteString -> BuiltinByteString + go i acc + | i < 0 = acc + | otherwise = go (i - 1) $ appendByteString (byteToBuiltinByteString $ indexByteString s i) acc + +{-# INLINABLE byteToBuiltinByteString #-} +byteToBuiltinByteString :: Integer -> BuiltinByteString +byteToBuiltinByteString n = consByteString (digitToByte h) $ consByteString (digitToByte l) emptyByteString + where + h = divide n 16 + l = modulo n 16 + + digitToByte :: Integer -> Integer + digitToByte x + | x <= 9 = x + 48 + | otherwise = x + 87 + +{-# INLINABLE ceiling #-} +ceiling :: Rational -> Integer +ceiling x + | x < zero = truncate x + | x == y = truncate x + | otherwise = 1 + truncate x + where + y = fromInteger $ truncate x + +{-# INLINABLE mintedTokens #-} +mintedTokens :: CurrencySymbol -> TokenName -> TxInfo -> Integer +mintedTokens cs tn info = + let + Just m = Map.lookup cs $ getValue $ txInfoMint info + in + fromMaybe 0 $ Map.lookup tn m + +notSignedBy :: TxInfo -> PubKeyHash -> Bool +notSignedBy info' pkh' = go $ txInfoSignatories info' + where + go :: [PubKeyHash] -> Bool + go xs = null xs || (head xs /= pkh' && go (tail xs)) + +desiredTracingMode :: TracingMode +desiredTracingMode = DoTracing diff --git a/geniusyield-onchain/src/GeniusYield/Plutonomy.hs b/geniusyield-onchain/src/GeniusYield/Plutonomy.hs new file mode 100644 index 00000000..d7c735f5 --- /dev/null +++ b/geniusyield-onchain/src/GeniusYield/Plutonomy.hs @@ -0,0 +1,47 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE UnboxedTuples #-} +{-# OPTIONS_GHC -Wno-orphans #-} + +-- | Extras to be added to @plutonomy@. +module GeniusYield.Plutonomy ( + plutonomyMintingPolicyFromScript, + plutonomyValidatorFromScript +) where + +import qualified Plutonomy +import qualified PlutusTx.Code +import qualified UntypedPlutusCore as UPLC +import Ply +import qualified Ply.Core.Unsafe as PlyUnsafe + +instance Plutonomy.HasUPLC (TypedScript rl params) where + uplc f ts = PlyUnsafe.unsafeTypedScript ver <$> Plutonomy.uplc f scrpt + where + (# ver, scrpt #) = PlyUnsafe.unsafeUnTypedScript ts + +renameUPLC :: (name -> name') -> UPLC.Term name uni fun ann -> UPLC.Term name' uni fun ann +renameUPLC rnm = go where + go (UPLC.Var ann n ) = UPLC.Var ann (rnm n) + go (UPLC.LamAbs ann n t ) = UPLC.LamAbs ann (rnm n) (go t) + go (UPLC.Apply ann t1 t2 ) = UPLC.Apply ann (go t1) (go t2) + go (UPLC.Delay ann t ) = UPLC.Delay ann (go t) + go (UPLC.Force ann t ) = UPLC.Force ann (go t) + go (UPLC.Constant ann con) = UPLC.Constant ann con + go (UPLC.Builtin ann bn ) = UPLC.Builtin ann bn + go (UPLC.Error ann ) = UPLC.Error ann + +renameProgram :: (name -> name') -> UPLC.Program name uni fun ann -> UPLC.Program name' uni fun ann +renameProgram f (UPLC.Program ann ver t) = UPLC.Program ann ver (renameUPLC f t) + +namedFromDeBruijn :: UPLC.DeBruijn -> UPLC.NamedDeBruijn +namedFromDeBruijn (UPLC.DeBruijn i) = UPLC.NamedDeBruijn "x" i + +plutonomyMintingPolicyFromScript :: TypedScript 'MintingPolicyRole '[] -> Plutonomy.MintingPolicy +plutonomyMintingPolicyFromScript (TypedScript _ s) = + Plutonomy.mkMintingPolicyScript $ + PlutusTx.Code.DeserializedCode (renameProgram namedFromDeBruijn s) Nothing mempty + +plutonomyValidatorFromScript :: TypedScript 'ValidatorRole '[] -> Plutonomy.Validator +plutonomyValidatorFromScript (TypedScript _ s) = + Plutonomy.mkValidatorScript $ + PlutusTx.Code.DeserializedCode (renameProgram namedFromDeBruijn s) Nothing mempty diff --git a/geniusyield-onchain/tests/geniusyield-onchain-tests.hs b/geniusyield-onchain/tests/geniusyield-onchain-tests.hs new file mode 100644 index 00000000..21cd3272 --- /dev/null +++ b/geniusyield-onchain/tests/geniusyield-onchain-tests.hs @@ -0,0 +1,102 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE NumericUnderscores #-} +{-# LANGUAGE OverloadedStrings #-} + +module Main + ( main + ) where + +import Control.Exception (throwIO) +import Data.Default (def) +import Data.Text (Text) +import qualified Data.Text as Txt +import qualified Plutonomy as P +import Plutonomy.Test (TestOptions (TestOptions, toAggSize, toFixturesDir, toName, toOptSize, toTerm, toUnoptSize), + plutonomyTests) +import PlutusLedgerApi.V1.Address (Address (..)) +import PlutusLedgerApi.V1.Credential (Credential (..)) +import PlutusLedgerApi.V1.Value (assetClass) +import Ply ((#)) +import Test.Tasty (defaultMain, testGroup) + +import GeniusYield.OnChain.DEX.NFT.Compiled (originalNftPolicy) +import GeniusYield.OnChain.DEX.PartialOrder.Compiled (originalPartialOrderValidator) +import GeniusYield.OnChain.DEX.PartialOrderNFT.Compiled (originalPartialOrderNftPolicy) + + + +import GeniusYield.OnChain.DEX.PartialOrderConfig.Compiled (originalPartialOrderConfigValidator) +import GeniusYield.OnChain.DEX.PartialOrderNFTV1_1.Compiled (originalPartialOrderNftV1_1Policy) +import GeniusYield.Plutonomy (plutonomyMintingPolicyFromScript, + plutonomyValidatorFromScript) + +getOrthrowText :: Either Text a -> IO a +getOrthrowText = either (throwIO . userError . Txt.unpack) pure + +main :: IO () +main = do + partialOrderVal <- getOrthrowText $ originalPartialOrderValidator def + partialOrderNftPolicy <- getOrthrowText $ originalPartialOrderNftPolicy def + partialOrderNftPolicyV1_1 <- getOrthrowText $ originalPartialOrderNftV1_1Policy def + partialOrderConfigVal <- getOrthrowText $ originalPartialOrderConfigValidator def + nftPolicy <- getOrthrowText originalNftPolicy + let plutonomyRawFromValidator = P.validatorToRaw . plutonomyValidatorFromScript + plutonomyRawFromMintingPolicy = P.mintingPolicyToRaw . plutonomyMintingPolicyFromScript + defaultMain $ testGroup "geniusyield" + [ testGroup "DEX" + [ plutonomyTests TestOptions + { toName = "partialorder" + , toTerm = plutonomyRawFromValidator $ partialOrderVal + # anAddress + # ac + , toUnoptSize = (6_037, 5_629) + , toOptSize = (5_369, 4_936) + , toAggSize = (5_369, 4_936) + , toFixturesDir = "fixtures" + } + , plutonomyTests TestOptions + { toName = "partialordernftpolicy" + , toTerm = plutonomyRawFromMintingPolicy $ partialOrderNftPolicy + # aScriptHash + # anAddress + # ac + , toUnoptSize = (6_040, 5_652) + , toOptSize = (5_082, 4_546) + , toAggSize = (5_082, 4_546) + , toFixturesDir = "fixtures" + } + , plutonomyTests TestOptions + { toName = "partialordernftpolicyV1_1" + , toTerm = plutonomyRawFromMintingPolicy $ partialOrderNftPolicyV1_1 + # aScriptHash + # anAddress + # ac + , toUnoptSize = (6_040, 5_652) + , toOptSize = (5_082, 4_546) + , toAggSize = (5_082, 4_546) + , toFixturesDir = "fixtures" + } + , plutonomyTests TestOptions + { toName = "partialorderconfig" + , toTerm = plutonomyRawFromValidator $ partialOrderConfigVal # ac + , toUnoptSize = (2_978, 2_630) + , toOptSize = (2_559, 2_250) + , toAggSize = (2_559, 2_250) + , toFixturesDir = "fixtures" + } + , plutonomyTests TestOptions + { toName = "nftpolicy" + , toTerm = plutonomyRawFromMintingPolicy nftPolicy + , toUnoptSize = (507,440) + , toOptSize = (445,388) + , toAggSize = (445,388) + , toFixturesDir = "fixtures" + } + ] + ] + where + aScriptHash = "e2f9d92651c75a28717bf5622e6164e25133d856e9c02ea21a234dfc" + anAddress = Address (PubKeyCredential "a881d6369fa731377d82d806d8deb2067878129a5e2df96c25e5a08e") Nothing + cs = "be18c29c7f0ffca5c3e6cd56f97df0f82a31e317e99bfa031b3b0fe3" + tn = "47454e53" + ac = assetClass cs tn diff --git a/geniusyield-server-lib/CHANGELOG.md b/geniusyield-server-lib/CHANGELOG.md index bc69082b..355b584c 100644 --- a/geniusyield-server-lib/CHANGELOG.md +++ b/geniusyield-server-lib/CHANGELOG.md @@ -1,5 +1,10 @@ # Revision history for geniusyield-server-lib -## 0.1.0 -- 2023-04-02 +## 0.2.0 -- 2024-04-22 + +* Uses latest version of `geniusyield-dex-api` which adds support of v1.1 script. +* `settings` endpoint now returns `genius-server` instead of `mmb` as return value of `backend` field. + +## 0.1.0 -- 2024-04-02 * First version. diff --git a/geniusyield-server-lib/geniusyield-server-lib.cabal b/geniusyield-server-lib/geniusyield-server-lib.cabal index df8a3ee6..919440bd 100644 --- a/geniusyield-server-lib/geniusyield-server-lib.cabal +++ b/geniusyield-server-lib/geniusyield-server-lib.cabal @@ -1,6 +1,6 @@ cabal-version: 3.6 name: geniusyield-server-lib -version: 0.1.0 +version: 0.2.0 synopsis: GeniusYield server library description: Library for GeniusYield server. license: Apache-2.0 diff --git a/geniusyield-server-lib/src/GeniusYield/Server/Api.hs b/geniusyield-server-lib/src/GeniusYield/Server/Api.hs index 810e3f1b..c37e131a 100644 --- a/geniusyield-server-lib/src/GeniusYield/Server/Api.hs +++ b/geniusyield-server-lib/src/GeniusYield/Server/Api.hs @@ -24,10 +24,11 @@ import Data.Version (showVersion) import Deriving.Aeson import Fmt import GHC.TypeLits (Symbol) -import GeniusYield.Api.Dex.PartialOrder (PORefs (..), PartialOrderInfo (..), partialOrders) -import GeniusYield.Api.Dex.PartialOrderConfig (fetchPartialOrderConfig) +import GeniusYield.Api.Dex.PartialOrder (PartialOrderInfo (..), partialOrders) +import GeniusYield.Api.Dex.PartialOrderConfig (RefPocd (..), SomeRefPocd (SomeRefPocd), fetchPartialOrderConfig) import GeniusYield.OrderBot.Domain.Markets import GeniusYield.Scripts (PartialOrderConfigInfoF (..)) +import GeniusYield.Scripts.Dex.Version (POCVersion (POCVersion1_1)) import GeniusYield.Server.Assets import GeniusYield.Server.Auth (APIKeyAuthProtect, V0) import GeniusYield.Server.Constants (gitHash) @@ -290,7 +291,7 @@ customShowNetworkId = show >>> removePrefix "GY" >>> removePrefix "Testnet" >>> handleTradingFeesApi ∷ Ctx → IO TradingFees handleTradingFeesApi ctx@Ctx {..} = do logInfo ctx "Calculating trading fees." - (_, pocd) ← runQuery ctx $ fetchPartialOrderConfig $ porRefNft $ dexPORefs ctxDexInfo + SomeRefPocd (RefPocd (_ :!: pocd)) ← runQuery ctx $ fetchPartialOrderConfig POCVersion1_1 $ dexPORefs ctxDexInfo pure TradingFees { tfFlatMakerFee = fromIntegral $ pociMakerFeeFlat pocd, diff --git a/geniusyield-server-lib/src/GeniusYield/Server/Constants.hs b/geniusyield-server-lib/src/GeniusYield/Server/Constants.hs index 3a31ded6..0f57a0b0 100644 --- a/geniusyield-server-lib/src/GeniusYield/Server/Constants.hs +++ b/geniusyield-server-lib/src/GeniusYield/Server/Constants.hs @@ -1,38 +1,12 @@ module GeniusYield.Server.Constants ( - poRefsMainnet, - poRefsPreprod, - poConfigAddrMainnet, - poConfigAddrPreprod, + module GeniusYield.Api.Dex.Constants, gitHash, ) where -import GeniusYield.Api.Dex.PartialOrder (PORefs (..)) -import GeniusYield.Types (GYAddress, unsafeAddressFromText) +import GeniusYield.Api.Dex.Constants import GitHash import RIO -poRefsMainnet ∷ PORefs -poRefsMainnet = - PORefs - { porValRef = "062f97b0e64130bc18b4a227299a62d6d59a4ea852a4c90db3de2204a2cd19ea#2", - porRefNft = "fae686ea8f21d567841d703dea4d4221c2af071a6f2b433ff07c0af2.4aff78908ef2dce98bfe435fb3fd2529747b1c4564dff5adebedf4e46d0fc63d", - porMintRef = "062f97b0e64130bc18b4a227299a62d6d59a4ea852a4c90db3de2204a2cd19ea#1" - } - -poRefsPreprod ∷ PORefs -poRefsPreprod = - PORefs - { porValRef = "be6f8dc16d4e8d5aad566ff6b5ffefdda574817a60d503e2a0ea95f773175050#2", - porRefNft = "fae686ea8f21d567841d703dea4d4221c2af071a6f2b433ff07c0af2.8309f9861928a55d37e84f6594b878941edce5e351f7904c2c63b559bde45c5c", - porMintRef = "be6f8dc16d4e8d5aad566ff6b5ffefdda574817a60d503e2a0ea95f773175050#1" - } - -poConfigAddrMainnet ∷ GYAddress -poConfigAddrMainnet = unsafeAddressFromText "addr1w9zr09hgj7z6vz3d7wnxw0u4x30arsp5k8avlcm84utptls8uqd0z" - -poConfigAddrPreprod ∷ GYAddress -poConfigAddrPreprod = unsafeAddressFromText "addr_test1wrgvy8fermjrruaf7fnndtmpuw4xx4cnvfqjp5zqu8kscfcvh32qk" - -- | The git hash of the current commit. gitHash ∷ String gitHash = $$tGitInfoCwd & giHash diff --git a/geniusyield-server-lib/src/GeniusYield/Server/Ctx.hs b/geniusyield-server-lib/src/GeniusYield/Server/Ctx.hs index 0edb9026..59ac32a7 100644 --- a/geniusyield-server-lib/src/GeniusYield/Server/Ctx.hs +++ b/geniusyield-server-lib/src/GeniusYield/Server/Ctx.hs @@ -12,57 +12,14 @@ module GeniusYield.Server.Ctx ( ) where import Data.Strict.Tuple (Pair (..)) -import GeniusYield.Api.Dex.PartialOrder (PORefs (..)) import GeniusYield.Imports import GeniusYield.OrderBot.Adapter.Maestro (MaestroProvider) -import GeniusYield.Scripts (HasPartialOrderConfigAddr (..), HasPartialOrderNftScript (..), HasPartialOrderScript (..)) -import GeniusYield.Scripts.Dex.Data (nftPolicy, orderValidator) -import GeniusYield.Server.Constants (poConfigAddrMainnet, poConfigAddrPreprod, poRefsMainnet, poRefsPreprod) +import GeniusYield.Server.Constants (DEXInfo (..), dexInfoDefaultMainnet, dexInfoDefaultPreprod) import GeniusYield.Transaction import GeniusYield.TxBuilder import GeniusYield.Types -import PlutusLedgerApi.V1 (Address) -import PlutusLedgerApi.V1.Scripts (ScriptHash) -import PlutusLedgerApi.V1.Value (AssetClass) -import Ply (ScriptRole (..), TypedScript) import RIO --- | Type that encapsulates the scripts needed for the dex api. -data DEXInfo = DEXInfo - { dexPartialOrderValidator ∷ !(TypedScript 'ValidatorRole '[Address, AssetClass]), - dexNftPolicy ∷ !(TypedScript 'MintingPolicyRole '[ScriptHash, Address, AssetClass]), - dexPartialOrderConfigAddr ∷ !GYAddress, - dexPORefs ∷ !PORefs - } - deriving stock (Show) - -instance HasPartialOrderScript DEXInfo where - getPartialOrderValidator = dexPartialOrderValidator - -instance HasPartialOrderNftScript DEXInfo where - getPartialOrderNftPolicy = dexNftPolicy - -instance HasPartialOrderConfigAddr DEXInfo where - getPartialOrderConfigAddr = dexPartialOrderConfigAddr - -dexInfoDefaultMainnet ∷ DEXInfo -dexInfoDefaultMainnet = - DEXInfo - { dexPartialOrderValidator = orderValidator, - dexNftPolicy = nftPolicy, - dexPartialOrderConfigAddr = poConfigAddrMainnet, - dexPORefs = poRefsMainnet - } - -dexInfoDefaultPreprod ∷ DEXInfo -dexInfoDefaultPreprod = - DEXInfo - { dexPartialOrderValidator = orderValidator, - dexNftPolicy = nftPolicy, - dexPartialOrderConfigAddr = poConfigAddrPreprod, - dexPORefs = poRefsPreprod - } - -- | Server context: configuration & shared state. data Ctx = Ctx { ctxNetworkId ∷ !GYNetworkId, diff --git a/geniusyield-server-lib/src/GeniusYield/Server/Dex/PartialOrder.hs b/geniusyield-server-lib/src/GeniusYield/Server/Dex/PartialOrder.hs index 175a1239..a8e1185e 100644 --- a/geniusyield-server-lib/src/GeniusYield/Server/Dex/PartialOrder.hs +++ b/geniusyield-server-lib/src/GeniusYield/Server/Dex/PartialOrder.hs @@ -15,11 +15,12 @@ import Data.Swagger.Internal.Schema qualified as Swagger import Deriving.Aeson import Fmt import GHC.TypeLits (AppendSymbol, Symbol) -import GeniusYield.Api.Dex.PartialOrder (PORefs (..), PartialOrderInfo (..), cancelMultiplePartialOrders, fillMultiplePartialOrders', getPartialOrdersInfos, getPartialOrdersInfos', orderByNft, partialOrderPrice', placePartialOrder') -import GeniusYield.Api.Dex.PartialOrderConfig (fetchPartialOrderConfig) +import GeniusYield.Api.Dex.PartialOrder (PartialOrderInfo (..), cancelMultiplePartialOrders', fillMultiplePartialOrders', getPartialOrdersInfos, getPartialOrdersInfos', getVersionsInOrders, orderByNft, partialOrderPrice', placePartialOrder', preferentiallySelectLatestPocd, preferentiallySelectLatestVersion, roundFunctionForPOCVersion) +import GeniusYield.Api.Dex.PartialOrderConfig (RefPocd (..), SomeRefPocd (SomeRefPocd), fetchPartialOrderConfig, fetchPartialOrderConfigs) import GeniusYield.HTTP.Errors import GeniusYield.OrderBot.Domain.Markets (OrderAssetPair (..)) import GeniusYield.Scripts.Dex.PartialOrderConfig (PartialOrderConfigInfoF (..)) +import GeniusYield.Scripts.Dex.Version (POCVersion (POCVersion1_1)) import GeniusYield.Server.Ctx import GeniusYield.Server.Tx (handleTxSign, handleTxSubmit, throwNoSigningKeyError) import GeniusYield.Server.Utils (addSwaggerDescription, addSwaggerExample, dropSymbolAndCamelToSnake, logDebug, logInfo) @@ -364,7 +365,8 @@ handlePlaceOrder ctx@Ctx {..} pops@PlaceOrderParameters {..} = do let porefs = dexPORefs ctxDexInfo popAddresses' = addressFromBech32 <$> popAddresses changeAddr = maybe (NonEmpty.head popAddresses') (\(ChangeAddress addr) → addressFromBech32 addr) popChangeAddress - (cfgRef, pocd) ← runQuery ctx $ fetchPartialOrderConfig $ porRefNft porefs + pocVersion = POCVersion1_1 + SomeRefPocd (RefPocd (cfgRef :!: pocd)) ← runQuery ctx $ fetchPartialOrderConfig pocVersion porefs let unitPrice = rationalFromGHC $ toInteger popPriceAmount % toInteger popOfferAmount @@ -391,7 +393,7 @@ handlePlaceOrder ctx@Ctx {..} pops@PlaceOrderParameters {..} = do potdTransactionFee = fromIntegral $ txBodyFee txBody, potdMakerLovelaceFlatFee = fromIntegral $ pociMakerFeeFlat pocd, potdMakerOfferedPercentFee = 100 * pociMakerFeeRatio pocd, - potdMakerOfferedPercentFeeAmount = ceiling $ toRational popOfferAmount * rationalToGHC (pociMakerFeeRatio pocd), + potdMakerOfferedPercentFeeAmount = roundFunctionForPOCVersion pocVersion $ toRational popOfferAmount * rationalToGHC (pociMakerFeeRatio pocd), potdLovelaceDeposit = fromIntegral $ pociMinDeposit pocd, potdOrderRef = txOutRefFromTuple (txId, 0) } @@ -420,7 +422,7 @@ handleCancelOrders ctx@Ctx {..} cops@CancelOrderParameters {..} = do changeAddr = maybe (NonEmpty.head copAddresses') (\(ChangeAddress addr) → addressFromBech32 addr) copChangeAddress txBody ← runSkeletonI ctx (NonEmpty.toList copAddresses') changeAddr copCollateral $ do pois ← Map.elems <$> getPartialOrdersInfos porefs (NonEmpty.toList copOrderReferences) - cancelMultiplePartialOrders porefs pois + cancelMultiplePartialOrders' porefs pois pure CancelOrderTransactionDetails { cotdTransaction = unsignedTx txBody, @@ -452,19 +454,22 @@ handleFillOrders ∷ Ctx → FillOrderParameters → IO FillOrderTransactionDeta handleFillOrders ctx@Ctx {..} fops@FillOrderParameters {..} = do logInfo ctx $ "Filling order(s). Parameters: " +|| fops ||+ "" let porefs = dexPORefs ctxDexInfo - fopAddresses' = addressFromBech32 <$> fopAddresses - changeAddr = maybe (NonEmpty.head fopAddresses') (\(ChangeAddress addr) → addressFromBech32 addr) fopChangeAddress - (cfgRef, pocd) ← runQuery ctx $ fetchPartialOrderConfig $ porRefNft porefs + refPocds ← runQuery ctx $ fetchPartialOrderConfigs porefs ordersWithTokenBuyAmount ← runQuery ctx $ getPartialOrdersInfos' porefs $ NonEmpty.toList $ second naturalToGHC <$> fopOrderReferencesWithAmount when (length ordersWithTokenBuyAmount > fromIntegral maxFillOrders) $ throwIO PodMultiFillMoreThanAllowed - let takerFeeRatio = pociMakerFeeRatio pocd - takerFee = computePercentTakerFees ordersWithTokenBuyAmount takerFeeRatio + let versionsSet = getVersionsInOrders $ map fst ordersWithTokenBuyAmount + overallPocVersion = preferentiallySelectLatestVersion versionsSet + pocd = preferentiallySelectLatestPocd versionsSet refPocds + takerFeeRatio = pociMakerFeeRatio pocd + takerFee = computePercentTakerFees overallPocVersion ordersWithTokenBuyAmount takerFeeRatio maxFlatTakerFee = foldl' (\prevMax (poi, _) → max prevMax $ poiTakerLovelaceFlatFee poi) 0 ordersWithTokenBuyAmount + fopAddresses' = addressFromBech32 <$> fopAddresses + changeAddr = maybe (NonEmpty.head fopAddresses') (\(ChangeAddress addr) → addressFromBech32 addr) fopChangeAddress takerFee' ← case valueToList takerFee of [(_, feeAmt)] → pure $ fromIntegral feeAmt _ → throwIO PodMultiFillNotAllSamePaymentToken txBody ← runSkeletonI ctx (NonEmpty.toList fopAddresses') changeAddr fopCollateral $ do - fillMultiplePartialOrders' porefs ordersWithTokenBuyAmount (Just (cfgRef, pocd)) takerFee + fillMultiplePartialOrders' porefs ordersWithTokenBuyAmount (Just refPocds) takerFee pure FillOrderTransactionDetails { fotdTransaction = unsignedTx txBody, @@ -475,8 +480,8 @@ handleFillOrders ctx@Ctx {..} fops@FillOrderParameters {..} = do fotdTakerOfferedPercentFeeAmount = takerFee' } where - computePercentTakerFees ∷ Foldable t ⇒ t (PartialOrderInfo, Natural) → GYRational → GYValue - computePercentTakerFees ordersWithTokenBuyAmount takerFeeRatio = + computePercentTakerFees ∷ Foldable t ⇒ POCVersion → t (PartialOrderInfo, Natural) → GYRational → GYValue + computePercentTakerFees overallPocVersion ordersWithTokenBuyAmount takerFeeRatio = let takerACWithAmt = foldl' ( \accTakerACWithAmt (poi@PartialOrderInfo {..}, amtToFill) → @@ -486,5 +491,5 @@ handleFillOrders ctx@Ctx {..} fops@FillOrderParameters {..} = do mempty ordersWithTokenBuyAmount takerFee = - Map.foldlWithKey' (\acc ac amt → acc <> valueSingleton ac (ceiling $ toRational amt * rationalToGHC takerFeeRatio)) mempty takerACWithAmt + Map.foldlWithKey' (\acc ac amt → acc <> valueSingleton ac (roundFunctionForPOCVersion overallPocVersion $ toRational amt * rationalToGHC takerFeeRatio)) mempty takerACWithAmt in takerFee