Add function `isFinished` that checks whethere the state has been set to `RequestState.Finished` (which is not being set yet) or if the contract was started (`RequestState.Started`) and the contract duration has lapsed.
To facilitate `isFinished`, the contract start time (`startedAt`) was added to calculate the contract end time.
Once a proof is marked as missing, if that missing proof is enough to slash a host, first slash the host, then check the hosts balance. If the balance has dropped below the minimum allowable collateral threshold, then remove them from the slot.
Update `Marketplace.state` getter to to take `isCancelled` into account. This state can then be used internally and externally.
Add checks to `proofEnd`, `isProofRequired`, `willProofBeRequired`, and `getChallenge` that understands if the request is in a state to accept proofs. If not, return other values.
Add `slotMustAcceptProofs` modifier, originally introduced in a later PR, which requires the request to be in state of the request accepting proofs.
Add tests for all the above.
- Remove `FundsWithdrawn` event
- do not copy request to memory
- todo for changing withdraw amount to not include proof payments
- test lock expiry border
- in tests, move `RequestState` to exported const in marketplace.js
- move test for state checks on `fillSlot` to the “filling a slot” section.
Add a requestId mapping to the Slot type. This allows the requestId to be obtained for a slot and the StorageRequest can be looked up from the id.
Add `isSlotCancelled` to check if the request that a slot belongs to has been cancelled (not enough slots filled before expiry).
Add cancelled check for slot state which checks the contract state and also the slot expiry time. This handles the case where the client may not have withdrawn funds yet (which sets the contract state to Cancelled).
Add tests for contract state.
Adds ability for client to withdraw funds from a cancelled storage request.
Tests to check if request has timed out, if the client address is requesting withdraw, if the request state is new, and the funds were successfully transferred.