@paraswap/dex-lib 2.37.2 → 2.37.4-cache-invalidation-fix.2
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/abi/pancakeswap-v3/PancakeswapV3Factory.abi.json +300 -0
- package/build/abi/uniswap-v3/UniswapV3Factory.abi.json +148 -0
- package/build/dex/algebra/algebra-factory.d.ts +25 -0
- package/build/dex/algebra/algebra-factory.js +43 -0
- package/build/dex/algebra/algebra-factory.js.map +1 -0
- package/build/dex/algebra/algebra.d.ts +3 -0
- package/build/dex/algebra/algebra.js +27 -5
- package/build/dex/algebra/algebra.js.map +1 -1
- package/build/dex/algebra/config.js +0 -1
- package/build/dex/algebra/config.js.map +1 -1
- package/build/dex/algebra/types.d.ts +1 -1
- package/build/dex/{woo-fi → hello}/config.d.ts +1 -1
- package/build/dex/{test-dex → hello}/config.js +3 -3
- package/build/dex/hello/config.js.map +1 -0
- package/build/dex/{test-dex/test-dex-pool.d.ts → hello/hello-pool.d.ts} +4 -4
- package/build/dex/{test-dex/test-dex-pool.js → hello/hello-pool.js} +9 -8
- package/build/dex/hello/hello-pool.js.map +1 -0
- package/build/dex/{test-dex/test-dex.d.ts → hello/hello.d.ts} +8 -8
- package/build/dex/{test-dex/test-dex.js → hello/hello.js} +7 -7
- package/build/dex/hello/hello.js.map +1 -0
- package/build/dex/{test-dex → hello}/types.d.ts +1 -1
- package/build/dex/{woo-fi → hello}/types.js.map +1 -1
- package/build/dex/{test-dex → my-test-dex}/config.d.ts +1 -1
- package/build/dex/my-test-dex/config.js +15 -0
- package/build/dex/my-test-dex/config.js.map +1 -0
- package/build/dex/my-test-dex/my-test-dex-pool.d.ts +39 -0
- package/build/dex/my-test-dex/my-test-dex-pool.js +64 -0
- package/build/dex/my-test-dex/my-test-dex-pool.js.map +1 -0
- package/build/dex/my-test-dex/my-test-dex.d.ts +37 -0
- package/build/dex/my-test-dex/my-test-dex.js +126 -0
- package/build/dex/my-test-dex/my-test-dex.js.map +1 -0
- package/build/dex/my-test-dex/types.d.ts +6 -0
- package/build/dex/{test-dex → my-test-dex}/types.js.map +1 -1
- package/build/dex/pancakeswap-v3/pancakeswap-v3-factory.d.ts +26 -0
- package/build/dex/pancakeswap-v3/pancakeswap-v3-factory.js +44 -0
- package/build/dex/pancakeswap-v3/pancakeswap-v3-factory.js.map +1 -0
- package/build/dex/pancakeswap-v3/pancakeswap-v3.d.ts +3 -0
- package/build/dex/pancakeswap-v3/pancakeswap-v3.js +26 -2
- package/build/dex/pancakeswap-v3/pancakeswap-v3.js.map +1 -1
- package/build/dex/uniswap-v3/types.d.ts +1 -0
- package/build/dex/uniswap-v3/types.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3-factory.d.ts +26 -0
- package/build/dex/uniswap-v3/uniswap-v3-factory.js +44 -0
- package/build/dex/uniswap-v3/uniswap-v3-factory.js.map +1 -0
- package/build/dex/uniswap-v3/uniswap-v3.d.ts +3 -0
- package/build/dex/uniswap-v3/uniswap-v3.js +26 -2
- package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
- package/build/dex-helper/dummy-dex-helper.js +3 -0
- package/build/dex-helper/dummy-dex-helper.js.map +1 -1
- package/build/dex-helper/icache.d.ts +1 -0
- package/package.json +1 -1
- package/src/abi/pancakeswap-v3/PancakeswapV3Factory.abi.json +300 -0
- package/src/dex/algebra/algebra-factory.ts +70 -0
- package/src/dex/algebra/algebra.ts +47 -6
- package/src/dex/algebra/config.ts +0 -1
- package/src/dex/algebra/types.ts +2 -1
- package/src/dex/pancakeswap-v3/pancakeswap-v3-factory.ts +73 -0
- package/src/dex/pancakeswap-v3/pancakeswap-v3.ts +50 -2
- package/src/dex/uniswap-v3/types.ts +2 -0
- package/src/dex/uniswap-v3/uniswap-v3-factory.ts +73 -0
- package/src/dex/uniswap-v3/uniswap-v3.ts +47 -2
- package/src/dex-helper/dummy-dex-helper.ts +4 -0
- package/src/dex-helper/icache.ts +2 -0
- package/build/abi/quickPerps/fast-price-events.json +0 -70
- package/build/abi/quickPerps/fast-price-feed.json +0 -748
- package/build/abi/quickPerps/reader.json +0 -313
- package/build/abi/quickPerps/vault-price-feed.json +0 -477
- package/build/abi/quickPerps/vault.json +0 -1953
- package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +0 -193
- package/build/abi/uniswap-v3/pancakeswap-v3/PancakeswapV3QuoterV2.abi.json +0 -285
- package/build/abi/uniswap-v3/pancakeswap-v3/PancakeswapV3Router.abi.json +0 -583
- package/build/abi/woo-fi/WooFeeManager.abi.json +0 -318
- package/build/abi/woo-fi/WooPP.abi.json +0 -548
- package/build/abi/woo-fi/Wooracle.abi.json +0 -260
- package/build/dex/aave-v3/tokens/arbitrum.json +0 -50
- package/build/dex/aave-v3/tokens/avalanche.json +0 -74
- package/build/dex/aave-v3/tokens/fantom.json +0 -62
- package/build/dex/aave-v3/tokens/optimism.json +0 -50
- package/build/dex/aave-v3/tokens/polygon.json +0 -116
- package/build/dex/balancer-v2/LinearMath.d.ts +0 -19
- package/build/dex/balancer-v2/LinearMath.js +0 -179
- package/build/dex/balancer-v2/LinearMath.js.map +0 -1
- package/build/dex/balancer-v2/LinearPool.d.ts +0 -47
- package/build/dex/balancer-v2/LinearPool.js +0 -324
- package/build/dex/balancer-v2/LinearPool.js.map +0 -1
- package/build/dex/balancer-v2/PhantomStablePool.d.ts +0 -47
- package/build/dex/balancer-v2/PhantomStablePool.js +0 -294
- package/build/dex/balancer-v2/PhantomStablePool.js.map +0 -1
- package/build/dex/balancer-v2/StableMath.d.ts +0 -9
- package/build/dex/balancer-v2/StableMath.js +0 -272
- package/build/dex/balancer-v2/StableMath.js.map +0 -1
- package/build/dex/balancer-v2/balancer-v2-pool.d.ts +0 -75
- package/build/dex/balancer-v2/balancer-v2-pool.js +0 -417
- package/build/dex/balancer-v2/balancer-v2-pool.js.map +0 -1
- package/build/dex/maverick-v1/scripts/event-sequence.d.ts +0 -1
- package/build/dex/maverick-v1/scripts/event-sequence.js +0 -110
- package/build/dex/maverick-v1/scripts/event-sequence.js.map +0 -1
- package/build/dex/quickswap/camelot-v3.d.ts +0 -6
- package/build/dex/quickswap/camelot-v3.js +0 -19
- package/build/dex/quickswap/camelot-v3.js.map +0 -1
- package/build/dex/quickswap/zyberswap-v3.d.ts +0 -6
- package/build/dex/quickswap/zyberswap-v3.js +0 -19
- package/build/dex/quickswap/zyberswap-v3.js.map +0 -1
- package/build/dex/quickswap-v3.d.ts +0 -21
- package/build/dex/quickswap-v3.js +0 -40
- package/build/dex/quickswap-v3.js.map +0 -1
- package/build/dex/test-dex/config.js.map +0 -1
- package/build/dex/test-dex/test-dex-pool.js.map +0 -1
- package/build/dex/test-dex/test-dex.js.map +0 -1
- package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.d.ts +0 -12
- package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.js +0 -23
- package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.js.map +0 -1
- package/build/dex/woo-fi/config.js +0 -141
- package/build/dex/woo-fi/config.js.map +0 -1
- package/build/dex/woo-fi/constants.d.ts +0 -5
- package/build/dex/woo-fi/constants.js +0 -20
- package/build/dex/woo-fi/constants.js.map +0 -1
- package/build/dex/woo-fi/types.d.ts +0 -48
- package/build/dex/woo-fi/woo-fi-decimal-math.d.ts +0 -14
- package/build/dex/woo-fi/woo-fi-decimal-math.js +0 -42
- package/build/dex/woo-fi/woo-fi-decimal-math.js.map +0 -1
- package/build/dex/woo-fi/woo-fi-math.d.ts +0 -31
- package/build/dex/woo-fi/woo-fi-math.js +0 -300
- package/build/dex/woo-fi/woo-fi-math.js.map +0 -1
- package/build/dex/woo-fi/woo-fi.d.ts +0 -65
- package/build/dex/woo-fi/woo-fi.js +0 -480
- package/build/dex/woo-fi/woo-fi.js.map +0 -1
- package/build/dex/woo-fi-v2/woo-fi-math.d.ts +0 -16
- package/build/dex/woo-fi-v2/woo-fi-math.js +0 -137
- package/build/dex/woo-fi-v2/woo-fi-math.js.map +0 -1
- package/build/workers.d.ts +0 -0
- package/build/workers.js +0 -2
- package/build/workers.js.map +0 -1
- /package/build/dex/{test-dex → hello}/types.js +0 -0
- /package/build/dex/{woo-fi → my-test-dex}/types.js +0 -0
|
@@ -56,6 +56,10 @@ import {
|
|
|
56
56
|
DEFAULT_ID_ERC20,
|
|
57
57
|
DEFAULT_ID_ERC20_AS_STRING,
|
|
58
58
|
} from '../../lib/tokens/types';
|
|
59
|
+
import {
|
|
60
|
+
OnPoolCreatedCallback,
|
|
61
|
+
PancakeswapV3Factory,
|
|
62
|
+
} from './pancakeswap-v3-factory';
|
|
59
63
|
|
|
60
64
|
type PoolPairsInfo = {
|
|
61
65
|
token0: Address;
|
|
@@ -63,14 +67,15 @@ type PoolPairsInfo = {
|
|
|
63
67
|
fee: string;
|
|
64
68
|
};
|
|
65
69
|
|
|
66
|
-
const PANCAKESWAPV3_CLEAN_NOT_EXISTING_POOL_TTL_MS =
|
|
67
|
-
const PANCAKESWAPV3_CLEAN_NOT_EXISTING_POOL_INTERVAL_MS =
|
|
70
|
+
const PANCAKESWAPV3_CLEAN_NOT_EXISTING_POOL_TTL_MS = 3 * 24 * 60 * 60 * 1000; // 3 days
|
|
71
|
+
const PANCAKESWAPV3_CLEAN_NOT_EXISTING_POOL_INTERVAL_MS = 24 * 60 * 60 * 1000; // Once in a day
|
|
68
72
|
const PANCAKESWAPV3_QUOTE_GASLIMIT = 200_000;
|
|
69
73
|
|
|
70
74
|
export class PancakeswapV3
|
|
71
75
|
extends SimpleExchange
|
|
72
76
|
implements IDex<UniswapV3Data>
|
|
73
77
|
{
|
|
78
|
+
private readonly factory: PancakeswapV3Factory;
|
|
74
79
|
readonly isFeeOnTransferSupported: boolean = false;
|
|
75
80
|
readonly eventPools: Record<string, PancakeSwapV3EventPool | null> = {};
|
|
76
81
|
|
|
@@ -117,6 +122,14 @@ export class PancakeswapV3
|
|
|
117
122
|
|
|
118
123
|
this.notExistingPoolSetKey =
|
|
119
124
|
`${CACHE_PREFIX}_${network}_${dexKey}_not_existings_pool_set`.toLowerCase();
|
|
125
|
+
|
|
126
|
+
this.factory = new PancakeswapV3Factory(
|
|
127
|
+
dexHelper,
|
|
128
|
+
dexKey,
|
|
129
|
+
this.config.factory,
|
|
130
|
+
this.logger,
|
|
131
|
+
this.onPoolCreatedDeleteFromNonExistingSet,
|
|
132
|
+
);
|
|
120
133
|
}
|
|
121
134
|
|
|
122
135
|
get supportedFees() {
|
|
@@ -133,6 +146,9 @@ export class PancakeswapV3
|
|
|
133
146
|
}
|
|
134
147
|
|
|
135
148
|
async initializePricing(blockNumber: number) {
|
|
149
|
+
// Init listening to new pools creation
|
|
150
|
+
await this.factory.initialize(blockNumber);
|
|
151
|
+
|
|
136
152
|
if (!this.dexHelper.config.isSlave) {
|
|
137
153
|
const cleanExpiredNotExistingPoolsKeys = async () => {
|
|
138
154
|
const maxTimestamp =
|
|
@@ -151,6 +167,38 @@ export class PancakeswapV3
|
|
|
151
167
|
}
|
|
152
168
|
}
|
|
153
169
|
|
|
170
|
+
/*
|
|
171
|
+
* When a non existing pool is queried, it's blacklisted for an arbitrary long period in order to prevent issuing too many rpc calls
|
|
172
|
+
* Once the pool is created, it gets immediately flagged
|
|
173
|
+
*/
|
|
174
|
+
onPoolCreatedDeleteFromNonExistingSet: OnPoolCreatedCallback = async ({
|
|
175
|
+
token0,
|
|
176
|
+
token1,
|
|
177
|
+
fee,
|
|
178
|
+
}) => {
|
|
179
|
+
const logPrefix = '[PancakeV3.onPoolCreatedDeleteFromNonExistingSet]';
|
|
180
|
+
const [_token0, _token1] = this._sortTokens(token0, token1);
|
|
181
|
+
const poolKey = `${_token0}_${_token1}_${fee}`;
|
|
182
|
+
|
|
183
|
+
// consider doing it only from master pool for less calls to distant cache
|
|
184
|
+
|
|
185
|
+
// delete entry locally to let local instance discover the pool
|
|
186
|
+
delete this.eventPools[this.getPoolIdentifier(_token0, _token1, fee)];
|
|
187
|
+
|
|
188
|
+
try {
|
|
189
|
+
this.logger.info(
|
|
190
|
+
`${logPrefix} delete pool from not existing set: ${poolKey}`,
|
|
191
|
+
);
|
|
192
|
+
// delete pool record from set
|
|
193
|
+
await this.dexHelper.cache.zrem(this.notExistingPoolSetKey, [poolKey]);
|
|
194
|
+
} catch (error) {
|
|
195
|
+
this.logger.error(
|
|
196
|
+
`${logPrefix} failed to delete pool from set :${poolKey}`,
|
|
197
|
+
error,
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
|
|
154
202
|
async getPool(
|
|
155
203
|
srcAddress: Address,
|
|
156
204
|
destAddress: Address,
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Interface } from '@ethersproject/abi';
|
|
2
|
+
import { DeepReadonly } from 'ts-essentials';
|
|
3
|
+
import FactoryABI from '../../abi/uniswap-v3/UniswapV3Factory.abi.json';
|
|
4
|
+
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
5
|
+
import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
6
|
+
import { Address, Log, Logger } from '../../types';
|
|
7
|
+
import { LogDescription } from 'ethers/lib/utils';
|
|
8
|
+
import { FactoryState } from './types';
|
|
9
|
+
|
|
10
|
+
export type OnPoolCreatedCallback = ({
|
|
11
|
+
token0,
|
|
12
|
+
token1,
|
|
13
|
+
fee,
|
|
14
|
+
}: {
|
|
15
|
+
token0: string;
|
|
16
|
+
token1: string;
|
|
17
|
+
fee: bigint;
|
|
18
|
+
}) => Promise<void>;
|
|
19
|
+
|
|
20
|
+
/*
|
|
21
|
+
* "Stateless" event subscriber in order to capture "PoolCreated" event on new pools created.
|
|
22
|
+
* State is present, but it's a placeholder to actually make the events reach handlers (if there's no previous state - `processBlockLogs` is not called)
|
|
23
|
+
*/
|
|
24
|
+
export class UniswapV3Factory extends StatefulEventSubscriber<FactoryState> {
|
|
25
|
+
handlers: {
|
|
26
|
+
[event: string]: (event: any) => Promise<void>;
|
|
27
|
+
} = {};
|
|
28
|
+
|
|
29
|
+
logDecoder: (log: Log) => any;
|
|
30
|
+
|
|
31
|
+
public readonly factoryIface = new Interface(FactoryABI);
|
|
32
|
+
|
|
33
|
+
constructor(
|
|
34
|
+
readonly dexHelper: IDexHelper,
|
|
35
|
+
parentName: string,
|
|
36
|
+
protected readonly factoryAddress: Address,
|
|
37
|
+
logger: Logger,
|
|
38
|
+
protected readonly onPoolCreated: OnPoolCreatedCallback,
|
|
39
|
+
mapKey: string = '',
|
|
40
|
+
) {
|
|
41
|
+
super(parentName, `${parentName} Factory`, dexHelper, logger, true, mapKey);
|
|
42
|
+
|
|
43
|
+
this.addressesSubscribed = [factoryAddress];
|
|
44
|
+
|
|
45
|
+
this.logDecoder = (log: Log) => this.factoryIface.parseLog(log);
|
|
46
|
+
|
|
47
|
+
this.handlers['PoolCreated'] = this.handleNewPool.bind(this);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
generateState(): FactoryState {
|
|
51
|
+
return {};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
protected async processLog(
|
|
55
|
+
_: DeepReadonly<FactoryState>,
|
|
56
|
+
log: Readonly<Log>,
|
|
57
|
+
): Promise<FactoryState> {
|
|
58
|
+
const event = this.logDecoder(log);
|
|
59
|
+
if (event.name in this.handlers) {
|
|
60
|
+
await this.handlers[event.name](event);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return {};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async handleNewPool(event: LogDescription) {
|
|
67
|
+
const token0 = event.args.token0.toLowerCase();
|
|
68
|
+
const token1 = event.args.token1.toLowerCase();
|
|
69
|
+
const fee = event.args.fee;
|
|
70
|
+
|
|
71
|
+
await this.onPoolCreated({ token0, token1, fee });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -64,6 +64,7 @@ import {
|
|
|
64
64
|
DEFAULT_ID_ERC20_AS_STRING,
|
|
65
65
|
} from '../../lib/tokens/types';
|
|
66
66
|
import { OptimalSwapExchange } from '@paraswap/core';
|
|
67
|
+
import { OnPoolCreatedCallback, UniswapV3Factory } from './uniswap-v3-factory';
|
|
67
68
|
|
|
68
69
|
type PoolPairsInfo = {
|
|
69
70
|
token0: Address;
|
|
@@ -71,14 +72,15 @@ type PoolPairsInfo = {
|
|
|
71
72
|
fee: string;
|
|
72
73
|
};
|
|
73
74
|
|
|
74
|
-
const UNISWAPV3_CLEAN_NOT_EXISTING_POOL_TTL_MS =
|
|
75
|
-
const UNISWAPV3_CLEAN_NOT_EXISTING_POOL_INTERVAL_MS =
|
|
75
|
+
const UNISWAPV3_CLEAN_NOT_EXISTING_POOL_TTL_MS = 3 * 24 * 60 * 60 * 1000; // 3 days
|
|
76
|
+
const UNISWAPV3_CLEAN_NOT_EXISTING_POOL_INTERVAL_MS = 24 * 60 * 60 * 1000; // Once in a day
|
|
76
77
|
const UNISWAPV3_QUOTE_GASLIMIT = 200_000;
|
|
77
78
|
|
|
78
79
|
export class UniswapV3
|
|
79
80
|
extends SimpleExchange
|
|
80
81
|
implements IDex<UniswapV3Data, UniswapV3Param>
|
|
81
82
|
{
|
|
83
|
+
private readonly factory: UniswapV3Factory;
|
|
82
84
|
readonly isFeeOnTransferSupported: boolean = false;
|
|
83
85
|
readonly eventPools: Record<string, UniswapV3EventPool | null> = {};
|
|
84
86
|
|
|
@@ -139,6 +141,14 @@ export class UniswapV3
|
|
|
139
141
|
|
|
140
142
|
this.notExistingPoolSetKey =
|
|
141
143
|
`${CACHE_PREFIX}_${network}_${dexKey}_not_existings_pool_set`.toLowerCase();
|
|
144
|
+
|
|
145
|
+
this.factory = new UniswapV3Factory(
|
|
146
|
+
dexHelper,
|
|
147
|
+
dexKey,
|
|
148
|
+
this.config.factory,
|
|
149
|
+
this.logger,
|
|
150
|
+
this.onPoolCreatedDeleteFromNonExistingSet,
|
|
151
|
+
);
|
|
142
152
|
}
|
|
143
153
|
|
|
144
154
|
get supportedFees() {
|
|
@@ -155,6 +165,9 @@ export class UniswapV3
|
|
|
155
165
|
}
|
|
156
166
|
|
|
157
167
|
async initializePricing(blockNumber: number) {
|
|
168
|
+
// Init listening to new pools creation
|
|
169
|
+
await this.factory.initialize(blockNumber);
|
|
170
|
+
|
|
158
171
|
// This is only for testing, because cold pool fetching is goes out of
|
|
159
172
|
// FETCH_POOL_INDENTIFIER_TIMEOUT range
|
|
160
173
|
await Promise.all(
|
|
@@ -185,6 +198,38 @@ export class UniswapV3
|
|
|
185
198
|
}
|
|
186
199
|
}
|
|
187
200
|
|
|
201
|
+
/*
|
|
202
|
+
* When a non existing pool is queried, it's blacklisted for an arbitrary long period in order to prevent issuing too many rpc calls
|
|
203
|
+
* Once the pool is created, it gets immediately flagged
|
|
204
|
+
*/
|
|
205
|
+
onPoolCreatedDeleteFromNonExistingSet: OnPoolCreatedCallback = async ({
|
|
206
|
+
token0,
|
|
207
|
+
token1,
|
|
208
|
+
fee,
|
|
209
|
+
}) => {
|
|
210
|
+
const logPrefix = '[UniswapV3.onPoolCreatedDeleteFromNonExistingSet]';
|
|
211
|
+
const [_token0, _token1] = this._sortTokens(token0, token1);
|
|
212
|
+
const poolKey = `${_token0}_${_token1}_${fee}`;
|
|
213
|
+
|
|
214
|
+
// consider doing it only from master pool for less calls to distant cache
|
|
215
|
+
|
|
216
|
+
// delete entry locally to let local instance discover the pool
|
|
217
|
+
delete this.eventPools[this.getPoolIdentifier(_token0, _token1, fee)];
|
|
218
|
+
|
|
219
|
+
try {
|
|
220
|
+
this.logger.info(
|
|
221
|
+
`${logPrefix} delete pool from not existing set: ${poolKey}`,
|
|
222
|
+
);
|
|
223
|
+
// delete pool record from set
|
|
224
|
+
await this.dexHelper.cache.zrem(this.notExistingPoolSetKey, [poolKey]);
|
|
225
|
+
} catch (error) {
|
|
226
|
+
this.logger.error(
|
|
227
|
+
`${logPrefix} failed to delete pool from set: ${poolKey}`,
|
|
228
|
+
error,
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
|
|
188
233
|
async getPool(
|
|
189
234
|
srcAddress: Address,
|
|
190
235
|
destAddress: Address,
|
|
@@ -115,6 +115,10 @@ class DummyCache implements ICache {
|
|
|
115
115
|
return 0;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
async zrem(key: string, membersKeys: string[]): Promise<number> {
|
|
119
|
+
return 0;
|
|
120
|
+
}
|
|
121
|
+
|
|
118
122
|
async zadd(key: string, bulkItemsToAdd: (number | string)[], option?: 'NX') {
|
|
119
123
|
return 0;
|
|
120
124
|
}
|
package/src/dex-helper/icache.ts
CHANGED
|
@@ -46,6 +46,8 @@ export interface ICache {
|
|
|
46
46
|
|
|
47
47
|
zremrangebyscore(key: string, min: number, max: number): Promise<number>;
|
|
48
48
|
|
|
49
|
+
zrem(key: string, membersKeys: string[]): Promise<number>;
|
|
50
|
+
|
|
49
51
|
zscore(setKey: string, key: string): Promise<string | null>;
|
|
50
52
|
|
|
51
53
|
sismember(setKey: string, key: string): Promise<boolean>;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"anonymous": false,
|
|
4
|
-
"inputs": [
|
|
5
|
-
{
|
|
6
|
-
"indexed": false,
|
|
7
|
-
"internalType": "address",
|
|
8
|
-
"name": "token",
|
|
9
|
-
"type": "address"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"indexed": false,
|
|
13
|
-
"internalType": "uint256",
|
|
14
|
-
"name": "price",
|
|
15
|
-
"type": "uint256"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"indexed": false,
|
|
19
|
-
"internalType": "address",
|
|
20
|
-
"name": "priceFeed",
|
|
21
|
-
"type": "address"
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
|
-
"name": "PriceUpdate",
|
|
25
|
-
"type": "event"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"inputs": [
|
|
29
|
-
{ "internalType": "address", "name": "_token", "type": "address" },
|
|
30
|
-
{ "internalType": "uint256", "name": "_price", "type": "uint256" }
|
|
31
|
-
],
|
|
32
|
-
"name": "emitPriceEvent",
|
|
33
|
-
"outputs": [],
|
|
34
|
-
"stateMutability": "nonpayable",
|
|
35
|
-
"type": "function"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"inputs": [],
|
|
39
|
-
"name": "gov",
|
|
40
|
-
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
41
|
-
"stateMutability": "view",
|
|
42
|
-
"type": "function"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
46
|
-
"name": "isPriceFeed",
|
|
47
|
-
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
|
|
48
|
-
"stateMutability": "view",
|
|
49
|
-
"type": "function"
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
"inputs": [
|
|
53
|
-
{ "internalType": "address", "name": "_gov", "type": "address" }
|
|
54
|
-
],
|
|
55
|
-
"name": "setGov",
|
|
56
|
-
"outputs": [],
|
|
57
|
-
"stateMutability": "nonpayable",
|
|
58
|
-
"type": "function"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"inputs": [
|
|
62
|
-
{ "internalType": "address", "name": "_priceFeed", "type": "address" },
|
|
63
|
-
{ "internalType": "bool", "name": "_isPriceFeed", "type": "bool" }
|
|
64
|
-
],
|
|
65
|
-
"name": "setIsPriceFeed",
|
|
66
|
-
"outputs": [],
|
|
67
|
-
"stateMutability": "nonpayable",
|
|
68
|
-
"type": "function"
|
|
69
|
-
}
|
|
70
|
-
]
|