@curvefi/api 2.4.3 → 2.6.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/lib/constants/abis/eursusd2/swap.json +1199 -0
- package/lib/constants/abis/eursusd2/zap.json +270 -0
- package/lib/constants/abis/factory-v2/DepositZapFantom.json +164 -0
- package/lib/constants/abis/factory-v2/DepositZapMetaUsd2Fantom.json +197 -0
- package/lib/constants/abis/factory-v2/MetaUSDGeist.json +932 -0
- package/lib/constants/abis/fusdt/swap.json +1221 -0
- package/lib/constants/abis/fusdt/zap.json +215 -0
- package/lib/constants/abis/gauge_child.json +0 -100
- package/lib/constants/abis/gauge_rewards_only.json +649 -0
- package/lib/constants/abis/ren-arbitrum/swap.json +1069 -0
- package/lib/constants/abis/ren-fantom/swap.json +868 -0
- package/lib/constants/abis/tricrypto/swapNoZap.json +1250 -0
- package/lib/constants/aliases.d.ts +2 -0
- package/lib/constants/aliases.js +25 -1
- package/lib/constants/coins/arbitrum.d.ts +7 -0
- package/lib/constants/coins/arbitrum.js +23 -0
- package/lib/constants/coins/fantom.d.ts +7 -0
- package/lib/constants/coins/fantom.js +36 -0
- package/lib/constants/pools/arbitrum.d.ts +4 -0
- package/lib/constants/pools/arbitrum.js +125 -0
- package/lib/constants/pools/fantom.d.ts +4 -0
- package/lib/constants/pools/fantom.js +191 -0
- package/lib/constants/pools/index.d.ts +3 -1
- package/lib/constants/pools/index.js +5 -1
- package/lib/constants/pools/polygon.js +30 -0
- package/lib/curve.js +42 -10
- package/lib/factory/common.js +31 -0
- package/lib/factory/constants.d.ts +6 -0
- package/lib/factory/constants.js +85 -3
- package/lib/factory/factory-crypto.js +4 -0
- package/lib/factory/factory.js +6 -0
- package/lib/pools/PoolTemplate.d.ts +2 -1
- package/lib/pools/PoolTemplate.js +30 -25
- package/lib/pools/poolConstructor.js +3 -3
- package/lib/router.js +6 -6
- package/lib/utils.js +6 -0
- package/package.json +1 -1
package/lib/factory/common.js
CHANGED
|
@@ -10,6 +10,8 @@ var deposit_json_1 = __importDefault(require("../constants/abis/factoryPools/dep
|
|
|
10
10
|
var metaZap_json_1 = __importDefault(require("../constants/abis/fraxusdc/metaZap.json"));
|
|
11
11
|
var DepositZapMetaUsdPolygon_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapMetaUsdPolygon.json"));
|
|
12
12
|
var DepositZapMetaBtcPolygon_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapMetaBtcPolygon.json"));
|
|
13
|
+
var DepositZapFantom_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapFantom.json"));
|
|
14
|
+
var DepositZapMetaUsd2Fantom_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapMetaUsd2Fantom.json"));
|
|
13
15
|
function setFactoryZapContracts() {
|
|
14
16
|
if (this.chainId === 1) {
|
|
15
17
|
var fraxusdcMetaZapAddress = "0x08780fb7E580e492c1935bEe4fA5920b94AA95Da".toLowerCase();
|
|
@@ -35,6 +37,23 @@ function setFactoryZapContracts() {
|
|
|
35
37
|
multicallContract: new ethcall_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default),
|
|
36
38
|
};
|
|
37
39
|
}
|
|
40
|
+
else if (this.chainId === 250) {
|
|
41
|
+
var metaUsdZapAddress = "0x78D51EB71a62c081550EfcC0a9F9Ea94B2Ef081c".toLowerCase();
|
|
42
|
+
this.contracts[metaUsdZapAddress] = {
|
|
43
|
+
contract: new ethers_1.Contract(metaUsdZapAddress, DepositZapFantom_json_1.default, this.signer || this.provider),
|
|
44
|
+
multicallContract: new ethcall_1.Contract(metaUsdZapAddress, DepositZapFantom_json_1.default),
|
|
45
|
+
};
|
|
46
|
+
var metaRenBtcZapAddress = "0x001E3BA199B4FF4B5B6e97aCD96daFC0E2e4156e".toLowerCase();
|
|
47
|
+
this.contracts[metaRenBtcZapAddress] = {
|
|
48
|
+
contract: new ethers_1.Contract(metaRenBtcZapAddress, DepositZapFantom_json_1.default, this.signer || this.provider),
|
|
49
|
+
multicallContract: new ethcall_1.Contract(metaRenBtcZapAddress, DepositZapFantom_json_1.default),
|
|
50
|
+
};
|
|
51
|
+
var metaGeistUsdZapAddress = "0x247aEB220E87f24c40C9F86b65d6bd5d3c987B55".toLowerCase();
|
|
52
|
+
this.contracts[metaGeistUsdZapAddress] = {
|
|
53
|
+
contract: new ethers_1.Contract(metaGeistUsdZapAddress, DepositZapMetaUsd2Fantom_json_1.default, this.signer || this.provider),
|
|
54
|
+
multicallContract: new ethcall_1.Contract(metaGeistUsdZapAddress, DepositZapMetaUsd2Fantom_json_1.default),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
38
57
|
else if (this.chainId === 43114) {
|
|
39
58
|
var metaUsdZapAddress = "0x001E3BA199B4FF4B5B6e97aCD96daFC0E2e4156e".toLowerCase();
|
|
40
59
|
this.contracts[metaUsdZapAddress] = {
|
|
@@ -47,5 +66,17 @@ function setFactoryZapContracts() {
|
|
|
47
66
|
multicallContract: new ethcall_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default),
|
|
48
67
|
};
|
|
49
68
|
}
|
|
69
|
+
else if (this.chainId === 42161) {
|
|
70
|
+
var metaUsdZapAddress = "0x7544Fe3d184b6B55D6B36c3FCA1157eE0Ba30287".toLowerCase();
|
|
71
|
+
this.contracts[metaUsdZapAddress] = {
|
|
72
|
+
contract: new ethers_1.Contract(metaUsdZapAddress, DepositZapFantom_json_1.default, this.signer || this.provider),
|
|
73
|
+
multicallContract: new ethcall_1.Contract(metaUsdZapAddress, DepositZapFantom_json_1.default),
|
|
74
|
+
};
|
|
75
|
+
var metaBtcZapAddress = "0x803A2B40c5a9BB2B86DD630B274Fa2A9202874C2".toLowerCase();
|
|
76
|
+
this.contracts[metaBtcZapAddress] = {
|
|
77
|
+
contract: new ethers_1.Contract(metaBtcZapAddress, DepositZapFantom_json_1.default, this.signer || this.provider),
|
|
78
|
+
multicallContract: new ethcall_1.Contract(metaBtcZapAddress, DepositZapFantom_json_1.default),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
50
81
|
}
|
|
51
82
|
exports.setFactoryZapContracts = setFactoryZapContracts;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { IDict } from "../interfaces";
|
|
2
2
|
export declare const implementationABIDictEthereum: IDict<any>;
|
|
3
3
|
export declare const implementationABIDictPolygon: IDict<any>;
|
|
4
|
+
export declare const implementationABIDictFantom: IDict<any>;
|
|
4
5
|
export declare const implementationABIDictAvalanche: IDict<any>;
|
|
6
|
+
export declare const implementationABIDictArbitrum: IDict<any>;
|
|
5
7
|
export declare const implementationBasePoolIdDictEthereum: IDict<string>;
|
|
6
8
|
export declare const implementationBasePoolIdDictPolygon: IDict<string>;
|
|
9
|
+
export declare const implementationBasePoolIdDictFantom: IDict<string>;
|
|
7
10
|
export declare const implementationBasePoolIdDictAvalanche: IDict<string>;
|
|
11
|
+
export declare const implementationBasePoolIdDictArbitrum: IDict<string>;
|
|
8
12
|
export declare const basePoolIdZapDictEthereum: IDict<string>;
|
|
9
13
|
export declare const basePoolIdZapDictPolygon: IDict<string>;
|
|
14
|
+
export declare const basePoolIdZapDictFantom: IDict<string>;
|
|
10
15
|
export declare const basePoolIdZapDictAvalanche: IDict<string>;
|
|
16
|
+
export declare const basePoolIdZapDictArbitrum: IDict<string>;
|
|
11
17
|
export declare const NATIVE_TOKEN_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
12
18
|
export declare const NATIVE_TOKENS: {
|
|
13
19
|
[index: number]: {
|
package/lib/factory/constants.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.FACTORY_CONSTANTS = exports.NATIVE_TOKENS = exports.NATIVE_TOKEN_ADDRESS = exports.basePoolIdZapDictAvalanche = exports.basePoolIdZapDictPolygon = exports.basePoolIdZapDictEthereum = exports.implementationBasePoolIdDictAvalanche = exports.implementationBasePoolIdDictPolygon = exports.implementationBasePoolIdDictEthereum = exports.implementationABIDictAvalanche = exports.implementationABIDictPolygon = exports.implementationABIDictEthereum = void 0;
|
|
6
|
+
exports.FACTORY_CONSTANTS = exports.NATIVE_TOKENS = exports.NATIVE_TOKEN_ADDRESS = exports.basePoolIdZapDictArbitrum = exports.basePoolIdZapDictAvalanche = exports.basePoolIdZapDictFantom = exports.basePoolIdZapDictPolygon = exports.basePoolIdZapDictEthereum = exports.implementationBasePoolIdDictArbitrum = exports.implementationBasePoolIdDictAvalanche = exports.implementationBasePoolIdDictFantom = exports.implementationBasePoolIdDictPolygon = exports.implementationBasePoolIdDictEthereum = exports.implementationABIDictArbitrum = exports.implementationABIDictAvalanche = exports.implementationABIDictFantom = exports.implementationABIDictPolygon = exports.implementationABIDictEthereum = void 0;
|
|
7
7
|
var swap_json_1 = __importDefault(require("../constants/abis/factoryPools/swap.json"));
|
|
8
8
|
var MetaUSD_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaUSD.json"));
|
|
9
9
|
var MetaUSDBalances_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaUSDBalances.json"));
|
|
@@ -13,6 +13,7 @@ var MetaBTC_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaB
|
|
|
13
13
|
var MetaBTCBalances_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaBTCBalances.json"));
|
|
14
14
|
var MetaBTCRen_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaBTCRen.json"));
|
|
15
15
|
var MetaBTCBalancesRen_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaBTCBalancesRen.json"));
|
|
16
|
+
var MetaUSDGeist_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaUSDGeist.json"));
|
|
16
17
|
var Plain2Basic_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain2Basic.json"));
|
|
17
18
|
var Plain2Balances_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain2Balances.json"));
|
|
18
19
|
var Plain2ETH_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain2ETH.json"));
|
|
@@ -66,6 +67,26 @@ exports.implementationABIDictPolygon = {
|
|
|
66
67
|
"0xf31bcdf0B9a5eCD7AB463eB905551fBc32e51856": Plain4ETH_json_1.default,
|
|
67
68
|
"0xAc273d5b4FC06625d8b1abA3BE8De15bDFb8E39f": Plain4Optimized_json_1.default,
|
|
68
69
|
};
|
|
70
|
+
exports.implementationABIDictFantom = {
|
|
71
|
+
"0xfCE359115dFe1533a2458650123F86C454BC0213": MetaUSD_json_1.default,
|
|
72
|
+
"0x09C62ad0694e3f1ad8cF8876aaBe56138C586f5F": MetaUSDBalances_json_1.default,
|
|
73
|
+
"0xC9438d8928486bD9621D326002F4672bF684187A": MetaBTCRen_json_1.default,
|
|
74
|
+
"0x2b70A5B878665FfDB4A06Ba40a264d6c70f68F4B": MetaBTCBalancesRen_json_1.default,
|
|
75
|
+
"0x210C806F6AE850279f7E298dE749EC4B427d00DD": MetaUSDGeist_json_1.default,
|
|
76
|
+
"0xf82162bB68aD5a168345bb7EFb2faA0EDCCA5177": MetaUSDBalances_json_1.default,
|
|
77
|
+
"0x61E10659fe3aa93d036d099405224E4Ac24996d0": Plain2Basic_json_1.default,
|
|
78
|
+
"0xd9Acb0BAeeD77C99305017821167674Cc7e82f7a": Plain2Balances_json_1.default,
|
|
79
|
+
"0xE6358f6a45B502477e83CC1CDa759f540E4459ee": Plain2ETH_json_1.default,
|
|
80
|
+
"0xAD4768F408dD170e62E074188D81A29AE31B8Fd8": Plain2Optimized_json_1.default,
|
|
81
|
+
"0x3cABd83bCa606768939B843f91df8f4963dBC079": Plain3Basic_json_1.default,
|
|
82
|
+
"0xD1602F68CC7C4c7B59D686243EA35a9C73B0c6a2": Plain3Balances_json_1.default,
|
|
83
|
+
"0x5d58Eb45e97B43e471AF05cD2b11CeB4106E1b1a": Plain3ETH_json_1.default,
|
|
84
|
+
"0x7Ee25A34C921E4009B726cC6be0643fd6a39DbfE": Plain3Optimized_json_1.default,
|
|
85
|
+
"0xABE216918fFDa43B44e3FC09639Fd82fD3527D89": Plain4Basic_json_1.default,
|
|
86
|
+
"0x775A21E0dfE25aF30FF2FCAC37512EbD8fD36471": Plain4Balances_json_1.default,
|
|
87
|
+
"0xb11Dc44A9f981fAF1669dca6DD40c3cc2554A2ce": Plain4ETH_json_1.default,
|
|
88
|
+
"0x9D7C28226AA7142cBF234ab9aa9C203D095c528B": Plain4Optimized_json_1.default,
|
|
89
|
+
};
|
|
69
90
|
exports.implementationABIDictAvalanche = {
|
|
70
91
|
"0xA237034249290De2B07988Ac64b96f22c0E76fE0": MetaUSD_json_1.default,
|
|
71
92
|
"0xc50C05Ca1f8C2346664bd0d4a1eb6aC1Da38414f": MetaUSDBalances_json_1.default,
|
|
@@ -84,6 +105,24 @@ exports.implementationABIDictAvalanche = {
|
|
|
84
105
|
"0x0eb0F1FaF5F509Ac53fA224477509EAD167cf410": Plain4ETH_json_1.default,
|
|
85
106
|
"0xCE94D3E5b0D80565D7B713A687b39a3Dc81780BA": Plain4Optimized_json_1.default,
|
|
86
107
|
};
|
|
108
|
+
exports.implementationABIDictArbitrum = {
|
|
109
|
+
"0x09672362833d8f703D5395ef3252D4Bfa51c15ca": MetaUSD_json_1.default,
|
|
110
|
+
"0xBE175115BF33E12348ff77CcfEE4726866A0Fbd5": MetaUSDBalances_json_1.default,
|
|
111
|
+
"0x094d12e5b541784701FD8d65F11fc0598FBC6332": MetaBTCRen_json_1.default,
|
|
112
|
+
"0xF1f85a74AD6c64315F85af52d3d46bF715236ADc": MetaBTCBalancesRen_json_1.default,
|
|
113
|
+
"0x54e8A25d0Ac0E4945b697C80b8372445FEA17A62": Plain2Basic_json_1.default,
|
|
114
|
+
"0xD68970e266cE1A015953897C7055a5E0bC657Af8": Plain2Balances_json_1.default,
|
|
115
|
+
"0x7DA64233Fefb352f8F501B357c018158ED8aA455": Plain2ETH_json_1.default,
|
|
116
|
+
"0x0100fBf414071977B19fC38e6fc7c32FE444F5C9": Plain2Optimized_json_1.default,
|
|
117
|
+
"0xe381C25de995d62b453aF8B931aAc84fcCaa7A62": Plain3Basic_json_1.default,
|
|
118
|
+
"0xc379bA7b8e1c6C48D64e1cf9dD602C97c9fD0F40": Plain3Balances_json_1.default,
|
|
119
|
+
"0xAAe75FAebCae43b9d541Fd875622BE48D9B4f5D0": Plain3ETH_json_1.default,
|
|
120
|
+
"0x8866414733F22295b7563f9C5299715D2D76CAf4": Plain3Optimized_json_1.default,
|
|
121
|
+
"0x8d53E5De033078367Ad91527c53abfd1Eb6bfa86": Plain4Basic_json_1.default,
|
|
122
|
+
"0x2ac56cEBc2D27c9bB51a11773355E44371Eb88D3": Plain4Balances_json_1.default,
|
|
123
|
+
"0x89287c32c2CAC1C76227F6d300B2DBbab6b75C08": Plain4ETH_json_1.default,
|
|
124
|
+
"0x06e3C4da96fd076b97b7ca3Ae23527314b6140dF": Plain4Optimized_json_1.default,
|
|
125
|
+
};
|
|
87
126
|
exports.implementationBasePoolIdDictEthereum = {
|
|
88
127
|
"0x5F890841f657d90E081bAbdB532A05996Af79Fe6": "3pool",
|
|
89
128
|
"0x213be373FDff327658139C7df330817DAD2d5bBE": "3pool",
|
|
@@ -101,12 +140,26 @@ exports.implementationBasePoolIdDictPolygon = {
|
|
|
101
140
|
"0xC05EB760A135d3D0c839f1141423002681157a17": "ren",
|
|
102
141
|
"0xD8336532f6ED7b94282fAF724fe41d6145E07Cfc": "ren",
|
|
103
142
|
};
|
|
143
|
+
exports.implementationBasePoolIdDictFantom = {
|
|
144
|
+
"0xfCE359115dFe1533a2458650123F86C454BC0213": "2pool",
|
|
145
|
+
"0x09C62ad0694e3f1ad8cF8876aaBe56138C586f5F": "2pool",
|
|
146
|
+
"0xC9438d8928486bD9621D326002F4672bF684187A": "ren",
|
|
147
|
+
"0x2b70A5B878665FfDB4A06Ba40a264d6c70f68F4B": "ren",
|
|
148
|
+
"0x210C806F6AE850279f7E298dE749EC4B427d00DD": "geist",
|
|
149
|
+
"0xf82162bB68aD5a168345bb7EFb2faA0EDCCA5177": "geist",
|
|
150
|
+
};
|
|
104
151
|
exports.implementationBasePoolIdDictAvalanche = {
|
|
105
152
|
"0xA237034249290De2B07988Ac64b96f22c0E76fE0": "aave",
|
|
106
153
|
"0xc50C05Ca1f8C2346664bd0d4a1eb6aC1Da38414f": "aave",
|
|
107
154
|
"0xa27f39E9C21b3376F43266E13Ad5A5d6E9BdB320": "ren",
|
|
108
155
|
"0x505C34ED8dBE96d2D5C7D83158aA844887770970": "ren",
|
|
109
156
|
};
|
|
157
|
+
exports.implementationBasePoolIdDictArbitrum = {
|
|
158
|
+
"0x09672362833d8f703D5395ef3252D4Bfa51c15ca": "2pool",
|
|
159
|
+
"0xBE175115BF33E12348ff77CcfEE4726866A0Fbd5": "2pool",
|
|
160
|
+
"0x094d12e5b541784701FD8d65F11fc0598FBC6332": "ren",
|
|
161
|
+
"0xF1f85a74AD6c64315F85af52d3d46bF715236ADc": "ren",
|
|
162
|
+
};
|
|
110
163
|
exports.basePoolIdZapDictEthereum = {
|
|
111
164
|
'3pool': "0xA79828DF1850E8a3A3064576f380D90aECDD3359".toLowerCase(),
|
|
112
165
|
fraxusdc: "0x08780fb7E580e492c1935bEe4fA5920b94AA95Da".toLowerCase(),
|
|
@@ -117,21 +170,40 @@ exports.basePoolIdZapDictPolygon = {
|
|
|
117
170
|
aave: "0x5ab5C56B9db92Ba45a0B46a207286cD83C15C939".toLowerCase(),
|
|
118
171
|
ren: "0xE2e6DC1708337A6e59f227921db08F21e3394723".toLowerCase(),
|
|
119
172
|
};
|
|
173
|
+
exports.basePoolIdZapDictFantom = {
|
|
174
|
+
'2pool': "0x78D51EB71a62c081550EfcC0a9F9Ea94B2Ef081c".toLowerCase(),
|
|
175
|
+
ren: "0x001E3BA199B4FF4B5B6e97aCD96daFC0E2e4156e".toLowerCase(),
|
|
176
|
+
geist: "0x247aEB220E87f24c40C9F86b65d6bd5d3c987B55".toLowerCase(),
|
|
177
|
+
};
|
|
120
178
|
exports.basePoolIdZapDictAvalanche = {
|
|
121
179
|
aave: "0x001E3BA199B4FF4B5B6e97aCD96daFC0E2e4156e".toLowerCase(),
|
|
122
180
|
ren: "0xEeB3DDBcc4174e0b3fd1C13aD462b95D11Ef42C3".toLowerCase(),
|
|
123
181
|
};
|
|
182
|
+
exports.basePoolIdZapDictArbitrum = {
|
|
183
|
+
"2pool": "0x7544Fe3d184b6B55D6B36c3FCA1157eE0Ba30287".toLowerCase(),
|
|
184
|
+
ren: "0x803A2B40c5a9BB2B86DD630B274Fa2A9202874C2".toLowerCase(),
|
|
185
|
+
};
|
|
124
186
|
exports.NATIVE_TOKEN_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
125
187
|
exports.NATIVE_TOKENS = {
|
|
126
188
|
1: {
|
|
127
189
|
symbol: 'ETH',
|
|
128
190
|
wrappedSymbol: 'WETH',
|
|
129
|
-
wrappedAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
191
|
+
wrappedAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'.toLowerCase(),
|
|
130
192
|
},
|
|
131
193
|
137: {
|
|
132
194
|
symbol: 'MATIC',
|
|
133
195
|
wrappedSymbol: 'WMATIC',
|
|
134
|
-
wrappedAddress: '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270',
|
|
196
|
+
wrappedAddress: '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270'.toLowerCase(),
|
|
197
|
+
},
|
|
198
|
+
250: {
|
|
199
|
+
symbol: 'FTM',
|
|
200
|
+
wrappedSymbol: 'WFTM',
|
|
201
|
+
wrappedAddress: '0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83'.toLowerCase(),
|
|
202
|
+
},
|
|
203
|
+
42161: {
|
|
204
|
+
symbol: 'ETH',
|
|
205
|
+
wrappedSymbol: 'WETH',
|
|
206
|
+
wrappedAddress: '0x82af49447d8a07e3bd95bd0d56f35241523fbab1'.toLowerCase(),
|
|
135
207
|
},
|
|
136
208
|
};
|
|
137
209
|
exports.FACTORY_CONSTANTS = {
|
|
@@ -145,9 +217,19 @@ exports.FACTORY_CONSTANTS = {
|
|
|
145
217
|
implementationBasePoolIdDict: exports.implementationBasePoolIdDictPolygon,
|
|
146
218
|
basePoolIdZapDict: exports.basePoolIdZapDictPolygon,
|
|
147
219
|
},
|
|
220
|
+
250: {
|
|
221
|
+
implementationABIDict: exports.implementationABIDictFantom,
|
|
222
|
+
implementationBasePoolIdDict: exports.implementationBasePoolIdDictFantom,
|
|
223
|
+
basePoolIdZapDict: exports.basePoolIdZapDictFantom,
|
|
224
|
+
},
|
|
148
225
|
43114: {
|
|
149
226
|
implementationABIDict: exports.implementationABIDictAvalanche,
|
|
150
227
|
implementationBasePoolIdDict: exports.implementationBasePoolIdDictAvalanche,
|
|
151
228
|
basePoolIdZapDict: exports.basePoolIdZapDictAvalanche,
|
|
152
229
|
},
|
|
230
|
+
42161: {
|
|
231
|
+
implementationABIDict: exports.implementationABIDictArbitrum,
|
|
232
|
+
implementationBasePoolIdDict: exports.implementationBasePoolIdDictArbitrum,
|
|
233
|
+
basePoolIdZapDict: exports.basePoolIdZapDictArbitrum,
|
|
234
|
+
},
|
|
153
235
|
};
|
|
@@ -225,8 +225,12 @@ function getExistingCoinAddressNameDict() {
|
|
|
225
225
|
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "ETH";
|
|
226
226
|
if (this.chainId === 137)
|
|
227
227
|
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "MATIC";
|
|
228
|
+
if (this.chainId === 250)
|
|
229
|
+
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "FTM";
|
|
228
230
|
if (this.chainId === 43114)
|
|
229
231
|
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "AVAX";
|
|
232
|
+
if (this.chainId === 42161)
|
|
233
|
+
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "ETH";
|
|
230
234
|
return dict;
|
|
231
235
|
}
|
|
232
236
|
function getCoinAddressNameDict(coinAddresses, existingCoinAddrNameDict) {
|
package/lib/factory/factory.js
CHANGED
|
@@ -63,7 +63,9 @@ var BLACK_LIST = {
|
|
|
63
63
|
"0xe4199bc5c5c1f63dba47b56b6db7144c51cf0bf8",
|
|
64
64
|
"0x88c4d6534165510b2e2caf0a130d4f70aa4b6d71",
|
|
65
65
|
],
|
|
66
|
+
250: [],
|
|
66
67
|
43114: [],
|
|
68
|
+
42161: [],
|
|
67
69
|
};
|
|
68
70
|
var deepFlatten = function (arr) { return [].concat.apply([], arr.map(function (v) { return (Array.isArray(v) ? deepFlatten(v) : v); })); };
|
|
69
71
|
function getFactoryIdsAndSwapAddresses() {
|
|
@@ -255,8 +257,12 @@ function getExistingCoinAddressNameDict() {
|
|
|
255
257
|
dict["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"] = "ETH";
|
|
256
258
|
if (this.chainId === 137)
|
|
257
259
|
dict["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"] = "MATIC";
|
|
260
|
+
if (this.chainId === 250)
|
|
261
|
+
dict["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"] = "FTM";
|
|
258
262
|
if (this.chainId === 43114)
|
|
259
263
|
dict["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"] = "AVAX";
|
|
264
|
+
if (this.chainId === 42161)
|
|
265
|
+
dict["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"] = "ETH";
|
|
260
266
|
return dict;
|
|
261
267
|
}
|
|
262
268
|
function getCoinAddressNameDict(coinAddresses, existingCoinAddrNameDict) {
|
|
@@ -47,7 +47,7 @@ export declare class PoolTemplate {
|
|
|
47
47
|
withdrawImbalanceApprove: (amounts: (number | string)[]) => Promise<number>;
|
|
48
48
|
withdrawImbalance: (amounts: (number | string)[]) => Promise<number>;
|
|
49
49
|
withdrawImbalanceWrapped: (amounts: (number | string)[]) => Promise<number>;
|
|
50
|
-
withdrawOneCoinApprove: (lpTokenAmount: number | string
|
|
50
|
+
withdrawOneCoinApprove: (lpTokenAmount: number | string) => Promise<number>;
|
|
51
51
|
withdrawOneCoin: (lpTokenAmount: number | string, coin: string | number) => Promise<number>;
|
|
52
52
|
withdrawOneCoinWrapped: (lpTokenAmount: number | string, coin: string | number) => Promise<number>;
|
|
53
53
|
swapApprove: (inputCoin: string | number, amount: number | string) => Promise<number>;
|
|
@@ -86,6 +86,7 @@ export declare class PoolTemplate {
|
|
|
86
86
|
allCoinBalances: (...addresses: string[] | string[][]) => Promise<IDict<IDict<string>> | IDict<string>>;
|
|
87
87
|
};
|
|
88
88
|
constructor(id: string);
|
|
89
|
+
rewardsOnly(): boolean;
|
|
89
90
|
private statsParameters;
|
|
90
91
|
private statsWrappedBalances;
|
|
91
92
|
private statsUnderlyingBalances;
|
|
@@ -203,8 +203,8 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
203
203
|
return __generator(this, function (_e) {
|
|
204
204
|
switch (_e.label) {
|
|
205
205
|
case 0:
|
|
206
|
-
if (this.
|
|
207
|
-
throw Error("".concat(this.name, "
|
|
206
|
+
if (this.rewardsOnly())
|
|
207
|
+
throw Error("".concat(this.name, " has Rewards-Only Gauge. Use getRewardsApy instead"));
|
|
208
208
|
return [4 /*yield*/, this.statsTotalLiquidity()];
|
|
209
209
|
case 1:
|
|
210
210
|
totalLiquidityUSD = _e.sent();
|
|
@@ -255,12 +255,14 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
255
255
|
});
|
|
256
256
|
}); };
|
|
257
257
|
this.statsRewardsApy = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
258
|
-
var apy, rewardTokens, _i, rewardTokens_1, rewardToken,
|
|
258
|
+
var apy, rewardTokens, _i, rewardTokens_1, rewardToken, contract, totalLiquidityUSD, rewardRate, rewardData, periodFinish, inflation, baseApy, network, promises, _a, mainPoolsRewards, allTypesExtendedPoolData, rewards, _c, _d, extendedPoolData, _e, _f, pool;
|
|
259
259
|
var _g;
|
|
260
260
|
return __generator(this, function (_h) {
|
|
261
261
|
switch (_h.label) {
|
|
262
262
|
case 0:
|
|
263
|
-
if (
|
|
263
|
+
if (this.gauge === ethers_1.ethers.constants.AddressZero)
|
|
264
|
+
return [2 /*return*/, []];
|
|
265
|
+
if (![137, 250, 43114, 42161].includes(curve_1.curve.chainId)) return [3 /*break*/, 8];
|
|
264
266
|
apy = [];
|
|
265
267
|
return [4 /*yield*/, this.rewardTokens()];
|
|
266
268
|
case 1:
|
|
@@ -270,14 +272,14 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
270
272
|
case 2:
|
|
271
273
|
if (!(_i < rewardTokens_1.length)) return [3 /*break*/, 7];
|
|
272
274
|
rewardToken = rewardTokens_1[_i];
|
|
273
|
-
|
|
275
|
+
contract = curve_1.curve.contracts[this.sRewardContract || this.gauge].contract;
|
|
274
276
|
return [4 /*yield*/, this.statsTotalLiquidity()];
|
|
275
277
|
case 3:
|
|
276
278
|
totalLiquidityUSD = _h.sent();
|
|
277
279
|
return [4 /*yield*/, (0, utils_1._getUsdRate)(rewardToken.token)];
|
|
278
280
|
case 4:
|
|
279
281
|
rewardRate = _h.sent();
|
|
280
|
-
return [4 /*yield*/,
|
|
282
|
+
return [4 /*yield*/, contract.reward_data(rewardToken.token, curve_1.curve.constantOptions)];
|
|
281
283
|
case 5:
|
|
282
284
|
rewardData = _h.sent();
|
|
283
285
|
periodFinish = Number(ethers_1.ethers.utils.formatUnits(rewardData.period_finish, 0)) * 1000;
|
|
@@ -329,8 +331,8 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
329
331
|
return __generator(this, function (_e) {
|
|
330
332
|
switch (_e.label) {
|
|
331
333
|
case 0:
|
|
332
|
-
if (this.
|
|
333
|
-
throw Error("".concat(this.name, "
|
|
334
|
+
if (this.rewardsOnly())
|
|
335
|
+
throw Error("".concat(this.name, " has Rewards-Only Gauge. Use rewardsProfit instead"));
|
|
334
336
|
address = address || curve_1.curve.signerAddress;
|
|
335
337
|
if (!address)
|
|
336
338
|
throw Error("Need to connect wallet or pass address into args");
|
|
@@ -948,6 +950,12 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
948
950
|
allCoinBalances: this.walletAllCoinBalances.bind(this),
|
|
949
951
|
};
|
|
950
952
|
}
|
|
953
|
+
PoolTemplate.prototype.rewardsOnly = function () {
|
|
954
|
+
if (this.gauge === ethers_1.ethers.constants.AddressZero)
|
|
955
|
+
throw Error("".concat(this.name, " doesn't have gauge"));
|
|
956
|
+
var gaugeContract = curve_1.curve.contracts[this.gauge].contract;
|
|
957
|
+
return !('inflation_rate()' in gaugeContract || 'inflation_rate(uint256)' in gaugeContract);
|
|
958
|
+
};
|
|
951
959
|
PoolTemplate.prototype.statsWrappedBalances = function () {
|
|
952
960
|
return __awaiter(this, void 0, void 0, function () {
|
|
953
961
|
var swapContract, contractCalls, _wrappedBalances;
|
|
@@ -1336,9 +1344,8 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1336
1344
|
return __generator(this, function (_d) {
|
|
1337
1345
|
switch (_d.label) {
|
|
1338
1346
|
case 0:
|
|
1339
|
-
if (this.
|
|
1340
|
-
throw Error("
|
|
1341
|
-
}
|
|
1347
|
+
if (this.rewardsOnly())
|
|
1348
|
+
throw Error("".concat(this.name, " has Rewards-Only Gauge. Use claimableRewards instead"));
|
|
1342
1349
|
address = address || curve_1.curve.signerAddress;
|
|
1343
1350
|
if (!address)
|
|
1344
1351
|
throw Error("Need to connect wallet or pass address into args");
|
|
@@ -1354,9 +1361,8 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1354
1361
|
return __generator(this, function (_a) {
|
|
1355
1362
|
switch (_a.label) {
|
|
1356
1363
|
case 0:
|
|
1357
|
-
if (this.
|
|
1358
|
-
throw Error("
|
|
1359
|
-
}
|
|
1364
|
+
if (this.rewardsOnly())
|
|
1365
|
+
throw Error("".concat(this.name, " has Rewards-Only Gauge. Use claimRewards instead"));
|
|
1360
1366
|
return [4 /*yield*/, curve_1.curve.contracts[curve_1.curve.constants.ALIASES.minter].contract.estimateGas.mint(this.gauge, curve_1.curve.constantOptions)];
|
|
1361
1367
|
case 1: return [2 /*return*/, (_a.sent()).toNumber()];
|
|
1362
1368
|
}
|
|
@@ -1369,9 +1375,8 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1369
1375
|
return __generator(this, function (_a) {
|
|
1370
1376
|
switch (_a.label) {
|
|
1371
1377
|
case 0:
|
|
1372
|
-
if (this.
|
|
1373
|
-
throw Error("
|
|
1374
|
-
}
|
|
1378
|
+
if (this.rewardsOnly())
|
|
1379
|
+
throw Error("".concat(this.name, " has Rewards-Only Gauge. Use claimRewards instead"));
|
|
1375
1380
|
contract = curve_1.curve.contracts[curve_1.curve.constants.ALIASES.minter].contract;
|
|
1376
1381
|
return [4 /*yield*/, contract.estimateGas.mint(this.gauge, curve_1.curve.constantOptions)];
|
|
1377
1382
|
case 1:
|
|
@@ -1625,7 +1630,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1625
1630
|
if (this.gauge === ethers_1.ethers.constants.AddressZero) {
|
|
1626
1631
|
throw Error("depositAndStakeWrappedExpected method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
1627
1632
|
}
|
|
1628
|
-
if (this.isFake)
|
|
1633
|
+
if (this.isPlain || this.isFake)
|
|
1629
1634
|
throw Error("depositAndStakeWrappedExpected method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, ")"));
|
|
1630
1635
|
return [4 /*yield*/, this.depositWrappedExpected(amounts)];
|
|
1631
1636
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -1641,7 +1646,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1641
1646
|
if (this.gauge === ethers_1.ethers.constants.AddressZero) {
|
|
1642
1647
|
throw Error("depositAndStakeWrappedBonus method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
1643
1648
|
}
|
|
1644
|
-
if (this.isFake)
|
|
1649
|
+
if (this.isPlain || this.isFake)
|
|
1645
1650
|
throw Error("depositAndStakeWrappedBonus method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, ")"));
|
|
1646
1651
|
return [4 /*yield*/, this.depositWrappedBonus(amounts)];
|
|
1647
1652
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -1658,7 +1663,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1658
1663
|
if (this.gauge === ethers_1.ethers.constants.AddressZero) {
|
|
1659
1664
|
throw Error("depositAndStakeWrappedIsApproved method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
1660
1665
|
}
|
|
1661
|
-
if (this.isFake)
|
|
1666
|
+
if (this.isPlain || this.isFake)
|
|
1662
1667
|
throw Error("depositAndStakeWrappedIsApproved method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, ")"));
|
|
1663
1668
|
return [4 /*yield*/, (0, utils_1.hasAllowance)(this.wrappedCoinAddresses, amounts, curve_1.curve.signerAddress, curve_1.curve.constants.ALIASES.deposit_and_stake)];
|
|
1664
1669
|
case 1:
|
|
@@ -1683,7 +1688,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1683
1688
|
if (this.gauge === ethers_1.ethers.constants.AddressZero) {
|
|
1684
1689
|
throw Error("depositAndStakeWrappedApprove method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
1685
1690
|
}
|
|
1686
|
-
if (this.isFake)
|
|
1691
|
+
if (this.isPlain || this.isFake)
|
|
1687
1692
|
throw Error("depositAndStakeWrappedApprove method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, ")"));
|
|
1688
1693
|
return [4 /*yield*/, (0, utils_1.ensureAllowanceEstimateGas)(this.wrappedCoinAddresses, amounts, curve_1.curve.constants.ALIASES.deposit_and_stake)];
|
|
1689
1694
|
case 1:
|
|
@@ -1712,7 +1717,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1712
1717
|
if (this.gauge === ethers_1.ethers.constants.AddressZero) {
|
|
1713
1718
|
throw Error("depositAndStakeWrappedApprove method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
1714
1719
|
}
|
|
1715
|
-
if (this.isFake)
|
|
1720
|
+
if (this.isPlain || this.isFake)
|
|
1716
1721
|
throw Error("depositAndStakeWrappedApprove method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, ")"));
|
|
1717
1722
|
return [4 /*yield*/, (0, utils_1.ensureAllowance)(this.wrappedCoinAddresses, amounts, curve_1.curve.constants.ALIASES.deposit_and_stake)];
|
|
1718
1723
|
case 1:
|
|
@@ -1743,7 +1748,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1743
1748
|
if (this.gauge === ethers_1.ethers.constants.AddressZero) {
|
|
1744
1749
|
throw Error("depositAndStakeWrapped method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
1745
1750
|
}
|
|
1746
|
-
if (this.isFake)
|
|
1751
|
+
if (this.isPlain || this.isFake)
|
|
1747
1752
|
throw Error("depositAndStakeWrapped method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, ")"));
|
|
1748
1753
|
return [4 /*yield*/, this._depositAndStake(amounts, false, true)];
|
|
1749
1754
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -1759,7 +1764,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1759
1764
|
if (this.gauge === ethers_1.ethers.constants.AddressZero) {
|
|
1760
1765
|
throw Error("depositAndStakeWrapped method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
1761
1766
|
}
|
|
1762
|
-
if (this.isFake)
|
|
1767
|
+
if (this.isPlain || this.isFake)
|
|
1763
1768
|
throw Error("depositAndStakeWrapped method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, ")"));
|
|
1764
1769
|
return [4 /*yield*/, this._depositAndStake(amounts, false, false)];
|
|
1765
1770
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -2536,7 +2541,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
2536
2541
|
});
|
|
2537
2542
|
};
|
|
2538
2543
|
PoolTemplate.prototype._swapContractAddress = function () {
|
|
2539
|
-
return (this.isCrypto && this.isMeta) || (
|
|
2544
|
+
return (this.isCrypto && this.isMeta) || (this.isMetaFactory && (new PoolTemplate(this.basePool).isLending)) ? this.zap : this.address;
|
|
2540
2545
|
};
|
|
2541
2546
|
PoolTemplate.prototype.swapIsApproved = function (inputCoin, amount) {
|
|
2542
2547
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -227,10 +227,10 @@ var getPool = function (poolId) {
|
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
// swap and swapEstimateGas
|
|
230
|
-
if (
|
|
230
|
+
if ('exchange(uint256,uint256,uint256,uint256,bool)' in curve_1.curve.contracts[poolDummy.address].contract) { // tricrypto2 (eth), tricrypto (arbitrum)
|
|
231
231
|
Object.assign(Pool.prototype, swapMixins_1.swapTricrypto2Mixin);
|
|
232
232
|
}
|
|
233
|
-
else if (
|
|
233
|
+
else if (poolDummy.isMetaFactory && (0, exports.getPool)(poolDummy.basePool).isLending) {
|
|
234
234
|
Object.assign(Pool.prototype, swapMixins_1.swapMetaFactoryMixin);
|
|
235
235
|
}
|
|
236
236
|
else {
|
|
@@ -239,7 +239,7 @@ var getPool = function (poolId) {
|
|
|
239
239
|
// swapWrapped and swapWrappedEstimateGas
|
|
240
240
|
if (!poolDummy.isPlain && !poolDummy.isFake) {
|
|
241
241
|
Object.assign(Pool.prototype, swapWrappedMixins_1.swapWrappedExpectedAndApproveMixin);
|
|
242
|
-
if (
|
|
242
|
+
if ('exchange(uint256,uint256,uint256,uint256,bool)' in curve_1.curve.contracts[poolDummy.address].contract) { // tricrypto2 (eth), tricrypto (arbitrum)
|
|
243
243
|
Object.assign(Pool.prototype, swapWrappedMixins_1.swapWrappedTricrypto2Mixin);
|
|
244
244
|
}
|
|
245
245
|
else {
|
package/lib/router.js
CHANGED
|
@@ -71,7 +71,7 @@ var pools_1 = require("./pools");
|
|
|
71
71
|
var IMBALANCED_POOLS = [];
|
|
72
72
|
// Inspired by Dijkstra's algorithm
|
|
73
73
|
var _findAllRoutes = function (inputCoinAddress, outputCoinAddress) { return __awaiter(void 0, void 0, void 0, function () {
|
|
74
|
-
var ALL_POOLS, basePoolsSet, _i, ALL_POOLS_1, pool, basePoolIds, markedCoins, curCoins, nextCoins, routes, step, _a, curCoins_1, inCoin, _b, ALL_POOLS_2, _c, poolId, poolData, wrapped_coin_addresses, underlying_coin_addresses, meta_coin_addresses, token_address, is_lending, inCoinIndexes, j, swapType, _d, _e, inCoinRoute, swapType, _f, _h, inCoinRoute, j, tvl, _j, swapType, _k, _l, inCoinRoute, poolAddress, j, tvl, _m, swapType, _o, _p, inCoinRoute, j, tvl, _q, swapType, _r, _s, inCoinRoute, tvl, _t, swapType, _u, _v, inCoinRoute;
|
|
74
|
+
var ALL_POOLS, basePoolsSet, _i, ALL_POOLS_1, pool, basePoolIds, markedCoins, curCoins, nextCoins, routes, step, _a, curCoins_1, inCoin, _b, ALL_POOLS_2, _c, poolId, poolData, wrapped_coin_addresses, underlying_coin_addresses, base_pool, meta_coin_addresses, token_address, is_lending, inCoinIndexes, j, swapType, _d, _e, inCoinRoute, swapType, _f, _h, inCoinRoute, j, tvl, _j, swapType, _k, _l, inCoinRoute, poolAddress, j, tvl, _m, swapType, _o, _p, inCoinRoute, j, tvl, _q, swapType, _r, _s, inCoinRoute, tvl, _t, swapType, _u, _v, inCoinRoute;
|
|
75
75
|
var _w;
|
|
76
76
|
var _x, _y, _z, _0, _1, _2, _3, _4;
|
|
77
77
|
return __generator(this, function (_5) {
|
|
@@ -109,8 +109,8 @@ var _findAllRoutes = function (inputCoinAddress, outputCoinAddress) { return __a
|
|
|
109
109
|
_c = ALL_POOLS_2[_b], poolId = _c[0], poolData = _c[1];
|
|
110
110
|
wrapped_coin_addresses = poolData.wrapped_coin_addresses.map(function (a) { return a.toLowerCase(); });
|
|
111
111
|
underlying_coin_addresses = poolData.underlying_coin_addresses.map(function (a) { return a.toLowerCase(); });
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
base_pool = poolData.is_meta ? curve_1.curve.constants.POOLS_DATA[poolData.base_pool] : null;
|
|
113
|
+
meta_coin_addresses = base_pool ? base_pool.underlying_coin_addresses.map(function (a) { return a.toLowerCase(); }) : [];
|
|
114
114
|
token_address = poolData.token_address.toLowerCase();
|
|
115
115
|
is_lending = (_x = poolData.is_lending) !== null && _x !== void 0 ? _x : false;
|
|
116
116
|
inCoinIndexes = {
|
|
@@ -214,7 +214,7 @@ var _findAllRoutes = function (inputCoinAddress, outputCoinAddress) { return __a
|
|
|
214
214
|
j++;
|
|
215
215
|
return [3 /*break*/, 4];
|
|
216
216
|
case 7:
|
|
217
|
-
poolAddress = (poolData.is_crypto && poolData.is_meta) || (
|
|
217
|
+
poolAddress = (poolData.is_crypto && poolData.is_meta) || (base_pool && base_pool.is_meta && poolData.is_factory) ?
|
|
218
218
|
poolData.deposit_address : poolData.swap_address;
|
|
219
219
|
if (!(wrapped_coin_addresses.join("|") !== underlying_coin_addresses.join("|") && inCoinIndexes.underlying_coin >= 0)) return [3 /*break*/, 11];
|
|
220
220
|
j = 0;
|
|
@@ -279,7 +279,7 @@ var _findAllRoutes = function (inputCoinAddress, outputCoinAddress) { return __a
|
|
|
279
279
|
// Skip imbalanced pools
|
|
280
280
|
if (IMBALANCED_POOLS.includes(poolId))
|
|
281
281
|
return [3 /*break*/, 14];
|
|
282
|
-
swapType = (
|
|
282
|
+
swapType = (base_pool && base_pool.is_meta && poolData.is_factory) ? 5 : poolData.is_crypto ? 4 : 2;
|
|
283
283
|
for (_r = 0, _s = routes[inCoin]; _r < _s.length; _r++) {
|
|
284
284
|
inCoinRoute = _s[_r];
|
|
285
285
|
routes[meta_coin_addresses[j]] = ((_2 = routes[meta_coin_addresses[j]]) !== null && _2 !== void 0 ? _2 : []).concat([__spreadArray(__spreadArray([], inCoinRoute, true), [
|
|
@@ -316,7 +316,7 @@ var _findAllRoutes = function (inputCoinAddress, outputCoinAddress) { return __a
|
|
|
316
316
|
// Skip imbalanced pools
|
|
317
317
|
if (IMBALANCED_POOLS.includes(poolId))
|
|
318
318
|
return [3 /*break*/, 17];
|
|
319
|
-
swapType = (
|
|
319
|
+
swapType = (base_pool && base_pool.is_meta && poolData.is_factory) ? 5 : poolData.is_crypto ? 4 : 2;
|
|
320
320
|
for (_u = 0, _v = routes[inCoin]; _u < _v.length; _u++) {
|
|
321
321
|
inCoinRoute = _v[_u];
|
|
322
322
|
routes[wrapped_coin_addresses[0]] = ((_3 = routes[wrapped_coin_addresses[0]]) !== null && _3 !== void 0 ? _3 : []).concat([__spreadArray(__spreadArray([], inCoinRoute, true), [
|
package/lib/utils.js
CHANGED
|
@@ -453,12 +453,16 @@ var _getUsdRate = function (assetId) { return __awaiter(void 0, void 0, void 0,
|
|
|
453
453
|
chainName = {
|
|
454
454
|
1: 'ethereum',
|
|
455
455
|
137: 'polygon-pos',
|
|
456
|
+
250: 'fantom',
|
|
456
457
|
43114: 'avalanche',
|
|
458
|
+
42161: 'arbitrum-one',
|
|
457
459
|
}[curve_1.curve.chainId];
|
|
458
460
|
nativeTokenName = {
|
|
459
461
|
1: 'ethereum',
|
|
460
462
|
137: 'matic-network',
|
|
463
|
+
250: 'fantom',
|
|
461
464
|
43114: 'avalanche-2',
|
|
465
|
+
42161: 'ethereum',
|
|
462
466
|
}[curve_1.curve.chainId];
|
|
463
467
|
if (chainName === undefined) {
|
|
464
468
|
throw Error('curve object is not initialized');
|
|
@@ -522,7 +526,9 @@ var getTVL = function (chainId) {
|
|
|
522
526
|
network = (_a = {
|
|
523
527
|
1: "ethereum",
|
|
524
528
|
137: "polygon",
|
|
529
|
+
250: "fantom",
|
|
525
530
|
43114: "avalanche",
|
|
531
|
+
42161: "arbitrum",
|
|
526
532
|
}[chainId]) !== null && _a !== void 0 ? _a : "ethereum";
|
|
527
533
|
promises = [
|
|
528
534
|
(0, external_api_1._getPoolsFromApi)(network, "main"),
|