-
Notifications
You must be signed in to change notification settings - Fork 1
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
Payable Feature #2
base: master
Are you sure you want to change the base?
Conversation
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.
Nice to see a start to this! I made a few comments, but I know this is also still a work in progress. This is definitely getting complex enough to warrant a separate Payable
object to separate this from the Solidity generation logic.
private def extractPayableParams(statements: Seq[Statement], scope: Set[String] = Set.empty[String], payableFields: Set[String], payableParams: Set[String]): Set[String] = { | ||
val names = statements.foldLeft(payableParams) { (current, statement) => | ||
statement match { | ||
case Send(destination, _, _) => current.union(extractVarNames(destination)) |
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.
If destination
includes field references, won't those be added in here as well, not just parameters?
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.
Just to clarify, is this if destination
is of type struct
? If so, yeah that's correctly, I'll be have to mindful of that when parsing and figuring out which variable within the struct's fields should be payable.
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.
I was just pointing out that this method is called extractPayableParams
but here, when you use extractVarNames
on destination
, I don't think it would properly distinguish between fields and parameters.
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.
Ohh gotcha, yes yes that makes sense. Before I think the resolution was that I'd just union it with the set of parameters of that transition, but admittedly that's not a very good solution. For the current version, I check for whether the variable is a parameter or field before adding it 👍
[WIP] Adding payable keyword generation to Solidity generator of compiler. Changes include
To do / push: