From 6e18082b2df69a0d658297572618450316b34226 Mon Sep 17 00:00:00 2001 From: sukanto01899 Date: Tue, 27 Jan 2026 09:25:28 +0600 Subject: [PATCH 1/2] fix/poolstreamer2-withdraw-underlying --- contracts/PoolStreamer2.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/PoolStreamer2.sol b/contracts/PoolStreamer2.sol index c4aa661..89ad06e 100644 --- a/contracts/PoolStreamer2.sol +++ b/contracts/PoolStreamer2.sol @@ -256,7 +256,7 @@ contract PoolStreamer2 is AccessControl { // downgrade amount from super token to underlying token _superToken(pool).downgrade(amount); // transfer amount to msg.sender - _superToken(pool).transfer(msg.sender, amount); + _underlyingToken(pool).transfer(msg.sender, amount); } function superToken(ISuperFluidPool pool) external view returns (address) { @@ -288,4 +288,4 @@ contract PoolStreamer2 is AccessControl { } } - \ No newline at end of file + From a22584262c1459913ef2f36cfa607a9d3a8999f0 Mon Sep 17 00:00:00 2001 From: sukanto01899 Date: Fri, 30 Jan 2026 12:41:09 +0600 Subject: [PATCH 2/2] Streamonomics: prevent zero step to avoid transfer DoS --- contracts/Streamonomics.sol | 3 ++- test/streamonomics.js | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 test/streamonomics.js diff --git a/contracts/Streamonomics.sol b/contracts/Streamonomics.sol index 3728c22..aefc173 100644 --- a/contracts/Streamonomics.sol +++ b/contracts/Streamonomics.sol @@ -32,6 +32,7 @@ contract Streamonomics is Ownable { delete streamonomics; uint256 total; for(uint i = 0; i < percentage.length; i++) { + require(step[i] > 0, "!step"); streamonomics.push(Streamonomic(percentage[i], start[i], step[i], limit[i])); emit StreamonomicAdded(percentage[i], start[i], step[i], limit[i]); total += percentage[i]; @@ -43,4 +44,4 @@ contract Streamonomics is Ownable { return streamonomics; } -} \ No newline at end of file +} diff --git a/test/streamonomics.js b/test/streamonomics.js new file mode 100644 index 0000000..e9f761d --- /dev/null +++ b/test/streamonomics.js @@ -0,0 +1,18 @@ +const { expect } = require("chai"); +const { ethers } = require("hardhat"); + +describe("Streamonomics", function () { + it("reverts when step is zero", async function () { + const Streamonomics = await ethers.getContractFactory("Streamonomics"); + const stream = await Streamonomics.deploy(); + await stream.deployed(); + + const percentage = [10]; + const start = [1]; + const step = [0]; + const limit = [1]; + + await expect(stream.setStreamonomics(percentage, start, step, limit)) + .to.be.revertedWith("!step"); + }); +}); \ No newline at end of file