Skip to content

Commit 06e001d

Browse files
committed
update testdata
1 parent 88d18ce commit 06e001d

20 files changed

+841
-211
lines changed

accounts/abi/abigen/bindv2_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ func TestBindingV2ConvertedV1Tests(t *testing.T) {
281281
}
282282
// Set this environment variable to regenerate the test outputs.
283283
if os.Getenv("WRITE_TEST_FILES") != "" {
284-
if err := os.WriteFile((fname), []byte(have), 0666); err != nil {
284+
if err := os.WriteFile(fname, []byte(have), 0666); err != nil {
285285
t.Fatalf("err writing expected output to file: %v\n", err)
286286
}
287287
}

accounts/abi/abigen/testdata/v2/callbackparam.go.txt

+9-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func (c *CallbackParam) Instance(backend bind.ContractBackend, addr common.Addre
5151
return bind.NewBoundContract(addr, c.abi, backend, backend, backend)
5252
}
5353

54-
// PackTest is the Go binding used to pack the parameters required for calling
54+
// PackTest is the Go binding used to pack the parameters required for calling, will panic for any error.
5555
// the contract method with ID 0xd7a5aba2.
5656
//
5757
// Solidity: function test(function callback) returns()
@@ -62,3 +62,11 @@ func (callbackParam *CallbackParam) PackTest(callback [24]byte) []byte {
6262
}
6363
return enc
6464
}
65+
66+
// PackTest is the Go binding used to pack the parameters required for calling, return error if it failed to pack.
67+
// the contract method with ID 0xd7a5aba2.
68+
//
69+
// Solidity: function test(function callback) returns()
70+
func (callbackParam *CallbackParam) TryPackTest(callback [24]byte) ([]byte, error) {
71+
return callbackParam.abi.Pack("test", callback)
72+
}

accounts/abi/abigen/testdata/v2/crowdsale.go.txt

+82-19
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func (crowdsale *Crowdsale) PackConstructor(ifSuccessfulSendTo common.Address, f
6363
return enc
6464
}
6565

66-
// PackAmountRaised is the Go binding used to pack the parameters required for calling
66+
// PackAmountRaised is the Go binding used to pack the parameters required for calling, will panic for any error.
6767
// the contract method with ID 0x7b3e5e7b.
6868
//
6969
// Solidity: function amountRaised() returns(uint256)
@@ -75,6 +75,14 @@ func (crowdsale *Crowdsale) PackAmountRaised() []byte {
7575
return enc
7676
}
7777

78+
// PackAmountRaised is the Go binding used to pack the parameters required for calling, return error if it failed to pack.
79+
// the contract method with ID 0x7b3e5e7b.
80+
//
81+
// Solidity: function amountRaised() returns(uint256)
82+
func (crowdsale *Crowdsale) TryPackAmountRaised() ([]byte, error) {
83+
return crowdsale.abi.Pack("amountRaised")
84+
}
85+
7886
// UnpackAmountRaised is the Go binding that unpacks the parameters returned
7987
// from invoking the contract method with ID 0x7b3e5e7b.
8088
//
@@ -85,10 +93,10 @@ func (crowdsale *Crowdsale) UnpackAmountRaised(data []byte) (*big.Int, error) {
8593
return new(big.Int), err
8694
}
8795
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
88-
return out0, err
96+
return out0, nil
8997
}
9098

91-
// PackBeneficiary is the Go binding used to pack the parameters required for calling
99+
// PackBeneficiary is the Go binding used to pack the parameters required for calling, will panic for any error.
92100
// the contract method with ID 0x38af3eed.
93101
//
94102
// Solidity: function beneficiary() returns(address)
@@ -100,6 +108,14 @@ func (crowdsale *Crowdsale) PackBeneficiary() []byte {
100108
return enc
101109
}
102110

111+
// PackBeneficiary is the Go binding used to pack the parameters required for calling, return error if it failed to pack.
112+
// the contract method with ID 0x38af3eed.
113+
//
114+
// Solidity: function beneficiary() returns(address)
115+
func (crowdsale *Crowdsale) TryPackBeneficiary() ([]byte, error) {
116+
return crowdsale.abi.Pack("beneficiary")
117+
}
118+
103119
// UnpackBeneficiary is the Go binding that unpacks the parameters returned
104120
// from invoking the contract method with ID 0x38af3eed.
105121
//
@@ -110,10 +126,10 @@ func (crowdsale *Crowdsale) UnpackBeneficiary(data []byte) (common.Address, erro
110126
return *new(common.Address), err
111127
}
112128
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
113-
return out0, err
129+
return out0, nil
114130
}
115131

