From 439eb594849859dd9d5390a07a0bb0b8143ed42a Mon Sep 17 00:00:00 2001 From: Nicola Miotto Date: Fri, 20 Oct 2023 11:19:27 +0200 Subject: [PATCH] add withdrawn event --- contracts/InternalMarket/InternalMarketBase.sol | 3 +++ test/InternalMarket.ts | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/contracts/InternalMarket/InternalMarketBase.sol b/contracts/InternalMarket/InternalMarketBase.sol index fec0a3a..c50d73d 100644 --- a/contracts/InternalMarket/InternalMarketBase.sol +++ b/contracts/InternalMarket/InternalMarketBase.sol @@ -17,6 +17,7 @@ contract InternalMarketBase { ); event OfferMatched(uint128 id, address from, address to, uint256 amount); + event Withdrawn(address from, address to, uint256 amount); struct Offer { uint256 expiredAt; @@ -203,6 +204,8 @@ contract InternalMarketBase { } else { tokenInternal.unwrap(from, to, amount); } + + emit Withdrawn(from, to, amount); } function _burn(address from, uint256 amount) internal virtual { diff --git a/test/InternalMarket.ts b/test/InternalMarket.ts index a22626e..3245b14 100644 --- a/test/InternalMarket.ts +++ b/test/InternalMarket.ts @@ -768,6 +768,13 @@ describe("InternalMarket", async () => { 11 + 25 ); }); + + it.only("should emit a Withdrawn event", async () => { + await setEVMTimestamp(ts + WEEK + DAY * 3); + expect(internalMarket.connect(alice).withdraw(bob.address, 11)) + .to.emit(internalMarket, "Withdrawn") + .withArgs(alice.address, bob.address, 11); + }); }); describe("match+withdraw", async () => {