Skip to content

Commit

Permalink
mul by magnitude beforehand
Browse files Browse the repository at this point in the history
  • Loading branch information
Wozacosta committed Sep 4, 2024
1 parent dd2c8b3 commit 2212e77
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion apps/ledger-live-mobile/e2e/specs/delegate/cosmos.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from "../../models/currencies";
import { Application } from "../../page";
import DeviceAction from "../../models/DeviceAction";
import BigNumber from "bignumber.js";

let app: Application;
let deviceAction: DeviceAction;
Expand Down Expand Up @@ -36,8 +37,15 @@ describe("Cosmos delegate flow", () => {
const delegatedPercent = 50;
const unit = getAccountUnit(testAccount);

const multiplier = new BigNumber(10).pow(unit.magnitude);
const usableAmount = testAccount.spendableBalance.minus(COSMOS_MIN_SAFE).minus(COSMOS_MIN_FEES);
const delegatedAmount = usableAmount.multipliedBy(delegatedPercent).div(100).integerValue();
// const delegatedAmount = usableAmount.multipliedBy(delegatedPercent).div(100).integerValue();
const delegatedAmount = usableAmount
.multipliedBy(multiplier)
.multipliedBy(delegatedPercent)
.div(100)
.div(multiplier)
.integerValue();
const remainingAmount = usableAmount.minus(delegatedAmount);

await app.stake.selectCurrency(testedCurrency);
Expand Down

0 comments on commit 2212e77

Please sign in to comment.