/
HelloWorld.go
335 lines (285 loc) · 17.7 KB
/
HelloWorld.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package helloworld
import (
"math/big"
"strings"
"github.com/FISCO-BCOS/go-sdk/abi"
"github.com/FISCO-BCOS/go-sdk/abi/bind"
"github.com/FISCO-BCOS/go-sdk/core/types"
ethereum "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
)
// Reference imports to suppress errors if they are not otherwise used.
var (
_ = big.NewInt
_ = strings.NewReader
_ = ethereum.NotFound
_ = abi.U256
_ = bind.Bind
_ = common.Big1
_ = types.BloomLookup
)
// HelloWorldABI is the input ABI used to generate the binding from.
const HelloWorldABI = "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"v\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"setValue\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"get\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"v\",\"type\":\"string\"}],\"name\":\"set\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]"
// HelloWorldBin is the compiled bytecode used for deploying new contracts.
var HelloWorldBin = "0x60c060405260016080819052603160f81b60a0908152610020919081610068565b5034801561002d57600080fd5b5060408051808201909152600d8082526c48656c6c6f2c20576f726c642160981b602090920191825261006291600091610068565b50610103565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100a957805160ff19168380011785556100d6565b828001600101855582156100d6579182015b828111156100d65782518255916020019190600101906100bb565b506100e29291506100e6565b5090565b61010091905b808211156100e257600081556001016100ec565b90565b6103bd806101126000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80634ed3885e1461004657806354fd4d50146100b85780636d4ce63c14610135575b600080fd5b6100b66004803603602081101561005c57600080fd5b81019060208101813564010000000081111561007757600080fd5b82018360208201111561008957600080fd5b803590602001918460018302840111640100000000831117156100ab57600080fd5b50909250905061013d565b005b6100c06101cb565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100fa5781810151838201526020016100e2565b50505050905090810190601f1680156101275780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100c0610258565b610149600083836102ef565b50336001600160a01b0316326001600160a01b03167f1cede41e194608a414a2e1d67987cf390338e67d0ff22be86dee2f3737c23d538484600160405180806020018381526020018281038252858582818152602001925080828437600083820152604051601f909101601f1916909201829003965090945050505050a35050565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156102505780601f1061022557610100808354040283529160200191610250565b820191906000526020600020905b81548152906001019060200180831161023357829003601f168201915b505050505081565b60008054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156102e45780601f106102b9576101008083540402835291602001916102e4565b820191906000526020600020905b8154815290600101906020018083116102c757829003601f168201915b505050505090505b90565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106103305782800160ff1982351617855561035d565b8280016001018555821561035d579182015b8281111561035d578235825591602001919060010190610342565b5061036992915061036d565b5090565b6102ec91905b80821115610369576000815560010161037356fea26469706673582212204a80e82479e39c85b30da9acea9566e1ab9da8ef6873f4502fe3d33297f3398564736f6c634300060a0033"
// DeployHelloWorld deploys a new contract, binding an instance of HelloWorld to it.
func DeployHelloWorld(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *HelloWorld, error) {
parsed, err := abi.JSON(strings.NewReader(HelloWorldABI))
if err != nil {
return common.Address{}, nil, nil, err
}
address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(HelloWorldBin), backend)
if err != nil {
return common.Address{}, nil, nil, err
}
return address, tx, &HelloWorld{HelloWorldCaller: HelloWorldCaller{contract: contract}, HelloWorldTransactor: HelloWorldTransactor{contract: contract}, HelloWorldFilterer: HelloWorldFilterer{contract: contract}}, nil
}
func AsyncDeployHelloWorld(auth *bind.TransactOpts, handler func(*types.Receipt, error), backend bind.ContractBackend) (*types.Transaction, error) {
parsed, err := abi.JSON(strings.NewReader(HelloWorldABI))
if err != nil {
return nil, err
}
tx, err := bind.AsyncDeployContract(auth, handler, parsed, common.FromHex(HelloWorldBin), backend)
if err != nil {
return nil, err
}
return tx, nil
}
// HelloWorld is an auto generated Go binding around a Solidity contract.
type HelloWorld struct {
HelloWorldCaller // Read-only binding to the contract
HelloWorldTransactor // Write-only binding to the contract
HelloWorldFilterer // Log filterer for contract events
}
// HelloWorldCaller is an auto generated read-only Go binding around a Solidity contract.
type HelloWorldCaller struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// HelloWorldTransactor is an auto generated write-only Go binding around a Solidity contract.
type HelloWorldTransactor struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// HelloWorldFilterer is an auto generated log filtering Go binding around a Solidity contract events.
type HelloWorldFilterer struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// HelloWorldSession is an auto generated Go binding around a Solidity contract,
// with pre-set call and transact options.
type HelloWorldSession struct {
Contract *HelloWorld // Generic contract binding to set the session for
CallOpts bind.CallOpts // Call options to use throughout this session
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}
// HelloWorldCallerSession is an auto generated read-only Go binding around a Solidity contract,
// with pre-set call options.
type HelloWorldCallerSession struct {
Contract *HelloWorldCaller // Generic contract caller binding to set the session for
CallOpts bind.CallOpts // Call options to use throughout this session
}
// HelloWorldTransactorSession is an auto generated write-only Go binding around a Solidity contract,
// with pre-set transact options.
type HelloWorldTransactorSession struct {
Contract *HelloWorldTransactor // Generic contract transactor binding to set the session for
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}
// HelloWorldRaw is an auto generated low-level Go binding around a Solidity contract.
type HelloWorldRaw struct {
Contract *HelloWorld // Generic contract binding to access the raw methods on
}
// HelloWorldCallerRaw is an auto generated low-level read-only Go binding around a Solidity contract.
type HelloWorldCallerRaw struct {
Contract *HelloWorldCaller // Generic read-only contract binding to access the raw methods on
}
// HelloWorldTransactorRaw is an auto generated low-level write-only Go binding around a Solidity contract.
type HelloWorldTransactorRaw struct {
Contract *HelloWorldTransactor // Generic write-only contract binding to access the raw methods on
}
// NewHelloWorld creates a new instance of HelloWorld, bound to a specific deployed contract.
func NewHelloWorld(address common.Address, backend bind.ContractBackend) (*HelloWorld, error) {
contract, err := bindHelloWorld(address, backend, backend, backend)
if err != nil {
return nil, err
}
return &HelloWorld{HelloWorldCaller: HelloWorldCaller{contract: contract}, HelloWorldTransactor: HelloWorldTransactor{contract: contract}, HelloWorldFilterer: HelloWorldFilterer{contract: contract}}, nil
}
// NewHelloWorldCaller creates a new read-only instance of HelloWorld, bound to a specific deployed contract.
func NewHelloWorldCaller(address common.Address, caller bind.ContractCaller) (*HelloWorldCaller, error) {
contract, err := bindHelloWorld(address, caller, nil, nil)
if err != nil {
return nil, err
}
return &HelloWorldCaller{contract: contract}, nil
}
// NewHelloWorldTransactor creates a new write-only instance of HelloWorld, bound to a specific deployed contract.
func NewHelloWorldTransactor(address common.Address, transactor bind.ContractTransactor) (*HelloWorldTransactor, error) {
contract, err := bindHelloWorld(address, nil, transactor, nil)
if err != nil {
return nil, err
}
return &HelloWorldTransactor{contract: contract}, nil
}
// NewHelloWorldFilterer creates a new log filterer instance of HelloWorld, bound to a specific deployed contract.
func NewHelloWorldFilterer(address common.Address, filterer bind.ContractFilterer) (*HelloWorldFilterer, error) {
contract, err := bindHelloWorld(address, nil, nil, filterer)
if err != nil {
return nil, err
}
return &HelloWorldFilterer{contract: contract}, nil
}
// bindHelloWorld binds a generic wrapper to an already deployed contract.
func bindHelloWorld(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
parsed, err := abi.JSON(strings.NewReader(HelloWorldABI))
if err != nil {
return nil, err
}
return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
}
// Call invokes the (constant) contract method with params as input values and
// sets the output to result. The result type might be a single field for simple
// returns, a slice of interfaces for anonymous returns and a struct for named
// returns.
func (_HelloWorld *HelloWorldRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {
return _HelloWorld.Contract.HelloWorldCaller.contract.Call(opts, result, method, params...)
}
// Transfer initiates a plain transaction to move funds to the contract, calling
// its default method if one is available.
func (_HelloWorld *HelloWorldRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, *types.Receipt, error) {
return _HelloWorld.Contract.HelloWorldTransactor.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_HelloWorld *HelloWorldRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, *types.Receipt, error) {
return _HelloWorld.Contract.HelloWorldTransactor.contract.Transact(opts, method, params...)
}
// Call invokes the (constant) contract method with params as input values and
// sets the output to result. The result type might be a single field for simple
// returns, a slice of interfaces for anonymous returns and a struct for named
// returns.
func (_HelloWorld *HelloWorldCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {
return _HelloWorld.Contract.contract.Call(opts, result, method, params...)
}
// Transfer initiates a plain transaction to move funds to the contract, calling
// its default method if one is available.
func (_HelloWorld *HelloWorldTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, *types.Receipt, error) {
return _HelloWorld.Contract.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_HelloWorld *HelloWorldTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, *types.Receipt, error) {
return _HelloWorld.Contract.contract.Transact(opts, method, params...)
}
// Get is a free data retrieval call binding the contract method 0x6d4ce63c.
//
// Solidity: function get() constant returns(string)
func (_HelloWorld *HelloWorldCaller) Get(opts *bind.CallOpts) (string, error) {
var (
ret0 = new(string)
)
out := ret0
err := _HelloWorld.contract.Call(opts, out, "get")
return *ret0, err
}
// Get is a free data retrieval call binding the contract method 0x6d4ce63c.
//
// Solidity: function get() constant returns(string)
func (_HelloWorld *HelloWorldSession) Get() (string, error) {
return _HelloWorld.Contract.Get(&_HelloWorld.CallOpts)
}
// Get is a free data retrieval call binding the contract method 0x6d4ce63c.
//
// Solidity: function get() constant returns(string)
func (_HelloWorld *HelloWorldCallerSession) Get() (string, error) {
return _HelloWorld.Contract.Get(&_HelloWorld.CallOpts)
}
// Version is a free data retrieval call binding the contract method 0x54fd4d50.
//
// Solidity: function version() constant returns(string)
func (_HelloWorld *HelloWorldCaller) Version(opts *bind.CallOpts) (string, error) {
var (
ret0 = new(string)
)
out := ret0
err := _HelloWorld.contract.Call(opts, out, "version")
return *ret0, err
}
// Version is a free data retrieval call binding the contract method 0x54fd4d50.
//
// Solidity: function version() constant returns(string)
func (_HelloWorld *HelloWorldSession) Version() (string, error) {
return _HelloWorld.Contract.Version(&_HelloWorld.CallOpts)
}
// Version is a free data retrieval call binding the contract method 0x54fd4d50.
//
// Solidity: function version() constant returns(string)
func (_HelloWorld *HelloWorldCallerSession) Version() (string, error) {
return _HelloWorld.Contract.Version(&_HelloWorld.CallOpts)
}
// Set is a paid mutator transaction binding the contract method 0x4ed3885e.
//
// Solidity: function set(string v) returns()
func (_HelloWorld *HelloWorldTransactor) Set(opts *bind.TransactOpts, v string) (*types.Transaction, *types.Receipt, error) {
return _HelloWorld.contract.Transact(opts, "set", v)
}
func (_HelloWorld *HelloWorldTransactor) AsyncSet(handler func(*types.Receipt, error), opts *bind.TransactOpts, v string) (*types.Transaction, error) {
return _HelloWorld.contract.AsyncTransact(opts, handler, "set", v)
}
// Set is a paid mutator transaction binding the contract method 0x4ed3885e.
//
// Solidity: function set(string v) returns()
func (_HelloWorld *HelloWorldSession) Set(v string) (*types.Transaction, *types.Receipt, error) {
return _HelloWorld.Contract.Set(&_HelloWorld.TransactOpts, v)
}
func (_HelloWorld *HelloWorldSession) AsyncSet(handler func(*types.Receipt, error), v string) (*types.Transaction, error) {
return _HelloWorld.Contract.AsyncSet(handler, &_HelloWorld.TransactOpts, v)
}
// Set is a paid mutator transaction binding the contract method 0x4ed3885e.
//
// Solidity: function set(string v) returns()
func (_HelloWorld *HelloWorldTransactorSession) Set(v string) (*types.Transaction, *types.Receipt, error) {
return _HelloWorld.Contract.Set(&_HelloWorld.TransactOpts, v)
}
func (_HelloWorld *HelloWorldTransactorSession) AsyncSet(handler func(*types.Receipt, error), v string) (*types.Transaction, error) {
return _HelloWorld.Contract.AsyncSet(handler, &_HelloWorld.TransactOpts, v)
}
// HelloWorldSetValue represents a SetValue event raised by the HelloWorld contract.
type HelloWorldSetValue struct {
V string
From common.Address
To common.Address
Value *big.Int
Raw types.Log // Blockchain specific contextual infos
}
// WatchSetValue is a free log subscription operation binding the contract event 0x1cede41e194608a414a2e1d67987cf390338e67d0ff22be86dee2f3737c23d53.
//
// Solidity: event setValue(string v, address indexed from, address indexed to, uint256 value)
func (_HelloWorld *HelloWorldFilterer) WatchSetValue(fromBlock *uint64, handler func(int, []types.Log), from common.Address, to common.Address) error {
return _HelloWorld.contract.WatchLogs(fromBlock, handler, "setValue", from, to)
}
func (_HelloWorld *HelloWorldFilterer) WatchAllSetValue(fromBlock *uint64, handler func(int, []types.Log)) error {
return _HelloWorld.contract.WatchLogs(fromBlock, handler, "setValue")
}
// ParseSetValue is a log parse operation binding the contract event 0x1cede41e194608a414a2e1d67987cf390338e67d0ff22be86dee2f3737c23d53.
//
// Solidity: event setValue(string v, address indexed from, address indexed to, uint256 value)
func (_HelloWorld *HelloWorldFilterer) ParseSetValue(log types.Log) (*HelloWorldSetValue, error) {
event := new(HelloWorldSetValue)
if err := _HelloWorld.contract.UnpackLog(event, "setValue", log); err != nil {
return nil, err
}
return event, nil
}
// WatchSetValue is a free log subscription operation binding the contract event 0x1cede41e194608a414a2e1d67987cf390338e67d0ff22be86dee2f3737c23d53.
//
// Solidity: event setValue(string v, address indexed from, address indexed to, uint256 value)
func (_HelloWorld *HelloWorldSession) WatchSetValue(fromBlock *uint64, handler func(int, []types.Log), from common.Address, to common.Address) error {
return _HelloWorld.Contract.WatchSetValue(fromBlock, handler, from, to)
}
func (_HelloWorld *HelloWorldSession) WatchAllSetValue(fromBlock *uint64, handler func(int, []types.Log)) error {
return _HelloWorld.Contract.WatchAllSetValue(fromBlock, handler)
}
// ParseSetValue is a log parse operation binding the contract event 0x1cede41e194608a414a2e1d67987cf390338e67d0ff22be86dee2f3737c23d53.
//
// Solidity: event setValue(string v, address indexed from, address indexed to, uint256 value)
func (_HelloWorld *HelloWorldSession) ParseSetValue(log types.Log) (*HelloWorldSetValue, error) {
return _HelloWorld.Contract.ParseSetValue(log)
}