4444 { {if .Libraries -} }
4545 Deps: []*bind.MetaData{
4646 {{- range $name , $pattern := .Libraries} }
47- { {$name } }MetaData,
47+ { {$name } }MetaData,
4848 { {- end} }
4949 },
5050 { {end} }
@@ -79,12 +79,12 @@ var (
7979
8080 { {/* Unpack method is needed only when there are return args */} }
8181 { {if .Normalized.Outputs } }
82- { { if .Structured } }
83- type { {.Normalized.Name} }Output struct {
84- {{range .Normalized.Outputs} }
85- { {.Name} } { {bindtype .Type $structs } }{ {end} }
86- }
87- { { end } }
82+ { { if .Structured } }
83+ type { {.Normalized.Name} }Output struct {
84+ {{range .Normalized.Outputs} }
85+ { {.Name} } { {bindtype .Type $structs } }{ {end} }
86+ }
87+ { { end } }
8888 func ({ { decapitalise $contract .Type} } *{ {$contract .Type} }) Unpack{ {.Normalized.Name} }(data []byte) ({ {if .Structured} } { {.Normalized.Name} }Output,{ {else } }{ {range .Normalized.Outputs} }{ {bindtype .Type $structs } },{ {end} }{ {end} } error) {
8989 out, err := {{ decapitalise $contract .Type} }.abi.Unpack("{ {.Original.Name} }", data)
9090 { {if .Structured} }
9494 }
9595 { {range $i , $t := .Normalized.Outputs} }
9696 { {if ispointertype .Type} }
97- outstruct.{ {.Name} } = abi.ConvertType(out[{ {$i } }], new({ {underlyingbindtype .Type } })).({ {bindtype .Type $structs } })
97+ outstruct.{ {.Name} } = abi.ConvertType(out[{ {$i } }], new({ {underlyingbindtype .Type } })).({ {bindtype .Type $structs } })
9898 { { else } }
99- outstruct.{ {.Name} } = *abi.ConvertType(out[{ {$i } }], new({ {bindtype .Type $structs } })).(*{ {bindtype .Type $structs } })
99+ outstruct.{ {.Name} } = *abi.ConvertType(out[{ {$i } }], new({ {bindtype .Type $structs } })).(*{ {bindtype .Type $structs } })
100100 { { end } }{ {end} }
101101
102102 return *outstruct, err
@@ -125,7 +125,7 @@ var (
125125 Raw *types.Log // Blockchain specific contextual infos
126126 }
127127
128- const { {$contract .Type} }{ {.Normalized.Name} }EventName = "{ {.Original.Name} }"
128+ const { {$contract .Type} }{ {.Normalized.Name} }EventName = "{ {.Original.Name} }"
129129
130130 func ({ { decapitalise $contract .Type} } *{ {$contract .Type} }) Unpack{ {.Normalized.Name} }Event(log *types.Log) (*{ {$contract .Type} }{ {.Normalized.Name} }, error) {
131131 event := " {{.Original.Name}}"
@@ -152,25 +152,25 @@ var (
152152 }
153153 { {end} }
154154
155- { { if .Errors } }
156- func ({ { decapitalise $contract .Type} } *{ {$contract .Type} }) UnpackError(raw []byte) any {
157- {{$i := 0} }
158- { {range $k , $v := .Errors} }
159- { { if eq $i 0 } }
160- if val, err := { { decapitalise $contract .Type} }.Unpack{ {.Normalized.Name} }Error(raw); err == nil {
161- return val
162- {{ else } }
163- } else if val, err := { { decapitalise $contract .Type} }.Unpack{ {.Normalized.Name} }Error(raw); err == nil {
164- return val
165- {{ end -} }
166- { {$i = add $i 1} }
167- { {end -} }
168- }
169- return nil
170- }
171- { { end -} }
172-
173- { {range .Errors} }
155+ { { if .Errors } }
156+ func ({ { decapitalise $contract .Type} } *{ {$contract .Type} }) UnpackError(raw []byte) any {
157+ {{$i := 0} }
158+ { {range $k , $v := .Errors} }
159+ { { if eq $i 0 } }
160+ if val, err := { { decapitalise $contract .Type} }.Unpack{ {.Normalized.Name} }Error(raw); err == nil {
161+ return val
162+ {{ else } }
163+ } else if val, err := { { decapitalise $contract .Type} }.Unpack{ {.Normalized.Name} }Error(raw); err == nil {
164+ return val
165+ {{ end -} }
166+ { {$i = add $i 1} }
167+ { {end -} }
168+ }
169+ return nil
170+ }
171+ { { end -} }
172+
173+ { {range .Errors} }
174174 // { {$contract .Type} }{ {.Normalized.Name} } represents a { {.Normalized.Name} } error raised by the { {$contract .Type} } contract.
175175 type { {$contract .Type} }{ {.Normalized.Name} } struct { {{range .Normalized.Inputs} }
176176 { {capitalise .Name} } { {if .Indexed} }{ {bindtopictype .Type $structs } }{ {else } }{ {bindtype .Type $structs } }{ {end} }; { {end} }
@@ -183,10 +183,10 @@ var (
183183 func ({ { decapitalise $contract .Type} } *{ {$contract .Type} }) Unpack{ {.Normalized.Name} }Error(raw []byte) (*{ {$contract .Type} }{ {.Normalized.Name} }, error) {
184184 errName := " {{.Normalized.Name}}"
185185 out := new({{$contract .Type} }{ {.Normalized.Name} })
186- if err := { { decapitalise $contract .Type} }.abi.UnpackIntoInterface(out, errName, raw); err != nil {
187- return nil, err
188- }
186+ if err := { { decapitalise $contract .Type} }.abi.UnpackIntoInterface(out, errName, raw); err != nil {
187+ return nil, err
188+ }
189189 return out, nil
190190 }
191- { {end} }
192- { {end} }
191+ { {end} }
192+ { {end} }
0 commit comments