diff --git a/accounts/abi/bind/base.go b/accounts/abi/bind/base.go index 0825ec1aad..cc30900c5b 100644 --- a/accounts/abi/bind/base.go +++ b/accounts/abi/bind/base.go @@ -257,19 +257,19 @@ func (c *BoundContract) Transact(opts *TransactOpts, method string, params ...in if err != nil { return nil, err } - // todo(rjl493456442) check whether the method is payable or not, - // reject invalid transaction at the first place return c.transact(opts, &c.address, input) } // RawTransact initiates a transaction with the given raw calldata as the input. // It's usually used to initiate transactions for invoking **Fallback** function. func (c *BoundContract) RawTransact(opts *TransactOpts, calldata []byte) (*types.Transaction, error) { - // todo(rjl493456442) check whether the method is payable or not, - // reject invalid transaction at the first place return c.transact(opts, &c.address, calldata) } +func (c *BoundContract) RawCreationTransact(opts *TransactOpts, calldata []byte) (*types.Transaction, error) { + return c.transact(opts, nil, calldata) +} + // Transfer initiates a plain transaction to move funds to the contract, calling // its default method if one is available. func (c *BoundContract) Transfer(opts *TransactOpts) (*types.Transaction, error) { diff --git a/accounts/abi/bind/dep_tree.go b/accounts/abi/bind/dep_tree.go index c7b813d0be..0b315c9283 100644 --- a/accounts/abi/bind/dep_tree.go +++ b/accounts/abi/bind/dep_tree.go @@ -122,8 +122,8 @@ func (d *depTreeDeployer) result() *DeploymentResult { // libraries. If an error occurs, only contracts which were successfully // deployed are returned in the result. func LinkAndDeploy(deployParams *DeploymentParams, deploy DeployFn) (res *DeploymentResult, err error) { + //deployParams.inputs = make(map[string][]byte) deployer := newDepTreeDeployer(deployParams, deploy) - deployParams.inputs = make(map[string][]byte) for _, contract := range deployParams.contracts { if _, err := deployer.linkAndDeploy(contract); err != nil { return deployer.result(), err diff --git a/accounts/abi/bind/source2.go.tpl b/accounts/abi/bind/source2.go.tpl index 0ee2deb1f6..b68a8a0724 100644 --- a/accounts/abi/bind/source2.go.tpl +++ b/accounts/abi/bind/source2.go.tpl @@ -94,7 +94,7 @@ var ( } {{range $i, $t := .Normalized.Outputs}} {{if ispointertype .Type}} - outstruct.{{.Name}} = abi.ConvertType(out[{{$i}}], new({{underlyingbindtype .Type }})).({{underlyingbindtype .Type }}) + outstruct.{{.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}}) {{ end }}{{end}} @@ -183,7 +183,7 @@ var ( func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) Unpack{{.Normalized.Name}}Error(raw []byte) (*{{$contract.Type}}{{.Normalized.Name}}, error) { errName := "{{.Normalized.Name}}" out := new({{$contract.Type}}{{.Normalized.Name}}) - if err := _{{$contract.Type}}.abi.UnpackIntoInterface(out, errName, raw); err != nil { + if err := {{ decapitalise $contract.Type}}.abi.UnpackIntoInterface(out, errName, raw); err != nil { return nil, err } return out, nil diff --git a/accounts/abi/bind/v2/internal/contracts/db/bindings.go b/accounts/abi/bind/v2/internal/contracts/db/bindings.go index 4b7b1aa02f..05f20d9757 100644 --- a/accounts/abi/bind/v2/internal/contracts/db/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/db/bindings.go @@ -98,11 +98,11 @@ func (dB *DB) UnpackGetNamedStatParams(data []byte) (GetNamedStatParamsOutput, e return *outstruct, err } - outstruct.Gets = abi.ConvertType(out[0], new(big.Int)).(big.Int) + outstruct.Gets = abi.ConvertType(out[0], new(big.Int)).(*big.Int) - outstruct.Inserts = abi.ConvertType(out[1], new(big.Int)).(big.Int) + outstruct.Inserts = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - outstruct.Mods = abi.ConvertType(out[2], new(big.Int)).(big.Int) + outstruct.Mods = abi.ConvertType(out[2], new(big.Int)).(*big.Int) return *outstruct, err @@ -129,11 +129,11 @@ func (dB *DB) UnpackGetStatParams(data []byte) (GetStatParamsOutput, error) { return *outstruct, err } - outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(big.Int) + outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int) - outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(big.Int) + outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - outstruct.Arg2 = abi.ConvertType(out[2], new(big.Int)).(big.Int) + outstruct.Arg2 = abi.ConvertType(out[2], new(big.Int)).(*big.Int) return *outstruct, err diff --git a/accounts/abi/bind/v2/internal/contracts/events/bindings.go b/accounts/abi/bind/v2/internal/contracts/events/bindings.go index f73362c34d..a33f9cab66 100644 --- a/accounts/abi/bind/v2/internal/contracts/events/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/events/bindings.go @@ -78,11 +78,11 @@ func (c *C) UnpackDoSomethingWithManyArgs(data []byte) (DoSomethingWithManyArgsO return *outstruct, err } - outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(big.Int) + outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int) - outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(big.Int) + outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) - outstruct.Arg2 = abi.ConvertType(out[2], new(big.Int)).(big.Int) + outstruct.Arg2 = abi.ConvertType(out[2], new(big.Int)).(*big.Int) outstruct.Arg3 = *abi.ConvertType(out[3], new(bool)).(*bool) diff --git a/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go b/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go index e88a75b649..16db99f770 100644 --- a/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go +++ b/accounts/abi/bind/v2/internal/contracts/solc_errors/bindings.go @@ -91,7 +91,7 @@ func CBadThingErrorID() common.Hash { func (c *C) UnpackBadThingError(raw []byte) (*CBadThing, error) { errName := "BadThing" out := new(CBadThing) - if err := _C.abi.UnpackIntoInterface(out, errName, raw); err != nil { + if err := c.abi.UnpackIntoInterface(out, errName, raw); err != nil { return nil, err } return out, nil @@ -112,7 +112,7 @@ func CBadThing2ErrorID() common.Hash { func (c *C) UnpackBadThing2Error(raw []byte) (*CBadThing2, error) { errName := "BadThing2" out := new(CBadThing2) - if err := _C.abi.UnpackIntoInterface(out, errName, raw); err != nil { + if err := c.abi.UnpackIntoInterface(out, errName, raw); err != nil { return nil, err } return out, nil @@ -176,7 +176,7 @@ func C2BadThingErrorID() common.Hash { func (c2 *C2) UnpackBadThingError(raw []byte) (*C2BadThing, error) { errName := "BadThing" out := new(C2BadThing) - if err := _C2.abi.UnpackIntoInterface(out, errName, raw); err != nil { + if err := c2.abi.UnpackIntoInterface(out, errName, raw); err != nil { return nil, err } return out, nil diff --git a/accounts/abi/bind/v2/lib.go b/accounts/abi/bind/v2/lib.go index 6aff6514e9..bee09300f7 100644 --- a/accounts/abi/bind/v2/lib.go +++ b/accounts/abi/bind/v2/lib.go @@ -182,8 +182,7 @@ func Call[T any](instance *ContractInstance, opts *bind.CallOpts, packedInput [] // bytes. func DeployContractRaw(opts *bind.TransactOpts, bytecode []byte, backend bind.ContractBackend, packedParams []byte) (common.Address, *types.Transaction, *bind.BoundContract, error) { c := bind.NewBoundContract(common.Address{}, abi.ABI{}, backend, backend, backend) - - tx, err := c.RawTransact(opts, append(bytecode, packedParams...)) + tx, err := c.RawCreationTransact(opts, append(bytecode, packedParams...)) if err != nil { return common.Address{}, nil, nil, err }