From c7c80ab93f26b976ca6fcac6c39dba7448aef18f Mon Sep 17 00:00:00 2001
From: t4ccer <t4ccer@gmail.com>
Date: Fri, 29 Jul 2022 04:09:35 -0600
Subject: [PATCH 1/2] Fix deps to be used by Kwarxs

---
 flake.lock                              | 54 +++++++++++++------------
 flake.nix                               | 14 +++----
 src/Plutus/Model/Fork/Cardano/Common.hs |  4 +-
 3 files changed, 37 insertions(+), 35 deletions(-)

diff --git a/flake.lock b/flake.lock
index 5fbb007..d1392ae 100644
--- a/flake.lock
+++ b/flake.lock
@@ -87,17 +87,17 @@
     "cardano-base": {
       "flake": false,
       "locked": {
-        "lastModified": 1652788515,
-        "narHash": "sha256-l0KgomRi6YhEoOlFnBYEXhnZO2+PW68rhfUrbMXjhCQ=",
+        "lastModified": 1654537609,
+        "narHash": "sha256-4b0keLjRaVSdEwfBXB1iT3QPlsutdxSltGfBufT4Clw=",
         "owner": "input-output-hk",
         "repo": "cardano-base",
-        "rev": "631cb6cf1fa01ab346233b610a38b3b4cba6e6ab",
+        "rev": "0f3a867493059e650cda69e20a5cbf1ace289a57",
         "type": "github"
       },
       "original": {
         "owner": "input-output-hk",
         "repo": "cardano-base",
-        "rev": "631cb6cf1fa01ab346233b610a38b3b4cba6e6ab",
+        "rev": "0f3a867493059e650cda69e20a5cbf1ace289a57",
         "type": "github"
       }
     },
@@ -121,34 +121,34 @@
     "cardano-ledger": {
       "flake": false,
       "locked": {
-        "lastModified": 1657934159,
-        "narHash": "sha256-Pfc4FPSWySZLd/mqK1Gtru4IKfI/0HEdX4nSW2iOP0U=",
+        "lastModified": 1657127204,
+        "narHash": "sha256-4wcSA61TwoDTvJ6rx7tjEAJjQLO/cs8WGTHcOghNdTc=",
         "owner": "input-output-hk",
         "repo": "cardano-ledger",
-        "rev": "389b266d6226dedf3d2aec7af640b3ca4984c5ea",
+        "rev": "3be8a19083fc13d9261b1640e27dd389b51bb08e",
         "type": "github"
       },
       "original": {
         "owner": "input-output-hk",
         "repo": "cardano-ledger",
-        "rev": "389b266d6226dedf3d2aec7af640b3ca4984c5ea",
+        "rev": "3be8a19083fc13d9261b1640e27dd389b51bb08e",
         "type": "github"
       }
     },
     "cardano-prelude": {
       "flake": false,
       "locked": {
-        "lastModified": 1657171052,
-        "narHash": "sha256-T5hW85PfnuR6066jIhH/2g5dzTmI0JXsXSKwez8fXnw=",
+        "lastModified": 1617089317,
+        "narHash": "sha256-kgX3DKyfjBb8/XcDEd+/adlETsFlp5sCSurHWgsFAQI=",
         "owner": "input-output-hk",
         "repo": "cardano-prelude",
-        "rev": "533aec85c1ca05c7d171da44b89341fb736ecfe5",
+        "rev": "bb4ed71ba8e587f672d06edf9d2e376f4b055555",
         "type": "github"
       },
       "original": {
         "owner": "input-output-hk",
         "repo": "cardano-prelude",
-        "rev": "533aec85c1ca05c7d171da44b89341fb736ecfe5",
+        "rev": "bb4ed71ba8e587f672d06edf9d2e376f4b055555",
         "type": "github"
       }
     },
@@ -275,16 +275,17 @@
         "stackage": "stackage"
       },
       "locked": {
-        "lastModified": 1657677865,
-        "narHash": "sha256-Q8aWijNz5I3sIrpT7IRZrlZLqBafn6qcSGvr0fOXIT0=",
+        "lastModified": 1653486569,
+        "narHash": "sha256-342b0LPX6kaBuEX8KZV40FwCCFre1lCtjdTQIDEt9kw=",
         "owner": "input-output-hk",
         "repo": "haskell.nix",
-        "rev": "1d8ca8b15d662d5137db52037342d10972cb3f36",
+        "rev": "220f8a9cd166e726aea62843bdafa7ecded3375c",
         "type": "github"
       },
       "original": {
         "owner": "input-output-hk",
         "repo": "haskell.nix",
+        "rev": "220f8a9cd166e726aea62843bdafa7ecded3375c",
         "type": "github"
       }
     },
