rename `validationSlots` to `myValidationSlots`
Rename: `validationSlots` to `myValidationSlots` `addToValidationSlots` to `addToMyValidationSlots` `removeFromValidationSlots` to `removeFromMyValidationSlots`
This commit is contained in:
parent
f68630fe98
commit
96f2dcaf3e
|
@ -150,7 +150,7 @@ contract Marketplace is Proofs, Validation, StateRetrieval, Endian {
|
||||||
|
|
||||||
_addToMySlots(slot.host, slotId);
|
_addToMySlots(slot.host, slotId);
|
||||||
uint16 groupIdx = _getValidatorIndex(slotId);
|
uint16 groupIdx = _getValidatorIndex(slotId);
|
||||||
_addToValidationSlots(groupIdx, slotId);
|
_addToMyValidationSlots(groupIdx, slotId);
|
||||||
|
|
||||||
emit SlotFilled(requestId, slotIndex);
|
emit SlotFilled(requestId, slotIndex);
|
||||||
if (context.slotsFilled == request.ask.slots) {
|
if (context.slotsFilled == request.ask.slots) {
|
||||||
|
@ -173,7 +173,7 @@ contract Marketplace is Proofs, Validation, StateRetrieval, Endian {
|
||||||
} else if (state == SlotState.Failed) {
|
} else if (state == SlotState.Failed) {
|
||||||
_removeFromMySlots(msg.sender, slotId);
|
_removeFromMySlots(msg.sender, slotId);
|
||||||
uint16 groupIdx = _getValidatorIndex(slotId);
|
uint16 groupIdx = _getValidatorIndex(slotId);
|
||||||
_removeFromValidationSlots(groupIdx, slotId);
|
_removeFromMyValidationSlots(groupIdx, slotId);
|
||||||
} else if (state == SlotState.Filled) {
|
} else if (state == SlotState.Filled) {
|
||||||
_forciblyFreeSlot(slotId);
|
_forciblyFreeSlot(slotId);
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ contract Marketplace is Proofs, Validation, StateRetrieval, Endian {
|
||||||
|
|
||||||
_removeFromMySlots(slot.host, slotId);
|
_removeFromMySlots(slot.host, slotId);
|
||||||
uint16 groupIdx = _getValidatorIndex(slotId);
|
uint16 groupIdx = _getValidatorIndex(slotId);
|
||||||
_removeFromValidationSlots(groupIdx, slotId);
|
_removeFromMyValidationSlots(groupIdx, slotId);
|
||||||
|
|
||||||
uint256 slotIndex = slot.slotIndex;
|
uint256 slotIndex = slot.slotIndex;
|
||||||
delete _slots[slotId];
|
delete _slots[slotId];
|
||||||
|
@ -276,7 +276,7 @@ contract Marketplace is Proofs, Validation, StateRetrieval, Endian {
|
||||||
|
|
||||||
_removeFromMySlots(slot.host, slotId);
|
_removeFromMySlots(slot.host, slotId);
|
||||||
uint16 groupIdx = _getValidatorIndex(slotId);
|
uint16 groupIdx = _getValidatorIndex(slotId);
|
||||||
_removeFromValidationSlots(groupIdx, slotId);
|
_removeFromMyValidationSlots(groupIdx, slotId);
|
||||||
|
|
||||||
uint256 amount = _requests[requestId].pricePerSlot() +
|
uint256 amount = _requests[requestId].pricePerSlot() +
|
||||||
slot.currentCollateral;
|
slot.currentCollateral;
|
||||||
|
@ -292,7 +292,7 @@ contract Marketplace is Proofs, Validation, StateRetrieval, Endian {
|
||||||
Slot storage slot = _slots[slotId];
|
Slot storage slot = _slots[slotId];
|
||||||
_removeFromMySlots(slot.host, slotId);
|
_removeFromMySlots(slot.host, slotId);
|
||||||
uint16 groupIdx = _getValidatorIndex(slotId);
|
uint16 groupIdx = _getValidatorIndex(slotId);
|
||||||
_removeFromValidationSlots(groupIdx, slotId);
|
_removeFromMyValidationSlots(groupIdx, slotId);
|
||||||
|
|
||||||
uint256 amount = _expiryPayoutAmount(requestId, slot.filledAt) +
|
uint256 amount = _expiryPayoutAmount(requestId, slot.filledAt) +
|
||||||
slot.currentCollateral;
|
slot.currentCollateral;
|
||||||
|
|
|
@ -20,7 +20,7 @@ contract StateRetrieval {
|
||||||
return _slotsPerHost[msg.sender].values().toSlotIds();
|
return _slotsPerHost[msg.sender].values().toSlotIds();
|
||||||
}
|
}
|
||||||
|
|
||||||
function validationSlots(
|
function myValidationSlots(
|
||||||
uint16 groupIdx
|
uint16 groupIdx
|
||||||
) public view returns (SlotId[] memory) {
|
) public view returns (SlotId[] memory) {
|
||||||
return _slotsPerValidator[groupIdx].values().toSlotIds();
|
return _slotsPerValidator[groupIdx].values().toSlotIds();
|
||||||
|
@ -38,7 +38,7 @@ contract StateRetrieval {
|
||||||
_slotsPerHost[host].add(SlotId.unwrap(slotId));
|
_slotsPerHost[host].add(SlotId.unwrap(slotId));
|
||||||
}
|
}
|
||||||
|
|
||||||
function _addToValidationSlots(uint16 groupIdx, SlotId slotId) internal {
|
function _addToMyValidationSlots(uint16 groupIdx, SlotId slotId) internal {
|
||||||
_slotsPerValidator[groupIdx].add(SlotId.unwrap(slotId));
|
_slotsPerValidator[groupIdx].add(SlotId.unwrap(slotId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ contract StateRetrieval {
|
||||||
_slotsPerHost[host].remove(SlotId.unwrap(slotId));
|
_slotsPerHost[host].remove(SlotId.unwrap(slotId));
|
||||||
}
|
}
|
||||||
|
|
||||||
function _removeFromValidationSlots(uint16 groupIdx, SlotId slotId) internal {
|
function _removeFromMyValidationSlots(uint16 groupIdx, SlotId slotId) internal {
|
||||||
_slotsPerValidator[groupIdx].remove(SlotId.unwrap(slotId));
|
_slotsPerValidator[groupIdx].remove(SlotId.unwrap(slotId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1129,9 +1129,9 @@ describe("Marketplace", function () {
|
||||||
let slot1 = { ...slot, index: slot.index + 1 }
|
let slot1 = { ...slot, index: slot.index + 1 }
|
||||||
await token.approve(marketplace.address, request.ask.collateral)
|
await token.approve(marketplace.address, request.ask.collateral)
|
||||||
await marketplace.fillSlot(slot.request, slot1.index, proof)
|
await marketplace.fillSlot(slot.request, slot1.index, proof)
|
||||||
const allSlots = (await marketplace.validationSlots(0))
|
const allSlots = (await marketplace.myValidationSlots(0))
|
||||||
.concat(await marketplace.validationSlots(1))
|
.concat(await marketplace.myValidationSlots(1))
|
||||||
.concat(await marketplace.validationSlots(2))
|
.concat(await marketplace.myValidationSlots(2))
|
||||||
expect(allSlots).to.have.members([slotId(slot), slotId(slot1)])
|
expect(allSlots).to.have.members([slotId(slot), slotId(slot1)])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1142,9 +1142,9 @@ describe("Marketplace", function () {
|
||||||
await marketplace.fillSlot(slot.request, slot1.index, proof)
|
await marketplace.fillSlot(slot.request, slot1.index, proof)
|
||||||
await token.approve(marketplace.address, request.ask.collateral)
|
await token.approve(marketplace.address, request.ask.collateral)
|
||||||
await marketplace.freeSlot(slotId(slot))
|
await marketplace.freeSlot(slotId(slot))
|
||||||
const allSlots = (await marketplace.validationSlots(0))
|
const allSlots = (await marketplace.myValidationSlots(0))
|
||||||
.concat(await marketplace.validationSlots(1))
|
.concat(await marketplace.myValidationSlots(1))
|
||||||
.concat(await marketplace.validationSlots(2))
|
.concat(await marketplace.myValidationSlots(2))
|
||||||
expect(allSlots).to.not.have.members([slotId(slot)])
|
expect(allSlots).to.not.have.members([slotId(slot)])
|
||||||
expect(allSlots).to.have.members([slotId(slot1)])
|
expect(allSlots).to.have.members([slotId(slot1)])
|
||||||
})
|
})
|
||||||
|
@ -1157,9 +1157,9 @@ describe("Marketplace", function () {
|
||||||
await marketplace.fillSlot(slot.request, slot1.index, proof)
|
await marketplace.fillSlot(slot.request, slot1.index, proof)
|
||||||
await waitUntilCancelled(request)
|
await waitUntilCancelled(request)
|
||||||
await mine()
|
await mine()
|
||||||
const allSlots = (await marketplace.validationSlots(0))
|
const allSlots = (await marketplace.myValidationSlots(0))
|
||||||
.concat(await marketplace.validationSlots(1))
|
.concat(await marketplace.myValidationSlots(1))
|
||||||
.concat(await marketplace.validationSlots(2))
|
.concat(await marketplace.myValidationSlots(2))
|
||||||
expect(allSlots).to.have.members([slotId(slot), slotId(slot1)])
|
expect(allSlots).to.have.members([slotId(slot), slotId(slot1)])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1167,9 +1167,9 @@ describe("Marketplace", function () {
|
||||||
await waitUntilStarted(marketplace, request, proof, token)
|
await waitUntilStarted(marketplace, request, proof, token)
|
||||||
await waitUntilFinished(marketplace, requestId(request))
|
await waitUntilFinished(marketplace, requestId(request))
|
||||||
await marketplace.freeSlot(slotId(slot))
|
await marketplace.freeSlot(slotId(slot))
|
||||||
const allSlots = (await marketplace.validationSlots(0))
|
const allSlots = (await marketplace.myValidationSlots(0))
|
||||||
.concat(await marketplace.validationSlots(1))
|
.concat(await marketplace.myValidationSlots(1))
|
||||||
.concat(await marketplace.validationSlots(2))
|
.concat(await marketplace.myValidationSlots(2))
|
||||||
expect(allSlots).to.not.contain(slotId(slot))
|
expect(allSlots).to.not.contain(slotId(slot))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1177,9 +1177,9 @@ describe("Marketplace", function () {
|
||||||
await marketplace.fillSlot(slot.request, slot.index, proof)
|
await marketplace.fillSlot(slot.request, slot.index, proof)
|
||||||
await waitUntilCancelled(request)
|
await waitUntilCancelled(request)
|
||||||
await marketplace.freeSlot(slotId(slot))
|
await marketplace.freeSlot(slotId(slot))
|
||||||
const allSlots = (await marketplace.validationSlots(0))
|
const allSlots = (await marketplace.myValidationSlots(0))
|
||||||
.concat(await marketplace.validationSlots(1))
|
.concat(await marketplace.myValidationSlots(1))
|
||||||
.concat(await marketplace.validationSlots(2))
|
.concat(await marketplace.myValidationSlots(2))
|
||||||
expect(allSlots).to.not.contain(slotId(slot))
|
expect(allSlots).to.not.contain(slotId(slot))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1187,9 +1187,9 @@ describe("Marketplace", function () {
|
||||||
await waitUntilStarted(marketplace, request, proof, token)
|
await waitUntilStarted(marketplace, request, proof, token)
|
||||||
await waitUntilSlotFailed(marketplace, request, slot)
|
await waitUntilSlotFailed(marketplace, request, slot)
|
||||||
await marketplace.freeSlot(slotId(slot))
|
await marketplace.freeSlot(slotId(slot))
|
||||||
const allSlots = (await marketplace.validationSlots(0))
|
const allSlots = (await marketplace.myValidationSlots(0))
|
||||||
.concat(await marketplace.validationSlots(1))
|
.concat(await marketplace.myValidationSlots(1))
|
||||||
.concat(await marketplace.validationSlots(2))
|
.concat(await marketplace.myValidationSlots(2))
|
||||||
expect(allSlots).to.not.contain(slotId(slot))
|
expect(allSlots).to.not.contain(slotId(slot))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue