mirror of
https://github.com/status-im/dagger-contracts.git
synced 2025-03-03 15:50:43 +00:00
[marketplace] formatting
reformatting using prettier
This commit is contained in:
parent
b2f9e07c56
commit
29dcfb52b4
@ -97,9 +97,11 @@ contract Marketplace is Collateral, Proofs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _freeSlot(
|
function _freeSlot(SlotId slotId)
|
||||||
SlotId slotId
|
internal
|
||||||
) internal slotMustAcceptProofs(slotId) marketplaceInvariant {
|
slotMustAcceptProofs(slotId)
|
||||||
|
marketplaceInvariant
|
||||||
|
{
|
||||||
Slot storage slot = _slot(slotId);
|
Slot storage slot = _slot(slotId);
|
||||||
RequestId requestId = slot.requestId;
|
RequestId requestId = slot.requestId;
|
||||||
RequestContext storage context = requestContexts[requestId];
|
RequestContext storage context = requestContexts[requestId];
|
||||||
@ -131,6 +133,7 @@ contract Marketplace is Collateral, Proofs {
|
|||||||
// TODO: send client remaining funds
|
// TODO: send client remaining funds
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function payoutSlot(RequestId requestId, uint256 slotIndex)
|
function payoutSlot(RequestId requestId, uint256 slotIndex)
|
||||||
public
|
public
|
||||||
marketplaceInvariant
|
marketplaceInvariant
|
||||||
@ -180,10 +183,8 @@ contract Marketplace is Collateral, Proofs {
|
|||||||
RequestContext storage context = _context(requestId);
|
RequestContext storage context = _context(requestId);
|
||||||
return
|
return
|
||||||
context.state == RequestState.Cancelled ||
|
context.state == RequestState.Cancelled ||
|
||||||
(
|
(context.state == RequestState.New &&
|
||||||
context.state == RequestState.New &&
|
block.timestamp > _request(requestId).expiry);
|
||||||
block.timestamp > _request(requestId).expiry
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @notice Return true if the request state is RequestState.Finished or if the request duration has elapsed and the request was started.
|
/// @notice Return true if the request state is RequestState.Finished or if the request duration has elapsed and the request was started.
|
||||||
@ -194,10 +195,8 @@ contract Marketplace is Collateral, Proofs {
|
|||||||
RequestContext memory context = _context(requestId);
|
RequestContext memory context = _context(requestId);
|
||||||
return
|
return
|
||||||
context.state == RequestState.Finished ||
|
context.state == RequestState.Finished ||
|
||||||
(
|
(context.state == RequestState.Started &&
|
||||||
context.state == RequestState.Started &&
|
block.timestamp > context.endsAt);
|
||||||
block.timestamp > context.endsAt
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @notice Return id of request that slot belongs to
|
/// @notice Return id of request that slot belongs to
|
||||||
@ -272,8 +271,8 @@ contract Marketplace is Collateral, Proofs {
|
|||||||
function _price(
|
function _price(
|
||||||
uint64 numSlots,
|
uint64 numSlots,
|
||||||
uint256 duration,
|
uint256 duration,
|
||||||
uint256 reward) internal pure returns (uint256) {
|
uint256 reward
|
||||||
|
) internal pure returns (uint256) {
|
||||||
return numSlots * duration * reward;
|
return numSlots * duration * reward;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,7 +310,11 @@ contract Marketplace is Collateral, Proofs {
|
|||||||
/// @notice returns true when the request is accepting proof submissions from hosts occupying slots.
|
/// @notice returns true when the request is accepting proof submissions from hosts occupying slots.
|
||||||
/// @dev Request state must be new or started, and must not be cancelled, finished, or failed.
|
/// @dev Request state must be new or started, and must not be cancelled, finished, or failed.
|
||||||
/// @param requestId id of the request for which to obtain state info
|
/// @param requestId id of the request for which to obtain state info
|
||||||
function _requestAcceptsProofs(RequestId requestId) internal view returns (bool) {
|
function _requestAcceptsProofs(RequestId requestId)
|
||||||
|
internal
|
||||||
|
view
|
||||||
|
returns (bool)
|
||||||
|
{
|
||||||
RequestState s = state(requestId);
|
RequestState s = state(requestId);
|
||||||
return s == RequestState.New || s == RequestState.Started;
|
return s == RequestState.New || s == RequestState.Started;
|
||||||
}
|
}
|
||||||
@ -324,9 +327,7 @@ contract Marketplace is Collateral, Proofs {
|
|||||||
return RequestId.wrap(keccak256(abi.encode(request)));
|
return RequestId.wrap(keccak256(abi.encode(request)));
|
||||||
}
|
}
|
||||||
|
|
||||||
function _toSlotId(
|
function _toSlotId(RequestId requestId, uint256 slotIndex)
|
||||||
RequestId requestId,
|
|
||||||
uint256 slotIndex)
|
|
||||||
internal
|
internal
|
||||||
pure
|
pure
|
||||||
returns (SlotId)
|
returns (SlotId)
|
||||||
@ -354,11 +355,6 @@ contract Marketplace is Collateral, Proofs {
|
|||||||
return ProofId.wrap(SlotId.unwrap(slotId));
|
return ProofId.wrap(SlotId.unwrap(slotId));
|
||||||
}
|
}
|
||||||
|
|
||||||
function _notEqual(RequestId a, uint256 b) internal pure returns (bool) {
|
|
||||||
return RequestId.unwrap(a) != bytes32(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
struct Request {
|
struct Request {
|
||||||
address client;
|
address client;
|
||||||
Ask ask;
|
Ask ask;
|
||||||
|
@ -9,7 +9,7 @@ const {
|
|||||||
waitUntilStarted,
|
waitUntilStarted,
|
||||||
waitUntilFinished,
|
waitUntilFinished,
|
||||||
waitUntilFailed,
|
waitUntilFailed,
|
||||||
RequestState
|
RequestState,
|
||||||
} = require("./marketplace")
|
} = require("./marketplace")
|
||||||
const { price, pricePerSlot } = require("./price")
|
const { price, pricePerSlot } = require("./price")
|
||||||
const {
|
const {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user