diff --git a/contracts/Marketplace.sol b/contracts/Marketplace.sol index 35fd0c3..eac1904 100644 --- a/contracts/Marketplace.sol +++ b/contracts/Marketplace.sol @@ -207,10 +207,8 @@ contract Marketplace is SlotReservations, Proofs, StateRetrieval, Endian { uint128 designated = _config.collateral.designatedCollateral(collateral); if (slotState(slotId) == SlotState.Repair) { - // host gets a discount on its collateral, paid for by the repair reward uint128 repairReward = _config.collateral.repairReward(collateral); _vault.transfer(fund, clientAccount, hostAccount, repairReward); - collateral -= repairReward; } _transferToVault(slot.host, fund, hostAccount, collateral); diff --git a/test/Marketplace.test.js b/test/Marketplace.test.js index 6c8424b..18693c0 100644 --- a/test/Marketplace.test.js +++ b/test/Marketplace.test.js @@ -304,30 +304,16 @@ describe("Marketplace", function () { await marketplace.freeSlot(slotId(slot)) }) - it("gives the host a discount on the collateral", async function () { - const collateral = collateralPerSlot(request) - const reward = repairReward(config, collateral) - const discountedCollateral = collateral - reward - await token.approve(marketplace.address, discountedCollateral) - - const startBalance = await token.balanceOf(host.address) - await marketplace.fillSlot(slot.request, slot.index, proof) - const endBalance = await token.balanceOf(host.address) - - expect(startBalance - endBalance).to.equal(discountedCollateral) - }) - it("tops up the host collateral with the repair reward", async function () { const collateral = collateralPerSlot(request) const reward = repairReward(config, collateral) - const discountedCollateral = collateral - reward - await token.approve(marketplace.address, discountedCollateral) + await token.approve(marketplace.address, collateral) const startBalance = await marketplace.getSlotBalance(slotId(slot)) await marketplace.fillSlot(slot.request, slot.index, proof) const endBalance = await marketplace.getSlotBalance(slotId(slot)) - expect(endBalance - startBalance).to.equal(collateral) + expect(endBalance - startBalance).to.equal(collateral + reward) }) })