From 39c1de6c5cea02ea5fb2ee5adcc1f2828a04c1c4 Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Fri, 25 Apr 2025 17:25:28 +0800 Subject: [PATCH] accounts/abi: revert pointer return for Unpack --- accounts/abi/abigen/source2.go.tpl | 23 +-- .../abigen/testdata/v2/callbackparam.go.txt | 10 +- .../abi/abigen/testdata/v2/crowdsale.go.txt | 90 ++++++---- accounts/abi/abigen/testdata/v2/dao.go.txt | 170 ++++++++++-------- .../testdata/v2/deeplynestedarray.go.txt | 30 ++-- accounts/abi/abigen/testdata/v2/getter.go.txt | 20 ++- .../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 | 110 +++++++----- .../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 | 30 ++-- accounts/abi/abigen/testdata/v2/token.go.txt | 90 ++++++---- accounts/abi/abigen/testdata/v2/tuple.go.txt | 40 +++-- accounts/abi/abigen/testdata/v2/tupler.go.txt | 20 ++- .../abi/abigen/testdata/v2/underscorer.go.txt | 150 +++++++++------- .../bind/v2/internal/contracts/db/bindings.go | 70 ++++---- .../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, 713 insertions(+), 510 deletions(-) diff --git a/accounts/abi/abigen/source2.go.tpl b/accounts/abi/abigen/source2.go.tpl index 4131cd8841..4d4b7149a8 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}} - if err != nil { - return nil, err - } outstruct := new({{.Normalized.Name}}Output) + if err != nil { + return *outstruct, err + } {{- 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 d3abab5054..4e9ccbe2cc 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 078784e20f..4b9b3f0456 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) - if err != nil { - return nil, err - } outstruct := new(FundersOutput) + if err != nil { + return *outstruct, err + } 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 0c656b54ce..54e0d38242 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) - if err != nil { - return nil, err - } outstruct := new(MembersOutput) + if err != nil { + return *outstruct, err + } 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) - if err != nil { - return nil, err - } outstruct := new(ProposalsOutput) + if err != nil { + return *outstruct, err + } 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 b4788ec930..edc5d10431 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 2fa09c4c25..a7b62be6d6 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) - if err != nil { - return nil, err - } outstruct := new(GetterOutput) + if err != nil { + return *outstruct, err + } 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 b29365366e..0105be1b3d 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 5ef50dba1f..580d9d4a1f 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 de8a0c5211..3382078559 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 fd0fcd31cc..b8e07f6e09 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 e861aba444..84e4134809 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 5f95e747b7..0ef2d47f84 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) - if err != nil { - return nil, err - } outstruct := new(AnonOutputsOutput) + if err != nil { + return *outstruct, err + } 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) - if err != nil { - return nil, err - } outstruct := new(CollidingOutputsOutput) + if err != nil { + return *outstruct, err + } 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) - if err != nil { - return nil, err - } outstruct := new(MixedOutputsOutput) + if err != nil { + return *outstruct, err + } 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) - if err != nil { - return nil, err - } outstruct := new(NamedOutputsOutput) + if err != nil { + return *outstruct, err + } 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 7f6e3535ea..340e4e723d 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 ac05be2a9e..294342cb1d 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 426eaa0517..72d468558f 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 da94fbf164..fc9efc2cbe 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) - if err != nil { - return nil, err - } outstruct := new(FOutput) + if err != nil { + return *outstruct, err + } 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 489c084c3c..5999ddbe5c 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 4f03b7f1fb..e6b72bafda 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) - if err != nil { - return nil, err - } outstruct := new(Func1Output) + if err != nil { + return *outstruct, err + } 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 5d919944cf..65410285ab 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) - if err != nil { - return nil, err - } outstruct := new(TupleOutput) + if err != nil { + return *outstruct, err + } 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 96c138fd44..9e39bd40f3 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) - if err != nil { - return nil, err - } outstruct := new(AllPurelyUnderscoredOutputOutput) + if err != nil { + return *outstruct, err + } 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) - if err != nil { - return nil, err - } outstruct := new(LowerLowerCollisionOutput) + if err != nil { + return *outstruct, err + } 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) - if err != nil { - return nil, err - } outstruct := new(LowerUpperCollisionOutput) + if err != nil { + return *outstruct, err + } 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) - if err != nil { - return nil, err - } outstruct := new(PurelyUnderscoredOutputOutput) + if err != nil { + return *outstruct, err + } 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) - if err != nil { - return nil, err - } outstruct := new(UnderscoredOutputOutput) + if err != nil { + return *outstruct, err + } 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) - if err != nil { - return nil, err - } outstruct := new(UpperLowerCollisionOutput) + if err != nil { + return *outstruct, err + } 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) - if err != nil { - return nil, err - } outstruct := new(UpperUpperCollisionOutput) + if err != nil { + return *outstruct, err + } 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 93cd2a491b..dedb251826 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) - if err != nil { - return nil, err - } outstruct := new(GetNamedStatParamsOutput) + if err != nil { + return *outstruct, err + } 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) - if err != nil { - return nil, err - } outstruct := new(GetStatParamsOutput) + if err != nil { + return *outstruct, err + } 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 f2918afb64..780c8e4a5f 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 2a3d21a37c..ab2c73db41 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 3ea8489b82..a65a9f20ce 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 c336198c88..e5da79c51b 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) {