Skip to content

Commit

Permalink
change canReserveSlot and reserveSlot parameters
Browse files Browse the repository at this point in the history
Parameters for `canReserveSlot` and `reserveSlot` were changed from `SlotId` to `RequestId` and `UInt256 slotIndex`.
  • Loading branch information
emizzle committed Sep 26, 2024
1 parent c0016ea commit fb68bc5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
13 changes: 9 additions & 4 deletions codex/contracts/market.nim
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,20 @@ method canProofBeMarkedAsMissing*(
trace "Proof cannot be marked as missing", msg = e.msg
return false

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

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

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

await market.contract.canReserveSlot(id)
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):
Expand Down
4 changes: 2 additions & 2 deletions codex/contracts/marketplace.nim
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ 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): ?TransactionResponse {.contract.}
proc canReserveSlot*(marketplace: Marketplace, id: SlotId): bool {.contract, view.}
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
6 changes: 4 additions & 2 deletions codex/market.nim
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,15 @@ method canProofBeMarkedAsMissing*(market: Market,

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,
id: SlotId) {.base, async.} =
requestId: RequestId,
slotIndex: UInt256) {.base, async.} =

raiseAssert("not implemented")

method canReserveSlot*(
market: Market,
id: SlotId): Future[bool] {.base, async.} =
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
Expand Down
2 changes: 1 addition & 1 deletion vendor/codex-contracts-eth

0 comments on commit fb68bc5

Please sign in to comment.