Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
Lint fix and renames
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan-Ethernal committed Sep 6, 2023
1 parent 2eee5af commit ab12302
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions consensus/polybft/contractsapi/bindings-gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,8 @@ func ({{.Sig}} *{{.TName}}) DecodeAbi(buf []byte) error {
}

// generateFunction generates code for smart contract function and its parameters
func generateFunction(generatedData *generatedData, contractName string, method *abi.Method, resolveBySignature bool) error {
func generateFunction(generatedData *generatedData, contractName string,
method *abi.Method, fnSigResolution bool) error {
methodName := fmt.Sprintf(functionNameFormat, strings.Title(method.Name+contractName))
res := []string{}

Expand All @@ -784,7 +785,7 @@ func generateFunction(generatedData *generatedData, contractName string, method
}

// write encode/decode functions
tmplStr := generateFunctionTemplate(resolveBySignature)
tmplStr := generateFunctionTemplate(fnSigResolution)
inputs := map[string]interface{}{
"Structs": res,
"Sig": strings.ToLower(string(methodName[0])),
Expand All @@ -793,7 +794,7 @@ func generateFunction(generatedData *generatedData, contractName string, method
"TName": strings.Title(methodName),
}

if resolveBySignature {
if fnSigResolution {
inputs["Name"] = method.Sig()
}

Expand All @@ -809,8 +810,8 @@ func generateFunction(generatedData *generatedData, contractName string, method

// generateFunctionTemplate generates function template string, based on provided flag
// depending whether function is resolved by signature or by name
func generateFunctionTemplate(resolvedBySignature bool) string {
if resolvedBySignature {
func generateFunctionTemplate(fnSigResolution bool) string {
if fnSigResolution {
return `
{{range .Structs}}
{{.}}
Expand Down

0 comments on commit ab12302

Please sign in to comment.