refactor limit_order to move out limit_order_txs logic #8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why this should be merged
I have moved out limit order transaction related logic in a separate file.
I was working on writing tests for limit_order.go.
For example in testing RunMatchingEngine() when we find matching limit_orders it makes a call to orderBookContract to execute those orders. The tests then need the correct setup for making those transaction including creating those accounts and adding gas.
We want to test only if the matching logic is working as we can test the code for making orderbook contract call separately. Here i can now start using mocks and check if the correct calls are being when matching orders are found and are not being made when no limit orders match.
Similarly for parsing blocks and storing limit_orders we can test each getting blocks and parsing it separately.
This will help me write better unit tests.
If we also want to add integration tests which test whole flow(we have one in OrderBook.ts) we can add those also separately.
How this works
How this was tested
It was tested using integration test in orderbook.ts.