From 5b3b3cb3d80bae76c05d7261377a7b1624884024 Mon Sep 17 00:00:00 2001 From: Nick Johnson Date: Wed, 10 Aug 2016 18:09:47 +0100 Subject: [PATCH 1/4] swarm, internal: Rewrote ENS support for the new EIP --- internal/web3ext/web3ext.go | 16 +- swarm/services/ens/README.md | 62 +- swarm/services/ens/contract/OpenRegistrar.abi | 1 - swarm/services/ens/contract/OpenRegistrar.bin | 1 - swarm/services/ens/contract/OpenRegistrar.go | 366 ------- .../ens/contract/PersonalResolver.abi | 1 - .../ens/contract/PersonalResolver.bin | 1 - .../services/ens/contract/PersonalResolver.go | 434 -------- swarm/services/ens/contract/ens.go | 988 +++++++++++++----- swarm/services/ens/contract/ens.sol | 234 ++++- swarm/services/ens/ens.go | 266 ++--- swarm/services/ens/ens_test.go | 19 +- swarm/swarm.go | 7 +- 13 files changed, 1056 insertions(+), 1340 deletions(-) delete mode 100644 swarm/services/ens/contract/OpenRegistrar.abi delete mode 100644 swarm/services/ens/contract/OpenRegistrar.bin delete mode 100644 swarm/services/ens/contract/OpenRegistrar.go delete mode 100644 swarm/services/ens/contract/PersonalResolver.abi delete mode 100644 swarm/services/ens/contract/PersonalResolver.bin delete mode 100644 swarm/services/ens/contract/PersonalResolver.go diff --git a/internal/web3ext/web3ext.go b/internal/web3ext/web3ext.go index d83f2a9b19..a5c3f2997c 100644 --- a/internal/web3ext/web3ext.go +++ b/internal/web3ext/web3ext.go @@ -117,27 +117,19 @@ web3._extend({ property: 'ens', methods: [ - new web3._extend.Method({ - name: 'deployRegistrar', - call: 'ens_deployRegistrar', - }), - new web3._extend.Method({ - name: 'deployResolver', - call: 'ens_deployResolver', - }), new web3._extend.Method({ name: 'register', call: 'ens_register', - params: 2, - inputFormatter: [null, null] + params: 1, + inputFormatter: [null] }), - new web3._extend.Method({ + new web3._extend.Method({ name: 'setContentHash', call: 'ens_setContentHash', params: 2, inputFormatter: [null, null] }), - new web3._extend.Method({ + new web3._extend.Method({ name: 'resolve', call: 'ens_resolve', params: 1, diff --git a/swarm/services/ens/README.md b/swarm/services/ens/README.md index 402c7cf4c5..4dca4dbba7 100644 --- a/swarm/services/ens/README.md +++ b/swarm/services/ens/README.md @@ -2,63 +2,33 @@ ## Usage -Full documentation for the Ethereum Name Service [can be found as EIP]() +Full documentation for the Ethereum Name Service [can be found as EIP 137](https://github.com/ethereum/EIPs/issues/137) Swarm offers a simple phase-one interface that streamlines the registration of swarm content hashes to arbitrary utf8 domain names. The interface is offered through the ENS RPC API module under the `ens` namespace. The API can be used via the console, rpc or web3.js. -### `ens.deployRegistrar()` +### `ens.register(name)` -sends a contract creation transaction from your bzz account deploying an open registrar contract which can serve as ENS root resolver. A root resolver is deployed on the testnet and set as default for EnsRoot. Alternative can be given by changing the `ENSRoot` parameter in swarm `config.json` file. +Sends a transaction that registers a name as a top-level domain, giving ownership to the current account, and automatically deploying a simple resolver contract for it. -To deploy an alternative top-level domain root resolver: - -```js -registrarAddr=ens.deployRegistrar() -// "0xa90b9572f094660f8f314b591a365985e98d2fd0" -eth.getCode(registrarAddr) // check if contract was successfully deployed -// "0x" // not mined yet -// miner.start(1) // to start mining on a private chain -// true -``` - -### `ens.deployResolver()` - -sends a contract creation transaction from your bzz account deploying a simple personal resolver contract, that can be registered with a (sub)domain on the root resolver. As a result the root resolver will delegate all hostnames under that domain to the child resolver. - -To deploy a personal resolver: - -```js -resolverAddr = ens.deployResolver() -// "0x2ba72b924a7d654c54467f7bda035ddc2f6fb4eb" -eth.getCode(registrarAddr) // check if contract was successfully deployed -// "0x" // not mined yet -// miner.start(1) // to start mining on a private chain -// true -``` - -### `ens.register(name, address)` - -Sends a transaction that registers a resolver contract with domain on the top-level resolver. -As a result the bzz account becomes the owner of that domain. -This line registers the (already deployed) personal resolver at address `resolverAddr` to the top-level domain `swarm` +This line registers the top-level domain `swarm`: ``` -ens.register("swarm",resolverAddr) +ens.register("swarm") // {} ``` ### `ens.setContentHash(name, hash)` -sends a transaction that sets a content hash to a name using a (sub-domain) resolver: +Sends a transaction that sets a content hash to a name using a (sub-domain) resolver: ```js ens.setContentHash("swarm","0x7420f14a28e276dd39da6a967dec332a932256717451155fbd3870b202b561c4") // {} ``` -The content hash argument is the bzz hash as returned by a swarm upload, e.g., using `bzz.upload`: -The name here will allow the name setting, if the top-level domain is 'swarm', it dispatches to the -resolver just registered. +To function, the domain must have a resolver deployed that supports the `setContent` function, and the sending account must have permission to call that function. `ens.register()` deploys a resolver for you that meets this requirement. + +The content hash argument is the bzz hash as returned by a swarm upload, e.g., using `bzz.upload`. The name here will allow the name setting, if the top-level domain is 'swarm', it dispatches to the resolver just registered. ```js bzz.upload("path/to/my/directory", "index.html") @@ -66,7 +36,7 @@ bzz.upload("path/to/my/directory", "index.html") Here the second argument to `bzz.upload` is the relative path to the asset mapped on to the root hash of entire collection, effectively the landing page served on the bare hash (and therefore the root of the domain registered with that hash) as url. -The same resolver will allow setting subdomains: +`setContentHash` can also be used on subdomains: ```js ens.setContentHash("album.swarm","7a59235e5f9c23bf74deb4838e24f75a77f786163f404c8004d79b5674625db0") @@ -88,20 +58,10 @@ This same backend method is used within swarm to resolve hostnames in urls, henc ## Development -The ABI and BIN files in contract subdirectory implement simple registrar and personal resolver contracts; they're used in tests, and can be used to deploy these contracts for your own purposes. +The SOL file in contract subdirectory implements the ENS root registry, a simple first-in-first-served registrar for the root namespace, and a simple resolver contract; they're used in tests, and can be used to deploy these contracts for your own purposes. The solidity source code can be found at [github.com/arachnid/ens/](https://github.com/arachnid/ens/). -The ABI and BIN files in the contract subdirectory were generated by - -```shell -solc -o `pwd` --optimise --abi --bin OpenRegistrar.sol -solc -o `pwd` --optimise --abi --bin PersonalResolver.sol -``` - -using the .sol files in [revision 1cbd90d0631e8e30e1c28a394c128e7503ea85c6](https://github.com/Arachnid/ens/commit/1cbd90d0631e8e30e1c28a394c128e7503ea85c6) -with solc version 0.3.2-e3c54185 - The go bindings for ENS contracts are generated using `abigen` via the go generator: ```shell diff --git a/swarm/services/ens/contract/OpenRegistrar.abi b/swarm/services/ens/contract/OpenRegistrar.abi deleted file mode 100644 index 6bd956f76d..0000000000 --- a/swarm/services/ens/contract/OpenRegistrar.abi +++ /dev/null @@ -1 +0,0 @@ -[{"constant":false,"inputs":[{"name":"label","type":"bytes32"},{"name":"newOwner","type":"address"}],"name":"setOwner","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"id","type":"bytes32"}],"name":"getExtended","outputs":[{"name":"data","type":"bytes"}],"type":"function"},{"constant":true,"inputs":[{"name":"nodeId","type":"bytes12"},{"name":"qtype","type":"bytes32"},{"name":"index","type":"uint16"}],"name":"resolve","outputs":[{"name":"rcode","type":"uint16"},{"name":"rtype","type":"bytes16"},{"name":"ttl","type":"uint32"},{"name":"len","type":"uint16"},{"name":"data","type":"bytes32"}],"type":"function"},{"constant":false,"inputs":[{"name":"label","type":"bytes32"},{"name":"resolver","type":"address"},{"name":"nodeId","type":"bytes12"}],"name":"register","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"label","type":"bytes32"}],"name":"getOwner","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":true,"inputs":[{"name":"nodeId","type":"bytes12"},{"name":"label","type":"bytes32"}],"name":"findResolver","outputs":[{"name":"rcode","type":"uint16"},{"name":"ttl","type":"uint32"},{"name":"rnode","type":"bytes12"},{"name":"raddress","type":"address"}],"type":"function"}] diff --git a/swarm/services/ens/contract/OpenRegistrar.bin b/swarm/services/ens/contract/OpenRegistrar.bin deleted file mode 100644 index c965ef5602..0000000000 --- a/swarm/services/ens/contract/OpenRegistrar.bin +++ /dev/null @@ -1 +0,0 @@ -6060604052610348806100126000396000f3606060405236156100565760e060020a60003504635b0fc9c381146100585780638021061c1461007a578063a16fdafa14610097578063a1f8f8f0146100c0578063deb931a2146100e5578063edc0277c1461010b575b005b610056600435602435600081600160a060020a03166000141561023357610002565b6101516004356000606081905260a060405260809081525b919050565b6101bf6004356024356044356000808080808781146100b557600394505b939792965093509350565b610056600435602435604435600082600160a060020a03166000141561028057610002565b6101e5600435600081815260208190526040902060010154600160a060020a0316610092565b6102026004356024356000818152602081905260408120819081908190868214158061014357506001810154600160a060020a031682145b15610320576003945061033e565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f1680156101b15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b50505061ffff919091166060908152608082905260a082815260c083905260e092909252f35b60408051600160a060020a03929092168252519081900360200190f35b61ffff93909316606090815263ffffffff92909216608090815260a091909152600160a060020a039290921660c052f35b828152602081905260409020600181015433600160a060020a0390811691161461025c57610002565b600101805473ffffffffffffffffffffffffffffffffffffffff1916909117905550565b83815260208190526040812060018101549091600160a060020a03909116148015906102bd5750600181015433600160a060020a03908116911614155b156102c757610002565b60018101805460c0604052606085905260808490523360a0819052835460a060020a8087040273ffffffffffffffffffffffffffffffffffffffff199182168817600160a060020a031617855590911617905550505050565b8054610e10945060a060020a808204029350600160a060020a031691505b509295919450925056 \ No newline at end of file diff --git a/swarm/services/ens/contract/OpenRegistrar.go b/swarm/services/ens/contract/OpenRegistrar.go deleted file mode 100644 index a6ed38d37a..0000000000 --- a/swarm/services/ens/contract/OpenRegistrar.go +++ /dev/null @@ -1,366 +0,0 @@ -// This file is an automatically generated Go binding. Do not modify as any -// change will likely be lost upon the next re-generation! - -package contract - -import ( - "strings" - - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" -) - -// OpenRegistrarABI is the input ABI used to generate the binding from. -const OpenRegistrarABI = `[{"constant":false,"inputs":[{"name":"label","type":"bytes32"},{"name":"newOwner","type":"address"}],"name":"setOwner","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"id","type":"bytes32"}],"name":"getExtended","outputs":[{"name":"data","type":"bytes"}],"type":"function"},{"constant":true,"inputs":[{"name":"nodeId","type":"bytes12"},{"name":"qtype","type":"bytes32"},{"name":"index","type":"uint16"}],"name":"resolve","outputs":[{"name":"rcode","type":"uint16"},{"name":"rtype","type":"bytes16"},{"name":"ttl","type":"uint32"},{"name":"len","type":"uint16"},{"name":"data","type":"bytes32"}],"type":"function"},{"constant":false,"inputs":[{"name":"label","type":"bytes32"},{"name":"resolver","type":"address"},{"name":"nodeId","type":"bytes12"}],"name":"register","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"label","type":"bytes32"},{"name":"resolver","type":"address"},{"name":"nodeId","type":"bytes12"}],"name":"setResolver","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"label","type":"bytes32"}],"name":"getOwner","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":true,"inputs":[{"name":"nodeId","type":"bytes12"},{"name":"label","type":"bytes32"}],"name":"findResolver","outputs":[{"name":"rcode","type":"uint16"},{"name":"ttl","type":"uint32"},{"name":"rnode","type":"bytes12"},{"name":"raddress","type":"address"}],"type":"function"}]` - -// OpenRegistrarBin is the compiled bytecode used for deploying new contracts. -const OpenRegistrarBin = `606060405261083b806100126000396000f36060604052361561007f576000357c0100000000000000000000000000000000000000000000000000000000900480635b0fc9c3146100815780638021061c146100a2578063a16fdafa14610126578063a1f8f8f0146101a5578063a9f2a1b2146101cf578063deb931a2146101f9578063edc0277c1461023b5761007f565b005b6100a060048080359060200190919080359060200190919050506102bc565b005b6100b86004808035906020019091905050610392565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f1680156101185780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61014e60048080359060200190919080359060200190919080359060200190919050506103c6565b604051808661ffff168152602001856fffffffffffffffffffffffffffffffff191681526020018463ffffffff1681526020018361ffff168152602001826000191681526020019550505050505060405180910390f35b6101cd600480803590602001909190803590602001909190803590602001909190505061041f565b005b6101f760048080359060200190919080359060200190919080359060200190919050506105ac565b005b61020f60048080359060200190919050506106c0565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61025a600480803590602001909190803590602001909190505061070f565b604051808561ffff1681526020018463ffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff191681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200194505050505060405180910390f35b600060008273ffffffffffffffffffffffffffffffffffffffff1614156102e257610002565b600060005060008460001916815260200190815260200160002060005090503373ffffffffffffffffffffffffffffffffffffffff168160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561035f57610002565b818160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055505b505050565b6020604051908101604052806000815260200150602060405190810160405280600081526020015090506103c1565b919050565b60006000600060006000600074010000000000000000000000000000000000000000028873ffffffffffffffffffffffffffffffffffffffff191614151561041357600394508450610414565b5b939792965093509350565b600060008373ffffffffffffffffffffffffffffffffffffffff16141561044557610002565b60006000506000856000191681526020019081526020016000206000509050600073ffffffffffffffffffffffffffffffffffffffff168160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156104c357610002565b60606040519081016040528084815260200183815260200133815260200150600060005060008660001916815260200190815260200160002060005060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff0219169083021790555060208201518160000160146101000a8154816bffffffffffffffffffffffff0219169083740100000000000000000000000000000000000000009004021790555060408201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055509050505b50505050565b600060008373ffffffffffffffffffffffffffffffffffffffff1614156105d257610002565b600060005060008560001916815260200190815260200160002060005090503373ffffffffffffffffffffffffffffffffffffffff168160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561064f57610002565b828160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff02191690830217905550818160000160146101000a8154816bffffffffffffffffffffffff021916908374010000000000000000000000000000000000000000900402179055505b50505050565b6000600060005060008360001916815260200190815260200160002060005060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905061070a565b919050565b6000600060006000600060006000506000876000191681526020019081526020016000206000509050600074010000000000000000000000000000000000000000028773ffffffffffffffffffffffffffffffffffffffff19161415806107c65750600073ffffffffffffffffffffffffffffffffffffffff168160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156107d657600394508450610831565b610e10935083508060000160149054906101000a90047401000000000000000000000000000000000000000002925082508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16915081505b509295919450925056` - -// DeployOpenRegistrar deploys a new Ethereum contract, binding an instance of OpenRegistrar to it. -func DeployOpenRegistrar(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *OpenRegistrar, error) { - parsed, err := abi.JSON(strings.NewReader(OpenRegistrarABI)) - if err != nil { - return common.Address{}, nil, nil, err - } - address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(OpenRegistrarBin), backend) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &OpenRegistrar{OpenRegistrarCaller: OpenRegistrarCaller{contract: contract}, OpenRegistrarTransactor: OpenRegistrarTransactor{contract: contract}}, nil -} - -// OpenRegistrar is an auto generated Go binding around an Ethereum contract. -type OpenRegistrar struct { - OpenRegistrarCaller // Read-only binding to the contract - OpenRegistrarTransactor // Write-only binding to the contract -} - -// OpenRegistrarCaller is an auto generated read-only Go binding around an Ethereum contract. -type OpenRegistrarCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// OpenRegistrarTransactor is an auto generated write-only Go binding around an Ethereum contract. -type OpenRegistrarTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// OpenRegistrarSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type OpenRegistrarSession struct { - Contract *OpenRegistrar // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// OpenRegistrarCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type OpenRegistrarCallerSession struct { - Contract *OpenRegistrarCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// OpenRegistrarTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type OpenRegistrarTransactorSession struct { - Contract *OpenRegistrarTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// OpenRegistrarRaw is an auto generated low-level Go binding around an Ethereum contract. -type OpenRegistrarRaw struct { - Contract *OpenRegistrar // Generic contract binding to access the raw methods on -} - -// OpenRegistrarCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type OpenRegistrarCallerRaw struct { - Contract *OpenRegistrarCaller // Generic read-only contract binding to access the raw methods on -} - -// OpenRegistrarTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type OpenRegistrarTransactorRaw struct { - Contract *OpenRegistrarTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewOpenRegistrar creates a new instance of OpenRegistrar, bound to a specific deployed contract. -func NewOpenRegistrar(address common.Address, backend bind.ContractBackend) (*OpenRegistrar, error) { - contract, err := bindOpenRegistrar(address, backend.(bind.ContractCaller), backend.(bind.ContractTransactor)) - if err != nil { - return nil, err - } - return &OpenRegistrar{OpenRegistrarCaller: OpenRegistrarCaller{contract: contract}, OpenRegistrarTransactor: OpenRegistrarTransactor{contract: contract}}, nil -} - -// NewOpenRegistrarCaller creates a new read-only instance of OpenRegistrar, bound to a specific deployed contract. -func NewOpenRegistrarCaller(address common.Address, caller bind.ContractCaller) (*OpenRegistrarCaller, error) { - contract, err := bindOpenRegistrar(address, caller, nil) - if err != nil { - return nil, err - } - return &OpenRegistrarCaller{contract: contract}, nil -} - -// NewOpenRegistrarTransactor creates a new write-only instance of OpenRegistrar, bound to a specific deployed contract. -func NewOpenRegistrarTransactor(address common.Address, transactor bind.ContractTransactor) (*OpenRegistrarTransactor, error) { - contract, err := bindOpenRegistrar(address, nil, transactor) - if err != nil { - return nil, err - } - return &OpenRegistrarTransactor{contract: contract}, nil -} - -// bindOpenRegistrar binds a generic wrapper to an already deployed contract. -func bindOpenRegistrar(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor) (*bind.BoundContract, error) { - parsed, err := abi.JSON(strings.NewReader(OpenRegistrarABI)) - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, parsed, caller, transactor), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_OpenRegistrar *OpenRegistrarRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { - return _OpenRegistrar.Contract.OpenRegistrarCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_OpenRegistrar *OpenRegistrarRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _OpenRegistrar.Contract.OpenRegistrarTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_OpenRegistrar *OpenRegistrarRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _OpenRegistrar.Contract.OpenRegistrarTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_OpenRegistrar *OpenRegistrarCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { - return _OpenRegistrar.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_OpenRegistrar *OpenRegistrarTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _OpenRegistrar.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_OpenRegistrar *OpenRegistrarTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _OpenRegistrar.Contract.contract.Transact(opts, method, params...) -} - -// FindResolver is a free data retrieval call binding the contract method 0xedc0277c. -// -// Solidity: function findResolver(nodeId bytes12, label bytes32) constant returns(rcode uint16, ttl uint32, rnode bytes12, raddress address) -func (_OpenRegistrar *OpenRegistrarCaller) FindResolver(opts *bind.CallOpts, nodeId [12]byte, label [32]byte) (struct { - Rcode uint16 - Ttl uint32 - Rnode [12]byte - Raddress common.Address -}, error) { - ret := new(struct { - Rcode uint16 - Ttl uint32 - Rnode [12]byte - Raddress common.Address - }) - out := ret - err := _OpenRegistrar.contract.Call(opts, out, "findResolver", nodeId, label) - return *ret, err -} - -// FindResolver is a free data retrieval call binding the contract method 0xedc0277c. -// -// Solidity: function findResolver(nodeId bytes12, label bytes32) constant returns(rcode uint16, ttl uint32, rnode bytes12, raddress address) -func (_OpenRegistrar *OpenRegistrarSession) FindResolver(nodeId [12]byte, label [32]byte) (struct { - Rcode uint16 - Ttl uint32 - Rnode [12]byte - Raddress common.Address -}, error) { - return _OpenRegistrar.Contract.FindResolver(&_OpenRegistrar.CallOpts, nodeId, label) -} - -// FindResolver is a free data retrieval call binding the contract method 0xedc0277c. -// -// Solidity: function findResolver(nodeId bytes12, label bytes32) constant returns(rcode uint16, ttl uint32, rnode bytes12, raddress address) -func (_OpenRegistrar *OpenRegistrarCallerSession) FindResolver(nodeId [12]byte, label [32]byte) (struct { - Rcode uint16 - Ttl uint32 - Rnode [12]byte - Raddress common.Address -}, error) { - return _OpenRegistrar.Contract.FindResolver(&_OpenRegistrar.CallOpts, nodeId, label) -} - -// GetExtended is a free data retrieval call binding the contract method 0x8021061c. -// -// Solidity: function getExtended(id bytes32) constant returns(data bytes) -func (_OpenRegistrar *OpenRegistrarCaller) GetExtended(opts *bind.CallOpts, id [32]byte) ([]byte, error) { - var ( - ret0 = new([]byte) - ) - out := ret0 - err := _OpenRegistrar.contract.Call(opts, out, "getExtended", id) - return *ret0, err -} - -// GetExtended is a free data retrieval call binding the contract method 0x8021061c. -// -// Solidity: function getExtended(id bytes32) constant returns(data bytes) -func (_OpenRegistrar *OpenRegistrarSession) GetExtended(id [32]byte) ([]byte, error) { - return _OpenRegistrar.Contract.GetExtended(&_OpenRegistrar.CallOpts, id) -} - -// GetExtended is a free data retrieval call binding the contract method 0x8021061c. -// -// Solidity: function getExtended(id bytes32) constant returns(data bytes) -func (_OpenRegistrar *OpenRegistrarCallerSession) GetExtended(id [32]byte) ([]byte, error) { - return _OpenRegistrar.Contract.GetExtended(&_OpenRegistrar.CallOpts, id) -} - -// GetOwner is a free data retrieval call binding the contract method 0xdeb931a2. -// -// Solidity: function getOwner(label bytes32) constant returns(address) -func (_OpenRegistrar *OpenRegistrarCaller) GetOwner(opts *bind.CallOpts, label [32]byte) (common.Address, error) { - var ( - ret0 = new(common.Address) - ) - out := ret0 - err := _OpenRegistrar.contract.Call(opts, out, "getOwner", label) - return *ret0, err -} - -// GetOwner is a free data retrieval call binding the contract method 0xdeb931a2. -// -// Solidity: function getOwner(label bytes32) constant returns(address) -func (_OpenRegistrar *OpenRegistrarSession) GetOwner(label [32]byte) (common.Address, error) { - return _OpenRegistrar.Contract.GetOwner(&_OpenRegistrar.CallOpts, label) -} - -// GetOwner is a free data retrieval call binding the contract method 0xdeb931a2. -// -// Solidity: function getOwner(label bytes32) constant returns(address) -func (_OpenRegistrar *OpenRegistrarCallerSession) GetOwner(label [32]byte) (common.Address, error) { - return _OpenRegistrar.Contract.GetOwner(&_OpenRegistrar.CallOpts, label) -} - -// Resolve is a free data retrieval call binding the contract method 0xa16fdafa. -// -// Solidity: function resolve(nodeId bytes12, qtype bytes32, index uint16) constant returns(rcode uint16, rtype bytes16, ttl uint32, len uint16, data bytes32) -func (_OpenRegistrar *OpenRegistrarCaller) Resolve(opts *bind.CallOpts, nodeId [12]byte, qtype [32]byte, index uint16) (struct { - Rcode uint16 - Rtype [16]byte - Ttl uint32 - Len uint16 - Data [32]byte -}, error) { - ret := new(struct { - Rcode uint16 - Rtype [16]byte - Ttl uint32 - Len uint16 - Data [32]byte - }) - out := ret - err := _OpenRegistrar.contract.Call(opts, out, "resolve", nodeId, qtype, index) - return *ret, err -} - -// Resolve is a free data retrieval call binding the contract method 0xa16fdafa. -// -// Solidity: function resolve(nodeId bytes12, qtype bytes32, index uint16) constant returns(rcode uint16, rtype bytes16, ttl uint32, len uint16, data bytes32) -func (_OpenRegistrar *OpenRegistrarSession) Resolve(nodeId [12]byte, qtype [32]byte, index uint16) (struct { - Rcode uint16 - Rtype [16]byte - Ttl uint32 - Len uint16 - Data [32]byte -}, error) { - return _OpenRegistrar.Contract.Resolve(&_OpenRegistrar.CallOpts, nodeId, qtype, index) -} - -// Resolve is a free data retrieval call binding the contract method 0xa16fdafa. -// -// Solidity: function resolve(nodeId bytes12, qtype bytes32, index uint16) constant returns(rcode uint16, rtype bytes16, ttl uint32, len uint16, data bytes32) -func (_OpenRegistrar *OpenRegistrarCallerSession) Resolve(nodeId [12]byte, qtype [32]byte, index uint16) (struct { - Rcode uint16 - Rtype [16]byte - Ttl uint32 - Len uint16 - Data [32]byte -}, error) { - return _OpenRegistrar.Contract.Resolve(&_OpenRegistrar.CallOpts, nodeId, qtype, index) -} - -// Register is a paid mutator transaction binding the contract method 0xa1f8f8f0. -// -// Solidity: function register(label bytes32, resolver address, nodeId bytes12) returns() -func (_OpenRegistrar *OpenRegistrarTransactor) Register(opts *bind.TransactOpts, label [32]byte, resolver common.Address, nodeId [12]byte) (*types.Transaction, error) { - return _OpenRegistrar.contract.Transact(opts, "register", label, resolver, nodeId) -} - -// Register is a paid mutator transaction binding the contract method 0xa1f8f8f0. -// -// Solidity: function register(label bytes32, resolver address, nodeId bytes12) returns() -func (_OpenRegistrar *OpenRegistrarSession) Register(label [32]byte, resolver common.Address, nodeId [12]byte) (*types.Transaction, error) { - return _OpenRegistrar.Contract.Register(&_OpenRegistrar.TransactOpts, label, resolver, nodeId) -} - -// Register is a paid mutator transaction binding the contract method 0xa1f8f8f0. -// -// Solidity: function register(label bytes32, resolver address, nodeId bytes12) returns() -func (_OpenRegistrar *OpenRegistrarTransactorSession) Register(label [32]byte, resolver common.Address, nodeId [12]byte) (*types.Transaction, error) { - return _OpenRegistrar.Contract.Register(&_OpenRegistrar.TransactOpts, label, resolver, nodeId) -} - -// SetOwner is a paid mutator transaction binding the contract method 0x5b0fc9c3. -// -// Solidity: function setOwner(label bytes32, newOwner address) returns() -func (_OpenRegistrar *OpenRegistrarTransactor) SetOwner(opts *bind.TransactOpts, label [32]byte, newOwner common.Address) (*types.Transaction, error) { - return _OpenRegistrar.contract.Transact(opts, "setOwner", label, newOwner) -} - -// SetOwner is a paid mutator transaction binding the contract method 0x5b0fc9c3. -// -// Solidity: function setOwner(label bytes32, newOwner address) returns() -func (_OpenRegistrar *OpenRegistrarSession) SetOwner(label [32]byte, newOwner common.Address) (*types.Transaction, error) { - return _OpenRegistrar.Contract.SetOwner(&_OpenRegistrar.TransactOpts, label, newOwner) -} - -// SetOwner is a paid mutator transaction binding the contract method 0x5b0fc9c3. -// -// Solidity: function setOwner(label bytes32, newOwner address) returns() -func (_OpenRegistrar *OpenRegistrarTransactorSession) SetOwner(label [32]byte, newOwner common.Address) (*types.Transaction, error) { - return _OpenRegistrar.Contract.SetOwner(&_OpenRegistrar.TransactOpts, label, newOwner) -} - -// SetResolver is a paid mutator transaction binding the contract method 0xa9f2a1b2. -// -// Solidity: function setResolver(label bytes32, resolver address, nodeId bytes12) returns() -func (_OpenRegistrar *OpenRegistrarTransactor) SetResolver(opts *bind.TransactOpts, label [32]byte, resolver common.Address, nodeId [12]byte) (*types.Transaction, error) { - return _OpenRegistrar.contract.Transact(opts, "setResolver", label, resolver, nodeId) -} - -// SetResolver is a paid mutator transaction binding the contract method 0xa9f2a1b2. -// -// Solidity: function setResolver(label bytes32, resolver address, nodeId bytes12) returns() -func (_OpenRegistrar *OpenRegistrarSession) SetResolver(label [32]byte, resolver common.Address, nodeId [12]byte) (*types.Transaction, error) { - return _OpenRegistrar.Contract.SetResolver(&_OpenRegistrar.TransactOpts, label, resolver, nodeId) -} - -// SetResolver is a paid mutator transaction binding the contract method 0xa9f2a1b2. -// -// Solidity: function setResolver(label bytes32, resolver address, nodeId bytes12) returns() -func (_OpenRegistrar *OpenRegistrarTransactorSession) SetResolver(label [32]byte, resolver common.Address, nodeId [12]byte) (*types.Transaction, error) { - return _OpenRegistrar.Contract.SetResolver(&_OpenRegistrar.TransactOpts, label, resolver, nodeId) -} diff --git a/swarm/services/ens/contract/PersonalResolver.abi b/swarm/services/ens/contract/PersonalResolver.abi deleted file mode 100644 index 87cb9e525b..0000000000 --- a/swarm/services/ens/contract/PersonalResolver.abi +++ /dev/null @@ -1 +0,0 @@ -[{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"setOwner","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"rootNodeId","type":"bytes12"},{"name":"name","type":"bytes32[]"}],"name":"deletePrivateRR","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"isPersonalResolver","outputs":[{"name":"","type":"bool"}],"type":"function"},{"constant":true,"inputs":[{"name":"id","type":"bytes32"}],"name":"getExtended","outputs":[{"name":"data","type":"bytes"}],"type":"function"},{"constant":false,"inputs":[{"name":"rootNodeId","type":"bytes12"},{"name":"name","type":"string"},{"name":"rtype","type":"bytes16"},{"name":"ttl","type":"uint32"},{"name":"len","type":"uint16"},{"name":"data","type":"bytes32"}],"name":"setRR","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":false,"inputs":[{"name":"rootNodeId","type":"bytes12"},{"name":"name","type":"bytes32[]"},{"name":"rtype","type":"bytes16"},{"name":"ttl","type":"uint32"},{"name":"len","type":"uint16"},{"name":"data","type":"bytes32"}],"name":"setPrivateRR","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"nodeId","type":"bytes12"},{"name":"qtype","type":"bytes32"},{"name":"index","type":"uint16"}],"name":"resolve","outputs":[{"name":"rcode","type":"uint16"},{"name":"rtype","type":"bytes16"},{"name":"ttl","type":"uint32"},{"name":"len","type":"uint16"},{"name":"data","type":"bytes32"}],"type":"function"},{"constant":false,"inputs":[{"name":"rootNodeId","type":"bytes12"},{"name":"name","type":"string"}],"name":"deleteRR","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"nodeId","type":"bytes12"},{"name":"label","type":"bytes32"}],"name":"findResolver","outputs":[{"name":"rcode","type":"uint16"},{"name":"ttl","type":"uint32"},{"name":"rnode","type":"bytes12"},{"name":"raddress","type":"address"}],"type":"function"},{"inputs":[],"type":"constructor"}] diff --git a/swarm/services/ens/contract/PersonalResolver.bin b/swarm/services/ens/contract/PersonalResolver.bin deleted file mode 100644 index 0c4c2a433f..0000000000 --- a/swarm/services/ens/contract/PersonalResolver.bin +++ /dev/null @@ -1 +0,0 @@ -606060405260008054600160a060020a031916331781558052600160208190527fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb4b556112798061004f6000396000f3606060405236156100825760e060020a600035046313af403581146100845780631b370194146100a65780633f5665e7146101085780638021061c1461011c5780638bba944d146101435780638da5cb5b146101b757806391c8e7b9146101c9578063a16fdafa14610237578063bc06183d1461026c578063edc0277c146102d3575b005b610082600435600054600160a060020a03908116339091161461042b57610002565b60408051602480356004818101356020818102808701820190975281865261008296833596939560449501929182919085019084908082843750949650505050505050600080548190600160a060020a03908116339091161461044057610002565b604080516001815290519081900360200190f35b6103166004356040805160208181018352600091829052825190810190925281525b919050565b60408051602060248035600481810135601f8101859004850286018501909652858552610082958135959194604494929390920191819084018382808284375094965050933593505060643591505060843560a435600080548190600160a060020a03908116339091161461054857610002565b610384600054600160a060020a031681565b6040805160248035600481810135602081810280870182019097528186526100829683359693956044950192918291908501908490808284375094965050933593505060643591505060843560a435600080548190600160a060020a0390811633909116146105dc57610002565b6103a1600435602435604435600060006000600060006000600060008861ffff1611156105ea575b5050939792965093509350565b60408051602060248035600481810135601f8101859004850286018501909652858552610082958135959194604494929390920191819084018382808284375094965050505050505060008054819033600160a060020a0390811691161461068f57610002565b6103e66004356024356000600060006000600061074f87875b60408051600160a060020a031984168152600c8101839052905190819003602c0190205b92915050565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f1680156103765780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60408051600160a060020a03929092168252519081900360200190f35b6040805161ffff96871681526001608060020a0319909516602086015263ffffffff939093168484015293166060830152608082019290925290519081900360a00190f35b6040805161ffff95909516855263ffffffff939093166020850152600160a060020a03199190911683830152600160a060020a03166060830152519081900360800190f35b60008054600160a060020a0319168217905550565b61047c8484600086515b6000808383016000190181805b868312610781576107a7898985815181101561000257906020019060200201516102ec565b600281015491935091506000141561049357610002565b600281015460019011156104af576104cf8160008080806104e3565b6104cf8484600086515b600060006108098686866001016001870361044a565b50505050565b90925090506105d281878787875b84546001608060020a031916608060020a948590041773ffffffff000000000000000000000000000000001916939092029290921775ffff0000000000000000000000000000000000000000191660a060020a90920291909117825560019190910155565b6104d58861057e895b60408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b604080518082018252600080825260208281018290528351808501855282815280820183905284518086019095526001855260f960020a601702918501919091529092839291908390819061094790610551565b5050505050505050565b6104d5888860008a5161044a565b600160a060020a03198a1660009081526001602052604081206002810154909350141561061a576003965061025f565b50807f2a0000000000000000000000000000000000000000000000000000000000000089148061065a57508054608060020a026001608060020a03191689145b1561025f5780546001820154608060020a8281029850820463ffffffff16965060a060020a90910461ffff169450925061025f565b61069c8461057e85610551565b60028101549193509150600014156106b357610002565b600281015460019011156106cf576104cf8160008080806104e3565b6104cf846106e985610551565b155b156105d2576105d288885b60406040519081016040528060008152602001600081526020015060006000600060006000610c5e610c956040604051908101604052806001815260200160f960020a6017028152602001506105519090565b610e1093503091505b5092959194509250565b600160a060020a03198116600090815260016020526040812060028101549295509250141561073c5760039450610745565b50505050600160a060020a03198516600090815260016020526040902094959350505050565b600160a060020a0319811660009081526001602052604081206002810154929450925014156107f75760016002828101829055600160a060020a03198b1660009081526040902001805490910190555b81985088506000199290920191610457565b915091506001600050600061082e8488600081518110156100025750602001516102ec565b600160a060020a031916815260208181019290925260400160009081208054600160b060020a0319168155600181018290556002810182905560038101805483825590835292822090926108b991908101905b8082111561093b576000818150805460018160011615610100020316600290046000825580601f1061090d57505b5050600101610881565b505050600281018054600019019081905560011480156108ea57508054608060020a026001608060020a0319166000145b80156108f65750600183115b1561093f5761093f868686600101600187036104b9565b601f0160209004906000526020600020908101906108af91905b8082111561093b5760008155600101610927565b5090565b505050505050565b93505b61097e875b805160001461013e565b50505050600160a060020a031984166000908152600160205260409020939492505050565b151561095957610a18878560408051808201909152600080825260208201526110f4838383604080518082019091526000808252602082810182905285518682015186519287015161111e939060008080808786116111d857602086116111e75760018660200360080260020a031980865116878a03890194505b808286511614611211576000198501948990116109f957889450611216565b9250610a238361094f565b15610a2d57610002565b610a4388610a9f855b8051602082015120919050565b600160a060020a031981166000908152600160205260408120600281015492945092501415610ad25760038101805460018101808355919082908015829011610adc57818360005260206000209182019101610adc9190610af1565b6102ec565b505060016002828101829055600160a060020a03198a16600090815260208390526040902001805490910190555b819750875061094a565b50505050610b4183610bb39090565b50506001015b8082111561093b576000818150805460018160011615610100020316600290046000825580601f10610b235750610aeb565b601f016020900490600052602060002090810190610aeb9190610927565b6003820180546000198101908110156100025790600052602060002090016000509080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610c2e57805160ff19168380011785555b50610aa4929150610927565b6040805160208181018352600080835283519182018452808252925184519293919290805910610be05750595b908082528060200260200182016040525091506020820190506110f4818560200151866000015160005b6020821061114757825184526020938401939290920191601f199190910190610c0a565b82800160010185558215610ba7579182015b82811115610ba7578251826000505591602001919060010190610c40565b9550610d308861057e896040805180820182526000808252602091820152815180830190925282518252828101519082015261013e565b889060408051808201909152600080825260208201526110f48383836040805180820190915260008082526020828101829052855186820151865192870151611165939060008080808088871161122d576020871161123f5760018760200360080260020a031980875116888b038a018a96505b818388511614610d25576001870196819010610d09578b8b0196505b505050839450611233565b600381015491965094509250600091505b82821015610dcf57610dd886610e7086600301600050858154811015610002579060005260206000209001600050604080518254602060026001831615610100026000190190921691909104601f810182900482028301820190935282825290929190830182828015610f1b5780601f10610ef057610100808354040283529160200191610f1b565b505050505b610ffa86610a36565b15610f265760038401805460001985019081101561000257906000526020600020900160005060038501805484908110156100025790600052602060002090016000509080546001816001161561010002031660029004828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610f3257805485555b50610f6e929150610927565b9060006110fb838380518251600091829081908190819081908190819088901015610e9a57895197505b8a60200151965089602001519550600094505b878510156111ae578651865190945092508284146111c45750506020869003830160080260020a600019011980821681841603600081146111c4578098506111b6565b820191906000526020600020905b815481529060010190602001808311610efe57829003601f168201915b506105519350505050565b60019190910190610d41565b82800160010185558215610e6457600052602060002091601f016020900482015b82811115610e64578254825591600101919060010190610f53565b50506003840180546000198101808355919082908015829011610dca57818360005260206000209182019101610dca9190610faa565b50506001015b8082111561093b576000818150805460018160011615610100020316600290046000825580601f10610fdc5750610fa4565b601f016020900490600052602060002090810190610fa49190610927565b90506001600061100a87846102ec565b600160a060020a031916815260208181019290925260400160009081208054600160b060020a03191681556001810182905560028101829055600381018054838255908352928220909261109591908101905b8082111561093b576000818150805460018160011615610100020316600290046000825580601f106110d657505b505060010161105d565b505050600284018054600019019081905560011480156110c657508354608060020a026001608060020a0319166000145b80156106de57506106dc8761094f565b601f01602090049060005260206000209081019061108b9190610927565b5092915050565b6000149050610310565b8351835186519101900385525b8291505b509392505050565b602084810182905286018051875190830390038552519091508114156111055760008552611112565b50825191516020919091036101000a60001901918216911916179052565b602086810180519186019190915280518203855286519051919250018114156111915760008552611112565b835183518651910190038552835181016020860152829150611116565b89518b510398505b505050505050505092915050565b602096870196958601959490940193610ead565b8693505b505050949350505050565b8585208689038801935091505b8683106111d85750848220808214156112205785830193506111dc565b938701935b50508293506111dc565b60001992909201916111f4565b88880194505b50505050949350505050565b8686208894506000935091505b868903831161122d57508583208082141561126957839450611233565b600193840193929092019161124c56 \ No newline at end of file diff --git a/swarm/services/ens/contract/PersonalResolver.go b/swarm/services/ens/contract/PersonalResolver.go deleted file mode 100644 index c2ffd6d0e8..0000000000 --- a/swarm/services/ens/contract/PersonalResolver.go +++ /dev/null @@ -1,434 +0,0 @@ -// This file is an automatically generated Go binding. Do not modify as any -// change will likely be lost upon the next re-generation! - -package contract - -import ( - "strings" - - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" -) - -// PersonalResolverABI is the input ABI used to generate the binding from. -const PersonalResolverABI = `[{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"setOwner","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"rootNodeId","type":"bytes12"},{"name":"name","type":"bytes32[]"}],"name":"deletePrivateRR","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"isPersonalResolver","outputs":[{"name":"","type":"bool"}],"type":"function"},{"constant":true,"inputs":[{"name":"id","type":"bytes32"}],"name":"getExtended","outputs":[{"name":"data","type":"bytes"}],"type":"function"},{"constant":false,"inputs":[{"name":"rootNodeId","type":"bytes12"},{"name":"name","type":"string"},{"name":"rtype","type":"bytes16"},{"name":"ttl","type":"uint32"},{"name":"len","type":"uint16"},{"name":"data","type":"bytes32"}],"name":"setRR","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":false,"inputs":[{"name":"rootNodeId","type":"bytes12"},{"name":"name","type":"bytes32[]"},{"name":"rtype","type":"bytes16"},{"name":"ttl","type":"uint32"},{"name":"len","type":"uint16"},{"name":"data","type":"bytes32"}],"name":"setPrivateRR","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"nodeId","type":"bytes12"},{"name":"qtype","type":"bytes32"},{"name":"index","type":"uint16"}],"name":"resolve","outputs":[{"name":"rcode","type":"uint16"},{"name":"rtype","type":"bytes16"},{"name":"ttl","type":"uint32"},{"name":"len","type":"uint16"},{"name":"data","type":"bytes32"}],"type":"function"},{"constant":false,"inputs":[{"name":"rootNodeId","type":"bytes12"},{"name":"name","type":"string"}],"name":"deleteRR","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"nodeId","type":"bytes12"},{"name":"label","type":"bytes32"}],"name":"findResolver","outputs":[{"name":"rcode","type":"uint16"},{"name":"ttl","type":"uint32"},{"name":"rnode","type":"bytes12"},{"name":"raddress","type":"address"}],"type":"function"},{"inputs":[],"type":"constructor"}]` - -// PersonalResolverBin is the compiled bytecode used for deploying new contracts. -const PersonalResolverBin = `60606040525b33600060006101000a81548173ffffffffffffffffffffffffffffffffffffffff02191690830217905550600160016000506000600074010000000000000000000000000000000000000000028152602001908152602001600020600050600201600050819055505b611cb58061007c6000396000f3606060405236156100a0576000357c01000000000000000000000000000000000000000000000000000000009004806313af4035146100a25780631b370194146100ba5780633f5665e7146101165780638021061c1461013b5780638bba944d146101bf5780638da5cb5b1461024257806391c8e7b91461027b578063a16fdafa146102fb578063bc06183d1461037a578063edc0277c146103d9576100a0565b005b6100b8600480803590602001909190505061045a565b005b610114600480803590602001909190803590602001908201803590602001919190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509090919050506104e5565b005b61012360048050506105c1565b60405180821515815260200191505060405180910390f35b61015160048080359060200190919050506105cf565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f1680156101b15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102406004808035906020019091908035906020019082018035906020019191908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050909091908035906020019091908035906020019091908035906020019091908035906020019091905050610603565b005b61024f6004805050610699565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f9600480803590602001909190803590602001908201803590602001919190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509090919080359060200190919080359060200190919080359060200190919080359060200190919050506106bf565b005b610323600480803590602001909190803590602001909190803590602001909190505061074f565b604051808661ffff168152602001856fffffffffffffffffffffffffffffffff191681526020018463ffffffff1681526020018361ffff168152602001826000191681526020019550505050505060405180910390f35b6103d76004808035906020019091908035906020019082018035906020019191908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509090919050506108b0565b005b6103f86004808035906020019091908035906020019091905050610998565b604051808561ffff1681526020018463ffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff191681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200194505050505060405180910390f35b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156104b657610002565b80600060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055505b50565b60006000600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561054557610002565b610553848460008651610a14565b9150915060008160020160005054141561056c57610002565b6001816002016000505411156105ab576105a681600001600050600070010000000000000000000000000000000002600060006000610b41565b6105ba565b6105b9848460008651610bde565b5b5b50505050565b6000600190506105cc565b90565b6020604051908101604052806000815260200150602060405190810160405280600081526020015090506105fe565b919050565b60006000600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561066357610002565b6106778861067289610dfd9090565b610e47565b9150915061068e8160000160005087878787610b41565b5b5050505050505050565b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006000600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561071f57610002565b61072d888860008a51610a14565b915091506107448160000160005087878787610b41565b5b5050505050505050565b600060006000600060006000600060008861ffff16111561076f576108a3565b600160005060008b73ffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060005091506000826002016000505414156107bc576003965086506108a3565b8160000160005090507f2a00000000000000000000000000000000000000000000000000000000000000600019168960001916148061083257508060000160009054906101000a9004700100000000000000000000000000000000026fffffffffffffffffffffffffffffffff19168960001916145b1561089e578060000160009054906101000a900470010000000000000000000000000000000002955085508060000160109054906101000a900463ffffffff16945084508060000160149054906101000a900461ffff16935083508060010160005054925082506108a3565b6108a3565b5050939792965093509350565b60006000600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561091057610002565b6109248461091f85610dfd9090565b610e47565b9150915060008160020160005054141561093d57610002565b60018160020160005054111561097c5761097781600001600050600070010000000000000000000000000000000002600060006000610b41565b610991565b6109908461098b85610dfd9090565b611197565b5b5b50505050565b600060006000600060006109ac87876116db565b92508250600160005060008473ffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060005090506000816002016000505414156109fd57600394508450610a0a565b610e109350835030915081505b5092959194509250565b6000600060006000600060018688010392505b8683121515610af857610a4e898985815181101561000257906020019060200201516116db565b9150600160005060008373ffffffffffffffffffffffffffffffffffffffff191681526020019081526020016000206000509050600081600201600050541415610ae457600181600201600050819055506001600160005060008b73ffffffffffffffffffffffffffffffffffffffff191681526020019081526020016000206000506002016000828282505401925050819055505b81985088505b828060019003935050610a27565b88600160005060008b73ffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060005080905094509450610b35565b50505094509492505050565b60208150602060ff161115610b5557610002565b838560000160006101000a8154816fffffffffffffffffffffffffffffffff021916908370010000000000000000000000000000000090040217905550828560000160106101000a81548163ffffffff02191690830217905550818560000160146101000a81548161ffff021916908302179055508085600101600050819055505b5050505050565b60006000610bf486866001870160018703610a14565b9150915060016000506000610c1e84886000815181101561000257906020019060200201516116db565b73ffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060006000820160006000820160006101000a8154906fffffffffffffffffffffffffffffffff02191690556000820160106101000a81549063ffffffff02191690556000820160146101000a81549061ffff02191690556001820160005060009055505060028201600050600090556003820160005080546000825590600052602060002090810190610d539190610cd6565b80821115610d4f576000818150805460018160011615610100020316600290046000825580601f10610d085750610d45565b601f016020900490600052602060002090810190610d449190610d26565b80821115610d405760008181506000905550600101610d26565b5090565b5b5050600101610cd6565b5090565b5b50505060018160020160008282825054039250508190555060018160020160005054148015610dd057506000700100000000000000000000000000000000028160000160005060000160009054906101000a9004700100000000000000000000000000000000026fffffffffffffffffffffffffffffffff1916145b8015610ddc5750600183115b15610df457610df386866001870160018703610bde565b5b5b505050505050565b604060405190810160405280600081526020016000815260200150600060208301905060406040519081016040528084518152602001828152602001509150610e41565b50919050565b6000600060406040519081016040528060008152602001600081526020015060406040519081016040528060008152602001600081526020015060006000610ec9604060405190810160405280600181526020017f2e00000000000000000000000000000000000000000000000000000000000000815260200150610dfd9090565b93505b610ed7876117219090565b151561114f57610eea8488611737909190565b9250610ef7836117219090565b15610f0157610002565b610f1588610f10856117659090565b6116db565b9150600160005060008373ffffffffffffffffffffffffffffffffffffffff19168152602001908152602001600020600050905060008160020160005054141561114557600181600301600050818180549050019150818154818355818115116110105781836000526020600020918201910161100f9190610f92565b8082111561100b576000818150805460018160011615610100020316600290046000825580601f10610fc45750611001565b601f0160209004906000526020600020908101906110009190610fe2565b80821115610ffc5760008181506000905550600101610fe2565b5090565b5b5050600101610f92565b5090565b5b5050505061101f836117779090565b816003016000506001836003016000508054905003815481101561000257906000526020600020900160005b509080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061109557805160ff19168380011785556110c6565b828001600101855582156110c6579182015b828111156110c55782518260005055916020019190600101906110a7565b5b5090506110f191906110d3565b808211156110ed57600081815060009055506001016110d3565b5090565b5050600181600201600050819055506001600160005060008a73ffffffffffffffffffffffffffffffffffffffff191681526020019081526020016000206000506002016000828282505401925050819055505b8197508750610ecc565b87600160005060008a73ffffffffffffffffffffffffffffffffffffffff191681526020019081526020016000206000508090509550955061118c565b505050509250929050565b6040604051908101604052806000815260200160008152602001506000600060006000600061120c611203604060405190810160405280600181526020017f2e00000000000000000000000000000000000000000000000000000000000000815260200150610dfd9090565b886117ee909190565b95506112228861121d8961181c9090565b610e47565b9450945083600301600050805490509250600091505b828210156114dc5761130f866113078660030160005085815481101561000257906000526020600020900160005b508054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112fb5780601f106112d0576101008083540402835291602001916112fb565b820191906000526020600020905b8154815290600101906020018083116112de57829003601f168201915b5050505050610dfd9090565b611864909190565b156114ce578360030160005060018403815481101561000257906000526020600020900160005b508460030160005083815481101561000257906000526020600020900160005b509080546001816001161561010002031660029004828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106113a457805485556113e1565b828001600101855582156113e157600052602060002091601f016020900482015b828111156113e05782548255916001019190600101906113c5565b5b50905061140c91906113ee565b8082111561140857600081815060009055506001016113ee565b5090565b5050600184600301600050818180549050039150818154818355818115116114c5578183600052602060002091820191016114c49190611447565b808211156114c0576000818150805460018160011615610100020316600290046000825580601f1061147957506114b6565b601f0160209004906000526020600020908101906114b59190611497565b808211156114b15760008181506000905550600101611497565b5090565b5b5050600101611447565b5090565b5b505050506114dc565b5b8180600101925050611238565b6114e7866117659090565b9050600160005060006114fa87846116db565b73ffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060006000820160006000820160006101000a8154906fffffffffffffffffffffffffffffffff02191690556000820160106101000a81549063ffffffff02191690556000820160146101000a81549061ffff0219169055600182016000506000905550506002820160005060009055600382016000508054600082559060005260206000209081019061162f91906115b2565b8082111561162b576000818150805460018160011615610100020316600290046000825580601f106115e45750611621565b601f0160209004906000526020600020908101906116209190611602565b8082111561161c5760008181506000905550600101611602565b5090565b5b50506001016115b2565b5090565b5b505050600184600201600082828250540392505081905550600184600201600050541480156116ac57506000700100000000000000000000000000000000028460000160005060000160009054906101000a9004700100000000000000000000000000000000026fffffffffffffffffffffffffffffffff1916145b80156116c057506116be876117219090565b155b156116d0576116cf8888611197565b5b5b5050505050505050565b60008282604051808373ffffffffffffffffffffffffffffffffffffffff19168152600c0182600019168152602001925050506040518091039020905080505b92915050565b600060008260000151149050611732565b919050565b60406040519081016040528060008152602001600081526020015061175d838383611880565b505b92915050565b6000815160208301512090505b919050565b60206040519081016040528060008152602001506020604051908101604052806000815260200150600083600001516040518059106117b35750595b908082528060200260200182016040525091506020820190506117df8185602001518660000151611936565b8192506117e7565b5050919050565b604060405190810160405280600081526020016000815260200150611814838383611989565b505b92915050565b604060405190810160405280600081526020016000815260200150604060405190810160405280836000015181526020018360200151815260200150905061185f565b919050565b600060006118728484611a58565b14905061187a565b92915050565b60406040519081016040528060008152602001600081526020015060006118b98560000151866020015186600001518760200151611b23565b905080836020019090818152602001505084602001518103856000015103836000019090818152602001505084602001518114156119065760008560000190908181526020015050611926565b836000015183600001510185600001818151039150909081815260200150505b82915061192e565b509392505050565b60005b6020821015156119655782518452602084019350835060208301925082505b6020820391508150611939565b6001826020036101000a039050801983511681855116818117865250505b50505050565b60406040519081016040528060008152602001600081526020015060006119c28560000151866020015186600001518760200151611be7565b9050846020015183602001909081815260200150508460200151810383600001909081815260200150508460000151856020015101811415611a135760008560000190908181526020015050611a48565b836000015183600001510185600001818151039150909081815260200150508360000151810185602001909081815260200150505b829150611a50565b509392505050565b6000600060006000600060006000600060008a6000015197508a600001518a600001511015611a8b578960000151975087505b8a60200151965089602001519550600094505b87851015611b035786519350855192508284141515611ae557600185896020030160080260020a03199150818316828516039050600081141515611ae457809850611b15565b5b602087019650865060208601955085505b6020850194508450611a9e565b89600001518b60000151039850611b15565b505050505050505092915050565b60006000600060008786111515611bd457602086111515611b8e5760018660200360080260020a031980865116878a03890194505b808286511614611b7a57600185039450886001860111611b5857889450611b80565b87850194505b5050829350611bdc56611bd3565b85852091508588038701925082505b8683101515611bd2578583209050806000191682600019161415611bc5578583019350611bdc565b6001830392508250611b9d565b5b5b869350611bdc565b505050949350505050565b600060006000600060008887111515611c9f57602087111515611c4e5760018760200360080260020a031980875116888b038a018a96505b818388511614611c3f57600187019650806001880310611c1f578b8b0196505b505050839450611ca956611c9e565b868620915087935083506000925082505b86890383111515611c9d578684209050806000191682600019161415611c8757839450611ca9565b60018401935083505b8280600101935050611c5f565b5b5b8888019450611ca9565b5050505094935050505056` - -// DeployPersonalResolver deploys a new Ethereum contract, binding an instance of PersonalResolver to it. -func DeployPersonalResolver(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *PersonalResolver, error) { - parsed, err := abi.JSON(strings.NewReader(PersonalResolverABI)) - if err != nil { - return common.Address{}, nil, nil, err - } - address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(PersonalResolverBin), backend) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &PersonalResolver{PersonalResolverCaller: PersonalResolverCaller{contract: contract}, PersonalResolverTransactor: PersonalResolverTransactor{contract: contract}}, nil -} - -// PersonalResolver is an auto generated Go binding around an Ethereum contract. -type PersonalResolver struct { - PersonalResolverCaller // Read-only binding to the contract - PersonalResolverTransactor // Write-only binding to the contract -} - -// PersonalResolverCaller is an auto generated read-only Go binding around an Ethereum contract. -type PersonalResolverCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// PersonalResolverTransactor is an auto generated write-only Go binding around an Ethereum contract. -type PersonalResolverTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// PersonalResolverSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type PersonalResolverSession struct { - Contract *PersonalResolver // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// PersonalResolverCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type PersonalResolverCallerSession struct { - Contract *PersonalResolverCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// PersonalResolverTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type PersonalResolverTransactorSession struct { - Contract *PersonalResolverTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// PersonalResolverRaw is an auto generated low-level Go binding around an Ethereum contract. -type PersonalResolverRaw struct { - Contract *PersonalResolver // Generic contract binding to access the raw methods on -} - -// PersonalResolverCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type PersonalResolverCallerRaw struct { - Contract *PersonalResolverCaller // Generic read-only contract binding to access the raw methods on -} - -// PersonalResolverTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type PersonalResolverTransactorRaw struct { - Contract *PersonalResolverTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewPersonalResolver creates a new instance of PersonalResolver, bound to a specific deployed contract. -func NewPersonalResolver(address common.Address, backend bind.ContractBackend) (*PersonalResolver, error) { - contract, err := bindPersonalResolver(address, backend.(bind.ContractCaller), backend.(bind.ContractTransactor)) - if err != nil { - return nil, err - } - return &PersonalResolver{PersonalResolverCaller: PersonalResolverCaller{contract: contract}, PersonalResolverTransactor: PersonalResolverTransactor{contract: contract}}, nil -} - -// NewPersonalResolverCaller creates a new read-only instance of PersonalResolver, bound to a specific deployed contract. -func NewPersonalResolverCaller(address common.Address, caller bind.ContractCaller) (*PersonalResolverCaller, error) { - contract, err := bindPersonalResolver(address, caller, nil) - if err != nil { - return nil, err - } - return &PersonalResolverCaller{contract: contract}, nil -} - -// NewPersonalResolverTransactor creates a new write-only instance of PersonalResolver, bound to a specific deployed contract. -func NewPersonalResolverTransactor(address common.Address, transactor bind.ContractTransactor) (*PersonalResolverTransactor, error) { - contract, err := bindPersonalResolver(address, nil, transactor) - if err != nil { - return nil, err - } - return &PersonalResolverTransactor{contract: contract}, nil -} - -// bindPersonalResolver binds a generic wrapper to an already deployed contract. -func bindPersonalResolver(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor) (*bind.BoundContract, error) { - parsed, err := abi.JSON(strings.NewReader(PersonalResolverABI)) - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, parsed, caller, transactor), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_PersonalResolver *PersonalResolverRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { - return _PersonalResolver.Contract.PersonalResolverCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_PersonalResolver *PersonalResolverRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _PersonalResolver.Contract.PersonalResolverTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_PersonalResolver *PersonalResolverRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _PersonalResolver.Contract.PersonalResolverTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_PersonalResolver *PersonalResolverCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { - return _PersonalResolver.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_PersonalResolver *PersonalResolverTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _PersonalResolver.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_PersonalResolver *PersonalResolverTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _PersonalResolver.Contract.contract.Transact(opts, method, params...) -} - -// FindResolver is a free data retrieval call binding the contract method 0xedc0277c. -// -// Solidity: function findResolver(nodeId bytes12, label bytes32) constant returns(rcode uint16, ttl uint32, rnode bytes12, raddress address) -func (_PersonalResolver *PersonalResolverCaller) FindResolver(opts *bind.CallOpts, nodeId [12]byte, label [32]byte) (struct { - Rcode uint16 - Ttl uint32 - Rnode [12]byte - Raddress common.Address -}, error) { - ret := new(struct { - Rcode uint16 - Ttl uint32 - Rnode [12]byte - Raddress common.Address - }) - out := ret - err := _PersonalResolver.contract.Call(opts, out, "findResolver", nodeId, label) - return *ret, err -} - -// FindResolver is a free data retrieval call binding the contract method 0xedc0277c. -// -// Solidity: function findResolver(nodeId bytes12, label bytes32) constant returns(rcode uint16, ttl uint32, rnode bytes12, raddress address) -func (_PersonalResolver *PersonalResolverSession) FindResolver(nodeId [12]byte, label [32]byte) (struct { - Rcode uint16 - Ttl uint32 - Rnode [12]byte - Raddress common.Address -}, error) { - return _PersonalResolver.Contract.FindResolver(&_PersonalResolver.CallOpts, nodeId, label) -} - -// FindResolver is a free data retrieval call binding the contract method 0xedc0277c. -// -// Solidity: function findResolver(nodeId bytes12, label bytes32) constant returns(rcode uint16, ttl uint32, rnode bytes12, raddress address) -func (_PersonalResolver *PersonalResolverCallerSession) FindResolver(nodeId [12]byte, label [32]byte) (struct { - Rcode uint16 - Ttl uint32 - Rnode [12]byte - Raddress common.Address -}, error) { - return _PersonalResolver.Contract.FindResolver(&_PersonalResolver.CallOpts, nodeId, label) -} - -// GetExtended is a free data retrieval call binding the contract method 0x8021061c. -// -// Solidity: function getExtended(id bytes32) constant returns(data bytes) -func (_PersonalResolver *PersonalResolverCaller) GetExtended(opts *bind.CallOpts, id [32]byte) ([]byte, error) { - var ( - ret0 = new([]byte) - ) - out := ret0 - err := _PersonalResolver.contract.Call(opts, out, "getExtended", id) - return *ret0, err -} - -// GetExtended is a free data retrieval call binding the contract method 0x8021061c. -// -// Solidity: function getExtended(id bytes32) constant returns(data bytes) -func (_PersonalResolver *PersonalResolverSession) GetExtended(id [32]byte) ([]byte, error) { - return _PersonalResolver.Contract.GetExtended(&_PersonalResolver.CallOpts, id) -} - -// GetExtended is a free data retrieval call binding the contract method 0x8021061c. -// -// Solidity: function getExtended(id bytes32) constant returns(data bytes) -func (_PersonalResolver *PersonalResolverCallerSession) GetExtended(id [32]byte) ([]byte, error) { - return _PersonalResolver.Contract.GetExtended(&_PersonalResolver.CallOpts, id) -} - -// IsPersonalResolver is a free data retrieval call binding the contract method 0x3f5665e7. -// -// Solidity: function isPersonalResolver() constant returns(bool) -func (_PersonalResolver *PersonalResolverCaller) IsPersonalResolver(opts *bind.CallOpts) (bool, error) { - var ( - ret0 = new(bool) - ) - out := ret0 - err := _PersonalResolver.contract.Call(opts, out, "isPersonalResolver") - return *ret0, err -} - -// IsPersonalResolver is a free data retrieval call binding the contract method 0x3f5665e7. -// -// Solidity: function isPersonalResolver() constant returns(bool) -func (_PersonalResolver *PersonalResolverSession) IsPersonalResolver() (bool, error) { - return _PersonalResolver.Contract.IsPersonalResolver(&_PersonalResolver.CallOpts) -} - -// IsPersonalResolver is a free data retrieval call binding the contract method 0x3f5665e7. -// -// Solidity: function isPersonalResolver() constant returns(bool) -func (_PersonalResolver *PersonalResolverCallerSession) IsPersonalResolver() (bool, error) { - return _PersonalResolver.Contract.IsPersonalResolver(&_PersonalResolver.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() constant returns(address) -func (_PersonalResolver *PersonalResolverCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var ( - ret0 = new(common.Address) - ) - out := ret0 - err := _PersonalResolver.contract.Call(opts, out, "owner") - return *ret0, err -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() constant returns(address) -func (_PersonalResolver *PersonalResolverSession) Owner() (common.Address, error) { - return _PersonalResolver.Contract.Owner(&_PersonalResolver.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() constant returns(address) -func (_PersonalResolver *PersonalResolverCallerSession) Owner() (common.Address, error) { - return _PersonalResolver.Contract.Owner(&_PersonalResolver.CallOpts) -} - -// Resolve is a free data retrieval call binding the contract method 0xa16fdafa. -// -// Solidity: function resolve(nodeId bytes12, qtype bytes32, index uint16) constant returns(rcode uint16, rtype bytes16, ttl uint32, len uint16, data bytes32) -func (_PersonalResolver *PersonalResolverCaller) Resolve(opts *bind.CallOpts, nodeId [12]byte, qtype [32]byte, index uint16) (struct { - Rcode uint16 - Rtype [16]byte - Ttl uint32 - Len uint16 - Data [32]byte -}, error) { - ret := new(struct { - Rcode uint16 - Rtype [16]byte - Ttl uint32 - Len uint16 - Data [32]byte - }) - out := ret - err := _PersonalResolver.contract.Call(opts, out, "resolve", nodeId, qtype, index) - return *ret, err -} - -// Resolve is a free data retrieval call binding the contract method 0xa16fdafa. -// -// Solidity: function resolve(nodeId bytes12, qtype bytes32, index uint16) constant returns(rcode uint16, rtype bytes16, ttl uint32, len uint16, data bytes32) -func (_PersonalResolver *PersonalResolverSession) Resolve(nodeId [12]byte, qtype [32]byte, index uint16) (struct { - Rcode uint16 - Rtype [16]byte - Ttl uint32 - Len uint16 - Data [32]byte -}, error) { - return _PersonalResolver.Contract.Resolve(&_PersonalResolver.CallOpts, nodeId, qtype, index) -} - -// Resolve is a free data retrieval call binding the contract method 0xa16fdafa. -// -// Solidity: function resolve(nodeId bytes12, qtype bytes32, index uint16) constant returns(rcode uint16, rtype bytes16, ttl uint32, len uint16, data bytes32) -func (_PersonalResolver *PersonalResolverCallerSession) Resolve(nodeId [12]byte, qtype [32]byte, index uint16) (struct { - Rcode uint16 - Rtype [16]byte - Ttl uint32 - Len uint16 - Data [32]byte -}, error) { - return _PersonalResolver.Contract.Resolve(&_PersonalResolver.CallOpts, nodeId, qtype, index) -} - -// DeletePrivateRR is a paid mutator transaction binding the contract method 0x1b370194. -// -// Solidity: function deletePrivateRR(rootNodeId bytes12, name bytes32[]) returns() -func (_PersonalResolver *PersonalResolverTransactor) DeletePrivateRR(opts *bind.TransactOpts, rootNodeId [12]byte, name [][32]byte) (*types.Transaction, error) { - return _PersonalResolver.contract.Transact(opts, "deletePrivateRR", rootNodeId, name) -} - -// DeletePrivateRR is a paid mutator transaction binding the contract method 0x1b370194. -// -// Solidity: function deletePrivateRR(rootNodeId bytes12, name bytes32[]) returns() -func (_PersonalResolver *PersonalResolverSession) DeletePrivateRR(rootNodeId [12]byte, name [][32]byte) (*types.Transaction, error) { - return _PersonalResolver.Contract.DeletePrivateRR(&_PersonalResolver.TransactOpts, rootNodeId, name) -} - -// DeletePrivateRR is a paid mutator transaction binding the contract method 0x1b370194. -// -// Solidity: function deletePrivateRR(rootNodeId bytes12, name bytes32[]) returns() -func (_PersonalResolver *PersonalResolverTransactorSession) DeletePrivateRR(rootNodeId [12]byte, name [][32]byte) (*types.Transaction, error) { - return _PersonalResolver.Contract.DeletePrivateRR(&_PersonalResolver.TransactOpts, rootNodeId, name) -} - -// DeleteRR is a paid mutator transaction binding the contract method 0xbc06183d. -// -// Solidity: function deleteRR(rootNodeId bytes12, name string) returns() -func (_PersonalResolver *PersonalResolverTransactor) DeleteRR(opts *bind.TransactOpts, rootNodeId [12]byte, name string) (*types.Transaction, error) { - return _PersonalResolver.contract.Transact(opts, "deleteRR", rootNodeId, name) -} - -// DeleteRR is a paid mutator transaction binding the contract method 0xbc06183d. -// -// Solidity: function deleteRR(rootNodeId bytes12, name string) returns() -func (_PersonalResolver *PersonalResolverSession) DeleteRR(rootNodeId [12]byte, name string) (*types.Transaction, error) { - return _PersonalResolver.Contract.DeleteRR(&_PersonalResolver.TransactOpts, rootNodeId, name) -} - -// DeleteRR is a paid mutator transaction binding the contract method 0xbc06183d. -// -// Solidity: function deleteRR(rootNodeId bytes12, name string) returns() -func (_PersonalResolver *PersonalResolverTransactorSession) DeleteRR(rootNodeId [12]byte, name string) (*types.Transaction, error) { - return _PersonalResolver.Contract.DeleteRR(&_PersonalResolver.TransactOpts, rootNodeId, name) -} - -// SetOwner is a paid mutator transaction binding the contract method 0x13af4035. -// -// Solidity: function setOwner(newOwner address) returns() -func (_PersonalResolver *PersonalResolverTransactor) SetOwner(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { - return _PersonalResolver.contract.Transact(opts, "setOwner", newOwner) -} - -// SetOwner is a paid mutator transaction binding the contract method 0x13af4035. -// -// Solidity: function setOwner(newOwner address) returns() -func (_PersonalResolver *PersonalResolverSession) SetOwner(newOwner common.Address) (*types.Transaction, error) { - return _PersonalResolver.Contract.SetOwner(&_PersonalResolver.TransactOpts, newOwner) -} - -// SetOwner is a paid mutator transaction binding the contract method 0x13af4035. -// -// Solidity: function setOwner(newOwner address) returns() -func (_PersonalResolver *PersonalResolverTransactorSession) SetOwner(newOwner common.Address) (*types.Transaction, error) { - return _PersonalResolver.Contract.SetOwner(&_PersonalResolver.TransactOpts, newOwner) -} - -// SetPrivateRR is a paid mutator transaction binding the contract method 0x91c8e7b9. -// -// Solidity: function setPrivateRR(rootNodeId bytes12, name bytes32[], rtype bytes16, ttl uint32, len uint16, data bytes32) returns() -func (_PersonalResolver *PersonalResolverTransactor) SetPrivateRR(opts *bind.TransactOpts, rootNodeId [12]byte, name [][32]byte, rtype [16]byte, ttl uint32, len uint16, data [32]byte) (*types.Transaction, error) { - return _PersonalResolver.contract.Transact(opts, "setPrivateRR", rootNodeId, name, rtype, ttl, len, data) -} - -// SetPrivateRR is a paid mutator transaction binding the contract method 0x91c8e7b9. -// -// Solidity: function setPrivateRR(rootNodeId bytes12, name bytes32[], rtype bytes16, ttl uint32, len uint16, data bytes32) returns() -func (_PersonalResolver *PersonalResolverSession) SetPrivateRR(rootNodeId [12]byte, name [][32]byte, rtype [16]byte, ttl uint32, len uint16, data [32]byte) (*types.Transaction, error) { - return _PersonalResolver.Contract.SetPrivateRR(&_PersonalResolver.TransactOpts, rootNodeId, name, rtype, ttl, len, data) -} - -// SetPrivateRR is a paid mutator transaction binding the contract method 0x91c8e7b9. -// -// Solidity: function setPrivateRR(rootNodeId bytes12, name bytes32[], rtype bytes16, ttl uint32, len uint16, data bytes32) returns() -func (_PersonalResolver *PersonalResolverTransactorSession) SetPrivateRR(rootNodeId [12]byte, name [][32]byte, rtype [16]byte, ttl uint32, len uint16, data [32]byte) (*types.Transaction, error) { - return _PersonalResolver.Contract.SetPrivateRR(&_PersonalResolver.TransactOpts, rootNodeId, name, rtype, ttl, len, data) -} - -// SetRR is a paid mutator transaction binding the contract method 0x8bba944d. -// -// Solidity: function setRR(rootNodeId bytes12, name string, rtype bytes16, ttl uint32, len uint16, data bytes32) returns() -func (_PersonalResolver *PersonalResolverTransactor) SetRR(opts *bind.TransactOpts, rootNodeId [12]byte, name string, rtype [16]byte, ttl uint32, len uint16, data [32]byte) (*types.Transaction, error) { - return _PersonalResolver.contract.Transact(opts, "setRR", rootNodeId, name, rtype, ttl, len, data) -} - -// SetRR is a paid mutator transaction binding the contract method 0x8bba944d. -// -// Solidity: function setRR(rootNodeId bytes12, name string, rtype bytes16, ttl uint32, len uint16, data bytes32) returns() -func (_PersonalResolver *PersonalResolverSession) SetRR(rootNodeId [12]byte, name string, rtype [16]byte, ttl uint32, len uint16, data [32]byte) (*types.Transaction, error) { - return _PersonalResolver.Contract.SetRR(&_PersonalResolver.TransactOpts, rootNodeId, name, rtype, ttl, len, data) -} - -// SetRR is a paid mutator transaction binding the contract method 0x8bba944d. -// -// Solidity: function setRR(rootNodeId bytes12, name string, rtype bytes16, ttl uint32, len uint16, data bytes32) returns() -func (_PersonalResolver *PersonalResolverTransactorSession) SetRR(rootNodeId [12]byte, name string, rtype [16]byte, ttl uint32, len uint16, data [32]byte) (*types.Transaction, error) { - return _PersonalResolver.Contract.SetRR(&_PersonalResolver.TransactOpts, rootNodeId, name, rtype, ttl, len, data) -} diff --git a/swarm/services/ens/contract/ens.go b/swarm/services/ens/contract/ens.go index b647fa7f56..34c156e3f4 100644 --- a/swarm/services/ens/contract/ens.go +++ b/swarm/services/ens/contract/ens.go @@ -12,8 +12,676 @@ import ( "github.com/ethereum/go-ethereum/core/types" ) +// 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":"resolver","type":"address"}],"name":"setResolver","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"label","type":"bytes32"},{"name":"owner","type":"address"}],"name":"setOwner","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"}]` + +// ENSBin is the compiled bytecode used for deploying new contracts. +const ENSBin = `0x606060405260405160208061030e83395060806040525160008080526020527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb58054600160a060020a03191682179055506102b08061005e6000396000f3606060405260e060020a60003504630178b8bf811461004757806302571be31461006e5780631896f70a14610091578063569cd595146100c55780635b0fc9c3146100fc575b005b610130600435600081815260208190526040902060010154600160a060020a03165b919050565b610130600435600081815260208190526040902054600160a060020a0316610069565b6100456004356024356000828152602081905260409020548290600160a060020a0390811633919091161461014357610002565b6100456004356024356044356000838152602081905260408120548490600160a060020a039081163391909116146101b757610002565b6100456004356024356000828152602081905260409020548290600160a060020a0390811633919091161461023c57610002565b600160a060020a03166060908152602090f35b600160a060020a038216606090815281907f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a090602090a2816000600050600085815260200190815260200160002060005060010160006101000a815481600160a060020a0302191690830217905550505050565b6060818152608085905260408120600160a060020a03851682529250849082907fce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e8290602090a3826000600050600084815260200190815260200160002060005060000160006101000a815481600160a060020a03021916908302179055505050505050565b600160a060020a038216606090815281907fd4735d920b0f87494915f556dd9b54c8f309026070caea5c737245152564d26690602090a2816000600050600085815260200190815260200160002060005060000160006101000a815481600160a060020a030219169083021790555050505056` + +// 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) { + parsed, err := abi.JSON(strings.NewReader(ENSABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(ENSBin), backend, owner) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &ENS{ENSCaller: ENSCaller{contract: contract}, ENSTransactor: ENSTransactor{contract: contract}}, nil +} + +// ENS is an auto generated Go binding around an Ethereum contract. +type ENS struct { + ENSCaller // Read-only binding to the contract + ENSTransactor // Write-only binding to the contract +} + +// ENSCaller is an auto generated read-only Go binding around an Ethereum contract. +type ENSCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ENSTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ENSTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ENSSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ENSSession struct { + Contract *ENS // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ENSCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ENSCallerSession struct { + Contract *ENSCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ENSTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ENSTransactorSession struct { + Contract *ENSTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ENSRaw is an auto generated low-level Go binding around an Ethereum contract. +type ENSRaw struct { + Contract *ENS // Generic contract binding to access the raw methods on +} + +// ENSCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ENSCallerRaw struct { + Contract *ENSCaller // Generic read-only contract binding to access the raw methods on +} + +// ENSTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ENSTransactorRaw struct { + Contract *ENSTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewENS creates a new instance of ENS, bound to a specific deployed contract. +func NewENS(address common.Address, backend bind.ContractBackend) (*ENS, error) { + contract, err := bindENS(address, backend.(bind.ContractCaller), backend.(bind.ContractTransactor)) + if err != nil { + return nil, err + } + return &ENS{ENSCaller: ENSCaller{contract: contract}, ENSTransactor: ENSTransactor{contract: contract}}, nil +} + +// 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) { + contract, err := bindENS(address, caller, nil) + if err != nil { + return nil, err + } + return &ENSCaller{contract: contract}, nil +} + +// 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) { + contract, err := bindENS(address, nil, transactor) + if err != nil { + return nil, err + } + return &ENSTransactor{contract: contract}, nil +} + +// bindENS binds a generic wrapper to an already deployed contract. +func bindENS(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(ENSABI)) + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, parsed, caller, transactor), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_ENS *ENSRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _ENS.Contract.ENSCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_ENS *ENSRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ENS.Contract.ENSTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ENS *ENSRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ENS.Contract.ENSTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_ENS *ENSCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _ENS.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_ENS *ENSTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ENS.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ENS *ENSTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ENS.Contract.contract.Transact(opts, method, params...) +} + +// Owner is a free data retrieval call binding the contract method 0x02571be3. +// +// Solidity: function owner(node bytes32) constant returns(address) +func (_ENS *ENSCaller) Owner(opts *bind.CallOpts, node [32]byte) (common.Address, error) { + var ( + ret0 = new(common.Address) + ) + out := ret0 + err := _ENS.contract.Call(opts, out, "owner", node) + return *ret0, err +} + +// Owner is a free data retrieval call binding the contract method 0x02571be3. +// +// Solidity: function owner(node bytes32) constant returns(address) +func (_ENS *ENSSession) Owner(node [32]byte) (common.Address, error) { + return _ENS.Contract.Owner(&_ENS.CallOpts, node) +} + +// Owner is a free data retrieval call binding the contract method 0x02571be3. +// +// Solidity: function owner(node bytes32) constant returns(address) +func (_ENS *ENSCallerSession) Owner(node [32]byte) (common.Address, error) { + return _ENS.Contract.Owner(&_ENS.CallOpts, node) +} + +// Resolver is a free data retrieval call binding the contract method 0x0178b8bf. +// +// Solidity: function resolver(node bytes32) constant returns(address) +func (_ENS *ENSCaller) Resolver(opts *bind.CallOpts, node [32]byte) (common.Address, error) { + var ( + ret0 = new(common.Address) + ) + out := ret0 + err := _ENS.contract.Call(opts, out, "resolver", node) + return *ret0, err +} + +// Resolver is a free data retrieval call binding the contract method 0x0178b8bf. +// +// Solidity: function resolver(node bytes32) constant returns(address) +func (_ENS *ENSSession) Resolver(node [32]byte) (common.Address, error) { + return _ENS.Contract.Resolver(&_ENS.CallOpts, node) +} + +// Resolver is a free data retrieval call binding the contract method 0x0178b8bf. +// +// Solidity: function resolver(node bytes32) constant returns(address) +func (_ENS *ENSCallerSession) Resolver(node [32]byte) (common.Address, error) { + return _ENS.Contract.Resolver(&_ENS.CallOpts, node) +} + +// SetOwner is a paid mutator transaction binding the contract method 0x5b0fc9c3. +// +// Solidity: function setOwner(node bytes32, owner address) returns() +func (_ENS *ENSTransactor) SetOwner(opts *bind.TransactOpts, node [32]byte, owner common.Address) (*types.Transaction, error) { + return _ENS.contract.Transact(opts, "setOwner", node, owner) +} + +// SetOwner is a paid mutator transaction binding the contract method 0x5b0fc9c3. +// +// Solidity: function setOwner(node bytes32, owner address) returns() +func (_ENS *ENSSession) SetOwner(node [32]byte, owner common.Address) (*types.Transaction, error) { + return _ENS.Contract.SetOwner(&_ENS.TransactOpts, node, owner) +} + +// SetOwner is a paid mutator transaction binding the contract method 0x5b0fc9c3. +// +// Solidity: function setOwner(node bytes32, owner address) returns() +func (_ENS *ENSTransactorSession) SetOwner(node [32]byte, owner common.Address) (*types.Transaction, error) { + return _ENS.Contract.SetOwner(&_ENS.TransactOpts, node, owner) +} + +// SetResolver is a paid mutator transaction binding the contract method 0x1896f70a. +// +// Solidity: function setResolver(node bytes32, resolver address) returns() +func (_ENS *ENSTransactor) SetResolver(opts *bind.TransactOpts, node [32]byte, resolver common.Address) (*types.Transaction, error) { + return _ENS.contract.Transact(opts, "setResolver", node, resolver) +} + +// SetResolver is a paid mutator transaction binding the contract method 0x1896f70a. +// +// Solidity: function setResolver(node bytes32, resolver address) returns() +func (_ENS *ENSSession) SetResolver(node [32]byte, resolver common.Address) (*types.Transaction, error) { + return _ENS.Contract.SetResolver(&_ENS.TransactOpts, node, resolver) +} + +// SetResolver is a paid mutator transaction binding the contract method 0x1896f70a. +// +// Solidity: function setResolver(node bytes32, resolver address) returns() +func (_ENS *ENSTransactorSession) SetResolver(node [32]byte, resolver common.Address) (*types.Transaction, error) { + return _ENS.Contract.SetResolver(&_ENS.TransactOpts, node, resolver) +} + +// 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"}]` + +// FIFSRegistrarBin is the compiled bytecode used for deploying new contracts. +const FIFSRegistrarBin = `0x60606040818152806105d1833960a090525160805160008054600160a060020a031916831790558160a0610323806100878339018082600160a060020a03168152602001915050604051809103906000f0600160006101000a815481600160a060020a0302191690830217905550806002600050819055505050610227806103aa6000396000f3606060405260405160208061032383395060806040525160008054600160a060020a03191682179055506102ec806100376000396000f36060604052361561004b5760e060020a60003504632dff694181146100535780633b3b57de1461007557806341b9dc2b146100a0578063c3d014d614610137578063d5fa2b00146101a3575b61020f610002565b6102116004356000818152600260205260408120549081141561022e57610002565b61021b600435600081815260016020526040812054600160a060020a03169081141561022e57610002565b6102116004356024356000817f61646472000000000000000000000000000000000000000000000000000000001480156100ef575082815260016020526040812054600160a060020a03168114155b806101305750817f636f6e74656e74000000000000000000000000000000000000000000000000001480156101305750828152600260205260408120548114155b9392505050565b61020f6004356024356000805460e060020a6302571be302606090815260648590528492600160a060020a033381169316916302571be3916084916020916024908290876161da5a03f11561000257505060405151600160a060020a0316909114905061023357610002565b61020f6004356024356000805460e060020a6302571be302606090815260648590528492600160a060020a033381169316916302571be3916084916020916024908290876161da5a03f11561000257505060405151600160a060020a0316909114905061027e57610002565b005b6060908152602090f35b600160a060020a03166060908152602090f35b919050565b6040805160008381526002602090815290839020859055848252915183927f0424b6fe0d9c3bdbece0e7879dc241bb0c22e900be8b6c168b4ee08bd9bf83bc928290030190a2505050565b6040805160008381526001602090815290839020805473ffffffffffffffffffffffffffffffffffffffff191686179055600160a060020a0385168252915183927f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd2928290030190a250505056606060405260e060020a6000350463d22057a9811461001b575b005b6100196004356024356002546060908152608083905260408120600080547f02571be3000000000000000000000000000000000000000000000000000000008452606483905291929091600160a060020a0316906302571be39060849060209060248187876161da5a03f1156100025750506040515191600160a060020a03831614801591506100bd575033600160a060020a031681600160a060020a031614155b156100c757610002565b60408051600080546002547f569cd59500000000000000000000000000000000000000000000000000000000845260048401526024830188905230600160a060020a039081166044850152935193169263569cd595926064818101939291829003018183876161da5a03f11561000257505050600060009054906101000a9004600160a060020a0316600160a060020a0316631896f70a83600160009054906101000a9004600160a060020a03166040518360e060020a0281526004018083815260200182600160a060020a03168152602001925050506000604051808303816000876161da5a03f11561000257505050600060009054906101000a9004600160a060020a0316600160a060020a0316635b0fc9c383856040518360e060020a0281526004018083815260200182600160a060020a03168152602001925050506000604051808303816000876161da5a03f115610002575050505050505056` + +// 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) { + parsed, err := abi.JSON(strings.NewReader(FIFSRegistrarABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(FIFSRegistrarBin), backend, ensAddr, node) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &FIFSRegistrar{FIFSRegistrarCaller: FIFSRegistrarCaller{contract: contract}, FIFSRegistrarTransactor: FIFSRegistrarTransactor{contract: contract}}, nil +} + +// FIFSRegistrar is an auto generated Go binding around an Ethereum contract. +type FIFSRegistrar struct { + FIFSRegistrarCaller // Read-only binding to the contract + FIFSRegistrarTransactor // Write-only binding to the contract +} + +// FIFSRegistrarCaller is an auto generated read-only Go binding around an Ethereum contract. +type FIFSRegistrarCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// FIFSRegistrarTransactor is an auto generated write-only Go binding around an Ethereum contract. +type FIFSRegistrarTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// FIFSRegistrarSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type FIFSRegistrarSession struct { + Contract *FIFSRegistrar // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// FIFSRegistrarCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type FIFSRegistrarCallerSession struct { + Contract *FIFSRegistrarCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// FIFSRegistrarTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type FIFSRegistrarTransactorSession struct { + Contract *FIFSRegistrarTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// FIFSRegistrarRaw is an auto generated low-level Go binding around an Ethereum contract. +type FIFSRegistrarRaw struct { + Contract *FIFSRegistrar // Generic contract binding to access the raw methods on +} + +// FIFSRegistrarCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type FIFSRegistrarCallerRaw struct { + Contract *FIFSRegistrarCaller // Generic read-only contract binding to access the raw methods on +} + +// FIFSRegistrarTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type FIFSRegistrarTransactorRaw struct { + Contract *FIFSRegistrarTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewFIFSRegistrar creates a new instance of FIFSRegistrar, bound to a specific deployed contract. +func NewFIFSRegistrar(address common.Address, backend bind.ContractBackend) (*FIFSRegistrar, error) { + contract, err := bindFIFSRegistrar(address, backend.(bind.ContractCaller), backend.(bind.ContractTransactor)) + if err != nil { + return nil, err + } + return &FIFSRegistrar{FIFSRegistrarCaller: FIFSRegistrarCaller{contract: contract}, FIFSRegistrarTransactor: FIFSRegistrarTransactor{contract: contract}}, nil +} + +// 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) { + contract, err := bindFIFSRegistrar(address, caller, nil) + if err != nil { + return nil, err + } + return &FIFSRegistrarCaller{contract: contract}, nil +} + +// 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) { + contract, err := bindFIFSRegistrar(address, nil, transactor) + if err != nil { + return nil, err + } + return &FIFSRegistrarTransactor{contract: contract}, nil +} + +// bindFIFSRegistrar binds a generic wrapper to an already deployed contract. +func bindFIFSRegistrar(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(FIFSRegistrarABI)) + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, parsed, caller, transactor), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_FIFSRegistrar *FIFSRegistrarRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _FIFSRegistrar.Contract.FIFSRegistrarCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_FIFSRegistrar *FIFSRegistrarRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _FIFSRegistrar.Contract.FIFSRegistrarTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_FIFSRegistrar *FIFSRegistrarRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _FIFSRegistrar.Contract.FIFSRegistrarTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_FIFSRegistrar *FIFSRegistrarCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _FIFSRegistrar.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_FIFSRegistrar *FIFSRegistrarTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _FIFSRegistrar.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_FIFSRegistrar *FIFSRegistrarTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _FIFSRegistrar.Contract.contract.Transact(opts, method, params...) +} + +// Register is a paid mutator transaction binding the contract method 0xd22057a9. +// +// Solidity: function register(subnode bytes32, owner address) returns() +func (_FIFSRegistrar *FIFSRegistrarTransactor) Register(opts *bind.TransactOpts, subnode [32]byte, owner common.Address) (*types.Transaction, error) { + return _FIFSRegistrar.contract.Transact(opts, "register", subnode, owner) +} + +// Register is a paid mutator transaction binding the contract method 0xd22057a9. +// +// Solidity: function register(subnode bytes32, owner address) returns() +func (_FIFSRegistrar *FIFSRegistrarSession) Register(subnode [32]byte, owner common.Address) (*types.Transaction, error) { + return _FIFSRegistrar.Contract.Register(&_FIFSRegistrar.TransactOpts, subnode, owner) +} + +// Register is a paid mutator transaction binding the contract method 0xd22057a9. +// +// Solidity: function register(subnode bytes32, owner address) returns() +func (_FIFSRegistrar *FIFSRegistrarTransactorSession) Register(subnode [32]byte, owner common.Address) (*types.Transaction, error) { + return _FIFSRegistrar.Contract.Register(&_FIFSRegistrar.TransactOpts, subnode, owner) +} + +// 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"}]` + +// PublicResolverBin is the compiled bytecode used for deploying new contracts. +const PublicResolverBin = `0x606060405260405160208061032383395060806040525160008054600160a060020a03191682179055506102ec806100376000396000f36060604052361561004b5760e060020a60003504632dff694181146100535780633b3b57de1461007557806341b9dc2b146100a0578063c3d014d614610137578063d5fa2b00146101a3575b61020f610002565b6102116004356000818152600260205260408120549081141561022e57610002565b61021b600435600081815260016020526040812054600160a060020a03169081141561022e57610002565b6102116004356024356000817f61646472000000000000000000000000000000000000000000000000000000001480156100ef575082815260016020526040812054600160a060020a03168114155b806101305750817f636f6e74656e74000000000000000000000000000000000000000000000000001480156101305750828152600260205260408120548114155b9392505050565b61020f6004356024356000805460e060020a6302571be302606090815260648590528492600160a060020a033381169316916302571be3916084916020916024908290876161da5a03f11561000257505060405151600160a060020a0316909114905061023357610002565b61020f6004356024356000805460e060020a6302571be302606090815260648590528492600160a060020a033381169316916302571be3916084916020916024908290876161da5a03f11561000257505060405151600160a060020a0316909114905061027e57610002565b005b6060908152602090f35b600160a060020a03166060908152602090f35b919050565b6040805160008381526002602090815290839020859055848252915183927f0424b6fe0d9c3bdbece0e7879dc241bb0c22e900be8b6c168b4ee08bd9bf83bc928290030190a2505050565b6040805160008381526001602090815290839020805473ffffffffffffffffffffffffffffffffffffffff191686179055600160a060020a0385168252915183927f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd2928290030190a250505056` + +// 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) { + parsed, err := abi.JSON(strings.NewReader(PublicResolverABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(PublicResolverBin), backend, ensAddr) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &PublicResolver{PublicResolverCaller: PublicResolverCaller{contract: contract}, PublicResolverTransactor: PublicResolverTransactor{contract: contract}}, nil +} + +// PublicResolver is an auto generated Go binding around an Ethereum contract. +type PublicResolver struct { + PublicResolverCaller // Read-only binding to the contract + PublicResolverTransactor // Write-only binding to the contract +} + +// PublicResolverCaller is an auto generated read-only Go binding around an Ethereum contract. +type PublicResolverCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// PublicResolverTransactor is an auto generated write-only Go binding around an Ethereum contract. +type PublicResolverTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// PublicResolverSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type PublicResolverSession struct { + Contract *PublicResolver // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// PublicResolverCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type PublicResolverCallerSession struct { + Contract *PublicResolverCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// PublicResolverTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type PublicResolverTransactorSession struct { + Contract *PublicResolverTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// PublicResolverRaw is an auto generated low-level Go binding around an Ethereum contract. +type PublicResolverRaw struct { + Contract *PublicResolver // Generic contract binding to access the raw methods on +} + +// PublicResolverCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type PublicResolverCallerRaw struct { + Contract *PublicResolverCaller // Generic read-only contract binding to access the raw methods on +} + +// PublicResolverTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type PublicResolverTransactorRaw struct { + Contract *PublicResolverTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewPublicResolver creates a new instance of PublicResolver, bound to a specific deployed contract. +func NewPublicResolver(address common.Address, backend bind.ContractBackend) (*PublicResolver, error) { + contract, err := bindPublicResolver(address, backend.(bind.ContractCaller), backend.(bind.ContractTransactor)) + if err != nil { + return nil, err + } + return &PublicResolver{PublicResolverCaller: PublicResolverCaller{contract: contract}, PublicResolverTransactor: PublicResolverTransactor{contract: contract}}, nil +} + +// 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) { + contract, err := bindPublicResolver(address, caller, nil) + if err != nil { + return nil, err + } + return &PublicResolverCaller{contract: contract}, nil +} + +// 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) { + contract, err := bindPublicResolver(address, nil, transactor) + if err != nil { + return nil, err + } + return &PublicResolverTransactor{contract: contract}, nil +} + +// bindPublicResolver binds a generic wrapper to an already deployed contract. +func bindPublicResolver(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(PublicResolverABI)) + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, parsed, caller, transactor), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_PublicResolver *PublicResolverRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _PublicResolver.Contract.PublicResolverCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_PublicResolver *PublicResolverRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _PublicResolver.Contract.PublicResolverTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_PublicResolver *PublicResolverRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _PublicResolver.Contract.PublicResolverTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_PublicResolver *PublicResolverCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _PublicResolver.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_PublicResolver *PublicResolverTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _PublicResolver.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_PublicResolver *PublicResolverTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _PublicResolver.Contract.contract.Transact(opts, method, params...) +} + +// Addr is a free data retrieval call binding the contract method 0x3b3b57de. +// +// Solidity: function addr(node bytes32) constant returns(ret address) +func (_PublicResolver *PublicResolverCaller) Addr(opts *bind.CallOpts, node [32]byte) (common.Address, error) { + var ( + ret0 = new(common.Address) + ) + out := ret0 + err := _PublicResolver.contract.Call(opts, out, "addr", node) + return *ret0, err +} + +// Addr is a free data retrieval call binding the contract method 0x3b3b57de. +// +// Solidity: function addr(node bytes32) constant returns(ret address) +func (_PublicResolver *PublicResolverSession) Addr(node [32]byte) (common.Address, error) { + return _PublicResolver.Contract.Addr(&_PublicResolver.CallOpts, node) +} + +// Addr is a free data retrieval call binding the contract method 0x3b3b57de. +// +// Solidity: function addr(node bytes32) constant returns(ret address) +func (_PublicResolver *PublicResolverCallerSession) Addr(node [32]byte) (common.Address, error) { + return _PublicResolver.Contract.Addr(&_PublicResolver.CallOpts, node) +} + +// Content is a free data retrieval call binding the contract method 0x2dff6941. +// +// Solidity: function content(node bytes32) constant returns(ret bytes32) +func (_PublicResolver *PublicResolverCaller) Content(opts *bind.CallOpts, node [32]byte) ([32]byte, error) { + var ( + ret0 = new([32]byte) + ) + out := ret0 + err := _PublicResolver.contract.Call(opts, out, "content", node) + return *ret0, err +} + +// Content is a free data retrieval call binding the contract method 0x2dff6941. +// +// Solidity: function content(node bytes32) constant returns(ret bytes32) +func (_PublicResolver *PublicResolverSession) Content(node [32]byte) ([32]byte, error) { + return _PublicResolver.Contract.Content(&_PublicResolver.CallOpts, node) +} + +// Content is a free data retrieval call binding the contract method 0x2dff6941. +// +// Solidity: function content(node bytes32) constant returns(ret bytes32) +func (_PublicResolver *PublicResolverCallerSession) Content(node [32]byte) ([32]byte, error) { + return _PublicResolver.Contract.Content(&_PublicResolver.CallOpts, node) +} + +// Has is a paid mutator transaction binding the contract method 0x41b9dc2b. +// +// Solidity: function has(node bytes32, kind bytes32) returns(bool) +func (_PublicResolver *PublicResolverTransactor) Has(opts *bind.TransactOpts, node [32]byte, kind [32]byte) (*types.Transaction, error) { + return _PublicResolver.contract.Transact(opts, "has", node, kind) +} + +// Has is a paid mutator transaction binding the contract method 0x41b9dc2b. +// +// Solidity: function has(node bytes32, kind bytes32) returns(bool) +func (_PublicResolver *PublicResolverSession) Has(node [32]byte, kind [32]byte) (*types.Transaction, error) { + return _PublicResolver.Contract.Has(&_PublicResolver.TransactOpts, node, kind) +} + +// Has is a paid mutator transaction binding the contract method 0x41b9dc2b. +// +// Solidity: function has(node bytes32, kind bytes32) returns(bool) +func (_PublicResolver *PublicResolverTransactorSession) Has(node [32]byte, kind [32]byte) (*types.Transaction, error) { + return _PublicResolver.Contract.Has(&_PublicResolver.TransactOpts, node, kind) +} + +// SetAddr is a paid mutator transaction binding the contract method 0xd5fa2b00. +// +// Solidity: function setAddr(node bytes32, addr address) returns() +func (_PublicResolver *PublicResolverTransactor) SetAddr(opts *bind.TransactOpts, node [32]byte, addr common.Address) (*types.Transaction, error) { + return _PublicResolver.contract.Transact(opts, "setAddr", node, addr) +} + +// SetAddr is a paid mutator transaction binding the contract method 0xd5fa2b00. +// +// Solidity: function setAddr(node bytes32, addr address) returns() +func (_PublicResolver *PublicResolverSession) SetAddr(node [32]byte, addr common.Address) (*types.Transaction, error) { + return _PublicResolver.Contract.SetAddr(&_PublicResolver.TransactOpts, node, addr) +} + +// SetAddr is a paid mutator transaction binding the contract method 0xd5fa2b00. +// +// Solidity: function setAddr(node bytes32, addr address) returns() +func (_PublicResolver *PublicResolverTransactorSession) SetAddr(node [32]byte, addr common.Address) (*types.Transaction, error) { + return _PublicResolver.Contract.SetAddr(&_PublicResolver.TransactOpts, node, addr) +} + +// SetContent is a paid mutator transaction binding the contract method 0xc3d014d6. +// +// Solidity: function setContent(node bytes32, hash bytes32) returns() +func (_PublicResolver *PublicResolverTransactor) SetContent(opts *bind.TransactOpts, node [32]byte, hash [32]byte) (*types.Transaction, error) { + return _PublicResolver.contract.Transact(opts, "setContent", node, hash) +} + +// SetContent is a paid mutator transaction binding the contract method 0xc3d014d6. +// +// Solidity: function setContent(node bytes32, hash bytes32) returns() +func (_PublicResolver *PublicResolverSession) SetContent(node [32]byte, hash [32]byte) (*types.Transaction, error) { + return _PublicResolver.Contract.SetContent(&_PublicResolver.TransactOpts, node, hash) +} + +// SetContent is a paid mutator transaction binding the contract method 0xc3d014d6. +// +// Solidity: function setContent(node bytes32, hash bytes32) returns() +func (_PublicResolver *PublicResolverTransactorSession) SetContent(node [32]byte, hash [32]byte) (*types.Transaction, error) { + return _PublicResolver.Contract.SetContent(&_PublicResolver.TransactOpts, node, hash) +} + // ResolverABI is the input ABI used to generate the binding from. -const ResolverABI = `[{"constant":false,"inputs":[{"name":"rootNodeId","type":"bytes12"},{"name":"name","type":"bytes32[]"}],"name":"deletePrivateRR","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"isPersonalResolver","outputs":[{"name":"","type":"bool"}],"type":"function"},{"constant":false,"inputs":[{"name":"label","type":"bytes32"},{"name":"newOwner","type":"address"}],"name":"setOwner","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"id","type":"bytes32"}],"name":"getExtended","outputs":[{"name":"data","type":"bytes"}],"type":"function"},{"constant":false,"inputs":[{"name":"rootNodeId","type":"bytes12"},{"name":"name","type":"string"},{"name":"rtype","type":"bytes16"},{"name":"ttl","type":"uint32"},{"name":"len","type":"uint16"},{"name":"data","type":"bytes32"}],"name":"setRR","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"rootNodeId","type":"bytes12"},{"name":"name","type":"bytes32[]"},{"name":"rtype","type":"bytes16"},{"name":"ttl","type":"uint32"},{"name":"len","type":"uint16"},{"name":"data","type":"bytes32"}],"name":"setPrivateRR","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"nodeId","type":"bytes12"},{"name":"qtype","type":"bytes32"},{"name":"index","type":"uint16"}],"name":"resolve","outputs":[{"name":"rcode","type":"uint16"},{"name":"rtype","type":"bytes16"},{"name":"ttl","type":"uint32"},{"name":"len","type":"uint16"},{"name":"data","type":"bytes32"}],"type":"function"},{"constant":false,"inputs":[{"name":"label","type":"bytes32"},{"name":"resolver","type":"address"},{"name":"nodeId","type":"bytes12"}],"name":"register","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"label","type":"bytes32"},{"name":"resolver","type":"address"},{"name":"nodeId","type":"bytes12"}],"name":"setResolver","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"rootNodeId","type":"bytes12"},{"name":"name","type":"string"}],"name":"deleteRR","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"label","type":"bytes32"}],"name":"getOwner","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":true,"inputs":[{"name":"nodeId","type":"bytes12"},{"name":"label","type":"bytes32"}],"name":"findResolver","outputs":[{"name":"rcode","type":"uint16"},{"name":"ttl","type":"uint32"},{"name":"rnode","type":"bytes12"},{"name":"raddress","type":"address"}],"type":"function"}]` +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"}]` // ResolverBin is the compiled bytecode used for deploying new contracts. const ResolverBin = `0x` @@ -158,319 +826,75 @@ func (_Resolver *ResolverTransactorRaw) Transact(opts *bind.TransactOpts, method return _Resolver.Contract.contract.Transact(opts, method, params...) } -// FindResolver is a free data retrieval call binding the contract method 0xedc0277c. +// Addr is a free data retrieval call binding the contract method 0x3b3b57de. // -// Solidity: function findResolver(nodeId bytes12, label bytes32) constant returns(rcode uint16, ttl uint32, rnode bytes12, raddress address) -func (_Resolver *ResolverCaller) FindResolver(opts *bind.CallOpts, nodeId [12]byte, label [32]byte) (struct { - Rcode uint16 - Ttl uint32 - Rnode [12]byte - Raddress common.Address -}, error) { - ret := new(struct { - Rcode uint16 - Ttl uint32 - Rnode [12]byte - Raddress common.Address - }) - out := ret - err := _Resolver.contract.Call(opts, out, "findResolver", nodeId, label) - return *ret, err -} - -// FindResolver is a free data retrieval call binding the contract method 0xedc0277c. -// -// Solidity: function findResolver(nodeId bytes12, label bytes32) constant returns(rcode uint16, ttl uint32, rnode bytes12, raddress address) -func (_Resolver *ResolverSession) FindResolver(nodeId [12]byte, label [32]byte) (struct { - Rcode uint16 - Ttl uint32 - Rnode [12]byte - Raddress common.Address -}, error) { - return _Resolver.Contract.FindResolver(&_Resolver.CallOpts, nodeId, label) -} - -// FindResolver is a free data retrieval call binding the contract method 0xedc0277c. -// -// Solidity: function findResolver(nodeId bytes12, label bytes32) constant returns(rcode uint16, ttl uint32, rnode bytes12, raddress address) -func (_Resolver *ResolverCallerSession) FindResolver(nodeId [12]byte, label [32]byte) (struct { - Rcode uint16 - Ttl uint32 - Rnode [12]byte - Raddress common.Address -}, error) { - return _Resolver.Contract.FindResolver(&_Resolver.CallOpts, nodeId, label) -} - -// GetExtended is a free data retrieval call binding the contract method 0x8021061c. -// -// Solidity: function getExtended(id bytes32) constant returns(data bytes) -func (_Resolver *ResolverCaller) GetExtended(opts *bind.CallOpts, id [32]byte) ([]byte, error) { - var ( - ret0 = new([]byte) - ) - out := ret0 - err := _Resolver.contract.Call(opts, out, "getExtended", id) - return *ret0, err -} - -// GetExtended is a free data retrieval call binding the contract method 0x8021061c. -// -// Solidity: function getExtended(id bytes32) constant returns(data bytes) -func (_Resolver *ResolverSession) GetExtended(id [32]byte) ([]byte, error) { - return _Resolver.Contract.GetExtended(&_Resolver.CallOpts, id) -} - -// GetExtended is a free data retrieval call binding the contract method 0x8021061c. -// -// Solidity: function getExtended(id bytes32) constant returns(data bytes) -func (_Resolver *ResolverCallerSession) GetExtended(id [32]byte) ([]byte, error) { - return _Resolver.Contract.GetExtended(&_Resolver.CallOpts, id) -} - -// GetOwner is a free data retrieval call binding the contract method 0xdeb931a2. -// -// Solidity: function getOwner(label bytes32) constant returns(address) -func (_Resolver *ResolverCaller) GetOwner(opts *bind.CallOpts, label [32]byte) (common.Address, error) { +// Solidity: function addr(node bytes32) constant returns(ret address) +func (_Resolver *ResolverCaller) Addr(opts *bind.CallOpts, node [32]byte) (common.Address, error) { var ( ret0 = new(common.Address) ) out := ret0 - err := _Resolver.contract.Call(opts, out, "getOwner", label) + err := _Resolver.contract.Call(opts, out, "addr", node) return *ret0, err } -// GetOwner is a free data retrieval call binding the contract method 0xdeb931a2. +// Addr is a free data retrieval call binding the contract method 0x3b3b57de. // -// Solidity: function getOwner(label bytes32) constant returns(address) -func (_Resolver *ResolverSession) GetOwner(label [32]byte) (common.Address, error) { - return _Resolver.Contract.GetOwner(&_Resolver.CallOpts, label) +// Solidity: function addr(node bytes32) constant returns(ret address) +func (_Resolver *ResolverSession) Addr(node [32]byte) (common.Address, error) { + return _Resolver.Contract.Addr(&_Resolver.CallOpts, node) } -// GetOwner is a free data retrieval call binding the contract method 0xdeb931a2. +// Addr is a free data retrieval call binding the contract method 0x3b3b57de. // -// Solidity: function getOwner(label bytes32) constant returns(address) -func (_Resolver *ResolverCallerSession) GetOwner(label [32]byte) (common.Address, error) { - return _Resolver.Contract.GetOwner(&_Resolver.CallOpts, label) +// Solidity: function addr(node bytes32) constant returns(ret address) +func (_Resolver *ResolverCallerSession) Addr(node [32]byte) (common.Address, error) { + return _Resolver.Contract.Addr(&_Resolver.CallOpts, node) } -// IsPersonalResolver is a free data retrieval call binding the contract method 0x3f5665e7. +// Content is a free data retrieval call binding the contract method 0x2dff6941. // -// Solidity: function isPersonalResolver() constant returns(bool) -func (_Resolver *ResolverCaller) IsPersonalResolver(opts *bind.CallOpts) (bool, error) { +// Solidity: function content(node bytes32) constant returns(ret bytes32) +func (_Resolver *ResolverCaller) Content(opts *bind.CallOpts, node [32]byte) ([32]byte, error) { var ( - ret0 = new(bool) + ret0 = new([32]byte) ) out := ret0 - err := _Resolver.contract.Call(opts, out, "isPersonalResolver") + err := _Resolver.contract.Call(opts, out, "content", node) return *ret0, err } -// IsPersonalResolver is a free data retrieval call binding the contract method 0x3f5665e7. +// Content is a free data retrieval call binding the contract method 0x2dff6941. // -// Solidity: function isPersonalResolver() constant returns(bool) -func (_Resolver *ResolverSession) IsPersonalResolver() (bool, error) { - return _Resolver.Contract.IsPersonalResolver(&_Resolver.CallOpts) +// Solidity: function content(node bytes32) constant returns(ret bytes32) +func (_Resolver *ResolverSession) Content(node [32]byte) ([32]byte, error) { + return _Resolver.Contract.Content(&_Resolver.CallOpts, node) } -// IsPersonalResolver is a free data retrieval call binding the contract method 0x3f5665e7. +// Content is a free data retrieval call binding the contract method 0x2dff6941. // -// Solidity: function isPersonalResolver() constant returns(bool) -func (_Resolver *ResolverCallerSession) IsPersonalResolver() (bool, error) { - return _Resolver.Contract.IsPersonalResolver(&_Resolver.CallOpts) +// Solidity: function content(node bytes32) constant returns(ret bytes32) +func (_Resolver *ResolverCallerSession) Content(node [32]byte) ([32]byte, error) { + return _Resolver.Contract.Content(&_Resolver.CallOpts, node) } -// Resolve is a free data retrieval call binding the contract method 0xa16fdafa. +// Has is a paid mutator transaction binding the contract method 0x41b9dc2b. // -// Solidity: function resolve(nodeId bytes12, qtype bytes32, index uint16) constant returns(rcode uint16, rtype bytes16, ttl uint32, len uint16, data bytes32) -func (_Resolver *ResolverCaller) Resolve(opts *bind.CallOpts, nodeId [12]byte, qtype [32]byte, index uint16) (struct { - Rcode uint16 - Rtype [16]byte - Ttl uint32 - Len uint16 - Data [32]byte -}, error) { - ret := new(struct { - Rcode uint16 - Rtype [16]byte - Ttl uint32 - Len uint16 - Data [32]byte - }) - out := ret - err := _Resolver.contract.Call(opts, out, "resolve", nodeId, qtype, index) - return *ret, err +// Solidity: function has(node bytes32, kind bytes32) returns(bool) +func (_Resolver *ResolverTransactor) Has(opts *bind.TransactOpts, node [32]byte, kind [32]byte) (*types.Transaction, error) { + return _Resolver.contract.Transact(opts, "has", node, kind) } -// Resolve is a free data retrieval call binding the contract method 0xa16fdafa. +// Has is a paid mutator transaction binding the contract method 0x41b9dc2b. // -// Solidity: function resolve(nodeId bytes12, qtype bytes32, index uint16) constant returns(rcode uint16, rtype bytes16, ttl uint32, len uint16, data bytes32) -func (_Resolver *ResolverSession) Resolve(nodeId [12]byte, qtype [32]byte, index uint16) (struct { - Rcode uint16 - Rtype [16]byte - Ttl uint32 - Len uint16 - Data [32]byte -}, error) { - return _Resolver.Contract.Resolve(&_Resolver.CallOpts, nodeId, qtype, index) +// Solidity: function has(node bytes32, kind bytes32) returns(bool) +func (_Resolver *ResolverSession) Has(node [32]byte, kind [32]byte) (*types.Transaction, error) { + return _Resolver.Contract.Has(&_Resolver.TransactOpts, node, kind) } -// Resolve is a free data retrieval call binding the contract method 0xa16fdafa. +// Has is a paid mutator transaction binding the contract method 0x41b9dc2b. // -// Solidity: function resolve(nodeId bytes12, qtype bytes32, index uint16) constant returns(rcode uint16, rtype bytes16, ttl uint32, len uint16, data bytes32) -func (_Resolver *ResolverCallerSession) Resolve(nodeId [12]byte, qtype [32]byte, index uint16) (struct { - Rcode uint16 - Rtype [16]byte - Ttl uint32 - Len uint16 - Data [32]byte -}, error) { - return _Resolver.Contract.Resolve(&_Resolver.CallOpts, nodeId, qtype, index) -} - -// DeletePrivateRR is a paid mutator transaction binding the contract method 0x1b370194. -// -// Solidity: function deletePrivateRR(rootNodeId bytes12, name bytes32[]) returns() -func (_Resolver *ResolverTransactor) DeletePrivateRR(opts *bind.TransactOpts, rootNodeId [12]byte, name [][32]byte) (*types.Transaction, error) { - return _Resolver.contract.Transact(opts, "deletePrivateRR", rootNodeId, name) -} - -// DeletePrivateRR is a paid mutator transaction binding the contract method 0x1b370194. -// -// Solidity: function deletePrivateRR(rootNodeId bytes12, name bytes32[]) returns() -func (_Resolver *ResolverSession) DeletePrivateRR(rootNodeId [12]byte, name [][32]byte) (*types.Transaction, error) { - return _Resolver.Contract.DeletePrivateRR(&_Resolver.TransactOpts, rootNodeId, name) -} - -// DeletePrivateRR is a paid mutator transaction binding the contract method 0x1b370194. -// -// Solidity: function deletePrivateRR(rootNodeId bytes12, name bytes32[]) returns() -func (_Resolver *ResolverTransactorSession) DeletePrivateRR(rootNodeId [12]byte, name [][32]byte) (*types.Transaction, error) { - return _Resolver.Contract.DeletePrivateRR(&_Resolver.TransactOpts, rootNodeId, name) -} - -// DeleteRR is a paid mutator transaction binding the contract method 0xbc06183d. -// -// Solidity: function deleteRR(rootNodeId bytes12, name string) returns() -func (_Resolver *ResolverTransactor) DeleteRR(opts *bind.TransactOpts, rootNodeId [12]byte, name string) (*types.Transaction, error) { - return _Resolver.contract.Transact(opts, "deleteRR", rootNodeId, name) -} - -// DeleteRR is a paid mutator transaction binding the contract method 0xbc06183d. -// -// Solidity: function deleteRR(rootNodeId bytes12, name string) returns() -func (_Resolver *ResolverSession) DeleteRR(rootNodeId [12]byte, name string) (*types.Transaction, error) { - return _Resolver.Contract.DeleteRR(&_Resolver.TransactOpts, rootNodeId, name) -} - -// DeleteRR is a paid mutator transaction binding the contract method 0xbc06183d. -// -// Solidity: function deleteRR(rootNodeId bytes12, name string) returns() -func (_Resolver *ResolverTransactorSession) DeleteRR(rootNodeId [12]byte, name string) (*types.Transaction, error) { - return _Resolver.Contract.DeleteRR(&_Resolver.TransactOpts, rootNodeId, name) -} - -// Register is a paid mutator transaction binding the contract method 0xa1f8f8f0. -// -// Solidity: function register(label bytes32, resolver address, nodeId bytes12) returns() -func (_Resolver *ResolverTransactor) Register(opts *bind.TransactOpts, label [32]byte, resolver common.Address, nodeId [12]byte) (*types.Transaction, error) { - return _Resolver.contract.Transact(opts, "register", label, resolver, nodeId) -} - -// Register is a paid mutator transaction binding the contract method 0xa1f8f8f0. -// -// Solidity: function register(label bytes32, resolver address, nodeId bytes12) returns() -func (_Resolver *ResolverSession) Register(label [32]byte, resolver common.Address, nodeId [12]byte) (*types.Transaction, error) { - return _Resolver.Contract.Register(&_Resolver.TransactOpts, label, resolver, nodeId) -} - -// Register is a paid mutator transaction binding the contract method 0xa1f8f8f0. -// -// Solidity: function register(label bytes32, resolver address, nodeId bytes12) returns() -func (_Resolver *ResolverTransactorSession) Register(label [32]byte, resolver common.Address, nodeId [12]byte) (*types.Transaction, error) { - return _Resolver.Contract.Register(&_Resolver.TransactOpts, label, resolver, nodeId) -} - -// SetOwner is a paid mutator transaction binding the contract method 0x5b0fc9c3. -// -// Solidity: function setOwner(label bytes32, newOwner address) returns() -func (_Resolver *ResolverTransactor) SetOwner(opts *bind.TransactOpts, label [32]byte, newOwner common.Address) (*types.Transaction, error) { - return _Resolver.contract.Transact(opts, "setOwner", label, newOwner) -} - -// SetOwner is a paid mutator transaction binding the contract method 0x5b0fc9c3. -// -// Solidity: function setOwner(label bytes32, newOwner address) returns() -func (_Resolver *ResolverSession) SetOwner(label [32]byte, newOwner common.Address) (*types.Transaction, error) { - return _Resolver.Contract.SetOwner(&_Resolver.TransactOpts, label, newOwner) -} - -// SetOwner is a paid mutator transaction binding the contract method 0x5b0fc9c3. -// -// Solidity: function setOwner(label bytes32, newOwner address) returns() -func (_Resolver *ResolverTransactorSession) SetOwner(label [32]byte, newOwner common.Address) (*types.Transaction, error) { - return _Resolver.Contract.SetOwner(&_Resolver.TransactOpts, label, newOwner) -} - -// SetPrivateRR is a paid mutator transaction binding the contract method 0x91c8e7b9. -// -// Solidity: function setPrivateRR(rootNodeId bytes12, name bytes32[], rtype bytes16, ttl uint32, len uint16, data bytes32) returns() -func (_Resolver *ResolverTransactor) SetPrivateRR(opts *bind.TransactOpts, rootNodeId [12]byte, name [][32]byte, rtype [16]byte, ttl uint32, len uint16, data [32]byte) (*types.Transaction, error) { - return _Resolver.contract.Transact(opts, "setPrivateRR", rootNodeId, name, rtype, ttl, len, data) -} - -// SetPrivateRR is a paid mutator transaction binding the contract method 0x91c8e7b9. -// -// Solidity: function setPrivateRR(rootNodeId bytes12, name bytes32[], rtype bytes16, ttl uint32, len uint16, data bytes32) returns() -func (_Resolver *ResolverSession) SetPrivateRR(rootNodeId [12]byte, name [][32]byte, rtype [16]byte, ttl uint32, len uint16, data [32]byte) (*types.Transaction, error) { - return _Resolver.Contract.SetPrivateRR(&_Resolver.TransactOpts, rootNodeId, name, rtype, ttl, len, data) -} - -// SetPrivateRR is a paid mutator transaction binding the contract method 0x91c8e7b9. -// -// Solidity: function setPrivateRR(rootNodeId bytes12, name bytes32[], rtype bytes16, ttl uint32, len uint16, data bytes32) returns() -func (_Resolver *ResolverTransactorSession) SetPrivateRR(rootNodeId [12]byte, name [][32]byte, rtype [16]byte, ttl uint32, len uint16, data [32]byte) (*types.Transaction, error) { - return _Resolver.Contract.SetPrivateRR(&_Resolver.TransactOpts, rootNodeId, name, rtype, ttl, len, data) -} - -// SetRR is a paid mutator transaction binding the contract method 0x8bba944d. -// -// Solidity: function setRR(rootNodeId bytes12, name string, rtype bytes16, ttl uint32, len uint16, data bytes32) returns() -func (_Resolver *ResolverTransactor) SetRR(opts *bind.TransactOpts, rootNodeId [12]byte, name string, rtype [16]byte, ttl uint32, len uint16, data [32]byte) (*types.Transaction, error) { - return _Resolver.contract.Transact(opts, "setRR", rootNodeId, name, rtype, ttl, len, data) -} - -// SetRR is a paid mutator transaction binding the contract method 0x8bba944d. -// -// Solidity: function setRR(rootNodeId bytes12, name string, rtype bytes16, ttl uint32, len uint16, data bytes32) returns() -func (_Resolver *ResolverSession) SetRR(rootNodeId [12]byte, name string, rtype [16]byte, ttl uint32, len uint16, data [32]byte) (*types.Transaction, error) { - return _Resolver.Contract.SetRR(&_Resolver.TransactOpts, rootNodeId, name, rtype, ttl, len, data) -} - -// SetRR is a paid mutator transaction binding the contract method 0x8bba944d. -// -// Solidity: function setRR(rootNodeId bytes12, name string, rtype bytes16, ttl uint32, len uint16, data bytes32) returns() -func (_Resolver *ResolverTransactorSession) SetRR(rootNodeId [12]byte, name string, rtype [16]byte, ttl uint32, len uint16, data [32]byte) (*types.Transaction, error) { - return _Resolver.Contract.SetRR(&_Resolver.TransactOpts, rootNodeId, name, rtype, ttl, len, data) -} - -// SetResolver is a paid mutator transaction binding the contract method 0xa9f2a1b2. -// -// Solidity: function setResolver(label bytes32, resolver address, nodeId bytes12) returns() -func (_Resolver *ResolverTransactor) SetResolver(opts *bind.TransactOpts, label [32]byte, resolver common.Address, nodeId [12]byte) (*types.Transaction, error) { - return _Resolver.contract.Transact(opts, "setResolver", label, resolver, nodeId) -} - -// SetResolver is a paid mutator transaction binding the contract method 0xa9f2a1b2. -// -// Solidity: function setResolver(label bytes32, resolver address, nodeId bytes12) returns() -func (_Resolver *ResolverSession) SetResolver(label [32]byte, resolver common.Address, nodeId [12]byte) (*types.Transaction, error) { - return _Resolver.Contract.SetResolver(&_Resolver.TransactOpts, label, resolver, nodeId) -} - -// SetResolver is a paid mutator transaction binding the contract method 0xa9f2a1b2. -// -// Solidity: function setResolver(label bytes32, resolver address, nodeId bytes12) returns() -func (_Resolver *ResolverTransactorSession) SetResolver(label [32]byte, resolver common.Address, nodeId [12]byte) (*types.Transaction, error) { - return _Resolver.Contract.SetResolver(&_Resolver.TransactOpts, label, resolver, nodeId) +// Solidity: function has(node bytes32, kind bytes32) returns(bool) +func (_Resolver *ResolverTransactorSession) Has(node [32]byte, kind [32]byte) (*types.Transaction, error) { + return _Resolver.Contract.Has(&_Resolver.TransactOpts, node, kind) } diff --git a/swarm/services/ens/contract/ens.sol b/swarm/services/ens/contract/ens.sol index 7e0f3e73bb..4095cd080f 100644 --- a/swarm/services/ens/contract/ens.sol +++ b/swarm/services/ens/contract/ens.sol @@ -1,31 +1,217 @@ /** - * ENS resolver interface. + * The ENS registry contract. */ -contract Resolver { - bytes32 constant TYPE_STAR = "*"; +contract ENS { + struct Record { + address owner; + address resolver; + } - // Response codes. - uint16 constant RCODE_OK = 0; - uint16 constant RCODE_NXDOMAIN = 3; + mapping(bytes32=>Record) records; + + // Logged when the owner of a node assigns a new owner to a subnode. + event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner); - // These methods are shared by all resolvers - function findResolver(bytes12 nodeId, bytes32 label) constant - returns (uint16 rcode, uint32 ttl, bytes12 rnode, address raddress); - function resolve(bytes12 nodeId, bytes32 qtype, uint16 index) constant - returns (uint16 rcode, bytes16 rtype, uint32 ttl, uint16 len, - bytes32 data); - function getExtended(bytes32 id) constant returns (bytes data); + // Logged when the owner of a node transfers ownership to a new account. + event Transfer(bytes32 indexed node, address owner); - // These methods are implemented by personal resolvers - function isPersonalResolver() constant returns (bool); - function setRR(bytes12 rootNodeId, string name, bytes16 rtype, uint32 ttl, uint16 len, bytes32 data); - function setPrivateRR(bytes12 rootNodeId, bytes32[] name, bytes16 rtype, uint32 ttl, uint16 len, bytes32 data); - function deleteRR(bytes12 rootNodeId, string name); - function deletePrivateRR(bytes12 rootNodeId, bytes32[] name); + // Logged when the owner of a node changes the resolver for that node. + event NewResolver(bytes32 indexed node, address resolver); + + // Permits modifications only by the owner of the specified node. + modifier only_owner(bytes32 node) { + if(records[node].owner != msg.sender) throw; + _ + } + + /** + * Constructs a new ENS registrar, with the provided address as the owner of the root node. + */ + function ENS(address owner) { + records[0].owner = owner; + } + + /** + * Returns the address that owns the specified node. + */ + function owner(bytes32 node) constant returns (address) { + return records[node].owner; + } + + /** + * Returns the address of the resolver for the specified node. + */ + function resolver(bytes32 node) constant returns (address) { + return records[node].resolver; + } - // These methods are implemented by open registrar implementations. - function register(bytes32 label, address resolver, bytes12 nodeId); - function setOwner(bytes32 label, address newOwner); - function setResolver(bytes32 label, address resolver, bytes12 nodeId); - function getOwner(bytes32 label) constant returns (address); + /** + * Transfers ownership of a node to a new address. May only be called by the current + * owner of the node. + * @param node The node to transfer ownership of. + * @param owner The address of the new owner. + */ + function setOwner(bytes32 node, address owner) only_owner(node) { + Transfer(node, owner); + records[node].owner = owner; + } + + /** + * Transfers ownership of a subnode sha3(node, label) to a new address. May only be + * called by the owner of the parent node. + * @param node The parent node. + * @param label The hash of the label specifying the subnode. + * @param owner The address of the new owner. + */ + function setOwner(bytes32 node, bytes32 label, address owner) only_owner(node) { + var subnode = sha3(node, label); + NewOwner(node, label, owner); + records[subnode].owner = owner; + } + + /** + * Sets the resolver address for the specified node. + * @param node The node to update. + * @param resolver The address of the resolver. + */ + function setResolver(bytes32 node, address resolver) only_owner(node) { + NewResolver(node, resolver); + records[node].resolver = resolver; + } +} + +/** + * A registrar that allocates subdomains to the first person to claim them. It also deploys + * a simple resolver contract and sets that as the default resolver on new names for + * convenience. + */ +contract FIFSRegistrar { + ENS ens; + PublicResolver defaultResolver; + bytes32 rootNode; + + /** + * Constructor. + * @param ensAddr The address of the ENS registry. + * @param node The node that this registrar administers. + */ + function FIFSRegistrar(address ensAddr, bytes32 node) { + ens = ENS(ensAddr); + defaultResolver = new PublicResolver(ensAddr); + rootNode = node; + } + + /** + * Register a name, or change the owner of an existing registration. + * @param subnode The hash of the label to register. + * @param owner The address of the new owner. + */ + function register(bytes32 subnode, address owner) { + var node = sha3(rootNode, subnode); + var currentOwner = ens.owner(node); + if(currentOwner != 0 && currentOwner != msg.sender) + throw; + + // Temporarily set ourselves as the owner + ens.setOwner(rootNode, subnode, this); + // Set up the default resolver + ens.setResolver(node, defaultResolver); + // Set the owner to the real owner + ens.setOwner(node, owner); + } +} + +contract Resolver { + event AddrChanged(bytes32 indexed node, address a); + event ContentChanged(bytes32 indexed node, bytes32 hash); + + function has(bytes32 node, bytes32 kind) returns (bool); + function addr(bytes32 node) constant returns (address ret); + function content(bytes32 node) constant returns (bytes32 ret); +} + +/** + * A simple resolver anyone can use; only allows the owner of a node to set its + * address. + */ +contract PublicResolver is Resolver { + ENS ens; + mapping(bytes32=>address) addresses; + mapping(bytes32=>bytes32) contents; + + modifier only_owner(bytes32 node) { + if(ens.owner(node) != msg.sender) throw; + _ + } + + /** + * Constructor. + * @param ensAddr The ENS registrar contract. + */ + function PublicResolver(address ensAddr) { + ens = ENS(ensAddr); + } + + /** + * Fallback function. + */ + function() { + throw; + } + + /** + * Returns true if the specified node has the specified record type. + * @param node The ENS node to query. + * @param kind The record type name, as specified in EIP137. + * @return True if this resolver has a record of the provided type on the + * provided node. + */ + function has(bytes32 node, bytes32 kind) returns (bool) { + return (kind == "addr" && addresses[node] != 0) || + (kind == "content" && contents[node] != 0); + } + + /** + * Returns the address associated with an ENS node. + * @param node The ENS node to query. + * @return The associated address. + */ + function addr(bytes32 node) constant returns (address ret) { + ret = addresses[node]; + if(ret == 0) + throw; + } + + /** + * Returns the content hash associated with an ENS node. + * @param node The ENS node to query. + * @return The associated content hash. + */ + function content(bytes32 node) constant returns (bytes32 ret) { + ret = contents[node]; + if(ret == 0) + throw; + } + + /** + * Sets the address associated with an ENS node. + * May only be called by the owner of that node in the ENS registry. + * @param node The node to update. + * @param addr The address to set. + */ + function setAddr(bytes32 node, address addr) only_owner(node) { + addresses[node] = addr; + AddrChanged(node, addr); + } + + /** + * Sets the content hash associated with an ENS node. + * May only be called by the owner of that node in the ENS registry. + * @param node The node to update. + * @param hash The content hash to set. + */ + function setContent(bytes32 node, bytes32 hash) only_owner(node) { + contents[node] = hash; + ContentChanged(node, hash); + } } diff --git a/swarm/services/ens/ens.go b/swarm/services/ens/ens.go index 3296af52ef..c15e782c4f 100644 --- a/swarm/services/ens/ens.go +++ b/swarm/services/ens/ens.go @@ -1,8 +1,8 @@ -//go:generate abigen --sol contract/ens.sol --pkg contract --out contract/ens.go +//go:generate abigen --sol contract/ENS.sol --pkg contract --out contract/ens.go + package ens import ( - "fmt" "strings" "github.com/ethereum/go-ethereum/accounts/abi/bind" @@ -13,182 +13,146 @@ import ( "github.com/ethereum/go-ethereum/swarm/storage" ) -var qtypeChash = [32]byte{0x43, 0x48, 0x41, 0x53, 0x48} -var rtypeChash = [16]byte{0x43, 0x48, 0x41, 0x53, 0x48} - // swarm domain name registry and resolver -// the ENS instance can be directly wrapped in rpc.Api type ENS struct { - transactOpts *bind.TransactOpts + *contract.ENSSession contractBackend bind.ContractBackend - rootAddress common.Address } -func NewENS(transactOpts *bind.TransactOpts, contractAddr common.Address, contractBackend bind.ContractBackend) *ENS { - return &ENS{ - transactOpts: transactOpts, - contractBackend: contractBackend, - rootAddress: contractAddr, - } -} - -func (self *ENS) DeployRegistrar() (common.Address, error) { - addr, _, _, err := contract.DeployOpenRegistrar(self.transactOpts, self.contractBackend) - if err != nil { - return common.Address{}, err - } - return addr, nil -} - -func (self *ENS) DeployResolver() (common.Address, error) { - addr, _, _, err := contract.DeployPersonalResolver(self.transactOpts, self.contractBackend) - if err != nil { - return common.Address{}, err - } - return addr, nil -} - -func (self *ENS) newResolver(contractAddr common.Address) (*contract.ResolverSession, error) { - resolver, err := contract.NewResolver(contractAddr, self.contractBackend) +// NewENS creates a struct exposing convenient high-level operations for interacting with +// the Ethereum Name Service. +func NewENS(transactOpts *bind.TransactOpts, contractAddr common.Address, contractBackend bind.ContractBackend) (*ENS, error) { + ens, err := contract.NewENS(contractAddr, contractBackend) if err != nil { return nil, err } - return &contract.ResolverSession{ - Contract: resolver, - TransactOpts: *self.transactOpts, + + return &ENS{ + &contract.ENSSession{ + Contract: ens, + TransactOpts: *transactOpts, + }, + contractBackend, }, nil } -// resolve is a non-tranasctional call, returns hash as storage.Key -func (self *ENS) Resolve(name string) (storage.Key, error) { - return self.resolveName(self.rootAddress, name) -} - -func (self *ENS) nextResolver(resolver *contract.ResolverSession, nodeId [12]byte, label string) (*contract.ResolverSession, [12]byte, error) { - hash := crypto.Sha3Hash([]byte(label)) - ret, err := resolver.FindResolver(nodeId, hash) - if err != nil { - err = fmt.Errorf("error resolving label '%v': %v", label, err) - return nil, [12]byte{}, err - } - if ret.Rcode != 0 { - err = fmt.Errorf("error resolving label '%v': got response code %v", label, ret.Rcode) - return nil, [12]byte{}, err - } - nodeId = ret.Rnode - resolver, err = self.newResolver(ret.Raddress) - if err != nil { - return nil, [12]byte{}, err - } - - return resolver, nodeId, nil -} - -func (self *ENS) findResolver(rootAddress common.Address, host string) (*contract.ResolverSession, [12]byte, error) { - resolver, err := self.newResolver(self.rootAddress) - if err != nil { - return nil, [12]byte{}, err - } - - if len(host) == 0 { - return resolver, [12]byte{}, nil - } - - labels := strings.Split(host, ".") - - var nodeId [12]byte - for i := len(labels) - 1; i >= 0; i-- { - var err error - resolver, nodeId, err = self.nextResolver(resolver, nodeId, labels[i]) - if err != nil { - return nil, [12]byte{}, err - } - } - - return resolver, nodeId, nil -} - -func (self *ENS) resolveName(rootAddress common.Address, host string) (storage.Key, error) { - resolver, nodeId, err := self.findResolver(rootAddress, host) +// DeployENS deploys an instance of the ENS nameservice, with a 'first in first served' root registrar. +func DeployENS(transactOpts *bind.TransactOpts, contractBackend bind.ContractBackend) (*ENS, error) { + // Deploy the ENS registry + ensAddr, _, _, err := contract.DeployENS(transactOpts, contractBackend, transactOpts.From) if err != nil { return nil, err } - ret, err := resolver.Resolve(nodeId, qtypeChash, 0) + ens, err := NewENS(transactOpts, ensAddr, contractBackend) if err != nil { - return nil, fmt.Errorf("error looking up RR on '%v': %v", host, err) + return nil, err } - if ret.Rcode != 0 { - return nil, fmt.Errorf("error looking up RR on '%v': got response code %v", host, ret.Rcode) + + // Deploy the registrar + regAddr, _, _, err := contract.DeployFIFSRegistrar(transactOpts, contractBackend, ensAddr, [32]byte{}) + if err != nil { + return nil, err } - return storage.Key(ret.Data[:]), nil + + // Set the registrar as owner of the ENS root + _, err = ens.SetOwner([32]byte{}, regAddr) + if err != nil { + return nil, err + } + + return ens, nil } -/** - * Registers a new domain name for the caller, making them the owner of the new name. - */ -func (self *ENS) Register(name string, resolverAddress common.Address) (*types.Transaction, error) { - // Find the resolver that we should register with (the one that controls the parent domain) +func ensParentNode(name string) (common.Hash, common.Hash) { parts := strings.SplitN(name, ".", 2) - - baseName := "" - if len(parts) > 1 { - baseName = parts[1] - } - - resolver, nodeId, err := self.findResolver(self.rootAddress, baseName) - if err != nil { - return nil, err - } - if nodeId != [12]byte{} { - return nil, fmt.Errorf("cannot register domains on %v: not a root node", baseName) - } - - // Send it a register transaction - hash := crypto.Sha3Hash([]byte(parts[0])) - return resolver.Register(hash, resolverAddress, [12]byte{}) -} - -/** - * Steps through name components until it finds a PersonalResolver contract. - * Returns the resolver, the node ID, and the remaining name components. - */ -func (self *ENS) findPersonalResolver(name string) (*contract.ResolverSession, [12]byte, string, error) { - var nodeId [12]byte - - resolver, err := self.newResolver(self.rootAddress) - if err != nil { - return nil, [12]byte{}, "", err - } - - labels := strings.Split(name, ".") - - for i := len(labels) - 1; i >= 0; i-- { - if personal, _ := resolver.IsPersonalResolver(); personal { - return resolver, nodeId, strings.Join(labels[0:i+1], "."), nil - } - - resolver, nodeId, err = self.nextResolver(resolver, nodeId, labels[i]) - if err != nil { - return nil, [12]byte{}, "", err - } - } - - if personal, _ := resolver.IsPersonalResolver(); !personal { - return nil, [12]byte{}, "", fmt.Errorf("Personal resolver not found in any name component") + label := crypto.Keccak256Hash([]byte(parts[0])) + if len(parts) == 1 { + return [32]byte{}, label } else { - return resolver, nodeId, "", nil + parentNode, parentLabel := ensParentNode(parts[1]) + return crypto.Keccak256Hash(parentNode[:], parentLabel[:]), label } } -/** - * Sets the content hash associated with a name. - */ -func (self *ENS) SetContentHash(name string, hash common.Hash) (*types.Transaction, error) { - resolver, nodeId, name, err := self.findPersonalResolver(name) +func ensNode(name string) common.Hash { + parentNode, parentLabel := ensParentNode(name) + return crypto.Keccak256Hash(parentNode[:], parentLabel[:]) +} + +func (self *ENS) getResolver(node [32]byte) (*contract.PublicResolverSession, error) { + resolverAddr, err := self.Resolver(node) if err != nil { return nil, err } - return resolver.SetRR(nodeId, name, rtypeChash, 3600, 20, [32]byte(hash)) + resolver, err := contract.NewPublicResolver(resolverAddr, self.contractBackend) + if err != nil { + return nil, err + } + + return &contract.PublicResolverSession{ + Contract: resolver, + TransactOpts: self.TransactOpts, + }, nil +} + +func (self *ENS) getRegistrar(node [32]byte) (*contract.FIFSRegistrarSession, error) { + registrarAddr, err := self.Owner(node) + if err != nil { + return nil, err + } + + registrar, err := contract.NewFIFSRegistrar(registrarAddr, self.contractBackend) + if err != nil { + return nil, err + } + + return &contract.FIFSRegistrarSession{ + Contract: registrar, + TransactOpts: self.TransactOpts, + }, nil +} + +// Resolve is a non-transactional call that returns the content hash associated with a name. +func (self *ENS) Resolve(name string) (storage.Key, error) { + node := ensNode(name) + + resolver, err := self.getResolver(node) + if err != nil { + return nil, err + } + + ret, err := resolver.Content(node) + if err != nil { + return nil, err + } + + return storage.Key(ret[:]), nil +} + +// Register registers a new domain name for the caller, making them the owner of the new name. +// Only works if the registrar for the parent domain implements the FIFS registrar protocol. +func (self *ENS) Register(name string) (*types.Transaction, error) { + parentNode, label := ensParentNode(name) + + registrar, err := self.getRegistrar(parentNode) + if err != nil { + return nil, err + } + + return registrar.Register(label, self.TransactOpts.From) +} + +// SetContentHash sets the content hash associated with a name. Only works if the caller +// owns the name, and the associated resolver implements a `setContent` function. +func (self *ENS) SetContentHash(name string, hash common.Hash) (*types.Transaction, error) { + node := ensNode(name) + + resolver, err := self.getResolver(node) + if err != nil { + return nil, err + } + + return resolver.SetContent(node, hash) } diff --git a/swarm/services/ens/ens_test.go b/swarm/services/ens/ens_test.go index d162b4352a..505f049690 100644 --- a/swarm/services/ens/ens_test.go +++ b/swarm/services/ens/ens_test.go @@ -1,5 +1,3 @@ -//go:generate abigen --abi contract/OpenRegistrar.abi --bin contract/OpenRegistrar.bin --pkg contract --type OpenRegistrar --out contract/OpenRegistrar.go -//go:generate abigen --abi contract/PersonalResolver.abi --bin contract/PersonalResolver.bin --pkg contract --type PersonalResolver --out contract/PersonalResolver.go package ens import ( @@ -8,7 +6,6 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/crypto" ) @@ -23,21 +20,16 @@ var ( func TestENS(t *testing.T) { contractBackend := backends.NewSimulatedBackend(core.GenesisAccount{addr, big.NewInt(1000000000)}) transactOpts := bind.NewKeyedTransactor(key) - ens := NewENS(transactOpts, common.Address{}, contractBackend) - registrarAddr, err := ens.DeployRegistrar() + // Workaround for bug estimating gas in the call to Register + transactOpts.GasLimit = big.NewInt(1000000) + + ens, err := DeployENS(transactOpts, contractBackend) if err != nil { t.Fatalf("expected no error, got %v", err) } contractBackend.Commit() - ens = NewENS(transactOpts, registrarAddr, contractBackend) - resolverAddr, err := ens.DeployResolver() - if err != nil { - t.Fatalf("expected no error, got %v", err) - } - contractBackend.Commit() - - _, err = ens.Register(name, resolverAddr) + _, err = ens.Register(name) if err != nil { t.Fatalf("expected no error, got %v", err) } @@ -56,5 +48,4 @@ func TestENS(t *testing.T) { if vhost.Hex() != hash.Hex()[2:] { t.Fatalf("resolve error, expected %v, got %v", hash.Hex(), vhost) } - } diff --git a/swarm/swarm.go b/swarm/swarm.go index 87ef9be314..825b960b09 100644 --- a/swarm/swarm.go +++ b/swarm/swarm.go @@ -138,8 +138,11 @@ func NewSwarm(ctx *node.ServiceContext, config *api.Config, swapEnabled, syncEna // set up high level api transactOpts := bind.NewKeyedTransactor(self.privateKey) - // backend := ethereum.ContractBackend() - self.dns = ens.NewENS(transactOpts, config.EnsRoot, self.backend) + + self.dns, err = ens.NewENS(transactOpts, config.EnsRoot, self.backend) + if err != nil { + return nil, err + } glog.V(logger.Debug).Infof("[BZZ] -> Swarm Domain Name Registrar @ address %v", config.EnsRoot.Hex()) self.api = api.NewApi(self.dpa, self.dns) From 4c62ffd55de013cc42d80098b70749d02d9c77a4 Mon Sep 17 00:00:00 2001 From: Nick Johnson Date: Tue, 16 Aug 2016 12:07:39 +0100 Subject: [PATCH 2/4] swarm: Add code to generate genesis JSON for swarm testnet --- swarm/api/config.go | 2 +- swarm/cmd/makegenesis/genesis.json | 60 ++++++++++++++++ swarm/cmd/makegenesis/makegenesis.js | 103 +++++++++++++++++++++++++++ swarm/cmd/makegenesis/package.json | 15 ++++ swarm/services/ens/contract/ens.sol | 12 ++++ swarm/services/ens/ens.go | 9 ++- 6 files changed, 198 insertions(+), 3 deletions(-) create mode 100644 swarm/cmd/makegenesis/genesis.json create mode 100644 swarm/cmd/makegenesis/makegenesis.js create mode 100644 swarm/cmd/makegenesis/package.json diff --git a/swarm/api/config.go b/swarm/api/config.go index 910a3404c0..272df372e6 100644 --- a/swarm/api/config.go +++ b/swarm/api/config.go @@ -21,7 +21,7 @@ const ( // by default ens root is north internal var ( - toyNetEnsRoot = common.HexToAddress("0x606aabab27f8aa98b772bf593b18e550ede87176") + toyNetEnsRoot = common.HexToAddress("0xd344889e0be3e9ef6c26b0f60ef66a32e83c1b69") ) // separate bzz directories diff --git a/swarm/cmd/makegenesis/genesis.json b/swarm/cmd/makegenesis/genesis.json new file mode 100644 index 0000000000..c58c44ff39 --- /dev/null +++ b/swarm/cmd/makegenesis/genesis.json @@ -0,0 +1,60 @@ +{ + "nonce": "0x42", + "gasLimit": "0x47e7c4", + "difficulty": "0x20000", + "alloc": { + "866b5394fe446751e932b7ef77280f4ab7ea3afe": { + "code": "", + "storage": {}, + "balance": "01c51307a94a7800" + }, + "0000000000000000000000000000000000000000": { + "code": "", + "storage": {}, + "balance": "3aecf856b58800" + }, + "0000000000000000000000000000000000000001": { + "code": "", + "storage": {}, + "balance": "01" + }, + "0000000000000000000000000000000000000002": { + "code": "", + "storage": {}, + "balance": "01" + }, + "0000000000000000000000000000000000000003": { + "code": "", + "storage": {}, + "balance": "01" + }, + "0000000000000000000000000000000000000004": { + "code": "", + "storage": {}, + "balance": "01" + }, + "cb7152b03774fd01a8480001b2bcdfebc4f04363": { + "code": "6060604052361561004b5760e060020a60003504632dff694181146100535780633b3b57de1461007557806341b9dc2b146100a0578063c3d014d614610139578063d5fa2b00146101b2575b61022b610002565b61022d6004356000818152600260205260408120549081141561027057610002565b61023f600435600081815260016020526040812054600160a060020a03169081141561027057610002565b61025c60043560243560007f6164647200000000000000000000000000000000000000000000000000000000821480156100f05750600083815260016020526040812054600160a060020a031614155b8061013257507f636f6e74656e740000000000000000000000000000000000000000000000000082148015610132575060008381526002602052604081205414155b9392505050565b61022b600435602435600080546040805160e060020a6302571be30281526004810186905290518593600160a060020a033381169416926302571be392602482810193602093839003909101908290876161da5a03f11561000257505060405151600160a060020a031691909114905061027557610002565b61022b600435602435600080546040805160e060020a6302571be30281526004810186905290518593600160a060020a033381169416926302571be392602482810193602093839003909101908290876161da5a03f11561000257505060405151600160a060020a03169190911490506102c157610002565b005b60408051918252519081900360200190f35b60408051600160a060020a03929092168252519081900360200190f35b604080519115158252519081900360200190f35b919050565b6000838152600260209081526040918290208490558151848152915185927f0424b6fe0d9c3bdbece0e7879dc241bb0c22e900be8b6c168b4ee08bd9bf83bc92908290030190a2505050565b600083815260016020908152604091829020805473ffffffffffffffffffffffffffffffffffffffff1916851790558151600160a060020a0385168152915185927f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd292908290030190a250505056", + "storage": { + "0000000000000000000000000000000000000000000000000000000000000000": "d344889e0be3e9ef6c26b0f60ef66a32e83c1b69" + }, + "balance": "" + }, + "d344889e0be3e9ef6c26b0f60ef66a32e83c1b69": { + "code": "606060405260e060020a60003504630178b8bf811461004757806302571be31461006e5780631896f70a14610091578063569cd595146100c55780635b0fc9c3146100fc575b005b610130600435600081815260208190526040902060010154600160a060020a03165b919050565b610130600435600081815260208190526040902054600160a060020a0316610069565b6100456004356024356000828152602081905260409020548290600160a060020a0390811633919091161461014d57610002565b6100456004356024356044356000838152602081905260408120548490600160a060020a039081163391909116146101bf57610002565b6100456004356024356000828152602081905260409020548290600160a060020a0390811633919091161461025957610002565b60408051600160a060020a03929092168252519081900360200190f35b60408051600160a060020a0384168152905184917f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a0919081900360200190a2506000828152602081905260409020600101805473ffffffffffffffffffffffffffffffffffffffff1916821790555050565b60408051868152602081810187905282519182900383018220600160a060020a03871683529251929450869288927fce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e8292908290030190a382600060005060008460001916815260200190815260200160002060005060000160006101000a815481600160a060020a03021916908302179055505050505050565b60408051600160a060020a0384168152905184917fd4735d920b0f87494915f556dd9b54c8f309026070caea5c737245152564d266919081900360200190a2506000828152602081905260409020805473ffffffffffffffffffffffffffffffffffffffff191682179055505056", + "storage": { + "859ecef2e168dc10231b000bd53493b42bc9d944cac29d94582c1e1d43592131": "582c767cca9d78699b04ba8dd7c33071f2d74003" + }, + "balance": "" + }, + "582c767cca9d78699b04ba8dd7c33071f2d74003": { + "code": "606060405260e060020a6000350463d22057a9811461001b575b005b61001960043560243560025460408051918252602082810185905260008054835194859003840185207f02571be300000000000000000000000000000000000000000000000000000000865260048601819052935193949193600160a060020a03909116926302571be39260248181019391829003018187876161da5a03f11561000257505060405151915050600160a060020a0381166000148015906100d4575033600160a060020a031681600160a060020a031614155b156100de57610002565b60408051600080546002547f569cd59500000000000000000000000000000000000000000000000000000000845260048401526024830188905230600160a060020a039081166044850152935193169263569cd595926064818101939291829003018183876161da5a03f11561000257505060008054600154604080517f1896f70a00000000000000000000000000000000000000000000000000000000815260048101889052600160a060020a0392831660248201529051929091169350631896f70a926044828101939192829003018183876161da5a03f11561000257505060008054604080517f5b0fc9c300000000000000000000000000000000000000000000000000000000815260048101879052600160a060020a0388811660248301529151929091169350635b0fc9c3926044828101939192829003018183876161da5a03f115610002575050505050505056", + "storage": { + "0000000000000000000000000000000000000000000000000000000000000000": "d344889e0be3e9ef6c26b0f60ef66a32e83c1b69", + "0000000000000000000000000000000000000000000000000000000000000001": "cb7152b03774fd01a8480001b2bcdfebc4f04363", + "0000000000000000000000000000000000000000000000000000000000000002": "93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae" + }, + "balance": "" + } + } +} diff --git a/swarm/cmd/makegenesis/makegenesis.js b/swarm/cmd/makegenesis/makegenesis.js new file mode 100644 index 0000000000..90095fa49b --- /dev/null +++ b/swarm/cmd/makegenesis/makegenesis.js @@ -0,0 +1,103 @@ +var Account = require('ethereumjs-account'); +var async = require('async'); +var fs = require('fs'); +var rlp = require('rlp'); +var solc = require('solc'); +var Transaction = require('ethereumjs-tx'); +var Trie = require('merkle-patricia-tree'); +var utils = require('ethereumjs-util'); +var VM = require('ethereumjs-vm'); + +var stateTrie = new Trie(); +var vm = new VM(stateTrie); + +var privatekey = utils.sha3("swarm"); +var accountAddress = utils.privateToAddress(privatekey); + +var accounts = { + "0000000000000000000000000000000000000001": "0x1", + "0000000000000000000000000000000000000002": "0x1", + "0000000000000000000000000000000000000003": "0x1", + "0000000000000000000000000000000000000004": "0x1", +}; +accounts[accountAddress.toString('hex')] = "0x200000000000000"; + +var source = fs.readFileSync('../../services/ens/contract/ens.sol').toString(); +var compiled = solc.compile(source, 1) +var deployer = "0x" + compiled.contracts['DeployENS'].bytecode; + +var transactions = [ + { + nonce: '0x00', + gasPrice: '0x4a817c800', + gasLimit: '0x3d0900', + value: '0x00', + data: deployer + } +]; + +function createAccounts(cb) { + async.each(Object.keys(accounts), function(addr, next) { + var account = new Account(); + account.balance = accounts[addr]; + stateTrie.put(new Buffer(addr, 'hex'), account.serialize(), next); + }, cb); +} + +function runTx(cb) { + async.each(transactions, function(txdata, next) { + var tx = new Transaction(txdata); + tx.sign(privatekey); + vm.runTx({tx: tx}, next); + }, cb); +} + +function dumpState(cb) { + var stream = stateTrie.createReadStream(); + + var accountList = []; + stream.on('data', function(data) { + accountList.push(data); + }); + stream.on('end', function(err) { + var accountData = {}; + async.each(accountList, function(data, next) { + var storage = {}; + + var account = new Account(data.value); + var storageTrie = stateTrie.copy(); + storageTrie.root = account.stateRoot; + + var storageStream = storageTrie.createReadStream(); + storageStream.on('data', function(data) { + storage[data.key.toString('hex')] = rlp.decode(data.value).toString('hex') + }); + storageStream.on('end', function(err) { + account.getCode(stateTrie, function(err, code) { + var address = data.key.toString('hex'); + accountData[address] = { + code: code.toString('hex'), + storage: storage, + balance: account.balance.toString('hex') + }; + next(err); + }); + }) + }, function(err) { + console.log(JSON.stringify({ + nonce: '0x42', + gasLimit: '0x47e7c4', + difficulty: '0x20000', + alloc: accountData + }, null, 4)); + }); + }); +} + +async.series([ + createAccounts, + runTx, + dumpState +], function(err) { + console.log("Error: " + err); +}); diff --git a/swarm/cmd/makegenesis/package.json b/swarm/cmd/makegenesis/package.json new file mode 100644 index 0000000000..7748193904 --- /dev/null +++ b/swarm/cmd/makegenesis/package.json @@ -0,0 +1,15 @@ +{ + "name": "makegenesis", + "version": "0.0.0", + "dependencies": { + "async": "^2.0.1", + "ethereumjs-account": "^2.0.3", + "ethereumjs-block": "^1.2.2", + "ethereumjs-tx": "^1.1.2", + "ethereumjs-util": "^4.5.0", + "ethereumjs-vm": "^1.4.0", + "merkle-patricia-tree": "^2.1.2", + "rlp": "^2.0.0", + "solc": "0.3.5" + } +} diff --git a/swarm/services/ens/contract/ens.sol b/swarm/services/ens/contract/ens.sol index 4095cd080f..eaac5c7716 100644 --- a/swarm/services/ens/contract/ens.sol +++ b/swarm/services/ens/contract/ens.sol @@ -215,3 +215,15 @@ contract PublicResolver is Resolver { ContentChanged(node, hash); } } + +contract DeployENS { + function DeployENS() { + var tld = sha3('eth'); + var tldnode = sha3(bytes32(0), tld); + var ens = new ENS(this); + var registrar = new FIFSRegistrar(ens, tldnode); + ens.setOwner(0, tld, registrar); + ens.setOwner(0, 0); + selfdestruct(msg.sender); + } +} diff --git a/swarm/services/ens/ens.go b/swarm/services/ens/ens.go index c15e782c4f..e7b3d336f7 100644 --- a/swarm/services/ens/ens.go +++ b/swarm/services/ens/ens.go @@ -3,6 +3,7 @@ package ens import ( + "math/big" "strings" "github.com/ethereum/go-ethereum/accounts/abi/bind" @@ -141,7 +142,9 @@ func (self *ENS) Register(name string) (*types.Transaction, error) { return nil, err } - return registrar.Register(label, self.TransactOpts.From) + opts := self.TransactOpts + opts.GasLimit = big.NewInt(200000) + return registrar.Contract.Register(&opts, label, self.TransactOpts.From) } // SetContentHash sets the content hash associated with a name. Only works if the caller @@ -154,5 +157,7 @@ func (self *ENS) SetContentHash(name string, hash common.Hash) (*types.Transacti return nil, err } - return resolver.SetContent(node, hash) + opts := self.TransactOpts + opts.GasLimit = big.NewInt(200000) + return resolver.Contract.SetContent(&opts, node, hash) } From 218cc1cc902300c9bb80a0b8a957ff5e8031b648 Mon Sep 17 00:00:00 2001 From: Nick Johnson Date: Wed, 17 Aug 2016 14:15:15 +0100 Subject: [PATCH 3/4] Permit registration on the root, instead of just .eth --- swarm/services/ens/contract/ens.sol | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/swarm/services/ens/contract/ens.sol b/swarm/services/ens/contract/ens.sol index eaac5c7716..e726addf32 100644 --- a/swarm/services/ens/contract/ens.sol +++ b/swarm/services/ens/contract/ens.sol @@ -218,12 +218,9 @@ contract PublicResolver is Resolver { contract DeployENS { function DeployENS() { - var tld = sha3('eth'); - var tldnode = sha3(bytes32(0), tld); var ens = new ENS(this); - var registrar = new FIFSRegistrar(ens, tldnode); - ens.setOwner(0, tld, registrar); - ens.setOwner(0, 0); + var registrar = new FIFSRegistrar(ens, 0); + ens.setOwner(0, registrar); selfdestruct(msg.sender); } } From cbcf0d2e68f9991c13b1cdb2f0b51888b9dc9393 Mon Sep 17 00:00:00 2001 From: colm Date: Fri, 19 Aug 2016 14:48:22 +0100 Subject: [PATCH 4/4] prevents stack depth attack --- swarm/services/chequebook/contract/chequebook.sol | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/swarm/services/chequebook/contract/chequebook.sol b/swarm/services/chequebook/contract/chequebook.sol index 0468742059..cb19d0b27b 100644 --- a/swarm/services/chequebook/contract/chequebook.sol +++ b/swarm/services/chequebook/contract/chequebook.sol @@ -27,9 +27,11 @@ contract chequebook is mortal { if(owner != ecrecover(hash, sig_v, sig_r, sig_s)) return; // Attempt sending the difference between the cumulative amount on the cheque // and the cumulative amount on the last cashed cheque to beneficiary. - if (beneficiary.send(amount - sent[beneficiary])) { - // Upon success, update the cumulative amount. - sent[beneficiary] = amount; + if (amount - sent[beneficiary] >= this.balance) { + if (beneficiary.send(amount - sent[beneficiary])) { + // Upon success, update the cumulative amount. + sent[beneficiary] = amount; + } } else { // Upon failure, punish owner for writing a bounced cheque. // owner.sendToDebtorsPrison();