Skip to content

Comments

Quickstudies#65

Open
mikewcasale wants to merge 20 commits intomainfrom
quickstudies
Open

Quickstudies#65
mikewcasale wants to merge 20 commits intomainfrom
quickstudies

Conversation

@mikewcasale
Copy link
Contributor

No description provided.

@netlify
Copy link

netlify bot commented Aug 8, 2022

Deploy Preview for incandescent-kelpie-250f0e canceled.

Name Link
🔨 Latest commit ac98abf
🔍 Latest deploy log https://app.netlify.com/sites/incandescent-kelpie-250f0e/deploys/62f17d656d173e000856958b

@mikewcasale mikewcasale requested a review from barakman August 8, 2022 17:41
@mikewcasale
Copy link
Contributor Author

This fixes the scenario_generator module for monte-carlo simulations.

if str(amount).endswith("%"):
return (
get_user_balance(state, user_name, tkn_name)
* Decimal(str(amount)[:-1])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same with regards to str(amount)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same response as previous

state = self.get_state(copy_type="initial", timestamp=timestamp)
state, tkn_name, user_name = validate_input(
state, tkn_name, user_name, timestamp
tkn_amt = userAmount(state, tkn_name, user_name, tkn_amt)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can/should revert this change.
Since tkn_amt is computed based on state, tkn_name, user_name, we should first have them validated (i.e., internally amended).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How/why would tkn_amt be computed based on state, tkn_name, user_name? This is a BancorDapp method, meaning it is the intended API for users of this codebase - hence they should be the ones specifying what the tkn_amt is. The deleted validate_input(..) did not include tkn_amt per your recent changes, presumably because the validation would have failed for string amounts with % signs, however, it makes more sense to simply call validate_input(..) on the tkn_amt directly after calling userAmount(...) (i.e., line 195 in this case). In short, Im suggesting we retain the original validate_input(..) which includes tkn_amt, but simply handle this after calling userAmount(...).

state, source_token, user_name, timestamp
tkn_amt = userAmount(state, source_token, user_name, tkn_amt)
state, source_token, tkn_amt, user_name = validate_input(
state, source_token, tkn_amt, user_name, timestamp
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same (you can/should revert this change).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same as above

state, tkn_name, user_name, timestamp
tkn_amt = userAmount(state, tkn_name, user_name, tkn_amt)
state, tkn_name, tkn_amt, user_name = validate_input(
state, tkn_name, tkn_amt, user_name, timestamp
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same (you can/should revert this change).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same as above

- changed `tkn_amt: str` to `tkn_amt: Any`
- changed camelcase functions to lowercase for simulator python style consistency
- fixed some inconsistent usage
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