Skip to content

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 force-pushed the feature/generate-preamble branch from d1b33ea to 2c992cd Compare October 9, 2019 15:21
@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