@swaptoshi/dex-module
Version:
Klayr decentralized exchange (dex) on-chain module
54 lines (53 loc) • 3.01 kB
TypeScript
import { Modules, Types } from 'klayr-framework';
import { Uint24String, Uint256String, Uint160String, Uint64String } from '../library/int';
import { DexNFTAttribute, ImmutableSwapContext, MutableSwapContext, NFTMetadata, PositionManager, CollectParams, DecreaseLiquidityParams, IncreaseLiquidityParams, MintParams, DexModuleConfig, TokenMethod, NFTMethod } from '../../types';
import { DEXPool } from './pool';
export declare class NonfungiblePositionManager {
constructor(positionManager: PositionManager, stores: Modules.NamedRegistry, events: Modules.NamedRegistry, genesisConfig: Types.GenesisConfig, dexConfig: DexModuleConfig, moduleName: string);
toJSON(): PositionManager;
addMutableDependencies(context: MutableSwapContext, tokenMethod: TokenMethod, nftMethod: NFTMethod): void;
addImmutableDependencies(context: ImmutableSwapContext, tokenMethod: TokenMethod, nftMethod: NFTMethod): void;
setSender(senderAddress: Buffer): void;
createAndInitializePoolIfNecessary(token0: Buffer, token0Symbol: string, token0Decimal: number, token1: Buffer, token1Symbol: string, token1Decimal: number, fee: Uint24String, sqrtPriceX96: Uint160String): Promise<DEXPool>;
getPositions(tokenId: Uint64String): Promise<DexNFTAttribute>;
mint(params: MintParams): Promise<[tokenId: string, liquidity: string, amount0: string, amount1: string]>;
increaseLiquidity(params: IncreaseLiquidityParams): Promise<[liquidity: string, amount0: string, amount1: string]>;
decreaseLiquidity(params: DecreaseLiquidityParams): Promise<[amount0: string, amount1: string]>;
collect(params: CollectParams): Promise<[amount0: string, amount1: string]>;
burn(tokenId: Uint64String): Promise<void>;
tokenURI(tokenId: Uint64String): Promise<string>;
getMetadata(tokenId: Uint64String): Promise<NFTMetadata>;
total(tokenId: Uint256String, sqrtRatioX96: Uint160String): Promise<[amount0: string, amount1: string]>;
principal(tokenId: Uint256String, sqrtRatioX96: Uint160String): Promise<[amount0: string, amount1: string]>;
fees(tokenId: Uint256String): Promise<[amount0: string, amount1: string]>;
private _fees;
private _getFeeGrowthInside;
private _metadataToIPFS;
private _saveTokenURI;
private _savePosition;
private _checkImmutableDependency;
private _checkMutableDependency;
private _pay;
private _mintCallback;
private _checkDeadline;
private _addLiquidity;
private _isAuthorizedForToken;
collectionId: Buffer;
poolAddress: Buffer;
name: string;
symbol: string;
address: Buffer;
private readonly moduleName;
private readonly chainId;
private readonly events;
private readonly poolStore;
private readonly tokenSymbolStore;
private readonly positionInfoStore;
private readonly dexConfig;
private mutableContext;
private immutableContext;
private tokenMethod;
private nftMethod;
private mutableDependencyReady;
private immutableDependencyReady;
}