From 075d97e5da43f3c44eb6c09e34d8ad5ce52d7746 Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Tue, 27 May 2025 13:07:10 +0200 Subject: [PATCH] marketplace: clarify why we flow & transfer funds before burning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Adam Uhlíř --- contracts/Marketplace.sol | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/contracts/Marketplace.sol b/contracts/Marketplace.sol index 8b61a60..c458d4e 100644 --- a/contracts/Marketplace.sol +++ b/contracts/Marketplace.sol @@ -364,8 +364,16 @@ contract Marketplace is SlotReservations, Proofs, StateRetrieval, Endian { FundId fund = requestId.asFundId(); AccountId hostAccount = _vault.hostAccount(slot.host, slot.slotIndex); AccountId clientAccount = _vault.clientAccount(request.client); + + // ensure that nothing is flowing into the account anymore by reversing the + // incoming flow from the client _vault.flow(fund, hostAccount, clientAccount, rate); + + // temporarily transfer repair reward for the slot to the client until a + // host repairs the slot _vault.transfer(fund, hostAccount, clientAccount, repairReward); + + // burn the rest of the funds in the account _vault.burnAccount(fund, hostAccount); _removeFromMySlots(slot.host, slotId);