use of org.aion.types.Log in project aion by aionnetwork.
the class LogUtility method decodeLog.
public static Log decodeLog(SharedRLPList sharedRLPList) {
Objects.requireNonNull(sharedRLPList);
// Can be null
byte[] address = sharedRLPList.get(0).getRLPData();
// Can be null
byte[] data = sharedRLPList.get(2).getRLPData();
SharedRLPList encodedTopics = (SharedRLPList) sharedRLPList.get(1);
List<byte[]> topics = new ArrayList<>();
for (RLPElement topic1 : encodedTopics) {
byte[] topic = topic1.getRLPData();
topics.add(topic);
}
Log ret;
if (address != null && data != null) {
if (topics.isEmpty()) {
ret = Log.dataOnly(address, data);
} else {
ret = Log.topicsAndData(address, topics, data);
}
} else {
throw new IllegalArgumentException("Unable to decode Log because of null " + (address == null ? "address" : "data"));
}
return ret;
}
Aggregations