mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
accounts/abi: don't capitalise argument names in pack functions. normalizeArgs returns args with names that start lowercase.
This commit is contained in:
parent
8b506f5b6f
commit
c5fa9c4182
19 changed files with 116 additions and 107 deletions
|
|
@ -195,12 +195,15 @@ func normalizeArgs(args abi.Arguments) abi.Arguments {
|
|||
|
||||
for i, input := range args {
|
||||
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)
|
||||
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++ {
|
||||
if !used[args[i].Name] {
|
||||
used[args[i].Name] = true
|
||||
|
|
|
|||
|
|
@ -303,11 +303,11 @@ func TestNormalizeArgs(t *testing.T) {
|
|||
expected []string
|
||||
}
|
||||
for i, tc := range []normalizeArgsTc{
|
||||
{[]string{"arg1", "Arg1"}, []string{"Arg1", "Arg10"}},
|
||||
{[]string{"", ""}, []string{"Arg0", "Arg1"}},
|
||||
{[]string{"var", "const"}, []string{"Arg0", "Arg1"}},
|
||||
{[]string{"_res", "Res"}, []string{"Res", "Res0"}},
|
||||
{[]string{"_", "__"}, []string{"Arg0", "Arg1"}}} {
|
||||
{[]string{"arg1", "arg1"}, []string{"arg1", "arg10"}},
|
||||
{[]string{"", ""}, []string{"arg0", "arg1"}},
|
||||
{[]string{"var", "const"}, []string{"arg0", "arg1"}},
|
||||
{[]string{"_res", "Res"}, []string{"res", "res0"}},
|
||||
{[]string{"_", "__"}, []string{"arg0", "arg1"}}} {
|
||||
var inpArgs abi.Arguments
|
||||
for _, inpArgName := range tc.inp {
|
||||
inpArgs = append(inpArgs, abi.Argument{
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ var (
|
|||
// {{.Name}} is an auto generated low-level Go binding around an user-defined struct.
|
||||
type {{.Name}} struct {
|
||||
{{range $field := .Fields}}
|
||||
{{$field.Name}} {{$field.Type}}{{end}}
|
||||
{{capitalise $field.Name}} {{$field.Type}}{{end}}
|
||||
}
|
||||
{{end}}
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ var (
|
|||
// method {{ .Normalized.Name }}.
|
||||
type {{.Normalized.Name}}Output struct {
|
||||
{{range .Normalized.Outputs}}
|
||||
{{.Name}} {{bindtype .Type $structs}}{{end}}
|
||||
{{capitalise .Name}} {{bindtype .Type $structs}}{{end}}
|
||||
}
|
||||
{{ end }}
|
||||
|
||||
|
|
@ -128,9 +128,9 @@ var (
|
|||
}
|
||||
{{- range $i, $t := .Normalized.Outputs}}
|
||||
{{- 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 }}
|
||||
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 }}
|
||||
return *outstruct, err
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ func (c *CallbackParam) Instance(backend bind.ContractBackend, addr common.Addre
|
|||
// the contract method with ID 0xd7a5aba2.
|
||||
//
|
||||
// Solidity: function test(function callback) returns()
|
||||
func (callbackParam *CallbackParam) PackTest(Callback [24]byte) []byte {
|
||||
enc, err := callbackParam.abi.Pack("test", Callback)
|
||||
func (callbackParam *CallbackParam) PackTest(callback [24]byte) []byte {
|
||||
enc, err := callbackParam.abi.Pack("test", callback)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,8 +154,8 @@ func (crowdsale *Crowdsale) UnpackDeadline(data []byte) (*big.Int, error) {
|
|||
// the contract method with ID 0xdc0d3dff.
|
||||
//
|
||||
// Solidity: function funders(uint256 ) returns(address addr, uint256 amount)
|
||||
func (crowdsale *Crowdsale) PackFunders(Arg0 *big.Int) []byte {
|
||||
enc, err := crowdsale.abi.Pack("funders", Arg0)
|
||||
func (crowdsale *Crowdsale) PackFunders(arg0 *big.Int) []byte {
|
||||
enc, err := crowdsale.abi.Pack("funders", arg0)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
40
accounts/abi/abigen/testdata/v2/dao.go.txt
vendored
40
accounts/abi/abigen/testdata/v2/dao.go.txt
vendored
|
|
@ -67,8 +67,8 @@ func (dAO *DAO) PackConstructor(minimumQuorumForProposals *big.Int, minutesForDe
|
|||
// the contract method with ID 0x9644fcbd.
|
||||
//
|
||||
// Solidity: function changeMembership(address targetMember, bool canVote, string memberName) returns()
|
||||
func (dAO *DAO) PackChangeMembership(TargetMember common.Address, CanVote bool, MemberName string) []byte {
|
||||
enc, err := dAO.abi.Pack("changeMembership", TargetMember, CanVote, MemberName)
|
||||
func (dAO *DAO) PackChangeMembership(targetMember common.Address, canVote bool, memberName string) []byte {
|
||||
enc, err := dAO.abi.Pack("changeMembership", targetMember, canVote, memberName)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -79,8 +79,8 @@ func (dAO *DAO) PackChangeMembership(TargetMember common.Address, CanVote bool,
|
|||
// the contract method with ID 0xbcca1fd3.
|
||||
//
|
||||
// Solidity: function changeVotingRules(uint256 minimumQuorumForProposals, uint256 minutesForDebate, int256 marginOfVotesForMajority) returns()
|
||||
func (dAO *DAO) PackChangeVotingRules(MinimumQuorumForProposals *big.Int, MinutesForDebate *big.Int, MarginOfVotesForMajority *big.Int) []byte {
|
||||
enc, err := dAO.abi.Pack("changeVotingRules", MinimumQuorumForProposals, MinutesForDebate, MarginOfVotesForMajority)
|
||||
func (dAO *DAO) PackChangeVotingRules(minimumQuorumForProposals *big.Int, minutesForDebate *big.Int, marginOfVotesForMajority *big.Int) []byte {
|
||||
enc, err := dAO.abi.Pack("changeVotingRules", minimumQuorumForProposals, minutesForDebate, marginOfVotesForMajority)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -91,8 +91,8 @@ func (dAO *DAO) PackChangeVotingRules(MinimumQuorumForProposals *big.Int, Minute
|
|||
// the contract method with ID 0xeceb2945.
|
||||
//
|
||||
// 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 {
|
||||
enc, err := dAO.abi.Pack("checkProposalCode", ProposalNumber, Beneficiary, EtherAmount, TransactionBytecode)
|
||||
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)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -141,8 +141,8 @@ func (dAO *DAO) UnpackDebatingPeriodInMinutes(data []byte) (*big.Int, error) {
|
|||
// the contract method with ID 0x237e9492.
|
||||
//
|
||||
// Solidity: function executeProposal(uint256 proposalNumber, bytes transactionBytecode) returns(int256 result)
|
||||
func (dAO *DAO) PackExecuteProposal(ProposalNumber *big.Int, TransactionBytecode []byte) []byte {
|
||||
enc, err := dAO.abi.Pack("executeProposal", ProposalNumber, TransactionBytecode)
|
||||
func (dAO *DAO) PackExecuteProposal(proposalNumber *big.Int, transactionBytecode []byte) []byte {
|
||||
enc, err := dAO.abi.Pack("executeProposal", proposalNumber, transactionBytecode)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -191,8 +191,8 @@ func (dAO *DAO) UnpackMajorityMargin(data []byte) (*big.Int, error) {
|
|||
// the contract method with ID 0x39106821.
|
||||
//
|
||||
// Solidity: function memberId(address ) returns(uint256)
|
||||
func (dAO *DAO) PackMemberId(Arg0 common.Address) []byte {
|
||||
enc, err := dAO.abi.Pack("memberId", Arg0)
|
||||
func (dAO *DAO) PackMemberId(arg0 common.Address) []byte {
|
||||
enc, err := dAO.abi.Pack("memberId", arg0)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -216,8 +216,8 @@ func (dAO *DAO) UnpackMemberId(data []byte) (*big.Int, error) {
|
|||
// the contract method with ID 0x5daf08ca.
|
||||
//
|
||||
// Solidity: function members(uint256 ) returns(address member, bool canVote, string name, uint256 memberSince)
|
||||
func (dAO *DAO) PackMembers(Arg0 *big.Int) []byte {
|
||||
enc, err := dAO.abi.Pack("members", Arg0)
|
||||
func (dAO *DAO) PackMembers(arg0 *big.Int) []byte {
|
||||
enc, err := dAO.abi.Pack("members", arg0)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -280,8 +280,8 @@ func (dAO *DAO) UnpackMinimumQuorum(data []byte) (*big.Int, error) {
|
|||
// the contract method with ID 0xb1050da5.
|
||||
//
|
||||
// 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 {
|
||||
enc, err := dAO.abi.Pack("newProposal", Beneficiary, EtherAmount, JobDescription, TransactionBytecode)
|
||||
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)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -355,8 +355,8 @@ func (dAO *DAO) UnpackOwner(data []byte) (common.Address, 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)
|
||||
func (dAO *DAO) PackProposals(Arg0 *big.Int) []byte {
|
||||
enc, err := dAO.abi.Pack("proposals", Arg0)
|
||||
func (dAO *DAO) PackProposals(arg0 *big.Int) []byte {
|
||||
enc, err := dAO.abi.Pack("proposals", arg0)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -404,8 +404,8 @@ func (dAO *DAO) UnpackProposals(data []byte) (ProposalsOutput, error) {
|
|||
// the contract method with ID 0xf2fde38b.
|
||||
//
|
||||
// Solidity: function transferOwnership(address newOwner) returns()
|
||||
func (dAO *DAO) PackTransferOwnership(NewOwner common.Address) []byte {
|
||||
enc, err := dAO.abi.Pack("transferOwnership", NewOwner)
|
||||
func (dAO *DAO) PackTransferOwnership(newOwner common.Address) []byte {
|
||||
enc, err := dAO.abi.Pack("transferOwnership", newOwner)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -416,8 +416,8 @@ func (dAO *DAO) PackTransferOwnership(NewOwner common.Address) []byte {
|
|||
// the contract method with ID 0xd3c0715b.
|
||||
//
|
||||
// Solidity: function vote(uint256 proposalNumber, bool supportsProposal, string justificationText) returns(uint256 voteID)
|
||||
func (dAO *DAO) PackVote(ProposalNumber *big.Int, SupportsProposal bool, JustificationText string) []byte {
|
||||
enc, err := dAO.abi.Pack("vote", ProposalNumber, SupportsProposal, JustificationText)
|
||||
func (dAO *DAO) PackVote(proposalNumber *big.Int, supportsProposal bool, justificationText string) []byte {
|
||||
enc, err := dAO.abi.Pack("vote", proposalNumber, supportsProposal, justificationText)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ func (c *DeeplyNestedArray) Instance(backend bind.ContractBackend, addr common.A
|
|||
// the contract method with ID 0x98ed1856.
|
||||
//
|
||||
// Solidity: function deepUint64Array(uint256 , uint256 , uint256 ) view returns(uint64)
|
||||
func (deeplyNestedArray *DeeplyNestedArray) PackDeepUint64Array(Arg0 *big.Int, Arg1 *big.Int, Arg2 *big.Int) []byte {
|
||||
enc, err := deeplyNestedArray.abi.Pack("deepUint64Array", Arg0, Arg1, Arg2)
|
||||
func (deeplyNestedArray *DeeplyNestedArray) PackDeepUint64Array(arg0 *big.Int, arg1 *big.Int, arg2 *big.Int) []byte {
|
||||
enc, err := deeplyNestedArray.abi.Pack("deepUint64Array", arg0, arg1, arg2)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -105,8 +105,8 @@ func (deeplyNestedArray *DeeplyNestedArray) UnpackRetrieveDeepArray(data []byte)
|
|||
// the contract method with ID 0x34424855.
|
||||
//
|
||||
// Solidity: function storeDeepUintArray(uint64[3][4][5] arr) returns()
|
||||
func (deeplyNestedArray *DeeplyNestedArray) PackStoreDeepUintArray(Arr [5][4][3]uint64) []byte {
|
||||
enc, err := deeplyNestedArray.abi.Pack("storeDeepUintArray", Arr)
|
||||
func (deeplyNestedArray *DeeplyNestedArray) PackStoreDeepUintArray(arr [5][4][3]uint64) []byte {
|
||||
enc, err := deeplyNestedArray.abi.Pack("storeDeepUintArray", arr)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ func (c *InputChecker) Instance(backend bind.ContractBackend, addr common.Addres
|
|||
// the contract method with ID 0x3e708e82.
|
||||
//
|
||||
// Solidity: function anonInput(string ) returns()
|
||||
func (inputChecker *InputChecker) PackAnonInput(Arg0 string) []byte {
|
||||
enc, err := inputChecker.abi.Pack("anonInput", Arg0)
|
||||
func (inputChecker *InputChecker) PackAnonInput(arg0 string) []byte {
|
||||
enc, err := inputChecker.abi.Pack("anonInput", arg0)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -66,8 +66,8 @@ func (inputChecker *InputChecker) PackAnonInput(Arg0 string) []byte {
|
|||
// the contract method with ID 0x28160527.
|
||||
//
|
||||
// Solidity: function anonInputs(string , string ) returns()
|
||||
func (inputChecker *InputChecker) PackAnonInputs(Arg0 string, Arg1 string) []byte {
|
||||
enc, err := inputChecker.abi.Pack("anonInputs", Arg0, Arg1)
|
||||
func (inputChecker *InputChecker) PackAnonInputs(arg0 string, arg1 string) []byte {
|
||||
enc, err := inputChecker.abi.Pack("anonInputs", arg0, arg1)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -78,8 +78,8 @@ func (inputChecker *InputChecker) PackAnonInputs(Arg0 string, Arg1 string) []byt
|
|||
// the contract method with ID 0xc689ebdc.
|
||||
//
|
||||
// Solidity: function mixedInputs(string , string str) returns()
|
||||
func (inputChecker *InputChecker) PackMixedInputs(Arg0 string, Str string) []byte {
|
||||
enc, err := inputChecker.abi.Pack("mixedInputs", Arg0, Str)
|
||||
func (inputChecker *InputChecker) PackMixedInputs(arg0 string, str string) []byte {
|
||||
enc, err := inputChecker.abi.Pack("mixedInputs", arg0, str)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -90,8 +90,8 @@ func (inputChecker *InputChecker) PackMixedInputs(Arg0 string, Str string) []byt
|
|||
// the contract method with ID 0x0d402005.
|
||||
//
|
||||
// Solidity: function namedInput(string str) returns()
|
||||
func (inputChecker *InputChecker) PackNamedInput(Str string) []byte {
|
||||
enc, err := inputChecker.abi.Pack("namedInput", Str)
|
||||
func (inputChecker *InputChecker) PackNamedInput(str string) []byte {
|
||||
enc, err := inputChecker.abi.Pack("namedInput", str)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -102,8 +102,8 @@ func (inputChecker *InputChecker) PackNamedInput(Str string) []byte {
|
|||
// the contract method with ID 0x63c796ed.
|
||||
//
|
||||
// Solidity: function namedInputs(string str1, string str2) returns()
|
||||
func (inputChecker *InputChecker) PackNamedInputs(Str1 string, Str2 string) []byte {
|
||||
enc, err := inputChecker.abi.Pack("namedInputs", Str1, Str2)
|
||||
func (inputChecker *InputChecker) PackNamedInputs(str1 string, str2 string) []byte {
|
||||
enc, err := inputChecker.abi.Pack("namedInputs", str1, str2)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,8 +92,8 @@ func (interactor *Interactor) UnpackDeployString(data []byte) (string, error) {
|
|||
// the contract method with ID 0xd736c513.
|
||||
//
|
||||
// Solidity: function transact(string str) returns()
|
||||
func (interactor *Interactor) PackTransact(Str string) []byte {
|
||||
enc, err := interactor.abi.Pack("transact", Str)
|
||||
func (interactor *Interactor) PackTransact(str string) []byte {
|
||||
enc, err := interactor.abi.Pack("transact", str)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,8 +61,8 @@ func (c *NameConflict) Instance(backend bind.ContractBackend, addr common.Addres
|
|||
// the contract method with ID 0xcce7b048.
|
||||
//
|
||||
// Solidity: function addRequest((bytes,bytes) req) pure returns()
|
||||
func (nameConflict *NameConflict) PackAddRequest(Req Oraclerequest) []byte {
|
||||
enc, err := nameConflict.abi.Pack("addRequest", Req)
|
||||
func (nameConflict *NameConflict) PackAddRequest(req Oraclerequest) []byte {
|
||||
enc, err := nameConflict.abi.Pack("addRequest", req)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ func (c *Overload) Instance(backend bind.ContractBackend, addr common.Address) *
|
|||
// the contract method with ID 0x04bc52f8.
|
||||
//
|
||||
// Solidity: function foo(uint256 i, uint256 j) returns()
|
||||
func (overload *Overload) PackFoo(I *big.Int, J *big.Int) []byte {
|
||||
enc, err := overload.abi.Pack("foo", I, J)
|
||||
func (overload *Overload) PackFoo(i *big.Int, j *big.Int) []byte {
|
||||
enc, err := overload.abi.Pack("foo", i, j)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -67,8 +67,8 @@ func (overload *Overload) PackFoo(I *big.Int, J *big.Int) []byte {
|
|||
// the contract method with ID 0x2fbebd38.
|
||||
//
|
||||
// Solidity: function foo(uint256 i) returns()
|
||||
func (overload *Overload) PackFoo0(I *big.Int) []byte {
|
||||
enc, err := overload.abi.Pack("foo0", I)
|
||||
func (overload *Overload) PackFoo0(i *big.Int) []byte {
|
||||
enc, err := overload.abi.Pack("foo0", i)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ func (c *RangeKeyword) Instance(backend bind.ContractBackend, addr common.Addres
|
|||
// the contract method with ID 0x527a119f.
|
||||
//
|
||||
// Solidity: function functionWithKeywordParameter(uint256 range) pure returns()
|
||||
func (rangeKeyword *RangeKeyword) PackFunctionWithKeywordParameter(Arg0 *big.Int) []byte {
|
||||
enc, err := rangeKeyword.abi.Pack("functionWithKeywordParameter", Arg0)
|
||||
func (rangeKeyword *RangeKeyword) PackFunctionWithKeywordParameter(arg0 *big.Int) []byte {
|
||||
enc, err := rangeKeyword.abi.Pack("functionWithKeywordParameter", arg0)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
16
accounts/abi/abigen/testdata/v2/slicer.go.txt
vendored
16
accounts/abi/abigen/testdata/v2/slicer.go.txt
vendored
|
|
@ -55,8 +55,8 @@ func (c *Slicer) Instance(backend bind.ContractBackend, addr common.Address) *bi
|
|||
// the contract method with ID 0xbe1127a3.
|
||||
//
|
||||
// Solidity: function echoAddresses(address[] input) returns(address[] output)
|
||||
func (slicer *Slicer) PackEchoAddresses(Input []common.Address) []byte {
|
||||
enc, err := slicer.abi.Pack("echoAddresses", Input)
|
||||
func (slicer *Slicer) PackEchoAddresses(input []common.Address) []byte {
|
||||
enc, err := slicer.abi.Pack("echoAddresses", input)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -80,8 +80,8 @@ func (slicer *Slicer) UnpackEchoAddresses(data []byte) ([]common.Address, error)
|
|||
// the contract method with ID 0xf637e589.
|
||||
//
|
||||
// Solidity: function echoBools(bool[] input) returns(bool[] output)
|
||||
func (slicer *Slicer) PackEchoBools(Input []bool) []byte {
|
||||
enc, err := slicer.abi.Pack("echoBools", Input)
|
||||
func (slicer *Slicer) PackEchoBools(input []bool) []byte {
|
||||
enc, err := slicer.abi.Pack("echoBools", input)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -105,8 +105,8 @@ func (slicer *Slicer) UnpackEchoBools(data []byte) ([]bool, error) {
|
|||
// the contract method with ID 0xd88becc0.
|
||||
//
|
||||
// Solidity: function echoFancyInts(uint24[23] input) returns(uint24[23] output)
|
||||
func (slicer *Slicer) PackEchoFancyInts(Input [23]*big.Int) []byte {
|
||||
enc, err := slicer.abi.Pack("echoFancyInts", Input)
|
||||
func (slicer *Slicer) PackEchoFancyInts(input [23]*big.Int) []byte {
|
||||
enc, err := slicer.abi.Pack("echoFancyInts", input)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -130,8 +130,8 @@ func (slicer *Slicer) UnpackEchoFancyInts(data []byte) ([23]*big.Int, error) {
|
|||
// the contract method with ID 0xe15a3db7.
|
||||
//
|
||||
// Solidity: function echoInts(int256[] input) returns(int256[] output)
|
||||
func (slicer *Slicer) PackEchoInts(Input []*big.Int) []byte {
|
||||
enc, err := slicer.abi.Pack("echoInts", Input)
|
||||
func (slicer *Slicer) PackEchoInts(input []*big.Int) []byte {
|
||||
enc, err := slicer.abi.Pack("echoInts", input)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
24
accounts/abi/abigen/testdata/v2/token.go.txt
vendored
24
accounts/abi/abigen/testdata/v2/token.go.txt
vendored
|
|
@ -67,8 +67,8 @@ func (token *Token) PackConstructor(initialSupply *big.Int, tokenName string, de
|
|||
// the contract method with ID 0xdd62ed3e.
|
||||
//
|
||||
// Solidity: function allowance(address , address ) returns(uint256)
|
||||
func (token *Token) PackAllowance(Arg0 common.Address, Arg1 common.Address) []byte {
|
||||
enc, err := token.abi.Pack("allowance", Arg0, Arg1)
|
||||
func (token *Token) PackAllowance(arg0 common.Address, arg1 common.Address) []byte {
|
||||
enc, err := token.abi.Pack("allowance", arg0, arg1)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -92,8 +92,8 @@ func (token *Token) UnpackAllowance(data []byte) (*big.Int, error) {
|
|||
// the contract method with ID 0xcae9ca51.
|
||||
//
|
||||
// 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 {
|
||||
enc, err := token.abi.Pack("approveAndCall", Spender, Value, ExtraData)
|
||||
func (token *Token) PackApproveAndCall(spender common.Address, value *big.Int, extraData []byte) []byte {
|
||||
enc, err := token.abi.Pack("approveAndCall", spender, value, extraData)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -117,8 +117,8 @@ func (token *Token) UnpackApproveAndCall(data []byte) (bool, error) {
|
|||
// the contract method with ID 0x70a08231.
|
||||
//
|
||||
// Solidity: function balanceOf(address ) returns(uint256)
|
||||
func (token *Token) PackBalanceOf(Arg0 common.Address) []byte {
|
||||
enc, err := token.abi.Pack("balanceOf", Arg0)
|
||||
func (token *Token) PackBalanceOf(arg0 common.Address) []byte {
|
||||
enc, err := token.abi.Pack("balanceOf", arg0)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -192,8 +192,8 @@ func (token *Token) UnpackName(data []byte) (string, error) {
|
|||
// the contract method with ID 0xdc3080f2.
|
||||
//
|
||||
// Solidity: function spentAllowance(address , address ) returns(uint256)
|
||||
func (token *Token) PackSpentAllowance(Arg0 common.Address, Arg1 common.Address) []byte {
|
||||
enc, err := token.abi.Pack("spentAllowance", Arg0, Arg1)
|
||||
func (token *Token) PackSpentAllowance(arg0 common.Address, arg1 common.Address) []byte {
|
||||
enc, err := token.abi.Pack("spentAllowance", arg0, arg1)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -242,8 +242,8 @@ func (token *Token) UnpackSymbol(data []byte) (string, error) {
|
|||
// the contract method with ID 0xa9059cbb.
|
||||
//
|
||||
// Solidity: function transfer(address _to, uint256 _value) returns()
|
||||
func (token *Token) PackTransfer(To common.Address, Value *big.Int) []byte {
|
||||
enc, err := token.abi.Pack("transfer", To, Value)
|
||||
func (token *Token) PackTransfer(to common.Address, value *big.Int) []byte {
|
||||
enc, err := token.abi.Pack("transfer", to, value)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -254,8 +254,8 @@ func (token *Token) PackTransfer(To common.Address, Value *big.Int) []byte {
|
|||
// the contract method with ID 0x23b872dd.
|
||||
//
|
||||
// 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 {
|
||||
enc, err := token.abi.Pack("transferFrom", From, To, Value)
|
||||
func (token *Token) PackTransferFrom(from common.Address, to common.Address, value *big.Int) []byte {
|
||||
enc, err := token.abi.Pack("transferFrom", from, to, value)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
12
accounts/abi/abigen/testdata/v2/tuple.go.txt
vendored
12
accounts/abi/abigen/testdata/v2/tuple.go.txt
vendored
|
|
@ -80,8 +80,8 @@ func (c *Tuple) Instance(backend bind.ContractBackend, addr common.Address) *bin
|
|||
// 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) 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)
|
||||
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)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -121,8 +121,8 @@ func (tuple *Tuple) UnpackFunc1(data []byte) (Func1Output, 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()
|
||||
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)
|
||||
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)
|
||||
if err != nil {
|
||||
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.
|
||||
//
|
||||
// Solidity: function func3((uint16,uint16)[] ) pure returns()
|
||||
func (tuple *Tuple) PackFunc3(Arg0 []TupleQ) []byte {
|
||||
enc, err := tuple.abi.Pack("func3", Arg0)
|
||||
func (tuple *Tuple) PackFunc3(arg0 []TupleQ) []byte {
|
||||
enc, err := tuple.abi.Pack("func3", arg0)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@ func (c *DB) Instance(backend bind.ContractBackend, addr common.Address) *bind.B
|
|||
// the contract method with ID 0x9507d39a.
|
||||
//
|
||||
// Solidity: function get(uint256 k) returns(uint256)
|
||||
func (dB *DB) PackGet(K *big.Int) []byte {
|
||||
enc, err := dB.abi.Pack("get", K)
|
||||
func (dB *DB) PackGet(k *big.Int) []byte {
|
||||
enc, err := dB.abi.Pack("get", k)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -186,8 +186,8 @@ func (dB *DB) UnpackGetStatsStruct(data []byte) (DBStats, error) {
|
|||
// the contract method with ID 0x1d834a1b.
|
||||
//
|
||||
// Solidity: function insert(uint256 k, uint256 v) returns(uint256)
|
||||
func (dB *DB) PackInsert(K *big.Int, V *big.Int) []byte {
|
||||
enc, err := dB.abi.Pack("insert", K, V)
|
||||
func (dB *DB) PackInsert(k *big.Int, v *big.Int) []byte {
|
||||
enc, err := dB.abi.Pack("insert", k, v)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,13 @@ contract DB {
|
|||
balance += msg.value;
|
||||
}
|
||||
|
||||
fallback() external {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
fallback(bytes calldata _input) external returns (bytes memory _output) {
|
||||
_output = _input;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
@ -100,8 +100,8 @@ func (c *C) UnpackDoSomethingWithManyArgs(data []byte) (DoSomethingWithManyArgsO
|
|||
// the contract method with ID 0xedcdc894.
|
||||
//
|
||||
// Solidity: function DoSomethingWithPoint((uint256,uint256) p) pure returns((uint256,uint256))
|
||||
func (c *C) PackDoSomethingWithPoint(P CPoint) []byte {
|
||||
enc, err := c.abi.Pack("DoSomethingWithPoint", P)
|
||||
func (c *C) PackDoSomethingWithPoint(p CPoint) []byte {
|
||||
enc, err := c.abi.Pack("DoSomethingWithPoint", p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ func (c1 *C1) PackConstructor(v1 *big.Int, v2 *big.Int) []byte {
|
|||
// the contract method with ID 0x2ad11272.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256 res)
|
||||
func (c1 *C1) PackDo(Val *big.Int) []byte {
|
||||
enc, err := c1.abi.Pack("Do", Val)
|
||||
func (c1 *C1) PackDo(val *big.Int) []byte {
|
||||
enc, err := c1.abi.Pack("Do", val)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -139,8 +139,8 @@ func (c2 *C2) PackConstructor(v1 *big.Int, v2 *big.Int) []byte {
|
|||
// the contract method with ID 0x2ad11272.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256 res)
|
||||
func (c2 *C2) PackDo(Val *big.Int) []byte {
|
||||
enc, err := c2.abi.Pack("Do", Val)
|
||||
func (c2 *C2) PackDo(val *big.Int) []byte {
|
||||
enc, err := c2.abi.Pack("Do", val)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -191,8 +191,8 @@ func (c *L1) Instance(backend bind.ContractBackend, addr common.Address) *bind.B
|
|||
// the contract method with ID 0x2ad11272.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l1 *L1) PackDo(Val *big.Int) []byte {
|
||||
enc, err := l1.abi.Pack("Do", Val)
|
||||
func (l1 *L1) PackDo(val *big.Int) []byte {
|
||||
enc, err := l1.abi.Pack("Do", val)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -246,8 +246,8 @@ func (c *L2) Instance(backend bind.ContractBackend, addr common.Address) *bind.B
|
|||
// the contract method with ID 0x2ad11272.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l2 *L2) PackDo(Val *big.Int) []byte {
|
||||
enc, err := l2.abi.Pack("Do", Val)
|
||||
func (l2 *L2) PackDo(val *big.Int) []byte {
|
||||
enc, err := l2.abi.Pack("Do", val)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -301,8 +301,8 @@ func (c *L2b) Instance(backend bind.ContractBackend, addr common.Address) *bind.
|
|||
// the contract method with ID 0x2ad11272.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l2b *L2b) PackDo(Val *big.Int) []byte {
|
||||
enc, err := l2b.abi.Pack("Do", Val)
|
||||
func (l2b *L2b) PackDo(val *big.Int) []byte {
|
||||
enc, err := l2b.abi.Pack("Do", val)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -353,8 +353,8 @@ func (c *L3) Instance(backend bind.ContractBackend, addr common.Address) *bind.B
|
|||
// the contract method with ID 0x2ad11272.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l3 *L3) PackDo(Val *big.Int) []byte {
|
||||
enc, err := l3.abi.Pack("Do", Val)
|
||||
func (l3 *L3) PackDo(val *big.Int) []byte {
|
||||
enc, err := l3.abi.Pack("Do", val)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -409,8 +409,8 @@ func (c *L4) Instance(backend bind.ContractBackend, addr common.Address) *bind.B
|
|||
// the contract method with ID 0x2ad11272.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l4 *L4) PackDo(Val *big.Int) []byte {
|
||||
enc, err := l4.abi.Pack("Do", Val)
|
||||
func (l4 *L4) PackDo(val *big.Int) []byte {
|
||||
enc, err := l4.abi.Pack("Do", val)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -464,8 +464,8 @@ func (c *L4b) Instance(backend bind.ContractBackend, addr common.Address) *bind.
|
|||
// the contract method with ID 0x2ad11272.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l4b *L4b) PackDo(Val *big.Int) []byte {
|
||||
enc, err := l4b.abi.Pack("Do", Val)
|
||||
func (l4b *L4b) PackDo(val *big.Int) []byte {
|
||||
enc, err := l4b.abi.Pack("Do", val)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue