mirror of
https://github.com/logos-storage/logos-storage-contracts-eth.git
synced 2026-01-02 13:23:10 +00:00
Previous to when SlotState.Repair was implemented, slots in repair would be considered free and the slots could be reserved in this state. Now that SlotState.Repair has been implemented, the `canReserveSlot` needs to check that the SlotState is in Repair or is Free before allowing reservation.
30 lines
823 B
Solidity
30 lines
823 B
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.28;
|
|
|
|
import "./SlotReservations.sol";
|
|
|
|
contract TestSlotReservations is SlotReservations {
|
|
using EnumerableSet for EnumerableSet.AddressSet;
|
|
|
|
mapping(SlotId => SlotState) private _states;
|
|
|
|
// solhint-disable-next-line no-empty-blocks
|
|
constructor(SlotReservationsConfig memory config) SlotReservations(config) {}
|
|
|
|
function contains(SlotId slotId, address host) public view returns (bool) {
|
|
return _reservations[slotId].contains(host);
|
|
}
|
|
|
|
function length(SlotId slotId) public view returns (uint256) {
|
|
return _reservations[slotId].length();
|
|
}
|
|
|
|
function slotState(SlotId slotId) public view override returns (SlotState) {
|
|
return _states[slotId];
|
|
}
|
|
|
|
function setSlotState(SlotId id, SlotState state) public {
|
|
_states[id] = state;
|
|
}
|
|
}
|