@perk.money/perk-swap-core
Version:
This npm package contains core logic of Perk Aggregator build on top of NEAR blockchain
48 lines (47 loc) • 1.46 kB
TypeScript
import JSBI from 'jsbi';
import { Percentage } from '../../utils';
import { RefFinanceStablePool } from './types';
export declare const calc_d: ({ pool }: {
pool: RefFinanceStablePool;
}) => number;
export declare const calc_y: ({ pool, x_c_amount, tokenInId, tokenOutId, }: {
pool: RefFinanceStablePool;
x_c_amount: number;
tokenInId: string;
tokenOutId: string;
}) => number;
export declare function calc_swap({ pool, tokenInId, tokenOutId, amountIn, }: {
pool: RefFinanceStablePool;
tokenInId: string;
tokenOutId: string;
amountIn: JSBI;
}): [JSBI, JSBI];
export declare function getStableOutputAmount({ tokenInId, tokenOutId, slippage, amountIn, stablePool, }: {
tokenInId: string;
tokenOutId: string;
slippage: Percentage;
amountIn: JSBI;
stablePool: RefFinanceStablePool;
}): {
amountIn: JSBI;
amountOut: JSBI;
minAmountOut: JSBI;
feeAmount: JSBI;
notEnoughLiquidity: boolean;
priceImpact: number;
};
export declare const getStableInputAmount: ({ tokenInId, tokenOutId, amountOut, slippage, stablePool, }: {
tokenInId: string;
tokenOutId: string;
amountOut: JSBI;
slippage: Percentage;
stablePool: RefFinanceStablePool;
}) => {
swapAmountOutDiff: JSBI;
priceImpact: number;
notEnoughLiquidity: boolean;
amountIn: JSBI;
amountOut: JSBI;
minAmountOut: JSBI;
feeAmount: JSBI;
};