@@ -423,6 +423,7 @@ private List<MethodSpec> buildFunctionDefinitions(
423
423
throws ClassNotFoundException {
424
424
425
425
Set <String > duplicateFunctionNames = getDuplicateFunctionNames (functionDefinitions );
426
+ changeEventsName (functionDefinitions );
426
427
List <MethodSpec > methodSpecs = new ArrayList <>();
427
428
for (AbiDefinition functionDefinition : functionDefinitions ) {
428
429
if (functionDefinition .getType ().equals (TYPE_FUNCTION )) {
@@ -436,6 +437,25 @@ private List<MethodSpec> buildFunctionDefinitions(
436
437
return methodSpecs ;
437
438
}
438
439
440
+ private void changeEventsName (List <AbiDefinition > functionDefinitions ) {
441
+
442
+ Map <String , Integer > countMap = new HashMap <>();
443
+
444
+ for (AbiDefinition functionDefinition : functionDefinitions ) {
445
+ if (TYPE_EVENT .equals (functionDefinition .getType ())
446
+ && functionDefinition .getName () != null ) {
447
+ String s = functionDefinition .getName ();
448
+ if (countMap .containsKey (s )) {
449
+ int count = countMap .get (s );
450
+ functionDefinition .setName (s + count );
451
+ countMap .put (s , count + 1 );
452
+ } else {
453
+ countMap .put (s , 1 );
454
+ }
455
+ }
456
+ }
457
+ }
458
+
439
459
private List <TypeSpec > buildStructTypes (final List <AbiDefinition > functionDefinitions )
440
460
throws ClassNotFoundException {
441
461
final List <AbiDefinition .NamedType > orderedKeys = extractStructs (functionDefinitions );
@@ -723,6 +743,7 @@ Iterable<FieldSpec> buildFuncNameConstants(List<AbiDefinition> functionDefinitio
723
743
Set <String > fieldNames = new HashSet <>();
724
744
fieldNames .add (Contract .FUNC_DEPLOY );
725
745
Set <String > duplicateFunctionNames = getDuplicateFunctionNames (functionDefinitions );
746
+ changeEventsName (functionDefinitions );
726
747
if (!duplicateFunctionNames .isEmpty ()) {
727
748
System .out .println (
728
749
"\n Warning: Duplicate field(s) found: "
0 commit comments