116-
// PackCheckGoalReached is the Go binding used to pack the parameters required for calling
132+
// PackCheckGoalReached is the Go binding used to pack the parameters required for calling, will panic for any error.
117133
// the contract method with ID 0x01cb3b20.
118134
//
119135
// Solidity: function checkGoalReached() returns()
@@ -125,7 +141,15 @@ func (crowdsale *Crowdsale) PackCheckGoalReached() []byte {
125141
return enc
126142
}
127143

128-
// PackDeadline is the Go binding used to pack the parameters required for calling
144+
// PackCheckGoalReached is the Go binding used to pack the parameters required for calling, return error if it failed to pack.
145+
// the contract method with ID 0x01cb3b20.
146+
//
147+
// Solidity: function checkGoalReached() returns()
148+
func (crowdsale *Crowdsale) TryPackCheckGoalReached() ([]byte, error) {
149+
return crowdsale.abi.Pack("checkGoalReached")
150+
}
151+
152+
// PackDeadline is the Go binding used to pack the parameters required for calling, will panic for any error.
129153
// the contract method with ID 0x29dcb0cf.
130154
//
131155
// Solidity: function deadline() returns(uint256)
@@ -137,6 +161,14 @@ func (crowdsale *Crowdsale) PackDeadline() []byte {
137161
return enc
138162
}
139163

164+
// PackDeadline is the Go binding used to pack the parameters required for calling, return error if it failed to pack.
165+
// the contract method with ID 0x29dcb0cf.
166+
//
167+
// Solidity: function deadline() returns(uint256)
168+
func (crowdsale *Crowdsale) TryPackDeadline() ([]byte, error) {
169+
return crowdsale.abi.Pack("deadline")
170+
}
171+
140172
// UnpackDeadline is the Go binding that unpacks the parameters returned
141173
// from invoking the contract method with ID 0x29dcb0cf.
142174
//
@@ -147,10 +179,10 @@ func (crowdsale *Crowdsale) UnpackDeadline(data []byte) (*big.Int, error) {
147179
return new(big.Int), err
148180
}
149181
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
150-
return out0, err
182+
return out0, nil
151183
}
152184

153-
// PackFunders is the Go binding used to pack the parameters required for calling
185+
// PackFunders is the Go binding used to pack the parameters required for calling, will panic for any error.
154186
// the contract method with ID 0xdc0d3dff.
155187
//
156188
// Solidity: function funders(uint256 ) returns(address addr, uint256 amount)
@@ -162,6 +194,14 @@ func (crowdsale *Crowdsale) PackFunders(arg0 *big.Int) []byte {
162194
return enc
163195
}
164196

