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

multi: Bug fixes and code improvements #696

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

ukane-philemon
Copy link
Collaborator

This PR resolves a handful of bugs, code improvements on the CEX page, and minor dex improvements.

Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com>
Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com>
…error

Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com>
- Fix asset selector dropdown
- Fix asset amount input
- Fix order schedular modal and balance to maintain field
- Fix order settings modal
- Handle error from failed order schedules

Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com>
Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com>
Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com>
log.Errorf("unable to get market(%s) rate from %s.", market, source)
log.Infof("Proceeding without checking market rate deviation...")
} else {
exchangeServerRate := res.ExchangeRate // estimated receivable value for libwallet.DefaultRateRequestAmount (1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this using res.ExchangeRate instead of res.EstimatedAmount

Copy link
Collaborator Author

@ukane-philemon ukane-philemon Oct 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current calculation checks for market price deviation using the rate. before now the estimated amount was used which was incorrectly used and also the estimate might change based on some factors like the final invoiced amount.

Comment on lines 113 to 119
orderInfo, err := pg.getOrderInfo(pg.orderInfo.UUID)
if err != nil {
log.Error(err)
pg.notifyError(err)
} else {
pg.orderInfo = orderInfo
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i try to avoid if else statements when possible to enhance readability

orderInfo, err := pg.getOrderInfo(pg.orderInfo.UUID)
			if err != nil {
				log.Error(err)
				pg.notifyError(err)
                               return
			}

			pg.orderInfo = orderInfo
			

@dreacot
Copy link
Member

dreacot commented Oct 24, 2024

i tried running the order scheduler

Screenshot from 2024-10-24 12 04 27

log.Error("source wallet balance after the exchange would be less than the set balance to maintain")
return errors.E(op, "source wallet balance after the exchange would be less than the set balance to maintain") // stop scheduling if the source wallet balance after the exchange would be less than the set balance to maintain
if invoicedAmount == walletBalance {
errMsg := "Specify a little balance to maintain to cover for transaction fees... e.g 0.001 for DCR to BTC or LTC swaps"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this band aid can work for now, but we would need to improve the logic to automatically do the necessary calculation from our end, similar to what happens when a user clicks "max" on the send page

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar to what happens when a user clicks "max" on the send page

Same thought, but not sure if the max send has been implemented yet.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, not yet implemented

@ukane-philemon
Copy link
Collaborator Author

i tried running the order scheduler

Screenshot from 2024-10-24 12 04 27

Not sure why ltc is looking for an explorer but will check.

Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com>
Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com>
@dreacot
Copy link
Member

dreacot commented Nov 11, 2024

2024-11-11 12:40:56.963 [INF] DLWL: Order Scheduler: get newly created order info
2024-11-11 12:41:02.764 [INF] DLWL: Order Scheduler: instantiate block explorer
2024-11-11 12:41:02.764 [INF] DLWL: Order Scheduler: verifying transaction with ID: 

the ID isn't shown

@dreacot
Copy link
Member

dreacot commented Nov 11, 2024

2024-11-11 13:01:18.157 [INF] DLWL: order was completed successfully
2024-11-11 13:01:18.157 [INF] DLWL: Order Scheduler: creating next order based on selected frequency
2024-11-11 13:01:18.157 [INF] DLWL: Order Scheduler: the scheduler start time is equal to or greater than the frequency, starting next order immediately
2024-11-11 13:01:18.157 [ERR] DLWL: source wallet balance is less than or equals the set balance to maintain
2024-11-11 13:01:18.157 [INF] DLWL: Order Scheduler: exited

i think the message in the modal is misleading, because no indication the scheduler completed successfully

Screenshot from 2024-11-11 13 01 24

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.

2 participants