@paraswap/dex-lib 4.7.5-unified-blacklist.3 → 4.7.6
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/BProtocol.json +1155 -0
- package/build/abi/Jarvis.json +1172 -0
- package/build/abi/MStableAsset.json +1545 -0
- package/build/abi/OneInchLp.json +1304 -0
- package/build/abi/Onebit.json +736 -0
- package/build/abi/Shell.json +1294 -0
- package/build/abi/TraderJoeV2Router.json +50 -0
- package/build/abi/wUSDM.json +757 -0
- package/build/abi/zrx.v2.json +1967 -0
- package/build/abi/zrx.v3.json +3454 -0
- package/build/abi/zrx.v4.json +2193 -0
- package/build/dex/OneInchLp.d.ts +24 -0
- package/build/dex/OneInchLp.js +43 -0
- package/build/dex/OneInchLp.js.map +1 -0
- package/build/dex/bProtocol/bProtocol.d.ts +15 -0
- package/build/dex/bProtocol/bProtocol.js +56 -0
- package/build/dex/bProtocol/bProtocol.js.map +1 -0
- package/build/dex/bProtocol/types.d.ts +11 -0
- package/build/dex/bProtocol/types.js +8 -0
- package/build/dex/bProtocol/types.js.map +1 -0
- package/build/dex/balancer-v2/balancer-v2.d.ts +1 -1
- package/build/dex/balancer-v2/balancer-v2.js +39 -37
- package/build/dex/balancer-v2/balancer-v2.js.map +1 -1
- package/build/dex/balancer-v2/constants.d.ts +1 -0
- package/build/dex/balancer-v2/constants.js +2 -1
- package/build/dex/balancer-v2/constants.js.map +1 -1
- package/build/dex/bebop/bebop.d.ts +1 -1
- package/build/dex/bebop/bebop.js +27 -16
- package/build/dex/bebop/bebop.js.map +1 -1
- package/build/dex/curve-v1/config.js +21 -21
- package/build/dex/curve-v1/config.js.map +1 -1
- package/build/dex/curve-v1/curve-v1.d.ts +3 -1
- package/build/dex/curve-v1/curve-v1.js +26 -1
- package/build/dex/curve-v1/curve-v1.js.map +1 -1
- package/build/dex/curve-v1/types.d.ts +6 -0
- package/build/dex/dexalot/constants.d.ts +1 -0
- package/build/dex/dexalot/constants.js +2 -1
- package/build/dex/dexalot/constants.js.map +1 -1
- package/build/dex/dexalot/dexalot.js +1 -1
- package/build/dex/dexalot/dexalot.js.map +1 -1
- package/build/dex/generic-rfq/types.d.ts +6 -0
- package/build/dex/generic-rfq/types.js +12 -1
- package/build/dex/generic-rfq/types.js.map +1 -1
- package/build/dex/idle-dao/idle-dao.d.ts +0 -1
- package/build/dex/idle-dao/idle-dao.js +11 -23
- package/build/dex/idle-dao/idle-dao.js.map +1 -1
- package/build/dex/jarvis.d.ts +56 -0
- package/build/dex/jarvis.js +163 -0
- package/build/dex/jarvis.js.map +1 -0
- package/build/dex/mStable.d.ts +44 -0
- package/build/dex/mStable.js +75 -0
- package/build/dex/mStable.js.map +1 -0
- package/build/dex/maker-psm/maker-psm.d.ts +41 -4
- package/build/dex/maker-psm/maker-psm.js +143 -40
- package/build/dex/maker-psm/maker-psm.js.map +1 -1
- package/build/dex/onebit/onebit.d.ts +16 -0
- package/build/dex/onebit/onebit.js +61 -0
- package/build/dex/onebit/onebit.js.map +1 -0
- package/build/dex/onebit/types.d.ts +14 -0
- package/build/dex/onebit/types.js +8 -0
- package/build/dex/onebit/types.js.map +1 -0
- package/build/dex/se-vlr/config.d.ts +3 -0
- package/build/dex/se-vlr/config.js +24 -0
- package/build/dex/se-vlr/config.js.map +1 -0
- package/build/dex/{maker-psm/maker-psm-event-pool.d.ts → se-vlr/se-vlr-pool.d.ts} +11 -15
- package/build/dex/se-vlr/se-vlr-pool.js +70 -0
- package/build/dex/se-vlr/se-vlr-pool.js.map +1 -0
- package/build/dex/se-vlr/se-vlr.d.ts +35 -0
- package/build/dex/se-vlr/se-vlr.js +131 -0
- package/build/dex/se-vlr/se-vlr.js.map +1 -0
- package/build/dex/se-vlr/types.d.ts +6 -0
- package/build/dex/se-vlr/types.js +3 -0
- package/build/dex/se-vlr/types.js.map +1 -0
- package/build/dex/shell.d.ts +25 -0
- package/build/dex/shell.js +41 -0
- package/build/dex/shell.js.map +1 -0
- package/build/dex/simple-exchange-with-restrictions.js +2 -2
- package/build/dex/simple-exchange-with-restrictions.js.map +1 -1
- package/build/dex/trader-joe-v2.d.ts +40 -0
- package/build/dex/trader-joe-v2.js +74 -0
- package/build/dex/trader-joe-v2.js.map +1 -0
- package/build/dex/uniswap-v3/uniswap-v3-new.d.ts +94 -0
- package/build/dex/uniswap-v3/uniswap-v3-new.js +923 -0
- package/build/dex/uniswap-v3/uniswap-v3-new.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/Position.d.ts +0 -6
- package/build/dex/uniswap-v4/contract-math/Position.js +0 -29
- package/build/dex/uniswap-v4/contract-math/Position.js.map +1 -1
- package/build/dex/uniswap-v4/subgraph.js +6 -0
- package/build/dex/uniswap-v4/subgraph.js.map +1 -1
- package/build/dex/uniswap-v4/types.d.ts +3 -0
- package/build/dex/uniswap-v4/uniswap-v4-pool-manager.d.ts +5 -1
- package/build/dex/uniswap-v4/uniswap-v4-pool-manager.js +86 -0
- package/build/dex/uniswap-v4/uniswap-v4-pool-manager.js.map +1 -1
- package/build/dex/uniswap-v4/uniswap-v4.d.ts +1 -1
- package/build/dex/uniswap-v4/uniswap-v4.js +50 -36
- package/build/dex/uniswap-v4/uniswap-v4.js.map +1 -1
- package/build/dex/usual-bond/config.d.ts +3 -0
- package/build/dex/usual-bond/config.js +13 -0
- package/build/dex/usual-bond/config.js.map +1 -0
- package/build/dex/usual-bond/types.d.ts +7 -0
- package/build/dex/usual-bond/types.js +3 -0
- package/build/dex/usual-bond/types.js.map +1 -0
- package/build/dex/usual-bond/usual-bond.d.ts +35 -0
- package/build/dex/usual-bond/usual-bond.js +176 -0
- package/build/dex/usual-bond/usual-bond.js.map +1 -0
- package/build/dex/wusdm/config.d.ts +3 -0
- package/build/dex/wusdm/config.js +43 -0
- package/build/dex/wusdm/config.js.map +1 -0
- package/build/dex/wusdm/constants.d.ts +2 -0
- package/build/dex/wusdm/constants.js +6 -0
- package/build/dex/wusdm/constants.js.map +1 -0
- package/build/dex/wusdm/types.d.ts +18 -0
- package/build/dex/wusdm/types.js +11 -0
- package/build/dex/wusdm/types.js.map +1 -0
- package/build/dex/wusdm/wusdm-pool.d.ts +21 -0
- package/build/dex/wusdm/wusdm-pool.js +74 -0
- package/build/dex/wusdm/wusdm-pool.js.map +1 -0
- package/build/dex/wusdm/wusdm.d.ts +46 -0
- package/build/dex/wusdm/wusdm.js +243 -0
- package/build/dex/wusdm/wusdm.js.map +1 -0
- package/build/dex/zerox/config.d.ts +2 -0
- package/build/dex/zerox/config.js +33 -0
- package/build/dex/zerox/config.js.map +1 -0
- package/build/dex/zerox/index.d.ts +22 -0
- package/build/dex/zerox/index.js +225 -0
- package/build/dex/zerox/index.js.map +1 -0
- package/build/dex/zerox/order.d.ts +88 -0
- package/build/dex/zerox/order.js +53 -0
- package/build/dex/zerox/order.js.map +1 -0
- package/build/dex/zerox/types.d.ts +73 -0
- package/build/dex/zerox/types.js +21 -0
- package/build/dex/zerox/types.js.map +1 -0
- package/package.json +1 -1
- package/build/dex/maker-psm/maker-psm-event-pool.js +0 -132
- package/build/dex/maker-psm/maker-psm-event-pool.js.map +0 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Token, Address, ExchangePrices, PoolPrices, AdapterExchangeParam, Logger, NumberAsString, DexExchangeParam, PoolLiquidity } from '../../types';
|
|
2
|
+
import { SwapSide, Network } from '../../constants';
|
|
3
|
+
import { IDex } from '../idex';
|
|
4
|
+
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
5
|
+
import { UsualBondData, DexParams } from './types';
|
|
6
|
+
import { SimpleExchange } from '../simple-exchange';
|
|
7
|
+
import { Interface } from '@ethersproject/abi';
|
|
8
|
+
export declare class UsualBond extends SimpleExchange implements IDex<UsualBondData> {
|
|
9
|
+
readonly network: Network;
|
|
10
|
+
readonly dexKey: string;
|
|
11
|
+
readonly dexHelper: IDexHelper;
|
|
12
|
+
protected config: DexParams;
|
|
13
|
+
readonly hasConstantPriceLargeAmounts = true;
|
|
14
|
+
readonly needWrapNative = false;
|
|
15
|
+
readonly isFeeOnTransferSupported = false;
|
|
16
|
+
static dexKeysWithNetwork: {
|
|
17
|
+
key: string;
|
|
18
|
+
networks: Network[];
|
|
19
|
+
}[];
|
|
20
|
+
usd0ppIface: Interface;
|
|
21
|
+
logger: Logger;
|
|
22
|
+
constructor(network: Network, dexKey: string, dexHelper: IDexHelper);
|
|
23
|
+
initializePricing(blockNumber: number): Promise<void>;
|
|
24
|
+
getConfig(): DexParams;
|
|
25
|
+
is_usd0(token: string): boolean;
|
|
26
|
+
is_usd0pp(token: string): boolean;
|
|
27
|
+
is_usd0_swap_token(srcToken: string, destToken: string): boolean;
|
|
28
|
+
getAdapters(): null;
|
|
29
|
+
getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
|
|
30
|
+
getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[]): Promise<null | ExchangePrices<UsualBondData>>;
|
|
31
|
+
getCalldataGasCost(poolPrices: PoolPrices<UsualBondData>): number | number[];
|
|
32
|
+
getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: UsualBondData, side: SwapSide): AdapterExchangeParam;
|
|
33
|
+
getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: UsualBondData, side: SwapSide): Promise<DexExchangeParam>;
|
|
34
|
+
getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.UsualBond = void 0;
|
|
40
|
+
const constants_1 = require("../../constants");
|
|
41
|
+
const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
|
|
42
|
+
const utils_1 = require("../../utils");
|
|
43
|
+
const simple_exchange_1 = require("../simple-exchange");
|
|
44
|
+
const config_1 = require("./config");
|
|
45
|
+
const abi_1 = require("@ethersproject/abi");
|
|
46
|
+
const usd0pp_abi_json_1 = __importDefault(require("../../abi/usual-bond/usd0pp.abi.json"));
|
|
47
|
+
const bigint_constants_1 = require("../../bigint-constants");
|
|
48
|
+
class UsualBond extends simple_exchange_1.SimpleExchange {
|
|
49
|
+
network;
|
|
50
|
+
dexKey;
|
|
51
|
+
dexHelper;
|
|
52
|
+
config;
|
|
53
|
+
hasConstantPriceLargeAmounts = true;
|
|
54
|
+
needWrapNative = false;
|
|
55
|
+
isFeeOnTransferSupported = false;
|
|
56
|
+
static dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.UsualBondConfig);
|
|
57
|
+
usd0ppIface;
|
|
58
|
+
logger;
|
|
59
|
+
constructor(network, dexKey, dexHelper) {
|
|
60
|
+
super(dexHelper, dexKey);
|
|
61
|
+
this.network = network;
|
|
62
|
+
this.dexKey = dexKey;
|
|
63
|
+
this.dexHelper = dexHelper;
|
|
64
|
+
const config = config_1.UsualBondConfig[dexKey][network];
|
|
65
|
+
this.usd0ppIface = new abi_1.Interface(usd0pp_abi_json_1.default);
|
|
66
|
+
this.config = {
|
|
67
|
+
usd0Address: config.usd0Address.toLowerCase(),
|
|
68
|
+
usd0ppAddress: config.usd0ppAddress.toLowerCase(),
|
|
69
|
+
};
|
|
70
|
+
this.logger = dexHelper.getLogger(dexKey);
|
|
71
|
+
}
|
|
72
|
+
async initializePricing(blockNumber) {
|
|
73
|
+
// No initialization needed for constant price
|
|
74
|
+
}
|
|
75
|
+
getConfig() {
|
|
76
|
+
return this.config;
|
|
77
|
+
}
|
|
78
|
+
is_usd0(token) {
|
|
79
|
+
return token.toLowerCase() === this.config.usd0Address.toLowerCase();
|
|
80
|
+
}
|
|
81
|
+
is_usd0pp(token) {
|
|
82
|
+
return token.toLowerCase() === this.config.usd0ppAddress.toLowerCase();
|
|
83
|
+
}
|
|
84
|
+
is_usd0_swap_token(srcToken, destToken) {
|
|
85
|
+
return this.is_usd0(srcToken) && this.is_usd0pp(destToken);
|
|
86
|
+
}
|
|
87
|
+
getAdapters() {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
async getPoolIdentifiers(srcToken, destToken, side, blockNumber) {
|
|
91
|
+
if (!srcToken || !destToken) {
|
|
92
|
+
this.logger.error('Source or destination token is undefined');
|
|
93
|
+
return [];
|
|
94
|
+
}
|
|
95
|
+
const srcTokenAddress = srcToken.address?.toLowerCase();
|
|
96
|
+
const destTokenAddress = destToken.address?.toLowerCase();
|
|
97
|
+
if (!srcTokenAddress || !destTokenAddress) {
|
|
98
|
+
this.logger.error('Source or destination token address is undefined');
|
|
99
|
+
return [];
|
|
100
|
+
}
|
|
101
|
+
if (this.is_usd0_swap_token(srcTokenAddress, destTokenAddress)) {
|
|
102
|
+
return [`${this.dexKey}_${this.config.usd0ppAddress}`];
|
|
103
|
+
}
|
|
104
|
+
return [];
|
|
105
|
+
}
|
|
106
|
+
async getPricesVolume(srcToken, destToken, amounts, side, blockNumber, limitPools) {
|
|
107
|
+
if (side === constants_1.SwapSide.BUY) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
const isUSD0SwapToken = this.is_usd0_swap_token(srcToken.address, destToken.address);
|
|
111
|
+
if (!isUSD0SwapToken) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
const unitOut = bigint_constants_1.BI_POWS[18]; // 1:1 swap
|
|
115
|
+
const amountsOut = amounts; // 1:1 swap, so output amounts are the same as input
|
|
116
|
+
return [
|
|
117
|
+
{
|
|
118
|
+
unit: unitOut,
|
|
119
|
+
prices: amountsOut,
|
|
120
|
+
data: {},
|
|
121
|
+
poolAddresses: [this.config.usd0ppAddress],
|
|
122
|
+
exchange: this.dexKey,
|
|
123
|
+
gasCost: 70000,
|
|
124
|
+
poolIdentifier: this.dexKey,
|
|
125
|
+
},
|
|
126
|
+
];
|
|
127
|
+
}
|
|
128
|
+
getCalldataGasCost(poolPrices) {
|
|
129
|
+
return CALLDATA_GAS_COST.DEX_NO_PAYLOAD;
|
|
130
|
+
}
|
|
131
|
+
getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
132
|
+
const payload = '0x';
|
|
133
|
+
return {
|
|
134
|
+
targetExchange: this.config.usd0ppAddress,
|
|
135
|
+
payload,
|
|
136
|
+
networkFee: '0',
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
async getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side) {
|
|
140
|
+
if (this.is_usd0(srcToken) && this.is_usd0pp(destToken)) {
|
|
141
|
+
const exchangeData = this.usd0ppIface.encodeFunctionData('mint', [
|
|
142
|
+
srcAmount,
|
|
143
|
+
]);
|
|
144
|
+
return {
|
|
145
|
+
needWrapNative: false,
|
|
146
|
+
dexFuncHasRecipient: false,
|
|
147
|
+
exchangeData,
|
|
148
|
+
targetExchange: this.config.usd0ppAddress,
|
|
149
|
+
returnAmountPos: undefined,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
throw new Error('LOGIC ERROR');
|
|
153
|
+
}
|
|
154
|
+
async getTopPoolsForToken(tokenAddress, limit) {
|
|
155
|
+
const isUsd0 = this.is_usd0(tokenAddress);
|
|
156
|
+
if (!isUsd0 && !this.is_usd0pp(tokenAddress))
|
|
157
|
+
return [];
|
|
158
|
+
return [
|
|
159
|
+
{
|
|
160
|
+
exchange: this.dexKey,
|
|
161
|
+
address: this.config.usd0ppAddress,
|
|
162
|
+
connectorTokens: [
|
|
163
|
+
{
|
|
164
|
+
decimals: 18,
|
|
165
|
+
address: isUsd0
|
|
166
|
+
? this.config.usd0ppAddress
|
|
167
|
+
: this.config.usd0Address,
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
liquidityUSD: 1000000000, // Just returning a big number so this DEX will be preferred
|
|
171
|
+
},
|
|
172
|
+
];
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
exports.UsualBond = UsualBond;
|
|
176
|
+
//# sourceMappingURL=usual-bond.js.map
|
|
@@ -0,0 +1 @@
|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CAAC,SAAS,CAAC,EAAE,CAAC;YACxD,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,MAAM,EAAE;gBAC/D,SAAS;aACV,CAAC,CAAC;YAEH,OAAO;gBACL,cAAc,EAAE,KAAK;gBACrB,mBAAmB,EAAE,KAAK;gBAC1B,YAAY;gBACZ,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa;gBACzC,eAAe,EAAE,SAAS;aAC3B,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,mBAAmB,CACvB,YAAqB,EACrB,KAAa;QAEb,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC;YAAE,OAAO,EAAE,CAAC;QAExD,OAAO;YACL;gBACE,QAAQ,EAAE,IAAI,CAAC,MAAM;gBACrB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa;gBAClC,eAAe,EAAE;oBACf;wBACE,QAAQ,EAAE,EAAE;wBACZ,OAAO,EAAE,MAAM;4BACb,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa;4BAC3B,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW;qBAC5B;iBACF;gBACD,YAAY,EAAE,UAAU,EAAE,4DAA4D;aACvF;SACF,CAAC;IACJ,CAAC;;AAvLH,8BAwLC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WUSDMConfig = void 0;
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
5
|
+
exports.WUSDMConfig = {
|
|
6
|
+
wUSDM: {
|
|
7
|
+
[constants_1.Network.MAINNET]: {
|
|
8
|
+
wUSDMAddress: '0x57F5E098CaD7A3D1Eed53991D4d66C45C9AF7812',
|
|
9
|
+
USDMAddress: '0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C',
|
|
10
|
+
},
|
|
11
|
+
[constants_1.Network.OPTIMISM]: {
|
|
12
|
+
wUSDMAddress: '0x57F5E098CaD7A3D1Eed53991D4d66C45C9AF7812',
|
|
13
|
+
USDMAddress: '0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C',
|
|
14
|
+
},
|
|
15
|
+
[constants_1.Network.ARBITRUM]: {
|
|
16
|
+
wUSDMAddress: '0x57F5E098CaD7A3D1Eed53991D4d66C45C9AF7812',
|
|
17
|
+
USDMAddress: '0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C',
|
|
18
|
+
},
|
|
19
|
+
[constants_1.Network.BASE]: {
|
|
20
|
+
wUSDMAddress: '0x57F5E098CaD7A3D1Eed53991D4d66C45C9AF7812',
|
|
21
|
+
USDMAddress: '0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C',
|
|
22
|
+
},
|
|
23
|
+
[constants_1.Network.POLYGON]: {
|
|
24
|
+
wUSDMAddress: '0x57F5E098CaD7A3D1Eed53991D4d66C45C9AF7812',
|
|
25
|
+
USDMAddress: '0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
// not really wUSDM, but works in the same way
|
|
29
|
+
// might give 1wei difference on BUY
|
|
30
|
+
sDAI: {
|
|
31
|
+
[constants_1.Network.GNOSIS]: {
|
|
32
|
+
wUSDMAddress: '0xaf204776c7245bF4147c2612BF6e5972Ee483701', // sDAI
|
|
33
|
+
USDMAddress: '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d', // WXDAI
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
wUSDL: {
|
|
37
|
+
[constants_1.Network.MAINNET]: {
|
|
38
|
+
wUSDMAddress: '0x7751E2F4b8ae93EF6B79d86419d42FE3295A4559', // wUSDL
|
|
39
|
+
USDMAddress: '0xbdC7c08592Ee4aa51D06C27Ee23D5087D65aDbcD', // USDL
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/wusdm/config.ts"],"names":[],"mappings":";;;AAEA,+CAA0C;AAE7B,QAAA,WAAW,GAA8B;IACpD,KAAK,EAAE;QACL,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;YACjB,YAAY,EAAE,4CAA4C;YAC1D,WAAW,EAAE,4CAA4C;SAC1D;QACD,CAAC,mBAAO,CAAC,QAAQ,CAAC,EAAE;YAClB,YAAY,EAAE,4CAA4C;YAC1D,WAAW,EAAE,4CAA4C;SAC1D;QACD,CAAC,mBAAO,CAAC,QAAQ,CAAC,EAAE;YAClB,YAAY,EAAE,4CAA4C;YAC1D,WAAW,EAAE,4CAA4C;SAC1D;QACD,CAAC,mBAAO,CAAC,IAAI,CAAC,EAAE;YACd,YAAY,EAAE,4CAA4C;YAC1D,WAAW,EAAE,4CAA4C;SAC1D;QACD,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;YACjB,YAAY,EAAE,4CAA4C;YAC1D,WAAW,EAAE,4CAA4C;SAC1D;KACF;IACD,8CAA8C;IAC9C,oCAAoC;IACpC,IAAI,EAAE;QACJ,CAAC,mBAAO,CAAC,MAAM,CAAC,EAAE;YAChB,YAAY,EAAE,4CAA4C,EAAE,OAAO;YACnE,WAAW,EAAE,4CAA4C,EAAE,QAAQ;SACpE;KACF;IAED,KAAK,EAAE;QACL,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;YACjB,YAAY,EAAE,4CAA4C,EAAE,QAAQ;YACpE,WAAW,EAAE,4CAA4C,EAAE,OAAO;SACnE;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEPOSIT_TOPIC = exports.WITHDRAW_TOPIC = void 0;
|
|
4
|
+
exports.WITHDRAW_TOPIC = '0xfbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db';
|
|
5
|
+
exports.DEPOSIT_TOPIC = '0xdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7';
|
|
6
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/dex/wusdm/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GACzB,oEAAoE,CAAC;AAC1D,QAAA,aAAa,GACxB,oEAAoE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Address } from '../../types';
|
|
2
|
+
export type WusdmPoolState = {
|
|
3
|
+
totalShares: bigint;
|
|
4
|
+
totalAssets: bigint;
|
|
5
|
+
};
|
|
6
|
+
export type WUSDMData = {
|
|
7
|
+
exchange: string;
|
|
8
|
+
};
|
|
9
|
+
export declare enum WUSDMFunctions {
|
|
10
|
+
deposit = "deposit",
|
|
11
|
+
redeem = "redeem",
|
|
12
|
+
withdraw = "withdraw",
|
|
13
|
+
mint = "mint"
|
|
14
|
+
}
|
|
15
|
+
export type WusdmParams = {
|
|
16
|
+
wUSDMAddress: Address;
|
|
17
|
+
USDMAddress: Address;
|
|
18
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WUSDMFunctions = void 0;
|
|
4
|
+
var WUSDMFunctions;
|
|
5
|
+
(function (WUSDMFunctions) {
|
|
6
|
+
WUSDMFunctions["deposit"] = "deposit";
|
|
7
|
+
WUSDMFunctions["redeem"] = "redeem";
|
|
8
|
+
WUSDMFunctions["withdraw"] = "withdraw";
|
|
9
|
+
WUSDMFunctions["mint"] = "mint";
|
|
10
|
+
})(WUSDMFunctions || (exports.WUSDMFunctions = WUSDMFunctions = {}));
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/wusdm/types.ts"],"names":[],"mappings":";;;AAWA,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,mCAAiB,CAAA;IACjB,uCAAqB,CAAA;IACrB,+BAAa,CAAA;AACf,CAAC,EALW,cAAc,8BAAd,cAAc,QAKzB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
2
|
+
import { Interface } from '@ethersproject/abi';
|
|
3
|
+
import type { IDexHelper } from '../../dex-helper';
|
|
4
|
+
import type { DeepReadonly } from 'ts-essentials';
|
|
5
|
+
import type { Address, BlockHeader, Log, Logger } from '../../types';
|
|
6
|
+
import type { WusdmPoolState } from './types';
|
|
7
|
+
import { Network } from '../../constants';
|
|
8
|
+
export declare class WusdmEventPool extends StatefulEventSubscriber<WusdmPoolState> {
|
|
9
|
+
protected dexHelper: IDexHelper;
|
|
10
|
+
private wrapperAddress;
|
|
11
|
+
private wrapperInterface;
|
|
12
|
+
private depositTopic;
|
|
13
|
+
private withdrawTopic;
|
|
14
|
+
logDecoder: (log: Log) => any;
|
|
15
|
+
constructor(parentName: string, network: Network, poolName: string, dexHelper: IDexHelper, wrapperAddress: Address, wrapperInterface: Interface, logger: Logger, depositTopic: string, withdrawTopic: string);
|
|
16
|
+
protected processLog(state: DeepReadonly<WusdmPoolState>, log: Readonly<Log>, blockHeader: Readonly<BlockHeader>): Promise<DeepReadonly<WusdmPoolState> | null>;
|
|
17
|
+
generateState(blockNumber?: number | 'latest'): Promise<DeepReadonly<WusdmPoolState>>;
|
|
18
|
+
getOrGenerateState(blockNumber: number): Promise<WusdmPoolState>;
|
|
19
|
+
handleDeposit(event: any, state: DeepReadonly<WusdmPoolState>, log: Readonly<Log>): Promise<DeepReadonly<WusdmPoolState>>;
|
|
20
|
+
handleWithdraw(event: any, state: DeepReadonly<WusdmPoolState>, log: Readonly<Log>): Promise<DeepReadonly<WusdmPoolState>>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WusdmEventPool = void 0;
|
|
4
|
+
const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
|
|
5
|
+
const decoders_1 = require("../../lib/decoders");
|
|
6
|
+
class WusdmEventPool extends stateful_event_subscriber_1.StatefulEventSubscriber {
|
|
7
|
+
dexHelper;
|
|
8
|
+
wrapperAddress;
|
|
9
|
+
wrapperInterface;
|
|
10
|
+
depositTopic;
|
|
11
|
+
withdrawTopic;
|
|
12
|
+
logDecoder;
|
|
13
|
+
constructor(parentName, network, poolName, dexHelper, wrapperAddress, wrapperInterface, logger, depositTopic, withdrawTopic) {
|
|
14
|
+
super(parentName, poolName, dexHelper, logger);
|
|
15
|
+
this.dexHelper = dexHelper;
|
|
16
|
+
this.wrapperAddress = wrapperAddress;
|
|
17
|
+
this.wrapperInterface = wrapperInterface;
|
|
18
|
+
this.depositTopic = depositTopic;
|
|
19
|
+
this.withdrawTopic = withdrawTopic;
|
|
20
|
+
this.addressesSubscribed = [wrapperAddress];
|
|
21
|
+
this.logDecoder = (log) => this.wrapperInterface.parseLog(log);
|
|
22
|
+
}
|
|
23
|
+
async processLog(state, log, blockHeader) {
|
|
24
|
+
const event = this.logDecoder(log);
|
|
25
|
+
if (log.topics[0] === this.depositTopic) {
|
|
26
|
+
return this.handleDeposit(event, state, log);
|
|
27
|
+
}
|
|
28
|
+
if (log.topics[0] === this.withdrawTopic) {
|
|
29
|
+
return this.handleWithdraw(event, state, log);
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
async generateState(blockNumber = 'latest') {
|
|
34
|
+
const calls = [
|
|
35
|
+
{
|
|
36
|
+
target: this.wrapperAddress,
|
|
37
|
+
callData: this.wrapperInterface.encodeFunctionData('totalAssets', []),
|
|
38
|
+
decodeFunction: decoders_1.uint256ToBigInt,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
target: this.wrapperAddress,
|
|
42
|
+
callData: this.wrapperInterface.encodeFunctionData('totalSupply', []),
|
|
43
|
+
decodeFunction: decoders_1.uint256ToBigInt,
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
const [totalAssets, totalSupply] = await this.dexHelper.multiWrapper.tryAggregate(true, calls, blockNumber);
|
|
47
|
+
return {
|
|
48
|
+
totalAssets: totalAssets.returnData,
|
|
49
|
+
totalShares: totalSupply.returnData,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
async getOrGenerateState(blockNumber) {
|
|
53
|
+
let state = this.getState(blockNumber);
|
|
54
|
+
if (!state) {
|
|
55
|
+
state = await this.generateState(blockNumber);
|
|
56
|
+
this.setState(state, blockNumber);
|
|
57
|
+
}
|
|
58
|
+
return state;
|
|
59
|
+
}
|
|
60
|
+
async handleDeposit(event, state, log) {
|
|
61
|
+
return {
|
|
62
|
+
totalAssets: state.totalAssets + BigInt(event.args.assets),
|
|
63
|
+
totalShares: state.totalShares + BigInt(event.args.shares),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
async handleWithdraw(event, state, log) {
|
|
67
|
+
return {
|
|
68
|
+
totalAssets: BigInt(state.totalAssets) - BigInt(event.args.assets),
|
|
69
|
+
totalShares: BigInt(state.totalShares) - BigInt(event.args.shares),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.WusdmEventPool = WusdmEventPool;
|
|
74
|
+
//# sourceMappingURL=wusdm-pool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wusdm-pool.js","sourceRoot":"","sources":["../../../src/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;IAED,KAAK,CAAC,cAAc,CAClB,KAAU,EACV,KAAmC,EACnC,GAAkB;QAElB,OAAO;YACL,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;YAClE,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;SACnE,CAAC;IACJ,CAAC;CACF;AA7FD,wCA6FC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Token, Address, ExchangePrices, PoolPrices, AdapterExchangeParam, SimpleExchangeParam, PoolLiquidity, Logger, NumberAsString, DexExchangeParam } from '../../types';
|
|
2
|
+
import { SwapSide, Network } from '../../constants';
|
|
3
|
+
import { IDex, Context } from '../../dex/idex';
|
|
4
|
+
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
5
|
+
import { WUSDMData, WusdmParams, WusdmPoolState } from './types';
|
|
6
|
+
import { SimpleExchange } from '../simple-exchange';
|
|
7
|
+
import { WusdmEventPool } from './wusdm-pool';
|
|
8
|
+
import { Interface } from '@ethersproject/abi';
|
|
9
|
+
export declare class WUSDM extends SimpleExchange implements IDex<WUSDMData, WusdmParams> {
|
|
10
|
+
readonly network: Network;
|
|
11
|
+
readonly dexKey: string;
|
|
12
|
+
readonly dexHelper: IDexHelper;
|
|
13
|
+
readonly wUSDMAddress: string;
|
|
14
|
+
readonly USDMAddress: string;
|
|
15
|
+
readonly wUSDMInterface: Interface;
|
|
16
|
+
readonly hasConstantPriceLargeAmounts = true;
|
|
17
|
+
readonly isFeeOnTransferSupported = false;
|
|
18
|
+
readonly needWrapNative: boolean;
|
|
19
|
+
static dexKeysWithNetwork: {
|
|
20
|
+
key: string;
|
|
21
|
+
networks: Network[];
|
|
22
|
+
}[];
|
|
23
|
+
readonly eventPool: WusdmEventPool;
|
|
24
|
+
logger: Logger;
|
|
25
|
+
constructor(network: Network, dexKey: string, dexHelper: IDexHelper, wUSDMAddress?: string, USDMAddress?: string, wUSDMInterface?: Interface);
|
|
26
|
+
getAdapters(side: SwapSide): {
|
|
27
|
+
name: string;
|
|
28
|
+
index: number;
|
|
29
|
+
}[] | null;
|
|
30
|
+
isAppropriatePair(srcToken: Token, destToken: Token): boolean;
|
|
31
|
+
initializePricing(blockNumber: number): Promise<void>;
|
|
32
|
+
getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
|
|
33
|
+
isUSDM(tokenAddress: Address): boolean;
|
|
34
|
+
isWUSDM(tokenAddress: Address): boolean;
|
|
35
|
+
isWrap(srcToken: Token, destToken: Token, side: SwapSide): boolean;
|
|
36
|
+
getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[]): Promise<null | ExchangePrices<WUSDMData>>;
|
|
37
|
+
getCalldataGasCost(poolPrices: PoolPrices<WUSDMData>): number | number[];
|
|
38
|
+
getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
|
|
39
|
+
getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: WUSDMData, side: SwapSide): Promise<SimpleExchangeParam>;
|
|
40
|
+
getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: WUSDMData, side: SwapSide, _: Context, executorAddress: Address): DexExchangeParam;
|
|
41
|
+
getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: WUSDMData, side: SwapSide): AdapterExchangeParam;
|
|
42
|
+
previewRedeem(shares: bigint, state: WusdmPoolState): bigint;
|
|
43
|
+
previewMint(shares: bigint, state: WusdmPoolState): bigint;
|
|
44
|
+
previewWithdraw(assets: bigint, state: WusdmPoolState): bigint;
|
|
45
|
+
previewDeposit(assets: bigint, state: WusdmPoolState): bigint;
|
|
46
|
+
}
|