feat: Waku v2 bridge

Issue #12610
This commit is contained in:
Michal Iskierko
2023-11-12 13:29:38 +01:00
parent 56e7bd01ca
commit 6d31343205
6716 changed files with 1982502 additions and 5891 deletions

21
vendor/github.com/wealdtech/go-ens/v3/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,21 @@
# Binaries for programs and plugins
*.exe
*.dll
*.so
*.dylib
# Test binary, build with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
coverage.html
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
.glide/
# Vim
*.sw?
# Local TODO
TODO.md

14
vendor/github.com/wealdtech/go-ens/v3/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,14 @@
language: go
go:
- "1.x"
- tip
before_install:
- go get -t -v ./...
script:
- go test -race -coverprofile=coverage.txt -covermode=atomic
after_success:
- bash <(curl -s https://codecov.io/bash)

201
vendor/github.com/wealdtech/go-ens/v3/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

170
vendor/github.com/wealdtech/go-ens/v3/README.md generated vendored Normal file
View File

@@ -0,0 +1,170 @@
# go-ens
[![Tag](https://img.shields.io/github/tag/wealdtech/go-ens.svg)](https://github.com/wealdtech/go-ens/releases/)
[![License](https://img.shields.io/github/license/wealdtech/go-ens.svg)](LICENSE)
[![GoDoc](https://godoc.org/github.com/wealdtech/go-ens?status.svg)](https://godoc.org/github.com/wealdtech/go-ens)
[![Travis CI](https://img.shields.io/travis/wealdtech/go-ens.svg)](https://travis-ci.org/wealdtech/go-ens)
[![codecov.io](https://img.shields.io/codecov/c/github/wealdtech/go-ens.svg)](https://codecov.io/github/wealdtech/go-ens)
[![Go Report Card](https://goreportcard.com/badge/github.com/wealdtech/go-ens)](https://goreportcard.com/report/github.com/wealdtech/go-ens)
Go module to simplify interacting with the [Ethereum Name Service](https://ens.domains/) contracts.
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [Maintainers](#maintainers)
- [Contribute](#contribute)
- [License](#license)
## Install
`go-ens` is a standard Go module which can be installed with:
```sh
go get github.com/wealdtech/go-ens
```
## Usage
`go-ens` provides simple access to the [Ethereum Name Service](https://ens.domains/) (ENS) contracts.
### Resolution
The most commonly-used feature of ENS is resolution: converting an ENS name to an Ethereum address. `go-ens` provides a simple call to allow this:
```go
address, err := ens.Resolve(client, domain)
```
where `client` is a connection to an Ethereum client and `domain` is the fully-qualified name you wish to resolve (e.g. `foo.mydomain.eth`) (full examples for using this are given in the [Example](#Example) section below).
The reverse process, converting an address to an ENS name, is just as simple:
```go
domain, err := ens.ReverseResolve(client, address)
```
Note that if the address does not have a reverse resolution this will return "". If you just want a string version of an address for on-screen display then you can use `ens.Format()`, for example:
```go
fmt.Printf("The address is %s\n", ens.Format(client, address))
```
This will carry out reverse resolution of the address and print the name if present; if not it will print a formatted version of the address.
### Management of names
A top-level name is one that sits directly underneath `.eth`, for example `mydomain.eth`. Lower-level names, such as `foo.mydomain.eth` are covered in the following section. `go-ens` provides a simplified `Name` interface to manage top-level, removing the requirement to understand registrars, controllers, _etc._
Starting out with names in `go-ens` is easy:
```go
client, err := ethclient.Dial("https://infura.io/v3/SECRET")
name, err := ens.NewName(client, "mydomain.eth")
```
Addresses can be set and obtained using the address functions, for example to get an address:
```go
COIN_TYPE_ETHEREUM := uint64(60)
address, err := name.Address(COIN_TYPE_ETHEREUM)
```
ENS supports addresses for multiple coin types; values of coin types can be found at https://github.com/satoshilabs/slips/blob/master/slip-0044.md
### Registering and extending names
Most operations on a domain will involve setting resolvers and resolver information.
### Management of subdomains
Because subdomains have their own registrars they do not work with the `Name` interface.
### Example
```go
package main
import (
"fmt"
"github.com/ethereum/go-ethereum/ethclient"
ens "github.com/wealdtech/go-ens/v3"
)
func main() {
// Replace SECRET with your own access token for this example to work.
client, err := ethclient.Dial("https://mainnet.infura.io/v3/SECRET")
if err != nil {
panic(err)
}
// Resolve a name to an address
domain := "avsa.eth"
address, err := ens.Resolve(client, domain)
if err != nil {
panic(err)
}
fmt.Printf("Address of %s is %s\n", domain, address.Hex())
// Reverse resolve an address to a name
reverse, err := ens.ReverseResolve(client, address)
if err != nil {
panic(err)
}
if reverse == "" {
fmt.Printf("%s has no reverse lookup\n", address.Hex())
} else {
fmt.Printf("Name of %s is %s\n", address.Hex(), reverse)
}
}
package main
import (
"github.com/ethereum/go-ethereum/ethclient"
ens "github.com/wealdtech/go-ens/v3"
)
func main() {
client, err := ethclient.Dial("https://mainnet.infura.io/v3/SECRET")
if err != nil {
panic(err)
}
// Resolve a name to an address
domain := "wealdtech.eth"
address, err := ens.Resolve(client, domain)
if err != nil {
panic(err)
}
fmt.Printf("Address of %s is %s\n", domain, address.Hex())
// Reverse resolve an address to a name
reverse, err := ens.ReverseResolve(client, address)
if err != nil {
panic(err)
}
if reverse == "" {
fmt.Printf("%s has no reverse lookup\n", address.Hex())
} else {
fmt.Printf("Name of %s is %s\n", address.Hex(), reverse)
}
}
```
## Maintainers
Jim McDonald: [@mcdee](https://github.com/mcdee).
## Contribute
Contributions welcome. Please check out [the issues](https://github.com/wealdtech/go-ens/issues).
## License
[Apache-2.0](LICENSE) © 2019 Weald Technology Trading Ltd

View File

@@ -0,0 +1,202 @@
// Copyright 2017-2019 Weald Technology Trading
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ens
import (
"fmt"
"math/big"
"time"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/wealdtech/go-ens/v3/contracts/auctionregistrar"
)
// AuctionRegistrar is the structure for the auction registrar contract
type AuctionRegistrar struct {
backend bind.ContractBackend
domain string
Contract *auctionregistrar.Contract
ContractAddr common.Address
}
// AuctionEntry is an auction entry
type AuctionEntry struct {
State string
Deed common.Address
Registration time.Time
Value *big.Int
HighestBid *big.Int
}
// NewAuctionRegistrar creates a new auction registrar for a given domain
func NewAuctionRegistrar(backend bind.ContractBackend, domain string) (*AuctionRegistrar, error) {
address, err := RegistrarContractAddress(backend, domain)
if err != nil {
return nil, err
}
return NewAuctionRegistrarAt(backend, domain, address)
}
// NewAuctionRegistrarAt creates an auction registrar for a given domain at a given address
func NewAuctionRegistrarAt(backend bind.ContractBackend, domain string, address common.Address) (*AuctionRegistrar, error) {
contract, err := auctionregistrar.NewContract(address, backend)
if err != nil {
return nil, err
}
return &AuctionRegistrar{
backend: backend,
domain: domain,
Contract: contract,
ContractAddr: address,
}, nil
}
// State returns the state of a nam
func (r *AuctionRegistrar) State(name string) (string, error) {
entry, err := r.Entry(name)
if err != nil {
return "", err
}
if entry == nil {
return "", fmt.Errorf("no entry for %s", name)
}
return entry.State, nil
}
// Entry obtains a registrar entry for a name
func (r *AuctionRegistrar) Entry(domain string) (*AuctionEntry, error) {
name, err := UnqualifiedName(domain, r.domain)
if err != nil {
return nil, fmt.Errorf("invalid name %s", domain)
}
labelHash, err := LabelHash(name)
if err != nil {
return nil, err
}
status, deedAddress, registration, value, highestBid, err := r.Contract.Entries(nil, labelHash)
if err != nil {
return nil, err
}
entry := &AuctionEntry{
Deed: deedAddress,
Value: value,
HighestBid: highestBid,
}
entry.Registration = time.Unix(registration.Int64(), 0)
switch status {
case 0:
entry.State = "Available"
case 1:
entry.State = "Bidding"
case 2:
// Might be won or owned
registry, err := NewRegistry(r.backend)
if err != nil {
return nil, err
}
owner, err := registry.Owner(domain)
if err != nil {
return nil, err
}
if owner == UnknownAddress {
entry.State = "Won"
} else {
entry.State = "Owned"
}
case 3:
entry.State = "Forbidden"
case 4:
entry.State = "Revealing"
case 5:
entry.State = "Unavailable"
default:
entry.State = "Unknown"
}
return entry, nil
}
// Migrate migrates a domain to the permanent registrar
func (r *AuctionRegistrar) Migrate(opts *bind.TransactOpts, domain string) (*types.Transaction, error) {
name, err := UnqualifiedName(domain, r.domain)
if err != nil {
return nil, fmt.Errorf("invalid name %s", domain)
}
labelHash, err := LabelHash(name)
if err != nil {
return nil, err
}
return r.Contract.TransferRegistrars(opts, labelHash)
}
// Release releases a domain
func (r *AuctionRegistrar) Release(opts *bind.TransactOpts, domain string) (*types.Transaction, error) {
name, err := UnqualifiedName(domain, r.domain)
if err != nil {
return nil, fmt.Errorf("invalid name %s", domain)
}
labelHash, err := LabelHash(name)
if err != nil {
return nil, err
}
return r.Contract.ReleaseDeed(opts, labelHash)
}
// Owner obtains the owner of the deed that represents the name.
func (r *AuctionRegistrar) Owner(domain string) (common.Address, error) {
name, err := UnqualifiedName(domain, r.domain)
if err != nil {
return UnknownAddress, err
}
entry, err := r.Entry(name)
if err != nil {
return UnknownAddress, err
}
deed, err := NewDeedAt(r.backend, entry.Deed)
if err != nil {
return UnknownAddress, err
}
return deed.Owner()
}
// SetOwner sets the owner of the deed that represents the name.
func (r *AuctionRegistrar) SetOwner(opts *bind.TransactOpts, domain string, address common.Address) (*types.Transaction, error) {
name, err := UnqualifiedName(domain, r.domain)
if err != nil {
return nil, fmt.Errorf("invalid name %s", domain)
}
labelHash, err := LabelHash(name)
if err != nil {
return nil, err
}
return r.Contract.Transfer(opts, labelHash, address)
}
// ShaBid calculates the hash for a bid.
func (r *AuctionRegistrar) ShaBid(hash [32]byte, address common.Address, value *big.Int, salt [32]byte) ([32]byte, error) {
return r.Contract.ShaBid(nil, hash, address, value, salt)
}

213
vendor/github.com/wealdtech/go-ens/v3/baseregistrar.go generated vendored Normal file
View File

@@ -0,0 +1,213 @@
// Copyright 2019 Weald Technology Trading
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ens
import (
"bytes"
"errors"
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/wealdtech/go-ens/v3/contracts/baseregistrar"
"golang.org/x/crypto/sha3"
)
// BaseRegistrar is the structure for the registrar
type BaseRegistrar struct {
backend bind.ContractBackend
domain string
Contract *baseregistrar.Contract
ContractAddr common.Address
}
// NewBaseRegistrar obtains the registrar contract for a given domain
func NewBaseRegistrar(backend bind.ContractBackend, domain string) (*BaseRegistrar, error) {
address, err := RegistrarContractAddress(backend, domain)
if err != nil {
return nil, err
}
if address == UnknownAddress {
return nil, fmt.Errorf("no registrar for domain %s", domain)
}
contract, err := baseregistrar.NewContract(address, backend)
if err != nil {
return nil, err
}
supported, err := contract.SupportsInterface(nil, [4]byte{0x28, 0xed, 0x4f, 0x6c})
if err != nil {
return nil, err
}
if !supported {
return nil, fmt.Errorf("purported registrar for domain %s does not support reclaim functionality", domain)
}
return &BaseRegistrar{
backend: backend,
domain: domain,
Contract: contract,
ContractAddr: address,
}, nil
}
// PriorAuctionContract obtains the previous (auction) registrar contract
func (r *BaseRegistrar) PriorAuctionContract() (*AuctionRegistrar, error) {
address, err := r.Contract.PreviousRegistrar(nil)
if err != nil {
// Means there is no prior registrar.
return nil, nil
}
auctionContract, err := NewAuctionRegistrarAt(r.backend, r.domain, address)
if err != nil {
return nil, errors.New("failed to instantiate prior auction contract")
}
// Confirm ths really is an auction contract by trying to create (but not submit) a bid
var shaBid [32]byte
var emptyHash [32]byte
sha := sha3.NewLegacyKeccak256()
if _, err := sha.Write(emptyHash[:]); err != nil {
return nil, err
}
if _, err := sha.Write(UnknownAddress.Bytes()); err != nil {
return nil, err
}
var amountBytes [32]byte
if _, err := sha.Write(amountBytes[:]); err != nil {
return nil, err
}
if _, err := sha.Write(emptyHash[:]); err != nil {
return nil, err
}
sha.Sum(shaBid[:0])
contractShaBid, err := auctionContract.ShaBid(emptyHash, UnknownAddress, big.NewInt(0), emptyHash)
if err != nil {
return nil, errors.New("failed to confirm auction contract")
}
if !bytes.Equal(contractShaBid[:], shaBid[:]) {
return nil, errors.New("failed to confirm auction contract")
}
return auctionContract, nil
}
// RegisteredWith returns one of "temporary", "permanent" or "none" for the
// registrar on which this name is registered
func (r *BaseRegistrar) RegisteredWith(domain string) (string, error) {
name, err := UnqualifiedName(domain, r.domain)
if err != nil {
return "", err
}
// See if we're registered at all - fetch the owner to find out
registry, err := NewRegistry(r.backend)
if err != nil {
return "", err
}
owner, err := registry.Owner(domain)
if err != nil {
return "", err
}
// Fetch the temporary registrar and see if we're registered there
auctionRegistrar, err := r.PriorAuctionContract()
if err != nil {
return "", err
}
if auctionRegistrar != nil {
state, err := auctionRegistrar.State(name)
if err != nil {
return "", err
}
if state == "Won" || state == "Owned" {
return "temporary", nil
}
}
// No temporary registrar or no entry in same
if owner == UnknownAddress {
return "none", nil
}
return "permanent", nil
}
// Owner obtains the owner of the underlying token that represents the name.
func (r *BaseRegistrar) Owner(domain string) (common.Address, error) {
name, err := UnqualifiedName(domain, r.domain)
if err != nil {
return UnknownAddress, err
}
labelHash, err := LabelHash(name)
if err != nil {
return UnknownAddress, err
}
owner, err := r.Contract.OwnerOf(nil, new(big.Int).SetBytes(labelHash[:]))
// Registrar reverts rather than provide a 0 owner, so...
if err != nil && err.Error() == "execution reverted" {
return UnknownAddress, nil
}
return owner, err
}
// SetOwner sets the owner of the token holding the name
func (r *BaseRegistrar) SetOwner(opts *bind.TransactOpts, domain string, newOwner common.Address) (*types.Transaction, error) {
name, err := UnqualifiedName(domain, r.domain)
if err != nil {
return nil, err
}
owner, err := r.Owner(name)
if err != nil {
return nil, err
}
labelHash, err := LabelHash(name)
if err != nil {
return nil, err
}
id := new(big.Int).SetBytes(labelHash[:])
return r.Contract.TransferFrom(opts, owner, newOwner, id)
}
// Expiry obtains the unix timestamp at which the registration expires.
func (r *BaseRegistrar) Expiry(domain string) (*big.Int, error) {
name, err := UnqualifiedName(domain, r.domain)
if err != nil {
return nil, err
}
labelHash, err := LabelHash(name)
if err != nil {
return nil, err
}
id := new(big.Int).SetBytes(labelHash[:])
return r.Contract.NameExpires(nil, id)
}
// Reclaim reclaims a domain by the owner
func (r *BaseRegistrar) Reclaim(opts *bind.TransactOpts, domain string, newOwner common.Address) (*types.Transaction, error) {
name, err := UnqualifiedName(domain, r.domain)
if err != nil {
return nil, err
}
labelHash, err := LabelHash(name)
if err != nil {
return nil, err
}
id := new(big.Int).SetBytes(labelHash[:])
return r.Contract.Reclaim(opts, id, newOwner)
}

207
vendor/github.com/wealdtech/go-ens/v3/contenthash.go generated vendored Normal file
View File

@@ -0,0 +1,207 @@
// Copyright 2019-2021 Weald Technology Trading
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ens
import (
"encoding/binary"
"encoding/hex"
"fmt"
"strings"
"github.com/ipfs/go-cid"
"github.com/multiformats/go-multibase"
"github.com/multiformats/go-multihash"
"github.com/pkg/errors"
"github.com/wealdtech/go-multicodec"
)
// StringToContenthash turns EIP-1577 text format in to EIP-1577 binary format
func StringToContenthash(text string) ([]byte, error) {
if text == "" {
return nil, errors.New("no content hash")
}
codec := ""
data := ""
if strings.Contains(text, "://") {
// URL style.
bits := strings.Split(text, "://")
if len(bits) != 2 {
return nil, fmt.Errorf("invalid content hash")
}
codec = bits[0]
data = bits[1]
} else {
// Path style.
bits := strings.Split(text, "/")
if len(bits) != 3 {
return nil, errors.New("invalid content hash")
}
codec = bits[1]
data = bits[2]
}
if codec == "" {
return nil, errors.New("codec missing")
}
if data == "" {
return nil, errors.New("data missing")
}
res := make([]byte, 0)
switch codec {
case "ipfs":
content, err := cid.Parse(data)
if err != nil {
return nil, errors.Wrap(err, "invalid IPFS data")
}
// Namespace
buf := make([]byte, binary.MaxVarintLen64)
size := binary.PutUvarint(buf, multicodec.MustID("ipfs-ns"))
res = append(res, buf[0:size]...)
if data[0:2] == "Qm" {
// CID v0 needs additional headers.
size = binary.PutUvarint(buf, 1)
res = append(res, buf[0:size]...)
size = binary.PutUvarint(buf, multicodec.MustID("dag-pb"))
res = append(res, buf[0:size]...)
res = append(res, content.Bytes()...)
} else {
res = append(res, content.Bytes()...)
}
case "ipns":
content, err := cid.Parse(data)
if err != nil {
return nil, errors.Wrap(err, "invalid IPNS data")
}
// Namespace
buf := make([]byte, binary.MaxVarintLen64)
size := binary.PutUvarint(buf, multicodec.MustID("ipns-ns"))
res = append(res, buf[0:size]...)
if data[0:2] == "Qm" {
// CID v0 needs additional headers.
size = binary.PutUvarint(buf, 1)
res = append(res, buf[0:size]...)
size = binary.PutUvarint(buf, multicodec.MustID("dag-pb"))
res = append(res, buf[0:size]...)
res = append(res, content.Bytes()...)
} else {
res = append(res, content.Bytes()...)
}
case "swarm", "bzz":
// Namespace
buf := make([]byte, binary.MaxVarintLen64)
size := binary.PutUvarint(buf, multicodec.MustID("swarm-ns"))
res = append(res, buf[0:size]...)
size = binary.PutUvarint(buf, 1)
res = append(res, buf[0:size]...)
size = binary.PutUvarint(buf, multicodec.MustID("swarm-manifest"))
res = append(res, buf[0:size]...)
// Hash.
hashData, err := hex.DecodeString(data)
if err != nil {
return nil, errors.Wrap(err, "invalid hex")
}
hash, err := multihash.Encode(hashData, multihash.KECCAK_256)
if err != nil {
return nil, errors.Wrap(err, "failed to hash")
}
res = append(res, hash...)
case "onion":
// Codec
buf := make([]byte, binary.MaxVarintLen64)
size := binary.PutUvarint(buf, multicodec.MustID("onion"))
res = append(res, buf[0:size]...)
// Address
if len(data) != 16 {
return nil, errors.New("onion address should be 16 characters")
}
res = append(res, []byte(data)...)
case "onion3":
// Codec
buf := make([]byte, binary.MaxVarintLen64)
size := binary.PutUvarint(buf, multicodec.MustID("onion3"))
res = append(res, buf[0:size]...)
// Address
if len(data) != 56 {
return nil, errors.New("onion address should be 56 characters")
}
res = append(res, []byte(data)...)
default:
return nil, fmt.Errorf("unknown codec %s", codec)
}
return res, nil
}
// ContenthashToString turns EIP-1577 binary format in to EIP-1577 text format
func ContenthashToString(bytes []byte) (string, error) {
data, codec, err := multicodec.RemoveCodec(bytes)
if err != nil {
return "", err
}
codecName, err := multicodec.Name(codec)
if err != nil {
return "", err
}
switch codecName {
case "ipfs-ns":
thisCID, err := cid.Parse(data)
if err != nil {
return "", errors.Wrap(err, "failed to parse CID")
}
str, err := thisCID.StringOfBase(multibase.Base36)
if err != nil {
return "", errors.Wrap(err, "failed to obtain base36 representation")
}
return fmt.Sprintf("ipfs://%s", str), nil
case "ipns-ns":
thisCID, err := cid.Parse(data)
if err != nil {
return "", errors.Wrap(err, "failed to parse CID")
}
res, err := multibase.Encode(multibase.Base36, thisCID.Bytes())
if err != nil {
return "", errors.Wrap(err, "unknown multibase")
}
return fmt.Sprintf("ipns://%s", res), nil
case "swarm-ns":
id, offset := binary.Uvarint(data)
if id == 0 {
return "", fmt.Errorf("unknown CID")
}
data, subCodec, err := multicodec.RemoveCodec(data[offset:])
if err != nil {
return "", err
}
_, err = multicodec.Name(subCodec)
if err != nil {
return "", err
}
decodedMHash, err := multihash.Decode(data)
if err != nil {
return "", err
}
return fmt.Sprintf("bzz://%x", decodedMHash.Digest), nil
case "onion":
return fmt.Sprintf("onion://%s", string(data)), nil
case "onion3":
return fmt.Sprintf("onion3://%s", string(data)), nil
default:
return "", fmt.Errorf("unknown codec name %s", codecName)
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
package auctionregistrar
//go:generate abigen -abi contract.abi -out contract.go -pkg auctionregistrar -type Contract

View File

@@ -0,0 +1,722 @@
[
{
"constant": true,
"inputs": [
{
"name": "interfaceID",
"type": "bytes4"
}
],
"name": "supportsInterface",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "tokenId",
"type": "uint256"
}
],
"name": "getApproved",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "to",
"type": "address"
},
{
"name": "tokenId",
"type": "uint256"
}
],
"name": "approve",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "from",
"type": "address"
},
{
"name": "to",
"type": "address"
},
{
"name": "tokenId",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "id",
"type": "uint256"
},
{
"name": "owner",
"type": "address"
}
],
"name": "reclaim",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "ens",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "from",
"type": "address"
},
{
"name": "to",
"type": "address"
},
{
"name": "tokenId",
"type": "uint256"
}
],
"name": "safeTransferFrom",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "transferPeriodEnds",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "resolver",
"type": "address"
}
],
"name": "setResolver",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "tokenId",
"type": "uint256"
}
],
"name": "ownerOf",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "MIGRATION_LOCK_PERIOD",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "owner",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "isOwner",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "id",
"type": "uint256"
}
],
"name": "available",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "to",
"type": "address"
},
{
"name": "approved",
"type": "bool"
}
],
"name": "setApprovalForAll",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "controller",
"type": "address"
}
],
"name": "addController",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "previousRegistrar",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "from",
"type": "address"
},
{
"name": "to",
"type": "address"
},
{
"name": "tokenId",
"type": "uint256"
},
{
"name": "_data",
"type": "bytes"
}
],
"name": "safeTransferFrom",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "GRACE_PERIOD",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "id",
"type": "uint256"
},
{
"name": "duration",
"type": "uint256"
}
],
"name": "renew",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "id",
"type": "uint256"
}
],
"name": "nameExpires",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "",
"type": "address"
}
],
"name": "controllers",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "baseNode",
"outputs": [
{
"name": "",
"type": "bytes32"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "owner",
"type": "address"
},
{
"name": "operator",
"type": "address"
}
],
"name": "isApprovedForAll",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "label",
"type": "bytes32"
},
{
"name": "deed",
"type": "address"
},
{
"name": "",
"type": "uint256"
}
],
"name": "acceptRegistrarTransfer",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "controller",
"type": "address"
}
],
"name": "removeController",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "id",
"type": "uint256"
},
{
"name": "owner",
"type": "address"
},
{
"name": "duration",
"type": "uint256"
}
],
"name": "register",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"name": "_ens",
"type": "address"
},
{
"name": "_previousRegistrar",
"type": "address"
},
{
"name": "_baseNode",
"type": "bytes32"
},
{
"name": "_transferPeriodEnds",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "controller",
"type": "address"
}
],
"name": "ControllerAdded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "controller",
"type": "address"
}
],
"name": "ControllerRemoved",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "id",
"type": "uint256"
},
{
"indexed": true,
"name": "owner",
"type": "address"
},
{
"indexed": false,
"name": "expires",
"type": "uint256"
}
],
"name": "NameMigrated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "id",
"type": "uint256"
},
{
"indexed": true,
"name": "owner",
"type": "address"
},
{
"indexed": false,
"name": "expires",
"type": "uint256"
}
],
"name": "NameRegistered",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "id",
"type": "uint256"
},
{
"indexed": false,
"name": "expires",
"type": "uint256"
}
],
"name": "NameRenewed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "from",
"type": "address"
},
{
"indexed": true,
"name": "to",
"type": "address"
},
{
"indexed": true,
"name": "tokenId",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "owner",
"type": "address"
},
{
"indexed": true,
"name": "approved",
"type": "address"
},
{
"indexed": true,
"name": "tokenId",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "owner",
"type": "address"
},
{
"indexed": true,
"name": "operator",
"type": "address"
},
{
"indexed": false,
"name": "approved",
"type": "bool"
}
],
"name": "ApprovalForAll",
"type": "event"
}
]

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
package baseregistrar
//go:generate abigen -abi contract.abi -out contract.go -pkg baseregistrar -type Contract

View File

@@ -0,0 +1 @@
[{"constant":true,"inputs":[],"name":"creationDate","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"destroyDeed","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"registrar","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"value","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"previousOwner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newValue","type":"uint256"},{"name":"throwOnFailure","type":"bool"}],"name":"setBalance","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"refundRatio","type":"uint256"}],"name":"closeDeed","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newRegistrar","type":"address"}],"name":"setRegistrar","outputs":[],"payable":false,"type":"function"},{"inputs":[{"name":"_owner","type":"address"}],"payable":true,"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[],"name":"DeedClosed","type":"event"}]

View File

