feat(slot-reservations): Support reserving slots

Closes #898.

Wire up reserveSlot and canReserveSlot contract calls, but don't call them
This commit is contained in:
Eric 2024-09-18 20:32:34 +10:00
parent e8e9820d5b
commit 104bf5e0a7
No known key found for this signature in database
4 changed files with 16 additions and 1 deletions

View File

@ -247,6 +247,12 @@ method canProofBeMarkedAsMissing*(
trace "Proof cannot be marked as missing", msg = e.msg trace "Proof cannot be marked as missing", msg = e.msg
return false 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, method subscribeRequests*(market: OnChainMarket,
callback: OnRequest): callback: OnRequest):
Future[MarketSubscription] {.async.} = Future[MarketSubscription] {.async.} =

View File

@ -51,3 +51,6 @@ proc getPointer*(marketplace: Marketplace, id: SlotId): uint8 {.contract, view.}
proc submitProof*(marketplace: Marketplace, id: SlotId, proof: Groth16Proof): ?TransactionResponse {.contract.} proc submitProof*(marketplace: Marketplace, id: SlotId, proof: Groth16Proof): ?TransactionResponse {.contract.}
proc markProofAsMissing*(marketplace: Marketplace, id: SlotId, period: UInt256): ?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.}

View File

@ -161,6 +161,12 @@ method canProofBeMarkedAsMissing*(market: Market,
period: Period): Future[bool] {.base, async.} = period: Period): Future[bool] {.base, async.} =
raiseAssert("not implemented") 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, method subscribeFulfillment*(market: Market,
callback: OnFulfillment): callback: OnFulfillment):
Future[Subscription] {.base, async.} = Future[Subscription] {.base, async.} =

@ -1 +1 @@
Subproject commit 73a2ca0bd3ba90715ea7e818bafbd82208034a58 Subproject commit b62c72b5e1a348c2d47c9f3c31c1d712e37286b7