Skip to content

Commit

Permalink
add fee and details types
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdev3 committed Jul 16, 2024
1 parent abe6e1b commit 3893574
Showing 1 changed file with 69 additions and 42 deletions.
111 changes: 69 additions & 42 deletions src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Dex, DexName } from "../dexes";
import { FeeCost, GasCost } from "../fees";
import { QuoteAction } from "../quote";
import { ChainCall, SquidData } from "../squid";
import { Token } from "../tokens";
import { Token, Volatility } from "../tokens";
import { WrapDirection, WrapperType } from "../wrappers";
import { BridgeType } from "../bridges";

Expand Down Expand Up @@ -97,6 +97,7 @@ export enum ActionType {
BRIDGE = "bridge",
IBC_TRANSFER = "ibc-transfer",
CUSTOM = "custom",
FEE = "fee",
}

export interface WrapDetails {
Expand Down Expand Up @@ -157,6 +158,17 @@ export interface CustomCallDetails {
calls: ChainCall[];
}

export interface Integrator {
id: string;
projectName: string;
contact: string;
contactName: string;
type: string;
website: string;
rps: number;
enabled: boolean;
}

export enum FEES_ENUM {
PLATFORM = "PLATFORM",
INTEGRATOR = "INTEGRATOR",
Expand All @@ -165,48 +177,63 @@ export enum FEES_ENUM {
TIER = "TIER",
}

export interface PlatformFee {
type: FEES_ENUM.PLATFORM;
flat: number;
percentage: number;
enabled: boolean;
address: string;
}

export interface IntegratorFee {
type: FEES_ENUM.INTEGRATOR;
flat: number;
percentage: number;
flat2?: number;
percentage2?: number;
squidFlat: number;
squidPercentage: number;
enabled: boolean;
waivePlatformFee: boolean;
address: string;
address2?: string;
integrator?: Integrator;
}

export interface ChainFee {
type: FEES_ENUM.CHAIN;
flat: number;
percentage: number;
enabled: boolean;
waivePlatformFee: boolean;
chain?: ChainData;
}

export interface TokenFee {
type: FEES_ENUM.TOKEN;
flat: number;
percentage: number;
enabled: boolean;
waivePlatformFee: boolean;
token?: Token;
}

export interface TierFee {
type: FEES_ENUM.TIER;
tier: Volatility;
flat: number;
percentage: number;
enabled: boolean;
waivePlatformFee: boolean;
}

export interface FeeDetails {
platformFee: {
type: FEES_ENUM.PLATFORM;
flat: number;
percentage: number;
enabled: boolean;
address: string;
};
integratorFee: {
type: FEES_ENUM.INTEGRATOR;
flat: number;
percentage: number;
flat2?: number;
percentage2?: number;
squidFlat: number;
squidPercentage: number;
enabled: boolean;
waivePlatformFee: boolean;
address: string;
address2?: string;
};
chainFee: {
type: FEES_ENUM.CHAIN;
flat: number;
percentage: number;
enabled: boolean;
waivePlatformFee: boolean;
};
tokenFee: {
type: FEES_ENUM.TOKEN;
flat: number;
percentage: number;
enabled: boolean;
waivePlatformFee: boolean;
};
tierFee: {
type: FEES_ENUM.TIER;
flat: number;
percentage: number;
enabled: boolean;
waivePlatformFee: boolean;
};
calls?: ChainCall[];
platformFee: PlatformFee;
integratorFee: IntegratorFee;
chainFee: ChainFee;
tokenFee: TokenFee;
tierFee: TierFee;
totalFeeAmount: bigint;
platformFeeAmount: bigint;
integratorFeeAmount: bigint;
Expand Down

0 comments on commit 3893574

Please sign in to comment.