This repository has been archived by the owner on Jan 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of github.com:gnosis/dex-react into walletconn…
…ect_update
- Loading branch information
Showing
51 changed files
with
1,691 additions
and
1,007 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
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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { logDebug } from 'utils' | ||
|
||
// 0.1 Gwei, reasonable gasPrice that would still allow flags replacement | ||
export const MIN_GAS_PRICE = (1e8).toString(10) | ||
|
||
export const earmarkGasPrice = (gasPrice: string, userPrint: string): string => { | ||
if (!userPrint) return gasPrice | ||
|
||
// don't replace 8000 -> 1201, only if most significant digit is untouched | ||
// 80000 -> 81201 | ||
if (userPrint.length >= gasPrice.length) { | ||
// if flags still don't fit even in MIN_GAS_PRICE | ||
if (userPrint.length >= MIN_GAS_PRICE.length) return gasPrice | ||
gasPrice = MIN_GAS_PRICE | ||
} | ||
|
||
const markedGasPrice = gasPrice.slice(0, -userPrint.length) + userPrint | ||
|
||
logDebug('Gas price', gasPrice, '->', markedGasPrice) | ||
return markedGasPrice | ||
} | ||
|
||
// simple concatenation, with '0x' for empty data to have `0x<userPrint>` at the least | ||
export const earmarkTxData = (data = '0x', userPrint: string): string => data + userPrint |
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
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
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
Oops, something went wrong.