@@ -0,0 +1,697 @@
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package deed
import (
"math/big"
"strings"
ethereum "github.com/ethereum/go-ethereum"
"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"
"github.com/ethereum/go-ethereum/event"
)
// Reference imports to suppress errors if they are not otherwise used.
var (
_ = big.NewInt
_ = strings.NewReader
_ = ethereum.NotFound
_ = bind.Bind
_ = common.Big1
_ = types.BloomLookup
_ = event.NewSubscription
)
// ContractABI is the input ABI used to generate the binding from.
const ContractABI = "[{\"constant\":true,\"inputs\":[],\"name\":\"creationDate\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"destroyDeed\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"registrar\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"value\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"previousOwner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"newValue\",\"type\":\"uint256\"},{\"name\":\"throwOnFailure\",\"type\":\"bool\"}],\"name\":\"setBalance\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"refundRatio\",\"type\":\"uint256\"}],\"name\":\"closeDeed\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"newRegistrar\",\"type\":\"address\"}],\"name\":\"setRegistrar\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"}],\"payable\":true,\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"DeedClosed\",\"type\":\"event\"}]"
// Contract is an auto generated Go binding around an Ethereum contract.
type Contract struct {
ContractCaller // Read-only binding to the contract
ContractTransactor // Write-only binding to the contract
ContractFilterer // Log filterer for contract events
}
// ContractCaller is an auto generated read-only Go binding around an Ethereum contract.
type ContractCaller struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// ContractTransactor is an auto generated write-only Go binding around an Ethereum contract.
type ContractTransactor struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// ContractFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
type ContractFilterer struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// ContractSession is an auto generated Go binding around an Ethereum contract,
// with pre-set call and transact options.
type ContractSession struct {
Contract *Contract // 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
}
// ContractCallerSession is an auto generated read-only Go binding around an Ethereum contract,
// with pre-set call options.
type ContractCallerSession struct {
Contract *ContractCaller // Generic contract caller binding to set the session for
CallOpts bind.CallOpts // Call options to use throughout this session
}
// ContractTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
// with pre-set transact options.
type ContractTransactorSession struct {
Contract *ContractTransactor // Generic contract transactor binding to set the session for
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}
// ContractRaw is an auto generated low-level Go binding around an Ethereum contract.
type ContractRaw struct {
Contract *Contract // Generic contract binding to access the raw methods on
}
// ContractCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
type ContractCallerRaw struct {
Contract *ContractCaller // Generic read-only contract binding to access the raw methods on
}
// ContractTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
type ContractTransactorRaw struct {
Contract *ContractTransactor // Generic write-only contract binding to access the raw methods on
}
// NewContract creates a new instance of Contract, bound to a specific deployed contract.
func NewContract(address common.Address, backend bind.ContractBackend) (*Contract, error) {
contract, err := bindContract(address, backend, backend, backend)
if err != nil {
return nil, err
}
return &Contract{ContractCaller: ContractCaller{contract: contract}, ContractTransactor: ContractTransactor{contract: contract}, ContractFilterer: ContractFilterer{contract: contract}}, nil
}
// NewContractCaller creates a new read-only instance of Contract, bound to a specific deployed contract.
func NewContractCaller(address common.Address, caller bind.ContractCaller) (*ContractCaller, error) {
contract, err := bindContract(address, caller, nil, nil)
if err != nil {
return nil, err
}
return &ContractCaller{contract: contract}, nil
}
// NewContractTransactor creates a new write-only instance of Contract, bound to a specific deployed contract.
func NewContractTransactor(address common.Address, transactor bind.ContractTransactor) (*ContractTransactor, error) {
contract, err := bindContract(address, nil, transactor, nil)
if err != nil {
return nil, err
}
return &ContractTransactor{contract: contract}, nil
}
// NewContractFilterer creates a new log filterer instance of Contract, bound to a specific deployed contract.
func NewContractFilterer(address common.Address, filterer bind.ContractFilterer) (*ContractFilterer, error) {
contract, err := bindContract(address, nil, nil, filterer)
if err != nil {
return nil, err
}
return &ContractFilterer{contract: contract}, nil
}
// bindContract binds a generic wrapper to an already deployed contract.
func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
parsed, err := abi.JSON(strings.NewReader(ContractABI))
if err != nil {
return nil, err
}
return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
}
// Call invokes the (constant) contract method with params as input values and
// sets the output to result. The result type might be a single field for simple
// returns, a slice of interfaces for anonymous returns and a struct for named
// returns.
func (_Contract *ContractRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _Contract.Contract.ContractCaller.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 (_Contract *ContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _Contract.Contract.ContractTransactor.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_Contract *ContractRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _Contract.Contract.ContractTransactor.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 (_Contract *ContractCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _Contract.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 (_Contract *ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _Contract.Contract.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_Contract *ContractTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _Contract.Contract.contract.Transact(opts, method, params...)
}
// CreationDate is a free data retrieval call binding the contract method 0x05b34410.
//
// Solidity: function creationDate() returns(uint256)
func (_Contract *ContractCaller) CreationDate(opts *bind.CallOpts) (*big.Int, error) {
var out []interface{}
err := _Contract.contract.Call(opts, &out, "creationDate")
if err != nil {
return *new(*big.Int), err
}
out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
return out0, err
}
// CreationDate is a free data retrieval call binding the contract method 0x05b34410.
//
// Solidity: function creationDate() returns(uint256)
func (_Contract *ContractSession) CreationDate() (*big.Int, error) {
return _Contract.Contract.CreationDate(&_Contract.CallOpts)
}
// CreationDate is a free data retrieval call binding the contract method 0x05b34410.
//
// Solidity: function creationDate() returns(uint256)
func (_Contract *ContractCallerSession) CreationDate() (*big.Int, error) {
return _Contract.Contract.CreationDate(&_Contract.CallOpts)
}
// Owner is a free data retrieval call binding the contract method 0x8da5cb5b.
//
// Solidity: function owner() returns(address)
func (_Contract *ContractCaller) Owner(opts *bind.CallOpts) (common.Address, error) {
var out []interface{}
err := _Contract.contract.Call(opts, &out, "owner")
if err != nil {
return *new(common.Address), err
}
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
return out0, err
}
// Owner is a free data retrieval call binding the contract method 0x8da5cb5b.
//
// Solidity: function owner() returns(address)
func (_Contract *ContractSession) Owner() (common.Address, error) {
return _Contract.Contract.Owner(&_Contract.CallOpts)
}
// Owner is a free data retrieval call binding the contract method 0x8da5cb5b.
//
// Solidity: function owner() returns(address)
func (_Contract *ContractCallerSession) Owner() (common.Address, error) {
return _Contract.Contract.Owner(&_Contract.CallOpts)
}
// PreviousOwner is a free data retrieval call binding the contract method 0x674f220f.
//
// Solidity: function previousOwner() returns(address)
func (_Contract *ContractCaller) PreviousOwner(opts *bind.CallOpts) (common.Address, error) {
var out []interface{}
err := _Contract.contract.Call(opts, &out, "previousOwner")
if err != nil {
return *new(common.Address), err
}
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
return out0, err
}
// PreviousOwner is a free data retrieval call binding the contract method 0x674f220f.
//
// Solidity: function previousOwner() returns(address)
func (_Contract *ContractSession) PreviousOwner() (common.Address, error) {
return _Contract.Contract.PreviousOwner(&_Contract.CallOpts)
}
// PreviousOwner is a free data retrieval call binding the contract method 0x674f220f.
//
// Solidity: function previousOwner() returns(address)
func (_Contract *ContractCallerSession) PreviousOwner() (common.Address, error) {
return _Contract.Contract.PreviousOwner(&_Contract.CallOpts)
}
// Registrar is a free data retrieval call binding the contract method 0x2b20e397.
//
// Solidity: function registrar() returns(address)
func (_Contract *ContractCaller) Registrar(opts *bind.CallOpts) (common.Address, error) {
var out []interface{}
err := _Contract.contract.Call(opts, &out, "registrar")
if err != nil {
return *new(common.Address), err
}
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
return out0, err
}
// Registrar is a free data retrieval call binding the contract method 0x2b20e397.
//
// Solidity: function registrar() returns(address)
func (_Contract *ContractSession) Registrar() (common.Address, error) {
return _Contract.Contract.Registrar(&_Contract.CallOpts)
}
// Registrar is a free data retrieval call binding the contract method 0x2b20e397.
//
// Solidity: function registrar() returns(address)
func (_Contract *ContractCallerSession) Registrar() (common.Address, error) {
return _Contract.Contract.Registrar(&_Contract.CallOpts)
}
// Value is a free data retrieval call binding the contract method 0x3fa4f245.
//
// Solidity: function value() returns(uint256)
func (_Contract *ContractCaller) Value(opts *bind.CallOpts) (*big.Int, error) {
var out []interface{}
err := _Contract.contract.Call(opts, &out, "value")
if err != nil {
return *new(*big.Int), err
}
out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
return out0, err
}
// Value is a free data retrieval call binding the contract method 0x3fa4f245.
//
// Solidity: function value() returns(uint256)
func (_Contract *ContractSession) Value() (*big.Int, error) {
return _Contract.Contract.Value(&_Contract.CallOpts)
}
// Value is a free data retrieval call binding the contract method 0x3fa4f245.
//
// Solidity: function value() returns(uint256)
func (_Contract *ContractCallerSession) Value() (*big.Int, error) {
return _Contract.Contract.Value(&_Contract.CallOpts)
}
// CloseDeed is a paid mutator transaction binding the contract method 0xbbe42771.
//
// Solidity: function closeDeed(uint256 refundRatio) returns()
func (_Contract *ContractTransactor) CloseDeed(opts *bind.TransactOpts, refundRatio *big.Int) (*types.Transaction, error) {
return _Contract.contract.Transact(opts, "closeDeed", refundRatio)
}
// CloseDeed is a paid mutator transaction binding the contract method 0xbbe42771.
//
// Solidity: function closeDeed(uint256 refundRatio) returns()
func (_Contract *ContractSession) CloseDeed(refundRatio *big.Int) (*types.Transaction, error) {
return _Contract.Contract.CloseDeed(&_Contract.TransactOpts, refundRatio)
}
// CloseDeed is a paid mutator transaction binding the contract method 0xbbe42771.
//
// Solidity: function closeDeed(uint256 refundRatio) returns()
func (_Contract *ContractTransactorSession) CloseDeed(refundRatio *big.Int) (*types.Transaction, error) {
return _Contract.Contract.CloseDeed(&_Contract.TransactOpts, refundRatio)
}
// DestroyDeed is a paid mutator transaction binding the contract method 0x0b5ab3d5.
//
// Solidity: function destroyDeed() returns()
func (_Contract *ContractTransactor) DestroyDeed(opts *bind.TransactOpts) (*types.Transaction, error) {
return _Contract.contract.Transact(opts, "destroyDeed")
}
// DestroyDeed is a paid mutator transaction binding the contract method 0x0b5ab3d5.
//
// Solidity: function destroyDeed() returns()
func (_Contract *ContractSession) DestroyDeed() (*types.Transaction, error) {
return _Contract.Contract.DestroyDeed(&_Contract.TransactOpts)
}
// DestroyDeed is a paid mutator transaction binding the contract method 0x0b5ab3d5.
//
// Solidity: function destroyDeed() returns()
func (_Contract *ContractTransactorSession) DestroyDeed() (*types.Transaction, error) {
return _Contract.Contract.DestroyDeed(&_Contract.TransactOpts)
}
// SetBalance is a paid mutator transaction binding the contract method 0xb0c80972.
//
// Solidity: function setBalance(uint256 newValue, bool throwOnFailure) returns()
func (_Contract *ContractTransactor) SetBalance(opts *bind.TransactOpts, newValue *big.Int, throwOnFailure bool) (*types.Transaction, error) {
return _Contract.contract.Transact(opts, "setBalance", newValue, throwOnFailure)
}
// SetBalance is a paid mutator transaction binding the contract method 0xb0c80972.
//
// Solidity: function setBalance(uint256 newValue, bool throwOnFailure) returns()
func (_Contract *ContractSession) SetBalance(newValue *big.Int, throwOnFailure bool) (*types.Transaction, error) {
return _Contract.Contract.SetBalance(&_Contract.TransactOpts, newValue, throwOnFailure)
}
// SetBalance is a paid mutator transaction binding the contract method 0xb0c80972.
//
// Solidity: function setBalance(uint256 newValue, bool throwOnFailure) returns()
func (_Contract *ContractTransactorSession) SetBalance(newValue *big.Int, throwOnFailure bool) (*types.Transaction, error) {
return _Contract.Contract.SetBalance(&_Contract.TransactOpts, newValue, throwOnFailure)
}
// SetOwner is a paid mutator transaction binding the contract method 0x13af4035.
//
// Solidity: function setOwner(address newOwner) returns()
func (_Contract *ContractTransactor) SetOwner(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) {
return _Contract.contract.Transact(opts, "setOwner", newOwner)
}
// SetOwner is a paid mutator transaction binding the contract method 0x13af4035.
//
// Solidity: function setOwner(address newOwner) returns()
func (_Contract *ContractSession) SetOwner(newOwner common.Address) (*types.Transaction, error) {
return _Contract.Contract.SetOwner(&_Contract.TransactOpts, newOwner)
}
// SetOwner is a paid mutator transaction binding the contract method 0x13af4035.
//
// Solidity: function setOwner(address newOwner) returns()
func (_Contract *ContractTransactorSession) SetOwner(newOwner common.Address) (*types.Transaction, error) {
return _Contract.Contract.SetOwner(&_Contract.TransactOpts, newOwner)
}
// SetRegistrar is a paid mutator transaction binding the contract method 0xfaab9d39.
//
// Solidity: function setRegistrar(address newRegistrar) returns()
func (_Contract *ContractTransactor) SetRegistrar(opts *bind.TransactOpts, newRegistrar common.Address) (*types.Transaction, error) {
return _Contract.contract.Transact(opts, "setRegistrar", newRegistrar)
}
// SetRegistrar is a paid mutator transaction binding the contract method 0xfaab9d39.
//
// Solidity: function setRegistrar(address newRegistrar) returns()
func (_Contract *ContractSession) SetRegistrar(newRegistrar common.Address) (*types.Transaction, error) {
return _Contract.Contract.SetRegistrar(&_Contract.TransactOpts, newRegistrar)
}
// SetRegistrar is a paid mutator transaction binding the contract method 0xfaab9d39.
//
// Solidity: function setRegistrar(address newRegistrar) returns()
func (_Contract *ContractTransactorSession) SetRegistrar(newRegistrar common.Address) (*types.Transaction, error) {
return _Contract.Contract.SetRegistrar(&_Contract.TransactOpts, newRegistrar)
}
// ContractDeedClosedIterator is returned from FilterDeedClosed and is used to iterate over the raw logs and unpacked data for DeedClosed events raised by the Contract contract.
type ContractDeedClosedIterator struct {
Event *ContractDeedClosed // Event containing the contract specifics and raw log
contract *bind.BoundContract // Generic contract to use for unpacking event data
event string // Event name to use for unpacking event data
logs chan types.Log // Log channel receiving the found contract events
sub ethereum.Subscription // Subscription for errors, completion and termination
done bool // Whether the subscription completed delivering logs
fail error // Occurred error to stop iteration
}
// Next advances the iterator to the subsequent event, returning whether there
// are any more events found. In case of a retrieval or parsing error, false is
// returned and Error() can be queried for the exact failure.
func (it *ContractDeedClosedIterator) Next() bool {
// If the iterator failed, stop iterating
if it.fail != nil {
return false
}
// If the iterator completed, deliver directly whatever's available
if it.done {
select {
case log := <-it.logs:
it.Event = new(ContractDeedClosed)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
default:
return false
}
}
// Iterator still in progress, wait for either a data or an error event
select {
case log := <-it.logs:
it.Event = new(ContractDeedClosed)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
case err := <-it.sub.Err():
it.done = true
it.fail = err
return it.Next()
}
}
// Error returns any retrieval or parsing error occurred during filtering.
func (it *ContractDeedClosedIterator) Error() error {
return it.fail
}
// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *ContractDeedClosedIterator) Close() error {
it.sub.Unsubscribe()
return nil
}
// ContractDeedClosed represents a DeedClosed event raised by the Contract contract.
type ContractDeedClosed struct {
Raw types.Log // Blockchain specific contextual infos
}
// FilterDeedClosed is a free log retrieval operation binding the contract event 0xbb2ce2f51803bba16bc85282b47deeea9a5c6223eabea1077be696b3f265cf13.
//
// Solidity: event DeedClosed()
func (_Contract *ContractFilterer) FilterDeedClosed(opts *bind.FilterOpts) (*ContractDeedClosedIterator, error) {
logs, sub, err := _Contract.contract.FilterLogs(opts, "DeedClosed")
if err != nil {
return nil, err
}
return &ContractDeedClosedIterator{contract: _Contract.contract, event: "DeedClosed", logs: logs, sub: sub}, nil
}
// WatchDeedClosed is a free log subscription operation binding the contract event 0xbb2ce2f51803bba16bc85282b47deeea9a5c6223eabea1077be696b3f265cf13.
//
// Solidity: event DeedClosed()
func (_Contract *ContractFilterer) WatchDeedClosed(opts *bind.WatchOpts, sink chan<- *ContractDeedClosed) (event.Subscription, error) {
logs, sub, err := _Contract.contract.WatchLogs(opts, "DeedClosed")
if err != nil {
return nil, err
}
return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe()
for {
select {
case log := <-logs:
// New log arrived, parse the event and forward to the user
event := new(ContractDeedClosed)
if err := _Contract.contract.UnpackLog(event, "DeedClosed", log); err != nil {
return err
}
event.Raw = log
select {
case sink <- event:
case err := <-sub.Err():
return err
case <-quit:
return nil
}
case err := <-sub.Err():
return err
case <-quit:
return nil
}
}
}), nil
}
// ParseDeedClosed is a log parse operation binding the contract event 0xbb2ce2f51803bba16bc85282b47deeea9a5c6223eabea1077be696b3f265cf13.
//
// Solidity: event DeedClosed()
func (_Contract *ContractFilterer) ParseDeedClosed(log types.Log) (*ContractDeedClosed, error) {
event := new(ContractDeedClosed)
if err := _Contract.contract.UnpackLog(event, "DeedClosed", log); err != nil {
return nil, err
}
return event, nil
}
// ContractOwnerChangedIterator is returned from FilterOwnerChanged and is used to iterate over the raw logs and unpacked data for OwnerChanged events raised by the Contract contract.
type ContractOwnerChangedIterator struct {
Event *ContractOwnerChanged // Event containing the contract specifics and raw log
contract *bind.BoundContract // Generic contract to use for unpacking event data
event string // Event name to use for unpacking event data
logs chan types.Log // Log channel receiving the found contract events
sub ethereum.Subscription // Subscription for errors, completion and termination
done bool // Whether the subscription completed delivering logs
fail error // Occurred error to stop iteration
}
// Next advances the iterator to the subsequent event, returning whether there
// are any more events found. In case of a retrieval or parsing error, false is
// returned and Error() can be queried for the exact failure.
func (it *ContractOwnerChangedIterator) Next() bool {
// If the iterator failed, stop iterating
if it.fail != nil {
return false
}
// If the iterator completed, deliver directly whatever's available
if it.done {
select {
case log := <-it.logs:
it.Event = new(ContractOwnerChanged)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
default:
return false
}
}
// Iterator still in progress, wait for either a data or an error event
select {
case log := <-it.logs:
it.Event = new(ContractOwnerChanged)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
case err := <-it.sub.Err():
it.done = true
it.fail = err
return it.Next()
}
}
// Error returns any retrieval or parsing error occurred during filtering.
func (it *ContractOwnerChangedIterator) Error() error {
return it.fail
}
// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *ContractOwnerChangedIterator) Close() error {
it.sub.Unsubscribe()
return nil
}
// ContractOwnerChanged represents a OwnerChanged event raised by the Contract contract.
type ContractOwnerChanged struct {
NewOwner common.Address
Raw types.Log // Blockchain specific contextual infos
}
// FilterOwnerChanged is a free log retrieval operation binding the contract event 0xa2ea9883a321a3e97b8266c2b078bfeec6d50c711ed71f874a90d500ae2eaf36.
//
// Solidity: event OwnerChanged(address newOwner)
func (_Contract *ContractFilterer) FilterOwnerChanged(opts *bind.FilterOpts) (*ContractOwnerChangedIterator, error) {
logs, sub, err := _Contract.contract.FilterLogs(opts, "OwnerChanged")
if err != nil {
return nil, err
}
return &ContractOwnerChangedIterator{contract: _Contract.contract, event: "OwnerChanged", logs: logs, sub: sub}, nil
}
// WatchOwnerChanged is a free log subscription operation binding the contract event 0xa2ea9883a321a3e97b8266c2b078bfeec6d50c711ed71f874a90d500ae2eaf36.
//
// Solidity: event OwnerChanged(address newOwner)
func (_Contract *ContractFilterer) WatchOwnerChanged(opts *bind.WatchOpts, sink chan<- *ContractOwnerChanged) (event.Subscription, error) {
logs, sub, err := _Contract.contract.WatchLogs(opts, "OwnerChanged")
if err != nil {
return nil, err
}
return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe()
for {
select {
case log := <-logs:
// New log arrived, parse the event and forward to the user
event := new(ContractOwnerChanged)
if err := _Contract.contract.UnpackLog(event, "OwnerChanged", log); err != nil {
return err
}
event.Raw = log
select {
case sink <- event:
case err := <-sub.Err():
return err
case <-quit:
return nil
}
case err := <-sub.Err():
return err
case <-quit:
return nil
}
}
}), nil
}
// ParseOwnerChanged is a log parse operation binding the contract event 0xa2ea9883a321a3e97b8266c2b078bfeec6d50c711ed71f874a90d500ae2eaf36.
//
// Solidity: event OwnerChanged(address newOwner)
func (_Contract *ContractFilterer) ParseOwnerChanged(log types.Log) (*ContractOwnerChanged, error) {
event := new(ContractOwnerChanged)
if err := _Contract.contract.UnpackLog(event, "OwnerChanged", log); err != nil {
return nil, err
}
return event, nil
}

View File

@@ -0,0 +1,3 @@
package deed
//go:generate abigen -abi contract.abi -out contract.go -pkg deed -type Contract

View File

@@ -0,0 +1,126 @@
[
{
"constant": true,
"inputs": [
{
"name": "interfaceID",
"type": "bytes4"
}
],
"name": "supportsInterface",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "pure",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "ens",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "oracle",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "name",
"type": "bytes"
},
{
"name": "proof",
"type": "bytes"
}
],
"name": "claim",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "name",
"type": "bytes"
},
{
"name": "input",
"type": "bytes"
},
{
"name": "proof",
"type": "bytes"
}
],
"name": "proveAndClaim",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"name": "_dnssec",
"type": "address"
},
{
"name": "_ens",
"type": "address"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "node",
"type": "bytes32"
},
{
"indexed": true,
"name": "owner",
"type": "address"
},
{
"indexed": false,
"name": "dnsname",
"type": "bytes"
}
],
"name": "Claim",
"type": "event"
}
]

View File

@@ -0,0 +1,460 @@
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package dnsregistrar
import (
"math/big"
"strings"
ethereum "github.com/ethereum/go-ethereum"
"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"
"github.com/ethereum/go-ethereum/event"
)
// Reference imports to suppress errors if they are not otherwise used.
var (
_ = big.NewInt
_ = strings.NewReader
_ = ethereum.NotFound
_ = bind.Bind
_ = common.Big1
_ = types.BloomLookup
_ = event.NewSubscription
)
// ContractABI is the input ABI used to generate the binding from.
const ContractABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"name\",\"type\":\"bytes\"},{\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"claim\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"name\",\"type\":\"bytes\"},{\"name\":\"input\",\"type\":\"bytes\"},{\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"proveAndClaim\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"_dnssec\",\"type\":\"address\"},{\"name\":\"_ens\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"dnsname\",\"type\":\"bytes\"}],\"name\":\"Claim\",\"type\":\"event\"}]"
// Contract is an auto generated Go binding around an Ethereum contract.
type Contract struct {
ContractCaller // Read-only binding to the contract
ContractTransactor // Write-only binding to the contract
ContractFilterer // Log filterer for contract events
}
// ContractCaller is an auto generated read-only Go binding around an Ethereum contract.
type ContractCaller struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// ContractTransactor is an auto generated write-only Go binding around an Ethereum contract.
type ContractTransactor struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// ContractFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
type ContractFilterer struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// ContractSession is an auto generated Go binding around an Ethereum contract,
// with pre-set call and transact options.
type ContractSession struct {
Contract *Contract // 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
}
// ContractCallerSession is an auto generated read-only Go binding around an Ethereum contract,
// with pre-set call options.
type ContractCallerSession struct {
Contract *ContractCaller // Generic contract caller binding to set the session for
CallOpts bind.CallOpts // Call options to use throughout this session
}
// ContractTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
// with pre-set transact options.
type ContractTransactorSession struct {
Contract *ContractTransactor // Generic contract transactor binding to set the session for
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}
// ContractRaw is an auto generated low-level Go binding around an Ethereum contract.
type ContractRaw struct {
Contract *Contract // Generic contract binding to access the raw methods on
}
// ContractCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
type ContractCallerRaw struct {
Contract *ContractCaller // Generic read-only contract binding to access the raw methods on
}
// ContractTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
type ContractTransactorRaw struct {
Contract *ContractTransactor // Generic write-only contract binding to access the raw methods on
}
// NewContract creates a new instance of Contract, bound to a specific deployed contract.
func NewContract(address common.Address, backend bind.ContractBackend) (*Contract, error) {
contract, err := bindContract(address, backend, backend, backend)
if err != nil {
return nil, err
}
return &Contract{ContractCaller: ContractCaller{contract: contract}, ContractTransactor: ContractTransactor{contract: contract}, ContractFilterer: ContractFilterer{contract: contract}}, nil
}
// NewContractCaller creates a new read-only instance of Contract, bound to a specific deployed contract.
func NewContractCaller(address common.Address, caller bind.ContractCaller) (*ContractCaller, error) {
contract, err := bindContract(address, caller, nil, nil)
if err != nil {
return nil, err
}
return &ContractCaller{contract: contract}, nil
}
// NewContractTransactor creates a new write-only instance of Contract, bound to a specific deployed contract.
func NewContractTransactor(address common.Address, transactor bind.ContractTransactor) (*ContractTransactor, error) {
contract, err := bindContract(address, nil, transactor, nil)
if err != nil {
return nil, err
}
return &ContractTransactor{contract: contract}, nil
}
// NewContractFilterer creates a new log filterer instance of Contract, bound to a specific deployed contract.
func NewContractFilterer(address common.Address, filterer bind.ContractFilterer) (*ContractFilterer, error) {
contract, err := bindContract(address, nil, nil, filterer)
if err != nil {
return nil, err
}
return &ContractFilterer{contract: contract}, nil
}
// bindContract binds a generic wrapper to an already deployed contract.
func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
parsed, err := abi.JSON(strings.NewReader(ContractABI))
if err != nil {
return nil, err
}
return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
}
// Call invokes the (constant) contract method with params as input values and
// sets the output to result. The result type might be a single field for simple
// returns, a slice of interfaces for anonymous returns and a struct for named
// returns.
func (_Contract *ContractRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _Contract.Contract.ContractCaller.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 (_Contract *ContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _Contract.Contract.ContractTransactor.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_Contract *ContractRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _Contract.Contract.ContractTransactor.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 (_Contract *ContractCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _Contract.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 (_Contract *ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _Contract.Contract.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_Contract *ContractTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _Contract.Contract.contract.Transact(opts, method, params...)
}
// Ens is a free data retrieval call binding the contract method 0x3f15457f.
//
// Solidity: function ens() view returns(address)
func (_Contract *ContractCaller) Ens(opts *bind.CallOpts) (common.Address, error) {
var out []interface{}
err := _Contract.contract.Call(opts, &out, "ens")
if err != nil {
return *new(common.Address), err
}
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
return out0, err
}
// Ens is a free data retrieval call binding the contract method 0x3f15457f.
//
// Solidity: function ens() view returns(address)
func (_Contract *ContractSession) Ens() (common.Address, error) {
return _Contract.Contract.Ens(&_Contract.CallOpts)
}
// Ens is a free data retrieval call binding the contract method 0x3f15457f.
//
// Solidity: function ens() view returns(address)
func (_Contract *ContractCallerSession) Ens() (common.Address, error) {
return _Contract.Contract.Ens(&_Contract.CallOpts)
}
// Oracle is a free data retrieval call binding the contract method 0x7dc0d1d0.
//
// Solidity: function oracle() view returns(address)
func (_Contract *ContractCaller) Oracle(opts *bind.CallOpts) (common.Address, error) {
var out []interface{}
err := _Contract.contract.Call(opts, &out, "oracle")
if err != nil {
return *new(common.Address), err
}
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
return out0, err
}
// Oracle is a free data retrieval call binding the contract method 0x7dc0d1d0.
//
// Solidity: function oracle() view returns(address)
func (_Contract *ContractSession) Oracle() (common.Address, error) {
return _Contract.Contract.Oracle(&_Contract.CallOpts)
}
// Oracle is a free data retrieval call binding the contract method 0x7dc0d1d0.
//
// Solidity: function oracle() view returns(address)
func (_Contract *ContractCallerSession) Oracle() (common.Address, error) {
return _Contract.Contract.Oracle(&_Contract.CallOpts)
}
// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7.
//
// Solidity: function supportsInterface(bytes4 interfaceID) pure returns(bool)
func (_Contract *ContractCaller) SupportsInterface(opts *bind.CallOpts, interfaceID [4]byte) (bool, error) {
var out []interface{}
err := _Contract.contract.Call(opts, &out, "supportsInterface", interfaceID)
if err != nil {
return *new(bool), err
}
out0 := *abi.ConvertType(out[0], new(bool)).(*bool)
return out0, err
}
// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7.
//
// Solidity: function supportsInterface(bytes4 interfaceID) pure returns(bool)
func (_Contract *ContractSession) SupportsInterface(interfaceID [4]byte) (bool, error) {
return _Contract.Contract.SupportsInterface(&_Contract.CallOpts, interfaceID)
}
// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7.
//
// Solidity: function supportsInterface(bytes4 interfaceID) pure returns(bool)
func (_Contract *ContractCallerSession) SupportsInterface(interfaceID [4]byte) (bool, error) {
return _Contract.Contract.SupportsInterface(&_Contract.CallOpts, interfaceID)
}
// Claim is a paid mutator transaction binding the contract method 0xbe27b22c.
//
// Solidity: function claim(bytes name, bytes proof) returns()
func (_Contract *ContractTransactor) Claim(opts *bind.TransactOpts, name []byte, proof []byte) (*types.Transaction, error) {
return _Contract.contract.Transact(opts, "claim", name, proof)
}
// Claim is a paid mutator transaction binding the contract method 0xbe27b22c.
//
// Solidity: function claim(bytes name, bytes proof) returns()
func (_Contract *ContractSession) Claim(name []byte, proof []byte) (*types.Transaction, error) {
return _Contract.Contract.Claim(&_Contract.TransactOpts, name, proof)
}
// Claim is a paid mutator transaction binding the contract method 0xbe27b22c.
//
// Solidity: function claim(bytes name, bytes proof) returns()
func (_Contract *ContractTransactorSession) Claim(name []byte, proof []byte) (*types.Transaction, error) {
return _Contract.Contract.Claim(&_Contract.TransactOpts, name, proof)
}
// ProveAndClaim is a paid mutator transaction binding the contract method 0xd94585bd.
//
// Solidity: function proveAndClaim(bytes name, bytes input, bytes proof) returns()
func (_Contract *ContractTransactor) ProveAndClaim(opts *bind.TransactOpts, name []byte, input []byte, proof []byte) (*types.Transaction, error) {
return _Contract.contract.Transact(opts, "proveAndClaim", name, input, proof)
}
// ProveAndClaim is a paid mutator transaction binding the contract method 0xd94585bd.
//
// Solidity: function proveAndClaim(bytes name, bytes input, bytes proof) returns()
func (_Contract *ContractSession) ProveAndClaim(name []byte, input []byte, proof []byte) (*types.Transaction, error) {
return _Contract.Contract.ProveAndClaim(&_Contract.TransactOpts, name, input, proof)
}
// ProveAndClaim is a paid mutator transaction binding the contract method 0xd94585bd.
//
// Solidity: function proveAndClaim(bytes name, bytes input, bytes proof) returns()
func (_Contract *ContractTransactorSession) ProveAndClaim(name []byte, input []byte, proof []byte) (*types.Transaction, error) {
return _Contract.Contract.ProveAndClaim(&_Contract.TransactOpts, name, input, proof)
}
// ContractClaimIterator is returned from FilterClaim and is used to iterate over the raw logs and unpacked data for Claim events raised by the Contract contract.
type ContractClaimIterator struct {
Event *ContractClaim // Event containing the contract specifics and raw log
contract *bind.BoundContract // Generic contract to use for unpacking event data
event string // Event name to use for unpacking event data
logs chan types.Log // Log channel receiving the found contract events
sub ethereum.Subscription // Subscription for errors, completion and termination
done bool // Whether the subscription completed delivering logs
fail error // Occurred error to stop iteration
}
// Next advances the iterator to the subsequent event, returning whether there
// are any more events found. In case of a retrieval or parsing error, false is
// returned and Error() can be queried for the exact failure.
func (it *ContractClaimIterator) Next() bool {
// If the iterator failed, stop iterating
if it.fail != nil {
return false
}
// If the iterator completed, deliver directly whatever's available
if it.done {
select {
case log := <-it.logs:
it.Event = new(ContractClaim)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
default:
return false
}
}
// Iterator still in progress, wait for either a data or an error event
select {
case log := <-it.logs:
it.Event = new(ContractClaim)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
case err := <-it.sub.Err():
it.done = true
it.fail = err
return it.Next()
}
}
// Error returns any retrieval or parsing error occurred during filtering.
func (it *ContractClaimIterator) Error() error {
return it.fail
}
// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *ContractClaimIterator) Close() error {
it.sub.Unsubscribe()
return nil
}
// ContractClaim represents a Claim event raised by the Contract contract.
type ContractClaim struct {
Node [32]byte
Owner common.Address
Dnsname []byte
Raw types.Log // Blockchain specific contextual infos
}
// FilterClaim is a free log retrieval operation binding the contract event 0xa2e66ce20e6fb2c4f61339c364ad79f15160cf5307230c8bc4d628adbca2ba39.
//
// Solidity: event Claim(bytes32 indexed node, address indexed owner, bytes dnsname)
func (_Contract *ContractFilterer) FilterClaim(opts *bind.FilterOpts, node [][32]byte, owner []common.Address) (*ContractClaimIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
}
var ownerRule []interface{}
for _, ownerItem := range owner {
ownerRule = append(ownerRule, ownerItem)
}
logs, sub, err := _Contract.contract.FilterLogs(opts, "Claim", nodeRule, ownerRule)
if err != nil {
return nil, err
}
return &ContractClaimIterator{contract: _Contract.contract, event: "Claim", logs: logs, sub: sub}, nil
}
// WatchClaim is a free log subscription operation binding the contract event 0xa2e66ce20e6fb2c4f61339c364ad79f15160cf5307230c8bc4d628adbca2ba39.
//
// Solidity: event Claim(bytes32 indexed node, address indexed owner, bytes dnsname)
func (_Contract *ContractFilterer) WatchClaim(opts *bind.WatchOpts, sink chan<- *ContractClaim, node [][32]byte, owner []common.Address) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
}
var ownerRule []interface{}
for _, ownerItem := range owner {
ownerRule = append(ownerRule, ownerItem)
}
logs, sub, err := _Contract.contract.WatchLogs(opts, "Claim", nodeRule, ownerRule)
if err != nil {
return nil, err
}
return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe()
for {
select {
case log := <-logs:
// New log arrived, parse the event and forward to the user
event := new(ContractClaim)
if err := _Contract.contract.UnpackLog(event, "Claim", log); err != nil {
return err
}
event.Raw = log
select {
case sink <- event:
case err := <-sub.Err():
return err
case <-quit:
return nil
}
case err := <-sub.Err():
return err
case <-quit:
return nil
}
}
}), nil
}
// ParseClaim is a log parse operation binding the contract event 0xa2e66ce20e6fb2c4f61339c364ad79f15160cf5307230c8bc4d628adbca2ba39.
//
// Solidity: event Claim(bytes32 indexed node, address indexed owner, bytes dnsname)
func (_Contract *ContractFilterer) ParseClaim(log types.Log) (*ContractClaim, error) {
event := new(ContractClaim)
if err := _Contract.contract.UnpackLog(event, "Claim", log); err != nil {
return nil, err
}
return event, nil
}

View File

@@ -0,0 +1,3 @@
package dnsregistrar
//go:generate abigen -abi contract.abi -out contract.go -pkg dnsregistrar -type Contract

View File

@@ -0,0 +1,908 @@
[
{
"constant": true,
"inputs": [
{
"internalType": "bytes4",
"name": "interfaceID",
"type": "bytes4"
}
],
"name": "supportsInterface",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "pure",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "setDNSRecords",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "string",
"name": "key",
"type": "string"
},
{
"internalType": "string",
"name": "value",
"type": "string"
}
],
"name": "setText",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "bytes4",
"name": "interfaceID",
"type": "bytes4"
}
],
"name": "interfaceImplementer",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "contentTypes",
"type": "uint256"
}
],
"name": "ABI",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "x",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "y",
"type": "bytes32"
}
],
"name": "setPubkey",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "bytes",
"name": "hash",
"type": "bytes"
}
],
"name": "setContenthash",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
}
],
"name": "addr",
"outputs": [
{
"internalType": "address payable",
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "address",
"name": "target",
"type": "address"
},
{
"internalType": "bool",
"name": "isAuthorised",
"type": "bool"
}
],
"name": "setAuthorisation",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "name",
"type": "bytes32"
}
],
"name": "hasDNSRecords",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "string",
"name": "key",
"type": "string"
}
],
"name": "text",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
}
],
"name": "zonehash",
"outputs": [
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "contentType",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "setABI",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
}
],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "string",
"name": "name",
"type": "string"
}
],
"name": "setName",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "coinType",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "a",
"type": "bytes"
}
],
"name": "setAddr",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "name",
"type": "bytes32"
},
{
"internalType": "uint16",
"name": "resource",
"type": "uint16"
}
],
"name": "dnsRecord",
"outputs": [
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
}
],
"name": "clearDNSZone",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
}
],
"name": "contenthash",
"outputs": [
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
}
],
"name": "pubkey",
"outputs": [
{
"internalType": "bytes32",
"name": "x",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "y",
"type": "bytes32"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "bytes",
"name": "hash",
"type": "bytes"
}
],
"name": "setZonehash",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "address",
"name": "a",
"type": "address"
}
],
"name": "setAddr",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "bytes4",
"name": "interfaceID",
"type": "bytes4"
},
{
"internalType": "address",
"name": "implementer",
"type": "address"
}
],
"name": "setInterface",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "coinType",
"type": "uint256"
}
],
"name": "addr",
"outputs": [
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
},
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "authorisations",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract ENS",
"name": "_ens",
"type": "address"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "target",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "isAuthorised",
"type": "bool"
}
],
"name": "AuthorisationChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "string",
"name": "indexedKey",
"type": "string"
},
{
"indexed": false,
"internalType": "string",
"name": "key",
"type": "string"
}
],
"name": "TextChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "x",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "y",
"type": "bytes32"
}
],
"name": "PubkeyChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "string",
"name": "name",
"type": "string"
}
],
"name": "NameChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes4",
"name": "interfaceID",
"type": "bytes4"
},
{
"indexed": false,
"internalType": "address",
"name": "implementer",
"type": "address"
}
],
"name": "InterfaceChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "bytes",
"name": "name",
"type": "bytes"
},
{
"indexed": false,
"internalType": "uint16",
"name": "resource",
"type": "uint16"
},
{
"indexed": false,
"internalType": "bytes",
"name": "record",
"type": "bytes"
}
],
"name": "DNSRecordChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "bytes",
"name": "name",
"type": "bytes"
},
{
"indexed": false,
"internalType": "uint16",
"name": "resource",
"type": "uint16"
}
],
"name": "DNSRecordDeleted",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
}
],
"name": "DNSZoneCleared",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "bytes",
"name": "lastzonehash",
"type": "bytes"
},
{
"indexed": false,
"internalType": "bytes",
"name": "zonehash",
"type": "bytes"
}
],
"name": "DNSZonehashChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "bytes",
"name": "hash",
"type": "bytes"
}
],
"name": "ContenthashChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "address",
"name": "a",
"type": "address"
}
],
"name": "AddrChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "uint256",
"name": "coinType",
"type": "uint256"
},
{
"indexed": false,
"internalType": "bytes",
"name": "newAddress",
"type": "bytes"
}
],
"name": "AddressChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "uint256",
"name": "contentType",
"type": "uint256"
}
],
"name": "ABIChanged",
"type": "event"
}
]

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
package dnsresolver
//go:generate abigen -abi contract.abi -out contract.go -pkg dnsresolver -type Contract

View File

@@ -0,0 +1,181 @@
[
{
"constant": true,
"inputs": [
{
"name": "dnstype",
"type": "uint16"
},
{
"name": "name",
"type": "bytes"
}
],
"name": "rrdata",
"outputs": [
{
"name": "",
"type": "uint32"
},
{
"name": "",
"type": "uint64"
},
{
"name": "",
"type": "bytes20"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "input",
"type": "bytes"
},
{
"name": "sig",
"type": "bytes"
},
{
"name": "proof",
"type": "bytes"
}
],
"name": "submitRRSet",
"outputs": [
{
"name": "",
"type": "bytes"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "data",
"type": "bytes"
},
{
"name": "proof",
"type": "bytes"
}
],
"name": "submitRRSets",
"outputs": [
{
"name": "",
"type": "bytes"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "deleteType",
"type": "uint16"
},
{
"name": "deleteName",
"type": "bytes"
},
{
"name": "nsec",
"type": "bytes"
},
{
"name": "sig",
"type": "bytes"
},
{
"name": "proof",
"type": "bytes"
}
],
"name": "deleteRRSet",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "id",
"type": "uint8"
},
{
"indexed": false,
"name": "addr",
"type": "address"
}
],
"name": "AlgorithmUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "id",
"type": "uint8"
},
{
"indexed": false,
"name": "addr",
"type": "address"
}
],
"name": "DigestUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "id",
"type": "uint8"
},
{
"indexed": false,
"name": "addr",
"type": "address"
}
],
"name": "NSEC3DigestUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "name",
"type": "bytes"
},
{
"indexed": false,
"name": "rrset",
"type": "bytes"
}
],
"name": "RRSetUpdated",
"type": "event"
}
]

View File

