mirror of
https://github.com/status-im/nim-codex.git
synced 2025-01-09 18:36:29 +00:00
2b5a40559e
* chore: bump dependencies, including nim-ethers with chronos v4 support Bumps the following dependencies: - nim-ethers to commit 507ac6a4cc71cec9be7693fa393db4a49b52baf9 which contains a pinned nim-eth version. This is to be replaced by a versioned library, so it will be pinned to a particular version. There is a crucial fix in this version of ethers that fixes nonce management which is causing issues in the Codex testnet. - nim-json-rpc to v0.4.4 - nim-json-serialization to v0.2.8 - nim-serde to v1.2.2 - nim-serialization to v0.2.4 Currently, one of the integration tests is failing. * fix integration test - When a state's run was cancelled, it was being caught as an error due to catching all CatchableErrors. This caused a state transition to SaleErrored, however cancellation of run was not actually an error. Handling this correctly fixed the issue. - Stopping of the clock was moved to after `HostInteractions` (sales) which avoided an assertion around getting time when the clock was not started. * bump ethers to include nonce fix and filter not found fix * bump ethers: fixes missing symbol not exported in ethers * Fix cirdl test imports/exports * Debugging in ci * Handle CancelledErrors for state.run in one place only * Rename `config` to `configuration` There was a symbol clash preventing compilation and it was easiest to rename `config` to `configuration` in the contracts. Not even remotely ideal, but it was the only way. * bump ethers to latest Prevents an issue were `JsonNode.items` symbol could not be found * More changes to support `config` > `configuration` * cleanup * testing to see if this fixes failure in ci * bumps contracts - ensures slot is free before allowing reservation - renames config to configuration to avoid symbol clash
57 lines
3.1 KiB
Nim
57 lines
3.1 KiB
Nim
import pkg/ethers
|
|
import pkg/ethers/erc20
|
|
import pkg/json_rpc/rpcclient
|
|
import pkg/stint
|
|
import pkg/chronos
|
|
import ../clock
|
|
import ./requests
|
|
import ./proofs
|
|
import ./config
|
|
|
|
export stint
|
|
export ethers except `%`, `%*`, toJson
|
|
export erc20 except `%`, `%*`, toJson
|
|
export config
|
|
export requests
|
|
|
|
type
|
|
Marketplace* = ref object of Contract
|
|
|
|
proc configuration*(marketplace: Marketplace): MarketplaceConfig {.contract, view.}
|
|
proc token*(marketplace: Marketplace): Address {.contract, view.}
|
|
proc slashMisses*(marketplace: Marketplace): UInt256 {.contract, view.}
|
|
proc slashPercentage*(marketplace: Marketplace): UInt256 {.contract, view.}
|
|
proc minCollateralThreshold*(marketplace: Marketplace): UInt256 {.contract, view.}
|
|
|
|
proc requestStorage*(marketplace: Marketplace, request: StorageRequest): Confirmable {.contract.}
|
|
proc fillSlot*(marketplace: Marketplace, requestId: RequestId, slotIndex: UInt256, proof: Groth16Proof): Confirmable {.contract.}
|
|
proc withdrawFunds*(marketplace: Marketplace, requestId: RequestId): Confirmable {.contract.}
|
|
proc withdrawFunds*(marketplace: Marketplace, requestId: RequestId, withdrawAddress: Address): Confirmable {.contract.}
|
|
proc freeSlot*(marketplace: Marketplace, id: SlotId): Confirmable {.contract.}
|
|
proc freeSlot*(marketplace: Marketplace, id: SlotId, rewardRecipient: Address, collateralRecipient: Address): Confirmable {.contract.}
|
|
proc getRequest*(marketplace: Marketplace, id: RequestId): StorageRequest {.contract, view.}
|
|
proc getHost*(marketplace: Marketplace, id: SlotId): Address {.contract, view.}
|
|
proc getActiveSlot*(marketplace: Marketplace, id: SlotId): Slot {.contract, view.}
|
|
|
|
proc myRequests*(marketplace: Marketplace): seq[RequestId] {.contract, view.}
|
|
proc mySlots*(marketplace: Marketplace): seq[SlotId] {.contract, view.}
|
|
proc requestState*(marketplace: Marketplace, requestId: RequestId): RequestState {.contract, view.}
|
|
proc slotState*(marketplace: Marketplace, slotId: SlotId): SlotState {.contract, view.}
|
|
proc requestEnd*(marketplace: Marketplace, requestId: RequestId): SecondsSince1970 {.contract, view.}
|
|
proc requestExpiry*(marketplace: Marketplace, requestId: RequestId): SecondsSince1970 {.contract, view.}
|
|
|
|
proc proofTimeout*(marketplace: Marketplace): UInt256 {.contract, view.}
|
|
|
|
proc proofEnd*(marketplace: Marketplace, id: SlotId): UInt256 {.contract, view.}
|
|
proc missingProofs*(marketplace: Marketplace, id: SlotId): UInt256 {.contract, view.}
|
|
proc isProofRequired*(marketplace: Marketplace, id: SlotId): bool {.contract, view.}
|
|
proc willProofBeRequired*(marketplace: Marketplace, id: SlotId): bool {.contract, view.}
|
|
proc getChallenge*(marketplace: Marketplace, id: SlotId): array[32, byte] {.contract, view.}
|
|
proc getPointer*(marketplace: Marketplace, id: SlotId): uint8 {.contract, view.}
|
|
|
|
proc submitProof*(marketplace: Marketplace, id: SlotId, proof: Groth16Proof): Confirmable {.contract.}
|
|
proc markProofAsMissing*(marketplace: Marketplace, id: SlotId, period: UInt256): Confirmable {.contract.}
|
|
|
|
proc reserveSlot*(marketplace: Marketplace, requestId: RequestId, slotIndex: UInt256): Confirmable {.contract.}
|
|
proc canReserveSlot*(marketplace: Marketplace, requestId: RequestId, slotIndex: UInt256): bool {.contract, view.}
|