@curvefi/api 2.63.5 → 2.63.7
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/aliases.js +1 -1
- package/lib/pools/PoolTemplate.js +42 -5
- package/lib/router.js +1 -1
- package/package.json +1 -1
package/lib/constants/aliases.js
CHANGED
|
@@ -132,7 +132,7 @@ export const ALIASES_OPTIMISM = lowerCaseValues({
|
|
|
132
132
|
});
|
|
133
133
|
export const ALIASES_XDAI = lowerCaseValues({
|
|
134
134
|
"crv": "0x712b3d230f3c1c19db860d80619288b1f0bdd0bd",
|
|
135
|
-
"child_gauge_factory": "
|
|
135
|
+
"child_gauge_factory": "0x06471ED238306a427241B3eA81352244E77B004F",
|
|
136
136
|
"root_gauge_factory": "0x06471ED238306a427241B3eA81352244E77B004F",
|
|
137
137
|
"child_gauge_factory_old": "0xabC000d88f23Bb45525E447528DBF656A9D55bf5",
|
|
138
138
|
"voting_escrow": "0xefde221f306152971d8e9f181bfe998447975810",
|
|
@@ -1194,11 +1194,31 @@ export class PoolTemplate {
|
|
|
1194
1194
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1195
1195
|
if (this.rewardsOnly())
|
|
1196
1196
|
throw Error(`${this.name} has Rewards-Only Gauge. Use claimRewards instead`);
|
|
1197
|
+
let isOldFactory = false;
|
|
1198
|
+
let contract;
|
|
1199
|
+
if (curve.chainId !== 1) {
|
|
1200
|
+
if (curve.constants.ALIASES.child_gauge_factory_old && curve.constants.ALIASES.child_gauge_factory_old !== curve.constants.ZERO_ADDRESS) {
|
|
1201
|
+
const oldFactoryContract = curve.contracts[curve.constants.ALIASES.child_gauge_factory_old].contract;
|
|
1202
|
+
const gaugeAddress = yield oldFactoryContract.get_gauge_from_lp_token(this.lpToken);
|
|
1203
|
+
isOldFactory = gaugeAddress === this.gauge.address;
|
|
1204
|
+
if (isOldFactory) {
|
|
1205
|
+
contract = oldFactoryContract;
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
if (!isOldFactory) {
|
|
1210
|
+
contract = curve.chainId === 1 ?
|
|
1211
|
+
curve.contracts[curve.constants.ALIASES.minter].contract :
|
|
1212
|
+
curve.contracts[curve.constants.ALIASES.child_gauge_factory].contract;
|
|
1213
|
+
}
|
|
1214
|
+
if (!contract) {
|
|
1215
|
+
throw new Error("Failed to find the correct contract for estimating gas");
|
|
1216
|
+
}
|
|
1197
1217
|
if (curve.chainId === 1) {
|
|
1198
|
-
return Number(yield
|
|
1218
|
+
return Number(yield contract.mint.estimateGas(this.gauge.address, curve.constantOptions));
|
|
1199
1219
|
}
|
|
1200
1220
|
else {
|
|
1201
|
-
return smartNumber(yield
|
|
1221
|
+
return smartNumber(yield contract.mint.estimateGas(this.gauge.address, curve.constantOptions));
|
|
1202
1222
|
}
|
|
1203
1223
|
});
|
|
1204
1224
|
}
|
|
@@ -1206,9 +1226,26 @@ export class PoolTemplate {
|
|
|
1206
1226
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1207
1227
|
if (this.rewardsOnly())
|
|
1208
1228
|
throw Error(`${this.name} has Rewards-Only Gauge. Use claimRewards instead`);
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1229
|
+
let isOldFactory = false;
|
|
1230
|
+
let contract;
|
|
1231
|
+
if (curve.chainId !== 1) {
|
|
1232
|
+
if (curve.constants.ALIASES.child_gauge_factory_old && curve.constants.ALIASES.child_gauge_factory_old !== curve.constants.ZERO_ADDRESS) {
|
|
1233
|
+
const oldFactoryContract = curve.contracts[curve.constants.ALIASES.child_gauge_factory_old].contract;
|
|
1234
|
+
const gaugeAddress = yield oldFactoryContract.get_gauge_from_lp_token(this.lpToken);
|
|
1235
|
+
isOldFactory = gaugeAddress === this.gauge.address;
|
|
1236
|
+
if (isOldFactory) {
|
|
1237
|
+
contract = oldFactoryContract;
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
if (!isOldFactory) {
|
|
1242
|
+
contract = curve.chainId === 1 ?
|
|
1243
|
+
curve.contracts[curve.constants.ALIASES.minter].contract :
|
|
1244
|
+
curve.contracts[curve.constants.ALIASES.child_gauge_factory].contract;
|
|
1245
|
+
}
|
|
1246
|
+
if (!contract) {
|
|
1247
|
+
throw new Error("Failed to find the correct contract for minting");
|
|
1248
|
+
}
|
|
1212
1249
|
yield curve.updateFeeData();
|
|
1213
1250
|
const gasLimit = mulBy1_3(DIGas(yield contract.mint.estimateGas(this.gauge.address, curve.constantOptions)));
|
|
1214
1251
|
return (yield contract.mint(this.gauge.address, Object.assign(Object.assign({}, curve.options), { gasLimit }))).hash;
|
package/lib/router.js
CHANGED
|
@@ -46,7 +46,7 @@ const _buildRouteGraph = memoize(() => __awaiter(void 0, void 0, void 0, functio
|
|
|
46
46
|
return runWorker(routeGraphWorkerCode, routeGraphWorker, Object.assign({ type: 'createRouteGraph' }, input));
|
|
47
47
|
}), {
|
|
48
48
|
promise: true,
|
|
49
|
-
maxAge: 5 * 1000, // 5m
|
|
49
|
+
maxAge: 5 * 60 * 1000, // 5m
|
|
50
50
|
});
|
|
51
51
|
const _findRoutes = (inputCoinAddress, outputCoinAddress) => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
52
|
const routerGraph = yield _buildRouteGraph();
|