@@ -0,0 +1,804 @@
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package dnssecoracle
import (
"math/big"
"strings"
ethereum "github.com/ethereum/go-ethereum"
"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"
"github.com/ethereum/go-ethereum/event"
)
// Reference imports to suppress errors if they are not otherwise used.
var (
_ = big.NewInt
_ = strings.NewReader
_ = ethereum.NotFound
_ = bind.Bind
_ = common.Big1
_ = types.BloomLookup
_ = event.NewSubscription
)
// ContractABI is the input ABI used to generate the binding from.
const ContractABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"dnstype\",\"type\":\"uint16\"},{\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"rrdata\",\"outputs\":[{\"name\":\"\",\"type\":\"uint32\"},{\"name\":\"\",\"type\":\"uint64\"},{\"name\":\"\",\"type\":\"bytes20\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"input\",\"type\":\"bytes\"},{\"name\":\"sig\",\"type\":\"bytes\"},{\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"submitRRSet\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"data\",\"type\":\"bytes\"},{\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"submitRRSets\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"deleteType\",\"type\":\"uint16\"},{\"name\":\"deleteName\",\"type\":\"bytes\"},{\"name\":\"nsec\",\"type\":\"bytes\"},{\"name\":\"sig\",\"type\":\"bytes\"},{\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"deleteRRSet\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"id\",\"type\":\"uint8\"},{\"indexed\":false,\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"AlgorithmUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"id\",\"type\":\"uint8\"},{\"indexed\":false,\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"DigestUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"id\",\"type\":\"uint8\"},{\"indexed\":false,\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"NSEC3DigestUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"name\":\"rrset\",\"type\":\"bytes\"}],\"name\":\"RRSetUpdated\",\"type\":\"event\"}]"
// Contract is an auto generated Go binding around an Ethereum contract.
type Contract struct {
ContractCaller // Read-only binding to the contract
ContractTransactor // Write-only binding to the contract
ContractFilterer // Log filterer for contract events
}
// ContractCaller is an auto generated read-only Go binding around an Ethereum contract.
type ContractCaller struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// ContractTransactor is an auto generated write-only Go binding around an Ethereum contract.
type ContractTransactor struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// ContractFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
type ContractFilterer struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// ContractSession is an auto generated Go binding around an Ethereum contract,
// with pre-set call and transact options.
type ContractSession struct {
Contract *Contract // 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
}
// ContractCallerSession is an auto generated read-only Go binding around an Ethereum contract,
// with pre-set call options.
type ContractCallerSession struct {
Contract *ContractCaller // Generic contract caller binding to set the session for
CallOpts bind.CallOpts // Call options to use throughout this session
}
// ContractTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
// with pre-set transact options.
type ContractTransactorSession struct {
Contract *ContractTransactor // Generic contract transactor binding to set the session for
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}
// ContractRaw is an auto generated low-level Go binding around an Ethereum contract.
type ContractRaw struct {
Contract *Contract // Generic contract binding to access the raw methods on
}
// ContractCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
type ContractCallerRaw struct {
Contract *ContractCaller // Generic read-only contract binding to access the raw methods on
}
// ContractTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
type ContractTransactorRaw struct {
Contract *ContractTransactor // Generic write-only contract binding to access the raw methods on
}
// NewContract creates a new instance of Contract, bound to a specific deployed contract.
func NewContract(address common.Address, backend bind.ContractBackend) (*Contract, error) {
contract, err := bindContract(address, backend, backend, backend)
if err != nil {
return nil, err
}
return &Contract{ContractCaller: ContractCaller{contract: contract}, ContractTransactor: ContractTransactor{contract: contract}, ContractFilterer: ContractFilterer{contract: contract}}, nil
}
// NewContractCaller creates a new read-only instance of Contract, bound to a specific deployed contract.
func NewContractCaller(address common.Address, caller bind.ContractCaller) (*ContractCaller, error) {
contract, err := bindContract(address, caller, nil, nil)
if err != nil {
return nil, err
}
return &ContractCaller{contract: contract}, nil
}
// NewContractTransactor creates a new write-only instance of Contract, bound to a specific deployed contract.
func NewContractTransactor(address common.Address, transactor bind.ContractTransactor) (*ContractTransactor, error) {
contract, err := bindContract(address, nil, transactor, nil)
if err != nil {
return nil, err
}
return &ContractTransactor{contract: contract}, nil
}
// NewContractFilterer creates a new log filterer instance of Contract, bound to a specific deployed contract.
func NewContractFilterer(address common.Address, filterer bind.ContractFilterer) (*ContractFilterer, error) {
contract, err := bindContract(address, nil, nil, filterer)
if err != nil {
return nil, err
}
return &ContractFilterer{contract: contract}, nil
}
// bindContract binds a generic wrapper to an already deployed contract.
func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
parsed, err := abi.JSON(strings.NewReader(ContractABI))
if err != nil {
return nil, err
}
return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
}
// Call invokes the (constant) contract method with params as input values and
// sets the output to result. The result type might be a single field for simple
// returns, a slice of interfaces for anonymous returns and a struct for named
// returns.
func (_Contract *ContractRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _Contract.Contract.ContractCaller.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 (_Contract *ContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _Contract.Contract.ContractTransactor.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_Contract *ContractRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _Contract.Contract.ContractTransactor.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 (_Contract *ContractCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _Contract.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 (_Contract *ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _Contract.Contract.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_Contract *ContractTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _Contract.Contract.contract.Transact(opts, method, params...)
}
// Rrdata is a free data retrieval call binding the contract method 0x087991bc.
//
// Solidity: function rrdata(uint16 dnstype, bytes name) view returns(uint32, uint64, bytes20)
func (_Contract *ContractCaller) Rrdata(opts *bind.CallOpts, dnstype uint16, name []byte) (uint32, uint64, [20]byte, error) {
var out []interface{}
err := _Contract.contract.Call(opts, &out, "rrdata", dnstype, name)
if err != nil {
return *new(uint32), *new(uint64), *new([20]byte), err
}
out0 := *abi.ConvertType(out[0], new(uint32)).(*uint32)
out1 := *abi.ConvertType(out[1], new(uint64)).(*uint64)
out2 := *abi.ConvertType(out[2], new([20]byte)).(*[20]byte)
return out0, out1, out2, err
}
// Rrdata is a free data retrieval call binding the contract method 0x087991bc.
//
// Solidity: function rrdata(uint16 dnstype, bytes name) view returns(uint32, uint64, bytes20)
func (_Contract *ContractSession) Rrdata(dnstype uint16, name []byte) (uint32, uint64, [20]byte, error) {
return _Contract.Contract.Rrdata(&_Contract.CallOpts, dnstype, name)
}
// Rrdata is a free data retrieval call binding the contract method 0x087991bc.
//
// Solidity: function rrdata(uint16 dnstype, bytes name) view returns(uint32, uint64, bytes20)
func (_Contract *ContractCallerSession) Rrdata(dnstype uint16, name []byte) (uint32, uint64, [20]byte, error) {
return _Contract.Contract.Rrdata(&_Contract.CallOpts, dnstype, name)
}
// DeleteRRSet is a paid mutator transaction binding the contract method 0xe60b202f.
//
// Solidity: function deleteRRSet(uint16 deleteType, bytes deleteName, bytes nsec, bytes sig, bytes proof) returns()
func (_Contract *ContractTransactor) DeleteRRSet(opts *bind.TransactOpts, deleteType uint16, deleteName []byte, nsec []byte, sig []byte, proof []byte) (*types.Transaction, error) {
return _Contract.contract.Transact(opts, "deleteRRSet", deleteType, deleteName, nsec, sig, proof)
}
// DeleteRRSet is a paid mutator transaction binding the contract method 0xe60b202f.
//
// Solidity: function deleteRRSet(uint16 deleteType, bytes deleteName, bytes nsec, bytes sig, bytes proof) returns()
func (_Contract *ContractSession) DeleteRRSet(deleteType uint16, deleteName []byte, nsec []byte, sig []byte, proof []byte) (*types.Transaction, error) {
return _Contract.Contract.DeleteRRSet(&_Contract.TransactOpts, deleteType, deleteName, nsec, sig, proof)
}
// DeleteRRSet is a paid mutator transaction binding the contract method 0xe60b202f.
//
// Solidity: function deleteRRSet(uint16 deleteType, bytes deleteName, bytes nsec, bytes sig, bytes proof) returns()
func (_Contract *ContractTransactorSession) DeleteRRSet(deleteType uint16, deleteName []byte, nsec []byte, sig []byte, proof []byte) (*types.Transaction, error) {
return _Contract.Contract.DeleteRRSet(&_Contract.TransactOpts, deleteType, deleteName, nsec, sig, proof)
}
// SubmitRRSet is a paid mutator transaction binding the contract method 0x4d46d581.
//
// Solidity: function submitRRSet(bytes input, bytes sig, bytes proof) returns(bytes)
func (_Contract *ContractTransactor) SubmitRRSet(opts *bind.TransactOpts, input []byte, sig []byte, proof []byte) (*types.Transaction, error) {
return _Contract.contract.Transact(opts, "submitRRSet", input, sig, proof)
}
// SubmitRRSet is a paid mutator transaction binding the contract method 0x4d46d581.
//
// Solidity: function submitRRSet(bytes input, bytes sig, bytes proof) returns(bytes)
func (_Contract *ContractSession) SubmitRRSet(input []byte, sig []byte, proof []byte) (*types.Transaction, error) {
return _Contract.Contract.SubmitRRSet(&_Contract.TransactOpts, input, sig, proof)
}
// SubmitRRSet is a paid mutator transaction binding the contract method 0x4d46d581.
//
// Solidity: function submitRRSet(bytes input, bytes sig, bytes proof) returns(bytes)
func (_Contract *ContractTransactorSession) SubmitRRSet(input []byte, sig []byte, proof []byte) (*types.Transaction, error) {
return _Contract.Contract.SubmitRRSet(&_Contract.TransactOpts, input, sig, proof)
}
// SubmitRRSets is a paid mutator transaction binding the contract method 0x76a14d1d.
//
// Solidity: function submitRRSets(bytes data, bytes proof) returns(bytes)
func (_Contract *ContractTransactor) SubmitRRSets(opts *bind.TransactOpts, data []byte, proof []byte) (*types.Transaction, error) {
return _Contract.contract.Transact(opts, "submitRRSets", data, proof)
}
// SubmitRRSets is a paid mutator transaction binding the contract method 0x76a14d1d.
//
// Solidity: function submitRRSets(bytes data, bytes proof) returns(bytes)
func (_Contract *ContractSession) SubmitRRSets(data []byte, proof []byte) (*types.Transaction, error) {
return _Contract.Contract.SubmitRRSets(&_Contract.TransactOpts, data, proof)
}
// SubmitRRSets is a paid mutator transaction binding the contract method 0x76a14d1d.
//
// Solidity: function submitRRSets(bytes data, bytes proof) returns(bytes)
func (_Contract *ContractTransactorSession) SubmitRRSets(data []byte, proof []byte) (*types.Transaction, error) {
return _Contract.Contract.SubmitRRSets(&_Contract.TransactOpts, data, proof)
}
// ContractAlgorithmUpdatedIterator is returned from FilterAlgorithmUpdated and is used to iterate over the raw logs and unpacked data for AlgorithmUpdated events raised by the Contract contract.
type ContractAlgorithmUpdatedIterator struct {
Event *ContractAlgorithmUpdated // Event containing the contract specifics and raw log
contract *bind.BoundContract // Generic contract to use for unpacking event data
event string // Event name to use for unpacking event data
logs chan types.Log // Log channel receiving the found contract events
sub ethereum.Subscription // Subscription for errors, completion and termination
done bool // Whether the subscription completed delivering logs
fail error // Occurred error to stop iteration
}
// Next advances the iterator to the subsequent event, returning whether there
// are any more events found. In case of a retrieval or parsing error, false is
// returned and Error() can be queried for the exact failure.
func (it *ContractAlgorithmUpdatedIterator) Next() bool {
// If the iterator failed, stop iterating
if it.fail != nil {
return false
}
// If the iterator completed, deliver directly whatever's available
if it.done {
select {
case log := <-it.logs:
it.Event = new(ContractAlgorithmUpdated)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
default:
return false
}
}
// Iterator still in progress, wait for either a data or an error event
select {
case log := <-it.logs:
it.Event = new(ContractAlgorithmUpdated)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
case err := <-it.sub.Err():
it.done = true
it.fail = err
return it.Next()
}
}
// Error returns any retrieval or parsing error occurred during filtering.
func (it *ContractAlgorithmUpdatedIterator) Error() error {
return it.fail
}
// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *ContractAlgorithmUpdatedIterator) Close() error {
it.sub.Unsubscribe()
return nil
}
// ContractAlgorithmUpdated represents a AlgorithmUpdated event raised by the Contract contract.
type ContractAlgorithmUpdated struct {
Id uint8
Addr common.Address
Raw types.Log // Blockchain specific contextual infos
}
// FilterAlgorithmUpdated is a free log retrieval operation binding the contract event 0xf73c3c226af96b7f1ba666a21b3ceaf2be3ee6a365e3178fd9cd1eaae0075aa8.
//
// Solidity: event AlgorithmUpdated(uint8 id, address addr)
func (_Contract *ContractFilterer) FilterAlgorithmUpdated(opts *bind.FilterOpts) (*ContractAlgorithmUpdatedIterator, error) {
logs, sub, err := _Contract.contract.FilterLogs(opts, "AlgorithmUpdated")
if err != nil {
return nil, err
}
return &ContractAlgorithmUpdatedIterator{contract: _Contract.contract, event: "AlgorithmUpdated", logs: logs, sub: sub}, nil
}
// WatchAlgorithmUpdated is a free log subscription operation binding the contract event 0xf73c3c226af96b7f1ba666a21b3ceaf2be3ee6a365e3178fd9cd1eaae0075aa8.
//
// Solidity: event AlgorithmUpdated(uint8 id, address addr)
func (_Contract *ContractFilterer) WatchAlgorithmUpdated(opts *bind.WatchOpts, sink chan<- *ContractAlgorithmUpdated) (event.Subscription, error) {
logs, sub, err := _Contract.contract.WatchLogs(opts, "AlgorithmUpdated")
if err != nil {
return nil, err
}
return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe()
for {
select {
case log := <-logs:
// New log arrived, parse the event and forward to the user
event := new(ContractAlgorithmUpdated)
if err := _Contract.contract.UnpackLog(event, "AlgorithmUpdated", log); err != nil {
return err
}
event.Raw = log
select {
case sink <- event:
case err := <-sub.Err():
return err
case <-quit:
return nil
}
case err := <-sub.Err():
return err
case <-quit:
return nil
}
}
}), nil
}
// ParseAlgorithmUpdated is a log parse operation binding the contract event 0xf73c3c226af96b7f1ba666a21b3ceaf2be3ee6a365e3178fd9cd1eaae0075aa8.
//
// Solidity: event AlgorithmUpdated(uint8 id, address addr)
func (_Contract *ContractFilterer) ParseAlgorithmUpdated(log types.Log) (*ContractAlgorithmUpdated, error) {
event := new(ContractAlgorithmUpdated)
if err := _Contract.contract.UnpackLog(event, "AlgorithmUpdated", log); err != nil {
return nil, err
}
return event, nil
}
// ContractDigestUpdatedIterator is returned from FilterDigestUpdated and is used to iterate over the raw logs and unpacked data for DigestUpdated events raised by the Contract contract.
type ContractDigestUpdatedIterator struct {
Event *ContractDigestUpdated // Event containing the contract specifics and raw log
contract *bind.BoundContract // Generic contract to use for unpacking event data
event string // Event name to use for unpacking event data
logs chan types.Log // Log channel receiving the found contract events
sub ethereum.Subscription // Subscription for errors, completion and termination
done bool // Whether the subscription completed delivering logs
fail error // Occurred error to stop iteration
}
// Next advances the iterator to the subsequent event, returning whether there
// are any more events found. In case of a retrieval or parsing error, false is
// returned and Error() can be queried for the exact failure.
func (it *ContractDigestUpdatedIterator) Next() bool {
// If the iterator failed, stop iterating
if it.fail != nil {
return false
}
// If the iterator completed, deliver directly whatever's available
if it.done {
select {
case log := <-it.logs:
it.Event = new(ContractDigestUpdated)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
default:
return false
}
}
// Iterator still in progress, wait for either a data or an error event
select {
case log := <-it.logs:
it.Event = new(ContractDigestUpdated)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
case err := <-it.sub.Err():
it.done = true
it.fail = err
return it.Next()
}
}
// Error returns any retrieval or parsing error occurred during filtering.
func (it *ContractDigestUpdatedIterator) Error() error {
return it.fail
}
// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *ContractDigestUpdatedIterator) Close() error {
it.sub.Unsubscribe()
return nil
}
// ContractDigestUpdated represents a DigestUpdated event raised by the Contract contract.
type ContractDigestUpdated struct {
Id uint8
Addr common.Address
Raw types.Log // Blockchain specific contextual infos
}
// FilterDigestUpdated is a free log retrieval operation binding the contract event 0x2fcc274c3b72dd483ab201bfa87295e3817e8b9b10693219873b722ca1af00c7.
//
// Solidity: event DigestUpdated(uint8 id, address addr)
func (_Contract *ContractFilterer) FilterDigestUpdated(opts *bind.FilterOpts) (*ContractDigestUpdatedIterator, error) {
logs, sub, err := _Contract.contract.FilterLogs(opts, "DigestUpdated")
if err != nil {
return nil, err
}
return &ContractDigestUpdatedIterator{contract: _Contract.contract, event: "DigestUpdated", logs: logs, sub: sub}, nil
}
// WatchDigestUpdated is a free log subscription operation binding the contract event 0x2fcc274c3b72dd483ab201bfa87295e3817e8b9b10693219873b722ca1af00c7.
//
// Solidity: event DigestUpdated(uint8 id, address addr)
func (_Contract *ContractFilterer) WatchDigestUpdated(opts *bind.WatchOpts, sink chan<- *ContractDigestUpdated) (event.Subscription, error) {
logs, sub, err := _Contract.contract.WatchLogs(opts, "DigestUpdated")
if err != nil {
return nil, err
}
return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe()
for {
select {
case log := <-logs:
// New log arrived, parse the event and forward to the user
event := new(ContractDigestUpdated)
if err := _Contract.contract.UnpackLog(event, "DigestUpdated", log); err != nil {
return err
}
event.Raw = log
select {
case sink <- event:
case err := <-sub.Err():
return err
case <-quit:
return nil
}
case err := <-sub.Err():
return err
case <-quit:
return nil
}
}
}), nil
}
// ParseDigestUpdated is a log parse operation binding the contract event 0x2fcc274c3b72dd483ab201bfa87295e3817e8b9b10693219873b722ca1af00c7.
//
// Solidity: event DigestUpdated(uint8 id, address addr)
func (_Contract *ContractFilterer) ParseDigestUpdated(log types.Log) (*ContractDigestUpdated, error) {
event := new(ContractDigestUpdated)
if err := _Contract.contract.UnpackLog(event, "DigestUpdated", log); err != nil {
return nil, err
}
return event, nil
}
// ContractNSEC3DigestUpdatedIterator is returned from FilterNSEC3DigestUpdated and is used to iterate over the raw logs and unpacked data for NSEC3DigestUpdated events raised by the Contract contract.
type ContractNSEC3DigestUpdatedIterator struct {
Event *ContractNSEC3DigestUpdated // Event containing the contract specifics and raw log
contract *bind.BoundContract // Generic contract to use for unpacking event data
event string // Event name to use for unpacking event data
logs chan types.Log // Log channel receiving the found contract events
sub ethereum.Subscription // Subscription for errors, completion and termination
done bool // Whether the subscription completed delivering logs
fail error // Occurred error to stop iteration
}
// Next advances the iterator to the subsequent event, returning whether there
// are any more events found. In case of a retrieval or parsing error, false is
// returned and Error() can be queried for the exact failure.
func (it *ContractNSEC3DigestUpdatedIterator) Next() bool {
// If the iterator failed, stop iterating
if it.fail != nil {
return false
}
// If the iterator completed, deliver directly whatever's available
if it.done {
select {
case log := <-it.logs:
it.Event = new(ContractNSEC3DigestUpdated)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
default:
return false
}
}
// Iterator still in progress, wait for either a data or an error event
select {
case log := <-it.logs:
it.Event = new(ContractNSEC3DigestUpdated)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
case err := <-it.sub.Err():
it.done = true
it.fail = err
return it.Next()
}
}
// Error returns any retrieval or parsing error occurred during filtering.
func (it *ContractNSEC3DigestUpdatedIterator) Error() error {
return it.fail
}
// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *ContractNSEC3DigestUpdatedIterator) Close() error {
it.sub.Unsubscribe()
return nil
}
// ContractNSEC3DigestUpdated represents a NSEC3DigestUpdated event raised by the Contract contract.
type ContractNSEC3DigestUpdated struct {
Id uint8
Addr common.Address
Raw types.Log // Blockchain specific contextual infos
}
// FilterNSEC3DigestUpdated is a free log retrieval operation binding the contract event 0xc7eec866a7a1386188cc3ca20ffea75b71bd3e90a60b6791b1d3f0971145118d.
//
// Solidity: event NSEC3DigestUpdated(uint8 id, address addr)
func (_Contract *ContractFilterer) FilterNSEC3DigestUpdated(opts *bind.FilterOpts) (*ContractNSEC3DigestUpdatedIterator, error) {
logs, sub, err := _Contract.contract.FilterLogs(opts, "NSEC3DigestUpdated")
if err != nil {
return nil, err
}
return &ContractNSEC3DigestUpdatedIterator{contract: _Contract.contract, event: "NSEC3DigestUpdated", logs: logs, sub: sub}, nil
}
// WatchNSEC3DigestUpdated is a free log subscription operation binding the contract event 0xc7eec866a7a1386188cc3ca20ffea75b71bd3e90a60b6791b1d3f0971145118d.
//
// Solidity: event NSEC3DigestUpdated(uint8 id, address addr)
func (_Contract *ContractFilterer) WatchNSEC3DigestUpdated(opts *bind.WatchOpts, sink chan<- *ContractNSEC3DigestUpdated) (event.Subscription, error) {
logs, sub, err := _Contract.contract.WatchLogs(opts, "NSEC3DigestUpdated")
if err != nil {
return nil, err
}
return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe()
for {
select {
case log := <-logs:
// New log arrived, parse the event and forward to the user
event := new(ContractNSEC3DigestUpdated)
if err := _Contract.contract.UnpackLog(event, "NSEC3DigestUpdated", log); err != nil {
return err
}
event.Raw = log
select {
case sink <- event:
case err := <-sub.Err():
return err
case <-quit:
return nil
}
case err := <-sub.Err():
return err
case <-quit:
return nil
}
}
}), nil
}
// ParseNSEC3DigestUpdated is a log parse operation binding the contract event 0xc7eec866a7a1386188cc3ca20ffea75b71bd3e90a60b6791b1d3f0971145118d.
//
// Solidity: event NSEC3DigestUpdated(uint8 id, address addr)
func (_Contract *ContractFilterer) ParseNSEC3DigestUpdated(log types.Log) (*ContractNSEC3DigestUpdated, error) {
event := new(ContractNSEC3DigestUpdated)
if err := _Contract.contract.UnpackLog(event, "NSEC3DigestUpdated", log); err != nil {
return nil, err
}
return event, nil
}
// ContractRRSetUpdatedIterator is returned from FilterRRSetUpdated and is used to iterate over the raw logs and unpacked data for RRSetUpdated events raised by the Contract contract.
type ContractRRSetUpdatedIterator struct {
Event *ContractRRSetUpdated // Event containing the contract specifics and raw log
contract *bind.BoundContract // Generic contract to use for unpacking event data
event string // Event name to use for unpacking event data
logs chan types.Log // Log channel receiving the found contract events
sub ethereum.Subscription // Subscription for errors, completion and termination
done bool // Whether the subscription completed delivering logs
fail error // Occurred error to stop iteration
}
// Next advances the iterator to the subsequent event, returning whether there
// are any more events found. In case of a retrieval or parsing error, false is
// returned and Error() can be queried for the exact failure.
func (it *ContractRRSetUpdatedIterator) Next() bool {
// If the iterator failed, stop iterating
if it.fail != nil {
return false
}
// If the iterator completed, deliver directly whatever's available
if it.done {
select {
case log := <-it.logs:
it.Event = new(ContractRRSetUpdated)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
default:
return false
}
}
// Iterator still in progress, wait for either a data or an error event
select {
case log := <-it.logs:
it.Event = new(ContractRRSetUpdated)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
case err := <-it.sub.Err():
it.done = true
it.fail = err
return it.Next()
}
}
// Error returns any retrieval or parsing error occurred during filtering.
func (it *ContractRRSetUpdatedIterator) Error() error {
return it.fail
}
// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *ContractRRSetUpdatedIterator) Close() error {
it.sub.Unsubscribe()
return nil
}
// ContractRRSetUpdated represents a RRSetUpdated event raised by the Contract contract.
type ContractRRSetUpdated struct {
Name []byte
Rrset []byte
Raw types.Log // Blockchain specific contextual infos
}
// FilterRRSetUpdated is a free log retrieval operation binding the contract event 0x55ced933cdd5a34dd03eb5d4bef19ec6ebb251dcd7a988eee0c1b9a13baaa88b.
//
// Solidity: event RRSetUpdated(bytes name, bytes rrset)
func (_Contract *ContractFilterer) FilterRRSetUpdated(opts *bind.FilterOpts) (*ContractRRSetUpdatedIterator, error) {
logs, sub, err := _Contract.contract.FilterLogs(opts, "RRSetUpdated")
if err != nil {
return nil, err
}
return &ContractRRSetUpdatedIterator{contract: _Contract.contract, event: "RRSetUpdated", logs: logs, sub: sub}, nil
}
// WatchRRSetUpdated is a free log subscription operation binding the contract event 0x55ced933cdd5a34dd03eb5d4bef19ec6ebb251dcd7a988eee0c1b9a13baaa88b.
//
// Solidity: event RRSetUpdated(bytes name, bytes rrset)
func (_Contract *ContractFilterer) WatchRRSetUpdated(opts *bind.WatchOpts, sink chan<- *ContractRRSetUpdated) (event.Subscription, error) {
logs, sub, err := _Contract.contract.WatchLogs(opts, "RRSetUpdated")
if err != nil {
return nil, err
}
return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe()
for {
select {
case log := <-logs:
// New log arrived, parse the event and forward to the user
event := new(ContractRRSetUpdated)
if err := _Contract.contract.UnpackLog(event, "RRSetUpdated", log); err != nil {
return err
}
event.Raw = log
select {
case sink <- event:
case err := <-sub.Err():
return err
case <-quit:
return nil
}
case err := <-sub.Err():
return err
case <-quit:
return nil
}
}
}), nil
}
// ParseRRSetUpdated is a log parse operation binding the contract event 0x55ced933cdd5a34dd03eb5d4bef19ec6ebb251dcd7a988eee0c1b9a13baaa88b.
//
// Solidity: event RRSetUpdated(bytes name, bytes rrset)
func (_Contract *ContractFilterer) ParseRRSetUpdated(log types.Log) (*ContractRRSetUpdated, error) {
event := new(ContractRRSetUpdated)
if err := _Contract.contract.UnpackLog(event, "RRSetUpdated", log); err != nil {
return nil, err
}
return event, nil
}

View File

@@ -0,0 +1,3 @@
package dnssecoracle
//go:generate abigen -abi contract.abi -out contract.go -pkg dnssecoracle -type Contract

View File

@@ -0,0 +1,2 @@
[{"constant":true,"inputs":[{"name":"interfaceID","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_prices","type":"address"}],"name":"setPriceOracle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_minCommitmentAge","type":"uint256"},{"name":"_maxCommitmentAge","type":"uint256"}],"name":"setCommitmentAges","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"commitments","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"name","type":"string"},{"name":"duration","type":"uint256"}],"name":"rentPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"name","type":"string"},{"name":"owner","type":"address"},{"name":"duration","type":"uint256"},{"name":"secret","type":"bytes32"}],"name":"register","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"MIN_REGISTRATION_DURATION","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"minCommitmentAge","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"name","type":"string"}],"name":"valid","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"name","type":"string"},{"name":"duration","type":"uint256"}],"name":"renew","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"name","type":"string"}],"name":"available","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxCommitmentAge","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"commitment","type":"bytes32"}],"name":"commit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"name","type":"string"},{"name":"owner","type":"address"},{"name":"secret","type":"bytes32"}],"name":"makeCommitment","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"pure","type":"function"},{"inputs":[{"name":"_base","type":"address"},{"name":"_prices","type":"address"},{"name":"_minCommitmentAge","type":"uint256"},{"name":"_maxCommitmentAge","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"name","type":"string"},{"indexed":true,"name":"label","type":"bytes32"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"cost","type":"uint256"},{"indexed":false,"name":"expires","type":"uint256"}],"name":"NameRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"name","type":"string"},{"indexed":true,"name":"label","type":"bytes32"},{"indexed":false,"name":"cost","type":"uint256"},{"indexed":false,"name":"expires","type":"uint256"}],"name":"NameRenewed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"oracle","type":"address"}],"name":"NewPriceOracle","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
package ethcontroller
//go:generate abigen -abi contract.abi -out contract.go -pkg ethcontroller -type Contract

View File

@@ -0,0 +1 @@
[{"constant":true,"inputs":[{"name":"node","type":"bytes32"}],"name":"resolver","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"node","type":"bytes32"}],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"label","type":"bytes32"},{"name":"owner","type":"address"}],"name":"setSubnodeOwner","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"ttl","type":"uint64"}],"name":"setTTL","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"node","type":"bytes32"}],"name":"ttl","outputs":[{"name":"","type":"uint64"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"resolver","type":"address"}],"name":"setResolver","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"owner","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"type":"function"},{"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":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":"resolver","type":"address"}],"name":"NewResolver","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"node","type":"bytes32"},{"indexed":false,"name":"ttl","type":"uint64"}],"name":"NewTTL","type":"event"}]

View File

