Skip to content

Commit

Permalink
feat: brings update to geniusyield-dex-api to consider original dat…
Browse files Browse the repository at this point in the history
…um bytes when providing for witness
  • Loading branch information
sourabhxyz committed Jun 5, 2024
1 parent f1c9905 commit 0466e16
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 15 deletions.
4 changes: 2 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ package strict-containers
source-repository-package
type: git
location: https://github.com/geniusyield/atlas
tag: 105ff78b32935ae5c18c53ccf4fb8462b8c1ca03
--sha256: sha256-Ee/UIoJ8OYBxgdnSv61hN8DH7CrIOPn4DjqOBxFL3Js=
tag: 1c20f2a65de8e087b495d1f3ad524d6e659167ad
--sha256: sha256-mvzqgLwKHhIJdeHfUoIdapN0t2K85DoehgSkfm/ddIw=

source-repository-package
type: git
Expand Down
5 changes: 5 additions & 0 deletions geniusyield-dex-api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Revision history for geniusyield-dex-api

## 0.3.0.0 -- 2024-06-05

* Updates to make use of latest Atlas commit, `1c20f2a65de8e087b495d1f3ad524d6e659167ad`.
* Uses original UTxO's datum to provide for witness to prevent for round-trip issues.

## 0.2.1.0 -- 2024-05-07

* Adds `placePartialOrder''`, `placePartialOrderWithVersion''` to also return for order's NFT token.
Expand Down
2 changes: 1 addition & 1 deletion geniusyield-dex-api/geniusyield-dex-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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.2.1.0
version: 0.3.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/.
Expand Down
22 changes: 12 additions & 10 deletions geniusyield-dex-api/src/GeniusYield/Api/Dex/PartialOrder.hs
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,11 @@ data PartialOrderInfo = PartialOrderInfo
-- | Caching the CS to avoid recalculating for it.
poiNFTCS !GYMintingPolicyId,
-- | Version of the partial order.
poiVersion !POCVersion
poiVersion !POCVersion,
-- | Raw datum.
poiRawDatum !GYDatum
}
deriving stock (Show, Eq, Generic)
deriving anyclass (Swagger.ToSchema)

poiContainedFeeToPlutus POIContainedFee PartialOrderContainedFee
poiContainedFeeToPlutus POIContainedFee {..} =
Expand Down Expand Up @@ -405,8 +406,8 @@ partialOrdersHavingAsset pors hasAsset = do
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
let datumsV1 = utxosDatumsPureWithOriginalDatum utxosWithDatumsV1
datumsV1_1 = utxosDatumsPureWithOriginalDatum utxosWithDatumsV1_1
m1
iwither
( \oref vod
Expand Down Expand Up @@ -465,7 +466,7 @@ getPartialOrderInfo pors orderRef = do
utxoWithDatum utxoAtTxOutRefWithDatum' orderRef
let utxo = fst utxoWithDatum
pocVersion getPartialOrderVersion pors (utxoAddress utxo :!: utxoRef utxo)
vod utxoDatumPure' utxoWithDatum
vod utxoDatumPureWithOriginalDatum' utxoWithDatum
policyId withSomePORef (selectPor pors pocVersion) partialOrderNftPolicyId

runExceptT (makePartialOrderInfo policyId orderRef vod pocVersion) >>= liftEither
Expand All @@ -478,9 +479,9 @@ getPartialOrdersInfos
getPartialOrdersInfos pors orderRefs = do
utxosWithDatums utxosAtTxOutRefsWithDatums orderRefs
ps applyToBoth addressToPaymentCredential <$> partialOrderAddrTuple pors
let vod = utxosDatumsPure utxosWithDatums
let vod = utxosDatumsPureWithOriginalDatum utxosWithDatums
when (Map.size vod /= length orderRefs) $ throwAppError $ PodNotAllOrderRefsPresent $ Set.fromList orderRefs `Set.difference` Map.keysSet vod
let makePartialOrderInfo' oref v@(addr, _, _) = do
let makePartialOrderInfo' oref v@(addr, _, _, _) = do
pocVersion getPartialOrderVersion' ps (addr :!: oref)
policyId withSomePORef (selectPor pors pocVersion) partialOrderNftPolicyId
makePartialOrderInfo policyId oref v pocVersion
Expand All @@ -497,10 +498,10 @@ makePartialOrderInfo
GYDexApiQueryMonad m a
GYMintingPolicyId
GYTxOutRef
(GYAddress, GYValue, PartialOrderDatum)
(GYAddress, GYValue, PartialOrderDatum, GYDatum)
POCVersion
ExceptT GYTxMonadException m PartialOrderInfo
makePartialOrderInfo policyId orderRef (utxoAddr, v, PartialOrderDatum {..}) pocVersion = do
makePartialOrderInfo policyId orderRef (utxoAddr, v, PartialOrderDatum {..}, origDatum) pocVersion = do
addr addressFromPlutus' podOwnerAddr

key pubKeyHashFromPlutus' podOwnerKey
Expand Down Expand Up @@ -533,7 +534,8 @@ makePartialOrderInfo policyId orderRef (utxoAddr, v, PartialOrderDatum {..}) poc
poiUTxOValue = v,
poiUTxOAddr = utxoAddr,
poiNFTCS = policyId,
poiVersion = pocVersion
poiVersion = pocVersion,
poiRawDatum = origDatum
}

-------------------------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions geniusyield-server-lib/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Revision history for geniusyield-server-lib

## 0.5.0 -- 2024-06-05

* Makes use of latest `geniusyield-dex-api` version, namely, v0.3.0.0. It includes a fix where original UTxO's datum bytes are used to provide for witness.

## 0.4.1 -- 2024-05-28

* Fix `/v0/orders/fill` endpoint to account for case when percent taker fees is zero.
Expand Down
2 changes: 1 addition & 1 deletion geniusyield-server-lib/geniusyield-server-lib.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.6
name: geniusyield-server-lib
version: 0.4.1
version: 0.5.0
synopsis: GeniusYield server library
description: Library for GeniusYield server.
license: Apache-2.0
Expand Down
3 changes: 2 additions & 1 deletion geniusyield-server-lib/src/GeniusYield/Server/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ coreConfigFromServerConfig ServerConfig {..} =
GYCoreConfig
{ cfgCoreProvider = scCoreProvider,
cfgNetworkId = scNetworkId,
cfgLogging = scLogging
cfgLogging = scLogging,
cfgLogTiming = Nothing
}

optionalSigningKeyFromServerConfig ServerConfig IO (Maybe (Pair GYSomePaymentSigningKey GYAddress))
Expand Down

0 comments on commit 0466e16

Please sign in to comment.