Skip to content

Commit

Permalink
fix: required deposit fix when available storage is higher than needed (
Browse files Browse the repository at this point in the history
#40)

* fix: required deposit fix when available storage is higher than needed

* chore: fixed lint error
  • Loading branch information
jaswinder6991 authored Jul 30, 2024
1 parent 4973ce1 commit 99f9e8d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ describe('calculateRequiredDeposit()', () => {
data,
storageBalance: {
available: BigInt(storageCostOfData.plus('1').toFixed()),
total: BigInt(storageCostOfData.minus('1').toFixed()),
total: BigInt(storageCostOfData.plus('10').toFixed()),
},
});

// assert
expect(result.toFixed()).toBe('1');
expect(result.toFixed()).toBe('0');
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import BigNumber from 'bignumber.js';
// constants
import {
MINIMUM_STORAGE_IN_BYTES,
ONE_YOCTO,
STORAGE_COST_PER_BYTES_IN_ATOMIC_UNITS,
} from '@app/constants';
import { EXTRA_STORAGE_BALANCE } from './constants';
Expand Down Expand Up @@ -48,5 +47,5 @@ export default function calculateRequiredDeposit({
// if the storage deposit available is less than the cost of storage, use the difference as the required deposit
return storageDepositAvailable.lt(storageCostOfData)
? storageCostOfData.minus(storageDepositAvailable)
: new BigNumber(ONE_YOCTO);
: new BigNumber('0');
}

0 comments on commit 99f9e8d

Please sign in to comment.