From bcc305dc208b3862b87a34c63617ca091087418c Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Tue, 7 Jan 2025 15:59:16 +0700 Subject: [PATCH] remove unused comment. add method description for RawCreationTransact --- accounts/abi/bind/base.go | 1 + accounts/abi/bind/dep_tree.go | 1 - accounts/abi/bind/source2.go.tpl | 66 ++++++++++++++++---------------- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/accounts/abi/bind/base.go b/accounts/abi/bind/base.go index cc30900c5b..4bcf86a122 100644 --- a/accounts/abi/bind/base.go +++ b/accounts/abi/bind/base.go @@ -266,6 +266,7 @@ func (c *BoundContract) RawTransact(opts *TransactOpts, calldata []byte) (*types return c.transact(opts, &c.address, calldata) } +// RawTransact initiates a contract-creation transaction with the given raw calldata as the input. func (c *BoundContract) RawCreationTransact(opts *TransactOpts, calldata []byte) (*types.Transaction, error) { return c.transact(opts, nil, calldata) } diff --git a/accounts/abi/bind/dep_tree.go b/accounts/abi/bind/dep_tree.go index 0b315c9283..0ed6bc0b3d 100644 --- a/accounts/abi/bind/dep_tree.go +++ b/accounts/abi/bind/dep_tree.go @@ -122,7 +122,6 @@ func (d *depTreeDeployer) result() *DeploymentResult { // libraries. If an error occurs, only contracts which were successfully // deployed are returned in the result. func LinkAndDeploy(deployParams *DeploymentParams, deploy DeployFn) (res *DeploymentResult, err error) { - //deployParams.inputs = make(map[string][]byte) deployer := newDepTreeDeployer(deployParams, deploy) for _, contract := range deployParams.contracts { if _, err := deployer.linkAndDeploy(contract); err != nil { diff --git a/accounts/abi/bind/source2.go.tpl b/accounts/abi/bind/source2.go.tpl index b68a8a0724..d297aee861 100644 --- a/accounts/abi/bind/source2.go.tpl +++ b/accounts/abi/bind/source2.go.tpl @@ -44,7 +44,7 @@ var ( {{if .Libraries -}} Deps: []*bind.MetaData{ {{- range $name, $pattern := .Libraries}} - {{$name}}MetaData, + {{$name}}MetaData, {{- end}} }, {{end}} @@ -79,12 +79,12 @@ var ( {{/* Unpack method is needed only when there are return args */}} {{if .Normalized.Outputs }} - {{ if .Structured }} - type {{.Normalized.Name}}Output struct { - {{range .Normalized.Outputs}} - {{.Name}} {{bindtype .Type $structs}}{{end}} - } - {{ end }} + {{ if .Structured }} + type {{.Normalized.Name}}Output struct { + {{range .Normalized.Outputs}} + {{.Name}} {{bindtype .Type $structs}}{{end}} + } + {{ end }} 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) { out, err := {{ decapitalise $contract.Type}}.abi.Unpack("{{.Original.Name}}", data) {{if .Structured}} @@ -94,9 +94,9 @@ var ( } {{range $i, $t := .Normalized.Outputs}} {{if ispointertype .Type}} - outstruct.{{.Name}} = abi.ConvertType(out[{{$i}}], new({{underlyingbindtype .Type }})).({{bindtype .Type $structs}}) + outstruct.{{.Name}} = abi.ConvertType(out[{{$i}}], new({{underlyingbindtype .Type }})).({{bindtype .Type $structs}}) {{ else }} - outstruct.{{.Name}} = *abi.ConvertType(out[{{$i}}], new({{bindtype .Type $structs}})).(*{{bindtype .Type $structs}}) + outstruct.{{.Name}} = *abi.ConvertType(out[{{$i}}], new({{bindtype .Type $structs}})).(*{{bindtype .Type $structs}}) {{ end }}{{end}} return *outstruct, err @@ -125,7 +125,7 @@ var ( Raw *types.Log // Blockchain specific contextual infos } - const {{$contract.Type}}{{.Normalized.Name}}EventName = "{{.Original.Name}}" + const {{$contract.Type}}{{.Normalized.Name}}EventName = "{{.Original.Name}}" func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) Unpack{{.Normalized.Name}}Event(log *types.Log) (*{{$contract.Type}}{{.Normalized.Name}}, error) { event := "{{.Original.Name}}" @@ -152,25 +152,25 @@ var ( } {{end}} - {{ if .Errors }} - func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) UnpackError(raw []byte) any { - {{$i := 0}} - {{range $k, $v := .Errors}} - {{ if eq $i 0 }} - if val, err := {{ decapitalise $contract.Type}}.Unpack{{.Normalized.Name}}Error(raw); err == nil { - return val - {{ else }} - } else if val, err := {{ decapitalise $contract.Type}}.Unpack{{.Normalized.Name}}Error(raw); err == nil { - return val - {{ end -}} - {{$i = add $i 1}} - {{end -}} - } - return nil - } - {{ end -}} + {{ if .Errors }} + func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) UnpackError(raw []byte) any { + {{$i := 0}} + {{range $k, $v := .Errors}} + {{ if eq $i 0 }} + if val, err := {{ decapitalise $contract.Type}}.Unpack{{.Normalized.Name}}Error(raw); err == nil { + return val + {{ else }} + } else if val, err := {{ decapitalise $contract.Type}}.Unpack{{.Normalized.Name}}Error(raw); err == nil { + return val + {{ end -}} + {{$i = add $i 1}} + {{end -}} + } + return nil + } + {{ end -}} - {{range .Errors}} + {{range .Errors}} // {{$contract.Type}}{{.Normalized.Name}} represents a {{.Normalized.Name}} error raised by the {{$contract.Type}} contract. type {{$contract.Type}}{{.Normalized.Name}} struct { {{range .Normalized.Inputs}} {{capitalise .Name}} {{if .Indexed}}{{bindtopictype .Type $structs}}{{else}}{{bindtype .Type $structs}}{{end}}; {{end}} @@ -183,10 +183,10 @@ var ( func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) Unpack{{.Normalized.Name}}Error(raw []byte) (*{{$contract.Type}}{{.Normalized.Name}}, error) { errName := "{{.Normalized.Name}}" out := new({{$contract.Type}}{{.Normalized.Name}}) - if err := {{ decapitalise $contract.Type}}.abi.UnpackIntoInterface(out, errName, raw); err != nil { - return nil, err - } + if err := {{ decapitalise $contract.Type}}.abi.UnpackIntoInterface(out, errName, raw); err != nil { + return nil, err + } return out, nil } - {{end}} -{{end}} \ No newline at end of file + {{end}} +{{end}}