Last active
May 15, 2021 11:40
-
-
Save misu200/373848b5be108da235670d49c6b7cefe to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
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
| // Available variables: | |
| // - Machine | |
| // - interpret | |
| // - assign | |
| // - send | |
| // - sendParent | |
| // - spawn | |
| // - raise | |
| // - actions | |
| // - XState (all XState exports) | |
| const fetchMachine = Machine({ | |
| id: 'fetch', | |
| initial: 'idle', | |
| context: { | |
| retries: 0 | |
| }, | |
| states: { | |
| idle: { | |
| on: { | |
| BUY_TOKEN: 'buy_token_in_pending' | |
| } | |
| }, | |
| buy_token_in_pending: { | |
| on: { | |
| MINED: 'trading', | |
| FAILED: 'failure' | |
| } | |
| }, | |
| trading:{ | |
| on:{ | |
| "ENEMY_SELL_TOKEN_PENDING":'trading', | |
| "ENEMY_SELL_TOKEN_MINED":'trading', | |
| "ENEMY_BUY_TOKEN_PENDING":'trading', | |
| "ENEMY_BUY_TOKEN_MINED":'trading', | |
| "REMOVE_LIQUIDITY_PENDING":'trading', | |
| "REMOVE_LIQUIDITY_MINED":'trading', | |
| "FRONTENDING_ENEMY_TOKEN_SELL":'trading', | |
| "FRONTENDING_ENEMY_REMOVE_LIQUIDITY":'trading', | |
| "GAS_WAR_MY_SELL":'trading', | |
| "MY_SELL_MINED":'compute_profit_or_loss' | |
| } | |
| }, | |
| compute_profit_or_loss:{ | |
| on:{ | |
| HAVE_PROFIT:'success', | |
| HAVE_LOSS:'failure' | |
| } | |
| }, | |
| success: { | |
| type: 'final' | |
| }, | |
| failure: { | |
| } | |
| } | |
| }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment