-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[BCFR-147] - Add DecodeHook to convert between string and common.Address types #14508
base: develop
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.
If you run this in a LOOP this won't work because here the contract type will still have common.Address types for fields, which is why we need a codec modifer too.
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.
Small change, but looks like it will work.
stringType, stringPtrType := reflect.TypeOf(""), reflect.PointerTo(reflect.TypeOf("")) | ||
addressType, addressPtrType := reflect.TypeOf(common.Address{}), reflect.TypeOf(&common.Address{}) |
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.
These can be constants outside the function scope. This would save them being declared every time the function runs.
Quality Gate passedIssues Measures |
Task Description:
Add an EVM exclusive modifier/hook that changes onchain common.Address type to string.
This PR:
Adds
addressStringDecodeHook
to convert betweenstring
andcommon.Address
types. It handles the following conversions:string
or*string
->common.Address
or*common.Address
common.Address
or*common.Address
->string
or*string
Ticket: