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