Skip to content

Commit 49b6dd1

Browse files
committed
handle nested pools
1 parent b599dba commit 49b6dd1

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/mappings/helpers/misc.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { Vault } from '../../types/Vault/Vault';
55
import { ONE_BD, SWAP_IN, SWAP_OUT, VAULT_ADDRESS, ZERO_ADDRESS, ZERO_BD } from './constants';
66
import { PoolType, getPoolAddress, isComposableStablePool } from './pools';
77
import { ComposableStablePool } from '../../types/ComposableStablePoolFactory/ComposableStablePool';
8-
import { WeightedPool } from '../../types/templates/WeightedPool/WeightedPool';
98

109
export function bytesToAddress(address: Bytes): Address {
1110
return Address.fromString(address.toHexString());
@@ -217,11 +216,10 @@ export function createToken(tokenAddress: Address): Token {
217216
if (!maybeSymbol.reverted) symbol = maybeSymbol.value;
218217
if (!maybeDecimals.reverted) decimals = maybeDecimals.value;
219218

220-
let pool = WeightedPool.bind(tokenAddress);
221-
let isPoolCall = pool.try_getPoolId();
222-
if (!isPoolCall.reverted) {
223-
let poolId = isPoolCall.value;
224-
token.pool = poolId.toHexString();
219+
// Check if the token is a pool
220+
let poolModel = Pool.load(tokenAddress.toHexString());
221+
if (poolModel != null) {
222+
token.pool = poolModel.id;
225223
}
226224

227225
token.name = name;

0 commit comments

Comments
 (0)