Skip to content

Commit

Permalink
fix(shell): use bigint to calculate vesting periods amount correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
olegshilov committed Oct 7, 2023
1 parent 7edbefa commit e0766eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ function CreateVestingAccountForm() {
placeholder="Deposit amount in ISLM"
value={amount.toString()}
onChange={(value) => {
const nextValue = !Number.isNaN(Number.parseInt(value))
? Number.parseInt(value)
const nextValue = !Number.isNaN(Number.parseFloat(value))
? Number.parseFloat(value)
: 0;
setAmount(nextValue);
}}
Expand Down Expand Up @@ -488,7 +488,7 @@ function Input({
required
id={id}
name={id}
value={value}
defaultValue={value}
onChange={(event) => {
onChange(event.currentTarget.value);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ export function useVestingActions() {
const periods = vestingInDays;
const denom = 'aISLM';
const lockupPeriods = [];
let restAmount = amount;
let unlockAmount = Math.floor(amount / periods);
const aislmAmount = BigInt(amount * 10 ** 18);
let restAmount = aislmAmount;
let unlockAmount = aislmAmount / BigInt(periods);
let length: number = cliff;

for (let i = 0; i < periods; i++) {
Expand All @@ -91,7 +92,7 @@ export function useVestingActions() {

const unlockCoins = {
denom: denom,
amount: BigInt(unlockAmount * 10 ** 18).toString(),
amount: unlockAmount.toString(),
};

const period = {
Expand Down

0 comments on commit e0766eb

Please sign in to comment.