apply loan origination fee buffer
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
parent
185b077285
commit
5402012064
|
@ -5,6 +5,7 @@ import {
|
||||||
I80F48,
|
I80F48,
|
||||||
I80F48Dto,
|
I80F48Dto,
|
||||||
MAX_I80F48,
|
MAX_I80F48,
|
||||||
|
ONE_I80F48,
|
||||||
ZERO_I80F48,
|
ZERO_I80F48,
|
||||||
} from './I80F48';
|
} from './I80F48';
|
||||||
import { HealthType } from './mangoAccount';
|
import { HealthType } from './mangoAccount';
|
||||||
|
@ -312,7 +313,13 @@ export class HealthCache {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return amount.div(source.oraclePrice);
|
return amount
|
||||||
|
.div(source.oraclePrice)
|
||||||
|
.mul(
|
||||||
|
ONE_I80F48.sub(
|
||||||
|
group.banksMap.get(sourceTokenName).loanOriginationFeeRate,
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -218,9 +218,10 @@ export class MangoAccount {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The amount of given source native token you can swap to a target token considering all existing assets as collateral.
|
* The max amount of given source native token you can swap to a target token.
|
||||||
* note: slippageAndFeesFactor is a normalized number, <1, e.g. a slippage of 5% and some fees which are 1%, then slippageAndFeesFactor = 0.94
|
* note: slippageAndFeesFactor is a normalized number, <1,
|
||||||
* the factor is used to compute how much target can be obtained by swapping source TODO: loan origination fees
|
* e.g. a slippage of 5% and some fees which are 1%, then slippageAndFeesFactor = 0.94
|
||||||
|
* the factor is used to compute how much target can be obtained by swapping source
|
||||||
*/
|
*/
|
||||||
getMaxSourceForTokenSwap(
|
getMaxSourceForTokenSwap(
|
||||||
group: Group,
|
group: Group,
|
||||||
|
|
Loading…
Reference in New Issue