-
Notifications
You must be signed in to change notification settings - Fork 56
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
fix: Display order price event attribute in JSON #1057
base: main
Are you sure you want to change the base?
Conversation
- Updated the NextVersion constant in setup_handlers.go to v1.1.0. - Improved the TestMsgServerExecuteOrder in msg_server_execute_order_test.go by adding post-requisite functions for better event validation and ensuring correct order execution. - Modified the Execute*Order functions in pending_spot_order.go to include MaxAmount for better order handling. - Enhanced event creation in events.go to serialize order prices as JSON for improved clarity in emitted events. These changes improve the testing framework and enhance the functionality of order execution in the Tradeshield module.
- Improved the TestMsgServerExecuteOrder in msg_server_execute_order_test.go by adding event validation to ensure the correct execution of limit open perpetual orders. - Updated the NewExecuteLimitOpenPerpetualOrderEvt function in events.go to serialize the trigger price as a JSON string for better clarity in emitted events. These changes strengthen the testing framework and improve the accuracy of event emissions in the Tradeshield module.
- Changed the NextVersion constant from v1.1.0 to v1.0.1 to reflect the correct versioning for the application. - This update ensures that the versioning is consistent with the intended release cycle.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1057 +/- ##
==========================================
- Coverage 45.87% 45.81% -0.07%
==========================================
Files 939 939
Lines 35829 35906 +77
==========================================
+ Hits 16438 16450 +12
- Misses 18103 18168 +65
Partials 1288 1288 |
return sdk.NewEvent(TypeEvtExecuteSpotOrder, | ||
sdk.NewAttribute("order_type", order.OrderType.String()), | ||
sdk.NewAttribute("order_id", strconv.FormatInt(int64(order.OrderId), 10)), | ||
sdk.NewAttribute("order_price", order.OrderPrice.String()), | ||
sdk.NewAttribute("order_price", string(orderPrice)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't we add 3 separate events?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@avkr003 lets keep structural changes post launch as it will require to update the offchain agents otherwise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cosmic-vagabond This is an event changed, not structural change. This won't change genesis right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@avkr003 I was referring to our offchain agent that uses the current event structure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@avkr003 the spot order events were broken down into 4 event types: limit buy, limit sell, stop loss and market buy, please review the changes thanks
return sdk.NewEvent(TypeEvtExecuteLimitOpenPerpetualOrder, | ||
sdk.NewAttribute("order_id", strconv.FormatInt(int64(order.OrderId), 10)), | ||
sdk.NewAttribute("owner_address", order.OwnerAddress), | ||
sdk.NewAttribute("order_type", order.PerpetualOrderType.String()), | ||
sdk.NewAttribute("position", order.Position.String()), | ||
sdk.NewAttribute("position_id", strconv.FormatInt(int64(positionId), 10)), | ||
sdk.NewAttribute("trigger_price", order.TriggerPrice.String()), | ||
sdk.NewAttribute("trigger_price", string(triggerPrice)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
… module - Updated event types in events.go to include specific events for limit buy, limit sell, stop loss, and market buy spot orders. - Modified the TestMsgServerExecuteOrder in msg_server_execute_order_test.go to validate the correct event type for limit buy orders. - Adjusted the ExecuteOrders function in msg_server_execute_orders.go to remove unused response variables and ensure proper event emissions. - Enhanced the CreateSpotOrder function in msg_server_spot_order.go to emit the correct event for market buy orders. - Added event emissions in the Execute*Order functions in pending_spot_order.go to ensure accurate event logging. These changes improve event handling and enhance the clarity of order execution in the Tradeshield module.
These changes improve the testing framework and enhance the functionality of order execution in the Tradeshield module.
Description
Closes:
What has Changed?
What specific problem were you aiming to address, and how did you successfully resolve it? If tests were not uploaded for this pull request or if coverage decreased, please provide an explanation for the change.
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeReviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking changeDeployment Notes
Are there any specific considerations to take into account when deploying these changes? This may include new dependencies, scripts that need to be executed, or any aspects that can only be evaluated in a deployed environment.
Screenshots and Videos
Please provide any relevant before and after screenshots by uploading them here. Additionally, demo videos can be highly beneficial in demonstrating the process.