-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
5 changed files
with
96 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
import { BigNumber } from 'bignumber.js' | ||
import { Token } from './Token' | ||
|
||
const DAI_DECIMAL_PLACES = 18 | ||
|
||
export class DaiToken extends Token { | ||
constructor(amount: BigNumber | string | bigint) { | ||
super(amount, 18) | ||
constructor(value: BigNumber | string | bigint) { | ||
super(value, DAI_DECIMAL_PLACES) | ||
} | ||
|
||
static fromDecimal(value: BigNumber | string | bigint): DaiToken { | ||
return Token.fromDecimal(value, DAI_DECIMAL_PLACES) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters