fix: always consider user input when performing swap (#572)

* fix: always consider user input when performing swap

* refactor: extract decimal places constants

* refactor: extract minimumOptimalValue

* fix: handle bzz precision and tweak message
This commit is contained in:
Cafe137
2022-11-09 14:21:34 +01:00
committed by GitHub
parent a4b8e7ca25
commit ec8fdf0315
5 changed files with 98 additions and 47 deletions
+8 -2
View File
@@ -1,8 +1,14 @@
import { BigNumber } from 'bignumber.js'
import { Token } from './Token'
export const BZZ_DECIMAL_PLACES = 16
export class BzzToken extends Token {
constructor(amount: BigNumber | string | bigint) {
super(amount, 16)
constructor(value: BigNumber | string | bigint) {
super(value, BZZ_DECIMAL_PLACES)
}
static fromDecimal(value: BigNumber | string | bigint): BzzToken {
return Token.fromDecimal(value, BZZ_DECIMAL_PLACES)
}
}