@curvefi/api 2.1.0 → 2.3.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/README.md +2 -0
- package/lib/constants/abis/dusd/sCurveRewards.json +472 -1
- package/lib/constants/abis/gauge_child.json +1039 -0
- package/lib/constants/abis/{gauge_rewards_only.json → minter_child.json} +159 -312
- package/lib/constants/abis/musd/sCurveRewards.json +482 -1
- package/lib/constants/abis/rsv/sCurveRewards.json +472 -1
- package/lib/constants/abis/sbtc/sCurveRewards.json +566 -1
- package/lib/constants/abis/susdv2/sCurveRewards.json +457 -1
- package/lib/constants/abis/tbtc/sCurveRewards.json +472 -1
- package/lib/constants/aliases.d.ts +1 -0
- package/lib/constants/aliases.js +14 -2
- package/lib/constants/coins/avalanche.d.ts +7 -0
- package/lib/constants/coins/avalanche.js +33 -0
- package/lib/constants/pools/avalanche.d.ts +4 -0
- package/lib/constants/pools/avalanche.js +106 -0
- package/lib/constants/pools/ethereum.js +0 -33
- package/lib/constants/pools/index.d.ts +2 -1
- package/lib/constants/pools/index.js +3 -1
- package/lib/constants/pools/polygon.js +19 -24
- package/lib/constants/utils.js +0 -9
- package/lib/curve.d.ts +5 -1
- package/lib/curve.js +47 -29
- package/lib/external-api.d.ts +3 -3
- package/lib/factory/common.d.ts +2 -0
- package/lib/factory/common.js +45 -0
- package/lib/factory/constants.d.ts +11 -11
- package/lib/factory/constants.js +60 -58
- package/lib/factory/factory-api.js +20 -46
- package/lib/factory/factory-crypto.js +7 -4
- package/lib/factory/factory.js +31 -163
- package/lib/interfaces.d.ts +37 -29
- package/lib/pools/PoolTemplate.d.ts +11 -1
- package/lib/pools/PoolTemplate.js +175 -104
- package/lib/pools/poolConstructor.js +3 -3
- package/lib/router.js +10 -10
- package/lib/utils.d.ts +2 -0
- package/lib/utils.js +36 -14
- package/package.json +1 -1
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.
|
|
6
|
+
exports.FACTORY_CONSTANTS = exports.ETH_ADDRESS = exports.WETH_ADDRESS = exports.basePoolIdZapDictAvalanche = exports.basePoolIdZapDictPolygon = exports.basePoolIdZapDictEthereum = exports.basePoolAddressIdDictAvalanche = exports.basePoolAddressIdDictPolygon = exports.basePoolAddressIdDictEthereum = exports.implementationBasePoolAddressDictAvalanche = exports.implementationBasePoolAddressDictPolygon = exports.implementationBasePoolAddressDictEthereum = exports.implementationABIDictAvalanche = 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"));
|
|
@@ -62,6 +62,24 @@ exports.implementationABIDictPolygon = {
|
|
|
62
62
|
"0xf31bcdf0B9a5eCD7AB463eB905551fBc32e51856": Plain4ETH_json_1.default,
|
|
63
63
|
"0xAc273d5b4FC06625d8b1abA3BE8De15bDFb8E39f": Plain4Optimized_json_1.default,
|
|
64
64
|
};
|
|
65
|
+
exports.implementationABIDictAvalanche = {
|
|
66
|
+
"0xA237034249290De2B07988Ac64b96f22c0E76fE0": MetaUSD_json_1.default,
|
|
67
|
+
"0xc50C05Ca1f8C2346664bd0d4a1eb6aC1Da38414f": MetaUSDBalances_json_1.default,
|
|
68
|
+
"0xa27f39E9C21b3376F43266E13Ad5A5d6E9BdB320": MetaBTCRen_json_1.default,
|
|
69
|
+
"0x505C34ED8dBE96d2D5C7D83158aA844887770970": MetaBTCBalancesRen_json_1.default,
|
|
70
|
+
"0x697434ca761d4F86b553784B69F4f37F5eDf54dF": Plain2Basic_json_1.default,
|
|
71
|
+
"0xBdFF0C27dd073C119ebcb1299a68A6A92aE607F0": Plain2Balances_json_1.default,
|
|
72
|
+
"0x64448B78561690B70E17CBE8029a3e5c1bB7136e": Plain2ETH_json_1.default,
|
|
73
|
+
"0x09672362833d8f703D5395ef3252D4Bfa51c15ca": Plain2Optimized_json_1.default,
|
|
74
|
+
"0x1de7f0866e2c4adAC7b457c58Cc25c8688CDa1f2": Plain3Basic_json_1.default,
|
|
75
|
+
"0x094d12e5b541784701FD8d65F11fc0598FBC6332": Plain3Balances_json_1.default,
|
|
76
|
+
"0xF1f85a74AD6c64315F85af52d3d46bF715236ADc": Plain3ETH_json_1.default,
|
|
77
|
+
"0xaa82ca713D94bBA7A89CEAB55314F9EfFEdDc78c": Plain3Optimized_json_1.default,
|
|
78
|
+
"0x7544Fe3d184b6B55D6B36c3FCA1157eE0Ba30287": Plain4Basic_json_1.default,
|
|
79
|
+
"0x7D86446dDb609eD0F5f8684AcF30380a356b2B4c": Plain4Balances_json_1.default,
|
|
80
|
+
"0x0eb0F1FaF5F509Ac53fA224477509EAD167cf410": Plain4ETH_json_1.default,
|
|
81
|
+
"0xCE94D3E5b0D80565D7B713A687b39a3Dc81780BA": Plain4Optimized_json_1.default,
|
|
82
|
+
};
|
|
65
83
|
exports.implementationBasePoolAddressDictEthereum = {
|
|
66
84
|
"0x5F890841f657d90E081bAbdB532A05996Af79Fe6": "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7",
|
|
67
85
|
"0x213be373FDff327658139C7df330817DAD2d5bBE": "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7",
|
|
@@ -77,73 +95,57 @@ exports.implementationBasePoolAddressDictPolygon = {
|
|
|
77
95
|
"0xC05EB760A135d3D0c839f1141423002681157a17": "0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67",
|
|
78
96
|
"0xD8336532f6ED7b94282fAF724fe41d6145E07Cfc": "0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67", // ren
|
|
79
97
|
};
|
|
80
|
-
exports.
|
|
98
|
+
exports.implementationBasePoolAddressDictAvalanche = {
|
|
99
|
+
"0xA237034249290De2B07988Ac64b96f22c0E76fE0": "0x7f90122BF0700F9E7e1F688fe926940E8839F353",
|
|
100
|
+
"0xc50C05Ca1f8C2346664bd0d4a1eb6aC1Da38414f": "0x7f90122BF0700F9E7e1F688fe926940E8839F353",
|
|
101
|
+
"0xa27f39E9C21b3376F43266E13Ad5A5d6E9BdB320": "0x16a7DA911A4DD1d83F3fF066fE28F3C792C50d90",
|
|
102
|
+
"0x505C34ED8dBE96d2D5C7D83158aA844887770970": "0x16a7DA911A4DD1d83F3fF066fE28F3C792C50d90", // ren
|
|
103
|
+
};
|
|
104
|
+
exports.basePoolAddressIdDictEthereum = {
|
|
81
105
|
"0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7": "3pool",
|
|
82
106
|
"0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714": "sbtc",
|
|
83
107
|
"0x93054188d876f558f4a66B2EF1d97d16eDf0895B": "ren",
|
|
84
108
|
};
|
|
85
|
-
exports.
|
|
109
|
+
exports.basePoolAddressIdDictPolygon = {
|
|
86
110
|
"0x445FE580eF8d70FF569aB36e80c647af338db351": "aave",
|
|
87
111
|
"0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67": "ren",
|
|
88
112
|
};
|
|
89
|
-
exports.
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"0x93054188d876f558f4a66B2EF1d97d16eDf0895B": ['renBTC', 'WBTC'], // ren
|
|
93
|
-
};
|
|
94
|
-
exports.basePoolAddressCoinsDictPolygon = {
|
|
95
|
-
"0x445FE580eF8d70FF569aB36e80c647af338db351": ['DAI', 'USDC', 'USDT'],
|
|
96
|
-
"0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67": ['WBTC', 'renBTC'], // ren
|
|
97
|
-
};
|
|
98
|
-
exports.basePoolAddressCoinAddressesDictEthereum = {
|
|
99
|
-
"0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7": [
|
|
100
|
-
'0x6B175474E89094C44Da98b954EedeAC495271d0F',
|
|
101
|
-
'0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
102
|
-
'0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
|
103
|
-
].map(function (addr) { return addr.toLowerCase(); }),
|
|
104
|
-
"0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714": [
|
|
105
|
-
'0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D',
|
|
106
|
-
'0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
|
|
107
|
-
'0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6',
|
|
108
|
-
].map(function (addr) { return addr.toLowerCase(); }),
|
|
109
|
-
"0x93054188d876f558f4a66B2EF1d97d16eDf0895B": [
|
|
110
|
-
'0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D',
|
|
111
|
-
'0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
|
|
112
|
-
].map(function (addr) { return addr.toLowerCase(); }),
|
|
113
|
+
exports.basePoolAddressIdDictAvalanche = {
|
|
114
|
+
"0x7f90122BF0700F9E7e1F688fe926940E8839F353": "aave",
|
|
115
|
+
"0x16a7DA911A4DD1d83F3fF066fE28F3C792C50d90": "ren",
|
|
113
116
|
};
|
|
114
|
-
exports.
|
|
115
|
-
"
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
'0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
|
|
119
|
-
].map(function (addr) { return addr.toLowerCase(); }),
|
|
120
|
-
"0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67": [
|
|
121
|
-
'0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6',
|
|
122
|
-
'0xDBf31dF14B66535aF65AaC99C32e9eA844e14501',
|
|
123
|
-
].map(function (addr) { return addr.toLowerCase(); }),
|
|
117
|
+
exports.basePoolIdZapDictEthereum = {
|
|
118
|
+
'3pool': "0xA79828DF1850E8a3A3064576f380D90aECDD3359".toLowerCase(),
|
|
119
|
+
sbtc: "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase(),
|
|
120
|
+
ren: "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase(), // TODO CHECK!!!
|
|
124
121
|
};
|
|
125
|
-
exports.
|
|
126
|
-
"
|
|
127
|
-
"
|
|
128
|
-
"0x93054188d876f558f4a66B2EF1d97d16eDf0895B": [8, 8], // ren
|
|
122
|
+
exports.basePoolIdZapDictPolygon = {
|
|
123
|
+
aave: "0x5ab5C56B9db92Ba45a0B46a207286cD83C15C939".toLowerCase(),
|
|
124
|
+
ren: "0xE2e6DC1708337A6e59f227921db08F21e3394723".toLowerCase(),
|
|
129
125
|
};
|
|
130
|
-
exports.
|
|
131
|
-
"
|
|
132
|
-
"
|
|
126
|
+
exports.basePoolIdZapDictAvalanche = {
|
|
127
|
+
aave: "0x001E3BA199B4FF4B5B6e97aCD96daFC0E2e4156e".toLowerCase(),
|
|
128
|
+
ren: "0xEeB3DDBcc4174e0b3fd1C13aD462b95D11Ef42C3".toLowerCase(),
|
|
133
129
|
};
|
|
134
|
-
exports.basePoolAddressZapDictEthereum = {
|
|
135
|
-
"0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7": "0xA79828DF1850E8a3A3064576f380D90aECDD3359".toLowerCase(),
|
|
136
|
-
"0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714": "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase(),
|
|
137
|
-
"0x93054188d876f558f4a66B2EF1d97d16eDf0895B": "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase(), // ren TODO CHECK!!!
|
|
138
|
-
};
|
|
139
|
-
exports.basePoolAddressZapDictPolygon = {
|
|
140
|
-
"0x445FE580eF8d70FF569aB36e80c647af338db351": "0x5ab5C56B9db92Ba45a0B46a207286cD83C15C939".toLowerCase(),
|
|
141
|
-
"0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67": "0xE2e6DC1708337A6e59f227921db08F21e3394723".toLowerCase(), // ren
|
|
142
|
-
};
|
|
143
|
-
exports.blackListPolygon = [
|
|
144
|
-
"0x666dc3b4babfd063faf965bd020024af0dc51b64",
|
|
145
|
-
"0xe4199bc5c5c1f63dba47b56b6db7144c51cf0bf8",
|
|
146
|
-
"0x88c4d6534165510b2e2caf0a130d4f70aa4b6d71",
|
|
147
|
-
];
|
|
148
130
|
exports.WETH_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
|
|
149
131
|
exports.ETH_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
132
|
+
exports.FACTORY_CONSTANTS = {
|
|
133
|
+
1: {
|
|
134
|
+
implementationABIDict: exports.implementationABIDictEthereum,
|
|
135
|
+
implementationBasePoolAddressDict: exports.implementationBasePoolAddressDictEthereum,
|
|
136
|
+
basePoolAddressIdDict: exports.basePoolAddressIdDictEthereum,
|
|
137
|
+
basePoolIdZapDict: exports.basePoolIdZapDictEthereum,
|
|
138
|
+
},
|
|
139
|
+
137: {
|
|
140
|
+
implementationABIDict: exports.implementationABIDictPolygon,
|
|
141
|
+
implementationBasePoolAddressDict: exports.implementationBasePoolAddressDictPolygon,
|
|
142
|
+
basePoolAddressIdDict: exports.basePoolAddressIdDictPolygon,
|
|
143
|
+
basePoolIdZapDict: exports.basePoolIdZapDictPolygon,
|
|
144
|
+
},
|
|
145
|
+
43114: {
|
|
146
|
+
implementationABIDict: exports.implementationABIDictAvalanche,
|
|
147
|
+
implementationBasePoolAddressDict: exports.implementationBasePoolAddressDictAvalanche,
|
|
148
|
+
basePoolAddressIdDict: exports.basePoolAddressIdDictAvalanche,
|
|
149
|
+
basePoolIdZapDict: exports.basePoolIdZapDictAvalanche,
|
|
150
|
+
},
|
|
151
|
+
};
|
|
@@ -55,10 +55,9 @@ var ethcall_1 = require("ethcall");
|
|
|
55
55
|
var gauge_factory_json_1 = __importDefault(require("../constants/abis/gauge_factory.json"));
|
|
56
56
|
var deposit_json_1 = __importDefault(require("../constants/abis/factoryPools/deposit.json"));
|
|
57
57
|
var ERC20_json_1 = __importDefault(require("../constants/abis/ERC20.json"));
|
|
58
|
-
var DepositZapMetaUsdPolygon_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapMetaUsdPolygon.json"));
|
|
59
|
-
var DepositZapMetaBtcPolygon_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapMetaBtcPolygon.json"));
|
|
60
58
|
var factory_crypto_pool_2_json_1 = __importDefault(require("../constants/abis/factory-crypto/factory-crypto-pool-2.json"));
|
|
61
59
|
var constants_1 = require("./constants");
|
|
60
|
+
var common_1 = require("./common");
|
|
62
61
|
function setFactorySwapContracts(rawPoolList, isCrypto) {
|
|
63
62
|
var _this = this;
|
|
64
63
|
if (isCrypto) {
|
|
@@ -71,7 +70,7 @@ function setFactorySwapContracts(rawPoolList, isCrypto) {
|
|
|
71
70
|
});
|
|
72
71
|
}
|
|
73
72
|
else {
|
|
74
|
-
var implementationABIDict_1 = this.chainId
|
|
73
|
+
var implementationABIDict_1 = constants_1.FACTORY_CONSTANTS[this.chainId].implementationABIDict;
|
|
75
74
|
rawPoolList.forEach(function (pool) {
|
|
76
75
|
var addr = pool.address.toLowerCase();
|
|
77
76
|
_this.contracts[addr] = {
|
|
@@ -134,27 +133,6 @@ function setFactoryRewardCoinsContracts(rawPoolList) {
|
|
|
134
133
|
}
|
|
135
134
|
}
|
|
136
135
|
}
|
|
137
|
-
function setFactoryZapContracts() {
|
|
138
|
-
if (this.chainId === 137) {
|
|
139
|
-
var metaUsdZapAddress = "0x5ab5C56B9db92Ba45a0B46a207286cD83C15C939".toLowerCase();
|
|
140
|
-
this.contracts[metaUsdZapAddress] = {
|
|
141
|
-
contract: new ethers_1.Contract(metaUsdZapAddress, DepositZapMetaUsdPolygon_json_1.default, this.signer || this.provider),
|
|
142
|
-
multicallContract: new ethcall_1.Contract(metaUsdZapAddress, DepositZapMetaUsdPolygon_json_1.default),
|
|
143
|
-
};
|
|
144
|
-
var metaBtcZapAddress = "0xE2e6DC1708337A6e59f227921db08F21e3394723".toLowerCase();
|
|
145
|
-
this.contracts[metaBtcZapAddress] = {
|
|
146
|
-
contract: new ethers_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default, this.signer || this.provider),
|
|
147
|
-
multicallContract: new ethcall_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default),
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
var metaSBtcZapAddress = "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase();
|
|
152
|
-
this.contracts[metaSBtcZapAddress] = {
|
|
153
|
-
contract: new ethers_1.Contract(metaSBtcZapAddress, deposit_json_1.default, this.signer || this.provider),
|
|
154
|
-
multicallContract: new ethcall_1.Contract(metaSBtcZapAddress, deposit_json_1.default),
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
136
|
function getFactoryPoolsDataFromApi(isCrypto) {
|
|
159
137
|
return __awaiter(this, void 0, void 0, function () {
|
|
160
138
|
var network, factoryType, url, response, rawPoolList, mainAddresses, FACTORY_POOLS_DATA;
|
|
@@ -162,7 +140,7 @@ function getFactoryPoolsDataFromApi(isCrypto) {
|
|
|
162
140
|
return __generator(this, function (_a) {
|
|
163
141
|
switch (_a.label) {
|
|
164
142
|
case 0:
|
|
165
|
-
network = this.
|
|
143
|
+
network = this.constants.NETWORK_NAME;
|
|
166
144
|
factoryType = isCrypto ? "factory-crypto" : "factory";
|
|
167
145
|
url = "https://api.curve.fi/api/getPools/".concat(network, "/").concat(factoryType);
|
|
168
146
|
return [4 /*yield*/, axios_1.default.get(url)];
|
|
@@ -178,10 +156,9 @@ function getFactoryPoolsDataFromApi(isCrypto) {
|
|
|
178
156
|
setFactoryCoinsContracts.call(this, rawPoolList);
|
|
179
157
|
setFactoryRewardCoinsContracts.call(this, rawPoolList);
|
|
180
158
|
if (!isCrypto)
|
|
181
|
-
setFactoryZapContracts.call(this);
|
|
159
|
+
common_1.setFactoryZapContracts.call(this);
|
|
182
160
|
FACTORY_POOLS_DATA = {};
|
|
183
161
|
rawPoolList.forEach(function (pool) {
|
|
184
|
-
var _a, _b, _c, _d, _e, _f;
|
|
185
162
|
var coinAddresses = pool.coins.map(function (c) { return c.address.toLowerCase(); });
|
|
186
163
|
var coinNames = pool.coins.map(function (c) { return c.symbol; });
|
|
187
164
|
var coinDecimals = pool.coins.map(function (c) { return Number(c.decimals); });
|
|
@@ -205,25 +182,26 @@ function getFactoryPoolsDataFromApi(isCrypto) {
|
|
|
205
182
|
wrapped_coin_addresses: coinAddresses,
|
|
206
183
|
underlying_decimals: coinDecimals,
|
|
207
184
|
wrapped_decimals: coinDecimals,
|
|
208
|
-
reward_tokens: ((_a = pool.gaugeRewards) !== null && _a !== void 0 ? _a : []).map(function (r) { return r.tokenAddress; }),
|
|
209
|
-
reward_decimals: ((_b = pool.gaugeRewards) !== null && _b !== void 0 ? _b : []).map(function (r) { return r.decimals; }),
|
|
210
185
|
swap_abi: factory_crypto_pool_2_json_1.default,
|
|
211
186
|
gauge_abi: gauge_factory_json_1.default,
|
|
212
187
|
};
|
|
213
188
|
}
|
|
214
189
|
else if (pool.implementation.startsWith("meta")) {
|
|
215
|
-
var implementationABIDict = _this.chainId
|
|
216
|
-
var implementationBasePoolAddressDict = _this.chainId
|
|
217
|
-
var
|
|
218
|
-
var
|
|
219
|
-
|
|
220
|
-
var
|
|
221
|
-
|
|
190
|
+
var implementationABIDict = constants_1.FACTORY_CONSTANTS[_this.chainId].implementationABIDict;
|
|
191
|
+
var implementationBasePoolAddressDict = constants_1.FACTORY_CONSTANTS[_this.chainId].implementationBasePoolAddressDict;
|
|
192
|
+
var basePoolAddressIdDict = constants_1.FACTORY_CONSTANTS[_this.chainId].basePoolAddressIdDict; // @ts-ignore
|
|
193
|
+
var basePoolIdCoinsDict = Object.fromEntries(Object.values(basePoolAddressIdDict).map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_coins]; }));
|
|
194
|
+
// @ts-ignore
|
|
195
|
+
var basePoolIdCoinAddressesDict = Object.fromEntries(Object.values(basePoolAddressIdDict).map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_coin_addresses]; }));
|
|
196
|
+
// @ts-ignore
|
|
197
|
+
var basePoolIdDecimalsDict = Object.fromEntries(Object.values(basePoolAddressIdDict).map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_decimals]; }));
|
|
198
|
+
var basePoolIdZapDict = constants_1.FACTORY_CONSTANTS[_this.chainId].basePoolIdZapDict;
|
|
222
199
|
var basePoolAddress = implementationBasePoolAddressDict[pool.implementationAddress];
|
|
223
|
-
var
|
|
224
|
-
var
|
|
225
|
-
var
|
|
226
|
-
var
|
|
200
|
+
var basePoolId = basePoolAddressIdDict[basePoolAddress];
|
|
201
|
+
var basePoolCoinNames = basePoolIdCoinsDict[basePoolId];
|
|
202
|
+
var basePoolCoinAddresses = basePoolIdCoinAddressesDict[basePoolId];
|
|
203
|
+
var basePoolDecimals = basePoolIdDecimalsDict[basePoolId];
|
|
204
|
+
var basePoolZap = basePoolIdZapDict[basePoolId];
|
|
227
205
|
FACTORY_POOLS_DATA[pool.id] = {
|
|
228
206
|
name: pool.name.split(": ")[1].trim(),
|
|
229
207
|
full_name: pool.name,
|
|
@@ -235,22 +213,20 @@ function getFactoryPoolsDataFromApi(isCrypto) {
|
|
|
235
213
|
deposit_address: basePoolZap,
|
|
236
214
|
is_meta: true,
|
|
237
215
|
is_factory: true,
|
|
238
|
-
base_pool:
|
|
216
|
+
base_pool: basePoolId,
|
|
239
217
|
underlying_coins: __spreadArray([coinNames[0]], basePoolCoinNames, true),
|
|
240
218
|
wrapped_coins: coinNames,
|
|
241
219
|
underlying_coin_addresses: __spreadArray([coinAddresses[0]], basePoolCoinAddresses, true),
|
|
242
220
|
wrapped_coin_addresses: coinAddresses,
|
|
243
221
|
underlying_decimals: __spreadArray([coinDecimals[0]], basePoolDecimals, true),
|
|
244
222
|
wrapped_decimals: coinDecimals,
|
|
245
|
-
reward_tokens: ((_c = pool.gaugeRewards) !== null && _c !== void 0 ? _c : []).map(function (r) { return r.tokenAddress; }),
|
|
246
|
-
reward_decimals: ((_d = pool.gaugeRewards) !== null && _d !== void 0 ? _d : []).map(function (r) { return r.decimals; }),
|
|
247
223
|
swap_abi: implementationABIDict[pool.implementationAddress],
|
|
248
224
|
gauge_abi: gauge_factory_json_1.default,
|
|
249
225
|
deposit_abi: deposit_json_1.default,
|
|
250
226
|
};
|
|
251
227
|
}
|
|
252
228
|
else {
|
|
253
|
-
var implementationABIDict = _this.chainId
|
|
229
|
+
var implementationABIDict = constants_1.FACTORY_CONSTANTS[_this.chainId].implementationABIDict;
|
|
254
230
|
FACTORY_POOLS_DATA[pool.id] = {
|
|
255
231
|
name: pool.name.split(": ")[1].trim(),
|
|
256
232
|
full_name: pool.name,
|
|
@@ -267,8 +243,6 @@ function getFactoryPoolsDataFromApi(isCrypto) {
|
|
|
267
243
|
wrapped_coin_addresses: coinAddresses,
|
|
268
244
|
underlying_decimals: coinDecimals,
|
|
269
245
|
wrapped_decimals: coinDecimals,
|
|
270
|
-
reward_tokens: ((_e = pool.gaugeRewards) !== null && _e !== void 0 ? _e : []).map(function (r) { return r.tokenAddress; }),
|
|
271
|
-
reward_decimals: ((_f = pool.gaugeRewards) !== null && _f !== void 0 ? _f : []).map(function (r) { return r.decimals; }),
|
|
272
246
|
swap_abi: implementationABIDict[pool.implementationAddress],
|
|
273
247
|
gauge_abi: gauge_factory_json_1.default,
|
|
274
248
|
};
|
|
@@ -45,7 +45,7 @@ var ethcall_1 = require("ethcall");
|
|
|
45
45
|
var ERC20_json_1 = __importDefault(require("../constants/abis/ERC20.json"));
|
|
46
46
|
var factory_crypto_pool_2_json_1 = __importDefault(require("../constants/abis/factory-crypto/factory-crypto-pool-2.json"));
|
|
47
47
|
var gauge_factory_json_1 = __importDefault(require("../constants/abis/gauge_factory.json"));
|
|
48
|
-
var
|
|
48
|
+
var constants_1 = require("./constants");
|
|
49
49
|
var deepFlatten = function (arr) { return [].concat.apply([], arr.map(function (v) { return (Array.isArray(v) ? deepFlatten(v) : v); })); };
|
|
50
50
|
function getCryptoFactoryIdsAndSwapAddresses() {
|
|
51
51
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -198,7 +198,7 @@ function setCryptoFactoryCoinsContracts(coinAddresses) {
|
|
|
198
198
|
function getCryptoFactoryUnderlyingCoinAddresses(coinAddresses) {
|
|
199
199
|
return __awaiter(this, void 0, void 0, function () {
|
|
200
200
|
return __generator(this, function (_a) {
|
|
201
|
-
return [2 /*return*/, coinAddresses.map(function (coins) { return coins.map(function (c) { return c === WETH_ADDRESS ? "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" : c; }); })];
|
|
201
|
+
return [2 /*return*/, coinAddresses.map(function (coins) { return coins.map(function (c) { return c === constants_1.WETH_ADDRESS ? "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" : c; }); })];
|
|
202
202
|
});
|
|
203
203
|
});
|
|
204
204
|
}
|
|
@@ -220,8 +220,12 @@ function getExistingCoinAddressNameDict() {
|
|
|
220
220
|
var poolData = _a[_i];
|
|
221
221
|
_loop_1(poolData);
|
|
222
222
|
}
|
|
223
|
+
if (this.chainId === 1)
|
|
224
|
+
dict["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"] = "ETH";
|
|
223
225
|
if (this.chainId === 137)
|
|
224
226
|
dict["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"] = "MATIC";
|
|
227
|
+
if (this.chainId === 43114)
|
|
228
|
+
dict["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"] = "AVAX";
|
|
225
229
|
return dict;
|
|
226
230
|
}
|
|
227
231
|
function getCoinAddressNameDict(coinAddresses, existingCoinAddrNameDict) {
|
|
@@ -288,6 +292,7 @@ function getCoinAddressDecimalsDict(coinAddresses, existingCoinAddressDecimalsDi
|
|
|
288
292
|
newCoinAddresses.forEach(function (addr, i) {
|
|
289
293
|
coinAddrNamesDict[addr] = decimals[i];
|
|
290
294
|
});
|
|
295
|
+
coinAddrNamesDict['0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'] = 18;
|
|
291
296
|
return [2 /*return*/, coinAddrNamesDict];
|
|
292
297
|
}
|
|
293
298
|
});
|
|
@@ -324,11 +329,9 @@ function getCryptoFactoryPoolData() {
|
|
|
324
329
|
return [4 /*yield*/, getCoinAddressNameDict.call(this, coinAddresses, existingCoinAddressNameDict)];
|
|
325
330
|
case 7:
|
|
326
331
|
coinAddressNameDict = _c.sent();
|
|
327
|
-
coinAddressNameDict['0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'] = 'ETH';
|
|
328
332
|
return [4 /*yield*/, getCoinAddressDecimalsDict.call(this, coinAddresses, this.constants.DECIMALS)];
|
|
329
333
|
case 8:
|
|
330
334
|
coinAddressDecimalsDict = _c.sent();
|
|
331
|
-
coinAddressDecimalsDict['0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'] = 18;
|
|
332
335
|
CRYPTO_FACTORY_POOLS_DATA = {};
|
|
333
336
|
for (i = 0; i < poolIds.length; i++) {
|
|
334
337
|
CRYPTO_FACTORY_POOLS_DATA[poolIds[i]] = {
|
package/lib/factory/factory.js
CHANGED
|
@@ -52,137 +52,19 @@ exports.getFactoryPoolData = void 0;
|
|
|
52
52
|
var ethers_1 = require("ethers");
|
|
53
53
|
var ethcall_1 = require("ethcall");
|
|
54
54
|
var ERC20_json_1 = __importDefault(require("../constants/abis/ERC20.json"));
|
|
55
|
-
var swap_json_1 = __importDefault(require("../constants/abis/factoryPools/swap.json"));
|
|
56
55
|
var deposit_json_1 = __importDefault(require("../constants/abis/factoryPools/deposit.json"));
|
|
57
56
|
var gauge_factory_json_1 = __importDefault(require("../constants/abis/gauge_factory.json"));
|
|
58
|
-
var
|
|
59
|
-
var
|
|
60
|
-
var
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
var Plain2ETH_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain2ETH.json"));
|
|
69
|
-
var Plain2Optimized_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain2Optimized.json"));
|
|
70
|
-
var Plain3Basic_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain3Basic.json"));
|
|
71
|
-
var Plain3Balances_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain3Balances.json"));
|
|
72
|
-
var Plain3ETH_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain3ETH.json"));
|
|
73
|
-
var Plain3Optimized_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain3Optimized.json"));
|
|
74
|
-
var Plain4Basic_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain4Basic.json"));
|
|
75
|
-
var Plain4Balances_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain4Balances.json"));
|
|
76
|
-
var Plain4ETH_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain4ETH.json"));
|
|
77
|
-
var Plain4Optimized_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain4Optimized.json"));
|
|
78
|
-
var implementationABIDictEthereum = {
|
|
79
|
-
"0x5F890841f657d90E081bAbdB532A05996Af79Fe6": swap_json_1.default,
|
|
80
|
-
"0x213be373FDff327658139C7df330817DAD2d5bBE": MetaUSD_json_1.default,
|
|
81
|
-
"0x55Aa9BF126bCABF0bDC17Fa9E39Ec9239e1ce7A9": MetaUSDBalances_json_1.default,
|
|
82
|
-
"0xC6A8466d128Fbfd34AdA64a9FFFce325D57C9a52": MetaBTC_json_1.default,
|
|
83
|
-
"0xc4C78b08fA0c3d0a312605634461A88184Ecd630": MetaBTCBalances_json_1.default,
|
|
84
|
-
"0xECAaecd9d2193900b424774133B1f51ae0F29d9E": MetaBTCRen_json_1.default,
|
|
85
|
-
"0x40fD58D44cFE63E8517c9Bb3ac98676838Ea56A8": MetaBTCBalancesRen_json_1.default,
|
|
86
|
-
"0x6523Ac15EC152Cb70a334230F6c5d62C5Bd963f1": Plain2Basic_json_1.default,
|
|
87
|
-
"0x24D937143d3F5cF04c72bA112735151A8CAE2262": Plain2Balances_json_1.default,
|
|
88
|
-
"0x6326DEbBAa15bCFE603d831e7D75f4fc10d9B43E": Plain2ETH_json_1.default,
|
|
89
|
-
"0x4A4d7868390EF5CaC51cDA262888f34bD3025C3F": Plain2Optimized_json_1.default,
|
|
90
|
-
"0x9B52F13DF69D79Ec5aAB6D1aCe3157d29B409cC3": Plain3Basic_json_1.default,
|
|
91
|
-
"0x50b085f2e5958C4A87baf93A8AB79F6bec068494": Plain3Balances_json_1.default,
|
|
92
|
-
"0x8c1aB78601c259E1B43F19816923609dC7d7de9B": Plain3ETH_json_1.default,
|
|
93
|
-
"0xE5F4b89E0A16578B3e0e7581327BDb4C712E44De": Plain3Optimized_json_1.default,
|
|
94
|
-
"0x5Bd47eA4494e0F8DE6e3Ca10F1c05F55b72466B8": Plain4Basic_json_1.default,
|
|
95
|
-
"0xd35B58386705CE75CE6d09842E38E9BE9CDe5bF6": Plain4Balances_json_1.default,
|
|
96
|
-
"0x88855cdF2b0A8413D470B86952E726684de915be": Plain4ETH_json_1.default,
|
|
97
|
-
"0xaD4753D045D3Aed5C1a6606dFb6a7D7AD67C1Ad7": Plain4Optimized_json_1.default,
|
|
57
|
+
var common_1 = require("./common");
|
|
58
|
+
var constants_1 = require("./constants");
|
|
59
|
+
var BLACK_LIST = {
|
|
60
|
+
1: [],
|
|
61
|
+
137: [
|
|
62
|
+
"0x666dc3b4babfd063faf965bd020024af0dc51b64",
|
|
63
|
+
"0xe4199bc5c5c1f63dba47b56b6db7144c51cf0bf8",
|
|
64
|
+
"0x88c4d6534165510b2e2caf0a130d4f70aa4b6d71",
|
|
65
|
+
],
|
|
66
|
+
43114: [],
|
|
98
67
|
};
|
|
99
|
-
var implementationABIDictPolygon = {
|
|
100
|
-
"0x4fb93D7d320E8A263F22f62C2059dFC2A8bCbC4c": MetaUSD_json_1.default,
|
|
101
|
-
"0x39fE1824f98CD828050D7c51dA443E84121c7cf1": MetaUSDBalances_json_1.default,
|
|
102
|
-
"0xC05EB760A135d3D0c839f1141423002681157a17": MetaBTCRen_json_1.default,
|
|
103
|
-
"0xD8336532f6ED7b94282fAF724fe41d6145E07Cfc": MetaBTCBalancesRen_json_1.default,
|
|
104
|
-
"0x571FF5b7b346F706aa48d696a9a4a288e9Bb4091": Plain2Basic_json_1.default,
|
|
105
|
-
"0x8925D9d9B4569D737a48499DeF3f67BaA5a144b9": Plain2Balances_json_1.default,
|
|
106
|
-
"0xAe00f57663F4C85FC948B13963cd4627dAF01061": Plain2ETH_json_1.default,
|
|
107
|
-
"0x8101E6760130be2C8Ace79643AB73500571b7162": Plain2Optimized_json_1.default,
|
|
108
|
-
"0x493084cA44C779Af27a416ac1F71e3823BF21b53": Plain3Basic_json_1.default,
|
|
109
|
-
"0x9B4Ed6F8904E976146b3dC0233CD48Cf81835240": Plain3Balances_json_1.default,
|
|
110
|
-
"0xA9134FaE98F92217f457918505375Ae91fdc5e3c": Plain3ETH_json_1.default,
|
|
111
|
-
"0xCC9fd96C26c450Dd4580893afF75efd5cb6C12Fc": Plain3Optimized_json_1.default,
|
|
112
|
-
"0x991b05d5316fa3A2C053F84658b84987cd5c9970": Plain4Basic_json_1.default,
|
|
113
|
-
"0xC7c46488566b9ef9B981b87E328939CaA5ca152f": Plain4Balances_json_1.default,
|
|
114
|
-
"0xf31bcdf0B9a5eCD7AB463eB905551fBc32e51856": Plain4ETH_json_1.default,
|
|
115
|
-
"0xAc273d5b4FC06625d8b1abA3BE8De15bDFb8E39f": Plain4Optimized_json_1.default,
|
|
116
|
-
};
|
|
117
|
-
var basePoolAddressNameDictEthereum = {
|
|
118
|
-
"0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7": "3pool",
|
|
119
|
-
"0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714": "sbtc",
|
|
120
|
-
"0x93054188d876f558f4a66B2EF1d97d16eDf0895B": "ren",
|
|
121
|
-
};
|
|
122
|
-
var basePoolAddressNameDictPolygon = {
|
|
123
|
-
"0x445FE580eF8d70FF569aB36e80c647af338db351": "aave",
|
|
124
|
-
"0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67": "ren",
|
|
125
|
-
};
|
|
126
|
-
var basePoolAddressCoinsDictEthereum = {
|
|
127
|
-
"0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7": ['DAI', 'USDC', 'USDT'],
|
|
128
|
-
"0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714": ['renBTC', 'WBTC', 'sBTC'],
|
|
129
|
-
"0x93054188d876f558f4a66B2EF1d97d16eDf0895B": ['renBTC', 'WBTC'], // ren
|
|
130
|
-
};
|
|
131
|
-
var basePoolAddressCoinsDictPolygon = {
|
|
132
|
-
"0x445FE580eF8d70FF569aB36e80c647af338db351": ['DAI', 'USDC', 'USDT'],
|
|
133
|
-
"0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67": ['WBTC', 'renBTC'], // ren
|
|
134
|
-
};
|
|
135
|
-
var basePoolAddressCoinAddressesDictEthereum = {
|
|
136
|
-
"0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7": [
|
|
137
|
-
'0x6B175474E89094C44Da98b954EedeAC495271d0F',
|
|
138
|
-
'0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
139
|
-
'0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
|
140
|
-
].map(function (addr) { return addr.toLowerCase(); }),
|
|
141
|
-
"0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714": [
|
|
142
|
-
'0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D',
|
|
143
|
-
'0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
|
|
144
|
-
'0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6',
|
|
145
|
-
].map(function (addr) { return addr.toLowerCase(); }),
|
|
146
|
-
"0x93054188d876f558f4a66B2EF1d97d16eDf0895B": [
|
|
147
|
-
'0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D',
|
|
148
|
-
'0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
|
|
149
|
-
].map(function (addr) { return addr.toLowerCase(); }),
|
|
150
|
-
};
|
|
151
|
-
var basePoolAddressCoinAddressesDictPolygon = {
|
|
152
|
-
"0x445FE580eF8d70FF569aB36e80c647af338db351": [
|
|
153
|
-
'0x8f3cf7ad23cd3cadbd9735aff958023239c6a063',
|
|
154
|
-
'0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
|
|
155
|
-
'0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
|
|
156
|
-
].map(function (addr) { return addr.toLowerCase(); }),
|
|
157
|
-
"0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67": [
|
|
158
|
-
'0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6',
|
|
159
|
-
'0xDBf31dF14B66535aF65AaC99C32e9eA844e14501',
|
|
160
|
-
].map(function (addr) { return addr.toLowerCase(); }),
|
|
161
|
-
};
|
|
162
|
-
var basePoolAddressDecimalsDictEthereum = {
|
|
163
|
-
"0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7": [18, 6, 6],
|
|
164
|
-
"0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714": [8, 8, 18],
|
|
165
|
-
"0x93054188d876f558f4a66B2EF1d97d16eDf0895B": [8, 8], // ren
|
|
166
|
-
};
|
|
167
|
-
var basePoolAddressDecimalsDictPolygon = {
|
|
168
|
-
"0x445FE580eF8d70FF569aB36e80c647af338db351": [18, 6, 6],
|
|
169
|
-
"0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67": [8, 8], // ren
|
|
170
|
-
};
|
|
171
|
-
var basePoolAddressZapDictEthereum = {
|
|
172
|
-
"0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7": "0xA79828DF1850E8a3A3064576f380D90aECDD3359".toLowerCase(),
|
|
173
|
-
"0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714": "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase(),
|
|
174
|
-
"0x93054188d876f558f4a66B2EF1d97d16eDf0895B": "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase(), // ren TODO CHECK!!!
|
|
175
|
-
};
|
|
176
|
-
var basePoolAddressZapDictPolygon = {
|
|
177
|
-
"0x445FE580eF8d70FF569aB36e80c647af338db351": "0x5ab5C56B9db92Ba45a0B46a207286cD83C15C939".toLowerCase(),
|
|
178
|
-
"0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67": "0xE2e6DC1708337A6e59f227921db08F21e3394723".toLowerCase(), // ren
|
|
179
|
-
};
|
|
180
|
-
var blackListPolygon = [
|
|
181
|
-
"0x666dc3b4babfd063faf965bd020024af0dc51b64",
|
|
182
|
-
"0xe4199bc5c5c1f63dba47b56b6db7144c51cf0bf8",
|
|
183
|
-
"0x88c4d6534165510b2e2caf0a130d4f70aa4b6d71",
|
|
184
|
-
];
|
|
185
|
-
var blackListEthereum = [];
|
|
186
68
|
var deepFlatten = function (arr) { return [].concat.apply([], arr.map(function (v) { return (Array.isArray(v) ? deepFlatten(v) : v); })); };
|
|
187
69
|
function getFactoryIdsAndSwapAddresses() {
|
|
188
70
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -205,7 +87,7 @@ function getFactoryIdsAndSwapAddresses() {
|
|
|
205
87
|
case 2:
|
|
206
88
|
factories = (_e.sent()).map(function (addr, i) { return ({ id: "factory-v2-".concat(i), address: addr.toLowerCase() }); });
|
|
207
89
|
swapAddresses = Object.values(this.constants.POOLS_DATA).map(function (pool) { return pool.swap_address.toLowerCase(); });
|
|
208
|
-
blacklist = this.chainId
|
|
90
|
+
blacklist = BLACK_LIST[this.chainId];
|
|
209
91
|
factories = factories.filter(function (f) { return !swapAddresses.includes(f.address) && !blacklist.includes(f.address); });
|
|
210
92
|
return [2 /*return*/, [factories.map(function (f) { return f.id; }), factories.map(function (f) { return f.address; })]];
|
|
211
93
|
}
|
|
@@ -218,7 +100,7 @@ function getFactorySwapABIs(factorySwapAddresses) {
|
|
|
218
100
|
return __generator(this, function (_a) {
|
|
219
101
|
switch (_a.label) {
|
|
220
102
|
case 0:
|
|
221
|
-
implementationABIDict = this.chainId
|
|
103
|
+
implementationABIDict = constants_1.FACTORY_CONSTANTS[this.chainId].implementationABIDict;
|
|
222
104
|
return [4 /*yield*/, this.contracts[this.constants.ALIASES.factory].multicallContract];
|
|
223
105
|
case 1:
|
|
224
106
|
factoryMulticallContract = _a.sent();
|
|
@@ -373,8 +255,12 @@ function getExistingCoinAddressNameDict() {
|
|
|
373
255
|
var poolData = _a[_i];
|
|
374
256
|
_loop_1(poolData);
|
|
375
257
|
}
|
|
258
|
+
if (this.chainId === 1)
|
|
259
|
+
dict["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"] = "ETH";
|
|
376
260
|
if (this.chainId === 137)
|
|
377
261
|
dict["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"] = "MATIC";
|
|
262
|
+
if (this.chainId === 43114)
|
|
263
|
+
dict["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"] = "AVAX";
|
|
378
264
|
return dict;
|
|
379
265
|
}
|
|
380
266
|
function getCoinAddressNameDict(coinAddresses, existingCoinAddrNameDict) {
|
|
@@ -438,6 +324,7 @@ function getCoinAddressDecimalsDict(coinAddresses, existingCoinAddressDecimalsDi
|
|
|
438
324
|
newCoinAddresses.forEach(function (addr, i) {
|
|
439
325
|
coinAddrNamesDict[addr] = decimals[i];
|
|
440
326
|
});
|
|
327
|
+
coinAddrNamesDict['0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'] = 18;
|
|
441
328
|
return [2 /*return*/, coinAddrNamesDict];
|
|
442
329
|
}
|
|
443
330
|
});
|
|
@@ -481,30 +368,10 @@ function getFactoryBasePoolAddresses(factorySwapAddresses) {
|
|
|
481
368
|
});
|
|
482
369
|
});
|
|
483
370
|
}
|
|
484
|
-
function setFactoryZapContracts() {
|
|
485
|
-
if (this.chainId === 137) {
|
|
486
|
-
var metaUsdZapAddress = "0x5ab5C56B9db92Ba45a0B46a207286cD83C15C939".toLowerCase();
|
|
487
|
-
this.contracts[metaUsdZapAddress] = {
|
|
488
|
-
contract: new ethers_1.Contract(metaUsdZapAddress, DepositZapMetaUsdPolygon_json_1.default, this.signer || this.provider),
|
|
489
|
-
multicallContract: new ethcall_1.Contract(metaUsdZapAddress, DepositZapMetaUsdPolygon_json_1.default),
|
|
490
|
-
};
|
|
491
|
-
var metaBtcZapAddress = "0xE2e6DC1708337A6e59f227921db08F21e3394723".toLowerCase();
|
|
492
|
-
this.contracts[metaBtcZapAddress] = {
|
|
493
|
-
contract: new ethers_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default, this.signer || this.provider),
|
|
494
|
-
multicallContract: new ethcall_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default),
|
|
495
|
-
};
|
|
496
|
-
}
|
|
497
|
-
else {
|
|
498
|
-
var metaSBtcZapAddress = "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase();
|
|
499
|
-
this.contracts[metaSBtcZapAddress] = {
|
|
500
|
-
contract: new ethers_1.Contract(metaSBtcZapAddress, deposit_json_1.default, this.signer || this.provider),
|
|
501
|
-
multicallContract: new ethcall_1.Contract(metaSBtcZapAddress, deposit_json_1.default),
|
|
502
|
-
};
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
371
|
function getFactoryPoolData() {
|
|
506
372
|
return __awaiter(this, void 0, void 0, function () {
|
|
507
|
-
var _a, poolIds, swapAddresses, swapABIs, gaugeAddresses, _b, poolSymbols, poolNames, referenceAssets, coinAddresses, existingCoinAddressNameDict, coinAddressNameDict, coinAddressDecimalsDict, isMeta, basePoolAddresses,
|
|
373
|
+
var _a, poolIds, swapAddresses, swapABIs, gaugeAddresses, _b, poolSymbols, poolNames, referenceAssets, coinAddresses, existingCoinAddressNameDict, coinAddressNameDict, coinAddressDecimalsDict, isMeta, basePoolAddresses, basePoolAddressIdDict, basePoolIds, basePoolIdCoinsDict, basePoolIdCoinAddressesDict, basePoolIdDecimalsDict, basePoolIdZapDict, FACTORY_POOLS_DATA, i;
|
|
374
|
+
var _this = this;
|
|
508
375
|
return __generator(this, function (_c) {
|
|
509
376
|
switch (_c.label) {
|
|
510
377
|
case 0: return [4 /*yield*/, getFactoryIdsAndSwapAddresses.call(this)];
|
|
@@ -541,12 +408,13 @@ function getFactoryPoolData() {
|
|
|
541
408
|
return [4 /*yield*/, getFactoryBasePoolAddresses.call(this, swapAddresses)];
|
|
542
409
|
case 10:
|
|
543
410
|
basePoolAddresses = _c.sent();
|
|
544
|
-
setFactoryZapContracts.call(this);
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
411
|
+
common_1.setFactoryZapContracts.call(this);
|
|
412
|
+
basePoolAddressIdDict = constants_1.FACTORY_CONSTANTS[this.chainId].basePoolAddressIdDict;
|
|
413
|
+
basePoolIds = basePoolAddresses.map(function (addr) { return basePoolAddressIdDict[addr]; });
|
|
414
|
+
basePoolIdCoinsDict = Object.fromEntries(Object.values(basePoolAddressIdDict).map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_coins]; }));
|
|
415
|
+
basePoolIdCoinAddressesDict = Object.fromEntries(Object.values(basePoolAddressIdDict).map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_coin_addresses]; }));
|
|
416
|
+
basePoolIdDecimalsDict = Object.fromEntries(Object.values(basePoolAddressIdDict).map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_decimals]; }));
|
|
417
|
+
basePoolIdZapDict = constants_1.FACTORY_CONSTANTS[this.chainId].basePoolIdZapDict;
|
|
550
418
|
FACTORY_POOLS_DATA = {};
|
|
551
419
|
for (i = 0; i < poolIds.length; i++) {
|
|
552
420
|
if (!isMeta[i]) {
|
|
@@ -579,15 +447,15 @@ function getFactoryPoolData() {
|
|
|
579
447
|
swap_address: swapAddresses[i],
|
|
580
448
|
token_address: swapAddresses[i],
|
|
581
449
|
gauge_address: gaugeAddresses[i],
|
|
582
|
-
deposit_address:
|
|
450
|
+
deposit_address: basePoolIdZapDict[basePoolIds[i]],
|
|
583
451
|
is_meta: true,
|
|
584
452
|
is_factory: true,
|
|
585
|
-
base_pool:
|
|
586
|
-
underlying_coins: __spreadArray([coinAddressNameDict[coinAddresses[i][0]]],
|
|
453
|
+
base_pool: basePoolIds[i],
|
|
454
|
+
underlying_coins: __spreadArray([coinAddressNameDict[coinAddresses[i][0]]], basePoolIdCoinsDict[basePoolIds[i]], true),
|
|
587
455
|
wrapped_coins: coinAddresses[i].map(function (addr) { return coinAddressNameDict[addr]; }),
|
|
588
|
-
underlying_coin_addresses: coinAddresses[i],
|
|
456
|
+
underlying_coin_addresses: __spreadArray([coinAddresses[i][0]], basePoolIdCoinAddressesDict[basePoolIds[i]], true),
|
|
589
457
|
wrapped_coin_addresses: coinAddresses[i],
|
|
590
|
-
underlying_decimals: __spreadArray([coinAddressDecimalsDict[coinAddresses[i][0]]],
|
|
458
|
+
underlying_decimals: __spreadArray([coinAddressDecimalsDict[coinAddresses[i][0]]], basePoolIdDecimalsDict[basePoolIds[i]], true),
|
|
591
459
|
wrapped_decimals: coinAddresses[i].map(function (addr) { return coinAddressDecimalsDict[addr]; }),
|
|
592
460
|
swap_abi: swapABIs[i],
|
|
593
461
|
gauge_abi: gauge_factory_json_1.default,
|