mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-01-10 04:55:40 +00:00
e8e9820d5b
* feat: add `--payout-address` Allows SPs to be paid out to a separate address, keeping their profits secure. Supports https://github.com/codex-storage/codex-contracts-eth/pull/144 in the nim-codex client. * Remove optional payoutAddress Change --payout-address so that it is no longer optional. There is no longer an overload in `Marketplace.sol` for `fillSlot` accepting no `payoutAddress`. * Update integration tests to include --payout-address * move payoutAddress from fillSlot to freeSlot * Update integration tests to use required payoutAddress - to make payoutAddress required, the integration tests needed to avoid building the cli params until just before starting the node, otherwise if cli params were added ad-hoc, there would be an error after a non-required parameter was added before a required parameter. * support client payout address - withdrawFunds requires a withdrawAddress parameter, directs payouts for withdrawing of client funds (for a cancelled request) to go to that address. * fix integration test adds --payout-address to validators * refactor: support withdrawFunds and freeSlot optional parameters - withdrawFunds has an optional parameter for withdrawRecipient - freeSlot has optional parameters for rewardRecipient and collateralRecipient - change --payout-address to --reward-recipient to match contract signature naming * Revert "Update integration tests to include --payout-address" This reverts commit 8f9535cf35b0f2b183ac4013a7ed11b246486964. There are some valid improvements to the integration tests, but they can be handled in a separate PR. * small fix * bump contracts to fix marketplace spec * bump codex-contracts-eth, now rebased on master * bump codex-contracts-eth now that feat/reward-address has been merged to master * clean up, comments
54 lines
3.0 KiB
Nim
54 lines
3.0 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 config*(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): ?TransactionResponse {.contract.}
|
|
proc fillSlot*(marketplace: Marketplace, requestId: RequestId, slotIndex: UInt256, proof: Groth16Proof): ?TransactionResponse {.contract.}
|
|
proc withdrawFunds*(marketplace: Marketplace, requestId: RequestId): ?TransactionResponse {.contract.}
|
|
proc withdrawFunds*(marketplace: Marketplace, requestId: RequestId, withdrawAddress: Address): ?TransactionResponse {.contract.}
|
|
proc freeSlot*(marketplace: Marketplace, id: SlotId): ?TransactionResponse {.contract.}
|
|
proc freeSlot*(marketplace: Marketplace, id: SlotId, rewardRecipient: Address, collateralRecipient: Address): ?TransactionResponse {.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): ?TransactionResponse {.contract.}
|
|
proc markProofAsMissing*(marketplace: Marketplace, id: SlotId, period: UInt256): ?TransactionResponse {.contract.}
|