Skip to content

Commit

Permalink
Fixing references and lint errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
danilo-silva-funttastic committed Sep 8, 2023
1 parent 3455980 commit c142655
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/connectors/kujira/kujira.convertors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -540,18 +540,17 @@ export const convertKujiraBalancesToBalances = async (

tokenBalance.inUSD.quotation = quotation;

if ([OrderStatus.OPEN, OrderStatus.PARTIALLY_FILLED].includes(
if (
[OrderStatus.OPEN, OrderStatus.PARTIALLY_FILLED].includes(
getNotNullOrThrowError<OrderStatus>(order.status)
)) {
)
) {
tokenBalance.lockedInOrders = tokenBalance.lockedInOrders.plus(amount);
tokenBalance.inUSD.lockedInOrders =
tokenBalance.inUSD.lockedInOrders.plus(
amount.multipliedBy(quotation)
);
tokenBalance.inUSD.lockedInOrders.plus(amount.multipliedBy(quotation));
} else if (order.status == OrderStatus.FILLED) {
tokenBalance.unsettled = tokenBalance.unsettled.plus(amount);
tokenBalance.inUSD.unsettled =
amount.multipliedBy(quotation);
tokenBalance.inUSD.unsettled = amount.multipliedBy(quotation);
}
}

Expand Down Expand Up @@ -623,10 +622,10 @@ export const convertKujiraSettlementToSettlement = (
const rawAmounts: string[] = [nativeFees];

if (rawBaseTokenFees) {
rawAmounts.push(rawBaseTokenFees)
rawAmounts.push(rawBaseTokenFees);
}
if (rawQuoteTokenFees) {
rawAmounts.push(rawQuoteTokenFees)
rawAmounts.push(rawQuoteTokenFees);
}

const tokenWithdraw = IMap<TokenId, Withdraw>().asMutable();
Expand Down
5 changes: 5 additions & 0 deletions test/connectors/kujira/kujira.routes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2266,6 +2266,7 @@ describe('Kujira', () => {
userBalances.tokens.get(targetOrder.market.quoteToken.id)?.total
),
inUSD: {
quotation: BigNumber(0),
free: getNotNullOrThrowError<any>(
userBalances.tokens.get(targetOrder.market.quoteToken.id)
)?.free,
Expand Down Expand Up @@ -2455,6 +2456,7 @@ describe('Kujira', () => {
userBalances.tokens.get(targetOrder.market.baseToken.id)?.total
),
inUSD: {
quotation: BigNumber(0),
free: getNotNullOrThrowError<any>(
userBalances.tokens.get(targetOrder.market.baseToken.id)?.inUSD.free
),
Expand Down Expand Up @@ -2507,6 +2509,7 @@ describe('Kujira', () => {
userBalances.tokens.get(targetOrder.market.quoteToken.id)?.total
),
inUSD: {
quotation: BigNumber(0),
free: getNotNullOrThrowError<any>(
userBalances.tokens.get(targetOrder.market.quoteToken.id)
)?.free,
Expand Down Expand Up @@ -2677,6 +2680,7 @@ describe('Kujira', () => {
userBalances.tokens.get(primaryTargetOrder.market.baseToken.id)?.total
),
inUSD: {
quotation: BigNumber(0),
free: getNotNullOrThrowError<any>(
userBalances.tokens.get(primaryTargetOrder.market.baseToken.id)
?.inUSD.free
Expand Down Expand Up @@ -2729,6 +2733,7 @@ describe('Kujira', () => {
?.total
),
inUSD: {
quotation: BigNumber(0),
free: getNotNullOrThrowError<any>(
userBalances.tokens.get(primaryTargetOrder.market.quoteToken.id)
)?.free,
Expand Down

0 comments on commit c142655

Please sign in to comment.