accounts/abi: don't capitalise argument names in pack functions. normalizeArgs returns args with names that start lowercase.

This commit is contained in:
Jared Wasinger 2025-02-17 19:41:45 -08:00
parent 8b506f5b6f
commit c5fa9c4182
19 changed files with 116 additions and 107 deletions

View file

@ -195,12 +195,15 @@ func normalizeArgs(args abi.Arguments) abi.Arguments {
for i, input := range args { for i, input := range args {
if isKeyWord(input.Name) { if isKeyWord(input.Name) {
args[i].Name = fmt.Sprintf("Arg%d", i) args[i].Name = fmt.Sprintf("arg%d", i)
} }
args[i].Name = abi.ToCamelCase(args[i].Name) args[i].Name = abi.ToCamelCase(args[i].Name)
if args[i].Name == "" { if args[i].Name == "" {
args[i].Name = fmt.Sprintf("Arg%d", i) args[i].Name = fmt.Sprintf("arg%d", i)
} else {
args[i].Name = strings.ToLower(args[i].Name[:1]) + args[i].Name[1:]
} }
for index := 0; ; index++ { for index := 0; ; index++ {
if !used[args[i].Name] { if !used[args[i].Name] {
used[args[i].Name] = true used[args[i].Name] = true

View file

@ -303,11 +303,11 @@ func TestNormalizeArgs(t *testing.T) {
expected []string expected []string
} }
for i, tc := range []normalizeArgsTc{ for i, tc := range []normalizeArgsTc{
{[]string{"arg1", "Arg1"}, []string{"Arg1", "Arg10"}}, {[]string{"arg1", "arg1"}, []string{"arg1", "arg10"}},
{[]string{"", ""}, []string{"Arg0", "Arg1"}}, {[]string{"", ""}, []string{"arg0", "arg1"}},
{[]string{"var", "const"}, []string{"Arg0", "Arg1"}}, {[]string{"var", "const"}, []string{"arg0", "arg1"}},
{[]string{"_res", "Res"}, []string{"Res", "Res0"}}, {[]string{"_res", "Res"}, []string{"res", "res0"}},
{[]string{"_", "__"}, []string{"Arg0", "Arg1"}}} { {[]string{"_", "__"}, []string{"arg0", "arg1"}}} {
var inpArgs abi.Arguments var inpArgs abi.Arguments
for _, inpArgName := range tc.inp { for _, inpArgName := range tc.inp {
inpArgs = append(inpArgs, abi.Argument{ inpArgs = append(inpArgs, abi.Argument{

View file

@ -29,7 +29,7 @@ var (
// {{.Name}} is an auto generated low-level Go binding around an user-defined struct. // {{.Name}} is an auto generated low-level Go binding around an user-defined struct.
type {{.Name}} struct { type {{.Name}} struct {
{{range $field := .Fields}} {{range $field := .Fields}}
{{$field.Name}} {{$field.Type}}{{end}} {{capitalise $field.Name}} {{$field.Type}}{{end}}
} }
{{end}} {{end}}
@ -108,7 +108,7 @@ var (
// method {{ .Normalized.Name }}. // method {{ .Normalized.Name }}.
type {{.Normalized.Name}}Output struct { type {{.Normalized.Name}}Output struct {
{{range .Normalized.Outputs}} {{range .Normalized.Outputs}}
{{.Name}} {{bindtype .Type $structs}}{{end}} {{capitalise .Name}} {{bindtype .Type $structs}}{{end}}
} }
{{ end }} {{ end }}
@ -128,9 +128,9 @@ var (
} }
{{- range $i, $t := .Normalized.Outputs}} {{- range $i, $t := .Normalized.Outputs}}
{{- if ispointertype .Type}} {{- if ispointertype .Type}}
outstruct.{{.Name}} = abi.ConvertType(out[{{$i}}], new({{underlyingbindtype .Type }})).({{bindtype .Type $structs}}) outstruct.{{capitalise .Name}} = abi.ConvertType(out[{{$i}}], new({{underlyingbindtype .Type }})).({{bindtype .Type $structs}})
{{- else }} {{- else }}
outstruct.{{.Name}} = *abi.ConvertType(out[{{$i}}], new({{bindtype .Type $structs}})).(*{{bindtype .Type $structs}}) outstruct.{{capitalise .Name}} = *abi.ConvertType(out[{{$i}}], new({{bindtype .Type $structs}})).(*{{bindtype .Type $structs}})
{{- end }} {{- end }}
{{- end }} {{- end }}
return *outstruct, err return *outstruct, err

View file

@ -55,8 +55,8 @@ func (c *CallbackParam) Instance(backend bind.ContractBackend, addr common.Addre
// the contract method with ID 0xd7a5aba2. // the contract method with ID 0xd7a5aba2.
// //
// Solidity: function test(function callback) returns() // Solidity: function test(function callback) returns()
func (callbackParam *CallbackParam) PackTest(Callback [24]byte) []byte { func (callbackParam *CallbackParam) PackTest(callback [24]byte) []byte {
enc, err := callbackParam.abi.Pack("test", Callback) enc, err := callbackParam.abi.Pack("test", callback)
if err != nil { if err != nil {
panic(err) panic(err)
} }

View file

@ -154,8 +154,8 @@ func (crowdsale *Crowdsale) UnpackDeadline(data []byte) (*big.Int, error) {
// the contract method with ID 0xdc0d3dff. // the contract method with ID 0xdc0d3dff.
// //
// Solidity: function funders(uint256 ) returns(address addr, uint256 amount) // Solidity: function funders(uint256 ) returns(address addr, uint256 amount)
func (crowdsale *Crowdsale) PackFunders(Arg0 *big.Int) []byte { func (crowdsale *Crowdsale) PackFunders(arg0 *big.Int) []byte {
enc, err := crowdsale.abi.Pack("funders", Arg0) enc, err := crowdsale.abi.Pack("funders", arg0)
if err != nil { if err != nil {
panic(err) panic(err)
} }

View file

@ -67,8 +67,8 @@ func (dAO *DAO) PackConstructor(minimumQuorumForProposals *big.Int, minutesForDe
// the contract method with ID 0x9644fcbd. // the contract method with ID 0x9644fcbd.
// //
// Solidity: function changeMembership(address targetMember, bool canVote, string memberName) returns() // Solidity: function changeMembership(address targetMember, bool canVote, string memberName) returns()
func (dAO *DAO) PackChangeMembership(TargetMember common.Address, CanVote bool, MemberName string) []byte { func (dAO *DAO) PackChangeMembership(targetMember common.Address, canVote bool, memberName string) []byte {
enc, err := dAO.abi.Pack("changeMembership", TargetMember, CanVote, MemberName) enc, err := dAO.abi.Pack("changeMembership", targetMember, canVote, memberName)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -79,8 +79,8 @@ func (dAO *DAO) PackChangeMembership(TargetMember common.Address, CanVote bool,
// the contract method with ID 0xbcca1fd3. // the contract method with ID 0xbcca1fd3.
// //
// Solidity: function changeVotingRules(uint256 minimumQuorumForProposals, uint256 minutesForDebate, int256 marginOfVotesForMajority) returns() // Solidity: function changeVotingRules(uint256 minimumQuorumForProposals, uint256 minutesForDebate, int256 marginOfVotesForMajority) returns()
func (dAO *DAO) PackChangeVotingRules(MinimumQuorumForProposals *big.Int, MinutesForDebate *big.Int, MarginOfVotesForMajority *big.Int) []byte { func (dAO *DAO) PackChangeVotingRules(minimumQuorumForProposals *big.Int, minutesForDebate *big.Int, marginOfVotesForMajority *big.Int) []byte {
enc, err := dAO.abi.Pack("changeVotingRules", MinimumQuorumForProposals, MinutesForDebate, MarginOfVotesForMajority) enc, err := dAO.abi.Pack("changeVotingRules", minimumQuorumForProposals, minutesForDebate, marginOfVotesForMajority)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -91,8 +91,8 @@ func (dAO *DAO) PackChangeVotingRules(MinimumQuorumForProposals *big.Int, Minute
// the contract method with ID 0xeceb2945. // the contract method with ID 0xeceb2945.
// //
// Solidity: function checkProposalCode(uint256 proposalNumber, address beneficiary, uint256 etherAmount, bytes transactionBytecode) returns(bool codeChecksOut) // Solidity: function checkProposalCode(uint256 proposalNumber, address beneficiary, uint256 etherAmount, bytes transactionBytecode) returns(bool codeChecksOut)
func (dAO *DAO) PackCheckProposalCode(ProposalNumber *big.Int, Beneficiary common.Address, EtherAmount *big.Int, TransactionBytecode []byte) []byte { func (dAO *DAO) PackCheckProposalCode(proposalNumber *big.Int, beneficiary common.Address, etherAmount *big.Int, transactionBytecode []byte) []byte {
enc, err := dAO.abi.Pack("checkProposalCode", ProposalNumber, Beneficiary, EtherAmount, TransactionBytecode) enc, err := dAO.abi.Pack("checkProposalCode", proposalNumber, beneficiary, etherAmount, transactionBytecode)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -141,8 +141,8 @@ func (dAO *DAO) UnpackDebatingPeriodInMinutes(data []byte) (*big.Int, error) {
// the contract method with ID 0x237e9492. // the contract method with ID 0x237e9492.
// //
// Solidity: function executeProposal(uint256 proposalNumber, bytes transactionBytecode) returns(int256 result) // Solidity: function executeProposal(uint256 proposalNumber, bytes transactionBytecode) returns(int256 result)
func (dAO *DAO) PackExecuteProposal(ProposalNumber *big.Int, TransactionBytecode []byte) []byte { func (dAO *DAO) PackExecuteProposal(proposalNumber *big.Int, transactionBytecode []byte) []byte {
enc, err := dAO.abi.Pack("executeProposal", ProposalNumber, TransactionBytecode) enc, err := dAO.abi.Pack("executeProposal", proposalNumber, transactionBytecode)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -191,8 +191,8 @@ func (dAO *DAO) UnpackMajorityMargin(data []byte) (*big.Int, error) {
// the contract method with ID 0x39106821. // the contract method with ID 0x39106821.
// //
// Solidity: function memberId(address ) returns(uint256) // Solidity: function memberId(address ) returns(uint256)
func (dAO *DAO) PackMemberId(Arg0 common.Address) []byte { func (dAO *DAO) PackMemberId(arg0 common.Address) []byte {
enc, err := dAO.abi.Pack("memberId", Arg0) enc, err := dAO.abi.Pack("memberId", arg0)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -216,8 +216,8 @@ func (dAO *DAO) UnpackMemberId(data []byte) (*big.Int, error) {
// the contract method with ID 0x5daf08ca. // the contract method with ID 0x5daf08ca.
// //
// Solidity: function members(uint256 ) returns(address member, bool canVote, string name, uint256 memberSince) // Solidity: function members(uint256 ) returns(address member, bool canVote, string name, uint256 memberSince)
func (dAO *DAO) PackMembers(Arg0 *big.Int) []byte { func (dAO *DAO) PackMembers(arg0 *big.Int) []byte {
enc, err := dAO.abi.Pack("members", Arg0) enc, err := dAO.abi.Pack("members", arg0)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -280,8 +280,8 @@ func (dAO *DAO) UnpackMinimumQuorum(data []byte) (*big.Int, error) {
// the contract method with ID 0xb1050da5. // the contract method with ID 0xb1050da5.
// //
// Solidity: function newProposal(address beneficiary, uint256 etherAmount, string JobDescription, bytes transactionBytecode) returns(uint256 proposalID) // Solidity: function newProposal(address beneficiary, uint256 etherAmount, string JobDescription, bytes transactionBytecode) returns(uint256 proposalID)
func (dAO *DAO) PackNewProposal(Beneficiary common.Address, EtherAmount *big.Int, JobDescription string, TransactionBytecode []byte) []byte { func (dAO *DAO) PackNewProposal(beneficiary common.Address, etherAmount *big.Int, jobDescription string, transactionBytecode []byte) []byte {
enc, err := dAO.abi.Pack("newProposal", Beneficiary, EtherAmount, JobDescription, TransactionBytecode) enc, err := dAO.abi.Pack("newProposal", beneficiary, etherAmount, jobDescription, transactionBytecode)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -355,8 +355,8 @@ func (dAO *DAO) UnpackOwner(data []byte) (common.Address, error) {
// the contract method with ID 0x013cf08b. // 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) // Solidity: function proposals(uint256 ) returns(address recipient, uint256 amount, string description, uint256 votingDeadline, bool executed, bool proposalPassed, uint256 numberOfVotes, int256 currentResult, bytes32 proposalHash)
func (dAO *DAO) PackProposals(Arg0 *big.Int) []byte { func (dAO *DAO) PackProposals(arg0 *big.Int) []byte {
enc, err := dAO.abi.Pack("proposals", Arg0) enc, err := dAO.abi.Pack("proposals", arg0)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -404,8 +404,8 @@ func (dAO *DAO) UnpackProposals(data []byte) (ProposalsOutput, error) {
// the contract method with ID 0xf2fde38b. // the contract method with ID 0xf2fde38b.
// //
// Solidity: function transferOwnership(address newOwner) returns() // Solidity: function transferOwnership(address newOwner) returns()
func (dAO *DAO) PackTransferOwnership(NewOwner common.Address) []byte { func (dAO *DAO) PackTransferOwnership(newOwner common.Address) []byte {
enc, err := dAO.abi.Pack("transferOwnership", NewOwner) enc, err := dAO.abi.Pack("transferOwnership", newOwner)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -416,8 +416,8 @@ func (dAO *DAO) PackTransferOwnership(NewOwner common.Address) []byte {
// the contract method with ID 0xd3c0715b. // the contract method with ID 0xd3c0715b.
// //
// Solidity: function vote(uint256 proposalNumber, bool supportsProposal, string justificationText) returns(uint256 voteID) // Solidity: function vote(uint256 proposalNumber, bool supportsProposal, string justificationText) returns(uint256 voteID)
func (dAO *DAO) PackVote(ProposalNumber *big.Int, SupportsProposal bool, JustificationText string) []byte { func (dAO *DAO) PackVote(proposalNumber *big.Int, supportsProposal bool, justificationText string) []byte {
enc, err := dAO.abi.Pack("vote", ProposalNumber, SupportsProposal, JustificationText) enc, err := dAO.abi.Pack("vote", proposalNumber, supportsProposal, justificationText)
if err != nil { if err != nil {
panic(err) panic(err)
} }

View file

@ -55,8 +55,8 @@ func (c *DeeplyNestedArray) Instance(backend bind.ContractBackend, addr common.A
// the contract method with ID 0x98ed1856. // the contract method with ID 0x98ed1856.
// //
// Solidity: function deepUint64Array(uint256 , uint256 , uint256 ) view returns(uint64) // Solidity: function deepUint64Array(uint256 , uint256 , uint256 ) view returns(uint64)
func (deeplyNestedArray *DeeplyNestedArray) PackDeepUint64Array(Arg0 *big.Int, Arg1 *big.Int, Arg2 *big.Int) []byte { func (deeplyNestedArray *DeeplyNestedArray) PackDeepUint64Array(arg0 *big.Int, arg1 *big.Int, arg2 *big.Int) []byte {
enc, err := deeplyNestedArray.abi.Pack("deepUint64Array", Arg0, Arg1, Arg2) enc, err := deeplyNestedArray.abi.Pack("deepUint64Array", arg0, arg1, arg2)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -105,8 +105,8 @@ func (deeplyNestedArray *DeeplyNestedArray) UnpackRetrieveDeepArray(data []byte)
// the contract method with ID 0x34424855. // the contract method with ID 0x34424855.
// //
// Solidity: function storeDeepUintArray(uint64[3][4][5] arr) returns() // Solidity: function storeDeepUintArray(uint64[3][4][5] arr) returns()
func (deeplyNestedArray *DeeplyNestedArray) PackStoreDeepUintArray(Arr [5][4][3]uint64) []byte { func (deeplyNestedArray *DeeplyNestedArray) PackStoreDeepUintArray(arr [5][4][3]uint64) []byte {
enc, err := deeplyNestedArray.abi.Pack("storeDeepUintArray", Arr) enc, err := deeplyNestedArray.abi.Pack("storeDeepUintArray", arr)
if err != nil { if err != nil {
panic(err) panic(err)
} }

View file

@ -54,8 +54,8 @@ func (c *InputChecker) Instance(backend bind.ContractBackend, addr common.Addres
// the contract method with ID 0x3e708e82. // the contract method with ID 0x3e708e82.
// //
// Solidity: function anonInput(string ) returns() // Solidity: function anonInput(string ) returns()
func (inputChecker *InputChecker) PackAnonInput(Arg0 string) []byte { func (inputChecker *InputChecker) PackAnonInput(arg0 string) []byte {
enc, err := inputChecker.abi.Pack("anonInput", Arg0) enc, err := inputChecker.abi.Pack("anonInput", arg0)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -66,8 +66,8 @@ func (inputChecker *InputChecker) PackAnonInput(Arg0 string) []byte {
// the contract method with ID 0x28160527. // the contract method with ID 0x28160527.
// //
// Solidity: function anonInputs(string , string ) returns() // Solidity: function anonInputs(string , string ) returns()
func (inputChecker *InputChecker) PackAnonInputs(Arg0 string, Arg1 string) []byte { func (inputChecker *InputChecker) PackAnonInputs(arg0 string, arg1 string) []byte {
enc, err := inputChecker.abi.Pack("anonInputs", Arg0, Arg1) enc, err := inputChecker.abi.Pack("anonInputs", arg0, arg1)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -78,8 +78,8 @@ func (inputChecker *InputChecker) PackAnonInputs(Arg0 string, Arg1 string) []byt
// the contract method with ID 0xc689ebdc. // the contract method with ID 0xc689ebdc.
// //
// Solidity: function mixedInputs(string , string str) returns() // Solidity: function mixedInputs(string , string str) returns()
func (inputChecker *InputChecker) PackMixedInputs(Arg0 string, Str string) []byte { func (inputChecker *InputChecker) PackMixedInputs(arg0 string, str string) []byte {
enc, err := inputChecker.abi.Pack("mixedInputs", Arg0, Str) enc, err := inputChecker.abi.Pack("mixedInputs", arg0, str)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -90,8 +90,8 @@ func (inputChecker *InputChecker) PackMixedInputs(Arg0 string, Str string) []byt
// the contract method with ID 0x0d402005. // the contract method with ID 0x0d402005.
// //
// Solidity: function namedInput(string str) returns() // Solidity: function namedInput(string str) returns()
func (inputChecker *InputChecker) PackNamedInput(Str string) []byte { func (inputChecker *InputChecker) PackNamedInput(str string) []byte {
enc, err := inputChecker.abi.Pack("namedInput", Str) enc, err := inputChecker.abi.Pack("namedInput", str)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -102,8 +102,8 @@ func (inputChecker *InputChecker) PackNamedInput(Str string) []byte {
// the contract method with ID 0x63c796ed. // the contract method with ID 0x63c796ed.
// //
// Solidity: function namedInputs(string str1, string str2) returns() // Solidity: function namedInputs(string str1, string str2) returns()
func (inputChecker *InputChecker) PackNamedInputs(Str1 string, Str2 string) []byte { func (inputChecker *InputChecker) PackNamedInputs(str1 string, str2 string) []byte {
enc, err := inputChecker.abi.Pack("namedInputs", Str1, Str2) enc, err := inputChecker.abi.Pack("namedInputs", str1, str2)
if err != nil { if err != nil {
panic(err) panic(err)
} }

View file

@ -92,8 +92,8 @@ func (interactor *Interactor) UnpackDeployString(data []byte) (string, error) {
// the contract method with ID 0xd736c513. // the contract method with ID 0xd736c513.
// //
// Solidity: function transact(string str) returns() // Solidity: function transact(string str) returns()
func (interactor *Interactor) PackTransact(Str string) []byte { func (interactor *Interactor) PackTransact(str string) []byte {
enc, err := interactor.abi.Pack("transact", Str) enc, err := interactor.abi.Pack("transact", str)
if err != nil { if err != nil {
panic(err) panic(err)
} }

View file

@ -61,8 +61,8 @@ func (c *NameConflict) Instance(backend bind.ContractBackend, addr common.Addres
// the contract method with ID 0xcce7b048. // the contract method with ID 0xcce7b048.
// //
// Solidity: function addRequest((bytes,bytes) req) pure returns() // Solidity: function addRequest((bytes,bytes) req) pure returns()
func (nameConflict *NameConflict) PackAddRequest(Req Oraclerequest) []byte { func (nameConflict *NameConflict) PackAddRequest(req Oraclerequest) []byte {
enc, err := nameConflict.abi.Pack("addRequest", Req) enc, err := nameConflict.abi.Pack("addRequest", req)
if err != nil { if err != nil {
panic(err) panic(err)
} }

View file

@ -55,8 +55,8 @@ func (c *Overload) Instance(backend bind.ContractBackend, addr common.Address) *
// the contract method with ID 0x04bc52f8. // the contract method with ID 0x04bc52f8.
// //
// Solidity: function foo(uint256 i, uint256 j) returns() // Solidity: function foo(uint256 i, uint256 j) returns()
func (overload *Overload) PackFoo(I *big.Int, J *big.Int) []byte { func (overload *Overload) PackFoo(i *big.Int, j *big.Int) []byte {
enc, err := overload.abi.Pack("foo", I, J) enc, err := overload.abi.Pack("foo", i, j)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -67,8 +67,8 @@ func (overload *Overload) PackFoo(I *big.Int, J *big.Int) []byte {
// the contract method with ID 0x2fbebd38. // the contract method with ID 0x2fbebd38.
// //
// Solidity: function foo(uint256 i) returns() // Solidity: function foo(uint256 i) returns()
func (overload *Overload) PackFoo0(I *big.Int) []byte { func (overload *Overload) PackFoo0(i *big.Int) []byte {
enc, err := overload.abi.Pack("foo0", I) enc, err := overload.abi.Pack("foo0", i)
if err != nil { if err != nil {
panic(err) panic(err)
} }

View file

@ -55,8 +55,8 @@ func (c *RangeKeyword) Instance(backend bind.ContractBackend, addr common.Addres
// the contract method with ID 0x527a119f. // the contract method with ID 0x527a119f.
// //
// Solidity: function functionWithKeywordParameter(uint256 range) pure returns() // Solidity: function functionWithKeywordParameter(uint256 range) pure returns()
func (rangeKeyword *RangeKeyword) PackFunctionWithKeywordParameter(Arg0 *big.Int) []byte { func (rangeKeyword *RangeKeyword) PackFunctionWithKeywordParameter(arg0 *big.Int) []byte {
enc, err := rangeKeyword.abi.Pack("functionWithKeywordParameter", Arg0) enc, err := rangeKeyword.abi.Pack("functionWithKeywordParameter", arg0)
if err != nil { if err != nil {
panic(err) panic(err)
} }

View file

@ -55,8 +55,8 @@ func (c *Slicer) Instance(backend bind.ContractBackend, addr common.Address) *bi
// the contract method with ID 0xbe1127a3. // the contract method with ID 0xbe1127a3.
// //
// Solidity: function echoAddresses(address[] input) returns(address[] output) // Solidity: function echoAddresses(address[] input) returns(address[] output)
func (slicer *Slicer) PackEchoAddresses(Input []common.Address) []byte { func (slicer *Slicer) PackEchoAddresses(input []common.Address) []byte {
enc, err := slicer.abi.Pack("echoAddresses", Input) enc, err := slicer.abi.Pack("echoAddresses", input)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -80,8 +80,8 @@ func (slicer *Slicer) UnpackEchoAddresses(data []byte) ([]common.Address, error)
// the contract method with ID 0xf637e589. // the contract method with ID 0xf637e589.
// //
// Solidity: function echoBools(bool[] input) returns(bool[] output) // Solidity: function echoBools(bool[] input) returns(bool[] output)
func (slicer *Slicer) PackEchoBools(Input []bool) []byte { func (slicer *Slicer) PackEchoBools(input []bool) []byte {
enc, err := slicer.abi.Pack("echoBools", Input) enc, err := slicer.abi.Pack("echoBools", input)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -105,8 +105,8 @@ func (slicer *Slicer) UnpackEchoBools(data []byte) ([]bool, error) {
// the contract method with ID 0xd88becc0. // the contract method with ID 0xd88becc0.
// //
// Solidity: function echoFancyInts(uint24[23] input) returns(uint24[23] output) // Solidity: function echoFancyInts(uint24[23] input) returns(uint24[23] output)
func (slicer *Slicer) PackEchoFancyInts(Input [23]*big.Int) []byte { func (slicer *Slicer) PackEchoFancyInts(input [23]*big.Int) []byte {
enc, err := slicer.abi.Pack("echoFancyInts", Input) enc, err := slicer.abi.Pack("echoFancyInts", input)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -130,8 +130,8 @@ func (slicer *Slicer) UnpackEchoFancyInts(data []byte) ([23]*big.Int, error) {
// the contract method with ID 0xe15a3db7. // the contract method with ID 0xe15a3db7.
// //
// Solidity: function echoInts(int256[] input) returns(int256[] output) // Solidity: function echoInts(int256[] input) returns(int256[] output)
func (slicer *Slicer) PackEchoInts(Input []*big.Int) []byte { func (slicer *Slicer) PackEchoInts(input []*big.Int) []byte {
enc, err := slicer.abi.Pack("echoInts", Input) enc, err := slicer.abi.Pack("echoInts", input)
if err != nil { if err != nil {
panic(err) panic(err)
} }

View file

@ -67,8 +67,8 @@ func (token *Token) PackConstructor(initialSupply *big.Int, tokenName string, de
// the contract method with ID 0xdd62ed3e. // the contract method with ID 0xdd62ed3e.
// //
// Solidity: function allowance(address , address ) returns(uint256) // Solidity: function allowance(address , address ) returns(uint256)
func (token *Token) PackAllowance(Arg0 common.Address, Arg1 common.Address) []byte { func (token *Token) PackAllowance(arg0 common.Address, arg1 common.Address) []byte {
enc, err := token.abi.Pack("allowance", Arg0, Arg1) enc, err := token.abi.Pack("allowance", arg0, arg1)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -92,8 +92,8 @@ func (token *Token) UnpackAllowance(data []byte) (*big.Int, error) {
// the contract method with ID 0xcae9ca51. // the contract method with ID 0xcae9ca51.
// //
// Solidity: function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns(bool success) // Solidity: function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns(bool success)
func (token *Token) PackApproveAndCall(Spender common.Address, Value *big.Int, ExtraData []byte) []byte { func (token *Token) PackApproveAndCall(spender common.Address, value *big.Int, extraData []byte) []byte {
enc, err := token.abi.Pack("approveAndCall", Spender, Value, ExtraData) enc, err := token.abi.Pack("approveAndCall", spender, value, extraData)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -117,8 +117,8 @@ func (token *Token) UnpackApproveAndCall(data []byte) (bool, error) {
// the contract method with ID 0x70a08231. // the contract method with ID 0x70a08231.
// //
// Solidity: function balanceOf(address ) returns(uint256) // Solidity: function balanceOf(address ) returns(uint256)
func (token *Token) PackBalanceOf(Arg0 common.Address) []byte { func (token *Token) PackBalanceOf(arg0 common.Address) []byte {
enc, err := token.abi.Pack("balanceOf", Arg0) enc, err := token.abi.Pack("balanceOf", arg0)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -192,8 +192,8 @@ func (token *Token) UnpackName(data []byte) (string, error) {
// the contract method with ID 0xdc3080f2. // the contract method with ID 0xdc3080f2.
// //
// Solidity: function spentAllowance(address , address ) returns(uint256) // Solidity: function spentAllowance(address , address ) returns(uint256)
func (token *Token) PackSpentAllowance(Arg0 common.Address, Arg1 common.Address) []byte { func (token *Token) PackSpentAllowance(arg0 common.Address, arg1 common.Address) []byte {
enc, err := token.abi.Pack("spentAllowance", Arg0, Arg1) enc, err := token.abi.Pack("spentAllowance", arg0, arg1)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -242,8 +242,8 @@ func (token *Token) UnpackSymbol(data []byte) (string, error) {
// the contract method with ID 0xa9059cbb. // the contract method with ID 0xa9059cbb.
// //
// Solidity: function transfer(address _to, uint256 _value) returns() // Solidity: function transfer(address _to, uint256 _value) returns()
func (token *Token) PackTransfer(To common.Address, Value *big.Int) []byte { func (token *Token) PackTransfer(to common.Address, value *big.Int) []byte {
enc, err := token.abi.Pack("transfer", To, Value) enc, err := token.abi.Pack("transfer", to, value)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -254,8 +254,8 @@ func (token *Token) PackTransfer(To common.Address, Value *big.Int) []byte {
// the contract method with ID 0x23b872dd. // the contract method with ID 0x23b872dd.
// //
// Solidity: function transferFrom(address _from, address _to, uint256 _value) returns(bool success) // Solidity: function transferFrom(address _from, address _to, uint256 _value) returns(bool success)
func (token *Token) PackTransferFrom(From common.Address, To common.Address, Value *big.Int) []byte { func (token *Token) PackTransferFrom(from common.Address, to common.Address, value *big.Int) []byte {
enc, err := token.abi.Pack("transferFrom", From, To, Value) enc, err := token.abi.Pack("transferFrom", from, to, value)
if err != nil { if err != nil {
panic(err) panic(err)
} }

View file

@ -80,8 +80,8 @@ func (c *Tuple) Instance(backend bind.ContractBackend, addr common.Address) *bin
// the contract method with ID 0x443c79b4. // 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[]) // Solidity: function func1((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) pure returns((uint256,uint256[],(uint256,uint256)[]), (uint256,uint256)[2][], (uint256,uint256)[][2], (uint256,uint256[],(uint256,uint256)[])[], uint256[])
func (tuple *Tuple) PackFunc1(A TupleS, B [][2]TupleT, C [2][]TupleT, D []TupleS, E []*big.Int) []byte { func (tuple *Tuple) PackFunc1(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) []byte {
enc, err := tuple.abi.Pack("func1", A, B, C, D, E) enc, err := tuple.abi.Pack("func1", a, b, c, d, e)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -121,8 +121,8 @@ func (tuple *Tuple) UnpackFunc1(data []byte) (Func1Output, error) {
// the contract method with ID 0xd0062cdd. // 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() // Solidity: function func2((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) returns()
func (tuple *Tuple) PackFunc2(A TupleS, B [][2]TupleT, C [2][]TupleT, D []TupleS, E []*big.Int) []byte { func (tuple *Tuple) PackFunc2(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) []byte {
enc, err := tuple.abi.Pack("func2", A, B, C, D, E) enc, err := tuple.abi.Pack("func2", a, b, c, d, e)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -133,8 +133,8 @@ func (tuple *Tuple) PackFunc2(A TupleS, B [][2]TupleT, C [2][]TupleT, D []TupleS
// the contract method with ID 0xe4d9a43b. // the contract method with ID 0xe4d9a43b.
// //
// Solidity: function func3((uint16,uint16)[] ) pure returns() // Solidity: function func3((uint16,uint16)[] ) pure returns()
func (tuple *Tuple) PackFunc3(Arg0 []TupleQ) []byte { func (tuple *Tuple) PackFunc3(arg0 []TupleQ) []byte {
enc, err := tuple.abi.Pack("func3", Arg0) enc, err := tuple.abi.Pack("func3", arg0)
if err != nil { if err != nil {
panic(err) panic(err)
} }

View file

@ -62,8 +62,8 @@ func (c *DB) Instance(backend bind.ContractBackend, addr common.Address) *bind.B
// the contract method with ID 0x9507d39a. // the contract method with ID 0x9507d39a.
// //
// Solidity: function get(uint256 k) returns(uint256) // Solidity: function get(uint256 k) returns(uint256)
func (dB *DB) PackGet(K *big.Int) []byte { func (dB *DB) PackGet(k *big.Int) []byte {
enc, err := dB.abi.Pack("get", K) enc, err := dB.abi.Pack("get", k)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -186,8 +186,8 @@ func (dB *DB) UnpackGetStatsStruct(data []byte) (DBStats, error) {
// the contract method with ID 0x1d834a1b. // the contract method with ID 0x1d834a1b.
// //
// Solidity: function insert(uint256 k, uint256 v) returns(uint256) // Solidity: function insert(uint256 k, uint256 v) returns(uint256)
func (dB *DB) PackInsert(K *big.Int, V *big.Int) []byte { func (dB *DB) PackInsert(k *big.Int, v *big.Int) []byte {
enc, err := dB.abi.Pack("insert", K, V) enc, err := dB.abi.Pack("insert", k, v)
if err != nil { if err != nil {
panic(err) panic(err)
} }

View file

@ -60,7 +60,13 @@ contract DB {
balance += msg.value; balance += msg.value;
} }
fallback() external {
}
/*
fallback(bytes calldata _input) external returns (bytes memory _output) { fallback(bytes calldata _input) external returns (bytes memory _output) {
_output = _input; _output = _input;
} }
*/
} }

View file

@ -100,8 +100,8 @@ func (c *C) UnpackDoSomethingWithManyArgs(data []byte) (DoSomethingWithManyArgsO
// the contract method with ID 0xedcdc894. // the contract method with ID 0xedcdc894.
// //
// Solidity: function DoSomethingWithPoint((uint256,uint256) p) pure returns((uint256,uint256)) // Solidity: function DoSomethingWithPoint((uint256,uint256) p) pure returns((uint256,uint256))
func (c *C) PackDoSomethingWithPoint(P CPoint) []byte { func (c *C) PackDoSomethingWithPoint(p CPoint) []byte {
enc, err := c.abi.Pack("DoSomethingWithPoint", P) enc, err := c.abi.Pack("DoSomethingWithPoint", p)
if err != nil { if err != nil {
panic(err) panic(err)
} }

View file

@ -71,8 +71,8 @@ func (c1 *C1) PackConstructor(v1 *big.Int, v2 *big.Int) []byte {
// the contract method with ID 0x2ad11272. // the contract method with ID 0x2ad11272.
// //
// Solidity: function Do(uint256 val) pure returns(uint256 res) // Solidity: function Do(uint256 val) pure returns(uint256 res)
func (c1 *C1) PackDo(Val *big.Int) []byte { func (c1 *C1) PackDo(val *big.Int) []byte {
enc, err := c1.abi.Pack("Do", Val) enc, err := c1.abi.Pack("Do", val)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -139,8 +139,8 @@ func (c2 *C2) PackConstructor(v1 *big.Int, v2 *big.Int) []byte {
// the contract method with ID 0x2ad11272. // the contract method with ID 0x2ad11272.
// //
// Solidity: function Do(uint256 val) pure returns(uint256 res) // Solidity: function Do(uint256 val) pure returns(uint256 res)
func (c2 *C2) PackDo(Val *big.Int) []byte { func (c2 *C2) PackDo(val *big.Int) []byte {
enc, err := c2.abi.Pack("Do", Val) enc, err := c2.abi.Pack("Do", val)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -191,8 +191,8 @@ func (c *L1) Instance(backend bind.ContractBackend, addr common.Address) *bind.B
// the contract method with ID 0x2ad11272. // the contract method with ID 0x2ad11272.
// //
// Solidity: function Do(uint256 val) pure returns(uint256) // Solidity: function Do(uint256 val) pure returns(uint256)
func (l1 *L1) PackDo(Val *big.Int) []byte { func (l1 *L1) PackDo(val *big.Int) []byte {
enc, err := l1.abi.Pack("Do", Val) enc, err := l1.abi.Pack("Do", val)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -246,8 +246,8 @@ func (c *L2) Instance(backend bind.ContractBackend, addr common.Address) *bind.B
// the contract method with ID 0x2ad11272. // the contract method with ID 0x2ad11272.
// //
// Solidity: function Do(uint256 val) pure returns(uint256) // Solidity: function Do(uint256 val) pure returns(uint256)
func (l2 *L2) PackDo(Val *big.Int) []byte { func (l2 *L2) PackDo(val *big.Int) []byte {
enc, err := l2.abi.Pack("Do", Val) enc, err := l2.abi.Pack("Do", val)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -301,8 +301,8 @@ func (c *L2b) Instance(backend bind.ContractBackend, addr common.Address) *bind.
// the contract method with ID 0x2ad11272. // the contract method with ID 0x2ad11272.
// //
// Solidity: function Do(uint256 val) pure returns(uint256) // Solidity: function Do(uint256 val) pure returns(uint256)
func (l2b *L2b) PackDo(Val *big.Int) []byte { func (l2b *L2b) PackDo(val *big.Int) []byte {
enc, err := l2b.abi.Pack("Do", Val) enc, err := l2b.abi.Pack("Do", val)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -353,8 +353,8 @@ func (c *L3) Instance(backend bind.ContractBackend, addr common.Address) *bind.B
// the contract method with ID 0x2ad11272. // the contract method with ID 0x2ad11272.
// //
// Solidity: function Do(uint256 val) pure returns(uint256) // Solidity: function Do(uint256 val) pure returns(uint256)
func (l3 *L3) PackDo(Val *big.Int) []byte { func (l3 *L3) PackDo(val *big.Int) []byte {
enc, err := l3.abi.Pack("Do", Val) enc, err := l3.abi.Pack("Do", val)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -409,8 +409,8 @@ func (c *L4) Instance(backend bind.ContractBackend, addr common.Address) *bind.B
// the contract method with ID 0x2ad11272. // the contract method with ID 0x2ad11272.
// //
// Solidity: function Do(uint256 val) pure returns(uint256) // Solidity: function Do(uint256 val) pure returns(uint256)
func (l4 *L4) PackDo(Val *big.Int) []byte { func (l4 *L4) PackDo(val *big.Int) []byte {
enc, err := l4.abi.Pack("Do", Val) enc, err := l4.abi.Pack("Do", val)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -464,8 +464,8 @@ func (c *L4b) Instance(backend bind.ContractBackend, addr common.Address) *bind.
// the contract method with ID 0x2ad11272. // the contract method with ID 0x2ad11272.
// //
// Solidity: function Do(uint256 val) pure returns(uint256) // Solidity: function Do(uint256 val) pure returns(uint256)
func (l4b *L4b) PackDo(Val *big.Int) []byte { func (l4b *L4b) PackDo(val *big.Int) []byte {
enc, err := l4b.abi.Pack("Do", Val) enc, err := l4b.abi.Pack("Do", val)
if err != nil { if err != nil {
panic(err) panic(err)
} }