hermes-v2-sdk
Version:
⚒️ An SDK for building applications on top of Hermes V2
76 lines (75 loc) • 3.97 kB
TypeScript
import JSBI from 'jsbi';
import { CurrencyAmount, NativeToken, Price } from 'maia-core-sdk';
import { Vault } from '..';
/**
* Represents an ERC4626 ComposableStablePoolWrapper
*/
export declare class ComposableStablePoolWrapper extends Vault {
readonly rate: JSBI;
private _token0Price?;
private _token1Price?;
/**
* Returns the price of the vault token in terms of the underlying token
* @param underlying One of the tokens in the vault, the underlying token
* @param vault The other token in the vault, the vault's address
* @param rate The exchange rate of the underlying token to the vault token
* @returns The price of the vault token in terms of the underlying token
*/
static priceOfVault(underlying: NativeToken, vault: NativeToken, rate: JSBI): Price<NativeToken, NativeToken>;
/**
* Returns the price of the underlying token in terms of the vault token
* @param underlying One of the tokens in the vault, the underlying token
* @param vault The other token in the vault, the vault's address
* @param rate The exchange rate of the underlying token to the vault token
* @returns The price of the underlying token in terms of the vault token
*/
static priceOfUnderlying(underlying: NativeToken, vault: NativeToken, rate: JSBI): Price<NativeToken, NativeToken>;
/**
* Construct a vault
* @param underlying One of the tokens in the vault, the underlying token
* @param vault The other token in the vault, the vault's address
* @param rate The exchange rate of the underlying token to the vault token
*/
constructor(underlying: NativeToken, vault: NativeToken, rate: JSBI);
/**
* Returns the current mid price of the vault in terms of token0, i.e. the ratio of token1 over token0
*/
get token0Price(): Price<NativeToken, NativeToken>;
/**
* Returns the current mid price of the vault in terms of token1, i.e. the ratio of token0 over token1
*/
get token1Price(): Price<NativeToken, NativeToken>;
/**
* Given an input amount of a token, return the computed output amount, and a vault with state updated after the trade
* @param inputAmount The input amount for which to quote the output amount
* @param rate The exchange rate of the underlying token to the vault token
* @returns The output amount and the vault with updated state
* @NOTE Call this when calculating "deposit" and "redeem" amounts
*/
getOutputAmount(inputAmount: CurrencyAmount<NativeToken>, rate?: JSBI): Promise<[CurrencyAmount<NativeToken>, ComposableStablePoolWrapper]>;
/**
* Given a desired output amount of a token, return the computed input amount and a vault with state updated after the trade
* @param outputAmount the output amount for which to quote the input amount
* @param rate The exchange rate of the underlying token to the vault token
* @returns The input amount and the vault with updated state
* @NOTE Call this when calculating "mint" and "withdraw" amounts
*/
getInputAmount(outputAmount: CurrencyAmount<NativeToken>, rate?: JSBI): Promise<[CurrencyAmount<NativeToken>, ComposableStablePoolWrapper]>;
/**
* Given an amount of a token, return the computed amount of the other token and a vault with state updated after the trade
* @param amount The amount for which to quote the other amount
* @param rate The exchange rate of the underlying token to the vault token
* @param roundDown Whether to round down or not
* @returns The other amount and the vault with updated state
*/
private getAmount;
/**
* Returns the price of the underlying token in terms of the vault token
* @param amount
* @param underlying
* @param vault
* @param rate
* @returns
*/
private static getOtherAmount;
}