diff --git a/accounts/abi/abigen/bindv2_test.go b/accounts/abi/abigen/bindv2_test.go index 2756ba0835..ee943f1c3f 100644 --- a/accounts/abi/abigen/bindv2_test.go +++ b/accounts/abi/abigen/bindv2_test.go @@ -281,7 +281,7 @@ func TestBindingV2ConvertedV1Tests(t *testing.T) { } // Set this environment variable to regenerate the test outputs. if os.Getenv("WRITE_TEST_FILES") != "" { - if err := os.WriteFile((fname), []byte(have), 0666); err != nil { + if err := os.WriteFile(fname, []byte(have), 0666); err != nil { t.Fatalf("err writing expected output to file: %v\n", err) } } diff --git a/accounts/abi/abigen/testdata/v2/callbackparam.go.txt b/accounts/abi/abigen/testdata/v2/callbackparam.go.txt index e3205bde0d..d3abab5054 100644 --- a/accounts/abi/abigen/testdata/v2/callbackparam.go.txt +++ b/accounts/abi/abigen/testdata/v2/callbackparam.go.txt @@ -51,7 +51,7 @@ func (c *CallbackParam) Instance(backend bind.ContractBackend, addr common.Addre return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackTest is the Go binding used to pack the parameters required for calling +// PackTest is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xd7a5aba2. // // Solidity: function test(function callback) returns() @@ -62,3 +62,11 @@ func (callbackParam *CallbackParam) PackTest(callback [24]byte) []byte { } return enc } + +// PackTest is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xd7a5aba2. +// +// Solidity: function test(function callback) returns() +func (callbackParam *CallbackParam) TryPackTest(callback [24]byte) ([]byte, error) { + return callbackParam.abi.Pack("test", callback) +} diff --git a/accounts/abi/abigen/testdata/v2/crowdsale.go.txt b/accounts/abi/abigen/testdata/v2/crowdsale.go.txt index 60d8b4ec11..078784e20f 100644 --- a/accounts/abi/abigen/testdata/v2/crowdsale.go.txt +++ b/accounts/abi/abigen/testdata/v2/crowdsale.go.txt @@ -63,7 +63,7 @@ func (crowdsale *Crowdsale) PackConstructor(ifSuccessfulSendTo common.Address, f return enc } -// PackAmountRaised is the Go binding used to pack the parameters required for calling +// PackAmountRaised is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x7b3e5e7b. // // Solidity: function amountRaised() returns(uint256) @@ -75,6 +75,14 @@ func (crowdsale *Crowdsale) PackAmountRaised() []byte { return enc } +// PackAmountRaised is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x7b3e5e7b. +// +// Solidity: function amountRaised() returns(uint256) +func (crowdsale *Crowdsale) TryPackAmountRaised() ([]byte, error) { + return crowdsale.abi.Pack("amountRaised") +} + // UnpackAmountRaised is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x7b3e5e7b. // @@ -85,10 +93,10 @@ func (crowdsale *Crowdsale) UnpackAmountRaised(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackBeneficiary is the Go binding used to pack the parameters required for calling +// PackBeneficiary is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x38af3eed. // // Solidity: function beneficiary() returns(address) @@ -100,6 +108,14 @@ func (crowdsale *Crowdsale) PackBeneficiary() []byte { return enc } +// PackBeneficiary is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x38af3eed. +// +// Solidity: function beneficiary() returns(address) +func (crowdsale *Crowdsale) TryPackBeneficiary() ([]byte, error) { + return crowdsale.abi.Pack("beneficiary") +} + // UnpackBeneficiary is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x38af3eed. // @@ -110,10 +126,10 @@ func (crowdsale *Crowdsale) UnpackBeneficiary(data []byte) (common.Address, erro return *new(common.Address), err } out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - return out0, err + return out0, nil } -// PackCheckGoalReached is the Go binding used to pack the parameters required for calling +// PackCheckGoalReached is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x01cb3b20. // // Solidity: function checkGoalReached() returns() @@ -125,7 +141,15 @@ func (crowdsale *Crowdsale) PackCheckGoalReached() []byte { return enc } -// PackDeadline is the Go binding used to pack the parameters required for calling +// PackCheckGoalReached is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x01cb3b20. +// +// Solidity: function checkGoalReached() returns() +func (crowdsale *Crowdsale) TryPackCheckGoalReached() ([]byte, error) { + return crowdsale.abi.Pack("checkGoalReached") +} + +// PackDeadline is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x29dcb0cf. // // Solidity: function deadline() returns(uint256) @@ -137,6 +161,14 @@ func (crowdsale *Crowdsale) PackDeadline() []byte { return enc } +// PackDeadline is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x29dcb0cf. +// +// Solidity: function deadline() returns(uint256) +func (crowdsale *Crowdsale) TryPackDeadline() ([]byte, error) { + return crowdsale.abi.Pack("deadline") +} + // UnpackDeadline is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x29dcb0cf. // @@ -147,10 +179,10 @@ func (crowdsale *Crowdsale) UnpackDeadline(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackFunders is the Go binding used to pack the parameters required for calling +// PackFunders is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xdc0d3dff. // // Solidity: function funders(uint256 ) returns(address addr, uint256 amount) @@ -162,6 +194,14 @@ func (crowdsale *Crowdsale) PackFunders(arg0 *big.Int) []byte { return enc } +// PackFunders is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xdc0d3dff. +// +// Solidity: function funders(uint256 ) returns(address addr, uint256 amount) +func (crowdsale *Crowdsale) TryPackFunders(arg0 *big.Int) ([]byte, error) { + return crowdsale.abi.Pack("funders", arg0) +} + // FundersOutput serves as a container for the return parameters of contract // method Funders. type FundersOutput struct { @@ -173,19 +213,18 @@ type FundersOutput struct { // from invoking the contract method with ID 0xdc0d3dff. // // Solidity: function funders(uint256 ) returns(address addr, uint256 amount) -func (crowdsale *Crowdsale) UnpackFunders(data []byte) (FundersOutput, error) { +func (crowdsale *Crowdsale) UnpackFunders(data []byte) (*FundersOutput, error) { out, err := crowdsale.abi.Unpack("funders", data) - outstruct := new(FundersOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(FundersOutput) outstruct.Addr = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) outstruct.Amount = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return *outstruct, err - + return outstruct, nil } -// PackFundingGoal is the Go binding used to pack the parameters required for calling +// PackFundingGoal is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x7a3a0e84. // // Solidity: function fundingGoal() returns(uint256) @@ -197,6 +236,14 @@ func (crowdsale *Crowdsale) PackFundingGoal() []byte { return enc } +// PackFundingGoal is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x7a3a0e84. +// +// Solidity: function fundingGoal() returns(uint256) +func (crowdsale *Crowdsale) TryPackFundingGoal() ([]byte, error) { + return crowdsale.abi.Pack("fundingGoal") +} + // UnpackFundingGoal is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x7a3a0e84. // @@ -207,10 +254,10 @@ func (crowdsale *Crowdsale) UnpackFundingGoal(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackPrice is the Go binding used to pack the parameters required for calling +// PackPrice is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xa035b1fe. // // Solidity: function price() returns(uint256) @@ -222,6 +269,14 @@ func (crowdsale *Crowdsale) PackPrice() []byte { return enc } +// PackPrice is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xa035b1fe. +// +// Solidity: function price() returns(uint256) +func (crowdsale *Crowdsale) TryPackPrice() ([]byte, error) { + return crowdsale.abi.Pack("price") +} + // UnpackPrice is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xa035b1fe. // @@ -232,10 +287,10 @@ func (crowdsale *Crowdsale) UnpackPrice(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackTokenReward is the Go binding used to pack the parameters required for calling +// PackTokenReward is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x6e66f6e9. // // Solidity: function tokenReward() returns(address) @@ -247,6 +302,14 @@ func (crowdsale *Crowdsale) PackTokenReward() []byte { return enc } +// PackTokenReward is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x6e66f6e9. +// +// Solidity: function tokenReward() returns(address) +func (crowdsale *Crowdsale) TryPackTokenReward() ([]byte, error) { + return crowdsale.abi.Pack("tokenReward") +} + // UnpackTokenReward is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x6e66f6e9. // @@ -257,7 +320,7 @@ func (crowdsale *Crowdsale) UnpackTokenReward(data []byte) (common.Address, erro return *new(common.Address), err } out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - return out0, err + return out0, nil } // CrowdsaleFundTransfer represents a FundTransfer event raised by the Crowdsale contract. diff --git a/accounts/abi/abigen/testdata/v2/dao.go.txt b/accounts/abi/abigen/testdata/v2/dao.go.txt index 72a80949f6..0c656b54ce 100644 --- a/accounts/abi/abigen/testdata/v2/dao.go.txt +++ b/accounts/abi/abigen/testdata/v2/dao.go.txt @@ -63,7 +63,7 @@ func (dAO *DAO) PackConstructor(minimumQuorumForProposals *big.Int, minutesForDe return enc } -// PackChangeMembership is the Go binding used to pack the parameters required for calling +// PackChangeMembership is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x9644fcbd. // // Solidity: function changeMembership(address targetMember, bool canVote, string memberName) returns() @@ -75,7 +75,15 @@ func (dAO *DAO) PackChangeMembership(targetMember common.Address, canVote bool, return enc } -// PackChangeVotingRules is the Go binding used to pack the parameters required for calling +// PackChangeMembership is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x9644fcbd. +// +// Solidity: function changeMembership(address targetMember, bool canVote, string memberName) returns() +func (dAO *DAO) TryPackChangeMembership(targetMember common.Address, canVote bool, memberName string) ([]byte, error) { + return dAO.abi.Pack("changeMembership", targetMember, canVote, memberName) +} + +// PackChangeVotingRules is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xbcca1fd3. // // Solidity: function changeVotingRules(uint256 minimumQuorumForProposals, uint256 minutesForDebate, int256 marginOfVotesForMajority) returns() @@ -87,7 +95,15 @@ func (dAO *DAO) PackChangeVotingRules(minimumQuorumForProposals *big.Int, minute return enc } -// PackCheckProposalCode is the Go binding used to pack the parameters required for calling +// PackChangeVotingRules is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xbcca1fd3. +// +// Solidity: function changeVotingRules(uint256 minimumQuorumForProposals, uint256 minutesForDebate, int256 marginOfVotesForMajority) returns() +func (dAO *DAO) TryPackChangeVotingRules(minimumQuorumForProposals *big.Int, minutesForDebate *big.Int, marginOfVotesForMajority *big.Int) ([]byte, error) { + return dAO.abi.Pack("changeVotingRules", minimumQuorumForProposals, minutesForDebate, marginOfVotesForMajority) +} + +// PackCheckProposalCode is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xeceb2945. // // Solidity: function checkProposalCode(uint256 proposalNumber, address beneficiary, uint256 etherAmount, bytes transactionBytecode) returns(bool codeChecksOut) @@ -99,6 +115,14 @@ func (dAO *DAO) PackCheckProposalCode(proposalNumber *big.Int, beneficiary commo return enc } +// PackCheckProposalCode is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xeceb2945. +// +// Solidity: function checkProposalCode(uint256 proposalNumber, address beneficiary, uint256 etherAmount, bytes transactionBytecode) returns(bool codeChecksOut) +func (dAO *DAO) TryPackCheckProposalCode(proposalNumber *big.Int, beneficiary common.Address, etherAmount *big.Int, transactionBytecode []byte) ([]byte, error) { + return dAO.abi.Pack("checkProposalCode", proposalNumber, beneficiary, etherAmount, transactionBytecode) +} + // UnpackCheckProposalCode is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xeceb2945. // @@ -109,10 +133,10 @@ func (dAO *DAO) UnpackCheckProposalCode(data []byte) (bool, error) { return *new(bool), err } out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - return out0, err + return out0, nil } -// PackDebatingPeriodInMinutes is the Go binding used to pack the parameters required for calling +// PackDebatingPeriodInMinutes is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x69bd3436. // // Solidity: function debatingPeriodInMinutes() returns(uint256) @@ -124,6 +148,14 @@ func (dAO *DAO) PackDebatingPeriodInMinutes() []byte { return enc } +// PackDebatingPeriodInMinutes is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x69bd3436. +// +// Solidity: function debatingPeriodInMinutes() returns(uint256) +func (dAO *DAO) TryPackDebatingPeriodInMinutes() ([]byte, error) { + return dAO.abi.Pack("debatingPeriodInMinutes") +} + // UnpackDebatingPeriodInMinutes is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x69bd3436. // @@ -134,10 +166,10 @@ func (dAO *DAO) UnpackDebatingPeriodInMinutes(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackExecuteProposal is the Go binding used to pack the parameters required for calling +// PackExecuteProposal is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x237e9492. // // Solidity: function executeProposal(uint256 proposalNumber, bytes transactionBytecode) returns(int256 result) @@ -149,6 +181,14 @@ func (dAO *DAO) PackExecuteProposal(proposalNumber *big.Int, transactionBytecode return enc } +// PackExecuteProposal is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x237e9492. +// +// Solidity: function executeProposal(uint256 proposalNumber, bytes transactionBytecode) returns(int256 result) +func (dAO *DAO) TryPackExecuteProposal(proposalNumber *big.Int, transactionBytecode []byte) ([]byte, error) { + return dAO.abi.Pack("executeProposal", proposalNumber, transactionBytecode) +} + // UnpackExecuteProposal is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x237e9492. // @@ -159,10 +199,10 @@ func (dAO *DAO) UnpackExecuteProposal(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackMajorityMargin is the Go binding used to pack the parameters required for calling +// PackMajorityMargin is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xaa02a90f. // // Solidity: function majorityMargin() returns(int256) @@ -174,6 +214,14 @@ func (dAO *DAO) PackMajorityMargin() []byte { return enc } +// PackMajorityMargin is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xaa02a90f. +// +// Solidity: function majorityMargin() returns(int256) +func (dAO *DAO) TryPackMajorityMargin() ([]byte, error) { + return dAO.abi.Pack("majorityMargin") +} + // UnpackMajorityMargin is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xaa02a90f. // @@ -184,10 +232,10 @@ func (dAO *DAO) UnpackMajorityMargin(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackMemberId is the Go binding used to pack the parameters required for calling +// PackMemberId is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x39106821. // // Solidity: function memberId(address ) returns(uint256) @@ -199,6 +247,14 @@ func (dAO *DAO) PackMemberId(arg0 common.Address) []byte { return enc } +// PackMemberId is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x39106821. +// +// Solidity: function memberId(address ) returns(uint256) +func (dAO *DAO) TryPackMemberId(arg0 common.Address) ([]byte, error) { + return dAO.abi.Pack("memberId", arg0) +} + // UnpackMemberId is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x39106821. // @@ -209,10 +265,10 @@ func (dAO *DAO) UnpackMemberId(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackMembers is the Go binding used to pack the parameters required for calling +// PackMembers is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x5daf08ca. // // Solidity: function members(uint256 ) returns(address member, bool canVote, string name, uint256 memberSince) @@ -224,6 +280,14 @@ func (dAO *DAO) PackMembers(arg0 *big.Int) []byte { return enc } +// PackMembers is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x5daf08ca. +// +// Solidity: function members(uint256 ) returns(address member, bool canVote, string name, uint256 memberSince) +func (dAO *DAO) TryPackMembers(arg0 *big.Int) ([]byte, error) { + return dAO.abi.Pack("members", arg0) +} + // MembersOutput serves as a container for the return parameters of contract // method Members. type MembersOutput struct { @@ -237,21 +301,20 @@ type MembersOutput struct { // from invoking the contract method with ID 0x5daf08ca. // // Solidity: function members(uint256 ) returns(address member, bool canVote, string name, uint256 memberSince) -func (dAO *DAO) UnpackMembers(data []byte) (MembersOutput, error) { +func (dAO *DAO) UnpackMembers(data []byte) (*MembersOutput, error) { out, err := dAO.abi.Unpack("members", data) - outstruct := new(MembersOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(MembersOutput) outstruct.Member = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) outstruct.CanVote = *abi.ConvertType(out[1], new(bool)).(*bool) outstruct.Name = *abi.ConvertType(out[2], new(string)).(*string) outstruct.MemberSince = abi.ConvertType(out[3], new(big.Int)).(*big.Int) - return *outstruct, err - + return outstruct, nil } -// PackMinimumQuorum is the Go binding used to pack the parameters required for calling +// PackMinimumQuorum is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x8160f0b5. // // Solidity: function minimumQuorum() returns(uint256) @@ -263,6 +326,14 @@ func (dAO *DAO) PackMinimumQuorum() []byte { return enc } +// PackMinimumQuorum is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x8160f0b5. +// +// Solidity: function minimumQuorum() returns(uint256) +func (dAO *DAO) TryPackMinimumQuorum() ([]byte, error) { + return dAO.abi.Pack("minimumQuorum") +} + // UnpackMinimumQuorum is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x8160f0b5. // @@ -273,10 +344,10 @@ func (dAO *DAO) UnpackMinimumQuorum(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackNewProposal is the Go binding used to pack the parameters required for calling +// PackNewProposal is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xb1050da5. // // Solidity: function newProposal(address beneficiary, uint256 etherAmount, string JobDescription, bytes transactionBytecode) returns(uint256 proposalID) @@ -288,6 +359,14 @@ func (dAO *DAO) PackNewProposal(beneficiary common.Address, etherAmount *big.Int return enc } +// PackNewProposal is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xb1050da5. +// +// Solidity: function newProposal(address beneficiary, uint256 etherAmount, string JobDescription, bytes transactionBytecode) returns(uint256 proposalID) +func (dAO *DAO) TryPackNewProposal(beneficiary common.Address, etherAmount *big.Int, jobDescription string, transactionBytecode []byte) ([]byte, error) { + return dAO.abi.Pack("newProposal", beneficiary, etherAmount, jobDescription, transactionBytecode) +} + // UnpackNewProposal is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xb1050da5. // @@ -298,10 +377,10 @@ func (dAO *DAO) UnpackNewProposal(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackNumProposals is the Go binding used to pack the parameters required for calling +// PackNumProposals is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x400e3949. // // Solidity: function numProposals() returns(uint256) @@ -313,6 +392,14 @@ func (dAO *DAO) PackNumProposals() []byte { return enc } +// PackNumProposals is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x400e3949. +// +// Solidity: function numProposals() returns(uint256) +func (dAO *DAO) TryPackNumProposals() ([]byte, error) { + return dAO.abi.Pack("numProposals") +} + // UnpackNumProposals is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x400e3949. // @@ -323,10 +410,10 @@ func (dAO *DAO) UnpackNumProposals(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackOwner is the Go binding used to pack the parameters required for calling +// PackOwner is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x8da5cb5b. // // Solidity: function owner() returns(address) @@ -338,6 +425,14 @@ func (dAO *DAO) PackOwner() []byte { return enc } +// PackOwner is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x8da5cb5b. +// +// Solidity: function owner() returns(address) +func (dAO *DAO) TryPackOwner() ([]byte, error) { + return dAO.abi.Pack("owner") +} + // UnpackOwner is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x8da5cb5b. // @@ -348,10 +443,10 @@ func (dAO *DAO) UnpackOwner(data []byte) (common.Address, error) { return *new(common.Address), err } out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - return out0, err + return out0, nil } -// PackProposals is the Go binding used to pack the parameters required for calling +// PackProposals is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x013cf08b. // // Solidity: function proposals(uint256 ) returns(address recipient, uint256 amount, string description, uint256 votingDeadline, bool executed, bool proposalPassed, uint256 numberOfVotes, int256 currentResult, bytes32 proposalHash) @@ -363,6 +458,14 @@ func (dAO *DAO) PackProposals(arg0 *big.Int) []byte { return enc } +// PackProposals is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x013cf08b. +// +// Solidity: function proposals(uint256 ) returns(address recipient, uint256 amount, string description, uint256 votingDeadline, bool executed, bool proposalPassed, uint256 numberOfVotes, int256 currentResult, bytes32 proposalHash) +func (dAO *DAO) TryPackProposals(arg0 *big.Int) ([]byte, error) { + return dAO.abi.Pack("proposals", arg0) +} + // ProposalsOutput serves as a container for the return parameters of contract // method Proposals. type ProposalsOutput struct { @@ -381,12 +484,12 @@ type ProposalsOutput struct { // from invoking the contract method with ID 0x013cf08b. // // Solidity: function proposals(uint256 ) returns(address recipient, uint256 amount, string description, uint256 votingDeadline, bool executed, bool proposalPassed, uint256 numberOfVotes, int256 currentResult, bytes32 proposalHash) -func (dAO *DAO) UnpackProposals(data []byte) (ProposalsOutput, error) { +func (dAO *DAO) UnpackProposals(data []byte) (*ProposalsOutput, error) { out, err := dAO.abi.Unpack("proposals", data) - outstruct := new(ProposalsOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(ProposalsOutput) outstruct.Recipient = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) outstruct.Amount = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Description = *abi.ConvertType(out[2], new(string)).(*string) @@ -396,11 +499,10 @@ func (dAO *DAO) UnpackProposals(data []byte) (ProposalsOutput, error) { outstruct.NumberOfVotes = abi.ConvertType(out[6], new(big.Int)).(*big.Int) outstruct.CurrentResult = abi.ConvertType(out[7], new(big.Int)).(*big.Int) outstruct.ProposalHash = *abi.ConvertType(out[8], new([32]byte)).(*[32]byte) - return *outstruct, err - + return outstruct, nil } -// PackTransferOwnership is the Go binding used to pack the parameters required for calling +// PackTransferOwnership is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xf2fde38b. // // Solidity: function transferOwnership(address newOwner) returns() @@ -412,7 +514,15 @@ func (dAO *DAO) PackTransferOwnership(newOwner common.Address) []byte { return enc } -// PackVote is the Go binding used to pack the parameters required for calling +// PackTransferOwnership is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (dAO *DAO) TryPackTransferOwnership(newOwner common.Address) ([]byte, error) { + return dAO.abi.Pack("transferOwnership", newOwner) +} + +// PackVote is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xd3c0715b. // // Solidity: function vote(uint256 proposalNumber, bool supportsProposal, string justificationText) returns(uint256 voteID) @@ -424,6 +534,14 @@ func (dAO *DAO) PackVote(proposalNumber *big.Int, supportsProposal bool, justifi return enc } +// PackVote is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xd3c0715b. +// +// Solidity: function vote(uint256 proposalNumber, bool supportsProposal, string justificationText) returns(uint256 voteID) +func (dAO *DAO) TryPackVote(proposalNumber *big.Int, supportsProposal bool, justificationText string) ([]byte, error) { + return dAO.abi.Pack("vote", proposalNumber, supportsProposal, justificationText) +} + // UnpackVote is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xd3c0715b. // @@ -434,7 +552,7 @@ func (dAO *DAO) UnpackVote(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } // DAOChangeOfRules represents a ChangeOfRules event raised by the DAO contract. diff --git a/accounts/abi/abigen/testdata/v2/deeplynestedarray.go.txt b/accounts/abi/abigen/testdata/v2/deeplynestedarray.go.txt index 00f717d020..b4788ec930 100644 --- a/accounts/abi/abigen/testdata/v2/deeplynestedarray.go.txt +++ b/accounts/abi/abigen/testdata/v2/deeplynestedarray.go.txt @@ -51,7 +51,7 @@ func (c *DeeplyNestedArray) Instance(backend bind.ContractBackend, addr common.A return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackDeepUint64Array is the Go binding used to pack the parameters required for calling +// PackDeepUint64Array is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x98ed1856. // // Solidity: function deepUint64Array(uint256 , uint256 , uint256 ) view returns(uint64) @@ -63,6 +63,14 @@ func (deeplyNestedArray *DeeplyNestedArray) PackDeepUint64Array(arg0 *big.Int, a return enc } +// PackDeepUint64Array is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x98ed1856. +// +// Solidity: function deepUint64Array(uint256 , uint256 , uint256 ) view returns(uint64) +func (deeplyNestedArray *DeeplyNestedArray) TryPackDeepUint64Array(arg0 *big.Int, arg1 *big.Int, arg2 *big.Int) ([]byte, error) { + return deeplyNestedArray.abi.Pack("deepUint64Array", arg0, arg1, arg2) +} + // UnpackDeepUint64Array is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x98ed1856. // @@ -73,10 +81,10 @@ func (deeplyNestedArray *DeeplyNestedArray) UnpackDeepUint64Array(data []byte) ( return *new(uint64), err } out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) - return out0, err + return out0, nil } -// PackRetrieveDeepArray is the Go binding used to pack the parameters required for calling +// PackRetrieveDeepArray is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x8ed4573a. // // Solidity: function retrieveDeepArray() view returns(uint64[3][4][5]) @@ -88,6 +96,14 @@ func (deeplyNestedArray *DeeplyNestedArray) PackRetrieveDeepArray() []byte { return enc } +// PackRetrieveDeepArray is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x8ed4573a. +// +// Solidity: function retrieveDeepArray() view returns(uint64[3][4][5]) +func (deeplyNestedArray *DeeplyNestedArray) TryPackRetrieveDeepArray() ([]byte, error) { + return deeplyNestedArray.abi.Pack("retrieveDeepArray") +} + // UnpackRetrieveDeepArray is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x8ed4573a. // @@ -98,10 +114,10 @@ func (deeplyNestedArray *DeeplyNestedArray) UnpackRetrieveDeepArray(data []byte) return *new([5][4][3]uint64), err } out0 := *abi.ConvertType(out[0], new([5][4][3]uint64)).(*[5][4][3]uint64) - return out0, err + return out0, nil } -// PackStoreDeepUintArray is the Go binding used to pack the parameters required for calling +// PackStoreDeepUintArray is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x34424855. // // Solidity: function storeDeepUintArray(uint64[3][4][5] arr) returns() @@ -112,3 +128,11 @@ func (deeplyNestedArray *DeeplyNestedArray) PackStoreDeepUintArray(arr [5][4][3] } return enc } + +// PackStoreDeepUintArray is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x34424855. +// +// Solidity: function storeDeepUintArray(uint64[3][4][5] arr) returns() +func (deeplyNestedArray *DeeplyNestedArray) TryPackStoreDeepUintArray(arr [5][4][3]uint64) ([]byte, error) { + return deeplyNestedArray.abi.Pack("storeDeepUintArray", arr) +} diff --git a/accounts/abi/abigen/testdata/v2/getter.go.txt b/accounts/abi/abigen/testdata/v2/getter.go.txt index 8e6e7debbf..2fa09c4c25 100644 --- a/accounts/abi/abigen/testdata/v2/getter.go.txt +++ b/accounts/abi/abigen/testdata/v2/getter.go.txt @@ -51,7 +51,7 @@ func (c *Getter) Instance(backend bind.ContractBackend, addr common.Address) *bi return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackGetter is the Go binding used to pack the parameters required for calling +// PackGetter is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x993a04b7. // // Solidity: function getter() returns(string, int256, bytes32) @@ -63,6 +63,14 @@ func (getter *Getter) PackGetter() []byte { return enc } +// PackGetter is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x993a04b7. +// +// Solidity: function getter() returns(string, int256, bytes32) +func (getter *Getter) TryPackGetter() ([]byte, error) { + return getter.abi.Pack("getter") +} + // GetterOutput serves as a container for the return parameters of contract // method Getter. type GetterOutput struct { @@ -75,15 +83,14 @@ type GetterOutput struct { // from invoking the contract method with ID 0x993a04b7. // // Solidity: function getter() returns(string, int256, bytes32) -func (getter *Getter) UnpackGetter(data []byte) (GetterOutput, error) { +func (getter *Getter) UnpackGetter(data []byte) (*GetterOutput, error) { out, err := getter.abi.Unpack("getter", data) - outstruct := new(GetterOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(GetterOutput) outstruct.Arg0 = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Arg2 = *abi.ConvertType(out[2], new([32]byte)).(*[32]byte) - return *outstruct, err - + return outstruct, nil } diff --git a/accounts/abi/abigen/testdata/v2/identifiercollision.go.txt b/accounts/abi/abigen/testdata/v2/identifiercollision.go.txt index 60554aac13..b29365366e 100644 --- a/accounts/abi/abigen/testdata/v2/identifiercollision.go.txt +++ b/accounts/abi/abigen/testdata/v2/identifiercollision.go.txt @@ -51,7 +51,7 @@ func (c *IdentifierCollision) Instance(backend bind.ContractBackend, addr common return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackMyVar is the Go binding used to pack the parameters required for calling +// PackMyVar is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x4ef1f0ad. // // Solidity: function MyVar() view returns(uint256) @@ -63,6 +63,14 @@ func (identifierCollision *IdentifierCollision) PackMyVar() []byte { return enc } +// PackMyVar is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x4ef1f0ad. +// +// Solidity: function MyVar() view returns(uint256) +func (identifierCollision *IdentifierCollision) TryPackMyVar() ([]byte, error) { + return identifierCollision.abi.Pack("MyVar") +} + // UnpackMyVar is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x4ef1f0ad. // @@ -73,10 +81,10 @@ func (identifierCollision *IdentifierCollision) UnpackMyVar(data []byte) (*big.I return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackPubVar is the Go binding used to pack the parameters required for calling +// PackPubVar is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x01ad4d87. // // Solidity: function _myVar() view returns(uint256) @@ -88,6 +96,14 @@ func (identifierCollision *IdentifierCollision) PackPubVar() []byte { return enc } +// PackPubVar is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x01ad4d87. +// +// Solidity: function _myVar() view returns(uint256) +func (identifierCollision *IdentifierCollision) TryPackPubVar() ([]byte, error) { + return identifierCollision.abi.Pack("_myVar") +} + // UnpackPubVar is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x01ad4d87. // @@ -98,5 +114,5 @@ func (identifierCollision *IdentifierCollision) UnpackPubVar(data []byte) (*big. return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } diff --git a/accounts/abi/abigen/testdata/v2/inputchecker.go.txt b/accounts/abi/abigen/testdata/v2/inputchecker.go.txt index 7b226aa90b..5ef50dba1f 100644 --- a/accounts/abi/abigen/testdata/v2/inputchecker.go.txt +++ b/accounts/abi/abigen/testdata/v2/inputchecker.go.txt @@ -50,7 +50,7 @@ func (c *InputChecker) Instance(backend bind.ContractBackend, addr common.Addres return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackAnonInput is the Go binding used to pack the parameters required for calling +// PackAnonInput is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x3e708e82. // // Solidity: function anonInput(string ) returns() @@ -62,7 +62,15 @@ func (inputChecker *InputChecker) PackAnonInput(arg0 string) []byte { return enc } -// PackAnonInputs is the Go binding used to pack the parameters required for calling +// PackAnonInput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x3e708e82. +// +// Solidity: function anonInput(string ) returns() +func (inputChecker *InputChecker) TryPackAnonInput(arg0 string) ([]byte, error) { + return inputChecker.abi.Pack("anonInput", arg0) +} + +// PackAnonInputs is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x28160527. // // Solidity: function anonInputs(string , string ) returns() @@ -74,7 +82,15 @@ func (inputChecker *InputChecker) PackAnonInputs(arg0 string, arg1 string) []byt return enc } -// PackMixedInputs is the Go binding used to pack the parameters required for calling +// PackAnonInputs is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x28160527. +// +// Solidity: function anonInputs(string , string ) returns() +func (inputChecker *InputChecker) TryPackAnonInputs(arg0 string, arg1 string) ([]byte, error) { + return inputChecker.abi.Pack("anonInputs", arg0, arg1) +} + +// PackMixedInputs is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xc689ebdc. // // Solidity: function mixedInputs(string , string str) returns() @@ -86,7 +102,15 @@ func (inputChecker *InputChecker) PackMixedInputs(arg0 string, str string) []byt return enc } -// PackNamedInput is the Go binding used to pack the parameters required for calling +// PackMixedInputs is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xc689ebdc. +// +// Solidity: function mixedInputs(string , string str) returns() +func (inputChecker *InputChecker) TryPackMixedInputs(arg0 string, str string) ([]byte, error) { + return inputChecker.abi.Pack("mixedInputs", arg0, str) +} + +// PackNamedInput is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x0d402005. // // Solidity: function namedInput(string str) returns() @@ -98,7 +122,15 @@ func (inputChecker *InputChecker) PackNamedInput(str string) []byte { return enc } -// PackNamedInputs is the Go binding used to pack the parameters required for calling +// PackNamedInput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x0d402005. +// +// Solidity: function namedInput(string str) returns() +func (inputChecker *InputChecker) TryPackNamedInput(str string) ([]byte, error) { + return inputChecker.abi.Pack("namedInput", str) +} + +// PackNamedInputs is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x63c796ed. // // Solidity: function namedInputs(string str1, string str2) returns() @@ -110,7 +142,15 @@ func (inputChecker *InputChecker) PackNamedInputs(str1 string, str2 string) []by return enc } -// PackNoInput is the Go binding used to pack the parameters required for calling +// PackNamedInputs is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x63c796ed. +// +// Solidity: function namedInputs(string str1, string str2) returns() +func (inputChecker *InputChecker) TryPackNamedInputs(str1 string, str2 string) ([]byte, error) { + return inputChecker.abi.Pack("namedInputs", str1, str2) +} + +// PackNoInput is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x53539029. // // Solidity: function noInput() returns() @@ -121,3 +161,11 @@ func (inputChecker *InputChecker) PackNoInput() []byte { } return enc } + +// PackNoInput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x53539029. +// +// Solidity: function noInput() returns() +func (inputChecker *InputChecker) TryPackNoInput() ([]byte, error) { + return inputChecker.abi.Pack("noInput") +} diff --git a/accounts/abi/abigen/testdata/v2/interactor.go.txt b/accounts/abi/abigen/testdata/v2/interactor.go.txt index cc0900856e..de8a0c5211 100644 --- a/accounts/abi/abigen/testdata/v2/interactor.go.txt +++ b/accounts/abi/abigen/testdata/v2/interactor.go.txt @@ -63,7 +63,7 @@ func (interactor *Interactor) PackConstructor(str string) []byte { return enc } -// PackDeployString is the Go binding used to pack the parameters required for calling +// PackDeployString is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x6874e809. // // Solidity: function deployString() returns(string) @@ -75,6 +75,14 @@ func (interactor *Interactor) PackDeployString() []byte { return enc } +// PackDeployString is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x6874e809. +// +// Solidity: function deployString() returns(string) +func (interactor *Interactor) TryPackDeployString() ([]byte, error) { + return interactor.abi.Pack("deployString") +} + // UnpackDeployString is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x6874e809. // @@ -85,10 +93,10 @@ func (interactor *Interactor) UnpackDeployString(data []byte) (string, error) { return *new(string), err } out0 := *abi.ConvertType(out[0], new(string)).(*string) - return out0, err + return out0, nil } -// PackTransact is the Go binding used to pack the parameters required for calling +// PackTransact is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xd736c513. // // Solidity: function transact(string str) returns() @@ -100,7 +108,15 @@ func (interactor *Interactor) PackTransact(str string) []byte { return enc } -// PackTransactString is the Go binding used to pack the parameters required for calling +// PackTransact is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xd736c513. +// +// Solidity: function transact(string str) returns() +func (interactor *Interactor) TryPackTransact(str string) ([]byte, error) { + return interactor.abi.Pack("transact", str) +} + +// PackTransactString is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x0d86a0e1. // // Solidity: function transactString() returns(string) @@ -112,6 +128,14 @@ func (interactor *Interactor) PackTransactString() []byte { return enc } +// PackTransactString is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x0d86a0e1. +// +// Solidity: function transactString() returns(string) +func (interactor *Interactor) TryPackTransactString() ([]byte, error) { + return interactor.abi.Pack("transactString") +} + // UnpackTransactString is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x0d86a0e1. // @@ -122,5 +146,5 @@ func (interactor *Interactor) UnpackTransactString(data []byte) (string, error) return *new(string), err } out0 := *abi.ConvertType(out[0], new(string)).(*string) - return out0, err + return out0, nil } diff --git a/accounts/abi/abigen/testdata/v2/nameconflict.go.txt b/accounts/abi/abigen/testdata/v2/nameconflict.go.txt index 6228bf7cc7..fd0fcd31cc 100644 --- a/accounts/abi/abigen/testdata/v2/nameconflict.go.txt +++ b/accounts/abi/abigen/testdata/v2/nameconflict.go.txt @@ -57,7 +57,7 @@ func (c *NameConflict) Instance(backend bind.ContractBackend, addr common.Addres return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackAddRequest is the Go binding used to pack the parameters required for calling +// PackAddRequest is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xcce7b048. // // Solidity: function addRequest((bytes,bytes) req) pure returns() @@ -69,7 +69,15 @@ func (nameConflict *NameConflict) PackAddRequest(req Oraclerequest) []byte { return enc } -// PackGetRequest is the Go binding used to pack the parameters required for calling +// PackAddRequest is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xcce7b048. +// +// Solidity: function addRequest((bytes,bytes) req) pure returns() +func (nameConflict *NameConflict) TryPackAddRequest(req Oraclerequest) ([]byte, error) { + return nameConflict.abi.Pack("addRequest", req) +} + +// PackGetRequest is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xc2bb515f. // // Solidity: function getRequest() pure returns((bytes,bytes)) @@ -81,6 +89,14 @@ func (nameConflict *NameConflict) PackGetRequest() []byte { return enc } +// PackGetRequest is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xc2bb515f. +// +// Solidity: function getRequest() pure returns((bytes,bytes)) +func (nameConflict *NameConflict) TryPackGetRequest() ([]byte, error) { + return nameConflict.abi.Pack("getRequest") +} + // UnpackGetRequest is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xc2bb515f. // @@ -91,7 +107,7 @@ func (nameConflict *NameConflict) UnpackGetRequest(data []byte) (Oraclerequest, return *new(Oraclerequest), err } out0 := *abi.ConvertType(out[0], new(Oraclerequest)).(*Oraclerequest) - return out0, err + return out0, nil } // NameConflictLog represents a log event raised by the NameConflict contract. diff --git a/accounts/abi/abigen/testdata/v2/numericmethodname.go.txt b/accounts/abi/abigen/testdata/v2/numericmethodname.go.txt index 5a2208e0d4..e861aba444 100644 --- a/accounts/abi/abigen/testdata/v2/numericmethodname.go.txt +++ b/accounts/abi/abigen/testdata/v2/numericmethodname.go.txt @@ -51,7 +51,7 @@ func (c *NumericMethodName) Instance(backend bind.ContractBackend, addr common.A return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackE1test is the Go binding used to pack the parameters required for calling +// PackE1test is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xffa02795. // // Solidity: function _1test() pure returns() @@ -63,7 +63,15 @@ func (numericMethodName *NumericMethodName) PackE1test() []byte { return enc } -// PackE1test0 is the Go binding used to pack the parameters required for calling +// PackE1test is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xffa02795. +// +// Solidity: function _1test() pure returns() +func (numericMethodName *NumericMethodName) TryPackE1test() ([]byte, error) { + return numericMethodName.abi.Pack("_1test") +} + +// PackE1test0 is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xd02767c7. // // Solidity: function __1test() pure returns() @@ -75,7 +83,15 @@ func (numericMethodName *NumericMethodName) PackE1test0() []byte { return enc } -// PackE2test is the Go binding used to pack the parameters required for calling +// PackE1test0 is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xd02767c7. +// +// Solidity: function __1test() pure returns() +func (numericMethodName *NumericMethodName) TryPackE1test0() ([]byte, error) { + return numericMethodName.abi.Pack("__1test") +} + +// PackE2test is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x9d993132. // // Solidity: function __2test() pure returns() @@ -87,6 +103,14 @@ func (numericMethodName *NumericMethodName) PackE2test() []byte { return enc } +// PackE2test is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x9d993132. +// +// Solidity: function __2test() pure returns() +func (numericMethodName *NumericMethodName) TryPackE2test() ([]byte, error) { + return numericMethodName.abi.Pack("__2test") +} + // NumericMethodNameE1TestEvent represents a _1TestEvent event raised by the NumericMethodName contract. type NumericMethodNameE1TestEvent struct { Param common.Address diff --git a/accounts/abi/abigen/testdata/v2/outputchecker.go.txt b/accounts/abi/abigen/testdata/v2/outputchecker.go.txt index 6f1f8e6795..5f95e747b7 100644 --- a/accounts/abi/abigen/testdata/v2/outputchecker.go.txt +++ b/accounts/abi/abigen/testdata/v2/outputchecker.go.txt @@ -50,7 +50,7 @@ func (c *OutputChecker) Instance(backend bind.ContractBackend, addr common.Addre return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackAnonOutput is the Go binding used to pack the parameters required for calling +// PackAnonOutput is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x008bda05. // // Solidity: function anonOutput() returns(string) @@ -62,6 +62,14 @@ func (outputChecker *OutputChecker) PackAnonOutput() []byte { return enc } +// PackAnonOutput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x008bda05. +// +// Solidity: function anonOutput() returns(string) +func (outputChecker *OutputChecker) TryPackAnonOutput() ([]byte, error) { + return outputChecker.abi.Pack("anonOutput") +} + // UnpackAnonOutput is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x008bda05. // @@ -72,10 +80,10 @@ func (outputChecker *OutputChecker) UnpackAnonOutput(data []byte) (string, error return *new(string), err } out0 := *abi.ConvertType(out[0], new(string)).(*string) - return out0, err + return out0, nil } -// PackAnonOutputs is the Go binding used to pack the parameters required for calling +// PackAnonOutputs is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x3c401115. // // Solidity: function anonOutputs() returns(string, string) @@ -87,6 +95,14 @@ func (outputChecker *OutputChecker) PackAnonOutputs() []byte { return enc } +// PackAnonOutputs is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x3c401115. +// +// Solidity: function anonOutputs() returns(string, string) +func (outputChecker *OutputChecker) TryPackAnonOutputs() ([]byte, error) { + return outputChecker.abi.Pack("anonOutputs") +} + // AnonOutputsOutput serves as a container for the return parameters of contract // method AnonOutputs. type AnonOutputsOutput struct { @@ -98,19 +114,18 @@ type AnonOutputsOutput struct { // from invoking the contract method with ID 0x3c401115. // // Solidity: function anonOutputs() returns(string, string) -func (outputChecker *OutputChecker) UnpackAnonOutputs(data []byte) (AnonOutputsOutput, error) { +func (outputChecker *OutputChecker) UnpackAnonOutputs(data []byte) (*AnonOutputsOutput, error) { out, err := outputChecker.abi.Unpack("anonOutputs", data) - outstruct := new(AnonOutputsOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(AnonOutputsOutput) outstruct.Arg0 = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Arg1 = *abi.ConvertType(out[1], new(string)).(*string) - return *outstruct, err - + return outstruct, nil } -// PackCollidingOutputs is the Go binding used to pack the parameters required for calling +// PackCollidingOutputs is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xeccbc1ee. // // Solidity: function collidingOutputs() returns(string str, string Str) @@ -122,6 +137,14 @@ func (outputChecker *OutputChecker) PackCollidingOutputs() []byte { return enc } +// PackCollidingOutputs is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xeccbc1ee. +// +// Solidity: function collidingOutputs() returns(string str, string Str) +func (outputChecker *OutputChecker) TryPackCollidingOutputs() ([]byte, error) { + return outputChecker.abi.Pack("collidingOutputs") +} + // CollidingOutputsOutput serves as a container for the return parameters of contract // method CollidingOutputs. type CollidingOutputsOutput struct { @@ -133,19 +156,18 @@ type CollidingOutputsOutput struct { // from invoking the contract method with ID 0xeccbc1ee. // // Solidity: function collidingOutputs() returns(string str, string Str) -func (outputChecker *OutputChecker) UnpackCollidingOutputs(data []byte) (CollidingOutputsOutput, error) { +func (outputChecker *OutputChecker) UnpackCollidingOutputs(data []byte) (*CollidingOutputsOutput, error) { out, err := outputChecker.abi.Unpack("collidingOutputs", data) - outstruct := new(CollidingOutputsOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(CollidingOutputsOutput) outstruct.Str = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Str0 = *abi.ConvertType(out[1], new(string)).(*string) - return *outstruct, err - + return outstruct, nil } -// PackMixedOutputs is the Go binding used to pack the parameters required for calling +// PackMixedOutputs is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x21b77b44. // // Solidity: function mixedOutputs() returns(string, string str) @@ -157,6 +179,14 @@ func (outputChecker *OutputChecker) PackMixedOutputs() []byte { return enc } +// PackMixedOutputs is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x21b77b44. +// +// Solidity: function mixedOutputs() returns(string, string str) +func (outputChecker *OutputChecker) TryPackMixedOutputs() ([]byte, error) { + return outputChecker.abi.Pack("mixedOutputs") +} + // MixedOutputsOutput serves as a container for the return parameters of contract // method MixedOutputs. type MixedOutputsOutput struct { @@ -168,19 +198,18 @@ type MixedOutputsOutput struct { // from invoking the contract method with ID 0x21b77b44. // // Solidity: function mixedOutputs() returns(string, string str) -func (outputChecker *OutputChecker) UnpackMixedOutputs(data []byte) (MixedOutputsOutput, error) { +func (outputChecker *OutputChecker) UnpackMixedOutputs(data []byte) (*MixedOutputsOutput, error) { out, err := outputChecker.abi.Unpack("mixedOutputs", data) - outstruct := new(MixedOutputsOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(MixedOutputsOutput) outstruct.Arg0 = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Str = *abi.ConvertType(out[1], new(string)).(*string) - return *outstruct, err - + return outstruct, nil } -// PackNamedOutput is the Go binding used to pack the parameters required for calling +// PackNamedOutput is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x5e632bd5. // // Solidity: function namedOutput() returns(string str) @@ -192,6 +221,14 @@ func (outputChecker *OutputChecker) PackNamedOutput() []byte { return enc } +// PackNamedOutput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x5e632bd5. +// +// Solidity: function namedOutput() returns(string str) +func (outputChecker *OutputChecker) TryPackNamedOutput() ([]byte, error) { + return outputChecker.abi.Pack("namedOutput") +} + // UnpackNamedOutput is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x5e632bd5. // @@ -202,10 +239,10 @@ func (outputChecker *OutputChecker) UnpackNamedOutput(data []byte) (string, erro return *new(string), err } out0 := *abi.ConvertType(out[0], new(string)).(*string) - return out0, err + return out0, nil } -// PackNamedOutputs is the Go binding used to pack the parameters required for calling +// PackNamedOutputs is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x7970a189. // // Solidity: function namedOutputs() returns(string str1, string str2) @@ -217,6 +254,14 @@ func (outputChecker *OutputChecker) PackNamedOutputs() []byte { return enc } +// PackNamedOutputs is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x7970a189. +// +// Solidity: function namedOutputs() returns(string str1, string str2) +func (outputChecker *OutputChecker) TryPackNamedOutputs() ([]byte, error) { + return outputChecker.abi.Pack("namedOutputs") +} + // NamedOutputsOutput serves as a container for the return parameters of contract // method NamedOutputs. type NamedOutputsOutput struct { @@ -228,19 +273,18 @@ type NamedOutputsOutput struct { // from invoking the contract method with ID 0x7970a189. // // Solidity: function namedOutputs() returns(string str1, string str2) -func (outputChecker *OutputChecker) UnpackNamedOutputs(data []byte) (NamedOutputsOutput, error) { +func (outputChecker *OutputChecker) UnpackNamedOutputs(data []byte) (*NamedOutputsOutput, error) { out, err := outputChecker.abi.Unpack("namedOutputs", data) - outstruct := new(NamedOutputsOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(NamedOutputsOutput) outstruct.Str1 = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Str2 = *abi.ConvertType(out[1], new(string)).(*string) - return *outstruct, err - + return outstruct, nil } -// PackNoOutput is the Go binding used to pack the parameters required for calling +// PackNoOutput is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x625f0306. // // Solidity: function noOutput() returns() @@ -251,3 +295,11 @@ func (outputChecker *OutputChecker) PackNoOutput() []byte { } return enc } + +// PackNoOutput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x625f0306. +// +// Solidity: function noOutput() returns() +func (outputChecker *OutputChecker) TryPackNoOutput() ([]byte, error) { + return outputChecker.abi.Pack("noOutput") +} diff --git a/accounts/abi/abigen/testdata/v2/overload.go.txt b/accounts/abi/abigen/testdata/v2/overload.go.txt index ed7c0b543c..7f6e3535ea 100644 --- a/accounts/abi/abigen/testdata/v2/overload.go.txt +++ b/accounts/abi/abigen/testdata/v2/overload.go.txt @@ -51,7 +51,7 @@ func (c *Overload) Instance(backend bind.ContractBackend, addr common.Address) * return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackFoo is the Go binding used to pack the parameters required for calling +// PackFoo is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x04bc52f8. // // Solidity: function foo(uint256 i, uint256 j) returns() @@ -63,7 +63,15 @@ func (overload *Overload) PackFoo(i *big.Int, j *big.Int) []byte { return enc } -// PackFoo0 is the Go binding used to pack the parameters required for calling +// PackFoo is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x04bc52f8. +// +// Solidity: function foo(uint256 i, uint256 j) returns() +func (overload *Overload) TryPackFoo(i *big.Int, j *big.Int) ([]byte, error) { + return overload.abi.Pack("foo", i, j) +} + +// PackFoo0 is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x2fbebd38. // // Solidity: function foo(uint256 i) returns() @@ -75,6 +83,14 @@ func (overload *Overload) PackFoo0(i *big.Int) []byte { return enc } +// PackFoo0 is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x2fbebd38. +// +// Solidity: function foo(uint256 i) returns() +func (overload *Overload) TryPackFoo0(i *big.Int) ([]byte, error) { + return overload.abi.Pack("foo0", i) +} + // OverloadBar represents a bar event raised by the Overload contract. type OverloadBar struct { I *big.Int diff --git a/accounts/abi/abigen/testdata/v2/rangekeyword.go.txt b/accounts/abi/abigen/testdata/v2/rangekeyword.go.txt index c7f1425395..ac05be2a9e 100644 --- a/accounts/abi/abigen/testdata/v2/rangekeyword.go.txt +++ b/accounts/abi/abigen/testdata/v2/rangekeyword.go.txt @@ -51,7 +51,7 @@ func (c *RangeKeyword) Instance(backend bind.ContractBackend, addr common.Addres return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackFunctionWithKeywordParameter is the Go binding used to pack the parameters required for calling +// PackFunctionWithKeywordParameter is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x527a119f. // // Solidity: function functionWithKeywordParameter(uint256 range) pure returns() @@ -62,3 +62,11 @@ func (rangeKeyword *RangeKeyword) PackFunctionWithKeywordParameter(arg0 *big.Int } return enc } + +// PackFunctionWithKeywordParameter is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x527a119f. +// +// Solidity: function functionWithKeywordParameter(uint256 range) pure returns() +func (rangeKeyword *RangeKeyword) TryPackFunctionWithKeywordParameter(arg0 *big.Int) ([]byte, error) { + return rangeKeyword.abi.Pack("functionWithKeywordParameter", arg0) +} diff --git a/accounts/abi/abigen/testdata/v2/slicer.go.txt b/accounts/abi/abigen/testdata/v2/slicer.go.txt index b66c05cf0f..426eaa0517 100644 --- a/accounts/abi/abigen/testdata/v2/slicer.go.txt +++ b/accounts/abi/abigen/testdata/v2/slicer.go.txt @@ -51,7 +51,7 @@ func (c *Slicer) Instance(backend bind.ContractBackend, addr common.Address) *bi return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackEchoAddresses is the Go binding used to pack the parameters required for calling +// PackEchoAddresses is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xbe1127a3. // // Solidity: function echoAddresses(address[] input) returns(address[] output) @@ -63,6 +63,14 @@ func (slicer *Slicer) PackEchoAddresses(input []common.Address) []byte { return enc } +// PackEchoAddresses is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xbe1127a3. +// +// Solidity: function echoAddresses(address[] input) returns(address[] output) +func (slicer *Slicer) TryPackEchoAddresses(input []common.Address) ([]byte, error) { + return slicer.abi.Pack("echoAddresses", input) +} + // UnpackEchoAddresses is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xbe1127a3. // @@ -73,10 +81,10 @@ func (slicer *Slicer) UnpackEchoAddresses(data []byte) ([]common.Address, error) return *new([]common.Address), err } out0 := *abi.ConvertType(out[0], new([]common.Address)).(*[]common.Address) - return out0, err + return out0, nil } -// PackEchoBools is the Go binding used to pack the parameters required for calling +// PackEchoBools is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xf637e589. // // Solidity: function echoBools(bool[] input) returns(bool[] output) @@ -88,6 +96,14 @@ func (slicer *Slicer) PackEchoBools(input []bool) []byte { return enc } +// PackEchoBools is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xf637e589. +// +// Solidity: function echoBools(bool[] input) returns(bool[] output) +func (slicer *Slicer) TryPackEchoBools(input []bool) ([]byte, error) { + return slicer.abi.Pack("echoBools", input) +} + // UnpackEchoBools is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xf637e589. // @@ -98,10 +114,10 @@ func (slicer *Slicer) UnpackEchoBools(data []byte) ([]bool, error) { return *new([]bool), err } out0 := *abi.ConvertType(out[0], new([]bool)).(*[]bool) - return out0, err + return out0, nil } -// PackEchoFancyInts is the Go binding used to pack the parameters required for calling +// PackEchoFancyInts is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xd88becc0. // // Solidity: function echoFancyInts(uint24[23] input) returns(uint24[23] output) @@ -113,6 +129,14 @@ func (slicer *Slicer) PackEchoFancyInts(input [23]*big.Int) []byte { return enc } +// PackEchoFancyInts is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xd88becc0. +// +// Solidity: function echoFancyInts(uint24[23] input) returns(uint24[23] output) +func (slicer *Slicer) TryPackEchoFancyInts(input [23]*big.Int) ([]byte, error) { + return slicer.abi.Pack("echoFancyInts", input) +} + // UnpackEchoFancyInts is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xd88becc0. // @@ -123,10 +147,10 @@ func (slicer *Slicer) UnpackEchoFancyInts(data []byte) ([23]*big.Int, error) { return *new([23]*big.Int), err } out0 := *abi.ConvertType(out[0], new([23]*big.Int)).(*[23]*big.Int) - return out0, err + return out0, nil } -// PackEchoInts is the Go binding used to pack the parameters required for calling +// PackEchoInts is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xe15a3db7. // // Solidity: function echoInts(int256[] input) returns(int256[] output) @@ -138,6 +162,14 @@ func (slicer *Slicer) PackEchoInts(input []*big.Int) []byte { return enc } +// PackEchoInts is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xe15a3db7. +// +// Solidity: function echoInts(int256[] input) returns(int256[] output) +func (slicer *Slicer) TryPackEchoInts(input []*big.Int) ([]byte, error) { + return slicer.abi.Pack("echoInts", input) +} + // UnpackEchoInts is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xe15a3db7. // @@ -148,5 +180,5 @@ func (slicer *Slicer) UnpackEchoInts(data []byte) ([]*big.Int, error) { return *new([]*big.Int), err } out0 := *abi.ConvertType(out[0], new([]*big.Int)).(*[]*big.Int) - return out0, err + return out0, nil } diff --git a/accounts/abi/abigen/testdata/v2/structs.go.txt b/accounts/abi/abigen/testdata/v2/structs.go.txt index 7fe59c5616..da94fbf164 100644 --- a/accounts/abi/abigen/testdata/v2/structs.go.txt +++ b/accounts/abi/abigen/testdata/v2/structs.go.txt @@ -56,7 +56,7 @@ func (c *Structs) Instance(backend bind.ContractBackend, addr common.Address) *b return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackF is the Go binding used to pack the parameters required for calling +// PackF is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x28811f59. // // Solidity: function F() view returns((bytes32)[] a, uint256[] c, bool[] d) @@ -68,6 +68,14 @@ func (structs *Structs) PackF() []byte { return enc } +// PackF is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x28811f59. +// +// Solidity: function F() view returns((bytes32)[] a, uint256[] c, bool[] d) +func (structs *Structs) TryPackF() ([]byte, error) { + return structs.abi.Pack("F") +} + // FOutput serves as a container for the return parameters of contract // method F. type FOutput struct { @@ -80,20 +88,19 @@ type FOutput struct { // from invoking the contract method with ID 0x28811f59. // // Solidity: function F() view returns((bytes32)[] a, uint256[] c, bool[] d) -func (structs *Structs) UnpackF(data []byte) (FOutput, error) { +func (structs *Structs) UnpackF(data []byte) (*FOutput, error) { out, err := structs.abi.Unpack("F", data) - outstruct := new(FOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(FOutput) outstruct.A = *abi.ConvertType(out[0], new([]Struct0)).(*[]Struct0) outstruct.C = *abi.ConvertType(out[1], new([]*big.Int)).(*[]*big.Int) outstruct.D = *abi.ConvertType(out[2], new([]bool)).(*[]bool) - return *outstruct, err - + return outstruct, nil } -// PackG is the Go binding used to pack the parameters required for calling +// PackG is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x6fecb623. // // Solidity: function G() view returns((bytes32)[] a) @@ -105,6 +112,14 @@ func (structs *Structs) PackG() []byte { return enc } +// PackG is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x6fecb623. +// +// Solidity: function G() view returns((bytes32)[] a) +func (structs *Structs) TryPackG() ([]byte, error) { + return structs.abi.Pack("G") +} + // UnpackG is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x6fecb623. // @@ -115,5 +130,5 @@ func (structs *Structs) UnpackG(data []byte) ([]Struct0, error) { return *new([]Struct0), err } out0 := *abi.ConvertType(out[0], new([]Struct0)).(*[]Struct0) - return out0, err + return out0, nil } diff --git a/accounts/abi/abigen/testdata/v2/token.go.txt b/accounts/abi/abigen/testdata/v2/token.go.txt index aca18cb227..489c084c3c 100644 --- a/accounts/abi/abigen/testdata/v2/token.go.txt +++ b/accounts/abi/abigen/testdata/v2/token.go.txt @@ -63,7 +63,7 @@ func (token *Token) PackConstructor(initialSupply *big.Int, tokenName string, de return enc } -// PackAllowance is the Go binding used to pack the parameters required for calling +// PackAllowance is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xdd62ed3e. // // Solidity: function allowance(address , address ) returns(uint256) @@ -75,6 +75,14 @@ func (token *Token) PackAllowance(arg0 common.Address, arg1 common.Address) []by return enc } +// PackAllowance is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xdd62ed3e. +// +// Solidity: function allowance(address , address ) returns(uint256) +func (token *Token) TryPackAllowance(arg0 common.Address, arg1 common.Address) ([]byte, error) { + return token.abi.Pack("allowance", arg0, arg1) +} + // UnpackAllowance is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xdd62ed3e. // @@ -85,10 +93,10 @@ func (token *Token) UnpackAllowance(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackApproveAndCall is the Go binding used to pack the parameters required for calling +// PackApproveAndCall is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xcae9ca51. // // Solidity: function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns(bool success) @@ -100,6 +108,14 @@ func (token *Token) PackApproveAndCall(spender common.Address, value *big.Int, e return enc } +// PackApproveAndCall is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xcae9ca51. +// +// Solidity: function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns(bool success) +func (token *Token) TryPackApproveAndCall(spender common.Address, value *big.Int, extraData []byte) ([]byte, error) { + return token.abi.Pack("approveAndCall", spender, value, extraData) +} + // UnpackApproveAndCall is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xcae9ca51. // @@ -110,10 +126,10 @@ func (token *Token) UnpackApproveAndCall(data []byte) (bool, error) { return *new(bool), err } out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - return out0, err + return out0, nil } -// PackBalanceOf is the Go binding used to pack the parameters required for calling +// PackBalanceOf is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x70a08231. // // Solidity: function balanceOf(address ) returns(uint256) @@ -125,6 +141,14 @@ func (token *Token) PackBalanceOf(arg0 common.Address) []byte { return enc } +// PackBalanceOf is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x70a08231. +// +// Solidity: function balanceOf(address ) returns(uint256) +func (token *Token) TryPackBalanceOf(arg0 common.Address) ([]byte, error) { + return token.abi.Pack("balanceOf", arg0) +} + // UnpackBalanceOf is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x70a08231. // @@ -135,10 +159,10 @@ func (token *Token) UnpackBalanceOf(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackDecimals is the Go binding used to pack the parameters required for calling +// PackDecimals is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x313ce567. // // Solidity: function decimals() returns(uint8) @@ -150,6 +174,14 @@ func (token *Token) PackDecimals() []byte { return enc } +// PackDecimals is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x313ce567. +// +// Solidity: function decimals() returns(uint8) +func (token *Token) TryPackDecimals() ([]byte, error) { + return token.abi.Pack("decimals") +} + // UnpackDecimals is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x313ce567. // @@ -160,10 +192,10 @@ func (token *Token) UnpackDecimals(data []byte) (uint8, error) { return *new(uint8), err } out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) - return out0, err + return out0, nil } -// PackName is the Go binding used to pack the parameters required for calling +// PackName is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x06fdde03. // // Solidity: function name() returns(string) @@ -175,6 +207,14 @@ func (token *Token) PackName() []byte { return enc } +// PackName is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x06fdde03. +// +// Solidity: function name() returns(string) +func (token *Token) TryPackName() ([]byte, error) { + return token.abi.Pack("name") +} + // UnpackName is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x06fdde03. // @@ -185,10 +225,10 @@ func (token *Token) UnpackName(data []byte) (string, error) { return *new(string), err } out0 := *abi.ConvertType(out[0], new(string)).(*string) - return out0, err + return out0, nil } -// PackSpentAllowance is the Go binding used to pack the parameters required for calling +// PackSpentAllowance is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xdc3080f2. // // Solidity: function spentAllowance(address , address ) returns(uint256) @@ -200,6 +240,14 @@ func (token *Token) PackSpentAllowance(arg0 common.Address, arg1 common.Address) return enc } +// PackSpentAllowance is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xdc3080f2. +// +// Solidity: function spentAllowance(address , address ) returns(uint256) +func (token *Token) TryPackSpentAllowance(arg0 common.Address, arg1 common.Address) ([]byte, error) { + return token.abi.Pack("spentAllowance", arg0, arg1) +} + // UnpackSpentAllowance is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0xdc3080f2. // @@ -210,10 +258,10 @@ func (token *Token) UnpackSpentAllowance(data []byte) (*big.Int, error) { return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil } -// PackSymbol is the Go binding used to pack the parameters required for calling +// PackSymbol is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x95d89b41. // // Solidity: function symbol() returns(string) @@ -225,6 +273,14 @@ func (token *Token) PackSymbol() []byte { return enc } +// PackSymbol is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x95d89b41. +// +// Solidity: function symbol() returns(string) +func (token *Token) TryPackSymbol() ([]byte, error) { + return token.abi.Pack("symbol") +} + // UnpackSymbol is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x95d89b41. // @@ -235,10 +291,10 @@ func (token *Token) UnpackSymbol(data []byte) (string, error) { return *new(string), err } out0 := *abi.ConvertType(out[0], new(string)).(*string) - return out0, err + return out0, nil } -// PackTransfer is the Go binding used to pack the parameters required for calling +// PackTransfer is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xa9059cbb. // // Solidity: function transfer(address _to, uint256 _value) returns() @@ -250,7 +306,15 @@ func (token *Token) PackTransfer(to common.Address, value *big.Int) []byte { return enc } -// PackTransferFrom is the Go binding used to pack the parameters required for calling +// PackTransfer is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xa9059cbb. +// +// Solidity: function transfer(address _to, uint256 _value) returns() +func (token *Token) TryPackTransfer(to common.Address, value *big.Int) ([]byte, error) { + return token.abi.Pack("transfer", to, value) +} + +// PackTransferFrom is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x23b872dd. // // Solidity: function transferFrom(address _from, address _to, uint256 _value) returns(bool success) @@ -262,6 +326,14 @@ func (token *Token) PackTransferFrom(from common.Address, to common.Address, val return enc } +// PackTransferFrom is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x23b872dd. +// +// Solidity: function transferFrom(address _from, address _to, uint256 _value) returns(bool success) +func (token *Token) TryPackTransferFrom(from common.Address, to common.Address, value *big.Int) ([]byte, error) { + return token.abi.Pack("transferFrom", from, to, value) +} + // UnpackTransferFrom is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x23b872dd. // @@ -272,7 +344,7 @@ func (token *Token) UnpackTransferFrom(data []byte) (bool, error) { return *new(bool), err } out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - return out0, err + return out0, nil } // TokenTransfer represents a Transfer event raised by the Token contract. diff --git a/accounts/abi/abigen/testdata/v2/tuple.go.txt b/accounts/abi/abigen/testdata/v2/tuple.go.txt index 65af765463..4f03b7f1fb 100644 --- a/accounts/abi/abigen/testdata/v2/tuple.go.txt +++ b/accounts/abi/abigen/testdata/v2/tuple.go.txt @@ -76,7 +76,7 @@ func (c *Tuple) Instance(backend bind.ContractBackend, addr common.Address) *bin return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackFunc1 is the Go binding used to pack the parameters required for calling +// PackFunc1 is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x443c79b4. // // Solidity: function func1((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) pure returns((uint256,uint256[],(uint256,uint256)[]), (uint256,uint256)[2][], (uint256,uint256)[][2], (uint256,uint256[],(uint256,uint256)[])[], uint256[]) @@ -88,6 +88,14 @@ func (tuple *Tuple) PackFunc1(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS return enc } +// PackFunc1 is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x443c79b4. +// +// Solidity: function func1((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) pure returns((uint256,uint256[],(uint256,uint256)[]), (uint256,uint256)[2][], (uint256,uint256)[][2], (uint256,uint256[],(uint256,uint256)[])[], uint256[]) +func (tuple *Tuple) TryPackFunc1(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) ([]byte, error) { + return tuple.abi.Pack("func1", a, b, c, d, e) +} + // Func1Output serves as a container for the return parameters of contract // method Func1. type Func1Output struct { @@ -102,22 +110,21 @@ type Func1Output struct { // from invoking the contract method with ID 0x443c79b4. // // Solidity: function func1((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) pure returns((uint256,uint256[],(uint256,uint256)[]), (uint256,uint256)[2][], (uint256,uint256)[][2], (uint256,uint256[],(uint256,uint256)[])[], uint256[]) -func (tuple *Tuple) UnpackFunc1(data []byte) (Func1Output, error) { +func (tuple *Tuple) UnpackFunc1(data []byte) (*Func1Output, error) { out, err := tuple.abi.Unpack("func1", data) - outstruct := new(Func1Output) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(Func1Output) outstruct.Arg0 = *abi.ConvertType(out[0], new(TupleS)).(*TupleS) outstruct.Arg1 = *abi.ConvertType(out[1], new([][2]TupleT)).(*[][2]TupleT) outstruct.Arg2 = *abi.ConvertType(out[2], new([2][]TupleT)).(*[2][]TupleT) outstruct.Arg3 = *abi.ConvertType(out[3], new([]TupleS)).(*[]TupleS) outstruct.Arg4 = *abi.ConvertType(out[4], new([]*big.Int)).(*[]*big.Int) - return *outstruct, err - + return outstruct, nil } -// PackFunc2 is the Go binding used to pack the parameters required for calling +// PackFunc2 is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xd0062cdd. // // Solidity: function func2((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) returns() @@ -129,7 +136,15 @@ func (tuple *Tuple) PackFunc2(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS return enc } -// PackFunc3 is the Go binding used to pack the parameters required for calling +// PackFunc2 is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xd0062cdd. +// +// Solidity: function func2((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) returns() +func (tuple *Tuple) TryPackFunc2(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) ([]byte, error) { + return tuple.abi.Pack("func2", a, b, c, d, e) +} + +// PackFunc3 is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xe4d9a43b. // // Solidity: function func3((uint16,uint16)[] ) pure returns() @@ -141,6 +156,14 @@ func (tuple *Tuple) PackFunc3(arg0 []TupleQ) []byte { return enc } +// PackFunc3 is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xe4d9a43b. +// +// Solidity: function func3((uint16,uint16)[] ) pure returns() +func (tuple *Tuple) TryPackFunc3(arg0 []TupleQ) ([]byte, error) { + return tuple.abi.Pack("func3", arg0) +} + // TupleTupleEvent represents a TupleEvent event raised by the Tuple contract. type TupleTupleEvent struct { A TupleS diff --git a/accounts/abi/abigen/testdata/v2/tupler.go.txt b/accounts/abi/abigen/testdata/v2/tupler.go.txt index caa692dade..5d919944cf 100644 --- a/accounts/abi/abigen/testdata/v2/tupler.go.txt +++ b/accounts/abi/abigen/testdata/v2/tupler.go.txt @@ -51,7 +51,7 @@ func (c *Tupler) Instance(backend bind.ContractBackend, addr common.Address) *bi return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackTuple is the Go binding used to pack the parameters required for calling +// PackTuple is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x3175aae2. // // Solidity: function tuple() returns(string a, int256 b, bytes32 c) @@ -63,6 +63,14 @@ func (tupler *Tupler) PackTuple() []byte { return enc } +// PackTuple is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x3175aae2. +// +// Solidity: function tuple() returns(string a, int256 b, bytes32 c) +func (tupler *Tupler) TryPackTuple() ([]byte, error) { + return tupler.abi.Pack("tuple") +} + // TupleOutput serves as a container for the return parameters of contract // method Tuple. type TupleOutput struct { @@ -75,15 +83,14 @@ type TupleOutput struct { // from invoking the contract method with ID 0x3175aae2. // // Solidity: function tuple() returns(string a, int256 b, bytes32 c) -func (tupler *Tupler) UnpackTuple(data []byte) (TupleOutput, error) { +func (tupler *Tupler) UnpackTuple(data []byte) (*TupleOutput, error) { out, err := tupler.abi.Unpack("tuple", data) - outstruct := new(TupleOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(TupleOutput) outstruct.A = *abi.ConvertType(out[0], new(string)).(*string) outstruct.B = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.C = *abi.ConvertType(out[2], new([32]byte)).(*[32]byte) - return *outstruct, err - + return outstruct, nil } diff --git a/accounts/abi/abigen/testdata/v2/underscorer.go.txt b/accounts/abi/abigen/testdata/v2/underscorer.go.txt index ef9eb864fa..96c138fd44 100644 --- a/accounts/abi/abigen/testdata/v2/underscorer.go.txt +++ b/accounts/abi/abigen/testdata/v2/underscorer.go.txt @@ -51,7 +51,7 @@ func (c *Underscorer) Instance(backend bind.ContractBackend, addr common.Address return bind.NewBoundContract(addr, c.abi, backend, backend, backend) } -// PackAllPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling +// PackAllPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xb564b34d. // // Solidity: function AllPurelyUnderscoredOutput() view returns(int256 _, int256 __) @@ -63,6 +63,14 @@ func (underscorer *Underscorer) PackAllPurelyUnderscoredOutput() []byte { return enc } +// PackAllPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xb564b34d. +// +// Solidity: function AllPurelyUnderscoredOutput() view returns(int256 _, int256 __) +func (underscorer *Underscorer) TryPackAllPurelyUnderscoredOutput() ([]byte, error) { + return underscorer.abi.Pack("AllPurelyUnderscoredOutput") +} + // AllPurelyUnderscoredOutputOutput serves as a container for the return parameters of contract // method AllPurelyUnderscoredOutput. type AllPurelyUnderscoredOutputOutput struct { @@ -74,19 +82,18 @@ type AllPurelyUnderscoredOutputOutput struct { // from invoking the contract method with ID 0xb564b34d. // // Solidity: function AllPurelyUnderscoredOutput() view returns(int256 _, int256 __) -func (underscorer *Underscorer) UnpackAllPurelyUnderscoredOutput(data []byte) (AllPurelyUnderscoredOutputOutput, error) { +func (underscorer *Underscorer) UnpackAllPurelyUnderscoredOutput(data []byte) (*AllPurelyUnderscoredOutputOutput, error) { out, err := underscorer.abi.Unpack("AllPurelyUnderscoredOutput", data) - outstruct := new(AllPurelyUnderscoredOutputOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(AllPurelyUnderscoredOutputOutput) outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return *outstruct, err - + return outstruct, nil } -// PackLowerLowerCollision is the Go binding used to pack the parameters required for calling +// PackLowerLowerCollision is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xe409ca45. // // Solidity: function LowerLowerCollision() view returns(int256 _res, int256 res) @@ -98,6 +105,14 @@ func (underscorer *Underscorer) PackLowerLowerCollision() []byte { return enc } +// PackLowerLowerCollision is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xe409ca45. +// +// Solidity: function LowerLowerCollision() view returns(int256 _res, int256 res) +func (underscorer *Underscorer) TryPackLowerLowerCollision() ([]byte, error) { + return underscorer.abi.Pack("LowerLowerCollision") +} + // LowerLowerCollisionOutput serves as a container for the return parameters of contract // method LowerLowerCollision. type LowerLowerCollisionOutput struct { @@ -109,19 +124,18 @@ type LowerLowerCollisionOutput struct { // from invoking the contract method with ID 0xe409ca45. // // Solidity: function LowerLowerCollision() view returns(int256 _res, int256 res) -func (underscorer *Underscorer) UnpackLowerLowerCollision(data []byte) (LowerLowerCollisionOutput, error) { +func (underscorer *Underscorer) UnpackLowerLowerCollision(data []byte) (*LowerLowerCollisionOutput, error) { out, err := underscorer.abi.Unpack("LowerLowerCollision", data) - outstruct := new(LowerLowerCollisionOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(LowerLowerCollisionOutput) outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return *outstruct, err - + return outstruct, nil } -// PackLowerUpperCollision is the Go binding used to pack the parameters required for calling +// PackLowerUpperCollision is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x03a59213. // // Solidity: function LowerUpperCollision() view returns(int256 _res, int256 Res) @@ -133,6 +147,14 @@ func (underscorer *Underscorer) PackLowerUpperCollision() []byte { return enc } +// PackLowerUpperCollision is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x03a59213. +// +// Solidity: function LowerUpperCollision() view returns(int256 _res, int256 Res) +func (underscorer *Underscorer) TryPackLowerUpperCollision() ([]byte, error) { + return underscorer.abi.Pack("LowerUpperCollision") +} + // LowerUpperCollisionOutput serves as a container for the return parameters of contract // method LowerUpperCollision. type LowerUpperCollisionOutput struct { @@ -144,19 +166,18 @@ type LowerUpperCollisionOutput struct { // from invoking the contract method with ID 0x03a59213. // // Solidity: function LowerUpperCollision() view returns(int256 _res, int256 Res) -func (underscorer *Underscorer) UnpackLowerUpperCollision(data []byte) (LowerUpperCollisionOutput, error) { +func (underscorer *Underscorer) UnpackLowerUpperCollision(data []byte) (*LowerUpperCollisionOutput, error) { out, err := underscorer.abi.Unpack("LowerUpperCollision", data) - outstruct := new(LowerUpperCollisionOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(LowerUpperCollisionOutput) outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return *outstruct, err - + return outstruct, nil } -// PackPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling +// PackPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x9df48485. // // Solidity: function PurelyUnderscoredOutput() view returns(int256 _, int256 res) @@ -168,6 +189,14 @@ func (underscorer *Underscorer) PackPurelyUnderscoredOutput() []byte { return enc } +// PackPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x9df48485. +// +// Solidity: function PurelyUnderscoredOutput() view returns(int256 _, int256 res) +func (underscorer *Underscorer) TryPackPurelyUnderscoredOutput() ([]byte, error) { + return underscorer.abi.Pack("PurelyUnderscoredOutput") +} + // PurelyUnderscoredOutputOutput serves as a container for the return parameters of contract // method PurelyUnderscoredOutput. type PurelyUnderscoredOutputOutput struct { @@ -179,19 +208,18 @@ type PurelyUnderscoredOutputOutput struct { // from invoking the contract method with ID 0x9df48485. // // Solidity: function PurelyUnderscoredOutput() view returns(int256 _, int256 res) -func (underscorer *Underscorer) UnpackPurelyUnderscoredOutput(data []byte) (PurelyUnderscoredOutputOutput, error) { +func (underscorer *Underscorer) UnpackPurelyUnderscoredOutput(data []byte) (*PurelyUnderscoredOutputOutput, error) { out, err := underscorer.abi.Unpack("PurelyUnderscoredOutput", data) - outstruct := new(PurelyUnderscoredOutputOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(PurelyUnderscoredOutputOutput) outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return *outstruct, err - + return outstruct, nil } -// PackUnderscoredOutput is the Go binding used to pack the parameters required for calling +// PackUnderscoredOutput is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x67e6633d. // // Solidity: function UnderscoredOutput() view returns(int256 _int, string _string) @@ -203,6 +231,14 @@ func (underscorer *Underscorer) PackUnderscoredOutput() []byte { return enc } +// PackUnderscoredOutput is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x67e6633d. +// +// Solidity: function UnderscoredOutput() view returns(int256 _int, string _string) +func (underscorer *Underscorer) TryPackUnderscoredOutput() ([]byte, error) { + return underscorer.abi.Pack("UnderscoredOutput") +} + // UnderscoredOutputOutput serves as a container for the return parameters of contract // method UnderscoredOutput. type UnderscoredOutputOutput struct { @@ -214,19 +250,18 @@ type UnderscoredOutputOutput struct { // from invoking the contract method with ID 0x67e6633d. // // Solidity: function UnderscoredOutput() view returns(int256 _int, string _string) -func (underscorer *Underscorer) UnpackUnderscoredOutput(data []byte) (UnderscoredOutputOutput, error) { +func (underscorer *Underscorer) UnpackUnderscoredOutput(data []byte) (*UnderscoredOutputOutput, error) { out, err := underscorer.abi.Unpack("UnderscoredOutput", data) - outstruct := new(UnderscoredOutputOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(UnderscoredOutputOutput) outstruct.Int = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.String = *abi.ConvertType(out[1], new(string)).(*string) - return *outstruct, err - + return outstruct, nil } -// PackUpperLowerCollision is the Go binding used to pack the parameters required for calling +// PackUpperLowerCollision is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xaf7486ab. // // Solidity: function UpperLowerCollision() view returns(int256 _Res, int256 res) @@ -238,6 +273,14 @@ func (underscorer *Underscorer) PackUpperLowerCollision() []byte { return enc } +// PackUpperLowerCollision is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xaf7486ab. +// +// Solidity: function UpperLowerCollision() view returns(int256 _Res, int256 res) +func (underscorer *Underscorer) TryPackUpperLowerCollision() ([]byte, error) { + return underscorer.abi.Pack("UpperLowerCollision") +} + // UpperLowerCollisionOutput serves as a container for the return parameters of contract // method UpperLowerCollision. type UpperLowerCollisionOutput struct { @@ -249,19 +292,18 @@ type UpperLowerCollisionOutput struct { // from invoking the contract method with ID 0xaf7486ab. // // Solidity: function UpperLowerCollision() view returns(int256 _Res, int256 res) -func (underscorer *Underscorer) UnpackUpperLowerCollision(data []byte) (UpperLowerCollisionOutput, error) { +func (underscorer *Underscorer) UnpackUpperLowerCollision(data []byte) (*UpperLowerCollisionOutput, error) { out, err := underscorer.abi.Unpack("UpperLowerCollision", data) - outstruct := new(UpperLowerCollisionOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(UpperLowerCollisionOutput) outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return *outstruct, err - + return outstruct, nil } -// PackUpperUpperCollision is the Go binding used to pack the parameters required for calling +// PackUpperUpperCollision is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0xe02ab24d. // // Solidity: function UpperUpperCollision() view returns(int256 _Res, int256 Res) @@ -273,6 +315,14 @@ func (underscorer *Underscorer) PackUpperUpperCollision() []byte { return enc } +// PackUpperUpperCollision is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0xe02ab24d. +// +// Solidity: function UpperUpperCollision() view returns(int256 _Res, int256 Res) +func (underscorer *Underscorer) TryPackUpperUpperCollision() ([]byte, error) { + return underscorer.abi.Pack("UpperUpperCollision") +} + // UpperUpperCollisionOutput serves as a container for the return parameters of contract // method UpperUpperCollision. type UpperUpperCollisionOutput struct { @@ -284,19 +334,18 @@ type UpperUpperCollisionOutput struct { // from invoking the contract method with ID 0xe02ab24d. // // Solidity: function UpperUpperCollision() view returns(int256 _Res, int256 Res) -func (underscorer *Underscorer) UnpackUpperUpperCollision(data []byte) (UpperUpperCollisionOutput, error) { +func (underscorer *Underscorer) UnpackUpperUpperCollision(data []byte) (*UpperUpperCollisionOutput, error) { out, err := underscorer.abi.Unpack("UpperUpperCollision", data) - outstruct := new(UpperUpperCollisionOutput) if err != nil { - return *outstruct, err + return nil, err } + outstruct := new(UpperUpperCollisionOutput) outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - return *outstruct, err - + return outstruct, nil } -// PackUnderScoredFunc is the Go binding used to pack the parameters required for calling +// PackUnderScoredFunc is the Go binding used to pack the parameters required for calling, will panic for any error. // the contract method with ID 0x46546dbe. // // Solidity: function _under_scored_func() view returns(int256 _int) @@ -308,6 +357,14 @@ func (underscorer *Underscorer) PackUnderScoredFunc() []byte { return enc } +// PackUnderScoredFunc is the Go binding used to pack the parameters required for calling, return error if it failed to pack. +// the contract method with ID 0x46546dbe. +// +// Solidity: function _under_scored_func() view returns(int256 _int) +func (underscorer *Underscorer) TryPackUnderScoredFunc() ([]byte, error) { + return underscorer.abi.Pack("_under_scored_func") +} + // UnpackUnderScoredFunc is the Go binding that unpacks the parameters returned // from invoking the contract method with ID 0x46546dbe. // @@ -318,5 +375,5 @@ func (underscorer *Underscorer) UnpackUnderScoredFunc(data []byte) (*big.Int, er return new(big.Int), err } out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) - return out0, err + return out0, nil }