Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(slot-reservations): Support reserving slots #907

Merged
merged 8 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions codex/contracts/market.nim
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,21 @@
trace "Proof cannot be marked as missing", msg = e.msg
return false

method reserveSlot*(
market: OnChainMarket,
requestId: RequestId,
slotIndex: UInt256) {.async.} =

convertEthersError:
discard await market.contract.reserveSlot(requestId, slotIndex).confirm(0)

method canReserveSlot*(
market: OnChainMarket,
requestId: RequestId,
slotIndex: UInt256): Future[bool] {.async.} =

await market.contract.canReserveSlot(requestId, slotIndex)

Check warning on line 264 in codex/contracts/market.nim

View check run for this annotation

Codecov / codecov/patch

codex/contracts/market.nim#L250-L264

Added lines #L250 - L264 were not covered by tests
method subscribeRequests*(market: OnChainMarket,
callback: OnRequest):
Future[MarketSubscription] {.async.} =
Expand Down
3 changes: 3 additions & 0 deletions codex/contracts/marketplace.nim
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@

proc submitProof*(marketplace: Marketplace, id: SlotId, proof: Groth16Proof): ?TransactionResponse {.contract.}
proc markProofAsMissing*(marketplace: Marketplace, id: SlotId, period: UInt256): ?TransactionResponse {.contract.}

proc reserveSlot*(marketplace: Marketplace, requestId: RequestId, slotIndex: UInt256): ?TransactionResponse {.contract.}
proc canReserveSlot*(marketplace: Marketplace, requestId: RequestId, slotIndex: UInt256): bool {.contract, view.}

Check warning on line 56 in codex/contracts/marketplace.nim

View check run for this annotation

Codecov / codecov/patch

codex/contracts/marketplace.nim#L54-L56

Added lines #L54 - L56 were not covered by tests
14 changes: 14 additions & 0 deletions codex/market.nim
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,20 @@
period: Period): Future[bool] {.base, async.} =
raiseAssert("not implemented")

method reserveSlot*(

Check warning on line 164 in codex/market.nim

View check run for this annotation

Codecov / codecov/patch

codex/market.nim#L164

Added line #L164 was not covered by tests
market: Market,
requestId: RequestId,
slotIndex: UInt256) {.base, async.} =

raiseAssert("not implemented")

method canReserveSlot*(
market: Market,
requestId: RequestId,
slotIndex: UInt256): Future[bool] {.base, async.} =

raiseAssert("not implemented")

Check warning on line 177 in codex/market.nim

View check run for this annotation

Codecov / codecov/patch

codex/market.nim#L166-L177

Added lines #L166 - L177 were not covered by tests
method subscribeFulfillment*(market: Market,
callback: OnFulfillment):
Future[Subscription] {.base, async.} =
Expand Down
2 changes: 1 addition & 1 deletion vendor/codex-contracts-eth