55import com .google .protobuf .ByteString ;
66import lombok .Getter ;
77import lombok .Setter ;
8+ import org .spongycastle .util .encoders .Hex ;
89import org .tron .common .logsfilter .EventPluginLoader ;
910import org .tron .common .logsfilter .trigger .TransactionLogTrigger ;
1011import org .tron .common .runtime .vm .program .ProgramResult ;
1112import org .tron .common .utils .TypeConversion ;
1213import org .tron .core .capsule .BlockCapsule ;
1314import org .tron .core .capsule .TransactionCapsule ;
1415import org .tron .core .db .TransactionTrace ;
16+ import org .tron .protos .Protocol ;
1517
1618public class TransactionLogTriggerCapsule extends TriggerCapsule {
1719
@@ -30,6 +32,31 @@ public TransactionLogTriggerCapsule(TransactionCapsule trxCasule, BlockCapsule b
3032
3133 TransactionTrace trxTrace = trxCasule .getTrxTrace ();
3234
35+ // contract result
36+ if (Objects .nonNull (trxCasule .getContractRet ())){
37+ transactionLogTrigger .setContractResult (trxCasule .getContractRet ().toString ());
38+ }
39+
40+ if (Objects .nonNull (trxCasule .getInstance ().getRawData ())){
41+ // feelimit
42+ transactionLogTrigger .setFeeLimit (trxCasule .getInstance ().getRawData ().getFeeLimit ());
43+
44+ Protocol .Transaction .Contract contract = trxCasule .getInstance ().getRawData ().getContract (0 );
45+ // contract type
46+ if (Objects .nonNull (contract )){
47+ Protocol .Transaction .Contract .ContractType contractType = contract .getType ();
48+ if (Objects .nonNull (contractType )){
49+ transactionLogTrigger .setContractType (contractType .toString ());
50+ }
51+
52+ if (Objects .nonNull (contract .getContractName ())){
53+ transactionLogTrigger .setContractName (Hex .toHexString (contract .getContractName ().toByteArray ()));
54+ }
55+
56+ transactionLogTrigger .setCallValue (TransactionCapsule .getCallValue (contract ));
57+ }
58+ }
59+
3360 // receipt
3461 if (Objects .nonNull (trxTrace ) && Objects .nonNull (trxTrace .getReceipt ())) {
3562 transactionLogTrigger .setEnergyFee (trxTrace .getReceipt ().getEnergyFee ());
@@ -54,17 +81,6 @@ public TransactionLogTriggerCapsule(TransactionCapsule trxCasule, BlockCapsule b
5481 transactionLogTrigger .setContractAddress (TypeConversion .bytesToHexString (contractAddress .toByteArray ()));
5582 }
5683
57- if (Objects .nonNull (programResult .getRet ())){
58- transactionLogTrigger .setContractFee (programResult .getRet ().getFee ());
59- transactionLogTrigger .setUnfreezeAmount (programResult .getRet ().getUnfreezeAmount ());
60- transactionLogTrigger .setAssetIssueID (programResult .getRet ().getAssetIssueID ());
61- transactionLogTrigger .setExchangeId (programResult .getRet ().getExchangeId ());
62- transactionLogTrigger .setWithdrawAmount (programResult .getRet ().getWithdrawAmount ());
63- transactionLogTrigger .setExchangeReceivedAmount (programResult .getRet ().getExchangeReceivedAmount ());
64- transactionLogTrigger .setExchangeInjectAnotherAmount (programResult .getRet ().getExchangeInjectAnotherAmount ());
65- transactionLogTrigger .setExchangeWithdrawAnotherAmount (programResult .getRet ().getExchangeWithdrawAnotherAmount ());
66- }
67-
6884 // internal transaction
6985 transactionLogTrigger .setInternalTransactionPojoList (programResult .getInternalTransactions ());
7086 }
0 commit comments