From 892d48b54ba9df2a5e9bd643ad04b157e3125c62 Mon Sep 17 00:00:00 2001 From: didi Date: Wed, 22 Oct 2025 14:18:51 +0200 Subject: [PATCH 1/2] use changed delete hook --- lib/superfluid-protocol-monorepo | 2 +- src/AdSpotContract.sol | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/superfluid-protocol-monorepo b/lib/superfluid-protocol-monorepo index a5bf3a6..ee71ae0 160000 --- a/lib/superfluid-protocol-monorepo +++ b/lib/superfluid-protocol-monorepo @@ -1 +1 @@ -Subproject commit a5bf3a6747815b19619c277191344f7f0ce7e135 +Subproject commit ee71ae0871b1e3c26d30beaeb14676f70ab01add diff --git a/src/AdSpotContract.sol b/src/AdSpotContract.sol index 66681d4..d765ee1 100644 --- a/src/AdSpotContract.sol +++ b/src/AdSpotContract.sol @@ -258,8 +258,6 @@ contract AdSpotContract is CFASuperAppBase { ISuperToken, /*superToken*/ address sender, - address, - /*receiver*/ int96, /*previousFlowRate*/ uint256, From 4eedc9fd0dd75ebc0520dd874e52e18c5b1c4fc3 Mon Sep 17 00:00:00 2001 From: didi Date: Fri, 24 Oct 2025 14:14:19 +0200 Subject: [PATCH 2/2] changed API --- lib/superfluid-protocol-monorepo | 2 +- src/AdSpotContract.sol | 34 ++++++++++++-------------------- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/lib/superfluid-protocol-monorepo b/lib/superfluid-protocol-monorepo index ee71ae0..3b138f8 160000 --- a/lib/superfluid-protocol-monorepo +++ b/lib/superfluid-protocol-monorepo @@ -1 +1 @@ -Subproject commit ee71ae0871b1e3c26d30beaeb14676f70ab01add +Subproject commit 3b138f82e138bbd0b45ee4dd22adb831af57e743 diff --git a/src/AdSpotContract.sol b/src/AdSpotContract.sol index d765ee1..7cd95c6 100644 --- a/src/AdSpotContract.sol +++ b/src/AdSpotContract.sol @@ -180,14 +180,14 @@ contract AdSpotContract is CFASuperAppBase { ISuperToken, /*superToken*/ address sender, + int96 flowRate, bytes calldata ctx ) internal override returns (bytes memory newCtx) { - int96 senderFlowRate = acceptedToken.getFlowRate(sender, address(this)); - require(senderFlowRate > highestFlowRate, "Sender flowrate lower than current flowRate"); + require(flowRate > highestFlowRate, "Sender flowrate lower than current flowRate"); newCtx = ctx; if (highestBidder != address(0)) { newCtx = acceptedToken.deleteFlowWithCtx(highestBidder, address(this), ctx); @@ -200,10 +200,10 @@ contract AdSpotContract is CFASuperAppBase { pool.updateMemberUnits(highestBidder, halfShares + pool.getUnits(highestBidder)); } highestBidder = sender; - highestFlowRate = senderFlowRate; + highestFlowRate = flowRate; lastUpdate = block.timestamp; emit newHighestBidder(highestBidder, highestFlowRate); - newCtx = acceptedToken.distributeFlowWithCtx(address(this), pool, senderFlowRate, newCtx); + newCtx = acceptedToken.distributeFlowWithCtx(address(this), pool, flowRate, newCtx); return newCtx; } @@ -219,28 +219,20 @@ contract AdSpotContract is CFASuperAppBase { function onFlowUpdated( ISuperToken, address sender, - int96 previousflowRate, - uint256, - /*lastUpdated*/ + int96 flowRate, + int96 previousFlowRate, + uint256 lastUpdated, bytes calldata ctx - ) - internal - override - returns (bytes memory newCtx) - { - int96 senderFlowRate = acceptedToken.getFlowRate(sender, address(this)); - require( - senderFlowRate > previousflowRate, - "Sender flowRate is lower than the previous one, delete flowrate and start a new one lower" - ); - require(senderFlowRate > highestFlowRate, "You already have a flowrate that is higher than this one"); + ) internal override returns (bytes memory newCtx) { + require(flowRate > previousFlowRate, "Sender flowRate is lower than the previous one, delete flowrate and start a new one lower"); + require(flowRate > highestFlowRate, "You already have a flowrate that is higher than this one"); newCtx = ctx; uint128 halfShares = SafeCast.toUint128(block.timestamp - lastUpdate) / 2; ISuperfluidPool(poolAddress).updateMemberUnits(owner, halfShares + pool.getUnits(owner)); ISuperfluidPool(poolAddress).updateMemberUnits(highestBidder, halfShares + pool.getUnits(highestBidder)); - newCtx = acceptedToken.distributeFlowWithCtx(address(this), pool, senderFlowRate, newCtx); + newCtx = acceptedToken.distributeFlowWithCtx(address(this), pool, flowRate, newCtx); highestBidder = sender; - highestFlowRate = senderFlowRate; + highestFlowRate = flowRate; lastUpdate = block.timestamp; emit newHighestBidder(highestBidder, highestFlowRate); return newCtx; @@ -254,7 +246,7 @@ contract AdSpotContract is CFASuperAppBase { * @return bytes Returns the new transaction context. */ - function onFlowDeleted( + function onInFlowDeleted( ISuperToken, /*superToken*/ address sender,