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

[BUG] Parameters like is_redeemed=false and is_canceled=false are recorded on token update history #539

Closed
purplesmoke05 opened this issue Sep 22, 2023 · 0 comments · Fixed by #541
Assignees
Labels
bug Something isn't working

Comments

@purplesmoke05
Copy link
Member

purplesmoke05 commented Sep 22, 2023

Describe the bug

  • Parameters like is_redeemed=false and is_canceled=false are recorded on token update history although they do not occur token update.

if data.is_redeemed is not None and data.is_redeemed:
tx = contract.functions.changeToRedeemed().build_transaction(
{
"chainId": CHAIN_ID,
"from": tx_from,
"gas": TX_GAS_LIMIT,
"gasPrice": 0,
}
)

if data.is_canceled is not None and data.is_canceled:
tx = contract.functions.changeToCanceled().build_transaction(
{
"chainId": CHAIN_ID,
"from": tx_from,
"gas": TX_GAS_LIMIT,
"gasPrice": 0,
}
)

# Register operation log
operation_log = TokenUpdateOperationLog()
operation_log.token_address = token_address
operation_log.issuer_address = issuer_address
operation_log.type = TokenType.IBET_SHARE.value
operation_log.arguments = token.model_dump(exclude_none=True)
operation_log.original_contents = original_contents
operation_log.operation_category = TokenUpdateOperationCategory.UPDATE.value
db.add(operation_log)

  • It seems that is_redeemed or is_cancelled should be validated to ensure that these keys have true value on token update API.

Expected behavior

  • Validation error response should be returned when is_redeemed=false or is_canceled=false is posted to token update API.
@purplesmoke05 purplesmoke05 added the bug Something isn't working label Sep 22, 2023
@purplesmoke05 purplesmoke05 self-assigned this Sep 22, 2023
YoshihitoAso added a commit that referenced this issue Sep 22, 2023
Add `is_canceled`/`is_redeemed` validation to token update request body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant