@galacticcouncil/sdk-next 0.10.0-pr206-70b5b04 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.cjs +1 -1
- package/build/index.mjs +1 -1
- package/build/types/farm/LiquidityMiningApi.d.ts +2 -2
- package/build/types/farm/RewardClaimSimulator.d.ts +2 -2
- package/build/types/farm/types.d.ts +3 -1
- package/build/types/gho/GhoTokenClient.d.ts +6 -0
- package/build/types/gho/abi.d.ts +124 -0
- package/build/types/gho/index.d.ts +2 -0
- package/build/types/pool/PoolClient.d.ts +2 -2
- package/build/types/pool/PoolContextProvider.d.ts +6 -2
- package/build/types/pool/aave/AavePool.d.ts +1 -1
- package/build/types/pool/hsm/HsmMath.d.ts +21 -0
- package/build/types/pool/hsm/HsmPool.d.ts +51 -0
- package/build/types/pool/hsm/HsmPoolClient.d.ts +24 -0
- package/build/types/pool/hsm/index.d.ts +3 -0
- package/build/types/pool/hsm/types.d.ts +7 -0
- package/build/types/pool/index.d.ts +3 -2
- package/build/types/pool/lbp/LbpPool.d.ts +1 -1
- package/build/types/pool/omni/OmniPool.d.ts +1 -1
- package/build/types/pool/stable/StableSwap.d.ts +1 -1
- package/build/types/pool/types.d.ts +8 -2
- package/build/types/pool/xyk/XykPool.d.ts +1 -1
- package/build/types/sor/Router.d.ts +1 -0
- package/build/types/sor/TradeRouter.d.ts +1 -1
- package/package.json +2 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FarmDepositReward,
|
|
1
|
+
import { FarmDepositReward, YieldFarmEntry, GlobalFarm, YieldFarm } from './types';
|
|
2
2
|
import { MultiCurrencyContainer } from './MultiCurrencyContainer';
|
|
3
3
|
export declare class RewardClaimSimulator {
|
|
4
4
|
protected getAccount: (sub: number) => string;
|
|
@@ -12,5 +12,5 @@ export declare class RewardClaimSimulator {
|
|
|
12
12
|
syncGlobalFarm(globalFarm: GlobalFarm, currentPeriod: number, oraclePrice: bigint): Promise<GlobalFarm | null>;
|
|
13
13
|
syncYieldFarm(yieldFarm: YieldFarm, globalFarm: GlobalFarm, currentPeriod: number): YieldFarm | null;
|
|
14
14
|
getLoyaltyMultiplier(periods: number, loyaltyCurve: YieldFarm['loyalty_curve']): string;
|
|
15
|
-
claimRewards(globalFarm: GlobalFarm, yieldFarm: YieldFarm, farmEntry:
|
|
15
|
+
claimRewards(globalFarm: GlobalFarm, yieldFarm: YieldFarm, farmEntry: YieldFarmEntry, relaychainBlockNumber: number, oraclePrice: bigint): Promise<FarmDepositReward | null>;
|
|
16
16
|
}
|
|
@@ -5,7 +5,7 @@ export type ISolatedYieldFarm = HydrationQueries['XYKWarehouseLM']['YieldFarm'][
|
|
|
5
5
|
export type OmnipoolGlobalFarm = HydrationQueries['OmnipoolWarehouseLM']['GlobalFarm']['Value'];
|
|
6
6
|
export type OmnipoolYieldFarm = HydrationQueries['OmnipoolWarehouseLM']['YieldFarm']['Value'];
|
|
7
7
|
export type OmnipoolWarehouseLMDeposit = HydrationQueries['OmnipoolWarehouseLM']['Deposit']['Value'];
|
|
8
|
-
export type
|
|
8
|
+
export type YieldFarmEntry = OmnipoolWarehouseLMDeposit['yield_farm_entries'][number] | HydrationQueries['XYKWarehouseLM']['Deposit']['Value']['yield_farm_entries'][number];
|
|
9
9
|
export type OmnipoolFarm = {
|
|
10
10
|
id: string;
|
|
11
11
|
globalFarm: OmnipoolGlobalFarm;
|
|
@@ -20,6 +20,8 @@ export type FarmDepositReward = {
|
|
|
20
20
|
readonly reward: bigint;
|
|
21
21
|
readonly maxReward: bigint;
|
|
22
22
|
readonly assetId: number;
|
|
23
|
+
readonly yieldFarmId: number;
|
|
24
|
+
readonly isActiveFarm: boolean;
|
|
23
25
|
};
|
|
24
26
|
export type Farm = {
|
|
25
27
|
apr: string;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export declare const GHO_TOKEN_ABI: readonly [{
|
|
2
|
+
readonly inputs: readonly [{
|
|
3
|
+
readonly internalType: "address";
|
|
4
|
+
readonly name: "facilitator";
|
|
5
|
+
readonly type: "address";
|
|
6
|
+
}];
|
|
7
|
+
readonly name: "getFacilitator";
|
|
8
|
+
readonly outputs: readonly [{
|
|
9
|
+
readonly type: "tuple";
|
|
10
|
+
readonly components: readonly [{
|
|
11
|
+
readonly name: "addr";
|
|
12
|
+
readonly type: "address";
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "label";
|
|
15
|
+
readonly type: "bytes32";
|
|
16
|
+
}, {
|
|
17
|
+
readonly name: "bucketCapacity";
|
|
18
|
+
readonly type: "uint128";
|
|
19
|
+
}, {
|
|
20
|
+
readonly name: "bucketLevel";
|
|
21
|
+
readonly type: "uint128";
|
|
22
|
+
}];
|
|
23
|
+
}];
|
|
24
|
+
readonly stateMutability: "view";
|
|
25
|
+
readonly type: "function";
|
|
26
|
+
}, {
|
|
27
|
+
readonly inputs: readonly [{
|
|
28
|
+
readonly internalType: "address";
|
|
29
|
+
readonly name: "facilitator";
|
|
30
|
+
readonly type: "address";
|
|
31
|
+
}];
|
|
32
|
+
readonly name: "getFacilitatorBucket";
|
|
33
|
+
readonly outputs: readonly [{
|
|
34
|
+
readonly internalType: "uint256";
|
|
35
|
+
readonly name: "";
|
|
36
|
+
readonly type: "uint256";
|
|
37
|
+
}, {
|
|
38
|
+
readonly internalType: "uint256";
|
|
39
|
+
readonly name: "";
|
|
40
|
+
readonly type: "uint256";
|
|
41
|
+
}];
|
|
42
|
+
readonly stateMutability: "view";
|
|
43
|
+
readonly type: "function";
|
|
44
|
+
}, {
|
|
45
|
+
readonly inputs: readonly [];
|
|
46
|
+
readonly name: "getFacilitatorsList";
|
|
47
|
+
readonly outputs: readonly [{
|
|
48
|
+
readonly internalType: "address[]";
|
|
49
|
+
readonly name: "";
|
|
50
|
+
readonly type: "address[]";
|
|
51
|
+
}];
|
|
52
|
+
readonly stateMutability: "view";
|
|
53
|
+
readonly type: "function";
|
|
54
|
+
}, {
|
|
55
|
+
readonly anonymous: false;
|
|
56
|
+
readonly inputs: readonly [{
|
|
57
|
+
readonly indexed: true;
|
|
58
|
+
readonly internalType: "address";
|
|
59
|
+
readonly name: "facilitatorAddress";
|
|
60
|
+
readonly type: "address";
|
|
61
|
+
}, {
|
|
62
|
+
readonly indexed: true;
|
|
63
|
+
readonly internalType: "bytes32";
|
|
64
|
+
readonly name: "label";
|
|
65
|
+
readonly type: "bytes32";
|
|
66
|
+
}, {
|
|
67
|
+
readonly indexed: false;
|
|
68
|
+
readonly internalType: "uint256";
|
|
69
|
+
readonly name: "bucketCapacity";
|
|
70
|
+
readonly type: "uint256";
|
|
71
|
+
}];
|
|
72
|
+
readonly name: "FacilitatorAdded";
|
|
73
|
+
readonly type: "event";
|
|
74
|
+
}, {
|
|
75
|
+
readonly anonymous: false;
|
|
76
|
+
readonly inputs: readonly [{
|
|
77
|
+
readonly indexed: true;
|
|
78
|
+
readonly internalType: "address";
|
|
79
|
+
readonly name: "facilitatorAddress";
|
|
80
|
+
readonly type: "address";
|
|
81
|
+
}, {
|
|
82
|
+
readonly indexed: false;
|
|
83
|
+
readonly internalType: "uint256";
|
|
84
|
+
readonly name: "oldCapacity";
|
|
85
|
+
readonly type: "uint256";
|
|
86
|
+
}, {
|
|
87
|
+
readonly indexed: false;
|
|
88
|
+
readonly internalType: "uint256";
|
|
89
|
+
readonly name: "newCapacity";
|
|
90
|
+
readonly type: "uint256";
|
|
91
|
+
}];
|
|
92
|
+
readonly name: "FacilitatorBucketCapacityUpdated";
|
|
93
|
+
readonly type: "event";
|
|
94
|
+
}, {
|
|
95
|
+
readonly anonymous: false;
|
|
96
|
+
readonly inputs: readonly [{
|
|
97
|
+
readonly indexed: true;
|
|
98
|
+
readonly internalType: "address";
|
|
99
|
+
readonly name: "facilitatorAddress";
|
|
100
|
+
readonly type: "address";
|
|
101
|
+
}, {
|
|
102
|
+
readonly indexed: false;
|
|
103
|
+
readonly internalType: "uint256";
|
|
104
|
+
readonly name: "oldLevel";
|
|
105
|
+
readonly type: "uint256";
|
|
106
|
+
}, {
|
|
107
|
+
readonly indexed: false;
|
|
108
|
+
readonly internalType: "uint256";
|
|
109
|
+
readonly name: "newLevel";
|
|
110
|
+
readonly type: "uint256";
|
|
111
|
+
}];
|
|
112
|
+
readonly name: "FacilitatorBucketLevelUpdated";
|
|
113
|
+
readonly type: "event";
|
|
114
|
+
}, {
|
|
115
|
+
readonly anonymous: false;
|
|
116
|
+
readonly inputs: readonly [{
|
|
117
|
+
readonly indexed: true;
|
|
118
|
+
readonly internalType: "address";
|
|
119
|
+
readonly name: "facilitatorAddress";
|
|
120
|
+
readonly type: "address";
|
|
121
|
+
}];
|
|
122
|
+
readonly name: "FacilitatorRemoved";
|
|
123
|
+
readonly type: "event";
|
|
124
|
+
}];
|
|
@@ -22,8 +22,8 @@ export declare abstract class PoolClient<T extends PoolBase> extends BalanceClie
|
|
|
22
22
|
getSubscriber(): Observable<T[]>;
|
|
23
23
|
private subscribeStore;
|
|
24
24
|
protected subscribeBalances(): Subscription;
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
protected hasSystemAsset(pool: T): boolean;
|
|
26
|
+
protected hasErc20Asset(pool: PoolBase): boolean;
|
|
27
27
|
private hasValidAssets;
|
|
28
28
|
private updateBalances;
|
|
29
29
|
}
|
|
@@ -2,6 +2,7 @@ import { PolkadotClient } from 'polkadot-api';
|
|
|
2
2
|
import { Papi } from '../api';
|
|
3
3
|
import { EvmClient } from '../evm';
|
|
4
4
|
import { AavePoolClient } from './aave';
|
|
5
|
+
import { HsmPoolClient } from './hsm';
|
|
5
6
|
import { LbpPoolClient } from './lbp';
|
|
6
7
|
import { OmniPoolClient } from './omni';
|
|
7
8
|
import { XykPoolClient } from './xyk';
|
|
@@ -12,6 +13,7 @@ export declare class PoolContextProvider extends Papi implements IPoolCtxProvide
|
|
|
12
13
|
readonly aave: AavePoolClient;
|
|
13
14
|
readonly omnipool: OmniPoolClient;
|
|
14
15
|
readonly stableswap: StableSwapClient;
|
|
16
|
+
readonly hsm: HsmPoolClient;
|
|
15
17
|
readonly xyk: XykPoolClient;
|
|
16
18
|
readonly lbp: LbpPoolClient;
|
|
17
19
|
private readonly active;
|
|
@@ -20,17 +22,19 @@ export declare class PoolContextProvider extends Papi implements IPoolCtxProvide
|
|
|
20
22
|
private aaveSub;
|
|
21
23
|
private omniSub;
|
|
22
24
|
private stableSub;
|
|
25
|
+
private hsmSub;
|
|
23
26
|
private xykSub;
|
|
24
27
|
private lbpSub;
|
|
25
28
|
private isReady;
|
|
26
29
|
private isDestroyed;
|
|
27
30
|
constructor(client: PolkadotClient, evm: EvmClient);
|
|
28
31
|
private subscribe;
|
|
32
|
+
withAave(): this;
|
|
29
33
|
withOmnipool(): this;
|
|
30
34
|
withStableswap(): this;
|
|
31
|
-
|
|
32
|
-
withAave(): this;
|
|
35
|
+
withHsm(): this;
|
|
33
36
|
withXyk(override?: PoolTokenOverride[]): this;
|
|
37
|
+
withLbp(): this;
|
|
34
38
|
destroy(): void;
|
|
35
39
|
getPools(): Promise<PoolBase[]>;
|
|
36
40
|
getPoolFees(poolPair: PoolPair, pool: Pool): Promise<PoolFees>;
|
|
@@ -11,7 +11,7 @@ export declare class AavePool implements Pool {
|
|
|
11
11
|
maxOutRatio: bigint;
|
|
12
12
|
minTradingLimit: bigint;
|
|
13
13
|
static fromPool(pool: PoolBase): AavePool;
|
|
14
|
-
constructor(
|
|
14
|
+
constructor(pool: PoolBase);
|
|
15
15
|
validatePair(_tokenIn: number, _tokenOut: number): boolean;
|
|
16
16
|
parsePair(tokenIn: number, tokenOut: number): PoolPair;
|
|
17
17
|
validateAndBuy(poolPair: PoolPair, amountOut: bigint, _fees: PoolFees): BuyCtx;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare class HsmMath {
|
|
2
|
+
static calculateCollateralInGivenHollarOut(amountOut: string, collateralPeg: string, purchaseFee: string): string;
|
|
3
|
+
static calculateCollateralOutGivenHollarIn(amountIn: string, executionPrice: string, buybackFee: string): string;
|
|
4
|
+
static calculateHollarOutGivenCollateralIn(amountIn: string, collateralPeg: string, purchaseFee: string): string;
|
|
5
|
+
static calculateHollarInGivenCollateralOut(amountOut: string, executionPrice: string, buybackFee: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* I_i = (H_i - peg_i * R_i) / 2
|
|
8
|
+
*
|
|
9
|
+
* If hollar reserve is less than pegged collateral, we're considering zero imbalance
|
|
10
|
+
* as we only care about positive imbalance (excess Hollar in the pool
|
|
11
|
+
*
|
|
12
|
+
* @param hollarReserve
|
|
13
|
+
* @param collateralPeg
|
|
14
|
+
* @param collateralReserve
|
|
15
|
+
* @returns pool imbalance or 0 if hollar reserve is less than pegged collateral
|
|
16
|
+
*/
|
|
17
|
+
static calculateImbalance(hollarReserve: string, collateralPeg: string, collateralReserve: string): string;
|
|
18
|
+
static calculateBuybackLimit(imbalance: string, buybackRate: string): string;
|
|
19
|
+
static calculateBuybackPriceWithFee(executionPriceNum: string, executionPriceDen: string, buyBackFee: string): string;
|
|
20
|
+
static calculateMaxPrice(collateralPeg: string, coeficient: string): string;
|
|
21
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { BuyCtx, PoolError, PoolFee, PoolPair, SellCtx } from '../types';
|
|
2
|
+
import { StableSwap, StableSwapBase, StableSwapPair } from '../stable';
|
|
3
|
+
export type HsmPoolBase = StableSwapBase & {
|
|
4
|
+
hsmAddress: string;
|
|
5
|
+
hsmMintCapacity: bigint;
|
|
6
|
+
hollarId: number;
|
|
7
|
+
hollarH160: string;
|
|
8
|
+
collateralId: number;
|
|
9
|
+
collateralBalance: bigint;
|
|
10
|
+
maxBuyPriceCoefficient: bigint;
|
|
11
|
+
maxInHolding: bigint;
|
|
12
|
+
purchaseFee: PoolFee;
|
|
13
|
+
buyBackFee: PoolFee;
|
|
14
|
+
buyBackRate: PoolFee;
|
|
15
|
+
};
|
|
16
|
+
export declare class HsmPool extends StableSwap {
|
|
17
|
+
hsmAddress: string;
|
|
18
|
+
hsmMintCapacity: bigint;
|
|
19
|
+
hollarId: number;
|
|
20
|
+
hollarH160: string;
|
|
21
|
+
collateralId: number;
|
|
22
|
+
collateralBalance: bigint;
|
|
23
|
+
maxBuyPriceCoefficient: bigint;
|
|
24
|
+
maxInHolding: bigint;
|
|
25
|
+
purchaseFee: PoolFee;
|
|
26
|
+
buyBackFee: PoolFee;
|
|
27
|
+
buyBackRate: PoolFee;
|
|
28
|
+
static fromPool(pool: HsmPoolBase): HsmPool;
|
|
29
|
+
constructor(pool: HsmPoolBase);
|
|
30
|
+
validatePair(_tokenIn: number, _tokenOut: number): boolean;
|
|
31
|
+
parsePair(tokenIn: number, tokenOut: number): StableSwapPair;
|
|
32
|
+
validateTradeHollarIn(poolPair: PoolPair, amountIn: bigint, amountOut: bigint, errors: PoolError[]): PoolError[];
|
|
33
|
+
validateTradeHollarOut(amountIn: bigint, amountOut: bigint, errors: PoolError[]): PoolError[];
|
|
34
|
+
validateTradeConstraints(poolPair: PoolPair, amountIn: bigint, amountOut: bigint): PoolError[];
|
|
35
|
+
validateAndBuy(poolPair: PoolPair, amountOut: bigint): BuyCtx;
|
|
36
|
+
validateAndSell(poolPair: PoolPair, amountIn: bigint): SellCtx;
|
|
37
|
+
private calculateHollarInGivenCollateralOut;
|
|
38
|
+
private calculateCollateralInGivenHollarOut;
|
|
39
|
+
calculateInGivenOut(poolPair: PoolPair, amountOut: bigint): bigint;
|
|
40
|
+
private calculateCollateralOutGivenHollarIn;
|
|
41
|
+
private calculateHollarOutGivenCollateralIn;
|
|
42
|
+
calculateOutGivenIn(poolPair: PoolPair, amountIn: bigint): bigint;
|
|
43
|
+
private calculateImbalance;
|
|
44
|
+
private calculateBuybackLimit;
|
|
45
|
+
private calculateBuyPrice;
|
|
46
|
+
private calculateMaxPrice;
|
|
47
|
+
spotPriceInGivenOut(poolPair: PoolPair): bigint;
|
|
48
|
+
spotPriceOutGivenIn(poolPair: PoolPair): bigint;
|
|
49
|
+
private getCollateralPeg;
|
|
50
|
+
private isDefaultPeg;
|
|
51
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PolkadotClient } from 'polkadot-api';
|
|
2
|
+
import { Subscription } from 'rxjs';
|
|
3
|
+
import { PoolClient } from '../PoolClient';
|
|
4
|
+
import { StableSwapClient } from '../stable';
|
|
5
|
+
import { PoolFees, PoolType } from '../types';
|
|
6
|
+
import { EvmClient } from '../../evm';
|
|
7
|
+
import { HsmPoolBase } from './HsmPool';
|
|
8
|
+
export declare class HsmPoolClient extends PoolClient<HsmPoolBase> {
|
|
9
|
+
private ghoClient;
|
|
10
|
+
private stableClient;
|
|
11
|
+
constructor(client: PolkadotClient, evm: EvmClient, stableClient: StableSwapClient);
|
|
12
|
+
getPoolType(): PoolType;
|
|
13
|
+
private getPoolId;
|
|
14
|
+
private getFacilitatorAddress;
|
|
15
|
+
private getHollarAddress;
|
|
16
|
+
private getPoolAddress;
|
|
17
|
+
isSupported(): Promise<boolean>;
|
|
18
|
+
loadPools(): Promise<HsmPoolBase[]>;
|
|
19
|
+
getPoolFees(): Promise<PoolFees>;
|
|
20
|
+
private parseEvmLog;
|
|
21
|
+
private subscribeEvmLog;
|
|
22
|
+
protected subscribeBalances(): Subscription;
|
|
23
|
+
protected subscribeUpdates(): Subscription;
|
|
24
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { PoolFactory } from './PoolFactory';
|
|
2
2
|
export { PoolContextProvider } from './PoolContextProvider';
|
|
3
3
|
export * as aave from './aave';
|
|
4
|
-
export * as xyk from './xyk';
|
|
5
4
|
export * as omni from './omni';
|
|
6
|
-
export * as lbp from './lbp';
|
|
7
5
|
export * as stable from './stable';
|
|
6
|
+
export * as hsm from './hsm';
|
|
7
|
+
export * as xyk from './xyk';
|
|
8
|
+
export * as lbp from './lbp';
|
|
8
9
|
export * from './types';
|
|
@@ -24,7 +24,7 @@ export declare class LbpPool implements Pool {
|
|
|
24
24
|
fee: PoolFee;
|
|
25
25
|
repayFeeApply: boolean;
|
|
26
26
|
static fromPool(pool: LbpPoolBase): LbpPool;
|
|
27
|
-
constructor(
|
|
27
|
+
constructor(pool: LbpPoolBase);
|
|
28
28
|
validatePair(_tokenIn: number, _tokenOut: number): boolean;
|
|
29
29
|
parsePair(tokenIn: number, tokenOut: number): WeightedPoolPair;
|
|
30
30
|
/**
|
|
@@ -29,7 +29,7 @@ export declare class OmniPool implements Pool {
|
|
|
29
29
|
minTradingLimit: bigint;
|
|
30
30
|
hubAssetId: number;
|
|
31
31
|
static fromPool(pool: OmniPoolBase): OmniPool;
|
|
32
|
-
constructor(
|
|
32
|
+
constructor(pool: OmniPoolBase);
|
|
33
33
|
validatePair(_tokenIn: number, tokenOut: number): boolean;
|
|
34
34
|
parsePair(tokenIn: number, tokenOut: number): OmniPoolPair;
|
|
35
35
|
validateAndBuy(poolPair: OmniPoolPair, amountOut: bigint, fees: OmniPoolFees): BuyCtx;
|
|
@@ -28,7 +28,7 @@ export declare class StableSwap implements Pool {
|
|
|
28
28
|
totalIssuance: bigint;
|
|
29
29
|
pegs: string[][];
|
|
30
30
|
static fromPool(pool: StableSwapBase): StableSwap;
|
|
31
|
-
constructor(
|
|
31
|
+
constructor(pool: StableSwapBase);
|
|
32
32
|
validatePair(_tokenIn: number, _tokenOut: number): boolean;
|
|
33
33
|
parsePair(tokenIn: number, tokenOut: number): StableSwapPair;
|
|
34
34
|
validateAndBuy(poolPair: StableSwapPair, amountOut: bigint, fees: StableSwapFees): BuyCtx;
|
|
@@ -8,14 +8,20 @@ export declare enum PoolType {
|
|
|
8
8
|
LBP = "LBP",
|
|
9
9
|
Omni = "Omnipool",
|
|
10
10
|
Stable = "Stableswap",
|
|
11
|
-
XYK = "XYK"
|
|
11
|
+
XYK = "XYK",
|
|
12
|
+
HSM = "HSM"
|
|
12
13
|
}
|
|
13
14
|
export declare enum PoolError {
|
|
15
|
+
UnknownError = "UnknownError",
|
|
16
|
+
FacilitatorCapacityExceeded = "FacilitatorCapacityExceeded",
|
|
14
17
|
InsufficientTradingAmount = "InsufficientTradingAmount",
|
|
18
|
+
InsufficientCollateral = "InsufficientCollateral",
|
|
19
|
+
MaxHoldingExceeded = "MaxHoldingExceeded",
|
|
15
20
|
MaxInRatioExceeded = "MaxInRatioExceeded",
|
|
16
21
|
MaxOutRatioExceeded = "MaxOutRatioExceeded",
|
|
17
22
|
TradeNotAllowed = "TradeNotAllowed",
|
|
18
|
-
|
|
23
|
+
MaxBuyBackExceeded = "MaxBuyBackExceeded",
|
|
24
|
+
MaxBuyPriceExceeded = "MaxBuyPriceExceeded"
|
|
19
25
|
}
|
|
20
26
|
export interface PoolPair {
|
|
21
27
|
assetIn: number;
|
|
@@ -10,7 +10,7 @@ export declare class XykPool implements Pool {
|
|
|
10
10
|
maxOutRatio: bigint;
|
|
11
11
|
minTradingLimit: bigint;
|
|
12
12
|
static fromPool(pool: PoolBase): XykPool;
|
|
13
|
-
constructor(
|
|
13
|
+
constructor(pool: PoolBase);
|
|
14
14
|
validatePair(_tokenIn: number, _tokenOut: number): boolean;
|
|
15
15
|
parsePair(tokenIn: number, tokenOut: number): PoolPair;
|
|
16
16
|
validateAndBuy(poolPair: PoolPair, amountOut: bigint, fees: XykPoolFees): BuyCtx;
|
|
@@ -6,6 +6,7 @@ export declare class Router {
|
|
|
6
6
|
private filter;
|
|
7
7
|
constructor(ctx: IPoolCtxProvider);
|
|
8
8
|
withFilter(filter?: PoolFilter): Promise<void>;
|
|
9
|
+
protected onFilterChanged(): void;
|
|
9
10
|
protected buildRouteKey(assetIn: number, assetOut: number, pools: PoolBase[]): string;
|
|
10
11
|
/**
|
|
11
12
|
* Filter pools given the following contraints:
|
|
@@ -4,8 +4,8 @@ import { Hop, IPoolCtxProvider } from '../pool';
|
|
|
4
4
|
import { Amount } from '../types';
|
|
5
5
|
export declare class TradeRouter extends Router {
|
|
6
6
|
private readonly mlr;
|
|
7
|
-
private poolsSnapshot?;
|
|
8
7
|
constructor(ctx: IPoolCtxProvider);
|
|
8
|
+
protected onFilterChanged(): void;
|
|
9
9
|
private buildCtxSync;
|
|
10
10
|
private withCtx;
|
|
11
11
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacticcouncil/sdk-next",
|
|
3
|
-
"version": "0.10.0
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Galactic next gen sdk (papi)",
|
|
5
5
|
"author": "GalacticCouncil",
|
|
6
6
|
"repository": {
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@galacticcouncil/descriptors": "^1.4.0",
|
|
39
|
+
"@galacticcouncil/math-hsm": "^1.1.0",
|
|
39
40
|
"@galacticcouncil/math-lbp": "^1.2.0",
|
|
40
41
|
"@galacticcouncil/math-liquidity-mining": "^1.2.0",
|
|
41
42
|
"@galacticcouncil/math-omnipool": "^1.3.0",
|