commit 6d82807ffe112f7e8d3d34e7d4e541be2d0780f8
parent 561c4b3a7160f580776f03d34e77234a5da9c18f
Author: Mohammed Sohail <sohailsameja@gmail.com>
Date: Mon, 8 Apr 2024 12:33:34 +0800
feat: add Swap event
Diffstat:
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/solidity/SwapPool.sol b/solidity/SwapPool.sol
@@ -36,6 +36,16 @@ contract SwapPool {
// EIP173
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); // EIP173
+ // Swap
+ event Swap(
+ address indexed initiator,
+ address indexed tokenIn,
+ address tokenOut,
+ uint256 amountIn,
+ uint256 amountOut,
+ uint256 fee
+ );
+
constructor(string memory _name, string memory _symbol, uint8 _decimals, address _tokenRegistry, address _tokenLimiter) {
name = _name;
symbol = _symbol;
@@ -164,6 +174,8 @@ contract SwapPool {
if (feeAddress != address(0)) {
fees[_outToken] += fee;
}
+
+ emit Swap(msg.sender, _inToken, _outToken, _value, outValue, fee);
}
// Withdraw token to fee address