Skip to content

Commit

Permalink
code refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
g1nt0ki committed Nov 21, 2024
1 parent af51bc9 commit 98d7b4b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 28 deletions.
13 changes: 0 additions & 13 deletions .envrc

This file was deleted.

29 changes: 14 additions & 15 deletions dexs/mach/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { FetchOptions, SimpleAdapter } from "../../adapters/types";
import { CHAIN } from "../../helpers/chains";

import { DEPLOYMENTS } from "./deployments.ts";

Expand All @@ -14,31 +13,31 @@ import { DEPLOYMENTS } from "./deployments.ts";
const EVENT_MATCH_EXECUTED = "event MatchExecuted(address indexed bonder, (address srcAsset, address dstAsset, uint32 dstLzc) direction, uint32 srcIndex, uint32 dstIndex, uint96 srcQuantity, uint96 dstQuantity, address taker, bool isWrapped)";

async function fetch({ chain, getLogs, createBalances }: FetchOptions) {
const address = DEPLOYMENTS[chain].address;
const address = DEPLOYMENTS[chain].address;

const logs = await getLogs({
target: address,
eventAbi: EVENT_MATCH_EXECUTED,
})
const logs = await getLogs({
target: address,
eventAbi: EVENT_MATCH_EXECUTED,
})

const dailyVolume = createBalances()
const dailyVolume = createBalances()

for (const log of logs) {
dailyVolume.add(log.direction.srcAsset, log.srcQuantity)
}
for (const log of logs) {
dailyVolume.add(log.direction.srcAsset, log.srcQuantity)
}

return { dailyVolume }
return { dailyVolume }
}

const adapters = {}

for (const [chain, deployment] of Object.entries(DEPLOYMENTS)) {
adapters[chain] = { fetch, deployment }
for (const [chain, { start }] of Object.entries(DEPLOYMENTS)) {
adapters[chain] = { fetch, start }
}

const adapter: SimpleAdapter = {
version: 2,
adapter: adapters,
version: 2,
adapter: adapters,
}

export default adapter;

0 comments on commit 98d7b4b

Please sign in to comment.