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

Issues with eth_contract macro #52

Open
levackt opened this issue Dec 23, 2019 · 2 comments
Open

Issues with eth_contract macro #52

levackt opened this issue Dec 23, 2019 · 2 comments
Assignees
Labels

Comments

@levackt
Copy link

levackt commented Dec 23, 2019

forum post

2 parts to this one

Consider a situation in which I have an Ethereum contract called TwoGather.sol, and discovery compile successfully compiles it into the build folder as build/smart_contracts/TwoGather.json

First question: It seems that I cannot just pass this file to the eth_contract macro, but that I first need to extract only the array that can be found at the abi property, is that correct? I was getting errors passing the file from the build/smart_contracts folder and that seemed to get me further.

Based on the the voting example this seems correct.

97 | #[eth_contract("TwoGather_abi_only.json")]
= help: message: called Result::unwrap() on an Err value: TokenParseError { error: "unexpected token" }

We don't see the rest of the contract but the eth_contract declaration seems correct, and the json looks valid in the post.

Will refer to the voting example while I try reproduce the error, perhaps Brendan can share a broken project.

@levackt
Copy link
Author

levackt commented Dec 28, 2019

Some updates;

  1. Improvements to the macro:

Allow a way to pull the abi from a locally built contract json. This will facilitate development of custom contracts more easily.
Provide better error messages when an abi fails to parse - at least the line/character number where the failure occurred!

  1. Possible bug leading to the error, will request more info about the compiler.

by removing the length [48] from the bytes then the error went away.

I think this must be an error in your discovery parser, because the solidity contract compiled fine and the bytes[48] is a valid type in solidity.

I would encourage your team to look into/fix that bug. Thx.

@levackt levackt added the bug Something isn't working label Dec 30, 2019
@levackt
Copy link
Author

levackt commented Dec 30, 2019

There's an open issue in discovery-cli, will keep this open until it's resolved to close the loop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant