forked from ava-labs/subnet-evm
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The Rise of the Hubblenet #61
Draft
atvanguard
wants to merge
191
commits into
master
Choose a base branch
from
main
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
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
* place and save order onchain * execute matched orders * changes based on PR comments
* Send a sample tx when a tx is received It goes into an infinite loop right now * add limit order processor * Add ABI parser * Remove hardcoded ABI * Order book (#1) * place and save order onchain * execute matched orders * changes based on PR comments * Make contarct call to OrderBook * add limit_order database layer to store and get limit_orders from sqlite database * Fix contract calls to OrderBook * Insert orders in sqlite database Read transactions and insert/update orders in database * Fix db tests * fix tests * check for price equality in GetLimitOrderByPositionTypeAndPrice method * return status in limit_orders in GetLimitOrder method * add test for updatelimit order status method * Add new run script * Review changes * Execute orders after block production * Store orders in memory and send tx at buildBlock * return if len of transaction input data is less than 4 fields * fix tests * change public methods to private and use them * add test for limit_order * add test for NewLimitOrderProcessor * minor refactoring Co-authored-by: vipul sharma <[email protected]> Co-authored-by: asquare <[email protected]>
* orderbook as genesis * reduce blocktime and clean tests * fix tests Co-authored-by: Atul Agarwal <[email protected]>
* add tests for memory_database * add GetOrdersByPriceAndPositionType method * remove execute test order and add logic for matching limit orders and making contract call * refactoring limit_order private methods * add OrderMatched event in orderbook contract and test event generation * log error is baseAssetQuantity is zero, add method for position type * break matching limit order loop if matching order is found * Use contract address instead of ABI for parseTx * Use ChainAcceptedEvent instead of NewHeadEvent * fix syntax error * refactor memory_database and remove matching logic from limit_order * add limit order matching engine and call it during buildblock * add purge local tx before running matching logic * minor fixes * check executeMatchedOrder tx status before deleting limit orders * delete pending executeMatchedOrders txs before running matching engine Co-authored-by: Shubham Goyal <[email protected]>
… limit_order dependencies in vm.go
…oreLimitOrderTransactions
* add filledBaseAssetQuantity in limit order * fix tests * add test for RunMatchingEngine * pull changes from hubble-v2 * remove sqlite database files * add LimitOrderDatabase interface and implement in inMemoryDatabase * deven|fdgod create LimitOrderTxProcessor interface * deven|fdgod add tests for limit_order and mocks for LimitOrderDatabase and LimitOrderTxProcessor * add tests for RunMatchingLogic in limit_order * fix previous tests * change memory_database to return object instead of pointer to limit_orders stored in memory_database * change matching logic to partial match limit orders with different BaseAssetQuantity * change ExecuteMatchedOrdersTx as per new contract * delete order if filledBaseAssetQuantity is equal to BaseAssetQuantity * update filledBaseAssetQuantity after parsing executeMatchedOrders * return LimitOrder instead of pointer in its memory_database * add test for GetOrder * return InMemoryDatabase from NewInMemoryDatabase and remove GetOrder function * remove GetOrder method from mocks * change salt to int64 * convert fillAmount to uint * add parsing logic for two orders in function input and output * pass orders with type Order to executeMatchedOrders tx * change logic of skipping already filled orders in RunMatchingEngine method in limit_order * refactor code
#13) * change price check in matching engine to match if longOrder price >= shortOrder price * more aggresive assertions * Add tests for getUnFilledBaseAssetQuantity * refactor TestGetUnfilledBaseAssetQuantity * refactor RunMatchingEngine in limit_order and add tests Co-authored-by: atvanguard <[email protected]>
* add genesis contracts * update orderbook.sol * update comments * precision
* funding skeleton * Handle events and add liquidation logic * Fix merge errors * minor fixes * Ignore orders matched during liquidation for matching * add tests for UpdateMargin, UpdatePosition, UpdateUnrealisedFunding method in memory_database * check for presence of positions for address in ResetUnrealisedFunding and add tests * fix tests * add lastPrice when db initialized and add tests * Liquidation and UnrealisedFunding fixes * Review changes * Use big.Int everywhere * add functions specified in LimitOrderTxProcessor interface * fix liquidations compare marginFraction logic * check if position nil in UpdateUnrealisedFunding and fix tests * Add missing file * Fetch all logs at once * Add missing file * fix: Change multiplication factor * purge liquidateAndExecuteOrder and settleFunding tx * Fix precision handling * refactor liquidations and add tests * Review fixes * fix tests * Fix incorrect amounts in runLiquidations * Fix errors after merge * fix tests * fix tests * add genesis contracts + mocked orderBook (#14) * add genesis contracts * update orderbook.sol * update comments * precision * Review fixes * Handle OrderCancelled * Pass notionalPosition in function * fix tests * Review fixes * Change IsFundingPaymentTime Co-authored-by: Shubham Goyal <[email protected]> Co-authored-by: fdgod <[email protected]>
expose api which return all database data
* move liquidations from database and change GetLiquidations into a standalone pure function, fix tests * move out contract events processor from limit_order_tx_processor and add tests
* Delete expired signed orders and virtual reserved margin * cache time.Now and Abs(baseAssetQ) when reserving margin * add SampleImpactPrice unit tests * Bugfixes from testing * Fix virtual reserved margin bug * Remove handling for short orders --------- Co-authored-by: atvanguard <[email protected]>
* remove order specific methods from jurorv2 * dynamically fetch signedOrderBookAddress * upgrade ts * set empty orderhash * misc * remove logs * misc * handle new trader
* Use gob encoding for gossiping orders instead of rlp * Fix snapshot loading * Fix nil VirtualReserved error * Allow gossiping to non validators
* cancel stale reduce only orders * review comments
* instantiate hState once * misc
* Update avalanchego version in local scripts * Update subnet config to allow gossiping to non-validators * Add more tests for jurorv2 precompile * Change versions for mainnet * jurorv2 activation time * rename deprecated apis --------- Co-authored-by: atvanguard <[email protected]>
* send oracle prices to evaluate availableMargin * deepcopy hState
* set signedOrderBook addy from precompile call * hardcode values for aylin
* Store makerbook and snapshot to file * Update default paths * Save snapshots only to the file * minor change * Fix log * Revert "Save snapshots only to the file" This reverts commit 77e92ea. * Save snapshot only to file * Fix log again * Load snapshot from file first * Return error when file path is not set * Review fixes * Review changes * tiny changes for more idiomatic code * use channels to queue messages to write to file * stop closing the channel within consumer logic when shutdown signal comes * fix ineffectual assignment lint error * fix order struct * Add missing Id set --------- Co-authored-by: wallydrag <[email protected]>
* allow grace period for market orders to be filled * dont remove IOC orders based on block number * remove KEEP_IF_MATCHEABLE orderStatus * trigger matching if possible when signed order is placed * add log * check bidsHead only if !isLongOrder * fix test
push docker images feature/oonodz-integration. Update variables
* 🐛 check available margin for correct trader * remove logs * add err logs
Sync upstream v0.6.2
* add support for custom oracle * add log, clean comment --------- Co-authored-by: atvanguard <[email protected]>
* Match orders in same block as they are placed * Add metrics * Changes for latest avalanche cli * Review fixes * Fix compile error
* handle settled markets * Get fresh hubble state (#191) * misc * fix settlement price slot --------- Co-authored-by: Shubham <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
For Illustration purpose - to review the diff with the original subnet-evm repo. Not meant to be merged.