Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D/W: check all denoms with lower case #3799

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions packages/bridge/src/ibc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ export class IbcBridgeProvider implements BridgeProvider {
try {
const assetListAsset = this.ctx.assetLists
.flatMap((list) => list.assets)
.find((a) => a.coinMinimalDenom === asset.address);
.find(
(a) =>
a.coinMinimalDenom.toLowerCase() === asset.address.toLowerCase()
);

const ibcTransferMethod = assetListAsset?.transferMethods.find(
({ type }) => type === "ibc"
Expand Down Expand Up @@ -224,7 +227,9 @@ export class IbcBridgeProvider implements BridgeProvider {
// try to get asset list fee asset first, or otherwise the chain fee currency
const assetListAsset = this.ctx.assetLists
.flatMap(({ assets }) => assets)
.find((asset) => asset.coinMinimalDenom.toLowerCase() === denom);
.find(
(asset) => asset.coinMinimalDenom.toLowerCase() === denom.toLowerCase()
);

if (assetListAsset) {
return {
Expand All @@ -238,7 +243,8 @@ export class IbcBridgeProvider implements BridgeProvider {
const chains = await this.getChains();
const chain = chains.find((c) => c.chain_id === fromChainId);
const feeCurrency = chain?.feeCurrencies.find(
({ chainSuggestionDenom }) => chainSuggestionDenom === denom
({ chainSuggestionDenom }) =>
chainSuggestionDenom.toLowerCase() === denom.toLowerCase()
);

if (feeCurrency) {
Expand Down
5 changes: 4 additions & 1 deletion packages/bridge/src/nitro/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ export class NitroBridgeProvider implements BridgeProvider {
const setTokenParam = (asset: BridgeAsset, param: string) => {
if (asset.address.includes("alloyed")) {
const assets = this.ctx.assetLists.flatMap(({ assets }) => assets);
const alloy = assets.find((a) => a.coinMinimalDenom === asset.address);
const alloy = assets.find(
(a) =>
a.coinMinimalDenom.toLowerCase() === asset.address.toLowerCase()
);
const variant = assets.find(
(a) =>
a.variantGroupKey === alloy?.variantGroupKey &&
Expand Down
5 changes: 4 additions & 1 deletion packages/bridge/src/squid/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,10 @@ export class SquidBridgeProvider implements BridgeProvider {
// asset list counterparties
const assetListAsset = this.ctx.assetLists
.flatMap(({ assets }) => assets)
.find((a) => a.coinMinimalDenom === asset.address);
.find(
(a) =>
a.coinMinimalDenom.toLowerCase() === asset.address.toLowerCase()
);

for (const counterparty of assetListAsset?.counterparty ?? []) {
// check if supported by squid
Expand Down
11 changes: 2 additions & 9 deletions packages/pools/src/router/__tests__/pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
RoutablePool,
Route,
RouteWithInAmount,
TokenOutGivenInRouter,
} from "..";

// Mock RoutablePool for testing purposes
Expand Down Expand Up @@ -82,10 +81,7 @@ export const makeMockRoutablePool = (
*/

// Mock OptimizedRoutes for testing purposes to get access to protected methods
export class TestOptimizedRoutes
extends OptimizedRoutes
implements TokenOutGivenInRouter
{
export class TestOptimizedRoutes extends OptimizedRoutes {
constructor(...args: ConstructorParameters<typeof OptimizedRoutes>) {
super(...args);
}
Expand Down Expand Up @@ -125,10 +121,7 @@ export function makeDefaultTestRouterParams(
return new TestOptimizedRoutes(params);
}

export class RoutesTestOptimizedRoutes
extends OptimizedRoutes
implements TokenOutGivenInRouter
{
export class RoutesTestOptimizedRoutes extends OptimizedRoutes {
private testRoutes: Route[];

constructor(
Expand Down
11 changes: 2 additions & 9 deletions packages/pools/src/router/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,7 @@ import {
RouteWithInAmount,
validateRoute,
} from "./route";
import {
Logger,
Quote,
RoutablePool,
SplitTokenInQuote,
Token,
TokenOutGivenInRouter,
} from "./types";
import { Logger, Quote, RoutablePool, SplitTokenInQuote, Token } from "./types";
import {
cacheKeyForTokenOutGivenIn,
invertRoute,
Expand Down Expand Up @@ -60,7 +53,7 @@ export type OptimizedRoutesParams = {
* @throws NotEnoughLiquidityError if there is not enough liquidity in a route.
* @throws NoRouteError if there is no route between the tokens.
*/
export class OptimizedRoutes implements TokenOutGivenInRouter {
export class OptimizedRoutes {
protected readonly _sortedPools: RoutablePool[];
protected readonly _preferredPoolIds?: string[];
protected readonly _getPoolTotalValueLocked: (poolId: string) => Dec;
Expand Down
9 changes: 0 additions & 9 deletions packages/pools/src/router/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@ export type Token = {
amount: Int;
};

export interface TokenOutGivenInRouter {
/** Route, with splits, given an in token and out denom. */
routeByTokenIn(
tokenIn: Token,
tokenOutDenom: string,
forcePoolId?: string
): Promise<SplitTokenInQuote>;
}

export interface RoutablePool {
/** Unique identifier across pools. */
id: string;
Expand Down
1 change: 0 additions & 1 deletion packages/server/src/queries/complex/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ export * from "./osmosis";
export * from "./pools";
export * from "./portfolio";
export * from "./staking";
export * from "./swap-routers";
export * from "./transactions";
1 change: 0 additions & 1 deletion packages/server/src/queries/complex/pools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ export * from "./bonding";
export * from "./env";
export * from "./incentives";
export * from "./providers";
export * from "./route-token-out-given-in";
export * from "./share";
export * from "./superfluid";
export * from "./transmuter";
Expand Down
Loading
Loading