Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions dexs/kalshi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,29 @@ async function fetch(_a: any, _b: any, options: FetchOptions) {
),
market_report_agg AS (
SELECT
SUM(CASE WHEN status = 'active' THEN open_interest ELSE 0 END) AS open_interest
SUM(CASE WHEN status = 'active' THEN open_interest ELSE 0 END) AS open_interest,
SUM(daily_volume) AS notional_volume
FROM kalshi.market_report
WHERE date = '${dateString}'
)
SELECT
tr.cash_volume,
mr.open_interest
mr.open_interest,
mr.notional_volume
FROM trade_report_agg tr
CROSS JOIN market_report_agg mr
`
const data: {
cash_volume: string,
open_interest: string
open_interest: string,
notional_volume: string,
}[] = await queryDuneSql(options, query)

const dailyVolume = Number(data[0]?.cash_volume) || 0
const openInterestAtEnd = Number(data[0]?.open_interest) || 0
const dailyNotionalVolume = Number(data[0]?.notional_volume) || 0

return { dailyVolume, openInterestAtEnd }
return { dailyVolume, openInterestAtEnd, dailyNotionalVolume }
}

const adapter: SimpleAdapter = {
Expand Down
27 changes: 20 additions & 7 deletions dexs/limitless-exchange/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,20 @@ const contracts = {
FEE_MODULE: "0x6d8a7d1898306ca129a74c296d14e55e20aae87d",
NEG_RISK_FEE_MODULE: "0x73fc1b1395ba964fea8705bff7ef8ea5c23cc661",

CTF_EXCHANGE_V2: "0xf1de958f8641448a5ba78c01f434085385af096d",
NEG_RISK_CTF_EXCHANGE_V2: "0x46e607d3f4a8494b0ab9b304d1463e2f4848891d",
FEE_MODULE_V2: "0xEECD2Cf0FF29D712648fC328be4EE02FC7931c7A",
NEG_RISK_FEE_MODULE_V2: "0x18B3E1192c01286050A0994Bc26f7226Ae4A483d",

// new main exchanges
CTF_EXCHANGE_V2: "0x05c748e2f4dcde0ec9fa8ddc40de6b867f923fa5",
NEG_RISK_CTF_EXCHANGE_V2: "0xe3e00ba3a9888d1de4834269f62ac008b4bb5c47",
FEE_MODULE_V2: "0x5130c2c398F930c4f43B15635410047cBEa9D6EB",
NEG_RISK_FEE_MODULE_V2: "0xfeb646D32a2A558359419a1C9c5dfb47fD92dADb",
CTF_EXCHANGE_V3: "0x05c748e2f4dcde0ec9fa8ddc40de6b867f923fa5",
NEG_RISK_CTF_EXCHANGE_V3: "0xe3e00ba3a9888d1de4834269f62ac008b4bb5c47",
FEE_MODULE_V3: "0x5130c2c398F930c4f43B15635410047cBEa9D6EB",
NEG_RISK_FEE_MODULE_V3: "0xfeb646D32a2A558359419a1C9c5dfb47fD92dADb",

WRAPPED_COLLATERAL_1: "0x5d6C6a4fEA600E0b1A3Ab3eF711060310E27886A",
WRAPPED_COLLATERAL_2: "0x8f4fA186E00E376a9054968a03172cfa1c2EedfE",
WRAPPED_COLLATERAL_3: "0x81140765fcf9D3a66CD9AA11cb972F9e07bc5deA",

CONDITIONAL_TOKENS: "0xC9c98965297Bc527861c898329Ee280632B76e18",
FEE_RECIPIENT: "0x88eaf31f9fE392002e0E818527f8259af92287b1",
Expand All @@ -34,16 +40,19 @@ const abi = {
ORDERS_MATCHED: 'event OrdersMatched (bytes32 indexed takerOrderHash, address indexed takerOrderMaker, uint256 makerAssetId, uint256 takerAssetId, uint256 makerAmountFilled, uint256 takerAmountFilled)',
};

async function fetch(options: FetchOptions) {
async function fetch(_a: any, _b: any, options: FetchOptions) {
const dailyVolume = options.createBalances();
const dailyFees = options.createBalances();
const dailyNotionalVolume = options.createBalances();
const fpmmMarkets: any[] = [];

const exchangeTargets = [
contracts.CTF_EXCHANGE,
contracts.NEG_RISK_CTF_EXCHANGE,
contracts.CTF_EXCHANGE_V2,
contracts.NEG_RISK_CTF_EXCHANGE_V2,
contracts.CTF_EXCHANGE_V3,
contracts.NEG_RISK_CTF_EXCHANGE_V3,
];

const marketCreationLogs = await options.getLogs({
Expand All @@ -70,11 +79,13 @@ async function fetch(options: FetchOptions) {
const collateralToken = fpmmMarketMap[log.address.toLowerCase()]
if (!collateralToken) return;
dailyVolume.addToken(collateralToken, log.args.investmentAmount);
dailyNotionalVolume.addToken(collateralToken, log.args.outcomeTokensBought);
})
sellLogs.forEach(log => {
const collateralToken = fpmmMarketMap[log.address.toLowerCase()]
if (!collateralToken) return;
dailyVolume.addToken(collateralToken, log.args.returnAmount);
dailyNotionalVolume.addToken(collateralToken, log.args.outcomeTokensSold);
})

const orderMatchedLogs = await options.getLogs({
Expand All @@ -86,13 +97,15 @@ async function fetch(options: FetchOptions) {
const { makerAssetId, makerAmountFilled, takerAmountFilled } = order;
const makerIdStr = makerAssetId?.toString?.() ?? String(makerAssetId);
const tradeVolume = makerIdStr === '0' ? makerAmountFilled : takerAmountFilled;
const notionalTradeVolume = makerIdStr === '0' ? takerAmountFilled : makerAmountFilled;
dailyVolume.addToken(ADDRESSES.base.USDC, tradeVolume);
dailyNotionalVolume.addToken(ADDRESSES.base.USDC, notionalTradeVolume);
});

await addTokensReceived({
options,
balances: dailyFees,
fromAdddesses: [contracts.CONDITIONAL_TOKENS, contracts.FEE_MODULE, contracts.FEE_MODULE_V2, contracts.WRAPPED_COLLATERAL_1, contracts.WRAPPED_COLLATERAL_2, contracts.NEG_RISK_FEE_MODULE, contracts.NEG_RISK_FEE_MODULE_V2],
fromAdddesses: [contracts.CONDITIONAL_TOKENS, contracts.FEE_MODULE, contracts.FEE_MODULE_V2, contracts.FEE_MODULE_V3, contracts.WRAPPED_COLLATERAL_1,contracts.WRAPPED_COLLATERAL_2, contracts.WRAPPED_COLLATERAL_3, contracts.NEG_RISK_FEE_MODULE, contracts.NEG_RISK_FEE_MODULE_V2, contracts.NEG_RISK_FEE_MODULE_V3],
target: contracts.FEE_RECIPIENT,
token: ADDRESSES.base.USDC
});
Expand All @@ -103,6 +116,7 @@ async function fetch(options: FetchOptions) {
dailyRevenue: dailyFees,
dailyProtocolRevenue: dailyFees,
dailyHoldersRevenue: 0,
dailyNotionalVolume,
};
}

Expand All @@ -114,7 +128,6 @@ const methodology = {
};

const adapter: SimpleAdapter = {
version: 2,
fetch,
chains: [CHAIN.BASE],
methodology,
Expand Down
4 changes: 4 additions & 0 deletions dexs/opinion/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ async function fetch(options: FetchOptions): Promise<FetchResult> {
const dailyVolume = options.createBalances()
const tradeFees = options.createBalances()
const rebateFees = options.createBalances()
const dailyNotionalVolume = options.createBalances()

const orderFilledLogs = await options.getLogs({
eventAbi: ORDER_FILLED_EVENT,
Expand All @@ -86,7 +87,9 @@ async function fetch(options: FetchOptions): Promise<FetchResult> {
}

const tradeVolume = Number(order.makerAssetId == 0 ? order.makerAmountFilled : order.takerAmountFilled) / 1e18
const notionalVolume = Number(order.makerAssetId == 0 ? order.takerAmountFilled : order.makerAmountFilled) / 1e18
dailyVolume.addUSDValue(Number(tradeVolume) / 2)
dailyNotionalVolume.addUSDValue(notionalVolume / 2)
})

rebateEarnedLogs.forEach((log: any) => {
Expand All @@ -102,6 +105,7 @@ async function fetch(options: FetchOptions): Promise<FetchResult> {
dailyFees,
dailyRevenue: dailyFees,
dailyProtocolRevenue: dailyFees,
dailyNotionalVolume,
}
}

Expand Down
24 changes: 22 additions & 2 deletions dexs/pancakeswap-prediction/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ const EVENT_ABI = {
async function fetch(options: FetchOptions) {
const dailyVolume = options.createBalances();
const dailyFees = options.createBalances();
const dailyNotionalVolume = options.createBalances();

const epochData: Map<number, { bullAmount: bigint; bearAmount: bigint }> = new Map();

const bullLogs = await options.getLogs({
target: PCS_BNB_PREDICTION_CONTRACT,
Expand All @@ -20,6 +23,10 @@ async function fetch(options: FetchOptions) {

bullLogs.forEach(bet => {
dailyVolume.add(ADDRESSES.bsc.WBNB, bet.amount);
const epoch = bet.epoch;
const data = epochData.get(epoch) || { bullAmount: 0n, bearAmount: 0n };
data.bullAmount += BigInt(bet.amount);
epochData.set(epoch, data);
});

const bearLogs = await options.getLogs({
Expand All @@ -29,6 +36,10 @@ async function fetch(options: FetchOptions) {

bearLogs.forEach(bet => {
dailyVolume.add(ADDRESSES.bsc.WBNB, bet.amount);
const epoch = bet.epoch;
const data = epochData.get(epoch) || { bullAmount: 0n, bearAmount: 0n };
data.bearAmount += BigInt(bet.amount);
epochData.set(epoch, data);
});

const rewardLogs = await options.getLogs({
Expand All @@ -40,11 +51,20 @@ async function fetch(options: FetchOptions) {
dailyFees.add(ADDRESSES.bsc.WBNB, reward.treasuryAmount);
});

return {
epochData.forEach(({ bullAmount, bearAmount }) => {
if (bullAmount > 0n && bearAmount > 0n) {
const total = bullAmount + bearAmount;
const notional = (total * (bullAmount * bullAmount + bearAmount * bearAmount)) / (bullAmount * bearAmount);
dailyNotionalVolume.add(ADDRESSES.bsc.WBNB, notional);
}
});

return {
dailyVolume,
dailyFees,
dailyRevenue: dailyFees,
dailyProtocolRevenue:0,
dailyNotionalVolume,
dailyProtocolRevenue: 0,
dailyHoldersRevenue: dailyFees,
};
}
Expand Down
30 changes: 21 additions & 9 deletions dexs/polymarket/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,18 @@ const fetch = async (_a: any, _b: any, options: FetchOptions) => {
select * from market_data
)
SELECT
SUM(volume_usd) as total_volume_usd
SUM(volume_usd) as total_volume_usd,
SUM(notional_volume) as total_notional_volume
FROM (
SELECT
SUM(CASE
SUM(CASE
WHEN makerAssetId = 0 THEN makerAmountFilled
WHEN takerAssetId = 0 THEN takerAmountFilled
END) / 1e6 as volume_usd
WHEN takerAssetId = 0 THEN takerAmountFilled
END) / 1e6 as volume_usd,
SUM(CASE
WHEN makerAssetId = 0 THEN takerAmountFilled
WHEN takerAssetId = 0 THEN makerAmountFilled
END) / 1e6 as notional_volume
FROM polymarket_polygon.NegRiskCtfExchange_evt_OrderFilled b
where b.evt_block_number > 50505492
and evt_block_time >= from_unixtime(${options.startTimestamp})
Expand All @@ -64,10 +69,14 @@ const fetch = async (_a: any, _b: any, options: FetchOptions) => {
UNION ALL

SELECT
SUM(CASE
SUM(CASE
WHEN makerAssetId = 0 THEN makerAmountFilled
WHEN takerAssetId = 0 THEN takerAmountFilled
END) / 1e6 as volume_usd
WHEN takerAssetId = 0 THEN takerAmountFilled
END) / 1e6 as volume_usd,
SUM(CASE
WHEN makerAssetId = 0 THEN takerAmountFilled
WHEN takerAssetId = 0 THEN makerAmountFilled
END) / 1e6 as notional_volume
FROM polymarket_polygon.CTFExchange_evt_OrderFilled a
where a.evt_block_number > 33605403
and evt_block_time >= from_unixtime(${options.startTimestamp})
Expand All @@ -76,7 +85,8 @@ const fetch = async (_a: any, _b: any, options: FetchOptions) => {
UNION ALL

select
bytearray_to_uint256(substr(pl.DATA, 1, 32)) / 1e6 as volume_usd
bytearray_to_uint256(substr(pl.DATA, 1, 32)) / 1e6 as volume_usd,
bytearray_to_uint256(substr(pl.DATA, 65, 96)) / 1e6 as notional_volume
from
polygon.logs pl
left join polymarket_market_data md on pl.contract_address = md.market_maker_address
Expand All @@ -97,12 +107,14 @@ const fetch = async (_a: any, _b: any, options: FetchOptions) => {
options.api.log(data);

const dailyVolume = options.createBalances();
const dailyNotionalVolume = options.createBalances();

// Polymarket emits two OrderFilled events per trade (maker + taker), so summing them directly double-counts volume. Dividing by 2 converts this into true one-sided volume. This also normalizes swaps and merge/split fills, where maker and taker amounts can differ but still represent the same underlying trade, preventing inflated totals

dailyVolume.addUSDValue(data[0].total_volume_usd / 2);
dailyNotionalVolume.addUSDValue(data[0].total_notional_volume/2);

Comment on lines 109 to 116
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Guard against null/undefined totals from Dune.
If total_volume_usd or total_notional_volume is null/undefined for a day, the current division yields NaN. Consider defaulting to 0 before addUSDValue.

Proposed fix
-  dailyVolume.addUSDValue(data[0].total_volume_usd / 2);
-  dailyNotionalVolume.addUSDValue(data[0].total_notional_volume/2);
+  const totalVolume = Number(data[0]?.total_volume_usd) || 0;
+  const totalNotional = Number(data[0]?.total_notional_volume) || 0;
+  dailyVolume.addUSDValue(totalVolume / 2);
+  dailyNotionalVolume.addUSDValue(totalNotional / 2);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const dailyVolume = options.createBalances();
const dailyNotionalVolume = options.createBalances();
// Polymarket emits two OrderFilled events per trade (maker + taker), so summing them directly double-counts volume. Dividing by 2 converts this into true one-sided volume. This also normalizes swaps and merge/split fills, where maker and taker amounts can differ but still represent the same underlying trade, preventing inflated totals
dailyVolume.addUSDValue(data[0].total_volume_usd / 2);
dailyNotionalVolume.addUSDValue(data[0].total_notional_volume/2);
const dailyVolume = options.createBalances();
const dailyNotionalVolume = options.createBalances();
// Polymarket emits two OrderFilled events per trade (maker + taker), so summing them directly double-counts volume. Dividing by 2 converts this into true one-sided volume. This also normalizes swaps and merge/split fills, where maker and taker amounts can differ but still represent the same underlying trade, preventing inflated totals
const totalVolume = Number(data[0]?.total_volume_usd) || 0;
const totalNotional = Number(data[0]?.total_notional_volume) || 0;
dailyVolume.addUSDValue(totalVolume / 2);
dailyNotionalVolume.addUSDValue(totalNotional / 2);
🤖 Prompt for AI Agents
In `@dexs/polymarket/index.ts` around lines 109 - 116, Guard against
null/undefined Dune totals by defaulting to 0 before dividing and calling
addUSDValue: when updating dailyVolume and dailyNotionalVolume, coalesce
data[0].total_volume_usd and data[0].total_notional_volume to 0 (e.g., via a
nullish check) before dividing by 2 and passing to addUSDValue so NaN cannot be
produced; update the sites where dailyVolume.addUSDValue(...) and
dailyNotionalVolume.addUSDValue(...) are called to use the safe default values
instead.

return { dailyVolume }
return { dailyVolume, dailyNotionalVolume }
}

const adapters: SimpleAdapter = {
Expand Down
7 changes: 4 additions & 3 deletions dexs/predict-fun/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ const EXCHANGE_CONTRACT_ADDRESSES = [

const USDT_ADDRESS = "0x55d398326f99059fF775485246999027B3197955";

const fetch = async (options: FetchOptions) => {
const { dailyVolume } = await getPolymarketVolume({ options, exchanges: EXCHANGE_CONTRACT_ADDRESSES, currency: USDT_ADDRESS });
const fetch = async (_a: any, _b: any, options: FetchOptions) => {
const { dailyVolume, dailyNotionalVolume } = await getPolymarketVolume({ options, exchanges: EXCHANGE_CONTRACT_ADDRESSES, currency: USDT_ADDRESS });

return {
dailyVolume,
dailyNotionalVolume,
};
};

const adapter: SimpleAdapter = {
version: 2,
version: 1, //too slow for version 2
adapter: {
[CHAIN.BSC]: {
fetch,
Expand Down
7 changes: 4 additions & 3 deletions dexs/probable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ import { getPolymarketVolume } from "../helpers/polymarket";
const EXCHANGE_CONTRACT_ADDRESS = "0xf99f5367ce708c66f0860b77b4331301a5597c86";
const USDT_ADDRESS = "0x55d398326f99059fF775485246999027B3197955";

const fetch = async (options: FetchOptions) => {
const { dailyVolume } = await getPolymarketVolume({ options, exchanges: [EXCHANGE_CONTRACT_ADDRESS], currency: USDT_ADDRESS });
const fetch = async (_a: any, _b: any, options: FetchOptions) => {
const { dailyVolume, dailyNotionalVolume } = await getPolymarketVolume({ options, exchanges: [EXCHANGE_CONTRACT_ADDRESS], currency: USDT_ADDRESS });

return {
dailyVolume,
dailyFees: 0, // no fees
dailyNotionalVolume
};
};

const adapter: SimpleAdapter = {
version: 2,
version: 1, //too slow for version 2
adapter: {
[CHAIN.BSC]: {
fetch,
Expand Down
7 changes: 5 additions & 2 deletions dexs/rain-one/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const poolTokenSetEvent =

const fetch = async (options: FetchOptions) => {
const dailyVolume = options.createBalances();
const dailyNotionalVolume = options.createBalances();

const poolCreationLogs = await options.api.getLogs({
target: rainFactory,
Expand Down Expand Up @@ -62,9 +63,11 @@ const fetch = async (options: FetchOptions) => {
token: usdt,
decimals: 6,
};
dailyVolume.addToken(tokenInfo?.token, log.args.baseAmount);
if(!tokenInfo?.token) return;
dailyVolume.addToken(tokenInfo.token, log.args.baseAmount);
dailyNotionalVolume.addToken(tokenInfo.token, log.args.optionAmount);
});
return { dailyVolume };
return { dailyVolume, dailyNotionalVolume };
};

const methodology = {
Expand Down
15 changes: 10 additions & 5 deletions fees/myriadmarkets/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FetchOptions, SimpleAdapter } from "../../adapters/types";
import { CHAIN } from "../../helpers/chains";

const MARKETS = {
const MARKETS:any = {
[CHAIN.ABSTRACT]: '0x3e0F5F8F5Fb043aBFA475C0308417Bf72c463289',
[CHAIN.LINEA]: '0x39e66ee6b2ddaf4defded3038e0162180dbef340',
[CHAIN.BSC]: '0x39e66ee6b2ddaf4defded3038e0162180dbef340',
Expand All @@ -19,24 +19,27 @@ async function fetch({ createBalances, chain, api, getLogs }: FetchOptions) {
const dailyFees = createBalances();
const dailySupplySideRevenue = createBalances();
const dailyRevenue = createBalances();
const dailyNotionalVolume = createBalances();

const markets = await api.call({ abi: 'uint256[]:getMarkets', target: market });
const marketData = await api.multiCall({ target: market, abi: abi.getMarketAltData, calls: markets })
const marketFees = (await api.multiCall({ target: market, abi: abi.getMarketFees, calls: markets }))
const marketMapping: any = {}
markets.forEach((val, idx) => marketMapping[val] = {
markets.forEach((val:any, idx:any) => marketMapping[val] = {
token: marketData[idx].token,
fees: marketFees[idx]
})
Comment on lines 27 to 31
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find the file
fd -t f "index.ts" | grep -E "fees.*myriadmarkets"

Repository: DefiLlama/dimension-adapters

Length of output: 99


🏁 Script executed:

#!/bin/bash
# Check if the file exists and read the relevant lines
if [ -f "fees/myriadmarkets/index.ts" ]; then
  echo "File exists. Reading lines 20-35 for context:"
  sed -n '20,35p' fees/myriadmarkets/index.ts | cat -n
else
  echo "File not found at fees/myriadmarkets/index.ts. Searching..."
  find . -name "index.ts" -path "*myriad*" 2>/dev/null
fi

Repository: DefiLlama/dimension-adapters

Length of output: 913


🏁 Script executed:

#!/bin/bash
# Check for biome configuration
ls -la | grep -i biome || echo "No biome config in root"
find . -name "biome.json" -o -name "biome.toml" 2>/dev/null | head -5

Repository: DefiLlama/dimension-adapters

Length of output: 148


🏁 Script executed:

#!/bin/bash
# Read the biome configuration
cat biome.json

Repository: DefiLlama/dimension-adapters

Length of output: 1847


🌐 Web query:

Biome forEach arrow function return statement lint rule

💡 Result:

Biome’s lint rule for “return statements inside forEach callbacks” is:

  • lint/suspicious/useIterableCallbackReturn (recommended / on by default since Biome v2.0.0) (biomejs.dev)

What it enforces:

  • For methods like map, filter, find, etc., the callback must consistently return a value. (biomejs.dev)
  • For forEach, a return value is disallowed (because forEach ignores returned values). (biomejs.dev)

Example that triggers it:

arr.forEach(() => {
  return 1; // flagged: should not return a value
});

(biomejs.dev)

Fix patterns:

  • Remove the returned value (or the return entirely), or if you need an early-exit style, use a loop (for...of) instead. (biomejs.dev)

Config:

{
  "linter": {
    "rules": {
      "suspicious": {
        "useIterableCallbackReturn": "error"
      }
    }
  }
}

(biomejs.dev)

Citations:


Fix forEach callback to satisfy useIterableCallbackReturn lint.
Line 9 uses an expression body that implicitly returns a value from forEach. Biome's useIterableCallbackReturn rule flags this since forEach ignores returned values. Switch to a block body to avoid the implicit return.

Proposed fix
-  markets.forEach((val:any, idx:any) => marketMapping[val] = {
-    token: marketData[idx].token,
-    fees: marketFees[idx]
-  })
+  markets.forEach((val: any, idx: any) => {
+    marketMapping[val] = {
+      token: marketData[idx].token,
+      fees: marketFees[idx],
+    }
+  })
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const marketMapping: any = {}
markets.forEach((val, idx) => marketMapping[val] = {
markets.forEach((val:any, idx:any) => marketMapping[val] = {
token: marketData[idx].token,
fees: marketFees[idx]
})
const marketMapping: any = {}
markets.forEach((val: any, idx: any) => {
marketMapping[val] = {
token: marketData[idx].token,
fees: marketFees[idx],
}
})
🧰 Tools
🪛 Biome (2.3.13)

[error] 28-28: This callback passed to forEach() iterable method should not return a value.

Either remove this return or remove the returned value.

(lint/suspicious/useIterableCallbackReturn)

🤖 Prompt for AI Agents
In `@fees/myriadmarkets/index.ts` around lines 27 - 31, The forEach callback for
building marketMapping currently uses an expression body which implicitly
returns a value; change the arrow to use a block body so it does not return
anything. Specifically, update the markets.forEach((val:any, idx:any) =>
marketMapping[val] = { token: marketData[idx].token, fees: marketFees[idx] }) to
markets.forEach((val:any, idx:any) => { marketMapping[val] = { token:
marketData[idx].token, fees: marketFees[idx] }; }); keeping the same identifiers
(marketMapping, markets, marketData, marketFees) and types.


marketFees.forEach(i => {
i.buyFees = i.buyFees.map(j => Number(j) / 1e18)
i.buyFees = i.buyFees.map((j:any) => Number(j) / 1e18)
})
const tradeLogs = await getLogs({ target: market, eventAbi: abi.MarketActionTx, });

tradeLogs.forEach(({ action, marketId, value }) => {
tradeLogs.forEach(({ action, marketId, value, shares }) => {
value = Number(value)
action = Number(action)
shares = Number(shares)

const { fees, token } = marketMapping[marketId]
const isBuy = action === 0
const feeKey = isBuy ? 'buyFees' : 'sellFees'
Expand All @@ -47,6 +50,7 @@ async function fetch({ createBalances, chain, api, getLogs }: FetchOptions) {
case 0: // buy
case 1: // sell
dailyVolume.add(token, value);
dailyNotionalVolume.add(token, shares);
dailyFees.add(token, value * totalFee, isBuy ? 'BuyFee' : 'SellFee')
dailySupplySideRevenue.add(token, value * distributorFee, 'DistributorFee')
dailySupplySideRevenue.add(token, value * fee, 'LPFee')
Expand All @@ -58,9 +62,10 @@ async function fetch({ createBalances, chain, api, getLogs }: FetchOptions) {

return {
dailyVolume,
dailyNotionalVolume,
dailyFees,
dailyRevenue,
dailyProtocolRevenue: dailyRevenue.clone(),
dailyProtocolRevenue: dailyRevenue,
dailyHoldersRevenue: 0,
dailySupplySideRevenue
};
Expand Down
Loading
Loading