Open Achilise opened 2 years ago
@Achilise 是的,如果status字段为0,那么output里面是返回值
你贴一下完整的生成的go代码,应该有带解析后的返回值的版本?
@Achilise 是的,如果status字段为0,那么output里面是返回值
我有两个问题:
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package asset
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"
"github.com/FISCO-BCOS/go-sdk/event"
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 = event.NewSubscription )
// AssetABI is the input ABI used to generate the binding from. const AssetABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"from_account\",\"type\":\"string\"},{\"name\":\"to_account\",\"type\":\"string\"},{\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"account\",\"type\":\"string\"},{\"name\":\"asset_value\",\"type\":\"uint256\"}],\"name\":\"register\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"account\",\"type\":\"string\"}],\"name\":\"select\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"},{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"ret\",\"type\":\"int256\"},{\"indexed\":false,\"name\":\"account\",\"type\":\"string\"},{\"indexed\":false,\"name\":\"asset_value\",\"type\":\"uint256\"}],\"name\":\"RegisterEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"ret\",\"type\":\"int256\"},{\"indexed\":false,\"name\":\"from_account\",\"type\":\"string\"},{\"indexed\":false,\"name\":\"to_account\",\"type\":\"string\"},{\"indexed\":false,\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferEvent\",\"type\":\"event\"}]"
// AssetBin is the compiled bytecode used for deploying new contracts. var AssetBin = "0x608060405234801561001057600080fd5b5061002861002d640100000000026401000000009004565b610185565b600061100190508073ffffffffffffffffffffffffffffffffffffffff166356004b6a6040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018060200180602001848103845260078152602001807f745f617373657400000000000000000000000000000000000000000000000000815250602001848103835260078152602001807f6163636f756e74000000000000000000000000000000000000000000000000008152506020018481038252600b8152602001807f61737365745f76616c75650000000000000000000000000000000000000000008152506020019350505050602060405180830381600087803b15801561014657600080fd5b505af115801561015a573d6000803e3d6000fd5b505050506040513d602081101561017057600080fd5b81019080805190602001909291905050505050565b611e0f80620001956000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680639b80b0501461005c578063ea87152b14610129578063fcd7e3c1146101b0575b600080fd5b34801561006857600080fd5b50610113600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929080359060200190929190505050610234565b6040518082815260200191505060405180910390f35b34801561013557600080fd5b5061019a600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192908035906020019092919050505061136a565b6040518082815260200191505060405180910390f35b3480156101bc57600080fd5b50610217600480360381019080803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061188a565b604051808381526020018281526020019250505060405180910390f35b600080600080600080600080600080975060009650600095506000945061025a8c61188a565b80975081985050506000871415156103b0577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff97507f8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd888d8d8d604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156103045780820151818401526020810190506102e9565b50505050905090810190601f1680156103315780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b8381101561036a57808201518184015260208101905061034f565b50505050905090810190601f1680156103975780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a187985061135b565b6103b98b61188a565b809650819850505060008714151561050f577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe97507f8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd888d8d8d604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610463578082015181840152602081019050610448565b50505050905090810190601f1680156104905780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156104c95780820151818401526020810190506104ae565b50505050905090810190601f1680156104f65780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a187985061135b565b8986101561065b577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd97507f8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd888d8d8d604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156105af578082015181840152602081019050610594565b50505050905090810190601f1680156105dc5780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156106155780820151818401526020810190506105fa565b50505050905090810190601f1680156106425780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a187985061135b565b848a860110156107a9577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc97507f8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd888d8d8d604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156106fd5780820151818401526020810190506106e2565b50505050905090810190601f16801561072a5780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b83811015610763578082015181840152602081019050610748565b50505050905090810190601f1680156107905780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a187985061135b565b6107b1611cf4565b93508373ffffffffffffffffffffffffffffffffffffffff166313db93466040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561081757600080fd5b505af115801561082b573d6000803e3d6000fd5b505050506040513d602081101561084157600080fd5b810190808051906020019092919050505092508273ffffffffffffffffffffffffffffffffffffffff1663e942b5168d6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835260078152602001807f6163636f756e7400000000000000000000000000000000000000000000000000815250602001838103825284818151815260200191508051906020019080838360005b838110156109145780820151818401526020810190506108f9565b50505050905090810190601f1680156109415780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b15801561096157600080fd5b505af1158015610975573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff16632ef8ba748b88036040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018381526020018281038252600b8152602001807f61737365745f76616c756500000000000000000000000000000000000000000081525060200192505050600060405180830381600087803b158015610a2357600080fd5b505af1158015610a37573d6000803e3d6000fd5b505050508373ffffffffffffffffffffffffffffffffffffffff1663bf2b70a18d858773ffffffffffffffffffffffffffffffffffffffff16637857d7c96040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610abd57600080fd5b505af1158015610ad1573d6000803e3d6000fd5b505050506040513d6020811015610ae757600080fd5b81019080805190602001909291905050506040518463ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825285818151815260200191508051906020019080838360005b83811015610bc7578082015181840152602081019050610bac565b50505050905090810190601f168015610bf45780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b158015610c1557600080fd5b505af1158015610c29573d6000803e3d6000fd5b505050506040513d6020811015610c3f57600080fd5b81019080805190602001909291905050509150600182141515610da0577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffb97507f8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd888d8d8d604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610cf4578082015181840152602081019050610cd9565b50505050905090810190601f168015610d215780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b83811015610d5a578082015181840152602081019050610d3f565b50505050905090810190601f168015610d875780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a187985061135b565b8373ffffffffffffffffffffffffffffffffffffffff166313db93466040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610e0457600080fd5b505af1158015610e18573d6000803e3d6000fd5b505050506040513d6020811015610e2e57600080fd5b810190808051906020019092919050505090508073ffffffffffffffffffffffffffffffffffffffff1663e942b5168c6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835260078152602001807f6163636f756e7400000000000000000000000000000000000000000000000000815250602001838103825284818151815260200191508051906020019080838360005b83811015610f01578082015181840152602081019050610ee6565b50505050905090810190601f168015610f2e5780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b158015610f4e57600080fd5b505af1158015610f62573d6000803e3d6000fd5b505050508073ffffffffffffffffffffffffffffffffffffffff16632ef8ba748b87016040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018381526020018281038252600b8152602001807f61737365745f76616c756500000000000000000000000000000000000000000081525060200192505050600060405180830381600087803b15801561101057600080fd5b505af1158015611024573d6000803e3d6000fd5b505050508373ffffffffffffffffffffffffffffffffffffffff1663bf2b70a18c838773ffffffffffffffffffffffffffffffffffffffff16637857d7c96040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156110aa57600080fd5b505af11580156110be573d6000803e3d6000fd5b505050506040513d60208110156110d457600080fd5b81019080805190602001909291905050506040518463ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825285818151815260200191508051906020019080838360005b838110156111b4578082015181840152602081019050611199565b50505050905090810190601f1680156111e15780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b15801561120257600080fd5b505af1158015611216573d6000803e3d6000fd5b505050506040513d602081101561122c57600080fd5b8101908080519060200190929190505050507f8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd888d8d8d604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156112b3578082015181840152602081019050611298565b50505050905090810190601f1680156112e05780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156113195780820151818401526020810190506112fe565b50505050905090810190601f1680156113465780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a18798505b50505050505050509392505050565b600080600080600080600080955060009450600093506113898961188a565b80955081965050506000851415156117ab576113a3611cf4565b92508273ffffffffffffffffffffffffffffffffffffffff166313db93466040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561140957600080fd5b505af115801561141d573d6000803e3d6000fd5b505050506040513d602081101561143357600080fd5b810190808051906020019092919050505091508173ffffffffffffffffffffffffffffffffffffffff1663e942b5168a6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835260078152602001807f6163636f756e7400000000000000000000000000000000000000000000000000815250602001838103825284818151815260200191508051906020019080838360005b838110156115065780820151818401526020810190506114eb565b50505050905090810190601f1680156115335780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b15801561155357600080fd5b505af1158015611567573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff16632ef8ba74896040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018381526020018281038252600b8152602001807f61737365745f76616c756500000000000000000000000000000000000000000081525060200192505050600060405180830381600087803b15801561161357600080fd5b505af1158015611627573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff166331afac368a846040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818151815260200191508051906020019080838360005b838110156116e65780820151818401526020810190506116cb565b50505050905090810190601f1680156117135780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b15801561173357600080fd5b505af1158015611747573d6000803e3d6000fd5b505050506040513d602081101561175d57600080fd5b81019080805190602001909291905050509050600181141561178257600095506117a6565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe95505b6117cf565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff95505b7f91c95f04198617c60eaf2180fbca88fc192db379657df0e412a9f7dd4ebbe95d868a8a6040518084815260200180602001838152602001828103825284818151815260200191508051906020019080838360005b8381101561183f578082015181840152602081019050611824565b50505050905090810190601f16801561186c5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a185965050505050505092915050565b60008060008060008061189b611cf4565b93508373ffffffffffffffffffffffffffffffffffffffff1663e8434e39888673ffffffffffffffffffffffffffffffffffffffff16637857d7c96040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561191e57600080fd5b505af1158015611932573d6000803e3d6000fd5b505050506040513d602081101561194857600080fd5b81019080805190602001909291905050506040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818151815260200191508051906020019080838360005b838110156119f65780820151818401526020810190506119db565b50505050905090810190601f168015611a235780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b158015611a4357600080fd5b505af1158015611a57573d6000803e3d6000fd5b505050506040513d6020811015611a6d57600080fd5b81019080805190602001909291905050509250600091508273ffffffffffffffffffffffffffffffffffffffff1663949d225d6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015611ae857600080fd5b505af1158015611afc573d6000803e3d6000fd5b505050506040513d6020811015611b1257600080fd5b810190808051906020019092919050505060001415611b59577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8281915095509550611ceb565b8273ffffffffffffffffffffffffffffffffffffffff1663846719e060006040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b158015611bc957600080fd5b505af1158015611bdd573d6000803e3d6000fd5b505050506040513d6020811015611bf357600080fd5b8101908080519060200190929190505050905060008173ffffffffffffffffffffffffffffffffffffffff1663fda69fae6040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018281038252600b8152602001807f61737365745f76616c7565000000000000000000000000000000000000000000815250602001915050602060405180830381600087803b158015611ca857600080fd5b505af1158015611cbc573d6000803e3d6000fd5b505050506040513d6020811015611cd257600080fd5b8101908080519060200190929190505050819150955095505b50505050915091565b600080600061100191508173ffffffffffffffffffffffffffffffffffffffff1663f23f63c96040518163ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825260078152602001807f745f617373657400000000000000000000000000000000000000000000000000815250602001915050602060405180830381600087803b158015611d9e57600080fd5b505af1158015611db2573d6000803e3d6000fd5b505050506040513d6020811015611dc857600080fd5b810190808051906020019092919050505090508092505050905600a165627a7a723058200f96a0088d350c14fb9e66519c4b317d47df6b7369d8962fbcc35cad9e7d74100029"
// DeployAsset deploys a new contract, binding an instance of Asset to it. func DeployAsset(auth bind.TransactOpts, backend bind.ContractBackend) (common.Address, types.Transaction, *Asset, error) { parsed, err := abi.JSON(strings.NewReader(AssetABI)) if err != nil { return common.Address{}, nil, nil, err }
address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(AssetBin), backend)
if err != nil {
return common.Address{}, nil, nil, err
}
return address, tx, &Asset{AssetCaller: AssetCaller{contract: contract}, AssetTransactor: AssetTransactor{contract: contract}, AssetFilterer: AssetFilterer{contract: contract}}, nil
}
func AsyncDeployAsset(auth bind.TransactOpts, handler func(types.Receipt, error), backend bind.ContractBackend) (*types.Transaction, error) { parsed, err := abi.JSON(strings.NewReader(AssetABI)) if err != nil { return nil, err }
tx, err := bind.AsyncDeployContract(auth, handler, parsed, common.FromHex(AssetBin), backend)
if err != nil {
return nil, err
}
return tx, nil
}
// Asset is an auto generated Go binding around a Solidity contract. type Asset struct { AssetCaller // Read-only binding to the contract AssetTransactor // Write-only binding to the contract AssetFilterer // Log filterer for contract events }
// AssetCaller is an auto generated read-only Go binding around a Solidity contract. type AssetCaller struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls }
// AssetTransactor is an auto generated write-only Go binding around a Solidity contract. type AssetTransactor struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls }
// AssetFilterer is an auto generated log filtering Go binding around a Solidity contract events. type AssetFilterer struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls }
// AssetSession is an auto generated Go binding around a Solidity contract, // with pre-set call and transact options. type AssetSession struct { Contract *Asset // 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 }
// AssetCallerSession is an auto generated read-only Go binding around a Solidity contract, // with pre-set call options. type AssetCallerSession struct { Contract *AssetCaller // Generic contract caller binding to set the session for CallOpts bind.CallOpts // Call options to use throughout this session }
// AssetTransactorSession is an auto generated write-only Go binding around a Solidity contract, // with pre-set transact options. type AssetTransactorSession struct { Contract *AssetTransactor // Generic contract transactor binding to set the session for TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session }
// AssetRaw is an auto generated low-level Go binding around a Solidity contract. type AssetRaw struct { Contract *Asset // Generic contract binding to access the raw methods on }
// AssetCallerRaw is an auto generated low-level read-only Go binding around a Solidity contract. type AssetCallerRaw struct { Contract *AssetCaller // Generic read-only contract binding to access the raw methods on }
// AssetTransactorRaw is an auto generated low-level write-only Go binding around a Solidity contract. type AssetTransactorRaw struct { Contract *AssetTransactor // Generic write-only contract binding to access the raw methods on }
// NewAsset creates a new instance of Asset, bound to a specific deployed contract. func NewAsset(address common.Address, backend bind.ContractBackend) (*Asset, error) { contract, err := bindAsset(address, backend, backend, backend) if err != nil { return nil, err } return &Asset{AssetCaller: AssetCaller{contract: contract}, AssetTransactor: AssetTransactor{contract: contract}, AssetFilterer: AssetFilterer{contract: contract}}, nil }
// NewAssetCaller creates a new read-only instance of Asset, bound to a specific deployed contract. func NewAssetCaller(address common.Address, caller bind.ContractCaller) (*AssetCaller, error) { contract, err := bindAsset(address, caller, nil, nil) if err != nil { return nil, err } return &AssetCaller{contract: contract}, nil }
// NewAssetTransactor creates a new write-only instance of Asset, bound to a specific deployed contract. func NewAssetTransactor(address common.Address, transactor bind.ContractTransactor) (*AssetTransactor, error) { contract, err := bindAsset(address, nil, transactor, nil) if err != nil { return nil, err } return &AssetTransactor{contract: contract}, nil }
// NewAssetFilterer creates a new log filterer instance of Asset, bound to a specific deployed contract. func NewAssetFilterer(address common.Address, filterer bind.ContractFilterer) (*AssetFilterer, error) { contract, err := bindAsset(address, nil, nil, filterer) if err != nil { return nil, err } return &AssetFilterer{contract: contract}, nil }
// bindAsset binds a generic wrapper to an already deployed contract. func bindAsset(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { parsed, err := abi.JSON(strings.NewReader(AssetABI)) 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 (_Asset AssetRaw) Call(opts bind.CallOpts, result interface{}, method string, params ...interface{}) error { return _Asset.Contract.AssetCaller.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 (_Asset AssetRaw) Transfer(opts bind.TransactOpts) (types.Transaction, types.Receipt, error) { return _Asset.Contract.AssetTransactor.contract.Transfer(opts) }
// Transact invokes the (paid) contract method with params as input values. func (_Asset AssetRaw) Transact(opts bind.TransactOpts, method string, params ...interface{}) (types.Transaction, types.Receipt, error) { return _Asset.Contract.AssetTransactor.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 (_Asset AssetCallerRaw) Call(opts bind.CallOpts, result interface{}, method string, params ...interface{}) error { return _Asset.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 (_Asset AssetTransactorRaw) Transfer(opts bind.TransactOpts) (types.Transaction, types.Receipt, error) { return _Asset.Contract.contract.Transfer(opts) }
// Transact invokes the (paid) contract method with params as input values. func (_Asset AssetTransactorRaw) Transact(opts bind.TransactOpts, method string, params ...interface{}) (types.Transaction, types.Receipt, error) { return _Asset.Contract.contract.Transact(opts, method, params...) }
// Select is a free data retrieval call binding the contract method 0xfcd7e3c1. // // Solidity: function select(string account) constant returns(int256, uint256) func (_Asset AssetCaller) Select(opts bind.CallOpts, account string) (big.Int, big.Int, error) { var ( ret0 = new(big.Int) ret1 = new(big.Int) ) out := &[]interface{}{ ret0, ret1, } err := _Asset.contract.Call(opts, out, "select", account) return ret0, ret1, err }
// Select is a free data retrieval call binding the contract method 0xfcd7e3c1. // // Solidity: function select(string account) constant returns(int256, uint256) func (_Asset AssetSession) Select(account string) (big.Int, *big.Int, error) { return _Asset.Contract.Select(&_Asset.CallOpts, account) }
// Select is a free data retrieval call binding the contract method 0xfcd7e3c1. // // Solidity: function select(string account) constant returns(int256, uint256) func (_Asset AssetCallerSession) Select(account string) (big.Int, *big.Int, error) { return _Asset.Contract.Select(&_Asset.CallOpts, account) }
// Register is a paid mutator transaction binding the contract method 0xea87152b. // // Solidity: function register(string account, uint256 asset_value) returns(int256) func (_Asset AssetTransactor) Register(opts bind.TransactOpts, account string, asset_value big.Int) (types.Transaction, *types.Receipt, error) { return _Asset.contract.Transact(opts, "register", account, asset_value) }
func (_Asset AssetTransactor) AsyncRegister(handler func(types.Receipt, error), opts bind.TransactOpts, account string, asset_value big.Int) (*types.Transaction, error) { return _Asset.contract.AsyncTransact(opts, handler, "register", account, asset_value) }
// Register is a paid mutator transaction binding the contract method 0xea87152b. // // Solidity: function register(string account, uint256 asset_value) returns(int256) func (_Asset AssetSession) Register(account string, asset_value big.Int) (types.Transaction, types.Receipt, error) { return _Asset.Contract.Register(&_Asset.TransactOpts, account, asset_value) }
func (_Asset AssetSession) AsyncRegister(handler func(types.Receipt, error), account string, asset_value big.Int) (types.Transaction, error) { return _Asset.Contract.AsyncRegister(handler, &_Asset.TransactOpts, account, asset_value) }
// Register is a paid mutator transaction binding the contract method 0xea87152b. // // Solidity: function register(string account, uint256 asset_value) returns(int256) func (_Asset AssetTransactorSession) Register(account string, asset_value big.Int) (types.Transaction, types.Receipt, error) { return _Asset.Contract.Register(&_Asset.TransactOpts, account, asset_value) }
func (_Asset AssetTransactorSession) AsyncRegister(handler func(types.Receipt, error), account string, asset_value big.Int) (types.Transaction, error) { return _Asset.Contract.AsyncRegister(handler, &_Asset.TransactOpts, account, asset_value) }
// Transfer is a paid mutator transaction binding the contract method 0x9b80b050. // // Solidity: function transfer(string from_account, string to_account, uint256 amount) returns(int256) func (_Asset AssetTransactor) Transfer(opts bind.TransactOpts, from_account string, to_account string, amount big.Int) (types.Transaction, *types.Receipt, error) { return _Asset.contract.Transact(opts, "transfer", from_account, to_account, amount) }
func (_Asset AssetTransactor) AsyncTransfer(handler func(types.Receipt, error), opts bind.TransactOpts, from_account string, to_account string, amount big.Int) (*types.Transaction, error) { return _Asset.contract.AsyncTransact(opts, handler, "transfer", from_account, to_account, amount) }
// Transfer is a paid mutator transaction binding the contract method 0x9b80b050. // // Solidity: function transfer(string from_account, string to_account, uint256 amount) returns(int256) func (_Asset AssetSession) Transfer(from_account string, to_account string, amount big.Int) (types.Transaction, types.Receipt, error) { return _Asset.Contract.Transfer(&_Asset.TransactOpts, from_account, to_account, amount) }
func (_Asset AssetSession) AsyncTransfer(handler func(types.Receipt, error), from_account string, to_account string, amount big.Int) (types.Transaction, error) { return _Asset.Contract.AsyncTransfer(handler, &_Asset.TransactOpts, from_account, to_account, amount) }
// Transfer is a paid mutator transaction binding the contract method 0x9b80b050. // // Solidity: function transfer(string from_account, string to_account, uint256 amount) returns(int256) func (_Asset AssetTransactorSession) Transfer(from_account string, to_account string, amount big.Int) (types.Transaction, types.Receipt, error) { return _Asset.Contract.Transfer(&_Asset.TransactOpts, from_account, to_account, amount) }
func (_Asset AssetTransactorSession) AsyncTransfer(handler func(types.Receipt, error), from_account string, to_account string, amount big.Int) (types.Transaction, error) { return _Asset.Contract.AsyncTransfer(handler, &_Asset.TransactOpts, from_account, to_account, amount) }
// AssetRegisterEventIterator is returned from FilterRegisterEvent and is used to iterate over the raw logs and unpacked data for RegisterEvent events raised by the Asset contract. type AssetRegisterEventIterator struct { Event *AssetRegisterEvent // Event containing the contract specifics and raw log
contract *bind.BoundContract // Generic contract to use for unpacking event data
event string // Event name to use for unpacking event data
logs chan types.Log // Log channel receiving the found contract events
sub ethereum.Subscription // Subscription for errors, completion and termination
done bool // Whether the subscription completed delivering logs
fail error // Occurred error to stop iteration
}
// Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. func (it *AssetRegisterEventIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false } // If the iterator completed, deliver directly whatever's available if it.done { select { case log := <-it.logs: it.Event = new(AssetRegisterEvent) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false } it.Event.Raw = log return true
default:
return false
}
}
// Iterator still in progress, wait for either a data or an error event
select {
case log := <-it.logs:
it.Event = new(AssetRegisterEvent)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
case err := <-it.sub.Err():
it.done = true
it.fail = err
return it.Next()
}
}
// Error returns any retrieval or parsing error occurred during filtering. func (it *AssetRegisterEventIterator) Error() error { return it.fail }
// Close terminates the iteration process, releasing any pending underlying // resources. func (it *AssetRegisterEventIterator) Close() error { it.sub.Unsubscribe() return nil }
// AssetRegisterEvent represents a RegisterEvent event raised by the Asset contract. type AssetRegisterEvent struct { Ret big.Int Account string AssetValue big.Int Raw types.Log // Blockchain specific contextual infos }
// FilterRegisterEvent is a free log retrieval operation binding the contract event 0x91c95f04198617c60eaf2180fbca88fc192db379657df0e412a9f7dd4ebbe95d. // // Solidity: event RegisterEvent(int256 ret, string account, uint256 asset_value) func (_Asset AssetFilterer) FilterRegisterEvent(opts bind.FilterOpts) (*AssetRegisterEventIterator, error) {
logs, sub, err := _Asset.contract.FilterLogs(opts, "RegisterEvent")
if err != nil {
return nil, err
}
return &AssetRegisterEventIterator{contract: _Asset.contract, event: "RegisterEvent", logs: logs, sub: sub}, nil
}
// WatchRegisterEvent is a free log subscription operation binding the contract event 0x91c95f04198617c60eaf2180fbca88fc192db379657df0e412a9f7dd4ebbe95d. // // Solidity: event RegisterEvent(int256 ret, string account, uint256 asset_value) func (_Asset AssetFilterer) WatchRegisterEvent(opts bind.WatchOpts, sink chan<- *AssetRegisterEvent) (event.Subscription, error) {
logs, sub, err := _Asset.contract.WatchLogs(opts, "RegisterEvent")
if err != nil {
return nil, err
}
return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe()
for {
select {
case log := <-logs:
// New log arrived, parse the event and forward to the user
event := new(AssetRegisterEvent)
if err := _Asset.contract.UnpackLog(event, "RegisterEvent", log); err != nil {
return err
}
event.Raw = log
select {
case sink <- event:
case err := <-sub.Err():
return err
case <-quit:
return nil
}
case err := <-sub.Err():
return err
case <-quit:
return nil
}
}
}), nil
}
// ParseRegisterEvent is a log parse operation binding the contract event 0x91c95f04198617c60eaf2180fbca88fc192db379657df0e412a9f7dd4ebbe95d. // // Solidity: event RegisterEvent(int256 ret, string account, uint256 asset_value) func (_Asset AssetFilterer) ParseRegisterEvent(log types.Log) (AssetRegisterEvent, error) { event := new(AssetRegisterEvent) if err := _Asset.contract.UnpackLog(event, "RegisterEvent", log); err != nil { return nil, err } return event, nil }
// AssetTransferEventIterator is returned from FilterTransferEvent and is used to iterate over the raw logs and unpacked data for TransferEvent events raised by the Asset contract. type AssetTransferEventIterator struct { Event *AssetTransferEvent // Event containing the contract specifics and raw log
contract *bind.BoundContract // Generic contract to use for unpacking event data
event string // Event name to use for unpacking event data
logs chan types.Log // Log channel receiving the found contract events
sub ethereum.Subscription // Subscription for errors, completion and termination
done bool // Whether the subscription completed delivering logs
fail error // Occurred error to stop iteration
}
// Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. func (it *AssetTransferEventIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false } // If the iterator completed, deliver directly whatever's available if it.done { select { case log := <-it.logs: it.Event = new(AssetTransferEvent) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false } it.Event.Raw = log return true
default:
return false
}
}
// Iterator still in progress, wait for either a data or an error event
select {
case log := <-it.logs:
it.Event = new(AssetTransferEvent)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
case err := <-it.sub.Err():
it.done = true
it.fail = err
return it.Next()
}
}
// Error returns any retrieval or parsing error occurred during filtering. func (it *AssetTransferEventIterator) Error() error { return it.fail }
// Close terminates the iteration process, releasing any pending underlying // resources. func (it *AssetTransferEventIterator) Close() error { it.sub.Unsubscribe() return nil }
// AssetTransferEvent represents a TransferEvent event raised by the Asset contract. type AssetTransferEvent struct { Ret big.Int FromAccount string ToAccount string Amount big.Int Raw types.Log // Blockchain specific contextual infos }
// FilterTransferEvent is a free log retrieval operation binding the contract event 0x8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd. // // Solidity: event TransferEvent(int256 ret, string from_account, string to_account, uint256 amount) func (_Asset AssetFilterer) FilterTransferEvent(opts bind.FilterOpts) (*AssetTransferEventIterator, error) {
logs, sub, err := _Asset.contract.FilterLogs(opts, "TransferEvent")
if err != nil {
return nil, err
}
return &AssetTransferEventIterator{contract: _Asset.contract, event: "TransferEvent", logs: logs, sub: sub}, nil
}
// WatchTransferEvent is a free log subscription operation binding the contract event 0x8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd. // // Solidity: event TransferEvent(int256 ret, string from_account, string to_account, uint256 amount) func (_Asset AssetFilterer) WatchTransferEvent(opts bind.WatchOpts, sink chan<- *AssetTransferEvent) (event.Subscription, error) {
logs, sub, err := _Asset.contract.WatchLogs(opts, "TransferEvent")
if err != nil {
return nil, err
}
return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe()
for {
select {
case log := <-logs:
// New log arrived, parse the event and forward to the user
event := new(AssetTransferEvent)
if err := _Asset.contract.UnpackLog(event, "TransferEvent", log); err != nil {
return err
}
event.Raw = log
select {
case sink <- event:
case err := <-sub.Err():
return err
case <-quit:
return nil
}
case err := <-sub.Err():
return err
case <-quit:
return nil
}
}
}), nil
}
// ParseTransferEvent is a log parse operation binding the contract event 0x8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd. // // Solidity: event TransferEvent(int256 ret, string from_account, string to_account, uint256 amount) func (_Asset AssetFilterer) ParseTransferEvent(log types.Log) (AssetTransferEvent, error) { event := new(AssetTransferEvent) if err := _Asset.contract.UnpackLog(event, "TransferEvent", log); err != nil { return nil, err } return event, nil }
@Achilise 是的,如果status字段为0,那么output里面是返回值
我有两个问题:
- 貌似不管函数调用成功与否,status都是0,这个status字段是什么意思?
- 对于监听机制,WatchRegisterEvent函数第一个参数怎么传?有demo吗? 以下是生成go文件,没有找到带返回值的版本:
// Code generated - DO NOT EDIT. // This file is a generated binding and any manual changes will be lost. package asset 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" "github.com/FISCO-BCOS/go-sdk/event" 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 _ = event.NewSubscription ) // AssetABI is the input ABI used to generate the binding from. const AssetABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"from_account\",\"type\":\"string\"},{\"name\":\"to_account\",\"type\":\"string\"},{\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"account\",\"type\":\"string\"},{\"name\":\"asset_value\",\"type\":\"uint256\"}],\"name\":\"register\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"account\",\"type\":\"string\"}],\"name\":\"select\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"},{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"ret\",\"type\":\"int256\"},{\"indexed\":false,\"name\":\"account\",\"type\":\"string\"},{\"indexed\":false,\"name\":\"asset_value\",\"type\":\"uint256\"}],\"name\":\"RegisterEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"ret\",\"type\":\"int256\"},{\"indexed\":false,\"name\":\"from_account\",\"type\":\"string\"},{\"indexed\":false,\"name\":\"to_account\",\"type\":\"string\"},{\"indexed\":false,\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferEvent\",\"type\":\"event\"}]" // AssetBin is the compiled bytecode used for deploying new contracts. var AssetBin = "0x608060405234801561001057600080fd5b5061002861002d640100000000026401000000009004565b610185565b600061100190508073ffffffffffffffffffffffffffffffffffffffff166356004b6a6040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018060200180602001848103845260078152602001807f745f617373657400000000000000000000000000000000000000000000000000815250602001848103835260078152602001807f6163636f756e74000000000000000000000000000000000000000000000000008152506020018481038252600b8152602001807f61737365745f76616c75650000000000000000000000000000000000000000008152506020019350505050602060405180830381600087803b15801561014657600080fd5b505af115801561015a573d6000803e3d6000fd5b505050506040513d602081101561017057600080fd5b81019080805190602001909291905050505050565b611e0f80620001956000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680639b80b0501461005c578063ea87152b14610129578063fcd7e3c1146101b0575b600080fd5b34801561006857600080fd5b50610113600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929080359060200190929190505050610234565b6040518082815260200191505060405180910390f35b34801561013557600080fd5b5061019a600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192908035906020019092919050505061136a565b6040518082815260200191505060405180910390f35b3480156101bc57600080fd5b50610217600480360381019080803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061188a565b604051808381526020018281526020019250505060405180910390f35b600080600080600080600080600080975060009650600095506000945061025a8c61188a565b80975081985050506000871415156103b0577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff97507f8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd888d8d8d604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156103045780820151818401526020810190506102e9565b50505050905090810190601f1680156103315780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b8381101561036a57808201518184015260208101905061034f565b50505050905090810190601f1680156103975780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a187985061135b565b6103b98b61188a565b809650819850505060008714151561050f577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe97507f8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd888d8d8d604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610463578082015181840152602081019050610448565b50505050905090810190601f1680156104905780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156104c95780820151818401526020810190506104ae565b50505050905090810190601f1680156104f65780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a187985061135b565b8986101561065b577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd97507f8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd888d8d8d604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156105af578082015181840152602081019050610594565b50505050905090810190601f1680156105dc5780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156106155780820151818401526020810190506105fa565b50505050905090810190601f1680156106425780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a187985061135b565b848a860110156107a9577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc97507f8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd888d8d8d604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156106fd5780820151818401526020810190506106e2565b50505050905090810190601f16801561072a5780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b83811015610763578082015181840152602081019050610748565b50505050905090810190601f1680156107905780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a187985061135b565b6107b1611cf4565b93508373ffffffffffffffffffffffffffffffffffffffff166313db93466040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561081757600080fd5b505af115801561082b573d6000803e3d6000fd5b505050506040513d602081101561084157600080fd5b810190808051906020019092919050505092508273ffffffffffffffffffffffffffffffffffffffff1663e942b5168d6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835260078152602001807f6163636f756e7400000000000000000000000000000000000000000000000000815250602001838103825284818151815260200191508051906020019080838360005b838110156109145780820151818401526020810190506108f9565b50505050905090810190601f1680156109415780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b15801561096157600080fd5b505af1158015610975573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff16632ef8ba748b88036040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018381526020018281038252600b8152602001807f61737365745f76616c756500000000000000000000000000000000000000000081525060200192505050600060405180830381600087803b158015610a2357600080fd5b505af1158015610a37573d6000803e3d6000fd5b505050508373ffffffffffffffffffffffffffffffffffffffff1663bf2b70a18d858773ffffffffffffffffffffffffffffffffffffffff16637857d7c96040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610abd57600080fd5b505af1158015610ad1573d6000803e3d6000fd5b505050506040513d6020811015610ae757600080fd5b81019080805190602001909291905050506040518463ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825285818151815260200191508051906020019080838360005b83811015610bc7578082015181840152602081019050610bac565b50505050905090810190601f168015610bf45780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b158015610c1557600080fd5b505af1158015610c29573d6000803e3d6000fd5b505050506040513d6020811015610c3f57600080fd5b81019080805190602001909291905050509150600182141515610da0577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffb97507f8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd888d8d8d604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610cf4578082015181840152602081019050610cd9565b50505050905090810190601f168015610d215780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b83811015610d5a578082015181840152602081019050610d3f565b50505050905090810190601f168015610d875780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a187985061135b565b8373ffffffffffffffffffffffffffffffffffffffff166313db93466040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610e0457600080fd5b505af1158015610e18573d6000803e3d6000fd5b505050506040513d6020811015610e2e57600080fd5b810190808051906020019092919050505090508073ffffffffffffffffffffffffffffffffffffffff1663e942b5168c6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835260078152602001807f6163636f756e7400000000000000000000000000000000000000000000000000815250602001838103825284818151815260200191508051906020019080838360005b83811015610f01578082015181840152602081019050610ee6565b50505050905090810190601f168015610f2e5780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b158015610f4e57600080fd5b505af1158015610f62573d6000803e3d6000fd5b505050508073ffffffffffffffffffffffffffffffffffffffff16632ef8ba748b87016040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018381526020018281038252600b8152602001807f61737365745f76616c756500000000000000000000000000000000000000000081525060200192505050600060405180830381600087803b15801561101057600080fd5b505af1158015611024573d6000803e3d6000fd5b505050508373ffffffffffffffffffffffffffffffffffffffff1663bf2b70a18c838773ffffffffffffffffffffffffffffffffffffffff16637857d7c96040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156110aa57600080fd5b505af11580156110be573d6000803e3d6000fd5b505050506040513d60208110156110d457600080fd5b81019080805190602001909291905050506040518463ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825285818151815260200191508051906020019080838360005b838110156111b4578082015181840152602081019050611199565b50505050905090810190601f1680156111e15780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b15801561120257600080fd5b505af1158015611216573d6000803e3d6000fd5b505050506040513d602081101561122c57600080fd5b8101908080519060200190929190505050507f8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd888d8d8d604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156112b3578082015181840152602081019050611298565b50505050905090810190601f1680156112e05780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156113195780820151818401526020810190506112fe565b50505050905090810190601f1680156113465780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a18798505b50505050505050509392505050565b600080600080600080600080955060009450600093506113898961188a565b80955081965050506000851415156117ab576113a3611cf4565b92508273ffffffffffffffffffffffffffffffffffffffff166313db93466040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561140957600080fd5b505af115801561141d573d6000803e3d6000fd5b505050506040513d602081101561143357600080fd5b810190808051906020019092919050505091508173ffffffffffffffffffffffffffffffffffffffff1663e942b5168a6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835260078152602001807f6163636f756e7400000000000000000000000000000000000000000000000000815250602001838103825284818151815260200191508051906020019080838360005b838110156115065780820151818401526020810190506114eb565b50505050905090810190601f1680156115335780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b15801561155357600080fd5b505af1158015611567573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff16632ef8ba74896040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018381526020018281038252600b8152602001807f61737365745f76616c756500000000000000000000000000000000000000000081525060200192505050600060405180830381600087803b15801561161357600080fd5b505af1158015611627573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff166331afac368a846040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818151815260200191508051906020019080838360005b838110156116e65780820151818401526020810190506116cb565b50505050905090810190601f1680156117135780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b15801561173357600080fd5b505af1158015611747573d6000803e3d6000fd5b505050506040513d602081101561175d57600080fd5b81019080805190602001909291905050509050600181141561178257600095506117a6565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe95505b6117cf565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff95505b7f91c95f04198617c60eaf2180fbca88fc192db379657df0e412a9f7dd4ebbe95d868a8a6040518084815260200180602001838152602001828103825284818151815260200191508051906020019080838360005b8381101561183f578082015181840152602081019050611824565b50505050905090810190601f16801561186c5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a185965050505050505092915050565b60008060008060008061189b611cf4565b93508373ffffffffffffffffffffffffffffffffffffffff1663e8434e39888673ffffffffffffffffffffffffffffffffffffffff16637857d7c96040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561191e57600080fd5b505af1158015611932573d6000803e3d6000fd5b505050506040513d602081101561194857600080fd5b81019080805190602001909291905050506040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818151815260200191508051906020019080838360005b838110156119f65780820151818401526020810190506119db565b50505050905090810190601f168015611a235780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b158015611a4357600080fd5b505af1158015611a57573d6000803e3d6000fd5b505050506040513d6020811015611a6d57600080fd5b81019080805190602001909291905050509250600091508273ffffffffffffffffffffffffffffffffffffffff1663949d225d6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015611ae857600080fd5b505af1158015611afc573d6000803e3d6000fd5b505050506040513d6020811015611b1257600080fd5b810190808051906020019092919050505060001415611b59577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8281915095509550611ceb565b8273ffffffffffffffffffffffffffffffffffffffff1663846719e060006040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b158015611bc957600080fd5b505af1158015611bdd573d6000803e3d6000fd5b505050506040513d6020811015611bf357600080fd5b8101908080519060200190929190505050905060008173ffffffffffffffffffffffffffffffffffffffff1663fda69fae6040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018281038252600b8152602001807f61737365745f76616c7565000000000000000000000000000000000000000000815250602001915050602060405180830381600087803b158015611ca857600080fd5b505af1158015611cbc573d6000803e3d6000fd5b505050506040513d6020811015611cd257600080fd5b8101908080519060200190929190505050819150955095505b50505050915091565b600080600061100191508173ffffffffffffffffffffffffffffffffffffffff1663f23f63c96040518163ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825260078152602001807f745f617373657400000000000000000000000000000000000000000000000000815250602001915050602060405180830381600087803b158015611d9e57600080fd5b505af1158015611db2573d6000803e3d6000fd5b505050506040513d6020811015611dc857600080fd5b810190808051906020019092919050505090508092505050905600a165627a7a723058200f96a0088d350c14fb9e66519c4b317d47df6b7369d8962fbcc35cad9e7d74100029" // DeployAsset deploys a new contract, binding an instance of Asset to it. func DeployAsset(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Asset, error) { parsed, err := abi.JSON(strings.NewReader(AssetABI)) if err != nil { return common.Address{}, nil, nil, err } address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(AssetBin), backend) if err != nil { return common.Address{}, nil, nil, err } return address, tx, &Asset{AssetCaller: AssetCaller{contract: contract}, AssetTransactor: AssetTransactor{contract: contract}, AssetFilterer: AssetFilterer{contract: contract}}, nil } func AsyncDeployAsset(auth *bind.TransactOpts, handler func(*types.Receipt, error), backend bind.ContractBackend) (*types.Transaction, error) { parsed, err := abi.JSON(strings.NewReader(AssetABI)) if err != nil { return nil, err } tx, err := bind.AsyncDeployContract(auth, handler, parsed, common.FromHex(AssetBin), backend) if err != nil { return nil, err } return tx, nil } // Asset is an auto generated Go binding around a Solidity contract. type Asset struct { AssetCaller // Read-only binding to the contract AssetTransactor // Write-only binding to the contract AssetFilterer // Log filterer for contract events } // AssetCaller is an auto generated read-only Go binding around a Solidity contract. type AssetCaller struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } // AssetTransactor is an auto generated write-only Go binding around a Solidity contract. type AssetTransactor struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } // AssetFilterer is an auto generated log filtering Go binding around a Solidity contract events. type AssetFilterer struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } // AssetSession is an auto generated Go binding around a Solidity contract, // with pre-set call and transact options. type AssetSession struct { Contract *Asset // 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 } // AssetCallerSession is an auto generated read-only Go binding around a Solidity contract, // with pre-set call options. type AssetCallerSession struct { Contract *AssetCaller // Generic contract caller binding to set the session for CallOpts bind.CallOpts // Call options to use throughout this session } // AssetTransactorSession is an auto generated write-only Go binding around a Solidity contract, // with pre-set transact options. type AssetTransactorSession struct { Contract *AssetTransactor // Generic contract transactor binding to set the session for TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session } // AssetRaw is an auto generated low-level Go binding around a Solidity contract. type AssetRaw struct { Contract *Asset // Generic contract binding to access the raw methods on } // AssetCallerRaw is an auto generated low-level read-only Go binding around a Solidity contract. type AssetCallerRaw struct { Contract *AssetCaller // Generic read-only contract binding to access the raw methods on } // AssetTransactorRaw is an auto generated low-level write-only Go binding around a Solidity contract. type AssetTransactorRaw struct { Contract *AssetTransactor // Generic write-only contract binding to access the raw methods on } // NewAsset creates a new instance of Asset, bound to a specific deployed contract. func NewAsset(address common.Address, backend bind.ContractBackend) (*Asset, error) { contract, err := bindAsset(address, backend, backend, backend) if err != nil { return nil, err } return &Asset{AssetCaller: AssetCaller{contract: contract}, AssetTransactor: AssetTransactor{contract: contract}, AssetFilterer: AssetFilterer{contract: contract}}, nil } // NewAssetCaller creates a new read-only instance of Asset, bound to a specific deployed contract. func NewAssetCaller(address common.Address, caller bind.ContractCaller) (*AssetCaller, error) { contract, err := bindAsset(address, caller, nil, nil) if err != nil { return nil, err } return &AssetCaller{contract: contract}, nil } // NewAssetTransactor creates a new write-only instance of Asset, bound to a specific deployed contract. func NewAssetTransactor(address common.Address, transactor bind.ContractTransactor) (*AssetTransactor, error) { contract, err := bindAsset(address, nil, transactor, nil) if err != nil { return nil, err } return &AssetTransactor{contract: contract}, nil } // NewAssetFilterer creates a new log filterer instance of Asset, bound to a specific deployed contract. func NewAssetFilterer(address common.Address, filterer bind.ContractFilterer) (*AssetFilterer, error) { contract, err := bindAsset(address, nil, nil, filterer) if err != nil { return nil, err } return &AssetFilterer{contract: contract}, nil } // bindAsset binds a generic wrapper to an already deployed contract. func bindAsset(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { parsed, err := abi.JSON(strings.NewReader(AssetABI)) 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 (_Asset *AssetRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { return _Asset.Contract.AssetCaller.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 (_Asset *AssetRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, *types.Receipt, error) { return _Asset.Contract.AssetTransactor.contract.Transfer(opts) } // Transact invokes the (paid) contract method with params as input values. func (_Asset *AssetRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, *types.Receipt, error) { return _Asset.Contract.AssetTransactor.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 (_Asset *AssetCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { return _Asset.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 (_Asset *AssetTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, *types.Receipt, error) { return _Asset.Contract.contract.Transfer(opts) } // Transact invokes the (paid) contract method with params as input values. func (_Asset *AssetTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, *types.Receipt, error) { return _Asset.Contract.contract.Transact(opts, method, params...) } // Select is a free data retrieval call binding the contract method 0xfcd7e3c1. // // Solidity: function select(string account) constant returns(int256, uint256) func (_Asset *AssetCaller) Select(opts *bind.CallOpts, account string) (*big.Int, *big.Int, error) { var ( ret0 = new(*big.Int) ret1 = new(*big.Int) ) out := &[]interface{}{ ret0, ret1, } err := _Asset.contract.Call(opts, out, "select", account) return *ret0, *ret1, err } // Select is a free data retrieval call binding the contract method 0xfcd7e3c1. // // Solidity: function select(string account) constant returns(int256, uint256) func (_Asset *AssetSession) Select(account string) (*big.Int, *big.Int, error) { return _Asset.Contract.Select(&_Asset.CallOpts, account) } // Select is a free data retrieval call binding the contract method 0xfcd7e3c1. // // Solidity: function select(string account) constant returns(int256, uint256) func (_Asset *AssetCallerSession) Select(account string) (*big.Int, *big.Int, error) { return _Asset.Contract.Select(&_Asset.CallOpts, account) } // Register is a paid mutator transaction binding the contract method 0xea87152b. // // Solidity: function register(string account, uint256 asset_value) returns(int256) func (_Asset *AssetTransactor) Register(opts *bind.TransactOpts, account string, asset_value *big.Int) (*types.Transaction, *types.Receipt, error) { return _Asset.contract.Transact(opts, "register", account, asset_value) } func (_Asset *AssetTransactor) AsyncRegister(handler func(*types.Receipt, error), opts *bind.TransactOpts, account string, asset_value *big.Int) (*types.Transaction, error) { return _Asset.contract.AsyncTransact(opts, handler, "register", account, asset_value) } // Register is a paid mutator transaction binding the contract method 0xea87152b. // // Solidity: function register(string account, uint256 asset_value) returns(int256) func (_Asset *AssetSession) Register(account string, asset_value *big.Int) (*types.Transaction, *types.Receipt, error) { return _Asset.Contract.Register(&_Asset.TransactOpts, account, asset_value) } func (_Asset *AssetSession) AsyncRegister(handler func(*types.Receipt, error), account string, asset_value *big.Int) (*types.Transaction, error) { return _Asset.Contract.AsyncRegister(handler, &_Asset.TransactOpts, account, asset_value) } // Register is a paid mutator transaction binding the contract method 0xea87152b. // // Solidity: function register(string account, uint256 asset_value) returns(int256) func (_Asset *AssetTransactorSession) Register(account string, asset_value *big.Int) (*types.Transaction, *types.Receipt, error) { return _Asset.Contract.Register(&_Asset.TransactOpts, account, asset_value) } func (_Asset *AssetTransactorSession) AsyncRegister(handler func(*types.Receipt, error), account string, asset_value *big.Int) (*types.Transaction, error) { return _Asset.Contract.AsyncRegister(handler, &_Asset.TransactOpts, account, asset_value) } // Transfer is a paid mutator transaction binding the contract method 0x9b80b050. // // Solidity: function transfer(string from_account, string to_account, uint256 amount) returns(int256) func (_Asset *AssetTransactor) Transfer(opts *bind.TransactOpts, from_account string, to_account string, amount *big.Int) (*types.Transaction, *types.Receipt, error) { return _Asset.contract.Transact(opts, "transfer", from_account, to_account, amount) } func (_Asset *AssetTransactor) AsyncTransfer(handler func(*types.Receipt, error), opts *bind.TransactOpts, from_account string, to_account string, amount *big.Int) (*types.Transaction, error) { return _Asset.contract.AsyncTransact(opts, handler, "transfer", from_account, to_account, amount) } // Transfer is a paid mutator transaction binding the contract method 0x9b80b050. // // Solidity: function transfer(string from_account, string to_account, uint256 amount) returns(int256) func (_Asset *AssetSession) Transfer(from_account string, to_account string, amount *big.Int) (*types.Transaction, *types.Receipt, error) { return _Asset.Contract.Transfer(&_Asset.TransactOpts, from_account, to_account, amount) } func (_Asset *AssetSession) AsyncTransfer(handler func(*types.Receipt, error), from_account string, to_account string, amount *big.Int) (*types.Transaction, error) { return _Asset.Contract.AsyncTransfer(handler, &_Asset.TransactOpts, from_account, to_account, amount) } // Transfer is a paid mutator transaction binding the contract method 0x9b80b050. // // Solidity: function transfer(string from_account, string to_account, uint256 amount) returns(int256) func (_Asset *AssetTransactorSession) Transfer(from_account string, to_account string, amount *big.Int) (*types.Transaction, *types.Receipt, error) { return _Asset.Contract.Transfer(&_Asset.TransactOpts, from_account, to_account, amount) } func (_Asset *AssetTransactorSession) AsyncTransfer(handler func(*types.Receipt, error), from_account string, to_account string, amount *big.Int) (*types.Transaction, error) { return _Asset.Contract.AsyncTransfer(handler, &_Asset.TransactOpts, from_account, to_account, amount) } // AssetRegisterEventIterator is returned from FilterRegisterEvent and is used to iterate over the raw logs and unpacked data for RegisterEvent events raised by the Asset contract. type AssetRegisterEventIterator struct { Event *AssetRegisterEvent // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data logs chan types.Log // Log channel receiving the found contract events sub ethereum.Subscription // Subscription for errors, completion and termination done bool // Whether the subscription completed delivering logs fail error // Occurred error to stop iteration } // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. func (it *AssetRegisterEventIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false } // If the iterator completed, deliver directly whatever's available if it.done { select { case log := <-it.logs: it.Event = new(AssetRegisterEvent) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false } it.Event.Raw = log return true default: return false } } // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: it.Event = new(AssetRegisterEvent) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false } it.Event.Raw = log return true case err := <-it.sub.Err(): it.done = true it.fail = err return it.Next() } } // Error returns any retrieval or parsing error occurred during filtering. func (it *AssetRegisterEventIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. func (it *AssetRegisterEventIterator) Close() error { it.sub.Unsubscribe() return nil } // AssetRegisterEvent represents a RegisterEvent event raised by the Asset contract. type AssetRegisterEvent struct { Ret *big.Int Account string AssetValue *big.Int Raw types.Log // Blockchain specific contextual infos } // FilterRegisterEvent is a free log retrieval operation binding the contract event 0x91c95f04198617c60eaf2180fbca88fc192db379657df0e412a9f7dd4ebbe95d. // // Solidity: event RegisterEvent(int256 ret, string account, uint256 asset_value) func (_Asset *AssetFilterer) FilterRegisterEvent(opts *bind.FilterOpts) (*AssetRegisterEventIterator, error) { logs, sub, err := _Asset.contract.FilterLogs(opts, "RegisterEvent") if err != nil { return nil, err } return &AssetRegisterEventIterator{contract: _Asset.contract, event: "RegisterEvent", logs: logs, sub: sub}, nil } // WatchRegisterEvent is a free log subscription operation binding the contract event 0x91c95f04198617c60eaf2180fbca88fc192db379657df0e412a9f7dd4ebbe95d. // // Solidity: event RegisterEvent(int256 ret, string account, uint256 asset_value) func (_Asset *AssetFilterer) WatchRegisterEvent(opts *bind.WatchOpts, sink chan<- *AssetRegisterEvent) (event.Subscription, error) { logs, sub, err := _Asset.contract.WatchLogs(opts, "RegisterEvent") if err != nil { return nil, err } return event.NewSubscription(func(quit <-chan struct{}) error { defer sub.Unsubscribe() for { select { case log := <-logs: // New log arrived, parse the event and forward to the user event := new(AssetRegisterEvent) if err := _Asset.contract.UnpackLog(event, "RegisterEvent", log); err != nil { return err } event.Raw = log select { case sink <- event: case err := <-sub.Err(): return err case <-quit: return nil } case err := <-sub.Err(): return err case <-quit: return nil } } }), nil } // ParseRegisterEvent is a log parse operation binding the contract event 0x91c95f04198617c60eaf2180fbca88fc192db379657df0e412a9f7dd4ebbe95d. // // Solidity: event RegisterEvent(int256 ret, string account, uint256 asset_value) func (_Asset *AssetFilterer) ParseRegisterEvent(log types.Log) (*AssetRegisterEvent, error) { event := new(AssetRegisterEvent) if err := _Asset.contract.UnpackLog(event, "RegisterEvent", log); err != nil { return nil, err } return event, nil } // AssetTransferEventIterator is returned from FilterTransferEvent and is used to iterate over the raw logs and unpacked data for TransferEvent events raised by the Asset contract. type AssetTransferEventIterator struct { Event *AssetTransferEvent // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data logs chan types.Log // Log channel receiving the found contract events sub ethereum.Subscription // Subscription for errors, completion and termination done bool // Whether the subscription completed delivering logs fail error // Occurred error to stop iteration } // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. func (it *AssetTransferEventIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false } // If the iterator completed, deliver directly whatever's available if it.done { select { case log := <-it.logs: it.Event = new(AssetTransferEvent) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false } it.Event.Raw = log return true default: return false } } // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: it.Event = new(AssetTransferEvent) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false } it.Event.Raw = log return true case err := <-it.sub.Err(): it.done = true it.fail = err return it.Next() } } // Error returns any retrieval or parsing error occurred during filtering. func (it *AssetTransferEventIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. func (it *AssetTransferEventIterator) Close() error { it.sub.Unsubscribe() return nil } // AssetTransferEvent represents a TransferEvent event raised by the Asset contract. type AssetTransferEvent struct { Ret *big.Int FromAccount string ToAccount string Amount *big.Int Raw types.Log // Blockchain specific contextual infos } // FilterTransferEvent is a free log retrieval operation binding the contract event 0x8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd. // // Solidity: event TransferEvent(int256 ret, string from_account, string to_account, uint256 amount) func (_Asset *AssetFilterer) FilterTransferEvent(opts *bind.FilterOpts) (*AssetTransferEventIterator, error) { logs, sub, err := _Asset.contract.FilterLogs(opts, "TransferEvent") if err != nil { return nil, err } return &AssetTransferEventIterator{contract: _Asset.contract, event: "TransferEvent", logs: logs, sub: sub}, nil } // WatchTransferEvent is a free log subscription operation binding the contract event 0x8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd. // // Solidity: event TransferEvent(int256 ret, string from_account, string to_account, uint256 amount) func (_Asset *AssetFilterer) WatchTransferEvent(opts *bind.WatchOpts, sink chan<- *AssetTransferEvent) (event.Subscription, error) { logs, sub, err := _Asset.contract.WatchLogs(opts, "TransferEvent") if err != nil { return nil, err } return event.NewSubscription(func(quit <-chan struct{}) error { defer sub.Unsubscribe() for { select { case log := <-logs: // New log arrived, parse the event and forward to the user event := new(AssetTransferEvent) if err := _Asset.contract.UnpackLog(event, "TransferEvent", log); err != nil { return err } event.Raw = log select { case sink <- event: case err := <-sub.Err(): return err case <-quit: return nil } case err := <-sub.Err(): return err case <-quit: return nil } } }), nil } // ParseTransferEvent is a log parse operation binding the contract event 0x8f6b9fa4d4bf04c7c1c3242d4a5c59ba22525b6761cf89e44becb27c606154bd. // // Solidity: event TransferEvent(int256 ret, string from_account, string to_account, uint256 amount) func (_Asset *AssetFilterer) ParseTransferEvent(log types.Log) (*AssetTransferEvent, error) { event := new(AssetTransferEvent) if err := _Asset.contract.UnpackLog(event, "TransferEvent", log); err != nil { return nil, err } return event, nil }
调用合约,如果交易回滚或其他问题,status不是0的,具体的错误码可以参考这里
合约事件的生成代码master分支是不可用的,可以尝试使用dev分支或release-1.0.0分支生成的代码
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
https://github.com/FISCO-BCOS/go-sdk/pull/183 这个PR支持生成的go代码,解析写接口的返回值
在官方asset例子中,asset.sol有如下函数:
编译成asset.go后函数为声明为:
asset.go中没有返回int256,请问如何在调用Register函数时获取返回值? 如下为交易回执,请问output是返回值吗:
@bxq2011hust