@@ -0,0 +1,934 @@
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package registry
import (
"math/big"
"strings"
ethereum "github.com/ethereum/go-ethereum"
"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"
"github.com/ethereum/go-ethereum/event"
)
// Reference imports to suppress errors if they are not otherwise used.
var (
_ = big.NewInt
_ = strings.NewReader
_ = ethereum.NotFound
_ = bind.Bind
_ = common.Big1
_ = types.BloomLookup
_ = event.NewSubscription
)
// ContractABI is the input ABI used to generate the binding from.
const ContractABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"resolver\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"label\",\"type\":\"bytes32\"},{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"setSubnodeOwner\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"ttl\",\"type\":\"uint64\"}],\"name\":\"setTTL\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"ttl\",\"outputs\":[{\"name\":\"\",\"type\":\"uint64\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"setResolver\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"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\":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\":\"resolver\",\"type\":\"address\"}],\"name\":\"NewResolver\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"ttl\",\"type\":\"uint64\"}],\"name\":\"NewTTL\",\"type\":\"event\"}]"
// Contract is an auto generated Go binding around an Ethereum contract.
type Contract struct {
ContractCaller // Read-only binding to the contract
ContractTransactor // Write-only binding to the contract
ContractFilterer // Log filterer for contract events
}
// ContractCaller is an auto generated read-only Go binding around an Ethereum contract.
type ContractCaller struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// ContractTransactor is an auto generated write-only Go binding around an Ethereum contract.
type ContractTransactor struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// ContractFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
type ContractFilterer struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// ContractSession is an auto generated Go binding around an Ethereum contract,
// with pre-set call and transact options.
type ContractSession struct {
Contract *Contract // 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
}
// ContractCallerSession is an auto generated read-only Go binding around an Ethereum contract,
// with pre-set call options.
type ContractCallerSession struct {
Contract *ContractCaller // Generic contract caller binding to set the session for
CallOpts bind.CallOpts // Call options to use throughout this session
}
// ContractTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
// with pre-set transact options.
type ContractTransactorSession struct {
Contract *ContractTransactor // Generic contract transactor binding to set the session for
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}
// ContractRaw is an auto generated low-level Go binding around an Ethereum contract.
type ContractRaw struct {
Contract *Contract // Generic contract binding to access the raw methods on
}
// ContractCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
type ContractCallerRaw struct {
Contract *ContractCaller // Generic read-only contract binding to access the raw methods on
}
// ContractTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
type ContractTransactorRaw struct {
Contract *ContractTransactor // Generic write-only contract binding to access the raw methods on
}
// NewContract creates a new instance of Contract, bound to a specific deployed contract.
func NewContract(address common.Address, backend bind.ContractBackend) (*Contract, error) {
contract, err := bindContract(address, backend, backend, backend)
if err != nil {
return nil, err
}
return &Contract{ContractCaller: ContractCaller{contract: contract}, ContractTransactor: ContractTransactor{contract: contract}, ContractFilterer: ContractFilterer{contract: contract}}, nil
}
// NewContractCaller creates a new read-only instance of Contract, bound to a specific deployed contract.
func NewContractCaller(address common.Address, caller bind.ContractCaller) (*ContractCaller, error) {
contract, err := bindContract(address, caller, nil, nil)
if err != nil {
return nil, err
}
return &ContractCaller{contract: contract}, nil
}
// NewContractTransactor creates a new write-only instance of Contract, bound to a specific deployed contract.
func NewContractTransactor(address common.Address, transactor bind.ContractTransactor) (*ContractTransactor, error) {
contract, err := bindContract(address, nil, transactor, nil)
if err != nil {
return nil, err
}
return &ContractTransactor{contract: contract}, nil
}
// NewContractFilterer creates a new log filterer instance of Contract, bound to a specific deployed contract.
func NewContractFilterer(address common.Address, filterer bind.ContractFilterer) (*ContractFilterer, error) {
contract, err := bindContract(address, nil, nil, filterer)
if err != nil {
return nil, err
}
return &ContractFilterer{contract: contract}, nil
}
// bindContract binds a generic wrapper to an already deployed contract.
func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
parsed, err := abi.JSON(strings.NewReader(ContractABI))
if err != nil {
return nil, err
}
return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
}
// Call invokes the (constant) contract method with params as input values and
// sets the output to result. The result type might be a single field for simple
// returns, a slice of interfaces for anonymous returns and a struct for named
// returns.
func (_Contract *ContractRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _Contract.Contract.ContractCaller.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 (_Contract *ContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _Contract.Contract.ContractTransactor.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_Contract *ContractRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _Contract.Contract.ContractTransactor.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 (_Contract *ContractCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _Contract.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 (_Contract *ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _Contract.Contract.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_Contract *ContractTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _Contract.Contract.contract.Transact(opts, method, params...)
}
// Owner is a free data retrieval call binding the contract method 0x02571be3.
//
// Solidity: function owner(bytes32 node) returns(address)
func (_Contract *ContractCaller) Owner(opts *bind.CallOpts, node [32]byte) (common.Address, error) {
var out []interface{}
err := _Contract.contract.Call(opts, &out, "owner", node)
if err != nil {
return *new(common.Address), err
}
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
return out0, err
}
// Owner is a free data retrieval call binding the contract method 0x02571be3.
//
// Solidity: function owner(bytes32 node) returns(address)
func (_Contract *ContractSession) Owner(node [32]byte) (common.Address, error) {
return _Contract.Contract.Owner(&_Contract.CallOpts, node)
}
// Owner is a free data retrieval call binding the contract method 0x02571be3.
//
// Solidity: function owner(bytes32 node) returns(address)
func (_Contract *ContractCallerSession) Owner(node [32]byte) (common.Address, error) {
return _Contract.Contract.Owner(&_Contract.CallOpts, node)
}
// Resolver is a free data retrieval call binding the contract method 0x0178b8bf.
//
// Solidity: function resolver(bytes32 node) returns(address)
func (_Contract *ContractCaller) Resolver(opts *bind.CallOpts, node [32]byte) (common.Address, error) {
var out []interface{}
err := _Contract.contract.Call(opts, &out, "resolver", node)
if err != nil {
return *new(common.Address), err
}
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
return out0, err
}
// Resolver is a free data retrieval call binding the contract method 0x0178b8bf.
//
// Solidity: function resolver(bytes32 node) returns(address)
func (_Contract *ContractSession) Resolver(node [32]byte) (common.Address, error) {
return _Contract.Contract.Resolver(&_Contract.CallOpts, node)
}
// Resolver is a free data retrieval call binding the contract method 0x0178b8bf.
//
// Solidity: function resolver(bytes32 node) returns(address)
func (_Contract *ContractCallerSession) Resolver(node [32]byte) (common.Address, error) {
return _Contract.Contract.Resolver(&_Contract.CallOpts, node)
}
// Ttl is a free data retrieval call binding the contract method 0x16a25cbd.
//
// Solidity: function ttl(bytes32 node) returns(uint64)
func (_Contract *ContractCaller) Ttl(opts *bind.CallOpts, node [32]byte) (uint64, error) {
var out []interface{}
err := _Contract.contract.Call(opts, &out, "ttl", node)
if err != nil {
return *new(uint64), err
}
out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64)
return out0, err
}
// Ttl is a free data retrieval call binding the contract method 0x16a25cbd.
//
// Solidity: function ttl(bytes32 node) returns(uint64)
func (_Contract *ContractSession) Ttl(node [32]byte) (uint64, error) {
return _Contract.Contract.Ttl(&_Contract.CallOpts, node)
}
// Ttl is a free data retrieval call binding the contract method 0x16a25cbd.
//
// Solidity: function ttl(bytes32 node) returns(uint64)
func (_Contract *ContractCallerSession) Ttl(node [32]byte) (uint64, error) {
return _Contract.Contract.Ttl(&_Contract.CallOpts, node)
}
// SetOwner is a paid mutator transaction binding the contract method 0x5b0fc9c3.
//
// Solidity: function setOwner(bytes32 node, address owner) returns()
func (_Contract *ContractTransactor) SetOwner(opts *bind.TransactOpts, node [32]byte, owner common.Address) (*types.Transaction, error) {
return _Contract.contract.Transact(opts, "setOwner", node, owner)
}
// SetOwner is a paid mutator transaction binding the contract method 0x5b0fc9c3.
//
// Solidity: function setOwner(bytes32 node, address owner) returns()
func (_Contract *ContractSession) SetOwner(node [32]byte, owner common.Address) (*types.Transaction, error) {
return _Contract.Contract.SetOwner(&_Contract.TransactOpts, node, owner)
}
// SetOwner is a paid mutator transaction binding the contract method 0x5b0fc9c3.
//
// Solidity: function setOwner(bytes32 node, address owner) returns()
func (_Contract *ContractTransactorSession) SetOwner(node [32]byte, owner common.Address) (*types.Transaction, error) {
return _Contract.Contract.SetOwner(&_Contract.TransactOpts, node, owner)
}
// SetResolver is a paid mutator transaction binding the contract method 0x1896f70a.
//
// Solidity: function setResolver(bytes32 node, address resolver) returns()
func (_Contract *ContractTransactor) SetResolver(opts *bind.TransactOpts, node [32]byte, resolver common.Address) (*types.Transaction, error) {
return _Contract.contract.Transact(opts, "setResolver", node, resolver)
}
// SetResolver is a paid mutator transaction binding the contract method 0x1896f70a.
//
// Solidity: function setResolver(bytes32 node, address resolver) returns()
func (_Contract *ContractSession) SetResolver(node [32]byte, resolver common.Address) (*types.Transaction, error) {
return _Contract.Contract.SetResolver(&_Contract.TransactOpts, node, resolver)
}
// SetResolver is a paid mutator transaction binding the contract method 0x1896f70a.
//
// Solidity: function setResolver(bytes32 node, address resolver) returns()
func (_Contract *ContractTransactorSession) SetResolver(node [32]byte, resolver common.Address) (*types.Transaction, error) {
return _Contract.Contract.SetResolver(&_Contract.TransactOpts, node, resolver)
}
// SetSubnodeOwner is a paid mutator transaction binding the contract method 0x06ab5923.
//
// Solidity: function setSubnodeOwner(bytes32 node, bytes32 label, address owner) returns()
func (_Contract *ContractTransactor) SetSubnodeOwner(opts *bind.TransactOpts, node [32]byte, label [32]byte, owner common.Address) (*types.Transaction, error) {
return _Contract.contract.Transact(opts, "setSubnodeOwner", node, label, owner)
}
// SetSubnodeOwner is a paid mutator transaction binding the contract method 0x06ab5923.
//
// Solidity: function setSubnodeOwner(bytes32 node, bytes32 label, address owner) returns()
func (_Contract *ContractSession) SetSubnodeOwner(node [32]byte, label [32]byte, owner common.Address) (*types.Transaction, error) {
return _Contract.Contract.SetSubnodeOwner(&_Contract.TransactOpts, node, label, owner)
}
// SetSubnodeOwner is a paid mutator transaction binding the contract method 0x06ab5923.
//
// Solidity: function setSubnodeOwner(bytes32 node, bytes32 label, address owner) returns()
func (_Contract *ContractTransactorSession) SetSubnodeOwner(node [32]byte, label [32]byte, owner common.Address) (*types.Transaction, error) {
return _Contract.Contract.SetSubnodeOwner(&_Contract.TransactOpts, node, label, owner)
}
// SetTTL is a paid mutator transaction binding the contract method 0x14ab9038.
//
// Solidity: function setTTL(bytes32 node, uint64 ttl) returns()
func (_Contract *ContractTransactor) SetTTL(opts *bind.TransactOpts, node [32]byte, ttl uint64) (*types.Transaction, error) {
return _Contract.contract.Transact(opts, "setTTL", node, ttl)
}
// SetTTL is a paid mutator transaction binding the contract method 0x14ab9038.
//
// Solidity: function setTTL(bytes32 node, uint64 ttl) returns()
func (_Contract *ContractSession) SetTTL(node [32]byte, ttl uint64) (*types.Transaction, error) {
return _Contract.Contract.SetTTL(&_Contract.TransactOpts, node, ttl)
}
// SetTTL is a paid mutator transaction binding the contract method 0x14ab9038.
//
// Solidity: function setTTL(bytes32 node, uint64 ttl) returns()
func (_Contract *ContractTransactorSession) SetTTL(node [32]byte, ttl uint64) (*types.Transaction, error) {
return _Contract.Contract.SetTTL(&_Contract.TransactOpts, node, ttl)
}
// ContractNewOwnerIterator is returned from FilterNewOwner and is used to iterate over the raw logs and unpacked data for NewOwner events raised by the Contract contract.
type ContractNewOwnerIterator struct {
Event *ContractNewOwner // Event containing the contract specifics and raw log
contract *bind.BoundContract // Generic contract to use for unpacking event data
event string // Event name to use for unpacking event data
logs chan types.Log // Log channel receiving the found contract events
sub ethereum.Subscription // Subscription for errors, completion and termination
done bool // Whether the subscription completed delivering logs
fail error // Occurred error to stop iteration
}
// Next advances the iterator to the subsequent event, returning whether there
// are any more events found. In case of a retrieval or parsing error, false is
// returned and Error() can be queried for the exact failure.
func (it *ContractNewOwnerIterator) Next() bool {
// If the iterator failed, stop iterating
if it.fail != nil {
return false
}
// If the iterator completed, deliver directly whatever's available
if it.done {
select {
case log := <-it.logs:
it.Event = new(ContractNewOwner)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
default:
return false
}
}
// Iterator still in progress, wait for either a data or an error event
select {
case log := <-it.logs:
it.Event = new(ContractNewOwner)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
case err := <-it.sub.Err():
it.done = true
it.fail = err
return it.Next()
}
}
// Error returns any retrieval or parsing error occurred during filtering.
func (it *ContractNewOwnerIterator) Error() error {
return it.fail
}
// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *ContractNewOwnerIterator) Close() error {
it.sub.Unsubscribe()
return nil
}
// ContractNewOwner represents a NewOwner event raised by the Contract contract.
type ContractNewOwner struct {
Node [32]byte
Label [32]byte
Owner common.Address
Raw types.Log // Blockchain specific contextual infos
}
// FilterNewOwner is a free log retrieval operation binding the contract event 0xce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82.
//
// Solidity: event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner)
func (_Contract *ContractFilterer) FilterNewOwner(opts *bind.FilterOpts, node [][32]byte, label [][32]byte) (*ContractNewOwnerIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
}
var labelRule []interface{}
for _, labelItem := range label {
labelRule = append(labelRule, labelItem)
}
logs, sub, err := _Contract.contract.FilterLogs(opts, "NewOwner", nodeRule, labelRule)
if err != nil {
return nil, err
}
return &ContractNewOwnerIterator{contract: _Contract.contract, event: "NewOwner", logs: logs, sub: sub}, nil
}
// WatchNewOwner is a free log subscription operation binding the contract event 0xce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82.
//
// Solidity: event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner)
func (_Contract *ContractFilterer) WatchNewOwner(opts *bind.WatchOpts, sink chan<- *ContractNewOwner, node [][32]byte, label [][32]byte) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
}
var labelRule []interface{}
for _, labelItem := range label {
labelRule = append(labelRule, labelItem)
}
logs, sub, err := _Contract.contract.WatchLogs(opts, "NewOwner", nodeRule, labelRule)
if err != nil {
return nil, err
}
return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe()
for {
select {
case log := <-logs:
// New log arrived, parse the event and forward to the user
event := new(ContractNewOwner)
if err := _Contract.contract.UnpackLog(event, "NewOwner", log); err != nil {
return err
}
event.Raw = log
select {
case sink <- event:
case err := <-sub.Err():
return err
case <-quit:
return nil
}
case err := <-sub.Err():
return err
case <-quit:
return nil
}
}
}), nil
}
// ParseNewOwner is a log parse operation binding the contract event 0xce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82.
//
// Solidity: event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner)
func (_Contract *ContractFilterer) ParseNewOwner(log types.Log) (*ContractNewOwner, error) {
event := new(ContractNewOwner)
if err := _Contract.contract.UnpackLog(event, "NewOwner", log); err != nil {
return nil, err
}
return event, nil
}
// ContractNewResolverIterator is returned from FilterNewResolver and is used to iterate over the raw logs and unpacked data for NewResolver events raised by the Contract contract.
type ContractNewResolverIterator struct {
Event *ContractNewResolver // Event containing the contract specifics and raw log
contract *bind.BoundContract // Generic contract to use for unpacking event data
event string // Event name to use for unpacking event data
logs chan types.Log // Log channel receiving the found contract events
sub ethereum.Subscription // Subscription for errors, completion and termination
done bool // Whether the subscription completed delivering logs
fail error // Occurred error to stop iteration
}
// Next advances the iterator to the subsequent event, returning whether there
// are any more events found. In case of a retrieval or parsing error, false is
// returned and Error() can be queried for the exact failure.
func (it *ContractNewResolverIterator) Next() bool {
// If the iterator failed, stop iterating
if it.fail != nil {
return false
}
// If the iterator completed, deliver directly whatever's available
if it.done {
select {
case log := <-it.logs:
it.Event = new(ContractNewResolver)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
default:
return false
}
}
// Iterator still in progress, wait for either a data or an error event
select {
case log := <-it.logs:
it.Event = new(ContractNewResolver)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
case err := <-it.sub.Err():
it.done = true
it.fail = err
return it.Next()
}
}
// Error returns any retrieval or parsing error occurred during filtering.
func (it *ContractNewResolverIterator) Error() error {
return it.fail
}
// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *ContractNewResolverIterator) Close() error {
it.sub.Unsubscribe()
return nil
}
// ContractNewResolver represents a NewResolver event raised by the Contract contract.
type ContractNewResolver struct {
Node [32]byte
Resolver common.Address
Raw types.Log // Blockchain specific contextual infos
}
// FilterNewResolver is a free log retrieval operation binding the contract event 0x335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a0.
//
// Solidity: event NewResolver(bytes32 indexed node, address resolver)
func (_Contract *ContractFilterer) FilterNewResolver(opts *bind.FilterOpts, node [][32]byte) (*ContractNewResolverIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
}
logs, sub, err := _Contract.contract.FilterLogs(opts, "NewResolver", nodeRule)
if err != nil {
return nil, err
}
return &ContractNewResolverIterator{contract: _Contract.contract, event: "NewResolver", logs: logs, sub: sub}, nil
}
// WatchNewResolver is a free log subscription operation binding the contract event 0x335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a0.
//
// Solidity: event NewResolver(bytes32 indexed node, address resolver)
func (_Contract *ContractFilterer) WatchNewResolver(opts *bind.WatchOpts, sink chan<- *ContractNewResolver, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
}
logs, sub, err := _Contract.contract.WatchLogs(opts, "NewResolver", nodeRule)
if err != nil {
return nil, err
}
return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe()
for {
select {
case log := <-logs:
// New log arrived, parse the event and forward to the user
event := new(ContractNewResolver)
if err := _Contract.contract.UnpackLog(event, "NewResolver", log); err != nil {
return err
}
event.Raw = log
select {
case sink <- event:
case err := <-sub.Err():
return err
case <-quit:
return nil
}
case err := <-sub.Err():
return err
case <-quit:
return nil
}
}
}), nil
}
// ParseNewResolver is a log parse operation binding the contract event 0x335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a0.
//
// Solidity: event NewResolver(bytes32 indexed node, address resolver)
func (_Contract *ContractFilterer) ParseNewResolver(log types.Log) (*ContractNewResolver, error) {
event := new(ContractNewResolver)
if err := _Contract.contract.UnpackLog(event, "NewResolver", log); err != nil {
return nil, err
}
return event, nil
}
// ContractNewTTLIterator is returned from FilterNewTTL and is used to iterate over the raw logs and unpacked data for NewTTL events raised by the Contract contract.
type ContractNewTTLIterator struct {
Event *ContractNewTTL // Event containing the contract specifics and raw log
contract *bind.BoundContract // Generic contract to use for unpacking event data
event string // Event name to use for unpacking event data
logs chan types.Log // Log channel receiving the found contract events
sub ethereum.Subscription // Subscription for errors, completion and termination
done bool // Whether the subscription completed delivering logs
fail error // Occurred error to stop iteration
}
// Next advances the iterator to the subsequent event, returning whether there
// are any more events found. In case of a retrieval or parsing error, false is
// returned and Error() can be queried for the exact failure.
func (it *ContractNewTTLIterator) Next() bool {
// If the iterator failed, stop iterating
if it.fail != nil {
return false
}
// If the iterator completed, deliver directly whatever's available
if it.done {
select {
case log := <-it.logs:
it.Event = new(ContractNewTTL)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
default:
return false
}
}
// Iterator still in progress, wait for either a data or an error event
select {
case log := <-it.logs:
it.Event = new(ContractNewTTL)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
case err := <-it.sub.Err():
it.done = true
it.fail = err
return it.Next()
}
}
// Error returns any retrieval or parsing error occurred during filtering.
func (it *ContractNewTTLIterator) Error() error {
return it.fail
}
// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *ContractNewTTLIterator) Close() error {
it.sub.Unsubscribe()
return nil
}
// ContractNewTTL represents a NewTTL event raised by the Contract contract.
type ContractNewTTL struct {
Node [32]byte
Ttl uint64
Raw types.Log // Blockchain specific contextual infos
}
// FilterNewTTL is a free log retrieval operation binding the contract event 0x1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa68.
//
// Solidity: event NewTTL(bytes32 indexed node, uint64 ttl)
func (_Contract *ContractFilterer) FilterNewTTL(opts *bind.FilterOpts, node [][32]byte) (*ContractNewTTLIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
}
logs, sub, err := _Contract.contract.FilterLogs(opts, "NewTTL", nodeRule)
if err != nil {
return nil, err
}
return &ContractNewTTLIterator{contract: _Contract.contract, event: "NewTTL", logs: logs, sub: sub}, nil
}
// WatchNewTTL is a free log subscription operation binding the contract event 0x1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa68.
//
// Solidity: event NewTTL(bytes32 indexed node, uint64 ttl)
func (_Contract *ContractFilterer) WatchNewTTL(opts *bind.WatchOpts, sink chan<- *ContractNewTTL, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
}
logs, sub, err := _Contract.contract.WatchLogs(opts, "NewTTL", nodeRule)
if err != nil {
return nil, err
}
return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe()
for {
select {
case log := <-logs:
// New log arrived, parse the event and forward to the user
event := new(ContractNewTTL)
if err := _Contract.contract.UnpackLog(event, "NewTTL", log); err != nil {
return err
}
event.Raw = log
select {
case sink <- event:
case err := <-sub.Err():
return err
case <-quit:
return nil
}
case err := <-sub.Err():
return err
case <-quit:
return nil
}
}
}), nil
}
// ParseNewTTL is a log parse operation binding the contract event 0x1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa68.
//
// Solidity: event NewTTL(bytes32 indexed node, uint64 ttl)
func (_Contract *ContractFilterer) ParseNewTTL(log types.Log) (*ContractNewTTL, error) {
event := new(ContractNewTTL)
if err := _Contract.contract.UnpackLog(event, "NewTTL", log); err != nil {
return nil, err
}
return event, nil
}
// ContractTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the Contract contract.
type ContractTransferIterator struct {
Event *ContractTransfer // Event containing the contract specifics and raw log
contract *bind.BoundContract // Generic contract to use for unpacking event data
event string // Event name to use for unpacking event data
logs chan types.Log // Log channel receiving the found contract events
sub ethereum.Subscription // Subscription for errors, completion and termination
done bool // Whether the subscription completed delivering logs
fail error // Occurred error to stop iteration
}
// Next advances the iterator to the subsequent event, returning whether there
// are any more events found. In case of a retrieval or parsing error, false is
// returned and Error() can be queried for the exact failure.
func (it *ContractTransferIterator) Next() bool {
// If the iterator failed, stop iterating
if it.fail != nil {
return false
}
// If the iterator completed, deliver directly whatever's available
if it.done {
select {
case log := <-it.logs:
it.Event = new(ContractTransfer)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
default:
return false
}
}
// Iterator still in progress, wait for either a data or an error event
select {
case log := <-it.logs:
it.Event = new(ContractTransfer)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
case err := <-it.sub.Err():
it.done = true
it.fail = err
return it.Next()
}
}
// Error returns any retrieval or parsing error occurred during filtering.
func (it *ContractTransferIterator) Error() error {
return it.fail
}
// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *ContractTransferIterator) Close() error {
it.sub.Unsubscribe()
return nil
}
// ContractTransfer represents a Transfer event raised by the Contract contract.
type ContractTransfer struct {
Node [32]byte
Owner common.Address
Raw types.Log // Blockchain specific contextual infos
}
// FilterTransfer is a free log retrieval operation binding the contract event 0xd4735d920b0f87494915f556dd9b54c8f309026070caea5c737245152564d266.
//
// Solidity: event Transfer(bytes32 indexed node, address owner)
func (_Contract *ContractFilterer) FilterTransfer(opts *bind.FilterOpts, node [][32]byte) (*ContractTransferIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
}
logs, sub, err := _Contract.contract.FilterLogs(opts, "Transfer", nodeRule)
if err != nil {
return nil, err
}
return &ContractTransferIterator{contract: _Contract.contract, event: "Transfer", logs: logs, sub: sub}, nil
}
// WatchTransfer is a free log subscription operation binding the contract event 0xd4735d920b0f87494915f556dd9b54c8f309026070caea5c737245152564d266.
//
// Solidity: event Transfer(bytes32 indexed node, address owner)
func (_Contract *ContractFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ContractTransfer, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
}
logs, sub, err := _Contract.contract.WatchLogs(opts, "Transfer", nodeRule)
if err != nil {
return nil, err
}
return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe()
for {
select {
case log := <-logs:
// New log arrived, parse the event and forward to the user
event := new(ContractTransfer)
if err := _Contract.contract.UnpackLog(event, "Transfer", log); err != nil {
return err
}
event.Raw = log
select {
case sink <- event:
case err := <-sub.Err():
return err
case <-quit:
return nil
}
case err := <-sub.Err():
return err
case <-quit:
return nil
}
}
}), nil
}
// ParseTransfer is a log parse operation binding the contract event 0xd4735d920b0f87494915f556dd9b54c8f309026070caea5c737245152564d266.
//
// Solidity: event Transfer(bytes32 indexed node, address owner)
func (_Contract *ContractFilterer) ParseTransfer(log types.Log) (*ContractTransfer, error) {
event := new(ContractTransfer)
if err := _Contract.contract.UnpackLog(event, "Transfer", log); err != nil {
return nil, err
}
return event, nil
}

View File

@@ -0,0 +1,3 @@
package registry
//go:generate abigen -abi contract.abi -out contract.go -pkg registry -type Contract

View File

@@ -0,0 +1,842 @@
[
{
"constant": true,
"inputs": [
{
"internalType": "bytes4",
"name": "interfaceID",
"type": "bytes4"
}
],
"name": "supportsInterface",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "pure",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "setDNSRecords",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "string",
"name": "key",
"type": "string"
},
{
"internalType": "string",
"name": "value",
"type": "string"
}
],
"name": "setText",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "bytes4",
"name": "interfaceID",
"type": "bytes4"
}
],
"name": "interfaceImplementer",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "contentTypes",
"type": "uint256"
}
],
"name": "ABI",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "x",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "y",
"type": "bytes32"
}
],
"name": "setPubkey",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "bytes",
"name": "hash",
"type": "bytes"
}
],
"name": "setContenthash",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
}
],
"name": "addr",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "address",
"name": "target",
"type": "address"
},
{
"internalType": "bool",
"name": "isAuthorised",
"type": "bool"
}
],
"name": "setAuthorisation",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "name",
"type": "bytes32"
}
],
"name": "hasDNSRecords",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "string",
"name": "key",
"type": "string"
}
],
"name": "text",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "contentType",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "setABI",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
}
],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "string",
"name": "name",
"type": "string"
}
],
"name": "setName",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "address",
"name": "a",
"type": "address"
}
],
"name": "setAddr",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "coinType",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "a",
"type": "bytes"
}
],
"name": "setAddr",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "name",
"type": "bytes32"
},
{
"internalType": "uint16",
"name": "resource",
"type": "uint16"
}
],
"name": "dnsRecord",
"outputs": [
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
}
],
"name": "clearDNSZone",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
}
],
"name": "contenthash",
"outputs": [
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
}
],
"name": "pubkey",
"outputs": [
{
"internalType": "bytes32",
"name": "x",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "y",
"type": "bytes32"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "bytes4",
"name": "interfaceID",
"type": "bytes4"
},
{
"internalType": "address",
"name": "implementer",
"type": "address"
}
],
"name": "setInterface",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "coinType",
"type": "uint256"
}
],
"name": "addr",
"outputs": [
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
},
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "authorisations",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract ENS",
"name": "_ens",
"type": "address"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "target",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "isAuthorised",
"type": "bool"
}
],
"name": "AuthorisationChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "string",
"name": "indexedKey",
"type": "string"
},
{
"indexed": false,
"internalType": "string",
"name": "key",
"type": "string"
}
],
"name": "TextChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "x",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "y",
"type": "bytes32"
}
],
"name": "PubkeyChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "string",
"name": "name",
"type": "string"
}
],
"name": "NameChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes4",
"name": "interfaceID",
"type": "bytes4"
},
{
"indexed": false,
"internalType": "address",
"name": "implementer",
"type": "address"
}
],
"name": "InterfaceChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "bytes",
"name": "name",
"type": "bytes"
},
{
"indexed": false,
"internalType": "uint16",
"name": "resource",
"type": "uint16"
},
{
"indexed": false,
"internalType": "bytes",
"name": "record",
"type": "bytes"
}
],
"name": "DNSRecordChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "bytes",
"name": "name",
"type": "bytes"
},
{
"indexed": false,
"internalType": "uint16",
"name": "resource",
"type": "uint16"
}
],
"name": "DNSRecordDeleted",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
}
],
"name": "DNSZoneCleared",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "bytes",
"name": "hash",
"type": "bytes"
}
],
"name": "ContenthashChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "address",
"name": "a",
"type": "address"
}
],
"name": "AddrChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "uint256",
"name": "coinType",
"type": "uint256"
},
{
"indexed": false,
"internalType": "bytes",
"name": "newAddress",
"type": "bytes"
}
],
"name": "AddressChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "uint256",
"name": "contentType",
"type": "uint256"
}
],
"name": "ABIChanged",
"type": "event"
}
]

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
package resolver
//go:generate abigen -abi contract.abi -out contract.go -pkg resolver -type Contract

View File

@@ -0,0 +1 @@
[{"constant":false,"inputs":[{"name":"owner","type":"address"},{"name":"resolver","type":"address"}],"name":"claimWithResolver","outputs":[{"name":"node","type":"bytes32"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"owner","type":"address"}],"name":"claim","outputs":[{"name":"node","type":"bytes32"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"ens","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"defaultResolver","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"addr","type":"address"}],"name":"node","outputs":[{"name":"ret","type":"bytes32"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"name","type":"string"}],"name":"setName","outputs":[{"name":"node","type":"bytes32"}],"payable":false,"type":"function"},{"inputs":[{"name":"ensAddr","type":"address"},{"name":"resolverAddr","type":"address"}],"payable":false,"type":"constructor"}]

View File

