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

Generate preamble code #62

Merged
merged 3 commits into from
Oct 15, 2019

Conversation

ikehara
Copy link
Contributor

@ikehara ikehara commented Sep 18, 2019

I'd like to pass parameters to a contract as function arguments in rust code.
This might be helpful for client code generation because we can easily determine
what parameters each contract entry point has by just parsing a source code.

I'm not sure what kind of types should be accepted as parameters.
Do you think everything (convertible to bytes) should be ok or there should be
a certain group of types which is acceptable for entry points.

@ikehara ikehara marked this pull request as ready for review October 9, 2019 15:44
};
Ok(a)
}
None => Err("invalid arg type".to_string())
Copy link
Member

Choose a reason for hiding this comment

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

please add type and argument info to error message

None => Err("invalid arg type".to_string())
}
}
_ => Err("invalid arg type".to_string())
Copy link
Member

Choose a reason for hiding this comment

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

please add type and argument info to error message

Integer(AbiInteger),
Bytes,
Address,
Hash,
Copy link
Member

Choose a reason for hiding this comment

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

Where does Hash comes from?

@@ -0,0 +1,54 @@

Copy link
Member

Choose a reason for hiding this comment

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

do rustfmt

@bluele
Copy link
Member

bluele commented Oct 10, 2019

Thanks, @ikehara .

I'd like to accept all types which can convert into Vec<u8>, but do you think there is a problem at your work #64 ?

@ikehara
Copy link
Contributor Author

ikehara commented Oct 12, 2019

Thanks, @ikehara .

I'd like to accept all types which can convert into Vec<u8>, but do you think there is a problem at your work #64 ?

The code generation in #64 is done based on the parsed ast of a source file.
I think all unrecognized types should be mapped to "bytes" or something in the intermediate JSON file and converted into []byte in the go source code.

Copy link
Member

@bluele bluele left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@bluele bluele merged commit 063d961 into datachainlab:develop Oct 15, 2019
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