@paraswap/dex-lib 2.14.0 → 2.14.1
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 +23 -5
- package/build/config.js.map +1 -1
- package/build/dex/index.js +2 -2
- package/build/dex/index.js.map +1 -1
- package/build/dex/simple-exchange.d.ts +1 -0
- package/build/dex/simple-exchange.js +2 -0
- package/build/dex/simple-exchange.js.map +1 -1
- package/build/lib/decoders.d.ts +2 -1
- package/build/lib/decoders.js +8 -1
- package/build/lib/decoders.js.map +1 -1
- package/build/lib/multi-wrapper.d.ts +2 -1
- package/build/lib/multi-wrapper.js.map +1 -1
- package/build/lib/tokens/balancer-fetcher.js +4 -5
- package/build/lib/tokens/balancer-fetcher.js.map +1 -1
- package/build/lib/tokens/utils.d.ts +2 -2
- package/build/lib/tokens/utils.js +1 -1
- package/build/lib/tokens/utils.js.map +1 -1
- package/build/types.d.ts +3 -0
- package/dex-template/__DexName__-e2e.test.ts.template +1 -0
- package/dex-template/__DexName__-events.test.ts.template +1 -0
- package/dex-template/__DexName__-integration.test.ts.template +1 -0
- package/dex-template/__DexName__-pool.ts.template +8 -5
- package/package.json +1 -1
- package/scripts/generate-bytecode.ts +2 -0
- package/src/abi/woo-fi-v2/IntegrationHelper.abi.json +116 -0
- package/src/abi/{woo-fi/Wooracle.abi.json → woo-fi-v2/WooOracleV2.abi.json} +148 -50
- package/src/abi/{woo-fi/WooPP.abi.json → woo-fi-v2/WooPPV2.abi.json} +201 -169
- package/src/config.ts +27 -5
- package/src/dex/balancer-v2/balancer-v2-e2e.test.ts +0 -1
- package/src/dex/index.ts +2 -2
- package/src/dex/simple-exchange.ts +3 -0
- package/src/dex/woo-fi-v2/config.ts +87 -0
- package/src/dex/woo-fi-v2/constants.ts +22 -0
- package/src/dex/woo-fi-v2/decoders.ts +45 -0
- package/src/dex/woo-fi-v2/types.ts +63 -0
- package/src/dex/woo-fi-v2/utils.ts +19 -0
- package/src/dex/woo-fi-v2/woo-fi-v2-e2e.test.ts +216 -0
- package/src/dex/woo-fi-v2/woo-fi-v2-integration.test.ts +495 -0
- package/src/dex/woo-fi-v2/woo-fi-v2-math.ts +195 -0
- package/src/dex/woo-fi-v2/woo-fi-v2-pool.ts +112 -0
- package/src/dex/woo-fi-v2/woo-fi-v2.ts +487 -0
- package/src/lib/decoders.ts +12 -1
- package/src/lib/log-messages-suppressor.ts +173 -0
- package/src/lib/multi-wrapper.ts +2 -1
- package/src/lib/stateful-rpc-poller/state-polling-manager.ts +320 -0
- package/src/lib/stateful-rpc-poller/stateful-rpc-poller.ts +604 -0
- package/src/lib/stateful-rpc-poller/types.ts +66 -0
- package/src/lib/stateful-rpc-poller/utils.ts +23 -0
- package/src/lib/tokens/balancer-fetcher.ts +5 -6
- package/src/lib/tokens/utils.ts +5 -3
- package/src/types.ts +4 -0
- package/tests/constants-e2e.ts +8 -3
- package/tests/tenderly-simulation.ts +1 -1
- package/tests/utils-e2e.ts +2 -0
- package/tests/utils.ts +2 -0
- package/src/abi/woo-fi/WooFeeManager.abi.json +0 -318
- package/src/dex/woo-fi/config.ts +0 -141
- package/src/dex/woo-fi/constants.ts +0 -21
- package/src/dex/woo-fi/types.ts +0 -55
- package/src/dex/woo-fi/woo-fi-decimal-math.ts +0 -45
- package/src/dex/woo-fi/woo-fi-e2e.test.ts +0 -183
- package/src/dex/woo-fi/woo-fi-integration.test.ts +0 -416
- package/src/dex/woo-fi/woo-fi-math.ts +0 -527
- package/src/dex/woo-fi/woo-fi.ts +0 -693
|
@@ -59,7 +59,6 @@ export const getBalanceCallParams = (
|
|
|
59
59
|
}));
|
|
60
60
|
default:
|
|
61
61
|
throw new Error(`missing case for assetType ${req.assetType}`);
|
|
62
|
-
return [];
|
|
63
62
|
}
|
|
64
63
|
};
|
|
65
64
|
|
|
@@ -264,21 +263,21 @@ export const getBalances = async (
|
|
|
264
263
|
blockNumber,
|
|
265
264
|
);
|
|
266
265
|
|
|
267
|
-
const
|
|
266
|
+
const chunks = [];
|
|
268
267
|
let j = 0;
|
|
269
268
|
for (let i = 0; i < results.length; ) {
|
|
270
269
|
const batchSize = decodingInfo[j].length;
|
|
271
|
-
const
|
|
272
|
-
|
|
270
|
+
const chunk = results.slice(i, i + batchSize);
|
|
271
|
+
chunks.push(chunk);
|
|
273
272
|
j++;
|
|
274
273
|
i += batchSize;
|
|
275
274
|
}
|
|
276
275
|
|
|
277
|
-
return
|
|
276
|
+
return chunks.map((chunk, index) =>
|
|
278
277
|
decodeBalanceAndAllowanceMultiResult(
|
|
279
278
|
reqs[index],
|
|
280
279
|
decodingInfo[index].spenders,
|
|
281
|
-
|
|
280
|
+
chunk,
|
|
282
281
|
),
|
|
283
282
|
);
|
|
284
283
|
};
|
package/src/lib/tokens/utils.ts
CHANGED
|
@@ -53,7 +53,7 @@ export const uint256ArrayDecode = (
|
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
export const booleanDecode = (
|
|
56
|
-
result: MultiResult<
|
|
56
|
+
result: MultiResult<BytesLike> | BytesLike,
|
|
57
57
|
): boolean => {
|
|
58
58
|
const [isSuccess, toDecode] = extractSuccessAndValue(result);
|
|
59
59
|
|
|
@@ -63,10 +63,12 @@ export const booleanDecode = (
|
|
|
63
63
|
return defaultAbiCoder.decode(['bool'], toDecode)[0];
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
export const addressDecode = (
|
|
66
|
+
export const addressDecode = (
|
|
67
|
+
result: MultiResult<BytesLike> | BytesLike,
|
|
68
|
+
): string => {
|
|
67
69
|
const [isSuccess, toDecode] = extractSuccessAndValue(result);
|
|
68
70
|
|
|
69
|
-
if (isSuccess) {
|
|
71
|
+
if (!isSuccess) {
|
|
70
72
|
return '';
|
|
71
73
|
}
|
|
72
74
|
return defaultAbiCoder.decode(['address'], toDecode)[0].toLowerCase();
|
package/src/types.ts
CHANGED
|
@@ -270,6 +270,8 @@ export type Config = {
|
|
|
270
270
|
adapterAddresses: { [name: string]: Address };
|
|
271
271
|
uniswapV2ExchangeRouterAddress: Address;
|
|
272
272
|
rfqConfigs: Record<string, RFQConfig>;
|
|
273
|
+
rpcPollingMaxAllowedStateDelayInBlocks: number;
|
|
274
|
+
rpcPollingBlocksBackToTriggerUpdate: number;
|
|
273
275
|
hashFlowAuthToken?: string;
|
|
274
276
|
hashFlowDisabledMMs: string[];
|
|
275
277
|
uniswapV3EventLoggingSampleRate?: number;
|
|
@@ -294,3 +296,5 @@ export type TransferFeeParams = {
|
|
|
294
296
|
srcDexFee: number;
|
|
295
297
|
destDexFee: number;
|
|
296
298
|
};
|
|
299
|
+
|
|
300
|
+
export type LogLevels = 'info' | 'warn' | 'error' | 'trace' | 'debug';
|
package/tests/constants-e2e.ts
CHANGED
|
@@ -470,6 +470,10 @@ export const Tokens: {
|
|
|
470
470
|
address: '0x841fad6eae12c286d1fd18d1d525dffa75c7effe',
|
|
471
471
|
decimals: 18,
|
|
472
472
|
},
|
|
473
|
+
ETH: {
|
|
474
|
+
address: '0x74b23882a30290451A17c44f4F05243b6b58C76d',
|
|
475
|
+
decimals: 18,
|
|
476
|
+
},
|
|
473
477
|
},
|
|
474
478
|
[Network.BSC]: {
|
|
475
479
|
POPS: {
|
|
@@ -887,7 +891,7 @@ export const Holders: {
|
|
|
887
891
|
DAI: '0x370f4b2dcf75c94d8d4450b493661a9c6170d0b5',
|
|
888
892
|
FTM: '0x431e81E5dfB5A24541b5Ff8762bDEF3f32F96354',
|
|
889
893
|
WFTM: '0x431e81E5dfB5A24541b5Ff8762bDEF3f32F96354',
|
|
890
|
-
USDC: '
|
|
894
|
+
USDC: '0xe48793b1533b351ae184e1c3119d0955dde7b330',
|
|
891
895
|
FUSDT: '0x9ade1c17d25246c405604344f89E8F23F8c1c632',
|
|
892
896
|
POPS: '0x4b78b52e7de4d8b7d367297cb8a87c1875a9d591',
|
|
893
897
|
aFanUSDT: '0x8EBc96fF91A30059E447bFC7C0a7394f8A5793E6',
|
|
@@ -900,6 +904,7 @@ export const Holders: {
|
|
|
900
904
|
wBOMB: '0x28aa4f9ffe21365473b64c161b566c3cdead0108',
|
|
901
905
|
TOR: '0x70de4b5ed310fd93da3c0bae824fb99cb4d44dd8',
|
|
902
906
|
BOO: '0xf778f4d7a14a8cb73d5261f9c61970ef4e7d7842',
|
|
907
|
+
ETH: '0xf48883940b4056801de30f12b934dcea90133ee6',
|
|
903
908
|
},
|
|
904
909
|
[Network.BSC]: {
|
|
905
910
|
DAI: '0xf68a4b64162906eff0ff6ae34e2bb1cd42fef62d',
|
|
@@ -919,10 +924,10 @@ export const Holders: {
|
|
|
919
924
|
[Network.AVALANCHE]: {
|
|
920
925
|
AVAX: '0xD6216fC19DB775Df9774a6E33526131dA7D19a2c',
|
|
921
926
|
avWAVAX: '0xc5ed2333f8a2C351fCA35E5EBAdb2A82F5d254C3',
|
|
922
|
-
WAVAX: '
|
|
927
|
+
WAVAX: '0xbbff2a8ec8d702e61faaccf7cf705968bb6a5bab',
|
|
923
928
|
sAVAX: '0xC73DF1e68FC203F6E4b6270240D6f82A850e8D38',
|
|
924
929
|
USDCe: '0x3a2434c698f8d79af1f5a9e43013157ca8b11a66',
|
|
925
|
-
USDC: '
|
|
930
|
+
USDC: '0xbf14db80d9275fb721383a77c00ae180fc40ae98',
|
|
926
931
|
USDTe: '0x84d34f4f83a87596cd3fb6887cff8f17bf5a7b83',
|
|
927
932
|
USDT: '0x715f3c533Cf264215Ba8BE00838a053284351086',
|
|
928
933
|
WETHe: '0xD291B51f7a1a1F4917D085F2a7731A447E4aF82D',
|
|
@@ -12,7 +12,7 @@ const TENDERLY_FORK_LAST_TX_ID = process.env.TENDERLY_FORK_LAST_TX_ID;
|
|
|
12
12
|
export class TenderlySimulation {
|
|
13
13
|
lastTx: string = '';
|
|
14
14
|
forkId: string = '';
|
|
15
|
-
maxGasLimit =
|
|
15
|
+
maxGasLimit = 80000000;
|
|
16
16
|
|
|
17
17
|
constructor(private network: Number = 1) {}
|
|
18
18
|
|
package/tests/utils-e2e.ts
CHANGED
|
@@ -45,6 +45,7 @@ const DEPLOYER_ADDRESS: { [nid: number]: string } = {
|
|
|
45
45
|
[Network.FANTOM]: '0x05182E579FDfCf69E4390c3411D8FeA1fb6467cf',
|
|
46
46
|
[Network.AVALANCHE]: '0xD6216fC19DB775Df9774a6E33526131dA7D19a2c',
|
|
47
47
|
[Network.OPTIMISM]: '0xf01121e808F782d7F34E857c27dA31AD1f151b39',
|
|
48
|
+
[Network.ARBITRUM]: '0xb38e8c17e38363af6ebdcb3dae12e0243582891d',
|
|
48
49
|
};
|
|
49
50
|
|
|
50
51
|
const MULTISIG: { [nid: number]: string } = {
|
|
@@ -54,6 +55,7 @@ const MULTISIG: { [nid: number]: string } = {
|
|
|
54
55
|
[Network.FANTOM]: '0xECaB2dac955b94e49Ec09D6d68672d3B397BbdAd',
|
|
55
56
|
[Network.AVALANCHE]: '0x1e2ECA5e812D08D2A7F8664D69035163ff5BfEC2',
|
|
56
57
|
[Network.OPTIMISM]: '0xf01121e808F782d7F34E857c27dA31AD1f151b39',
|
|
58
|
+
[Network.ARBITRUM]: '0x90DfD8a6454CFE19be39EaB42ac93CD850c7f339',
|
|
57
59
|
};
|
|
58
60
|
|
|
59
61
|
class APIParaswapSDK implements IParaSwapSDK {
|
package/tests/utils.ts
CHANGED
|
@@ -57,6 +57,8 @@ export function checkPoolsLiquidity(
|
|
|
57
57
|
tokenAddress: Address,
|
|
58
58
|
dexKey: string,
|
|
59
59
|
) {
|
|
60
|
+
expect(poolsLiquidity.length).toBeGreaterThan(0);
|
|
61
|
+
|
|
60
62
|
poolsLiquidity.forEach(p => {
|
|
61
63
|
expect(p.exchange).toEqual(dexKey);
|
|
62
64
|
expect(p.liquidityUSD).toBeGreaterThanOrEqual(0);
|
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"inputs": [
|
|
4
|
-
{ "internalType": "address", "name": "newQuoteToken", "type": "address" },
|
|
5
|
-
{
|
|
6
|
-
"internalType": "address",
|
|
7
|
-
"name": "newRebateManager",
|
|
8
|
-
"type": "address"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"internalType": "address",
|
|
12
|
-
"name": "newVaultManager",
|
|
13
|
-
"type": "address"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"internalType": "address",
|
|
17
|
-
"name": "newAccessManager",
|
|
18
|
-
"type": "address"
|
|
19
|
-
},
|
|
20
|
-
{ "internalType": "address", "name": "newTreasury", "type": "address" }
|
|
21
|
-
],
|
|
22
|
-
"stateMutability": "nonpayable",
|
|
23
|
-
"type": "constructor"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"anonymous": false,
|
|
27
|
-
"inputs": [
|
|
28
|
-
{
|
|
29
|
-
"indexed": true,
|
|
30
|
-
"internalType": "address",
|
|
31
|
-
"name": "token",
|
|
32
|
-
"type": "address"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"indexed": false,
|
|
36
|
-
"internalType": "uint256",
|
|
37
|
-
"name": "newFeeRate",
|
|
38
|
-
"type": "uint256"
|
|
39
|
-
}
|
|
40
|
-
],
|
|
41
|
-
"name": "FeeRateUpdated",
|
|
42
|
-
"type": "event"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"anonymous": false,
|
|
46
|
-
"inputs": [
|
|
47
|
-
{
|
|
48
|
-
"indexed": true,
|
|
49
|
-
"internalType": "address",
|
|
50
|
-
"name": "previousOwner",
|
|
51
|
-
"type": "address"
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"indexed": true,
|
|
55
|
-
"internalType": "address",
|
|
56
|
-
"name": "newOwner",
|
|
57
|
-
"type": "address"
|
|
58
|
-
}
|
|
59
|
-
],
|
|
60
|
-
"name": "OwnershipTransferPrepared",
|
|
61
|
-
"type": "event"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"anonymous": false,
|
|
65
|
-
"inputs": [
|
|
66
|
-
{
|
|
67
|
-
"indexed": true,
|
|
68
|
-
"internalType": "address",
|
|
69
|
-
"name": "previousOwner",
|
|
70
|
-
"type": "address"
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
"indexed": true,
|
|
74
|
-
"internalType": "address",
|
|
75
|
-
"name": "newOwner",
|
|
76
|
-
"type": "address"
|
|
77
|
-
}
|
|
78
|
-
],
|
|
79
|
-
"name": "OwnershipTransferred",
|
|
80
|
-
"type": "event"
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"anonymous": false,
|
|
84
|
-
"inputs": [
|
|
85
|
-
{
|
|
86
|
-
"indexed": true,
|
|
87
|
-
"internalType": "address",
|
|
88
|
-
"name": "token",
|
|
89
|
-
"type": "address"
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
"indexed": true,
|
|
93
|
-
"internalType": "address",
|
|
94
|
-
"name": "to",
|
|
95
|
-
"type": "address"
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
"indexed": false,
|
|
99
|
-
"internalType": "uint256",
|
|
100
|
-
"name": "amount",
|
|
101
|
-
"type": "uint256"
|
|
102
|
-
}
|
|
103
|
-
],
|
|
104
|
-
"name": "Withdraw",
|
|
105
|
-
"type": "event"
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
"inputs": [],
|
|
109
|
-
"name": "_NEW_OWNER_",
|
|
110
|
-
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
111
|
-
"stateMutability": "view",
|
|
112
|
-
"type": "function"
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
"inputs": [],
|
|
116
|
-
"name": "_OWNER_",
|
|
117
|
-
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
118
|
-
"stateMutability": "view",
|
|
119
|
-
"type": "function"
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
"inputs": [],
|
|
123
|
-
"name": "accessManager",
|
|
124
|
-
"outputs": [
|
|
125
|
-
{
|
|
126
|
-
"internalType": "contract IWooAccessManager",
|
|
127
|
-
"name": "",
|
|
128
|
-
"type": "address"
|
|
129
|
-
}
|
|
130
|
-
],
|
|
131
|
-
"stateMutability": "view",
|
|
132
|
-
"type": "function"
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
"inputs": [],
|
|
136
|
-
"name": "claimOwnership",
|
|
137
|
-
"outputs": [],
|
|
138
|
-
"stateMutability": "nonpayable",
|
|
139
|
-
"type": "function"
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
"inputs": [
|
|
143
|
-
{ "internalType": "uint256", "name": "amount", "type": "uint256" },
|
|
144
|
-
{ "internalType": "address", "name": "brokerAddr", "type": "address" }
|
|
145
|
-
],
|
|
146
|
-
"name": "collectFee",
|
|
147
|
-
"outputs": [],
|
|
148
|
-
"stateMutability": "nonpayable",
|
|
149
|
-
"type": "function"
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
"inputs": [],
|
|
153
|
-
"name": "distributeFees",
|
|
154
|
-
"outputs": [],
|
|
155
|
-
"stateMutability": "nonpayable",
|
|
156
|
-
"type": "function"
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
"inputs": [
|
|
160
|
-
{ "internalType": "address", "name": "token", "type": "address" },
|
|
161
|
-
{ "internalType": "address", "name": "to", "type": "address" }
|
|
162
|
-
],
|
|
163
|
-
"name": "emergencyWithdraw",
|
|
164
|
-
"outputs": [],
|
|
165
|
-
"stateMutability": "nonpayable",
|
|
166
|
-
"type": "function"
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
170
|
-
"name": "feeRate",
|
|
171
|
-
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
|
172
|
-
"stateMutability": "view",
|
|
173
|
-
"type": "function"
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
"inputs": [
|
|
177
|
-
{ "internalType": "address", "name": "newOwner", "type": "address" }
|
|
178
|
-
],
|
|
179
|
-
"name": "initOwner",
|
|
180
|
-
"outputs": [],
|
|
181
|
-
"stateMutability": "nonpayable",
|
|
182
|
-
"type": "function"
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
"inputs": [],
|
|
186
|
-
"name": "quoteToken",
|
|
187
|
-
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
188
|
-
"stateMutability": "view",
|
|
189
|
-
"type": "function"
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
"inputs": [],
|
|
193
|
-
"name": "rebateAmount",
|
|
194
|
-
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
|
195
|
-
"stateMutability": "view",
|
|
196
|
-
"type": "function"
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
"inputs": [],
|
|
200
|
-
"name": "rebateManager",
|
|
201
|
-
"outputs": [
|
|
202
|
-
{
|
|
203
|
-
"internalType": "contract IWooRebateManager",
|
|
204
|
-
"name": "",
|
|
205
|
-
"type": "address"
|
|
206
|
-
}
|
|
207
|
-
],
|
|
208
|
-
"stateMutability": "view",
|
|
209
|
-
"type": "function"
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
"inputs": [
|
|
213
|
-
{
|
|
214
|
-
"internalType": "address",
|
|
215
|
-
"name": "newAccessManager",
|
|
216
|
-
"type": "address"
|
|
217
|
-
}
|
|
218
|
-
],
|
|
219
|
-
"name": "setAccessManager",
|
|
220
|
-
"outputs": [],
|
|
221
|
-
"stateMutability": "nonpayable",
|
|
222
|
-
"type": "function"
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
"inputs": [
|
|
226
|
-
{ "internalType": "address", "name": "token", "type": "address" },
|
|
227
|
-
{ "internalType": "uint256", "name": "newFeeRate", "type": "uint256" }
|
|
228
|
-
],
|
|
229
|
-
"name": "setFeeRate",
|
|
230
|
-
"outputs": [],
|
|
231
|
-
"stateMutability": "nonpayable",
|
|
232
|
-
"type": "function"
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
"inputs": [
|
|
236
|
-
{
|
|
237
|
-
"internalType": "address",
|
|
238
|
-
"name": "newRebateManager",
|
|
239
|
-
"type": "address"
|
|
240
|
-
}
|
|
241
|
-
],
|
|
242
|
-
"name": "setRebateManager",
|
|
243
|
-
"outputs": [],
|
|
244
|
-
"stateMutability": "nonpayable",
|
|
245
|
-
"type": "function"
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
"inputs": [
|
|
249
|
-
{ "internalType": "address", "name": "newTreasury", "type": "address" }
|
|
250
|
-
],
|
|
251
|
-
"name": "setTreasury",
|
|
252
|
-
"outputs": [],
|
|
253
|
-
"stateMutability": "nonpayable",
|
|
254
|
-
"type": "function"
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
"inputs": [
|
|
258
|
-
{
|
|
259
|
-
"internalType": "address",
|
|
260
|
-
"name": "newVaultManager",
|
|
261
|
-
"type": "address"
|
|
262
|
-
}
|
|
263
|
-
],
|
|
264
|
-
"name": "setVaultManager",
|
|
265
|
-
"outputs": [],
|
|
266
|
-
"stateMutability": "nonpayable",
|
|
267
|
-
"type": "function"
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
"inputs": [
|
|
271
|
-
{
|
|
272
|
-
"internalType": "uint256",
|
|
273
|
-
"name": "newVaultRewardRate",
|
|
274
|
-
"type": "uint256"
|
|
275
|
-
}
|
|
276
|
-
],
|
|
277
|
-
"name": "setVaultRewardRate",
|
|
278
|
-
"outputs": [],
|
|
279
|
-
"stateMutability": "nonpayable",
|
|
280
|
-
"type": "function"
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
"inputs": [
|
|
284
|
-
{ "internalType": "address", "name": "newOwner", "type": "address" }
|
|
285
|
-
],
|
|
286
|
-
"name": "transferOwnership",
|
|
287
|
-
"outputs": [],
|
|
288
|
-
"stateMutability": "nonpayable",
|
|
289
|
-
"type": "function"
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
"inputs": [],
|
|
293
|
-
"name": "treasury",
|
|
294
|
-
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
295
|
-
"stateMutability": "view",
|
|
296
|
-
"type": "function"
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
"inputs": [],
|
|
300
|
-
"name": "vaultManager",
|
|
301
|
-
"outputs": [
|
|
302
|
-
{
|
|
303
|
-
"internalType": "contract IWooVaultManager",
|
|
304
|
-
"name": "",
|
|
305
|
-
"type": "address"
|
|
306
|
-
}
|
|
307
|
-
],
|
|
308
|
-
"stateMutability": "view",
|
|
309
|
-
"type": "function"
|
|
310
|
-
},
|
|
311
|
-
{
|
|
312
|
-
"inputs": [],
|
|
313
|
-
"name": "vaultRewardRate",
|
|
314
|
-
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
|
315
|
-
"stateMutability": "view",
|
|
316
|
-
"type": "function"
|
|
317
|
-
}
|
|
318
|
-
]
|
package/src/dex/woo-fi/config.ts
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { DexParams } from './types';
|
|
2
|
-
import { DexConfigMap, AdapterMappings } from '../../types';
|
|
3
|
-
import { Network, SwapSide } from '../../constants';
|
|
4
|
-
|
|
5
|
-
export const WooFiConfig: DexConfigMap<DexParams> = {
|
|
6
|
-
WooFi: {
|
|
7
|
-
[Network.BSC]: {
|
|
8
|
-
wooPPAddress: '0xbf365Ce9cFcb2d5855521985E351bA3bcf77FD3F',
|
|
9
|
-
wooOracleAddress: '0x6b6fBEc7934b104e81b2046D24A990e03e17afDC',
|
|
10
|
-
wooFeeManagerAddress: '0xaA6c60D638d34261B764fEDB551E50Ab02c34C90',
|
|
11
|
-
wooGuardianAddress: '0x910723e3c6a68276687b50613a1a9e42cc6589b4',
|
|
12
|
-
quoteToken: {
|
|
13
|
-
// USDT
|
|
14
|
-
address: '0x55d398326f99059ff775485246999027b3197955',
|
|
15
|
-
decimals: 18,
|
|
16
|
-
},
|
|
17
|
-
baseTokens: {
|
|
18
|
-
WBNB: {
|
|
19
|
-
address: '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c',
|
|
20
|
-
decimals: 18,
|
|
21
|
-
},
|
|
22
|
-
BTCB: {
|
|
23
|
-
address: '0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c',
|
|
24
|
-
decimals: 18,
|
|
25
|
-
},
|
|
26
|
-
ETH: {
|
|
27
|
-
address: '0x2170ed0880ac9a755fd29b2688956bd959f933f8',
|
|
28
|
-
decimals: 18,
|
|
29
|
-
},
|
|
30
|
-
WOO: {
|
|
31
|
-
address: '0x4691937a7508860f876c9c0a2a617e7d9e945d4b',
|
|
32
|
-
decimals: 18,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
rebateTo: '0xcbb65ad3e64f404b5411486e15561bfb645ce642',
|
|
36
|
-
},
|
|
37
|
-
[Network.AVALANCHE]: {
|
|
38
|
-
wooPPAddress: '0x1df3009c57a8B143c6246149F00B090Bce3b8f88',
|
|
39
|
-
wooOracleAddress: '0x25a4d4a094A084c7ad45Ac273cF7D6B6bfae7D4E',
|
|
40
|
-
wooFeeManagerAddress: '0x209102c0D2E34282494114ea76D5251c8e7Ea7ab',
|
|
41
|
-
wooGuardianAddress: '0x58c73f7e102bc6bcdc6b092ef0399b3e06d6b3e3',
|
|
42
|
-
quoteToken: {
|
|
43
|
-
// USDC
|
|
44
|
-
address: '0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e',
|
|
45
|
-
decimals: 6,
|
|
46
|
-
},
|
|
47
|
-
baseTokens: {
|
|
48
|
-
WAVAX: {
|
|
49
|
-
address: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7',
|
|
50
|
-
decimals: 18,
|
|
51
|
-
},
|
|
52
|
-
['BTC.b']: {
|
|
53
|
-
address: '0x152b9d0FdC40C096757F570A51E494bd4b943E50',
|
|
54
|
-
decimals: 8,
|
|
55
|
-
},
|
|
56
|
-
['WETH.e']: {
|
|
57
|
-
address: '0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB',
|
|
58
|
-
decimals: 18,
|
|
59
|
-
},
|
|
60
|
-
['WOO.e']: {
|
|
61
|
-
address: '0xaBC9547B534519fF73921b1FBA6E672b5f58D083',
|
|
62
|
-
decimals: 18,
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
rebateTo: '0x1bf4c97384e7bdc609017305edb23fd28c13e76a',
|
|
66
|
-
},
|
|
67
|
-
[Network.FANTOM]: {
|
|
68
|
-
wooPPAddress: '0x9503E7517D3C5bc4f9E4A1c6AE4f8B33AC2546f2',
|
|
69
|
-
wooOracleAddress: '0x209102c0D2E34282494114ea76D5251c8e7Ea7ab',
|
|
70
|
-
wooFeeManagerAddress: '0xBE1a0FccCFA9c9065152B7770B918f7C59914E8D',
|
|
71
|
-
wooGuardianAddress: '0x128758d0e909624841AB29D53919646BFBDa5dB2',
|
|
72
|
-
quoteToken: {
|
|
73
|
-
// USDC
|
|
74
|
-
address: '0x04068da6c83afcfa0e13ba15a6696662335d5b75',
|
|
75
|
-
decimals: 6,
|
|
76
|
-
},
|
|
77
|
-
baseTokens: {
|
|
78
|
-
WFTM: {
|
|
79
|
-
address: '0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83',
|
|
80
|
-
decimals: 18,
|
|
81
|
-
},
|
|
82
|
-
BTC: {
|
|
83
|
-
address: '0x321162Cd933E2Be498Cd2267a90534A804051b11',
|
|
84
|
-
decimals: 8,
|
|
85
|
-
},
|
|
86
|
-
ETH: {
|
|
87
|
-
address: '0x74b23882a30290451A17c44f4F05243b6b58C76d',
|
|
88
|
-
decimals: 18,
|
|
89
|
-
},
|
|
90
|
-
WOO: {
|
|
91
|
-
address: '0x6626c47c00F1D87902fc13EECfaC3ed06D5E8D8a',
|
|
92
|
-
decimals: 18,
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
rebateTo: '0xced122f9b99d224675eeda13f0c14639c5633f91',
|
|
96
|
-
},
|
|
97
|
-
[Network.POLYGON]: {
|
|
98
|
-
wooPPAddress: '0x7400B665C8f4f3a951a99f1ee9872efb8778723d',
|
|
99
|
-
wooOracleAddress: '0x2Fe5E5D341cFFa606a5d9DA1B6B646a381B0f7ec',
|
|
100
|
-
wooFeeManagerAddress: '0x7214833BE05Ce39f6dCd97668e521162e6C18937',
|
|
101
|
-
wooGuardianAddress: '0xF5d215d9C84778F85746D15762DaF39B9E83a2d6',
|
|
102
|
-
quoteToken: {
|
|
103
|
-
// USDC
|
|
104
|
-
address: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174',
|
|
105
|
-
decimals: 6,
|
|
106
|
-
},
|
|
107
|
-
baseTokens: {
|
|
108
|
-
WMATIC: {
|
|
109
|
-
address: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
|
|
110
|
-
decimals: 18,
|
|
111
|
-
},
|
|
112
|
-
WBTC: {
|
|
113
|
-
address: '0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6',
|
|
114
|
-
decimals: 8,
|
|
115
|
-
},
|
|
116
|
-
WETH: {
|
|
117
|
-
address: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
|
|
118
|
-
decimals: 18,
|
|
119
|
-
},
|
|
120
|
-
WOO: {
|
|
121
|
-
address: '0x1B815d120B3eF02039Ee11dC2d33DE7aA4a8C603',
|
|
122
|
-
decimals: 18,
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
rebateTo: '0x0c84cd406b8a4e07df9a1b15ef348023a1dcd075',
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
export const Adapters: Record<number, AdapterMappings> = {
|
|
131
|
-
[Network.BSC]: { [SwapSide.SELL]: [{ name: 'BscAdapter01', index: 13 }] },
|
|
132
|
-
[Network.AVALANCHE]: {
|
|
133
|
-
[SwapSide.SELL]: [{ name: 'AvalancheAdapter01', index: 12 }],
|
|
134
|
-
},
|
|
135
|
-
[Network.FANTOM]: {
|
|
136
|
-
[SwapSide.SELL]: [{ name: 'FantomAdapter01', index: 8 }],
|
|
137
|
-
},
|
|
138
|
-
[Network.POLYGON]: {
|
|
139
|
-
[SwapSide.SELL]: [{ name: 'PolygonAdapter02', index: 4 }],
|
|
140
|
-
},
|
|
141
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { PoolState } from './types';
|
|
2
|
-
|
|
3
|
-
export const WOO_FI_GAS_COST = 270 * 1000;
|
|
4
|
-
|
|
5
|
-
export const USD_PRECISION = 2;
|
|
6
|
-
|
|
7
|
-
export const MIN_CONVERSION_RATE = 1;
|
|
8
|
-
|
|
9
|
-
export const NULL_STATE: PoolState = {
|
|
10
|
-
feeRates: {},
|
|
11
|
-
tokenInfos: {},
|
|
12
|
-
tokenStates: {},
|
|
13
|
-
oracleTimestamp: 0n,
|
|
14
|
-
isPaused: false,
|
|
15
|
-
guardian: {
|
|
16
|
-
globalBound: 0n,
|
|
17
|
-
refInfos: {},
|
|
18
|
-
},
|
|
19
|
-
chainlink: { latestRoundDatas: {} },
|
|
20
|
-
wooPPBalances: {},
|
|
21
|
-
};
|
package/src/dex/woo-fi/types.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Address, Token } from '../../types';
|
|
2
|
-
|
|
3
|
-
export type TokenInfo = {
|
|
4
|
-
reserve: bigint;
|
|
5
|
-
R: bigint;
|
|
6
|
-
threshold: bigint;
|
|
7
|
-
target: bigint;
|
|
8
|
-
lastResetTimestamp: bigint;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export type TokenState = {
|
|
12
|
-
priceNow: bigint;
|
|
13
|
-
spreadNow: bigint;
|
|
14
|
-
coeffNow: bigint;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export type RefInfo = {
|
|
18
|
-
chainlinkRefOracle: Address;
|
|
19
|
-
refPriceFixCoeff: bigint;
|
|
20
|
-
minInputAmount: bigint;
|
|
21
|
-
maxInputAmount: bigint;
|
|
22
|
-
bound: bigint;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export type LatestRoundData = {
|
|
26
|
-
answer: bigint;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export type PoolState = {
|
|
30
|
-
feeRates: Record<Address, bigint>;
|
|
31
|
-
tokenInfos: Record<Address, TokenInfo>;
|
|
32
|
-
tokenStates: Record<Address, TokenState>;
|
|
33
|
-
oracleTimestamp: bigint;
|
|
34
|
-
isPaused: boolean;
|
|
35
|
-
guardian: {
|
|
36
|
-
globalBound: bigint;
|
|
37
|
-
refInfos: Record<Address, RefInfo>;
|
|
38
|
-
};
|
|
39
|
-
chainlink: {
|
|
40
|
-
latestRoundDatas: Record<Address, LatestRoundData>;
|
|
41
|
-
};
|
|
42
|
-
wooPPBalances: Record<Address, bigint>;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export type WooFiData = {};
|
|
46
|
-
|
|
47
|
-
export type DexParams = {
|
|
48
|
-
wooPPAddress: Address;
|
|
49
|
-
wooOracleAddress: Address;
|
|
50
|
-
wooFeeManagerAddress: Address;
|
|
51
|
-
wooGuardianAddress: Address;
|
|
52
|
-
quoteToken: Token;
|
|
53
|
-
baseTokens: Record<string, Token>;
|
|
54
|
-
rebateTo: Address;
|
|
55
|
-
};
|