ts: remove debug code

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2022-09-27 17:33:51 +02:00
parent b57e50c75b
commit 8d86883190
3 changed files with 6 additions and 20 deletions

View File

@ -46,22 +46,6 @@ export class HealthCache {
) {}
static fromDto(dto) {
// console.log(
JSON.stringify(
dto,
function replacer(k, v) {
// console.log(k);
console.log(v);
// if (v instanceof BN) {
// console.log(v);
// return new I80F48(v).toNumber();
// }
// return v;
},
2,
),
// );
process.exit(0);
return new HealthCache(
dto.tokenInfos.map((dto) => TokenInfo.fromDto(dto)),
dto.serum3Infos.map((dto) => Serum3Info.fromDto(dto)),
@ -173,7 +157,7 @@ export class HealthCache {
}
}
if (liabs.gt(I80F48.fromNumber(0.001))) {
if (liabs.gt(I80F48.fromNumber(0.001))) {
return HUNDRED_I80F48().mul(assets.sub(liabs).div(liabs));
} else {
return MAX_I80F48();

View File

@ -286,8 +286,10 @@ export class MangoAccount {
* PNL is defined here as spot value + serum3 open orders value + perp value - net deposits value (evaluated at native quote price at the time of the deposit/withdraw)
* spot value + serum3 open orders value + perp value is returned by getEquity (open orders values are added to spot token values implicitly)
*/
getPnl(): I80F48 | undefined {
return this.getEquity()?.add((I80F48.fromI64(this.netDeposits)).mul(I80F48.fromNumber(-1)))
getPnl(): I80F48 | undefined {
return this.getEquity()?.add(
I80F48.fromI64(this.netDeposits).mul(I80F48.fromNumber(-1)),
);
}
/**

View File

@ -616,7 +616,7 @@ export class MangoClient {
await this.program.account.mangoAccount.fetch(mangoAccountPk),
);
}
public async getMangoAccountWithSlot(mangoAccountPk: PublicKey) {
const resp =
await this.program.provider.connection.getAccountInfoAndContext(