hermes-v2-sdk
Version:
⚒️ An SDK for building applications on top of Hermes V2
35 lines (34 loc) • 3.56 kB
TypeScript
export declare function _calcOutGivenIn(amp: bigint, balances: bigint[], tokenIndexIn: number, tokenIndexOut: number, amountIn: bigint, fee: bigint): bigint;
export declare function _calcInGivenOut(amp: bigint, balances: bigint[], tokenIndexIn: number, tokenIndexOut: number, amountOut: bigint, fee: bigint): bigint;
/**
* _calcBptOutGivenExactTokensIn
* @param amp Amplification parameter in EVM Scale
* @param balances Token balances in EVM Scale normalised to 18 decimals (Should not have value for BPT token)
* @param amountsIn Token amounts in EVM Scale normalised to 18 decimals (Should not have value for BPT token)
* @param bptTotalSupply BPT total supply in EVM Scale
* @param swapFeePercentage Swap fee percentage in EVM Scale
* @returns BPT out in EVM Scale
*/
export declare function _calcBptOutGivenExactTokensIn(amp: bigint, balances: bigint[], amountsIn: bigint[], bptTotalSupply: bigint, swapFeePercentage: bigint): bigint;
/**
* _calcTokenInGivenExactBptOut
* @param amp Amplification parameter in EVM Scale
* @param balances Token balances in EVM Scale normalised to 18 decimals (Should not have value for BPT token)
* @param tokenIndexIn Index of token in (from tokens array without BPT)
* @param bptAmountOut BPT amount out in EVM scale
* @param bptTotalSupply BPT total supply in EVM Scale
* @param fee Swap fee percentage in EVM Scale
* @returns token in EVM Scale normalised to 18 decimals
*/
export declare function _calcTokenInGivenExactBptOut(amp: bigint, balances: bigint[], tokenIndexIn: number, bptAmountOut: bigint, bptTotalSupply: bigint, fee: bigint): bigint;
export declare function _calcBptInGivenExactTokensOut(amp: bigint, balances: bigint[], amountsOut: bigint[], bptTotalSupply: bigint, swapFeePercentage: bigint): bigint;
export declare function _calcTokenOutGivenExactBptIn(amp: bigint, balances: bigint[], tokenIndex: number, bptAmountIn: bigint, bptTotalSupply: bigint, swapFeePercentage: bigint): bigint;
export declare function _calcTokensOutGivenExactBptIn(balances: bigint[], bptAmountIn: bigint, bptTotalSupply: bigint): bigint[];
export declare function _spotPriceAfterSwapExactTokenInForTokenOut(amp: bigint, balances: bigint[], tokenIndexIn: number, tokenIndexOut: number, amountIn: bigint, fee: bigint): bigint;
export declare function _spotPriceAfterSwapTokenInForExactTokenOut(amp: bigint, balances: bigint[], tokenIndexIn: number, tokenIndexOut: number, amountOut: bigint, fee: bigint): bigint;
export declare function _spotPriceAfterSwapExactTokenInForBPTOut(amp: bigint, balances: bigint[], tokenIndexIn: number, bptTotalSupply: bigint, amountIn: bigint): bigint;
export declare function _spotPriceAfterSwapTokenInForExactBPTOut(amp: bigint, balances: bigint[], tokenIndexIn: number, bptTotalSupply: bigint, amountOut: bigint): bigint;
export declare function _spotPriceAfterSwapExactBPTInForTokenOut(amp: bigint, balances: bigint[], tokenIndexOut: number, bptTotalSupply: bigint, amountIn: bigint): bigint;
export declare function _spotPriceAfterSwapBPTInForExactTokenOut(amp: bigint, balances: bigint[], tokenIndexOut: number, bptTotalSupply: bigint, amountOut: bigint): bigint;
export declare function _poolDerivatives(amp: bigint, balances: bigint[], tokenIndexIn: number, tokenIndexOut: number, is_first_derivative: boolean, wrt_out: boolean): bigint;
export declare function _poolDerivativesBPT(amp: bigint, balances: bigint[], bptSupply: bigint, tokenIndexIn: number, _is_first_derivative: boolean, _is_BPT_out: boolean, _wrt_out: boolean): bigint;