Skip to content

Commit

Permalink
fix dynamic loading on pools
Browse files Browse the repository at this point in the history
  • Loading branch information
jankjr committed Feb 18, 2025
1 parent 8f36c54 commit fd2ae9a
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 28 deletions.
1 change: 1 addition & 0 deletions src.ts/Universe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@ export class Universe<const UniverseConf extends Config = Config> {
const id = action.actionId;
if (this.actionById.has(id)) {
this.logger.warn(`Duplicate action: ${id}`)
return this
}
this.actionById.set(id, action)
if (this.allActions.has(action)) {
Expand Down
12 changes: 12 additions & 0 deletions src.ts/configuration/data/base/tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -58205,6 +58205,12 @@
"name": "sAMM-USDC/toby",
"decimals": 18
},
{
"address": "0xb9cdbd0e468d0832514699347b8805e463595217",
"symbol": "vAMM-WETH/CDX",
"name": "vAMM-WETH/CDX",
"decimals": 18
},
{
"address": "0xb9d58811dc1d7597376ff0a86f0b0fdbdda80aba",
"symbol": "vAMM-GO/BAR",
Expand Down Expand Up @@ -60413,6 +60419,12 @@
"name": "Cod3x USD",
"decimals": 18
},
{
"address": "0xc0d3700000c0e32716863323bfd936b54a1633d1",
"symbol": "CDX",
"name": "CDX",
"decimals": 18
},
{
"address": "0xc0ef50cdd2e392e00cc6a98961abefa747bca07d",
"symbol": "vAMM-USBA/🅧",
Expand Down
19 changes: 10 additions & 9 deletions src.ts/configuration/setupBaseZapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,26 +337,27 @@ export const setupBaseZapper = async (universe: BaseUniverse) => {
await Promise.all(
configJson.uniswap.v2.map(async (poolAddr) => {
try {
await uniswapV2Ctx!.loadPool(Address.from(poolAddr.toLowerCase()))
const pool = await uniswapV2Ctx!.loadPool(
Address.from(poolAddr.toLowerCase())
)
universe.addAction(pool.swap01)
universe.addAction(pool.swap10)
} catch (e) {}
})
)
await Promise.all(
configJson.uniswap.v3.map(async (poolAddr) => {
try {
await uniswapV3Ctx!.loadPool(Address.from(poolAddr.toLowerCase()))
const pool = await uniswapV3Ctx!.loadPool(
Address.from(poolAddr.toLowerCase())
)
universe.addAction(pool.swap01)
universe.addAction(pool.swap10)
} catch (e) {
console.log(e)
}
})
)
await Promise.all(
configJson.aerodrome.stableOrVolatile.map(async (poolAddr) => {
try {
await aerodromeCtx!.loadPool(Address.from(poolAddr.toLowerCase()))
} catch (e) {}
})
)
} catch (e) {
logger.error('Failed to load dynamic pool data')
logger.error(e)
Expand Down
18 changes: 1 addition & 17 deletions src.ts/configuration/setupUniswapV3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,7 @@ const configs: Record<ChainId, IUniswapV3Config> = {
router: '0x2626664c2603336e57b271c5c0b26f421741e481',
quoter: '0x3d4e44eb1374240ce5f1b871ab261cd16335b76a',
factory: '0x33128a8fc17869897dce68ed026d694621f6fdfd',
pools: [
'0x130c5bc30567987861620971c6b60c08d3784ef8',
'0x5624a729b13af57cfd7155639dc312d4f0c308b1',
'0x629ae4b2e6254893d56573ae9ab0c909ff9c1e22',
'0x9140d1bc4f976dbcea88575f42d73716054c38bd',
'0xab365f161dd501473a1ff0d2ef0dce94e7398839',
'0xae50c3b3e9be6a836f2fe3c5c8daea5eafaf28b2',
'0xc06926b1ae55a2aeb99a45f27aad24d1eecc1501',
'0xcf77b6cec4e7d7d8c46b6bd098e1eeaa98a648ac',
'0xe207fab5839ca5bcc0d930761755cc7d82c1f19c',
'0xed5210bd97d855e8bec2389439b8487eecc3fc60',
'0xf0454a58ca927a6316ca659e420c2c5b28aaa056',
'0xf511e60cbcc042cb6fe3efdfdf045b784dc0b43c',
'0xfdccd04ddca9ecf052e8e9ef6bd09a9b323fbf49',
'0xfe3816b0deccf83ca11f6da54b108d0a6469ed1b',
'0xba6042ca6fd1f4be67c09bbb5e522e2396a3c7ab',
],
pools: ['0xab7fed603f0e5eb8f46ab58b086631d75cfbe78d'],
staticPools: baseUniV3.map((i) => ({
...i,
feeTier: Number(i.feeTier),
Expand Down
2 changes: 1 addition & 1 deletion src.ts/searcher/TokenFlowGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3706,7 +3706,7 @@ export class TokenFlowGraphSearcher {
}

private doesTradePathExistCache = new Map<string, Promise<boolean>>()
private async doesTradePathExist(inputQty: TokenQuantity, output: Token) {
public async doesTradePathExist(inputQty: TokenQuantity, output: Token) {
const key = `${inputQty.token}.${output}`
let prev = this.doesTradePathExistCache.get(key)
if (prev == null) {
Expand Down
3 changes: 2 additions & 1 deletion test/integration/base.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ const issueanceCases = [
// makeTestCase(5, t.WETH, rTokens.hyUSD),
// makeTestCase(10, t.WETH, rTokens.BSDX),
// makeTestCase(1, t.ETH, t.TEST1),
makeTestCase(0.1, t.WETH, t.ABX),
makeTestCase(0.1, t.WETH, t.BGCI),
makeTestCase(0.1, t.WETH, t.MVDA25),
// makeTestCase(10000, t.USDC, rTokens.BSDX),
]

Expand Down

0 comments on commit fd2ae9a

Please sign in to comment.