use of com.jd.blockchain.ledger.BytesValueList in project jdchain-core by blockchain-jd-com.
the class InstantiatedContractCode method doProcessEvent.
@Override
protected BytesValue doProcessEvent(Object contractInstance, ContractEventContext eventContext) {
// 反序列化参数;
Method handleMethod = contractDefinition.getType().getHandleMethod(eventContext.getEvent());
if (handleMethod == null) {
throw new ContractException(String.format("Contract[%s:%s] has no handle method to handle event[%s]!", getAddress().toString(), contractDefinition.getType().getName(), eventContext.getEvent()));
}
BytesValueList bytesValues = eventContext.getArgs();
Object[] args = BytesValueEncoding.decode(bytesValues, handleMethod.getParameterTypes());
return BytesValueEncoding.encodeSingle(ReflectionUtils.invokeMethod(handleMethod, contractInstance, args), handleMethod.getReturnType());
}
Aggregations