mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 09:23:48 +00:00
Merge d8ee7df03b into 3d88ecd61a
This commit is contained in:
commit
48057667be
16 changed files with 466 additions and 86 deletions
|
|
@ -90,8 +90,14 @@ type ContractTransactor interface {
|
||||||
SendTransaction(ctx context.Context, tx *types.Transaction) error
|
SendTransaction(ctx context.Context, tx *types.Transaction) error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ContractEventer defines methods to listen for events raised by the contract.
|
||||||
|
type ContractEventer interface {
|
||||||
|
SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
|
||||||
|
}
|
||||||
|
|
||||||
// ContractBackend defines the methods needed to work with contracts on a read-write basis.
|
// ContractBackend defines the methods needed to work with contracts on a read-write basis.
|
||||||
type ContractBackend interface {
|
type ContractBackend interface {
|
||||||
ContractCaller
|
ContractCaller
|
||||||
ContractTransactor
|
ContractTransactor
|
||||||
|
ContractEventer
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -303,6 +303,13 @@ func (b *SimulatedBackend) AdjustTime(adjustment time.Duration) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SubscribeFilterLogs emits logs that match the given criteria over the given channel.
|
||||||
|
//
|
||||||
|
// Note: it is currently not implemented.
|
||||||
|
func (b *SimulatedBackend) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error) {
|
||||||
|
return nil, fmt.Errorf("not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
// callmsg implements core.Message to allow passing it as a transaction simulator.
|
// callmsg implements core.Message to allow passing it as a transaction simulator.
|
||||||
type callmsg struct {
|
type callmsg struct {
|
||||||
ethereum.CallMsg
|
ethereum.CallMsg
|
||||||
|
|
|
||||||
|
|
@ -63,16 +63,18 @@ type BoundContract struct {
|
||||||
abi abi.ABI // Reflect based ABI to access the correct Ethereum methods
|
abi abi.ABI // Reflect based ABI to access the correct Ethereum methods
|
||||||
caller ContractCaller // Read interface to interact with the blockchain
|
caller ContractCaller // Read interface to interact with the blockchain
|
||||||
transactor ContractTransactor // Write interface to interact with the blockchain
|
transactor ContractTransactor // Write interface to interact with the blockchain
|
||||||
|
eventer ContractEventer // Listen for events raised by the contract
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewBoundContract creates a low level contract interface through which calls
|
// NewBoundContract creates a low level contract interface through which calls
|
||||||
// and transactions may be made through.
|
// and transactions may be made through.
|
||||||
func NewBoundContract(address common.Address, abi abi.ABI, caller ContractCaller, transactor ContractTransactor) *BoundContract {
|
func NewBoundContract(address common.Address, abi abi.ABI, caller ContractCaller, transactor ContractTransactor, eventer ContractEventer) *BoundContract {
|
||||||
return &BoundContract{
|
return &BoundContract{
|
||||||
address: address,
|
address: address,
|
||||||
abi: abi,
|
abi: abi,
|
||||||
caller: caller,
|
caller: caller,
|
||||||
transactor: transactor,
|
transactor: transactor,
|
||||||
|
eventer: eventer,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -80,7 +82,7 @@ func NewBoundContract(address common.Address, abi abi.ABI, caller ContractCaller
|
||||||
// deployment address with a Go wrapper.
|
// deployment address with a Go wrapper.
|
||||||
func DeployContract(opts *TransactOpts, abi abi.ABI, bytecode []byte, backend ContractBackend, params ...interface{}) (common.Address, *types.Transaction, *BoundContract, error) {
|
func DeployContract(opts *TransactOpts, abi abi.ABI, bytecode []byte, backend ContractBackend, params ...interface{}) (common.Address, *types.Transaction, *BoundContract, error) {
|
||||||
// Otherwise try to deploy the contract
|
// Otherwise try to deploy the contract
|
||||||
c := NewBoundContract(common.Address{}, abi, backend, backend)
|
c := NewBoundContract(common.Address{}, abi, backend, backend, backend)
|
||||||
|
|
||||||
input, err := c.abi.Pack("", params...)
|
input, err := c.abi.Pack("", params...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -225,6 +227,18 @@ func (c *BoundContract) transact(opts *TransactOpts, contract *common.Address, i
|
||||||
return signedTx, nil
|
return signedTx, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SubscribeFilterLogs creates a log subscription that streams logs raised by this contract
|
||||||
|
// with topics matching
|
||||||
|
func (c *BoundContract) SubscribeFilterLogs(opts *CallOpts, topics [][]common.Hash, ch chan<- types.Log) (ethereum.Subscription, error) {
|
||||||
|
ctx := ensureContext(opts.Context)
|
||||||
|
q := ethereum.FilterQuery{
|
||||||
|
Addresses: []common.Address{c.address},
|
||||||
|
Topics: topics,
|
||||||
|
}
|
||||||
|
|
||||||
|
return c.eventer.SubscribeFilterLogs(ctx, q, ch)
|
||||||
|
}
|
||||||
|
|
||||||
func ensureContext(ctx context.Context) context.Context {
|
func ensureContext(ctx context.Context) context.Context {
|
||||||
if ctx == nil {
|
if ctx == nil {
|
||||||
return context.TODO()
|
return context.TODO()
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ func Bind(types []string, abis []string, bytecodes []string, pkg string, lang La
|
||||||
var (
|
var (
|
||||||
calls = make(map[string]*tmplMethod)
|
calls = make(map[string]*tmplMethod)
|
||||||
transacts = make(map[string]*tmplMethod)
|
transacts = make(map[string]*tmplMethod)
|
||||||
|
events = make(map[string]*tmplEvent)
|
||||||
)
|
)
|
||||||
for _, original := range evmABI.Methods {
|
for _, original := range evmABI.Methods {
|
||||||
// Normalize the method for capital cases and non-anonymous inputs/outputs
|
// Normalize the method for capital cases and non-anonymous inputs/outputs
|
||||||
|
|
@ -94,6 +95,16 @@ func Bind(types []string, abis []string, bytecodes []string, pkg string, lang La
|
||||||
transacts[original.Name] = &tmplMethod{Original: original, Normalized: normalized, Structured: structured(original)}
|
transacts[original.Name] = &tmplMethod{Original: original, Normalized: normalized, Structured: structured(original)}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, e := range evmABI.Events {
|
||||||
|
events[e.Name] = &tmplEvent{
|
||||||
|
Name: e.Name,
|
||||||
|
Inputs: e.Inputs,
|
||||||
|
ID: fmt.Sprintf("%x", e.Id()),
|
||||||
|
Anonymous: e.Anonymous,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
contracts[types[i]] = &tmplContract{
|
contracts[types[i]] = &tmplContract{
|
||||||
Type: capitalise(types[i]),
|
Type: capitalise(types[i]),
|
||||||
InputABI: strings.Replace(strippedABI, "\"", "\\\"", -1),
|
InputABI: strings.Replace(strippedABI, "\"", "\\\"", -1),
|
||||||
|
|
@ -101,6 +112,7 @@ func Bind(types []string, abis []string, bytecodes []string, pkg string, lang La
|
||||||
Constructor: evmABI.Constructor,
|
Constructor: evmABI.Constructor,
|
||||||
Calls: calls,
|
Calls: calls,
|
||||||
Transacts: transacts,
|
Transacts: transacts,
|
||||||
|
Events: events, // TODO: add event subscription support to the java template
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Generate the contract template data content and render it
|
// Generate the contract template data content and render it
|
||||||
|
|
@ -116,6 +128,7 @@ func Bind(types []string, abis []string, bytecodes []string, pkg string, lang La
|
||||||
"capitalise": capitalise,
|
"capitalise": capitalise,
|
||||||
"decapitalise": decapitalise,
|
"decapitalise": decapitalise,
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpl := template.Must(template.New("").Funcs(funcs).Parse(tmplSource[lang]))
|
tmpl := template.Must(template.New("").Funcs(funcs).Parse(tmplSource[lang]))
|
||||||
if err := tmpl.Execute(buffer, data); err != nil {
|
if err := tmpl.Execute(buffer, data); err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,12 @@
|
||||||
|
|
||||||
package bind
|
package bind
|
||||||
|
|
||||||
import "github.com/ethereum/go-ethereum/accounts/abi"
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/accounts/abi"
|
||||||
|
)
|
||||||
|
|
||||||
// tmplData is the data structure required to fill the binding template.
|
// tmplData is the data structure required to fill the binding template.
|
||||||
type tmplData struct {
|
type tmplData struct {
|
||||||
|
|
@ -32,6 +37,7 @@ type tmplContract struct {
|
||||||
Constructor abi.Method // Contract constructor for deploy parametrization
|
Constructor abi.Method // Contract constructor for deploy parametrization
|
||||||
Calls map[string]*tmplMethod // Contract calls that only read state data
|
Calls map[string]*tmplMethod // Contract calls that only read state data
|
||||||
Transacts map[string]*tmplMethod // Contract calls that write state data
|
Transacts map[string]*tmplMethod // Contract calls that write state data
|
||||||
|
Events map[string]*tmplEvent // Contract events
|
||||||
}
|
}
|
||||||
|
|
||||||
// tmplMethod is a wrapper around an abi.Method that contains a few preprocessed
|
// tmplMethod is a wrapper around an abi.Method that contains a few preprocessed
|
||||||
|
|
@ -42,6 +48,39 @@ type tmplMethod struct {
|
||||||
Structured bool // Whether the returns should be accumulated into a contract
|
Structured bool // Whether the returns should be accumulated into a contract
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// tmplEvent is a wrapper around an abi.Event that contains a few preprocessed
|
||||||
|
// and cached data fields.
|
||||||
|
type tmplEvent struct {
|
||||||
|
Name string
|
||||||
|
Inputs []abi.Argument
|
||||||
|
ID string
|
||||||
|
Anonymous bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e tmplEvent) Canonical() string {
|
||||||
|
var (
|
||||||
|
args []string
|
||||||
|
anonymous string
|
||||||
|
)
|
||||||
|
|
||||||
|
for _, a := range e.Inputs {
|
||||||
|
indexed := ""
|
||||||
|
if a.Indexed {
|
||||||
|
indexed = " indexed"
|
||||||
|
}
|
||||||
|
if a.Name != "" {
|
||||||
|
args = append(args, fmt.Sprintf("%s%s %s", a.Type, indexed, a.Name))
|
||||||
|
} else {
|
||||||
|
args = append(args, fmt.Sprintf("%s%s", a.Type, indexed))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if e.Anonymous {
|
||||||
|
anonymous = " anonymous"
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("%s(%s)%s", e.Name, strings.Join(args, ", "), anonymous)
|
||||||
|
}
|
||||||
|
|
||||||
// tmplSource is language to template mapping containing all the supported
|
// tmplSource is language to template mapping containing all the supported
|
||||||
// programming languages the package can generate to.
|
// programming languages the package can generate to.
|
||||||
var tmplSource = map[Lang]string{
|
var tmplSource = map[Lang]string{
|
||||||
|
|
@ -83,6 +122,7 @@ package {{.Package}}
|
||||||
type {{.Type}} struct {
|
type {{.Type}} struct {
|
||||||
{{.Type}}Caller // Read-only binding to the contract
|
{{.Type}}Caller // Read-only binding to the contract
|
||||||
{{.Type}}Transactor // Write-only binding to the contract
|
{{.Type}}Transactor // Write-only binding to the contract
|
||||||
|
{{.Type}}Eventer // Event listener binding to the contract
|
||||||
}
|
}
|
||||||
|
|
||||||
// {{.Type}}Caller is an auto generated read-only Go binding around an Ethereum contract.
|
// {{.Type}}Caller is an auto generated read-only Go binding around an Ethereum contract.
|
||||||
|
|
@ -95,6 +135,12 @@ package {{.Package}}
|
||||||
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// {{.Type}}Eventer is an auto generated write-only Go binding around an Ethereum contract.
|
||||||
|
type {{.Type}}Eventer struct {
|
||||||
|
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||||
|
address common.Address // Contract address
|
||||||
|
}
|
||||||
|
|
||||||
// {{.Type}}Session is an auto generated Go binding around an Ethereum contract,
|
// {{.Type}}Session is an auto generated Go binding around an Ethereum contract,
|
||||||
// with pre-set call and transact options.
|
// with pre-set call and transact options.
|
||||||
type {{.Type}}Session struct {
|
type {{.Type}}Session struct {
|
||||||
|
|
@ -134,7 +180,7 @@ package {{.Package}}
|
||||||
|
|
||||||
// New{{.Type}} creates a new instance of {{.Type}}, bound to a specific deployed contract.
|
// New{{.Type}} creates a new instance of {{.Type}}, bound to a specific deployed contract.
|
||||||
func New{{.Type}}(address common.Address, backend bind.ContractBackend) (*{{.Type}}, error) {
|
func New{{.Type}}(address common.Address, backend bind.ContractBackend) (*{{.Type}}, error) {
|
||||||
contract, err := bind{{.Type}}(address, backend, backend)
|
contract, err := bind{{.Type}}(address, backend, backend, backend)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -143,7 +189,7 @@ package {{.Package}}
|
||||||
|
|
||||||
// New{{.Type}}Caller creates a new read-only instance of {{.Type}}, bound to a specific deployed contract.
|
// New{{.Type}}Caller creates a new read-only instance of {{.Type}}, bound to a specific deployed contract.
|
||||||
func New{{.Type}}Caller(address common.Address, caller bind.ContractCaller) (*{{.Type}}Caller, error) {
|
func New{{.Type}}Caller(address common.Address, caller bind.ContractCaller) (*{{.Type}}Caller, error) {
|
||||||
contract, err := bind{{.Type}}(address, caller, nil)
|
contract, err := bind{{.Type}}(address, caller, nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -152,20 +198,29 @@ package {{.Package}}
|
||||||
|
|
||||||
// New{{.Type}}Transactor creates a new write-only instance of {{.Type}}, bound to a specific deployed contract.
|
// New{{.Type}}Transactor creates a new write-only instance of {{.Type}}, bound to a specific deployed contract.
|
||||||
func New{{.Type}}Transactor(address common.Address, transactor bind.ContractTransactor) (*{{.Type}}Transactor, error) {
|
func New{{.Type}}Transactor(address common.Address, transactor bind.ContractTransactor) (*{{.Type}}Transactor, error) {
|
||||||
contract, err := bind{{.Type}}(address, nil, transactor)
|
contract, err := bind{{.Type}}(address, nil, transactor, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &{{.Type}}Transactor{contract: contract}, nil
|
return &{{.Type}}Transactor{contract: contract}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// New{{.Type}}Eventer creates a new listen only instance of {{.Type}}, bound to a specific deployed contract.
|
||||||
|
func New{{.Type}}Eventer(address common.Address, eventer bind.ContractEventer) (*{{.Type}}Eventer, error) {
|
||||||
|
contract, err := bind{{.Type}}(address, nil, nil, eventer)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &{{.Type}}Eventer{contract: contract, address: address}, nil
|
||||||
|
}
|
||||||
|
|
||||||
// bind{{.Type}} binds a generic wrapper to an already deployed contract.
|
// bind{{.Type}} binds a generic wrapper to an already deployed contract.
|
||||||
func bind{{.Type}}(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor) (*bind.BoundContract, error) {
|
func bind{{.Type}}(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, eventer bind.ContractEventer) (*bind.BoundContract, error) {
|
||||||
parsed, err := abi.JSON(strings.NewReader({{.Type}}ABI))
|
parsed, err := abi.JSON(strings.NewReader({{.Type}}ABI))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return bind.NewBoundContract(address, parsed, caller, transactor), nil
|
return bind.NewBoundContract(address, parsed, caller, transactor, eventer), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call invokes the (constant) contract method with params as input values and
|
// Call invokes the (constant) contract method with params as input values and
|
||||||
|
|
@ -263,6 +318,18 @@ package {{.Package}}
|
||||||
return _{{$contract.Type}}.Contract.{{.Normalized.Name}}(&_{{$contract.Type}}.TransactOpts {{range $i, $_ := .Normalized.Inputs}}, {{.Name}}{{end}})
|
return _{{$contract.Type}}.Contract.{{.Normalized.Name}}(&_{{$contract.Type}}.TransactOpts {{range $i, $_ := .Normalized.Inputs}}, {{.Name}}{{end}})
|
||||||
}
|
}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
{{range .Events}}
|
||||||
|
// Solidity: event {{.Canonical}}
|
||||||
|
//
|
||||||
|
// {{if not .Anonymous}}Note: this method will fill in the Event ID topic{{end}}
|
||||||
|
func (_{{$contract.Type}} *{{$contract.Type}}Eventer) Subscribe{{.Name}}(opts *bind.CallOpts, ch chan<- types.Log, topics ...[]common.Hash) (ethereum.Subscription, error) {
|
||||||
|
{{if not .Anonymous}}id := []common.Hash{common.HexToHash("{{.ID}}")}
|
||||||
|
topics = append([][]common.Hash{id}, topics...)
|
||||||
|
{{end}}
|
||||||
|
return _{{$contract.Type}}.contract.SubscribeFilterLogs(opts, topics, ch)
|
||||||
|
}
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// This file is an automatically generated Go binding. Do not modify as any
|
// Code generated - DO NOT EDIT.
|
||||||
// change will likely be lost upon the next re-generation!
|
// This file is a generated binding and any manual changes will be lost.
|
||||||
|
|
||||||
package contract
|
package contract
|
||||||
|
|
||||||
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"math/big"
|
"math/big"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
ethereum "github.com/ethereum/go-ethereum"
|
||||||
"github.com/ethereum/go-ethereum/accounts/abi"
|
"github.com/ethereum/go-ethereum/accounts/abi"
|
||||||
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
|
@ -14,10 +15,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// ChequebookABI is the input ABI used to generate the binding from.
|
// ChequebookABI is the input ABI used to generate the binding from.
|
||||||
const ChequebookABI = `[{"constant":false,"inputs":[],"name":"kill","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"sent","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"beneficiary","type":"address"},{"name":"amount","type":"uint256"},{"name":"sig_v","type":"uint8"},{"name":"sig_r","type":"bytes32"},{"name":"sig_s","type":"bytes32"}],"name":"cash","outputs":[],"type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"deadbeat","type":"address"}],"name":"Overdraft","type":"event"}]`
|
const ChequebookABI = "[{\"constant\":false,\"inputs\":[],\"name\":\"kill\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"}],\"name\":\"sent\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"beneficiary\",\"type\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\"},{\"name\":\"sig_v\",\"type\":\"uint8\"},{\"name\":\"sig_r\",\"type\":\"bytes32\"},{\"name\":\"sig_s\",\"type\":\"bytes32\"}],\"name\":\"cash\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"deadbeat\",\"type\":\"address\"}],\"name\":\"Overdraft\",\"type\":\"event\"}]"
|
||||||
|
|
||||||
// ChequebookBin is the compiled bytecode used for deploying new contracts.
|
// ChequebookBin is the compiled bytecode used for deploying new contracts.
|
||||||
const ChequebookBin = `0x606060405260008054600160a060020a031916331790556101ff806100246000396000f3606060405260e060020a600035046341c0e1b581146100315780637bf786f814610059578063fbf788d614610071575b005b61002f60005433600160a060020a03908116911614156100bd57600054600160a060020a0316ff5b6100ab60043560016020526000908152604090205481565b61002f600435602435604435606435608435600160a060020a03851660009081526001602052604081205485116100bf575b505050505050565b60408051918252519081900360200190f35b565b50604080516c0100000000000000000000000030600160a060020a0390811682028352881602601482015260288101869052815190819003604801812080825260ff861660208381019190915282840186905260608301859052925190926001926080818101939182900301816000866161da5a03f11561000257505060405151600054600160a060020a0390811691161461015a576100a3565b600160a060020a038681166000908152600160205260409020543090911631908603106101b357604060008181208790559051600160a060020a0388169190819081818181818881f1935050505015156100a357610002565b60005460408051600160a060020a03929092168252517f2250e2993c15843b32621c89447cc589ee7a9f049c026986e545d3c2c0c6f9789181900360200190a185600160a060020a0316ff`
|
const ChequebookBin = `0x606060405260008054600160a060020a033316600160a060020a03199091161790556102e8806100306000396000f300606060405263ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b581146100525780637bf786f814610067578063fbf788d61461009857600080fd5b341561005d57600080fd5b6100656100c6565b005b341561007257600080fd5b610086600160a060020a03600435166100ed565b60405190815260200160405180910390f35b34156100a357600080fd5b610065600160a060020a036004351660243560ff604435166064356084356100ff565b60005433600160a060020a03908116911614156100eb57600054600160a060020a0316ff5b565b60016020526000908152604090205481565b600160a060020a03851660009081526001602052604081205481908611610125576102b3565b3087876040516c01000000000000000000000000600160a060020a03948516810282529290931690910260148301526028820152604801604051809103902091506001828686866040516000815260200160405260006040516020015260405193845260ff90921660208085019190915260408085019290925260608401929092526080909201915160208103908084039060008661646e5a03f115156101cb57600080fd5b505060206040510351600054600160a060020a039081169116146101ee576102b3565b50600160a060020a03808716600090815260016020526040902054860390301631811161025e57600160a060020a0387166000818152600160205260409081902088905582156108fc0290839051600060405180830381858888f19350505050151561025957600080fd5b6102b3565b6000547f2250e2993c15843b32621c89447cc589ee7a9f049c026986e545d3c2c0c6f97890600160a060020a0316604051600160a060020a03909116815260200160405180910390a186600160a060020a0316ff5b505050505050505600a165627a7a72305820b3a1c2bd4b98d782f1e6fec27acc9a5c750c36171ccaf44c9da72718e8dc1b3c0029`
|
||||||
|
|
||||||
// DeployChequebook deploys a new Ethereum contract, binding an instance of Chequebook to it.
|
// DeployChequebook deploys a new Ethereum contract, binding an instance of Chequebook to it.
|
||||||
func DeployChequebook(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Chequebook, error) {
|
func DeployChequebook(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Chequebook, error) {
|
||||||
|
|
@ -36,6 +37,7 @@ func DeployChequebook(auth *bind.TransactOpts, backend bind.ContractBackend) (co
|
||||||
type Chequebook struct {
|
type Chequebook struct {
|
||||||
ChequebookCaller // Read-only binding to the contract
|
ChequebookCaller // Read-only binding to the contract
|
||||||
ChequebookTransactor // Write-only binding to the contract
|
ChequebookTransactor // Write-only binding to the contract
|
||||||
|
ChequebookEventer // Event listener binding to the contract
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChequebookCaller is an auto generated read-only Go binding around an Ethereum contract.
|
// ChequebookCaller is an auto generated read-only Go binding around an Ethereum contract.
|
||||||
|
|
@ -48,6 +50,12 @@ type ChequebookTransactor struct {
|
||||||
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ChequebookEventer is an auto generated write-only Go binding around an Ethereum contract.
|
||||||
|
type ChequebookEventer struct {
|
||||||
|
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||||
|
address common.Address // Contract address
|
||||||
|
}
|
||||||
|
|
||||||
// ChequebookSession is an auto generated Go binding around an Ethereum contract,
|
// ChequebookSession is an auto generated Go binding around an Ethereum contract,
|
||||||
// with pre-set call and transact options.
|
// with pre-set call and transact options.
|
||||||
type ChequebookSession struct {
|
type ChequebookSession struct {
|
||||||
|
|
@ -87,7 +95,7 @@ type ChequebookTransactorRaw struct {
|
||||||
|
|
||||||
// NewChequebook creates a new instance of Chequebook, bound to a specific deployed contract.
|
// NewChequebook creates a new instance of Chequebook, bound to a specific deployed contract.
|
||||||
func NewChequebook(address common.Address, backend bind.ContractBackend) (*Chequebook, error) {
|
func NewChequebook(address common.Address, backend bind.ContractBackend) (*Chequebook, error) {
|
||||||
contract, err := bindChequebook(address, backend, backend)
|
contract, err := bindChequebook(address, backend, backend, backend)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -96,7 +104,7 @@ func NewChequebook(address common.Address, backend bind.ContractBackend) (*Chequ
|
||||||
|
|
||||||
// NewChequebookCaller creates a new read-only instance of Chequebook, bound to a specific deployed contract.
|
// NewChequebookCaller creates a new read-only instance of Chequebook, bound to a specific deployed contract.
|
||||||
func NewChequebookCaller(address common.Address, caller bind.ContractCaller) (*ChequebookCaller, error) {
|
func NewChequebookCaller(address common.Address, caller bind.ContractCaller) (*ChequebookCaller, error) {
|
||||||
contract, err := bindChequebook(address, caller, nil)
|
contract, err := bindChequebook(address, caller, nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -105,20 +113,29 @@ func NewChequebookCaller(address common.Address, caller bind.ContractCaller) (*C
|
||||||
|
|
||||||
// NewChequebookTransactor creates a new write-only instance of Chequebook, bound to a specific deployed contract.
|
// NewChequebookTransactor creates a new write-only instance of Chequebook, bound to a specific deployed contract.
|
||||||
func NewChequebookTransactor(address common.Address, transactor bind.ContractTransactor) (*ChequebookTransactor, error) {
|
func NewChequebookTransactor(address common.Address, transactor bind.ContractTransactor) (*ChequebookTransactor, error) {
|
||||||
contract, err := bindChequebook(address, nil, transactor)
|
contract, err := bindChequebook(address, nil, transactor, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &ChequebookTransactor{contract: contract}, nil
|
return &ChequebookTransactor{contract: contract}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewChequebookEventer creates a new listen only instance of Chequebook, bound to a specific deployed contract.
|
||||||
|
func NewChequebookEventer(address common.Address, eventer bind.ContractEventer) (*ChequebookEventer, error) {
|
||||||
|
contract, err := bindChequebook(address, nil, nil, eventer)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &ChequebookEventer{contract: contract, address: address}, nil
|
||||||
|
}
|
||||||
|
|
||||||
// bindChequebook binds a generic wrapper to an already deployed contract.
|
// bindChequebook binds a generic wrapper to an already deployed contract.
|
||||||
func bindChequebook(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor) (*bind.BoundContract, error) {
|
func bindChequebook(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, eventer bind.ContractEventer) (*bind.BoundContract, error) {
|
||||||
parsed, err := abi.JSON(strings.NewReader(ChequebookABI))
|
parsed, err := abi.JSON(strings.NewReader(ChequebookABI))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return bind.NewBoundContract(address, parsed, caller, transactor), nil
|
return bind.NewBoundContract(address, parsed, caller, transactor, eventer), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call invokes the (constant) contract method with params as input values and
|
// Call invokes the (constant) contract method with params as input values and
|
||||||
|
|
@ -227,11 +244,21 @@ func (_Chequebook *ChequebookTransactorSession) Kill() (*types.Transaction, erro
|
||||||
return _Chequebook.Contract.Kill(&_Chequebook.TransactOpts)
|
return _Chequebook.Contract.Kill(&_Chequebook.TransactOpts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Solidity: event Overdraft(address deadbeat)
|
||||||
|
//
|
||||||
|
// Note: this method will fill in the Event ID topic
|
||||||
|
func (_Chequebook *ChequebookCaller) SubscribeOverdraft(opts *bind.CallOpts, ch chan<- types.Log, topics ...[]common.Hash) (ethereum.Subscription, error) {
|
||||||
|
id := []common.Hash{common.HexToHash("2250e2993c15843b32621c89447cc589ee7a9f049c026986e545d3c2c0c6f978")}
|
||||||
|
topics = append([][]common.Hash{id}, topics...)
|
||||||
|
|
||||||
|
return _Chequebook.contract.SubscribeFilterLogs(opts, topics, ch)
|
||||||
|
}
|
||||||
|
|
||||||
// MortalABI is the input ABI used to generate the binding from.
|
// MortalABI is the input ABI used to generate the binding from.
|
||||||
const MortalABI = `[{"constant":false,"inputs":[],"name":"kill","outputs":[],"type":"function"}]`
|
const MortalABI = "[{\"constant\":false,\"inputs\":[],\"name\":\"kill\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
|
||||||
|
|
||||||
// MortalBin is the compiled bytecode used for deploying new contracts.
|
// MortalBin is the compiled bytecode used for deploying new contracts.
|
||||||
const MortalBin = `0x606060405260008054600160a060020a03191633179055605c8060226000396000f3606060405260e060020a600035046341c0e1b58114601a575b005b60186000543373ffffffffffffffffffffffffffffffffffffffff90811691161415605a5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b56`
|
const MortalBin = `0x606060405260008054600160a060020a033316600160a060020a031990911617905560b98061002f6000396000f300606060405263ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b58114603b57600080fd5b3415604557600080fd5b604b604d565b005b6000543373ffffffffffffffffffffffffffffffffffffffff90811691161415608b5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b5600a165627a7a72305820867692aada3a78bdb36ad4ba0b9181a440566917df3e5416cc4de17ed0a633710029`
|
||||||
|
|
||||||
// DeployMortal deploys a new Ethereum contract, binding an instance of Mortal to it.
|
// DeployMortal deploys a new Ethereum contract, binding an instance of Mortal to it.
|
||||||
func DeployMortal(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Mortal, error) {
|
func DeployMortal(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Mortal, error) {
|
||||||
|
|
@ -250,6 +277,7 @@ func DeployMortal(auth *bind.TransactOpts, backend bind.ContractBackend) (common
|
||||||
type Mortal struct {
|
type Mortal struct {
|
||||||
MortalCaller // Read-only binding to the contract
|
MortalCaller // Read-only binding to the contract
|
||||||
MortalTransactor // Write-only binding to the contract
|
MortalTransactor // Write-only binding to the contract
|
||||||
|
MortalEventer // Event listener binding to the contract
|
||||||
}
|
}
|
||||||
|
|
||||||
// MortalCaller is an auto generated read-only Go binding around an Ethereum contract.
|
// MortalCaller is an auto generated read-only Go binding around an Ethereum contract.
|
||||||
|
|
@ -262,6 +290,12 @@ type MortalTransactor struct {
|
||||||
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MortalEventer is an auto generated write-only Go binding around an Ethereum contract.
|
||||||
|
type MortalEventer struct {
|
||||||
|
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||||
|
address common.Address // Contract address
|
||||||
|
}
|
||||||
|
|
||||||
// MortalSession is an auto generated Go binding around an Ethereum contract,
|
// MortalSession is an auto generated Go binding around an Ethereum contract,
|
||||||
// with pre-set call and transact options.
|
// with pre-set call and transact options.
|
||||||
type MortalSession struct {
|
type MortalSession struct {
|
||||||
|
|
@ -301,7 +335,7 @@ type MortalTransactorRaw struct {
|
||||||
|
|
||||||
// NewMortal creates a new instance of Mortal, bound to a specific deployed contract.
|
// NewMortal creates a new instance of Mortal, bound to a specific deployed contract.
|
||||||
func NewMortal(address common.Address, backend bind.ContractBackend) (*Mortal, error) {
|
func NewMortal(address common.Address, backend bind.ContractBackend) (*Mortal, error) {
|
||||||
contract, err := bindMortal(address, backend, backend)
|
contract, err := bindMortal(address, backend, backend, backend)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -310,7 +344,7 @@ func NewMortal(address common.Address, backend bind.ContractBackend) (*Mortal, e
|
||||||
|
|
||||||
// NewMortalCaller creates a new read-only instance of Mortal, bound to a specific deployed contract.
|
// NewMortalCaller creates a new read-only instance of Mortal, bound to a specific deployed contract.
|
||||||
func NewMortalCaller(address common.Address, caller bind.ContractCaller) (*MortalCaller, error) {
|
func NewMortalCaller(address common.Address, caller bind.ContractCaller) (*MortalCaller, error) {
|
||||||
contract, err := bindMortal(address, caller, nil)
|
contract, err := bindMortal(address, caller, nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -319,20 +353,29 @@ func NewMortalCaller(address common.Address, caller bind.ContractCaller) (*Morta
|
||||||
|
|
||||||
// NewMortalTransactor creates a new write-only instance of Mortal, bound to a specific deployed contract.
|
// NewMortalTransactor creates a new write-only instance of Mortal, bound to a specific deployed contract.
|
||||||
func NewMortalTransactor(address common.Address, transactor bind.ContractTransactor) (*MortalTransactor, error) {
|
func NewMortalTransactor(address common.Address, transactor bind.ContractTransactor) (*MortalTransactor, error) {
|
||||||
contract, err := bindMortal(address, nil, transactor)
|
contract, err := bindMortal(address, nil, transactor, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &MortalTransactor{contract: contract}, nil
|
return &MortalTransactor{contract: contract}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewMortalEventer creates a new listen only instance of Mortal, bound to a specific deployed contract.
|
||||||
|
func NewMortalEventer(address common.Address, eventer bind.ContractEventer) (*MortalEventer, error) {
|
||||||
|
contract, err := bindMortal(address, nil, nil, eventer)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &MortalEventer{contract: contract, address: address}, nil
|
||||||
|
}
|
||||||
|
|
||||||
// bindMortal binds a generic wrapper to an already deployed contract.
|
// bindMortal binds a generic wrapper to an already deployed contract.
|
||||||
func bindMortal(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor) (*bind.BoundContract, error) {
|
func bindMortal(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, eventer bind.ContractEventer) (*bind.BoundContract, error) {
|
||||||
parsed, err := abi.JSON(strings.NewReader(MortalABI))
|
parsed, err := abi.JSON(strings.NewReader(MortalABI))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return bind.NewBoundContract(address, parsed, caller, transactor), nil
|
return bind.NewBoundContract(address, parsed, caller, transactor, eventer), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call invokes the (constant) contract method with params as input values and
|
// Call invokes the (constant) contract method with params as input values and
|
||||||
|
|
@ -395,10 +438,10 @@ func (_Mortal *MortalTransactorSession) Kill() (*types.Transaction, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// OwnedABI is the input ABI used to generate the binding from.
|
// OwnedABI is the input ABI used to generate the binding from.
|
||||||
const OwnedABI = `[{"inputs":[],"type":"constructor"}]`
|
const OwnedABI = "[{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}]"
|
||||||
|
|
||||||
// OwnedBin is the compiled bytecode used for deploying new contracts.
|
// OwnedBin is the compiled bytecode used for deploying new contracts.
|
||||||
const OwnedBin = `0x606060405260008054600160a060020a0319163317905560068060226000396000f3606060405200`
|
const OwnedBin = `0x60606040523415600e57600080fd5b60008054600160a060020a033316600160a060020a031990911617905560358060386000396000f3006060604052600080fd00a165627a7a72305820e54b308f1b7c92d99b6f3d202299b9edb321527608e31a7d1829dbe638fc80c40029`
|
||||||
|
|
||||||
// DeployOwned deploys a new Ethereum contract, binding an instance of Owned to it.
|
// DeployOwned deploys a new Ethereum contract, binding an instance of Owned to it.
|
||||||
func DeployOwned(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Owned, error) {
|
func DeployOwned(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Owned, error) {
|
||||||
|
|
@ -417,6 +460,7 @@ func DeployOwned(auth *bind.TransactOpts, backend bind.ContractBackend) (common.
|
||||||
type Owned struct {
|
type Owned struct {
|
||||||
OwnedCaller // Read-only binding to the contract
|
OwnedCaller // Read-only binding to the contract
|
||||||
OwnedTransactor // Write-only binding to the contract
|
OwnedTransactor // Write-only binding to the contract
|
||||||
|
OwnedEventer // Event listener binding to the contract
|
||||||
}
|
}
|
||||||
|
|
||||||
// OwnedCaller is an auto generated read-only Go binding around an Ethereum contract.
|
// OwnedCaller is an auto generated read-only Go binding around an Ethereum contract.
|
||||||
|
|
@ -429,6 +473,12 @@ type OwnedTransactor struct {
|
||||||
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OwnedEventer is an auto generated write-only Go binding around an Ethereum contract.
|
||||||
|
type OwnedEventer struct {
|
||||||
|
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||||
|
address common.Address // Contract address
|
||||||
|
}
|
||||||
|
|
||||||
// OwnedSession is an auto generated Go binding around an Ethereum contract,
|
// OwnedSession is an auto generated Go binding around an Ethereum contract,
|
||||||
// with pre-set call and transact options.
|
// with pre-set call and transact options.
|
||||||
type OwnedSession struct {
|
type OwnedSession struct {
|
||||||
|
|
@ -468,7 +518,7 @@ type OwnedTransactorRaw struct {
|
||||||
|
|
||||||
// NewOwned creates a new instance of Owned, bound to a specific deployed contract.
|
// NewOwned creates a new instance of Owned, bound to a specific deployed contract.
|
||||||
func NewOwned(address common.Address, backend bind.ContractBackend) (*Owned, error) {
|
func NewOwned(address common.Address, backend bind.ContractBackend) (*Owned, error) {
|
||||||
contract, err := bindOwned(address, backend, backend)
|
contract, err := bindOwned(address, backend, backend, backend)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -477,7 +527,7 @@ func NewOwned(address common.Address, backend bind.ContractBackend) (*Owned, err
|
||||||
|
|
||||||
// NewOwnedCaller creates a new read-only instance of Owned, bound to a specific deployed contract.
|
// NewOwnedCaller creates a new read-only instance of Owned, bound to a specific deployed contract.
|
||||||
func NewOwnedCaller(address common.Address, caller bind.ContractCaller) (*OwnedCaller, error) {
|
func NewOwnedCaller(address common.Address, caller bind.ContractCaller) (*OwnedCaller, error) {
|
||||||
contract, err := bindOwned(address, caller, nil)
|
contract, err := bindOwned(address, caller, nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -486,20 +536,29 @@ func NewOwnedCaller(address common.Address, caller bind.ContractCaller) (*OwnedC
|
||||||
|
|
||||||
// NewOwnedTransactor creates a new write-only instance of Owned, bound to a specific deployed contract.
|
// NewOwnedTransactor creates a new write-only instance of Owned, bound to a specific deployed contract.
|
||||||
func NewOwnedTransactor(address common.Address, transactor bind.ContractTransactor) (*OwnedTransactor, error) {
|
func NewOwnedTransactor(address common.Address, transactor bind.ContractTransactor) (*OwnedTransactor, error) {
|
||||||
contract, err := bindOwned(address, nil, transactor)
|
contract, err := bindOwned(address, nil, transactor, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &OwnedTransactor{contract: contract}, nil
|
return &OwnedTransactor{contract: contract}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewOwnedEventer creates a new listen only instance of Owned, bound to a specific deployed contract.
|
||||||
|
func NewOwnedEventer(address common.Address, eventer bind.ContractEventer) (*OwnedEventer, error) {
|
||||||
|
contract, err := bindOwned(address, nil, nil, eventer)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &OwnedEventer{contract: contract, address: address}, nil
|
||||||
|
}
|
||||||
|
|
||||||
// bindOwned binds a generic wrapper to an already deployed contract.
|
// bindOwned binds a generic wrapper to an already deployed contract.
|
||||||
func bindOwned(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor) (*bind.BoundContract, error) {
|
func bindOwned(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, eventer bind.ContractEventer) (*bind.BoundContract, error) {
|
||||||
parsed, err := abi.JSON(strings.NewReader(OwnedABI))
|
parsed, err := abi.JSON(strings.NewReader(OwnedABI))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return bind.NewBoundContract(address, parsed, caller, transactor), nil
|
return bind.NewBoundContract(address, parsed, caller, transactor, eventer), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call invokes the (constant) contract method with params as input values and
|
// Call invokes the (constant) contract method with params as input values and
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,22 @@
|
||||||
import "mortal";
|
contract owned {
|
||||||
|
address owner;
|
||||||
|
|
||||||
|
function owned() {
|
||||||
|
owner = msg.sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
modifier onlyowner() {
|
||||||
|
if (msg.sender == owner) {
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
contract mortal is owned {
|
||||||
|
function kill() {
|
||||||
|
if (msg.sender == owner) suicide(owner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// @title Chequebook for Ethereum micropayments
|
/// @title Chequebook for Ethereum micropayments
|
||||||
/// @author Daniel A. Nagy <daniel@ethdev.com>
|
/// @author Daniel A. Nagy <daniel@ethdev.com>
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,4 @@ package contract
|
||||||
|
|
||||||
// ContractDeployedCode is used to detect suicides. This constant needs to be
|
// ContractDeployedCode is used to detect suicides. This constant needs to be
|
||||||
// updated when the contract code is changed.
|
// updated when the contract code is changed.
|
||||||
const ContractDeployedCode = "0x606060405260e060020a600035046341c0e1b581146100315780637bf786f814610059578063fbf788d614610071575b005b61002f60005433600160a060020a03908116911614156100bd57600054600160a060020a0316ff5b6100ab60043560016020526000908152604090205481565b61002f600435602435604435606435608435600160a060020a03851660009081526001602052604081205485116100bf575b505050505050565b60408051918252519081900360200190f35b565b50604080516c0100000000000000000000000030600160a060020a0390811682028352881602601482015260288101869052815190819003604801812080825260ff861660208381019190915282840186905260608301859052925190926001926080818101939182900301816000866161da5a03f11561000257505060405151600054600160a060020a0390811691161461015a576100a3565b600160a060020a038681166000908152600160205260409020543090911631908603106101b357604060008181208790559051600160a060020a0388169190819081818181818881f1935050505015156100a357610002565b60005460408051600160a060020a03929092168252517f2250e2993c15843b32621c89447cc589ee7a9f049c026986e545d3c2c0c6f9789181900360200190a185600160a060020a0316ff"
|
const ContractDeployedCode = "0x606060405263ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b581146100525780637bf786f814610067578063fbf788d61461009857600080fd5b341561005d57600080fd5b6100656100c6565b005b341561007257600080fd5b610086600160a060020a03600435166100ed565b60405190815260200160405180910390f35b34156100a357600080fd5b610065600160a060020a036004351660243560ff604435166064356084356100ff565b60005433600160a060020a03908116911614156100eb57600054600160a060020a0316ff5b565b60016020526000908152604090205481565b600160a060020a03851660009081526001602052604081205481908611610125576102b3565b3087876040516c01000000000000000000000000600160a060020a03948516810282529290931690910260148301526028820152604801604051809103902091506001828686866040516000815260200160405260006040516020015260405193845260ff90921660208085019190915260408085019290925260608401929092526080909201915160208103908084039060008661646e5a03f115156101cb57600080fd5b505060206040510351600054600160a060020a039081169116146101ee576102b3565b50600160a060020a03808716600090815260016020526040902054860390301631811161025e57600160a060020a0387166000818152600160205260409081902088905582156108fc0290839051600060405180830381858888f19350505050151561025957600080fd5b6102b3565b6000547f2250e2993c15843b32621c89447cc589ee7a9f049c026986e545d3c2c0c6f97890600160a060020a0316604051600160a060020a03909116815260200160405180910390a186600160a060020a0316ff5b505050505050505600a165627a7a72305820b3a1c2bd4b98d782f1e6fec27acc9a5c750c36171ccaf44c9da72718e8dc1b3c0029"
|
||||||
|
|
|
||||||
|
|
@ -32,16 +32,16 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
|
||||||
testAccount = core.GenesisAccount{
|
|
||||||
Address: crypto.PubkeyToAddress(testKey.PublicKey),
|
|
||||||
Balance: big.NewInt(500000000000),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
backend := backends.NewSimulatedBackend(testAccount)
|
testKey, _ := crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
||||||
|
alloc := core.GenesisAlloc{
|
||||||
|
crypto.PubkeyToAddress(testKey.PublicKey): {
|
||||||
|
PrivateKey: crypto.FromECDSA(testKey),
|
||||||
|
Balance: big.NewInt(500000000000),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
backend := backends.NewSimulatedBackend(alloc)
|
||||||
auth := bind.NewKeyedTransactor(testKey)
|
auth := bind.NewKeyedTransactor(testKey)
|
||||||
|
|
||||||
// Deploy the contract, get the code.
|
// Deploy the contract, get the code.
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
// This file is an automatically generated Go binding. Do not modify as any
|
// Code generated - DO NOT EDIT.
|
||||||
// change will likely be lost upon the next re-generation!
|
// This file is a generated binding and any manual changes will be lost.
|
||||||
|
|
||||||
package contract
|
package contract
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
ethereum "github.com/ethereum/go-ethereum"
|
||||||
"github.com/ethereum/go-ethereum/accounts/abi"
|
"github.com/ethereum/go-ethereum/accounts/abi"
|
||||||
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
|
@ -13,10 +14,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// ENSABI is the input ABI used to generate the binding from.
|
// ENSABI is the input ABI used to generate the binding from.
|
||||||
const ENSABI = `[{"constant":true,"inputs":[{"name":"node","type":"bytes32"}],"name":"resolver","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":true,"inputs":[{"name":"node","type":"bytes32"}],"name":"owner","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"label","type":"bytes32"},{"name":"owner","type":"address"}],"name":"setSubnodeOwner","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"resolver","type":"address"}],"name":"setResolver","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"owner","type":"address"}],"name":"setOwner","outputs":[],"type":"function"},{"inputs":[{"name":"owner","type":"address"}],"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"node","type":"bytes32"},{"indexed":true,"name":"label","type":"bytes32"},{"indexed":false,"name":"owner","type":"address"}],"name":"NewOwner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"node","type":"bytes32"},{"indexed":false,"name":"owner","type":"address"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"node","type":"bytes32"},{"indexed":false,"name":"resolver","type":"address"}],"name":"NewResolver","type":"event"}]`
|
const ENSABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"resolver\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"label\",\"type\":\"bytes32\"},{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"setSubnodeOwner\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"setResolver\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"name\":\"label\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"NewOwner\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"NewResolver\",\"type\":\"event\"}]"
|
||||||
|
|
||||||
// ENSBin is the compiled bytecode used for deploying new contracts.
|
// ENSBin is the compiled bytecode used for deploying new contracts.
|
||||||
const ENSBin = `0x606060405260405160208061032683395060806040525160008080526020527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb58054600160a060020a03191682179055506102c88061005e6000396000f3606060405260e060020a60003504630178b8bf811461004757806302571be31461006e57806306ab5923146100915780631896f70a146100c85780635b0fc9c3146100fc575b005b610130600435600081815260208190526040902060010154600160a060020a03165b919050565b610130600435600081815260208190526040902054600160a060020a0316610069565b6100456004356024356044356000838152602081905260408120548490600160a060020a0390811633919091161461014d57610002565b6100456004356024356000828152602081905260409020548290600160a060020a039081163391909116146101e757610002565b6100456004356024356000828152602081905260409020548290600160a060020a0390811633919091161461025957610002565b60408051600160a060020a03929092168252519081900360200190f35b60408051868152602081810187905282519182900383018220600160a060020a03871683529251929450869288927fce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e8292908290030190a382600060005060008460001916815260200190815260200160002060005060000160006101000a815481600160a060020a03021916908302179055505050505050565b60408051600160a060020a0384168152905184917f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a0919081900360200190a2506000828152602081905260409020600101805473ffffffffffffffffffffffffffffffffffffffff1916821790555050565b60408051600160a060020a0384168152905184917fd4735d920b0f87494915f556dd9b54c8f309026070caea5c737245152564d266919081900360200190a2506000828152602081905260409020805473ffffffffffffffffffffffffffffffffffffffff191682179055505056`
|
const ENSBin = `0x6060604052341561000f57600080fd5b6040516020806104068339810160405280805160008080526020527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb58054600160a060020a03909216600160a060020a0319909216919091179055505061038b8061007b6000396000f300606060405263ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630178b8bf811461006857806302571be31461009a57806306ab5923146100b05780631896f70a146100d75780635b0fc9c3146100f957600080fd5b341561007357600080fd5b61007e60043561011b565b604051600160a060020a03909116815260200160405180910390f35b34156100a557600080fd5b61007e600435610139565b34156100bb57600080fd5b6100d5600435602435600160a060020a0360443516610154565b005b34156100e257600080fd5b6100d5600435600160a060020a0360243516610216565b341561010457600080fd5b6100d5600435600160a060020a03602435166102bc565b600090815260208190526040902060010154600160a060020a031690565b600090815260208190526040902054600160a060020a031690565b600083815260208190526040812054849033600160a060020a0390811691161461017d57600080fd5b8484604051918252602082015260409081019051908190039020915083857fce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e8285604051600160a060020a03909116815260200160405180910390a3506000908152602081905260409020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555050565b600082815260208190526040902054829033600160a060020a0390811691161461023f57600080fd5b827f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a083604051600160a060020a03909116815260200160405180910390a250600091825260208290526040909120600101805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03909216919091179055565b600082815260208190526040902054829033600160a060020a039081169116146102e557600080fd5b827fd4735d920b0f87494915f556dd9b54c8f309026070caea5c737245152564d26683604051600160a060020a03909116815260200160405180910390a250600091825260208290526040909120805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039092169190911790555600a165627a7a723058201688b733fec0724299316d2a5da097e557f512618a9391f556b1cd523512ed5a0029`
|
||||||
|
|
||||||
// DeployENS deploys a new Ethereum contract, binding an instance of ENS to it.
|
// DeployENS deploys a new Ethereum contract, binding an instance of ENS to it.
|
||||||
func DeployENS(auth *bind.TransactOpts, backend bind.ContractBackend, owner common.Address) (common.Address, *types.Transaction, *ENS, error) {
|
func DeployENS(auth *bind.TransactOpts, backend bind.ContractBackend, owner common.Address) (common.Address, *types.Transaction, *ENS, error) {
|
||||||
|
|
@ -35,6 +36,7 @@ func DeployENS(auth *bind.TransactOpts, backend bind.ContractBackend, owner comm
|
||||||
type ENS struct {
|
type ENS struct {
|
||||||
ENSCaller // Read-only binding to the contract
|
ENSCaller // Read-only binding to the contract
|
||||||
ENSTransactor // Write-only binding to the contract
|
ENSTransactor // Write-only binding to the contract
|
||||||
|
ENSEventer // Event listener binding to the contract
|
||||||
}
|
}
|
||||||
|
|
||||||
// ENSCaller is an auto generated read-only Go binding around an Ethereum contract.
|
// ENSCaller is an auto generated read-only Go binding around an Ethereum contract.
|
||||||
|
|
@ -47,6 +49,12 @@ type ENSTransactor struct {
|
||||||
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ENSEventer is an auto generated write-only Go binding around an Ethereum contract.
|
||||||
|
type ENSEventer struct {
|
||||||
|
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||||
|
address common.Address // Contract address
|
||||||
|
}
|
||||||
|
|
||||||
// ENSSession is an auto generated Go binding around an Ethereum contract,
|
// ENSSession is an auto generated Go binding around an Ethereum contract,
|
||||||
// with pre-set call and transact options.
|
// with pre-set call and transact options.
|
||||||
type ENSSession struct {
|
type ENSSession struct {
|
||||||
|
|
@ -86,7 +94,7 @@ type ENSTransactorRaw struct {
|
||||||
|
|
||||||
// NewENS creates a new instance of ENS, bound to a specific deployed contract.
|
// NewENS creates a new instance of ENS, bound to a specific deployed contract.
|
||||||
func NewENS(address common.Address, backend bind.ContractBackend) (*ENS, error) {
|
func NewENS(address common.Address, backend bind.ContractBackend) (*ENS, error) {
|
||||||
contract, err := bindENS(address, backend, backend)
|
contract, err := bindENS(address, backend, backend, backend)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -95,7 +103,7 @@ func NewENS(address common.Address, backend bind.ContractBackend) (*ENS, error)
|
||||||
|
|
||||||
// NewENSCaller creates a new read-only instance of ENS, bound to a specific deployed contract.
|
// NewENSCaller creates a new read-only instance of ENS, bound to a specific deployed contract.
|
||||||
func NewENSCaller(address common.Address, caller bind.ContractCaller) (*ENSCaller, error) {
|
func NewENSCaller(address common.Address, caller bind.ContractCaller) (*ENSCaller, error) {
|
||||||
contract, err := bindENS(address, caller, nil)
|
contract, err := bindENS(address, caller, nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -104,20 +112,29 @@ func NewENSCaller(address common.Address, caller bind.ContractCaller) (*ENSCalle
|
||||||
|
|
||||||
// NewENSTransactor creates a new write-only instance of ENS, bound to a specific deployed contract.
|
// NewENSTransactor creates a new write-only instance of ENS, bound to a specific deployed contract.
|
||||||
func NewENSTransactor(address common.Address, transactor bind.ContractTransactor) (*ENSTransactor, error) {
|
func NewENSTransactor(address common.Address, transactor bind.ContractTransactor) (*ENSTransactor, error) {
|
||||||
contract, err := bindENS(address, nil, transactor)
|
contract, err := bindENS(address, nil, transactor, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &ENSTransactor{contract: contract}, nil
|
return &ENSTransactor{contract: contract}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewENSEventer creates a new listen only instance of ENS, bound to a specific deployed contract.
|
||||||
|
func NewENSEventer(address common.Address, eventer bind.ContractEventer) (*ENSEventer, error) {
|
||||||
|
contract, err := bindENS(address, nil, nil, eventer)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &ENSEventer{contract: contract, address: address}, nil
|
||||||
|
}
|
||||||
|
|
||||||
// bindENS binds a generic wrapper to an already deployed contract.
|
// bindENS binds a generic wrapper to an already deployed contract.
|
||||||
func bindENS(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor) (*bind.BoundContract, error) {
|
func bindENS(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, eventer bind.ContractEventer) (*bind.BoundContract, error) {
|
||||||
parsed, err := abi.JSON(strings.NewReader(ENSABI))
|
parsed, err := abi.JSON(strings.NewReader(ENSABI))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return bind.NewBoundContract(address, parsed, caller, transactor), nil
|
return bind.NewBoundContract(address, parsed, caller, transactor, eventer), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call invokes the (constant) contract method with params as input values and
|
// Call invokes the (constant) contract method with params as input values and
|
||||||
|
|
@ -273,11 +290,41 @@ func (_ENS *ENSTransactorSession) SetSubnodeOwner(node [32]byte, label [32]byte,
|
||||||
return _ENS.Contract.SetSubnodeOwner(&_ENS.TransactOpts, node, label, owner)
|
return _ENS.Contract.SetSubnodeOwner(&_ENS.TransactOpts, node, label, owner)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Solidity: event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner)
|
||||||
|
//
|
||||||
|
// Note: this method will fill in the Event ID topic
|
||||||
|
func (_ENS *ENSCaller) SubscribeNewOwner(opts *bind.CallOpts, ch chan<- types.Log, topics ...[]common.Hash) (ethereum.Subscription, error) {
|
||||||
|
id := []common.Hash{common.HexToHash("ce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82")}
|
||||||
|
topics = append([][]common.Hash{id}, topics...)
|
||||||
|
|
||||||
|
return _ENS.contract.SubscribeFilterLogs(opts, topics, ch)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Solidity: event NewResolver(bytes32 indexed node, address resolver)
|
||||||
|
//
|
||||||
|
// Note: this method will fill in the Event ID topic
|
||||||
|
func (_ENS *ENSCaller) SubscribeNewResolver(opts *bind.CallOpts, ch chan<- types.Log, topics ...[]common.Hash) (ethereum.Subscription, error) {
|
||||||
|
id := []common.Hash{common.HexToHash("335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a0")}
|
||||||
|
topics = append([][]common.Hash{id}, topics...)
|
||||||
|
|
||||||
|
return _ENS.contract.SubscribeFilterLogs(opts, topics, ch)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Solidity: event Transfer(bytes32 indexed node, address owner)
|
||||||
|
//
|
||||||
|
// Note: this method will fill in the Event ID topic
|
||||||
|
func (_ENS *ENSCaller) SubscribeTransfer(opts *bind.CallOpts, ch chan<- types.Log, topics ...[]common.Hash) (ethereum.Subscription, error) {
|
||||||
|
id := []common.Hash{common.HexToHash("d4735d920b0f87494915f556dd9b54c8f309026070caea5c737245152564d266")}
|
||||||
|
topics = append([][]common.Hash{id}, topics...)
|
||||||
|
|
||||||
|
return _ENS.contract.SubscribeFilterLogs(opts, topics, ch)
|
||||||
|
}
|
||||||
|
|
||||||
// FIFSRegistrarABI is the input ABI used to generate the binding from.
|
// FIFSRegistrarABI is the input ABI used to generate the binding from.
|
||||||
const FIFSRegistrarABI = `[{"constant":false,"inputs":[{"name":"subnode","type":"bytes32"},{"name":"owner","type":"address"}],"name":"register","outputs":[],"type":"function"},{"inputs":[{"name":"ensAddr","type":"address"},{"name":"node","type":"bytes32"}],"type":"constructor"}]`
|
const FIFSRegistrarABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"subnode\",\"type\":\"bytes32\"},{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"register\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"ensAddr\",\"type\":\"address\"},{\"name\":\"node\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}]"
|
||||||
|
|
||||||
// FIFSRegistrarBin is the compiled bytecode used for deploying new contracts.
|
// FIFSRegistrarBin is the compiled bytecode used for deploying new contracts.
|
||||||
const FIFSRegistrarBin = `0x6060604081815280610620833960a090525160805160008054600160a060020a031916831790558160a0610367806100878339018082600160a060020a03168152602001915050604051809103906000f0600160006101000a815481600160a060020a0302191690830217905550806002600050819055505050610232806103ee6000396000f3606060405260405160208061036783395060806040525160008054600160a060020a0319168217905550610330806100376000396000f36060604052361561004b5760e060020a60003504632dff694181146100535780633b3b57de1461007557806341b9dc2b146100a0578063c3d014d614610139578063d5fa2b00146101b2575b61022b610002565b61022d6004356000818152600260205260408120549081141561027057610002565b61023f600435600081815260016020526040812054600160a060020a03169081141561027057610002565b61025c60043560243560007f6164647200000000000000000000000000000000000000000000000000000000821480156100f05750600083815260016020526040812054600160a060020a031614155b8061013257507f636f6e74656e740000000000000000000000000000000000000000000000000082148015610132575060008381526002602052604081205414155b9392505050565b61022b600435602435600080546040805160e060020a6302571be30281526004810186905290518593600160a060020a033381169416926302571be392602482810193602093839003909101908290876161da5a03f11561000257505060405151600160a060020a031691909114905061027557610002565b61022b600435602435600080546040805160e060020a6302571be30281526004810186905290518593600160a060020a033381169416926302571be392602482810193602093839003909101908290876161da5a03f11561000257505060405151600160a060020a03169190911490506102c157610002565b005b60408051918252519081900360200190f35b60408051600160a060020a03929092168252519081900360200190f35b604080519115158252519081900360200190f35b919050565b6000838152600260209081526040918290208490558151848152915185927f0424b6fe0d9c3bdbece0e7879dc241bb0c22e900be8b6c168b4ee08bd9bf83bc92908290030190a2505050565b600083815260016020908152604091829020805473ffffffffffffffffffffffffffffffffffffffff1916851790558151600160a060020a0385168152915185927f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd292908290030190a250505056606060405260e060020a6000350463d22057a9811461001b575b005b61001960043560243560025460408051918252602082810185905260008054835194859003840185207f02571be300000000000000000000000000000000000000000000000000000000865260048601819052935193949193600160a060020a03909116926302571be39260248181019391829003018187876161da5a03f11561000257505060405151915050600160a060020a0381166000148015906100d4575033600160a060020a031681600160a060020a031614155b156100de57610002565b60408051600080546002547f06ab592300000000000000000000000000000000000000000000000000000000845260048401526024830188905230600160a060020a03908116604485015293519316926306ab5923926064818101939291829003018183876161da5a03f11561000257505060008054600154604080517f1896f70a00000000000000000000000000000000000000000000000000000000815260048101889052600160a060020a0392831660248201529051929091169350631896f70a926044828101939192829003018183876161da5a03f11561000257505060008054604080517f5b0fc9c300000000000000000000000000000000000000000000000000000000815260048101879052600160a060020a0388811660248301529151929091169350635b0fc9c3926044828101939192829003018183876161da5a03f115610002575050505050505056`
|
const FIFSRegistrarBin = `0x6060604052341561000f57600080fd5b6040516040806107aa833981016040528080519190602001805160008054600160a060020a031916600160a060020a03861617905591508290506100516100a0565b600160a060020a039091168152602001604051809103906000f080151561007757600080fd5b60018054600160a060020a031916600160a060020a0392909216919091179055600255506100b0565b6040516104528061035883390190565b610299806100bf6000396000f300606060405263ffffffff60e060020a600035041663d22057a9811461002357600080fd5b341561002e57600080fd5b610045600435600160a060020a0360243516610047565b005b6000806002548460405191825260208201526040908101905190819003902060008054919350600160a060020a03909116906302571be39084906040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b15156100be57600080fd5b6102c65a03f115156100cf57600080fd5b5050506040518051915050600160a060020a03811615801590610104575033600160a060020a031681600160a060020a031614155b1561010e57600080fd5b600054600254600160a060020a03909116906306ab592390863060405160e060020a63ffffffff861602815260048101939093526024830191909152600160a060020a03166044820152606401600060405180830381600087803b151561017457600080fd5b6102c65a03f1151561018557600080fd5b5050600054600154600160a060020a039182169250631896f70a9185911660405160e060020a63ffffffff85160281526004810192909252600160a060020a03166024820152604401600060405180830381600087803b15156101e757600080fd5b6102c65a03f115156101f857600080fd5b5050600054600160a060020a03169050635b0fc9c3838560405160e060020a63ffffffff85160281526004810192909252600160a060020a03166024820152604401600060405180830381600087803b151561025357600080fd5b6102c65a03f1151561026457600080fd5b505050505050505600a165627a7a723058201e9755b9f5ff21d081d11be9376b988645d4d830325cbafb21d076dd6b8cbbd300296060604052341561000f57600080fd5b6040516020806104528339810160405280805160008054600160a060020a03909216600160a060020a031990921691909117905550506103fe806100546000396000f300606060405236156100515763ffffffff60e060020a6000350416632dff694181146100615780633b3b57de1461008957806341b9dc2b146100bb578063c3d014d6146100e8578063d5fa2b0014610103575b341561005c57600080fd5b600080fd5b341561006c57600080fd5b610077600435610125565b60405190815260200160405180910390f35b341561009457600080fd5b61009f600435610145565b604051600160a060020a03909116815260200160405180910390f35b34156100c657600080fd5b6100d4600435602435610169565b604051901515815260200160405180910390f35b34156100f357600080fd5b6101016004356024356101f9565b005b341561010e57600080fd5b610101600435600160a060020a03602435166102cf565b60008181526002602052604090205480151561014057600080fd5b919050565b600081815260016020526040902054600160a060020a031680151561014057600080fd5b60007f6164647200000000000000000000000000000000000000000000000000000000821480156101b05750600083815260016020526040902054600160a060020a031615155b806101f257507f636f6e74656e7400000000000000000000000000000000000000000000000000821480156101f2575060008381526002602052604090205415155b9392505050565b600080548391600160a060020a033381169216906302571be39084906040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b151561025257600080fd5b6102c65a03f1151561026357600080fd5b50505060405180519050600160a060020a031614151561028257600080fd5b6000838152600260205260409081902083905583907f0424b6fe0d9c3bdbece0e7879dc241bb0c22e900be8b6c168b4ee08bd9bf83bc9084905190815260200160405180910390a2505050565b600080548391600160a060020a033381169216906302571be39084906040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b151561032857600080fd5b6102c65a03f1151561033957600080fd5b50505060405180519050600160a060020a031614151561035857600080fd5b60008381526001602052604090819020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03851617905583907f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd290849051600160a060020a03909116815260200160405180910390a25050505600a165627a7a7230582033714cadfb6a68b1d60c392730668d3fd6da7e7e5cded2a84db2fa7cb7e955ad0029`
|
||||||
|
|
||||||
// DeployFIFSRegistrar deploys a new Ethereum contract, binding an instance of FIFSRegistrar to it.
|
// DeployFIFSRegistrar deploys a new Ethereum contract, binding an instance of FIFSRegistrar to it.
|
||||||
func DeployFIFSRegistrar(auth *bind.TransactOpts, backend bind.ContractBackend, ensAddr common.Address, node [32]byte) (common.Address, *types.Transaction, *FIFSRegistrar, error) {
|
func DeployFIFSRegistrar(auth *bind.TransactOpts, backend bind.ContractBackend, ensAddr common.Address, node [32]byte) (common.Address, *types.Transaction, *FIFSRegistrar, error) {
|
||||||
|
|
@ -296,6 +343,7 @@ func DeployFIFSRegistrar(auth *bind.TransactOpts, backend bind.ContractBackend,
|
||||||
type FIFSRegistrar struct {
|
type FIFSRegistrar struct {
|
||||||
FIFSRegistrarCaller // Read-only binding to the contract
|
FIFSRegistrarCaller // Read-only binding to the contract
|
||||||
FIFSRegistrarTransactor // Write-only binding to the contract
|
FIFSRegistrarTransactor // Write-only binding to the contract
|
||||||
|
FIFSRegistrarEventer // Event listener binding to the contract
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIFSRegistrarCaller is an auto generated read-only Go binding around an Ethereum contract.
|
// FIFSRegistrarCaller is an auto generated read-only Go binding around an Ethereum contract.
|
||||||
|
|
@ -308,6 +356,12 @@ type FIFSRegistrarTransactor struct {
|
||||||
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIFSRegistrarEventer is an auto generated write-only Go binding around an Ethereum contract.
|
||||||
|
type FIFSRegistrarEventer struct {
|
||||||
|
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||||
|
address common.Address // Contract address
|
||||||
|
}
|
||||||
|
|
||||||
// FIFSRegistrarSession is an auto generated Go binding around an Ethereum contract,
|
// FIFSRegistrarSession is an auto generated Go binding around an Ethereum contract,
|
||||||
// with pre-set call and transact options.
|
// with pre-set call and transact options.
|
||||||
type FIFSRegistrarSession struct {
|
type FIFSRegistrarSession struct {
|
||||||
|
|
@ -347,7 +401,7 @@ type FIFSRegistrarTransactorRaw struct {
|
||||||
|
|
||||||
// NewFIFSRegistrar creates a new instance of FIFSRegistrar, bound to a specific deployed contract.
|
// NewFIFSRegistrar creates a new instance of FIFSRegistrar, bound to a specific deployed contract.
|
||||||
func NewFIFSRegistrar(address common.Address, backend bind.ContractBackend) (*FIFSRegistrar, error) {
|
func NewFIFSRegistrar(address common.Address, backend bind.ContractBackend) (*FIFSRegistrar, error) {
|
||||||
contract, err := bindFIFSRegistrar(address, backend, backend)
|
contract, err := bindFIFSRegistrar(address, backend, backend, backend)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -356,7 +410,7 @@ func NewFIFSRegistrar(address common.Address, backend bind.ContractBackend) (*FI
|
||||||
|
|
||||||
// NewFIFSRegistrarCaller creates a new read-only instance of FIFSRegistrar, bound to a specific deployed contract.
|
// NewFIFSRegistrarCaller creates a new read-only instance of FIFSRegistrar, bound to a specific deployed contract.
|
||||||
func NewFIFSRegistrarCaller(address common.Address, caller bind.ContractCaller) (*FIFSRegistrarCaller, error) {
|
func NewFIFSRegistrarCaller(address common.Address, caller bind.ContractCaller) (*FIFSRegistrarCaller, error) {
|
||||||
contract, err := bindFIFSRegistrar(address, caller, nil)
|
contract, err := bindFIFSRegistrar(address, caller, nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -365,20 +419,29 @@ func NewFIFSRegistrarCaller(address common.Address, caller bind.ContractCaller)
|
||||||
|
|
||||||
// NewFIFSRegistrarTransactor creates a new write-only instance of FIFSRegistrar, bound to a specific deployed contract.
|
// NewFIFSRegistrarTransactor creates a new write-only instance of FIFSRegistrar, bound to a specific deployed contract.
|
||||||
func NewFIFSRegistrarTransactor(address common.Address, transactor bind.ContractTransactor) (*FIFSRegistrarTransactor, error) {
|
func NewFIFSRegistrarTransactor(address common.Address, transactor bind.ContractTransactor) (*FIFSRegistrarTransactor, error) {
|
||||||
contract, err := bindFIFSRegistrar(address, nil, transactor)
|
contract, err := bindFIFSRegistrar(address, nil, transactor, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &FIFSRegistrarTransactor{contract: contract}, nil
|
return &FIFSRegistrarTransactor{contract: contract}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewFIFSRegistrarEventer creates a new listen only instance of FIFSRegistrar, bound to a specific deployed contract.
|
||||||
|
func NewFIFSRegistrarEventer(address common.Address, eventer bind.ContractEventer) (*FIFSRegistrarEventer, error) {
|
||||||
|
contract, err := bindFIFSRegistrar(address, nil, nil, eventer)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &FIFSRegistrarEventer{contract: contract, address: address}, nil
|
||||||
|
}
|
||||||
|
|
||||||
// bindFIFSRegistrar binds a generic wrapper to an already deployed contract.
|
// bindFIFSRegistrar binds a generic wrapper to an already deployed contract.
|
||||||
func bindFIFSRegistrar(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor) (*bind.BoundContract, error) {
|
func bindFIFSRegistrar(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, eventer bind.ContractEventer) (*bind.BoundContract, error) {
|
||||||
parsed, err := abi.JSON(strings.NewReader(FIFSRegistrarABI))
|
parsed, err := abi.JSON(strings.NewReader(FIFSRegistrarABI))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return bind.NewBoundContract(address, parsed, caller, transactor), nil
|
return bind.NewBoundContract(address, parsed, caller, transactor, eventer), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call invokes the (constant) contract method with params as input values and
|
// Call invokes the (constant) contract method with params as input values and
|
||||||
|
|
@ -441,10 +504,10 @@ func (_FIFSRegistrar *FIFSRegistrarTransactorSession) Register(subnode [32]byte,
|
||||||
}
|
}
|
||||||
|
|
||||||
// PublicResolverABI is the input ABI used to generate the binding from.
|
// PublicResolverABI is the input ABI used to generate the binding from.
|
||||||
const PublicResolverABI = `[{"constant":true,"inputs":[{"name":"node","type":"bytes32"}],"name":"content","outputs":[{"name":"ret","type":"bytes32"}],"type":"function"},{"constant":true,"inputs":[{"name":"node","type":"bytes32"}],"name":"addr","outputs":[{"name":"ret","type":"address"}],"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"kind","type":"bytes32"}],"name":"has","outputs":[{"name":"","type":"bool"}],"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"hash","type":"bytes32"}],"name":"setContent","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"addr","type":"address"}],"name":"setAddr","outputs":[],"type":"function"},{"inputs":[{"name":"ensAddr","type":"address"}],"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"node","type":"bytes32"},{"indexed":false,"name":"a","type":"address"}],"name":"AddrChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"node","type":"bytes32"},{"indexed":false,"name":"hash","type":"bytes32"}],"name":"ContentChanged","type":"event"}]`
|
const PublicResolverABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"content\",\"outputs\":[{\"name\":\"ret\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"addr\",\"outputs\":[{\"name\":\"ret\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"kind\",\"type\":\"bytes32\"}],\"name\":\"has\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"hash\",\"type\":\"bytes32\"}],\"name\":\"setContent\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setAddr\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"ensAddr\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"fallback\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"a\",\"type\":\"address\"}],\"name\":\"AddrChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"hash\",\"type\":\"bytes32\"}],\"name\":\"ContentChanged\",\"type\":\"event\"}]"
|
||||||
|
|
||||||
// PublicResolverBin is the compiled bytecode used for deploying new contracts.
|
// PublicResolverBin is the compiled bytecode used for deploying new contracts.
|
||||||
const PublicResolverBin = `0x606060405260405160208061036783395060806040525160008054600160a060020a0319168217905550610330806100376000396000f36060604052361561004b5760e060020a60003504632dff694181146100535780633b3b57de1461007557806341b9dc2b146100a0578063c3d014d614610139578063d5fa2b00146101b2575b61022b610002565b61022d6004356000818152600260205260408120549081141561027057610002565b61023f600435600081815260016020526040812054600160a060020a03169081141561027057610002565b61025c60043560243560007f6164647200000000000000000000000000000000000000000000000000000000821480156100f05750600083815260016020526040812054600160a060020a031614155b8061013257507f636f6e74656e740000000000000000000000000000000000000000000000000082148015610132575060008381526002602052604081205414155b9392505050565b61022b600435602435600080546040805160e060020a6302571be30281526004810186905290518593600160a060020a033381169416926302571be392602482810193602093839003909101908290876161da5a03f11561000257505060405151600160a060020a031691909114905061027557610002565b61022b600435602435600080546040805160e060020a6302571be30281526004810186905290518593600160a060020a033381169416926302571be392602482810193602093839003909101908290876161da5a03f11561000257505060405151600160a060020a03169190911490506102c157610002565b005b60408051918252519081900360200190f35b60408051600160a060020a03929092168252519081900360200190f35b604080519115158252519081900360200190f35b919050565b6000838152600260209081526040918290208490558151848152915185927f0424b6fe0d9c3bdbece0e7879dc241bb0c22e900be8b6c168b4ee08bd9bf83bc92908290030190a2505050565b600083815260016020908152604091829020805473ffffffffffffffffffffffffffffffffffffffff1916851790558151600160a060020a0385168152915185927f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd292908290030190a250505056`
|
const PublicResolverBin = `0x6060604052341561000f57600080fd5b6040516020806104528339810160405280805160008054600160a060020a03909216600160a060020a031990921691909117905550506103fe806100546000396000f300606060405236156100515763ffffffff60e060020a6000350416632dff694181146100615780633b3b57de1461008957806341b9dc2b146100bb578063c3d014d6146100e8578063d5fa2b0014610103575b341561005c57600080fd5b600080fd5b341561006c57600080fd5b610077600435610125565b60405190815260200160405180910390f35b341561009457600080fd5b61009f600435610145565b604051600160a060020a03909116815260200160405180910390f35b34156100c657600080fd5b6100d4600435602435610169565b604051901515815260200160405180910390f35b34156100f357600080fd5b6101016004356024356101f9565b005b341561010e57600080fd5b610101600435600160a060020a03602435166102cf565b60008181526002602052604090205480151561014057600080fd5b919050565b600081815260016020526040902054600160a060020a031680151561014057600080fd5b60007f6164647200000000000000000000000000000000000000000000000000000000821480156101b05750600083815260016020526040902054600160a060020a031615155b806101f257507f636f6e74656e7400000000000000000000000000000000000000000000000000821480156101f2575060008381526002602052604090205415155b9392505050565b600080548391600160a060020a033381169216906302571be39084906040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b151561025257600080fd5b6102c65a03f1151561026357600080fd5b50505060405180519050600160a060020a031614151561028257600080fd5b6000838152600260205260409081902083905583907f0424b6fe0d9c3bdbece0e7879dc241bb0c22e900be8b6c168b4ee08bd9bf83bc9084905190815260200160405180910390a2505050565b600080548391600160a060020a033381169216906302571be39084906040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b151561032857600080fd5b6102c65a03f1151561033957600080fd5b50505060405180519050600160a060020a031614151561035857600080fd5b60008381526001602052604090819020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03851617905583907f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd290849051600160a060020a03909116815260200160405180910390a25050505600a165627a7a7230582033714cadfb6a68b1d60c392730668d3fd6da7e7e5cded2a84db2fa7cb7e955ad0029`
|
||||||
|
|
||||||
// DeployPublicResolver deploys a new Ethereum contract, binding an instance of PublicResolver to it.
|
// DeployPublicResolver deploys a new Ethereum contract, binding an instance of PublicResolver to it.
|
||||||
func DeployPublicResolver(auth *bind.TransactOpts, backend bind.ContractBackend, ensAddr common.Address) (common.Address, *types.Transaction, *PublicResolver, error) {
|
func DeployPublicResolver(auth *bind.TransactOpts, backend bind.ContractBackend, ensAddr common.Address) (common.Address, *types.Transaction, *PublicResolver, error) {
|
||||||
|
|
@ -463,6 +526,7 @@ func DeployPublicResolver(auth *bind.TransactOpts, backend bind.ContractBackend,
|
||||||
type PublicResolver struct {
|
type PublicResolver struct {
|
||||||
PublicResolverCaller // Read-only binding to the contract
|
PublicResolverCaller // Read-only binding to the contract
|
||||||
PublicResolverTransactor // Write-only binding to the contract
|
PublicResolverTransactor // Write-only binding to the contract
|
||||||
|
PublicResolverEventer // Event listener binding to the contract
|
||||||
}
|
}
|
||||||
|
|
||||||
// PublicResolverCaller is an auto generated read-only Go binding around an Ethereum contract.
|
// PublicResolverCaller is an auto generated read-only Go binding around an Ethereum contract.
|
||||||
|
|
@ -475,6 +539,12 @@ type PublicResolverTransactor struct {
|
||||||
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PublicResolverEventer is an auto generated write-only Go binding around an Ethereum contract.
|
||||||
|
type PublicResolverEventer struct {
|
||||||
|
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||||
|
address common.Address // Contract address
|
||||||
|
}
|
||||||
|
|
||||||
// PublicResolverSession is an auto generated Go binding around an Ethereum contract,
|
// PublicResolverSession is an auto generated Go binding around an Ethereum contract,
|
||||||
// with pre-set call and transact options.
|
// with pre-set call and transact options.
|
||||||
type PublicResolverSession struct {
|
type PublicResolverSession struct {
|
||||||
|
|
@ -514,7 +584,7 @@ type PublicResolverTransactorRaw struct {
|
||||||
|
|
||||||
// NewPublicResolver creates a new instance of PublicResolver, bound to a specific deployed contract.
|
// NewPublicResolver creates a new instance of PublicResolver, bound to a specific deployed contract.
|
||||||
func NewPublicResolver(address common.Address, backend bind.ContractBackend) (*PublicResolver, error) {
|
func NewPublicResolver(address common.Address, backend bind.ContractBackend) (*PublicResolver, error) {
|
||||||
contract, err := bindPublicResolver(address, backend, backend)
|
contract, err := bindPublicResolver(address, backend, backend, backend)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -523,7 +593,7 @@ func NewPublicResolver(address common.Address, backend bind.ContractBackend) (*P
|
||||||
|
|
||||||
// NewPublicResolverCaller creates a new read-only instance of PublicResolver, bound to a specific deployed contract.
|
// NewPublicResolverCaller creates a new read-only instance of PublicResolver, bound to a specific deployed contract.
|
||||||
func NewPublicResolverCaller(address common.Address, caller bind.ContractCaller) (*PublicResolverCaller, error) {
|
func NewPublicResolverCaller(address common.Address, caller bind.ContractCaller) (*PublicResolverCaller, error) {
|
||||||
contract, err := bindPublicResolver(address, caller, nil)
|
contract, err := bindPublicResolver(address, caller, nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -532,20 +602,29 @@ func NewPublicResolverCaller(address common.Address, caller bind.ContractCaller)
|
||||||
|
|
||||||
// NewPublicResolverTransactor creates a new write-only instance of PublicResolver, bound to a specific deployed contract.
|
// NewPublicResolverTransactor creates a new write-only instance of PublicResolver, bound to a specific deployed contract.
|
||||||
func NewPublicResolverTransactor(address common.Address, transactor bind.ContractTransactor) (*PublicResolverTransactor, error) {
|
func NewPublicResolverTransactor(address common.Address, transactor bind.ContractTransactor) (*PublicResolverTransactor, error) {
|
||||||
contract, err := bindPublicResolver(address, nil, transactor)
|
contract, err := bindPublicResolver(address, nil, transactor, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &PublicResolverTransactor{contract: contract}, nil
|
return &PublicResolverTransactor{contract: contract}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewPublicResolverEventer creates a new listen only instance of PublicResolver, bound to a specific deployed contract.
|
||||||
|
func NewPublicResolverEventer(address common.Address, eventer bind.ContractEventer) (*PublicResolverEventer, error) {
|
||||||
|
contract, err := bindPublicResolver(address, nil, nil, eventer)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &PublicResolverEventer{contract: contract, address: address}, nil
|
||||||
|
}
|
||||||
|
|
||||||
// bindPublicResolver binds a generic wrapper to an already deployed contract.
|
// bindPublicResolver binds a generic wrapper to an already deployed contract.
|
||||||
func bindPublicResolver(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor) (*bind.BoundContract, error) {
|
func bindPublicResolver(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, eventer bind.ContractEventer) (*bind.BoundContract, error) {
|
||||||
parsed, err := abi.JSON(strings.NewReader(PublicResolverABI))
|
parsed, err := abi.JSON(strings.NewReader(PublicResolverABI))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return bind.NewBoundContract(address, parsed, caller, transactor), nil
|
return bind.NewBoundContract(address, parsed, caller, transactor, eventer), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call invokes the (constant) contract method with params as input values and
|
// Call invokes the (constant) contract method with params as input values and
|
||||||
|
|
@ -701,8 +780,28 @@ func (_PublicResolver *PublicResolverTransactorSession) SetContent(node [32]byte
|
||||||
return _PublicResolver.Contract.SetContent(&_PublicResolver.TransactOpts, node, hash)
|
return _PublicResolver.Contract.SetContent(&_PublicResolver.TransactOpts, node, hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Solidity: event AddrChanged(bytes32 indexed node, address a)
|
||||||
|
//
|
||||||
|
// Note: this method will fill in the Event ID topic
|
||||||
|
func (_PublicResolver *PublicResolverCaller) SubscribeAddrChanged(opts *bind.CallOpts, ch chan<- types.Log, topics ...[]common.Hash) (ethereum.Subscription, error) {
|
||||||
|
id := []common.Hash{common.HexToHash("52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd2")}
|
||||||
|
topics = append([][]common.Hash{id}, topics...)
|
||||||
|
|
||||||
|
return _PublicResolver.contract.SubscribeFilterLogs(opts, topics, ch)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Solidity: event ContentChanged(bytes32 indexed node, bytes32 hash)
|
||||||
|
//
|
||||||
|
// Note: this method will fill in the Event ID topic
|
||||||
|
func (_PublicResolver *PublicResolverCaller) SubscribeContentChanged(opts *bind.CallOpts, ch chan<- types.Log, topics ...[]common.Hash) (ethereum.Subscription, error) {
|
||||||
|
id := []common.Hash{common.HexToHash("0424b6fe0d9c3bdbece0e7879dc241bb0c22e900be8b6c168b4ee08bd9bf83bc")}
|
||||||
|
topics = append([][]common.Hash{id}, topics...)
|
||||||
|
|
||||||
|
return _PublicResolver.contract.SubscribeFilterLogs(opts, topics, ch)
|
||||||
|
}
|
||||||
|
|
||||||
// ResolverABI is the input ABI used to generate the binding from.
|
// ResolverABI is the input ABI used to generate the binding from.
|
||||||
const ResolverABI = `[{"constant":true,"inputs":[{"name":"node","type":"bytes32"}],"name":"content","outputs":[{"name":"ret","type":"bytes32"}],"type":"function"},{"constant":true,"inputs":[{"name":"node","type":"bytes32"}],"name":"addr","outputs":[{"name":"ret","type":"address"}],"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"kind","type":"bytes32"}],"name":"has","outputs":[{"name":"","type":"bool"}],"type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"node","type":"bytes32"},{"indexed":false,"name":"a","type":"address"}],"name":"AddrChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"node","type":"bytes32"},{"indexed":false,"name":"hash","type":"bytes32"}],"name":"ContentChanged","type":"event"}]`
|
const ResolverABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"content\",\"outputs\":[{\"name\":\"ret\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"addr\",\"outputs\":[{\"name\":\"ret\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"kind\",\"type\":\"bytes32\"}],\"name\":\"has\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"a\",\"type\":\"address\"}],\"name\":\"AddrChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"hash\",\"type\":\"bytes32\"}],\"name\":\"ContentChanged\",\"type\":\"event\"}]"
|
||||||
|
|
||||||
// ResolverBin is the compiled bytecode used for deploying new contracts.
|
// ResolverBin is the compiled bytecode used for deploying new contracts.
|
||||||
const ResolverBin = `0x`
|
const ResolverBin = `0x`
|
||||||
|
|
@ -724,6 +823,7 @@ func DeployResolver(auth *bind.TransactOpts, backend bind.ContractBackend) (comm
|
||||||
type Resolver struct {
|
type Resolver struct {
|
||||||
ResolverCaller // Read-only binding to the contract
|
ResolverCaller // Read-only binding to the contract
|
||||||
ResolverTransactor // Write-only binding to the contract
|
ResolverTransactor // Write-only binding to the contract
|
||||||
|
ResolverEventer // Event listener binding to the contract
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResolverCaller is an auto generated read-only Go binding around an Ethereum contract.
|
// ResolverCaller is an auto generated read-only Go binding around an Ethereum contract.
|
||||||
|
|
@ -736,6 +836,12 @@ type ResolverTransactor struct {
|
||||||
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ResolverEventer is an auto generated write-only Go binding around an Ethereum contract.
|
||||||
|
type ResolverEventer struct {
|
||||||
|
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||||
|
address common.Address // Contract address
|
||||||
|
}
|
||||||
|
|
||||||
// ResolverSession is an auto generated Go binding around an Ethereum contract,
|
// ResolverSession is an auto generated Go binding around an Ethereum contract,
|
||||||
// with pre-set call and transact options.
|
// with pre-set call and transact options.
|
||||||
type ResolverSession struct {
|
type ResolverSession struct {
|
||||||
|
|
@ -775,7 +881,7 @@ type ResolverTransactorRaw struct {
|
||||||
|
|
||||||
// NewResolver creates a new instance of Resolver, bound to a specific deployed contract.
|
// NewResolver creates a new instance of Resolver, bound to a specific deployed contract.
|
||||||
func NewResolver(address common.Address, backend bind.ContractBackend) (*Resolver, error) {
|
func NewResolver(address common.Address, backend bind.ContractBackend) (*Resolver, error) {
|
||||||
contract, err := bindResolver(address, backend, backend)
|
contract, err := bindResolver(address, backend, backend, backend)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -784,7 +890,7 @@ func NewResolver(address common.Address, backend bind.ContractBackend) (*Resolve
|
||||||
|
|
||||||
// NewResolverCaller creates a new read-only instance of Resolver, bound to a specific deployed contract.
|
// NewResolverCaller creates a new read-only instance of Resolver, bound to a specific deployed contract.
|
||||||
func NewResolverCaller(address common.Address, caller bind.ContractCaller) (*ResolverCaller, error) {
|
func NewResolverCaller(address common.Address, caller bind.ContractCaller) (*ResolverCaller, error) {
|
||||||
contract, err := bindResolver(address, caller, nil)
|
contract, err := bindResolver(address, caller, nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -793,20 +899,29 @@ func NewResolverCaller(address common.Address, caller bind.ContractCaller) (*Res
|
||||||
|
|
||||||
// NewResolverTransactor creates a new write-only instance of Resolver, bound to a specific deployed contract.
|
// NewResolverTransactor creates a new write-only instance of Resolver, bound to a specific deployed contract.
|
||||||
func NewResolverTransactor(address common.Address, transactor bind.ContractTransactor) (*ResolverTransactor, error) {
|
func NewResolverTransactor(address common.Address, transactor bind.ContractTransactor) (*ResolverTransactor, error) {
|
||||||
contract, err := bindResolver(address, nil, transactor)
|
contract, err := bindResolver(address, nil, transactor, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &ResolverTransactor{contract: contract}, nil
|
return &ResolverTransactor{contract: contract}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewResolverEventer creates a new listen only instance of Resolver, bound to a specific deployed contract.
|
||||||
|
func NewResolverEventer(address common.Address, eventer bind.ContractEventer) (*ResolverEventer, error) {
|
||||||
|
contract, err := bindResolver(address, nil, nil, eventer)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &ResolverEventer{contract: contract, address: address}, nil
|
||||||
|
}
|
||||||
|
|
||||||
// bindResolver binds a generic wrapper to an already deployed contract.
|
// bindResolver binds a generic wrapper to an already deployed contract.
|
||||||
func bindResolver(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor) (*bind.BoundContract, error) {
|
func bindResolver(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, eventer bind.ContractEventer) (*bind.BoundContract, error) {
|
||||||
parsed, err := abi.JSON(strings.NewReader(ResolverABI))
|
parsed, err := abi.JSON(strings.NewReader(ResolverABI))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return bind.NewBoundContract(address, parsed, caller, transactor), nil
|
return bind.NewBoundContract(address, parsed, caller, transactor, eventer), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call invokes the (constant) contract method with params as input values and
|
// Call invokes the (constant) contract method with params as input values and
|
||||||
|
|
@ -919,3 +1034,23 @@ func (_Resolver *ResolverSession) Has(node [32]byte, kind [32]byte) (*types.Tran
|
||||||
func (_Resolver *ResolverTransactorSession) Has(node [32]byte, kind [32]byte) (*types.Transaction, error) {
|
func (_Resolver *ResolverTransactorSession) Has(node [32]byte, kind [32]byte) (*types.Transaction, error) {
|
||||||
return _Resolver.Contract.Has(&_Resolver.TransactOpts, node, kind)
|
return _Resolver.Contract.Has(&_Resolver.TransactOpts, node, kind)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Solidity: event AddrChanged(bytes32 indexed node, address a)
|
||||||
|
//
|
||||||
|
// Note: this method will fill in the Event ID topic
|
||||||
|
func (_Resolver *ResolverCaller) SubscribeAddrChanged(opts *bind.CallOpts, ch chan<- types.Log, topics ...[]common.Hash) (ethereum.Subscription, error) {
|
||||||
|
id := []common.Hash{common.HexToHash("52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd2")}
|
||||||
|
topics = append([][]common.Hash{id}, topics...)
|
||||||
|
|
||||||
|
return _Resolver.contract.SubscribeFilterLogs(opts, topics, ch)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Solidity: event ContentChanged(bytes32 indexed node, bytes32 hash)
|
||||||
|
//
|
||||||
|
// Note: this method will fill in the Event ID topic
|
||||||
|
func (_Resolver *ResolverCaller) SubscribeContentChanged(opts *bind.CallOpts, ch chan<- types.Log, topics ...[]common.Hash) (ethereum.Subscription, error) {
|
||||||
|
id := []common.Hash{common.HexToHash("0424b6fe0d9c3bdbece0e7879dc241bb0c22e900be8b6c168b4ee08bd9bf83bc")}
|
||||||
|
topics = append([][]common.Hash{id}, topics...)
|
||||||
|
|
||||||
|
return _Resolver.contract.SubscribeFilterLogs(opts, topics, ch)
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ contract ENS {
|
||||||
// Permits modifications only by the owner of the specified node.
|
// Permits modifications only by the owner of the specified node.
|
||||||
modifier only_owner(bytes32 node) {
|
modifier only_owner(bytes32 node) {
|
||||||
if(records[node].owner != msg.sender) throw;
|
if(records[node].owner != msg.sender) throw;
|
||||||
_
|
_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -150,7 +150,7 @@ contract PublicResolver is Resolver {
|
||||||
|
|
||||||
modifier only_owner(bytes32 node) {
|
modifier only_owner(bytes32 node) {
|
||||||
if(ens.owner(node) != msg.sender) throw;
|
if(ens.owner(node) != msg.sender) throw;
|
||||||
_
|
_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -58,7 +58,7 @@ contract ReleaseOracle {
|
||||||
// isSigner is a modifier to authorize contract transactions.
|
// isSigner is a modifier to authorize contract transactions.
|
||||||
modifier isSigner() {
|
modifier isSigner() {
|
||||||
if (authorised[msg.sender]) {
|
if (authorised[msg.sender]) {
|
||||||
_
|
_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/eth"
|
"github.com/ethereum/go-ethereum/eth"
|
||||||
|
"github.com/ethereum/go-ethereum/eth/filters"
|
||||||
"github.com/ethereum/go-ethereum/internal/ethapi"
|
"github.com/ethereum/go-ethereum/internal/ethapi"
|
||||||
"github.com/ethereum/go-ethereum/les"
|
"github.com/ethereum/go-ethereum/les"
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
|
|
@ -62,19 +63,26 @@ type ReleaseService struct {
|
||||||
func NewReleaseService(ctx *node.ServiceContext, config Config) (node.Service, error) {
|
func NewReleaseService(ctx *node.ServiceContext, config Config) (node.Service, error) {
|
||||||
// Retrieve the Ethereum service dependency to access the blockchain
|
// Retrieve the Ethereum service dependency to access the blockchain
|
||||||
var apiBackend ethapi.Backend
|
var apiBackend ethapi.Backend
|
||||||
|
var filterBackend filters.Backend
|
||||||
var ethereum *eth.Ethereum
|
var ethereum *eth.Ethereum
|
||||||
|
lightMode := false
|
||||||
|
|
||||||
if err := ctx.Service(ðereum); err == nil {
|
if err := ctx.Service(ðereum); err == nil {
|
||||||
apiBackend = ethereum.ApiBackend
|
apiBackend = ethereum.ApiBackend
|
||||||
|
filterBackend = ethereum.ApiBackend
|
||||||
} else {
|
} else {
|
||||||
var ethereum *les.LightEthereum
|
var ethereum *les.LightEthereum
|
||||||
if err := ctx.Service(ðereum); err == nil {
|
if err := ctx.Service(ðereum); err == nil {
|
||||||
apiBackend = ethereum.ApiBackend
|
apiBackend = ethereum.ApiBackend
|
||||||
|
filterBackend = ethereum.ApiBackend
|
||||||
|
lightMode = true
|
||||||
} else {
|
} else {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct the release service
|
// Construct the release service
|
||||||
contract, err := NewReleaseOracle(config.Oracle, eth.NewContractBackend(apiBackend))
|
contract, err := NewReleaseOracle(config.Oracle, eth.NewContractBackend(apiBackend, filterBackend, lightMode))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
39
eth/bind.go
39
eth/bind.go
|
|
@ -24,6 +24,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
|
"github.com/ethereum/go-ethereum/eth/filters"
|
||||||
"github.com/ethereum/go-ethereum/internal/ethapi"
|
"github.com/ethereum/go-ethereum/internal/ethapi"
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
|
|
@ -40,15 +41,17 @@ type ContractBackend struct {
|
||||||
eapi *ethapi.PublicEthereumAPI // Wrapper around the Ethereum object to access metadata
|
eapi *ethapi.PublicEthereumAPI // Wrapper around the Ethereum object to access metadata
|
||||||
bcapi *ethapi.PublicBlockChainAPI // Wrapper around the blockchain to access chain data
|
bcapi *ethapi.PublicBlockChainAPI // Wrapper around the blockchain to access chain data
|
||||||
txapi *ethapi.PublicTransactionPoolAPI // Wrapper around the transaction pool to access transaction data
|
txapi *ethapi.PublicTransactionPoolAPI // Wrapper around the transaction pool to access transaction data
|
||||||
|
es *filters.EventSystem // Enable log subscriptions
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewContractBackend creates a new native contract backend using an existing
|
// NewContractBackend creates a new native contract backend using an existing
|
||||||
// Ethereum object.
|
// Ethereum object.
|
||||||
func NewContractBackend(apiBackend ethapi.Backend) *ContractBackend {
|
func NewContractBackend(apiBackend ethapi.Backend, filterBackend filters.Backend, lightMode bool) *ContractBackend {
|
||||||
return &ContractBackend{
|
return &ContractBackend{
|
||||||
eapi: ethapi.NewPublicEthereumAPI(apiBackend),
|
eapi: ethapi.NewPublicEthereumAPI(apiBackend),
|
||||||
bcapi: ethapi.NewPublicBlockChainAPI(apiBackend),
|
bcapi: ethapi.NewPublicBlockChainAPI(apiBackend),
|
||||||
txapi: ethapi.NewPublicTransactionPoolAPI(apiBackend, new(ethapi.AddrLocker)),
|
txapi: ethapi.NewPublicTransactionPoolAPI(apiBackend, new(ethapi.AddrLocker)),
|
||||||
|
es: filters.NewEventSystem(apiBackend.EventMux(), filterBackend, lightMode),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -136,3 +139,37 @@ func (b *ContractBackend) SendTransaction(ctx context.Context, tx *types.Transac
|
||||||
_, err := b.txapi.SendRawTransaction(ctx, raw)
|
_, err := b.txapi.SendRawTransaction(ctx, raw)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SubscribeFilterLogs emits logs that match the given criteria over the given channel.
|
||||||
|
func (b *ContractBackend) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, logs chan<- types.Log) (ethereum.Subscription, error) {
|
||||||
|
f := filters.FilterCriteria{
|
||||||
|
FromBlock: q.FromBlock,
|
||||||
|
ToBlock: q.ToBlock,
|
||||||
|
Addresses: q.Addresses,
|
||||||
|
Topics: q.Topics,
|
||||||
|
}
|
||||||
|
l := make(chan []*types.Log)
|
||||||
|
|
||||||
|
sub, err := b.es.SubscribeLogs(f, l)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: rewrite filters.EventSystem so SubscribeLogs
|
||||||
|
// accepts chan types.Log instead of chan []*type.Log
|
||||||
|
go func() {
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-sub.Err():
|
||||||
|
close(l)
|
||||||
|
return
|
||||||
|
case ls := <-l:
|
||||||
|
for _, l := range ls {
|
||||||
|
logs <- *l
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
return sub, nil
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ func BindContract(address *Address, abiJSON string, client *EthereumClient) (con
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &BoundContract{
|
return &BoundContract{
|
||||||
contract: bind.NewBoundContract(address.address, parsed, client.client, client.client),
|
contract: bind.NewBoundContract(address.address, parsed, client.client, client.client, client.client),
|
||||||
address: address.address,
|
address: address.address,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue