aboutsummaryrefslogtreecommitdiffstats
path: root/contracts/ens/ens.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@users.noreply.github.com>2018-01-08 20:15:57 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-01-08 20:15:57 +0800
commit5c2f1e00148f16655d3fb63b93920b1108165c56 (patch)
treef3b453e05a8da60ceb006b5899554f8fbad86cf4 /contracts/ens/ens.go
parenta139041d409d0ffaf81c7cf931c6b24299a05705 (diff)
downloaddexon-5c2f1e00148f16655d3fb63b93920b1108165c56.tar
dexon-5c2f1e00148f16655d3fb63b93920b1108165c56.tar.gz
dexon-5c2f1e00148f16655d3fb63b93920b1108165c56.tar.bz2
dexon-5c2f1e00148f16655d3fb63b93920b1108165c56.tar.lz
dexon-5c2f1e00148f16655d3fb63b93920b1108165c56.tar.xz
dexon-5c2f1e00148f16655d3fb63b93920b1108165c56.tar.zst
dexon-5c2f1e00148f16655d3fb63b93920b1108165c56.zip
all: update generated code (#15808)
* core/types, core/vm, eth, tests: regenerate gencodec files * Makefile: update devtools target Install protoc-gen-go and print reminders about npm, solc and protoc. Also switch to github.com/kevinburke/go-bindata because it's more maintained. * contracts/ens: update contracts and regenerate with solidity v0.4.19 The newer upstream version of the FIFSRegistrar contract doesn't set the resolver anymore. The resolver is now deployed separately. * contracts/release: regenerate with solidity v0.4.19 * contracts/chequebook: fix fallback and regenerate with solidity v0.4.19 The contract didn't have a fallback function, payments would be rejected when compiled with newer solidity. References to 'mortal' and 'owned' use the local file system so we can compile without network access. * p2p/discv5: regenerate with recent stringer * cmd/faucet: regenerate * dashboard: regenerate * eth/tracers: regenerate * internal/jsre/deps: regenerate * dashboard: avoid sed -i because it's not portable * accounts/usbwallet/internal/trezor: fix go generate warnings
Diffstat (limited to 'contracts/ens/ens.go')
-rw-r--r--contracts/ens/ens.go34
1 files changed, 15 insertions, 19 deletions
diff --git a/contracts/ens/ens.go b/contracts/ens/ens.go
index 60c3c83ab..06045a5cd 100644
--- a/contracts/ens/ens.go
+++ b/contracts/ens/ens.go
@@ -16,7 +16,9 @@
package ens
-//go:generate abigen --sol contract/ens.sol --pkg contract --out contract/ens.go
+//go:generate abigen --sol contract/ENS.sol --exc contract/AbstractENS.sol:AbstractENS --pkg contract --out contract/ens.go
+//go:generate abigen --sol contract/FIFSRegistrar.sol --exc contract/AbstractENS.sol:AbstractENS --pkg contract --out contract/fifsregistrar.go
+//go:generate abigen --sol contract/PublicResolver.sol --exc contract/AbstractENS.sol:AbstractENS --pkg contract --out contract/publicresolver.go
import (
"strings"
@@ -57,31 +59,29 @@ func NewENS(transactOpts *bind.TransactOpts, contractAddr common.Address, contra
}
// 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)
+func DeployENS(transactOpts *bind.TransactOpts, contractBackend bind.ContractBackend) (common.Address, *ENS, error) {
+ // Deploy the ENS registry.
+ ensAddr, _, _, err := contract.DeployENS(transactOpts, contractBackend)
if err != nil {
- return nil, err
+ return ensAddr, nil, err
}
ens, err := NewENS(transactOpts, ensAddr, contractBackend)
if err != nil {
- return nil, err
+ return ensAddr, nil, err
}
- // Deploy the registrar
+ // Deploy the registrar.
regAddr, _, _, err := contract.DeployFIFSRegistrar(transactOpts, contractBackend, ensAddr, [32]byte{})
if err != nil {
- return nil, err
+ return ensAddr, nil, err
}
-
- // Set the registrar as owner of the ENS root
- _, err = ens.SetOwner([32]byte{}, regAddr)
- if err != nil {
- return nil, err
+ // Set the registrar as owner of the ENS root.
+ if _, err = ens.SetOwner([32]byte{}, regAddr); err != nil {
+ return ensAddr, nil, err
}
- return ens, nil
+ return ensAddr, ens, nil
}
func ensParentNode(name string) (common.Hash, common.Hash) {
@@ -155,15 +155,11 @@ func (self *ENS) Resolve(name string) (common.Hash, error) {
// 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
}
-
- opts := self.TransactOpts
- opts.GasLimit = 200000
- return registrar.Contract.Register(&opts, label, self.TransactOpts.From)
+ return registrar.Contract.Register(&self.TransactOpts, label, self.TransactOpts.From)
}
// SetContentHash sets the content hash associated with a name. Only works if the caller