hermes-v2-sdk
Version:
⚒️ An SDK for building applications on top of Hermes V2
67 lines (66 loc) • 3.02 kB
TypeScript
import { CurrencyAmount, NativeToken, Percent, Price } from 'maia-core-sdk';
/**
* Represents an ERC4626 vault.
*/
export declare abstract class Vault {
readonly token0: NativeToken;
readonly token1: NativeToken;
readonly vaultIsToken0: boolean;
readonly fee: Percent;
static getAddress(underlying: NativeToken, initCodeHashManualOverride?: string, factoryAddressOverride?: string): string;
/**
* 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 fee The fee in hundredths of a bips of the input amount of every swap that is collected by the vault
*/
constructor(underlying: NativeToken, vault: NativeToken, fee?: Percent);
/**
* Returns the vault token
* @returns The vault token
*/
vault(): NativeToken;
/**
* Returns the underlying token
* @returns The underlying token
*/
underlying(): NativeToken;
/**
* Returns true if the token is either token0 or token1
* @param token The token to check
* @returns True if token is either token0 or token
*/
involvesToken(token: NativeToken): boolean;
/**
* Returns the current mid price of the vault in terms of token0, i.e. the ratio of token1 over token0
*/
abstract 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
*/
abstract get token1Price(): Price<NativeToken, NativeToken>;
/**
* Return the price of the given token in terms of the other token in the vault.
* @param token The token to return price of
* @returns The price of the given token, in terms of the other.
*/
priceOf(token: NativeToken): Price<NativeToken, NativeToken>;
/**
* Returns the chain ID of the tokens in the vault.
*/
get chainId(): number;
/**
* 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
* @returns The output amount and the vault with updated state
* @NOTE Call this when calculating "deposit" and "redeem" amounts
*/
abstract getOutputAmount(inputAmount: CurrencyAmount<NativeToken>): Promise<[CurrencyAmount<NativeToken>, Vault]>;
/**
* 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
* @returns The input amount and the vault with updated state
* @NOTE Call this when calculating "mint" and "withdraw" amounts
*/
abstract getInputAmount(outputAmount: CurrencyAmount<NativeToken>): Promise<[CurrencyAmount<NativeToken>, Vault]>;
}