Skip to content

Commit 1b7aece

Browse files
jwasingerfjl
authored andcommitted
don't emit constructor input packing method if the contract constructor has no inputs
1 parent c92220f commit 1b7aece

File tree

25 files changed

+79
-126
lines changed

25 files changed

+79
-126
lines changed

accounts/abi/bind/source2.go.tpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,12 @@ var (
6363
return &{{.Type}}{abi: *parsed}, nil
6464
}
6565

66+
{{ if .Constructor.Inputs }}
6667
func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) PackConstructor({{range .Constructor.Inputs}} {{.Name}} {{bindtype .Type $structs}}, {{end}}) []byte {
6768
res, _ := {{ decapitalise $contract.Type}}.abi.Pack("" {{range .Constructor.Inputs}}, {{.Name}}{{end}})
6869
return res
6970
}
71+
{{ end -}}
7072

7173
{{range .Calls}}
7274
// {{.Normalized.Name}} is a free data retrieval call binding the contract method 0x{{printf "%x" .Original.ID}}.

accounts/abi/bind/v2/internal/contracts/db/bindings.go

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

accounts/abi/bind/v2/internal/contracts/events/bindings.go

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

accounts/abi/bind/v2/internal/contracts/nested_libraries/bindings.go

Lines changed: 0 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

accounts/abi/bind/v2/internal/contracts/solc_errors/contract.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ contract C {
2424
}
2525

2626
// purpose of this is to test that generation of metadata for contract that emits one error produces valid Go code
27-
contract 2C2 {
27+
contract C2 {
2828
function Foo() public pure {
2929
revert BadThing({
3030
arg1: uint256(0),

accounts/abi/bind/v2/internal/contracts/uint256arrayreturn/bindings.go

Lines changed: 65 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"contracts":{"contract.sol:MyContract":{"abi":[{"inputs":[],"name":"GetNums","outputs":[{"internalType":"uint256[5]","name":"","type":"uint256[5]"}],"stateMutability":"pure","type":"function"}],"bin":"6080604052348015600e575f80fd5b506101a78061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063bd6d10071461002d575b5f80fd5b61003561004b565b6040516100429190610158565b60405180910390f35b610053610088565b5f6040518060a001604052805f8152602001600181526020016002815260200160038152602001600481525090508091505090565b6040518060a00160405280600590602082028036833780820191505090505090565b5f60059050919050565b5f81905092915050565b5f819050919050565b5f819050919050565b6100d9816100c7565b82525050565b5f6100ea83836100d0565b60208301905092915050565b5f602082019050919050565b61010b816100aa565b61011581846100b4565b9250610120826100be565b805f5b8381101561015057815161013787826100df565b9650610142836100f6565b925050600181019050610123565b505050505050565b5f60a08201905061016b5f830184610102565b9291505056fea26469706673582212203fa25125c2101a81e9f20c6226dc2ebcf2845d4c211c842bf95771005a51acc964736f6c634300081a0033"}},"version":"0.8.26+commit.8a97fa7a.Darwin.appleclang"}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.26;
3+
4+
contract MyContract {
5+
// emit multiple events, different types
6+
function GetNums() public pure returns (uint256[5] memory) {
7+
uint256[5] memory myNums = [uint256(0), uint256(1), uint256(2), uint256(3), uint256(4)];
8+
return myNums;
9+
}
10+
}

accounts/abi/bind/v2/internal/convertedv1bindtests/callbackparam.go

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

accounts/abi/bind/v2/internal/convertedv1bindtests/deeplynestedarray.go

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)