From 92b1f74a5d486573ea3c074b033f3a7db9af2dad Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 22 Jan 2025 13:58:10 +0100 Subject: [PATCH] accounts/abi/bind: update converted v1 bind tests --- .../convertedv1bindtests/callbackparam.go | 15 ++++++++++----- .../v2/internal/convertedv1bindtests/crowdsale.go | 15 ++++++++++----- .../bind/v2/internal/convertedv1bindtests/dao.go | 15 ++++++++++----- .../convertedv1bindtests/deeplynestedarray.go | 15 ++++++++++----- .../v2/internal/convertedv1bindtests/empty.go | 15 ++++++++++----- .../internal/convertedv1bindtests/eventchecker.go | 15 ++++++++++----- .../v2/internal/convertedv1bindtests/getter.go | 15 ++++++++++----- .../convertedv1bindtests/identifiercollision.go | 15 ++++++++++----- .../internal/convertedv1bindtests/inputchecker.go | 15 ++++++++++----- .../internal/convertedv1bindtests/interactor.go | 15 ++++++++++----- .../internal/convertedv1bindtests/nameconflict.go | 15 ++++++++++----- .../convertedv1bindtests/numericmethodname.go | 15 ++++++++++----- .../convertedv1bindtests/outputchecker.go | 15 ++++++++++----- .../v2/internal/convertedv1bindtests/overload.go | 15 ++++++++++----- .../internal/convertedv1bindtests/rangekeyword.go | 15 ++++++++++----- .../v2/internal/convertedv1bindtests/slicer.go | 15 ++++++++++----- .../v2/internal/convertedv1bindtests/structs.go | 15 ++++++++++----- .../v2/internal/convertedv1bindtests/token.go | 15 ++++++++++----- .../v2/internal/convertedv1bindtests/tuple.go | 15 ++++++++++----- .../v2/internal/convertedv1bindtests/tupler.go | 15 ++++++++++----- .../internal/convertedv1bindtests/underscorer.go | 15 ++++++++++----- 21 files changed, 210 insertions(+), 105 deletions(-) diff --git a/accounts/abi/bind/v2/internal/convertedv1bindtests/callbackparam.go b/accounts/abi/bind/v2/internal/convertedv1bindtests/callbackparam.go index ef2d54c933..476a65a5a5 100644 --- a/accounts/abi/bind/v2/internal/convertedv1bindtests/callbackparam.go +++ b/accounts/abi/bind/v2/internal/convertedv1bindtests/callbackparam.go @@ -8,7 +8,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -17,7 +17,6 @@ import ( var ( _ = errors.New _ = big.NewInt - _ = bind.Bind _ = common.Big1 _ = types.BloomLookup _ = abi.ConvertType @@ -36,12 +35,18 @@ type CallbackParam struct { } // NewCallbackParam creates a new instance of CallbackParam. -func NewCallbackParam() (*CallbackParam, error) { +func NewCallbackParam() *CallbackParam { parsed, err := CallbackParamMetaData.GetAbi() if err != nil { - return nil, err + panic(errors.New("invalid ABI: " + err.Error())) } - return &CallbackParam{abi: *parsed}, nil + return &CallbackParam{abi: *parsed} +} + +// Instance creates a wrapper for a deployed contract instance at the given address. +// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. +func (c *CallbackParam) Instance(backend bind.ContractBackend, addr common.Address) bind.ContractInstance { + return bind.NewContractInstance(backend, addr, c.abi) } // Test is a free data retrieval call binding the contract method 0xd7a5aba2. diff --git a/accounts/abi/bind/v2/internal/convertedv1bindtests/crowdsale.go b/accounts/abi/bind/v2/internal/convertedv1bindtests/crowdsale.go index e9e314aafd..3f059a3eb8 100644 --- a/accounts/abi/bind/v2/internal/convertedv1bindtests/crowdsale.go +++ b/accounts/abi/bind/v2/internal/convertedv1bindtests/crowdsale.go @@ -8,7 +8,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -17,7 +17,6 @@ import ( var ( _ = errors.New _ = big.NewInt - _ = bind.Bind _ = common.Big1 _ = types.BloomLookup _ = abi.ConvertType @@ -36,12 +35,18 @@ type Crowdsale struct { } // NewCrowdsale creates a new instance of Crowdsale. -func NewCrowdsale() (*Crowdsale, error) { +func NewCrowdsale() *Crowdsale { parsed, err := CrowdsaleMetaData.GetAbi() if err != nil { - return nil, err + panic(errors.New("invalid ABI: " + err.Error())) } - return &Crowdsale{abi: *parsed}, nil + return &Crowdsale{abi: *parsed} +} + +// Instance creates a wrapper for a deployed contract instance at the given address. +// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. +func (c *Crowdsale) Instance(backend bind.ContractBackend, addr common.Address) bind.ContractInstance { + return bind.NewContractInstance(backend, addr, c.abi) } func (crowdsale *Crowdsale) PackConstructor(ifSuccessfulSendTo common.Address, fundingGoalInEthers *big.Int, durationInMinutes *big.Int, etherCostOfEachToken *big.Int, addressOfTokenUsedAsReward common.Address) []byte { diff --git a/accounts/abi/bind/v2/internal/convertedv1bindtests/dao.go b/accounts/abi/bind/v2/internal/convertedv1bindtests/dao.go index 280ed44b10..65f6350a86 100644 --- a/accounts/abi/bind/v2/internal/convertedv1bindtests/dao.go +++ b/accounts/abi/bind/v2/internal/convertedv1bindtests/dao.go @@ -8,7 +8,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -17,7 +17,6 @@ import ( var ( _ = errors.New _ = big.NewInt - _ = bind.Bind _ = common.Big1 _ = types.BloomLookup _ = abi.ConvertType @@ -36,12 +35,18 @@ type DAO struct { } // NewDAO creates a new instance of DAO. -func NewDAO() (*DAO, error) { +func NewDAO() *DAO { parsed, err := DAOMetaData.GetAbi() if err != nil { - return nil, err + panic(errors.New("invalid ABI: " + err.Error())) } - return &DAO{abi: *parsed}, nil + return &DAO{abi: *parsed} +} + +// Instance creates a wrapper for a deployed contract instance at the given address. +// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. +func (c *DAO) Instance(backend bind.ContractBackend, addr common.Address) bind.ContractInstance { + return bind.NewContractInstance(backend, addr, c.abi) } func (dAO *DAO) PackConstructor(minimumQuorumForProposals *big.Int, minutesForDebate *big.Int, marginOfVotesForMajority *big.Int, congressLeader common.Address) []byte { diff --git a/accounts/abi/bind/v2/internal/convertedv1bindtests/deeplynestedarray.go b/accounts/abi/bind/v2/internal/convertedv1bindtests/deeplynestedarray.go index dc0451244f..b1d7fd2f39 100644 --- a/accounts/abi/bind/v2/internal/convertedv1bindtests/deeplynestedarray.go +++ b/accounts/abi/bind/v2/internal/convertedv1bindtests/deeplynestedarray.go @@ -8,7 +8,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -17,7 +17,6 @@ import ( var ( _ = errors.New _ = big.NewInt - _ = bind.Bind _ = common.Big1 _ = types.BloomLookup _ = abi.ConvertType @@ -36,12 +35,18 @@ type DeeplyNestedArray struct { } // NewDeeplyNestedArray creates a new instance of DeeplyNestedArray. -func NewDeeplyNestedArray() (*DeeplyNestedArray, error) { +func NewDeeplyNestedArray() *DeeplyNestedArray { parsed, err := DeeplyNestedArrayMetaData.GetAbi() if err != nil { - return nil, err + panic(errors.New("invalid ABI: " + err.Error())) } - return &DeeplyNestedArray{abi: *parsed}, nil + return &DeeplyNestedArray{abi: *parsed} +} + +// Instance creates a wrapper for a deployed contract instance at the given address. +// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. +func (c *DeeplyNestedArray) Instance(backend bind.ContractBackend, addr common.Address) bind.ContractInstance { + return bind.NewContractInstance(backend, addr, c.abi) } // DeepUint64Array is a free data retrieval call binding the contract method 0x98ed1856. diff --git a/accounts/abi/bind/v2/internal/convertedv1bindtests/empty.go b/accounts/abi/bind/v2/internal/convertedv1bindtests/empty.go index 0ec84f5d34..382936f9d5 100644 --- a/accounts/abi/bind/v2/internal/convertedv1bindtests/empty.go +++ b/accounts/abi/bind/v2/internal/convertedv1bindtests/empty.go @@ -8,7 +8,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -17,7 +17,6 @@ import ( var ( _ = errors.New _ = big.NewInt - _ = bind.Bind _ = common.Big1 _ = types.BloomLookup _ = abi.ConvertType @@ -36,10 +35,16 @@ type Empty struct { } // NewEmpty creates a new instance of Empty. -func NewEmpty() (*Empty, error) { +func NewEmpty() *Empty { parsed, err := EmptyMetaData.GetAbi() if err != nil { - return nil, err + panic(errors.New("invalid ABI: " + err.Error())) } - return &Empty{abi: *parsed}, nil + return &Empty{abi: *parsed} +} + +// Instance creates a wrapper for a deployed contract instance at the given address. +// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. +func (c *Empty) Instance(backend bind.ContractBackend, addr common.Address) bind.ContractInstance { + return bind.NewContractInstance(backend, addr, c.abi) } diff --git a/accounts/abi/bind/v2/internal/convertedv1bindtests/eventchecker.go b/accounts/abi/bind/v2/internal/convertedv1bindtests/eventchecker.go index afcd479ad4..e78e86ced8 100644 --- a/accounts/abi/bind/v2/internal/convertedv1bindtests/eventchecker.go +++ b/accounts/abi/bind/v2/internal/convertedv1bindtests/eventchecker.go @@ -8,7 +8,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -17,7 +17,6 @@ import ( var ( _ = errors.New _ = big.NewInt - _ = bind.Bind _ = common.Big1 _ = types.BloomLookup _ = abi.ConvertType @@ -35,12 +34,18 @@ type EventChecker struct { } // NewEventChecker creates a new instance of EventChecker. -func NewEventChecker() (*EventChecker, error) { +func NewEventChecker() *EventChecker { parsed, err := EventCheckerMetaData.GetAbi() if err != nil { - return nil, err + panic(errors.New("invalid ABI: " + err.Error())) } - return &EventChecker{abi: *parsed}, nil + return &EventChecker{abi: *parsed} +} + +// Instance creates a wrapper for a deployed contract instance at the given address. +// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. +func (c *EventChecker) Instance(backend bind.ContractBackend, addr common.Address) bind.ContractInstance { + return bind.NewContractInstance(backend, addr, c.abi) } // EventCheckerDynamic represents a Dynamic event raised by the EventChecker contract. diff --git a/accounts/abi/bind/v2/internal/convertedv1bindtests/getter.go b/accounts/abi/bind/v2/internal/convertedv1bindtests/getter.go index 8ff0b0652e..43972fd9f9 100644 --- a/accounts/abi/bind/v2/internal/convertedv1bindtests/getter.go +++ b/accounts/abi/bind/v2/internal/convertedv1bindtests/getter.go @@ -8,7 +8,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -17,7 +17,6 @@ import ( var ( _ = errors.New _ = big.NewInt - _ = bind.Bind _ = common.Big1 _ = types.BloomLookup _ = abi.ConvertType @@ -36,12 +35,18 @@ type Getter struct { } // NewGetter creates a new instance of Getter. -func NewGetter() (*Getter, error) { +func NewGetter() *Getter { parsed, err := GetterMetaData.GetAbi() if err != nil { - return nil, err + panic(errors.New("invalid ABI: " + err.Error())) } - return &Getter{abi: *parsed}, nil + return &Getter{abi: *parsed} +} + +// Instance creates a wrapper for a deployed contract instance at the given address. +// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. +func (c *Getter) Instance(backend bind.ContractBackend, addr common.Address) bind.ContractInstance { + return bind.NewContractInstance(backend, addr, c.abi) } // Getter is a free data retrieval call binding the contract method 0x993a04b7. diff --git a/accounts/abi/bind/v2/internal/convertedv1bindtests/identifiercollision.go b/accounts/abi/bind/v2/internal/convertedv1bindtests/identifiercollision.go index cf47e84e2d..9631917f56 100644 --- a/accounts/abi/bind/v2/internal/convertedv1bindtests/identifiercollision.go +++ b/accounts/abi/bind/v2/internal/convertedv1bindtests/identifiercollision.go @@ -8,7 +8,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -17,7 +17,6 @@ import ( var ( _ = errors.New _ = big.NewInt - _ = bind.Bind _ = common.Big1 _ = types.BloomLookup _ = abi.ConvertType @@ -36,12 +35,18 @@ type IdentifierCollision struct { } // NewIdentifierCollision creates a new instance of IdentifierCollision. -func NewIdentifierCollision() (*IdentifierCollision, error) { +func NewIdentifierCollision() *IdentifierCollision { parsed, err := IdentifierCollisionMetaData.GetAbi() if err != nil { - return nil, err + panic(errors.New("invalid ABI: " + err.Error())) } - return &IdentifierCollision{abi: *parsed}, nil + return &IdentifierCollision{abi: *parsed} +} + +// Instance creates a wrapper for a deployed contract instance at the given address. +// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. +func (c *IdentifierCollision) Instance(backend bind.ContractBackend, addr common.Address) bind.ContractInstance { + return bind.NewContractInstance(backend, addr, c.abi) } // MyVar is a free data retrieval call binding the contract method 0x4ef1f0ad. diff --git a/accounts/abi/bind/v2/internal/convertedv1bindtests/inputchecker.go b/accounts/abi/bind/v2/internal/convertedv1bindtests/inputchecker.go index c516b70bc8..0226f1bb08 100644 --- a/accounts/abi/bind/v2/internal/convertedv1bindtests/inputchecker.go +++ b/accounts/abi/bind/v2/internal/convertedv1bindtests/inputchecker.go @@ -8,7 +8,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -17,7 +17,6 @@ import ( var ( _ = errors.New _ = big.NewInt - _ = bind.Bind _ = common.Big1 _ = types.BloomLookup _ = abi.ConvertType @@ -35,12 +34,18 @@ type InputChecker struct { } // NewInputChecker creates a new instance of InputChecker. -func NewInputChecker() (*InputChecker, error) { +func NewInputChecker() *InputChecker { parsed, err := InputCheckerMetaData.GetAbi() if err != nil { - return nil, err + panic(errors.New("invalid ABI: " + err.Error())) } - return &InputChecker{abi: *parsed}, nil + return &InputChecker{abi: *parsed} +} + +// Instance creates a wrapper for a deployed contract instance at the given address. +// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. +func (c *InputChecker) Instance(backend bind.ContractBackend, addr common.Address) bind.ContractInstance { + return bind.NewContractInstance(backend, addr, c.abi) } // AnonInput is a free data retrieval call binding the contract method 0x3e708e82. diff --git a/accounts/abi/bind/v2/internal/convertedv1bindtests/interactor.go b/accounts/abi/bind/v2/internal/convertedv1bindtests/interactor.go index 631584d369..5fdba215fa 100644 --- a/accounts/abi/bind/v2/internal/convertedv1bindtests/interactor.go +++ b/accounts/abi/bind/v2/internal/convertedv1bindtests/interactor.go @@ -8,7 +8,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -17,7 +17,6 @@ import ( var ( _ = errors.New _ = big.NewInt - _ = bind.Bind _ = common.Big1 _ = types.BloomLookup _ = abi.ConvertType @@ -36,12 +35,18 @@ type Interactor struct { } // NewInteractor creates a new instance of Interactor. -func NewInteractor() (*Interactor, error) { +func NewInteractor() *Interactor { parsed, err := InteractorMetaData.GetAbi() if err != nil { - return nil, err + panic(errors.New("invalid ABI: " + err.Error())) } - return &Interactor{abi: *parsed}, nil + return &Interactor{abi: *parsed} +} + +// Instance creates a wrapper for a deployed contract instance at the given address. +// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. +func (c *Interactor) Instance(backend bind.ContractBackend, addr common.Address) bind.ContractInstance { + return bind.NewContractInstance(backend, addr, c.abi) } func (interactor *Interactor) PackConstructor(str string) []byte { diff --git a/accounts/abi/bind/v2/internal/convertedv1bindtests/nameconflict.go b/accounts/abi/bind/v2/internal/convertedv1bindtests/nameconflict.go index 3bc34bcaf7..bd4d75e365 100644 --- a/accounts/abi/bind/v2/internal/convertedv1bindtests/nameconflict.go +++ b/accounts/abi/bind/v2/internal/convertedv1bindtests/nameconflict.go @@ -8,7 +8,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -17,7 +17,6 @@ import ( var ( _ = errors.New _ = big.NewInt - _ = bind.Bind _ = common.Big1 _ = types.BloomLookup _ = abi.ConvertType @@ -42,12 +41,18 @@ type NameConflict struct { } // NewNameConflict creates a new instance of NameConflict. -func NewNameConflict() (*NameConflict, error) { +func NewNameConflict() *NameConflict { parsed, err := NameConflictMetaData.GetAbi() if err != nil { - return nil, err + panic(errors.New("invalid ABI: " + err.Error())) } - return &NameConflict{abi: *parsed}, nil + return &NameConflict{abi: *parsed} +} + +// Instance creates a wrapper for a deployed contract instance at the given address. +// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. +func (c *NameConflict) Instance(backend bind.ContractBackend, addr common.Address) bind.ContractInstance { + return bind.NewContractInstance(backend, addr, c.abi) } // AddRequest is a free data retrieval call binding the contract method 0xcce7b048. diff --git a/accounts/abi/bind/v2/internal/convertedv1bindtests/numericmethodname.go b/accounts/abi/bind/v2/internal/convertedv1bindtests/numericmethodname.go index d08f8f4ccd..7001e65809 100644 --- a/accounts/abi/bind/v2/internal/convertedv1bindtests/numericmethodname.go +++ b/accounts/abi/bind/v2/internal/convertedv1bindtests/numericmethodname.go @@ -8,7 +8,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -17,7 +17,6 @@ import ( var ( _ = errors.New _ = big.NewInt - _ = bind.Bind _ = common.Big1 _ = types.BloomLookup _ = abi.ConvertType @@ -36,12 +35,18 @@ type NumericMethodName struct { } // NewNumericMethodName creates a new instance of NumericMethodName. -func NewNumericMethodName() (*NumericMethodName, error) { +func NewNumericMethodName() *NumericMethodName { parsed, err := NumericMethodNameMetaData.GetAbi() if err != nil { - return nil, err + panic(errors.New("invalid ABI: " + err.Error())) } - return &NumericMethodName{abi: *parsed}, nil + return &NumericMethodName{abi: *parsed} +} + +// Instance creates a wrapper for a deployed contract instance at the given address. +// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. +func (c *NumericMethodName) Instance(backend bind.ContractBackend, addr common.Address) bind.ContractInstance { + return bind.NewContractInstance(backend, addr, c.abi) } // E1test is a free data retrieval call binding the contract method 0xffa02795. diff --git a/accounts/abi/bind/v2/internal/convertedv1bindtests/outputchecker.go b/accounts/abi/bind/v2/internal/convertedv1bindtests/outputchecker.go index 79de5488b9..e3f5b97856 100644 --- a/accounts/abi/bind/v2/internal/convertedv1bindtests/outputchecker.go +++ b/accounts/abi/bind/v2/internal/convertedv1bindtests/outputchecker.go @@ -8,7 +8,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -17,7 +17,6 @@ import ( var ( _ = errors.New _ = big.NewInt - _ = bind.Bind _ = common.Big1 _ = types.BloomLookup _ = abi.ConvertType @@ -35,12 +34,18 @@ type OutputChecker struct { } // NewOutputChecker creates a new instance of OutputChecker. -func NewOutputChecker() (*OutputChecker, error) { +func NewOutputChecker() *OutputChecker { parsed, err := OutputCheckerMetaData.GetAbi() if err != nil { - return nil, err + panic(errors.New("invalid ABI: " + err.Error())) } - return &OutputChecker{abi: *parsed}, nil + return &OutputChecker{abi: *parsed} +} + +// Instance creates a wrapper for a deployed contract instance at the given address. +// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. +func (c *OutputChecker) Instance(backend bind.ContractBackend, addr common.Address) bind.ContractInstance { + return bind.NewContractInstance(backend, addr, c.abi) } // AnonOutput is a free data retrieval call binding the contract method 0x008bda05. diff --git a/accounts/abi/bind/v2/internal/convertedv1bindtests/overload.go b/accounts/abi/bind/v2/internal/convertedv1bindtests/overload.go index 77465fc319..6a0d7d081b 100644 --- a/accounts/abi/bind/v2/internal/convertedv1bindtests/overload.go +++ b/accounts/abi/bind/v2/internal/convertedv1bindtests/overload.go @@ -8,7 +8,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -17,7 +17,6 @@ import ( var ( _ = errors.New _ = big.NewInt - _ = bind.Bind _ = common.Big1 _ = types.BloomLookup _ = abi.ConvertType @@ -36,12 +35,18 @@ type Overload struct { } // NewOverload creates a new instance of Overload. -func NewOverload() (*Overload, error) { +func NewOverload() *Overload { parsed, err := OverloadMetaData.GetAbi() if err != nil { - return nil, err + panic(errors.New("invalid ABI: " + err.Error())) } - return &Overload{abi: *parsed}, nil + return &Overload{abi: *parsed} +} + +// Instance creates a wrapper for a deployed contract instance at the given address. +// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. +func (c *Overload) Instance(backend bind.ContractBackend, addr common.Address) bind.ContractInstance { + return bind.NewContractInstance(backend, addr, c.abi) } // Foo is a free data retrieval call binding the contract method 0x04bc52f8. diff --git a/accounts/abi/bind/v2/internal/convertedv1bindtests/rangekeyword.go b/accounts/abi/bind/v2/internal/convertedv1bindtests/rangekeyword.go index d5a0b4660e..acd90f02f0 100644 --- a/accounts/abi/bind/v2/internal/convertedv1bindtests/rangekeyword.go +++ b/accounts/abi/bind/v2/internal/convertedv1bindtests/rangekeyword.go @@ -8,7 +8,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -17,7 +17,6 @@ import ( var ( _ = errors.New _ = big.NewInt - _ = bind.Bind _ = common.Big1 _ = types.BloomLookup _ = abi.ConvertType @@ -36,12 +35,18 @@ type RangeKeyword struct { } // NewRangeKeyword creates a new instance of RangeKeyword. -func NewRangeKeyword() (*RangeKeyword, error) { +func NewRangeKeyword() *RangeKeyword { parsed, err := RangeKeywordMetaData.GetAbi() if err != nil { - return nil, err + panic(errors.New("invalid ABI: " + err.Error())) } - return &RangeKeyword{abi: *parsed}, nil + return &RangeKeyword{abi: *parsed} +} + +// Instance creates a wrapper for a deployed contract instance at the given address. +// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. +func (c *RangeKeyword) Instance(backend bind.ContractBackend, addr common.Address) bind.ContractInstance { + return bind.NewContractInstance(backend, addr, c.abi) } // FunctionWithKeywordParameter is a free data retrieval call binding the contract method 0x527a119f. diff --git a/accounts/abi/bind/v2/internal/convertedv1bindtests/slicer.go b/accounts/abi/bind/v2/internal/convertedv1bindtests/slicer.go index b28c88fed4..5b2e7add45 100644 --- a/accounts/abi/bind/v2/internal/convertedv1bindtests/slicer.go +++ b/accounts/abi/bind/v2/internal/convertedv1bindtests/slicer.go @@ -8,7 +8,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -17,7 +17,6 @@ import ( var ( _ = errors.New _ = big.NewInt - _ = bind.Bind _ = common.Big1 _ = types.BloomLookup _ = abi.ConvertType @@ -36,12 +35,18 @@ type Slicer struct { } // NewSlicer creates a new instance of Slicer. -func NewSlicer() (*Slicer, error) { +func NewSlicer() *Slicer { parsed, err := SlicerMetaData.GetAbi() if err != nil { - return nil, err + panic(errors.New("invalid ABI: " + err.Error())) } - return &Slicer{abi: *parsed}, nil + return &Slicer{abi: *parsed} +} + +// Instance creates a wrapper for a deployed contract instance at the given address. +// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. +func (c *Slicer) Instance(backend bind.ContractBackend, addr common.Address) bind.ContractInstance { + return bind.NewContractInstance(backend, addr, c.abi) } // EchoAddresses is a free data retrieval call binding the contract method 0xbe1127a3. diff --git a/accounts/abi/bind/v2/internal/convertedv1bindtests/structs.go b/accounts/abi/bind/v2/internal/convertedv1bindtests/structs.go index 9efef4eea8..3ae5733807 100644 --- a/accounts/abi/bind/v2/internal/convertedv1bindtests/structs.go +++ b/accounts/abi/bind/v2/internal/convertedv1bindtests/structs.go @@ -8,7 +8,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -17,7 +17,6 @@ import ( var ( _ = errors.New _ = big.NewInt - _ = bind.Bind _ = common.Big1 _ = types.BloomLookup _ = abi.ConvertType @@ -41,12 +40,18 @@ type Structs struct { } // NewStructs creates a new instance of Structs. -func NewStructs() (*Structs, error) { +func NewStructs() *Structs { parsed, err := StructsMetaData.GetAbi() if err != nil { - return nil, err + panic(errors.New("invalid ABI: " + err.Error())) } - return &Structs{abi: *parsed}, nil + return &Structs{abi: *parsed} +} + +// Instance creates a wrapper for a deployed contract instance at the given address. +// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. +func (c *Structs) Instance(backend bind.ContractBackend, addr common.Address) bind.ContractInstance { + return bind.NewContractInstance(backend, addr, c.abi) } // F is a free data retrieval call binding the contract method 0x28811f59. diff --git a/accounts/abi/bind/v2/internal/convertedv1bindtests/token.go b/accounts/abi/bind/v2/internal/convertedv1bindtests/token.go index 53f4f801f9..877e0b0f7c 100644 --- a/accounts/abi/bind/v2/internal/convertedv1bindtests/token.go +++ b/accounts/abi/bind/v2/internal/convertedv1bindtests/token.go @@ -8,7 +8,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -17,7 +17,6 @@ import ( var ( _ = errors.New _ = big.NewInt - _ = bind.Bind _ = common.Big1 _ = types.BloomLookup _ = abi.ConvertType @@ -36,12 +35,18 @@ type Token struct { } // NewToken creates a new instance of Token. -func NewToken() (*Token, error) { +func NewToken() *Token { parsed, err := TokenMetaData.GetAbi() if err != nil { - return nil, err + panic(errors.New("invalid ABI: " + err.Error())) } - return &Token{abi: *parsed}, nil + return &Token{abi: *parsed} +} + +// Instance creates a wrapper for a deployed contract instance at the given address. +// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. +func (c *Token) Instance(backend bind.ContractBackend, addr common.Address) bind.ContractInstance { + return bind.NewContractInstance(backend, addr, c.abi) } func (token *Token) PackConstructor(initialSupply *big.Int, tokenName string, decimalUnits uint8, tokenSymbol string) []byte { diff --git a/accounts/abi/bind/v2/internal/convertedv1bindtests/tuple.go b/accounts/abi/bind/v2/internal/convertedv1bindtests/tuple.go index e445b14ffd..34eada17ae 100644 --- a/accounts/abi/bind/v2/internal/convertedv1bindtests/tuple.go +++ b/accounts/abi/bind/v2/internal/convertedv1bindtests/tuple.go @@ -8,7 +8,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -17,7 +17,6 @@ import ( var ( _ = errors.New _ = big.NewInt - _ = bind.Bind _ = common.Big1 _ = types.BloomLookup _ = abi.ConvertType @@ -61,12 +60,18 @@ type Tuple struct { } // NewTuple creates a new instance of Tuple. -func NewTuple() (*Tuple, error) { +func NewTuple() *Tuple { parsed, err := TupleMetaData.GetAbi() if err != nil { - return nil, err + panic(errors.New("invalid ABI: " + err.Error())) } - return &Tuple{abi: *parsed}, nil + return &Tuple{abi: *parsed} +} + +// Instance creates a wrapper for a deployed contract instance at the given address. +// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. +func (c *Tuple) Instance(backend bind.ContractBackend, addr common.Address) bind.ContractInstance { + return bind.NewContractInstance(backend, addr, c.abi) } // Func1 is a free data retrieval call binding the contract method 0x443c79b4. diff --git a/accounts/abi/bind/v2/internal/convertedv1bindtests/tupler.go b/accounts/abi/bind/v2/internal/convertedv1bindtests/tupler.go index 401b57cb46..874affd6b8 100644 --- a/accounts/abi/bind/v2/internal/convertedv1bindtests/tupler.go +++ b/accounts/abi/bind/v2/internal/convertedv1bindtests/tupler.go @@ -8,7 +8,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -17,7 +17,6 @@ import ( var ( _ = errors.New _ = big.NewInt - _ = bind.Bind _ = common.Big1 _ = types.BloomLookup _ = abi.ConvertType @@ -36,12 +35,18 @@ type Tupler struct { } // NewTupler creates a new instance of Tupler. -func NewTupler() (*Tupler, error) { +func NewTupler() *Tupler { parsed, err := TuplerMetaData.GetAbi() if err != nil { - return nil, err + panic(errors.New("invalid ABI: " + err.Error())) } - return &Tupler{abi: *parsed}, nil + return &Tupler{abi: *parsed} +} + +// Instance creates a wrapper for a deployed contract instance at the given address. +// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. +func (c *Tupler) Instance(backend bind.ContractBackend, addr common.Address) bind.ContractInstance { + return bind.NewContractInstance(backend, addr, c.abi) } // Tuple is a free data retrieval call binding the contract method 0x3175aae2. diff --git a/accounts/abi/bind/v2/internal/convertedv1bindtests/underscorer.go b/accounts/abi/bind/v2/internal/convertedv1bindtests/underscorer.go index 7c3541a41d..1cd99962e9 100644 --- a/accounts/abi/bind/v2/internal/convertedv1bindtests/underscorer.go +++ b/accounts/abi/bind/v2/internal/convertedv1bindtests/underscorer.go @@ -8,7 +8,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -17,7 +17,6 @@ import ( var ( _ = errors.New _ = big.NewInt - _ = bind.Bind _ = common.Big1 _ = types.BloomLookup _ = abi.ConvertType @@ -36,12 +35,18 @@ type Underscorer struct { } // NewUnderscorer creates a new instance of Underscorer. -func NewUnderscorer() (*Underscorer, error) { +func NewUnderscorer() *Underscorer { parsed, err := UnderscorerMetaData.GetAbi() if err != nil { - return nil, err + panic(errors.New("invalid ABI: " + err.Error())) } - return &Underscorer{abi: *parsed}, nil + return &Underscorer{abi: *parsed} +} + +// Instance creates a wrapper for a deployed contract instance at the given address. +// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. +func (c *Underscorer) Instance(backend bind.ContractBackend, addr common.Address) bind.ContractInstance { + return bind.NewContractInstance(backend, addr, c.abi) } // AllPurelyUnderscoredOutput is a free data retrieval call binding the contract method 0xb564b34d.