From 9105a3530a1595370a14f3d7caaf1bd96222e10b Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Tue, 28 Jan 2025 10:33:54 +0100 Subject: [PATCH] vault: reject negative flows --- test/Vault.tests.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/Vault.tests.js b/test/Vault.tests.js index 44f702d..b4bc9c4 100644 --- a/test/Vault.tests.js +++ b/test/Vault.tests.js @@ -503,6 +503,12 @@ describe("Vault", function () { expect(await getBalance(receiver)).to.equal(total) }) + it("rejects negative flows", async function() { + await expect( + vault.flow(context, sender, receiver, -1) + ).to.be.revertedWith("NegativeFlow") + }) + it("rejects flow when insufficient available tokens", async function () { const duration = maximum - (await currentTime()) const rate = Math.round(deposit / duration)