Increase iterations for max swap to fix some edge case, fix debug script since fees are already accounted for
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
parent
566a369ffc
commit
f7e6d6469f
|
@ -111,22 +111,19 @@ async function debugUser(
|
|||
console.log(`Error for ${src}->${tgt}, ` + error.toString());
|
||||
}
|
||||
|
||||
const maxSourceWoFees =
|
||||
-maxSourceUi *
|
||||
(1 + group.banksMapByName.get(src)![0].loanOriginationFeeRate.toNumber());
|
||||
const maxTargetWoFees =
|
||||
-maxSourceWoFees *
|
||||
const maxTargetUi =
|
||||
maxSourceUi *
|
||||
(group.banksMapByName.get(src)![0].uiPrice /
|
||||
group.banksMapByName.get(tgt)![0].uiPrice);
|
||||
|
||||
const sim = mangoAccount.simHealthRatioWithTokenPositionUiChanges(group, [
|
||||
{
|
||||
mintPk: group.banksMapByName.get(src)![0].mint,
|
||||
uiTokenAmount: maxSourceWoFees,
|
||||
uiTokenAmount: -maxSourceUi,
|
||||
},
|
||||
{
|
||||
mintPk: group.banksMapByName.get(tgt)![0].mint,
|
||||
uiTokenAmount: maxTargetWoFees,
|
||||
uiTokenAmount: maxTargetUi,
|
||||
},
|
||||
]);
|
||||
console.log(
|
||||
|
|
|
@ -559,7 +559,7 @@ export class HealthCache {
|
|||
target: I80F48,
|
||||
fun: (amount: I80F48) => I80F48,
|
||||
): I80F48 {
|
||||
const maxIterations = 20;
|
||||
const maxIterations = 50;
|
||||
let current = start;
|
||||
// console.log(`scanRightUntilLessThan, start ${start.toLocaleString()}`);
|
||||
for (const key of Array(maxIterations).fill(0).keys()) {
|
||||
|
|
Loading…
Reference in New Issue