From 104bf5e0a71d4ab11f280168864f34264695b12b Mon Sep 17 00:00:00 2001 From: Eric <5089238+emizzle@users.noreply.github.com> Date: Wed, 18 Sep 2024 20:32:34 +1000 Subject: [PATCH] feat(slot-reservations): Support reserving slots Closes #898. Wire up reserveSlot and canReserveSlot contract calls, but don't call them --- codex/contracts/market.nim | 6 ++++++ codex/contracts/marketplace.nim | 3 +++ codex/market.nim | 6 ++++++ vendor/codex-contracts-eth | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/codex/contracts/market.nim b/codex/contracts/market.nim index 1595b449..e2065769 100644 --- a/codex/contracts/market.nim +++ b/codex/contracts/market.nim @@ -247,6 +247,12 @@ method canProofBeMarkedAsMissing*( trace "Proof cannot be marked as missing", msg = e.msg return false +method reserveSlot*(id: SlotId): Future[bool] {.async.} = + discard await market.contract.reserveSlot(id).confirm(0) + +method canReserveSlot*(id: SlotId): Future[bool] {.async.} = + discard await market.contract.canReserveSlot(id).confirm(0) + method subscribeRequests*(market: OnChainMarket, callback: OnRequest): Future[MarketSubscription] {.async.} = diff --git a/codex/contracts/marketplace.nim b/codex/contracts/marketplace.nim index f98b9a80..6596c993 100644 --- a/codex/contracts/marketplace.nim +++ b/codex/contracts/marketplace.nim @@ -51,3 +51,6 @@ proc getPointer*(marketplace: Marketplace, id: SlotId): uint8 {.contract, view.} proc submitProof*(marketplace: Marketplace, id: SlotId, proof: Groth16Proof): ?TransactionResponse {.contract.} proc markProofAsMissing*(marketplace: Marketplace, id: SlotId, period: UInt256): ?TransactionResponse {.contract.} + +proc reserveSlot*(marketplace: Marketplace, id: SlotId): bool {.contract.} +proc canReserveSlot*(marketplace: Marketplace, id: SlotId): bool {.contract, view.} diff --git a/codex/market.nim b/codex/market.nim index 245c28d5..1ebe237d 100644 --- a/codex/market.nim +++ b/codex/market.nim @@ -161,6 +161,12 @@ method canProofBeMarkedAsMissing*(market: Market, period: Period): Future[bool] {.base, async.} = raiseAssert("not implemented") +method reserveSlot*(id: SlotId): Future[bool] {.base, async.} = + raiseAssert("not implemented") + +method canReserveSlot*(id: SlotId): Future[bool] {.base, async.} = + raiseAssert("not implemented") + method subscribeFulfillment*(market: Market, callback: OnFulfillment): Future[Subscription] {.base, async.} = diff --git a/vendor/codex-contracts-eth b/vendor/codex-contracts-eth index 73a2ca0b..b62c72b5 160000 --- a/vendor/codex-contracts-eth +++ b/vendor/codex-contracts-eth @@ -1 +1 @@ -Subproject commit 73a2ca0bd3ba90715ea7e818bafbd82208034a58 +Subproject commit b62c72b5e1a348c2d47c9f3c31c1d712e37286b7