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

Solc生成的合约EventValues对象类型映射错误 #574

Open
rainy-wind opened this issue Apr 24, 2020 · 0 comments
Open

Solc生成的合约EventValues对象类型映射错误 #574

rainy-wind opened this issue Apr 24, 2020 · 0 comments

Comments

@rainy-wind
Copy link

在solc中,会自动生成Java代码,其中每个event会生成一个对应的内部类PO,以EventResponse结尾,例如存在合约:

        event LogSetSArray(uint256[2] o, uint256[2] n);

对应的java代码为:

 public static class LogSetSArrayEventResponse {
        public Log log;

        public List<BigInteger> o;

        public List<BigInteger> n;
    }

但是,在最新的版本中,如果event中存在动态或静态数字的数组,会统一映射为 List,但是实际上的类型并非 List。

以上述类型为例,当调用时,实际的类型为原版本的映射类型,

		List<LogSetSArrayEventResponse> LogSetSArrayEventResponseList = contract.getLogSetSArrayEvents(receipt);

实际的类型为List:

[{"value":1,"typeAsString":"uint256"},{"value":2,"typeAsString":"uint256"}]

这个问题会导致下游系统对数据的解析产生错误。

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

No branches or pull requests

1 participant