Created
October 4, 2017 09:05
-
-
Save gkucmierz/36a12647af6c2535453053018e76ebbc to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| const walletBalanceChanged = balance => { | |
| const GAS_PRICE = 1e10; | |
| const TX_GAS = 40e3; | |
| const TX_PRICE = GAS_PRICE * TX_GAS; | |
| let txsNum = balance / TX_PRICE; | |
| const txsLvls = [2, 10, 20]; | |
| if (txsNum <= 2) { | |
| return { action: 'contractWithdraw', amount: txsLvls[1] * TX_PRICE - balance }; | |
| } | |
| if (20 < txsNum) { | |
| return { action: 'contractDeposit', amount: balance - txsLvls[1] * TX_PRICE }; | |
| } | |
| return { action: null }; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment