@@ -23,6 +23,7 @@ import { _getUserCollateral } from "../external-api.js";
23
23
24
24
export class LlammaTemplate {
25
25
id : string ;
26
+ isNewMarket : boolean ;
26
27
address : string ;
27
28
controller : string ;
28
29
monetaryPolicy : string ;
@@ -120,6 +121,7 @@ export class LlammaTemplate {
120
121
const llammaData = crvusd . constants . LLAMMAS [ id ] ;
121
122
122
123
this . id = id ;
124
+ this . isNewMarket = llammaData . isNewMarket || false ;
123
125
this . address = llammaData . amm_address ;
124
126
this . controller = llammaData . controller_address ;
125
127
this . monetaryPolicy = llammaData . monetary_policy_address ;
@@ -1058,12 +1060,12 @@ export class LlammaTemplate {
1058
1060
const [ _ , n1 ] = await this . userBands ( address ) ;
1059
1061
const { stablecoin } = await this . userState ( address ) ;
1060
1062
const n = ( BN ( stablecoin ) . gt ( 0 ) ) ? MAX_ACTIVE_BAND : n1 - 1 ; // In liquidation mode it doesn't matter if active band moves
1061
- const gas = await contract . estimateGas . repay ( _debt , address , n , isEth ( this . collateral ) , crvusd . constantOptions ) ;
1063
+ const gas = this . isNewMarket ? await contract . estimateGas . repay ( _debt , address , n , crvusd . constantOptions ) : await contract . estimateGas . repay ( _debt , address , n , isEth ( this . collateral ) , crvusd . constantOptions ) ;
1062
1064
if ( estimateGas ) return gas . toNumber ( ) ;
1063
1065
1064
1066
await crvusd . updateFeeData ( ) ;
1065
1067
const gasLimit = gas . mul ( 130 ) . div ( 100 ) ;
1066
- return ( await contract . repay ( _debt , address , n , isEth ( this . collateral ) , { ...crvusd . options , gasLimit } ) ) . hash
1068
+ return ( this . isNewMarket ? await contract . repay ( _debt , address , n , { ... crvusd . options , gasLimit } ) : await contract . repay ( _debt , address , n , isEth ( this . collateral ) , { ...crvusd . options , gasLimit } ) ) . hash
1067
1069
}
1068
1070
1069
1071
public async repayEstimateGas ( debt : number | string , address = "" ) : Promise < number > {
0 commit comments