From 0d9c49c753403e0ff4c026e8c4c9794ba9d602da Mon Sep 17 00:00:00 2001 From: maskpp Date: Tue, 22 Apr 2025 16:53:46 +0800 Subject: [PATCH 1/9] fix error return format --- accounts/abi/abigen/source2.go.tpl | 2 +- .../bind/v2/internal/contracts/db/bindings.go | 6 +++--- .../contracts/nested_libraries/bindings.go | 16 ++++++++-------- .../contracts/uint256arrayreturn/bindings.go | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/accounts/abi/abigen/source2.go.tpl b/accounts/abi/abigen/source2.go.tpl index 8f9d4d4103eb..79f90b5f4eef 100644 --- a/accounts/abi/abigen/source2.go.tpl +++ b/accounts/abi/abigen/source2.go.tpl @@ -145,7 +145,7 @@ var ( out{{$i}} := *abi.ConvertType(out[{{$i}}], new({{bindtype .Type $structs}})).(*{{bindtype .Type $structs}}) {{- end }} {{- end}} - return {{range $i, $t := .Normalized.Outputs}}out{{$i}}, {{end}} err + return {{range $i, $t := .Normalized.Outputs}}out{{$i}}, {{end}} nil {{- end}} } {{end}} diff --git a/accounts/abi/bind/v2/internal/contracts/db/bindings.go b/accounts/abi/bind/v2/internal/contracts/db/bindings.go index 6291160fe966..a614c3c08a86 100644 --- a/accounts/abi/bind/v2/internal/contracts/db/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/db/bindings.go @@ -80,7 +80,7 @@ func (dB *DB) UnpackGet(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // PackGetNamedStatParams is the Go binding used to pack the parameters required for calling @@ -179,7 +179,7 @@ func (dB *DB) UnpackGetStatsStruct(data []byte) (DBStats, error) { return *new(DBStats), err } out0 := *abi.ConvertType(out[0], new(DBStats)).(*DBStats) - return out0, err + return out0, nil } // PackInsert is the Go binding used to pack the parameters required for calling @@ -204,7 +204,7 @@ func (dB *DB) UnpackInsert(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // DBInsert represents a Insert event raised by the DB contract. diff --git a/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go b/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go index 6fd6a1b2859a..ba73dd95c2f7 100644 --- a/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go @@ -89,7 +89,7 @@ func (c1 *C1) UnpackDo(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // C2MetaData contains all meta data concerning the C2 contract. @@ -157,7 +157,7 @@ func (c2 *C2) UnpackDo(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // L1MetaData contains all meta data concerning the L1 contract. @@ -209,7 +209,7 @@ func (l1 *L1) UnpackDo(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // L2MetaData contains all meta data concerning the L2 contract. @@ -264,7 +264,7 @@ func (l2 *L2) UnpackDo(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // L2bMetaData contains all meta data concerning the L2b contract. @@ -319,7 +319,7 @@ func (l2b *L2b) UnpackDo(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // L3MetaData contains all meta data concerning the L3 contract. @@ -371,7 +371,7 @@ func (l3 *L3) UnpackDo(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // L4MetaData contains all meta data concerning the L4 contract. @@ -427,7 +427,7 @@ func (l4 *L4) UnpackDo(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // L4bMetaData contains all meta data concerning the L4b contract. @@ -482,5 +482,5 @@ func (l4b *L4b) UnpackDo(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } diff --git a/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go b/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go index 4999cc75d9ef..badcd20894fa 100644 --- a/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go @@ -73,5 +73,5 @@ func (myContract *MyContract) UnpackGetNums(data []byte) ([5]*big.Int, error) { return *new([5]*big.Int), err } out0 := *abi.ConvertType(out[0], new([5]*big.Int)).(*[5]*big.Int) - return out0, err + return out0, nil } From 2958387a847c71c1321dd4c630b1c98fc4f28214 Mon Sep 17 00:00:00 2001 From: maskpp Date: Tue, 22 Apr 2025 17:08:31 +0800 Subject: [PATCH 2/9] fix abigen v2 --- accounts/abi/abigen/source2.go.tpl | 18 ++---- .../bind/v2/internal/contracts/db/bindings.go | 54 +++++----------- .../v2/internal/contracts/events/bindings.go | 16 ++--- .../contracts/nested_libraries/bindings.go | 64 +++++-------------- .../contracts/solc_errors/bindings.go | 24 ++----- .../contracts/uint256arrayreturn/bindings.go | 8 +-- 6 files changed, 50 insertions(+), 134 deletions(-) diff --git a/accounts/abi/abigen/source2.go.tpl b/accounts/abi/abigen/source2.go.tpl index 79f90b5f4eef..7c02b1ce245e 100644 --- a/accounts/abi/abigen/source2.go.tpl +++ b/accounts/abi/abigen/source2.go.tpl @@ -93,12 +93,8 @@ var ( // the contract method with ID 0x{{printf "%x" .Original.ID}}. // // Solidity: {{.Original.String}} - func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) Pack{{.Normalized.Name}}({{range .Normalized.Inputs}} {{.Name}} {{bindtype .Type $structs}}, {{end}}) []byte { - enc, err := {{ decapitalise $contract.Type}}.abi.Pack("{{.Original.Name}}" {{range .Normalized.Inputs}}, {{.Name}}{{end}}) - if err != nil { - panic(err) - } - return enc + func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) Pack{{.Normalized.Name}}({{range .Normalized.Inputs}} {{.Name}} {{bindtype .Type $structs}}, {{end}}) ([]byte, error) { + return {{ decapitalise $contract.Type}}.abi.Pack("{{.Original.Name}}" {{range .Normalized.Inputs}}, {{.Name}}{{end}}) } {{/* Unpack method is needed only when there are return args */}} @@ -117,14 +113,14 @@ var ( // // Solidity: {{.Original.String}} func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) Unpack{{.Normalized.Name}}(data []byte) ( - {{- if .Structured}} {{.Normalized.Name}}Output,{{else}} + {{- 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}} outstruct := new({{.Normalized.Name}}Output) if err != nil { - return *outstruct, err + return outstruct, nil } {{- range $i, $t := .Normalized.Outputs}} {{- if ispointertype .Type}} @@ -133,8 +129,7 @@ var ( outstruct.{{capitalise .Name}} = *abi.ConvertType(out[{{$i}}], new({{bindtype .Type $structs}})).(*{{bindtype .Type $structs}}) {{- end }} {{- end }} - return *outstruct, err - {{else}} + return outstruct, nil{{else}} if err != nil { return {{range $i, $_ := .Normalized.Outputs}}{{if ispointertype .Type}}new({{underlyingbindtype .Type }}), {{else}}*new({{bindtype .Type $structs}}), {{end}}{{end}} err } @@ -145,8 +140,7 @@ var ( out{{$i}} := *abi.ConvertType(out[{{$i}}], new({{bindtype .Type $structs}})).(*{{bindtype .Type $structs}}) {{- end }} {{- end}} - return {{range $i, $t := .Normalized.Outputs}}out{{$i}}, {{end}} nil - {{- end}} + return {{range $i, $t := .Normalized.Outputs}}out{{$i}}, {{end}} nil{{- end}} } {{end}} {{end}} diff --git a/accounts/abi/bind/v2/internal/contracts/db/bindings.go b/accounts/abi/bind/v2/internal/contracts/db/bindings.go index a614c3c08a86..fd54e53304da 100644 --- a/accounts/abi/bind/v2/internal/contracts/db/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/db/bindings.go @@ -62,12 +62,8 @@ func (c *DB) Instance(backend bind.ContractBackend, addr common.Address) *bind.B // the contract method with ID 0x9507d39a. // // Solidity: function get(uint256 k) returns(uint256) -func (dB *DB) PackGet(k *big.Int) []byte { - enc, err := dB.abi.Pack("get", k) - if err != nil { - panic(err) - } - return enc +func (dB *DB) PackGet(k *big.Int) ([]byte, error) { + return dB.abi.Pack("get", k) } // UnpackGet is the Go binding that unpacks the parameters returned @@ -87,12 +83,8 @@ func (dB *DB) UnpackGet(data []byte) (*big.Int, error) { // the contract method with ID 0xe369ba3b. // // Solidity: function getNamedStatParams() view returns(uint256 gets, uint256 inserts, uint256 mods) -func (dB *DB) PackGetNamedStatParams() []byte { - enc, err := dB.abi.Pack("getNamedStatParams") - if err != nil { - panic(err) - } - return enc +func (dB *DB) PackGetNamedStatParams() ([]byte, error) { + return dB.abi.Pack("getNamedStatParams") } // GetNamedStatParamsOutput serves as a container for the return parameters of contract @@ -107,29 +99,24 @@ type GetNamedStatParamsOutput struct { // from invoking the contract method with ID 0xe369ba3b. // // Solidity: function getNamedStatParams() view returns(uint256 gets, uint256 inserts, uint256 mods) -func (dB *DB) UnpackGetNamedStatParams(data []byte) (GetNamedStatParamsOutput, error) { +func (dB *DB) UnpackGetNamedStatParams(data []byte) (*GetNamedStatParamsOutput, error) { out, err := dB.abi.Unpack("getNamedStatParams", data) outstruct := new(GetNamedStatParamsOutput) if err != nil { - return *outstruct, err + return outstruct, nil } outstruct.Gets = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Inserts = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Mods = abi.ConvertType(out[2], new(big.Int)).(*big.Int) - return *outstruct, err - + return outstruct, nil } // PackGetStatParams is the Go binding used to pack the parameters required for calling // the contract method with ID 0x6fcb9c70. // // Solidity: function getStatParams() view returns(uint256, uint256, uint256) -func (dB *DB) PackGetStatParams() []byte { - enc, err := dB.abi.Pack("getStatParams") - if err != nil { - panic(err) - } - return enc +func (dB *DB) PackGetStatParams() ([]byte, error) { + return dB.abi.Pack("getStatParams") } // GetStatParamsOutput serves as a container for the return parameters of contract @@ -144,29 +131,24 @@ type GetStatParamsOutput struct { // from invoking the contract method with ID 0x6fcb9c70. // // Solidity: function getStatParams() view returns(uint256, uint256, uint256) -func (dB *DB) UnpackGetStatParams(data []byte) (GetStatParamsOutput, error) { +func (dB *DB) UnpackGetStatParams(data []byte) (*GetStatParamsOutput, error) { out, err := dB.abi.Unpack("getStatParams", data) outstruct := new(GetStatParamsOutput) if err != nil { - return *outstruct, err + return outstruct, nil } outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Arg2 = abi.ConvertType(out[2], new(big.Int)).(*big.Int) - return *outstruct, err - + return outstruct, nil } // PackGetStatsStruct is the Go binding used to pack the parameters required for calling // the contract method with ID 0xee8161e0. // // Solidity: function getStatsStruct() view returns((uint256,uint256,uint256)) -func (dB *DB) PackGetStatsStruct() []byte { - enc, err := dB.abi.Pack("getStatsStruct") - if err != nil { - panic(err) - } - return enc +func (dB *DB) PackGetStatsStruct() ([]byte, error) { + return dB.abi.Pack("getStatsStruct") } // UnpackGetStatsStruct is the Go binding that unpacks the parameters returned @@ -186,12 +168,8 @@ func (dB *DB) UnpackGetStatsStruct(data []byte) (DBStats, error) { // the contract method with ID 0x1d834a1b. // // Solidity: function insert(uint256 k, uint256 v) returns(uint256) -func (dB *DB) PackInsert(k *big.Int, v *big.Int) []byte { - enc, err := dB.abi.Pack("insert", k, v) - if err != nil { - panic(err) - } - return enc +func (dB *DB) PackInsert(k *big.Int, v *big.Int) ([]byte, error) { + return dB.abi.Pack("insert", k, v) } // UnpackInsert is the Go binding that unpacks the parameters returned diff --git a/accounts/abi/bind/v2/internal/contracts/events/bindings.go b/accounts/abi/bind/v2/internal/contracts/events/bindings.go index 580bffa23eb8..a4bf69bcc69a 100644 --- a/accounts/abi/bind/v2/internal/contracts/events/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/events/bindings.go @@ -55,24 +55,16 @@ func (c *C) Instance(backend bind.ContractBackend, addr common.Address) *bind.Bo // the contract method with ID 0xcb493749. // // Solidity: function EmitMulti() returns() -func (c *C) PackEmitMulti() []byte { - enc, err := c.abi.Pack("EmitMulti") - if err != nil { - panic(err) - } - return enc +func (c *C) PackEmitMulti() ([]byte, error) { + return c.abi.Pack("EmitMulti") } // PackEmitOne is the Go binding used to pack the parameters required for calling // the contract method with ID 0xe8e49a71. // // Solidity: function EmitOne() returns() -func (c *C) PackEmitOne() []byte { - enc, err := c.abi.Pack("EmitOne") - if err != nil { - panic(err) - } - return enc +func (c *C) PackEmitOne() ([]byte, error) { + return c.abi.Pack("EmitOne") } // CBasic1 represents a basic1 event raised by the C contract. diff --git a/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go b/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go index ba73dd95c2f7..dc4751596f45 100644 --- a/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go @@ -71,12 +71,8 @@ func (c1 *C1) PackConstructor(v1 *big.Int, v2 *big.Int) []byte { // the contract method with ID 0x2ad11272. // // Solidity: function Do(uint256 val) pure returns(uint256 res) -func (c1 *C1) PackDo(val *big.Int) []byte { - enc, err := c1.abi.Pack("Do", val) - if err != nil { - panic(err) - } - return enc +func (c1 *C1) PackDo(val *big.Int) ([]byte, error) { + return c1.abi.Pack("Do", val) } // UnpackDo is the Go binding that unpacks the parameters returned @@ -139,12 +135,8 @@ func (c2 *C2) PackConstructor(v1 *big.Int, v2 *big.Int) []byte { // the contract method with ID 0x2ad11272. // // Solidity: function Do(uint256 val) pure returns(uint256 res) -func (c2 *C2) PackDo(val *big.Int) []byte { - enc, err := c2.abi.Pack("Do", val) - if err != nil { - panic(err) - } - return enc +func (c2 *C2) PackDo(val *big.Int) ([]byte, error) { + return c2.abi.Pack("Do", val) } // UnpackDo is the Go binding that unpacks the parameters returned @@ -191,12 +183,8 @@ func (c *L1) Instance(backend bind.ContractBackend, addr common.Address) *bind.B // the contract method with ID 0x2ad11272. // // Solidity: function Do(uint256 val) pure returns(uint256) -func (l1 *L1) PackDo(val *big.Int) []byte { - enc, err := l1.abi.Pack("Do", val) - if err != nil { - panic(err) - } - return enc +func (l1 *L1) PackDo(val *big.Int) ([]byte, error) { + return l1.abi.Pack("Do", val) } // UnpackDo is the Go binding that unpacks the parameters returned @@ -246,12 +234,8 @@ func (c *L2) Instance(backend bind.ContractBackend, addr common.Address) *bind.B // the contract method with ID 0x2ad11272. // // Solidity: function Do(uint256 val) pure returns(uint256) -func (l2 *L2) PackDo(val *big.Int) []byte { - enc, err := l2.abi.Pack("Do", val) - if err != nil { - panic(err) - } - return enc +func (l2 *L2) PackDo(val *big.Int) ([]byte, error) { + return l2.abi.Pack("Do", val) } // UnpackDo is the Go binding that unpacks the parameters returned @@ -301,12 +285,8 @@ func (c *L2b) Instance(backend bind.ContractBackend, addr common.Address) *bind. // the contract method with ID 0x2ad11272. // // Solidity: function Do(uint256 val) pure returns(uint256) -func (l2b *L2b) PackDo(val *big.Int) []byte { - enc, err := l2b.abi.Pack("Do", val) - if err != nil { - panic(err) - } - return enc +func (l2b *L2b) PackDo(val *big.Int) ([]byte, error) { + return l2b.abi.Pack("Do", val) } // UnpackDo is the Go binding that unpacks the parameters returned @@ -353,12 +333,8 @@ func (c *L3) Instance(backend bind.ContractBackend, addr common.Address) *bind.B // the contract method with ID 0x2ad11272. // // Solidity: function Do(uint256 val) pure returns(uint256) -func (l3 *L3) PackDo(val *big.Int) []byte { - enc, err := l3.abi.Pack("Do", val) - if err != nil { - panic(err) - } - return enc +func (l3 *L3) PackDo(val *big.Int) ([]byte, error) { + return l3.abi.Pack("Do", val) } // UnpackDo is the Go binding that unpacks the parameters returned @@ -409,12 +385,8 @@ func (c *L4) Instance(backend bind.ContractBackend, addr common.Address) *bind.B // the contract method with ID 0x2ad11272. // // Solidity: function Do(uint256 val) pure returns(uint256) -func (l4 *L4) PackDo(val *big.Int) []byte { - enc, err := l4.abi.Pack("Do", val) - if err != nil { - panic(err) - } - return enc +func (l4 *L4) PackDo(val *big.Int) ([]byte, error) { + return l4.abi.Pack("Do", val) } // UnpackDo is the Go binding that unpacks the parameters returned @@ -464,12 +436,8 @@ func (c *L4b) Instance(backend bind.ContractBackend, addr common.Address) *bind. // the contract method with ID 0x2ad11272. // // Solidity: function Do(uint256 val) pure returns(uint256) -func (l4b *L4b) PackDo(val *big.Int) []byte { - enc, err := l4b.abi.Pack("Do", val) - if err != nil { - panic(err) - } - return enc +func (l4b *L4b) PackDo(val *big.Int) ([]byte, error) { + return l4b.abi.Pack("Do", val) } // UnpackDo is the Go binding that unpacks the parameters returned diff --git a/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go b/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go index 067fb2b0e118..4f424577a37f 100644 --- a/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go @@ -55,24 +55,16 @@ func (c *C) Instance(backend bind.ContractBackend, addr common.Address) *bind.Bo // the contract method with ID 0xb0a378b0. // // Solidity: function Bar() pure returns() -func (c *C) PackBar() []byte { - enc, err := c.abi.Pack("Bar") - if err != nil { - panic(err) - } - return enc +func (c *C) PackBar() ([]byte, error) { + return c.abi.Pack("Bar") } // PackFoo is the Go binding used to pack the parameters required for calling // the contract method with ID 0xbfb4ebcf. // // Solidity: function Foo() pure returns() -func (c *C) PackFoo() []byte { - enc, err := c.abi.Pack("Foo") - if err != nil { - panic(err) - } - return enc +func (c *C) PackFoo() ([]byte, error) { + return c.abi.Pack("Foo") } // UnpackError attempts to decode the provided error data using user-defined @@ -172,12 +164,8 @@ func (c *C2) Instance(backend bind.ContractBackend, addr common.Address) *bind.B // the contract method with ID 0xbfb4ebcf. // // Solidity: function Foo() pure returns() -func (c2 *C2) PackFoo() []byte { - enc, err := c2.abi.Pack("Foo") - if err != nil { - panic(err) - } - return enc +func (c2 *C2) PackFoo() ([]byte, error) { + return c2.abi.Pack("Foo") } // UnpackError attempts to decode the provided error data using user-defined diff --git a/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go b/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go index badcd20894fa..dd09903d1887 100644 --- a/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go @@ -55,12 +55,8 @@ func (c *MyContract) Instance(backend bind.ContractBackend, addr common.Address) // the contract method with ID 0xbd6d1007. // // Solidity: function GetNums() pure returns(uint256[5]) -func (myContract *MyContract) PackGetNums() []byte { - enc, err := myContract.abi.Pack("GetNums") - if err != nil { - panic(err) - } - return enc +func (myContract *MyContract) PackGetNums() ([]byte, error) { + return myContract.abi.Pack("GetNums") } // UnpackGetNums is the Go binding that unpacks the parameters returned From 4c524e6b1db9bca7efaf3a7612f24ed0141d6670 Mon Sep 17 00:00:00 2001 From: maskpp Date: Tue, 22 Apr 2025 18:47:33 +0800 Subject: [PATCH 3/9] add TryPack template method --- accounts/abi/abigen/source2.go.tpl | 16 ++- .../bind/v2/internal/contracts/db/bindings.go | 80 +++++++++-- .../v2/internal/contracts/events/bindings.go | 32 ++++- .../contracts/nested_libraries/bindings.go | 128 +++++++++++++++--- .../contracts/solc_errors/bindings.go | 48 ++++++- .../contracts/uint256arrayreturn/bindings.go | 16 ++- 6 files changed, 280 insertions(+), 40 deletions(-) diff --git a/accounts/abi/abigen/source2.go.tpl b/accounts/abi/abigen/source2.go.tpl index 7c02b1ce245e..b61a2ff988a9 100644 --- a/accounts/abi/abigen/source2.go.tpl +++ b/accounts/abi/abigen/source2.go.tpl @@ -89,11 +89,23 @@ var ( {{ end }} {{range .Calls}} - // Pack{{.Normalized.Name}} is the Go binding used to pack the parameters required for calling + // Pack{{.Normalized.Name}} is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x{{printf "%x" .Original.ID}}. // // Solidity: {{.Original.String}} - func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) Pack{{.Normalized.Name}}({{range .Normalized.Inputs}} {{.Name}} {{bindtype .Type $structs}}, {{end}}) ([]byte, error) { + func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) Pack{{.Normalized.Name}}({{range .Normalized.Inputs}} {{.Name}} {{bindtype .Type $structs}}, {{end}}) []byte { + enc, err := {{ decapitalise $contract.Type}}.abi.Pack("{{.Original.Name}}" {{range .Normalized.Inputs}}, {{.Name}}{{end}}) + if err != nil { + panic(err) + } + return enc + } + + // Pack{{.Normalized.Name}} is the Go binding used to pack the parameters required for calling, return error if it failed to pack. + // the contract method with ID 0x{{printf "%x" .Original.ID}}. + // + // Solidity: {{.Original.String}} + func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) TryPack{{.Normalized.Name}}({{range .Normalized.Inputs}} {{.Name}} {{bindtype .Type $structs}}, {{end}}) ([]byte, error) { return {{ decapitalise $contract.Type}}.abi.Pack("{{.Original.Name}}" {{range .Normalized.Inputs}}, {{.Name}}{{end}}) } diff --git a/accounts/abi/bind/v2/internal/contracts/db/bindings.go b/accounts/abi/bind/v2/internal/contracts/db/bindings.go index fd54e53304da..b5ba69eaef64 100644 --- a/accounts/abi/bind/v2/internal/contracts/db/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/db/bindings.go @@ -58,11 +58,23 @@ func (c *DB) Instance(backend bind.ContractBackend, addr common.Address) *bind.B return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackGet is the Go binding used to pack the parameters required for calling +// PackGet is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x9507d39a. // // Solidity: function get(uint256 k) returns(uint256) -func (dB *DB) PackGet(k *big.Int) ([]byte, error) { +func (dB *DB) PackGet(k *big.Int) []byte { + enc, err := dB.abi.Pack("get", k) + if err != nil { + panic(err) + } + return enc +} + +// PackGet is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x9507d39a. +// +// Solidity: function get(uint256 k) returns(uint256) +func (dB *DB) TryPackGet(k *big.Int) ([]byte, error) { return dB.abi.Pack("get", k) } @@ -79,11 +91,23 @@ func (dB *DB) UnpackGet(data []byte) (*big.Int, error) { return out0, nil } -// PackGetNamedStatParams is the Go binding used to pack the parameters required for calling +// PackGetNamedStatParams is the Go binding used to pack the parameters required for calling, will panic for any error. +// the contract method with ID 0xe369ba3b. +// +// Solidity: function getNamedStatParams() view returns(uint256 gets, uint256 inserts, uint256 mods) +func (dB *DB) PackGetNamedStatParams() []byte { + enc, err := dB.abi.Pack("getNamedStatParams") + if err != nil { + panic(err) + } + return enc +} + +// PackGetNamedStatParams is the Go binding used to pack the parameters required for calling, return error if it failed to pack. // the contract method with ID 0xe369ba3b. // // Solidity: function getNamedStatParams() view returns(uint256 gets, uint256 inserts, uint256 mods) -func (dB *DB) PackGetNamedStatParams() ([]byte, error) { +func (dB *DB) TryPackGetNamedStatParams() ([]byte, error) { return dB.abi.Pack("getNamedStatParams") } @@ -111,11 +135,23 @@ func (dB *DB) UnpackGetNamedStatParams(data []byte) (*GetNamedStatParamsOutput, return outstruct, nil } -// PackGetStatParams is the Go binding used to pack the parameters required for calling +// PackGetStatParams is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x6fcb9c70. // // Solidity: function getStatParams() view returns(uint256, uint256, uint256) -func (dB *DB) PackGetStatParams() ([]byte, error) { +func (dB *DB) PackGetStatParams() []byte { + enc, err := dB.abi.Pack("getStatParams") + if err != nil { + panic(err) + } + return enc +} + +// PackGetStatParams is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x6fcb9c70. +// +// Solidity: function getStatParams() view returns(uint256, uint256, uint256) +func (dB *DB) TryPackGetStatParams() ([]byte, error) { return dB.abi.Pack("getStatParams") } @@ -143,11 +179,23 @@ func (dB *DB) UnpackGetStatParams(data []byte) (*GetStatParamsOutput, error) { return outstruct, nil } -// PackGetStatsStruct is the Go binding used to pack the parameters required for calling +// PackGetStatsStruct is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xee8161e0. // // Solidity: function getStatsStruct() view returns((uint256,uint256,uint256)) -func (dB *DB) PackGetStatsStruct() ([]byte, error) { +func (dB *DB) PackGetStatsStruct() []byte { + enc, err := dB.abi.Pack("getStatsStruct") + if err != nil { + panic(err) + } + return enc +} + +// PackGetStatsStruct is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xee8161e0. +// +// Solidity: function getStatsStruct() view returns((uint256,uint256,uint256)) +func (dB *DB) TryPackGetStatsStruct() ([]byte, error) { return dB.abi.Pack("getStatsStruct") } @@ -164,11 +212,23 @@ func (dB *DB) UnpackGetStatsStruct(data []byte) (DBStats, error) { return out0, nil } -// PackInsert is the Go binding used to pack the parameters required for calling +// PackInsert is the Go binding used to pack the parameters required for calling, will panic for any error. +// the contract method with ID 0x1d834a1b. +// +// Solidity: function insert(uint256 k, uint256 v) returns(uint256) +func (dB *DB) PackInsert(k *big.Int, v *big.Int) []byte { + enc, err := dB.abi.Pack("insert", k, v) + if err != nil { + panic(err) + } + return enc +} + +// PackInsert is the Go binding used to pack the parameters required for calling, return error if it failed to pack. // the contract method with ID 0x1d834a1b. // // Solidity: function insert(uint256 k, uint256 v) returns(uint256) -func (dB *DB) PackInsert(k *big.Int, v *big.Int) ([]byte, error) { +func (dB *DB) TryPackInsert(k *big.Int, v *big.Int) ([]byte, error) { return dB.abi.Pack("insert", k, v) } diff --git a/accounts/abi/bind/v2/internal/contracts/events/bindings.go b/accounts/abi/bind/v2/internal/contracts/events/bindings.go index a4bf69bcc69a..f2918afb6411 100644 --- a/accounts/abi/bind/v2/internal/contracts/events/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/events/bindings.go @@ -51,19 +51,43 @@ func (c *C) Instance(backend bind.ContractBackend, addr common.Address) *bind.Bo return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackEmitMulti is the Go binding used to pack the parameters required for calling +// PackEmitMulti is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xcb493749. // // Solidity: function EmitMulti() returns() -func (c *C) PackEmitMulti() ([]byte, error) { +func (c *C) PackEmitMulti() []byte { + enc, err := c.abi.Pack("EmitMulti") + if err != nil { + panic(err) + } + return enc +} + +// PackEmitMulti is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xcb493749. +// +// Solidity: function EmitMulti() returns() +func (c *C) TryPackEmitMulti() ([]byte, error) { return c.abi.Pack("EmitMulti") } -// PackEmitOne is the Go binding used to pack the parameters required for calling +// PackEmitOne is the Go binding used to pack the parameters required for calling, will panic for any error. +// the contract method with ID 0xe8e49a71. +// +// Solidity: function EmitOne() returns() +func (c *C) PackEmitOne() []byte { + enc, err := c.abi.Pack("EmitOne") + if err != nil { + panic(err) + } + return enc +} + +// PackEmitOne is the Go binding used to pack the parameters required for calling, return error if it failed to pack. // the contract method with ID 0xe8e49a71. // // Solidity: function EmitOne() returns() -func (c *C) PackEmitOne() ([]byte, error) { +func (c *C) TryPackEmitOne() ([]byte, error) { return c.abi.Pack("EmitOne") } diff --git a/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go b/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go index dc4751596f45..2a3d21a37c85 100644 --- a/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go @@ -67,11 +67,23 @@ func (c1 *C1) PackConstructor(v1 *big.Int, v2 *big.Int) []byte { return enc } -// PackDo is the Go binding used to pack the parameters required for calling +// PackDo is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x2ad11272. // // Solidity: function Do(uint256 val) pure returns(uint256 res) -func (c1 *C1) PackDo(val *big.Int) ([]byte, error) { +func (c1 *C1) PackDo(val *big.Int) []byte { + enc, err := c1.abi.Pack("Do", val) + if err != nil { + panic(err) + } + return enc +} + +// PackDo is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x2ad11272. +// +// Solidity: function Do(uint256 val) pure returns(uint256 res) +func (c1 *C1) TryPackDo(val *big.Int) ([]byte, error) { return c1.abi.Pack("Do", val) } @@ -131,11 +143,23 @@ func (c2 *C2) PackConstructor(v1 *big.Int, v2 *big.Int) []byte { return enc } -// PackDo is the Go binding used to pack the parameters required for calling +// PackDo is the Go binding used to pack the parameters required for calling, will panic for any error. +// the contract method with ID 0x2ad11272. +// +// Solidity: function Do(uint256 val) pure returns(uint256 res) +func (c2 *C2) PackDo(val *big.Int) []byte { + enc, err := c2.abi.Pack("Do", val) + if err != nil { + panic(err) + } + return enc +} + +// PackDo is the Go binding used to pack the parameters required for calling, return error if it failed to pack. // the contract method with ID 0x2ad11272. // // Solidity: function Do(uint256 val) pure returns(uint256 res) -func (c2 *C2) PackDo(val *big.Int) ([]byte, error) { +func (c2 *C2) TryPackDo(val *big.Int) ([]byte, error) { return c2.abi.Pack("Do", val) } @@ -179,11 +203,23 @@ func (c *L1) Instance(backend bind.ContractBackend, addr common.Address) *bind.B return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackDo is the Go binding used to pack the parameters required for calling +// PackDo is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x2ad11272. // // Solidity: function Do(uint256 val) pure returns(uint256) -func (l1 *L1) PackDo(val *big.Int) ([]byte, error) { +func (l1 *L1) PackDo(val *big.Int) []byte { + enc, err := l1.abi.Pack("Do", val) + if err != nil { + panic(err) + } + return enc +} + +// PackDo is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x2ad11272. +// +// Solidity: function Do(uint256 val) pure returns(uint256) +func (l1 *L1) TryPackDo(val *big.Int) ([]byte, error) { return l1.abi.Pack("Do", val) } @@ -230,11 +266,23 @@ func (c *L2) Instance(backend bind.ContractBackend, addr common.Address) *bind.B return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackDo is the Go binding used to pack the parameters required for calling +// PackDo is the Go binding used to pack the parameters required for calling, will panic for any error. +// the contract method with ID 0x2ad11272. +// +// Solidity: function Do(uint256 val) pure returns(uint256) +func (l2 *L2) PackDo(val *big.Int) []byte { + enc, err := l2.abi.Pack("Do", val) + if err != nil { + panic(err) + } + return enc +} + +// PackDo is the Go binding used to pack the parameters required for calling, return error if it failed to pack. // the contract method with ID 0x2ad11272. // // Solidity: function Do(uint256 val) pure returns(uint256) -func (l2 *L2) PackDo(val *big.Int) ([]byte, error) { +func (l2 *L2) TryPackDo(val *big.Int) ([]byte, error) { return l2.abi.Pack("Do", val) } @@ -281,11 +329,23 @@ func (c *L2b) Instance(backend bind.ContractBackend, addr common.Address) *bind. return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackDo is the Go binding used to pack the parameters required for calling +// PackDo is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x2ad11272. // // Solidity: function Do(uint256 val) pure returns(uint256) -func (l2b *L2b) PackDo(val *big.Int) ([]byte, error) { +func (l2b *L2b) PackDo(val *big.Int) []byte { + enc, err := l2b.abi.Pack("Do", val) + if err != nil { + panic(err) + } + return enc +} + +// PackDo is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x2ad11272. +// +// Solidity: function Do(uint256 val) pure returns(uint256) +func (l2b *L2b) TryPackDo(val *big.Int) ([]byte, error) { return l2b.abi.Pack("Do", val) } @@ -329,11 +389,23 @@ func (c *L3) Instance(backend bind.ContractBackend, addr common.Address) *bind.B return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackDo is the Go binding used to pack the parameters required for calling +// PackDo is the Go binding used to pack the parameters required for calling, will panic for any error. +// the contract method with ID 0x2ad11272. +// +// Solidity: function Do(uint256 val) pure returns(uint256) +func (l3 *L3) PackDo(val *big.Int) []byte { + enc, err := l3.abi.Pack("Do", val) + if err != nil { + panic(err) + } + return enc +} + +// PackDo is the Go binding used to pack the parameters required for calling, return error if it failed to pack. // the contract method with ID 0x2ad11272. // // Solidity: function Do(uint256 val) pure returns(uint256) -func (l3 *L3) PackDo(val *big.Int) ([]byte, error) { +func (l3 *L3) TryPackDo(val *big.Int) ([]byte, error) { return l3.abi.Pack("Do", val) } @@ -381,11 +453,23 @@ func (c *L4) Instance(backend bind.ContractBackend, addr common.Address) *bind.B return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackDo is the Go binding used to pack the parameters required for calling +// PackDo is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x2ad11272. // // Solidity: function Do(uint256 val) pure returns(uint256) -func (l4 *L4) PackDo(val *big.Int) ([]byte, error) { +func (l4 *L4) PackDo(val *big.Int) []byte { + enc, err := l4.abi.Pack("Do", val) + if err != nil { + panic(err) + } + return enc +} + +// PackDo is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x2ad11272. +// +// Solidity: function Do(uint256 val) pure returns(uint256) +func (l4 *L4) TryPackDo(val *big.Int) ([]byte, error) { return l4.abi.Pack("Do", val) } @@ -432,11 +516,23 @@ func (c *L4b) Instance(backend bind.ContractBackend, addr common.Address) *bind. return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackDo is the Go binding used to pack the parameters required for calling +// PackDo is the Go binding used to pack the parameters required for calling, will panic for any error. +// the contract method with ID 0x2ad11272. +// +// Solidity: function Do(uint256 val) pure returns(uint256) +func (l4b *L4b) PackDo(val *big.Int) []byte { + enc, err := l4b.abi.Pack("Do", val) + if err != nil { + panic(err) + } + return enc +} + +// PackDo is the Go binding used to pack the parameters required for calling, return error if it failed to pack. // the contract method with ID 0x2ad11272. // // Solidity: function Do(uint256 val) pure returns(uint256) -func (l4b *L4b) PackDo(val *big.Int) ([]byte, error) { +func (l4b *L4b) TryPackDo(val *big.Int) ([]byte, error) { return l4b.abi.Pack("Do", val) } diff --git a/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go b/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go index 4f424577a37f..3ea8489b8281 100644 --- a/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go @@ -51,19 +51,43 @@ func (c *C) Instance(backend bind.ContractBackend, addr common.Address) *bind.Bo return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackBar is the Go binding used to pack the parameters required for calling +// PackBar is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xb0a378b0. // // Solidity: function Bar() pure returns() -func (c *C) PackBar() ([]byte, error) { +func (c *C) PackBar() []byte { + enc, err := c.abi.Pack("Bar") + if err != nil { + panic(err) + } + return enc +} + +// PackBar is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xb0a378b0. +// +// Solidity: function Bar() pure returns() +func (c *C) TryPackBar() ([]byte, error) { return c.abi.Pack("Bar") } -// PackFoo is the Go binding used to pack the parameters required for calling +// PackFoo is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xbfb4ebcf. // // Solidity: function Foo() pure returns() -func (c *C) PackFoo() ([]byte, error) { +func (c *C) PackFoo() []byte { + enc, err := c.abi.Pack("Foo") + if err != nil { + panic(err) + } + return enc +} + +// PackFoo is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xbfb4ebcf. +// +// Solidity: function Foo() pure returns() +func (c *C) TryPackFoo() ([]byte, error) { return c.abi.Pack("Foo") } @@ -160,11 +184,23 @@ func (c *C2) Instance(backend bind.ContractBackend, addr common.Address) *bind.B return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackFoo is the Go binding used to pack the parameters required for calling +// PackFoo is the Go binding used to pack the parameters required for calling, will panic for any error. +// the contract method with ID 0xbfb4ebcf. +// +// Solidity: function Foo() pure returns() +func (c2 *C2) PackFoo() []byte { + enc, err := c2.abi.Pack("Foo") + if err != nil { + panic(err) + } + return enc +} + +// PackFoo is the Go binding used to pack the parameters required for calling, return error if it failed to pack. // the contract method with ID 0xbfb4ebcf. // // Solidity: function Foo() pure returns() -func (c2 *C2) PackFoo() ([]byte, error) { +func (c2 *C2) TryPackFoo() ([]byte, error) { return c2.abi.Pack("Foo") } diff --git a/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go b/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go index dd09903d1887..c336198c8890 100644 --- a/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go @@ -51,11 +51,23 @@ func (c *MyContract) Instance(backend bind.ContractBackend, addr common.Address) return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackGetNums is the Go binding used to pack the parameters required for calling +// PackGetNums is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xbd6d1007. // // Solidity: function GetNums() pure returns(uint256[5]) -func (myContract *MyContract) PackGetNums() ([]byte, error) { +func (myContract *MyContract) PackGetNums() []byte { + enc, err := myContract.abi.Pack("GetNums") + if err != nil { + panic(err) + } + return enc +} + +// PackGetNums is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xbd6d1007. +// +// Solidity: function GetNums() pure returns(uint256[5]) +func (myContract *MyContract) TryPackGetNums() ([]byte, error) { return myContract.abi.Pack("GetNums") } From 77ef9beb649405814a9d85bd20bcdedf881655dd Mon Sep 17 00:00:00 2001 From: maskpp Date: Wed, 23 Apr 2025 21:01:49 +0800 Subject: [PATCH 4/9] fix bug --- accounts/abi/abigen/source2.go.tpl | 2 +- accounts/abi/bind/v2/internal/contracts/db/bindings.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/accounts/abi/abigen/source2.go.tpl b/accounts/abi/abigen/source2.go.tpl index b61a2ff988a9..871b300f5473 100644 --- a/accounts/abi/abigen/source2.go.tpl +++ b/accounts/abi/abigen/source2.go.tpl @@ -132,7 +132,7 @@ var ( {{- if .Structured}} outstruct := new({{.Normalized.Name}}Output) if err != nil { - return outstruct, nil + return nil, err } {{- range $i, $t := .Normalized.Outputs}} {{- if ispointertype .Type}} diff --git a/accounts/abi/bind/v2/internal/contracts/db/bindings.go b/accounts/abi/bind/v2/internal/contracts/db/bindings.go index b5ba69eaef64..ec6efc885d7a 100644 --- a/accounts/abi/bind/v2/internal/contracts/db/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/db/bindings.go @@ -127,7 +127,7 @@ func (dB *DB) UnpackGetNamedStatParams(data []byte) (*GetNamedStatParamsOutput, out, err := dB.abi.Unpack("getNamedStatParams", data) outstruct := new(GetNamedStatParamsOutput) if err != nil { - return outstruct, nil + return nil, err } outstruct.Gets = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Inserts = abi.ConvertType(out[1], new(big.Int)).(*big.Int) @@ -171,7 +171,7 @@ func (dB *DB) UnpackGetStatParams(data []byte) (*GetStatParamsOutput, error) { out, err := dB.abi.Unpack("getStatParams", data) outstruct := new(GetStatParamsOutput) if err != nil { - return outstruct, nil + return nil, err } outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) From 88d18ce3ac2ab4f9d7951b1a30b206c4a72dfa08 Mon Sep 17 00:00:00 2001 From: maskpp Date: Wed, 23 Apr 2025 21:05:20 +0800 Subject: [PATCH 5/9] upgrade code --- accounts/abi/abigen/source2.go.tpl | 2 +- accounts/abi/bind/v2/internal/contracts/db/bindings.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/accounts/abi/abigen/source2.go.tpl b/accounts/abi/abigen/source2.go.tpl index 871b300f5473..4131cd884174 100644 --- a/accounts/abi/abigen/source2.go.tpl +++ b/accounts/abi/abigen/source2.go.tpl @@ -130,10 +130,10 @@ var ( {{- end }} error) { out, err := {{ decapitalise $contract.Type}}.abi.Unpack("{{.Original.Name}}", data) {{- if .Structured}} - outstruct := new({{.Normalized.Name}}Output) if err != nil { return nil, err } + outstruct := new({{.Normalized.Name}}Output) {{- range $i, $t := .Normalized.Outputs}} {{- if ispointertype .Type}} outstruct.{{capitalise .Name}} = abi.ConvertType(out[{{$i}}], new({{underlyingbindtype .Type }})).({{bindtype .Type $structs}}) diff --git a/accounts/abi/bind/v2/internal/contracts/db/bindings.go b/accounts/abi/bind/v2/internal/contracts/db/bindings.go index ec6efc885d7a..93cd2a491bdd 100644 --- a/accounts/abi/bind/v2/internal/contracts/db/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/db/bindings.go @@ -125,10 +125,10 @@ type GetNamedStatParamsOutput struct { // Solidity: function getNamedStatParams() view returns(uint256 gets, uint256 inserts, uint256 mods) func (dB *DB) UnpackGetNamedStatParams(data []byte) (*GetNamedStatParamsOutput, error) { out, err := dB.abi.Unpack("getNamedStatParams", data) - outstruct := new(GetNamedStatParamsOutput) if err != nil { return nil, err } + outstruct := new(GetNamedStatParamsOutput) outstruct.Gets = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Inserts = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Mods = abi.ConvertType(out[2], new(big.Int)).(*big.Int) @@ -169,10 +169,10 @@ type GetStatParamsOutput struct { // Solidity: function getStatParams() view returns(uint256, uint256, uint256) func (dB *DB) UnpackGetStatParams(data []byte) (*GetStatParamsOutput, error) { out, err := dB.abi.Unpack("getStatParams", data) - outstruct := new(GetStatParamsOutput) if err != nil { return nil, err } + outstruct := new(GetStatParamsOutput) outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Arg2 = abi.ConvertType(out[2], new(big.Int)).(*big.Int) From 06e001dc5dd8ce5130843e4bf8b5d174a0cbc734 Mon Sep 17 00:00:00 2001 From: maskpp Date: Wed, 23 Apr 2025 22:54:38 +0800 Subject: [PATCH 6/9] update testdata --- accounts/abi/abigen/bindv2_test.go | 2 +- .../abigen/testdata/v2/callbackparam.go.txt | 10 +- .../abi/abigen/testdata/v2/crowdsale.go.txt | 101 ++++++++-- accounts/abi/abigen/testdata/v2/dao.go.txt | 188 ++++++++++++++---- .../testdata/v2/deeplynestedarray.go.txt | 34 +++- accounts/abi/abigen/testdata/v2/getter.go.txt | 19 +- .../testdata/v2/identifiercollision.go.txt | 24 ++- .../abigen/testdata/v2/inputchecker.go.txt | 60 +++++- .../abi/abigen/testdata/v2/interactor.go.txt | 34 +++- .../abigen/testdata/v2/nameconflict.go.txt | 22 +- .../testdata/v2/numericmethodname.go.txt | 30 ++- .../abigen/testdata/v2/outputchecker.go.txt | 110 +++++++--- .../abi/abigen/testdata/v2/overload.go.txt | 20 +- .../abigen/testdata/v2/rangekeyword.go.txt | 10 +- accounts/abi/abigen/testdata/v2/slicer.go.txt | 48 ++++- .../abi/abigen/testdata/v2/structs.go.txt | 31 ++- accounts/abi/abigen/testdata/v2/token.go.txt | 106 ++++++++-- accounts/abi/abigen/testdata/v2/tuple.go.txt | 39 +++- accounts/abi/abigen/testdata/v2/tupler.go.txt | 19 +- .../abi/abigen/testdata/v2/underscorer.go.txt | 145 ++++++++++---- 20 files changed, 841 insertions(+), 211 deletions(-) diff --git a/accounts/abi/abigen/bindv2_test.go b/accounts/abi/abigen/bindv2_test.go index 2756ba0835e2..ee943f1c3f37 100644 --- a/accounts/abi/abigen/bindv2_test.go +++ b/accounts/abi/abigen/bindv2_test.go @@ -281,7 +281,7 @@ func TestBindingV2ConvertedV1Tests(t *testing.T) { } // Set this environment variable to regenerate the test outputs. if os.Getenv("WRITE_TEST_FILES") != "" { - if err := os.WriteFile((fname), []byte(have), 0666); err != nil { + if err := os.WriteFile(fname, []byte(have), 0666); err != nil { t.Fatalf("err writing expected output to file: %v\n", err) } } diff --git a/accounts/abi/abigen/testdata/v2/callbackparam.go.txt b/accounts/abi/abigen/testdata/v2/callbackparam.go.txt index e3205bde0dc7..d3abab505499 100644 --- a/accounts/abi/abigen/testdata/v2/callbackparam.go.txt +++ b/accounts/abi/abigen/testdata/v2/callbackparam.go.txt @@ -51,7 +51,7 @@ func (c *CallbackParam) Instance(backend bind.ContractBackend, addr common.Addre return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackTest is the Go binding used to pack the parameters required for calling +// PackTest is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xd7a5aba2. // // Solidity: function test(function callback) returns() @@ -62,3 +62,11 @@ func (callbackParam *CallbackParam) PackTest(callback [24]byte) []byte { } return enc } + +// PackTest is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xd7a5aba2. +// +// Solidity: function test(function callback) returns() +func (callbackParam *CallbackParam) TryPackTest(callback [24]byte) ([]byte, error) { + return callbackParam.abi.Pack("test", callback) +} diff --git a/accounts/abi/abigen/testdata/v2/crowdsale.go.txt b/accounts/abi/abigen/testdata/v2/crowdsale.go.txt index 60d8b4ec11bd..078784e20f12 100644 --- a/accounts/abi/abigen/testdata/v2/crowdsale.go.txt +++ b/accounts/abi/abigen/testdata/v2/crowdsale.go.txt @@ -63,7 +63,7 @@ func (crowdsale *Crowdsale) PackConstructor(ifSuccessfulSendTo common.Address, f return enc } -// PackAmountRaised is the Go binding used to pack the parameters required for calling +// PackAmountRaised is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x7b3e5e7b. // // Solidity: function amountRaised() returns(uint256) @@ -75,6 +75,14 @@ func (crowdsale *Crowdsale) PackAmountRaised() []byte { return enc } +// PackAmountRaised is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x7b3e5e7b. +// +// Solidity: function amountRaised() returns(uint256) +func (crowdsale *Crowdsale) TryPackAmountRaised() ([]byte, error) { + return crowdsale.abi.Pack("amountRaised") +} + // UnpackAmountRaised is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x7b3e5e7b. // @@ -85,10 +93,10 @@ func (crowdsale *Crowdsale) UnpackAmountRaised(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackBeneficiary is the Go binding used to pack the parameters required for calling +// PackBeneficiary is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x38af3eed. // // Solidity: function beneficiary() returns(address) @@ -100,6 +108,14 @@ func (crowdsale *Crowdsale) PackBeneficiary() []byte { return enc } +// PackBeneficiary is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x38af3eed. +// +// Solidity: function beneficiary() returns(address) +func (crowdsale *Crowdsale) TryPackBeneficiary() ([]byte, error) { + return crowdsale.abi.Pack("beneficiary") +} + // UnpackBeneficiary is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x38af3eed. // @@ -110,10 +126,10 @@ func (crowdsale *Crowdsale) UnpackBeneficiary(data []byte) (common.Address, erro return *new(common.Address), err } out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - return out0, err + return out0, nil } -// PackCheckGoalReached is the Go binding used to pack the parameters required for calling +// PackCheckGoalReached is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x01cb3b20. // // Solidity: function checkGoalReached() returns() @@ -125,7 +141,15 @@ func (crowdsale *Crowdsale) PackCheckGoalReached() []byte { return enc } -// PackDeadline is the Go binding used to pack the parameters required for calling +// PackCheckGoalReached is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x01cb3b20. +// +// Solidity: function checkGoalReached() returns() +func (crowdsale *Crowdsale) TryPackCheckGoalReached() ([]byte, error) { + return crowdsale.abi.Pack("checkGoalReached") +} + +// PackDeadline is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x29dcb0cf. // // Solidity: function deadline() returns(uint256) @@ -137,6 +161,14 @@ func (crowdsale *Crowdsale) PackDeadline() []byte { return enc } +// PackDeadline is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x29dcb0cf. +// +// Solidity: function deadline() returns(uint256) +func (crowdsale *Crowdsale) TryPackDeadline() ([]byte, error) { + return crowdsale.abi.Pack("deadline") +} + // UnpackDeadline is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x29dcb0cf. // @@ -147,10 +179,10 @@ func (crowdsale *Crowdsale) UnpackDeadline(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackFunders is the Go binding used to pack the parameters required for calling +// PackFunders is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xdc0d3dff. // // Solidity: function funders(uint256 ) returns(address addr, uint256 amount) @@ -162,6 +194,14 @@ func (crowdsale *Crowdsale) PackFunders(arg0 *big.Int) []byte { return enc } +// PackFunders is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xdc0d3dff. +// +// Solidity: function funders(uint256 ) returns(address addr, uint256 amount) +func (crowdsale *Crowdsale) TryPackFunders(arg0 *big.Int) ([]byte, error) { + return crowdsale.abi.Pack("funders", arg0) +} + // FundersOutput serves as a container for the return parameters of contract // method Funders. type FundersOutput struct { @@ -173,19 +213,18 @@ type FundersOutput struct { // from invoking the contract method with ID 0xdc0d3dff. // // Solidity: function funders(uint256 ) returns(address addr, uint256 amount) -func (crowdsale *Crowdsale) UnpackFunders(data []byte) (FundersOutput, error) { +func (crowdsale *Crowdsale) UnpackFunders(data []byte) (*FundersOutput, error) { out, err := crowdsale.abi.Unpack("funders", data) - outstruct := new(FundersOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(FundersOutput) outstruct.Addr = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) outstruct.Amount = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return *outstruct, err - + return outstruct, nil } -// PackFundingGoal is the Go binding used to pack the parameters required for calling +// PackFundingGoal is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x7a3a0e84. // // Solidity: function fundingGoal() returns(uint256) @@ -197,6 +236,14 @@ func (crowdsale *Crowdsale) PackFundingGoal() []byte { return enc } +// PackFundingGoal is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x7a3a0e84. +// +// Solidity: function fundingGoal() returns(uint256) +func (crowdsale *Crowdsale) TryPackFundingGoal() ([]byte, error) { + return crowdsale.abi.Pack("fundingGoal") +} + // UnpackFundingGoal is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x7a3a0e84. // @@ -207,10 +254,10 @@ func (crowdsale *Crowdsale) UnpackFundingGoal(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackPrice is the Go binding used to pack the parameters required for calling +// PackPrice is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xa035b1fe. // // Solidity: function price() returns(uint256) @@ -222,6 +269,14 @@ func (crowdsale *Crowdsale) PackPrice() []byte { return enc } +// PackPrice is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xa035b1fe. +// +// Solidity: function price() returns(uint256) +func (crowdsale *Crowdsale) TryPackPrice() ([]byte, error) { + return crowdsale.abi.Pack("price") +} + // UnpackPrice is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xa035b1fe. // @@ -232,10 +287,10 @@ func (crowdsale *Crowdsale) UnpackPrice(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackTokenReward is the Go binding used to pack the parameters required for calling +// PackTokenReward is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x6e66f6e9. // // Solidity: function tokenReward() returns(address) @@ -247,6 +302,14 @@ func (crowdsale *Crowdsale) PackTokenReward() []byte { return enc } +// PackTokenReward is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x6e66f6e9. +// +// Solidity: function tokenReward() returns(address) +func (crowdsale *Crowdsale) TryPackTokenReward() ([]byte, error) { + return crowdsale.abi.Pack("tokenReward") +} + // UnpackTokenReward is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x6e66f6e9. // @@ -257,7 +320,7 @@ func (crowdsale *Crowdsale) UnpackTokenReward(data []byte) (common.Address, erro return *new(common.Address), err } out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - return out0, err + return out0, nil } // CrowdsaleFundTransfer represents a FundTransfer event raised by the Crowdsale contract. diff --git a/accounts/abi/abigen/testdata/v2/dao.go.txt b/accounts/abi/abigen/testdata/v2/dao.go.txt index 72a80949f6c5..0c656b54cecd 100644 --- a/accounts/abi/abigen/testdata/v2/dao.go.txt +++ b/accounts/abi/abigen/testdata/v2/dao.go.txt @@ -63,7 +63,7 @@ func (dAO *DAO) PackConstructor(minimumQuorumForProposals *big.Int, minutesForDe return enc } -// PackChangeMembership is the Go binding used to pack the parameters required for calling +// PackChangeMembership is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x9644fcbd. // // Solidity: function changeMembership(address targetMember, bool canVote, string memberName) returns() @@ -75,7 +75,15 @@ func (dAO *DAO) PackChangeMembership(targetMember common.Address, canVote bool, return enc } -// PackChangeVotingRules is the Go binding used to pack the parameters required for calling +// PackChangeMembership is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x9644fcbd. +// +// Solidity: function changeMembership(address targetMember, bool canVote, string memberName) returns() +func (dAO *DAO) TryPackChangeMembership(targetMember common.Address, canVote bool, memberName string) ([]byte, error) { + return dAO.abi.Pack("changeMembership", targetMember, canVote, memberName) +} + +// PackChangeVotingRules is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xbcca1fd3. // // Solidity: function changeVotingRules(uint256 minimumQuorumForProposals, uint256 minutesForDebate, int256 marginOfVotesForMajority) returns() @@ -87,7 +95,15 @@ func (dAO *DAO) PackChangeVotingRules(minimumQuorumForProposals *big.Int, minute return enc } -// PackCheckProposalCode is the Go binding used to pack the parameters required for calling +// PackChangeVotingRules is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xbcca1fd3. +// +// Solidity: function changeVotingRules(uint256 minimumQuorumForProposals, uint256 minutesForDebate, int256 marginOfVotesForMajority) returns() +func (dAO *DAO) TryPackChangeVotingRules(minimumQuorumForProposals *big.Int, minutesForDebate *big.Int, marginOfVotesForMajority *big.Int) ([]byte, error) { + return dAO.abi.Pack("changeVotingRules", minimumQuorumForProposals, minutesForDebate, marginOfVotesForMajority) +} + +// PackCheckProposalCode is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xeceb2945. // // Solidity: function checkProposalCode(uint256 proposalNumber, address beneficiary, uint256 etherAmount, bytes transactionBytecode) returns(bool codeChecksOut) @@ -99,6 +115,14 @@ func (dAO *DAO) PackCheckProposalCode(proposalNumber *big.Int, beneficiary commo return enc } +// PackCheckProposalCode is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xeceb2945. +// +// Solidity: function checkProposalCode(uint256 proposalNumber, address beneficiary, uint256 etherAmount, bytes transactionBytecode) returns(bool codeChecksOut) +func (dAO *DAO) TryPackCheckProposalCode(proposalNumber *big.Int, beneficiary common.Address, etherAmount *big.Int, transactionBytecode []byte) ([]byte, error) { + return dAO.abi.Pack("checkProposalCode", proposalNumber, beneficiary, etherAmount, transactionBytecode) +} + // UnpackCheckProposalCode is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xeceb2945. // @@ -109,10 +133,10 @@ func (dAO *DAO) UnpackCheckProposalCode(data []byte) (bool, error) { return *new(bool), err } out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - return out0, err + return out0, nil } -// PackDebatingPeriodInMinutes is the Go binding used to pack the parameters required for calling +// PackDebatingPeriodInMinutes is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x69bd3436. // // Solidity: function debatingPeriodInMinutes() returns(uint256) @@ -124,6 +148,14 @@ func (dAO *DAO) PackDebatingPeriodInMinutes() []byte { return enc } +// PackDebatingPeriodInMinutes is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x69bd3436. +// +// Solidity: function debatingPeriodInMinutes() returns(uint256) +func (dAO *DAO) TryPackDebatingPeriodInMinutes() ([]byte, error) { + return dAO.abi.Pack("debatingPeriodInMinutes") +} + // UnpackDebatingPeriodInMinutes is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x69bd3436. // @@ -134,10 +166,10 @@ func (dAO *DAO) UnpackDebatingPeriodInMinutes(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackExecuteProposal is the Go binding used to pack the parameters required for calling +// PackExecuteProposal is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x237e9492. // // Solidity: function executeProposal(uint256 proposalNumber, bytes transactionBytecode) returns(int256 result) @@ -149,6 +181,14 @@ func (dAO *DAO) PackExecuteProposal(proposalNumber *big.Int, transactionBytecode return enc } +// PackExecuteProposal is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x237e9492. +// +// Solidity: function executeProposal(uint256 proposalNumber, bytes transactionBytecode) returns(int256 result) +func (dAO *DAO) TryPackExecuteProposal(proposalNumber *big.Int, transactionBytecode []byte) ([]byte, error) { + return dAO.abi.Pack("executeProposal", proposalNumber, transactionBytecode) +} + // UnpackExecuteProposal is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x237e9492. // @@ -159,10 +199,10 @@ func (dAO *DAO) UnpackExecuteProposal(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackMajorityMargin is the Go binding used to pack the parameters required for calling +// PackMajorityMargin is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xaa02a90f. // // Solidity: function majorityMargin() returns(int256) @@ -174,6 +214,14 @@ func (dAO *DAO) PackMajorityMargin() []byte { return enc } +// PackMajorityMargin is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xaa02a90f. +// +// Solidity: function majorityMargin() returns(int256) +func (dAO *DAO) TryPackMajorityMargin() ([]byte, error) { + return dAO.abi.Pack("majorityMargin") +} + // UnpackMajorityMargin is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xaa02a90f. // @@ -184,10 +232,10 @@ func (dAO *DAO) UnpackMajorityMargin(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackMemberId is the Go binding used to pack the parameters required for calling +// PackMemberId is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x39106821. // // Solidity: function memberId(address ) returns(uint256) @@ -199,6 +247,14 @@ func (dAO *DAO) PackMemberId(arg0 common.Address) []byte { return enc } +// PackMemberId is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x39106821. +// +// Solidity: function memberId(address ) returns(uint256) +func (dAO *DAO) TryPackMemberId(arg0 common.Address) ([]byte, error) { + return dAO.abi.Pack("memberId", arg0) +} + // UnpackMemberId is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x39106821. // @@ -209,10 +265,10 @@ func (dAO *DAO) UnpackMemberId(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackMembers is the Go binding used to pack the parameters required for calling +// PackMembers is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x5daf08ca. // // Solidity: function members(uint256 ) returns(address member, bool canVote, string name, uint256 memberSince) @@ -224,6 +280,14 @@ func (dAO *DAO) PackMembers(arg0 *big.Int) []byte { return enc } +// PackMembers is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x5daf08ca. +// +// Solidity: function members(uint256 ) returns(address member, bool canVote, string name, uint256 memberSince) +func (dAO *DAO) TryPackMembers(arg0 *big.Int) ([]byte, error) { + return dAO.abi.Pack("members", arg0) +} + // MembersOutput serves as a container for the return parameters of contract // method Members. type MembersOutput struct { @@ -237,21 +301,20 @@ type MembersOutput struct { // from invoking the contract method with ID 0x5daf08ca. // // Solidity: function members(uint256 ) returns(address member, bool canVote, string name, uint256 memberSince) -func (dAO *DAO) UnpackMembers(data []byte) (MembersOutput, error) { +func (dAO *DAO) UnpackMembers(data []byte) (*MembersOutput, error) { out, err := dAO.abi.Unpack("members", data) - outstruct := new(MembersOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(MembersOutput) outstruct.Member = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) outstruct.CanVote = *abi.ConvertType(out[1], new(bool)).(*bool) outstruct.Name = *abi.ConvertType(out[2], new(string)).(*string) outstruct.MemberSince = abi.ConvertType(out[3], new(big.Int)).(*big.Int) - return *outstruct, err - + return outstruct, nil } -// PackMinimumQuorum is the Go binding used to pack the parameters required for calling +// PackMinimumQuorum is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x8160f0b5. // // Solidity: function minimumQuorum() returns(uint256) @@ -263,6 +326,14 @@ func (dAO *DAO) PackMinimumQuorum() []byte { return enc } +// PackMinimumQuorum is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x8160f0b5. +// +// Solidity: function minimumQuorum() returns(uint256) +func (dAO *DAO) TryPackMinimumQuorum() ([]byte, error) { + return dAO.abi.Pack("minimumQuorum") +} + // UnpackMinimumQuorum is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x8160f0b5. // @@ -273,10 +344,10 @@ func (dAO *DAO) UnpackMinimumQuorum(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackNewProposal is the Go binding used to pack the parameters required for calling +// PackNewProposal is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xb1050da5. // // Solidity: function newProposal(address beneficiary, uint256 etherAmount, string JobDescription, bytes transactionBytecode) returns(uint256 proposalID) @@ -288,6 +359,14 @@ func (dAO *DAO) PackNewProposal(beneficiary common.Address, etherAmount *big.Int return enc } +// PackNewProposal is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xb1050da5. +// +// Solidity: function newProposal(address beneficiary, uint256 etherAmount, string JobDescription, bytes transactionBytecode) returns(uint256 proposalID) +func (dAO *DAO) TryPackNewProposal(beneficiary common.Address, etherAmount *big.Int, jobDescription string, transactionBytecode []byte) ([]byte, error) { + return dAO.abi.Pack("newProposal", beneficiary, etherAmount, jobDescription, transactionBytecode) +} + // UnpackNewProposal is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xb1050da5. // @@ -298,10 +377,10 @@ func (dAO *DAO) UnpackNewProposal(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackNumProposals is the Go binding used to pack the parameters required for calling +// PackNumProposals is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x400e3949. // // Solidity: function numProposals() returns(uint256) @@ -313,6 +392,14 @@ func (dAO *DAO) PackNumProposals() []byte { return enc } +// PackNumProposals is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x400e3949. +// +// Solidity: function numProposals() returns(uint256) +func (dAO *DAO) TryPackNumProposals() ([]byte, error) { + return dAO.abi.Pack("numProposals") +} + // UnpackNumProposals is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x400e3949. // @@ -323,10 +410,10 @@ func (dAO *DAO) UnpackNumProposals(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackOwner is the Go binding used to pack the parameters required for calling +// PackOwner is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x8da5cb5b. // // Solidity: function owner() returns(address) @@ -338,6 +425,14 @@ func (dAO *DAO) PackOwner() []byte { return enc } +// PackOwner is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x8da5cb5b. +// +// Solidity: function owner() returns(address) +func (dAO *DAO) TryPackOwner() ([]byte, error) { + return dAO.abi.Pack("owner") +} + // UnpackOwner is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x8da5cb5b. // @@ -348,10 +443,10 @@ func (dAO *DAO) UnpackOwner(data []byte) (common.Address, error) { return *new(common.Address), err } out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - return out0, err + return out0, nil } -// PackProposals is the Go binding used to pack the parameters required for calling +// PackProposals is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x013cf08b. // // Solidity: function proposals(uint256 ) returns(address recipient, uint256 amount, string description, uint256 votingDeadline, bool executed, bool proposalPassed, uint256 numberOfVotes, int256 currentResult, bytes32 proposalHash) @@ -363,6 +458,14 @@ func (dAO *DAO) PackProposals(arg0 *big.Int) []byte { return enc } +// PackProposals is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x013cf08b. +// +// Solidity: function proposals(uint256 ) returns(address recipient, uint256 amount, string description, uint256 votingDeadline, bool executed, bool proposalPassed, uint256 numberOfVotes, int256 currentResult, bytes32 proposalHash) +func (dAO *DAO) TryPackProposals(arg0 *big.Int) ([]byte, error) { + return dAO.abi.Pack("proposals", arg0) +} + // ProposalsOutput serves as a container for the return parameters of contract // method Proposals. type ProposalsOutput struct { @@ -381,12 +484,12 @@ type ProposalsOutput struct { // from invoking the contract method with ID 0x013cf08b. // // Solidity: function proposals(uint256 ) returns(address recipient, uint256 amount, string description, uint256 votingDeadline, bool executed, bool proposalPassed, uint256 numberOfVotes, int256 currentResult, bytes32 proposalHash) -func (dAO *DAO) UnpackProposals(data []byte) (ProposalsOutput, error) { +func (dAO *DAO) UnpackProposals(data []byte) (*ProposalsOutput, error) { out, err := dAO.abi.Unpack("proposals", data) - outstruct := new(ProposalsOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(ProposalsOutput) outstruct.Recipient = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) outstruct.Amount = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Description = *abi.ConvertType(out[2], new(string)).(*string) @@ -396,11 +499,10 @@ func (dAO *DAO) UnpackProposals(data []byte) (ProposalsOutput, error) { outstruct.NumberOfVotes = abi.ConvertType(out[6], new(big.Int)).(*big.Int) outstruct.CurrentResult = abi.ConvertType(out[7], new(big.Int)).(*big.Int) outstruct.ProposalHash = *abi.ConvertType(out[8], new([32]byte)).(*[32]byte) - return *outstruct, err - + return outstruct, nil } -// PackTransferOwnership is the Go binding used to pack the parameters required for calling +// PackTransferOwnership is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xf2fde38b. // // Solidity: function transferOwnership(address newOwner) returns() @@ -412,7 +514,15 @@ func (dAO *DAO) PackTransferOwnership(newOwner common.Address) []byte { return enc } -// PackVote is the Go binding used to pack the parameters required for calling +// PackTransferOwnership is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (dAO *DAO) TryPackTransferOwnership(newOwner common.Address) ([]byte, error) { + return dAO.abi.Pack("transferOwnership", newOwner) +} + +// PackVote is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xd3c0715b. // // Solidity: function vote(uint256 proposalNumber, bool supportsProposal, string justificationText) returns(uint256 voteID) @@ -424,6 +534,14 @@ func (dAO *DAO) PackVote(proposalNumber *big.Int, supportsProposal bool, justifi return enc } +// PackVote is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xd3c0715b. +// +// Solidity: function vote(uint256 proposalNumber, bool supportsProposal, string justificationText) returns(uint256 voteID) +func (dAO *DAO) TryPackVote(proposalNumber *big.Int, supportsProposal bool, justificationText string) ([]byte, error) { + return dAO.abi.Pack("vote", proposalNumber, supportsProposal, justificationText) +} + // UnpackVote is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xd3c0715b. // @@ -434,7 +552,7 @@ func (dAO *DAO) UnpackVote(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // DAOChangeOfRules represents a ChangeOfRules event raised by the DAO contract. diff --git a/accounts/abi/abigen/testdata/v2/deeplynestedarray.go.txt b/accounts/abi/abigen/testdata/v2/deeplynestedarray.go.txt index 00f717d020ce..b4788ec93028 100644 --- a/accounts/abi/abigen/testdata/v2/deeplynestedarray.go.txt +++ b/accounts/abi/abigen/testdata/v2/deeplynestedarray.go.txt @@ -51,7 +51,7 @@ func (c *DeeplyNestedArray) Instance(backend bind.ContractBackend, addr common.A return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackDeepUint64Array is the Go binding used to pack the parameters required for calling +// PackDeepUint64Array is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x98ed1856. // // Solidity: function deepUint64Array(uint256 , uint256 , uint256 ) view returns(uint64) @@ -63,6 +63,14 @@ func (deeplyNestedArray *DeeplyNestedArray) PackDeepUint64Array(arg0 *big.Int, a return enc } +// PackDeepUint64Array is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x98ed1856. +// +// Solidity: function deepUint64Array(uint256 , uint256 , uint256 ) view returns(uint64) +func (deeplyNestedArray *DeeplyNestedArray) TryPackDeepUint64Array(arg0 *big.Int, arg1 *big.Int, arg2 *big.Int) ([]byte, error) { + return deeplyNestedArray.abi.Pack("deepUint64Array", arg0, arg1, arg2) +} + // UnpackDeepUint64Array is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x98ed1856. // @@ -73,10 +81,10 @@ func (deeplyNestedArray *DeeplyNestedArray) UnpackDeepUint64Array(data []byte) ( return *new(uint64), err } out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) - return out0, err + return out0, nil } -// PackRetrieveDeepArray is the Go binding used to pack the parameters required for calling +// PackRetrieveDeepArray is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x8ed4573a. // // Solidity: function retrieveDeepArray() view returns(uint64[3][4][5]) @@ -88,6 +96,14 @@ func (deeplyNestedArray *DeeplyNestedArray) PackRetrieveDeepArray() []byte { return enc } +// PackRetrieveDeepArray is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x8ed4573a. +// +// Solidity: function retrieveDeepArray() view returns(uint64[3][4][5]) +func (deeplyNestedArray *DeeplyNestedArray) TryPackRetrieveDeepArray() ([]byte, error) { + return deeplyNestedArray.abi.Pack("retrieveDeepArray") +} + // UnpackRetrieveDeepArray is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x8ed4573a. // @@ -98,10 +114,10 @@ func (deeplyNestedArray *DeeplyNestedArray) UnpackRetrieveDeepArray(data []byte) return *new([5][4][3]uint64), err } out0 := *abi.ConvertType(out[0], new([5][4][3]uint64)).(*[5][4][3]uint64) - return out0, err + return out0, nil } -// PackStoreDeepUintArray is the Go binding used to pack the parameters required for calling +// PackStoreDeepUintArray is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x34424855. // // Solidity: function storeDeepUintArray(uint64[3][4][5] arr) returns() @@ -112,3 +128,11 @@ func (deeplyNestedArray *DeeplyNestedArray) PackStoreDeepUintArray(arr [5][4][3] } return enc } + +// PackStoreDeepUintArray is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x34424855. +// +// Solidity: function storeDeepUintArray(uint64[3][4][5] arr) returns() +func (deeplyNestedArray *DeeplyNestedArray) TryPackStoreDeepUintArray(arr [5][4][3]uint64) ([]byte, error) { + return deeplyNestedArray.abi.Pack("storeDeepUintArray", arr) +} diff --git a/accounts/abi/abigen/testdata/v2/getter.go.txt b/accounts/abi/abigen/testdata/v2/getter.go.txt index 8e6e7debbfae..2fa09c4c25f9 100644 --- a/accounts/abi/abigen/testdata/v2/getter.go.txt +++ b/accounts/abi/abigen/testdata/v2/getter.go.txt @@ -51,7 +51,7 @@ func (c *Getter) Instance(backend bind.ContractBackend, addr common.Address) *bi return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackGetter is the Go binding used to pack the parameters required for calling +// PackGetter is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x993a04b7. // // Solidity: function getter() returns(string, int256, bytes32) @@ -63,6 +63,14 @@ func (getter *Getter) PackGetter() []byte { return enc } +// PackGetter is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x993a04b7. +// +// Solidity: function getter() returns(string, int256, bytes32) +func (getter *Getter) TryPackGetter() ([]byte, error) { + return getter.abi.Pack("getter") +} + // GetterOutput serves as a container for the return parameters of contract // method Getter. type GetterOutput struct { @@ -75,15 +83,14 @@ type GetterOutput struct { // from invoking the contract method with ID 0x993a04b7. // // Solidity: function getter() returns(string, int256, bytes32) -func (getter *Getter) UnpackGetter(data []byte) (GetterOutput, error) { +func (getter *Getter) UnpackGetter(data []byte) (*GetterOutput, error) { out, err := getter.abi.Unpack("getter", data) - outstruct := new(GetterOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(GetterOutput) outstruct.Arg0 = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Arg2 = *abi.ConvertType(out[2], new([32]byte)).(*[32]byte) - return *outstruct, err - + return outstruct, nil } diff --git a/accounts/abi/abigen/testdata/v2/identifiercollision.go.txt b/accounts/abi/abigen/testdata/v2/identifiercollision.go.txt index 60554aac132d..b29365366e0a 100644 --- a/accounts/abi/abigen/testdata/v2/identifiercollision.go.txt +++ b/accounts/abi/abigen/testdata/v2/identifiercollision.go.txt @@ -51,7 +51,7 @@ func (c *IdentifierCollision) Instance(backend bind.ContractBackend, addr common return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackMyVar is the Go binding used to pack the parameters required for calling +// PackMyVar is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x4ef1f0ad. // // Solidity: function MyVar() view returns(uint256) @@ -63,6 +63,14 @@ func (identifierCollision *IdentifierCollision) PackMyVar() []byte { return enc } +// PackMyVar is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x4ef1f0ad. +// +// Solidity: function MyVar() view returns(uint256) +func (identifierCollision *IdentifierCollision) TryPackMyVar() ([]byte, error) { + return identifierCollision.abi.Pack("MyVar") +} + // UnpackMyVar is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x4ef1f0ad. // @@ -73,10 +81,10 @@ func (identifierCollision *IdentifierCollision) UnpackMyVar(data []byte) (*big.I return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackPubVar is the Go binding used to pack the parameters required for calling +// PackPubVar is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x01ad4d87. // // Solidity: function _myVar() view returns(uint256) @@ -88,6 +96,14 @@ func (identifierCollision *IdentifierCollision) PackPubVar() []byte { return enc } +// PackPubVar is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x01ad4d87. +// +// Solidity: function _myVar() view returns(uint256) +func (identifierCollision *IdentifierCollision) TryPackPubVar() ([]byte, error) { + return identifierCollision.abi.Pack("_myVar") +} + // UnpackPubVar is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x01ad4d87. // @@ -98,5 +114,5 @@ func (identifierCollision *IdentifierCollision) UnpackPubVar(data []byte) (*big. return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } diff --git a/accounts/abi/abigen/testdata/v2/inputchecker.go.txt b/accounts/abi/abigen/testdata/v2/inputchecker.go.txt index 7b226aa90bd8..5ef50dba1f81 100644 --- a/accounts/abi/abigen/testdata/v2/inputchecker.go.txt +++ b/accounts/abi/abigen/testdata/v2/inputchecker.go.txt @@ -50,7 +50,7 @@ func (c *InputChecker) Instance(backend bind.ContractBackend, addr common.Addres return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackAnonInput is the Go binding used to pack the parameters required for calling +// PackAnonInput is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x3e708e82. // // Solidity: function anonInput(string ) returns() @@ -62,7 +62,15 @@ func (inputChecker *InputChecker) PackAnonInput(arg0 string) []byte { return enc } -// PackAnonInputs is the Go binding used to pack the parameters required for calling +// PackAnonInput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x3e708e82. +// +// Solidity: function anonInput(string ) returns() +func (inputChecker *InputChecker) TryPackAnonInput(arg0 string) ([]byte, error) { + return inputChecker.abi.Pack("anonInput", arg0) +} + +// PackAnonInputs is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x28160527. // // Solidity: function anonInputs(string , string ) returns() @@ -74,7 +82,15 @@ func (inputChecker *InputChecker) PackAnonInputs(arg0 string, arg1 string) []byt return enc } -// PackMixedInputs is the Go binding used to pack the parameters required for calling +// PackAnonInputs is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x28160527. +// +// Solidity: function anonInputs(string , string ) returns() +func (inputChecker *InputChecker) TryPackAnonInputs(arg0 string, arg1 string) ([]byte, error) { + return inputChecker.abi.Pack("anonInputs", arg0, arg1) +} + +// PackMixedInputs is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xc689ebdc. // // Solidity: function mixedInputs(string , string str) returns() @@ -86,7 +102,15 @@ func (inputChecker *InputChecker) PackMixedInputs(arg0 string, str string) []byt return enc } -// PackNamedInput is the Go binding used to pack the parameters required for calling +// PackMixedInputs is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xc689ebdc. +// +// Solidity: function mixedInputs(string , string str) returns() +func (inputChecker *InputChecker) TryPackMixedInputs(arg0 string, str string) ([]byte, error) { + return inputChecker.abi.Pack("mixedInputs", arg0, str) +} + +// PackNamedInput is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x0d402005. // // Solidity: function namedInput(string str) returns() @@ -98,7 +122,15 @@ func (inputChecker *InputChecker) PackNamedInput(str string) []byte { return enc } -// PackNamedInputs is the Go binding used to pack the parameters required for calling +// PackNamedInput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x0d402005. +// +// Solidity: function namedInput(string str) returns() +func (inputChecker *InputChecker) TryPackNamedInput(str string) ([]byte, error) { + return inputChecker.abi.Pack("namedInput", str) +} + +// PackNamedInputs is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x63c796ed. // // Solidity: function namedInputs(string str1, string str2) returns() @@ -110,7 +142,15 @@ func (inputChecker *InputChecker) PackNamedInputs(str1 string, str2 string) []by return enc } -// PackNoInput is the Go binding used to pack the parameters required for calling +// PackNamedInputs is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x63c796ed. +// +// Solidity: function namedInputs(string str1, string str2) returns() +func (inputChecker *InputChecker) TryPackNamedInputs(str1 string, str2 string) ([]byte, error) { + return inputChecker.abi.Pack("namedInputs", str1, str2) +} + +// PackNoInput is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x53539029. // // Solidity: function noInput() returns() @@ -121,3 +161,11 @@ func (inputChecker *InputChecker) PackNoInput() []byte { } return enc } + +// PackNoInput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x53539029. +// +// Solidity: function noInput() returns() +func (inputChecker *InputChecker) TryPackNoInput() ([]byte, error) { + return inputChecker.abi.Pack("noInput") +} diff --git a/accounts/abi/abigen/testdata/v2/interactor.go.txt b/accounts/abi/abigen/testdata/v2/interactor.go.txt index cc0900856ec8..de8a0c52111e 100644 --- a/accounts/abi/abigen/testdata/v2/interactor.go.txt +++ b/accounts/abi/abigen/testdata/v2/interactor.go.txt @@ -63,7 +63,7 @@ func (interactor *Interactor) PackConstructor(str string) []byte { return enc } -// PackDeployString is the Go binding used to pack the parameters required for calling +// PackDeployString is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x6874e809. // // Solidity: function deployString() returns(string) @@ -75,6 +75,14 @@ func (interactor *Interactor) PackDeployString() []byte { return enc } +// PackDeployString is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x6874e809. +// +// Solidity: function deployString() returns(string) +func (interactor *Interactor) TryPackDeployString() ([]byte, error) { + return interactor.abi.Pack("deployString") +} + // UnpackDeployString is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x6874e809. // @@ -85,10 +93,10 @@ func (interactor *Interactor) UnpackDeployString(data []byte) (string, error) { return *new(string), err } out0 := *abi.ConvertType(out[0], new(string)).(*string) - return out0, err + return out0, nil } -// PackTransact is the Go binding used to pack the parameters required for calling +// PackTransact is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xd736c513. // // Solidity: function transact(string str) returns() @@ -100,7 +108,15 @@ func (interactor *Interactor) PackTransact(str string) []byte { return enc } -// PackTransactString is the Go binding used to pack the parameters required for calling +// PackTransact is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xd736c513. +// +// Solidity: function transact(string str) returns() +func (interactor *Interactor) TryPackTransact(str string) ([]byte, error) { + return interactor.abi.Pack("transact", str) +} + +// PackTransactString is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x0d86a0e1. // // Solidity: function transactString() returns(string) @@ -112,6 +128,14 @@ func (interactor *Interactor) PackTransactString() []byte { return enc } +// PackTransactString is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x0d86a0e1. +// +// Solidity: function transactString() returns(string) +func (interactor *Interactor) TryPackTransactString() ([]byte, error) { + return interactor.abi.Pack("transactString") +} + // UnpackTransactString is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x0d86a0e1. // @@ -122,5 +146,5 @@ func (interactor *Interactor) UnpackTransactString(data []byte) (string, error) return *new(string), err } out0 := *abi.ConvertType(out[0], new(string)).(*string) - return out0, err + return out0, nil } diff --git a/accounts/abi/abigen/testdata/v2/nameconflict.go.txt b/accounts/abi/abigen/testdata/v2/nameconflict.go.txt index 6228bf7cc73c..fd0fcd31cc76 100644 --- a/accounts/abi/abigen/testdata/v2/nameconflict.go.txt +++ b/accounts/abi/abigen/testdata/v2/nameconflict.go.txt @@ -57,7 +57,7 @@ func (c *NameConflict) Instance(backend bind.ContractBackend, addr common.Addres return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackAddRequest is the Go binding used to pack the parameters required for calling +// PackAddRequest is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xcce7b048. // // Solidity: function addRequest((bytes,bytes) req) pure returns() @@ -69,7 +69,15 @@ func (nameConflict *NameConflict) PackAddRequest(req Oraclerequest) []byte { return enc } -// PackGetRequest is the Go binding used to pack the parameters required for calling +// PackAddRequest is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xcce7b048. +// +// Solidity: function addRequest((bytes,bytes) req) pure returns() +func (nameConflict *NameConflict) TryPackAddRequest(req Oraclerequest) ([]byte, error) { + return nameConflict.abi.Pack("addRequest", req) +} + +// PackGetRequest is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xc2bb515f. // // Solidity: function getRequest() pure returns((bytes,bytes)) @@ -81,6 +89,14 @@ func (nameConflict *NameConflict) PackGetRequest() []byte { return enc } +// PackGetRequest is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xc2bb515f. +// +// Solidity: function getRequest() pure returns((bytes,bytes)) +func (nameConflict *NameConflict) TryPackGetRequest() ([]byte, error) { + return nameConflict.abi.Pack("getRequest") +} + // UnpackGetRequest is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xc2bb515f. // @@ -91,7 +107,7 @@ func (nameConflict *NameConflict) UnpackGetRequest(data []byte) (Oraclerequest, return *new(Oraclerequest), err } out0 := *abi.ConvertType(out[0], new(Oraclerequest)).(*Oraclerequest) - return out0, err + return out0, nil } // NameConflictLog represents a log event raised by the NameConflict contract. diff --git a/accounts/abi/abigen/testdata/v2/numericmethodname.go.txt b/accounts/abi/abigen/testdata/v2/numericmethodname.go.txt index 5a2208e0d42e..e861aba44431 100644 --- a/accounts/abi/abigen/testdata/v2/numericmethodname.go.txt +++ b/accounts/abi/abigen/testdata/v2/numericmethodname.go.txt @@ -51,7 +51,7 @@ func (c *NumericMethodName) Instance(backend bind.ContractBackend, addr common.A return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackE1test is the Go binding used to pack the parameters required for calling +// PackE1test is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xffa02795. // // Solidity: function _1test() pure returns() @@ -63,7 +63,15 @@ func (numericMethodName *NumericMethodName) PackE1test() []byte { return enc } -// PackE1test0 is the Go binding used to pack the parameters required for calling +// PackE1test is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xffa02795. +// +// Solidity: function _1test() pure returns() +func (numericMethodName *NumericMethodName) TryPackE1test() ([]byte, error) { + return numericMethodName.abi.Pack("_1test") +} + +// PackE1test0 is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xd02767c7. // // Solidity: function __1test() pure returns() @@ -75,7 +83,15 @@ func (numericMethodName *NumericMethodName) PackE1test0() []byte { return enc } -// PackE2test is the Go binding used to pack the parameters required for calling +// PackE1test0 is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xd02767c7. +// +// Solidity: function __1test() pure returns() +func (numericMethodName *NumericMethodName) TryPackE1test0() ([]byte, error) { + return numericMethodName.abi.Pack("__1test") +} + +// PackE2test is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x9d993132. // // Solidity: function __2test() pure returns() @@ -87,6 +103,14 @@ func (numericMethodName *NumericMethodName) PackE2test() []byte { return enc } +// PackE2test is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x9d993132. +// +// Solidity: function __2test() pure returns() +func (numericMethodName *NumericMethodName) TryPackE2test() ([]byte, error) { + return numericMethodName.abi.Pack("__2test") +} + // NumericMethodNameE1TestEvent represents a _1TestEvent event raised by the NumericMethodName contract. type NumericMethodNameE1TestEvent struct { Param common.Address diff --git a/accounts/abi/abigen/testdata/v2/outputchecker.go.txt b/accounts/abi/abigen/testdata/v2/outputchecker.go.txt index 6f1f8e67957b..5f95e747b70c 100644 --- a/accounts/abi/abigen/testdata/v2/outputchecker.go.txt +++ b/accounts/abi/abigen/testdata/v2/outputchecker.go.txt @@ -50,7 +50,7 @@ func (c *OutputChecker) Instance(backend bind.ContractBackend, addr common.Addre return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackAnonOutput is the Go binding used to pack the parameters required for calling +// PackAnonOutput is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x008bda05. // // Solidity: function anonOutput() returns(string) @@ -62,6 +62,14 @@ func (outputChecker *OutputChecker) PackAnonOutput() []byte { return enc } +// PackAnonOutput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x008bda05. +// +// Solidity: function anonOutput() returns(string) +func (outputChecker *OutputChecker) TryPackAnonOutput() ([]byte, error) { + return outputChecker.abi.Pack("anonOutput") +} + // UnpackAnonOutput is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x008bda05. // @@ -72,10 +80,10 @@ func (outputChecker *OutputChecker) UnpackAnonOutput(data []byte) (string, error return *new(string), err } out0 := *abi.ConvertType(out[0], new(string)).(*string) - return out0, err + return out0, nil } -// PackAnonOutputs is the Go binding used to pack the parameters required for calling +// PackAnonOutputs is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x3c401115. // // Solidity: function anonOutputs() returns(string, string) @@ -87,6 +95,14 @@ func (outputChecker *OutputChecker) PackAnonOutputs() []byte { return enc } +// PackAnonOutputs is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x3c401115. +// +// Solidity: function anonOutputs() returns(string, string) +func (outputChecker *OutputChecker) TryPackAnonOutputs() ([]byte, error) { + return outputChecker.abi.Pack("anonOutputs") +} + // AnonOutputsOutput serves as a container for the return parameters of contract // method AnonOutputs. type AnonOutputsOutput struct { @@ -98,19 +114,18 @@ type AnonOutputsOutput struct { // from invoking the contract method with ID 0x3c401115. // // Solidity: function anonOutputs() returns(string, string) -func (outputChecker *OutputChecker) UnpackAnonOutputs(data []byte) (AnonOutputsOutput, error) { +func (outputChecker *OutputChecker) UnpackAnonOutputs(data []byte) (*AnonOutputsOutput, error) { out, err := outputChecker.abi.Unpack("anonOutputs", data) - outstruct := new(AnonOutputsOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(AnonOutputsOutput) outstruct.Arg0 = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Arg1 = *abi.ConvertType(out[1], new(string)).(*string) - return *outstruct, err - + return outstruct, nil } -// PackCollidingOutputs is the Go binding used to pack the parameters required for calling +// PackCollidingOutputs is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xeccbc1ee. // // Solidity: function collidingOutputs() returns(string str, string Str) @@ -122,6 +137,14 @@ func (outputChecker *OutputChecker) PackCollidingOutputs() []byte { return enc } +// PackCollidingOutputs is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xeccbc1ee. +// +// Solidity: function collidingOutputs() returns(string str, string Str) +func (outputChecker *OutputChecker) TryPackCollidingOutputs() ([]byte, error) { + return outputChecker.abi.Pack("collidingOutputs") +} + // CollidingOutputsOutput serves as a container for the return parameters of contract // method CollidingOutputs. type CollidingOutputsOutput struct { @@ -133,19 +156,18 @@ type CollidingOutputsOutput struct { // from invoking the contract method with ID 0xeccbc1ee. // // Solidity: function collidingOutputs() returns(string str, string Str) -func (outputChecker *OutputChecker) UnpackCollidingOutputs(data []byte) (CollidingOutputsOutput, error) { +func (outputChecker *OutputChecker) UnpackCollidingOutputs(data []byte) (*CollidingOutputsOutput, error) { out, err := outputChecker.abi.Unpack("collidingOutputs", data) - outstruct := new(CollidingOutputsOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(CollidingOutputsOutput) outstruct.Str = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Str0 = *abi.ConvertType(out[1], new(string)).(*string) - return *outstruct, err - + return outstruct, nil } -// PackMixedOutputs is the Go binding used to pack the parameters required for calling +// PackMixedOutputs is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x21b77b44. // // Solidity: function mixedOutputs() returns(string, string str) @@ -157,6 +179,14 @@ func (outputChecker *OutputChecker) PackMixedOutputs() []byte { return enc } +// PackMixedOutputs is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x21b77b44. +// +// Solidity: function mixedOutputs() returns(string, string str) +func (outputChecker *OutputChecker) TryPackMixedOutputs() ([]byte, error) { + return outputChecker.abi.Pack("mixedOutputs") +} + // MixedOutputsOutput serves as a container for the return parameters of contract // method MixedOutputs. type MixedOutputsOutput struct { @@ -168,19 +198,18 @@ type MixedOutputsOutput struct { // from invoking the contract method with ID 0x21b77b44. // // Solidity: function mixedOutputs() returns(string, string str) -func (outputChecker *OutputChecker) UnpackMixedOutputs(data []byte) (MixedOutputsOutput, error) { +func (outputChecker *OutputChecker) UnpackMixedOutputs(data []byte) (*MixedOutputsOutput, error) { out, err := outputChecker.abi.Unpack("mixedOutputs", data) - outstruct := new(MixedOutputsOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(MixedOutputsOutput) outstruct.Arg0 = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Str = *abi.ConvertType(out[1], new(string)).(*string) - return *outstruct, err - + return outstruct, nil } -// PackNamedOutput is the Go binding used to pack the parameters required for calling +// PackNamedOutput is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x5e632bd5. // // Solidity: function namedOutput() returns(string str) @@ -192,6 +221,14 @@ func (outputChecker *OutputChecker) PackNamedOutput() []byte { return enc } +// PackNamedOutput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x5e632bd5. +// +// Solidity: function namedOutput() returns(string str) +func (outputChecker *OutputChecker) TryPackNamedOutput() ([]byte, error) { + return outputChecker.abi.Pack("namedOutput") +} + // UnpackNamedOutput is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x5e632bd5. // @@ -202,10 +239,10 @@ func (outputChecker *OutputChecker) UnpackNamedOutput(data []byte) (string, erro return *new(string), err } out0 := *abi.ConvertType(out[0], new(string)).(*string) - return out0, err + return out0, nil } -// PackNamedOutputs is the Go binding used to pack the parameters required for calling +// PackNamedOutputs is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x7970a189. // // Solidity: function namedOutputs() returns(string str1, string str2) @@ -217,6 +254,14 @@ func (outputChecker *OutputChecker) PackNamedOutputs() []byte { return enc } +// PackNamedOutputs is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x7970a189. +// +// Solidity: function namedOutputs() returns(string str1, string str2) +func (outputChecker *OutputChecker) TryPackNamedOutputs() ([]byte, error) { + return outputChecker.abi.Pack("namedOutputs") +} + // NamedOutputsOutput serves as a container for the return parameters of contract // method NamedOutputs. type NamedOutputsOutput struct { @@ -228,19 +273,18 @@ type NamedOutputsOutput struct { // from invoking the contract method with ID 0x7970a189. // // Solidity: function namedOutputs() returns(string str1, string str2) -func (outputChecker *OutputChecker) UnpackNamedOutputs(data []byte) (NamedOutputsOutput, error) { +func (outputChecker *OutputChecker) UnpackNamedOutputs(data []byte) (*NamedOutputsOutput, error) { out, err := outputChecker.abi.Unpack("namedOutputs", data) - outstruct := new(NamedOutputsOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(NamedOutputsOutput) outstruct.Str1 = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Str2 = *abi.ConvertType(out[1], new(string)).(*string) - return *outstruct, err - + return outstruct, nil } -// PackNoOutput is the Go binding used to pack the parameters required for calling +// PackNoOutput is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x625f0306. // // Solidity: function noOutput() returns() @@ -251,3 +295,11 @@ func (outputChecker *OutputChecker) PackNoOutput() []byte { } return enc } + +// PackNoOutput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x625f0306. +// +// Solidity: function noOutput() returns() +func (outputChecker *OutputChecker) TryPackNoOutput() ([]byte, error) { + return outputChecker.abi.Pack("noOutput") +} diff --git a/accounts/abi/abigen/testdata/v2/overload.go.txt b/accounts/abi/abigen/testdata/v2/overload.go.txt index ed7c0b543ce2..7f6e3535eaab 100644 --- a/accounts/abi/abigen/testdata/v2/overload.go.txt +++ b/accounts/abi/abigen/testdata/v2/overload.go.txt @@ -51,7 +51,7 @@ func (c *Overload) Instance(backend bind.ContractBackend, addr common.Address) * return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackFoo is the Go binding used to pack the parameters required for calling +// PackFoo is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x04bc52f8. // // Solidity: function foo(uint256 i, uint256 j) returns() @@ -63,7 +63,15 @@ func (overload *Overload) PackFoo(i *big.Int, j *big.Int) []byte { return enc } -// PackFoo0 is the Go binding used to pack the parameters required for calling +// PackFoo is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x04bc52f8. +// +// Solidity: function foo(uint256 i, uint256 j) returns() +func (overload *Overload) TryPackFoo(i *big.Int, j *big.Int) ([]byte, error) { + return overload.abi.Pack("foo", i, j) +} + +// PackFoo0 is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x2fbebd38. // // Solidity: function foo(uint256 i) returns() @@ -75,6 +83,14 @@ func (overload *Overload) PackFoo0(i *big.Int) []byte { return enc } +// PackFoo0 is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x2fbebd38. +// +// Solidity: function foo(uint256 i) returns() +func (overload *Overload) TryPackFoo0(i *big.Int) ([]byte, error) { + return overload.abi.Pack("foo0", i) +} + // OverloadBar represents a bar event raised by the Overload contract. type OverloadBar struct { I *big.Int diff --git a/accounts/abi/abigen/testdata/v2/rangekeyword.go.txt b/accounts/abi/abigen/testdata/v2/rangekeyword.go.txt index c7f142539589..ac05be2a9e92 100644 --- a/accounts/abi/abigen/testdata/v2/rangekeyword.go.txt +++ b/accounts/abi/abigen/testdata/v2/rangekeyword.go.txt @@ -51,7 +51,7 @@ func (c *RangeKeyword) Instance(backend bind.ContractBackend, addr common.Addres return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackFunctionWithKeywordParameter is the Go binding used to pack the parameters required for calling +// PackFunctionWithKeywordParameter is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x527a119f. // // Solidity: function functionWithKeywordParameter(uint256 range) pure returns() @@ -62,3 +62,11 @@ func (rangeKeyword *RangeKeyword) PackFunctionWithKeywordParameter(arg0 *big.Int } return enc } + +// PackFunctionWithKeywordParameter is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x527a119f. +// +// Solidity: function functionWithKeywordParameter(uint256 range) pure returns() +func (rangeKeyword *RangeKeyword) TryPackFunctionWithKeywordParameter(arg0 *big.Int) ([]byte, error) { + return rangeKeyword.abi.Pack("functionWithKeywordParameter", arg0) +} diff --git a/accounts/abi/abigen/testdata/v2/slicer.go.txt b/accounts/abi/abigen/testdata/v2/slicer.go.txt index b66c05cf0ff3..426eaa051752 100644 --- a/accounts/abi/abigen/testdata/v2/slicer.go.txt +++ b/accounts/abi/abigen/testdata/v2/slicer.go.txt @@ -51,7 +51,7 @@ func (c *Slicer) Instance(backend bind.ContractBackend, addr common.Address) *bi return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackEchoAddresses is the Go binding used to pack the parameters required for calling +// PackEchoAddresses is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xbe1127a3. // // Solidity: function echoAddresses(address[] input) returns(address[] output) @@ -63,6 +63,14 @@ func (slicer *Slicer) PackEchoAddresses(input []common.Address) []byte { return enc } +// PackEchoAddresses is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xbe1127a3. +// +// Solidity: function echoAddresses(address[] input) returns(address[] output) +func (slicer *Slicer) TryPackEchoAddresses(input []common.Address) ([]byte, error) { + return slicer.abi.Pack("echoAddresses", input) +} + // UnpackEchoAddresses is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xbe1127a3. // @@ -73,10 +81,10 @@ func (slicer *Slicer) UnpackEchoAddresses(data []byte) ([]common.Address, error) return *new([]common.Address), err } out0 := *abi.ConvertType(out[0], new([]common.Address)).(*[]common.Address) - return out0, err + return out0, nil } -// PackEchoBools is the Go binding used to pack the parameters required for calling +// PackEchoBools is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xf637e589. // // Solidity: function echoBools(bool[] input) returns(bool[] output) @@ -88,6 +96,14 @@ func (slicer *Slicer) PackEchoBools(input []bool) []byte { return enc } +// PackEchoBools is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xf637e589. +// +// Solidity: function echoBools(bool[] input) returns(bool[] output) +func (slicer *Slicer) TryPackEchoBools(input []bool) ([]byte, error) { + return slicer.abi.Pack("echoBools", input) +} + // UnpackEchoBools is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xf637e589. // @@ -98,10 +114,10 @@ func (slicer *Slicer) UnpackEchoBools(data []byte) ([]bool, error) { return *new([]bool), err } out0 := *abi.ConvertType(out[0], new([]bool)).(*[]bool) - return out0, err + return out0, nil } -// PackEchoFancyInts is the Go binding used to pack the parameters required for calling +// PackEchoFancyInts is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xd88becc0. // // Solidity: function echoFancyInts(uint24[23] input) returns(uint24[23] output) @@ -113,6 +129,14 @@ func (slicer *Slicer) PackEchoFancyInts(input [23]*big.Int) []byte { return enc } +// PackEchoFancyInts is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xd88becc0. +// +// Solidity: function echoFancyInts(uint24[23] input) returns(uint24[23] output) +func (slicer *Slicer) TryPackEchoFancyInts(input [23]*big.Int) ([]byte, error) { + return slicer.abi.Pack("echoFancyInts", input) +} + // UnpackEchoFancyInts is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xd88becc0. // @@ -123,10 +147,10 @@ func (slicer *Slicer) UnpackEchoFancyInts(data []byte) ([23]*big.Int, error) { return *new([23]*big.Int), err } out0 := *abi.ConvertType(out[0], new([23]*big.Int)).(*[23]*big.Int) - return out0, err + return out0, nil } -// PackEchoInts is the Go binding used to pack the parameters required for calling +// PackEchoInts is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xe15a3db7. // // Solidity: function echoInts(int256[] input) returns(int256[] output) @@ -138,6 +162,14 @@ func (slicer *Slicer) PackEchoInts(input []*big.Int) []byte { return enc } +// PackEchoInts is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xe15a3db7. +// +// Solidity: function echoInts(int256[] input) returns(int256[] output) +func (slicer *Slicer) TryPackEchoInts(input []*big.Int) ([]byte, error) { + return slicer.abi.Pack("echoInts", input) +} + // UnpackEchoInts is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xe15a3db7. // @@ -148,5 +180,5 @@ func (slicer *Slicer) UnpackEchoInts(data []byte) ([]*big.Int, error) { return *new([]*big.Int), err } out0 := *abi.ConvertType(out[0], new([]*big.Int)).(*[]*big.Int) - return out0, err + return out0, nil } diff --git a/accounts/abi/abigen/testdata/v2/structs.go.txt b/accounts/abi/abigen/testdata/v2/structs.go.txt index 7fe59c5616c3..da94fbf164d8 100644 --- a/accounts/abi/abigen/testdata/v2/structs.go.txt +++ b/accounts/abi/abigen/testdata/v2/structs.go.txt @@ -56,7 +56,7 @@ func (c *Structs) Instance(backend bind.ContractBackend, addr common.Address) *b return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackF is the Go binding used to pack the parameters required for calling +// PackF is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x28811f59. // // Solidity: function F() view returns((bytes32)[] a, uint256[] c, bool[] d) @@ -68,6 +68,14 @@ func (structs *Structs) PackF() []byte { return enc } +// PackF is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x28811f59. +// +// Solidity: function F() view returns((bytes32)[] a, uint256[] c, bool[] d) +func (structs *Structs) TryPackF() ([]byte, error) { + return structs.abi.Pack("F") +} + // FOutput serves as a container for the return parameters of contract // method F. type FOutput struct { @@ -80,20 +88,19 @@ type FOutput struct { // from invoking the contract method with ID 0x28811f59. // // Solidity: function F() view returns((bytes32)[] a, uint256[] c, bool[] d) -func (structs *Structs) UnpackF(data []byte) (FOutput, error) { +func (structs *Structs) UnpackF(data []byte) (*FOutput, error) { out, err := structs.abi.Unpack("F", data) - outstruct := new(FOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(FOutput) outstruct.A = *abi.ConvertType(out[0], new([]Struct0)).(*[]Struct0) outstruct.C = *abi.ConvertType(out[1], new([]*big.Int)).(*[]*big.Int) outstruct.D = *abi.ConvertType(out[2], new([]bool)).(*[]bool) - return *outstruct, err - + return outstruct, nil } -// PackG is the Go binding used to pack the parameters required for calling +// PackG is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x6fecb623. // // Solidity: function G() view returns((bytes32)[] a) @@ -105,6 +112,14 @@ func (structs *Structs) PackG() []byte { return enc } +// PackG is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x6fecb623. +// +// Solidity: function G() view returns((bytes32)[] a) +func (structs *Structs) TryPackG() ([]byte, error) { + return structs.abi.Pack("G") +} + // UnpackG is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x6fecb623. // @@ -115,5 +130,5 @@ func (structs *Structs) UnpackG(data []byte) ([]Struct0, error) { return *new([]Struct0), err } out0 := *abi.ConvertType(out[0], new([]Struct0)).(*[]Struct0) - return out0, err + return out0, nil } diff --git a/accounts/abi/abigen/testdata/v2/token.go.txt b/accounts/abi/abigen/testdata/v2/token.go.txt index aca18cb227cf..489c084c3cce 100644 --- a/accounts/abi/abigen/testdata/v2/token.go.txt +++ b/accounts/abi/abigen/testdata/v2/token.go.txt @@ -63,7 +63,7 @@ func (token *Token) PackConstructor(initialSupply *big.Int, tokenName string, de return enc } -// PackAllowance is the Go binding used to pack the parameters required for calling +// PackAllowance is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xdd62ed3e. // // Solidity: function allowance(address , address ) returns(uint256) @@ -75,6 +75,14 @@ func (token *Token) PackAllowance(arg0 common.Address, arg1 common.Address) []by return enc } +// PackAllowance is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xdd62ed3e. +// +// Solidity: function allowance(address , address ) returns(uint256) +func (token *Token) TryPackAllowance(arg0 common.Address, arg1 common.Address) ([]byte, error) { + return token.abi.Pack("allowance", arg0, arg1) +} + // UnpackAllowance is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xdd62ed3e. // @@ -85,10 +93,10 @@ func (token *Token) UnpackAllowance(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackApproveAndCall is the Go binding used to pack the parameters required for calling +// PackApproveAndCall is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xcae9ca51. // // Solidity: function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns(bool success) @@ -100,6 +108,14 @@ func (token *Token) PackApproveAndCall(spender common.Address, value *big.Int, e return enc } +// PackApproveAndCall is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xcae9ca51. +// +// Solidity: function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns(bool success) +func (token *Token) TryPackApproveAndCall(spender common.Address, value *big.Int, extraData []byte) ([]byte, error) { + return token.abi.Pack("approveAndCall", spender, value, extraData) +} + // UnpackApproveAndCall is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xcae9ca51. // @@ -110,10 +126,10 @@ func (token *Token) UnpackApproveAndCall(data []byte) (bool, error) { return *new(bool), err } out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - return out0, err + return out0, nil } -// PackBalanceOf is the Go binding used to pack the parameters required for calling +// PackBalanceOf is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x70a08231. // // Solidity: function balanceOf(address ) returns(uint256) @@ -125,6 +141,14 @@ func (token *Token) PackBalanceOf(arg0 common.Address) []byte { return enc } +// PackBalanceOf is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x70a08231. +// +// Solidity: function balanceOf(address ) returns(uint256) +func (token *Token) TryPackBalanceOf(arg0 common.Address) ([]byte, error) { + return token.abi.Pack("balanceOf", arg0) +} + // UnpackBalanceOf is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x70a08231. // @@ -135,10 +159,10 @@ func (token *Token) UnpackBalanceOf(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackDecimals is the Go binding used to pack the parameters required for calling +// PackDecimals is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x313ce567. // // Solidity: function decimals() returns(uint8) @@ -150,6 +174,14 @@ func (token *Token) PackDecimals() []byte { return enc } +// PackDecimals is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x313ce567. +// +// Solidity: function decimals() returns(uint8) +func (token *Token) TryPackDecimals() ([]byte, error) { + return token.abi.Pack("decimals") +} + // UnpackDecimals is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x313ce567. // @@ -160,10 +192,10 @@ func (token *Token) UnpackDecimals(data []byte) (uint8, error) { return *new(uint8), err } out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) - return out0, err + return out0, nil } -// PackName is the Go binding used to pack the parameters required for calling +// PackName is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x06fdde03. // // Solidity: function name() returns(string) @@ -175,6 +207,14 @@ func (token *Token) PackName() []byte { return enc } +// PackName is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x06fdde03. +// +// Solidity: function name() returns(string) +func (token *Token) TryPackName() ([]byte, error) { + return token.abi.Pack("name") +} + // UnpackName is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x06fdde03. // @@ -185,10 +225,10 @@ func (token *Token) UnpackName(data []byte) (string, error) { return *new(string), err } out0 := *abi.ConvertType(out[0], new(string)).(*string) - return out0, err + return out0, nil } -// PackSpentAllowance is the Go binding used to pack the parameters required for calling +// PackSpentAllowance is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xdc3080f2. // // Solidity: function spentAllowance(address , address ) returns(uint256) @@ -200,6 +240,14 @@ func (token *Token) PackSpentAllowance(arg0 common.Address, arg1 common.Address) return enc } +// PackSpentAllowance is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xdc3080f2. +// +// Solidity: function spentAllowance(address , address ) returns(uint256) +func (token *Token) TryPackSpentAllowance(arg0 common.Address, arg1 common.Address) ([]byte, error) { + return token.abi.Pack("spentAllowance", arg0, arg1) +} + // UnpackSpentAllowance is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xdc3080f2. // @@ -210,10 +258,10 @@ func (token *Token) UnpackSpentAllowance(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackSymbol is the Go binding used to pack the parameters required for calling +// PackSymbol is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x95d89b41. // // Solidity: function symbol() returns(string) @@ -225,6 +273,14 @@ func (token *Token) PackSymbol() []byte { return enc } +// PackSymbol is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x95d89b41. +// +// Solidity: function symbol() returns(string) +func (token *Token) TryPackSymbol() ([]byte, error) { + return token.abi.Pack("symbol") +} + // UnpackSymbol is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x95d89b41. // @@ -235,10 +291,10 @@ func (token *Token) UnpackSymbol(data []byte) (string, error) { return *new(string), err } out0 := *abi.ConvertType(out[0], new(string)).(*string) - return out0, err + return out0, nil } -// PackTransfer is the Go binding used to pack the parameters required for calling +// PackTransfer is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xa9059cbb. // // Solidity: function transfer(address _to, uint256 _value) returns() @@ -250,7 +306,15 @@ func (token *Token) PackTransfer(to common.Address, value *big.Int) []byte { return enc } -// PackTransferFrom is the Go binding used to pack the parameters required for calling +// PackTransfer is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xa9059cbb. +// +// Solidity: function transfer(address _to, uint256 _value) returns() +func (token *Token) TryPackTransfer(to common.Address, value *big.Int) ([]byte, error) { + return token.abi.Pack("transfer", to, value) +} + +// PackTransferFrom is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x23b872dd. // // Solidity: function transferFrom(address _from, address _to, uint256 _value) returns(bool success) @@ -262,6 +326,14 @@ func (token *Token) PackTransferFrom(from common.Address, to common.Address, val return enc } +// PackTransferFrom is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x23b872dd. +// +// Solidity: function transferFrom(address _from, address _to, uint256 _value) returns(bool success) +func (token *Token) TryPackTransferFrom(from common.Address, to common.Address, value *big.Int) ([]byte, error) { + return token.abi.Pack("transferFrom", from, to, value) +} + // UnpackTransferFrom is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x23b872dd. // @@ -272,7 +344,7 @@ func (token *Token) UnpackTransferFrom(data []byte) (bool, error) { return *new(bool), err } out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - return out0, err + return out0, nil } // TokenTransfer represents a Transfer event raised by the Token contract. diff --git a/accounts/abi/abigen/testdata/v2/tuple.go.txt b/accounts/abi/abigen/testdata/v2/tuple.go.txt index 65af7654635f..4f03b7f1fbeb 100644 --- a/accounts/abi/abigen/testdata/v2/tuple.go.txt +++ b/accounts/abi/abigen/testdata/v2/tuple.go.txt @@ -76,7 +76,7 @@ func (c *Tuple) Instance(backend bind.ContractBackend, addr common.Address) *bin return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackFunc1 is the Go binding used to pack the parameters required for calling +// PackFunc1 is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x443c79b4. // // Solidity: function func1((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) pure returns((uint256,uint256[],(uint256,uint256)[]), (uint256,uint256)[2][], (uint256,uint256)[][2], (uint256,uint256[],(uint256,uint256)[])[], uint256[]) @@ -88,6 +88,14 @@ func (tuple *Tuple) PackFunc1(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS return enc } +// PackFunc1 is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x443c79b4. +// +// Solidity: function func1((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) pure returns((uint256,uint256[],(uint256,uint256)[]), (uint256,uint256)[2][], (uint256,uint256)[][2], (uint256,uint256[],(uint256,uint256)[])[], uint256[]) +func (tuple *Tuple) TryPackFunc1(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) ([]byte, error) { + return tuple.abi.Pack("func1", a, b, c, d, e) +} + // Func1Output serves as a container for the return parameters of contract // method Func1. type Func1Output struct { @@ -102,22 +110,21 @@ type Func1Output struct { // from invoking the contract method with ID 0x443c79b4. // // Solidity: function func1((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) pure returns((uint256,uint256[],(uint256,uint256)[]), (uint256,uint256)[2][], (uint256,uint256)[][2], (uint256,uint256[],(uint256,uint256)[])[], uint256[]) -func (tuple *Tuple) UnpackFunc1(data []byte) (Func1Output, error) { +func (tuple *Tuple) UnpackFunc1(data []byte) (*Func1Output, error) { out, err := tuple.abi.Unpack("func1", data) - outstruct := new(Func1Output) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(Func1Output) outstruct.Arg0 = *abi.ConvertType(out[0], new(TupleS)).(*TupleS) outstruct.Arg1 = *abi.ConvertType(out[1], new([][2]TupleT)).(*[][2]TupleT) outstruct.Arg2 = *abi.ConvertType(out[2], new([2][]TupleT)).(*[2][]TupleT) outstruct.Arg3 = *abi.ConvertType(out[3], new([]TupleS)).(*[]TupleS) outstruct.Arg4 = *abi.ConvertType(out[4], new([]*big.Int)).(*[]*big.Int) - return *outstruct, err - + return outstruct, nil } -// PackFunc2 is the Go binding used to pack the parameters required for calling +// PackFunc2 is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xd0062cdd. // // Solidity: function func2((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) returns() @@ -129,7 +136,15 @@ func (tuple *Tuple) PackFunc2(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS return enc } -// PackFunc3 is the Go binding used to pack the parameters required for calling +// PackFunc2 is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xd0062cdd. +// +// Solidity: function func2((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) returns() +func (tuple *Tuple) TryPackFunc2(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) ([]byte, error) { + return tuple.abi.Pack("func2", a, b, c, d, e) +} + +// PackFunc3 is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xe4d9a43b. // // Solidity: function func3((uint16,uint16)[] ) pure returns() @@ -141,6 +156,14 @@ func (tuple *Tuple) PackFunc3(arg0 []TupleQ) []byte { return enc } +// PackFunc3 is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xe4d9a43b. +// +// Solidity: function func3((uint16,uint16)[] ) pure returns() +func (tuple *Tuple) TryPackFunc3(arg0 []TupleQ) ([]byte, error) { + return tuple.abi.Pack("func3", arg0) +} + // TupleTupleEvent represents a TupleEvent event raised by the Tuple contract. type TupleTupleEvent struct { A TupleS diff --git a/accounts/abi/abigen/testdata/v2/tupler.go.txt b/accounts/abi/abigen/testdata/v2/tupler.go.txt index caa692dadec7..5d919944cff9 100644 --- a/accounts/abi/abigen/testdata/v2/tupler.go.txt +++ b/accounts/abi/abigen/testdata/v2/tupler.go.txt @@ -51,7 +51,7 @@ func (c *Tupler) Instance(backend bind.ContractBackend, addr common.Address) *bi return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackTuple is the Go binding used to pack the parameters required for calling +// PackTuple is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x3175aae2. // // Solidity: function tuple() returns(string a, int256 b, bytes32 c) @@ -63,6 +63,14 @@ func (tupler *Tupler) PackTuple() []byte { return enc } +// PackTuple is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x3175aae2. +// +// Solidity: function tuple() returns(string a, int256 b, bytes32 c) +func (tupler *Tupler) TryPackTuple() ([]byte, error) { + return tupler.abi.Pack("tuple") +} + // TupleOutput serves as a container for the return parameters of contract // method Tuple. type TupleOutput struct { @@ -75,15 +83,14 @@ type TupleOutput struct { // from invoking the contract method with ID 0x3175aae2. // // Solidity: function tuple() returns(string a, int256 b, bytes32 c) -func (tupler *Tupler) UnpackTuple(data []byte) (TupleOutput, error) { +func (tupler *Tupler) UnpackTuple(data []byte) (*TupleOutput, error) { out, err := tupler.abi.Unpack("tuple", data) - outstruct := new(TupleOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(TupleOutput) outstruct.A = *abi.ConvertType(out[0], new(string)).(*string) outstruct.B = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.C = *abi.ConvertType(out[2], new([32]byte)).(*[32]byte) - return *outstruct, err - + return outstruct, nil } diff --git a/accounts/abi/abigen/testdata/v2/underscorer.go.txt b/accounts/abi/abigen/testdata/v2/underscorer.go.txt index ef9eb864fa49..96c138fd44f3 100644 --- a/accounts/abi/abigen/testdata/v2/underscorer.go.txt +++ b/accounts/abi/abigen/testdata/v2/underscorer.go.txt @@ -51,7 +51,7 @@ func (c *Underscorer) Instance(backend bind.ContractBackend, addr common.Address return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackAllPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling +// PackAllPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xb564b34d. // // Solidity: function AllPurelyUnderscoredOutput() view returns(int256 _, int256 __) @@ -63,6 +63,14 @@ func (underscorer *Underscorer) PackAllPurelyUnderscoredOutput() []byte { return enc } +// PackAllPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xb564b34d. +// +// Solidity: function AllPurelyUnderscoredOutput() view returns(int256 _, int256 __) +func (underscorer *Underscorer) TryPackAllPurelyUnderscoredOutput() ([]byte, error) { + return underscorer.abi.Pack("AllPurelyUnderscoredOutput") +} + // AllPurelyUnderscoredOutputOutput serves as a container for the return parameters of contract // method AllPurelyUnderscoredOutput. type AllPurelyUnderscoredOutputOutput struct { @@ -74,19 +82,18 @@ type AllPurelyUnderscoredOutputOutput struct { // from invoking the contract method with ID 0xb564b34d. // // Solidity: function AllPurelyUnderscoredOutput() view returns(int256 _, int256 __) -func (underscorer *Underscorer) UnpackAllPurelyUnderscoredOutput(data []byte) (AllPurelyUnderscoredOutputOutput, error) { +func (underscorer *Underscorer) UnpackAllPurelyUnderscoredOutput(data []byte) (*AllPurelyUnderscoredOutputOutput, error) { out, err := underscorer.abi.Unpack("AllPurelyUnderscoredOutput", data) - outstruct := new(AllPurelyUnderscoredOutputOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(AllPurelyUnderscoredOutputOutput) outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return *outstruct, err - + return outstruct, nil } -// PackLowerLowerCollision is the Go binding used to pack the parameters required for calling +// PackLowerLowerCollision is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xe409ca45. // // Solidity: function LowerLowerCollision() view returns(int256 _res, int256 res) @@ -98,6 +105,14 @@ func (underscorer *Underscorer) PackLowerLowerCollision() []byte { return enc } +// PackLowerLowerCollision is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xe409ca45. +// +// Solidity: function LowerLowerCollision() view returns(int256 _res, int256 res) +func (underscorer *Underscorer) TryPackLowerLowerCollision() ([]byte, error) { + return underscorer.abi.Pack("LowerLowerCollision") +} + // LowerLowerCollisionOutput serves as a container for the return parameters of contract // method LowerLowerCollision. type LowerLowerCollisionOutput struct { @@ -109,19 +124,18 @@ type LowerLowerCollisionOutput struct { // from invoking the contract method with ID 0xe409ca45. // // Solidity: function LowerLowerCollision() view returns(int256 _res, int256 res) -func (underscorer *Underscorer) UnpackLowerLowerCollision(data []byte) (LowerLowerCollisionOutput, error) { +func (underscorer *Underscorer) UnpackLowerLowerCollision(data []byte) (*LowerLowerCollisionOutput, error) { out, err := underscorer.abi.Unpack("LowerLowerCollision", data) - outstruct := new(LowerLowerCollisionOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(LowerLowerCollisionOutput) outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return *outstruct, err - + return outstruct, nil } -// PackLowerUpperCollision is the Go binding used to pack the parameters required for calling +// PackLowerUpperCollision is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x03a59213. // // Solidity: function LowerUpperCollision() view returns(int256 _res, int256 Res) @@ -133,6 +147,14 @@ func (underscorer *Underscorer) PackLowerUpperCollision() []byte { return enc } +// PackLowerUpperCollision is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x03a59213. +// +// Solidity: function LowerUpperCollision() view returns(int256 _res, int256 Res) +func (underscorer *Underscorer) TryPackLowerUpperCollision() ([]byte, error) { + return underscorer.abi.Pack("LowerUpperCollision") +} + // LowerUpperCollisionOutput serves as a container for the return parameters of contract // method LowerUpperCollision. type LowerUpperCollisionOutput struct { @@ -144,19 +166,18 @@ type LowerUpperCollisionOutput struct { // from invoking the contract method with ID 0x03a59213. // // Solidity: function LowerUpperCollision() view returns(int256 _res, int256 Res) -func (underscorer *Underscorer) UnpackLowerUpperCollision(data []byte) (LowerUpperCollisionOutput, error) { +func (underscorer *Underscorer) UnpackLowerUpperCollision(data []byte) (*LowerUpperCollisionOutput, error) { out, err := underscorer.abi.Unpack("LowerUpperCollision", data) - outstruct := new(LowerUpperCollisionOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(LowerUpperCollisionOutput) outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return *outstruct, err - + return outstruct, nil } -// PackPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling +// PackPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x9df48485. // // Solidity: function PurelyUnderscoredOutput() view returns(int256 _, int256 res) @@ -168,6 +189,14 @@ func (underscorer *Underscorer) PackPurelyUnderscoredOutput() []byte { return enc } +// PackPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x9df48485. +// +// Solidity: function PurelyUnderscoredOutput() view returns(int256 _, int256 res) +func (underscorer *Underscorer) TryPackPurelyUnderscoredOutput() ([]byte, error) { + return underscorer.abi.Pack("PurelyUnderscoredOutput") +} + // PurelyUnderscoredOutputOutput serves as a container for the return parameters of contract // method PurelyUnderscoredOutput. type PurelyUnderscoredOutputOutput struct { @@ -179,19 +208,18 @@ type PurelyUnderscoredOutputOutput struct { // from invoking the contract method with ID 0x9df48485. // // Solidity: function PurelyUnderscoredOutput() view returns(int256 _, int256 res) -func (underscorer *Underscorer) UnpackPurelyUnderscoredOutput(data []byte) (PurelyUnderscoredOutputOutput, error) { +func (underscorer *Underscorer) UnpackPurelyUnderscoredOutput(data []byte) (*PurelyUnderscoredOutputOutput, error) { out, err := underscorer.abi.Unpack("PurelyUnderscoredOutput", data) - outstruct := new(PurelyUnderscoredOutputOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(PurelyUnderscoredOutputOutput) outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return *outstruct, err - + return outstruct, nil } -// PackUnderscoredOutput is the Go binding used to pack the parameters required for calling +// PackUnderscoredOutput is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x67e6633d. // // Solidity: function UnderscoredOutput() view returns(int256 _int, string _string) @@ -203,6 +231,14 @@ func (underscorer *Underscorer) PackUnderscoredOutput() []byte { return enc } +// PackUnderscoredOutput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x67e6633d. +// +// Solidity: function UnderscoredOutput() view returns(int256 _int, string _string) +func (underscorer *Underscorer) TryPackUnderscoredOutput() ([]byte, error) { + return underscorer.abi.Pack("UnderscoredOutput") +} + // UnderscoredOutputOutput serves as a container for the return parameters of contract // method UnderscoredOutput. type UnderscoredOutputOutput struct { @@ -214,19 +250,18 @@ type UnderscoredOutputOutput struct { // from invoking the contract method with ID 0x67e6633d. // // Solidity: function UnderscoredOutput() view returns(int256 _int, string _string) -func (underscorer *Underscorer) UnpackUnderscoredOutput(data []byte) (UnderscoredOutputOutput, error) { +func (underscorer *Underscorer) UnpackUnderscoredOutput(data []byte) (*UnderscoredOutputOutput, error) { out, err := underscorer.abi.Unpack("UnderscoredOutput", data) - outstruct := new(UnderscoredOutputOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(UnderscoredOutputOutput) outstruct.Int = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.String = *abi.ConvertType(out[1], new(string)).(*string) - return *outstruct, err - + return outstruct, nil } -// PackUpperLowerCollision is the Go binding used to pack the parameters required for calling +// PackUpperLowerCollision is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xaf7486ab. // // Solidity: function UpperLowerCollision() view returns(int256 _Res, int256 res) @@ -238,6 +273,14 @@ func (underscorer *Underscorer) PackUpperLowerCollision() []byte { return enc } +// PackUpperLowerCollision is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xaf7486ab. +// +// Solidity: function UpperLowerCollision() view returns(int256 _Res, int256 res) +func (underscorer *Underscorer) TryPackUpperLowerCollision() ([]byte, error) { + return underscorer.abi.Pack("UpperLowerCollision") +} + // UpperLowerCollisionOutput serves as a container for the return parameters of contract // method UpperLowerCollision. type UpperLowerCollisionOutput struct { @@ -249,19 +292,18 @@ type UpperLowerCollisionOutput struct { // from invoking the contract method with ID 0xaf7486ab. // // Solidity: function UpperLowerCollision() view returns(int256 _Res, int256 res) -func (underscorer *Underscorer) UnpackUpperLowerCollision(data []byte) (UpperLowerCollisionOutput, error) { +func (underscorer *Underscorer) UnpackUpperLowerCollision(data []byte) (*UpperLowerCollisionOutput, error) { out, err := underscorer.abi.Unpack("UpperLowerCollision", data) - outstruct := new(UpperLowerCollisionOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(UpperLowerCollisionOutput) outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return *outstruct, err - + return outstruct, nil } -// PackUpperUpperCollision is the Go binding used to pack the parameters required for calling +// PackUpperUpperCollision is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xe02ab24d. // // Solidity: function UpperUpperCollision() view returns(int256 _Res, int256 Res) @@ -273,6 +315,14 @@ func (underscorer *Underscorer) PackUpperUpperCollision() []byte { return enc } +// PackUpperUpperCollision is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xe02ab24d. +// +// Solidity: function UpperUpperCollision() view returns(int256 _Res, int256 Res) +func (underscorer *Underscorer) TryPackUpperUpperCollision() ([]byte, error) { + return underscorer.abi.Pack("UpperUpperCollision") +} + // UpperUpperCollisionOutput serves as a container for the return parameters of contract // method UpperUpperCollision. type UpperUpperCollisionOutput struct { @@ -284,19 +334,18 @@ type UpperUpperCollisionOutput struct { // from invoking the contract method with ID 0xe02ab24d. // // Solidity: function UpperUpperCollision() view returns(int256 _Res, int256 Res) -func (underscorer *Underscorer) UnpackUpperUpperCollision(data []byte) (UpperUpperCollisionOutput, error) { +func (underscorer *Underscorer) UnpackUpperUpperCollision(data []byte) (*UpperUpperCollisionOutput, error) { out, err := underscorer.abi.Unpack("UpperUpperCollision", data) - outstruct := new(UpperUpperCollisionOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(UpperUpperCollisionOutput) outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return *outstruct, err - + return outstruct, nil } -// PackUnderScoredFunc is the Go binding used to pack the parameters required for calling +// PackUnderScoredFunc is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x46546dbe. // // Solidity: function _under_scored_func() view returns(int256 _int) @@ -308,6 +357,14 @@ func (underscorer *Underscorer) PackUnderScoredFunc() []byte { return enc } +// PackUnderScoredFunc is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x46546dbe. +// +// Solidity: function _under_scored_func() view returns(int256 _int) +func (underscorer *Underscorer) TryPackUnderScoredFunc() ([]byte, error) { + return underscorer.abi.Pack("_under_scored_func") +} + // UnpackUnderScoredFunc is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x46546dbe. // @@ -318,5 +375,5 @@ func (underscorer *Underscorer) UnpackUnderScoredFunc(data []byte) (*big.Int, er return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } From 39c1de6c5cea02ea5fb2ee5adcc1f2828a04c1c4 Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Fri, 25 Apr 2025 17:25:28 +0800 Subject: [PATCH 7/9] accounts/abi: revert pointer return for Unpack --- accounts/abi/abigen/source2.go.tpl | 21 ++- .../abigen/testdata/v2/callbackparam.go.txt | 10 +- .../abi/abigen/testdata/v2/crowdsale.go.txt | 88 ++++++---- accounts/abi/abigen/testdata/v2/dao.go.txt | 166 +++++++++++------- .../testdata/v2/deeplynestedarray.go.txt | 30 ++-- accounts/abi/abigen/testdata/v2/getter.go.txt | 18 +- .../testdata/v2/identifiercollision.go.txt | 20 ++- .../abigen/testdata/v2/inputchecker.go.txt | 60 ++++--- .../abi/abigen/testdata/v2/interactor.go.txt | 30 ++-- .../abigen/testdata/v2/nameconflict.go.txt | 20 ++- .../testdata/v2/numericmethodname.go.txt | 30 ++-- .../abigen/testdata/v2/outputchecker.go.txt | 102 ++++++----- .../abi/abigen/testdata/v2/overload.go.txt | 20 ++- .../abigen/testdata/v2/rangekeyword.go.txt | 10 +- accounts/abi/abigen/testdata/v2/slicer.go.txt | 40 +++-- .../abi/abigen/testdata/v2/structs.go.txt | 28 +-- accounts/abi/abigen/testdata/v2/token.go.txt | 90 ++++++---- accounts/abi/abigen/testdata/v2/tuple.go.txt | 38 ++-- accounts/abi/abigen/testdata/v2/tupler.go.txt | 18 +- .../abi/abigen/testdata/v2/underscorer.go.txt | 136 +++++++------- .../bind/v2/internal/contracts/db/bindings.go | 66 ++++--- .../v2/internal/contracts/events/bindings.go | 20 ++- .../contracts/nested_libraries/bindings.go | 80 +++++---- .../contracts/solc_errors/bindings.go | 30 ++-- .../contracts/uint256arrayreturn/bindings.go | 10 +- 25 files changed, 692 insertions(+), 489 deletions(-) diff --git a/accounts/abi/abigen/source2.go.tpl b/accounts/abi/abigen/source2.go.tpl index 4131cd884174..4d4b7149a827 100644 --- a/accounts/abi/abigen/source2.go.tpl +++ b/accounts/abi/abigen/source2.go.tpl @@ -89,8 +89,9 @@ var ( {{ end }} {{range .Calls}} - // Pack{{.Normalized.Name}} is the Go binding used to pack the parameters required for calling, will panic for any error. - // the contract method with ID 0x{{printf "%x" .Original.ID}}. + // Pack{{.Normalized.Name}} is the Go binding used to pack the parameters required for calling + // the contract method with ID 0x{{printf "%x" .Original.ID}}. This method will panic if any + // invalid/nil inputs are passed. // // Solidity: {{.Original.String}} func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) Pack{{.Normalized.Name}}({{range .Normalized.Inputs}} {{.Name}} {{bindtype .Type $structs}}, {{end}}) []byte { @@ -101,8 +102,9 @@ var ( return enc } - // Pack{{.Normalized.Name}} is the Go binding used to pack the parameters required for calling, return error if it failed to pack. - // the contract method with ID 0x{{printf "%x" .Original.ID}}. + // Pack{{.Normalized.Name}} is the Go binding used to pack the parameters required for calling + // the contract method with ID 0x{{printf "%x" .Original.ID}}. This method will return an error + // if any inputs are invalid/nil. // // Solidity: {{.Original.String}} func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) TryPack{{.Normalized.Name}}({{range .Normalized.Inputs}} {{.Name}} {{bindtype .Type $structs}}, {{end}}) ([]byte, error) { @@ -125,15 +127,15 @@ var ( // // Solidity: {{.Original.String}} func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) Unpack{{.Normalized.Name}}(data []byte) ( - {{- if .Structured}} *{{.Normalized.Name}}Output,{{else}} + {{- 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}} + outstruct := new({{.Normalized.Name}}Output) if err != nil { - return nil, err + return *outstruct, err } - outstruct := new({{.Normalized.Name}}Output) {{- range $i, $t := .Normalized.Outputs}} {{- if ispointertype .Type}} outstruct.{{capitalise .Name}} = abi.ConvertType(out[{{$i}}], new({{underlyingbindtype .Type }})).({{bindtype .Type $structs}}) @@ -141,7 +143,7 @@ var ( outstruct.{{capitalise .Name}} = *abi.ConvertType(out[{{$i}}], new({{bindtype .Type $structs}})).(*{{bindtype .Type $structs}}) {{- end }} {{- end }} - return outstruct, nil{{else}} + return *outstruct, nil{{else}} if err != nil { return {{range $i, $_ := .Normalized.Outputs}}{{if ispointertype .Type}}new({{underlyingbindtype .Type }}), {{else}}*new({{bindtype .Type $structs}}), {{end}}{{end}} err } @@ -152,7 +154,8 @@ var ( out{{$i}} := *abi.ConvertType(out[{{$i}}], new({{bindtype .Type $structs}})).(*{{bindtype .Type $structs}}) {{- end }} {{- end}} - return {{range $i, $t := .Normalized.Outputs}}out{{$i}}, {{end}} nil{{- end}} + return {{range $i, $t := .Normalized.Outputs}}out{{$i}}, {{end}} nil + {{- end}} } {{end}} {{end}} diff --git a/accounts/abi/abigen/testdata/v2/callbackparam.go.txt b/accounts/abi/abigen/testdata/v2/callbackparam.go.txt index d3abab505499..4e9ccbe2cca0 100644 --- a/accounts/abi/abigen/testdata/v2/callbackparam.go.txt +++ b/accounts/abi/abigen/testdata/v2/callbackparam.go.txt @@ -51,8 +51,9 @@ func (c *CallbackParam) Instance(backend bind.ContractBackend, addr common.Addre return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackTest is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xd7a5aba2. +// PackTest is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xd7a5aba2. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function test(function callback) returns() func (callbackParam *CallbackParam) PackTest(callback [24]byte) []byte { @@ -63,8 +64,9 @@ func (callbackParam *CallbackParam) PackTest(callback [24]byte) []byte { return enc } -// PackTest is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xd7a5aba2. +// PackTest is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xd7a5aba2. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function test(function callback) returns() func (callbackParam *CallbackParam) TryPackTest(callback [24]byte) ([]byte, error) { diff --git a/accounts/abi/abigen/testdata/v2/crowdsale.go.txt b/accounts/abi/abigen/testdata/v2/crowdsale.go.txt index 078784e20f12..4b9b3f04560c 100644 --- a/accounts/abi/abigen/testdata/v2/crowdsale.go.txt +++ b/accounts/abi/abigen/testdata/v2/crowdsale.go.txt @@ -63,8 +63,9 @@ func (crowdsale *Crowdsale) PackConstructor(ifSuccessfulSendTo common.Address, f return enc } -// PackAmountRaised is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x7b3e5e7b. +// PackAmountRaised is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x7b3e5e7b. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function amountRaised() returns(uint256) func (crowdsale *Crowdsale) PackAmountRaised() []byte { @@ -75,8 +76,9 @@ func (crowdsale *Crowdsale) PackAmountRaised() []byte { return enc } -// PackAmountRaised is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x7b3e5e7b. +// PackAmountRaised is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x7b3e5e7b. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function amountRaised() returns(uint256) func (crowdsale *Crowdsale) TryPackAmountRaised() ([]byte, error) { @@ -96,8 +98,9 @@ func (crowdsale *Crowdsale) UnpackAmountRaised(data []byte) (*big.Int, error) { return out0, nil } -// PackBeneficiary is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x38af3eed. +// PackBeneficiary is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x38af3eed. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function beneficiary() returns(address) func (crowdsale *Crowdsale) PackBeneficiary() []byte { @@ -108,8 +111,9 @@ func (crowdsale *Crowdsale) PackBeneficiary() []byte { return enc } -// PackBeneficiary is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x38af3eed. +// PackBeneficiary is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x38af3eed. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function beneficiary() returns(address) func (crowdsale *Crowdsale) TryPackBeneficiary() ([]byte, error) { @@ -129,8 +133,9 @@ func (crowdsale *Crowdsale) UnpackBeneficiary(data []byte) (common.Address, erro return out0, nil } -// PackCheckGoalReached is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x01cb3b20. +// PackCheckGoalReached is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x01cb3b20. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function checkGoalReached() returns() func (crowdsale *Crowdsale) PackCheckGoalReached() []byte { @@ -141,16 +146,18 @@ func (crowdsale *Crowdsale) PackCheckGoalReached() []byte { return enc } -// PackCheckGoalReached is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x01cb3b20. +// PackCheckGoalReached is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x01cb3b20. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function checkGoalReached() returns() func (crowdsale *Crowdsale) TryPackCheckGoalReached() ([]byte, error) { return crowdsale.abi.Pack("checkGoalReached") } -// PackDeadline is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x29dcb0cf. +// PackDeadline is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x29dcb0cf. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function deadline() returns(uint256) func (crowdsale *Crowdsale) PackDeadline() []byte { @@ -161,8 +168,9 @@ func (crowdsale *Crowdsale) PackDeadline() []byte { return enc } -// PackDeadline is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x29dcb0cf. +// PackDeadline is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x29dcb0cf. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function deadline() returns(uint256) func (crowdsale *Crowdsale) TryPackDeadline() ([]byte, error) { @@ -182,8 +190,9 @@ func (crowdsale *Crowdsale) UnpackDeadline(data []byte) (*big.Int, error) { return out0, nil } -// PackFunders is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xdc0d3dff. +// PackFunders is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xdc0d3dff. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function funders(uint256 ) returns(address addr, uint256 amount) func (crowdsale *Crowdsale) PackFunders(arg0 *big.Int) []byte { @@ -194,8 +203,9 @@ func (crowdsale *Crowdsale) PackFunders(arg0 *big.Int) []byte { return enc } -// PackFunders is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xdc0d3dff. +// PackFunders is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xdc0d3dff. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function funders(uint256 ) returns(address addr, uint256 amount) func (crowdsale *Crowdsale) TryPackFunders(arg0 *big.Int) ([]byte, error) { @@ -213,19 +223,20 @@ type FundersOutput struct { // from invoking the contract method with ID 0xdc0d3dff. // // Solidity: function funders(uint256 ) returns(address addr, uint256 amount) -func (crowdsale *Crowdsale) UnpackFunders(data []byte) (*FundersOutput, error) { +func (crowdsale *Crowdsale) UnpackFunders(data []byte) (FundersOutput, error) { out, err := crowdsale.abi.Unpack("funders", data) + outstruct := new(FundersOutput) if err != nil { - return nil, err + return *outstruct, err } - outstruct := new(FundersOutput) outstruct.Addr = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) outstruct.Amount = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return outstruct, nil + return *outstruct, nil } -// PackFundingGoal is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x7a3a0e84. +// PackFundingGoal is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x7a3a0e84. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function fundingGoal() returns(uint256) func (crowdsale *Crowdsale) PackFundingGoal() []byte { @@ -236,8 +247,9 @@ func (crowdsale *Crowdsale) PackFundingGoal() []byte { return enc } -// PackFundingGoal is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x7a3a0e84. +// PackFundingGoal is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x7a3a0e84. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function fundingGoal() returns(uint256) func (crowdsale *Crowdsale) TryPackFundingGoal() ([]byte, error) { @@ -257,8 +269,9 @@ func (crowdsale *Crowdsale) UnpackFundingGoal(data []byte) (*big.Int, error) { return out0, nil } -// PackPrice is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xa035b1fe. +// PackPrice is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xa035b1fe. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function price() returns(uint256) func (crowdsale *Crowdsale) PackPrice() []byte { @@ -269,8 +282,9 @@ func (crowdsale *Crowdsale) PackPrice() []byte { return enc } -// PackPrice is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xa035b1fe. +// PackPrice is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xa035b1fe. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function price() returns(uint256) func (crowdsale *Crowdsale) TryPackPrice() ([]byte, error) { @@ -290,8 +304,9 @@ func (crowdsale *Crowdsale) UnpackPrice(data []byte) (*big.Int, error) { return out0, nil } -// PackTokenReward is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x6e66f6e9. +// PackTokenReward is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x6e66f6e9. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function tokenReward() returns(address) func (crowdsale *Crowdsale) PackTokenReward() []byte { @@ -302,8 +317,9 @@ func (crowdsale *Crowdsale) PackTokenReward() []byte { return enc } -// PackTokenReward is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x6e66f6e9. +// PackTokenReward is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x6e66f6e9. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function tokenReward() returns(address) func (crowdsale *Crowdsale) TryPackTokenReward() ([]byte, error) { diff --git a/accounts/abi/abigen/testdata/v2/dao.go.txt b/accounts/abi/abigen/testdata/v2/dao.go.txt index 0c656b54cecd..54e0d382429f 100644 --- a/accounts/abi/abigen/testdata/v2/dao.go.txt +++ b/accounts/abi/abigen/testdata/v2/dao.go.txt @@ -63,8 +63,9 @@ func (dAO *DAO) PackConstructor(minimumQuorumForProposals *big.Int, minutesForDe return enc } -// PackChangeMembership is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x9644fcbd. +// PackChangeMembership is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x9644fcbd. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function changeMembership(address targetMember, bool canVote, string memberName) returns() func (dAO *DAO) PackChangeMembership(targetMember common.Address, canVote bool, memberName string) []byte { @@ -75,16 +76,18 @@ func (dAO *DAO) PackChangeMembership(targetMember common.Address, canVote bool, return enc } -// PackChangeMembership is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x9644fcbd. +// PackChangeMembership is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x9644fcbd. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function changeMembership(address targetMember, bool canVote, string memberName) returns() func (dAO *DAO) TryPackChangeMembership(targetMember common.Address, canVote bool, memberName string) ([]byte, error) { return dAO.abi.Pack("changeMembership", targetMember, canVote, memberName) } -// PackChangeVotingRules is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xbcca1fd3. +// PackChangeVotingRules is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xbcca1fd3. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function changeVotingRules(uint256 minimumQuorumForProposals, uint256 minutesForDebate, int256 marginOfVotesForMajority) returns() func (dAO *DAO) PackChangeVotingRules(minimumQuorumForProposals *big.Int, minutesForDebate *big.Int, marginOfVotesForMajority *big.Int) []byte { @@ -95,16 +98,18 @@ func (dAO *DAO) PackChangeVotingRules(minimumQuorumForProposals *big.Int, minute return enc } -// PackChangeVotingRules is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xbcca1fd3. +// PackChangeVotingRules is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xbcca1fd3. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function changeVotingRules(uint256 minimumQuorumForProposals, uint256 minutesForDebate, int256 marginOfVotesForMajority) returns() func (dAO *DAO) TryPackChangeVotingRules(minimumQuorumForProposals *big.Int, minutesForDebate *big.Int, marginOfVotesForMajority *big.Int) ([]byte, error) { return dAO.abi.Pack("changeVotingRules", minimumQuorumForProposals, minutesForDebate, marginOfVotesForMajority) } -// PackCheckProposalCode is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xeceb2945. +// PackCheckProposalCode is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xeceb2945. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function checkProposalCode(uint256 proposalNumber, address beneficiary, uint256 etherAmount, bytes transactionBytecode) returns(bool codeChecksOut) func (dAO *DAO) PackCheckProposalCode(proposalNumber *big.Int, beneficiary common.Address, etherAmount *big.Int, transactionBytecode []byte) []byte { @@ -115,8 +120,9 @@ func (dAO *DAO) PackCheckProposalCode(proposalNumber *big.Int, beneficiary commo return enc } -// PackCheckProposalCode is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xeceb2945. +// PackCheckProposalCode is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xeceb2945. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function checkProposalCode(uint256 proposalNumber, address beneficiary, uint256 etherAmount, bytes transactionBytecode) returns(bool codeChecksOut) func (dAO *DAO) TryPackCheckProposalCode(proposalNumber *big.Int, beneficiary common.Address, etherAmount *big.Int, transactionBytecode []byte) ([]byte, error) { @@ -136,8 +142,9 @@ func (dAO *DAO) UnpackCheckProposalCode(data []byte) (bool, error) { return out0, nil } -// PackDebatingPeriodInMinutes is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x69bd3436. +// PackDebatingPeriodInMinutes is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x69bd3436. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function debatingPeriodInMinutes() returns(uint256) func (dAO *DAO) PackDebatingPeriodInMinutes() []byte { @@ -148,8 +155,9 @@ func (dAO *DAO) PackDebatingPeriodInMinutes() []byte { return enc } -// PackDebatingPeriodInMinutes is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x69bd3436. +// PackDebatingPeriodInMinutes is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x69bd3436. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function debatingPeriodInMinutes() returns(uint256) func (dAO *DAO) TryPackDebatingPeriodInMinutes() ([]byte, error) { @@ -169,8 +177,9 @@ func (dAO *DAO) UnpackDebatingPeriodInMinutes(data []byte) (*big.Int, error) { return out0, nil } -// PackExecuteProposal is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x237e9492. +// PackExecuteProposal is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x237e9492. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function executeProposal(uint256 proposalNumber, bytes transactionBytecode) returns(int256 result) func (dAO *DAO) PackExecuteProposal(proposalNumber *big.Int, transactionBytecode []byte) []byte { @@ -181,8 +190,9 @@ func (dAO *DAO) PackExecuteProposal(proposalNumber *big.Int, transactionBytecode return enc } -// PackExecuteProposal is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x237e9492. +// PackExecuteProposal is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x237e9492. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function executeProposal(uint256 proposalNumber, bytes transactionBytecode) returns(int256 result) func (dAO *DAO) TryPackExecuteProposal(proposalNumber *big.Int, transactionBytecode []byte) ([]byte, error) { @@ -202,8 +212,9 @@ func (dAO *DAO) UnpackExecuteProposal(data []byte) (*big.Int, error) { return out0, nil } -// PackMajorityMargin is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xaa02a90f. +// PackMajorityMargin is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xaa02a90f. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function majorityMargin() returns(int256) func (dAO *DAO) PackMajorityMargin() []byte { @@ -214,8 +225,9 @@ func (dAO *DAO) PackMajorityMargin() []byte { return enc } -// PackMajorityMargin is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xaa02a90f. +// PackMajorityMargin is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xaa02a90f. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function majorityMargin() returns(int256) func (dAO *DAO) TryPackMajorityMargin() ([]byte, error) { @@ -235,8 +247,9 @@ func (dAO *DAO) UnpackMajorityMargin(data []byte) (*big.Int, error) { return out0, nil } -// PackMemberId is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x39106821. +// PackMemberId is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x39106821. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function memberId(address ) returns(uint256) func (dAO *DAO) PackMemberId(arg0 common.Address) []byte { @@ -247,8 +260,9 @@ func (dAO *DAO) PackMemberId(arg0 common.Address) []byte { return enc } -// PackMemberId is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x39106821. +// PackMemberId is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x39106821. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function memberId(address ) returns(uint256) func (dAO *DAO) TryPackMemberId(arg0 common.Address) ([]byte, error) { @@ -268,8 +282,9 @@ func (dAO *DAO) UnpackMemberId(data []byte) (*big.Int, error) { return out0, nil } -// PackMembers is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x5daf08ca. +// PackMembers is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x5daf08ca. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function members(uint256 ) returns(address member, bool canVote, string name, uint256 memberSince) func (dAO *DAO) PackMembers(arg0 *big.Int) []byte { @@ -280,8 +295,9 @@ func (dAO *DAO) PackMembers(arg0 *big.Int) []byte { return enc } -// PackMembers is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x5daf08ca. +// PackMembers is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x5daf08ca. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function members(uint256 ) returns(address member, bool canVote, string name, uint256 memberSince) func (dAO *DAO) TryPackMembers(arg0 *big.Int) ([]byte, error) { @@ -301,21 +317,22 @@ type MembersOutput struct { // from invoking the contract method with ID 0x5daf08ca. // // Solidity: function members(uint256 ) returns(address member, bool canVote, string name, uint256 memberSince) -func (dAO *DAO) UnpackMembers(data []byte) (*MembersOutput, error) { +func (dAO *DAO) UnpackMembers(data []byte) (MembersOutput, error) { out, err := dAO.abi.Unpack("members", data) + outstruct := new(MembersOutput) if err != nil { - return nil, err + return *outstruct, err } - outstruct := new(MembersOutput) outstruct.Member = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) outstruct.CanVote = *abi.ConvertType(out[1], new(bool)).(*bool) outstruct.Name = *abi.ConvertType(out[2], new(string)).(*string) outstruct.MemberSince = abi.ConvertType(out[3], new(big.Int)).(*big.Int) - return outstruct, nil + return *outstruct, nil } -// PackMinimumQuorum is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x8160f0b5. +// PackMinimumQuorum is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x8160f0b5. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function minimumQuorum() returns(uint256) func (dAO *DAO) PackMinimumQuorum() []byte { @@ -326,8 +343,9 @@ func (dAO *DAO) PackMinimumQuorum() []byte { return enc } -// PackMinimumQuorum is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x8160f0b5. +// PackMinimumQuorum is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x8160f0b5. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function minimumQuorum() returns(uint256) func (dAO *DAO) TryPackMinimumQuorum() ([]byte, error) { @@ -347,8 +365,9 @@ func (dAO *DAO) UnpackMinimumQuorum(data []byte) (*big.Int, error) { return out0, nil } -// PackNewProposal is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xb1050da5. +// PackNewProposal is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xb1050da5. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function newProposal(address beneficiary, uint256 etherAmount, string JobDescription, bytes transactionBytecode) returns(uint256 proposalID) func (dAO *DAO) PackNewProposal(beneficiary common.Address, etherAmount *big.Int, jobDescription string, transactionBytecode []byte) []byte { @@ -359,8 +378,9 @@ func (dAO *DAO) PackNewProposal(beneficiary common.Address, etherAmount *big.Int return enc } -// PackNewProposal is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xb1050da5. +// PackNewProposal is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xb1050da5. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function newProposal(address beneficiary, uint256 etherAmount, string JobDescription, bytes transactionBytecode) returns(uint256 proposalID) func (dAO *DAO) TryPackNewProposal(beneficiary common.Address, etherAmount *big.Int, jobDescription string, transactionBytecode []byte) ([]byte, error) { @@ -380,8 +400,9 @@ func (dAO *DAO) UnpackNewProposal(data []byte) (*big.Int, error) { return out0, nil } -// PackNumProposals is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x400e3949. +// PackNumProposals is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x400e3949. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function numProposals() returns(uint256) func (dAO *DAO) PackNumProposals() []byte { @@ -392,8 +413,9 @@ func (dAO *DAO) PackNumProposals() []byte { return enc } -// PackNumProposals is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x400e3949. +// PackNumProposals is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x400e3949. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function numProposals() returns(uint256) func (dAO *DAO) TryPackNumProposals() ([]byte, error) { @@ -413,8 +435,9 @@ func (dAO *DAO) UnpackNumProposals(data []byte) (*big.Int, error) { return out0, nil } -// PackOwner is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x8da5cb5b. +// PackOwner is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x8da5cb5b. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function owner() returns(address) func (dAO *DAO) PackOwner() []byte { @@ -425,8 +448,9 @@ func (dAO *DAO) PackOwner() []byte { return enc } -// PackOwner is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x8da5cb5b. +// PackOwner is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x8da5cb5b. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function owner() returns(address) func (dAO *DAO) TryPackOwner() ([]byte, error) { @@ -446,8 +470,9 @@ func (dAO *DAO) UnpackOwner(data []byte) (common.Address, error) { return out0, nil } -// PackProposals is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x013cf08b. +// PackProposals is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x013cf08b. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function proposals(uint256 ) returns(address recipient, uint256 amount, string description, uint256 votingDeadline, bool executed, bool proposalPassed, uint256 numberOfVotes, int256 currentResult, bytes32 proposalHash) func (dAO *DAO) PackProposals(arg0 *big.Int) []byte { @@ -458,8 +483,9 @@ func (dAO *DAO) PackProposals(arg0 *big.Int) []byte { return enc } -// PackProposals is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x013cf08b. +// PackProposals is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x013cf08b. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function proposals(uint256 ) returns(address recipient, uint256 amount, string description, uint256 votingDeadline, bool executed, bool proposalPassed, uint256 numberOfVotes, int256 currentResult, bytes32 proposalHash) func (dAO *DAO) TryPackProposals(arg0 *big.Int) ([]byte, error) { @@ -484,12 +510,12 @@ type ProposalsOutput struct { // from invoking the contract method with ID 0x013cf08b. // // Solidity: function proposals(uint256 ) returns(address recipient, uint256 amount, string description, uint256 votingDeadline, bool executed, bool proposalPassed, uint256 numberOfVotes, int256 currentResult, bytes32 proposalHash) -func (dAO *DAO) UnpackProposals(data []byte) (*ProposalsOutput, error) { +func (dAO *DAO) UnpackProposals(data []byte) (ProposalsOutput, error) { out, err := dAO.abi.Unpack("proposals", data) + outstruct := new(ProposalsOutput) if err != nil { - return nil, err + return *outstruct, err } - outstruct := new(ProposalsOutput) outstruct.Recipient = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) outstruct.Amount = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Description = *abi.ConvertType(out[2], new(string)).(*string) @@ -499,11 +525,12 @@ func (dAO *DAO) UnpackProposals(data []byte) (*ProposalsOutput, error) { outstruct.NumberOfVotes = abi.ConvertType(out[6], new(big.Int)).(*big.Int) outstruct.CurrentResult = abi.ConvertType(out[7], new(big.Int)).(*big.Int) outstruct.ProposalHash = *abi.ConvertType(out[8], new([32]byte)).(*[32]byte) - return outstruct, nil + return *outstruct, nil } -// PackTransferOwnership is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xf2fde38b. +// PackTransferOwnership is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xf2fde38b. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function transferOwnership(address newOwner) returns() func (dAO *DAO) PackTransferOwnership(newOwner common.Address) []byte { @@ -514,16 +541,18 @@ func (dAO *DAO) PackTransferOwnership(newOwner common.Address) []byte { return enc } -// PackTransferOwnership is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xf2fde38b. +// PackTransferOwnership is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xf2fde38b. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function transferOwnership(address newOwner) returns() func (dAO *DAO) TryPackTransferOwnership(newOwner common.Address) ([]byte, error) { return dAO.abi.Pack("transferOwnership", newOwner) } -// PackVote is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xd3c0715b. +// PackVote is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xd3c0715b. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function vote(uint256 proposalNumber, bool supportsProposal, string justificationText) returns(uint256 voteID) func (dAO *DAO) PackVote(proposalNumber *big.Int, supportsProposal bool, justificationText string) []byte { @@ -534,8 +563,9 @@ func (dAO *DAO) PackVote(proposalNumber *big.Int, supportsProposal bool, justifi return enc } -// PackVote is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xd3c0715b. +// PackVote is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xd3c0715b. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function vote(uint256 proposalNumber, bool supportsProposal, string justificationText) returns(uint256 voteID) func (dAO *DAO) TryPackVote(proposalNumber *big.Int, supportsProposal bool, justificationText string) ([]byte, error) { diff --git a/accounts/abi/abigen/testdata/v2/deeplynestedarray.go.txt b/accounts/abi/abigen/testdata/v2/deeplynestedarray.go.txt index b4788ec93028..edc5d10431ab 100644 --- a/accounts/abi/abigen/testdata/v2/deeplynestedarray.go.txt +++ b/accounts/abi/abigen/testdata/v2/deeplynestedarray.go.txt @@ -51,8 +51,9 @@ func (c *DeeplyNestedArray) Instance(backend bind.ContractBackend, addr common.A return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackDeepUint64Array is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x98ed1856. +// PackDeepUint64Array is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x98ed1856. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function deepUint64Array(uint256 , uint256 , uint256 ) view returns(uint64) func (deeplyNestedArray *DeeplyNestedArray) PackDeepUint64Array(arg0 *big.Int, arg1 *big.Int, arg2 *big.Int) []byte { @@ -63,8 +64,9 @@ func (deeplyNestedArray *DeeplyNestedArray) PackDeepUint64Array(arg0 *big.Int, a return enc } -// PackDeepUint64Array is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x98ed1856. +// PackDeepUint64Array is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x98ed1856. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function deepUint64Array(uint256 , uint256 , uint256 ) view returns(uint64) func (deeplyNestedArray *DeeplyNestedArray) TryPackDeepUint64Array(arg0 *big.Int, arg1 *big.Int, arg2 *big.Int) ([]byte, error) { @@ -84,8 +86,9 @@ func (deeplyNestedArray *DeeplyNestedArray) UnpackDeepUint64Array(data []byte) ( return out0, nil } -// PackRetrieveDeepArray is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x8ed4573a. +// PackRetrieveDeepArray is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x8ed4573a. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function retrieveDeepArray() view returns(uint64[3][4][5]) func (deeplyNestedArray *DeeplyNestedArray) PackRetrieveDeepArray() []byte { @@ -96,8 +99,9 @@ func (deeplyNestedArray *DeeplyNestedArray) PackRetrieveDeepArray() []byte { return enc } -// PackRetrieveDeepArray is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x8ed4573a. +// PackRetrieveDeepArray is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x8ed4573a. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function retrieveDeepArray() view returns(uint64[3][4][5]) func (deeplyNestedArray *DeeplyNestedArray) TryPackRetrieveDeepArray() ([]byte, error) { @@ -117,8 +121,9 @@ func (deeplyNestedArray *DeeplyNestedArray) UnpackRetrieveDeepArray(data []byte) return out0, nil } -// PackStoreDeepUintArray is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x34424855. +// PackStoreDeepUintArray is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x34424855. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function storeDeepUintArray(uint64[3][4][5] arr) returns() func (deeplyNestedArray *DeeplyNestedArray) PackStoreDeepUintArray(arr [5][4][3]uint64) []byte { @@ -129,8 +134,9 @@ func (deeplyNestedArray *DeeplyNestedArray) PackStoreDeepUintArray(arr [5][4][3] return enc } -// PackStoreDeepUintArray is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x34424855. +// PackStoreDeepUintArray is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x34424855. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function storeDeepUintArray(uint64[3][4][5] arr) returns() func (deeplyNestedArray *DeeplyNestedArray) TryPackStoreDeepUintArray(arr [5][4][3]uint64) ([]byte, error) { diff --git a/accounts/abi/abigen/testdata/v2/getter.go.txt b/accounts/abi/abigen/testdata/v2/getter.go.txt index 2fa09c4c25f9..a7b62be6d64b 100644 --- a/accounts/abi/abigen/testdata/v2/getter.go.txt +++ b/accounts/abi/abigen/testdata/v2/getter.go.txt @@ -51,8 +51,9 @@ func (c *Getter) Instance(backend bind.ContractBackend, addr common.Address) *bi return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackGetter is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x993a04b7. +// PackGetter is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x993a04b7. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function getter() returns(string, int256, bytes32) func (getter *Getter) PackGetter() []byte { @@ -63,8 +64,9 @@ func (getter *Getter) PackGetter() []byte { return enc } -// PackGetter is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x993a04b7. +// PackGetter is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x993a04b7. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function getter() returns(string, int256, bytes32) func (getter *Getter) TryPackGetter() ([]byte, error) { @@ -83,14 +85,14 @@ type GetterOutput struct { // from invoking the contract method with ID 0x993a04b7. // // Solidity: function getter() returns(string, int256, bytes32) -func (getter *Getter) UnpackGetter(data []byte) (*GetterOutput, error) { +func (getter *Getter) UnpackGetter(data []byte) (GetterOutput, error) { out, err := getter.abi.Unpack("getter", data) + outstruct := new(GetterOutput) if err != nil { - return nil, err + return *outstruct, err } - outstruct := new(GetterOutput) outstruct.Arg0 = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Arg2 = *abi.ConvertType(out[2], new([32]byte)).(*[32]byte) - return outstruct, nil + return *outstruct, nil } diff --git a/accounts/abi/abigen/testdata/v2/identifiercollision.go.txt b/accounts/abi/abigen/testdata/v2/identifiercollision.go.txt index b29365366e0a..0105be1b3d12 100644 --- a/accounts/abi/abigen/testdata/v2/identifiercollision.go.txt +++ b/accounts/abi/abigen/testdata/v2/identifiercollision.go.txt @@ -51,8 +51,9 @@ func (c *IdentifierCollision) Instance(backend bind.ContractBackend, addr common return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackMyVar is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x4ef1f0ad. +// PackMyVar is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x4ef1f0ad. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function MyVar() view returns(uint256) func (identifierCollision *IdentifierCollision) PackMyVar() []byte { @@ -63,8 +64,9 @@ func (identifierCollision *IdentifierCollision) PackMyVar() []byte { return enc } -// PackMyVar is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x4ef1f0ad. +// PackMyVar is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x4ef1f0ad. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function MyVar() view returns(uint256) func (identifierCollision *IdentifierCollision) TryPackMyVar() ([]byte, error) { @@ -84,8 +86,9 @@ func (identifierCollision *IdentifierCollision) UnpackMyVar(data []byte) (*big.I return out0, nil } -// PackPubVar is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x01ad4d87. +// PackPubVar is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x01ad4d87. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function _myVar() view returns(uint256) func (identifierCollision *IdentifierCollision) PackPubVar() []byte { @@ -96,8 +99,9 @@ func (identifierCollision *IdentifierCollision) PackPubVar() []byte { return enc } -// PackPubVar is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x01ad4d87. +// PackPubVar is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x01ad4d87. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function _myVar() view returns(uint256) func (identifierCollision *IdentifierCollision) TryPackPubVar() ([]byte, error) { diff --git a/accounts/abi/abigen/testdata/v2/inputchecker.go.txt b/accounts/abi/abigen/testdata/v2/inputchecker.go.txt index 5ef50dba1f81..580d9d4a1f4a 100644 --- a/accounts/abi/abigen/testdata/v2/inputchecker.go.txt +++ b/accounts/abi/abigen/testdata/v2/inputchecker.go.txt @@ -50,8 +50,9 @@ func (c *InputChecker) Instance(backend bind.ContractBackend, addr common.Addres return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackAnonInput is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x3e708e82. +// PackAnonInput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x3e708e82. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function anonInput(string ) returns() func (inputChecker *InputChecker) PackAnonInput(arg0 string) []byte { @@ -62,16 +63,18 @@ func (inputChecker *InputChecker) PackAnonInput(arg0 string) []byte { return enc } -// PackAnonInput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x3e708e82. +// PackAnonInput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x3e708e82. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function anonInput(string ) returns() func (inputChecker *InputChecker) TryPackAnonInput(arg0 string) ([]byte, error) { return inputChecker.abi.Pack("anonInput", arg0) } -// PackAnonInputs is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x28160527. +// PackAnonInputs is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x28160527. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function anonInputs(string , string ) returns() func (inputChecker *InputChecker) PackAnonInputs(arg0 string, arg1 string) []byte { @@ -82,16 +85,18 @@ func (inputChecker *InputChecker) PackAnonInputs(arg0 string, arg1 string) []byt return enc } -// PackAnonInputs is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x28160527. +// PackAnonInputs is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x28160527. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function anonInputs(string , string ) returns() func (inputChecker *InputChecker) TryPackAnonInputs(arg0 string, arg1 string) ([]byte, error) { return inputChecker.abi.Pack("anonInputs", arg0, arg1) } -// PackMixedInputs is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xc689ebdc. +// PackMixedInputs is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xc689ebdc. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function mixedInputs(string , string str) returns() func (inputChecker *InputChecker) PackMixedInputs(arg0 string, str string) []byte { @@ -102,16 +107,18 @@ func (inputChecker *InputChecker) PackMixedInputs(arg0 string, str string) []byt return enc } -// PackMixedInputs is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xc689ebdc. +// PackMixedInputs is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xc689ebdc. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function mixedInputs(string , string str) returns() func (inputChecker *InputChecker) TryPackMixedInputs(arg0 string, str string) ([]byte, error) { return inputChecker.abi.Pack("mixedInputs", arg0, str) } -// PackNamedInput is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x0d402005. +// PackNamedInput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x0d402005. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function namedInput(string str) returns() func (inputChecker *InputChecker) PackNamedInput(str string) []byte { @@ -122,16 +129,18 @@ func (inputChecker *InputChecker) PackNamedInput(str string) []byte { return enc } -// PackNamedInput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x0d402005. +// PackNamedInput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x0d402005. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function namedInput(string str) returns() func (inputChecker *InputChecker) TryPackNamedInput(str string) ([]byte, error) { return inputChecker.abi.Pack("namedInput", str) } -// PackNamedInputs is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x63c796ed. +// PackNamedInputs is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x63c796ed. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function namedInputs(string str1, string str2) returns() func (inputChecker *InputChecker) PackNamedInputs(str1 string, str2 string) []byte { @@ -142,16 +151,18 @@ func (inputChecker *InputChecker) PackNamedInputs(str1 string, str2 string) []by return enc } -// PackNamedInputs is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x63c796ed. +// PackNamedInputs is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x63c796ed. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function namedInputs(string str1, string str2) returns() func (inputChecker *InputChecker) TryPackNamedInputs(str1 string, str2 string) ([]byte, error) { return inputChecker.abi.Pack("namedInputs", str1, str2) } -// PackNoInput is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x53539029. +// PackNoInput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x53539029. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function noInput() returns() func (inputChecker *InputChecker) PackNoInput() []byte { @@ -162,8 +173,9 @@ func (inputChecker *InputChecker) PackNoInput() []byte { return enc } -// PackNoInput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x53539029. +// PackNoInput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x53539029. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function noInput() returns() func (inputChecker *InputChecker) TryPackNoInput() ([]byte, error) { diff --git a/accounts/abi/abigen/testdata/v2/interactor.go.txt b/accounts/abi/abigen/testdata/v2/interactor.go.txt index de8a0c52111e..3382078559c0 100644 --- a/accounts/abi/abigen/testdata/v2/interactor.go.txt +++ b/accounts/abi/abigen/testdata/v2/interactor.go.txt @@ -63,8 +63,9 @@ func (interactor *Interactor) PackConstructor(str string) []byte { return enc } -// PackDeployString is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x6874e809. +// PackDeployString is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x6874e809. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function deployString() returns(string) func (interactor *Interactor) PackDeployString() []byte { @@ -75,8 +76,9 @@ func (interactor *Interactor) PackDeployString() []byte { return enc } -// PackDeployString is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x6874e809. +// PackDeployString is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x6874e809. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function deployString() returns(string) func (interactor *Interactor) TryPackDeployString() ([]byte, error) { @@ -96,8 +98,9 @@ func (interactor *Interactor) UnpackDeployString(data []byte) (string, error) { return out0, nil } -// PackTransact is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xd736c513. +// PackTransact is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xd736c513. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function transact(string str) returns() func (interactor *Interactor) PackTransact(str string) []byte { @@ -108,16 +111,18 @@ func (interactor *Interactor) PackTransact(str string) []byte { return enc } -// PackTransact is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xd736c513. +// PackTransact is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xd736c513. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function transact(string str) returns() func (interactor *Interactor) TryPackTransact(str string) ([]byte, error) { return interactor.abi.Pack("transact", str) } -// PackTransactString is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x0d86a0e1. +// PackTransactString is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x0d86a0e1. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function transactString() returns(string) func (interactor *Interactor) PackTransactString() []byte { @@ -128,8 +133,9 @@ func (interactor *Interactor) PackTransactString() []byte { return enc } -// PackTransactString is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x0d86a0e1. +// PackTransactString is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x0d86a0e1. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function transactString() returns(string) func (interactor *Interactor) TryPackTransactString() ([]byte, error) { diff --git a/accounts/abi/abigen/testdata/v2/nameconflict.go.txt b/accounts/abi/abigen/testdata/v2/nameconflict.go.txt index fd0fcd31cc76..b8e07f6e09b1 100644 --- a/accounts/abi/abigen/testdata/v2/nameconflict.go.txt +++ b/accounts/abi/abigen/testdata/v2/nameconflict.go.txt @@ -57,8 +57,9 @@ func (c *NameConflict) Instance(backend bind.ContractBackend, addr common.Addres return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackAddRequest is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xcce7b048. +// PackAddRequest is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xcce7b048. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function addRequest((bytes,bytes) req) pure returns() func (nameConflict *NameConflict) PackAddRequest(req Oraclerequest) []byte { @@ -69,16 +70,18 @@ func (nameConflict *NameConflict) PackAddRequest(req Oraclerequest) []byte { return enc } -// PackAddRequest is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xcce7b048. +// PackAddRequest is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xcce7b048. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function addRequest((bytes,bytes) req) pure returns() func (nameConflict *NameConflict) TryPackAddRequest(req Oraclerequest) ([]byte, error) { return nameConflict.abi.Pack("addRequest", req) } -// PackGetRequest is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xc2bb515f. +// PackGetRequest is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xc2bb515f. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function getRequest() pure returns((bytes,bytes)) func (nameConflict *NameConflict) PackGetRequest() []byte { @@ -89,8 +92,9 @@ func (nameConflict *NameConflict) PackGetRequest() []byte { return enc } -// PackGetRequest is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xc2bb515f. +// PackGetRequest is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xc2bb515f. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function getRequest() pure returns((bytes,bytes)) func (nameConflict *NameConflict) TryPackGetRequest() ([]byte, error) { diff --git a/accounts/abi/abigen/testdata/v2/numericmethodname.go.txt b/accounts/abi/abigen/testdata/v2/numericmethodname.go.txt index e861aba44431..84e4134809a8 100644 --- a/accounts/abi/abigen/testdata/v2/numericmethodname.go.txt +++ b/accounts/abi/abigen/testdata/v2/numericmethodname.go.txt @@ -51,8 +51,9 @@ func (c *NumericMethodName) Instance(backend bind.ContractBackend, addr common.A return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackE1test is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xffa02795. +// PackE1test is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xffa02795. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function _1test() pure returns() func (numericMethodName *NumericMethodName) PackE1test() []byte { @@ -63,16 +64,18 @@ func (numericMethodName *NumericMethodName) PackE1test() []byte { return enc } -// PackE1test is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xffa02795. +// PackE1test is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xffa02795. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function _1test() pure returns() func (numericMethodName *NumericMethodName) TryPackE1test() ([]byte, error) { return numericMethodName.abi.Pack("_1test") } -// PackE1test0 is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xd02767c7. +// PackE1test0 is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xd02767c7. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function __1test() pure returns() func (numericMethodName *NumericMethodName) PackE1test0() []byte { @@ -83,16 +86,18 @@ func (numericMethodName *NumericMethodName) PackE1test0() []byte { return enc } -// PackE1test0 is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xd02767c7. +// PackE1test0 is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xd02767c7. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function __1test() pure returns() func (numericMethodName *NumericMethodName) TryPackE1test0() ([]byte, error) { return numericMethodName.abi.Pack("__1test") } -// PackE2test is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x9d993132. +// PackE2test is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x9d993132. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function __2test() pure returns() func (numericMethodName *NumericMethodName) PackE2test() []byte { @@ -103,8 +108,9 @@ func (numericMethodName *NumericMethodName) PackE2test() []byte { return enc } -// PackE2test is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x9d993132. +// PackE2test is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x9d993132. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function __2test() pure returns() func (numericMethodName *NumericMethodName) TryPackE2test() ([]byte, error) { diff --git a/accounts/abi/abigen/testdata/v2/outputchecker.go.txt b/accounts/abi/abigen/testdata/v2/outputchecker.go.txt index 5f95e747b70c..0ef2d47f84e9 100644 --- a/accounts/abi/abigen/testdata/v2/outputchecker.go.txt +++ b/accounts/abi/abigen/testdata/v2/outputchecker.go.txt @@ -50,8 +50,9 @@ func (c *OutputChecker) Instance(backend bind.ContractBackend, addr common.Addre return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackAnonOutput is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x008bda05. +// PackAnonOutput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x008bda05. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function anonOutput() returns(string) func (outputChecker *OutputChecker) PackAnonOutput() []byte { @@ -62,8 +63,9 @@ func (outputChecker *OutputChecker) PackAnonOutput() []byte { return enc } -// PackAnonOutput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x008bda05. +// PackAnonOutput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x008bda05. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function anonOutput() returns(string) func (outputChecker *OutputChecker) TryPackAnonOutput() ([]byte, error) { @@ -83,8 +85,9 @@ func (outputChecker *OutputChecker) UnpackAnonOutput(data []byte) (string, error return out0, nil } -// PackAnonOutputs is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x3c401115. +// PackAnonOutputs is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x3c401115. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function anonOutputs() returns(string, string) func (outputChecker *OutputChecker) PackAnonOutputs() []byte { @@ -95,8 +98,9 @@ func (outputChecker *OutputChecker) PackAnonOutputs() []byte { return enc } -// PackAnonOutputs is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x3c401115. +// PackAnonOutputs is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x3c401115. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function anonOutputs() returns(string, string) func (outputChecker *OutputChecker) TryPackAnonOutputs() ([]byte, error) { @@ -114,19 +118,20 @@ type AnonOutputsOutput struct { // from invoking the contract method with ID 0x3c401115. // // Solidity: function anonOutputs() returns(string, string) -func (outputChecker *OutputChecker) UnpackAnonOutputs(data []byte) (*AnonOutputsOutput, error) { +func (outputChecker *OutputChecker) UnpackAnonOutputs(data []byte) (AnonOutputsOutput, error) { out, err := outputChecker.abi.Unpack("anonOutputs", data) + outstruct := new(AnonOutputsOutput) if err != nil { - return nil, err + return *outstruct, err } - outstruct := new(AnonOutputsOutput) outstruct.Arg0 = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Arg1 = *abi.ConvertType(out[1], new(string)).(*string) - return outstruct, nil + return *outstruct, nil } -// PackCollidingOutputs is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xeccbc1ee. +// PackCollidingOutputs is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xeccbc1ee. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function collidingOutputs() returns(string str, string Str) func (outputChecker *OutputChecker) PackCollidingOutputs() []byte { @@ -137,8 +142,9 @@ func (outputChecker *OutputChecker) PackCollidingOutputs() []byte { return enc } -// PackCollidingOutputs is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xeccbc1ee. +// PackCollidingOutputs is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xeccbc1ee. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function collidingOutputs() returns(string str, string Str) func (outputChecker *OutputChecker) TryPackCollidingOutputs() ([]byte, error) { @@ -156,19 +162,20 @@ type CollidingOutputsOutput struct { // from invoking the contract method with ID 0xeccbc1ee. // // Solidity: function collidingOutputs() returns(string str, string Str) -func (outputChecker *OutputChecker) UnpackCollidingOutputs(data []byte) (*CollidingOutputsOutput, error) { +func (outputChecker *OutputChecker) UnpackCollidingOutputs(data []byte) (CollidingOutputsOutput, error) { out, err := outputChecker.abi.Unpack("collidingOutputs", data) + outstruct := new(CollidingOutputsOutput) if err != nil { - return nil, err + return *outstruct, err } - outstruct := new(CollidingOutputsOutput) outstruct.Str = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Str0 = *abi.ConvertType(out[1], new(string)).(*string) - return outstruct, nil + return *outstruct, nil } -// PackMixedOutputs is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x21b77b44. +// PackMixedOutputs is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x21b77b44. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function mixedOutputs() returns(string, string str) func (outputChecker *OutputChecker) PackMixedOutputs() []byte { @@ -179,8 +186,9 @@ func (outputChecker *OutputChecker) PackMixedOutputs() []byte { return enc } -// PackMixedOutputs is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x21b77b44. +// PackMixedOutputs is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x21b77b44. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function mixedOutputs() returns(string, string str) func (outputChecker *OutputChecker) TryPackMixedOutputs() ([]byte, error) { @@ -198,19 +206,20 @@ type MixedOutputsOutput struct { // from invoking the contract method with ID 0x21b77b44. // // Solidity: function mixedOutputs() returns(string, string str) -func (outputChecker *OutputChecker) UnpackMixedOutputs(data []byte) (*MixedOutputsOutput, error) { +func (outputChecker *OutputChecker) UnpackMixedOutputs(data []byte) (MixedOutputsOutput, error) { out, err := outputChecker.abi.Unpack("mixedOutputs", data) + outstruct := new(MixedOutputsOutput) if err != nil { - return nil, err + return *outstruct, err } - outstruct := new(MixedOutputsOutput) outstruct.Arg0 = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Str = *abi.ConvertType(out[1], new(string)).(*string) - return outstruct, nil + return *outstruct, nil } -// PackNamedOutput is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x5e632bd5. +// PackNamedOutput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x5e632bd5. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function namedOutput() returns(string str) func (outputChecker *OutputChecker) PackNamedOutput() []byte { @@ -221,8 +230,9 @@ func (outputChecker *OutputChecker) PackNamedOutput() []byte { return enc } -// PackNamedOutput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x5e632bd5. +// PackNamedOutput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x5e632bd5. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function namedOutput() returns(string str) func (outputChecker *OutputChecker) TryPackNamedOutput() ([]byte, error) { @@ -242,8 +252,9 @@ func (outputChecker *OutputChecker) UnpackNamedOutput(data []byte) (string, erro return out0, nil } -// PackNamedOutputs is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x7970a189. +// PackNamedOutputs is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x7970a189. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function namedOutputs() returns(string str1, string str2) func (outputChecker *OutputChecker) PackNamedOutputs() []byte { @@ -254,8 +265,9 @@ func (outputChecker *OutputChecker) PackNamedOutputs() []byte { return enc } -// PackNamedOutputs is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x7970a189. +// PackNamedOutputs is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x7970a189. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function namedOutputs() returns(string str1, string str2) func (outputChecker *OutputChecker) TryPackNamedOutputs() ([]byte, error) { @@ -273,19 +285,20 @@ type NamedOutputsOutput struct { // from invoking the contract method with ID 0x7970a189. // // Solidity: function namedOutputs() returns(string str1, string str2) -func (outputChecker *OutputChecker) UnpackNamedOutputs(data []byte) (*NamedOutputsOutput, error) { +func (outputChecker *OutputChecker) UnpackNamedOutputs(data []byte) (NamedOutputsOutput, error) { out, err := outputChecker.abi.Unpack("namedOutputs", data) + outstruct := new(NamedOutputsOutput) if err != nil { - return nil, err + return *outstruct, err } - outstruct := new(NamedOutputsOutput) outstruct.Str1 = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Str2 = *abi.ConvertType(out[1], new(string)).(*string) - return outstruct, nil + return *outstruct, nil } -// PackNoOutput is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x625f0306. +// PackNoOutput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x625f0306. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function noOutput() returns() func (outputChecker *OutputChecker) PackNoOutput() []byte { @@ -296,8 +309,9 @@ func (outputChecker *OutputChecker) PackNoOutput() []byte { return enc } -// PackNoOutput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x625f0306. +// PackNoOutput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x625f0306. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function noOutput() returns() func (outputChecker *OutputChecker) TryPackNoOutput() ([]byte, error) { diff --git a/accounts/abi/abigen/testdata/v2/overload.go.txt b/accounts/abi/abigen/testdata/v2/overload.go.txt index 7f6e3535eaab..340e4e723dd0 100644 --- a/accounts/abi/abigen/testdata/v2/overload.go.txt +++ b/accounts/abi/abigen/testdata/v2/overload.go.txt @@ -51,8 +51,9 @@ func (c *Overload) Instance(backend bind.ContractBackend, addr common.Address) * return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackFoo is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x04bc52f8. +// PackFoo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x04bc52f8. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function foo(uint256 i, uint256 j) returns() func (overload *Overload) PackFoo(i *big.Int, j *big.Int) []byte { @@ -63,16 +64,18 @@ func (overload *Overload) PackFoo(i *big.Int, j *big.Int) []byte { return enc } -// PackFoo is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x04bc52f8. +// PackFoo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x04bc52f8. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function foo(uint256 i, uint256 j) returns() func (overload *Overload) TryPackFoo(i *big.Int, j *big.Int) ([]byte, error) { return overload.abi.Pack("foo", i, j) } -// PackFoo0 is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x2fbebd38. +// PackFoo0 is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2fbebd38. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function foo(uint256 i) returns() func (overload *Overload) PackFoo0(i *big.Int) []byte { @@ -83,8 +86,9 @@ func (overload *Overload) PackFoo0(i *big.Int) []byte { return enc } -// PackFoo0 is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x2fbebd38. +// PackFoo0 is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2fbebd38. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function foo(uint256 i) returns() func (overload *Overload) TryPackFoo0(i *big.Int) ([]byte, error) { diff --git a/accounts/abi/abigen/testdata/v2/rangekeyword.go.txt b/accounts/abi/abigen/testdata/v2/rangekeyword.go.txt index ac05be2a9e92..294342cb1d17 100644 --- a/accounts/abi/abigen/testdata/v2/rangekeyword.go.txt +++ b/accounts/abi/abigen/testdata/v2/rangekeyword.go.txt @@ -51,8 +51,9 @@ func (c *RangeKeyword) Instance(backend bind.ContractBackend, addr common.Addres return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackFunctionWithKeywordParameter is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x527a119f. +// PackFunctionWithKeywordParameter is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x527a119f. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function functionWithKeywordParameter(uint256 range) pure returns() func (rangeKeyword *RangeKeyword) PackFunctionWithKeywordParameter(arg0 *big.Int) []byte { @@ -63,8 +64,9 @@ func (rangeKeyword *RangeKeyword) PackFunctionWithKeywordParameter(arg0 *big.Int return enc } -// PackFunctionWithKeywordParameter is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x527a119f. +// PackFunctionWithKeywordParameter is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x527a119f. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function functionWithKeywordParameter(uint256 range) pure returns() func (rangeKeyword *RangeKeyword) TryPackFunctionWithKeywordParameter(arg0 *big.Int) ([]byte, error) { diff --git a/accounts/abi/abigen/testdata/v2/slicer.go.txt b/accounts/abi/abigen/testdata/v2/slicer.go.txt index 426eaa051752..72d468558f4d 100644 --- a/accounts/abi/abigen/testdata/v2/slicer.go.txt +++ b/accounts/abi/abigen/testdata/v2/slicer.go.txt @@ -51,8 +51,9 @@ func (c *Slicer) Instance(backend bind.ContractBackend, addr common.Address) *bi return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackEchoAddresses is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xbe1127a3. +// PackEchoAddresses is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xbe1127a3. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function echoAddresses(address[] input) returns(address[] output) func (slicer *Slicer) PackEchoAddresses(input []common.Address) []byte { @@ -63,8 +64,9 @@ func (slicer *Slicer) PackEchoAddresses(input []common.Address) []byte { return enc } -// PackEchoAddresses is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xbe1127a3. +// PackEchoAddresses is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xbe1127a3. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function echoAddresses(address[] input) returns(address[] output) func (slicer *Slicer) TryPackEchoAddresses(input []common.Address) ([]byte, error) { @@ -84,8 +86,9 @@ func (slicer *Slicer) UnpackEchoAddresses(data []byte) ([]common.Address, error) return out0, nil } -// PackEchoBools is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xf637e589. +// PackEchoBools is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xf637e589. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function echoBools(bool[] input) returns(bool[] output) func (slicer *Slicer) PackEchoBools(input []bool) []byte { @@ -96,8 +99,9 @@ func (slicer *Slicer) PackEchoBools(input []bool) []byte { return enc } -// PackEchoBools is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xf637e589. +// PackEchoBools is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xf637e589. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function echoBools(bool[] input) returns(bool[] output) func (slicer *Slicer) TryPackEchoBools(input []bool) ([]byte, error) { @@ -117,8 +121,9 @@ func (slicer *Slicer) UnpackEchoBools(data []byte) ([]bool, error) { return out0, nil } -// PackEchoFancyInts is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xd88becc0. +// PackEchoFancyInts is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xd88becc0. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function echoFancyInts(uint24[23] input) returns(uint24[23] output) func (slicer *Slicer) PackEchoFancyInts(input [23]*big.Int) []byte { @@ -129,8 +134,9 @@ func (slicer *Slicer) PackEchoFancyInts(input [23]*big.Int) []byte { return enc } -// PackEchoFancyInts is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xd88becc0. +// PackEchoFancyInts is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xd88becc0. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function echoFancyInts(uint24[23] input) returns(uint24[23] output) func (slicer *Slicer) TryPackEchoFancyInts(input [23]*big.Int) ([]byte, error) { @@ -150,8 +156,9 @@ func (slicer *Slicer) UnpackEchoFancyInts(data []byte) ([23]*big.Int, error) { return out0, nil } -// PackEchoInts is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xe15a3db7. +// PackEchoInts is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xe15a3db7. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function echoInts(int256[] input) returns(int256[] output) func (slicer *Slicer) PackEchoInts(input []*big.Int) []byte { @@ -162,8 +169,9 @@ func (slicer *Slicer) PackEchoInts(input []*big.Int) []byte { return enc } -// PackEchoInts is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xe15a3db7. +// PackEchoInts is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xe15a3db7. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function echoInts(int256[] input) returns(int256[] output) func (slicer *Slicer) TryPackEchoInts(input []*big.Int) ([]byte, error) { diff --git a/accounts/abi/abigen/testdata/v2/structs.go.txt b/accounts/abi/abigen/testdata/v2/structs.go.txt index da94fbf164d8..fc9efc2cbe47 100644 --- a/accounts/abi/abigen/testdata/v2/structs.go.txt +++ b/accounts/abi/abigen/testdata/v2/structs.go.txt @@ -56,8 +56,9 @@ func (c *Structs) Instance(backend bind.ContractBackend, addr common.Address) *b return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackF is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x28811f59. +// PackF is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x28811f59. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function F() view returns((bytes32)[] a, uint256[] c, bool[] d) func (structs *Structs) PackF() []byte { @@ -68,8 +69,9 @@ func (structs *Structs) PackF() []byte { return enc } -// PackF is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x28811f59. +// PackF is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x28811f59. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function F() view returns((bytes32)[] a, uint256[] c, bool[] d) func (structs *Structs) TryPackF() ([]byte, error) { @@ -88,20 +90,21 @@ type FOutput struct { // from invoking the contract method with ID 0x28811f59. // // Solidity: function F() view returns((bytes32)[] a, uint256[] c, bool[] d) -func (structs *Structs) UnpackF(data []byte) (*FOutput, error) { +func (structs *Structs) UnpackF(data []byte) (FOutput, error) { out, err := structs.abi.Unpack("F", data) + outstruct := new(FOutput) if err != nil { - return nil, err + return *outstruct, err } - outstruct := new(FOutput) outstruct.A = *abi.ConvertType(out[0], new([]Struct0)).(*[]Struct0) outstruct.C = *abi.ConvertType(out[1], new([]*big.Int)).(*[]*big.Int) outstruct.D = *abi.ConvertType(out[2], new([]bool)).(*[]bool) - return outstruct, nil + return *outstruct, nil } -// PackG is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x6fecb623. +// PackG is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x6fecb623. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function G() view returns((bytes32)[] a) func (structs *Structs) PackG() []byte { @@ -112,8 +115,9 @@ func (structs *Structs) PackG() []byte { return enc } -// PackG is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x6fecb623. +// PackG is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x6fecb623. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function G() view returns((bytes32)[] a) func (structs *Structs) TryPackG() ([]byte, error) { diff --git a/accounts/abi/abigen/testdata/v2/token.go.txt b/accounts/abi/abigen/testdata/v2/token.go.txt index 489c084c3cce..5999ddbe5ce1 100644 --- a/accounts/abi/abigen/testdata/v2/token.go.txt +++ b/accounts/abi/abigen/testdata/v2/token.go.txt @@ -63,8 +63,9 @@ func (token *Token) PackConstructor(initialSupply *big.Int, tokenName string, de return enc } -// PackAllowance is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xdd62ed3e. +// PackAllowance is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xdd62ed3e. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function allowance(address , address ) returns(uint256) func (token *Token) PackAllowance(arg0 common.Address, arg1 common.Address) []byte { @@ -75,8 +76,9 @@ func (token *Token) PackAllowance(arg0 common.Address, arg1 common.Address) []by return enc } -// PackAllowance is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xdd62ed3e. +// PackAllowance is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xdd62ed3e. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function allowance(address , address ) returns(uint256) func (token *Token) TryPackAllowance(arg0 common.Address, arg1 common.Address) ([]byte, error) { @@ -96,8 +98,9 @@ func (token *Token) UnpackAllowance(data []byte) (*big.Int, error) { return out0, nil } -// PackApproveAndCall is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xcae9ca51. +// PackApproveAndCall is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xcae9ca51. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns(bool success) func (token *Token) PackApproveAndCall(spender common.Address, value *big.Int, extraData []byte) []byte { @@ -108,8 +111,9 @@ func (token *Token) PackApproveAndCall(spender common.Address, value *big.Int, e return enc } -// PackApproveAndCall is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xcae9ca51. +// PackApproveAndCall is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xcae9ca51. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns(bool success) func (token *Token) TryPackApproveAndCall(spender common.Address, value *big.Int, extraData []byte) ([]byte, error) { @@ -129,8 +133,9 @@ func (token *Token) UnpackApproveAndCall(data []byte) (bool, error) { return out0, nil } -// PackBalanceOf is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x70a08231. +// PackBalanceOf is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x70a08231. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function balanceOf(address ) returns(uint256) func (token *Token) PackBalanceOf(arg0 common.Address) []byte { @@ -141,8 +146,9 @@ func (token *Token) PackBalanceOf(arg0 common.Address) []byte { return enc } -// PackBalanceOf is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x70a08231. +// PackBalanceOf is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x70a08231. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function balanceOf(address ) returns(uint256) func (token *Token) TryPackBalanceOf(arg0 common.Address) ([]byte, error) { @@ -162,8 +168,9 @@ func (token *Token) UnpackBalanceOf(data []byte) (*big.Int, error) { return out0, nil } -// PackDecimals is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x313ce567. +// PackDecimals is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x313ce567. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function decimals() returns(uint8) func (token *Token) PackDecimals() []byte { @@ -174,8 +181,9 @@ func (token *Token) PackDecimals() []byte { return enc } -// PackDecimals is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x313ce567. +// PackDecimals is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x313ce567. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function decimals() returns(uint8) func (token *Token) TryPackDecimals() ([]byte, error) { @@ -195,8 +203,9 @@ func (token *Token) UnpackDecimals(data []byte) (uint8, error) { return out0, nil } -// PackName is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x06fdde03. +// PackName is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x06fdde03. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function name() returns(string) func (token *Token) PackName() []byte { @@ -207,8 +216,9 @@ func (token *Token) PackName() []byte { return enc } -// PackName is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x06fdde03. +// PackName is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x06fdde03. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function name() returns(string) func (token *Token) TryPackName() ([]byte, error) { @@ -228,8 +238,9 @@ func (token *Token) UnpackName(data []byte) (string, error) { return out0, nil } -// PackSpentAllowance is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xdc3080f2. +// PackSpentAllowance is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xdc3080f2. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function spentAllowance(address , address ) returns(uint256) func (token *Token) PackSpentAllowance(arg0 common.Address, arg1 common.Address) []byte { @@ -240,8 +251,9 @@ func (token *Token) PackSpentAllowance(arg0 common.Address, arg1 common.Address) return enc } -// PackSpentAllowance is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xdc3080f2. +// PackSpentAllowance is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xdc3080f2. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function spentAllowance(address , address ) returns(uint256) func (token *Token) TryPackSpentAllowance(arg0 common.Address, arg1 common.Address) ([]byte, error) { @@ -261,8 +273,9 @@ func (token *Token) UnpackSpentAllowance(data []byte) (*big.Int, error) { return out0, nil } -// PackSymbol is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x95d89b41. +// PackSymbol is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x95d89b41. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function symbol() returns(string) func (token *Token) PackSymbol() []byte { @@ -273,8 +286,9 @@ func (token *Token) PackSymbol() []byte { return enc } -// PackSymbol is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x95d89b41. +// PackSymbol is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x95d89b41. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function symbol() returns(string) func (token *Token) TryPackSymbol() ([]byte, error) { @@ -294,8 +308,9 @@ func (token *Token) UnpackSymbol(data []byte) (string, error) { return out0, nil } -// PackTransfer is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xa9059cbb. +// PackTransfer is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xa9059cbb. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function transfer(address _to, uint256 _value) returns() func (token *Token) PackTransfer(to common.Address, value *big.Int) []byte { @@ -306,16 +321,18 @@ func (token *Token) PackTransfer(to common.Address, value *big.Int) []byte { return enc } -// PackTransfer is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xa9059cbb. +// PackTransfer is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xa9059cbb. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function transfer(address _to, uint256 _value) returns() func (token *Token) TryPackTransfer(to common.Address, value *big.Int) ([]byte, error) { return token.abi.Pack("transfer", to, value) } -// PackTransferFrom is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x23b872dd. +// PackTransferFrom is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x23b872dd. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function transferFrom(address _from, address _to, uint256 _value) returns(bool success) func (token *Token) PackTransferFrom(from common.Address, to common.Address, value *big.Int) []byte { @@ -326,8 +343,9 @@ func (token *Token) PackTransferFrom(from common.Address, to common.Address, val return enc } -// PackTransferFrom is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x23b872dd. +// PackTransferFrom is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x23b872dd. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function transferFrom(address _from, address _to, uint256 _value) returns(bool success) func (token *Token) TryPackTransferFrom(from common.Address, to common.Address, value *big.Int) ([]byte, error) { diff --git a/accounts/abi/abigen/testdata/v2/tuple.go.txt b/accounts/abi/abigen/testdata/v2/tuple.go.txt index 4f03b7f1fbeb..e6b72bafda6e 100644 --- a/accounts/abi/abigen/testdata/v2/tuple.go.txt +++ b/accounts/abi/abigen/testdata/v2/tuple.go.txt @@ -76,8 +76,9 @@ func (c *Tuple) Instance(backend bind.ContractBackend, addr common.Address) *bin return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackFunc1 is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x443c79b4. +// PackFunc1 is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x443c79b4. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function func1((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) pure returns((uint256,uint256[],(uint256,uint256)[]), (uint256,uint256)[2][], (uint256,uint256)[][2], (uint256,uint256[],(uint256,uint256)[])[], uint256[]) func (tuple *Tuple) PackFunc1(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) []byte { @@ -88,8 +89,9 @@ func (tuple *Tuple) PackFunc1(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS return enc } -// PackFunc1 is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x443c79b4. +// PackFunc1 is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x443c79b4. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function func1((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) pure returns((uint256,uint256[],(uint256,uint256)[]), (uint256,uint256)[2][], (uint256,uint256)[][2], (uint256,uint256[],(uint256,uint256)[])[], uint256[]) func (tuple *Tuple) TryPackFunc1(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) ([]byte, error) { @@ -110,22 +112,23 @@ type Func1Output struct { // from invoking the contract method with ID 0x443c79b4. // // Solidity: function func1((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) pure returns((uint256,uint256[],(uint256,uint256)[]), (uint256,uint256)[2][], (uint256,uint256)[][2], (uint256,uint256[],(uint256,uint256)[])[], uint256[]) -func (tuple *Tuple) UnpackFunc1(data []byte) (*Func1Output, error) { +func (tuple *Tuple) UnpackFunc1(data []byte) (Func1Output, error) { out, err := tuple.abi.Unpack("func1", data) + outstruct := new(Func1Output) if err != nil { - return nil, err + return *outstruct, err } - outstruct := new(Func1Output) outstruct.Arg0 = *abi.ConvertType(out[0], new(TupleS)).(*TupleS) outstruct.Arg1 = *abi.ConvertType(out[1], new([][2]TupleT)).(*[][2]TupleT) outstruct.Arg2 = *abi.ConvertType(out[2], new([2][]TupleT)).(*[2][]TupleT) outstruct.Arg3 = *abi.ConvertType(out[3], new([]TupleS)).(*[]TupleS) outstruct.Arg4 = *abi.ConvertType(out[4], new([]*big.Int)).(*[]*big.Int) - return outstruct, nil + return *outstruct, nil } -// PackFunc2 is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xd0062cdd. +// PackFunc2 is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xd0062cdd. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function func2((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) returns() func (tuple *Tuple) PackFunc2(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) []byte { @@ -136,16 +139,18 @@ func (tuple *Tuple) PackFunc2(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS return enc } -// PackFunc2 is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xd0062cdd. +// PackFunc2 is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xd0062cdd. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function func2((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) returns() func (tuple *Tuple) TryPackFunc2(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) ([]byte, error) { return tuple.abi.Pack("func2", a, b, c, d, e) } -// PackFunc3 is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xe4d9a43b. +// PackFunc3 is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xe4d9a43b. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function func3((uint16,uint16)[] ) pure returns() func (tuple *Tuple) PackFunc3(arg0 []TupleQ) []byte { @@ -156,8 +161,9 @@ func (tuple *Tuple) PackFunc3(arg0 []TupleQ) []byte { return enc } -// PackFunc3 is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xe4d9a43b. +// PackFunc3 is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xe4d9a43b. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function func3((uint16,uint16)[] ) pure returns() func (tuple *Tuple) TryPackFunc3(arg0 []TupleQ) ([]byte, error) { diff --git a/accounts/abi/abigen/testdata/v2/tupler.go.txt b/accounts/abi/abigen/testdata/v2/tupler.go.txt index 5d919944cff9..65410285ab0c 100644 --- a/accounts/abi/abigen/testdata/v2/tupler.go.txt +++ b/accounts/abi/abigen/testdata/v2/tupler.go.txt @@ -51,8 +51,9 @@ func (c *Tupler) Instance(backend bind.ContractBackend, addr common.Address) *bi return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackTuple is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x3175aae2. +// PackTuple is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x3175aae2. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function tuple() returns(string a, int256 b, bytes32 c) func (tupler *Tupler) PackTuple() []byte { @@ -63,8 +64,9 @@ func (tupler *Tupler) PackTuple() []byte { return enc } -// PackTuple is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x3175aae2. +// PackTuple is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x3175aae2. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function tuple() returns(string a, int256 b, bytes32 c) func (tupler *Tupler) TryPackTuple() ([]byte, error) { @@ -83,14 +85,14 @@ type TupleOutput struct { // from invoking the contract method with ID 0x3175aae2. // // Solidity: function tuple() returns(string a, int256 b, bytes32 c) -func (tupler *Tupler) UnpackTuple(data []byte) (*TupleOutput, error) { +func (tupler *Tupler) UnpackTuple(data []byte) (TupleOutput, error) { out, err := tupler.abi.Unpack("tuple", data) + outstruct := new(TupleOutput) if err != nil { - return nil, err + return *outstruct, err } - outstruct := new(TupleOutput) outstruct.A = *abi.ConvertType(out[0], new(string)).(*string) outstruct.B = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.C = *abi.ConvertType(out[2], new([32]byte)).(*[32]byte) - return outstruct, nil + return *outstruct, nil } diff --git a/accounts/abi/abigen/testdata/v2/underscorer.go.txt b/accounts/abi/abigen/testdata/v2/underscorer.go.txt index 96c138fd44f3..9e39bd40f397 100644 --- a/accounts/abi/abigen/testdata/v2/underscorer.go.txt +++ b/accounts/abi/abigen/testdata/v2/underscorer.go.txt @@ -51,8 +51,9 @@ func (c *Underscorer) Instance(backend bind.ContractBackend, addr common.Address return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackAllPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xb564b34d. +// PackAllPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xb564b34d. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function AllPurelyUnderscoredOutput() view returns(int256 _, int256 __) func (underscorer *Underscorer) PackAllPurelyUnderscoredOutput() []byte { @@ -63,8 +64,9 @@ func (underscorer *Underscorer) PackAllPurelyUnderscoredOutput() []byte { return enc } -// PackAllPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xb564b34d. +// PackAllPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xb564b34d. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function AllPurelyUnderscoredOutput() view returns(int256 _, int256 __) func (underscorer *Underscorer) TryPackAllPurelyUnderscoredOutput() ([]byte, error) { @@ -82,19 +84,20 @@ type AllPurelyUnderscoredOutputOutput struct { // from invoking the contract method with ID 0xb564b34d. // // Solidity: function AllPurelyUnderscoredOutput() view returns(int256 _, int256 __) -func (underscorer *Underscorer) UnpackAllPurelyUnderscoredOutput(data []byte) (*AllPurelyUnderscoredOutputOutput, error) { +func (underscorer *Underscorer) UnpackAllPurelyUnderscoredOutput(data []byte) (AllPurelyUnderscoredOutputOutput, error) { out, err := underscorer.abi.Unpack("AllPurelyUnderscoredOutput", data) + outstruct := new(AllPurelyUnderscoredOutputOutput) if err != nil { - return nil, err + return *outstruct, err } - outstruct := new(AllPurelyUnderscoredOutputOutput) outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return outstruct, nil + return *outstruct, nil } -// PackLowerLowerCollision is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xe409ca45. +// PackLowerLowerCollision is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xe409ca45. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function LowerLowerCollision() view returns(int256 _res, int256 res) func (underscorer *Underscorer) PackLowerLowerCollision() []byte { @@ -105,8 +108,9 @@ func (underscorer *Underscorer) PackLowerLowerCollision() []byte { return enc } -// PackLowerLowerCollision is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xe409ca45. +// PackLowerLowerCollision is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xe409ca45. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function LowerLowerCollision() view returns(int256 _res, int256 res) func (underscorer *Underscorer) TryPackLowerLowerCollision() ([]byte, error) { @@ -124,19 +128,20 @@ type LowerLowerCollisionOutput struct { // from invoking the contract method with ID 0xe409ca45. // // Solidity: function LowerLowerCollision() view returns(int256 _res, int256 res) -func (underscorer *Underscorer) UnpackLowerLowerCollision(data []byte) (*LowerLowerCollisionOutput, error) { +func (underscorer *Underscorer) UnpackLowerLowerCollision(data []byte) (LowerLowerCollisionOutput, error) { out, err := underscorer.abi.Unpack("LowerLowerCollision", data) + outstruct := new(LowerLowerCollisionOutput) if err != nil { - return nil, err + return *outstruct, err } - outstruct := new(LowerLowerCollisionOutput) outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return outstruct, nil + return *outstruct, nil } -// PackLowerUpperCollision is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x03a59213. +// PackLowerUpperCollision is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x03a59213. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function LowerUpperCollision() view returns(int256 _res, int256 Res) func (underscorer *Underscorer) PackLowerUpperCollision() []byte { @@ -147,8 +152,9 @@ func (underscorer *Underscorer) PackLowerUpperCollision() []byte { return enc } -// PackLowerUpperCollision is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x03a59213. +// PackLowerUpperCollision is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x03a59213. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function LowerUpperCollision() view returns(int256 _res, int256 Res) func (underscorer *Underscorer) TryPackLowerUpperCollision() ([]byte, error) { @@ -166,19 +172,20 @@ type LowerUpperCollisionOutput struct { // from invoking the contract method with ID 0x03a59213. // // Solidity: function LowerUpperCollision() view returns(int256 _res, int256 Res) -func (underscorer *Underscorer) UnpackLowerUpperCollision(data []byte) (*LowerUpperCollisionOutput, error) { +func (underscorer *Underscorer) UnpackLowerUpperCollision(data []byte) (LowerUpperCollisionOutput, error) { out, err := underscorer.abi.Unpack("LowerUpperCollision", data) + outstruct := new(LowerUpperCollisionOutput) if err != nil { - return nil, err + return *outstruct, err } - outstruct := new(LowerUpperCollisionOutput) outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return outstruct, nil + return *outstruct, nil } -// PackPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x9df48485. +// PackPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x9df48485. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function PurelyUnderscoredOutput() view returns(int256 _, int256 res) func (underscorer *Underscorer) PackPurelyUnderscoredOutput() []byte { @@ -189,8 +196,9 @@ func (underscorer *Underscorer) PackPurelyUnderscoredOutput() []byte { return enc } -// PackPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x9df48485. +// PackPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x9df48485. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function PurelyUnderscoredOutput() view returns(int256 _, int256 res) func (underscorer *Underscorer) TryPackPurelyUnderscoredOutput() ([]byte, error) { @@ -208,19 +216,20 @@ type PurelyUnderscoredOutputOutput struct { // from invoking the contract method with ID 0x9df48485. // // Solidity: function PurelyUnderscoredOutput() view returns(int256 _, int256 res) -func (underscorer *Underscorer) UnpackPurelyUnderscoredOutput(data []byte) (*PurelyUnderscoredOutputOutput, error) { +func (underscorer *Underscorer) UnpackPurelyUnderscoredOutput(data []byte) (PurelyUnderscoredOutputOutput, error) { out, err := underscorer.abi.Unpack("PurelyUnderscoredOutput", data) + outstruct := new(PurelyUnderscoredOutputOutput) if err != nil { - return nil, err + return *outstruct, err } - outstruct := new(PurelyUnderscoredOutputOutput) outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return outstruct, nil + return *outstruct, nil } -// PackUnderscoredOutput is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x67e6633d. +// PackUnderscoredOutput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x67e6633d. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function UnderscoredOutput() view returns(int256 _int, string _string) func (underscorer *Underscorer) PackUnderscoredOutput() []byte { @@ -231,8 +240,9 @@ func (underscorer *Underscorer) PackUnderscoredOutput() []byte { return enc } -// PackUnderscoredOutput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x67e6633d. +// PackUnderscoredOutput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x67e6633d. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function UnderscoredOutput() view returns(int256 _int, string _string) func (underscorer *Underscorer) TryPackUnderscoredOutput() ([]byte, error) { @@ -250,19 +260,20 @@ type UnderscoredOutputOutput struct { // from invoking the contract method with ID 0x67e6633d. // // Solidity: function UnderscoredOutput() view returns(int256 _int, string _string) -func (underscorer *Underscorer) UnpackUnderscoredOutput(data []byte) (*UnderscoredOutputOutput, error) { +func (underscorer *Underscorer) UnpackUnderscoredOutput(data []byte) (UnderscoredOutputOutput, error) { out, err := underscorer.abi.Unpack("UnderscoredOutput", data) + outstruct := new(UnderscoredOutputOutput) if err != nil { - return nil, err + return *outstruct, err } - outstruct := new(UnderscoredOutputOutput) outstruct.Int = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.String = *abi.ConvertType(out[1], new(string)).(*string) - return outstruct, nil + return *outstruct, nil } -// PackUpperLowerCollision is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xaf7486ab. +// PackUpperLowerCollision is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xaf7486ab. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function UpperLowerCollision() view returns(int256 _Res, int256 res) func (underscorer *Underscorer) PackUpperLowerCollision() []byte { @@ -273,8 +284,9 @@ func (underscorer *Underscorer) PackUpperLowerCollision() []byte { return enc } -// PackUpperLowerCollision is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xaf7486ab. +// PackUpperLowerCollision is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xaf7486ab. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function UpperLowerCollision() view returns(int256 _Res, int256 res) func (underscorer *Underscorer) TryPackUpperLowerCollision() ([]byte, error) { @@ -292,19 +304,20 @@ type UpperLowerCollisionOutput struct { // from invoking the contract method with ID 0xaf7486ab. // // Solidity: function UpperLowerCollision() view returns(int256 _Res, int256 res) -func (underscorer *Underscorer) UnpackUpperLowerCollision(data []byte) (*UpperLowerCollisionOutput, error) { +func (underscorer *Underscorer) UnpackUpperLowerCollision(data []byte) (UpperLowerCollisionOutput, error) { out, err := underscorer.abi.Unpack("UpperLowerCollision", data) + outstruct := new(UpperLowerCollisionOutput) if err != nil { - return nil, err + return *outstruct, err } - outstruct := new(UpperLowerCollisionOutput) outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return outstruct, nil + return *outstruct, nil } -// PackUpperUpperCollision is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xe02ab24d. +// PackUpperUpperCollision is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xe02ab24d. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function UpperUpperCollision() view returns(int256 _Res, int256 Res) func (underscorer *Underscorer) PackUpperUpperCollision() []byte { @@ -315,8 +328,9 @@ func (underscorer *Underscorer) PackUpperUpperCollision() []byte { return enc } -// PackUpperUpperCollision is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xe02ab24d. +// PackUpperUpperCollision is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xe02ab24d. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function UpperUpperCollision() view returns(int256 _Res, int256 Res) func (underscorer *Underscorer) TryPackUpperUpperCollision() ([]byte, error) { @@ -334,19 +348,20 @@ type UpperUpperCollisionOutput struct { // from invoking the contract method with ID 0xe02ab24d. // // Solidity: function UpperUpperCollision() view returns(int256 _Res, int256 Res) -func (underscorer *Underscorer) UnpackUpperUpperCollision(data []byte) (*UpperUpperCollisionOutput, error) { +func (underscorer *Underscorer) UnpackUpperUpperCollision(data []byte) (UpperUpperCollisionOutput, error) { out, err := underscorer.abi.Unpack("UpperUpperCollision", data) + outstruct := new(UpperUpperCollisionOutput) if err != nil { - return nil, err + return *outstruct, err } - outstruct := new(UpperUpperCollisionOutput) outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return outstruct, nil + return *outstruct, nil } -// PackUnderScoredFunc is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x46546dbe. +// PackUnderScoredFunc is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x46546dbe. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function _under_scored_func() view returns(int256 _int) func (underscorer *Underscorer) PackUnderScoredFunc() []byte { @@ -357,8 +372,9 @@ func (underscorer *Underscorer) PackUnderScoredFunc() []byte { return enc } -// PackUnderScoredFunc is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x46546dbe. +// PackUnderScoredFunc is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x46546dbe. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function _under_scored_func() view returns(int256 _int) func (underscorer *Underscorer) TryPackUnderScoredFunc() ([]byte, error) { diff --git a/accounts/abi/bind/v2/internal/contracts/db/bindings.go b/accounts/abi/bind/v2/internal/contracts/db/bindings.go index 93cd2a491bdd..dedb2518267e 100644 --- a/accounts/abi/bind/v2/internal/contracts/db/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/db/bindings.go @@ -58,8 +58,9 @@ func (c *DB) Instance(backend bind.ContractBackend, addr common.Address) *bind.B return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackGet is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x9507d39a. +// PackGet is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x9507d39a. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function get(uint256 k) returns(uint256) func (dB *DB) PackGet(k *big.Int) []byte { @@ -70,8 +71,9 @@ func (dB *DB) PackGet(k *big.Int) []byte { return enc } -// PackGet is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x9507d39a. +// PackGet is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x9507d39a. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function get(uint256 k) returns(uint256) func (dB *DB) TryPackGet(k *big.Int) ([]byte, error) { @@ -91,8 +93,9 @@ func (dB *DB) UnpackGet(data []byte) (*big.Int, error) { return out0, nil } -// PackGetNamedStatParams is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xe369ba3b. +// PackGetNamedStatParams is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xe369ba3b. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function getNamedStatParams() view returns(uint256 gets, uint256 inserts, uint256 mods) func (dB *DB) PackGetNamedStatParams() []byte { @@ -103,8 +106,9 @@ func (dB *DB) PackGetNamedStatParams() []byte { return enc } -// PackGetNamedStatParams is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xe369ba3b. +// PackGetNamedStatParams is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xe369ba3b. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function getNamedStatParams() view returns(uint256 gets, uint256 inserts, uint256 mods) func (dB *DB) TryPackGetNamedStatParams() ([]byte, error) { @@ -123,20 +127,21 @@ type GetNamedStatParamsOutput struct { // from invoking the contract method with ID 0xe369ba3b. // // Solidity: function getNamedStatParams() view returns(uint256 gets, uint256 inserts, uint256 mods) -func (dB *DB) UnpackGetNamedStatParams(data []byte) (*GetNamedStatParamsOutput, error) { +func (dB *DB) UnpackGetNamedStatParams(data []byte) (GetNamedStatParamsOutput, error) { out, err := dB.abi.Unpack("getNamedStatParams", data) + outstruct := new(GetNamedStatParamsOutput) if err != nil { - return nil, err + return *outstruct, err } - outstruct := new(GetNamedStatParamsOutput) outstruct.Gets = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Inserts = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Mods = abi.ConvertType(out[2], new(big.Int)).(*big.Int) - return outstruct, nil + return *outstruct, nil } -// PackGetStatParams is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x6fcb9c70. +// PackGetStatParams is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x6fcb9c70. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function getStatParams() view returns(uint256, uint256, uint256) func (dB *DB) PackGetStatParams() []byte { @@ -147,8 +152,9 @@ func (dB *DB) PackGetStatParams() []byte { return enc } -// PackGetStatParams is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x6fcb9c70. +// PackGetStatParams is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x6fcb9c70. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function getStatParams() view returns(uint256, uint256, uint256) func (dB *DB) TryPackGetStatParams() ([]byte, error) { @@ -167,20 +173,21 @@ type GetStatParamsOutput struct { // from invoking the contract method with ID 0x6fcb9c70. // // Solidity: function getStatParams() view returns(uint256, uint256, uint256) -func (dB *DB) UnpackGetStatParams(data []byte) (*GetStatParamsOutput, error) { +func (dB *DB) UnpackGetStatParams(data []byte) (GetStatParamsOutput, error) { out, err := dB.abi.Unpack("getStatParams", data) + outstruct := new(GetStatParamsOutput) if err != nil { - return nil, err + return *outstruct, err } - outstruct := new(GetStatParamsOutput) outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Arg2 = abi.ConvertType(out[2], new(big.Int)).(*big.Int) - return outstruct, nil + return *outstruct, nil } -// PackGetStatsStruct is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xee8161e0. +// PackGetStatsStruct is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xee8161e0. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function getStatsStruct() view returns((uint256,uint256,uint256)) func (dB *DB) PackGetStatsStruct() []byte { @@ -191,8 +198,9 @@ func (dB *DB) PackGetStatsStruct() []byte { return enc } -// PackGetStatsStruct is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xee8161e0. +// PackGetStatsStruct is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xee8161e0. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function getStatsStruct() view returns((uint256,uint256,uint256)) func (dB *DB) TryPackGetStatsStruct() ([]byte, error) { @@ -212,8 +220,9 @@ func (dB *DB) UnpackGetStatsStruct(data []byte) (DBStats, error) { return out0, nil } -// PackInsert is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x1d834a1b. +// PackInsert is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x1d834a1b. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function insert(uint256 k, uint256 v) returns(uint256) func (dB *DB) PackInsert(k *big.Int, v *big.Int) []byte { @@ -224,8 +233,9 @@ func (dB *DB) PackInsert(k *big.Int, v *big.Int) []byte { return enc } -// PackInsert is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x1d834a1b. +// PackInsert is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x1d834a1b. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function insert(uint256 k, uint256 v) returns(uint256) func (dB *DB) TryPackInsert(k *big.Int, v *big.Int) ([]byte, error) { diff --git a/accounts/abi/bind/v2/internal/contracts/events/bindings.go b/accounts/abi/bind/v2/internal/contracts/events/bindings.go index f2918afb6411..780c8e4a5f26 100644 --- a/accounts/abi/bind/v2/internal/contracts/events/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/events/bindings.go @@ -51,8 +51,9 @@ func (c *C) Instance(backend bind.ContractBackend, addr common.Address) *bind.Bo return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackEmitMulti is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xcb493749. +// PackEmitMulti is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xcb493749. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function EmitMulti() returns() func (c *C) PackEmitMulti() []byte { @@ -63,16 +64,18 @@ func (c *C) PackEmitMulti() []byte { return enc } -// PackEmitMulti is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xcb493749. +// PackEmitMulti is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xcb493749. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function EmitMulti() returns() func (c *C) TryPackEmitMulti() ([]byte, error) { return c.abi.Pack("EmitMulti") } -// PackEmitOne is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xe8e49a71. +// PackEmitOne is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xe8e49a71. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function EmitOne() returns() func (c *C) PackEmitOne() []byte { @@ -83,8 +86,9 @@ func (c *C) PackEmitOne() []byte { return enc } -// PackEmitOne is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xe8e49a71. +// PackEmitOne is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xe8e49a71. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function EmitOne() returns() func (c *C) TryPackEmitOne() ([]byte, error) { diff --git a/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go b/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go index 2a3d21a37c85..ab2c73db416d 100644 --- a/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go @@ -67,8 +67,9 @@ func (c1 *C1) PackConstructor(v1 *big.Int, v2 *big.Int) []byte { return enc } -// PackDo is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x2ad11272. +// PackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function Do(uint256 val) pure returns(uint256 res) func (c1 *C1) PackDo(val *big.Int) []byte { @@ -79,8 +80,9 @@ func (c1 *C1) PackDo(val *big.Int) []byte { return enc } -// PackDo is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x2ad11272. +// PackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function Do(uint256 val) pure returns(uint256 res) func (c1 *C1) TryPackDo(val *big.Int) ([]byte, error) { @@ -143,8 +145,9 @@ func (c2 *C2) PackConstructor(v1 *big.Int, v2 *big.Int) []byte { return enc } -// PackDo is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x2ad11272. +// PackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function Do(uint256 val) pure returns(uint256 res) func (c2 *C2) PackDo(val *big.Int) []byte { @@ -155,8 +158,9 @@ func (c2 *C2) PackDo(val *big.Int) []byte { return enc } -// PackDo is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x2ad11272. +// PackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function Do(uint256 val) pure returns(uint256 res) func (c2 *C2) TryPackDo(val *big.Int) ([]byte, error) { @@ -203,8 +207,9 @@ func (c *L1) Instance(backend bind.ContractBackend, addr common.Address) *bind.B return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackDo is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x2ad11272. +// PackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function Do(uint256 val) pure returns(uint256) func (l1 *L1) PackDo(val *big.Int) []byte { @@ -215,8 +220,9 @@ func (l1 *L1) PackDo(val *big.Int) []byte { return enc } -// PackDo is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x2ad11272. +// PackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function Do(uint256 val) pure returns(uint256) func (l1 *L1) TryPackDo(val *big.Int) ([]byte, error) { @@ -266,8 +272,9 @@ func (c *L2) Instance(backend bind.ContractBackend, addr common.Address) *bind.B return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackDo is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x2ad11272. +// PackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function Do(uint256 val) pure returns(uint256) func (l2 *L2) PackDo(val *big.Int) []byte { @@ -278,8 +285,9 @@ func (l2 *L2) PackDo(val *big.Int) []byte { return enc } -// PackDo is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x2ad11272. +// PackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function Do(uint256 val) pure returns(uint256) func (l2 *L2) TryPackDo(val *big.Int) ([]byte, error) { @@ -329,8 +337,9 @@ func (c *L2b) Instance(backend bind.ContractBackend, addr common.Address) *bind. return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackDo is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x2ad11272. +// PackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function Do(uint256 val) pure returns(uint256) func (l2b *L2b) PackDo(val *big.Int) []byte { @@ -341,8 +350,9 @@ func (l2b *L2b) PackDo(val *big.Int) []byte { return enc } -// PackDo is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x2ad11272. +// PackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function Do(uint256 val) pure returns(uint256) func (l2b *L2b) TryPackDo(val *big.Int) ([]byte, error) { @@ -389,8 +399,9 @@ func (c *L3) Instance(backend bind.ContractBackend, addr common.Address) *bind.B return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackDo is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x2ad11272. +// PackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function Do(uint256 val) pure returns(uint256) func (l3 *L3) PackDo(val *big.Int) []byte { @@ -401,8 +412,9 @@ func (l3 *L3) PackDo(val *big.Int) []byte { return enc } -// PackDo is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x2ad11272. +// PackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function Do(uint256 val) pure returns(uint256) func (l3 *L3) TryPackDo(val *big.Int) ([]byte, error) { @@ -453,8 +465,9 @@ func (c *L4) Instance(backend bind.ContractBackend, addr common.Address) *bind.B return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackDo is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x2ad11272. +// PackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function Do(uint256 val) pure returns(uint256) func (l4 *L4) PackDo(val *big.Int) []byte { @@ -465,8 +478,9 @@ func (l4 *L4) PackDo(val *big.Int) []byte { return enc } -// PackDo is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x2ad11272. +// PackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function Do(uint256 val) pure returns(uint256) func (l4 *L4) TryPackDo(val *big.Int) ([]byte, error) { @@ -516,8 +530,9 @@ func (c *L4b) Instance(backend bind.ContractBackend, addr common.Address) *bind. return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackDo is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0x2ad11272. +// PackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function Do(uint256 val) pure returns(uint256) func (l4b *L4b) PackDo(val *big.Int) []byte { @@ -528,8 +543,9 @@ func (l4b *L4b) PackDo(val *big.Int) []byte { return enc } -// PackDo is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0x2ad11272. +// PackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function Do(uint256 val) pure returns(uint256) func (l4b *L4b) TryPackDo(val *big.Int) ([]byte, error) { diff --git a/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go b/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go index 3ea8489b8281..a65a9f20ce7a 100644 --- a/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go @@ -51,8 +51,9 @@ func (c *C) Instance(backend bind.ContractBackend, addr common.Address) *bind.Bo return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackBar is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xb0a378b0. +// PackBar is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xb0a378b0. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function Bar() pure returns() func (c *C) PackBar() []byte { @@ -63,16 +64,18 @@ func (c *C) PackBar() []byte { return enc } -// PackBar is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xb0a378b0. +// PackBar is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xb0a378b0. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function Bar() pure returns() func (c *C) TryPackBar() ([]byte, error) { return c.abi.Pack("Bar") } -// PackFoo is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xbfb4ebcf. +// PackFoo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xbfb4ebcf. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function Foo() pure returns() func (c *C) PackFoo() []byte { @@ -83,8 +86,9 @@ func (c *C) PackFoo() []byte { return enc } -// PackFoo is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xbfb4ebcf. +// PackFoo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xbfb4ebcf. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function Foo() pure returns() func (c *C) TryPackFoo() ([]byte, error) { @@ -184,8 +188,9 @@ func (c *C2) Instance(backend bind.ContractBackend, addr common.Address) *bind.B return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackFoo is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xbfb4ebcf. +// PackFoo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xbfb4ebcf. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function Foo() pure returns() func (c2 *C2) PackFoo() []byte { @@ -196,8 +201,9 @@ func (c2 *C2) PackFoo() []byte { return enc } -// PackFoo is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xbfb4ebcf. +// PackFoo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xbfb4ebcf. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function Foo() pure returns() func (c2 *C2) TryPackFoo() ([]byte, error) { diff --git a/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go b/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go index c336198c8890..e5da79c51baa 100644 --- a/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go @@ -51,8 +51,9 @@ func (c *MyContract) Instance(backend bind.ContractBackend, addr common.Address) return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackGetNums is the Go binding used to pack the parameters required for calling, will panic for any error. -// the contract method with ID 0xbd6d1007. +// PackGetNums is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xbd6d1007. This method will panic if any +// invalid/nil inputs are passed. // // Solidity: function GetNums() pure returns(uint256[5]) func (myContract *MyContract) PackGetNums() []byte { @@ -63,8 +64,9 @@ func (myContract *MyContract) PackGetNums() []byte { return enc } -// PackGetNums is the Go binding used to pack the parameters required for calling, return error if it failed to pack. -// the contract method with ID 0xbd6d1007. +// PackGetNums is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xbd6d1007. This method will return an error +// if any inputs are invalid/nil. // // Solidity: function GetNums() pure returns(uint256[5]) func (myContract *MyContract) TryPackGetNums() ([]byte, error) { From 9ed71be3753052c313fc230b932480cdbe1f695e Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Fri, 25 Apr 2025 17:37:44 +0800 Subject: [PATCH 8/9] fix method comment --- accounts/abi/abigen/source2.go.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accounts/abi/abigen/source2.go.tpl b/accounts/abi/abigen/source2.go.tpl index 4d4b7149a827..8ef906b8d6a4 100644 --- a/accounts/abi/abigen/source2.go.tpl +++ b/accounts/abi/abigen/source2.go.tpl @@ -102,7 +102,7 @@ var ( return enc } - // Pack{{.Normalized.Name}} is the Go binding used to pack the parameters required for calling + // TryPack{{.Normalized.Name}} is the Go binding used to pack the parameters required for calling // the contract method with ID 0x{{printf "%x" .Original.ID}}. This method will return an error // if any inputs are invalid/nil. // From 022df3d4c50b29bcc40d1d5f27ecbe9dae1650d4 Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Fri, 25 Apr 2025 18:26:59 +0800 Subject: [PATCH 9/9] regenerate abigen test files --- .../abigen/testdata/v2/callbackparam.go.txt | 2 +- .../abi/abigen/testdata/v2/crowdsale.go.txt | 16 +++++----- accounts/abi/abigen/testdata/v2/dao.go.txt | 30 +++++++++---------- .../testdata/v2/deeplynestedarray.go.txt | 6 ++-- accounts/abi/abigen/testdata/v2/getter.go.txt | 2 +- .../testdata/v2/identifiercollision.go.txt | 4 +-- .../abigen/testdata/v2/inputchecker.go.txt | 12 ++++---- .../abi/abigen/testdata/v2/interactor.go.txt | 6 ++-- .../abigen/testdata/v2/nameconflict.go.txt | 4 +-- .../testdata/v2/numericmethodname.go.txt | 6 ++-- .../abigen/testdata/v2/outputchecker.go.txt | 14 ++++----- .../abi/abigen/testdata/v2/overload.go.txt | 4 +-- .../abigen/testdata/v2/rangekeyword.go.txt | 2 +- accounts/abi/abigen/testdata/v2/slicer.go.txt | 8 ++--- .../abi/abigen/testdata/v2/structs.go.txt | 4 +-- accounts/abi/abigen/testdata/v2/token.go.txt | 18 +++++------ accounts/abi/abigen/testdata/v2/tuple.go.txt | 6 ++-- accounts/abi/abigen/testdata/v2/tupler.go.txt | 2 +- .../abi/abigen/testdata/v2/underscorer.go.txt | 16 +++++----- .../bind/v2/internal/contracts/db/bindings.go | 10 +++---- .../v2/internal/contracts/events/bindings.go | 4 +-- .../contracts/nested_libraries/bindings.go | 16 +++++----- .../contracts/solc_errors/bindings.go | 6 ++-- .../contracts/uint256arrayreturn/bindings.go | 2 +- 24 files changed, 100 insertions(+), 100 deletions(-) diff --git a/accounts/abi/abigen/testdata/v2/callbackparam.go.txt b/accounts/abi/abigen/testdata/v2/callbackparam.go.txt index 4e9ccbe2cca0..d22b9784863c 100644 --- a/accounts/abi/abigen/testdata/v2/callbackparam.go.txt +++ b/accounts/abi/abigen/testdata/v2/callbackparam.go.txt @@ -64,7 +64,7 @@ func (callbackParam *CallbackParam) PackTest(callback [24]byte) []byte { return enc } -// PackTest is the Go binding used to pack the parameters required for calling +// TryPackTest is the Go binding used to pack the parameters required for calling // the contract method with ID 0xd7a5aba2. This method will return an error // if any inputs are invalid/nil. // diff --git a/accounts/abi/abigen/testdata/v2/crowdsale.go.txt b/accounts/abi/abigen/testdata/v2/crowdsale.go.txt index 4b9b3f04560c..b2183c91ea59 100644 --- a/accounts/abi/abigen/testdata/v2/crowdsale.go.txt +++ b/accounts/abi/abigen/testdata/v2/crowdsale.go.txt @@ -76,7 +76,7 @@ func (crowdsale *Crowdsale) PackAmountRaised() []byte { return enc } -// PackAmountRaised is the Go binding used to pack the parameters required for calling +// TryPackAmountRaised is the Go binding used to pack the parameters required for calling // the contract method with ID 0x7b3e5e7b. This method will return an error // if any inputs are invalid/nil. // @@ -111,7 +111,7 @@ func (crowdsale *Crowdsale) PackBeneficiary() []byte { return enc } -// PackBeneficiary is the Go binding used to pack the parameters required for calling +// TryPackBeneficiary is the Go binding used to pack the parameters required for calling // the contract method with ID 0x38af3eed. This method will return an error // if any inputs are invalid/nil. // @@ -146,7 +146,7 @@ func (crowdsale *Crowdsale) PackCheckGoalReached() []byte { return enc } -// PackCheckGoalReached is the Go binding used to pack the parameters required for calling +// TryPackCheckGoalReached is the Go binding used to pack the parameters required for calling // the contract method with ID 0x01cb3b20. This method will return an error // if any inputs are invalid/nil. // @@ -168,7 +168,7 @@ func (crowdsale *Crowdsale) PackDeadline() []byte { return enc } -// PackDeadline is the Go binding used to pack the parameters required for calling +// TryPackDeadline is the Go binding used to pack the parameters required for calling // the contract method with ID 0x29dcb0cf. This method will return an error // if any inputs are invalid/nil. // @@ -203,7 +203,7 @@ func (crowdsale *Crowdsale) PackFunders(arg0 *big.Int) []byte { return enc } -// PackFunders is the Go binding used to pack the parameters required for calling +// TryPackFunders is the Go binding used to pack the parameters required for calling // the contract method with ID 0xdc0d3dff. This method will return an error // if any inputs are invalid/nil. // @@ -247,7 +247,7 @@ func (crowdsale *Crowdsale) PackFundingGoal() []byte { return enc } -// PackFundingGoal is the Go binding used to pack the parameters required for calling +// TryPackFundingGoal is the Go binding used to pack the parameters required for calling // the contract method with ID 0x7a3a0e84. This method will return an error // if any inputs are invalid/nil. // @@ -282,7 +282,7 @@ func (crowdsale *Crowdsale) PackPrice() []byte { return enc } -// PackPrice is the Go binding used to pack the parameters required for calling +// TryPackPrice is the Go binding used to pack the parameters required for calling // the contract method with ID 0xa035b1fe. This method will return an error // if any inputs are invalid/nil. // @@ -317,7 +317,7 @@ func (crowdsale *Crowdsale) PackTokenReward() []byte { return enc } -// PackTokenReward is the Go binding used to pack the parameters required for calling +// TryPackTokenReward is the Go binding used to pack the parameters required for calling // the contract method with ID 0x6e66f6e9. This method will return an error // if any inputs are invalid/nil. // diff --git a/accounts/abi/abigen/testdata/v2/dao.go.txt b/accounts/abi/abigen/testdata/v2/dao.go.txt index 54e0d382429f..75fa95df9107 100644 --- a/accounts/abi/abigen/testdata/v2/dao.go.txt +++ b/accounts/abi/abigen/testdata/v2/dao.go.txt @@ -76,7 +76,7 @@ func (dAO *DAO) PackChangeMembership(targetMember common.Address, canVote bool, return enc } -// PackChangeMembership is the Go binding used to pack the parameters required for calling +// TryPackChangeMembership is the Go binding used to pack the parameters required for calling // the contract method with ID 0x9644fcbd. This method will return an error // if any inputs are invalid/nil. // @@ -98,7 +98,7 @@ func (dAO *DAO) PackChangeVotingRules(minimumQuorumForProposals *big.Int, minute return enc } -// PackChangeVotingRules is the Go binding used to pack the parameters required for calling +// TryPackChangeVotingRules is the Go binding used to pack the parameters required for calling // the contract method with ID 0xbcca1fd3. This method will return an error // if any inputs are invalid/nil. // @@ -120,7 +120,7 @@ func (dAO *DAO) PackCheckProposalCode(proposalNumber *big.Int, beneficiary commo return enc } -// PackCheckProposalCode is the Go binding used to pack the parameters required for calling +// TryPackCheckProposalCode is the Go binding used to pack the parameters required for calling // the contract method with ID 0xeceb2945. This method will return an error // if any inputs are invalid/nil. // @@ -155,7 +155,7 @@ func (dAO *DAO) PackDebatingPeriodInMinutes() []byte { return enc } -// PackDebatingPeriodInMinutes is the Go binding used to pack the parameters required for calling +// TryPackDebatingPeriodInMinutes is the Go binding used to pack the parameters required for calling // the contract method with ID 0x69bd3436. This method will return an error // if any inputs are invalid/nil. // @@ -190,7 +190,7 @@ func (dAO *DAO) PackExecuteProposal(proposalNumber *big.Int, transactionBytecode return enc } -// PackExecuteProposal is the Go binding used to pack the parameters required for calling +// TryPackExecuteProposal is the Go binding used to pack the parameters required for calling // the contract method with ID 0x237e9492. This method will return an error // if any inputs are invalid/nil. // @@ -225,7 +225,7 @@ func (dAO *DAO) PackMajorityMargin() []byte { return enc } -// PackMajorityMargin is the Go binding used to pack the parameters required for calling +// TryPackMajorityMargin is the Go binding used to pack the parameters required for calling // the contract method with ID 0xaa02a90f. This method will return an error // if any inputs are invalid/nil. // @@ -260,7 +260,7 @@ func (dAO *DAO) PackMemberId(arg0 common.Address) []byte { return enc } -// PackMemberId is the Go binding used to pack the parameters required for calling +// TryPackMemberId is the Go binding used to pack the parameters required for calling // the contract method with ID 0x39106821. This method will return an error // if any inputs are invalid/nil. // @@ -295,7 +295,7 @@ func (dAO *DAO) PackMembers(arg0 *big.Int) []byte { return enc } -// PackMembers is the Go binding used to pack the parameters required for calling +// TryPackMembers is the Go binding used to pack the parameters required for calling // the contract method with ID 0x5daf08ca. This method will return an error // if any inputs are invalid/nil. // @@ -343,7 +343,7 @@ func (dAO *DAO) PackMinimumQuorum() []byte { return enc } -// PackMinimumQuorum is the Go binding used to pack the parameters required for calling +// TryPackMinimumQuorum is the Go binding used to pack the parameters required for calling // the contract method with ID 0x8160f0b5. This method will return an error // if any inputs are invalid/nil. // @@ -378,7 +378,7 @@ func (dAO *DAO) PackNewProposal(beneficiary common.Address, etherAmount *big.Int return enc } -// PackNewProposal is the Go binding used to pack the parameters required for calling +// TryPackNewProposal is the Go binding used to pack the parameters required for calling // the contract method with ID 0xb1050da5. This method will return an error // if any inputs are invalid/nil. // @@ -413,7 +413,7 @@ func (dAO *DAO) PackNumProposals() []byte { return enc } -// PackNumProposals is the Go binding used to pack the parameters required for calling +// TryPackNumProposals is the Go binding used to pack the parameters required for calling // the contract method with ID 0x400e3949. This method will return an error // if any inputs are invalid/nil. // @@ -448,7 +448,7 @@ func (dAO *DAO) PackOwner() []byte { return enc } -// PackOwner is the Go binding used to pack the parameters required for calling +// TryPackOwner is the Go binding used to pack the parameters required for calling // the contract method with ID 0x8da5cb5b. This method will return an error // if any inputs are invalid/nil. // @@ -483,7 +483,7 @@ func (dAO *DAO) PackProposals(arg0 *big.Int) []byte { return enc } -// PackProposals is the Go binding used to pack the parameters required for calling +// TryPackProposals is the Go binding used to pack the parameters required for calling // the contract method with ID 0x013cf08b. This method will return an error // if any inputs are invalid/nil. // @@ -541,7 +541,7 @@ func (dAO *DAO) PackTransferOwnership(newOwner common.Address) []byte { return enc } -// PackTransferOwnership is the Go binding used to pack the parameters required for calling +// TryPackTransferOwnership is the Go binding used to pack the parameters required for calling // the contract method with ID 0xf2fde38b. This method will return an error // if any inputs are invalid/nil. // @@ -563,7 +563,7 @@ func (dAO *DAO) PackVote(proposalNumber *big.Int, supportsProposal bool, justifi return enc } -// PackVote is the Go binding used to pack the parameters required for calling +// TryPackVote is the Go binding used to pack the parameters required for calling // the contract method with ID 0xd3c0715b. This method will return an error // if any inputs are invalid/nil. // diff --git a/accounts/abi/abigen/testdata/v2/deeplynestedarray.go.txt b/accounts/abi/abigen/testdata/v2/deeplynestedarray.go.txt index edc5d10431ab..302f1d736fcc 100644 --- a/accounts/abi/abigen/testdata/v2/deeplynestedarray.go.txt +++ b/accounts/abi/abigen/testdata/v2/deeplynestedarray.go.txt @@ -64,7 +64,7 @@ func (deeplyNestedArray *DeeplyNestedArray) PackDeepUint64Array(arg0 *big.Int, a return enc } -// PackDeepUint64Array is the Go binding used to pack the parameters required for calling +// TryPackDeepUint64Array is the Go binding used to pack the parameters required for calling // the contract method with ID 0x98ed1856. This method will return an error // if any inputs are invalid/nil. // @@ -99,7 +99,7 @@ func (deeplyNestedArray *DeeplyNestedArray) PackRetrieveDeepArray() []byte { return enc } -// PackRetrieveDeepArray is the Go binding used to pack the parameters required for calling +// TryPackRetrieveDeepArray is the Go binding used to pack the parameters required for calling // the contract method with ID 0x8ed4573a. This method will return an error // if any inputs are invalid/nil. // @@ -134,7 +134,7 @@ func (deeplyNestedArray *DeeplyNestedArray) PackStoreDeepUintArray(arr [5][4][3] return enc } -// PackStoreDeepUintArray is the Go binding used to pack the parameters required for calling +// TryPackStoreDeepUintArray is the Go binding used to pack the parameters required for calling // the contract method with ID 0x34424855. This method will return an error // if any inputs are invalid/nil. // diff --git a/accounts/abi/abigen/testdata/v2/getter.go.txt b/accounts/abi/abigen/testdata/v2/getter.go.txt index a7b62be6d64b..69a4fb54c822 100644 --- a/accounts/abi/abigen/testdata/v2/getter.go.txt +++ b/accounts/abi/abigen/testdata/v2/getter.go.txt @@ -64,7 +64,7 @@ func (getter *Getter) PackGetter() []byte { return enc } -// PackGetter is the Go binding used to pack the parameters required for calling +// TryPackGetter is the Go binding used to pack the parameters required for calling // the contract method with ID 0x993a04b7. This method will return an error // if any inputs are invalid/nil. // diff --git a/accounts/abi/abigen/testdata/v2/identifiercollision.go.txt b/accounts/abi/abigen/testdata/v2/identifiercollision.go.txt index 0105be1b3d12..e7301521f4d0 100644 --- a/accounts/abi/abigen/testdata/v2/identifiercollision.go.txt +++ b/accounts/abi/abigen/testdata/v2/identifiercollision.go.txt @@ -64,7 +64,7 @@ func (identifierCollision *IdentifierCollision) PackMyVar() []byte { return enc } -// PackMyVar is the Go binding used to pack the parameters required for calling +// TryPackMyVar is the Go binding used to pack the parameters required for calling // the contract method with ID 0x4ef1f0ad. This method will return an error // if any inputs are invalid/nil. // @@ -99,7 +99,7 @@ func (identifierCollision *IdentifierCollision) PackPubVar() []byte { return enc } -// PackPubVar is the Go binding used to pack the parameters required for calling +// TryPackPubVar is the Go binding used to pack the parameters required for calling // the contract method with ID 0x01ad4d87. This method will return an error // if any inputs are invalid/nil. // diff --git a/accounts/abi/abigen/testdata/v2/inputchecker.go.txt b/accounts/abi/abigen/testdata/v2/inputchecker.go.txt index 580d9d4a1f4a..1743f336db0c 100644 --- a/accounts/abi/abigen/testdata/v2/inputchecker.go.txt +++ b/accounts/abi/abigen/testdata/v2/inputchecker.go.txt @@ -63,7 +63,7 @@ func (inputChecker *InputChecker) PackAnonInput(arg0 string) []byte { return enc } -// PackAnonInput is the Go binding used to pack the parameters required for calling +// TryPackAnonInput is the Go binding used to pack the parameters required for calling // the contract method with ID 0x3e708e82. This method will return an error // if any inputs are invalid/nil. // @@ -85,7 +85,7 @@ func (inputChecker *InputChecker) PackAnonInputs(arg0 string, arg1 string) []byt return enc } -// PackAnonInputs is the Go binding used to pack the parameters required for calling +// TryPackAnonInputs is the Go binding used to pack the parameters required for calling // the contract method with ID 0x28160527. This method will return an error // if any inputs are invalid/nil. // @@ -107,7 +107,7 @@ func (inputChecker *InputChecker) PackMixedInputs(arg0 string, str string) []byt return enc } -// PackMixedInputs is the Go binding used to pack the parameters required for calling +// TryPackMixedInputs is the Go binding used to pack the parameters required for calling // the contract method with ID 0xc689ebdc. This method will return an error // if any inputs are invalid/nil. // @@ -129,7 +129,7 @@ func (inputChecker *InputChecker) PackNamedInput(str string) []byte { return enc } -// PackNamedInput is the Go binding used to pack the parameters required for calling +// TryPackNamedInput is the Go binding used to pack the parameters required for calling // the contract method with ID 0x0d402005. This method will return an error // if any inputs are invalid/nil. // @@ -151,7 +151,7 @@ func (inputChecker *InputChecker) PackNamedInputs(str1 string, str2 string) []by return enc } -// PackNamedInputs is the Go binding used to pack the parameters required for calling +// TryPackNamedInputs is the Go binding used to pack the parameters required for calling // the contract method with ID 0x63c796ed. This method will return an error // if any inputs are invalid/nil. // @@ -173,7 +173,7 @@ func (inputChecker *InputChecker) PackNoInput() []byte { return enc } -// PackNoInput is the Go binding used to pack the parameters required for calling +// TryPackNoInput is the Go binding used to pack the parameters required for calling // the contract method with ID 0x53539029. This method will return an error // if any inputs are invalid/nil. // diff --git a/accounts/abi/abigen/testdata/v2/interactor.go.txt b/accounts/abi/abigen/testdata/v2/interactor.go.txt index 3382078559c0..f33c95b63926 100644 --- a/accounts/abi/abigen/testdata/v2/interactor.go.txt +++ b/accounts/abi/abigen/testdata/v2/interactor.go.txt @@ -76,7 +76,7 @@ func (interactor *Interactor) PackDeployString() []byte { return enc } -// PackDeployString is the Go binding used to pack the parameters required for calling +// TryPackDeployString is the Go binding used to pack the parameters required for calling // the contract method with ID 0x6874e809. This method will return an error // if any inputs are invalid/nil. // @@ -111,7 +111,7 @@ func (interactor *Interactor) PackTransact(str string) []byte { return enc } -// PackTransact is the Go binding used to pack the parameters required for calling +// TryPackTransact is the Go binding used to pack the parameters required for calling // the contract method with ID 0xd736c513. This method will return an error // if any inputs are invalid/nil. // @@ -133,7 +133,7 @@ func (interactor *Interactor) PackTransactString() []byte { return enc } -// PackTransactString is the Go binding used to pack the parameters required for calling +// TryPackTransactString is the Go binding used to pack the parameters required for calling // the contract method with ID 0x0d86a0e1. This method will return an error // if any inputs are invalid/nil. // diff --git a/accounts/abi/abigen/testdata/v2/nameconflict.go.txt b/accounts/abi/abigen/testdata/v2/nameconflict.go.txt index b8e07f6e09b1..fbc61a5c6c93 100644 --- a/accounts/abi/abigen/testdata/v2/nameconflict.go.txt +++ b/accounts/abi/abigen/testdata/v2/nameconflict.go.txt @@ -70,7 +70,7 @@ func (nameConflict *NameConflict) PackAddRequest(req Oraclerequest) []byte { return enc } -// PackAddRequest is the Go binding used to pack the parameters required for calling +// TryPackAddRequest is the Go binding used to pack the parameters required for calling // the contract method with ID 0xcce7b048. This method will return an error // if any inputs are invalid/nil. // @@ -92,7 +92,7 @@ func (nameConflict *NameConflict) PackGetRequest() []byte { return enc } -// PackGetRequest is the Go binding used to pack the parameters required for calling +// TryPackGetRequest is the Go binding used to pack the parameters required for calling // the contract method with ID 0xc2bb515f. This method will return an error // if any inputs are invalid/nil. // diff --git a/accounts/abi/abigen/testdata/v2/numericmethodname.go.txt b/accounts/abi/abigen/testdata/v2/numericmethodname.go.txt index 84e4134809a8..9d698a2657fc 100644 --- a/accounts/abi/abigen/testdata/v2/numericmethodname.go.txt +++ b/accounts/abi/abigen/testdata/v2/numericmethodname.go.txt @@ -64,7 +64,7 @@ func (numericMethodName *NumericMethodName) PackE1test() []byte { return enc } -// PackE1test is the Go binding used to pack the parameters required for calling +// TryPackE1test is the Go binding used to pack the parameters required for calling // the contract method with ID 0xffa02795. This method will return an error // if any inputs are invalid/nil. // @@ -86,7 +86,7 @@ func (numericMethodName *NumericMethodName) PackE1test0() []byte { return enc } -// PackE1test0 is the Go binding used to pack the parameters required for calling +// TryPackE1test0 is the Go binding used to pack the parameters required for calling // the contract method with ID 0xd02767c7. This method will return an error // if any inputs are invalid/nil. // @@ -108,7 +108,7 @@ func (numericMethodName *NumericMethodName) PackE2test() []byte { return enc } -// PackE2test is the Go binding used to pack the parameters required for calling +// TryPackE2test is the Go binding used to pack the parameters required for calling // the contract method with ID 0x9d993132. This method will return an error // if any inputs are invalid/nil. // diff --git a/accounts/abi/abigen/testdata/v2/outputchecker.go.txt b/accounts/abi/abigen/testdata/v2/outputchecker.go.txt index 0ef2d47f84e9..f1c98f536e80 100644 --- a/accounts/abi/abigen/testdata/v2/outputchecker.go.txt +++ b/accounts/abi/abigen/testdata/v2/outputchecker.go.txt @@ -63,7 +63,7 @@ func (outputChecker *OutputChecker) PackAnonOutput() []byte { return enc } -// PackAnonOutput is the Go binding used to pack the parameters required for calling +// TryPackAnonOutput is the Go binding used to pack the parameters required for calling // the contract method with ID 0x008bda05. This method will return an error // if any inputs are invalid/nil. // @@ -98,7 +98,7 @@ func (outputChecker *OutputChecker) PackAnonOutputs() []byte { return enc } -// PackAnonOutputs is the Go binding used to pack the parameters required for calling +// TryPackAnonOutputs is the Go binding used to pack the parameters required for calling // the contract method with ID 0x3c401115. This method will return an error // if any inputs are invalid/nil. // @@ -142,7 +142,7 @@ func (outputChecker *OutputChecker) PackCollidingOutputs() []byte { return enc } -// PackCollidingOutputs is the Go binding used to pack the parameters required for calling +// TryPackCollidingOutputs is the Go binding used to pack the parameters required for calling // the contract method with ID 0xeccbc1ee. This method will return an error // if any inputs are invalid/nil. // @@ -186,7 +186,7 @@ func (outputChecker *OutputChecker) PackMixedOutputs() []byte { return enc } -// PackMixedOutputs is the Go binding used to pack the parameters required for calling +// TryPackMixedOutputs is the Go binding used to pack the parameters required for calling // the contract method with ID 0x21b77b44. This method will return an error // if any inputs are invalid/nil. // @@ -230,7 +230,7 @@ func (outputChecker *OutputChecker) PackNamedOutput() []byte { return enc } -// PackNamedOutput is the Go binding used to pack the parameters required for calling +// TryPackNamedOutput is the Go binding used to pack the parameters required for calling // the contract method with ID 0x5e632bd5. This method will return an error // if any inputs are invalid/nil. // @@ -265,7 +265,7 @@ func (outputChecker *OutputChecker) PackNamedOutputs() []byte { return enc } -// PackNamedOutputs is the Go binding used to pack the parameters required for calling +// TryPackNamedOutputs is the Go binding used to pack the parameters required for calling // the contract method with ID 0x7970a189. This method will return an error // if any inputs are invalid/nil. // @@ -309,7 +309,7 @@ func (outputChecker *OutputChecker) PackNoOutput() []byte { return enc } -// PackNoOutput is the Go binding used to pack the parameters required for calling +// TryPackNoOutput is the Go binding used to pack the parameters required for calling // the contract method with ID 0x625f0306. This method will return an error // if any inputs are invalid/nil. // diff --git a/accounts/abi/abigen/testdata/v2/overload.go.txt b/accounts/abi/abigen/testdata/v2/overload.go.txt index 340e4e723dd0..3b9a95a125b3 100644 --- a/accounts/abi/abigen/testdata/v2/overload.go.txt +++ b/accounts/abi/abigen/testdata/v2/overload.go.txt @@ -64,7 +64,7 @@ func (overload *Overload) PackFoo(i *big.Int, j *big.Int) []byte { return enc } -// PackFoo is the Go binding used to pack the parameters required for calling +// TryPackFoo is the Go binding used to pack the parameters required for calling // the contract method with ID 0x04bc52f8. This method will return an error // if any inputs are invalid/nil. // @@ -86,7 +86,7 @@ func (overload *Overload) PackFoo0(i *big.Int) []byte { return enc } -// PackFoo0 is the Go binding used to pack the parameters required for calling +// TryPackFoo0 is the Go binding used to pack the parameters required for calling // the contract method with ID 0x2fbebd38. This method will return an error // if any inputs are invalid/nil. // diff --git a/accounts/abi/abigen/testdata/v2/rangekeyword.go.txt b/accounts/abi/abigen/testdata/v2/rangekeyword.go.txt index 294342cb1d17..296de1fccc71 100644 --- a/accounts/abi/abigen/testdata/v2/rangekeyword.go.txt +++ b/accounts/abi/abigen/testdata/v2/rangekeyword.go.txt @@ -64,7 +64,7 @@ func (rangeKeyword *RangeKeyword) PackFunctionWithKeywordParameter(arg0 *big.Int return enc } -// PackFunctionWithKeywordParameter is the Go binding used to pack the parameters required for calling +// TryPackFunctionWithKeywordParameter is the Go binding used to pack the parameters required for calling // the contract method with ID 0x527a119f. This method will return an error // if any inputs are invalid/nil. // diff --git a/accounts/abi/abigen/testdata/v2/slicer.go.txt b/accounts/abi/abigen/testdata/v2/slicer.go.txt index 72d468558f4d..379f136453e0 100644 --- a/accounts/abi/abigen/testdata/v2/slicer.go.txt +++ b/accounts/abi/abigen/testdata/v2/slicer.go.txt @@ -64,7 +64,7 @@ func (slicer *Slicer) PackEchoAddresses(input []common.Address) []byte { return enc } -// PackEchoAddresses is the Go binding used to pack the parameters required for calling +// TryPackEchoAddresses is the Go binding used to pack the parameters required for calling // the contract method with ID 0xbe1127a3. This method will return an error // if any inputs are invalid/nil. // @@ -99,7 +99,7 @@ func (slicer *Slicer) PackEchoBools(input []bool) []byte { return enc } -// PackEchoBools is the Go binding used to pack the parameters required for calling +// TryPackEchoBools is the Go binding used to pack the parameters required for calling // the contract method with ID 0xf637e589. This method will return an error // if any inputs are invalid/nil. // @@ -134,7 +134,7 @@ func (slicer *Slicer) PackEchoFancyInts(input [23]*big.Int) []byte { return enc } -// PackEchoFancyInts is the Go binding used to pack the parameters required for calling +// TryPackEchoFancyInts is the Go binding used to pack the parameters required for calling // the contract method with ID 0xd88becc0. This method will return an error // if any inputs are invalid/nil. // @@ -169,7 +169,7 @@ func (slicer *Slicer) PackEchoInts(input []*big.Int) []byte { return enc } -// PackEchoInts is the Go binding used to pack the parameters required for calling +// TryPackEchoInts is the Go binding used to pack the parameters required for calling // the contract method with ID 0xe15a3db7. This method will return an error // if any inputs are invalid/nil. // diff --git a/accounts/abi/abigen/testdata/v2/structs.go.txt b/accounts/abi/abigen/testdata/v2/structs.go.txt index fc9efc2cbe47..4d8864cf6ea3 100644 --- a/accounts/abi/abigen/testdata/v2/structs.go.txt +++ b/accounts/abi/abigen/testdata/v2/structs.go.txt @@ -69,7 +69,7 @@ func (structs *Structs) PackF() []byte { return enc } -// PackF is the Go binding used to pack the parameters required for calling +// TryPackF is the Go binding used to pack the parameters required for calling // the contract method with ID 0x28811f59. This method will return an error // if any inputs are invalid/nil. // @@ -115,7 +115,7 @@ func (structs *Structs) PackG() []byte { return enc } -// PackG is the Go binding used to pack the parameters required for calling +// TryPackG is the Go binding used to pack the parameters required for calling // the contract method with ID 0x6fecb623. This method will return an error // if any inputs are invalid/nil. // diff --git a/accounts/abi/abigen/testdata/v2/token.go.txt b/accounts/abi/abigen/testdata/v2/token.go.txt index 5999ddbe5ce1..69294f375a15 100644 --- a/accounts/abi/abigen/testdata/v2/token.go.txt +++ b/accounts/abi/abigen/testdata/v2/token.go.txt @@ -76,7 +76,7 @@ func (token *Token) PackAllowance(arg0 common.Address, arg1 common.Address) []by return enc } -// PackAllowance is the Go binding used to pack the parameters required for calling +// TryPackAllowance is the Go binding used to pack the parameters required for calling // the contract method with ID 0xdd62ed3e. This method will return an error // if any inputs are invalid/nil. // @@ -111,7 +111,7 @@ func (token *Token) PackApproveAndCall(spender common.Address, value *big.Int, e return enc } -// PackApproveAndCall is the Go binding used to pack the parameters required for calling +// TryPackApproveAndCall is the Go binding used to pack the parameters required for calling // the contract method with ID 0xcae9ca51. This method will return an error // if any inputs are invalid/nil. // @@ -146,7 +146,7 @@ func (token *Token) PackBalanceOf(arg0 common.Address) []byte { return enc } -// PackBalanceOf is the Go binding used to pack the parameters required for calling +// TryPackBalanceOf is the Go binding used to pack the parameters required for calling // the contract method with ID 0x70a08231. This method will return an error // if any inputs are invalid/nil. // @@ -181,7 +181,7 @@ func (token *Token) PackDecimals() []byte { return enc } -// PackDecimals is the Go binding used to pack the parameters required for calling +// TryPackDecimals is the Go binding used to pack the parameters required for calling // the contract method with ID 0x313ce567. This method will return an error // if any inputs are invalid/nil. // @@ -216,7 +216,7 @@ func (token *Token) PackName() []byte { return enc } -// PackName is the Go binding used to pack the parameters required for calling +// TryPackName is the Go binding used to pack the parameters required for calling // the contract method with ID 0x06fdde03. This method will return an error // if any inputs are invalid/nil. // @@ -251,7 +251,7 @@ func (token *Token) PackSpentAllowance(arg0 common.Address, arg1 common.Address) return enc } -// PackSpentAllowance is the Go binding used to pack the parameters required for calling +// TryPackSpentAllowance is the Go binding used to pack the parameters required for calling // the contract method with ID 0xdc3080f2. This method will return an error // if any inputs are invalid/nil. // @@ -286,7 +286,7 @@ func (token *Token) PackSymbol() []byte { return enc } -// PackSymbol is the Go binding used to pack the parameters required for calling +// TryPackSymbol is the Go binding used to pack the parameters required for calling // the contract method with ID 0x95d89b41. This method will return an error // if any inputs are invalid/nil. // @@ -321,7 +321,7 @@ func (token *Token) PackTransfer(to common.Address, value *big.Int) []byte { return enc } -// PackTransfer is the Go binding used to pack the parameters required for calling +// TryPackTransfer is the Go binding used to pack the parameters required for calling // the contract method with ID 0xa9059cbb. This method will return an error // if any inputs are invalid/nil. // @@ -343,7 +343,7 @@ func (token *Token) PackTransferFrom(from common.Address, to common.Address, val return enc } -// PackTransferFrom is the Go binding used to pack the parameters required for calling +// TryPackTransferFrom is the Go binding used to pack the parameters required for calling // the contract method with ID 0x23b872dd. This method will return an error // if any inputs are invalid/nil. // diff --git a/accounts/abi/abigen/testdata/v2/tuple.go.txt b/accounts/abi/abigen/testdata/v2/tuple.go.txt index e6b72bafda6e..76a1f58d52f9 100644 --- a/accounts/abi/abigen/testdata/v2/tuple.go.txt +++ b/accounts/abi/abigen/testdata/v2/tuple.go.txt @@ -89,7 +89,7 @@ func (tuple *Tuple) PackFunc1(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS return enc } -// PackFunc1 is the Go binding used to pack the parameters required for calling +// TryPackFunc1 is the Go binding used to pack the parameters required for calling // the contract method with ID 0x443c79b4. This method will return an error // if any inputs are invalid/nil. // @@ -139,7 +139,7 @@ func (tuple *Tuple) PackFunc2(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS return enc } -// PackFunc2 is the Go binding used to pack the parameters required for calling +// TryPackFunc2 is the Go binding used to pack the parameters required for calling // the contract method with ID 0xd0062cdd. This method will return an error // if any inputs are invalid/nil. // @@ -161,7 +161,7 @@ func (tuple *Tuple) PackFunc3(arg0 []TupleQ) []byte { return enc } -// PackFunc3 is the Go binding used to pack the parameters required for calling +// TryPackFunc3 is the Go binding used to pack the parameters required for calling // the contract method with ID 0xe4d9a43b. This method will return an error // if any inputs are invalid/nil. // diff --git a/accounts/abi/abigen/testdata/v2/tupler.go.txt b/accounts/abi/abigen/testdata/v2/tupler.go.txt index 65410285ab0c..8643487042c8 100644 --- a/accounts/abi/abigen/testdata/v2/tupler.go.txt +++ b/accounts/abi/abigen/testdata/v2/tupler.go.txt @@ -64,7 +64,7 @@ func (tupler *Tupler) PackTuple() []byte { return enc } -// PackTuple is the Go binding used to pack the parameters required for calling +// TryPackTuple is the Go binding used to pack the parameters required for calling // the contract method with ID 0x3175aae2. This method will return an error // if any inputs are invalid/nil. // diff --git a/accounts/abi/abigen/testdata/v2/underscorer.go.txt b/accounts/abi/abigen/testdata/v2/underscorer.go.txt index 9e39bd40f397..13ec9685086a 100644 --- a/accounts/abi/abigen/testdata/v2/underscorer.go.txt +++ b/accounts/abi/abigen/testdata/v2/underscorer.go.txt @@ -64,7 +64,7 @@ func (underscorer *Underscorer) PackAllPurelyUnderscoredOutput() []byte { return enc } -// PackAllPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling +// TryPackAllPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling // the contract method with ID 0xb564b34d. This method will return an error // if any inputs are invalid/nil. // @@ -108,7 +108,7 @@ func (underscorer *Underscorer) PackLowerLowerCollision() []byte { return enc } -// PackLowerLowerCollision is the Go binding used to pack the parameters required for calling +// TryPackLowerLowerCollision is the Go binding used to pack the parameters required for calling // the contract method with ID 0xe409ca45. This method will return an error // if any inputs are invalid/nil. // @@ -152,7 +152,7 @@ func (underscorer *Underscorer) PackLowerUpperCollision() []byte { return enc } -// PackLowerUpperCollision is the Go binding used to pack the parameters required for calling +// TryPackLowerUpperCollision is the Go binding used to pack the parameters required for calling // the contract method with ID 0x03a59213. This method will return an error // if any inputs are invalid/nil. // @@ -196,7 +196,7 @@ func (underscorer *Underscorer) PackPurelyUnderscoredOutput() []byte { return enc } -// PackPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling +// TryPackPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling // the contract method with ID 0x9df48485. This method will return an error // if any inputs are invalid/nil. // @@ -240,7 +240,7 @@ func (underscorer *Underscorer) PackUnderscoredOutput() []byte { return enc } -// PackUnderscoredOutput is the Go binding used to pack the parameters required for calling +// TryPackUnderscoredOutput is the Go binding used to pack the parameters required for calling // the contract method with ID 0x67e6633d. This method will return an error // if any inputs are invalid/nil. // @@ -284,7 +284,7 @@ func (underscorer *Underscorer) PackUpperLowerCollision() []byte { return enc } -// PackUpperLowerCollision is the Go binding used to pack the parameters required for calling +// TryPackUpperLowerCollision is the Go binding used to pack the parameters required for calling // the contract method with ID 0xaf7486ab. This method will return an error // if any inputs are invalid/nil. // @@ -328,7 +328,7 @@ func (underscorer *Underscorer) PackUpperUpperCollision() []byte { return enc } -// PackUpperUpperCollision is the Go binding used to pack the parameters required for calling +// TryPackUpperUpperCollision is the Go binding used to pack the parameters required for calling // the contract method with ID 0xe02ab24d. This method will return an error // if any inputs are invalid/nil. // @@ -372,7 +372,7 @@ func (underscorer *Underscorer) PackUnderScoredFunc() []byte { return enc } -// PackUnderScoredFunc is the Go binding used to pack the parameters required for calling +// TryPackUnderScoredFunc is the Go binding used to pack the parameters required for calling // the contract method with ID 0x46546dbe. This method will return an error // if any inputs are invalid/nil. // diff --git a/accounts/abi/bind/v2/internal/contracts/db/bindings.go b/accounts/abi/bind/v2/internal/contracts/db/bindings.go index dedb2518267e..fc00a555b5cc 100644 --- a/accounts/abi/bind/v2/internal/contracts/db/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/db/bindings.go @@ -71,7 +71,7 @@ func (dB *DB) PackGet(k *big.Int) []byte { return enc } -// PackGet is the Go binding used to pack the parameters required for calling +// TryPackGet is the Go binding used to pack the parameters required for calling // the contract method with ID 0x9507d39a. This method will return an error // if any inputs are invalid/nil. // @@ -106,7 +106,7 @@ func (dB *DB) PackGetNamedStatParams() []byte { return enc } -// PackGetNamedStatParams is the Go binding used to pack the parameters required for calling +// TryPackGetNamedStatParams is the Go binding used to pack the parameters required for calling // the contract method with ID 0xe369ba3b. This method will return an error // if any inputs are invalid/nil. // @@ -152,7 +152,7 @@ func (dB *DB) PackGetStatParams() []byte { return enc } -// PackGetStatParams is the Go binding used to pack the parameters required for calling +// TryPackGetStatParams is the Go binding used to pack the parameters required for calling // the contract method with ID 0x6fcb9c70. This method will return an error // if any inputs are invalid/nil. // @@ -198,7 +198,7 @@ func (dB *DB) PackGetStatsStruct() []byte { return enc } -// PackGetStatsStruct is the Go binding used to pack the parameters required for calling +// TryPackGetStatsStruct is the Go binding used to pack the parameters required for calling // the contract method with ID 0xee8161e0. This method will return an error // if any inputs are invalid/nil. // @@ -233,7 +233,7 @@ func (dB *DB) PackInsert(k *big.Int, v *big.Int) []byte { return enc } -// PackInsert is the Go binding used to pack the parameters required for calling +// TryPackInsert is the Go binding used to pack the parameters required for calling // the contract method with ID 0x1d834a1b. This method will return an error // if any inputs are invalid/nil. // diff --git a/accounts/abi/bind/v2/internal/contracts/events/bindings.go b/accounts/abi/bind/v2/internal/contracts/events/bindings.go index 780c8e4a5f26..ba4fdc71e3f1 100644 --- a/accounts/abi/bind/v2/internal/contracts/events/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/events/bindings.go @@ -64,7 +64,7 @@ func (c *C) PackEmitMulti() []byte { return enc } -// PackEmitMulti is the Go binding used to pack the parameters required for calling +// TryPackEmitMulti is the Go binding used to pack the parameters required for calling // the contract method with ID 0xcb493749. This method will return an error // if any inputs are invalid/nil. // @@ -86,7 +86,7 @@ func (c *C) PackEmitOne() []byte { return enc } -// PackEmitOne is the Go binding used to pack the parameters required for calling +// TryPackEmitOne is the Go binding used to pack the parameters required for calling // the contract method with ID 0xe8e49a71. This method will return an error // if any inputs are invalid/nil. // diff --git a/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go b/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go index ab2c73db416d..d1cb08116b0c 100644 --- a/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go @@ -80,7 +80,7 @@ func (c1 *C1) PackDo(val *big.Int) []byte { return enc } -// PackDo is the Go binding used to pack the parameters required for calling +// TryPackDo is the Go binding used to pack the parameters required for calling // the contract method with ID 0x2ad11272. This method will return an error // if any inputs are invalid/nil. // @@ -158,7 +158,7 @@ func (c2 *C2) PackDo(val *big.Int) []byte { return enc } -// PackDo is the Go binding used to pack the parameters required for calling +// TryPackDo is the Go binding used to pack the parameters required for calling // the contract method with ID 0x2ad11272. This method will return an error // if any inputs are invalid/nil. // @@ -220,7 +220,7 @@ func (l1 *L1) PackDo(val *big.Int) []byte { return enc } -// PackDo is the Go binding used to pack the parameters required for calling +// TryPackDo is the Go binding used to pack the parameters required for calling // the contract method with ID 0x2ad11272. This method will return an error // if any inputs are invalid/nil. // @@ -285,7 +285,7 @@ func (l2 *L2) PackDo(val *big.Int) []byte { return enc } -// PackDo is the Go binding used to pack the parameters required for calling +// TryPackDo is the Go binding used to pack the parameters required for calling // the contract method with ID 0x2ad11272. This method will return an error // if any inputs are invalid/nil. // @@ -350,7 +350,7 @@ func (l2b *L2b) PackDo(val *big.Int) []byte { return enc } -// PackDo is the Go binding used to pack the parameters required for calling +// TryPackDo is the Go binding used to pack the parameters required for calling // the contract method with ID 0x2ad11272. This method will return an error // if any inputs are invalid/nil. // @@ -412,7 +412,7 @@ func (l3 *L3) PackDo(val *big.Int) []byte { return enc } -// PackDo is the Go binding used to pack the parameters required for calling +// TryPackDo is the Go binding used to pack the parameters required for calling // the contract method with ID 0x2ad11272. This method will return an error // if any inputs are invalid/nil. // @@ -478,7 +478,7 @@ func (l4 *L4) PackDo(val *big.Int) []byte { return enc } -// PackDo is the Go binding used to pack the parameters required for calling +// TryPackDo is the Go binding used to pack the parameters required for calling // the contract method with ID 0x2ad11272. This method will return an error // if any inputs are invalid/nil. // @@ -543,7 +543,7 @@ func (l4b *L4b) PackDo(val *big.Int) []byte { return enc } -// PackDo is the Go binding used to pack the parameters required for calling +// TryPackDo is the Go binding used to pack the parameters required for calling // the contract method with ID 0x2ad11272. This method will return an error // if any inputs are invalid/nil. // diff --git a/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go b/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go index a65a9f20ce7a..627b86f1b99a 100644 --- a/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go @@ -64,7 +64,7 @@ func (c *C) PackBar() []byte { return enc } -// PackBar is the Go binding used to pack the parameters required for calling +// TryPackBar is the Go binding used to pack the parameters required for calling // the contract method with ID 0xb0a378b0. This method will return an error // if any inputs are invalid/nil. // @@ -86,7 +86,7 @@ func (c *C) PackFoo() []byte { return enc } -// PackFoo is the Go binding used to pack the parameters required for calling +// TryPackFoo is the Go binding used to pack the parameters required for calling // the contract method with ID 0xbfb4ebcf. This method will return an error // if any inputs are invalid/nil. // @@ -201,7 +201,7 @@ func (c2 *C2) PackFoo() []byte { return enc } -// PackFoo is the Go binding used to pack the parameters required for calling +// TryPackFoo is the Go binding used to pack the parameters required for calling // the contract method with ID 0xbfb4ebcf. This method will return an error // if any inputs are invalid/nil. // diff --git a/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go b/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go index e5da79c51baa..19d09bdd6a41 100644 --- a/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go @@ -64,7 +64,7 @@ func (myContract *MyContract) PackGetNums() []byte { return enc } -// PackGetNums is the Go binding used to pack the parameters required for calling +// TryPackGetNums is the Go binding used to pack the parameters required for calling // the contract method with ID 0xbd6d1007. This method will return an error // if any inputs are invalid/nil. //