Skip to content

Commit

Permalink
track omaxswap volume
Browse files Browse the repository at this point in the history
  • Loading branch information
g1nt0ki committed Mar 13, 2024
1 parent 10fd4af commit 7151afb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions helpers/uniswap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import { ethers } from "ethers";

export async function filterPools({ api, pairs, createBalances }: { api: ChainApi, pairs: IJSON<string[]>, createBalances: any }): Promise<IJSON<number>> {
const balanceCalls = Object.entries(pairs).map(([pair, tokens]) => tokens.map(i => ({ target: i, params: pair }))).flat()
const res = await api.multiCall({ abi: 'erc20:balanceOf', calls: balanceCalls })
const res = await api.multiCall({ abi: 'erc20:balanceOf', calls: balanceCalls, permitFailure: true, })
const balances: Balances = createBalances()
const pairBalances: IJSON<Balances> = {}
res.forEach((bal, i) => {
balances.add(balanceCalls[i].target, bal)
if (!pairBalances[balanceCalls[i].params]) {
pairBalances[balanceCalls[i].params] = createBalances()
}
pairBalances[balanceCalls[i].params].add(balanceCalls[i].target, bal)
pairBalances[balanceCalls[i].params].add(balanceCalls[i].target, bal ?? 0)
})
// we do this to cache price results
await balances.getUSDValue()
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions protocols/omax-swap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { uniV2Exports } from "../helpers/uniswap";

export default uniV2Exports({
omax: {
factory: '0x441b9333D1D1ccAd27f2755e69d24E60c9d8F9CF',
}
})

0 comments on commit 7151afb

Please sign in to comment.