Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
fix(mux): Fix destructure of assets (#3055)
Browse files Browse the repository at this point in the history
  • Loading branch information
immasandwich committed Nov 15, 2023
1 parent 5fc64b8 commit 510da9c
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions src/apps/mux/common/utils.ts
Expand Up @@ -92,23 +92,21 @@ async function getReaderAssets(network: Network, appToolkit: IAppToolkit): Promi
.simulate.getChainStorage()
.then(v => v.result);

return storage[1]
return storage.assets
.filter(item => item.tokenAddress !== ZERO_ADDRESS)
.map(a => {
return {
symbol: ethers.utils.parseBytes32String(a.symbol),
id: a.id,
tokenAddress: a.tokenAddress,
decimals: a.decimals,
isStable: test64(a.flags.toNumber(), ASSET_IS_STABLE),
isTradable: test64(a.flags.toNumber(), ASSET_IS_TRADABLE),
isOpenable: test64(a.flags.toNumber(), ASSET_IS_OPENABLE),
useStableTokenForProfit: test64(a.flags.toNumber(), ASSET_USE_STABLE_TOKEN_FOR_PROFIT),
isEnabled: test64(a.flags.toNumber(), ASSET_IS_ENABLED),
minProfitTime: a.minProfitTime,
minProfitRate: fromRate(a.minProfitRate),
};
});
.map(a => ({
symbol: ethers.utils.parseBytes32String(a.symbol),
id: a.id,
tokenAddress: a.tokenAddress,
decimals: a.decimals,
isStable: test64(Number(a.flags), ASSET_IS_STABLE),
isTradable: test64(Number(a.flags), ASSET_IS_TRADABLE),
isOpenable: test64(Number(a.flags), ASSET_IS_OPENABLE),
useStableTokenForProfit: test64(Number(a.flags), ASSET_USE_STABLE_TOKEN_FOR_PROFIT),
isEnabled: test64(Number(a.flags), ASSET_IS_ENABLED),
minProfitTime: a.minProfitTime,
minProfitRate: fromRate(a.minProfitRate),
}));
}

export async function getMarketTokensByNetwork(network: Network, appToolkit: IAppToolkit): Promise<MuxBaseToken[]> {
Expand Down

0 comments on commit 510da9c

Please sign in to comment.