vault: reject negative flows

This commit is contained in:
Mark Spanbroek 2025-01-28 10:33:54 +01:00
parent 8ee4512080
commit 9105a3530a

View File

@ -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)