@@ -298,17 +299,17 @@
         ]
       },
       "locked": {
-        "lastModified": 1655143375,
-        "narHash": "sha256-yU+HPLwGPf5IeLj9IBQ1zrPBTYEwvYbuMnADs4T8RLQ=",
+        "lastModified": 1658790167,
+        "narHash": "sha256-QRZCAz/k5hEvXiHc2aVDDc2jgPTeiRXUtARg0GA9rDU=",
         "owner": "mlabs-haskell",
         "repo": "haskell-nix-extra-hackage",
-        "rev": "03ee7afdc1ad982e059e3941db80f7a5b30a2757",
+        "rev": "ee50d7eb739819efdb27bda9f444e007c12e9833",
         "type": "github"
       },
       "original": {
         "owner": "mlabs-haskell",
-        "ref": "separate-hackages",
         "repo": "haskell-nix-extra-hackage",
+        "rev": "ee50d7eb739819efdb27bda9f444e007c12e9833",
         "type": "github"
       }
     },
@@ -356,16 +357,17 @@
         "nixpkgs": "nixpkgs_2"
       },
       "locked": {
-        "lastModified": 1653579289,
-        "narHash": "sha256-wveDdPsgB/3nAGAdFaxrcgLEpdi0aJ5kEVNtI+YqVfo=",
+        "lastModified": 1658222743,
+        "narHash": "sha256-yFH01psqx30y5Ws4dBElLkxYpIxxqZx4G+jCVhsXpnA=",
         "owner": "input-output-hk",
         "repo": "iohk-nix",
-        "rev": "edb2d2df2ebe42bbdf03a0711115cf6213c9d366",
+        "rev": "9a604d01bd4420ab7f396f14d1947fbe2ce7db8b",
         "type": "github"
       },
       "original": {
         "owner": "input-output-hk",
         "repo": "iohk-nix",
+        "rev": "9a604d01bd4420ab7f396f14d1947fbe2ce7db8b",
         "type": "github"
       }
     },
@@ -550,17 +552,17 @@
     "plutus": {
       "flake": false,
       "locked": {
-        "lastModified": 1657812223,
-        "narHash": "sha256-coD/Kpl7tutwXb6ukQCH5XojBjquYkW7ob0BWZtdpok=",
+        "lastModified": 1656585904,
+        "narHash": "sha256-ATwDR5LX2RN9YfoPhTxV7REvFoJnM4x/CN9XZVZlalg=",
         "owner": "input-output-hk",
         "repo": "plutus",
-        "rev": "8ab4c3355c5fdf67dcf6acc1f5a14668d5e6f0a9",
+        "rev": "69ab98c384703172f898eb5bcad1078ded521426",
         "type": "github"
       },
       "original": {
         "owner": "input-output-hk",
         "repo": "plutus",
-        "rev": "8ab4c3355c5fdf67dcf6acc1f5a14668d5e6f0a9",
+        "rev": "69ab98c384703172f898eb5bcad1078ded521426",
         "type": "github"
       }
     },
