Skip to content

Commit 3ec3448

Browse files
authored
Merge pull request #82 from geniusyield/81-conway
feat(#81): conway update
2 parents 1d7116e + 9800372 commit 3ec3448

File tree

10 files changed

+119
-104
lines changed

10 files changed

+119
-104
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ cabal.project.local~
2525
*.skey
2626
secrets/
2727
*.env
28+
.vscode

cabal.project

+47-43
Original file line numberDiff line numberDiff line change
@@ -10,74 +10,66 @@ repository cardano-haskell-packages
1010
d4a35cd3121aa00d18544bb0ac01c3e1691d618f462c46129271bccf39f7e8ee
1111

1212
-- repeating the index-state for hackage to work around hackage.nix parsing limitation
13-
index-state: 2024-06-15T17:35:54Z
13+
index-state: 2024-08-27T16:28:01Z
1414

1515
index-state:
16-
, hackage.haskell.org 2024-06-15T17:35:54Z
17-
, cardano-haskell-packages 2024-06-13T23:12:13Z
16+
, hackage.haskell.org 2024-08-27T16:28:01Z
17+
, cardano-haskell-packages 2024-07-24T14:16:32Z
1818

1919
packages:
2020
geniusyield-dex-api
2121
geniusyield-orderbot-lib
2222
geniusyield-server-lib
2323
geniusyield-onchain/geniusyield-common
2424

25-
-- TODO: Default value should be @direct@ in upcoming 3.10 version of cabal, omit this line then.
26-
test-show-details: direct
27-
2825
source-repository-package
2926
type: git
3027
location: https://github.com/geniusyield/ply
31-
tag: b13674633771f572a5eedfb47276c0ac3993ab85
32-
--sha256: sha256-a63OdFAbo0sWOXxceI2bW/ZMrS8wo1t7aPFrfXvVhvE=
28+
tag: 4a61941b3287782d2c11f9ab1cae0889d0a57385
29+
--sha256: sha256-24WKaBs6qiJzi++wTyqIh61Dc1QeCzeo0YqLE4wsEbg=
3330
subdir: ply-core
3431

3532
source-repository-package
3633
type: git
3734
location: https://github.com/geniusyield/atlas
38-
tag: 97f3ca97bda997533d17274689daa69c5fdcbcd6
39-
--sha256: sha256-NKUrxa3f6tlywWNWwdw5bWQ974ziOG9MXmY9GNZTdu8=
35+
tag: v0.6.0
36+
--sha256: sha256-v+tTCIz8uyaQfsMJRc5F36TNK9ZPfrBxwXLYaXqZrZA=
4037

4138
-------- Begin contents from @atlas@'s @cabal.project@ file. --------
4239

4340
package cardano-crypto-praos
4441
flags: -external-libsodium-vrf
4542

46-
-- TODO: This is fixed for in their later version, omit this when we update to it.
47-
package strict-containers
48-
ghc-options: -Wwarn=noncanonical-monad-instances
49-
5043
source-repository-package
5144
type: git
5245
location: https://github.com/maestro-org/haskell-sdk
5346
tag: v1.7.2
5447
--sha256: sha256-nXnelHH4a+V0nguP8oUDlyEz/fLQ/i1fs/flyZTmvAc=
5548

49+
-- TODO: Temporary, until proposed changes are in upstream (track https://github.com/mlabs-haskell/clb/pull/44)
5650
source-repository-package
5751
type: git
58-
location: https://github.com/mlabs-haskell/clb
59-
tag: 18e781b5b53adc1aa1d8c057c1b606b536a80350
60-
--sha256: sha256-PDmrXYTBHPcY0x+JnF21uupLMBwURLSiNMqNmwwapkc=
52+
location: https://github.com/sourabhxyz/clb
53+
tag: 09414a93047b4c7f6e03e20d1730c9c0f88e1d46
54+
--sha256: sha256-y5fF8IDywt/pQ3HsRE6CpAlqK4uiU/SRuDIqSHxBED0=
6155

62-
-- Obtaining cardano-node stuff for 8.9.*. These aren't published on CHaP yet.
56+
-- Obtaining cardano-node stuff for 9.1.0. These aren't published on CHaP yet.
6357
source-repository-package
6458
type: git
6559
location: https://github.com/IntersectMBO/cardano-node
66-
tag: 8.9.2
67-
--sha256: sha256-PxMlVzTLMuVeu04QcGOxjaSMnpWJG78J0Rul3423too=
60+
tag: 9.1.0
61+
--sha256: sha256-F5wgRA820x16f+8c/LlEEBG0rMJIA1XWw6X0ZwX5UWs=
6862
subdir:
6963
cardano-node
7064
cardano-testnet
71-
cardano-git-rev
7265
trace-dispatcher
7366

74-
-- Everything below is essentially copied from cardano-wallet's cabal.project.
75-
67+
-- TODO: Make changes upstream
7668
source-repository-package
7769
type: git
78-
location: https://github.com/input-output-hk/cardano-wallet
79-
tag: v2024-03-27
80-
--sha256: sha256-rxMPopa3nxQaM0yOxUCq5oj3+XSL68jkuuFVhj/SY+w=
70+
location: https://github.com/geniusyield/cardano-wallet
71+
tag: 3413fdf74fd25b100662abf2a49c1afc892f1b79
72+
--sha256: sha256-V5DNUzraaDJo6cXc1eeVVIJNWqC8JayQrJeNNLg/Els=
8173
subdir:
8274
lib/address-derivation-discovery
8375
lib/balance-tx/
@@ -100,15 +92,15 @@ source-repository-package
10092
lib/wallet-benchmarks/
10193
lib/wallet/
10294

103-
------ Begin contents from @cardano-wallet@'s @cabal.project@ file. --------
95+
------ Following is mostly from @cardano-wallet@'s @cabal.project@ file. -------
10496

10597
--------------------------------------------------------------------------------
10698

10799
source-repository-package
108100
type: git
109101
location: https://github.com/IntersectMBO/cardano-addresses
110-
tag: 126964483d188c2362393d2a6eea8c65dfc43097
111-
--sha256: 1w152imj28ap5dfdc8x9ly0cy7dn500v7k63vw11f70gvgg6x7my
102+
tag: 2bca06deaa60e54a5322ac757387d744bf043367
103+
--sha256: 1y1mzfly7jac40b9g4xc078rcm5zqhc3xxv77kwxi10yph1jwq7z
112104
subdir: command-line
113105
core
114106

@@ -149,21 +141,31 @@ source-repository-package
149141
--------------------------------------------------------------------------------
150142
-- BEGIN Constraints tweaking section
151143

152-
-- cardano-addresses unit tests bring in some version constraint conflicts.
153-
--
154-
-- 1. hjsonschema and hjsonpointer deps have overly strict bounds.
155-
-- 2. it has strict aeson < 1.5 dep - this will be fixed in the next release.
156144
allow-newer:
157-
hjsonschema:*
158-
, hjsonpointer:*
159-
, *:aeson
160-
, *:hashable
161-
, async-timer:unliftio-core
162-
, ekg:*
163-
, ntp-client:*
164-
, libsystemd-journal:base
165-
, cardano-addresses-cli:mtl
145+
async-timer:unliftio-core
166146
, servant-openapi3:*
147+
, katip:Win32
148+
, raven-haskell:aeson
149+
150+
constraints:
151+
base >= 4.18.2.0 && < 5
152+
, openapi3 >= 3.2.0
153+
, persistent ^>= 2.14.6.0
154+
, cardano-node ^>= 9.1.0
155+
, bech32 >= 1.1.7
156+
, postgresql-libpq ^>= 0.10
157+
158+
-- lower versions of katip won't build with the Win32-2.12.0.1
159+
-- which is shipped with the ghc-9.2.8
160+
, katip >= 0.8.7.4
161+
162+
163+
-- Cardano Node dependencies:
164+
, io-classes >= 1.4
165+
, io-classes -asserts
166+
, ouroboros-consensus-cardano ^>= 0.18
167+
, ouroboros-network ^>= 0.16.1
168+
, ouroboros-network-protocols ^>= 0.9
167169

168170
-- END Constraints tweaking section
169171
--------------------------------------------------------------------------------
@@ -185,8 +187,10 @@ package cardano-config
185187
package cardano-node
186188
flags: -systemd
187189

190+
package bitvec
191+
flags: -simd
192+
188193
-- -------------------------------------------------------------------------
189194

190195
-------- End contents from @cardano-wallet@'s @cabal.project@ file. --------
191-
192196
-------- End contents from @atlas@'s @cabal.project@ file. --------

geniusyield-dex-api/CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Revision history for geniusyield-dex-api
22

3-
## 0.4.0.0 -- 2024-27-06
3+
## 0.5.0.0 -- 2024-08-30
4+
5+
* Update to Atlas v0.6.0.
6+
7+
## 0.4.0.0 -- 2024-06-27
48

59
* Updates definition of `fillMultiplePartialOrders'` to call `buildWithFeeOutput` even in case more than one order is being filled.
610

geniusyield-dex-api/geniusyield-dex-api.cabal

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: geniusyield-dex-api
44
-- PVP summary: +-+------- breaking API changes
55
-- | | +----- non-breaking API additions
66
-- | | | +--- code changes with no API change
7-
version: 0.4.0.0
7+
version: 0.5.0.0
88
synopsis: API code to interact with GeniusYield DEX.
99
description:
1010
API code to interact with GeniusYield DEX. Learn more about GeniusYield by visiting https://www.geniusyield.co/.

geniusyield-dex-api/src/GeniusYield/Api/Dex/PartialOrder.hs

+15-14
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ module GeniusYield.Api.Dex.PartialOrder (
6565
preferentiallySelectLatestPocd,
6666
) where
6767

68-
import Control.Monad.Except (ExceptT (..), liftEither, runExceptT)
6968
import Control.Monad.Reader (ask)
7069
import Data.Bifunctor (Bifunctor)
7170
import Data.Foldable (foldlM)
@@ -410,17 +409,11 @@ partialOrdersHavingAsset pors hasAsset = do
410409
datumsV1_1 = utxosDatumsPureWithOriginalDatum utxosWithDatumsV1_1
411410
m1
412411
iwither
413-
( \oref vod
414-
either (const Nothing) Just
415-
<$> runExceptT (makePartialOrderInfo policyIdV1 oref vod POCVersion1)
416-
)
412+
(\oref vod makePartialOrderInfo' policyIdV1 oref vod POCVersion1)
417413
datumsV1
418414
m1_1
419415
iwither
420-
( \oref vod
421-
either (const Nothing) Just
422-
<$> runExceptT (makePartialOrderInfo policyIdV1_1 oref vod POCVersion1_1)
423-
)
416+
(\oref vod makePartialOrderInfo' policyIdV1_1 oref vod POCVersion1_1)
424417
datumsV1_1
425418
pure $! m1 <> m1_1
426419

@@ -468,8 +461,7 @@ getPartialOrderInfo pors orderRef = do
468461
pocVersion getPartialOrderVersion pors (utxoAddress utxo :!: utxoRef utxo)
469462
vod utxoDatumPureWithOriginalDatum' utxoWithDatum
470463
policyId withSomePORef (selectPor pors pocVersion) partialOrderNftPolicyId
471-
472-
runExceptT (makePartialOrderInfo policyId orderRef vod pocVersion) >>= liftEither
464+
makePartialOrderInfo policyId orderRef vod pocVersion
473465

474466
getPartialOrdersInfos
475467
GYDexApiQueryMonad m a
@@ -481,11 +473,11 @@ getPartialOrdersInfos pors orderRefs = do
481473
ps applyToBoth addressToPaymentCredential <$> partialOrderAddrTuple pors
482474
let vod = utxosDatumsPureWithOriginalDatum utxosWithDatums
483475
when (Map.size vod /= length orderRefs) $ throwAppError $ PodNotAllOrderRefsPresent $ Set.fromList orderRefs `Set.difference` Map.keysSet vod
484-
let makePartialOrderInfo' oref v@(addr, _, _, _) = do
476+
let makePartialOrderInfo'' oref v@(addr, _, _, _) = do
485477
pocVersion getPartialOrderVersion' ps (addr :!: oref)
486478
policyId withSomePORef (selectPor pors pocVersion) partialOrderNftPolicyId
487479
makePartialOrderInfo policyId oref v pocVersion
488-
runExceptT (Map.traverseWithKey makePartialOrderInfo' vod) >>= liftEither
480+
Map.traverseWithKey makePartialOrderInfo'' vod
489481

490482
getPartialOrdersInfos' GYDexApiQueryMonad m a PORefs [(GYTxOutRef, Natural)] m [(PartialOrderInfo, Natural)]
491483
getPartialOrdersInfos' por ordersWithTokenBuyAmount = do
@@ -494,13 +486,22 @@ getPartialOrdersInfos' por ordersWithTokenBuyAmount = do
494486
-- Even though we use `dropMissing`, `getPartialOrdersInfos` verify that all entries are present.
495487
pure $ Map.elems $ Map.merge Map.dropMissing Map.dropMissing (Map.zipWithMatched (\_ poi amt (poi, amt))) orders ordersWithTokenBuyAmount'
496488

489+
makePartialOrderInfo'
490+
GYDexApiQueryMonad m a
491+
GYMintingPolicyId
492+
GYTxOutRef
493+
(GYAddress, GYValue, PartialOrderDatum, GYDatum)
494+
POCVersion
495+
m (Maybe PartialOrderInfo)
496+
makePartialOrderInfo' policyId orderRef tuple pocVersion = catchError (Just <$> makePartialOrderInfo policyId orderRef tuple pocVersion) $ \(_ GYTxMonadException) pure Nothing
497+
497498
makePartialOrderInfo
498499
GYDexApiQueryMonad m a
499500
GYMintingPolicyId
500501
GYTxOutRef
501502
(GYAddress, GYValue, PartialOrderDatum, GYDatum)
502503
POCVersion
503-
ExceptT GYTxMonadException m PartialOrderInfo
504+
m PartialOrderInfo
504505
makePartialOrderInfo policyId orderRef (utxoAddr, v, PartialOrderDatum {..}, origDatum) pocVersion = do
505506
addr addressFromPlutus' podOwnerAddr
506507

geniusyield-dex-api/src/GeniusYield/Api/Dex/Types.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ module GeniusYield.Api.Dex.Types (
1313

1414
import Control.Monad.Reader (MonadReader)
1515
import GeniusYield.Scripts.Dex (HasPartialOrderConfigAddr, HasPartialOrderNftScript, HasPartialOrderScript)
16-
import GeniusYield.TxBuilder.Class (GYTxMonad, GYTxQueryMonad)
16+
import GeniusYield.TxBuilder.Class (GYTxQueryMonad, GYTxUserQueryMonad)
1717

1818
type HasDexScripts a = (HasPartialOrderConfigAddr a, HasPartialOrderScript a, HasPartialOrderNftScript a)
1919

2020
type GYDexApiQueryMonad m a = (HasDexScripts a, MonadReader a m, GYTxQueryMonad m)
2121

22-
type GYDexApiMonad m a = (GYDexApiQueryMonad m a, GYTxMonad m)
22+
type GYDexApiMonad m a = (GYDexApiQueryMonad m a, GYTxUserQueryMonad m)

geniusyield-server-lib/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Revision history for geniusyield-server-lib
22

3+
## 0.11.0 -- 2024-08-30
4+
5+
* Update to Atlas v0.6.0.
6+
37
## 0.10.1 -- 2024-08-29
48

59
* Updated Atlas & Maestro SDK version to not make use Maestro's recently deprecated protocol parameters & era summaries endpoint.

geniusyield-server-lib/geniusyield-server-lib.cabal

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 3.6
22
name: geniusyield-server-lib
3-
version: 0.10.1
3+
version: 0.11.0
44
synopsis: GeniusYield server library
55
description: Library for GeniusYield server.
66
license: Apache-2.0

geniusyield-server-lib/src/GeniusYield/Server/Ctx.hs

+10-7
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ runSkeletonI
5151
-- ^ User's change address.
5252
Maybe GYTxOutRef
5353
-- ^ User's collateral.
54-
ReaderT DEXInfo GYTxMonadNode (GYTxSkeleton v)
54+
ReaderT DEXInfo GYTxBuilderMonadIO (GYTxSkeleton v)
5555
IO GYTxBody
5656
runSkeletonI = coerce (runSkeletonF @Identity)
5757

@@ -65,7 +65,7 @@ runSkeletonWithStrategyI
6565
-- ^ User's change address.
6666
Maybe GYTxOutRef
6767
-- ^ User's collateral.
68-
ReaderT DEXInfo GYTxMonadNode (GYTxSkeleton v)
68+
ReaderT DEXInfo GYTxBuilderMonadIO (GYTxSkeleton v)
6969
IO GYTxBody
7070
runSkeletonWithStrategyI cstrat = coerce (runSkeletonWithStrategyF @Identity cstrat)
7171

@@ -78,7 +78,7 @@ runSkeletonF
7878
-- ^ User's change address.
7979
Maybe GYTxOutRef
8080
-- ^ User's collateral.
81-
ReaderT DEXInfo GYTxMonadNode (t (GYTxSkeleton v))
81+
ReaderT DEXInfo GYTxBuilderMonadIO (t (GYTxSkeleton v))
8282
IO (t GYTxBody)
8383
runSkeletonF = runSkeletonWithStrategyF GYRandomImproveMultiAsset
8484

@@ -92,7 +92,7 @@ runSkeletonWithStrategyF
9292
-- ^ User's change address.
9393
Maybe GYTxOutRef
9494
-- ^ User's collateral.
95-
ReaderT DEXInfo GYTxMonadNode (t (GYTxSkeleton v))
95+
ReaderT DEXInfo GYTxBuilderMonadIO (t (GYTxSkeleton v))
9696
IO (t GYTxBody)
9797
runSkeletonWithStrategyF cstrat ctx addrs addr mcollateral skeleton = do
9898
let nid = ctxNetworkId ctx
@@ -104,11 +104,14 @@ runSkeletonWithStrategyF cstrat ctx addrs addr mcollateral skeleton = do
104104

105105
runGYTxMonadNodeF cstrat nid providers (addr : addrs) addr mcollateral' $ runReaderT skeleton di
106106

107-
runQuery Ctx ReaderT DEXInfo GYTxQueryMonadNode a IO a
107+
runQuery Ctx ReaderT DEXInfo GYTxQueryMonadIO a IO a
108108
runQuery ctx = runQueryWithReader ctx (ctxDexInfo ctx)
109109

110-
runQueryWithReader Ctx a ReaderT a GYTxQueryMonadNode b IO b
110+
runQueryWithReader Ctx a ReaderT a GYTxQueryMonadIO b IO b
111111
runQueryWithReader ctx a q = do
112112
let nid = ctxNetworkId ctx
113113
providers = ctxProviders ctx
114-
runGYTxQueryMonadNode nid providers $ runReaderT q a
114+
runGYTxQueryMonadIO nid providers $ runReaderT q a
115+
116+
runGYTxMonadNodeF t v. Traversable t GYCoinSelectionStrategy GYNetworkId GYProviders [GYAddress] GYAddress Maybe (GYTxOutRef, Bool) GYTxBuilderMonadIO (t (GYTxSkeleton v)) IO (t GYTxBody)
117+
runGYTxMonadNodeF strat nid providers addrs change collateral act = runGYTxBuilderMonadIO nid providers addrs change collateral $ act >>= traverse (buildTxBodyWithStrategy strat)

0 commit comments

Comments
 (0)