@@ -0,0 +1,328 @@
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package reverseregistrar
import (
"math/big"
"strings"
ethereum "github.com/ethereum/go-ethereum"
"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"
"github.com/ethereum/go-ethereum/event"
)
// Reference imports to suppress errors if they are not otherwise used.
var (
_ = big.NewInt
_ = strings.NewReader
_ = ethereum.NotFound
_ = bind.Bind
_ = common.Big1
_ = types.BloomLookup
_ = event.NewSubscription
)
// ContractABI is the input ABI used to generate the binding from.
const ContractABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"claimWithResolver\",\"outputs\":[{\"name\":\"node\",\"type\":\"bytes32\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[{\"name\":\"node\",\"type\":\"bytes32\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"defaultResolver\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"node\",\"outputs\":[{\"name\":\"ret\",\"type\":\"bytes32\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"name\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[{\"name\":\"node\",\"type\":\"bytes32\"}],\"payable\":false,\"type\":\"function\"},{\"inputs\":[{\"name\":\"ensAddr\",\"type\":\"address\"},{\"name\":\"resolverAddr\",\"type\":\"address\"}],\"payable\":false,\"type\":\"constructor\"}]"
// Contract is an auto generated Go binding around an Ethereum contract.
type Contract struct {
ContractCaller // Read-only binding to the contract
ContractTransactor // Write-only binding to the contract
ContractFilterer // Log filterer for contract events
}
// ContractCaller is an auto generated read-only Go binding around an Ethereum contract.
type ContractCaller struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// ContractTransactor is an auto generated write-only Go binding around an Ethereum contract.
type ContractTransactor struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// ContractFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
type ContractFilterer struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// ContractSession is an auto generated Go binding around an Ethereum contract,
// with pre-set call and transact options.
type ContractSession struct {
Contract *Contract // 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
}
// ContractCallerSession is an auto generated read-only Go binding around an Ethereum contract,
// with pre-set call options.
type ContractCallerSession struct {
Contract *ContractCaller // Generic contract caller binding to set the session for
CallOpts bind.CallOpts // Call options to use throughout this session
}
// ContractTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
// with pre-set transact options.
type ContractTransactorSession struct {
Contract *ContractTransactor // Generic contract transactor binding to set the session for
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}
// ContractRaw is an auto generated low-level Go binding around an Ethereum contract.
type ContractRaw struct {
Contract *Contract // Generic contract binding to access the raw methods on
}
// ContractCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
type ContractCallerRaw struct {
Contract *ContractCaller // Generic read-only contract binding to access the raw methods on
}
// ContractTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
type ContractTransactorRaw struct {
Contract *ContractTransactor // Generic write-only contract binding to access the raw methods on
}
// NewContract creates a new instance of Contract, bound to a specific deployed contract.
func NewContract(address common.Address, backend bind.ContractBackend) (*Contract, error) {
contract, err := bindContract(address, backend, backend, backend)
if err != nil {
return nil, err
}
return &Contract{ContractCaller: ContractCaller{contract: contract}, ContractTransactor: ContractTransactor{contract: contract}, ContractFilterer: ContractFilterer{contract: contract}}, nil
}
// NewContractCaller creates a new read-only instance of Contract, bound to a specific deployed contract.
func NewContractCaller(address common.Address, caller bind.ContractCaller) (*ContractCaller, error) {
contract, err := bindContract(address, caller, nil, nil)
if err != nil {
return nil, err
}
return &ContractCaller{contract: contract}, nil
}
// NewContractTransactor creates a new write-only instance of Contract, bound to a specific deployed contract.
func NewContractTransactor(address common.Address, transactor bind.ContractTransactor) (*ContractTransactor, error) {
contract, err := bindContract(address, nil, transactor, nil)
if err != nil {
return nil, err
}
return &ContractTransactor{contract: contract}, nil
}
// NewContractFilterer creates a new log filterer instance of Contract, bound to a specific deployed contract.
func NewContractFilterer(address common.Address, filterer bind.ContractFilterer) (*ContractFilterer, error) {
contract, err := bindContract(address, nil, nil, filterer)
if err != nil {
return nil, err
}
return &ContractFilterer{contract: contract}, nil
}
// bindContract binds a generic wrapper to an already deployed contract.
func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
parsed, err := abi.JSON(strings.NewReader(ContractABI))
if err != nil {
return nil, err
}
return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
}
// Call invokes the (constant) contract method with params as input values and
// sets the output to result. The result type might be a single field for simple
// returns, a slice of interfaces for anonymous returns and a struct for named
// returns.
func (_Contract *ContractRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _Contract.Contract.ContractCaller.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 (_Contract *ContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _Contract.Contract.ContractTransactor.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_Contract *ContractRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _Contract.Contract.ContractTransactor.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 (_Contract *ContractCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _Contract.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 (_Contract *ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _Contract.Contract.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_Contract *ContractTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _Contract.Contract.contract.Transact(opts, method, params...)
}
// DefaultResolver is a free data retrieval call binding the contract method 0x828eab0e.
//
// Solidity: function defaultResolver() returns(address)
func (_Contract *ContractCaller) DefaultResolver(opts *bind.CallOpts) (common.Address, error) {
var out []interface{}
err := _Contract.contract.Call(opts, &out, "defaultResolver")
if err != nil {
return *new(common.Address), err
}
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
return out0, err
}
// DefaultResolver is a free data retrieval call binding the contract method 0x828eab0e.
//
// Solidity: function defaultResolver() returns(address)
func (_Contract *ContractSession) DefaultResolver() (common.Address, error) {
return _Contract.Contract.DefaultResolver(&_Contract.CallOpts)
}
// DefaultResolver is a free data retrieval call binding the contract method 0x828eab0e.
//
// Solidity: function defaultResolver() returns(address)
func (_Contract *ContractCallerSession) DefaultResolver() (common.Address, error) {
return _Contract.Contract.DefaultResolver(&_Contract.CallOpts)
}
// Ens is a free data retrieval call binding the contract method 0x3f15457f.
//
// Solidity: function ens() returns(address)
func (_Contract *ContractCaller) Ens(opts *bind.CallOpts) (common.Address, error) {
var out []interface{}
err := _Contract.contract.Call(opts, &out, "ens")
if err != nil {
return *new(common.Address), err
}
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
return out0, err
}
// Ens is a free data retrieval call binding the contract method 0x3f15457f.
//
// Solidity: function ens() returns(address)
func (_Contract *ContractSession) Ens() (common.Address, error) {
return _Contract.Contract.Ens(&_Contract.CallOpts)
}
// Ens is a free data retrieval call binding the contract method 0x3f15457f.
//
// Solidity: function ens() returns(address)
func (_Contract *ContractCallerSession) Ens() (common.Address, error) {
return _Contract.Contract.Ens(&_Contract.CallOpts)
}
// Node is a free data retrieval call binding the contract method 0xbffbe61c.
//
// Solidity: function node(address addr) returns(bytes32 ret)
func (_Contract *ContractCaller) Node(opts *bind.CallOpts, addr common.Address) ([32]byte, error) {
var out []interface{}
err := _Contract.contract.Call(opts, &out, "node", addr)
if err != nil {
return *new([32]byte), err
}
out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte)
return out0, err
}
// Node is a free data retrieval call binding the contract method 0xbffbe61c.
//
// Solidity: function node(address addr) returns(bytes32 ret)
func (_Contract *ContractSession) Node(addr common.Address) ([32]byte, error) {
return _Contract.Contract.Node(&_Contract.CallOpts, addr)
}
// Node is a free data retrieval call binding the contract method 0xbffbe61c.
//
// Solidity: function node(address addr) returns(bytes32 ret)
func (_Contract *ContractCallerSession) Node(addr common.Address) ([32]byte, error) {
return _Contract.Contract.Node(&_Contract.CallOpts, addr)
}
// Claim is a paid mutator transaction binding the contract method 0x1e83409a.
//
// Solidity: function claim(address owner) returns(bytes32 node)
func (_Contract *ContractTransactor) Claim(opts *bind.TransactOpts, owner common.Address) (*types.Transaction, error) {
return _Contract.contract.Transact(opts, "claim", owner)
}
// Claim is a paid mutator transaction binding the contract method 0x1e83409a.
//
// Solidity: function claim(address owner) returns(bytes32 node)
func (_Contract *ContractSession) Claim(owner common.Address) (*types.Transaction, error) {
return _Contract.Contract.Claim(&_Contract.TransactOpts, owner)
}
// Claim is a paid mutator transaction binding the contract method 0x1e83409a.
//
// Solidity: function claim(address owner) returns(bytes32 node)
func (_Contract *ContractTransactorSession) Claim(owner common.Address) (*types.Transaction, error) {
return _Contract.Contract.Claim(&_Contract.TransactOpts, owner)
}
// ClaimWithResolver is a paid mutator transaction binding the contract method 0x0f5a5466.
//
// Solidity: function claimWithResolver(address owner, address resolver) returns(bytes32 node)
func (_Contract *ContractTransactor) ClaimWithResolver(opts *bind.TransactOpts, owner common.Address, resolver common.Address) (*types.Transaction, error) {
return _Contract.contract.Transact(opts, "claimWithResolver", owner, resolver)
}
// ClaimWithResolver is a paid mutator transaction binding the contract method 0x0f5a5466.
//
// Solidity: function claimWithResolver(address owner, address resolver) returns(bytes32 node)
func (_Contract *ContractSession) ClaimWithResolver(owner common.Address, resolver common.Address) (*types.Transaction, error) {
return _Contract.Contract.ClaimWithResolver(&_Contract.TransactOpts, owner, resolver)
}
// ClaimWithResolver is a paid mutator transaction binding the contract method 0x0f5a5466.
//
// Solidity: function claimWithResolver(address owner, address resolver) returns(bytes32 node)
func (_Contract *ContractTransactorSession) ClaimWithResolver(owner common.Address, resolver common.Address) (*types.Transaction, error) {
return _Contract.Contract.ClaimWithResolver(&_Contract.TransactOpts, owner, resolver)
}
// SetName is a paid mutator transaction binding the contract method 0xc47f0027.
//
// Solidity: function setName(string name) returns(bytes32 node)
func (_Contract *ContractTransactor) SetName(opts *bind.TransactOpts, name string) (*types.Transaction, error) {
return _Contract.contract.Transact(opts, "setName", name)
}
// SetName is a paid mutator transaction binding the contract method 0xc47f0027.
//
// Solidity: function setName(string name) returns(bytes32 node)
func (_Contract *ContractSession) SetName(name string) (*types.Transaction, error) {
return _Contract.Contract.SetName(&_Contract.TransactOpts, name)
}
// SetName is a paid mutator transaction binding the contract method 0xc47f0027.
//
// Solidity: function setName(string name) returns(bytes32 node)
func (_Contract *ContractTransactorSession) SetName(name string) (*types.Transaction, error) {
return _Contract.Contract.SetName(&_Contract.TransactOpts, name)
}

View File

@@ -0,0 +1,3 @@
package reverseregistrar
//go:generate abigen -abi contract.abi -out contract.go -pkg reverseregistrar -type Contract

View File

@@ -0,0 +1 @@
[{"constant":true,"inputs":[],"name":"ens","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"_name","type":"string"}],"name":"setName","outputs":[],"payable":false,"type":"function"},{"inputs":[{"name":"ensAddr","type":"address"}],"payable":false,"type":"constructor"}]

View File

@@ -0,0 +1,255 @@
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package reverseresolver
import (
"math/big"
"strings"
ethereum "github.com/ethereum/go-ethereum"
"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"
"github.com/ethereum/go-ethereum/event"
)
// Reference imports to suppress errors if they are not otherwise used.
var (
_ = big.NewInt
_ = strings.NewReader
_ = ethereum.NotFound
_ = bind.Bind
_ = common.Big1
_ = types.BloomLookup
_ = event.NewSubscription
)
// ContractABI is the input ABI used to generate the binding from.
const ContractABI = "[{\"constant\":true,\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"inputs\":[{\"name\":\"ensAddr\",\"type\":\"address\"}],\"payable\":false,\"type\":\"constructor\"}]"
// Contract is an auto generated Go binding around an Ethereum contract.
type Contract struct {
ContractCaller // Read-only binding to the contract
ContractTransactor // Write-only binding to the contract
ContractFilterer // Log filterer for contract events
}
// ContractCaller is an auto generated read-only Go binding around an Ethereum contract.
type ContractCaller struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// ContractTransactor is an auto generated write-only Go binding around an Ethereum contract.
type ContractTransactor struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// ContractFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
type ContractFilterer struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// ContractSession is an auto generated Go binding around an Ethereum contract,
// with pre-set call and transact options.
type ContractSession struct {
Contract *Contract // 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
}
// ContractCallerSession is an auto generated read-only Go binding around an Ethereum contract,
// with pre-set call options.
type ContractCallerSession struct {
Contract *ContractCaller // Generic contract caller binding to set the session for
CallOpts bind.CallOpts // Call options to use throughout this session
}
// ContractTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
// with pre-set transact options.
type ContractTransactorSession struct {
Contract *ContractTransactor // Generic contract transactor binding to set the session for
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}
// ContractRaw is an auto generated low-level Go binding around an Ethereum contract.
type ContractRaw struct {
Contract *Contract // Generic contract binding to access the raw methods on
}
// ContractCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
type ContractCallerRaw struct {
Contract *ContractCaller // Generic read-only contract binding to access the raw methods on
}
// ContractTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
type ContractTransactorRaw struct {
Contract *ContractTransactor // Generic write-only contract binding to access the raw methods on
}
// NewContract creates a new instance of Contract, bound to a specific deployed contract.
func NewContract(address common.Address, backend bind.ContractBackend) (*Contract, error) {
contract, err := bindContract(address, backend, backend, backend)
if err != nil {
return nil, err
}
return &Contract{ContractCaller: ContractCaller{contract: contract}, ContractTransactor: ContractTransactor{contract: contract}, ContractFilterer: ContractFilterer{contract: contract}}, nil
}
// NewContractCaller creates a new read-only instance of Contract, bound to a specific deployed contract.
func NewContractCaller(address common.Address, caller bind.ContractCaller) (*ContractCaller, error) {
contract, err := bindContract(address, caller, nil, nil)
if err != nil {
return nil, err
}
return &ContractCaller{contract: contract}, nil
}
// NewContractTransactor creates a new write-only instance of Contract, bound to a specific deployed contract.
func NewContractTransactor(address common.Address, transactor bind.ContractTransactor) (*ContractTransactor, error) {
contract, err := bindContract(address, nil, transactor, nil)
if err != nil {
return nil, err
}
return &ContractTransactor{contract: contract}, nil
}
// NewContractFilterer creates a new log filterer instance of Contract, bound to a specific deployed contract.
func NewContractFilterer(address common.Address, filterer bind.ContractFilterer) (*ContractFilterer, error) {
contract, err := bindContract(address, nil, nil, filterer)
if err != nil {
return nil, err
}
return &ContractFilterer{contract: contract}, nil
}
// bindContract binds a generic wrapper to an already deployed contract.
func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
parsed, err := abi.JSON(strings.NewReader(ContractABI))
if err != nil {
return nil, err
}
return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
}
// Call invokes the (constant) contract method with params as input values and
// sets the output to result. The result type might be a single field for simple
// returns, a slice of interfaces for anonymous returns and a struct for named
// returns.
func (_Contract *ContractRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _Contract.Contract.ContractCaller.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 (_Contract *ContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _Contract.Contract.ContractTransactor.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_Contract *ContractRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _Contract.Contract.ContractTransactor.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 (_Contract *ContractCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _Contract.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 (_Contract *ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _Contract.Contract.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_Contract *ContractTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _Contract.Contract.contract.Transact(opts, method, params...)
}
// Ens is a free data retrieval call binding the contract method 0x3f15457f.
//
// Solidity: function ens() returns(address)
func (_Contract *ContractCaller) Ens(opts *bind.CallOpts) (common.Address, error) {
var out []interface{}
err := _Contract.contract.Call(opts, &out, "ens")
if err != nil {
return *new(common.Address), err
}
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
return out0, err
}
// Ens is a free data retrieval call binding the contract method 0x3f15457f.
//
// Solidity: function ens() returns(address)
func (_Contract *ContractSession) Ens() (common.Address, error) {
return _Contract.Contract.Ens(&_Contract.CallOpts)
}
// Ens is a free data retrieval call binding the contract method 0x3f15457f.
//
// Solidity: function ens() returns(address)
func (_Contract *ContractCallerSession) Ens() (common.Address, error) {
return _Contract.Contract.Ens(&_Contract.CallOpts)
}
// Name is a free data retrieval call binding the contract method 0x691f3431.
//
// Solidity: function name(bytes32 ) returns(string)
func (_Contract *ContractCaller) Name(opts *bind.CallOpts, arg0 [32]byte) (string, error) {
var out []interface{}
err := _Contract.contract.Call(opts, &out, "name", arg0)
if err != nil {
return *new(string), err
}
out0 := *abi.ConvertType(out[0], new(string)).(*string)
return out0, err
}
// Name is a free data retrieval call binding the contract method 0x691f3431.
//
// Solidity: function name(bytes32 ) returns(string)
func (_Contract *ContractSession) Name(arg0 [32]byte) (string, error) {
return _Contract.Contract.Name(&_Contract.CallOpts, arg0)
}
// Name is a free data retrieval call binding the contract method 0x691f3431.
//
// Solidity: function name(bytes32 ) returns(string)
func (_Contract *ContractCallerSession) Name(arg0 [32]byte) (string, error) {
return _Contract.Contract.Name(&_Contract.CallOpts, arg0)
}
// SetName is a paid mutator transaction binding the contract method 0x77372213.
//
// Solidity: function setName(bytes32 node, string _name) returns()
func (_Contract *ContractTransactor) SetName(opts *bind.TransactOpts, node [32]byte, _name string) (*types.Transaction, error) {
return _Contract.contract.Transact(opts, "setName", node, _name)
}
// SetName is a paid mutator transaction binding the contract method 0x77372213.
//
// Solidity: function setName(bytes32 node, string _name) returns()
func (_Contract *ContractSession) SetName(node [32]byte, _name string) (*types.Transaction, error) {
return _Contract.Contract.SetName(&_Contract.TransactOpts, node, _name)
}
// SetName is a paid mutator transaction binding the contract method 0x77372213.
//
// Solidity: function setName(bytes32 node, string _name) returns()
func (_Contract *ContractTransactorSession) SetName(node [32]byte, _name string) (*types.Transaction, error) {
return _Contract.Contract.SetName(&_Contract.TransactOpts, node, _name)
}

View File

@@ -0,0 +1,3 @@
package reverseresolver
//go:generate abigen -abi contract.abi -out contract.go -pkg reverseresolver -type Contract

71
vendor/github.com/wealdtech/go-ens/v3/deed.go generated vendored Normal file
View File

@@ -0,0 +1,71 @@
// Copyright 2017-2019 Weald Technology Trading
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ens
import (
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/wealdtech/go-ens/v3/contracts/deed"
)
// Deed is the structure for the deed
type Deed struct {
Contract *deed.Contract
}
// NewDeed obtains the deed contract for a given domain
func NewDeed(backend bind.ContractBackend, domain string) (*Deed, error) {
// Obtain the auction registrar for the deed
auctionRegistrar, err := NewAuctionRegistrar(backend, domain)
if err != nil {
return nil, err
}
entry, err := auctionRegistrar.Entry(domain)
if err != nil {
return nil, err
}
return NewDeedAt(backend, entry.Deed)
}
// NewDeedAt creates a deed contract at a given address
func NewDeedAt(backend bind.ContractBackend, address common.Address) (*Deed, error) {
contract, err := deed.NewContract(address, backend)
if err != nil {
return nil, err
}
return &Deed{
Contract: contract,
}, nil
}
// Owner obtains the owner of the deed
func (c *Deed) Owner() (common.Address, error) {
return c.Contract.Owner(nil)
}
// PreviousOwner obtains the previous owner of the deed
func (c *Deed) PreviousOwner() (common.Address, error) {
return c.Contract.PreviousOwner(nil)
}
// SetOwner sets the owner of the deed
func (c *Deed) SetOwner(opts *bind.TransactOpts, address common.Address) (*types.Transaction, error) {
return c.Contract.SetOwner(opts, address)
}

67
vendor/github.com/wealdtech/go-ens/v3/dnsregistrar.go generated vendored Normal file
View File

@@ -0,0 +1,67 @@
// Copyright 2019 Weald Technology Trading
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ens
import (
"fmt"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/wealdtech/go-ens/v3/contracts/dnsregistrar"
)
// DNSRegistrar is the structure for the registrar
type DNSRegistrar struct {
backend bind.ContractBackend
domain string
Contract *dnsregistrar.Contract
ContractAddr common.Address
}
// NewDNSRegistrar obtains the registrar contract for a given domain
func NewDNSRegistrar(backend bind.ContractBackend, domain string) (*DNSRegistrar, error) {
address, err := RegistrarContractAddress(backend, domain)
if err != nil {
return nil, err
}
if address == UnknownAddress {
return nil, fmt.Errorf("no registrar for domain %s", domain)
}
contract, err := dnsregistrar.NewContract(address, backend)
if err != nil {
return nil, err
}
// Ensure this really is a DNS registrar. To do this confirm that it supports
// the expected interface.
supported, err := contract.SupportsInterface(nil, [4]byte{0x1a, 0xa2, 0xe6, 0x41})
if err != nil {
return nil, err
}
if !supported {
return nil, fmt.Errorf("purported registrar for domain %s does not support DNS registrar functionality", domain)
}
return &DNSRegistrar{
backend: backend,
domain: domain,
Contract: contract,
ContractAddr: address,
}, nil
}
// TODO claim

158
vendor/github.com/wealdtech/go-ens/v3/dnsresolver.go generated vendored Normal file
View File

@@ -0,0 +1,158 @@
// Copyright 2017-2019 Weald Technology Trading
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ens
import (
"fmt"
"strings"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/wealdtech/go-ens/v3/contracts/dnsresolver"
"golang.org/x/crypto/sha3"
)
// DNSResolver is the structure for the DNS resolver contract
type DNSResolver struct {
backend bind.ContractBackend
domain string
Contract *dnsresolver.Contract
ContractAddr common.Address
}
// NewDNSResolver creates a new DNS resolver for a given domain
func NewDNSResolver(backend bind.ContractBackend, domain string) (*DNSResolver, error) {
registry, err := NewRegistry(backend)
if err != nil {
return nil, err
}
address, err := registry.ResolverAddress(domain)
if err != nil {
return nil, err
}
return NewDNSResolverAt(backend, domain, address)
}
// NewDNSResolverAt creates a new DNS resolver for a given domain at a given address
func NewDNSResolverAt(backend bind.ContractBackend, domain string, address common.Address) (*DNSResolver, error) {
contract, err := dnsresolver.NewContract(address, backend)
if err != nil {
return nil, err
}
// Ensure that this is a DNS resolver
supported, err := contract.SupportsInterface(nil, [4]byte{0xa8, 0xfa, 0x56, 0x82})
if err != nil {
return nil, err
}
if !supported {
return nil, fmt.Errorf("%s is not a DNS resolver contract", address.Hex())
}
return &DNSResolver{
backend: backend,
domain: domain,
Contract: contract,
ContractAddr: address,
}, nil
}
// Record obtains an RRSet for a name
func (r *DNSResolver) Record(name string, rrType uint16) ([]byte, error) {
nameHash, err := NameHash(r.domain)
if err != nil {
return nil, err
}
return r.Contract.DnsRecord(nil, nameHash, DNSWireFormatDomainHash(name), rrType)
}
// HasRecords returns true if the given name has any RRsets
func (r *DNSResolver) HasRecords(name string) (bool, error) {
nameHash, err := NameHash(r.domain)
if err != nil {
return false, err
}
return r.Contract.HasDNSRecords(nil, nameHash, DNSWireFormatDomainHash(name))
}
// SetRecords sets one or more RRSets
func (r *DNSResolver) SetRecords(opts *bind.TransactOpts, data []byte) (*types.Transaction, error) {
nameHash, err := NameHash(r.domain)
if err != nil {
return nil, err
}
return r.Contract.SetDNSRecords(opts, nameHash, data)
}
// ClearDNSZone clears all records in the zone
func (r *DNSResolver) ClearDNSZone(opts *bind.TransactOpts) (*types.Transaction, error) {
nameHash, err := NameHash(r.domain)
if err != nil {
return nil, err
}
return r.Contract.ClearDNSZone(opts, nameHash)
}
// Zonehash returns the zone hash of the domain
func (r *DNSResolver) Zonehash() ([]byte, error) {
nameHash, err := NameHash(r.domain)
if err != nil {
return nil, err
}
return r.Contract.Zonehash(nil, nameHash)
}
// SetZonehash sets the zone hash of the domain
func (r *DNSResolver) SetZonehash(opts *bind.TransactOpts, zonehash []byte) (*types.Transaction, error) {
nameHash, err := NameHash(r.domain)
if err != nil {
return nil, err
}
return r.Contract.SetZonehash(opts, nameHash, zonehash)
}
// DNSWireFormatDomainHash hashes a domain name in wire format
func DNSWireFormatDomainHash(domain string) (hash [32]byte) {
sha := sha3.NewLegacyKeccak256()
// //nolint:golint,errcheck
sha.Write(DNSWireFormat(domain))
sha.Sum(hash[:0])
return
}
// DNSWireFormat turns a domain name in to wire format
func DNSWireFormat(domain string) []byte {
// Remove leading and trailing dots
domain = strings.TrimLeft(domain, ".")
domain = strings.TrimRight(domain, ".")
domain = strings.ToLower(domain)
if domain == "" {
return []byte{0x00}
}
bytes := make([]byte, len(domain)+2)
pieces := strings.Split(domain, ".")
offset := 0
for _, piece := range pieces {
bytes[offset] = byte(len(piece))
offset++
copy(bytes[offset:offset+len(piece)], piece)
offset += len(piece)
}
return bytes
}

54
vendor/github.com/wealdtech/go-ens/v3/dnssecoracle.go generated vendored Normal file
View File

@@ -0,0 +1,54 @@
// Copyright 2019 Weald Technology Trading
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ens
import (
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/wealdtech/go-ens/v3/contracts/dnssecoracle"
)
// DNSSECOracle is the structure for the DNSSEC oracle
type DNSSECOracle struct {
backend bind.ContractBackend
domain string
Contract *dnssecoracle.Contract
ContractAddr common.Address
}
// NewDNSSECOracle obtains the DNSSEC oracle contract for a given domain
func NewDNSSECOracle(backend bind.ContractBackend, domain string) (*DNSSECOracle, error) {
registrar, err := NewDNSRegistrar(backend, domain)
if err != nil {
return nil, err
}
address, err := registrar.Contract.Oracle(nil)
if err != nil {
return nil, err
}
contract, err := dnssecoracle.NewContract(address, backend)
if err != nil {
return nil, err
}
return &DNSSECOracle{
backend: backend,
domain: domain,
Contract: contract,
ContractAddr: address,
}, nil
}

252
vendor/github.com/wealdtech/go-ens/v3/ethcontroller.go generated vendored Normal file
View File

@@ -0,0 +1,252 @@
// Copyright 2017-2019 Weald Technology Trading
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ens
import (
"errors"
"fmt"
"math/big"
"time"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/wealdtech/go-ens/v3/contracts/ethcontroller"
)
// ETHController is the structure for the .eth controller contract
type ETHController struct {
backend bind.ContractBackend
Contract *ethcontroller.Contract
ContractAddr common.Address
domain string
}
// NewETHController creates a new controller for a given domain
func NewETHController(backend bind.ContractBackend, domain string) (*ETHController, error) {
registry, err := NewRegistry(backend)
if err != nil {
return nil, err
}
resolver, err := registry.Resolver(domain)
if err != nil {
return nil, err
}
// Obtain the controller from the resolver
controllerAddress, err := resolver.InterfaceImplementer([4]byte{0x01, 0x8f, 0xac, 0x06})
if err != nil {
return nil, err
}
return NewETHControllerAt(backend, domain, controllerAddress)
}
// NewETHControllerAt creates a .eth controller at a given address
func NewETHControllerAt(backend bind.ContractBackend, domain string, address common.Address) (*ETHController, error) {
contract, err := ethcontroller.NewContract(address, backend)
if err != nil {
return nil, err
}
return &ETHController{
backend: backend,
Contract: contract,
ContractAddr: address,
domain: domain,
}, nil
}
// IsValid returns true if the domain is considered valid by the controller.
func (c *ETHController) IsValid(domain string) (bool, error) {
name, err := UnqualifiedName(domain, c.domain)
if err != nil {
return false, fmt.Errorf("invalid name %s", domain)
}
return c.Contract.Valid(nil, name)
}
// IsAvailable returns true if the domain is available for registration.
func (c *ETHController) IsAvailable(domain string) (bool, error) {
name, err := UnqualifiedName(domain, c.domain)
if err != nil {
return false, fmt.Errorf("invalid name %s", domain)
}
return c.Contract.Available(nil, name)
}
// MinRegistrationDuration returns the minimum duration for which a name can be registered
func (c *ETHController) MinRegistrationDuration() (time.Duration, error) {
tmp, err := c.Contract.MINREGISTRATIONDURATION(nil)
if err != nil {
return 0 * time.Second, err
}
return time.Duration(tmp.Int64()) * time.Second, nil
}
// RentCost returns the cost of rent in wei-per-second.
func (c *ETHController) RentCost(domain string) (*big.Int, error) {
name, err := UnqualifiedName(domain, c.domain)
if err != nil {
return nil, fmt.Errorf("invalid name %s", domain)
}
return c.Contract.RentPrice(nil, name, big.NewInt(1))
}
// MinCommitmentInterval returns the minimum time that has to pass between a commit and reveal
func (c *ETHController) MinCommitmentInterval() (*big.Int, error) {
return c.Contract.MinCommitmentAge(nil)
}
// MaxCommitmentInterval returns the maximum time that has to pass between a commit and reveal
func (c *ETHController) MaxCommitmentInterval() (*big.Int, error) {
return c.Contract.MaxCommitmentAge(nil)
}
// CommitmentHash returns the commitment hash for a label/owner/secret tuple
func (c *ETHController) CommitmentHash(domain string, owner common.Address, secret [32]byte) (common.Hash, error) {
name, err := UnqualifiedName(domain, c.domain)
if err != nil {
return common.BytesToHash([]byte{}), fmt.Errorf("invalid name %s", domain)
}
commitment, err := c.Contract.MakeCommitment(nil, name, owner, secret)
if err != nil {
return common.BytesToHash([]byte{}), err
}
hash := common.BytesToHash(commitment[:])
return hash, err
}
// CommitmentTime states the time at which a commitment was registered on the blockchain.
func (c *ETHController) CommitmentTime(domain string, owner common.Address, secret [32]byte) (*big.Int, error) {
hash, err := c.CommitmentHash(domain, owner, secret)
if err != nil {
return nil, err
}
return c.Contract.Commitments(nil, hash)
}
// Commit sends a commitment to register a domain.
func (c *ETHController) Commit(opts *bind.TransactOpts, domain string, owner common.Address, secret [32]byte) (*types.Transaction, error) {
name, err := UnqualifiedName(domain, c.domain)
if err != nil {
return nil, fmt.Errorf("invalid name %s", domain)
}
commitment, err := c.Contract.MakeCommitment(nil, name, owner, secret)
if err != nil {
return nil, errors.New("failed to create commitment")
}
if opts.Value != nil && opts.Value.Cmp(big.NewInt(0)) != 0 {
return nil, errors.New("commitment should have 0 value")
}
return c.Contract.Commit(opts, commitment)
}
// Reveal reveals a commitment to register a domain.
func (c *ETHController) Reveal(opts *bind.TransactOpts, domain string, owner common.Address, secret [32]byte) (*types.Transaction, error) {
name, err := UnqualifiedName(domain, c.domain)
if err != nil {
return nil, fmt.Errorf("invalid name %s", domain)
}
if opts == nil {
return nil, errors.New("transaction options required")
}
if opts.Value == nil {
return nil, errors.New("no ether supplied with transaction")
}
commitTS, err := c.CommitmentTime(name, owner, secret)
if err != nil {
return nil, err
}
if commitTS.Cmp(big.NewInt(0)) == 0 {
return nil, errors.New("no commitment present")
}
commit := time.Unix(commitTS.Int64(), 0)
minCommitIntervalTS, err := c.MinCommitmentInterval()
if err != nil {
return nil, err
}
minCommitInterval := time.Duration(minCommitIntervalTS.Int64()) * time.Second
minRevealTime := commit.Add(minCommitInterval)
if time.Now().Before(minRevealTime) {
return nil, errors.New("commitment too young to reveal")
}
maxCommitIntervalTS, err := c.MaxCommitmentInterval()
if err != nil {
return nil, err
}
maxCommitInterval := time.Duration(maxCommitIntervalTS.Int64()) * time.Second
maxRevealTime := commit.Add(maxCommitInterval)
if time.Now().After(maxRevealTime) {
return nil, errors.New("commitment too old to reveal")
}
// Calculate the duration given the rent cost and the value
costPerSecond, err := c.RentCost(domain)
if err != nil {
return nil, errors.New("failed to obtain rent cost")
}
duration := new(big.Int).Div(opts.Value, costPerSecond)
// Ensure duration is greater than minimum duration
minDuration, err := c.MinRegistrationDuration()
if err != nil {
return nil, err
}
if big.NewInt(int64(minDuration.Seconds())).Cmp(duration) >= 0 {
return nil, fmt.Errorf("not enough funds to cover minimum duration of %v", minDuration)
}
return c.Contract.Register(opts, name, owner, duration, secret)
}
// Renew renews a registered domain.
func (c *ETHController) Renew(opts *bind.TransactOpts, domain string) (*types.Transaction, error) {
name, err := UnqualifiedName(domain, c.domain)
if err != nil {
return nil, fmt.Errorf("invalid name %s", domain)
}
// See if we're registered at all - fetch the owner to find out
registry, err := NewRegistry(c.backend)
if err != nil {
return nil, err
}
owner, err := registry.Owner(domain)
if err != nil {
return nil, err
}
if owner == UnknownAddress {
return nil, fmt.Errorf("%s not registered", domain)
}
// Calculate the duration given the rent cost and the value
costPerSecond, err := c.RentCost(domain)
if err != nil {
return nil, errors.New("failed to obtain rent cost")
}
duration := new(big.Int).Div(opts.Value, costPerSecond)
return c.Contract.Renew(opts, name, duration)
}

136
vendor/github.com/wealdtech/go-ens/v3/misc.go generated vendored Normal file
View File

@@ -0,0 +1,136 @@
package ens
import (
"fmt"
"strings"
)
// DomainLevel calculates the level of the domain presented.
// A top-level domain (e.g. 'eth') will be 0, a domain (e.g.
// 'foo.eth') will be 1, a subdomain (e.g. 'bar.foo.eth' will
// be 2, etc.
func DomainLevel(name string) (level int) {
return len(strings.Split(name, ".")) - 1
}
// NormaliseDomain turns ENS domain in to normal form
func NormaliseDomain(domain string) (string, error) {
wildcard := false
if strings.HasPrefix(domain, "*.") {
wildcard = true
domain = domain[2:]
}
output, err := p.ToUnicode(strings.ToLower(domain))
if err != nil {
return "", err
}
// ToUnicode() removes leading periods. Replace them
if strings.HasPrefix(domain, ".") && !strings.HasPrefix(output, ".") {
output = "." + output
}
// If we removed a wildcard then add it back
if wildcard {
output = "*." + output
}
return output, nil
}
// NormaliseDomainStrict turns ENS domain in to normal form, using strict DNS
// rules (e.g. no underscores)
func NormaliseDomainStrict(domain string) (string, error) {
wildcard := false
if strings.HasPrefix(domain, "*.") {
wildcard = true
domain = domain[2:]
}
output, err := pStrict.ToUnicode(strings.ToLower(domain))
if err != nil {
return "", err
}
// ToUnicode() removes leading periods. Replace them
if strings.HasPrefix(domain, ".") && !strings.HasPrefix(output, ".") {
output = "." + output
}
// If we removed a wildcard then add it back
if wildcard {
output = "*." + output
}
return output, nil
}
// Tld obtains the top-level domain of an ENS name
func Tld(domain string) string {
domain, err := NormaliseDomain(domain)
if err != nil {
return domain
}
tld, err := DomainPart(domain, -1)
if err != nil {
return domain
}
return tld
}
// Domain obtains the domain of an ENS name, including subdomains. It does this
// by removing everything up to and including the first period.
// For example, 'eth' will return ''
// 'foo.eth' will return 'eth'
// 'bar.foo.eth' will return 'foo.eth'
func Domain(domain string) string {
if idx := strings.IndexByte(domain, '.'); idx >= 0 {
return domain[idx+1:]
}
return ""
}
// DomainPart obtains a part of a name
// Positive parts start at the lowest-level of the domain and work towards the
// top-level domain. Negative parts start at the top-level domain and work
// towards the lowest-level domain.
// For example, with a domain bar.foo.com the following parts will be returned:
// Number | part
// 1 | bar
// 2 | foo
// 3 | com
// -1 | com
// -2 | foo
// -3 | bar
func DomainPart(domain string, part int) (string, error) {
if part == 0 {
return "", fmt.Errorf("invalid part")
}
domain, err := NormaliseDomain(domain)
if err != nil {
return "", err
}
parts := strings.Split(domain, ".")
if len(parts) < abs(part) {
return "", fmt.Errorf("not enough parts")
}
if part < 0 {
return parts[len(parts)+part], nil
}
return parts[part-1], nil
}
func abs(x int) int {
if x < 0 {
return -x
}
return x
}
// UnqualifiedName strips the root from the domain and ensures the result is
// suitable as a name
func UnqualifiedName(domain string, root string) (string, error) {
suffix := fmt.Sprintf(".%s", root)
name := strings.TrimSuffix(domain, suffix)
if strings.Contains(name, ".") {
return "", fmt.Errorf("%s not a direct child of %s", domain, root)
}
return name, nil
}

314
vendor/github.com/wealdtech/go-ens/v3/name.go generated vendored Normal file
View File

@@ -0,0 +1,314 @@
// Copyright 2017-2019 Weald Technology Trading
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ens
import (
"crypto/rand"
"errors"
"fmt"
"math/big"
"time"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
)
// Name represents an ENS name, for example 'foo.bar.eth'.
type Name struct {
backend bind.ContractBackend
// Name is the fully-qualified name of an ENS domain e.g. foo.bar.eth
Name string
// Domain is the domain of an ENS domain e.g. bar.eth
Domain string
// Label is the name part of an ENS domain e.g. foo
Label string
// Contracts
registry *Registry
registrar *BaseRegistrar
controller *ETHController
}
// NewName creates an ENS name structure.
// Note that this does not create the name on-chain.
func NewName(backend bind.ContractBackend, name string) (*Name, error) {
name, err := NormaliseDomain(name)
if err != nil {
return nil, err
}
domain := Domain(name)
label, err := DomainPart(name, 1)
if err != nil {
return nil, err
}
registry, err := NewRegistry(backend)
if err != nil {
return nil, err
}
registrar, err := NewBaseRegistrar(backend, domain)
if err != nil {
return nil, err
}
controller, err := NewETHController(backend, domain)
if err != nil {
return nil, err
}
isValid, err := controller.IsValid(name)
if err != nil {
return nil, err
}
if !isValid {
return nil, errors.New("name is not valid according to the rules of the registrar (too short, invalid characters, etc.)")
}
return &Name{
backend: backend,
Name: name,
Domain: domain,
Label: label,
registry: registry,
registrar: registrar,
controller: controller,
}, nil
}
// IsRegistered returns true if the name is registered in the registrar
func (n *Name) IsRegistered() (bool, error) {
registrant, err := n.Registrant()
if err != nil {
return false, err
}
return registrant != UnknownAddress, nil
}
// ExtendRegistration sends a transaction that extends the registration of the name.
func (n *Name) ExtendRegistration(opts *bind.TransactOpts) (*types.Transaction, error) {
isRegistered, err := n.IsRegistered()
if err != nil {
return nil, err
}
if !isRegistered {
return nil, errors.New("name is not registered")
}
rentCost, err := n.RentCost()
if err != nil {
return nil, err
}
if opts.Value == nil || opts.Value.Cmp(rentCost) < 0 {
return nil, errors.New("not enough funds to extend the registration")
}
return n.controller.Renew(opts, n.Name)
}
// RegistrationInterval obtains the minimum interval between commit and reveal
// when registering this name.
func (n *Name) RegistrationInterval() (time.Duration, error) {
interval, err := n.controller.MinCommitmentInterval()
if err != nil {
return time.Duration(0), err
}
return time.Duration(interval.Int64()) * time.Second, nil
}
// RegisterStageOne sends a transaction that starts the registration process.
func (n *Name) RegisterStageOne(registrant common.Address, opts *bind.TransactOpts) (*types.Transaction, [32]byte, error) {
var secret [32]byte
_, err := rand.Read(secret[:])
if err != nil {
return nil, secret, err
}
isRegistered, err := n.IsRegistered()
if err != nil {
return nil, secret, err
}
if isRegistered {
return nil, secret, errors.New("name is already registered")
}
signedTx, err := n.controller.Commit(opts, n.Label, registrant, secret)
return signedTx, secret, err
}
// RegisterStageTwo sends a transaction that completes the registration process.
// The registrant must be the same as supplied in RegisterStageOne.
// The secret is that returned by RegisterStageOne.
// At least RegistrationInterval() time must have passed since the stage one
// transaction was mined for this to work.
func (n *Name) RegisterStageTwo(registrant common.Address, secret [32]byte, opts *bind.TransactOpts) (*types.Transaction, error) {
commitTS, err := n.controller.CommitmentTime(n.Label, registrant, secret)
if err != nil {
return nil, err
}
if commitTS.Cmp(big.NewInt(0)) == 0 {
return nil, errors.New("stage 2 attempted prior to successful stage 1 transaction")
}
commit := time.Unix(commitTS.Int64(), 0)
minCommitIntervalTS, err := n.controller.MinCommitmentInterval()
if err != nil {
return nil, err
}
minCommitInterval := time.Duration(minCommitIntervalTS.Int64()) * time.Second
minStageTwoTime := commit.Add(minCommitInterval)
if time.Now().Before(minStageTwoTime) {
return nil, errors.New("too early to send second transaction")
}
maxCommitIntervalTS, err := n.controller.MaxCommitmentInterval()
if err != nil {
return nil, err
}
maxCommitInterval := time.Duration(maxCommitIntervalTS.Int64()) * time.Second
maxStageTwoTime := commit.Add(maxCommitInterval)
if time.Now().After(maxStageTwoTime) {
return nil, errors.New("too late to send second transaction")
}
return n.controller.Reveal(opts, n.Label, registrant, secret)
}
// Expires obtain the time at which the registration for this name expires.
func (n *Name) Expires() (time.Time, error) {
expiryTS, err := n.registrar.Expiry(n.Label)
if err != nil {
return time.Unix(0, 0), err
}
if expiryTS.Int64() == 0 {
return time.Unix(0, 0), errors.New("not registered")
}
return time.Unix(expiryTS.Int64(), 0), nil
}
// Controller obtains the controller for this name.
// The controller can carry out operations on the name such as setting
// records, but cannot transfer ultimate ownership of the name.
func (n *Name) Controller() (common.Address, error) {
return n.registry.Owner(n.Name)
}
// SetController sets the controller for this name.
// The controller can carry out operations on the name such as setting
// records, but cannot transfer ultimate ownership of the name.
func (n *Name) SetController(controller common.Address, opts *bind.TransactOpts) (*types.Transaction, error) {
// Are we the current controller?
curController, err := n.Controller()
if err != nil {
return nil, err
}
if curController == opts.From {
return n.registry.SetOwner(opts, n.Name, controller)
}
// Perhaps we are the registrant
registrant, err := n.Registrant()
if err != nil {
return nil, err
}
// Are we actually trying to reclaim?
if registrant == opts.From && opts.From == controller {
return n.Reclaim(opts)
}
return nil, errors.New("not authorised to change the controller")
}
// Reclaim reclaims controller rights by the registrant
func (n *Name) Reclaim(opts *bind.TransactOpts) (*types.Transaction, error) {
// Ensure the we are the registrant
registrant, err := n.Registrant()
if err != nil {
return nil, err
}
if registrant != opts.From {
return nil, errors.New("not the registrant")
}
return n.registrar.Reclaim(opts, n.Name, registrant)
}
// Registrant obtains the registrant for this name.
func (n *Name) Registrant() (common.Address, error) {
return n.registrar.Owner(n.Label)
}
// Transfer transfers the registration of this name to a new registrant.
func (n *Name) Transfer(registrant common.Address, opts *bind.TransactOpts) (*types.Transaction, error) {
// Ensure the we are the registrant
currentRegistrant, err := n.Registrant()
if err != nil {
return nil, err
}
if currentRegistrant != opts.From {
return nil, errors.New("not the current registrant")
}
return n.registrar.SetOwner(opts, n.Label, registrant)
}
// RentCost returns the cost of rent in Wei-per-second.
func (n *Name) RentCost() (*big.Int, error) {
return n.controller.RentCost(n.Label)
}
// CreateSubdomain creates a subdomain on the name.
func (n *Name) CreateSubdomain(label string, controller common.Address, opts *bind.TransactOpts) (*types.Transaction, error) {
// Confirm the subdomain does not already exist
fqdn := fmt.Sprintf("%s.%s", label, n.Name)
subdomainController, err := n.registry.Owner(fqdn)
if err != nil {
return nil, err
}
if subdomainController != UnknownAddress {
return nil, errors.New("that subdomain already exists")
}
return n.registry.SetSubdomainOwner(opts, n.Name, label, controller)
}
// ResolverAddress fetches the address of the resolver contract for the name.
func (n *Name) ResolverAddress() (common.Address, error) {
return n.registry.ResolverAddress(n.Name)
}
// SetResolverAddress sets the resolver contract address for the name.
func (n *Name) SetResolverAddress(address common.Address, opts *bind.TransactOpts) (*types.Transaction, error) {
return n.registry.SetResolver(opts, n.Name, address)
}
// Address fetches the address of the name for a given coin type.
// Coin types are defined at https://github.com/satoshilabs/slips/blob/master/slip-0044.md
func (n *Name) Address(coinType uint64) ([]byte, error) {
resolver, err := NewResolver(n.backend, n.Name)
if err != nil {
return nil, err
}
return resolver.MultiAddress(coinType)
}
// SetAddress sets the address of the name for a given coin type.
// Coin types are defined at https://github.com/satoshilabs/slips/blob/master/slip-0044.md
func (n *Name) SetAddress(coinType uint64, address []byte, opts *bind.TransactOpts) (*types.Transaction, error) {
resolver, err := NewResolver(n.backend, n.Name)
if err != nil {
return nil, err
}
return resolver.SetMultiAddress(opts, coinType, address)
}

90
vendor/github.com/wealdtech/go-ens/v3/namehash.go generated vendored Normal file
View File

@@ -0,0 +1,90 @@
// Copyright 2017 Weald Technology Trading
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ens
import (
"strings"
"golang.org/x/net/idna"
"golang.org/x/crypto/sha3"
)
var p = idna.New(idna.MapForLookup(), idna.StrictDomainName(false), idna.Transitional(false))
var pStrict = idna.New(idna.MapForLookup(), idna.StrictDomainName(true), idna.Transitional(false))
// Normalize normalizes a name according to the ENS rules
func Normalize(input string) (output string, err error) {
output, err = p.ToUnicode(input)
if err != nil {
return
}
// If the name started with a period then ToUnicode() removes it, but we want to keep it
if strings.HasPrefix(input, ".") && !strings.HasPrefix(output, ".") {
output = "." + output
}
return
}
// LabelHash generates a simple hash for a piece of a name.
func LabelHash(label string) (hash [32]byte, err error) {
normalizedLabel, err := Normalize(label)
if err != nil {
return
}
sha := sha3.NewLegacyKeccak256()
if _, err = sha.Write([]byte(normalizedLabel)); err != nil {
return
}
sha.Sum(hash[:0])
return
}
// NameHash generates a hash from a name that can be used to
// look up the name in ENS
func NameHash(name string) (hash [32]byte, err error) {
if name == "" {
return
}
normalizedName, err := Normalize(name)
if err != nil {
return
}
parts := strings.Split(normalizedName, ".")
for i := len(parts) - 1; i >= 0; i-- {
if hash, err = nameHashPart(hash, parts[i]); err != nil {
return
}
}
return
}
func nameHashPart(currentHash [32]byte, name string) (hash [32]byte, err error) {
sha := sha3.NewLegacyKeccak256()
if _, err = sha.Write(currentHash[:]); err != nil {
return
}
nameSha := sha3.NewLegacyKeccak256()
if _, err = nameSha.Write([]byte(name)); err != nil {
return
}
nameHash := nameSha.Sum(nil)
if _, err = sha.Write(nameHash); err != nil {
return
}
sha.Sum(hash[:0])
return
}

39
vendor/github.com/wealdtech/go-ens/v3/registrar.go generated vendored Normal file
View File

@@ -0,0 +1,39 @@
// Copyright 2019 Weald Technology Trading
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ens
import (
"fmt"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
)
// RegistrarContractAddress obtains the registrar contract address for a given domain
func RegistrarContractAddress(backend bind.ContractBackend, domain string) (common.Address, error) {
// Obtain a registry contract
registry, err := NewRegistry(backend)
if err != nil {
return UnknownAddress, err
}
// Obtain the registrar address from the registry
address, err := registry.Owner(domain)
if address == UnknownAddress {
err = fmt.Errorf("no registrar for %s", domain)
}
return address, err
}

189
vendor/github.com/wealdtech/go-ens/v3/registry.go generated vendored Normal file
View File

@@ -0,0 +1,189 @@
// Copyright 2017 Weald Technology Trading
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ens
import (
"errors"
"math/big"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/wealdtech/go-ens/v3/contracts/auctionregistrar"
"github.com/wealdtech/go-ens/v3/contracts/registry"
"github.com/wealdtech/go-ens/v3/util"
)
// Registry is the structure for the registry contract
type Registry struct {
backend bind.ContractBackend
Contract *registry.Contract
ContractAddr common.Address
}
// NewRegistry obtains the ENS registry
func NewRegistry(backend bind.ContractBackend) (*Registry, error) {
address, err := RegistryContractAddress(backend)
if err != nil {
return nil, err
}
return NewRegistryAt(backend, address)
}
// NewRegistryAt obtains the ENS registry at a given address
func NewRegistryAt(backend bind.ContractBackend, address common.Address) (*Registry, error) {
contract, err := registry.NewContract(address, backend)
if err != nil {
return nil, err
}
return &Registry{
backend: backend,
Contract: contract,
ContractAddr: address,
}, nil
}
// Owner returns the address of the owner of a name
func (r *Registry) Owner(name string) (common.Address, error) {
nameHash, err := NameHash(name)
if err != nil {
return UnknownAddress, err
}
return r.Contract.Owner(nil, nameHash)
}
// ResolverAddress returns the address of the resolver for a name
func (r *Registry) ResolverAddress(name string) (common.Address, error) {
nameHash, err := NameHash(name)
if err != nil {
return UnknownAddress, err
}
return r.Contract.Resolver(nil, nameHash)
}
// SetResolver sets the resolver for a name
func (r *Registry) SetResolver(opts *bind.TransactOpts, name string, address common.Address) (*types.Transaction, error) {
nameHash, err := NameHash(name)
if err != nil {
return nil, err
}
return r.Contract.SetResolver(opts, nameHash, address)
}
// Resolver returns the resolver for a name
func (r *Registry) Resolver(name string) (*Resolver, error) {
address, err := r.ResolverAddress(name)
if err != nil {
return nil, err
}
return NewResolverAt(r.backend, name, address)
}
// SetOwner sets the ownership of a domain
func (r *Registry) SetOwner(opts *bind.TransactOpts, name string, address common.Address) (*types.Transaction, error) {
nameHash, err := NameHash(name)
if err != nil {
return nil, err
}
return r.Contract.SetOwner(opts, nameHash, address)
}
// SetSubdomainOwner sets the ownership of a subdomain, potentially creating it in the process
func (r *Registry) SetSubdomainOwner(opts *bind.TransactOpts, name string, subname string, address common.Address) (*types.Transaction, error) {
nameHash, err := NameHash(name)
if err != nil {
return nil, err
}
labelHash, err := LabelHash(subname)
if err != nil {
return nil, err
}
return r.Contract.SetSubnodeOwner(opts, nameHash, labelHash, address)
}
// RegistryContractAddress obtains the address of the registry contract for a chain.
// This is (currently) the same for all chains.
func RegistryContractAddress(backend bind.ContractBackend) (common.Address, error) {
// chainID := big.NewInt(0)
// if reflect.TypeOf(backend).String() == "*ethclient.Client" {
// ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
// defer cancel()
// var err error
// chainID, err = backend.(*ethclient.Client).NetworkID(ctx)
// if err != nil {
// return UnknownAddress, err
// }
// }
// Instantiate the registry contract. The same for all chains.
return common.HexToAddress("00000000000C2E074eC69A0dFb2997BA6C7d2e1e"), nil
}
// RegistryContractFromRegistrar obtains the registry contract given an
// existing registrar contract
func RegistryContractFromRegistrar(backend bind.ContractBackend, registrar *auctionregistrar.Contract) (*registry.Contract, error) {
if registrar == nil {
return nil, errors.New("no registrar contract")
}
registryAddress, err := registrar.Ens(nil)
if err != nil {
return nil, err
}
return registry.NewContract(registryAddress, backend)
}
// SetResolver sets the resolver for a name
func SetResolver(session *registry.ContractSession, name string, resolverAddr *common.Address) (*types.Transaction, error) {
nameHash, err := NameHash(name)
if err != nil {
return nil, err
}
return session.SetResolver(nameHash, *resolverAddr)
}
// SetSubdomainOwner sets the owner for a subdomain of a name
func SetSubdomainOwner(session *registry.ContractSession, name string, subdomain string, ownerAddr *common.Address) (*types.Transaction, error) {
nameHash, err := NameHash(name)
if err != nil {
return nil, err
}
labelHash, err := LabelHash(subdomain)
if err != nil {
return nil, err
}
return session.SetSubnodeOwner(nameHash, labelHash, *ownerAddr)
}
// CreateRegistrySession creates a session suitable for multiple calls
func CreateRegistrySession(chainID *big.Int, wallet *accounts.Wallet, account *accounts.Account, passphrase string, contract *registry.Contract, gasPrice *big.Int) *registry.ContractSession {
// Create a signer
signer := util.AccountSigner(chainID, wallet, account, passphrase)
// Return our session
session := &registry.ContractSession{
Contract: contract,
CallOpts: bind.CallOpts{
Pending: true,
},
TransactOpts: bind.TransactOpts{
From: account.Address,
Signer: signer,
GasPrice: gasPrice,
},
}
return session
}

309
vendor/github.com/wealdtech/go-ens/v3/resolver.go generated vendored Normal file
View File

@@ -0,0 +1,309 @@
// Copyright 2017-2019 Weald Technology Trading
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ens
import (
"bytes"
"compress/zlib"
"errors"
"io"
"io/ioutil"
"math/big"
"strings"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/wealdtech/go-ens/v3/contracts/resolver"
)
var zeroHash = make([]byte, 32)
// UnknownAddress is the address to which unknown entries resolve
var UnknownAddress = common.HexToAddress("00")
// Resolver is the structure for the resolver contract
type Resolver struct {
Contract *resolver.Contract
ContractAddr common.Address
domain string
}
// NewResolver obtains an ENS resolver for a given domain
func NewResolver(backend bind.ContractBackend, domain string) (*Resolver, error) {
registry, err := NewRegistry(backend)
if err != nil {
return nil, err
}
// Ensure the name is registered
ownerAddress, err := registry.Owner(domain)
if err != nil {
return nil, err
}
if bytes.Equal(ownerAddress.Bytes(), UnknownAddress.Bytes()) {
return nil, errors.New("unregistered name")
}
// Obtain the resolver address for this domain
resolver, err := registry.ResolverAddress(domain)
if err != nil {
return nil, err
}
return NewResolverAt(backend, domain, resolver)
}
// NewResolverAt obtains an ENS resolver at a given address
func NewResolverAt(backend bind.ContractBackend, domain string, address common.Address) (*Resolver, error) {
contract, err := resolver.NewContract(address, backend)
if err != nil {
return nil, err
}
// Ensure this really is a resolver contract
nameHash, err := NameHash("test.eth")
if err != nil {
return nil, err
}
_, err = contract.Addr(nil, nameHash)
if err != nil {
if err.Error() == "no contract code at given address" {
return nil, errors.New("no resolver")
}
return nil, err
}
return &Resolver{
Contract: contract,
ContractAddr: address,
domain: domain,
}, nil
}
// PublicResolverAddress obtains the address of the public resolver for a chain
func PublicResolverAddress(backend bind.ContractBackend) (common.Address, error) {
return Resolve(backend, "resolver.eth")
}
// Address returns the Ethereum address of the domain
func (r *Resolver) Address() (common.Address, error) {
nameHash, err := NameHash(r.domain)
if err != nil {
return UnknownAddress, err
}
return r.Contract.Addr(nil, nameHash)
}
// SetAddress sets the Ethereum address of the domain
func (r *Resolver) SetAddress(opts *bind.TransactOpts, address common.Address) (*types.Transaction, error) {
nameHash, err := NameHash(r.domain)
if err != nil {
return nil, err
}
return r.Contract.SetAddr(opts, nameHash, address)
}
// MultiAddress returns the address of the domain for a given coin type.
// The coin type is as per https://github.com/satoshilabs/slips/blob/master/slip-0044.md
func (r *Resolver) MultiAddress(coinType uint64) ([]byte, error) {
nameHash, err := NameHash(r.domain)
if err != nil {
return nil, err
}
return r.Contract.Addr0(nil, nameHash, big.NewInt(int64(coinType)))
}
// SetMultiAddress sets the iaddress of the domain for a given coin type.
// The coin type is as per https://github.com/satoshilabs/slips/blob/master/slip-0044.md
func (r *Resolver) SetMultiAddress(opts *bind.TransactOpts, coinType uint64, address []byte) (*types.Transaction, error) {
nameHash, err := NameHash(r.domain)
if err != nil {
return nil, err
}
return r.Contract.SetAddr0(opts, nameHash, big.NewInt(int64(coinType)), address)
}
// PubKey returns the public key of the domain
func (r *Resolver) PubKey() ([32]byte, [32]byte, error) {
nameHash, err := NameHash(r.domain)
if err != nil {
return [32]byte{}, [32]byte{}, err
}
res, err := r.Contract.Pubkey(nil, nameHash)
return res.X, res.Y, err
}
// SetPubKey sets the public key of the domain
func (r *Resolver) SetPubKey(opts *bind.TransactOpts, x [32]byte, y [32]byte) (*types.Transaction, error) {
nameHash, err := NameHash(r.domain)
if err != nil {
return nil, err
}
return r.Contract.SetPubkey(opts, nameHash, x, y)
}
// Contenthash returns the content hash of the domain
func (r *Resolver) Contenthash() ([]byte, error) {
nameHash, err := NameHash(r.domain)
if err != nil {
return nil, err
}
return r.Contract.Contenthash(nil, nameHash)
}
// SetContenthash sets the content hash of the domain
func (r *Resolver) SetContenthash(opts *bind.TransactOpts, contenthash []byte) (*types.Transaction, error) {
nameHash, err := NameHash(r.domain)
if err != nil {
return nil, err
}
return r.Contract.SetContenthash(opts, nameHash, contenthash)
}
// InterfaceImplementer returns the address of the contract that implements the given interface for the given domain
func (r *Resolver) InterfaceImplementer(interfaceID [4]byte) (common.Address, error) {
nameHash, err := NameHash(r.domain)
if err != nil {
return UnknownAddress, err
}
return r.Contract.InterfaceImplementer(nil, nameHash, interfaceID)
}
// Resolve resolves an ENS name in to an Etheruem address
// This will return an error if the name is not found or otherwise 0
func Resolve(backend bind.ContractBackend, input string) (address common.Address, err error) {
if strings.Contains(input, ".") {
return resolveName(backend, input)
}
if (strings.HasPrefix(input, "0x") && len(input) > 42) || (!strings.HasPrefix(input, "0x") && len(input) > 40) {
err = errors.New("address too long")
} else {
address = common.HexToAddress(input)
if address == UnknownAddress {
err = errors.New("could not parse address")
}
}
return
}
func resolveName(backend bind.ContractBackend, input string) (address common.Address, err error) {
nameHash, err := NameHash(input)
if err != nil {
return UnknownAddress, err
}
if bytes.Equal(nameHash[:], zeroHash) {
err = errors.New("bad name")
} else {
address, err = resolveHash(backend, input)
}
return
}
func resolveHash(backend bind.ContractBackend, domain string) (address common.Address, err error) {
resolver, err := NewResolver(backend, domain)
if err != nil {
return UnknownAddress, err
}
// Resolve the domain
address, err = resolver.Address()
if err != nil {
return UnknownAddress, err
}
if bytes.Equal(address.Bytes(), UnknownAddress.Bytes()) {
return UnknownAddress, errors.New("no address")
}
return
}
// SetText sets the text associated with a name
func (r *Resolver) SetText(opts *bind.TransactOpts, name string, value string) (*types.Transaction, error) {
nameHash, err := NameHash(r.domain)
if err != nil {
return nil, err
}
return r.Contract.SetText(opts, nameHash, name, value)
}
// Text obtains the text associated with a name
func (r *Resolver) Text(name string) (string, error) {
nameHash, err := NameHash(r.domain)
if err != nil {
return "", err
}
return r.Contract.Text(nil, nameHash, name)
}
// SetABI sets the ABI associated with a name
func (r *Resolver) SetABI(opts *bind.TransactOpts, name string, abi string, contentType *big.Int) (*types.Transaction, error) {
var data []byte
switch contentType.Uint64() {
case 1:
// Uncompressed JSON
data = []byte(abi)
case 2:
// Zlib-compressed JSON
var b bytes.Buffer
w := zlib.NewWriter(&b)
if _, err := w.Write([]byte(abi)); err != nil {
return nil, err
}
w.Close()
data = b.Bytes()
default:
return nil, errors.New("unsupported content type")
}
nameHash, err := NameHash(r.domain)
if err != nil {
return nil, err
}
return r.Contract.SetABI(opts, nameHash, contentType, data)
}
// ABI returns the ABI associated with a name
func (r *Resolver) ABI(name string) (string, error) {
contentTypes := big.NewInt(3)
nameHash, err := NameHash(name)
if err != nil {
return "", err
}
contentType, data, err := r.Contract.ABI(nil, nameHash, contentTypes)
var abi string
if err == nil {
if contentType.Cmp(big.NewInt(1)) == 0 {
// Uncompressed JSON
abi = string(data)
} else if contentType.Cmp(big.NewInt(2)) == 0 {
// Zlib-compressed JSON
b := bytes.NewReader(data)
var z io.ReadCloser
z, err = zlib.NewReader(b)
if err != nil {
return "", err
}
defer z.Close()
var uncompressed []byte
uncompressed, err = ioutil.ReadAll(z)
if err != nil {
return "", err
}
abi = string(uncompressed)
}
}
return abi, nil
}

View File

@@ -0,0 +1,70 @@
// Copyright 2017-2019 Weald Technology Trading
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ens
import (
"errors"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/wealdtech/go-ens/v3/contracts/reverseregistrar"
)
// ReverseRegistrar is the structure for the reverse registrar
type ReverseRegistrar struct {
Contract *reverseregistrar.Contract
ContractAddr common.Address
}
// NewReverseRegistrar obtains the reverse registrar
func NewReverseRegistrar(backend bind.ContractBackend) (*ReverseRegistrar, error) {
registry, err := NewRegistry(backend)
if err != nil {
return nil, err
}
// Obtain the registry address from the registrar
address, err := registry.Owner("addr.reverse")
if err != nil {
return nil, err
}
if address == UnknownAddress {
return nil, errors.New("no registrar for that network")
}
return NewReverseRegistrarAt(backend, address)
}
// NewReverseRegistrarAt obtains the reverse registrar at a given address
func NewReverseRegistrarAt(backend bind.ContractBackend, address common.Address) (*ReverseRegistrar, error) {
contract, err := reverseregistrar.NewContract(address, backend)
if err != nil {
return nil, err
}
return &ReverseRegistrar{
Contract: contract,
ContractAddr: address,
}, nil
}
// SetName sets the name
func (r *ReverseRegistrar) SetName(opts *bind.TransactOpts, name string) (tx *types.Transaction, err error) {
return r.Contract.SetName(opts, name)
}
// DefaultResolverAddress obtains the default resolver address
func (r *ReverseRegistrar) DefaultResolverAddress() (common.Address, error) {
return r.Contract.DefaultResolver(nil)
}

View File

@@ -0,0 +1,121 @@
// Copyright 2017-2019 Weald Technology Trading
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ens
import (
"errors"
"fmt"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/wealdtech/go-ens/v3/contracts/reverseresolver"
)
// ReverseResolver is the structure for the reverse resolver contract
type ReverseResolver struct {
Contract *reverseresolver.Contract
ContractAddr common.Address
}
// NewReverseResolverFor creates a reverse resolver contract for the given address.
func NewReverseResolverFor(backend bind.ContractBackend, address common.Address) (*ReverseResolver, error) {
registry, err := NewRegistry(backend)
if err != nil {
return nil, err
}
// Now fetch the resolver.
domain := fmt.Sprintf("%x.addr.reverse", address.Bytes())
contractAddress, err := registry.ResolverAddress(domain)
if err != nil {
return nil, err
}
return NewReverseResolverAt(backend, contractAddress)
}
// NewReverseResolver obtains the reverse resolver
func NewReverseResolver(backend bind.ContractBackend) (*ReverseResolver, error) {
reverseRegistrar, err := NewReverseRegistrar(backend)
if err != nil {
return nil, err
}
// Now fetch the default resolver
address, err := reverseRegistrar.DefaultResolverAddress()
if err != nil {
return nil, err
}
return NewReverseResolverAt(backend, address)
}
// NewReverseResolverAt obtains the reverse resolver at a given address
func NewReverseResolverAt(backend bind.ContractBackend, address common.Address) (*ReverseResolver, error) {
// Instantiate the reverse registrar contract
contract, err := reverseresolver.NewContract(address, backend)
if err != nil {
return nil, err
}
// Ensure the contract is a resolver
nameHash, err := NameHash("0.addr.reverse")
if err != nil {
return nil, err
}
_, err = contract.Name(nil, nameHash)
if err != nil && err.Error() == "no contract code at given address" {
return nil, fmt.Errorf("not a resolver")
}
return &ReverseResolver{
Contract: contract,
ContractAddr: address,
}, nil
}
// Name obtains the name for an address
func (r *ReverseResolver) Name(address common.Address) (string, error) {
nameHash, err := NameHash(fmt.Sprintf("%s.addr.reverse", address.Hex()[2:]))
if err != nil {
return "", err
}
return r.Contract.Name(nil, nameHash)
}
// Format provides a string version of an address, reverse resolving it if possible
func Format(backend bind.ContractBackend, address common.Address) string {
result, err := ReverseResolve(backend, address)
if err != nil {
result = address.Hex()
}
return result
}
// ReverseResolve resolves an address in to an ENS name
// This will return an error if the name is not found or otherwise 0
func ReverseResolve(backend bind.ContractBackend, address common.Address) (string, error) {
resolver, err := NewReverseResolverFor(backend, address)
if err != nil {
return "", err
}
// Resolve the name
name, err := resolver.Name(address)
if name == "" {
err = errors.New("no resolution")
}
return name, err
}

51
vendor/github.com/wealdtech/go-ens/v3/util/signer.go generated vendored Normal file
View File

@@ -0,0 +1,51 @@
// Copyright 2018 Weald Technology Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package util
import (
"crypto/ecdsa"
"errors"
"math/big"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
)
// KeySigner generates a signer using a private key
func KeySigner(chainID *big.Int, key *ecdsa.PrivateKey) (signerfn bind.SignerFn) {
signerfn = func(address common.Address, tx *types.Transaction) (*types.Transaction, error) {
keyAddr := crypto.PubkeyToAddress(key.PublicKey)
if address != keyAddr {
return nil, errors.New("not authorized to sign this account")
}
return types.SignTx(tx, types.NewEIP155Signer(chainID), key)
}
return
}
// AccountSigner generates a signer using an account
func AccountSigner(chainID *big.Int, wallet *accounts.Wallet, account *accounts.Account, passphrase string) (signerfn bind.SignerFn) {
signerfn = func(address common.Address, tx *types.Transaction) (*types.Transaction, error) {
if address != account.Address {
return nil, errors.New("not authorized to sign this account")
}
return (*wallet).SignTxWithPassphrase(*account, passphrase, tx, chainID)
}
return
}

21
vendor/github.com/wealdtech/go-multicodec/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,21 @@
# Binaries for programs and plugins
*.exe
*.dll
*.so
*.dylib
# Test binary, build with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
coverage.html
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
.glide/
# Vim
*.sw?
# Local TODO
TODO.md

14
vendor/github.com/wealdtech/go-multicodec/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,14 @@
language: go
go:
- "1.x"
- tip
before_install:
- go get -t -v ./...
script:
- go test -race -coverprofile=coverage.txt -covermode=atomic
after_success:
- bash <(curl -s https://codecov.io/bash)

201
vendor/github.com/wealdtech/go-multicodec/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

80
vendor/github.com/wealdtech/go-multicodec/README.md generated vendored Normal file
View File

@@ -0,0 +1,80 @@
# go-multicodec
[![Tag](https://img.shields.io/github/tag/wealdtech/go-multicodec.svg)](https://github.com/wealdtech/go-multicodec/releases/)
[![License](https://img.shields.io/github/license/wealdtech/go-multicodec.svg)](LICENSE)
[![GoDoc](https://godoc.org/github.com/wealdtech/go-multicodec?status.svg)](https://godoc.org/github.com/wealdtech/go-multicodec)
[![Travis CI](https://img.shields.io/travis/wealdtech/go-multicodec.svg)](https://travis-ci.org/wealdtech/go-multicodec)
[![codecov.io](https://img.shields.io/codecov/c/github/wealdtech/go-multicodec.svg)](https://codecov.io/github/wealdtech/go-multicodec)
Go utility library to provide encoding and decoding of [multicodec](https://github.com/multiformats/multicodec) values.
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [Maintainers](#maintainers)
- [Contribute](#contribute)
- [License](#license)
## Install
`go-multicodec` is a standard Go module which can be installed with:
```sh
go get github.com/wealdtech/go-multicodec
```
## Usage
### Example
```go
import (
"bytes"
"encoding/hex"
"errors"
multicodec "github.com/wealdtech/go-multicodec"
)
func main() {
// Data in this case is an IPFS hash in multihash format with a dag-pb content type
data, err := hex.DecodeString("70122029f2d17be6139079dc48696d1f582a8530eb9805b561eda517e22a892c7e3f1f")
if err != nil {
panic(err)
}
// Add the "ipfs-ns" namespace codec
dataWithCodec, err := multicodec.AddCodec("ipfs-ns", data)
if err != nil {
panic(err)
}
if !multicodec.IsCodec("ipfs-ns", dataWithCodec) {
panic(errors.New("data does not have correct codec prefix"))
}
// Remove the codec
dataWithoutCodec, _, err := multicodec.RemoveCodec(dataWithCodec)
if err != nil {
panic(err)
}
if !bytes.Equal(data, dataWithoutCodec) {
panic(errors.New("data mismatch"))
}
}
```
## Maintainers
Jim McDonald: [@mcdee](https://github.com/mcdee).
## Contribute
Contributions welcome. Please check out [the issues](https://github.com/wealdtech/go-multicodec/issues).
## License
[Apache-2.0](LICENSE) © 2019 Weald Technology Trading Ltd

959
vendor/github.com/wealdtech/go-multicodec/codecs.go generated vendored Normal file
View File

@@ -0,0 +1,959 @@
// Copyright © 2019 Weald Technology Trading
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package multicodec
// codec is the structure holding codec information
type codec struct {
id uint64
tag string
name string
}
var codecs map[string]*codec
var reverseCodecs map[uint64]*codec
func init() {
codecs = make(map[string]*codec)
reverseCodecs = make(map[uint64]*codec)
codecs["identity"] = &codec{id: 0x00, name: "identity", tag: "multihash"}
reverseCodecs[0x00] = codecs["identity"]
codecs["cidv1"] = &codec{id: 0x01, name: "cidv1", tag: "ipld"}
reverseCodecs[0x01] = codecs["cidv1"]
codecs["cidv2"] = &codec{id: 0x02, name: "cidv2", tag: "ipld"}
reverseCodecs[0x02] = codecs["cidv2"]
codecs["cidv3"] = &codec{id: 0x03, name: "cidv3", tag: "ipld"}
reverseCodecs[0x03] = codecs["cidv3"]
codecs["ip4"] = &codec{id: 0x04, name: "ip4", tag: "multiaddr"}
reverseCodecs[0x04] = codecs["ip4"]
codecs["tcp"] = &codec{id: 0x06, name: "tcp", tag: "multiaddr"}
reverseCodecs[0x06] = codecs["tcp"]
codecs["sha1"] = &codec{id: 0x11, name: "sha1", tag: "multihash"}
reverseCodecs[0x11] = codecs["sha1"]
codecs["sha2-256"] = &codec{id: 0x12, name: "sha2-256", tag: "multihash"}
reverseCodecs[0x12] = codecs["sha2-256"]
codecs["sha2-512"] = &codec{id: 0x13, name: "sha2-512", tag: "multihash"}
reverseCodecs[0x13] = codecs["sha2-512"]
codecs["sha3-512"] = &codec{id: 0x14, name: "sha3-512", tag: "multihash"}
reverseCodecs[0x14] = codecs["sha3-512"]
codecs["sha3-384"] = &codec{id: 0x15, name: "sha3-384", tag: "multihash"}
reverseCodecs[0x15] = codecs["sha3-384"]
codecs["sha3-256"] = &codec{id: 0x16, name: "sha3-256", tag: "multihash"}
reverseCodecs[0x16] = codecs["sha3-256"]
codecs["sha3-224"] = &codec{id: 0x17, name: "sha3-224", tag: "multihash"}
reverseCodecs[0x17] = codecs["sha3-224"]
codecs["shake-128"] = &codec{id: 0x18, name: "shake-128", tag: "multihash"}
reverseCodecs[0x18] = codecs["shake-128"]
codecs["shake-256"] = &codec{id: 0x19, name: "shake-256", tag: "multihash"}
reverseCodecs[0x19] = codecs["shake-256"]
codecs["keccak-224"] = &codec{id: 0x1a, name: "keccak-224", tag: "multihash"}
reverseCodecs[0x1a] = codecs["keccak-224"]
codecs["keccak-256"] = &codec{id: 0x1b, name: "keccak-256", tag: "multihash"}
reverseCodecs[0x1b] = codecs["keccak-256"]
codecs["keccak-384"] = &codec{id: 0x1c, name: "keccak-384", tag: "multihash"}
reverseCodecs[0x1c] = codecs["keccak-384"]
codecs["keccak-512"] = &codec{id: 0x1d, name: "keccak-512", tag: "multihash"}
reverseCodecs[0x1d] = codecs["keccak-512"]
codecs["blake3"] = &codec{id: 0x1e, name: "blake3", tag: "multihash"}
reverseCodecs[0x1e] = codecs["blake3"]
codecs["dccp"] = &codec{id: 0x21, name: "dccp", tag: "multiaddr"}
reverseCodecs[0x21] = codecs["dccp"]
codecs["murmur3-128"] = &codec{id: 0x22, name: "murmur3-128", tag: "multihash"}
reverseCodecs[0x22] = codecs["murmur3-128"]
codecs["murmur3-32"] = &codec{id: 0x23, name: "murmur3-32", tag: "multihash"}
reverseCodecs[0x23] = codecs["murmur3-32"]
codecs["ip6"] = &codec{id: 0x29, name: "ip6", tag: "multiaddr"}
reverseCodecs[0x29] = codecs["ip6"]
codecs["ip6zone"] = &codec{id: 0x2a, name: "ip6zone", tag: "multiaddr"}
reverseCodecs[0x2a] = codecs["ip6zone"]
codecs["path"] = &codec{id: 0x2f, name: "path", tag: "namespace"}
reverseCodecs[0x2f] = codecs["path"]
codecs["multicodec"] = &codec{id: 0x30, name: "multicodec", tag: "multiformat"}
reverseCodecs[0x30] = codecs["multicodec"]
codecs["multihash"] = &codec{id: 0x31, name: "multihash", tag: "multiformat"}
reverseCodecs[0x31] = codecs["multihash"]
codecs["multiaddr"] = &codec{id: 0x32, name: "multiaddr", tag: "multiformat"}
reverseCodecs[0x32] = codecs["multiaddr"]
codecs["multibase"] = &codec{id: 0x33, name: "multibase", tag: "multiformat"}
reverseCodecs[0x33] = codecs["multibase"]
codecs["dns"] = &codec{id: 0x35, name: "dns", tag: "multiaddr"}
reverseCodecs[0x35] = codecs["dns"]
codecs["dns4"] = &codec{id: 0x36, name: "dns4", tag: "multiaddr"}
reverseCodecs[0x36] = codecs["dns4"]
codecs["dns6"] = &codec{id: 0x37, name: "dns6", tag: "multiaddr"}
reverseCodecs[0x37] = codecs["dns6"]
codecs["dnsaddr"] = &codec{id: 0x38, name: "dnsaddr", tag: "multiaddr"}
reverseCodecs[0x38] = codecs["dnsaddr"]
codecs["protobuf"] = &codec{id: 0x50, name: "protobuf", tag: "serialization"}
reverseCodecs[0x50] = codecs["protobuf"]
codecs["cbor"] = &codec{id: 0x51, name: "cbor", tag: "serialization"}
reverseCodecs[0x51] = codecs["cbor"]
codecs["raw"] = &codec{id: 0x55, name: "raw", tag: "ipld"}
reverseCodecs[0x55] = codecs["raw"]
codecs["dbl-sha2-256"] = &codec{id: 0x56, name: "dbl-sha2-256", tag: "multihash"}
reverseCodecs[0x56] = codecs["dbl-sha2-256"]
codecs["rlp"] = &codec{id: 0x60, name: "rlp", tag: "serialization"}
reverseCodecs[0x60] = codecs["rlp"]
codecs["bencode"] = &codec{id: 0x63, name: "bencode", tag: "serialization"}
reverseCodecs[0x63] = codecs["bencode"]
codecs["dag-pb"] = &codec{id: 0x70, name: "dag-pb", tag: "ipld"}
reverseCodecs[0x70] = codecs["dag-pb"]
codecs["dag-cbor"] = &codec{id: 0x71, name: "dag-cbor", tag: "ipld"}
reverseCodecs[0x71] = codecs["dag-cbor"]
codecs["libp2p-key"] = &codec{id: 0x72, name: "libp2p-key", tag: "ipld"}
reverseCodecs[0x72] = codecs["libp2p-key"]
codecs["git-raw"] = &codec{id: 0x78, name: "git-raw", tag: "ipld"}
reverseCodecs[0x78] = codecs["git-raw"]
codecs["torrent-info"] = &codec{id: 0x7b, name: "torrent-info", tag: "ipld"}
reverseCodecs[0x7b] = codecs["torrent-info"]
codecs["torrent-file"] = &codec{id: 0x7c, name: "torrent-file", tag: "ipld"}
reverseCodecs[0x7c] = codecs["torrent-file"]
codecs["leofcoin-block"] = &codec{id: 0x81, name: "leofcoin-block", tag: "ipld"}
reverseCodecs[0x81] = codecs["leofcoin-block"]
codecs["leofcoin-tx"] = &codec{id: 0x82, name: "leofcoin-tx", tag: "ipld"}
reverseCodecs[0x82] = codecs["leofcoin-tx"]
codecs["leofcoin-pr"] = &codec{id: 0x83, name: "leofcoin-pr", tag: "ipld"}
reverseCodecs[0x83] = codecs["leofcoin-pr"]
codecs["sctp"] = &codec{id: 0x84, name: "sctp", tag: "multiaddr"}
reverseCodecs[0x84] = codecs["sctp"]
codecs["dag-jose"] = &codec{id: 0x85, name: "dag-jose", tag: "ipld"}
reverseCodecs[0x85] = codecs["dag-jose"]
codecs["dag-cose"] = &codec{id: 0x86, name: "dag-cose", tag: "ipld"}
reverseCodecs[0x86] = codecs["dag-cose"]
codecs["eth-block"] = &codec{id: 0x90, name: "eth-block", tag: "ipld"}
reverseCodecs[0x90] = codecs["eth-block"]
codecs["eth-block-list"] = &codec{id: 0x91, name: "eth-block-list", tag: "ipld"}
reverseCodecs[0x91] = codecs["eth-block-list"]
codecs["eth-tx-trie"] = &codec{id: 0x92, name: "eth-tx-trie", tag: "ipld"}
reverseCodecs[0x92] = codecs["eth-tx-trie"]
codecs["eth-tx"] = &codec{id: 0x93, name: "eth-tx", tag: "ipld"}
reverseCodecs[0x93] = codecs["eth-tx"]
codecs["eth-tx-receipt-trie"] = &codec{id: 0x94, name: "eth-tx-receipt-trie", tag: "ipld"}
reverseCodecs[0x94] = codecs["eth-tx-receipt-trie"]
codecs["eth-tx-receipt"] = &codec{id: 0x95, name: "eth-tx-receipt", tag: "ipld"}
reverseCodecs[0x95] = codecs["eth-tx-receipt"]
codecs["eth-state-trie"] = &codec{id: 0x96, name: "eth-state-trie", tag: "ipld"}
reverseCodecs[0x96] = codecs["eth-state-trie"]
codecs["eth-account-snapshot"] = &codec{id: 0x97, name: "eth-account-snapshot", tag: "ipld"}
reverseCodecs[0x97] = codecs["eth-account-snapshot"]
codecs["eth-storage-trie"] = &codec{id: 0x98, name: "eth-storage-trie", tag: "ipld"}
reverseCodecs[0x98] = codecs["eth-storage-trie"]
codecs["bitcoin-block"] = &codec{id: 0xb0, name: "bitcoin-block", tag: "ipld"}
reverseCodecs[0xb0] = codecs["bitcoin-block"]
codecs["bitcoin-tx"] = &codec{id: 0xb1, name: "bitcoin-tx", tag: "ipld"}
reverseCodecs[0xb1] = codecs["bitcoin-tx"]
codecs["bitcoin-witness-commitment"] = &codec{id: 0xb2, name: "bitcoin-witness-commitment", tag: "ipld"}
reverseCodecs[0xb2] = codecs["bitcoin-witness-commitment"]
codecs["zcash-block"] = &codec{id: 0xc0, name: "zcash-block", tag: "ipld"}
reverseCodecs[0xc0] = codecs["zcash-block"]
codecs["zcash-tx"] = &codec{id: 0xc1, name: "zcash-tx", tag: "ipld"}
reverseCodecs[0xc1] = codecs["zcash-tx"]
codecs["caip-50"] = &codec{id: 0xca, name: "caip-50", tag: "multiformat"}
reverseCodecs[0xca] = codecs["caip-50"]
codecs["streamid"] = &codec{id: 0xce, name: "streamid", tag: "namespace"}
reverseCodecs[0xce] = codecs["streamid"]
codecs["stellar-block"] = &codec{id: 0xd0, name: "stellar-block", tag: "ipld"}
reverseCodecs[0xd0] = codecs["stellar-block"]
codecs["stellar-tx"] = &codec{id: 0xd1, name: "stellar-tx", tag: "ipld"}
reverseCodecs[0xd1] = codecs["stellar-tx"]
codecs["md4"] = &codec{id: 0xd4, name: "md4", tag: "multihash"}
reverseCodecs[0xd4] = codecs["md4"]
codecs["md5"] = &codec{id: 0xd5, name: "md5", tag: "multihash"}
reverseCodecs[0xd5] = codecs["md5"]
codecs["bmt"] = &codec{id: 0xd6, name: "bmt", tag: "multihash"}
reverseCodecs[0xd6] = codecs["bmt"]
codecs["decred-block"] = &codec{id: 0xe0, name: "decred-block", tag: "ipld"}
reverseCodecs[0xe0] = codecs["decred-block"]
codecs["decred-tx"] = &codec{id: 0xe1, name: "decred-tx", tag: "ipld"}
reverseCodecs[0xe1] = codecs["decred-tx"]
codecs["ipld-ns"] = &codec{id: 0xe2, name: "ipld-ns", tag: "namespace"}
reverseCodecs[0xe2] = codecs["ipld-ns"]
codecs["ipfs-ns"] = &codec{id: 0xe3, name: "ipfs-ns", tag: "namespace"}
reverseCodecs[0xe3] = codecs["ipfs-ns"]
codecs["swarm-ns"] = &codec{id: 0xe4, name: "swarm-ns", tag: "namespace"}
reverseCodecs[0xe4] = codecs["swarm-ns"]
codecs["ipns-ns"] = &codec{id: 0xe5, name: "ipns-ns", tag: "namespace"}
reverseCodecs[0xe5] = codecs["ipns-ns"]
codecs["zeronet"] = &codec{id: 0xe6, name: "zeronet", tag: "namespace"}
reverseCodecs[0xe6] = codecs["zeronet"]
codecs["secp256k1-pub"] = &codec{id: 0xe7, name: "secp256k1-pub", tag: "key"}
reverseCodecs[0xe7] = codecs["secp256k1-pub"]
codecs["bls12_381-g1-pub"] = &codec{id: 0xea, name: "bls12_381-g1-pub", tag: "key"}
reverseCodecs[0xea] = codecs["bls12_381-g1-pub"]
codecs["bls12_381-g2-pub"] = &codec{id: 0xeb, name: "bls12_381-g2-pub", tag: "key"}
reverseCodecs[0xeb] = codecs["bls12_381-g2-pub"]
codecs["x25519-pub"] = &codec{id: 0xec, name: "x25519-pub", tag: "key"}
reverseCodecs[0xec] = codecs["x25519-pub"]
codecs["ed25519-pub"] = &codec{id: 0xed, name: "ed25519-pub", tag: "key"}
reverseCodecs[0xed] = codecs["ed25519-pub"]
codecs["bls12_381-g1g2-pub"] = &codec{id: 0xee, name: "bls12_381-g1g2-pub", tag: "key"}
reverseCodecs[0xee] = codecs["bls12_381-g1g2-pub"]
codecs["dash-block"] = &codec{id: 0xf0, name: "dash-block", tag: "ipld"}
reverseCodecs[0xf0] = codecs["dash-block"]
codecs["dash-tx"] = &codec{id: 0xf1, name: "dash-tx", tag: "ipld"}
reverseCodecs[0xf1] = codecs["dash-tx"]
codecs["swarm-manifest"] = &codec{id: 0xfa, name: "swarm-manifest", tag: "ipld"}
reverseCodecs[0xfa] = codecs["swarm-manifest"]
codecs["swarm-feed"] = &codec{id: 0xfb, name: "swarm-feed", tag: "ipld"}
reverseCodecs[0xfb] = codecs["swarm-feed"]
codecs["udp"] = &codec{id: 0x0111, name: "udp", tag: "multiaddr"}
reverseCodecs[0x0111] = codecs["udp"]
codecs["p2p-webrtc-star"] = &codec{id: 0x0113, name: "p2p-webrtc-star", tag: "multiaddr"}
reverseCodecs[0x0113] = codecs["p2p-webrtc-star"]
codecs["p2p-webrtc-direct"] = &codec{id: 0x0114, name: "p2p-webrtc-direct", tag: "multiaddr"}
reverseCodecs[0x0114] = codecs["p2p-webrtc-direct"]
codecs["p2p-stardust"] = &codec{id: 0x0115, name: "p2p-stardust", tag: "multiaddr"}
reverseCodecs[0x0115] = codecs["p2p-stardust"]
codecs["p2p-circuit"] = &codec{id: 0x0122, name: "p2p-circuit", tag: "multiaddr"}
reverseCodecs[0x0122] = codecs["p2p-circuit"]
codecs["dag-json"] = &codec{id: 0x0129, name: "dag-json", tag: "ipld"}
reverseCodecs[0x0129] = codecs["dag-json"]
codecs["udt"] = &codec{id: 0x012d, name: "udt", tag: "multiaddr"}
reverseCodecs[0x012d] = codecs["udt"]
codecs["utp"] = &codec{id: 0x012e, name: "utp", tag: "multiaddr"}
reverseCodecs[0x012e] = codecs["utp"]
codecs["unix"] = &codec{id: 0x0190, name: "unix", tag: "multiaddr"}
reverseCodecs[0x0190] = codecs["unix"]
codecs["thread"] = &codec{id: 0x0196, name: "thread", tag: "multiaddr"}
reverseCodecs[0x0196] = codecs["thread"]
codecs["p2p"] = &codec{id: 0x01a5, name: "p2p", tag: "multiaddr"}
reverseCodecs[0x01a5] = codecs["p2p"]
codecs["ipfs"] = &codec{id: 0x01a5, name: "ipfs", tag: "multiaddr"}
codecs["https"] = &codec{id: 0x01bb, name: "https", tag: "multiaddr"}
reverseCodecs[0x01bb] = codecs["https"]
codecs["onion"] = &codec{id: 0x01bc, name: "onion", tag: "multiaddr"}
reverseCodecs[0x01bc] = codecs["onion"]
codecs["onion3"] = &codec{id: 0x01bd, name: "onion3", tag: "multiaddr"}
reverseCodecs[0x01bd] = codecs["onion3"]
codecs["garlic64"] = &codec{id: 0x01be, name: "garlic64", tag: "multiaddr"}
reverseCodecs[0x01be] = codecs["garlic64"]
codecs["garlic32"] = &codec{id: 0x01bf, name: "garlic32", tag: "multiaddr"}
reverseCodecs[0x01bf] = codecs["garlic32"]
codecs["tls"] = &codec{id: 0x01c0, name: "tls", tag: "multiaddr"}
reverseCodecs[0x01c0] = codecs["tls"]
codecs["quic"] = &codec{id: 0x01cc, name: "quic", tag: "multiaddr"}
reverseCodecs[0x01cc] = codecs["quic"]
codecs["ws"] = &codec{id: 0x01dd, name: "ws", tag: "multiaddr"}
reverseCodecs[0x01dd] = codecs["ws"]
codecs["wss"] = &codec{id: 0x01de, name: "wss", tag: "multiaddr"}
reverseCodecs[0x01de] = codecs["wss"]
codecs["p2p-websocket-star"] = &codec{id: 0x01df, name: "p2p-websocket-star", tag: "multiaddr"}
reverseCodecs[0x01df] = codecs["p2p-websocket-star"]
codecs["http"] = &codec{id: 0x01e0, name: "http", tag: "multiaddr"}
reverseCodecs[0x01e0] = codecs["http"]
codecs["json"] = &codec{id: 0x0200, name: "json", tag: "serialization"}
reverseCodecs[0x0200] = codecs["json"]
codecs["messagepack"] = &codec{id: 0x0201, name: "messagepack", tag: "serialization"}
reverseCodecs[0x0201] = codecs["messagepack"]
codecs["libp2p-peer-record"] = &codec{id: 0x0301, name: "libp2p-peer-record", tag: "libp2p"}
reverseCodecs[0x0301] = codecs["libp2p-peer-record"]
codecs["libp2p-relay-rsvp"] = &codec{id: 0x0302, name: "libp2p-relay-rsvp", tag: "libp2p"}
reverseCodecs[0x0302] = codecs["libp2p-relay-rsvp"]
codecs["sha2-256-trunc254-padded"] = &codec{id: 0x1012, name: "sha2-256-trunc254-padded", tag: "multihash"}
reverseCodecs[0x1012] = codecs["sha2-256-trunc254-padded"]
codecs["ripemd-128"] = &codec{id: 0x1052, name: "ripemd-128", tag: "multihash"}
reverseCodecs[0x1052] = codecs["ripemd-128"]
codecs["ripemd-160"] = &codec{id: 0x1053, name: "ripemd-160", tag: "multihash"}
reverseCodecs[0x1053] = codecs["ripemd-160"]
codecs["ripemd-256"] = &codec{id: 0x1054, name: "ripemd-256", tag: "multihash"}
reverseCodecs[0x1054] = codecs["ripemd-256"]
codecs["ripemd-320"] = &codec{id: 0x1055, name: "ripemd-320", tag: "multihash"}
reverseCodecs[0x1055] = codecs["ripemd-320"]
codecs["x11"] = &codec{id: 0x1100, name: "x11", tag: "multihash"}
reverseCodecs[0x1100] = codecs["x11"]
codecs["p256-pub"] = &codec{id: 0x1200, name: "p256-pub", tag: "key"}
reverseCodecs[0x1200] = codecs["p256-pub"]
codecs["p384-pub"] = &codec{id: 0x1201, name: "p384-pub", tag: "key"}
reverseCodecs[0x1201] = codecs["p384-pub"]
codecs["p521-pub"] = &codec{id: 0x1202, name: "p521-pub", tag: "key"}
reverseCodecs[0x1202] = codecs["p521-pub"]
codecs["ed448-pub"] = &codec{id: 0x1203, name: "ed448-pub", tag: "key"}
reverseCodecs[0x1203] = codecs["ed448-pub"]
codecs["x448-pub"] = &codec{id: 0x1204, name: "x448-pub", tag: "key"}
reverseCodecs[0x1204] = codecs["x448-pub"]
codecs["ed25519-priv"] = &codec{id: 0x1300, name: "ed25519-priv", tag: "key"}
reverseCodecs[0x1300] = codecs["ed25519-priv"]
codecs["secp256k1-priv"] = &codec{id: 0x1301, name: "secp256k1-priv", tag: "key"}
reverseCodecs[0x1301] = codecs["secp256k1-priv"]
codecs["x25519-priv"] = &codec{id: 0x1302, name: "x25519-priv", tag: "key"}
reverseCodecs[0x1302] = codecs["x25519-priv"]
codecs["kangarootwelve"] = &codec{id: 0x1d01, name: "kangarootwelve", tag: "multihash"}
reverseCodecs[0x1d01] = codecs["kangarootwelve"]
codecs["sm3-256"] = &codec{id: 0x534d, name: "sm3-256", tag: "multihash"}
reverseCodecs[0x534d] = codecs["sm3-256"]
codecs["blake2b-8"] = &codec{id: 0xb201, name: "blake2b-8", tag: "multihash"}
reverseCodecs[0xb201] = codecs["blake2b-8"]
codecs["blake2b-16"] = &codec{id: 0xb202, name: "blake2b-16", tag: "multihash"}
reverseCodecs[0xb202] = codecs["blake2b-16"]
codecs["blake2b-24"] = &codec{id: 0xb203, name: "blake2b-24", tag: "multihash"}
reverseCodecs[0xb203] = codecs["blake2b-24"]
codecs["blake2b-32"] = &codec{id: 0xb204, name: "blake2b-32", tag: "multihash"}
reverseCodecs[0xb204] = codecs["blake2b-32"]
codecs["blake2b-40"] = &codec{id: 0xb205, name: "blake2b-40", tag: "multihash"}
reverseCodecs[0xb205] = codecs["blake2b-40"]
codecs["blake2b-48"] = &codec{id: 0xb206, name: "blake2b-48", tag: "multihash"}
reverseCodecs[0xb206] = codecs["blake2b-48"]
codecs["blake2b-56"] = &codec{id: 0xb207, name: "blake2b-56", tag: "multihash"}
reverseCodecs[0xb207] = codecs["blake2b-56"]
codecs["blake2b-64"] = &codec{id: 0xb208, name: "blake2b-64", tag: "multihash"}
reverseCodecs[0xb208] = codecs["blake2b-64"]
codecs["blake2b-72"] = &codec{id: 0xb209, name: "blake2b-72", tag: "multihash"}
reverseCodecs[0xb209] = codecs["blake2b-72"]
codecs["blake2b-80"] = &codec{id: 0xb20a, name: "blake2b-80", tag: "multihash"}
reverseCodecs[0xb20a] = codecs["blake2b-80"]
codecs["blake2b-88"] = &codec{id: 0xb20b, name: "blake2b-88", tag: "multihash"}
reverseCodecs[0xb20b] = codecs["blake2b-88"]
codecs["blake2b-96"] = &codec{id: 0xb20c, name: "blake2b-96", tag: "multihash"}
reverseCodecs[0xb20c] = codecs["blake2b-96"]
codecs["blake2b-104"] = &codec{id: 0xb20d, name: "blake2b-104", tag: "multihash"}
reverseCodecs[0xb20d] = codecs["blake2b-104"]
codecs["blake2b-112"] = &codec{id: 0xb20e, name: "blake2b-112", tag: "multihash"}
reverseCodecs[0xb20e] = codecs["blake2b-112"]
codecs["blake2b-120"] = &codec{id: 0xb20f, name: "blake2b-120", tag: "multihash"}
reverseCodecs[0xb20f] = codecs["blake2b-120"]
codecs["blake2b-128"] = &codec{id: 0xb210, name: "blake2b-128", tag: "multihash"}
reverseCodecs[0xb210] = codecs["blake2b-128"]
codecs["blake2b-136"] = &codec{id: 0xb211, name: "blake2b-136", tag: "multihash"}
reverseCodecs[0xb211] = codecs["blake2b-136"]
codecs["blake2b-144"] = &codec{id: 0xb212, name: "blake2b-144", tag: "multihash"}
reverseCodecs[0xb212] = codecs["blake2b-144"]
codecs["blake2b-152"] = &codec{id: 0xb213, name: "blake2b-152", tag: "multihash"}
reverseCodecs[0xb213] = codecs["blake2b-152"]
codecs["blake2b-160"] = &codec{id: 0xb214, name: "blake2b-160", tag: "multihash"}
reverseCodecs[0xb214] = codecs["blake2b-160"]
codecs["blake2b-168"] = &codec{id: 0xb215, name: "blake2b-168", tag: "multihash"}
reverseCodecs[0xb215] = codecs["blake2b-168"]
codecs["blake2b-176"] = &codec{id: 0xb216, name: "blake2b-176", tag: "multihash"}
reverseCodecs[0xb216] = codecs["blake2b-176"]
codecs["blake2b-184"] = &codec{id: 0xb217, name: "blake2b-184", tag: "multihash"}
reverseCodecs[0xb217] = codecs["blake2b-184"]
codecs["blake2b-192"] = &codec{id: 0xb218, name: "blake2b-192", tag: "multihash"}
reverseCodecs[0xb218] = codecs["blake2b-192"]
codecs["blake2b-200"] = &codec{id: 0xb219, name: "blake2b-200", tag: "multihash"}
reverseCodecs[0xb219] = codecs["blake2b-200"]
codecs["blake2b-208"] = &codec{id: 0xb21a, name: "blake2b-208", tag: "multihash"}
reverseCodecs[0xb21a] = codecs["blake2b-208"]
codecs["blake2b-216"] = &codec{id: 0xb21b, name: "blake2b-216", tag: "multihash"}
reverseCodecs[0xb21b] = codecs["blake2b-216"]
codecs["blake2b-224"] = &codec{id: 0xb21c, name: "blake2b-224", tag: "multihash"}
reverseCodecs[0xb21c] = codecs["blake2b-224"]
codecs["blake2b-232"] = &codec{id: 0xb21d, name: "blake2b-232", tag: "multihash"}
reverseCodecs[0xb21d] = codecs["blake2b-232"]
codecs["blake2b-240"] = &codec{id: 0xb21e, name: "blake2b-240", tag: "multihash"}
reverseCodecs[0xb21e] = codecs["blake2b-240"]
codecs["blake2b-248"] = &codec{id: 0xb21f, name: "blake2b-248", tag: "multihash"}
reverseCodecs[0xb21f] = codecs["blake2b-248"]
codecs["blake2b-256"] = &codec{id: 0xb220, name: "blake2b-256", tag: "multihash"}
reverseCodecs[0xb220] = codecs["blake2b-256"]
codecs["blake2b-264"] = &codec{id: 0xb221, name: "blake2b-264", tag: "multihash"}
reverseCodecs[0xb221] = codecs["blake2b-264"]
codecs["blake2b-272"] = &codec{id: 0xb222, name: "blake2b-272", tag: "multihash"}
reverseCodecs[0xb222] = codecs["blake2b-272"]
codecs["blake2b-280"] = &codec{id: 0xb223, name: "blake2b-280", tag: "multihash"}
reverseCodecs[0xb223] = codecs["blake2b-280"]
codecs["blake2b-288"] = &codec{id: 0xb224, name: "blake2b-288", tag: "multihash"}
reverseCodecs[0xb224] = codecs["blake2b-288"]
codecs["blake2b-296"] = &codec{id: 0xb225, name: "blake2b-296", tag: "multihash"}
reverseCodecs[0xb225] = codecs["blake2b-296"]
codecs["blake2b-304"] = &codec{id: 0xb226, name: "blake2b-304", tag: "multihash"}
reverseCodecs[0xb226] = codecs["blake2b-304"]
codecs["blake2b-312"] = &codec{id: 0xb227, name: "blake2b-312", tag: "multihash"}
reverseCodecs[0xb227] = codecs["blake2b-312"]
codecs["blake2b-320"] = &codec{id: 0xb228, name: "blake2b-320", tag: "multihash"}
reverseCodecs[0xb228] = codecs["blake2b-320"]
codecs["blake2b-328"] = &codec{id: 0xb229, name: "blake2b-328", tag: "multihash"}
reverseCodecs[0xb229] = codecs["blake2b-328"]
codecs["blake2b-336"] = &codec{id: 0xb22a, name: "blake2b-336", tag: "multihash"}
reverseCodecs[0xb22a] = codecs["blake2b-336"]
codecs["blake2b-344"] = &codec{id: 0xb22b, name: "blake2b-344", tag: "multihash"}
reverseCodecs[0xb22b] = codecs["blake2b-344"]
codecs["blake2b-352"] = &codec{id: 0xb22c, name: "blake2b-352", tag: "multihash"}
reverseCodecs[0xb22c] = codecs["blake2b-352"]
codecs["blake2b-360"] = &codec{id: 0xb22d, name: "blake2b-360", tag: "multihash"}
reverseCodecs[0xb22d] = codecs["blake2b-360"]
codecs["blake2b-368"] = &codec{id: 0xb22e, name: "blake2b-368", tag: "multihash"}
reverseCodecs[0xb22e] = codecs["blake2b-368"]
codecs["blake2b-376"] = &codec{id: 0xb22f, name: "blake2b-376", tag: "multihash"}
reverseCodecs[0xb22f] = codecs["blake2b-376"]
codecs["blake2b-384"] = &codec{id: 0xb230, name: "blake2b-384", tag: "multihash"}
reverseCodecs[0xb230] = codecs["blake2b-384"]
codecs["blake2b-392"] = &codec{id: 0xb231, name: "blake2b-392", tag: "multihash"}
reverseCodecs[0xb231] = codecs["blake2b-392"]
codecs["blake2b-400"] = &codec{id: 0xb232, name: "blake2b-400", tag: "multihash"}
reverseCodecs[0xb232] = codecs["blake2b-400"]
codecs["blake2b-408"] = &codec{id: 0xb233, name: "blake2b-408", tag: "multihash"}
reverseCodecs[0xb233] = codecs["blake2b-408"]
codecs["blake2b-416"] = &codec{id: 0xb234, name: "blake2b-416", tag: "multihash"}
reverseCodecs[0xb234] = codecs["blake2b-416"]
codecs["blake2b-424"] = &codec{id: 0xb235, name: "blake2b-424", tag: "multihash"}
reverseCodecs[0xb235] = codecs["blake2b-424"]
codecs["blake2b-432"] = &codec{id: 0xb236, name: "blake2b-432", tag: "multihash"}
reverseCodecs[0xb236] = codecs["blake2b-432"]
codecs["blake2b-440"] = &codec{id: 0xb237, name: "blake2b-440", tag: "multihash"}
reverseCodecs[0xb237] = codecs["blake2b-440"]
codecs["blake2b-448"] = &codec{id: 0xb238, name: "blake2b-448", tag: "multihash"}
reverseCodecs[0xb238] = codecs["blake2b-448"]
codecs["blake2b-456"] = &codec{id: 0xb239, name: "blake2b-456", tag: "multihash"}
reverseCodecs[0xb239] = codecs["blake2b-456"]
codecs["blake2b-464"] = &codec{id: 0xb23a, name: "blake2b-464", tag: "multihash"}
reverseCodecs[0xb23a] = codecs["blake2b-464"]
codecs["blake2b-472"] = &codec{id: 0xb23b, name: "blake2b-472", tag: "multihash"}
reverseCodecs[0xb23b] = codecs["blake2b-472"]
codecs["blake2b-480"] = &codec{id: 0xb23c, name: "blake2b-480", tag: "multihash"}
reverseCodecs[0xb23c] = codecs["blake2b-480"]
codecs["blake2b-488"] = &codec{id: 0xb23d, name: "blake2b-488", tag: "multihash"}
reverseCodecs[0xb23d] = codecs["blake2b-488"]
codecs["blake2b-496"] = &codec{id: 0xb23e, name: "blake2b-496", tag: "multihash"}
reverseCodecs[0xb23e] = codecs["blake2b-496"]
codecs["blake2b-504"] = &codec{id: 0xb23f, name: "blake2b-504", tag: "multihash"}
reverseCodecs[0xb23f] = codecs["blake2b-504"]
codecs["blake2b-512"] = &codec{id: 0xb240, name: "blake2b-512", tag: "multihash"}
reverseCodecs[0xb240] = codecs["blake2b-512"]
codecs["blake2s-8"] = &codec{id: 0xb241, name: "blake2s-8", tag: "multihash"}
reverseCodecs[0xb241] = codecs["blake2s-8"]
codecs["blake2s-16"] = &codec{id: 0xb242, name: "blake2s-16", tag: "multihash"}
reverseCodecs[0xb242] = codecs["blake2s-16"]
codecs["blake2s-24"] = &codec{id: 0xb243, name: "blake2s-24", tag: "multihash"}
reverseCodecs[0xb243] = codecs["blake2s-24"]
codecs["blake2s-32"] = &codec{id: 0xb244, name: "blake2s-32", tag: "multihash"}
reverseCodecs[0xb244] = codecs["blake2s-32"]
codecs["blake2s-40"] = &codec{id: 0xb245, name: "blake2s-40", tag: "multihash"}
reverseCodecs[0xb245] = codecs["blake2s-40"]
codecs["blake2s-48"] = &codec{id: 0xb246, name: "blake2s-48", tag: "multihash"}
reverseCodecs[0xb246] = codecs["blake2s-48"]
codecs["blake2s-56"] = &codec{id: 0xb247, name: "blake2s-56", tag: "multihash"}
reverseCodecs[0xb247] = codecs["blake2s-56"]
codecs["blake2s-64"] = &codec{id: 0xb248, name: "blake2s-64", tag: "multihash"}
reverseCodecs[0xb248] = codecs["blake2s-64"]
codecs["blake2s-72"] = &codec{id: 0xb249, name: "blake2s-72", tag: "multihash"}
reverseCodecs[0xb249] = codecs["blake2s-72"]
codecs["blake2s-80"] = &codec{id: 0xb24a, name: "blake2s-80", tag: "multihash"}
reverseCodecs[0xb24a] = codecs["blake2s-80"]
codecs["blake2s-88"] = &codec{id: 0xb24b, name: "blake2s-88", tag: "multihash"}
reverseCodecs[0xb24b] = codecs["blake2s-88"]
codecs["blake2s-96"] = &codec{id: 0xb24c, name: "blake2s-96", tag: "multihash"}
reverseCodecs[0xb24c] = codecs["blake2s-96"]
codecs["blake2s-104"] = &codec{id: 0xb24d, name: "blake2s-104", tag: "multihash"}
reverseCodecs[0xb24d] = codecs["blake2s-104"]
codecs["blake2s-112"] = &codec{id: 0xb24e, name: "blake2s-112", tag: "multihash"}
reverseCodecs[0xb24e] = codecs["blake2s-112"]
codecs["blake2s-120"] = &codec{id: 0xb24f, name: "blake2s-120", tag: "multihash"}
reverseCodecs[0xb24f] = codecs["blake2s-120"]
codecs["blake2s-128"] = &codec{id: 0xb250, name: "blake2s-128", tag: "multihash"}
reverseCodecs[0xb250] = codecs["blake2s-128"]
codecs["blake2s-136"] = &codec{id: 0xb251, name: "blake2s-136", tag: "multihash"}
reverseCodecs[0xb251] = codecs["blake2s-136"]
codecs["blake2s-144"] = &codec{id: 0xb252, name: "blake2s-144", tag: "multihash"}
reverseCodecs[0xb252] = codecs["blake2s-144"]
codecs["blake2s-152"] = &codec{id: 0xb253, name: "blake2s-152", tag: "multihash"}
reverseCodecs[0xb253] = codecs["blake2s-152"]
codecs["blake2s-160"] = &codec{id: 0xb254, name: "blake2s-160", tag: "multihash"}
reverseCodecs[0xb254] = codecs["blake2s-160"]
codecs["blake2s-168"] = &codec{id: 0xb255, name: "blake2s-168", tag: "multihash"}
reverseCodecs[0xb255] = codecs["blake2s-168"]
codecs["blake2s-176"] = &codec{id: 0xb256, name: "blake2s-176", tag: "multihash"}
reverseCodecs[0xb256] = codecs["blake2s-176"]
codecs["blake2s-184"] = &codec{id: 0xb257, name: "blake2s-184", tag: "multihash"}
reverseCodecs[0xb257] = codecs["blake2s-184"]
codecs["blake2s-192"] = &codec{id: 0xb258, name: "blake2s-192", tag: "multihash"}
reverseCodecs[0xb258] = codecs["blake2s-192"]
codecs["blake2s-200"] = &codec{id: 0xb259, name: "blake2s-200", tag: "multihash"}
reverseCodecs[0xb259] = codecs["blake2s-200"]
codecs["blake2s-208"] = &codec{id: 0xb25a, name: "blake2s-208", tag: "multihash"}
reverseCodecs[0xb25a] = codecs["blake2s-208"]
codecs["blake2s-216"] = &codec{id: 0xb25b, name: "blake2s-216", tag: "multihash"}
reverseCodecs[0xb25b] = codecs["blake2s-216"]
codecs["blake2s-224"] = &codec{id: 0xb25c, name: "blake2s-224", tag: "multihash"}
reverseCodecs[0xb25c] = codecs["blake2s-224"]
codecs["blake2s-232"] = &codec{id: 0xb25d, name: "blake2s-232", tag: "multihash"}
reverseCodecs[0xb25d] = codecs["blake2s-232"]
codecs["blake2s-240"] = &codec{id: 0xb25e, name: "blake2s-240", tag: "multihash"}
reverseCodecs[0xb25e] = codecs["blake2s-240"]
codecs["blake2s-248"] = &codec{id: 0xb25f, name: "blake2s-248", tag: "multihash"}
reverseCodecs[0xb25f] = codecs["blake2s-248"]
codecs["blake2s-256"] = &codec{id: 0xb260, name: "blake2s-256", tag: "multihash"}
reverseCodecs[0xb260] = codecs["blake2s-256"]
codecs["skein256-8"] = &codec{id: 0xb301, name: "skein256-8", tag: "multihash"}
reverseCodecs[0xb301] = codecs["skein256-8"]
codecs["skein256-16"] = &codec{id: 0xb302, name: "skein256-16", tag: "multihash"}
reverseCodecs[0xb302] = codecs["skein256-16"]
codecs["skein256-24"] = &codec{id: 0xb303, name: "skein256-24", tag: "multihash"}
reverseCodecs[0xb303] = codecs["skein256-24"]
codecs["skein256-32"] = &codec{id: 0xb304, name: "skein256-32", tag: "multihash"}
reverseCodecs[0xb304] = codecs["skein256-32"]
codecs["skein256-40"] = &codec{id: 0xb305, name: "skein256-40", tag: "multihash"}
reverseCodecs[0xb305] = codecs["skein256-40"]
codecs["skein256-48"] = &codec{id: 0xb306, name: "skein256-48", tag: "multihash"}
reverseCodecs[0xb306] = codecs["skein256-48"]
codecs["skein256-56"] = &codec{id: 0xb307, name: "skein256-56", tag: "multihash"}
reverseCodecs[0xb307] = codecs["skein256-56"]
codecs["skein256-64"] = &codec{id: 0xb308, name: "skein256-64", tag: "multihash"}
reverseCodecs[0xb308] = codecs["skein256-64"]
codecs["skein256-72"] = &codec{id: 0xb309, name: "skein256-72", tag: "multihash"}
reverseCodecs[0xb309] = codecs["skein256-72"]
codecs["skein256-80"] = &codec{id: 0xb30a, name: "skein256-80", tag: "multihash"}
reverseCodecs[0xb30a] = codecs["skein256-80"]
codecs["skein256-88"] = &codec{id: 0xb30b, name: "skein256-88", tag: "multihash"}
reverseCodecs[0xb30b] = codecs["skein256-88"]
codecs["skein256-96"] = &codec{id: 0xb30c, name: "skein256-96", tag: "multihash"}
reverseCodecs[0xb30c] = codecs["skein256-96"]
codecs["skein256-104"] = &codec{id: 0xb30d, name: "skein256-104", tag: "multihash"}
reverseCodecs[0xb30d] = codecs["skein256-104"]
codecs["skein256-112"] = &codec{id: 0xb30e, name: "skein256-112", tag: "multihash"}
reverseCodecs[0xb30e] = codecs["skein256-112"]
codecs["skein256-120"] = &codec{id: 0xb30f, name: "skein256-120", tag: "multihash"}
reverseCodecs[0xb30f] = codecs["skein256-120"]
codecs["skein256-128"] = &codec{id: 0xb310, name: "skein256-128", tag: "multihash"}
reverseCodecs[0xb310] = codecs["skein256-128"]
codecs["skein256-136"] = &codec{id: 0xb311, name: "skein256-136", tag: "multihash"}
reverseCodecs[0xb311] = codecs["skein256-136"]
codecs["skein256-144"] = &codec{id: 0xb312, name: "skein256-144", tag: "multihash"}
reverseCodecs[0xb312] = codecs["skein256-144"]
codecs["skein256-152"] = &codec{id: 0xb313, name: "skein256-152", tag: "multihash"}
reverseCodecs[0xb313] = codecs["skein256-152"]
codecs["skein256-160"] = &codec{id: 0xb314, name: "skein256-160", tag: "multihash"}
reverseCodecs[0xb314] = codecs["skein256-160"]
codecs["skein256-168"] = &codec{id: 0xb315, name: "skein256-168", tag: "multihash"}
reverseCodecs[0xb315] = codecs["skein256-168"]
codecs["skein256-176"] = &codec{id: 0xb316, name: "skein256-176", tag: "multihash"}
reverseCodecs[0xb316] = codecs["skein256-176"]
codecs["skein256-184"] = &codec{id: 0xb317, name: "skein256-184", tag: "multihash"}
reverseCodecs[0xb317] = codecs["skein256-184"]
codecs["skein256-192"] = &codec{id: 0xb318, name: "skein256-192", tag: "multihash"}
reverseCodecs[0xb318] = codecs["skein256-192"]
codecs["skein256-200"] = &codec{id: 0xb319, name: "skein256-200", tag: "multihash"}
reverseCodecs[0xb319] = codecs["skein256-200"]
codecs["skein256-208"] = &codec{id: 0xb31a, name: "skein256-208", tag: "multihash"}
reverseCodecs[0xb31a] = codecs["skein256-208"]
codecs["skein256-216"] = &codec{id: 0xb31b, name: "skein256-216", tag: "multihash"}
reverseCodecs[0xb31b] = codecs["skein256-216"]
codecs["skein256-224"] = &codec{id: 0xb31c, name: "skein256-224", tag: "multihash"}
reverseCodecs[0xb31c] = codecs["skein256-224"]
codecs["skein256-232"] = &codec{id: 0xb31d, name: "skein256-232", tag: "multihash"}
reverseCodecs[0xb31d] = codecs["skein256-232"]
codecs["skein256-240"] = &codec{id: 0xb31e, name: "skein256-240", tag: "multihash"}
reverseCodecs[0xb31e] = codecs["skein256-240"]
codecs["skein256-248"] = &codec{id: 0xb31f, name: "skein256-248", tag: "multihash"}
reverseCodecs[0xb31f] = codecs["skein256-248"]
codecs["skein256-256"] = &codec{id: 0xb320, name: "skein256-256", tag: "multihash"}
reverseCodecs[0xb320] = codecs["skein256-256"]
codecs["skein512-8"] = &codec{id: 0xb321, name: "skein512-8", tag: "multihash"}
reverseCodecs[0xb321] = codecs["skein512-8"]
codecs["skein512-16"] = &codec{id: 0xb322, name: "skein512-16", tag: "multihash"}
reverseCodecs[0xb322] = codecs["skein512-16"]
codecs["skein512-24"] = &codec{id: 0xb323, name: "skein512-24", tag: "multihash"}
reverseCodecs[0xb323] = codecs["skein512-24"]
codecs["skein512-32"] = &codec{id: 0xb324, name: "skein512-32", tag: "multihash"}
reverseCodecs[0xb324] = codecs["skein512-32"]
codecs["skein512-40"] = &codec{id: 0xb325, name: "skein512-40", tag: "multihash"}
reverseCodecs[0xb325] = codecs["skein512-40"]
codecs["skein512-48"] = &codec{id: 0xb326, name: "skein512-48", tag: "multihash"}
reverseCodecs[0xb326] = codecs["skein512-48"]
codecs["skein512-56"] = &codec{id: 0xb327, name: "skein512-56", tag: "multihash"}
reverseCodecs[0xb327] = codecs["skein512-56"]
codecs["skein512-64"] = &codec{id: 0xb328, name: "skein512-64", tag: "multihash"}
reverseCodecs[0xb328] = codecs["skein512-64"]
codecs["skein512-72"] = &codec{id: 0xb329, name: "skein512-72", tag: "multihash"}
reverseCodecs[0xb329] = codecs["skein512-72"]
codecs["skein512-80"] = &codec{id: 0xb32a, name: "skein512-80", tag: "multihash"}
reverseCodecs[0xb32a] = codecs["skein512-80"]
codecs["skein512-88"] = &codec{id: 0xb32b, name: "skein512-88", tag: "multihash"}
reverseCodecs[0xb32b] = codecs["skein512-88"]
codecs["skein512-96"] = &codec{id: 0xb32c, name: "skein512-96", tag: "multihash"}
reverseCodecs[0xb32c] = codecs["skein512-96"]
codecs["skein512-104"] = &codec{id: 0xb32d, name: "skein512-104", tag: "multihash"}
reverseCodecs[0xb32d] = codecs["skein512-104"]
codecs["skein512-112"] = &codec{id: 0xb32e, name: "skein512-112", tag: "multihash"}
reverseCodecs[0xb32e] = codecs["skein512-112"]
codecs["skein512-120"] = &codec{id: 0xb32f, name: "skein512-120", tag: "multihash"}
reverseCodecs[0xb32f] = codecs["skein512-120"]
codecs["skein512-128"] = &codec{id: 0xb330, name: "skein512-128", tag: "multihash"}
reverseCodecs[0xb330] = codecs["skein512-128"]
codecs["skein512-136"] = &codec{id: 0xb331, name: "skein512-136", tag: "multihash"}
reverseCodecs[0xb331] = codecs["skein512-136"]
codecs["skein512-144"] = &codec{id: 0xb332, name: "skein512-144", tag: "multihash"}
reverseCodecs[0xb332] = codecs["skein512-144"]
codecs["skein512-152"] = &codec{id: 0xb333, name: "skein512-152", tag: "multihash"}
reverseCodecs[0xb333] = codecs["skein512-152"]
codecs["skein512-160"] = &codec{id: 0xb334, name: "skein512-160", tag: "multihash"}
reverseCodecs[0xb334] = codecs["skein512-160"]
codecs["skein512-168"] = &codec{id: 0xb335, name: "skein512-168", tag: "multihash"}
reverseCodecs[0xb335] = codecs["skein512-168"]
codecs["skein512-176"] = &codec{id: 0xb336, name: "skein512-176", tag: "multihash"}
reverseCodecs[0xb336] = codecs["skein512-176"]
codecs["skein512-184"] = &codec{id: 0xb337, name: "skein512-184", tag: "multihash"}
reverseCodecs[0xb337] = codecs["skein512-184"]
codecs["skein512-192"] = &codec{id: 0xb338, name: "skein512-192", tag: "multihash"}
reverseCodecs[0xb338] = codecs["skein512-192"]
codecs["skein512-200"] = &codec{id: 0xb339, name: "skein512-200", tag: "multihash"}
reverseCodecs[0xb339] = codecs["skein512-200"]
codecs["skein512-208"] = &codec{id: 0xb33a, name: "skein512-208", tag: "multihash"}
reverseCodecs[0xb33a] = codecs["skein512-208"]
codecs["skein512-216"] = &codec{id: 0xb33b, name: "skein512-216", tag: "multihash"}
reverseCodecs[0xb33b] = codecs["skein512-216"]
codecs["skein512-224"] = &codec{id: 0xb33c, name: "skein512-224", tag: "multihash"}
reverseCodecs[0xb33c] = codecs["skein512-224"]
codecs["skein512-232"] = &codec{id: 0xb33d, name: "skein512-232", tag: "multihash"}
reverseCodecs[0xb33d] = codecs["skein512-232"]
codecs["skein512-240"] = &codec{id: 0xb33e, name: "skein512-240", tag: "multihash"}
reverseCodecs[0xb33e] = codecs["skein512-240"]
codecs["skein512-248"] = &codec{id: 0xb33f, name: "skein512-248", tag: "multihash"}
reverseCodecs[0xb33f] = codecs["skein512-248"]
codecs["skein512-256"] = &codec{id: 0xb340, name: "skein512-256", tag: "multihash"}
reverseCodecs[0xb340] = codecs["skein512-256"]
codecs["skein512-264"] = &codec{id: 0xb341, name: "skein512-264", tag: "multihash"}
reverseCodecs[0xb341] = codecs["skein512-264"]
codecs["skein512-272"] = &codec{id: 0xb342, name: "skein512-272", tag: "multihash"}
reverseCodecs[0xb342] = codecs["skein512-272"]
codecs["skein512-280"] = &codec{id: 0xb343, name: "skein512-280", tag: "multihash"}
reverseCodecs[0xb343] = codecs["skein512-280"]
codecs["skein512-288"] = &codec{id: 0xb344, name: "skein512-288", tag: "multihash"}
reverseCodecs[0xb344] = codecs["skein512-288"]
codecs["skein512-296"] = &codec{id: 0xb345, name: "skein512-296", tag: "multihash"}
reverseCodecs[0xb345] = codecs["skein512-296"]
codecs["skein512-304"] = &codec{id: 0xb346, name: "skein512-304", tag: "multihash"}
reverseCodecs[0xb346] = codecs["skein512-304"]
codecs["skein512-312"] = &codec{id: 0xb347, name: "skein512-312", tag: "multihash"}
reverseCodecs[0xb347] = codecs["skein512-312"]
codecs["skein512-320"] = &codec{id: 0xb348, name: "skein512-320", tag: "multihash"}
reverseCodecs[0xb348] = codecs["skein512-320"]
codecs["skein512-328"] = &codec{id: 0xb349, name: "skein512-328", tag: "multihash"}
reverseCodecs[0xb349] = codecs["skein512-328"]
codecs["skein512-336"] = &codec{id: 0xb34a, name: "skein512-336", tag: "multihash"}
reverseCodecs[0xb34a] = codecs["skein512-336"]
codecs["skein512-344"] = &codec{id: 0xb34b, name: "skein512-344", tag: "multihash"}
reverseCodecs[0xb34b] = codecs["skein512-344"]
codecs["skein512-352"] = &codec{id: 0xb34c, name: "skein512-352", tag: "multihash"}
reverseCodecs[0xb34c] = codecs["skein512-352"]
codecs["skein512-360"] = &codec{id: 0xb34d, name: "skein512-360", tag: "multihash"}
reverseCodecs[0xb34d] = codecs["skein512-360"]
codecs["skein512-368"] = &codec{id: 0xb34e, name: "skein512-368", tag: "multihash"}
reverseCodecs[0xb34e] = codecs["skein512-368"]
codecs["skein512-376"] = &codec{id: 0xb34f, name: "skein512-376", tag: "multihash"}
reverseCodecs[0xb34f] = codecs["skein512-376"]
codecs["skein512-384"] = &codec{id: 0xb350, name: "skein512-384", tag: "multihash"}
reverseCodecs[0xb350] = codecs["skein512-384"]
codecs["skein512-392"] = &codec{id: 0xb351, name: "skein512-392", tag: "multihash"}
reverseCodecs[0xb351] = codecs["skein512-392"]
codecs["skein512-400"] = &codec{id: 0xb352, name: "skein512-400", tag: "multihash"}
reverseCodecs[0xb352] = codecs["skein512-400"]
codecs["skein512-408"] = &codec{id: 0xb353, name: "skein512-408", tag: "multihash"}
reverseCodecs[0xb353] = codecs["skein512-408"]
codecs["skein512-416"] = &codec{id: 0xb354, name: "skein512-416", tag: "multihash"}
reverseCodecs[0xb354] = codecs["skein512-416"]
codecs["skein512-424"] = &codec{id: 0xb355, name: "skein512-424", tag: "multihash"}
reverseCodecs[0xb355] = codecs["skein512-424"]
codecs["skein512-432"] = &codec{id: 0xb356, name: "skein512-432", tag: "multihash"}
reverseCodecs[0xb356] = codecs["skein512-432"]
codecs["skein512-440"] = &codec{id: 0xb357, name: "skein512-440", tag: "multihash"}
reverseCodecs[0xb357] = codecs["skein512-440"]
codecs["skein512-448"] = &codec{id: 0xb358, name: "skein512-448", tag: "multihash"}
reverseCodecs[0xb358] = codecs["skein512-448"]
codecs["skein512-456"] = &codec{id: 0xb359, name: "skein512-456", tag: "multihash"}
reverseCodecs[0xb359] = codecs["skein512-456"]
codecs["skein512-464"] = &codec{id: 0xb35a, name: "skein512-464", tag: "multihash"}
reverseCodecs[0xb35a] = codecs["skein512-464"]
codecs["skein512-472"] = &codec{id: 0xb35b, name: "skein512-472", tag: "multihash"}
reverseCodecs[0xb35b] = codecs["skein512-472"]
codecs["skein512-480"] = &codec{id: 0xb35c, name: "skein512-480", tag: "multihash"}
reverseCodecs[0xb35c] = codecs["skein512-480"]
codecs["skein512-488"] = &codec{id: 0xb35d, name: "skein512-488", tag: "multihash"}
reverseCodecs[0xb35d] = codecs["skein512-488"]
codecs["skein512-496"] = &codec{id: 0xb35e, name: "skein512-496", tag: "multihash"}
reverseCodecs[0xb35e] = codecs["skein512-496"]
codecs["skein512-504"] = &codec{id: 0xb35f, name: "skein512-504", tag: "multihash"}
reverseCodecs[0xb35f] = codecs["skein512-504"]
codecs["skein512-512"] = &codec{id: 0xb360, name: "skein512-512", tag: "multihash"}
reverseCodecs[0xb360] = codecs["skein512-512"]
codecs["skein1024-8"] = &codec{id: 0xb361, name: "skein1024-8", tag: "multihash"}
reverseCodecs[0xb361] = codecs["skein1024-8"]
codecs["skein1024-16"] = &codec{id: 0xb362, name: "skein1024-16", tag: "multihash"}
reverseCodecs[0xb362] = codecs["skein1024-16"]
codecs["skein1024-24"] = &codec{id: 0xb363, name: "skein1024-24", tag: "multihash"}
reverseCodecs[0xb363] = codecs["skein1024-24"]
codecs["skein1024-32"] = &codec{id: 0xb364, name: "skein1024-32", tag: "multihash"}
reverseCodecs[0xb364] = codecs["skein1024-32"]
codecs["skein1024-40"] = &codec{id: 0xb365, name: "skein1024-40", tag: "multihash"}
reverseCodecs[0xb365] = codecs["skein1024-40"]
codecs["skein1024-48"] = &codec{id: 0xb366, name: "skein1024-48", tag: "multihash"}
reverseCodecs[0xb366] = codecs["skein1024-48"]
codecs["skein1024-56"] = &codec{id: 0xb367, name: "skein1024-56", tag: "multihash"}
reverseCodecs[0xb367] = codecs["skein1024-56"]
codecs["skein1024-64"] = &codec{id: 0xb368, name: "skein1024-64", tag: "multihash"}
reverseCodecs[0xb368] = codecs["skein1024-64"]
codecs["skein1024-72"] = &codec{id: 0xb369, name: "skein1024-72", tag: "multihash"}
reverseCodecs[0xb369] = codecs["skein1024-72"]
codecs["skein1024-80"] = &codec{id: 0xb36a, name: "skein1024-80", tag: "multihash"}
reverseCodecs[0xb36a] = codecs["skein1024-80"]
codecs["skein1024-88"] = &codec{id: 0xb36b, name: "skein1024-88", tag: "multihash"}
reverseCodecs[0xb36b] = codecs["skein1024-88"]
codecs["skein1024-96"] = &codec{id: 0xb36c, name: "skein1024-96", tag: "multihash"}
reverseCodecs[0xb36c] = codecs["skein1024-96"]
codecs["skein1024-104"] = &codec{id: 0xb36d, name: "skein1024-104", tag: "multihash"}
reverseCodecs[0xb36d] = codecs["skein1024-104"]
codecs["skein1024-112"] = &codec{id: 0xb36e, name: "skein1024-112", tag: "multihash"}
reverseCodecs[0xb36e] = codecs["skein1024-112"]
codecs["skein1024-120"] = &codec{id: 0xb36f, name: "skein1024-120", tag: "multihash"}
reverseCodecs[0xb36f] = codecs["skein1024-120"]
codecs["skein1024-128"] = &codec{id: 0xb370, name: "skein1024-128", tag: "multihash"}
reverseCodecs[0xb370] = codecs["skein1024-128"]
codecs["skein1024-136"] = &codec{id: 0xb371, name: "skein1024-136", tag: "multihash"}
reverseCodecs[0xb371] = codecs["skein1024-136"]
codecs["skein1024-144"] = &codec{id: 0xb372, name: "skein1024-144", tag: "multihash"}
reverseCodecs[0xb372] = codecs["skein1024-144"]
codecs["skein1024-152"] = &codec{id: 0xb373, name: "skein1024-152", tag: "multihash"}
reverseCodecs[0xb373] = codecs["skein1024-152"]
codecs["skein1024-160"] = &codec{id: 0xb374, name: "skein1024-160", tag: "multihash"}
reverseCodecs[0xb374] = codecs["skein1024-160"]
codecs["skein1024-168"] = &codec{id: 0xb375, name: "skein1024-168", tag: "multihash"}
reverseCodecs[0xb375] = codecs["skein1024-168"]
codecs["skein1024-176"] = &codec{id: 0xb376, name: "skein1024-176", tag: "multihash"}
reverseCodecs[0xb376] = codecs["skein1024-176"]
codecs["skein1024-184"] = &codec{id: 0xb377, name: "skein1024-184", tag: "multihash"}
reverseCodecs[0xb377] = codecs["skein1024-184"]
codecs["skein1024-192"] = &codec{id: 0xb378, name: "skein1024-192", tag: "multihash"}
reverseCodecs[0xb378] = codecs["skein1024-192"]
codecs["skein1024-200"] = &codec{id: 0xb379, name: "skein1024-200", tag: "multihash"}
reverseCodecs[0xb379] = codecs["skein1024-200"]
codecs["skein1024-208"] = &codec{id: 0xb37a, name: "skein1024-208", tag: "multihash"}
reverseCodecs[0xb37a] = codecs["skein1024-208"]
codecs["skein1024-216"] = &codec{id: 0xb37b, name: "skein1024-216", tag: "multihash"}
reverseCodecs[0xb37b] = codecs["skein1024-216"]
codecs["skein1024-224"] = &codec{id: 0xb37c, name: "skein1024-224", tag: "multihash"}
reverseCodecs[0xb37c] = codecs["skein1024-224"]
codecs["skein1024-232"] = &codec{id: 0xb37d, name: "skein1024-232", tag: "multihash"}
reverseCodecs[0xb37d] = codecs["skein1024-232"]
codecs["skein1024-240"] = &codec{id: 0xb37e, name: "skein1024-240", tag: "multihash"}
reverseCodecs[0xb37e] = codecs["skein1024-240"]
codecs["skein1024-248"] = &codec{id: 0xb37f, name: "skein1024-248", tag: "multihash"}
reverseCodecs[0xb37f] = codecs["skein1024-248"]
codecs["skein1024-256"] = &codec{id: 0xb380, name: "skein1024-256", tag: "multihash"}
reverseCodecs[0xb380] = codecs["skein1024-256"]
codecs["skein1024-264"] = &codec{id: 0xb381, name: "skein1024-264", tag: "multihash"}
reverseCodecs[0xb381] = codecs["skein1024-264"]
codecs["skein1024-272"] = &codec{id: 0xb382, name: "skein1024-272", tag: "multihash"}
reverseCodecs[0xb382] = codecs["skein1024-272"]
codecs["skein1024-280"] = &codec{id: 0xb383, name: "skein1024-280", tag: "multihash"}
reverseCodecs[0xb383] = codecs["skein1024-280"]
codecs["skein1024-288"] = &codec{id: 0xb384, name: "skein1024-288", tag: "multihash"}
reverseCodecs[0xb384] = codecs["skein1024-288"]
codecs["skein1024-296"] = &codec{id: 0xb385, name: "skein1024-296", tag: "multihash"}
reverseCodecs[0xb385] = codecs["skein1024-296"]
codecs["skein1024-304"] = &codec{id: 0xb386, name: "skein1024-304", tag: "multihash"}
reverseCodecs[0xb386] = codecs["skein1024-304"]
codecs["skein1024-312"] = &codec{id: 0xb387, name: "skein1024-312", tag: "multihash"}
reverseCodecs[0xb387] = codecs["skein1024-312"]
codecs["skein1024-320"] = &codec{id: 0xb388, name: "skein1024-320", tag: "multihash"}
reverseCodecs[0xb388] = codecs["skein1024-320"]
codecs["skein1024-328"] = &codec{id: 0xb389, name: "skein1024-328", tag: "multihash"}
reverseCodecs[0xb389] = codecs["skein1024-328"]
codecs["skein1024-336"] = &codec{id: 0xb38a, name: "skein1024-336", tag: "multihash"}
reverseCodecs[0xb38a] = codecs["skein1024-336"]
codecs["skein1024-344"] = &codec{id: 0xb38b, name: "skein1024-344", tag: "multihash"}
reverseCodecs[0xb38b] = codecs["skein1024-344"]
codecs["skein1024-352"] = &codec{id: 0xb38c, name: "skein1024-352", tag: "multihash"}
reverseCodecs[0xb38c] = codecs["skein1024-352"]
codecs["skein1024-360"] = &codec{id: 0xb38d, name: "skein1024-360", tag: "multihash"}
reverseCodecs[0xb38d] = codecs["skein1024-360"]
codecs["skein1024-368"] = &codec{id: 0xb38e, name: "skein1024-368", tag: "multihash"}
reverseCodecs[0xb38e] = codecs["skein1024-368"]
codecs["skein1024-376"] = &codec{id: 0xb38f, name: "skein1024-376", tag: "multihash"}
reverseCodecs[0xb38f] = codecs["skein1024-376"]
codecs["skein1024-384"] = &codec{id: 0xb390, name: "skein1024-384", tag: "multihash"}
reverseCodecs[0xb390] = codecs["skein1024-384"]
codecs["skein1024-392"] = &codec{id: 0xb391, name: "skein1024-392", tag: "multihash"}
reverseCodecs[0xb391] = codecs["skein1024-392"]
codecs["skein1024-400"] = &codec{id: 0xb392, name: "skein1024-400", tag: "multihash"}
reverseCodecs[0xb392] = codecs["skein1024-400"]
codecs["skein1024-408"] = &codec{id: 0xb393, name: "skein1024-408", tag: "multihash"}
reverseCodecs[0xb393] = codecs["skein1024-408"]
codecs["skein1024-416"] = &codec{id: 0xb394, name: "skein1024-416", tag: "multihash"}
reverseCodecs[0xb394] = codecs["skein1024-416"]
codecs["skein1024-424"] = &codec{id: 0xb395, name: "skein1024-424", tag: "multihash"}
reverseCodecs[0xb395] = codecs["skein1024-424"]
codecs["skein1024-432"] = &codec{id: 0xb396, name: "skein1024-432", tag: "multihash"}
reverseCodecs[0xb396] = codecs["skein1024-432"]
codecs["skein1024-440"] = &codec{id: 0xb397, name: "skein1024-440", tag: "multihash"}
reverseCodecs[0xb397] = codecs["skein1024-440"]
codecs["skein1024-448"] = &codec{id: 0xb398, name: "skein1024-448", tag: "multihash"}
reverseCodecs[0xb398] = codecs["skein1024-448"]
codecs["skein1024-456"] = &codec{id: 0xb399, name: "skein1024-456", tag: "multihash"}
reverseCodecs[0xb399] = codecs["skein1024-456"]
codecs["skein1024-464"] = &codec{id: 0xb39a, name: "skein1024-464", tag: "multihash"}
reverseCodecs[0xb39a] = codecs["skein1024-464"]
codecs["skein1024-472"] = &codec{id: 0xb39b, name: "skein1024-472", tag: "multihash"}
reverseCodecs[0xb39b] = codecs["skein1024-472"]
codecs["skein1024-480"] = &codec{id: 0xb39c, name: "skein1024-480", tag: "multihash"}
reverseCodecs[0xb39c] = codecs["skein1024-480"]
codecs["skein1024-488"] = &codec{id: 0xb39d, name: "skein1024-488", tag: "multihash"}
reverseCodecs[0xb39d] = codecs["skein1024-488"]
codecs["skein1024-496"] = &codec{id: 0xb39e, name: "skein1024-496", tag: "multihash"}
reverseCodecs[0xb39e] = codecs["skein1024-496"]
codecs["skein1024-504"] = &codec{id: 0xb39f, name: "skein1024-504", tag: "multihash"}
reverseCodecs[0xb39f] = codecs["skein1024-504"]
codecs["skein1024-512"] = &codec{id: 0xb3a0, name: "skein1024-512", tag: "multihash"}
reverseCodecs[0xb3a0] = codecs["skein1024-512"]
codecs["skein1024-520"] = &codec{id: 0xb3a1, name: "skein1024-520", tag: "multihash"}
reverseCodecs[0xb3a1] = codecs["skein1024-520"]
codecs["skein1024-528"] = &codec{id: 0xb3a2, name: "skein1024-528", tag: "multihash"}
reverseCodecs[0xb3a2] = codecs["skein1024-528"]
codecs["skein1024-536"] = &codec{id: 0xb3a3, name: "skein1024-536", tag: "multihash"}
reverseCodecs[0xb3a3] = codecs["skein1024-536"]
codecs["skein1024-544"] = &codec{id: 0xb3a4, name: "skein1024-544", tag: "multihash"}
reverseCodecs[0xb3a4] = codecs["skein1024-544"]
codecs["skein1024-552"] = &codec{id: 0xb3a5, name: "skein1024-552", tag: "multihash"}
reverseCodecs[0xb3a5] = codecs["skein1024-552"]
codecs["skein1024-560"] = &codec{id: 0xb3a6, name: "skein1024-560", tag: "multihash"}
reverseCodecs[0xb3a6] = codecs["skein1024-560"]
codecs["skein1024-568"] = &codec{id: 0xb3a7, name: "skein1024-568", tag: "multihash"}
reverseCodecs[0xb3a7] = codecs["skein1024-568"]
codecs["skein1024-576"] = &codec{id: 0xb3a8, name: "skein1024-576", tag: "multihash"}
reverseCodecs[0xb3a8] = codecs["skein1024-576"]
codecs["skein1024-584"] = &codec{id: 0xb3a9, name: "skein1024-584", tag: "multihash"}
reverseCodecs[0xb3a9] = codecs["skein1024-584"]
codecs["skein1024-592"] = &codec{id: 0xb3aa, name: "skein1024-592", tag: "multihash"}
reverseCodecs[0xb3aa] = codecs["skein1024-592"]
codecs["skein1024-600"] = &codec{id: 0xb3ab, name: "skein1024-600", tag: "multihash"}
reverseCodecs[0xb3ab] = codecs["skein1024-600"]
codecs["skein1024-608"] = &codec{id: 0xb3ac, name: "skein1024-608", tag: "multihash"}
reverseCodecs[0xb3ac] = codecs["skein1024-608"]
codecs["skein1024-616"] = &codec{id: 0xb3ad, name: "skein1024-616", tag: "multihash"}
reverseCodecs[0xb3ad] = codecs["skein1024-616"]
codecs["skein1024-624"] = &codec{id: 0xb3ae, name: "skein1024-624", tag: "multihash"}
reverseCodecs[0xb3ae] = codecs["skein1024-624"]
codecs["skein1024-632"] = &codec{id: 0xb3af, name: "skein1024-632", tag: "multihash"}
reverseCodecs[0xb3af] = codecs["skein1024-632"]
codecs["skein1024-640"] = &codec{id: 0xb3b0, name: "skein1024-640", tag: "multihash"}
reverseCodecs[0xb3b0] = codecs["skein1024-640"]
codecs["skein1024-648"] = &codec{id: 0xb3b1, name: "skein1024-648", tag: "multihash"}
reverseCodecs[0xb3b1] = codecs["skein1024-648"]
codecs["skein1024-656"] = &codec{id: 0xb3b2, name: "skein1024-656", tag: "multihash"}
reverseCodecs[0xb3b2] = codecs["skein1024-656"]
codecs["skein1024-664"] = &codec{id: 0xb3b3, name: "skein1024-664", tag: "multihash"}
reverseCodecs[0xb3b3] = codecs["skein1024-664"]
codecs["skein1024-672"] = &codec{id: 0xb3b4, name: "skein1024-672", tag: "multihash"}
reverseCodecs[0xb3b4] = codecs["skein1024-672"]
codecs["skein1024-680"] = &codec{id: 0xb3b5, name: "skein1024-680", tag: "multihash"}
reverseCodecs[0xb3b5] = codecs["skein1024-680"]
codecs["skein1024-688"] = &codec{id: 0xb3b6, name: "skein1024-688", tag: "multihash"}
reverseCodecs[0xb3b6] = codecs["skein1024-688"]
codecs["skein1024-696"] = &codec{id: 0xb3b7, name: "skein1024-696", tag: "multihash"}
reverseCodecs[0xb3b7] = codecs["skein1024-696"]
codecs["skein1024-704"] = &codec{id: 0xb3b8, name: "skein1024-704", tag: "multihash"}
reverseCodecs[0xb3b8] = codecs["skein1024-704"]
codecs["skein1024-712"] = &codec{id: 0xb3b9, name: "skein1024-712", tag: "multihash"}
reverseCodecs[0xb3b9] = codecs["skein1024-712"]
codecs["skein1024-720"] = &codec{id: 0xb3ba, name: "skein1024-720", tag: "multihash"}
reverseCodecs[0xb3ba] = codecs["skein1024-720"]
codecs["skein1024-728"] = &codec{id: 0xb3bb, name: "skein1024-728", tag: "multihash"}
reverseCodecs[0xb3bb] = codecs["skein1024-728"]
codecs["skein1024-736"] = &codec{id: 0xb3bc, name: "skein1024-736", tag: "multihash"}
reverseCodecs[0xb3bc] = codecs["skein1024-736"]
codecs["skein1024-744"] = &codec{id: 0xb3bd, name: "skein1024-744", tag: "multihash"}
reverseCodecs[0xb3bd] = codecs["skein1024-744"]
codecs["skein1024-752"] = &codec{id: 0xb3be, name: "skein1024-752", tag: "multihash"}
reverseCodecs[0xb3be] = codecs["skein1024-752"]
codecs["skein1024-760"] = &codec{id: 0xb3bf, name: "skein1024-760", tag: "multihash"}
reverseCodecs[0xb3bf] = codecs["skein1024-760"]
codecs["skein1024-768"] = &codec{id: 0xb3c0, name: "skein1024-768", tag: "multihash"}
reverseCodecs[0xb3c0] = codecs["skein1024-768"]
codecs["skein1024-776"] = &codec{id: 0xb3c1, name: "skein1024-776", tag: "multihash"}
reverseCodecs[0xb3c1] = codecs["skein1024-776"]
codecs["skein1024-784"] = &codec{id: 0xb3c2, name: "skein1024-784", tag: "multihash"}
reverseCodecs[0xb3c2] = codecs["skein1024-784"]
codecs["skein1024-792"] = &codec{id: 0xb3c3, name: "skein1024-792", tag: "multihash"}
reverseCodecs[0xb3c3] = codecs["skein1024-792"]
codecs["skein1024-800"] = &codec{id: 0xb3c4, name: "skein1024-800", tag: "multihash"}
reverseCodecs[0xb3c4] = codecs["skein1024-800"]
codecs["skein1024-808"] = &codec{id: 0xb3c5, name: "skein1024-808", tag: "multihash"}
reverseCodecs[0xb3c5] = codecs["skein1024-808"]
codecs["skein1024-816"] = &codec{id: 0xb3c6, name: "skein1024-816", tag: "multihash"}
reverseCodecs[0xb3c6] = codecs["skein1024-816"]
codecs["skein1024-824"] = &codec{id: 0xb3c7, name: "skein1024-824", tag: "multihash"}
reverseCodecs[0xb3c7] = codecs["skein1024-824"]
codecs["skein1024-832"] = &codec{id: 0xb3c8, name: "skein1024-832", tag: "multihash"}
reverseCodecs[0xb3c8] = codecs["skein1024-832"]
codecs["skein1024-840"] = &codec{id: 0xb3c9, name: "skein1024-840", tag: "multihash"}
reverseCodecs[0xb3c9] = codecs["skein1024-840"]
codecs["skein1024-848"] = &codec{id: 0xb3ca, name: "skein1024-848", tag: "multihash"}
reverseCodecs[0xb3ca] = codecs["skein1024-848"]
codecs["skein1024-856"] = &codec{id: 0xb3cb, name: "skein1024-856", tag: "multihash"}
reverseCodecs[0xb3cb] = codecs["skein1024-856"]
codecs["skein1024-864"] = &codec{id: 0xb3cc, name: "skein1024-864", tag: "multihash"}
reverseCodecs[0xb3cc] = codecs["skein1024-864"]
codecs["skein1024-872"] = &codec{id: 0xb3cd, name: "skein1024-872", tag: "multihash"}
reverseCodecs[0xb3cd] = codecs["skein1024-872"]
codecs["skein1024-880"] = &codec{id: 0xb3ce, name: "skein1024-880", tag: "multihash"}
reverseCodecs[0xb3ce] = codecs["skein1024-880"]
codecs["skein1024-888"] = &codec{id: 0xb3cf, name: "skein1024-888", tag: "multihash"}
reverseCodecs[0xb3cf] = codecs["skein1024-888"]
codecs["skein1024-896"] = &codec{id: 0xb3d0, name: "skein1024-896", tag: "multihash"}
reverseCodecs[0xb3d0] = codecs["skein1024-896"]
codecs["skein1024-904"] = &codec{id: 0xb3d1, name: "skein1024-904", tag: "multihash"}
reverseCodecs[0xb3d1] = codecs["skein1024-904"]
codecs["skein1024-912"] = &codec{id: 0xb3d2, name: "skein1024-912", tag: "multihash"}
reverseCodecs[0xb3d2] = codecs["skein1024-912"]
codecs["skein1024-920"] = &codec{id: 0xb3d3, name: "skein1024-920", tag: "multihash"}
reverseCodecs[0xb3d3] = codecs["skein1024-920"]
codecs["skein1024-928"] = &codec{id: 0xb3d4, name: "skein1024-928", tag: "multihash"}
reverseCodecs[0xb3d4] = codecs["skein1024-928"]
codecs["skein1024-936"] = &codec{id: 0xb3d5, name: "skein1024-936", tag: "multihash"}
reverseCodecs[0xb3d5] = codecs["skein1024-936"]
codecs["skein1024-944"] = &codec{id: 0xb3d6, name: "skein1024-944", tag: "multihash"}
reverseCodecs[0xb3d6] = codecs["skein1024-944"]
codecs["skein1024-952"] = &codec{id: 0xb3d7, name: "skein1024-952", tag: "multihash"}
reverseCodecs[0xb3d7] = codecs["skein1024-952"]
codecs["skein1024-960"] = &codec{id: 0xb3d8, name: "skein1024-960", tag: "multihash"}
reverseCodecs[0xb3d8] = codecs["skein1024-960"]
codecs["skein1024-968"] = &codec{id: 0xb3d9, name: "skein1024-968", tag: "multihash"}
reverseCodecs[0xb3d9] = codecs["skein1024-968"]
codecs["skein1024-976"] = &codec{id: 0xb3da, name: "skein1024-976", tag: "multihash"}
reverseCodecs[0xb3da] = codecs["skein1024-976"]
codecs["skein1024-984"] = &codec{id: 0xb3db, name: "skein1024-984", tag: "multihash"}
reverseCodecs[0xb3db] = codecs["skein1024-984"]
codecs["skein1024-992"] = &codec{id: 0xb3dc, name: "skein1024-992", tag: "multihash"}
reverseCodecs[0xb3dc] = codecs["skein1024-992"]
codecs["skein1024-1000"] = &codec{id: 0xb3dd, name: "skein1024-1000", tag: "multihash"}
reverseCodecs[0xb3dd] = codecs["skein1024-1000"]
codecs["skein1024-1008"] = &codec{id: 0xb3de, name: "skein1024-1008", tag: "multihash"}
reverseCodecs[0xb3de] = codecs["skein1024-1008"]
codecs["skein1024-1016"] = &codec{id: 0xb3df, name: "skein1024-1016", tag: "multihash"}
reverseCodecs[0xb3df] = codecs["skein1024-1016"]
codecs["skein1024-1024"] = &codec{id: 0xb3e0, name: "skein1024-1024", tag: "multihash"}
reverseCodecs[0xb3e0] = codecs["skein1024-1024"]
codecs["poseidon-bls12_381-a2-fc1"] = &codec{id: 0xb401, name: "poseidon-bls12_381-a2-fc1", tag: "multihash"}
reverseCodecs[0xb401] = codecs["poseidon-bls12_381-a2-fc1"]
codecs["poseidon-bls12_381-a2-fc1-sc"] = &codec{id: 0xb402, name: "poseidon-bls12_381-a2-fc1-sc", tag: "multihash"}
reverseCodecs[0xb402] = codecs["poseidon-bls12_381-a2-fc1-sc"]
codecs["zeroxcert-imprint-256"] = &codec{id: 0xce11, name: "zeroxcert-imprint-256", tag: "zeroxcert"}
reverseCodecs[0xce11] = codecs["zeroxcert-imprint-256"]
codecs["fil-commitment-unsealed"] = &codec{id: 0xf101, name: "fil-commitment-unsealed", tag: "filecoin"}
reverseCodecs[0xf101] = codecs["fil-commitment-unsealed"]
codecs["fil-commitment-sealed"] = &codec{id: 0xf102, name: "fil-commitment-sealed", tag: "filecoin"}
reverseCodecs[0xf102] = codecs["fil-commitment-sealed"]
codecs["holochain-adr-v0"] = &codec{id: 0x807124, name: "holochain-adr-v0", tag: "holochain"}
reverseCodecs[0x807124] = codecs["holochain-adr-v0"]
codecs["holochain-adr-v1"] = &codec{id: 0x817124, name: "holochain-adr-v1", tag: "holochain"}
reverseCodecs[0x817124] = codecs["holochain-adr-v1"]
codecs["holochain-key-v0"] = &codec{id: 0x947124, name: "holochain-key-v0", tag: "holochain"}
reverseCodecs[0x947124] = codecs["holochain-key-v0"]
codecs["holochain-key-v1"] = &codec{id: 0x957124, name: "holochain-key-v1", tag: "holochain"}
reverseCodecs[0x957124] = codecs["holochain-key-v1"]
codecs["holochain-sig-v0"] = &codec{id: 0xa27124, name: "holochain-sig-v0", tag: "holochain"}
reverseCodecs[0xa27124] = codecs["holochain-sig-v0"]
codecs["holochain-sig-v1"] = &codec{id: 0xa37124, name: "holochain-sig-v1", tag: "holochain"}
reverseCodecs[0xa37124] = codecs["holochain-sig-v1"]
codecs["skynet-ns"] = &codec{id: 0xb19910, name: "skynet-ns", tag: "namespace"}
reverseCodecs[0xb19910] = codecs["skynet-ns"]
}

16
vendor/github.com/wealdtech/go-multicodec/generate.go generated vendored Normal file
View File

@@ -0,0 +1,16 @@
// Copyright © 2019 Weald Technology Trading
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package multicodec
//go:generate ./generate.sh

58
vendor/github.com/wealdtech/go-multicodec/generate.sh generated vendored Normal file
View File

@@ -0,0 +1,58 @@
#!/bin/bash
OUTPUT=codecs.go
cat >${OUTPUT} <<EOSTART
// Copyright © 2019 Weald Technology Trading
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package multicodec
// codec is the structure holding codec information
type codec struct {
id uint64
tag string
name string
}
var codecs map[string]*codec
var reverseCodecs map[uint64]*codec
func init() {
codecs = make(map[string]*codec)
reverseCodecs = make(map[uint64]*codec)
EOSTART
while read line
do
CODECNAME=$(echo $line |awk -F, '{print $1}' | sed -e 's/^ *//' -e 's/ *$//')
CODECTAG=$(echo $line |awk -F, '{print $2}' | sed -e 's/^ *//' -e 's/ *$//')
CODECID=$(echo $line |awk -F, '{print $3}' | sed -e 's/^ *//' -e 's/ *$//')
CODECDESC=$(echo $line |awk -F, '{print $4}' | sed -e 's/^ *//' -e 's/ *$//')
cat >>${OUTPUT} <<EOCODEC
codecs["${CODECNAME}"] = &codec{id: ${CODECID},name:"${CODECNAME}",tag:"${CODECTAG}"}
EOCODEC
# Do not add reverse lookup for deprecated items
if [[ ! ${CODECDESC} =~ .*deprecated.* ]]
then
cat >>${OUTPUT} <<EOCODEC
reverseCodecs[${CODECID}] = codecs["${CODECNAME}"]
EOCODEC
fi
done < <(wget -q -O - https://raw.githubusercontent.com/multiformats/multicodec/master/table.csv | tail +2)
cat >>${OUTPUT} <<EOEND
}
EOEND
gofmt -w ${OUTPUT}

104
vendor/github.com/wealdtech/go-multicodec/multicodec.go generated vendored Normal file
View File

@@ -0,0 +1,104 @@
// Copyright © 2019 Weald Technology Trading
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package multicodec provides the ability to add and remove codec prefixes from data.
package multicodec
import (
"encoding/binary"
"fmt"
)
// AddCodec adds a codec prefix to a byte array.
// It returns a new byte array with the relevant codec prefixed.
func AddCodec(name string, data []byte) ([]byte, error) {
id, err := ID(name)
if err != nil {
return nil, err
}
buf := make([]byte, binary.MaxVarintLen64)
size := binary.PutUvarint(buf, id)
res := make([]byte, size+len(data))
copy(res, buf[0:size])
copy(res[size:], data)
return res, nil
}
// RemoveCodec removes a codec prefix from a byte array.
// It returns a slice of the input byte array without the codec prefix, along with the ID of the codec that has been removed.
func RemoveCodec(data []byte) ([]byte, uint64, error) {
id, size := binary.Uvarint(data)
if id == 0 {
return nil, 0, fmt.Errorf("failed to find codec prefix to remove")
}
return data[size:], id, nil
}
// GetCodec returns the ID of the codec prefix from a byte array
func GetCodec(data []byte) (uint64, error) {
id, _ := binary.Uvarint(data)
if id == 0 {
return 0, fmt.Errorf("failed to find codec prefix to remove")
}
return id, nil
}
// IsCodec returns true if the data is of the supplied codec prefix, otherwise false
func IsCodec(name string, data []byte) bool {
id, err := GetCodec(data)
if err != nil {
return false
}
codecName, err := Name(id)
if err != nil {
// Failed to obtain name for ID
return false
}
return codecName == name
}
// ID obtains the ID of a codec from its name
func ID(name string) (uint64, error) {
codec, exists := codecs[name]
if !exists {
return 0, fmt.Errorf("unknown name %s", name)
}
return codec.id, nil
}
// MustID obtains the ID of a codec from its name, panicking if not present.
func MustID(name string) uint64 {
codec, exists := codecs[name]
if !exists {
panic(fmt.Errorf("unknown name %s", name))
}
return codec.id
}
// Name obtains the name of a codec from its ID
func Name(id uint64) (string, error) {
codec, exists := reverseCodecs[id]
if !exists {
return "", fmt.Errorf("unknown ID 0x%x", id)
}
return codec.name, nil
}
// MustName obtains the name of a codec from its ID, panicking if not present.
func MustName(id uint64) string {
codec, exists := reverseCodecs[id]
if !exists {
panic(fmt.Errorf("unknown ID 0x%x", id))
}
return codec.name
}