197+
// PackFunders is the Go binding used to pack the parameters required for calling, return error if it failed to pack.
198+
// the contract method with ID 0xdc0d3dff.
199+
//
200+
// Solidity: function funders(uint256 ) returns(address addr, uint256 amount)
201+
func (crowdsale *Crowdsale) TryPackFunders(arg0 *big.Int) ([]byte, error) {
202+
return crowdsale.abi.Pack("funders", arg0)
203+
}
204+
165205
// FundersOutput serves as a container for the return parameters of contract
166206
// method Funders.
167207
type FundersOutput struct {
@@ -173,19 +213,18 @@ type FundersOutput struct {
173213
// from invoking the contract method with ID 0xdc0d3dff.
174214
//
175215
// Solidity: function funders(uint256 ) returns(address addr, uint256 amount)
176-
func (crowdsale *Crowdsale) UnpackFunders(data []byte) (FundersOutput, error) {
216+
func (crowdsale *Crowdsale) UnpackFunders(data []byte) (*FundersOutput, error) {
177217
out, err := crowdsale.abi.Unpack("funders", data)
178-
outstruct := new(FundersOutput)
179218
if err != nil {
180-
return *outstruct, err
219+
return nil, err
181220
}
221+
outstruct := new(FundersOutput)
182222
outstruct.Addr = *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
183223
outstruct.Amount = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
184-
return *outstruct, err
185-
224+
return outstruct, nil
186225
}
187226

188-
// PackFundingGoal is the Go binding used to pack the parameters required for calling
227+
// PackFundingGoal is the Go binding used to pack the parameters required for calling, will panic for any error.
189228
// the contract method with ID 0x7a3a0e84.
190229
//
191230
// Solidity: function fundingGoal() returns(uint256)
@@ -197,6 +236,14 @@ func (crowdsale *Crowdsale) PackFundingGoal() []byte {
197236
return enc
198237
}
199238

239+
// PackFundingGoal is the Go binding used to pack the parameters required for calling, return error if it failed to pack.
240+
// the contract method with ID 0x7a3a0e84.
241+
//
242+
// Solidity: function fundingGoal() returns(uint256)
243+
func (crowdsale *Crowdsale) TryPackFundingGoal() ([]byte, error) {
244+
return crowdsale.abi.Pack("fundingGoal")
245+
}
246+
200247
// UnpackFundingGoal is the Go binding that unpacks the parameters returned
201248
// from invoking the contract method with ID 0x7a3a0e84.
202249
//
@@ -207,10 +254,10 @@ func (crowdsale *Crowdsale) UnpackFundingGoal(data []byte) (*big.Int, error) {
207254
return new(big.Int), err
208255
}
209256
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
210-
return out0, err
257+
return out0, nil
211258
}
212259

213-
// PackPrice is the Go binding used to pack the parameters required for calling
260+
// PackPrice is the Go binding used to pack the parameters required for calling, will panic for any error.
214261
// the contract method with ID 0xa035b1fe.
215262
//
216263
// Solidity: function price() returns(uint256)
@@ -222,6 +269,14 @@ func (crowdsale *Crowdsale) PackPrice() []byte {
222269
return enc
223270
}
224271

272+
// PackPrice is the Go binding used to pack the parameters required for calling, return error if it failed to pack.
273+
// the contract method with ID 0xa035b1fe.
274+
//
275+
// Solidity: function price() returns(uint256)
276+
func (crowdsale *Crowdsale) TryPackPrice() ([]byte, error) {
277+
return crowdsale.abi.Pack("price")
278+
}
279+
225280
// UnpackPrice is the Go binding that unpacks the parameters returned
226281
// from invoking the contract method with ID 0xa035b1fe.
227282
//
@@ -232,10 +287,10 @@ func (crowdsale *Crowdsale) UnpackPrice(data []byte) (*big.Int, error) {
232287
return new(big.Int), err
233288
}
234289
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
235-
return out0, err
290+
return out0, nil
236291
}
237292

238-
// PackTokenReward is the Go binding used to pack the parameters required for calling
293+
// PackTokenReward is the Go binding used to pack the parameters required for calling, will panic for any error.
239294
// the contract method with ID 0x6e66f6e9.
240295
//
241296
// Solidity: function tokenReward() returns(address)
@@ -247,6 +302,14 @@ func (crowdsale *Crowdsale) PackTokenReward() []byte {
247302
return enc
248303
}
249304

305+
// PackTokenReward is the Go binding used to pack the parameters required for calling, return error if it failed to pack.
306+
// the contract method with ID 0x6e66f6e9.
307+
//
308+
// Solidity: function tokenReward() returns(address)
309+
func (crowdsale *Crowdsale) TryPackTokenReward() ([]byte, error) {
310+
return crowdsale.abi.Pack("tokenReward")
311+
}
312+
250313
// UnpackTokenReward is the Go binding that unpacks the parameters returned
251314
// from invoking the contract method with ID 0x6e66f6e9.
252315
//
@@ -257,7 +320,7 @@ func (crowdsale *Crowdsale) UnpackTokenReward(data []byte) (common.Address, erro
257320
return *new(common.Address), err
258321
}
259322
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
260-
return out0, err
323+
return out0, nil
261324
}
262325

263326
// CrowdsaleFundTransfer represents a FundTransfer event raised by the Crowdsale contract.

0 commit comments

Comments
 (0)