@@ -1409,11 +1409,11 @@ assets.forEach(function (a) {
1409
1409
if ( _amount > 0n && fromUtilization <= utilization && utilization < toUtilization ) {
1410
1410
const fromPercent = await feeFunc . fromPercent ( ) ;
1411
1411
const toPercent = await feeFunc . toPercent ( ) ;
1412
- const upperBound = ( toUtilization * BigInt ( 1e8 ) ) / MAX_PERCENT ;
1412
+ const upperBound = ( toUtilization * targetCapacity ) / MAX_PERCENT ;
1413
1413
const replenished = upperBound > flashCapacity + _amount ? _amount : upperBound - flashCapacity ;
1414
1414
const slope = ( ( toPercent - fromPercent ) * MAX_PERCENT ) / ( toUtilization - fromUtilization ) ;
1415
1415
const bonusPercent =
1416
- fromPercent + ( slope * ( flashCapacity + replenished / 2n ) ) / BigInt ( 1e8 ) ;
1416
+ fromPercent + ( slope * ( flashCapacity + replenished / 2n ) ) / targetCapacity ;
1417
1417
const bonus = ( replenished * bonusPercent ) / MAX_PERCENT ;
1418
1418
console . log ( `Replenished:\t\t\t${ replenished . format ( ) } ` ) ;
1419
1419
console . log ( `Bonus percent:\t\t\t${ bonusPercent . format ( ) } ` ) ;
@@ -1621,11 +1621,11 @@ assets.forEach(function (a) {
1621
1621
console . log ( `Utilization:\t\t\t${ utilization . format ( ) } ` ) ;
1622
1622
const fromPercent = await feeFunc . fromPercent ( ) ;
1623
1623
const toPercent = await feeFunc . toPercent ( ) ;
1624
- const lowerBound = ( fromUtilization * BigInt ( 1e8 ) ) / MAX_PERCENT ;
1624
+ const lowerBound = ( fromUtilization * targetCapacity ) / MAX_PERCENT ;
1625
1625
const replenished = lowerBound > flashCapacity - _amount ? flashCapacity - lowerBound : _amount ;
1626
1626
const slope = ( ( toPercent - fromPercent ) * MAX_PERCENT ) / ( toUtilization - fromUtilization ) ;
1627
1627
const withdrawFeePercent =
1628
- fromPercent + ( slope * ( flashCapacity - replenished / 2n ) ) / BigInt ( 1e8 ) ;
1628
+ fromPercent + ( slope * ( flashCapacity - replenished / 2n ) ) / targetCapacity ;
1629
1629
const fee = ( replenished * withdrawFeePercent ) / MAX_PERCENT ;
1630
1630
console . log ( `Replenished:\t\t\t${ replenished . format ( ) } ` ) ;
1631
1631
console . log ( `Fee percent:\t\t\t${ withdrawFeePercent . format ( ) } ` ) ;
0 commit comments