Skip to content

Commit 8a630e8

Browse files
authored
Merge pull request #37 from curvefi/fix/fixed-gasLimit
Fix/fixed gas limit
2 parents c14abc5 + 3093188 commit 8a630e8

File tree

3 files changed

+5
-13
lines changed

3 files changed

+5
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@curvefi/stablecoin-api",
3-
"version": "1.5.15",
3+
"version": "1.5.16",
44
"description": "JavaScript library for Curve Stablecoin",
55
"main": "lib/index.js",
66
"author": "Macket",

src/constants/abis/controller_v2.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,6 @@
425425
{
426426
"name": "collateral",
427427
"type": "uint256"
428-
},
429-
{
430-
"name": "use_eth",
431-
"type": "bool"
432428
}
433429
],
434430
"name": "remove_collateral",
@@ -531,10 +527,6 @@
531527
"name": "min_x",
532528
"type": "uint256"
533529
},
534-
{
535-
"name": "use_eth",
536-
"type": "bool"
537-
}
538530
],
539531
"name": "liquidate",
540532
"outputs": [],

src/llammas/LlammaTemplate.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -985,12 +985,12 @@ export class LlammaTemplate {
985985

986986
const _collateral = parseUnits(collateral, this.collateralDecimals);
987987
const contract = crvusd.contracts[this.controller].contract;
988-
const gas = await contract.estimateGas.remove_collateral(_collateral, isEth(this.collateral), crvusd.constantOptions);
988+
const gas = this.isNewMarket ? await contract.estimateGas.remove_collateral(_collateral, crvusd.constantOptions) : await contract.estimateGas.remove_collateral(_collateral, isEth(this.collateral), crvusd.constantOptions);
989989
if (estimateGas) return gas.toNumber();
990990

991991
await crvusd.updateFeeData();
992992
const gasLimit = gas.mul(130).div(100);
993-
return (await contract.remove_collateral(_collateral, isEth(this.collateral), { ...crvusd.options, gasLimit })).hash
993+
return (this.isNewMarket ? await contract.remove_collateral(_collateral, { ...crvusd.options, gasLimit }) : await contract.remove_collateral(_collateral, isEth(this.collateral), { ...crvusd.options, gasLimit })).hash
994994
}
995995

996996
public async removeCollateralEstimateGas(collateral: number | string): Promise<number> {
@@ -1264,12 +1264,12 @@ export class LlammaTemplate {
12641264
const minAmountBN: BigNumber = BN(stablecoin).times(100 - slippage).div(100);
12651265
const _minAmount = fromBN(minAmountBN);
12661266
const contract = crvusd.contracts[this.controller].contract;
1267-
const gas = (await contract.estimateGas.liquidate(address, _minAmount, isEth(this.collateral), crvusd.constantOptions))
1267+
const gas = this.isNewMarket ? (await contract.estimateGas.liquidate(address, _minAmount, crvusd.constantOptions)) : (await contract.estimateGas.liquidate(address, _minAmount, isEth(this.collateral), crvusd.constantOptions))
12681268
if (estimateGas) return gas.toNumber();
12691269

12701270
await crvusd.updateFeeData();
12711271
const gasLimit = gas.mul(130).div(100);
1272-
return (await contract.liquidate(address, _minAmount, isEth(this.collateral), { ...crvusd.options, gasLimit })).hash
1272+
return (this.isNewMarket ? await contract.liquidate(address, _minAmount, { ...crvusd.options, gasLimit }) : await contract.liquidate(address, _minAmount, isEth(this.collateral), { ...crvusd.options, gasLimit })).hash
12731273
}
12741274

12751275
public async liquidateEstimateGas(address: string, slippage = 0.1): Promise<number> {

0 commit comments

Comments
 (0)