@paraswap/dex-lib 2.33.4-balancer-v2-multihop.2 → 2.33.4-base-support.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/config.js +26 -0
- package/build/config.js.map +1 -1
- package/build/constants.d.ts +2 -1
- package/build/constants.js +2 -1
- package/build/constants.js.map +1 -1
- package/build/dex/balancer-v2/optimizer.d.ts +0 -1
- package/build/dex/balancer-v2/optimizer.js +21 -29
- package/build/dex/balancer-v2/optimizer.js.map +1 -1
- package/build/dex/pancakeswap-v3/types.d.ts +137 -0
- package/build/dex/pancakeswap-v3/types.js +9 -0
- package/build/dex/pancakeswap-v3/types.js.map +1 -0
- package/build/dex/uniswap-v3/config.js +12 -0
- package/build/dex/uniswap-v3/config.js.map +1 -1
- package/build/dex/weth/config.js +3 -0
- package/build/dex/weth/config.js.map +1 -1
- package/build/web3-provider.d.ts +3 -0
- package/build/web3-provider.js +13 -0
- package/build/web3-provider.js.map +1 -0
- package/package.json +1 -1
- package/src/config.ts +29 -0
- package/src/constants.ts +2 -1
- package/src/dex/balancer-v2/optimizer.ts +23 -38
- package/src/dex/uniswap-v3/config.ts +13 -0
- package/src/dex/weth/config.ts +3 -0
- package/build/abi/algebra/AlgebraFactory-v1_1.abi.json +0 -250
- package/build/abi/api3-proxy.json +0 -46
- package/build/abi/api3-server-v1.json +0 -463
- package/build/abi/quick-perps/fast-price-events.json +0 -70
- package/build/abi/quick-perps/fast-price-feed.json +0 -741
- package/build/abi/quick-perps/reader.json +0 -313
- package/build/abi/quick-perps/vault-price-feed.json +0 -323
- package/build/abi/quick-perps/vault.json +0 -1953
- 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/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/quick-perps/config.d.ts +0 -11
- package/build/dex/quick-perps/config.js +0 -27
- package/build/dex/quick-perps/config.js.map +0 -1
- package/build/dex/quick-perps/fast-price-feed.d.ts +0 -26
- package/build/dex/quick-perps/fast-price-feed.js +0 -176
- package/build/dex/quick-perps/fast-price-feed.js.map +0 -1
- package/build/dex/quick-perps/pool.d.ts +0 -21
- package/build/dex/quick-perps/pool.js +0 -210
- package/build/dex/quick-perps/pool.js.map +0 -1
- package/build/dex/quick-perps/quick-perps.d.ts +0 -52
- package/build/dex/quick-perps/quick-perps.js +0 -205
- package/build/dex/quick-perps/quick-perps.js.map +0 -1
- package/build/dex/quick-perps/types.d.ts +0 -98
- package/build/dex/quick-perps/types.js +0 -3
- package/build/dex/quick-perps/types.js.map +0 -1
- package/build/dex/quick-perps/usdq.d.ts +0 -15
- package/build/dex/quick-perps/usdq.js +0 -61
- package/build/dex/quick-perps/usdq.js.map +0 -1
- package/build/dex/quick-perps/vault-price-feed.d.ts +0 -43
- package/build/dex/quick-perps/vault-price-feed.js +0 -194
- package/build/dex/quick-perps/vault-price-feed.js.map +0 -1
- package/build/dex/quick-perps/vault-utils.d.ts +0 -8
- package/build/dex/quick-perps/vault-utils.js +0 -41
- package/build/dex/quick-perps/vault-utils.js.map +0 -1
- package/build/dex/quick-perps/vault.d.ts +0 -46
- package/build/dex/quick-perps/vault.js +0 -166
- package/build/dex/quick-perps/vault.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-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.d.ts +0 -4
- package/build/dex/test-dex/config.js +0 -15
- package/build/dex/test-dex/config.js.map +0 -1
- package/build/dex/test-dex/test-dex-pool.d.ts +0 -39
- package/build/dex/test-dex/test-dex-pool.js +0 -63
- package/build/dex/test-dex/test-dex-pool.js.map +0 -1
- package/build/dex/test-dex/test-dex.d.ts +0 -37
- package/build/dex/test-dex/test-dex.js +0 -126
- package/build/dex/test-dex/test-dex.js.map +0 -1
- package/build/dex/test-dex/types.d.ts +0 -6
- package/build/dex/test-dex/types.js +0 -3
- package/build/dex/test-dex/types.js.map +0 -1
- package/build/dex/woo-fi/config.d.ts +0 -4
- 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/types.js +0 -3
- package/build/dex/woo-fi/types.js.map +0 -1
- 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/lib/api3-feed.d.ts +0 -26
- package/build/lib/api3-feed.js +0 -82
- package/build/lib/api3-feed.js.map +0 -1
- package/src/dex/balancer-v2/balancer-v2-optimizer.test.ts +0 -226
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.QuickPerps = void 0;
|
|
30
|
-
const abi_1 = require("@ethersproject/abi");
|
|
31
|
-
const constants_1 = require("../../constants");
|
|
32
|
-
const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
|
|
33
|
-
const utils_1 = require("../../utils");
|
|
34
|
-
const pool_1 = require("./pool");
|
|
35
|
-
const simple_exchange_1 = require("../simple-exchange");
|
|
36
|
-
const config_1 = require("./config");
|
|
37
|
-
const vault_1 = require("./vault");
|
|
38
|
-
const erc20_json_1 = __importDefault(require("../../abi/erc20.json"));
|
|
39
|
-
const QuickPerpsGasCost = 300 * 1000;
|
|
40
|
-
class QuickPerps extends simple_exchange_1.SimpleExchange {
|
|
41
|
-
constructor(network, dexKey, dexHelper, adapters = config_1.Adapters[network], params = config_1.QuickPerpsConfig[dexKey][network]) {
|
|
42
|
-
super(dexHelper, dexKey);
|
|
43
|
-
this.network = network;
|
|
44
|
-
this.dexHelper = dexHelper;
|
|
45
|
-
this.adapters = adapters;
|
|
46
|
-
this.params = params;
|
|
47
|
-
this.pool = null;
|
|
48
|
-
this.supportedTokensMap = {};
|
|
49
|
-
// supportedTokens is only used by the pooltracker
|
|
50
|
-
this.supportedTokens = [];
|
|
51
|
-
this.hasConstantPriceLargeAmounts = false;
|
|
52
|
-
this.needWrapNative = true;
|
|
53
|
-
this.isFeeOnTransferSupported = false;
|
|
54
|
-
this.vaultUSDBalance = 0;
|
|
55
|
-
this.logger = dexHelper.getLogger(dexKey);
|
|
56
|
-
}
|
|
57
|
-
async initializePricing(blockNumber) {
|
|
58
|
-
const config = await pool_1.QuickPerpsEventPool.getConfig(this.params, blockNumber, this.dexHelper.multiContract);
|
|
59
|
-
config.tokenAddresses.forEach((token) => (this.supportedTokensMap[token] = true));
|
|
60
|
-
this.pool = new pool_1.QuickPerpsEventPool(this.dexKey, this.network, this.dexHelper, config);
|
|
61
|
-
await this.pool.initialize(blockNumber);
|
|
62
|
-
}
|
|
63
|
-
// Returns the list of contract adapters (name and index)
|
|
64
|
-
// for a buy/sell. Return null if there are no adapters.
|
|
65
|
-
getAdapters(side) {
|
|
66
|
-
return this.adapters[side];
|
|
67
|
-
}
|
|
68
|
-
// Returns list of pool identifiers that can be used
|
|
69
|
-
// for a given swap. poolIdentifiers must be unique
|
|
70
|
-
// across DEXes.
|
|
71
|
-
async getPoolIdentifiers(srcToken, destToken, side, blockNumber) {
|
|
72
|
-
if (side === constants_1.SwapSide.BUY || !this.pool)
|
|
73
|
-
return [];
|
|
74
|
-
const srcAddress = this.dexHelper.config
|
|
75
|
-
.wrapETH(srcToken)
|
|
76
|
-
.address.toLowerCase();
|
|
77
|
-
const destAddress = this.dexHelper.config
|
|
78
|
-
.wrapETH(destToken)
|
|
79
|
-
.address.toLowerCase();
|
|
80
|
-
if (srcAddress !== destAddress &&
|
|
81
|
-
this.supportedTokensMap[srcAddress] &&
|
|
82
|
-
this.supportedTokensMap[destAddress]) {
|
|
83
|
-
return [`${this.dexKey}_${srcAddress}`, `${this.dexKey}_${destAddress}`];
|
|
84
|
-
}
|
|
85
|
-
return [];
|
|
86
|
-
}
|
|
87
|
-
// Returns pool prices for amounts.
|
|
88
|
-
// If limitPools is defined only pools in limitPools
|
|
89
|
-
// should be used. If limitPools is undefined then
|
|
90
|
-
// any pools can be used.
|
|
91
|
-
async getPricesVolume(srcToken, destToken, amounts, side, blockNumber, limitPools) {
|
|
92
|
-
if (side === constants_1.SwapSide.BUY || !this.pool)
|
|
93
|
-
return null;
|
|
94
|
-
const srcAddress = this.dexHelper.config
|
|
95
|
-
.wrapETH(srcToken)
|
|
96
|
-
.address.toLowerCase();
|
|
97
|
-
const destAddress = this.dexHelper.config
|
|
98
|
-
.wrapETH(destToken)
|
|
99
|
-
.address.toLowerCase();
|
|
100
|
-
if (srcAddress === destAddress ||
|
|
101
|
-
!(this.supportedTokensMap[srcAddress] &&
|
|
102
|
-
this.supportedTokensMap[destAddress]))
|
|
103
|
-
return null;
|
|
104
|
-
const srcPoolIdentifier = `${this.dexKey}_${srcAddress}`;
|
|
105
|
-
const destPoolIdentifier = `${this.dexKey}_${destAddress}`;
|
|
106
|
-
const pools = [srcPoolIdentifier, destPoolIdentifier];
|
|
107
|
-
if (limitPools && pools.some(p => !limitPools.includes(p)))
|
|
108
|
-
return null;
|
|
109
|
-
const unitVolume = (0, utils_1.getBigIntPow)(srcToken.decimals);
|
|
110
|
-
const prices = await this.pool.getAmountOut(srcAddress, destAddress, [unitVolume, ...amounts], blockNumber);
|
|
111
|
-
if (!prices)
|
|
112
|
-
return null;
|
|
113
|
-
return [
|
|
114
|
-
{
|
|
115
|
-
prices: prices.slice(1),
|
|
116
|
-
unit: prices[0],
|
|
117
|
-
gasCost: QuickPerpsGasCost,
|
|
118
|
-
exchange: this.dexKey,
|
|
119
|
-
data: {},
|
|
120
|
-
poolAddresses: [this.params.vault],
|
|
121
|
-
},
|
|
122
|
-
];
|
|
123
|
-
}
|
|
124
|
-
// Returns estimated gas cost of calldata for this DEX in multiSwap
|
|
125
|
-
getCalldataGasCost(poolPrices) {
|
|
126
|
-
return CALLDATA_GAS_COST.DEX_NO_PAYLOAD;
|
|
127
|
-
}
|
|
128
|
-
getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
129
|
-
return {
|
|
130
|
-
targetExchange: this.params.vault,
|
|
131
|
-
payload: '0x',
|
|
132
|
-
networkFee: '0',
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
getSimpleParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
136
|
-
return {
|
|
137
|
-
callees: [srcToken, this.params.vault],
|
|
138
|
-
calldata: [
|
|
139
|
-
QuickPerps.erc20Interface.encodeFunctionData('transfer', [
|
|
140
|
-
this.params.vault,
|
|
141
|
-
srcAmount,
|
|
142
|
-
]),
|
|
143
|
-
vault_1.Vault.interface.encodeFunctionData('swap', [
|
|
144
|
-
srcToken,
|
|
145
|
-
destToken,
|
|
146
|
-
this.augustusAddress,
|
|
147
|
-
]),
|
|
148
|
-
],
|
|
149
|
-
values: ['0', '0'],
|
|
150
|
-
networkFee: '0',
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
async updatePoolState() {
|
|
154
|
-
if (!this.supportedTokens.length) {
|
|
155
|
-
const tokenAddresses = await pool_1.QuickPerpsEventPool.getWhitelistedTokens(this.params.vault, 'latest', this.dexHelper.multiContract);
|
|
156
|
-
const decimalsCallData = QuickPerps.erc20Interface.encodeFunctionData('decimals');
|
|
157
|
-
const tokenBalanceMultiCall = tokenAddresses.map(t => ({
|
|
158
|
-
target: t,
|
|
159
|
-
callData: decimalsCallData,
|
|
160
|
-
}));
|
|
161
|
-
const res = (await this.dexHelper.multiContract.methods
|
|
162
|
-
.aggregate(tokenBalanceMultiCall)
|
|
163
|
-
.call()).returnData;
|
|
164
|
-
const tokenDecimals = res.map((r) => parseInt(QuickPerps.erc20Interface
|
|
165
|
-
.decodeFunctionResult('decimals', r)[0]
|
|
166
|
-
.toString()));
|
|
167
|
-
this.supportedTokens = tokenAddresses.map((t, i) => ({
|
|
168
|
-
address: t,
|
|
169
|
-
decimals: tokenDecimals[i],
|
|
170
|
-
}));
|
|
171
|
-
}
|
|
172
|
-
const erc20BalanceCalldata = QuickPerps.erc20Interface.encodeFunctionData('balanceOf', [this.params.vault]);
|
|
173
|
-
const tokenBalanceMultiCall = this.supportedTokens.map(t => ({
|
|
174
|
-
target: t.address,
|
|
175
|
-
callData: erc20BalanceCalldata,
|
|
176
|
-
}));
|
|
177
|
-
const res = (await this.dexHelper.multiContract.methods
|
|
178
|
-
.aggregate(tokenBalanceMultiCall)
|
|
179
|
-
.call()).returnData;
|
|
180
|
-
const tokenBalances = res.map((r) => BigInt(QuickPerps.erc20Interface
|
|
181
|
-
.decodeFunctionResult('balanceOf', r)[0]
|
|
182
|
-
.toString()));
|
|
183
|
-
const tokenBalancesUSD = await Promise.all(this.supportedTokens.map((t, i) => this.dexHelper.getTokenUSDPrice(t, tokenBalances[i])));
|
|
184
|
-
this.vaultUSDBalance = tokenBalancesUSD.reduce((sum, curr) => sum + curr);
|
|
185
|
-
}
|
|
186
|
-
// Returns list of top pools based on liquidity. Max
|
|
187
|
-
// limit number pools should be returned.
|
|
188
|
-
async getTopPoolsForToken(_tokenAddress, limit) {
|
|
189
|
-
const tokenAddress = _tokenAddress.toLowerCase();
|
|
190
|
-
if (!this.supportedTokens.some(t => t.address === tokenAddress))
|
|
191
|
-
return [];
|
|
192
|
-
return [
|
|
193
|
-
{
|
|
194
|
-
exchange: this.dexKey,
|
|
195
|
-
address: this.params.vault,
|
|
196
|
-
connectorTokens: this.supportedTokens.filter(t => t.address !== tokenAddress),
|
|
197
|
-
liquidityUSD: this.vaultUSDBalance,
|
|
198
|
-
},
|
|
199
|
-
];
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
exports.QuickPerps = QuickPerps;
|
|
203
|
-
QuickPerps.dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.QuickPerpsConfig);
|
|
204
|
-
QuickPerps.erc20Interface = new abi_1.Interface(erc20_json_1.default);
|
|
205
|
-
//# sourceMappingURL=quick-perps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"quick-perps.js","sourceRoot":"","sources":["../../../src/dex/quick-perps/quick-perps.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA+C;AAY/C,+CAAoD;AACpD,2EAA6D;AAC7D,uCAAkE;AAIlE,iCAA6C;AAC7C,wDAAoD;AACpD,qCAAsD;AACtD,mCAAgC;AAChC,sEAA4C;AAE5C,MAAM,iBAAiB,GAAG,GAAG,GAAG,IAAI,CAAC;AAErC,MAAa,UAAW,SAAQ,gCAAc;IAmB5C,YACY,OAAgB,EAC1B,MAAc,EACJ,SAAqB,EACrB,WAAW,iBAAQ,CAAC,OAAO,CAAC,EAC5B,SAAoB,yBAAgB,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;QAE/D,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QANf,YAAO,GAAP,OAAO,CAAS;QAEhB,cAAS,GAAT,SAAS,CAAY;QACrB,aAAQ,GAAR,QAAQ,CAAoB;QAC5B,WAAM,GAAN,MAAM,CA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AE,IAAY,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,CAC1C,CAAC;IACJ,CAAC;IAED,oDAAoD;IACpD,yCAAyC;IACzC,KAAK,CAAC,mBAAmB,CACvB,aAAsB,EACtB,KAAa;QAEb,MAAM,YAAY,GAAG,aAAa,CAAC,WAAW,EAAE,CAAC;QACjD,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,YAAY,CAAC;YAAE,OAAO,EAAE,CAAC;QAC3E,OAAO;YACL;gBACE,QAAQ,EAAE,IAAI,CAAC,MAAM;gBACrB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK;gBAC1B,eAAe,EAAE,IAAI,CAAC,eAAe,CAAC,MAAM,CAC1C,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,YAAY,CAChC;gBACD,YAAY,EAAE,IAAI,CAAC,eAAe;aACnC;SACF,CAAC;IACJ,CAAC;;AAxQH,gCAyQC;AA/Pe,6BAAkB,GAC9B,IAAA,6BAAqB,EAAC,yBAAgB,CAAC,CAAC;AAE5B,yBAAc,GAAG,IAAI,eAAS,CAAC,oBAAQ,CAAC,CAAC"}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { Address } from '../../types';
|
|
2
|
-
import { Api3FeedSubscriberState } from '../../lib/api3-feed';
|
|
3
|
-
export declare type PoolState = {
|
|
4
|
-
primaryPrices: {
|
|
5
|
-
[poolAddress: string]: Api3FeedSubscriberState;
|
|
6
|
-
};
|
|
7
|
-
secondaryPrices: FastPriceFeedState;
|
|
8
|
-
vault: VaultState;
|
|
9
|
-
usdq: USDQState;
|
|
10
|
-
};
|
|
11
|
-
export declare type FastPriceFeedState = {
|
|
12
|
-
lastUpdatedAt: number;
|
|
13
|
-
prices: {
|
|
14
|
-
[tokenAddress: string]: bigint;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
export declare type VaultState = {
|
|
18
|
-
usdqAmounts: {
|
|
19
|
-
[tokenAddress: string]: bigint;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
export declare type USDQState = {
|
|
23
|
-
totalSupply: bigint;
|
|
24
|
-
};
|
|
25
|
-
export declare type QuickPerpsData = {};
|
|
26
|
-
export declare type DexParams = {
|
|
27
|
-
vault: Address;
|
|
28
|
-
reader: Address;
|
|
29
|
-
priceFeed: Address;
|
|
30
|
-
fastPriceFeed: Address;
|
|
31
|
-
fastPriceEvents: Address;
|
|
32
|
-
usdq: Address;
|
|
33
|
-
};
|
|
34
|
-
export declare type FastPriceFeedConfig = {
|
|
35
|
-
priceDuration: number;
|
|
36
|
-
maxDeviationBasisPoints: bigint;
|
|
37
|
-
favorFastPrice: Record<string, boolean>;
|
|
38
|
-
spreadBasisPointsIfInactive: bigint;
|
|
39
|
-
spreadBasisPointsIfChainError: bigint;
|
|
40
|
-
maxPriceUpdateDelay: number;
|
|
41
|
-
};
|
|
42
|
-
export declare type VaultPriceFeedConfig = {
|
|
43
|
-
isSecondaryPriceEnabled: boolean;
|
|
44
|
-
strictStableTokens: {
|
|
45
|
-
[address: string]: boolean;
|
|
46
|
-
};
|
|
47
|
-
spreadBasisPoints: {
|
|
48
|
-
[address: string]: bigint;
|
|
49
|
-
};
|
|
50
|
-
adjustmentBasisPoints: {
|
|
51
|
-
[address: string]: bigint;
|
|
52
|
-
};
|
|
53
|
-
isAdjustmentAdditive: {
|
|
54
|
-
[address: string]: boolean;
|
|
55
|
-
};
|
|
56
|
-
priceDecimals: {
|
|
57
|
-
[address: string]: number;
|
|
58
|
-
};
|
|
59
|
-
maxStrictPriceDeviation: bigint;
|
|
60
|
-
};
|
|
61
|
-
export declare type VaultConfig = {
|
|
62
|
-
tokenDecimals: {
|
|
63
|
-
[address: string]: number;
|
|
64
|
-
};
|
|
65
|
-
stableTokens: {
|
|
66
|
-
[address: string]: boolean;
|
|
67
|
-
};
|
|
68
|
-
tokenWeights: {
|
|
69
|
-
[address: string]: bigint;
|
|
70
|
-
};
|
|
71
|
-
stableSwapFeeBasisPoints: bigint;
|
|
72
|
-
swapFeeBasisPoints: bigint;
|
|
73
|
-
stableTaxBasisPoints: bigint;
|
|
74
|
-
taxBasisPoints: bigint;
|
|
75
|
-
hasDynamicFees: bigint;
|
|
76
|
-
includeAmmPrice: boolean;
|
|
77
|
-
useSwapPricing: boolean;
|
|
78
|
-
totalTokenWeights: bigint;
|
|
79
|
-
};
|
|
80
|
-
export declare type PoolConfig = {
|
|
81
|
-
vaultAddress: Address;
|
|
82
|
-
readerAddress: Address;
|
|
83
|
-
priceFeed: Address;
|
|
84
|
-
fastPriceFeed: Address;
|
|
85
|
-
fastPriceEvents: Address;
|
|
86
|
-
usdqAddress: Address;
|
|
87
|
-
tokenAddresses: Address[];
|
|
88
|
-
vaultConfig: VaultConfig;
|
|
89
|
-
vaultPriceFeedConfig: VaultPriceFeedConfig;
|
|
90
|
-
fastPriceFeedConfig: FastPriceFeedConfig;
|
|
91
|
-
api3ServerV1: {
|
|
92
|
-
[address: string]: {
|
|
93
|
-
proxy: Address;
|
|
94
|
-
api3ServerV1: Address;
|
|
95
|
-
dataFeedId: string;
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/quick-perps/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Interface } from '@ethersproject/abi';
|
|
2
|
-
import { DeepReadonly } from 'ts-essentials';
|
|
3
|
-
import { PartialEventSubscriber } from '../../composed-event-subscriber';
|
|
4
|
-
import { Address, MultiCallInput, MultiCallOutput, Logger, Log, BlockHeader } from '../../types';
|
|
5
|
-
import { USDQState } from './types';
|
|
6
|
-
import { Lens } from '../../lens';
|
|
7
|
-
export declare class USDQ<State> extends PartialEventSubscriber<State, USDQState> {
|
|
8
|
-
private usdqAddress;
|
|
9
|
-
static readonly interface: Interface;
|
|
10
|
-
constructor(usdqAddress: Address, lens: Lens<DeepReadonly<State>, DeepReadonly<USDQState>>, logger: Logger);
|
|
11
|
-
getTotalSupply(state: DeepReadonly<State>): bigint;
|
|
12
|
-
processLog(state: DeepReadonly<USDQState>, log: Readonly<Log>, blockHeader: Readonly<BlockHeader>): DeepReadonly<USDQState> | null;
|
|
13
|
-
getGenerateStateMultiCallInputs(): MultiCallInput[];
|
|
14
|
-
generateState(multicallOutputs: MultiCallOutput[], blockNumber?: number | 'latest'): DeepReadonly<USDQState>;
|
|
15
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.USDQ = void 0;
|
|
7
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
-
const abi_1 = require("@ethersproject/abi");
|
|
9
|
-
const composed_event_subscriber_1 = require("../../composed-event-subscriber");
|
|
10
|
-
const erc20_json_1 = __importDefault(require("../../abi/erc20.json"));
|
|
11
|
-
const constants_1 = require("../../constants");
|
|
12
|
-
class USDQ extends composed_event_subscriber_1.PartialEventSubscriber {
|
|
13
|
-
constructor(usdqAddress, lens, logger) {
|
|
14
|
-
super([usdqAddress], lens, logger);
|
|
15
|
-
this.usdqAddress = usdqAddress;
|
|
16
|
-
}
|
|
17
|
-
getTotalSupply(state) {
|
|
18
|
-
return this.lens.get()(state).totalSupply;
|
|
19
|
-
}
|
|
20
|
-
processLog(state, log, blockHeader) {
|
|
21
|
-
try {
|
|
22
|
-
const parsed = USDQ.interface.parseLog(log);
|
|
23
|
-
const _state = lodash_1.default.cloneDeep(state);
|
|
24
|
-
switch (parsed.name) {
|
|
25
|
-
case 'Transfer': {
|
|
26
|
-
const fromAddress = parsed.args.src;
|
|
27
|
-
const toAddress = parsed.args.dst;
|
|
28
|
-
if (fromAddress === constants_1.NULL_ADDRESS) {
|
|
29
|
-
_state.totalSupply += BigInt(parsed.args.wad.toString());
|
|
30
|
-
}
|
|
31
|
-
else if (toAddress === constants_1.NULL_ADDRESS) {
|
|
32
|
-
_state.totalSupply -= BigInt(parsed.args.wad.toString());
|
|
33
|
-
}
|
|
34
|
-
return _state;
|
|
35
|
-
}
|
|
36
|
-
default:
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
catch (e) {
|
|
41
|
-
this.logger.error('Failed to parse log', e);
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
getGenerateStateMultiCallInputs() {
|
|
46
|
-
return [
|
|
47
|
-
{
|
|
48
|
-
target: this.usdqAddress,
|
|
49
|
-
callData: USDQ.interface.encodeFunctionData('totalSupply'),
|
|
50
|
-
},
|
|
51
|
-
];
|
|
52
|
-
}
|
|
53
|
-
generateState(multicallOutputs, blockNumber) {
|
|
54
|
-
return {
|
|
55
|
-
totalSupply: BigInt(USDQ.interface.decodeFunctionResult('totalSupply', multicallOutputs[0])[0]),
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
exports.USDQ = USDQ;
|
|
60
|
-
USDQ.interface = new abi_1.Interface(erc20_json_1.default);
|
|
61
|
-
//# sourceMappingURL=usdq.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usdq.js","sourceRoot":"","sources":["../../../src/dex/quick-perps/usdq.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,4CAA+C;AAE/C,+EAAyE;AAUzE,sEAA4C;AAE5C,+CAA+C;AAE/C,MAAa,IAAY,SAAQ,kDAAwC;IAGvE,YACU,WAAoB,EAC5B,IAAwD,EACxD,MAAc;QAEd,KAAK,CAAC,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAJ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;IACJ,CAAC;IAEM,aAAa,CAClB,gBAAmC,EACnC,WAA+B;QAE/B,OAAO;YACL,WAAW,EAAE,MAAM,CACjB,IAAI,CAAC,SAAS,CAAC,oBAAoB,CACjC,aAAa,EACb,gBAAgB,CAAC,CAAC,CAAC,CACpB,CAAC,CAAC,CAAC,CACL;SACF,CAAC;IACJ,CAAC;;AAhEH,oBAiEC;AAhEiB,cAAS,GAAG,IAAI,eAAS,CAAC,oBAAQ,CAAC,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Interface } from '@ethersproject/abi';
|
|
2
|
-
import { Address, MultiCallInput, MultiCallOutput } from '../../types';
|
|
3
|
-
import { VaultPriceFeedConfig } from './types';
|
|
4
|
-
import { FastPriceFeed } from './fast-price-feed';
|
|
5
|
-
import { DeepReadonly } from 'ts-essentials';
|
|
6
|
-
import { Api3FeedSubscriber } from '../../lib/api3-feed';
|
|
7
|
-
export declare class VaultPriceFeed<State> {
|
|
8
|
-
protected primaryPrices: {
|
|
9
|
-
[token: string]: Api3FeedSubscriber<State>;
|
|
10
|
-
};
|
|
11
|
-
protected secondaryPrice: FastPriceFeed<State>;
|
|
12
|
-
BASIS_POINTS_DIVISOR: bigint;
|
|
13
|
-
PRICE_PRECISION: bigint;
|
|
14
|
-
ONE_USD: bigint;
|
|
15
|
-
static interface: Interface;
|
|
16
|
-
protected isSecondaryPriceEnabled: boolean;
|
|
17
|
-
protected strictStableTokens: {
|
|
18
|
-
[address: string]: boolean;
|
|
19
|
-
};
|
|
20
|
-
protected spreadBasisPoints: {
|
|
21
|
-
[address: string]: bigint;
|
|
22
|
-
};
|
|
23
|
-
protected adjustmentBasisPoints: {
|
|
24
|
-
[address: string]: bigint;
|
|
25
|
-
};
|
|
26
|
-
protected isAdjustmentAdditive: {
|
|
27
|
-
[address: string]: boolean;
|
|
28
|
-
};
|
|
29
|
-
protected priceDecimals: {
|
|
30
|
-
[address: string]: number;
|
|
31
|
-
};
|
|
32
|
-
protected maxStrictPriceDeviation: bigint;
|
|
33
|
-
constructor(config: VaultPriceFeedConfig, primaryPrices: {
|
|
34
|
-
[token: string]: Api3FeedSubscriber<State>;
|
|
35
|
-
}, secondaryPrice: FastPriceFeed<State>);
|
|
36
|
-
getPrice(state: DeepReadonly<State>, _token: Address, _maximize: boolean, _includeAmmPrice: boolean, _useSwapPricing: boolean): bigint;
|
|
37
|
-
getPriceV1(state: DeepReadonly<State>, _token: Address, _maximize: boolean, _includeAmmPrice: boolean): bigint;
|
|
38
|
-
getAmmPrice(state: DeepReadonly<State>, token: Address): bigint;
|
|
39
|
-
getPrimaryPrice(state: DeepReadonly<State>, _token: Address, _maximize: boolean): bigint;
|
|
40
|
-
getSecondaryPrice(state: DeepReadonly<State>, _token: Address, _referencePrice: bigint, _maximize: boolean): bigint;
|
|
41
|
-
static getConfigMulticallInputs(vaultPriceFeedAddress: Address, tokenAddresses: Address[]): MultiCallInput[];
|
|
42
|
-
static getConfig(multicallOutputs: MultiCallOutput[], tokenAddress: Address[]): VaultPriceFeedConfig;
|
|
43
|
-
}
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.VaultPriceFeed = void 0;
|
|
7
|
-
const abi_1 = require("@ethersproject/abi");
|
|
8
|
-
const vault_price_feed_json_1 = __importDefault(require("../../abi/quick-perps/vault-price-feed.json"));
|
|
9
|
-
class VaultPriceFeed {
|
|
10
|
-
constructor(config, primaryPrices, secondaryPrice) {
|
|
11
|
-
this.primaryPrices = primaryPrices;
|
|
12
|
-
this.secondaryPrice = secondaryPrice;
|
|
13
|
-
this.BASIS_POINTS_DIVISOR = 10000n;
|
|
14
|
-
this.PRICE_PRECISION = 10n ** 30n;
|
|
15
|
-
this.ONE_USD = this.PRICE_PRECISION;
|
|
16
|
-
this.isSecondaryPriceEnabled = config.isSecondaryPriceEnabled;
|
|
17
|
-
this.strictStableTokens = config.strictStableTokens;
|
|
18
|
-
this.spreadBasisPoints = config.spreadBasisPoints;
|
|
19
|
-
this.adjustmentBasisPoints = config.adjustmentBasisPoints;
|
|
20
|
-
this.isAdjustmentAdditive = config.isAdjustmentAdditive;
|
|
21
|
-
this.priceDecimals = config.priceDecimals;
|
|
22
|
-
this.maxStrictPriceDeviation = config.maxStrictPriceDeviation;
|
|
23
|
-
}
|
|
24
|
-
getPrice(state, _token, _maximize, _includeAmmPrice, _useSwapPricing) {
|
|
25
|
-
let price = this.getPriceV1(state, _token, _maximize, _includeAmmPrice);
|
|
26
|
-
const adjustmentBps = this.adjustmentBasisPoints[_token];
|
|
27
|
-
if (adjustmentBps > 0n) {
|
|
28
|
-
const isAdditive = this.isAdjustmentAdditive[_token];
|
|
29
|
-
if (isAdditive) {
|
|
30
|
-
price =
|
|
31
|
-
(price * (this.BASIS_POINTS_DIVISOR + adjustmentBps)) /
|
|
32
|
-
this.BASIS_POINTS_DIVISOR;
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
price =
|
|
36
|
-
(price * (this.BASIS_POINTS_DIVISOR - adjustmentBps)) /
|
|
37
|
-
this.BASIS_POINTS_DIVISOR;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return price;
|
|
41
|
-
}
|
|
42
|
-
getPriceV1(state, _token, _maximize, _includeAmmPrice) {
|
|
43
|
-
let price = this.getPrimaryPrice(state, _token, _maximize);
|
|
44
|
-
if (this.isSecondaryPriceEnabled) {
|
|
45
|
-
price = this.getSecondaryPrice(state, _token, price, _maximize);
|
|
46
|
-
}
|
|
47
|
-
if (this.strictStableTokens[_token]) {
|
|
48
|
-
const delta = price > this.ONE_USD ? price - this.ONE_USD : this.ONE_USD - price;
|
|
49
|
-
if (delta <= this.maxStrictPriceDeviation) {
|
|
50
|
-
return this.ONE_USD;
|
|
51
|
-
}
|
|
52
|
-
// if _maximize and price is e.g. 1.02, return 1.02
|
|
53
|
-
if (_maximize && price > this.ONE_USD) {
|
|
54
|
-
return price;
|
|
55
|
-
}
|
|
56
|
-
// if !_maximize and price is e.g. 0.98, return 0.98
|
|
57
|
-
if (!_maximize && price < this.ONE_USD) {
|
|
58
|
-
return price;
|
|
59
|
-
}
|
|
60
|
-
return this.ONE_USD;
|
|
61
|
-
}
|
|
62
|
-
const _spreadBasisPoints = this.spreadBasisPoints[_token];
|
|
63
|
-
if (_maximize) {
|
|
64
|
-
return ((price * (this.BASIS_POINTS_DIVISOR + _spreadBasisPoints)) /
|
|
65
|
-
this.BASIS_POINTS_DIVISOR);
|
|
66
|
-
}
|
|
67
|
-
return ((price * (this.BASIS_POINTS_DIVISOR - _spreadBasisPoints)) /
|
|
68
|
-
this.BASIS_POINTS_DIVISOR);
|
|
69
|
-
}
|
|
70
|
-
getAmmPrice(state, token) {
|
|
71
|
-
throw new Error('getAmmPrice implementation is not complete, developers should disable the dex or complete the implementation');
|
|
72
|
-
}
|
|
73
|
-
getPrimaryPrice(state, _token, _maximize) {
|
|
74
|
-
// const priceFeedAddress = this.priceFeeds[_token];
|
|
75
|
-
// require(priceFeedAddress != address(0), "VaultPriceFeed: invalid price feed");
|
|
76
|
-
// if (chainlinkFlags != address(0)) {
|
|
77
|
-
// bool isRaised = IChainlinkFlags(chainlinkFlags).getFlag(FLAG_ARBITRUM_SEQ_OFFLINE);
|
|
78
|
-
// if (isRaised) {
|
|
79
|
-
// // If flag is raised we shouldn't perform any critical operations
|
|
80
|
-
// revert("Chainlink feeds are not being updated");
|
|
81
|
-
// }
|
|
82
|
-
// }
|
|
83
|
-
// IPriceFeed priceFeed = IPriceFeed(priceFeedAddress);
|
|
84
|
-
let price = 0n;
|
|
85
|
-
// const roundId = priceFeed.latestRound;
|
|
86
|
-
// for (let i = 0; i < this.priceSampleSpace; i++) {
|
|
87
|
-
// if (roundId <= i) {
|
|
88
|
-
// break;
|
|
89
|
-
// }
|
|
90
|
-
// if (i == 0) {
|
|
91
|
-
// const _p = priceFeed.latestAnswer();
|
|
92
|
-
// require(_p > 0, "VaultPriceFeed: invalid price");
|
|
93
|
-
// p = uint256(_p);
|
|
94
|
-
// } else {
|
|
95
|
-
// (, int256 _p, , ,) = priceFeed.getRoundData(roundId - i);
|
|
96
|
-
// require(_p > 0, "VaultPriceFeed: invalid price");
|
|
97
|
-
// p = uint256(_p);
|
|
98
|
-
// }
|
|
99
|
-
// if (price == 0n) {
|
|
100
|
-
// price = p;
|
|
101
|
-
// continue;
|
|
102
|
-
// }
|
|
103
|
-
// if (_maximize && p > price) {
|
|
104
|
-
// price = p;
|
|
105
|
-
// continue;
|
|
106
|
-
// }
|
|
107
|
-
// if (!_maximize && p < price) {
|
|
108
|
-
// price = p;
|
|
109
|
-
// }
|
|
110
|
-
// }
|
|
111
|
-
price = this.primaryPrices[_token].getLatestData(state);
|
|
112
|
-
// require(price > 0n, "VaultPriceFeed: could not fetch price");
|
|
113
|
-
if (price <= 0n)
|
|
114
|
-
throw new Error('VaultPriceFeed: could not fetch price');
|
|
115
|
-
// normalize price precision
|
|
116
|
-
const _priceDecimals = this.priceDecimals[_token];
|
|
117
|
-
return (price * this.PRICE_PRECISION) / BigInt(10 ** _priceDecimals);
|
|
118
|
-
}
|
|
119
|
-
getSecondaryPrice(state, _token, _referencePrice, _maximize) {
|
|
120
|
-
return this.secondaryPrice.getPrice(state, _token, _referencePrice, _maximize);
|
|
121
|
-
}
|
|
122
|
-
static getConfigMulticallInputs(vaultPriceFeedAddress, tokenAddresses) {
|
|
123
|
-
return [
|
|
124
|
-
{
|
|
125
|
-
target: vaultPriceFeedAddress,
|
|
126
|
-
callData: VaultPriceFeed.interface.encodeFunctionData('isSecondaryPriceEnabled'),
|
|
127
|
-
},
|
|
128
|
-
...tokenAddresses.map(t => ({
|
|
129
|
-
target: vaultPriceFeedAddress,
|
|
130
|
-
callData: VaultPriceFeed.interface.encodeFunctionData('strictStableTokens', [t]),
|
|
131
|
-
})),
|
|
132
|
-
...tokenAddresses.map(t => ({
|
|
133
|
-
target: vaultPriceFeedAddress,
|
|
134
|
-
callData: VaultPriceFeed.interface.encodeFunctionData('spreadBasisPoints', [t]),
|
|
135
|
-
})),
|
|
136
|
-
...tokenAddresses.map(t => ({
|
|
137
|
-
target: vaultPriceFeedAddress,
|
|
138
|
-
callData: VaultPriceFeed.interface.encodeFunctionData('isAdjustmentAdditive', [t]),
|
|
139
|
-
})),
|
|
140
|
-
...tokenAddresses.map(t => ({
|
|
141
|
-
target: vaultPriceFeedAddress,
|
|
142
|
-
callData: VaultPriceFeed.interface.encodeFunctionData('adjustmentBasisPoints', [t]),
|
|
143
|
-
})),
|
|
144
|
-
...tokenAddresses.map(t => ({
|
|
145
|
-
target: vaultPriceFeedAddress,
|
|
146
|
-
callData: VaultPriceFeed.interface.encodeFunctionData('priceDecimals', [
|
|
147
|
-
t,
|
|
148
|
-
]),
|
|
149
|
-
})),
|
|
150
|
-
{
|
|
151
|
-
target: vaultPriceFeedAddress,
|
|
152
|
-
callData: VaultPriceFeed.interface.encodeFunctionData('maxStrictPriceDeviation'),
|
|
153
|
-
},
|
|
154
|
-
];
|
|
155
|
-
}
|
|
156
|
-
static getConfig(multicallOutputs, tokenAddress) {
|
|
157
|
-
let i = 0;
|
|
158
|
-
return {
|
|
159
|
-
isSecondaryPriceEnabled: VaultPriceFeed.interface.decodeFunctionResult('isSecondaryPriceEnabled', multicallOutputs[i++])[0],
|
|
160
|
-
strictStableTokens: tokenAddress.reduce((acc, t) => {
|
|
161
|
-
acc[t] = VaultPriceFeed.interface.decodeFunctionResult('strictStableTokens', multicallOutputs[i++])[0];
|
|
162
|
-
return acc;
|
|
163
|
-
}, {}),
|
|
164
|
-
spreadBasisPoints: tokenAddress.reduce((acc, t) => {
|
|
165
|
-
acc[t] = BigInt(VaultPriceFeed.interface
|
|
166
|
-
.decodeFunctionResult('spreadBasisPoints', multicallOutputs[i++])[0]
|
|
167
|
-
.toString());
|
|
168
|
-
return acc;
|
|
169
|
-
}, {}),
|
|
170
|
-
isAdjustmentAdditive: tokenAddress.reduce((acc, t) => {
|
|
171
|
-
acc[t] = VaultPriceFeed.interface.decodeFunctionResult('isAdjustmentAdditive', multicallOutputs[i++])[0];
|
|
172
|
-
return acc;
|
|
173
|
-
}, {}),
|
|
174
|
-
adjustmentBasisPoints: tokenAddress.reduce((acc, t) => {
|
|
175
|
-
acc[t] = BigInt(VaultPriceFeed.interface
|
|
176
|
-
.decodeFunctionResult('adjustmentBasisPoints', multicallOutputs[i++])[0]
|
|
177
|
-
.toString());
|
|
178
|
-
return acc;
|
|
179
|
-
}, {}),
|
|
180
|
-
priceDecimals: tokenAddress.reduce((acc, t) => {
|
|
181
|
-
acc[t] = parseInt(VaultPriceFeed.interface
|
|
182
|
-
.decodeFunctionResult('priceDecimals', multicallOutputs[i++])[0]
|
|
183
|
-
.toString());
|
|
184
|
-
return acc;
|
|
185
|
-
}, {}),
|
|
186
|
-
maxStrictPriceDeviation: BigInt(VaultPriceFeed.interface
|
|
187
|
-
.decodeFunctionResult('maxStrictPriceDeviation', multicallOutputs[i++])[0]
|
|
188
|
-
.toString()),
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
exports.VaultPriceFeed = VaultPriceFeed;
|
|
193
|
-
VaultPriceFeed.interface = new abi_1.Interface(vault_price_feed_json_1.default);
|
|
194
|
-
//# sourceMappingURL=vault-price-feed.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vault-price-feed.js","sourceRoot":"","sources":["../../../src/dex/quick-perps/vault-price-feed.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAI/C,wGAA4E;AAI5E,MAAa,cAAc;IAezB,YACE,MAA4B,EAClB,aAA6D,EAC7D,cAAoC;QADpC,kBAAa,GAAb,aAAa,CAAgD;QAC7D,mBAAc,GAAd,cAAc,CAAsB;QAjBhD,yBAAoB,GAAG,MAAM,CA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