mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-02-10 03:55:30 +00:00
* openAPI: StorageRequestCreation: reward => pricePerByte, collateral => collateralPerByte * purchasing: reward => pricePerByte, collateral => collateralPerByte * Updates availabilities and reservations to use totalCollateral, minPricePerByte, and maxCollateralPerByte * Uses correct div operator when operating on UInt256 * proposal updating totalCollateral in availability * makes sure that reading currentCollateral happens before freeing slot * Updates naming * fixes tests: unit and contracts * uses feat/price-per-byte branch for codex-contracts-eth * temporarily disables integration tests on CI * introduces high level <<totalCollateral>> property for a cleaner external interface * updates integration tests * Applies review comments * Updates description of totalCollateral in SalesAvailability * updates codex-contracts-eth (price-per-byte)
27 lines
687 B
Nim
27 lines
687 B
Nim
import pkg/codex/contracts/requests
|
|
import pkg/codex/sales/slotqueue
|
|
|
|
type MockSlotQueueItem* = object
|
|
requestId*: RequestId
|
|
slotIndex*: uint16
|
|
slotSize*: UInt256
|
|
duration*: UInt256
|
|
pricePerBytePerSecond*: UInt256
|
|
collateralPerByte*: UInt256
|
|
expiry*: UInt256
|
|
seen*: bool
|
|
|
|
proc toSlotQueueItem*(item: MockSlotQueueItem): SlotQueueItem =
|
|
SlotQueueItem.init(
|
|
requestId = item.requestId,
|
|
slotIndex = item.slotIndex,
|
|
ask = StorageAsk(
|
|
slotSize: item.slotSize,
|
|
duration: item.duration,
|
|
pricePerBytePerSecond: item.pricePerBytePerSecond,
|
|
collateralPerByte: item.collateralPerByte,
|
|
),
|
|
expiry = item.expiry,
|
|
seen = item.seen,
|
|
)
|