copy slotIndex before delete for emit

This commit is contained in:
Eric Mastro 2023-06-21 17:54:41 +10:00
parent 8d254f8385
commit df219c85d7
No known key found for this signature in database
1 changed files with 5 additions and 6 deletions

View File

@ -110,7 +110,7 @@ contract Marketplace is Proofs, StateRetrieval {
_addToMySlots(slot.host, slotId);
emit SlotFilled(requestId, slotIndex, slotId);
emit SlotFilled(requestId, slotIndex);
if (context.slotsFilled == request.ask.slots) {
context.state = RequestState.Started;
context.startedAt = block.timestamp;
@ -160,9 +160,10 @@ contract Marketplace is Proofs, StateRetrieval {
_removeFromMySlots(slot.host, slotId);
uint256 slotIndex = slot.slotIndex;
delete _slots[slotId];
context.slotsFilled -= 1;
emit SlotFreed(requestId, slot.slotIndex, slotId);
emit SlotFreed(requestId, slotIndex);
resetMissingProofs(slotId);
Request storage request = _requests[requestId];
@ -316,13 +317,11 @@ contract Marketplace is Proofs, StateRetrieval {
event RequestFailed(RequestId indexed requestId);
event SlotFilled(
RequestId indexed requestId,
uint256 indexed slotIndex,
SlotId slotId
uint256 slotIndex
);
event SlotFreed(
RequestId indexed requestId,
uint256 slotIndex,
SlotId slotId
uint256 slotIndex
);
event RequestCancelled(RequestId indexed requestId);