marketplace: remove accounting that is now done by vault

This commit is contained in:
Mark Spanbroek 2025-02-27 08:37:23 +01:00
parent c626372d55
commit 5e8031eda5

View File

@ -63,7 +63,6 @@ contract Marketplace is SlotReservations, Proofs, StateRetrieval, Endian {
struct RequestContext {
RequestState state;
uint64 slotsFilled;
Timestamp startedAt;
Timestamp endsAt;
Timestamp expiresAt;
}
@ -71,12 +70,7 @@ contract Marketplace is SlotReservations, Proofs, StateRetrieval, Endian {
struct Slot {
SlotState state;
RequestId requestId;
/// @notice Timestamp that signals when slot was filled
/// @dev Used for calculating payouts as hosts are paid
/// based on time they actually host the content
Timestamp filledAt;
uint64 slotIndex;
/// @notice address used for collateral interactions and identifying hosts
address host;
}
@ -193,10 +187,7 @@ contract Marketplace is SlotReservations, Proofs, StateRetrieval, Endian {
revert Marketplace_SlotNotFree();
}
Timestamp currentTime = Timestamps.currentTime();
slot.host = msg.sender;
slot.filledAt = currentTime;
_startRequiringProofs(slotId);
submitProof(slotId, proof);
@ -234,7 +225,6 @@ contract Marketplace is SlotReservations, Proofs, StateRetrieval, Endian {
context.state == RequestState.New // Only New requests can "start" the requests
) {
context.state = RequestState.Started;
context.startedAt = currentTime;
_vault.extendLock(fund, context.endsAt);
emit RequestFulfilled(requestId);
}
@ -367,7 +357,6 @@ contract Marketplace is SlotReservations, Proofs, StateRetrieval, Endian {
_removeFromMySlots(slot.host, slotId);
_reservations[slotId].clear(); // We purge all the reservations for the slot
slot.state = SlotState.Repair;
slot.filledAt = Timestamp.wrap(0);
slot.host = address(0);
context.slotsFilled -= 1;
emit SlotFreed(requestId, slot.slotIndex);