mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-01-06 15:33:06 +00:00
When a request for storage times out (not enough slots filled), the client will initiate a withdraw request to retrieve its funds out of the contract, setting the state of the request to RequestState.Cancelled. The client will also emit a RequestCancelled event for others to listen to (ie hosts will need to listen for this event to withdraw its collateral). Add unit test that checks for emission of RequestCancelled after request is purchased request expires. Update dagger-contracts dependency to commit that holds the changes supporting withdrawing of funds.
72 lines
2.6 KiB
Nim
72 lines
2.6 KiB
Nim
import pkg/chronos
|
|
import pkg/upraises
|
|
import pkg/questionable
|
|
import ./contracts/requests
|
|
|
|
export chronos
|
|
export questionable
|
|
export requests
|
|
|
|
type
|
|
Market* = ref object of RootObj
|
|
Subscription* = ref object of RootObj
|
|
OnRequest* = proc(id: array[32, byte], ask: StorageAsk) {.gcsafe, upraises:[].}
|
|
OnFulfillment* = proc(requestId: array[32, byte]) {.gcsafe, upraises: [].}
|
|
OnSlotFilled* = proc(requestId: array[32, byte], slotIndex: UInt256) {.gcsafe, upraises:[].}
|
|
OnRequestCancelled* = proc(requestId: array[32, byte]) {.gcsafe, upraises:[].}
|
|
|
|
method getSigner*(market: Market): Future[Address] {.base, async.} =
|
|
raiseAssert("not implemented")
|
|
|
|
method requestStorage*(market: Market,
|
|
request: StorageRequest):
|
|
Future[StorageRequest] {.base, async.} =
|
|
raiseAssert("not implemented")
|
|
|
|
method getRequest*(market: Market,
|
|
id: RequestId):
|
|
Future[?StorageRequest] {.base, async.} =
|
|
raiseAssert("not implemented")
|
|
|
|
method getHost*(market: Market,
|
|
requestId: RequestId,
|
|
slotIndex: UInt256): Future[?Address] {.base, async.} =
|
|
raiseAssert("not implemented")
|
|
|
|
method fillSlot*(market: Market,
|
|
requestId: RequestId,
|
|
slotIndex: UInt256,
|
|
proof: seq[byte]) {.base, async.} =
|
|
raiseAssert("not implemented")
|
|
|
|
method withdrawFunds*(market: Market,
|
|
requestId: array[32, byte]) {.base, async.} =
|
|
raiseAssert("not implemented")
|
|
|
|
method subscribeRequests*(market: Market,
|
|
callback: OnRequest):
|
|
Future[Subscription] {.base, async.} =
|
|
raiseAssert("not implemented")
|
|
|
|
method subscribeFulfillment*(market: Market,
|
|
requestId: RequestId,
|
|
callback: OnFulfillment):
|
|
Future[Subscription] {.base, async.} =
|
|
raiseAssert("not implemented")
|
|
|
|
method subscribeSlotFilled*(market: Market,
|
|
requestId: RequestId,
|
|
slotIndex: UInt256,
|
|
callback: OnSlotFilled):
|
|
Future[Subscription] {.base, async.} =
|
|
raiseAssert("not implemented")
|
|
|
|
method subscribeRequestCancelled*(market: Market,
|
|
requestId: array[32, byte],
|
|
callback: OnRequestCancelled):
|
|
Future[Subscription] {.base, async.} =
|
|
raiseAssert("not implemented")
|
|
|
|
method unsubscribe*(subscription: Subscription) {.base, async, upraises:[].} =
|
|
raiseAssert("not implemented")
|