Skip to content

Commit

Permalink
add withdrawn event
Browse files Browse the repository at this point in the history
  • Loading branch information
sirnicolaz committed Oct 20, 2023
1 parent b5e785b commit 439eb59
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions contracts/InternalMarket/InternalMarketBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
7 changes: 7 additions & 0 deletions test/InternalMarket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit 439eb59

Please sign in to comment.