@@ -4,9 +4,11 @@ pragma solidity ^0.8.22;
44import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol " ;
55import {IERC20 } from "forge-std/interfaces/IERC20.sol " ;
66import {IERC1155Receiver } from "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol " ;
7+ import {Strings} from "@openzeppelin/contracts/utils/Strings.sol " ;
78import {CTHelpers} from "@lay3rlabs/conditional-tokens-contracts/CTHelpers.sol " ;
89import {ConditionalTokens} from "@lay3rlabs/conditional-tokens-contracts/ConditionalTokens.sol " ;
910import {Whitelist} from "./Whitelist.sol " ;
11+ import {Interaction} from "./IIndexedEvents.sol " ;
1012
1113abstract contract MarketMaker is Ownable , IERC1155Receiver {
1214 /*
@@ -168,10 +170,13 @@ abstract contract MarketMaker is Ownable, IERC1155Receiver {
168170 // Calculate net cost for executing trade
169171 int256 outcomeTokenNetCost = calcNetCost (outcomeTokenAmounts);
170172 int256 fees;
173+ string memory tradeType;
171174 if (outcomeTokenNetCost < 0 ) {
172175 fees = int256 (calcMarketFee (uint256 (- outcomeTokenNetCost)));
176+ tradeType = "sell " ;
173177 } else {
174178 fees = int256 (calcMarketFee (uint256 (outcomeTokenNetCost)));
179+ tradeType = "buy " ;
175180 }
176181
177182 require (fees >= 0 );
@@ -225,6 +230,11 @@ abstract contract MarketMaker is Ownable, IERC1155Receiver {
225230 if (netCost < 0 ) {
226231 require (collateralToken.transfer (msg .sender , uint256 (- netCost)));
227232 }
233+
234+ string [] memory tags = new string [](2 );
235+ tags[0 ] = string .concat ("tradeType: " , tradeType);
236+ tags[1 ] = string .concat ("collateralToken: " , Strings.toHexString (address (collateralToken)));
237+ emit Interaction (msg .sender , "prediction_market_trade " , tags, abi.encode (outcomeTokenAmounts, outcomeTokenNetCost, uint256 (fees)));
228238 }
229239
230240 /// @dev Calculates fee to be paid to market maker
0 commit comments