diff --git a/flake.nix b/flake.nix
index 39ea0ee..b2c27be 100644
--- a/flake.nix
+++ b/flake.nix
@@ -2,20 +2,20 @@
   description = "plutus-simple-model";
 
   inputs = {
-    haskell-nix.url = "github:input-output-hk/haskell.nix";
+    haskell-nix.url = "github:input-output-hk/haskell.nix/220f8a9cd166e726aea62843bdafa7ecded3375c"; # TODO
     nixpkgs.follows = "haskell-nix/nixpkgs-unstable";
-    iohk-nix.url = "github:input-output-hk/iohk-nix";
-    haskell-nix-extra-hackage.url = "github:mlabs-haskell/haskell-nix-extra-hackage/separate-hackages";
+    iohk-nix.url = "github:input-output-hk/iohk-nix/9a604d01bd4420ab7f396f14d1947fbe2ce7db8b";
+    haskell-nix-extra-hackage.url = "github:mlabs-haskell/haskell-nix-extra-hackage/ee50d7eb739819efdb27bda9f444e007c12e9833";
     haskell-nix-extra-hackage.inputs.haskell-nix.follows = "haskell-nix";
     haskell-nix-extra-hackage.inputs.nixpkgs.follows = "nixpkgs";
 
-    cardano-base.url = "github:input-output-hk/cardano-base/631cb6cf1fa01ab346233b610a38b3b4cba6e6ab";
+    cardano-base.url = "github:input-output-hk/cardano-base/0f3a867493059e650cda69e20a5cbf1ace289a57";
     cardano-base.flake = false;
     cardano-crypto.url = "github:input-output-hk/cardano-crypto/f73079303f663e028288f9f4a9e08bcca39a923e";
     cardano-crypto.flake = false;
-    cardano-ledger.url = "github:input-output-hk/cardano-ledger/389b266d6226dedf3d2aec7af640b3ca4984c5ea";
+    cardano-ledger.url = "github:input-output-hk/cardano-ledger/3be8a19083fc13d9261b1640e27dd389b51bb08e";
     cardano-ledger.flake = false;
-    cardano-prelude.url = "github:input-output-hk/cardano-prelude/533aec85c1ca05c7d171da44b89341fb736ecfe5";
+    cardano-prelude.url = "github:input-output-hk/cardano-prelude/bb4ed71ba8e587f672d06edf9d2e376f4b055555";
     cardano-prelude.flake = false;
     flat.url = "github:Quid2/flat/ee59880f47ab835dbd73bea0847dab7869fc20d8";
     flat.flake = false;
@@ -23,7 +23,7 @@
     goblins.flake = false;
     weigh.url = "github:fpco/weigh/bfcf4415144d7d2817dfcb91b6f9a6dfd7236de7";
     weigh.flake = false;
-    plutus.url = "github:input-output-hk/plutus/8ab4c3355c5fdf67dcf6acc1f5a14668d5e6f0a9";
+    plutus.url = "github:input-output-hk/plutus/69ab98c384703172f898eb5bcad1078ded521426";
     plutus.flake = false;
     Win32-network.url = "github:input-output-hk/Win32-network/3825d3abf75f83f406c1f7161883c438dac7277d";
     Win32-network.flake = false;
diff --git a/src/Plutus/Model/Fork/Cardano/Common.hs b/src/Plutus/Model/Fork/Cardano/Common.hs
index 7a9d1ba..64daaca 100644
--- a/src/Plutus/Model/Fork/Cardano/Common.hs
+++ b/src/Plutus/Model/Fork/Cardano/Common.hs
@@ -64,7 +64,7 @@ import Cardano.Ledger.Shelley.API.Types qualified as Shelley (Hash)
 import Cardano.Ledger.TxIn qualified as C
 import Cardano.Ledger.ShelleyMA.Timelocks qualified as C
 import Cardano.Ledger.Keys qualified as C
-import Cardano.Ledger.Keys.WitVKey
+import Cardano.Ledger.Shelley.API.Types (WitVKey, Delegation (Delegation))
 import Cardano.Ledger.Shelley.UTxO qualified as C
 import qualified Cardano.Crypto.Hash.Class as Crypto
 import Cardano.Ledger.Mary.Value qualified as C
@@ -167,7 +167,7 @@ toDCert :: Network -> C.Coin -> C.Coin -> P.DCert -> Either ToCardanoError (C.DC
 toDCert network poolDeposit minPoolCost = \case
   P.DCertDelegRegKey (P.StakingHash stakingCredential) -> C.DCertDeleg . C.RegKey <$> toCredential stakingCredential
   P.DCertDelegDeRegKey (P.StakingHash stakingCredential) -> C.DCertDeleg . C.DeRegKey <$> toCredential stakingCredential
-  P.DCertDelegDelegate (P.StakingHash stakingCredential) pubKeyHash -> C.DCertDeleg . C.Delegate <$> (C.Delegation <$> toCredential stakingCredential <*> toPubKeyHash pubKeyHash)
+  P.DCertDelegDelegate (P.StakingHash stakingCredential) pubKeyHash -> C.DCertDeleg . C.Delegate <$> (Delegation <$> toCredential stakingCredential <*> toPubKeyHash pubKeyHash)
   P.DCertPoolRegister poolKeyHash poolVfr -> C.DCertPool . C.RegPool <$> toPoolParams poolKeyHash poolVfr
   P.DCertPoolRetire pkh n -> C.DCertPool . (\key -> C.RetirePool key (C.EpochNo (fromIntegral n)) ) <$> toPubKeyHash pkh
   P.DCertGenesis -> Left "DCertGenesis is not supported"

From 1463321e0ebc394293673164c966687675c08af5 Mon Sep 17 00:00:00 2001
From: t4ccer <t4ccer@gmail.com>
Date: Fri, 29 Jul 2022 04:31:36 -0600
Subject: [PATCH 2/2] Expose every module

---
 plutus-simple-model.cabal | 1 -
 1 file changed, 1 deletion(-)

diff --git a/plutus-simple-model.cabal b/plutus-simple-model.cabal
index 4cb5e2e..8da7e34 100644
--- a/plutus-simple-model.cabal
+++ b/plutus-simple-model.cabal
@@ -133,7 +133,6 @@ library
     Plutus.Model.Validator.V1.Plutus
     Plutus.Model.Validator.V2
     Plutus.Model.Validator.V2.Plutus
-  other-modules:
     Plutus.Model.Fork.Cardano.Alonzo
     Plutus.Model.Fork.Cardano.Babbage
     Plutus.Model.Fork.Cardano.Class