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
+7
View File
@@ -87,4 +87,11 @@ export class Token {
this.decimals,
)
}
plusBaseUnits(amount: string): Token {
return new Token(
this.toBigNumber.plus(new BigNumber(amount).multipliedBy(new BigNumber(10).pow(this.decimals))),
this.decimals,
)
}
}