Skip to content
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

Add return value (what and how much is refunded) to virtual limit_order_cancel operation #2729

Merged
merged 3 commits into from
Mar 20, 2023

Conversation

abitmore
Copy link
Member

@abitmore abitmore commented Mar 19, 2023

When a limit order is canceled due to expiration or because it is too small to fill, a virtual limit_order_cancel operation is recorded in account history. However, we didn't save the result of the operation correctly, it was always null_result ([0,{}]), but should be an asset object which indicates what and how much is refunded. This PR should fix it.

Example of old data:

  • a virtual limit_ordre_cancel operation
>>> get_object 1.11.1261437645
[{
    "id": "1.11.1261437645",
    "op": [
      2,{
        "fee": {
          "amount": 482,
          "asset_id": "1.3.0"
        },
        "fee_paying_account": "1.2.735564",
        "order": "1.7.59952142",
        "extensions": []
      }
    ],
    "result": [
      0,{}
    ],
    "block_num": 77727877,
    "trx_in_block": 2,
    "op_in_trx": 0,
    "virtual_op": 0,
    "is_virtual": true,
    "block_time": "2023-03-19T01:54:03"
  }
]
  • a real limit_order_cancel operation
>>> get_object 1.11.1261513074
[{
    "id": "1.11.1261513074",
    "op": [
      2,{
        "fee": {
          "amount": 482,
          "asset_id": "1.3.0"
        },
        "fee_paying_account": "1.2.1799499",
        "order": "1.7.519871121",
        "extensions": []
      }
    ],
    "result": [
      2,{
        "amount": 25052176,
        "asset_id": "1.3.5589"
      }
    ],
    "block_num": 77739593,
    "trx_in_block": 0,
    "op_in_trx": 3,
    "virtual_op": 0,
    "is_virtual": false,
    "block_time": "2023-03-19T11:41:21"
  }
]

@abitmore abitmore force-pushed the order-cancel-vop-result branch from 2adc3ce to 40be62a Compare March 19, 2023 16:31
@sonarcloud
Copy link

sonarcloud bot commented Mar 19, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@abitmore abitmore merged commit d50e2db into develop Mar 20, 2023
@abitmore abitmore deleted the order-cancel-vop-result branch March 20, 2023 00:09
@abitmore abitmore changed the title Save the result of virtual limit_order_cancel operation Update virtual limit_order_cancel operation to return what and how much is refunded May 19, 2023
@abitmore abitmore changed the title Update virtual limit_order_cancel operation to return what and how much is refunded Add return value (what and how much is refunded) to virtual limit_order_cancel operation May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant