diff --git a/accounts/abi/abigen/bindv2_test.go b/accounts/abi/abigen/bindv2_test.go index 2756ba0835e2..ee943f1c3f37 100644 --- a/accounts/abi/abigen/bindv2_test.go +++ b/accounts/abi/abigen/bindv2_test.go @@ -281,7 +281,7 @@ func TestBindingV2ConvertedV1Tests(t *testing.T) { } // Set this environment variable to regenerate the test outputs. if os.Getenv("WRITE_TEST_FILES") != "" { - if err := os.WriteFile((fname), []byte(have), 0666); err != nil { + if err := os.WriteFile(fname, []byte(have), 0666); err != nil { t.Fatalf("err writing expected output to file: %v\n", err) } } diff --git a/accounts/abi/abigen/source2.go.tpl b/accounts/abi/abigen/source2.go.tpl index 8f9d4d4103eb..8ef906b8d6a4 100644 --- a/accounts/abi/abigen/source2.go.tpl +++ b/accounts/abi/abigen/source2.go.tpl @@ -90,7 +90,8 @@ var ( {{range .Calls}} // 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}}. + // 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,6 +102,15 @@ var ( return enc } + // TryPack{{.Normalized.Name}} is the Go binding used to pack the parameters required for calling + // the contract method with ID 0x{{printf "%x" .Original.ID}}. This method will return an error + // if any inputs are invalid/nil. + // + // Solidity: {{.Original.String}} + func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) TryPack{{.Normalized.Name}}({{range .Normalized.Inputs}} {{.Name}} {{bindtype .Type $structs}}, {{end}}) ([]byte, error) { + return {{ decapitalise $contract.Type}}.abi.Pack("{{.Original.Name}}" {{range .Normalized.Inputs}}, {{.Name}}{{end}}) + } + {{/* Unpack method is needed only when there are return args */}} {{if .Normalized.Outputs }} {{ if .Structured }} @@ -133,8 +143,7 @@ var ( outstruct.{{capitalise .Name}} = *abi.ConvertType(out[{{$i}}], new({{bindtype .Type $structs}})).(*{{bindtype .Type $structs}}) {{- end }} {{- end }} - return *outstruct, err - {{else}} + return *outstruct, nil{{else}} if err != nil { return {{range $i, $_ := .Normalized.Outputs}}{{if ispointertype .Type}}new({{underlyingbindtype .Type }}), {{else}}*new({{bindtype .Type $structs}}), {{end}}{{end}} err } @@ -145,8 +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}} err - {{- 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 e3205bde0dc7..d22b9784863c 100644 --- a/accounts/abi/abigen/testdata/v2/callbackparam.go.txt +++ b/accounts/abi/abigen/testdata/v2/callbackparam.go.txt @@ -52,7 +52,8 @@ func (c *CallbackParam) Instance(backend bind.ContractBackend, addr common.Addre } // PackTest is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xd7a5aba2. +// 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 { @@ -62,3 +63,12 @@ func (callbackParam *CallbackParam) PackTest(callback [24]byte) []byte { } return enc } + +// TryPackTest is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xd7a5aba2. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function test(function callback) returns() +func (callbackParam *CallbackParam) TryPackTest(callback [24]byte) ([]byte, error) { + return callbackParam.abi.Pack("test", callback) +} diff --git a/accounts/abi/abigen/testdata/v2/crowdsale.go.txt b/accounts/abi/abigen/testdata/v2/crowdsale.go.txt index 60d8b4ec11bd..b2183c91ea59 100644 --- a/accounts/abi/abigen/testdata/v2/crowdsale.go.txt +++ b/accounts/abi/abigen/testdata/v2/crowdsale.go.txt @@ -64,7 +64,8 @@ func (crowdsale *Crowdsale) PackConstructor(ifSuccessfulSendTo common.Address, f } // PackAmountRaised is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x7b3e5e7b. +// 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,6 +76,15 @@ func (crowdsale *Crowdsale) PackAmountRaised() []byte { return enc } +// TryPackAmountRaised is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x7b3e5e7b. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function amountRaised() returns(uint256) +func (crowdsale *Crowdsale) TryPackAmountRaised() ([]byte, error) { + return crowdsale.abi.Pack("amountRaised") +} + // UnpackAmountRaised is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x7b3e5e7b. // @@ -85,11 +95,12 @@ func (crowdsale *Crowdsale) UnpackAmountRaised(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // PackBeneficiary is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x38af3eed. +// 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 { @@ -100,6 +111,15 @@ func (crowdsale *Crowdsale) PackBeneficiary() []byte { return enc } +// TryPackBeneficiary is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x38af3eed. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function beneficiary() returns(address) +func (crowdsale *Crowdsale) TryPackBeneficiary() ([]byte, error) { + return crowdsale.abi.Pack("beneficiary") +} + // UnpackBeneficiary is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x38af3eed. // @@ -110,11 +130,12 @@ func (crowdsale *Crowdsale) UnpackBeneficiary(data []byte) (common.Address, erro return *new(common.Address), err } out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - return out0, err + return out0, nil } // PackCheckGoalReached is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x01cb3b20. +// 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 { @@ -125,8 +146,18 @@ func (crowdsale *Crowdsale) PackCheckGoalReached() []byte { return enc } +// TryPackCheckGoalReached is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x01cb3b20. This method will return an error +// if any inputs are invalid/nil. +// +// 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 -// the contract method with ID 0x29dcb0cf. +// 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 { @@ -137,6 +168,15 @@ func (crowdsale *Crowdsale) PackDeadline() []byte { return enc } +// TryPackDeadline is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x29dcb0cf. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function deadline() returns(uint256) +func (crowdsale *Crowdsale) TryPackDeadline() ([]byte, error) { + return crowdsale.abi.Pack("deadline") +} + // UnpackDeadline is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x29dcb0cf. // @@ -147,11 +187,12 @@ func (crowdsale *Crowdsale) UnpackDeadline(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // PackFunders is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xdc0d3dff. +// 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 { @@ -162,6 +203,15 @@ func (crowdsale *Crowdsale) PackFunders(arg0 *big.Int) []byte { return enc } +// TryPackFunders is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xdc0d3dff. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function funders(uint256 ) returns(address addr, uint256 amount) +func (crowdsale *Crowdsale) TryPackFunders(arg0 *big.Int) ([]byte, error) { + return crowdsale.abi.Pack("funders", arg0) +} + // FundersOutput serves as a container for the return parameters of contract // method Funders. type FundersOutput struct { @@ -181,12 +231,12 @@ func (crowdsale *Crowdsale) UnpackFunders(data []byte) (FundersOutput, error) { } outstruct.Addr = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) outstruct.Amount = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return *outstruct, err - + return *outstruct, nil } // PackFundingGoal is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x7a3a0e84. +// 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 { @@ -197,6 +247,15 @@ func (crowdsale *Crowdsale) PackFundingGoal() []byte { return enc } +// TryPackFundingGoal is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x7a3a0e84. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function fundingGoal() returns(uint256) +func (crowdsale *Crowdsale) TryPackFundingGoal() ([]byte, error) { + return crowdsale.abi.Pack("fundingGoal") +} + // UnpackFundingGoal is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x7a3a0e84. // @@ -207,11 +266,12 @@ func (crowdsale *Crowdsale) UnpackFundingGoal(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // PackPrice is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xa035b1fe. +// 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 { @@ -222,6 +282,15 @@ func (crowdsale *Crowdsale) PackPrice() []byte { return enc } +// TryPackPrice is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xa035b1fe. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function price() returns(uint256) +func (crowdsale *Crowdsale) TryPackPrice() ([]byte, error) { + return crowdsale.abi.Pack("price") +} + // UnpackPrice is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xa035b1fe. // @@ -232,11 +301,12 @@ func (crowdsale *Crowdsale) UnpackPrice(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // PackTokenReward is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x6e66f6e9. +// 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 { @@ -247,6 +317,15 @@ func (crowdsale *Crowdsale) PackTokenReward() []byte { return enc } +// TryPackTokenReward is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x6e66f6e9. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function tokenReward() returns(address) +func (crowdsale *Crowdsale) TryPackTokenReward() ([]byte, error) { + return crowdsale.abi.Pack("tokenReward") +} + // UnpackTokenReward is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x6e66f6e9. // @@ -257,7 +336,7 @@ func (crowdsale *Crowdsale) UnpackTokenReward(data []byte) (common.Address, erro return *new(common.Address), err } out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - return out0, err + return out0, nil } // CrowdsaleFundTransfer represents a FundTransfer event raised by the Crowdsale contract. diff --git a/accounts/abi/abigen/testdata/v2/dao.go.txt b/accounts/abi/abigen/testdata/v2/dao.go.txt index 72a80949f6c5..75fa95df9107 100644 --- a/accounts/abi/abigen/testdata/v2/dao.go.txt +++ b/accounts/abi/abigen/testdata/v2/dao.go.txt @@ -64,7 +64,8 @@ func (dAO *DAO) PackConstructor(minimumQuorumForProposals *big.Int, minutesForDe } // PackChangeMembership is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x9644fcbd. +// 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,8 +76,18 @@ func (dAO *DAO) PackChangeMembership(targetMember common.Address, canVote bool, return enc } +// TryPackChangeMembership is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x9644fcbd. This method will return an error +// if any inputs are invalid/nil. +// +// 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 -// the contract method with ID 0xbcca1fd3. +// 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 { @@ -87,8 +98,18 @@ func (dAO *DAO) PackChangeVotingRules(minimumQuorumForProposals *big.Int, minute return enc } +// TryPackChangeVotingRules is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xbcca1fd3. This method will return an error +// if any inputs are invalid/nil. +// +// 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 -// the contract method with ID 0xeceb2945. +// 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 { @@ -99,6 +120,15 @@ func (dAO *DAO) PackCheckProposalCode(proposalNumber *big.Int, beneficiary commo return enc } +// TryPackCheckProposalCode is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xeceb2945. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function checkProposalCode(uint256 proposalNumber, address beneficiary, uint256 etherAmount, bytes transactionBytecode) returns(bool codeChecksOut) +func (dAO *DAO) TryPackCheckProposalCode(proposalNumber *big.Int, beneficiary common.Address, etherAmount *big.Int, transactionBytecode []byte) ([]byte, error) { + return dAO.abi.Pack("checkProposalCode", proposalNumber, beneficiary, etherAmount, transactionBytecode) +} + // UnpackCheckProposalCode is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xeceb2945. // @@ -109,11 +139,12 @@ func (dAO *DAO) UnpackCheckProposalCode(data []byte) (bool, error) { return *new(bool), err } out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - return out0, err + return out0, nil } // PackDebatingPeriodInMinutes is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x69bd3436. +// 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 { @@ -124,6 +155,15 @@ func (dAO *DAO) PackDebatingPeriodInMinutes() []byte { return enc } +// TryPackDebatingPeriodInMinutes is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x69bd3436. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function debatingPeriodInMinutes() returns(uint256) +func (dAO *DAO) TryPackDebatingPeriodInMinutes() ([]byte, error) { + return dAO.abi.Pack("debatingPeriodInMinutes") +} + // UnpackDebatingPeriodInMinutes is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x69bd3436. // @@ -134,11 +174,12 @@ func (dAO *DAO) UnpackDebatingPeriodInMinutes(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // PackExecuteProposal is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x237e9492. +// 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 { @@ -149,6 +190,15 @@ func (dAO *DAO) PackExecuteProposal(proposalNumber *big.Int, transactionBytecode return enc } +// TryPackExecuteProposal is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x237e9492. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function executeProposal(uint256 proposalNumber, bytes transactionBytecode) returns(int256 result) +func (dAO *DAO) TryPackExecuteProposal(proposalNumber *big.Int, transactionBytecode []byte) ([]byte, error) { + return dAO.abi.Pack("executeProposal", proposalNumber, transactionBytecode) +} + // UnpackExecuteProposal is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x237e9492. // @@ -159,11 +209,12 @@ func (dAO *DAO) UnpackExecuteProposal(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // PackMajorityMargin is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xaa02a90f. +// 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 { @@ -174,6 +225,15 @@ func (dAO *DAO) PackMajorityMargin() []byte { return enc } +// TryPackMajorityMargin is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xaa02a90f. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function majorityMargin() returns(int256) +func (dAO *DAO) TryPackMajorityMargin() ([]byte, error) { + return dAO.abi.Pack("majorityMargin") +} + // UnpackMajorityMargin is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xaa02a90f. // @@ -184,11 +244,12 @@ func (dAO *DAO) UnpackMajorityMargin(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // PackMemberId is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x39106821. +// 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 { @@ -199,6 +260,15 @@ func (dAO *DAO) PackMemberId(arg0 common.Address) []byte { return enc } +// TryPackMemberId is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x39106821. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function memberId(address ) returns(uint256) +func (dAO *DAO) TryPackMemberId(arg0 common.Address) ([]byte, error) { + return dAO.abi.Pack("memberId", arg0) +} + // UnpackMemberId is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x39106821. // @@ -209,11 +279,12 @@ func (dAO *DAO) UnpackMemberId(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // PackMembers is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x5daf08ca. +// 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 { @@ -224,6 +295,15 @@ func (dAO *DAO) PackMembers(arg0 *big.Int) []byte { return enc } +// TryPackMembers is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x5daf08ca. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function members(uint256 ) returns(address member, bool canVote, string name, uint256 memberSince) +func (dAO *DAO) TryPackMembers(arg0 *big.Int) ([]byte, error) { + return dAO.abi.Pack("members", arg0) +} + // MembersOutput serves as a container for the return parameters of contract // method Members. type MembersOutput struct { @@ -247,12 +327,12 @@ func (dAO *DAO) UnpackMembers(data []byte) (MembersOutput, error) { outstruct.CanVote = *abi.ConvertType(out[1], new(bool)).(*bool) outstruct.Name = *abi.ConvertType(out[2], new(string)).(*string) outstruct.MemberSince = abi.ConvertType(out[3], new(big.Int)).(*big.Int) - return *outstruct, err - + return *outstruct, nil } // PackMinimumQuorum is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x8160f0b5. +// 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 { @@ -263,6 +343,15 @@ func (dAO *DAO) PackMinimumQuorum() []byte { return enc } +// TryPackMinimumQuorum is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x8160f0b5. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function minimumQuorum() returns(uint256) +func (dAO *DAO) TryPackMinimumQuorum() ([]byte, error) { + return dAO.abi.Pack("minimumQuorum") +} + // UnpackMinimumQuorum is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x8160f0b5. // @@ -273,11 +362,12 @@ func (dAO *DAO) UnpackMinimumQuorum(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // PackNewProposal is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xb1050da5. +// 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 { @@ -288,6 +378,15 @@ func (dAO *DAO) PackNewProposal(beneficiary common.Address, etherAmount *big.Int return enc } +// TryPackNewProposal is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xb1050da5. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function newProposal(address beneficiary, uint256 etherAmount, string JobDescription, bytes transactionBytecode) returns(uint256 proposalID) +func (dAO *DAO) TryPackNewProposal(beneficiary common.Address, etherAmount *big.Int, jobDescription string, transactionBytecode []byte) ([]byte, error) { + return dAO.abi.Pack("newProposal", beneficiary, etherAmount, jobDescription, transactionBytecode) +} + // UnpackNewProposal is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xb1050da5. // @@ -298,11 +397,12 @@ func (dAO *DAO) UnpackNewProposal(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // PackNumProposals is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x400e3949. +// 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 { @@ -313,6 +413,15 @@ func (dAO *DAO) PackNumProposals() []byte { return enc } +// TryPackNumProposals is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x400e3949. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function numProposals() returns(uint256) +func (dAO *DAO) TryPackNumProposals() ([]byte, error) { + return dAO.abi.Pack("numProposals") +} + // UnpackNumProposals is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x400e3949. // @@ -323,11 +432,12 @@ func (dAO *DAO) UnpackNumProposals(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // PackOwner is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x8da5cb5b. +// 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 { @@ -338,6 +448,15 @@ func (dAO *DAO) PackOwner() []byte { return enc } +// TryPackOwner is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x8da5cb5b. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function owner() returns(address) +func (dAO *DAO) TryPackOwner() ([]byte, error) { + return dAO.abi.Pack("owner") +} + // UnpackOwner is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x8da5cb5b. // @@ -348,11 +467,12 @@ func (dAO *DAO) UnpackOwner(data []byte) (common.Address, error) { return *new(common.Address), err } out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - return out0, err + return out0, nil } // PackProposals is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x013cf08b. +// 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 { @@ -363,6 +483,15 @@ func (dAO *DAO) PackProposals(arg0 *big.Int) []byte { return enc } +// TryPackProposals is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x013cf08b. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function proposals(uint256 ) returns(address recipient, uint256 amount, string description, uint256 votingDeadline, bool executed, bool proposalPassed, uint256 numberOfVotes, int256 currentResult, bytes32 proposalHash) +func (dAO *DAO) TryPackProposals(arg0 *big.Int) ([]byte, error) { + return dAO.abi.Pack("proposals", arg0) +} + // ProposalsOutput serves as a container for the return parameters of contract // method Proposals. type ProposalsOutput struct { @@ -396,12 +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, err - + return *outstruct, nil } // PackTransferOwnership is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xf2fde38b. +// 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 { @@ -412,8 +541,18 @@ func (dAO *DAO) PackTransferOwnership(newOwner common.Address) []byte { return enc } +// TryPackTransferOwnership is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xf2fde38b. This method will return an error +// if any inputs are invalid/nil. +// +// 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 -// the contract method with ID 0xd3c0715b. +// 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 { @@ -424,6 +563,15 @@ func (dAO *DAO) PackVote(proposalNumber *big.Int, supportsProposal bool, justifi return enc } +// TryPackVote is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xd3c0715b. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function vote(uint256 proposalNumber, bool supportsProposal, string justificationText) returns(uint256 voteID) +func (dAO *DAO) TryPackVote(proposalNumber *big.Int, supportsProposal bool, justificationText string) ([]byte, error) { + return dAO.abi.Pack("vote", proposalNumber, supportsProposal, justificationText) +} + // UnpackVote is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xd3c0715b. // @@ -434,7 +582,7 @@ func (dAO *DAO) UnpackVote(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // DAOChangeOfRules represents a ChangeOfRules event raised by the DAO contract. diff --git a/accounts/abi/abigen/testdata/v2/deeplynestedarray.go.txt b/accounts/abi/abigen/testdata/v2/deeplynestedarray.go.txt index 00f717d020ce..302f1d736fcc 100644 --- a/accounts/abi/abigen/testdata/v2/deeplynestedarray.go.txt +++ b/accounts/abi/abigen/testdata/v2/deeplynestedarray.go.txt @@ -52,7 +52,8 @@ func (c *DeeplyNestedArray) Instance(backend bind.ContractBackend, addr common.A } // PackDeepUint64Array is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x98ed1856. +// 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,6 +64,15 @@ func (deeplyNestedArray *DeeplyNestedArray) PackDeepUint64Array(arg0 *big.Int, a return enc } +// TryPackDeepUint64Array is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x98ed1856. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function deepUint64Array(uint256 , uint256 , uint256 ) view returns(uint64) +func (deeplyNestedArray *DeeplyNestedArray) TryPackDeepUint64Array(arg0 *big.Int, arg1 *big.Int, arg2 *big.Int) ([]byte, error) { + return deeplyNestedArray.abi.Pack("deepUint64Array", arg0, arg1, arg2) +} + // UnpackDeepUint64Array is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x98ed1856. // @@ -73,11 +83,12 @@ func (deeplyNestedArray *DeeplyNestedArray) UnpackDeepUint64Array(data []byte) ( return *new(uint64), err } out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) - return out0, err + return out0, nil } // PackRetrieveDeepArray is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x8ed4573a. +// 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 { @@ -88,6 +99,15 @@ func (deeplyNestedArray *DeeplyNestedArray) PackRetrieveDeepArray() []byte { return enc } +// TryPackRetrieveDeepArray is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x8ed4573a. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function retrieveDeepArray() view returns(uint64[3][4][5]) +func (deeplyNestedArray *DeeplyNestedArray) TryPackRetrieveDeepArray() ([]byte, error) { + return deeplyNestedArray.abi.Pack("retrieveDeepArray") +} + // UnpackRetrieveDeepArray is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x8ed4573a. // @@ -98,11 +118,12 @@ func (deeplyNestedArray *DeeplyNestedArray) UnpackRetrieveDeepArray(data []byte) return *new([5][4][3]uint64), err } out0 := *abi.ConvertType(out[0], new([5][4][3]uint64)).(*[5][4][3]uint64) - return out0, err + return out0, nil } // PackStoreDeepUintArray is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x34424855. +// 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 { @@ -112,3 +133,12 @@ func (deeplyNestedArray *DeeplyNestedArray) PackStoreDeepUintArray(arr [5][4][3] } return enc } + +// TryPackStoreDeepUintArray is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x34424855. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function storeDeepUintArray(uint64[3][4][5] arr) returns() +func (deeplyNestedArray *DeeplyNestedArray) TryPackStoreDeepUintArray(arr [5][4][3]uint64) ([]byte, error) { + return deeplyNestedArray.abi.Pack("storeDeepUintArray", arr) +} diff --git a/accounts/abi/abigen/testdata/v2/getter.go.txt b/accounts/abi/abigen/testdata/v2/getter.go.txt index 8e6e7debbfae..69a4fb54c822 100644 --- a/accounts/abi/abigen/testdata/v2/getter.go.txt +++ b/accounts/abi/abigen/testdata/v2/getter.go.txt @@ -52,7 +52,8 @@ func (c *Getter) Instance(backend bind.ContractBackend, addr common.Address) *bi } // PackGetter is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x993a04b7. +// 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,6 +64,15 @@ func (getter *Getter) PackGetter() []byte { return enc } +// TryPackGetter is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x993a04b7. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function getter() returns(string, int256, bytes32) +func (getter *Getter) TryPackGetter() ([]byte, error) { + return getter.abi.Pack("getter") +} + // GetterOutput serves as a container for the return parameters of contract // method Getter. type GetterOutput struct { @@ -84,6 +94,5 @@ func (getter *Getter) UnpackGetter(data []byte) (GetterOutput, error) { outstruct.Arg0 = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Arg2 = *abi.ConvertType(out[2], new([32]byte)).(*[32]byte) - return *outstruct, err - + return *outstruct, nil } diff --git a/accounts/abi/abigen/testdata/v2/identifiercollision.go.txt b/accounts/abi/abigen/testdata/v2/identifiercollision.go.txt index 60554aac132d..e7301521f4d0 100644 --- a/accounts/abi/abigen/testdata/v2/identifiercollision.go.txt +++ b/accounts/abi/abigen/testdata/v2/identifiercollision.go.txt @@ -52,7 +52,8 @@ func (c *IdentifierCollision) Instance(backend bind.ContractBackend, addr common } // PackMyVar is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x4ef1f0ad. +// 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,6 +64,15 @@ func (identifierCollision *IdentifierCollision) PackMyVar() []byte { return enc } +// TryPackMyVar is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x4ef1f0ad. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function MyVar() view returns(uint256) +func (identifierCollision *IdentifierCollision) TryPackMyVar() ([]byte, error) { + return identifierCollision.abi.Pack("MyVar") +} + // UnpackMyVar is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x4ef1f0ad. // @@ -73,11 +83,12 @@ func (identifierCollision *IdentifierCollision) UnpackMyVar(data []byte) (*big.I return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // PackPubVar is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x01ad4d87. +// 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 { @@ -88,6 +99,15 @@ func (identifierCollision *IdentifierCollision) PackPubVar() []byte { return enc } +// TryPackPubVar is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x01ad4d87. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function _myVar() view returns(uint256) +func (identifierCollision *IdentifierCollision) TryPackPubVar() ([]byte, error) { + return identifierCollision.abi.Pack("_myVar") +} + // UnpackPubVar is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x01ad4d87. // @@ -98,5 +118,5 @@ func (identifierCollision *IdentifierCollision) UnpackPubVar(data []byte) (*big. return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } diff --git a/accounts/abi/abigen/testdata/v2/inputchecker.go.txt b/accounts/abi/abigen/testdata/v2/inputchecker.go.txt index 7b226aa90bd8..1743f336db0c 100644 --- a/accounts/abi/abigen/testdata/v2/inputchecker.go.txt +++ b/accounts/abi/abigen/testdata/v2/inputchecker.go.txt @@ -51,7 +51,8 @@ func (c *InputChecker) Instance(backend bind.ContractBackend, addr common.Addres } // PackAnonInput is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x3e708e82. +// 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,8 +63,18 @@ func (inputChecker *InputChecker) PackAnonInput(arg0 string) []byte { return enc } +// TryPackAnonInput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x3e708e82. This method will return an error +// if any inputs are invalid/nil. +// +// 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 -// the contract method with ID 0x28160527. +// 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 { @@ -74,8 +85,18 @@ func (inputChecker *InputChecker) PackAnonInputs(arg0 string, arg1 string) []byt return enc } +// TryPackAnonInputs is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x28160527. This method will return an error +// if any inputs are invalid/nil. +// +// 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 -// the contract method with ID 0xc689ebdc. +// 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 { @@ -86,8 +107,18 @@ func (inputChecker *InputChecker) PackMixedInputs(arg0 string, str string) []byt return enc } +// TryPackMixedInputs is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xc689ebdc. This method will return an error +// if any inputs are invalid/nil. +// +// 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 -// the contract method with ID 0x0d402005. +// 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 { @@ -98,8 +129,18 @@ func (inputChecker *InputChecker) PackNamedInput(str string) []byte { return enc } +// TryPackNamedInput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x0d402005. This method will return an error +// if any inputs are invalid/nil. +// +// 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 -// the contract method with ID 0x63c796ed. +// 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 { @@ -110,8 +151,18 @@ func (inputChecker *InputChecker) PackNamedInputs(str1 string, str2 string) []by return enc } +// TryPackNamedInputs is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x63c796ed. This method will return an error +// if any inputs are invalid/nil. +// +// 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 -// the contract method with ID 0x53539029. +// 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 { @@ -121,3 +172,12 @@ func (inputChecker *InputChecker) PackNoInput() []byte { } return enc } + +// TryPackNoInput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x53539029. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function noInput() returns() +func (inputChecker *InputChecker) TryPackNoInput() ([]byte, error) { + return inputChecker.abi.Pack("noInput") +} diff --git a/accounts/abi/abigen/testdata/v2/interactor.go.txt b/accounts/abi/abigen/testdata/v2/interactor.go.txt index cc0900856ec8..f33c95b63926 100644 --- a/accounts/abi/abigen/testdata/v2/interactor.go.txt +++ b/accounts/abi/abigen/testdata/v2/interactor.go.txt @@ -64,7 +64,8 @@ func (interactor *Interactor) PackConstructor(str string) []byte { } // PackDeployString is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x6874e809. +// 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,6 +76,15 @@ func (interactor *Interactor) PackDeployString() []byte { return enc } +// TryPackDeployString is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x6874e809. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function deployString() returns(string) +func (interactor *Interactor) TryPackDeployString() ([]byte, error) { + return interactor.abi.Pack("deployString") +} + // UnpackDeployString is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x6874e809. // @@ -85,11 +95,12 @@ func (interactor *Interactor) UnpackDeployString(data []byte) (string, error) { return *new(string), err } out0 := *abi.ConvertType(out[0], new(string)).(*string) - return out0, err + return out0, nil } // PackTransact is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xd736c513. +// 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 { @@ -100,8 +111,18 @@ func (interactor *Interactor) PackTransact(str string) []byte { return enc } +// TryPackTransact is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xd736c513. This method will return an error +// if any inputs are invalid/nil. +// +// 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 -// the contract method with ID 0x0d86a0e1. +// 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 { @@ -112,6 +133,15 @@ func (interactor *Interactor) PackTransactString() []byte { return enc } +// TryPackTransactString is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x0d86a0e1. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function transactString() returns(string) +func (interactor *Interactor) TryPackTransactString() ([]byte, error) { + return interactor.abi.Pack("transactString") +} + // UnpackTransactString is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x0d86a0e1. // @@ -122,5 +152,5 @@ func (interactor *Interactor) UnpackTransactString(data []byte) (string, error) return *new(string), err } out0 := *abi.ConvertType(out[0], new(string)).(*string) - return out0, err + return out0, nil } diff --git a/accounts/abi/abigen/testdata/v2/nameconflict.go.txt b/accounts/abi/abigen/testdata/v2/nameconflict.go.txt index 6228bf7cc73c..fbc61a5c6c93 100644 --- a/accounts/abi/abigen/testdata/v2/nameconflict.go.txt +++ b/accounts/abi/abigen/testdata/v2/nameconflict.go.txt @@ -58,7 +58,8 @@ func (c *NameConflict) Instance(backend bind.ContractBackend, addr common.Addres } // PackAddRequest is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xcce7b048. +// 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,8 +70,18 @@ func (nameConflict *NameConflict) PackAddRequest(req Oraclerequest) []byte { return enc } +// TryPackAddRequest is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xcce7b048. This method will return an error +// if any inputs are invalid/nil. +// +// 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 -// the contract method with ID 0xc2bb515f. +// 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 { @@ -81,6 +92,15 @@ func (nameConflict *NameConflict) PackGetRequest() []byte { return enc } +// TryPackGetRequest is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xc2bb515f. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function getRequest() pure returns((bytes,bytes)) +func (nameConflict *NameConflict) TryPackGetRequest() ([]byte, error) { + return nameConflict.abi.Pack("getRequest") +} + // UnpackGetRequest is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xc2bb515f. // @@ -91,7 +111,7 @@ func (nameConflict *NameConflict) UnpackGetRequest(data []byte) (Oraclerequest, return *new(Oraclerequest), err } out0 := *abi.ConvertType(out[0], new(Oraclerequest)).(*Oraclerequest) - return out0, err + return out0, nil } // NameConflictLog represents a log event raised by the NameConflict contract. diff --git a/accounts/abi/abigen/testdata/v2/numericmethodname.go.txt b/accounts/abi/abigen/testdata/v2/numericmethodname.go.txt index 5a2208e0d42e..9d698a2657fc 100644 --- a/accounts/abi/abigen/testdata/v2/numericmethodname.go.txt +++ b/accounts/abi/abigen/testdata/v2/numericmethodname.go.txt @@ -52,7 +52,8 @@ func (c *NumericMethodName) Instance(backend bind.ContractBackend, addr common.A } // PackE1test is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xffa02795. +// 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,8 +64,18 @@ func (numericMethodName *NumericMethodName) PackE1test() []byte { return enc } +// TryPackE1test is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xffa02795. This method will return an error +// if any inputs are invalid/nil. +// +// 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 -// the contract method with ID 0xd02767c7. +// 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 { @@ -75,8 +86,18 @@ func (numericMethodName *NumericMethodName) PackE1test0() []byte { return enc } +// TryPackE1test0 is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xd02767c7. This method will return an error +// if any inputs are invalid/nil. +// +// 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 -// the contract method with ID 0x9d993132. +// 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 { @@ -87,6 +108,15 @@ func (numericMethodName *NumericMethodName) PackE2test() []byte { return enc } +// TryPackE2test is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x9d993132. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function __2test() pure returns() +func (numericMethodName *NumericMethodName) TryPackE2test() ([]byte, error) { + return numericMethodName.abi.Pack("__2test") +} + // NumericMethodNameE1TestEvent represents a _1TestEvent event raised by the NumericMethodName contract. type NumericMethodNameE1TestEvent struct { Param common.Address diff --git a/accounts/abi/abigen/testdata/v2/outputchecker.go.txt b/accounts/abi/abigen/testdata/v2/outputchecker.go.txt index 6f1f8e67957b..f1c98f536e80 100644 --- a/accounts/abi/abigen/testdata/v2/outputchecker.go.txt +++ b/accounts/abi/abigen/testdata/v2/outputchecker.go.txt @@ -51,7 +51,8 @@ func (c *OutputChecker) Instance(backend bind.ContractBackend, addr common.Addre } // PackAnonOutput is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x008bda05. +// 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,6 +63,15 @@ func (outputChecker *OutputChecker) PackAnonOutput() []byte { return enc } +// TryPackAnonOutput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x008bda05. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function anonOutput() returns(string) +func (outputChecker *OutputChecker) TryPackAnonOutput() ([]byte, error) { + return outputChecker.abi.Pack("anonOutput") +} + // UnpackAnonOutput is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x008bda05. // @@ -72,11 +82,12 @@ func (outputChecker *OutputChecker) UnpackAnonOutput(data []byte) (string, error return *new(string), err } out0 := *abi.ConvertType(out[0], new(string)).(*string) - return out0, err + return out0, nil } // PackAnonOutputs is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x3c401115. +// 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 { @@ -87,6 +98,15 @@ func (outputChecker *OutputChecker) PackAnonOutputs() []byte { return enc } +// TryPackAnonOutputs is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x3c401115. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function anonOutputs() returns(string, string) +func (outputChecker *OutputChecker) TryPackAnonOutputs() ([]byte, error) { + return outputChecker.abi.Pack("anonOutputs") +} + // AnonOutputsOutput serves as a container for the return parameters of contract // method AnonOutputs. type AnonOutputsOutput struct { @@ -106,12 +126,12 @@ func (outputChecker *OutputChecker) UnpackAnonOutputs(data []byte) (AnonOutputsO } outstruct.Arg0 = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Arg1 = *abi.ConvertType(out[1], new(string)).(*string) - return *outstruct, err - + return *outstruct, nil } // PackCollidingOutputs is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xeccbc1ee. +// 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 { @@ -122,6 +142,15 @@ func (outputChecker *OutputChecker) PackCollidingOutputs() []byte { return enc } +// TryPackCollidingOutputs is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xeccbc1ee. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function collidingOutputs() returns(string str, string Str) +func (outputChecker *OutputChecker) TryPackCollidingOutputs() ([]byte, error) { + return outputChecker.abi.Pack("collidingOutputs") +} + // CollidingOutputsOutput serves as a container for the return parameters of contract // method CollidingOutputs. type CollidingOutputsOutput struct { @@ -141,12 +170,12 @@ func (outputChecker *OutputChecker) UnpackCollidingOutputs(data []byte) (Collidi } outstruct.Str = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Str0 = *abi.ConvertType(out[1], new(string)).(*string) - return *outstruct, err - + return *outstruct, nil } // PackMixedOutputs is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x21b77b44. +// 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 { @@ -157,6 +186,15 @@ func (outputChecker *OutputChecker) PackMixedOutputs() []byte { return enc } +// TryPackMixedOutputs is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x21b77b44. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function mixedOutputs() returns(string, string str) +func (outputChecker *OutputChecker) TryPackMixedOutputs() ([]byte, error) { + return outputChecker.abi.Pack("mixedOutputs") +} + // MixedOutputsOutput serves as a container for the return parameters of contract // method MixedOutputs. type MixedOutputsOutput struct { @@ -176,12 +214,12 @@ func (outputChecker *OutputChecker) UnpackMixedOutputs(data []byte) (MixedOutput } outstruct.Arg0 = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Str = *abi.ConvertType(out[1], new(string)).(*string) - return *outstruct, err - + return *outstruct, nil } // PackNamedOutput is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x5e632bd5. +// 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 { @@ -192,6 +230,15 @@ func (outputChecker *OutputChecker) PackNamedOutput() []byte { return enc } +// TryPackNamedOutput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x5e632bd5. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function namedOutput() returns(string str) +func (outputChecker *OutputChecker) TryPackNamedOutput() ([]byte, error) { + return outputChecker.abi.Pack("namedOutput") +} + // UnpackNamedOutput is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x5e632bd5. // @@ -202,11 +249,12 @@ func (outputChecker *OutputChecker) UnpackNamedOutput(data []byte) (string, erro return *new(string), err } out0 := *abi.ConvertType(out[0], new(string)).(*string) - return out0, err + return out0, nil } // PackNamedOutputs is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x7970a189. +// 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 { @@ -217,6 +265,15 @@ func (outputChecker *OutputChecker) PackNamedOutputs() []byte { return enc } +// TryPackNamedOutputs is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x7970a189. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function namedOutputs() returns(string str1, string str2) +func (outputChecker *OutputChecker) TryPackNamedOutputs() ([]byte, error) { + return outputChecker.abi.Pack("namedOutputs") +} + // NamedOutputsOutput serves as a container for the return parameters of contract // method NamedOutputs. type NamedOutputsOutput struct { @@ -236,12 +293,12 @@ func (outputChecker *OutputChecker) UnpackNamedOutputs(data []byte) (NamedOutput } outstruct.Str1 = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Str2 = *abi.ConvertType(out[1], new(string)).(*string) - return *outstruct, err - + return *outstruct, nil } // PackNoOutput is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x625f0306. +// 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 { @@ -251,3 +308,12 @@ func (outputChecker *OutputChecker) PackNoOutput() []byte { } return enc } + +// TryPackNoOutput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x625f0306. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function noOutput() returns() +func (outputChecker *OutputChecker) TryPackNoOutput() ([]byte, error) { + return outputChecker.abi.Pack("noOutput") +} diff --git a/accounts/abi/abigen/testdata/v2/overload.go.txt b/accounts/abi/abigen/testdata/v2/overload.go.txt index ed7c0b543ce2..3b9a95a125b3 100644 --- a/accounts/abi/abigen/testdata/v2/overload.go.txt +++ b/accounts/abi/abigen/testdata/v2/overload.go.txt @@ -52,7 +52,8 @@ func (c *Overload) Instance(backend bind.ContractBackend, addr common.Address) * } // PackFoo is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x04bc52f8. +// 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,8 +64,18 @@ func (overload *Overload) PackFoo(i *big.Int, j *big.Int) []byte { return enc } +// TryPackFoo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x04bc52f8. This method will return an error +// if any inputs are invalid/nil. +// +// 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 -// the contract method with ID 0x2fbebd38. +// 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 { @@ -75,6 +86,15 @@ func (overload *Overload) PackFoo0(i *big.Int) []byte { return enc } +// TryPackFoo0 is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2fbebd38. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function foo(uint256 i) returns() +func (overload *Overload) TryPackFoo0(i *big.Int) ([]byte, error) { + return overload.abi.Pack("foo0", i) +} + // OverloadBar represents a bar event raised by the Overload contract. type OverloadBar struct { I *big.Int diff --git a/accounts/abi/abigen/testdata/v2/rangekeyword.go.txt b/accounts/abi/abigen/testdata/v2/rangekeyword.go.txt index c7f142539589..296de1fccc71 100644 --- a/accounts/abi/abigen/testdata/v2/rangekeyword.go.txt +++ b/accounts/abi/abigen/testdata/v2/rangekeyword.go.txt @@ -52,7 +52,8 @@ func (c *RangeKeyword) Instance(backend bind.ContractBackend, addr common.Addres } // PackFunctionWithKeywordParameter is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x527a119f. +// 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 { @@ -62,3 +63,12 @@ func (rangeKeyword *RangeKeyword) PackFunctionWithKeywordParameter(arg0 *big.Int } return enc } + +// TryPackFunctionWithKeywordParameter is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x527a119f. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function functionWithKeywordParameter(uint256 range) pure returns() +func (rangeKeyword *RangeKeyword) TryPackFunctionWithKeywordParameter(arg0 *big.Int) ([]byte, error) { + return rangeKeyword.abi.Pack("functionWithKeywordParameter", arg0) +} diff --git a/accounts/abi/abigen/testdata/v2/slicer.go.txt b/accounts/abi/abigen/testdata/v2/slicer.go.txt index b66c05cf0ff3..379f136453e0 100644 --- a/accounts/abi/abigen/testdata/v2/slicer.go.txt +++ b/accounts/abi/abigen/testdata/v2/slicer.go.txt @@ -52,7 +52,8 @@ func (c *Slicer) Instance(backend bind.ContractBackend, addr common.Address) *bi } // PackEchoAddresses is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xbe1127a3. +// 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,6 +64,15 @@ func (slicer *Slicer) PackEchoAddresses(input []common.Address) []byte { return enc } +// TryPackEchoAddresses is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xbe1127a3. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function echoAddresses(address[] input) returns(address[] output) +func (slicer *Slicer) TryPackEchoAddresses(input []common.Address) ([]byte, error) { + return slicer.abi.Pack("echoAddresses", input) +} + // UnpackEchoAddresses is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xbe1127a3. // @@ -73,11 +83,12 @@ func (slicer *Slicer) UnpackEchoAddresses(data []byte) ([]common.Address, error) return *new([]common.Address), err } out0 := *abi.ConvertType(out[0], new([]common.Address)).(*[]common.Address) - return out0, err + return out0, nil } // PackEchoBools is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xf637e589. +// 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 { @@ -88,6 +99,15 @@ func (slicer *Slicer) PackEchoBools(input []bool) []byte { return enc } +// TryPackEchoBools is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xf637e589. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function echoBools(bool[] input) returns(bool[] output) +func (slicer *Slicer) TryPackEchoBools(input []bool) ([]byte, error) { + return slicer.abi.Pack("echoBools", input) +} + // UnpackEchoBools is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xf637e589. // @@ -98,11 +118,12 @@ func (slicer *Slicer) UnpackEchoBools(data []byte) ([]bool, error) { return *new([]bool), err } out0 := *abi.ConvertType(out[0], new([]bool)).(*[]bool) - return out0, err + return out0, nil } // PackEchoFancyInts is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xd88becc0. +// 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 { @@ -113,6 +134,15 @@ func (slicer *Slicer) PackEchoFancyInts(input [23]*big.Int) []byte { return enc } +// TryPackEchoFancyInts is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xd88becc0. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function echoFancyInts(uint24[23] input) returns(uint24[23] output) +func (slicer *Slicer) TryPackEchoFancyInts(input [23]*big.Int) ([]byte, error) { + return slicer.abi.Pack("echoFancyInts", input) +} + // UnpackEchoFancyInts is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xd88becc0. // @@ -123,11 +153,12 @@ func (slicer *Slicer) UnpackEchoFancyInts(data []byte) ([23]*big.Int, error) { return *new([23]*big.Int), err } out0 := *abi.ConvertType(out[0], new([23]*big.Int)).(*[23]*big.Int) - return out0, err + return out0, nil } // PackEchoInts is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xe15a3db7. +// 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 { @@ -138,6 +169,15 @@ func (slicer *Slicer) PackEchoInts(input []*big.Int) []byte { return enc } +// TryPackEchoInts is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xe15a3db7. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function echoInts(int256[] input) returns(int256[] output) +func (slicer *Slicer) TryPackEchoInts(input []*big.Int) ([]byte, error) { + return slicer.abi.Pack("echoInts", input) +} + // UnpackEchoInts is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xe15a3db7. // @@ -148,5 +188,5 @@ func (slicer *Slicer) UnpackEchoInts(data []byte) ([]*big.Int, error) { return *new([]*big.Int), err } out0 := *abi.ConvertType(out[0], new([]*big.Int)).(*[]*big.Int) - return out0, err + return out0, nil } diff --git a/accounts/abi/abigen/testdata/v2/structs.go.txt b/accounts/abi/abigen/testdata/v2/structs.go.txt index 7fe59c5616c3..4d8864cf6ea3 100644 --- a/accounts/abi/abigen/testdata/v2/structs.go.txt +++ b/accounts/abi/abigen/testdata/v2/structs.go.txt @@ -57,7 +57,8 @@ func (c *Structs) Instance(backend bind.ContractBackend, addr common.Address) *b } // PackF is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x28811f59. +// 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,6 +69,15 @@ func (structs *Structs) PackF() []byte { return enc } +// TryPackF is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x28811f59. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function F() view returns((bytes32)[] a, uint256[] c, bool[] d) +func (structs *Structs) TryPackF() ([]byte, error) { + return structs.abi.Pack("F") +} + // FOutput serves as a container for the return parameters of contract // method F. type FOutput struct { @@ -89,12 +99,12 @@ func (structs *Structs) UnpackF(data []byte) (FOutput, error) { outstruct.A = *abi.ConvertType(out[0], new([]Struct0)).(*[]Struct0) outstruct.C = *abi.ConvertType(out[1], new([]*big.Int)).(*[]*big.Int) outstruct.D = *abi.ConvertType(out[2], new([]bool)).(*[]bool) - return *outstruct, err - + return *outstruct, nil } // PackG is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x6fecb623. +// 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 { @@ -105,6 +115,15 @@ func (structs *Structs) PackG() []byte { return enc } +// TryPackG is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x6fecb623. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function G() view returns((bytes32)[] a) +func (structs *Structs) TryPackG() ([]byte, error) { + return structs.abi.Pack("G") +} + // UnpackG is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x6fecb623. // @@ -115,5 +134,5 @@ func (structs *Structs) UnpackG(data []byte) ([]Struct0, error) { return *new([]Struct0), err } out0 := *abi.ConvertType(out[0], new([]Struct0)).(*[]Struct0) - return out0, err + return out0, nil } diff --git a/accounts/abi/abigen/testdata/v2/token.go.txt b/accounts/abi/abigen/testdata/v2/token.go.txt index aca18cb227cf..69294f375a15 100644 --- a/accounts/abi/abigen/testdata/v2/token.go.txt +++ b/accounts/abi/abigen/testdata/v2/token.go.txt @@ -64,7 +64,8 @@ func (token *Token) PackConstructor(initialSupply *big.Int, tokenName string, de } // PackAllowance is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xdd62ed3e. +// 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,6 +76,15 @@ func (token *Token) PackAllowance(arg0 common.Address, arg1 common.Address) []by return enc } +// TryPackAllowance is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xdd62ed3e. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function allowance(address , address ) returns(uint256) +func (token *Token) TryPackAllowance(arg0 common.Address, arg1 common.Address) ([]byte, error) { + return token.abi.Pack("allowance", arg0, arg1) +} + // UnpackAllowance is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xdd62ed3e. // @@ -85,11 +95,12 @@ func (token *Token) UnpackAllowance(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // PackApproveAndCall is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xcae9ca51. +// 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 { @@ -100,6 +111,15 @@ func (token *Token) PackApproveAndCall(spender common.Address, value *big.Int, e return enc } +// TryPackApproveAndCall is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xcae9ca51. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns(bool success) +func (token *Token) TryPackApproveAndCall(spender common.Address, value *big.Int, extraData []byte) ([]byte, error) { + return token.abi.Pack("approveAndCall", spender, value, extraData) +} + // UnpackApproveAndCall is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xcae9ca51. // @@ -110,11 +130,12 @@ func (token *Token) UnpackApproveAndCall(data []byte) (bool, error) { return *new(bool), err } out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - return out0, err + return out0, nil } // PackBalanceOf is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x70a08231. +// 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 { @@ -125,6 +146,15 @@ func (token *Token) PackBalanceOf(arg0 common.Address) []byte { return enc } +// TryPackBalanceOf is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x70a08231. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function balanceOf(address ) returns(uint256) +func (token *Token) TryPackBalanceOf(arg0 common.Address) ([]byte, error) { + return token.abi.Pack("balanceOf", arg0) +} + // UnpackBalanceOf is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x70a08231. // @@ -135,11 +165,12 @@ func (token *Token) UnpackBalanceOf(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // PackDecimals is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x313ce567. +// 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 { @@ -150,6 +181,15 @@ func (token *Token) PackDecimals() []byte { return enc } +// TryPackDecimals is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x313ce567. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function decimals() returns(uint8) +func (token *Token) TryPackDecimals() ([]byte, error) { + return token.abi.Pack("decimals") +} + // UnpackDecimals is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x313ce567. // @@ -160,11 +200,12 @@ func (token *Token) UnpackDecimals(data []byte) (uint8, error) { return *new(uint8), err } out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) - return out0, err + return out0, nil } // PackName is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x06fdde03. +// 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 { @@ -175,6 +216,15 @@ func (token *Token) PackName() []byte { return enc } +// TryPackName is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x06fdde03. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function name() returns(string) +func (token *Token) TryPackName() ([]byte, error) { + return token.abi.Pack("name") +} + // UnpackName is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x06fdde03. // @@ -185,11 +235,12 @@ func (token *Token) UnpackName(data []byte) (string, error) { return *new(string), err } out0 := *abi.ConvertType(out[0], new(string)).(*string) - return out0, err + return out0, nil } // PackSpentAllowance is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xdc3080f2. +// 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 { @@ -200,6 +251,15 @@ func (token *Token) PackSpentAllowance(arg0 common.Address, arg1 common.Address) return enc } +// TryPackSpentAllowance is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xdc3080f2. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function spentAllowance(address , address ) returns(uint256) +func (token *Token) TryPackSpentAllowance(arg0 common.Address, arg1 common.Address) ([]byte, error) { + return token.abi.Pack("spentAllowance", arg0, arg1) +} + // UnpackSpentAllowance is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xdc3080f2. // @@ -210,11 +270,12 @@ func (token *Token) UnpackSpentAllowance(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // PackSymbol is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x95d89b41. +// 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 { @@ -225,6 +286,15 @@ func (token *Token) PackSymbol() []byte { return enc } +// TryPackSymbol is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x95d89b41. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function symbol() returns(string) +func (token *Token) TryPackSymbol() ([]byte, error) { + return token.abi.Pack("symbol") +} + // UnpackSymbol is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x95d89b41. // @@ -235,11 +305,12 @@ func (token *Token) UnpackSymbol(data []byte) (string, error) { return *new(string), err } out0 := *abi.ConvertType(out[0], new(string)).(*string) - return out0, err + return out0, nil } // PackTransfer is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xa9059cbb. +// 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 { @@ -250,8 +321,18 @@ func (token *Token) PackTransfer(to common.Address, value *big.Int) []byte { return enc } +// TryPackTransfer is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xa9059cbb. This method will return an error +// if any inputs are invalid/nil. +// +// 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 -// the contract method with ID 0x23b872dd. +// 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 { @@ -262,6 +343,15 @@ func (token *Token) PackTransferFrom(from common.Address, to common.Address, val return enc } +// TryPackTransferFrom is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x23b872dd. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function transferFrom(address _from, address _to, uint256 _value) returns(bool success) +func (token *Token) TryPackTransferFrom(from common.Address, to common.Address, value *big.Int) ([]byte, error) { + return token.abi.Pack("transferFrom", from, to, value) +} + // UnpackTransferFrom is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x23b872dd. // @@ -272,7 +362,7 @@ func (token *Token) UnpackTransferFrom(data []byte) (bool, error) { return *new(bool), err } out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - return out0, err + return out0, nil } // TokenTransfer represents a Transfer event raised by the Token contract. diff --git a/accounts/abi/abigen/testdata/v2/tuple.go.txt b/accounts/abi/abigen/testdata/v2/tuple.go.txt index 65af7654635f..76a1f58d52f9 100644 --- a/accounts/abi/abigen/testdata/v2/tuple.go.txt +++ b/accounts/abi/abigen/testdata/v2/tuple.go.txt @@ -77,7 +77,8 @@ func (c *Tuple) Instance(backend bind.ContractBackend, addr common.Address) *bin } // PackFunc1 is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x443c79b4. +// 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,6 +89,15 @@ func (tuple *Tuple) PackFunc1(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS return enc } +// TryPackFunc1 is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x443c79b4. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function func1((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) pure returns((uint256,uint256[],(uint256,uint256)[]), (uint256,uint256)[2][], (uint256,uint256)[][2], (uint256,uint256[],(uint256,uint256)[])[], uint256[]) +func (tuple *Tuple) TryPackFunc1(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) ([]byte, error) { + return tuple.abi.Pack("func1", a, b, c, d, e) +} + // Func1Output serves as a container for the return parameters of contract // method Func1. type Func1Output struct { @@ -113,12 +123,12 @@ func (tuple *Tuple) UnpackFunc1(data []byte) (Func1Output, error) { outstruct.Arg2 = *abi.ConvertType(out[2], new([2][]TupleT)).(*[2][]TupleT) outstruct.Arg3 = *abi.ConvertType(out[3], new([]TupleS)).(*[]TupleS) outstruct.Arg4 = *abi.ConvertType(out[4], new([]*big.Int)).(*[]*big.Int) - return *outstruct, err - + return *outstruct, nil } // PackFunc2 is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xd0062cdd. +// 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 { @@ -129,8 +139,18 @@ func (tuple *Tuple) PackFunc2(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS return enc } +// TryPackFunc2 is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xd0062cdd. This method will return an error +// if any inputs are invalid/nil. +// +// 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 -// the contract method with ID 0xe4d9a43b. +// 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 { @@ -141,6 +161,15 @@ func (tuple *Tuple) PackFunc3(arg0 []TupleQ) []byte { return enc } +// TryPackFunc3 is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xe4d9a43b. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function func3((uint16,uint16)[] ) pure returns() +func (tuple *Tuple) TryPackFunc3(arg0 []TupleQ) ([]byte, error) { + return tuple.abi.Pack("func3", arg0) +} + // TupleTupleEvent represents a TupleEvent event raised by the Tuple contract. type TupleTupleEvent struct { A TupleS diff --git a/accounts/abi/abigen/testdata/v2/tupler.go.txt b/accounts/abi/abigen/testdata/v2/tupler.go.txt index caa692dadec7..8643487042c8 100644 --- a/accounts/abi/abigen/testdata/v2/tupler.go.txt +++ b/accounts/abi/abigen/testdata/v2/tupler.go.txt @@ -52,7 +52,8 @@ func (c *Tupler) Instance(backend bind.ContractBackend, addr common.Address) *bi } // PackTuple is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x3175aae2. +// 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,6 +64,15 @@ func (tupler *Tupler) PackTuple() []byte { return enc } +// TryPackTuple is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x3175aae2. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function tuple() returns(string a, int256 b, bytes32 c) +func (tupler *Tupler) TryPackTuple() ([]byte, error) { + return tupler.abi.Pack("tuple") +} + // TupleOutput serves as a container for the return parameters of contract // method Tuple. type TupleOutput struct { @@ -84,6 +94,5 @@ func (tupler *Tupler) UnpackTuple(data []byte) (TupleOutput, error) { outstruct.A = *abi.ConvertType(out[0], new(string)).(*string) outstruct.B = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.C = *abi.ConvertType(out[2], new([32]byte)).(*[32]byte) - return *outstruct, err - + return *outstruct, nil } diff --git a/accounts/abi/abigen/testdata/v2/underscorer.go.txt b/accounts/abi/abigen/testdata/v2/underscorer.go.txt index ef9eb864fa49..13ec9685086a 100644 --- a/accounts/abi/abigen/testdata/v2/underscorer.go.txt +++ b/accounts/abi/abigen/testdata/v2/underscorer.go.txt @@ -52,7 +52,8 @@ func (c *Underscorer) Instance(backend bind.ContractBackend, addr common.Address } // PackAllPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xb564b34d. +// 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,6 +64,15 @@ func (underscorer *Underscorer) PackAllPurelyUnderscoredOutput() []byte { return enc } +// TryPackAllPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xb564b34d. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function AllPurelyUnderscoredOutput() view returns(int256 _, int256 __) +func (underscorer *Underscorer) TryPackAllPurelyUnderscoredOutput() ([]byte, error) { + return underscorer.abi.Pack("AllPurelyUnderscoredOutput") +} + // AllPurelyUnderscoredOutputOutput serves as a container for the return parameters of contract // method AllPurelyUnderscoredOutput. type AllPurelyUnderscoredOutputOutput struct { @@ -82,12 +92,12 @@ func (underscorer *Underscorer) UnpackAllPurelyUnderscoredOutput(data []byte) (A } outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return *outstruct, err - + return *outstruct, nil } // PackLowerLowerCollision is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xe409ca45. +// 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 { @@ -98,6 +108,15 @@ func (underscorer *Underscorer) PackLowerLowerCollision() []byte { return enc } +// TryPackLowerLowerCollision is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xe409ca45. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function LowerLowerCollision() view returns(int256 _res, int256 res) +func (underscorer *Underscorer) TryPackLowerLowerCollision() ([]byte, error) { + return underscorer.abi.Pack("LowerLowerCollision") +} + // LowerLowerCollisionOutput serves as a container for the return parameters of contract // method LowerLowerCollision. type LowerLowerCollisionOutput struct { @@ -117,12 +136,12 @@ func (underscorer *Underscorer) UnpackLowerLowerCollision(data []byte) (LowerLow } outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return *outstruct, err - + return *outstruct, nil } // PackLowerUpperCollision is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x03a59213. +// 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 { @@ -133,6 +152,15 @@ func (underscorer *Underscorer) PackLowerUpperCollision() []byte { return enc } +// TryPackLowerUpperCollision is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x03a59213. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function LowerUpperCollision() view returns(int256 _res, int256 Res) +func (underscorer *Underscorer) TryPackLowerUpperCollision() ([]byte, error) { + return underscorer.abi.Pack("LowerUpperCollision") +} + // LowerUpperCollisionOutput serves as a container for the return parameters of contract // method LowerUpperCollision. type LowerUpperCollisionOutput struct { @@ -152,12 +180,12 @@ func (underscorer *Underscorer) UnpackLowerUpperCollision(data []byte) (LowerUpp } outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return *outstruct, err - + return *outstruct, nil } // PackPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x9df48485. +// 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 { @@ -168,6 +196,15 @@ func (underscorer *Underscorer) PackPurelyUnderscoredOutput() []byte { return enc } +// TryPackPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x9df48485. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function PurelyUnderscoredOutput() view returns(int256 _, int256 res) +func (underscorer *Underscorer) TryPackPurelyUnderscoredOutput() ([]byte, error) { + return underscorer.abi.Pack("PurelyUnderscoredOutput") +} + // PurelyUnderscoredOutputOutput serves as a container for the return parameters of contract // method PurelyUnderscoredOutput. type PurelyUnderscoredOutputOutput struct { @@ -187,12 +224,12 @@ func (underscorer *Underscorer) UnpackPurelyUnderscoredOutput(data []byte) (Pure } outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return *outstruct, err - + return *outstruct, nil } // PackUnderscoredOutput is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x67e6633d. +// 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 { @@ -203,6 +240,15 @@ func (underscorer *Underscorer) PackUnderscoredOutput() []byte { return enc } +// TryPackUnderscoredOutput is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x67e6633d. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function UnderscoredOutput() view returns(int256 _int, string _string) +func (underscorer *Underscorer) TryPackUnderscoredOutput() ([]byte, error) { + return underscorer.abi.Pack("UnderscoredOutput") +} + // UnderscoredOutputOutput serves as a container for the return parameters of contract // method UnderscoredOutput. type UnderscoredOutputOutput struct { @@ -222,12 +268,12 @@ func (underscorer *Underscorer) UnpackUnderscoredOutput(data []byte) (Underscore } outstruct.Int = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.String = *abi.ConvertType(out[1], new(string)).(*string) - return *outstruct, err - + return *outstruct, nil } // PackUpperLowerCollision is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xaf7486ab. +// 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 { @@ -238,6 +284,15 @@ func (underscorer *Underscorer) PackUpperLowerCollision() []byte { return enc } +// TryPackUpperLowerCollision is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xaf7486ab. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function UpperLowerCollision() view returns(int256 _Res, int256 res) +func (underscorer *Underscorer) TryPackUpperLowerCollision() ([]byte, error) { + return underscorer.abi.Pack("UpperLowerCollision") +} + // UpperLowerCollisionOutput serves as a container for the return parameters of contract // method UpperLowerCollision. type UpperLowerCollisionOutput struct { @@ -257,12 +312,12 @@ func (underscorer *Underscorer) UnpackUpperLowerCollision(data []byte) (UpperLow } outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return *outstruct, err - + return *outstruct, nil } // PackUpperUpperCollision is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xe02ab24d. +// 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 { @@ -273,6 +328,15 @@ func (underscorer *Underscorer) PackUpperUpperCollision() []byte { return enc } +// TryPackUpperUpperCollision is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xe02ab24d. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function UpperUpperCollision() view returns(int256 _Res, int256 Res) +func (underscorer *Underscorer) TryPackUpperUpperCollision() ([]byte, error) { + return underscorer.abi.Pack("UpperUpperCollision") +} + // UpperUpperCollisionOutput serves as a container for the return parameters of contract // method UpperUpperCollision. type UpperUpperCollisionOutput struct { @@ -292,12 +356,12 @@ func (underscorer *Underscorer) UnpackUpperUpperCollision(data []byte) (UpperUpp } outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return *outstruct, err - + return *outstruct, nil } // PackUnderScoredFunc is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x46546dbe. +// 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 { @@ -308,6 +372,15 @@ func (underscorer *Underscorer) PackUnderScoredFunc() []byte { return enc } +// TryPackUnderScoredFunc is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x46546dbe. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function _under_scored_func() view returns(int256 _int) +func (underscorer *Underscorer) TryPackUnderScoredFunc() ([]byte, error) { + return underscorer.abi.Pack("_under_scored_func") +} + // UnpackUnderScoredFunc is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x46546dbe. // @@ -318,5 +391,5 @@ func (underscorer *Underscorer) UnpackUnderScoredFunc(data []byte) (*big.Int, er return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } diff --git a/accounts/abi/bind/v2/internal/contracts/db/bindings.go b/accounts/abi/bind/v2/internal/contracts/db/bindings.go index 6291160fe966..fc00a555b5cc 100644 --- a/accounts/abi/bind/v2/internal/contracts/db/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/db/bindings.go @@ -59,7 +59,8 @@ func (c *DB) Instance(backend bind.ContractBackend, addr common.Address) *bind.B } // PackGet is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x9507d39a. +// 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,6 +71,15 @@ func (dB *DB) PackGet(k *big.Int) []byte { return enc } +// TryPackGet is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x9507d39a. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function get(uint256 k) returns(uint256) +func (dB *DB) TryPackGet(k *big.Int) ([]byte, error) { + return dB.abi.Pack("get", k) +} + // UnpackGet is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x9507d39a. // @@ -80,11 +90,12 @@ func (dB *DB) UnpackGet(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // PackGetNamedStatParams is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xe369ba3b. +// 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 { @@ -95,6 +106,15 @@ func (dB *DB) PackGetNamedStatParams() []byte { return enc } +// TryPackGetNamedStatParams is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xe369ba3b. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function getNamedStatParams() view returns(uint256 gets, uint256 inserts, uint256 mods) +func (dB *DB) TryPackGetNamedStatParams() ([]byte, error) { + return dB.abi.Pack("getNamedStatParams") +} + // GetNamedStatParamsOutput serves as a container for the return parameters of contract // method GetNamedStatParams. type GetNamedStatParamsOutput struct { @@ -116,12 +136,12 @@ func (dB *DB) UnpackGetNamedStatParams(data []byte) (GetNamedStatParamsOutput, e outstruct.Gets = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Inserts = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Mods = abi.ConvertType(out[2], new(big.Int)).(*big.Int) - return *outstruct, err - + return *outstruct, nil } // PackGetStatParams is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x6fcb9c70. +// 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 { @@ -132,6 +152,15 @@ func (dB *DB) PackGetStatParams() []byte { return enc } +// TryPackGetStatParams is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x6fcb9c70. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function getStatParams() view returns(uint256, uint256, uint256) +func (dB *DB) TryPackGetStatParams() ([]byte, error) { + return dB.abi.Pack("getStatParams") +} + // GetStatParamsOutput serves as a container for the return parameters of contract // method GetStatParams. type GetStatParamsOutput struct { @@ -153,12 +182,12 @@ func (dB *DB) UnpackGetStatParams(data []byte) (GetStatParamsOutput, error) { outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Arg2 = abi.ConvertType(out[2], new(big.Int)).(*big.Int) - return *outstruct, err - + return *outstruct, nil } // PackGetStatsStruct is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xee8161e0. +// 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 { @@ -169,6 +198,15 @@ func (dB *DB) PackGetStatsStruct() []byte { return enc } +// TryPackGetStatsStruct is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xee8161e0. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function getStatsStruct() view returns((uint256,uint256,uint256)) +func (dB *DB) TryPackGetStatsStruct() ([]byte, error) { + return dB.abi.Pack("getStatsStruct") +} + // UnpackGetStatsStruct is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xee8161e0. // @@ -179,11 +217,12 @@ func (dB *DB) UnpackGetStatsStruct(data []byte) (DBStats, error) { return *new(DBStats), err } out0 := *abi.ConvertType(out[0], new(DBStats)).(*DBStats) - return out0, err + return out0, nil } // PackInsert is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x1d834a1b. +// 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 { @@ -194,6 +233,15 @@ func (dB *DB) PackInsert(k *big.Int, v *big.Int) []byte { return enc } +// TryPackInsert is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x1d834a1b. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function insert(uint256 k, uint256 v) returns(uint256) +func (dB *DB) TryPackInsert(k *big.Int, v *big.Int) ([]byte, error) { + return dB.abi.Pack("insert", k, v) +} + // UnpackInsert is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x1d834a1b. // @@ -204,7 +252,7 @@ func (dB *DB) UnpackInsert(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // DBInsert represents a Insert event raised by the DB contract. diff --git a/accounts/abi/bind/v2/internal/contracts/events/bindings.go b/accounts/abi/bind/v2/internal/contracts/events/bindings.go index 580bffa23eb8..ba4fdc71e3f1 100644 --- a/accounts/abi/bind/v2/internal/contracts/events/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/events/bindings.go @@ -52,7 +52,8 @@ func (c *C) Instance(backend bind.ContractBackend, addr common.Address) *bind.Bo } // PackEmitMulti is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xcb493749. +// 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,8 +64,18 @@ func (c *C) PackEmitMulti() []byte { return enc } +// TryPackEmitMulti is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xcb493749. This method will return an error +// if any inputs are invalid/nil. +// +// 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 -// the contract method with ID 0xe8e49a71. +// 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 { @@ -75,6 +86,15 @@ func (c *C) PackEmitOne() []byte { return enc } +// TryPackEmitOne is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xe8e49a71. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function EmitOne() returns() +func (c *C) TryPackEmitOne() ([]byte, error) { + return c.abi.Pack("EmitOne") +} + // CBasic1 represents a basic1 event raised by the C contract. type CBasic1 struct { Id *big.Int diff --git a/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go b/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go index 6fd6a1b2859a..d1cb08116b0c 100644 --- a/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go @@ -68,7 +68,8 @@ func (c1 *C1) PackConstructor(v1 *big.Int, v2 *big.Int) []byte { } // PackDo is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x2ad11272. +// 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,6 +80,15 @@ func (c1 *C1) PackDo(val *big.Int) []byte { return enc } +// TryPackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function Do(uint256 val) pure returns(uint256 res) +func (c1 *C1) TryPackDo(val *big.Int) ([]byte, error) { + return c1.abi.Pack("Do", val) +} + // UnpackDo is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x2ad11272. // @@ -89,7 +99,7 @@ func (c1 *C1) UnpackDo(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // C2MetaData contains all meta data concerning the C2 contract. @@ -136,7 +146,8 @@ func (c2 *C2) PackConstructor(v1 *big.Int, v2 *big.Int) []byte { } // PackDo is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x2ad11272. +// 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 { @@ -147,6 +158,15 @@ func (c2 *C2) PackDo(val *big.Int) []byte { return enc } +// TryPackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function Do(uint256 val) pure returns(uint256 res) +func (c2 *C2) TryPackDo(val *big.Int) ([]byte, error) { + return c2.abi.Pack("Do", val) +} + // UnpackDo is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x2ad11272. // @@ -157,7 +177,7 @@ func (c2 *C2) UnpackDo(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // L1MetaData contains all meta data concerning the L1 contract. @@ -188,7 +208,8 @@ func (c *L1) Instance(backend bind.ContractBackend, addr common.Address) *bind.B } // PackDo is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x2ad11272. +// 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 { @@ -199,6 +220,15 @@ func (l1 *L1) PackDo(val *big.Int) []byte { return enc } +// TryPackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function Do(uint256 val) pure returns(uint256) +func (l1 *L1) TryPackDo(val *big.Int) ([]byte, error) { + return l1.abi.Pack("Do", val) +} + // UnpackDo is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x2ad11272. // @@ -209,7 +239,7 @@ func (l1 *L1) UnpackDo(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // L2MetaData contains all meta data concerning the L2 contract. @@ -243,7 +273,8 @@ func (c *L2) Instance(backend bind.ContractBackend, addr common.Address) *bind.B } // PackDo is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x2ad11272. +// 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 { @@ -254,6 +285,15 @@ func (l2 *L2) PackDo(val *big.Int) []byte { return enc } +// TryPackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function Do(uint256 val) pure returns(uint256) +func (l2 *L2) TryPackDo(val *big.Int) ([]byte, error) { + return l2.abi.Pack("Do", val) +} + // UnpackDo is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x2ad11272. // @@ -264,7 +304,7 @@ func (l2 *L2) UnpackDo(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // L2bMetaData contains all meta data concerning the L2b contract. @@ -298,7 +338,8 @@ func (c *L2b) Instance(backend bind.ContractBackend, addr common.Address) *bind. } // PackDo is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x2ad11272. +// 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 { @@ -309,6 +350,15 @@ func (l2b *L2b) PackDo(val *big.Int) []byte { return enc } +// TryPackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function Do(uint256 val) pure returns(uint256) +func (l2b *L2b) TryPackDo(val *big.Int) ([]byte, error) { + return l2b.abi.Pack("Do", val) +} + // UnpackDo is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x2ad11272. // @@ -319,7 +369,7 @@ func (l2b *L2b) UnpackDo(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // L3MetaData contains all meta data concerning the L3 contract. @@ -350,7 +400,8 @@ func (c *L3) Instance(backend bind.ContractBackend, addr common.Address) *bind.B } // PackDo is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x2ad11272. +// 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 { @@ -361,6 +412,15 @@ func (l3 *L3) PackDo(val *big.Int) []byte { return enc } +// TryPackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function Do(uint256 val) pure returns(uint256) +func (l3 *L3) TryPackDo(val *big.Int) ([]byte, error) { + return l3.abi.Pack("Do", val) +} + // UnpackDo is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x2ad11272. // @@ -371,7 +431,7 @@ func (l3 *L3) UnpackDo(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // L4MetaData contains all meta data concerning the L4 contract. @@ -406,7 +466,8 @@ func (c *L4) Instance(backend bind.ContractBackend, addr common.Address) *bind.B } // PackDo is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x2ad11272. +// 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 { @@ -417,6 +478,15 @@ func (l4 *L4) PackDo(val *big.Int) []byte { return enc } +// TryPackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function Do(uint256 val) pure returns(uint256) +func (l4 *L4) TryPackDo(val *big.Int) ([]byte, error) { + return l4.abi.Pack("Do", val) +} + // UnpackDo is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x2ad11272. // @@ -427,7 +497,7 @@ func (l4 *L4) UnpackDo(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // L4bMetaData contains all meta data concerning the L4b contract. @@ -461,7 +531,8 @@ func (c *L4b) Instance(backend bind.ContractBackend, addr common.Address) *bind. } // PackDo is the Go binding used to pack the parameters required for calling -// the contract method with ID 0x2ad11272. +// 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 { @@ -472,6 +543,15 @@ func (l4b *L4b) PackDo(val *big.Int) []byte { return enc } +// TryPackDo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0x2ad11272. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function Do(uint256 val) pure returns(uint256) +func (l4b *L4b) TryPackDo(val *big.Int) ([]byte, error) { + return l4b.abi.Pack("Do", val) +} + // UnpackDo is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x2ad11272. // @@ -482,5 +562,5 @@ func (l4b *L4b) UnpackDo(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } diff --git a/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go b/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go index 067fb2b0e118..627b86f1b99a 100644 --- a/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go @@ -52,7 +52,8 @@ func (c *C) Instance(backend bind.ContractBackend, addr common.Address) *bind.Bo } // PackBar is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xb0a378b0. +// 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,8 +64,18 @@ func (c *C) PackBar() []byte { return enc } +// TryPackBar is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xb0a378b0. This method will return an error +// if any inputs are invalid/nil. +// +// 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 -// the contract method with ID 0xbfb4ebcf. +// 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 { @@ -75,6 +86,15 @@ func (c *C) PackFoo() []byte { return enc } +// TryPackFoo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xbfb4ebcf. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function Foo() pure returns() +func (c *C) TryPackFoo() ([]byte, error) { + return c.abi.Pack("Foo") +} + // UnpackError attempts to decode the provided error data using user-defined // error definitions. func (c *C) UnpackError(raw []byte) (any, error) { @@ -169,7 +189,8 @@ func (c *C2) Instance(backend bind.ContractBackend, addr common.Address) *bind.B } // PackFoo is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xbfb4ebcf. +// 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 { @@ -180,6 +201,15 @@ func (c2 *C2) PackFoo() []byte { return enc } +// TryPackFoo is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xbfb4ebcf. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function Foo() pure returns() +func (c2 *C2) TryPackFoo() ([]byte, error) { + return c2.abi.Pack("Foo") +} + // UnpackError attempts to decode the provided error data using user-defined // error definitions. func (c2 *C2) UnpackError(raw []byte) (any, error) { diff --git a/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go b/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go index 4999cc75d9ef..19d09bdd6a41 100644 --- a/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go @@ -52,7 +52,8 @@ func (c *MyContract) Instance(backend bind.ContractBackend, addr common.Address) } // PackGetNums is the Go binding used to pack the parameters required for calling -// the contract method with ID 0xbd6d1007. +// 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,6 +64,15 @@ func (myContract *MyContract) PackGetNums() []byte { return enc } +// TryPackGetNums is the Go binding used to pack the parameters required for calling +// the contract method with ID 0xbd6d1007. This method will return an error +// if any inputs are invalid/nil. +// +// Solidity: function GetNums() pure returns(uint256[5]) +func (myContract *MyContract) TryPackGetNums() ([]byte, error) { + return myContract.abi.Pack("GetNums") +} + // UnpackGetNums is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xbd6d1007. // @@ -73,5 +83,5 @@ func (myContract *MyContract) UnpackGetNums(data []byte) ([5]*big.Int, error) { return *new([5]*big.Int), err } out0 := *abi.ConvertType(out[0], new([5]*big.Int)).(*[5]*big.Int) - return out0, err + return out0, nil }