Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
53b823af
Unverified
Commit
53b823af
authored
Apr 30, 2018
by
Kiel barry
Committed by
Péter Szilágyi
Feb 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
contracts/*: golint updates for this or self warning
parent
6f714ed7
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
194 additions
and
209 deletions
+194
-209
api.go
contracts/chequebook/api.go
+11
-11
cheque.go
contracts/chequebook/cheque.go
+140
-140
chequebook.go
contracts/chequebook/contract/chequebook.go
+6
-6
ens.go
contracts/ens/contract/ens.go
+9
-9
ens.go
contracts/ens/ens.go
+27
-42
swarm.go
swarm/swarm.go
+1
-1
No files found.
contracts/chequebook/api.go
View file @
53b823af
...
@@ -27,40 +27,40 @@ const Version = "1.0"
...
@@ -27,40 +27,40 @@ const Version = "1.0"
var
errNoChequebook
=
errors
.
New
(
"no chequebook"
)
var
errNoChequebook
=
errors
.
New
(
"no chequebook"
)
type
A
pi
struct
{
type
A
PI
struct
{
chequebookf
func
()
*
Chequebook
chequebookf
func
()
*
Chequebook
}
}
func
NewA
pi
(
ch
func
()
*
Chequebook
)
*
Api
{
func
NewA
PI
(
ch
func
()
*
Chequebook
)
*
API
{
return
&
A
pi
{
ch
}
return
&
A
PI
{
ch
}
}
}
func
(
self
*
Api
)
Balance
()
(
string
,
error
)
{
func
(
a
*
API
)
Balance
()
(
string
,
error
)
{
ch
:=
self
.
chequebookf
()
ch
:=
a
.
chequebookf
()
if
ch
==
nil
{
if
ch
==
nil
{
return
""
,
errNoChequebook
return
""
,
errNoChequebook
}
}
return
ch
.
Balance
()
.
String
(),
nil
return
ch
.
Balance
()
.
String
(),
nil
}
}
func
(
self
*
Api
)
Issue
(
beneficiary
common
.
Address
,
amount
*
big
.
Int
)
(
cheque
*
Cheque
,
err
error
)
{
func
(
a
*
API
)
Issue
(
beneficiary
common
.
Address
,
amount
*
big
.
Int
)
(
cheque
*
Cheque
,
err
error
)
{
ch
:=
self
.
chequebookf
()
ch
:=
a
.
chequebookf
()
if
ch
==
nil
{
if
ch
==
nil
{
return
nil
,
errNoChequebook
return
nil
,
errNoChequebook
}
}
return
ch
.
Issue
(
beneficiary
,
amount
)
return
ch
.
Issue
(
beneficiary
,
amount
)
}
}
func
(
self
*
Api
)
Cash
(
cheque
*
Cheque
)
(
txhash
string
,
err
error
)
{
func
(
a
*
API
)
Cash
(
cheque
*
Cheque
)
(
txhash
string
,
err
error
)
{
ch
:=
self
.
chequebookf
()
ch
:=
a
.
chequebookf
()
if
ch
==
nil
{
if
ch
==
nil
{
return
""
,
errNoChequebook
return
""
,
errNoChequebook
}
}
return
ch
.
Cash
(
cheque
)
return
ch
.
Cash
(
cheque
)
}
}
func
(
self
*
Api
)
Deposit
(
amount
*
big
.
Int
)
(
txhash
string
,
err
error
)
{
func
(
a
*
API
)
Deposit
(
amount
*
big
.
Int
)
(
txhash
string
,
err
error
)
{
ch
:=
self
.
chequebookf
()
ch
:=
a
.
chequebookf
()
if
ch
==
nil
{
if
ch
==
nil
{
return
""
,
errNoChequebook
return
""
,
errNoChequebook
}
}
...
...
contracts/chequebook/cheque.go
View file @
53b823af
This diff is collapsed.
Click to expand it.
contracts/chequebook/contract/chequebook.go
View file @
53b823af
...
@@ -205,22 +205,22 @@ func (_Chequebook *ChequebookCallerSession) Sent(arg0 common.Address) (*big.Int,
...
@@ -205,22 +205,22 @@ func (_Chequebook *ChequebookCallerSession) Sent(arg0 common.Address) (*big.Int,
// Cash is a paid mutator transaction binding the contract method 0xfbf788d6.
// Cash is a paid mutator transaction binding the contract method 0xfbf788d6.
//
//
// Solidity: function cash(beneficiary address, amount uint256, sig_v uint8, sig_r bytes32, sig_s bytes32) returns()
// Solidity: function cash(beneficiary address, amount uint256, sig_v uint8, sig_r bytes32, sig_s bytes32) returns()
func
(
_Chequebook
*
ChequebookTransactor
)
Cash
(
opts
*
bind
.
TransactOpts
,
beneficiary
common
.
Address
,
amount
*
big
.
Int
,
sig
_v
uint8
,
sig_r
[
32
]
byte
,
sig_s
[
32
]
byte
)
(
*
types
.
Transaction
,
error
)
{
func
(
_Chequebook
*
ChequebookTransactor
)
Cash
(
opts
*
bind
.
TransactOpts
,
beneficiary
common
.
Address
,
amount
*
big
.
Int
,
sig
V
uint8
,
sigR
[
32
]
byte
,
sigS
[
32
]
byte
)
(
*
types
.
Transaction
,
error
)
{
return
_Chequebook
.
contract
.
Transact
(
opts
,
"cash"
,
beneficiary
,
amount
,
sig
_v
,
sig_r
,
sig_s
)
return
_Chequebook
.
contract
.
Transact
(
opts
,
"cash"
,
beneficiary
,
amount
,
sig
V
,
sigR
,
sigS
)
}
}
// Cash is a paid mutator transaction binding the contract method 0xfbf788d6.
// Cash is a paid mutator transaction binding the contract method 0xfbf788d6.
//
//
// Solidity: function cash(beneficiary address, amount uint256, sig_v uint8, sig_r bytes32, sig_s bytes32) returns()
// Solidity: function cash(beneficiary address, amount uint256, sig_v uint8, sig_r bytes32, sig_s bytes32) returns()
func
(
_Chequebook
*
ChequebookSession
)
Cash
(
beneficiary
common
.
Address
,
amount
*
big
.
Int
,
sig
_v
uint8
,
sig_r
[
32
]
byte
,
sig_s
[
32
]
byte
)
(
*
types
.
Transaction
,
error
)
{
func
(
_Chequebook
*
ChequebookSession
)
Cash
(
beneficiary
common
.
Address
,
amount
*
big
.
Int
,
sig
V
uint8
,
sigR
[
32
]
byte
,
sigS
[
32
]
byte
)
(
*
types
.
Transaction
,
error
)
{
return
_Chequebook
.
Contract
.
Cash
(
&
_Chequebook
.
TransactOpts
,
beneficiary
,
amount
,
sig
_v
,
sig_r
,
sig_s
)
return
_Chequebook
.
Contract
.
Cash
(
&
_Chequebook
.
TransactOpts
,
beneficiary
,
amount
,
sig
V
,
sigR
,
sigS
)
}
}
// Cash is a paid mutator transaction binding the contract method 0xfbf788d6.
// Cash is a paid mutator transaction binding the contract method 0xfbf788d6.
//
//
// Solidity: function cash(beneficiary address, amount uint256, sig_v uint8, sig_r bytes32, sig_s bytes32) returns()
// Solidity: function cash(beneficiary address, amount uint256, sig_v uint8, sig_r bytes32, sig_s bytes32) returns()
func
(
_Chequebook
*
ChequebookTransactorSession
)
Cash
(
beneficiary
common
.
Address
,
amount
*
big
.
Int
,
sig
_v
uint8
,
sig_r
[
32
]
byte
,
sig_s
[
32
]
byte
)
(
*
types
.
Transaction
,
error
)
{
func
(
_Chequebook
*
ChequebookTransactorSession
)
Cash
(
beneficiary
common
.
Address
,
amount
*
big
.
Int
,
sig
V
uint8
,
sigR
[
32
]
byte
,
sigS
[
32
]
byte
)
(
*
types
.
Transaction
,
error
)
{
return
_Chequebook
.
Contract
.
Cash
(
&
_Chequebook
.
TransactOpts
,
beneficiary
,
amount
,
sig
_v
,
sig_r
,
sig_s
)
return
_Chequebook
.
Contract
.
Cash
(
&
_Chequebook
.
TransactOpts
,
beneficiary
,
amount
,
sig
V
,
sigR
,
sigS
)
}
}
// Kill is a paid mutator transaction binding the contract method 0x41c0e1b5.
// Kill is a paid mutator transaction binding the contract method 0x41c0e1b5.
...
...
contracts/ens/contract/ens.go
View file @
53b823af
...
@@ -227,10 +227,10 @@ func (_ENS *ENSCallerSession) Resolver(node [32]byte) (common.Address, error) {
...
@@ -227,10 +227,10 @@ func (_ENS *ENSCallerSession) Resolver(node [32]byte) (common.Address, error) {
return
_ENS
.
Contract
.
Resolver
(
&
_ENS
.
CallOpts
,
node
)
return
_ENS
.
Contract
.
Resolver
(
&
_ENS
.
CallOpts
,
node
)
}
}
// T
tl
is a free data retrieval call binding the contract method 0x16a25cbd.
// T
TL
is a free data retrieval call binding the contract method 0x16a25cbd.
//
//
// Solidity: function ttl(node bytes32) constant returns(uint64)
// Solidity: function ttl(node bytes32) constant returns(uint64)
func
(
_ENS
*
ENSCaller
)
T
tl
(
opts
*
bind
.
CallOpts
,
node
[
32
]
byte
)
(
uint64
,
error
)
{
func
(
_ENS
*
ENSCaller
)
T
TL
(
opts
*
bind
.
CallOpts
,
node
[
32
]
byte
)
(
uint64
,
error
)
{
var
(
var
(
ret0
=
new
(
uint64
)
ret0
=
new
(
uint64
)
)
)
...
@@ -239,18 +239,18 @@ func (_ENS *ENSCaller) Ttl(opts *bind.CallOpts, node [32]byte) (uint64, error) {
...
@@ -239,18 +239,18 @@ func (_ENS *ENSCaller) Ttl(opts *bind.CallOpts, node [32]byte) (uint64, error) {
return
*
ret0
,
err
return
*
ret0
,
err
}
}
// T
tl
is a free data retrieval call binding the contract method 0x16a25cbd.
// T
TL
is a free data retrieval call binding the contract method 0x16a25cbd.
//
//
// Solidity: function ttl(node bytes32) constant returns(uint64)
// Solidity: function ttl(node bytes32) constant returns(uint64)
func
(
_ENS
*
ENSSession
)
T
tl
(
node
[
32
]
byte
)
(
uint64
,
error
)
{
func
(
_ENS
*
ENSSession
)
T
TL
(
node
[
32
]
byte
)
(
uint64
,
error
)
{
return
_ENS
.
Contract
.
T
tl
(
&
_ENS
.
CallOpts
,
node
)
return
_ENS
.
Contract
.
T
TL
(
&
_ENS
.
CallOpts
,
node
)
}
}
// T
tl
is a free data retrieval call binding the contract method 0x16a25cbd.
// T
TL
is a free data retrieval call binding the contract method 0x16a25cbd.
//
//
// Solidity: function ttl(node bytes32) constant returns(uint64)
// Solidity: function ttl(node bytes32) constant returns(uint64)
func
(
_ENS
*
ENSCallerSession
)
T
tl
(
node
[
32
]
byte
)
(
uint64
,
error
)
{
func
(
_ENS
*
ENSCallerSession
)
T
TL
(
node
[
32
]
byte
)
(
uint64
,
error
)
{
return
_ENS
.
Contract
.
T
tl
(
&
_ENS
.
CallOpts
,
node
)
return
_ENS
.
Contract
.
T
TL
(
&
_ENS
.
CallOpts
,
node
)
}
}
// SetOwner is a paid mutator transaction binding the contract method 0x5b0fc9c3.
// SetOwner is a paid mutator transaction binding the contract method 0x5b0fc9c3.
...
@@ -682,7 +682,7 @@ func (it *ENSNewTTLIterator) Close() error {
...
@@ -682,7 +682,7 @@ func (it *ENSNewTTLIterator) Close() error {
// ENSNewTTL represents a NewTTL event raised by the ENS contract.
// ENSNewTTL represents a NewTTL event raised by the ENS contract.
type
ENSNewTTL
struct
{
type
ENSNewTTL
struct
{
Node
[
32
]
byte
Node
[
32
]
byte
T
tl
uint64
T
TL
uint64
Raw
types
.
Log
// Blockchain specific contextual infos
Raw
types
.
Log
// Blockchain specific contextual infos
}
}
...
...
contracts/ens/ens.go
View file @
53b823af
...
@@ -35,7 +35,7 @@ var (
...
@@ -35,7 +35,7 @@ var (
TestNetAddress
=
common
.
HexToAddress
(
"0x112234455c3a32fd11230c42e7bccd4a84e02010"
)
TestNetAddress
=
common
.
HexToAddress
(
"0x112234455c3a32fd11230c42e7bccd4a84e02010"
)
)
)
// swarm domain name registry and resolver
//
ENS is the
swarm domain name registry and resolver
type
ENS
struct
{
type
ENS
struct
{
*
contract
.
ENSSession
*
contract
.
ENSSession
contractBackend
bind
.
ContractBackend
contractBackend
bind
.
ContractBackend
...
@@ -48,7 +48,6 @@ func NewENS(transactOpts *bind.TransactOpts, contractAddr common.Address, contra
...
@@ -48,7 +48,6 @@ func NewENS(transactOpts *bind.TransactOpts, contractAddr common.Address, contra
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
return
&
ENS
{
return
&
ENS
{
&
contract
.
ENSSession
{
&
contract
.
ENSSession
{
Contract
:
ens
,
Contract
:
ens
,
...
@@ -60,27 +59,24 @@ func NewENS(transactOpts *bind.TransactOpts, contractAddr common.Address, contra
...
@@ -60,27 +59,24 @@ func NewENS(transactOpts *bind.TransactOpts, contractAddr common.Address, contra
// DeployENS deploys an instance of the ENS nameservice, with a 'first-in, first-served' root registrar.
// DeployENS deploys an instance of the ENS nameservice, with a 'first-in, first-served' root registrar.
func
DeployENS
(
transactOpts
*
bind
.
TransactOpts
,
contractBackend
bind
.
ContractBackend
)
(
common
.
Address
,
*
ENS
,
error
)
{
func
DeployENS
(
transactOpts
*
bind
.
TransactOpts
,
contractBackend
bind
.
ContractBackend
)
(
common
.
Address
,
*
ENS
,
error
)
{
// Deploy the ENS registry
.
// Deploy the ENS registry
ensAddr
,
_
,
_
,
err
:=
contract
.
DeployENS
(
transactOpts
,
contractBackend
)
ensAddr
,
_
,
_
,
err
:=
contract
.
DeployENS
(
transactOpts
,
contractBackend
)
if
err
!=
nil
{
if
err
!=
nil
{
return
ensAddr
,
nil
,
err
return
ensAddr
,
nil
,
err
}
}
ens
,
err
:=
NewENS
(
transactOpts
,
ensAddr
,
contractBackend
)
ens
,
err
:=
NewENS
(
transactOpts
,
ensAddr
,
contractBackend
)
if
err
!=
nil
{
if
err
!=
nil
{
return
ensAddr
,
nil
,
err
return
ensAddr
,
nil
,
err
}
}
// Deploy the registrar
// Deploy the registrar.
regAddr
,
_
,
_
,
err
:=
contract
.
DeployFIFSRegistrar
(
transactOpts
,
contractBackend
,
ensAddr
,
[
32
]
byte
{})
regAddr
,
_
,
_
,
err
:=
contract
.
DeployFIFSRegistrar
(
transactOpts
,
contractBackend
,
ensAddr
,
[
32
]
byte
{})
if
err
!=
nil
{
if
err
!=
nil
{
return
ensAddr
,
nil
,
err
return
ensAddr
,
nil
,
err
}
}
// Set the registrar as owner of the ENS root
.
// Set the registrar as owner of the ENS root
if
_
,
err
=
ens
.
SetOwner
([
32
]
byte
{},
regAddr
);
err
!=
nil
{
if
_
,
err
=
ens
.
SetOwner
([
32
]
byte
{},
regAddr
);
err
!=
nil
{
return
ensAddr
,
nil
,
err
return
ensAddr
,
nil
,
err
}
}
return
ensAddr
,
ens
,
nil
return
ensAddr
,
ens
,
nil
}
}
...
@@ -89,10 +85,9 @@ func ensParentNode(name string) (common.Hash, common.Hash) {
...
@@ -89,10 +85,9 @@ func ensParentNode(name string) (common.Hash, common.Hash) {
label
:=
crypto
.
Keccak256Hash
([]
byte
(
parts
[
0
]))
label
:=
crypto
.
Keccak256Hash
([]
byte
(
parts
[
0
]))
if
len
(
parts
)
==
1
{
if
len
(
parts
)
==
1
{
return
[
32
]
byte
{},
label
return
[
32
]
byte
{},
label
}
else
{
parentNode
,
parentLabel
:=
ensParentNode
(
parts
[
1
])
return
crypto
.
Keccak256Hash
(
parentNode
[
:
],
parentLabel
[
:
]),
label
}
}
parentNode
,
parentLabel
:=
ensParentNode
(
parts
[
1
])
return
crypto
.
Keccak256Hash
(
parentNode
[
:
],
parentLabel
[
:
]),
label
}
}
func
EnsNode
(
name
string
)
common
.
Hash
{
func
EnsNode
(
name
string
)
common
.
Hash
{
...
@@ -100,111 +95,101 @@ func EnsNode(name string) common.Hash {
...
@@ -100,111 +95,101 @@ func EnsNode(name string) common.Hash {
return
crypto
.
Keccak256Hash
(
parentNode
[
:
],
parentLabel
[
:
])
return
crypto
.
Keccak256Hash
(
parentNode
[
:
],
parentLabel
[
:
])
}
}
func
(
self
*
ENS
)
getResolver
(
node
[
32
]
byte
)
(
*
contract
.
PublicResolverSession
,
error
)
{
func
(
ens
*
ENS
)
getResolver
(
node
[
32
]
byte
)
(
*
contract
.
PublicResolverSession
,
error
)
{
resolverAddr
,
err
:=
self
.
Resolver
(
node
)
resolverAddr
,
err
:=
ens
.
Resolver
(
node
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
resolver
,
err
:=
contract
.
NewPublicResolver
(
resolverAddr
,
ens
.
contractBackend
)
resolver
,
err
:=
contract
.
NewPublicResolver
(
resolverAddr
,
self
.
contractBackend
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
return
&
contract
.
PublicResolverSession
{
return
&
contract
.
PublicResolverSession
{
Contract
:
resolver
,
Contract
:
resolver
,
TransactOpts
:
self
.
TransactOpts
,
TransactOpts
:
ens
.
TransactOpts
,
},
nil
},
nil
}
}
func
(
self
*
ENS
)
getRegistrar
(
node
[
32
]
byte
)
(
*
contract
.
FIFSRegistrarSession
,
error
)
{
func
(
ens
*
ENS
)
getRegistrar
(
node
[
32
]
byte
)
(
*
contract
.
FIFSRegistrarSession
,
error
)
{
registrarAddr
,
err
:=
self
.
Owner
(
node
)
registrarAddr
,
err
:=
ens
.
Owner
(
node
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
registrar
,
err
:=
contract
.
NewFIFSRegistrar
(
registrarAddr
,
ens
.
contractBackend
)
registrar
,
err
:=
contract
.
NewFIFSRegistrar
(
registrarAddr
,
self
.
contractBackend
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
return
&
contract
.
FIFSRegistrarSession
{
return
&
contract
.
FIFSRegistrarSession
{
Contract
:
registrar
,
Contract
:
registrar
,
TransactOpts
:
self
.
TransactOpts
,
TransactOpts
:
ens
.
TransactOpts
,
},
nil
},
nil
}
}
// Resolve is a non-transactional call that returns the content hash associated with a name.
// Resolve is a non-transactional call that returns the content hash associated with a name.
func
(
self
*
ENS
)
Resolve
(
name
string
)
(
common
.
Hash
,
error
)
{
func
(
ens
*
ENS
)
Resolve
(
name
string
)
(
common
.
Hash
,
error
)
{
node
:=
EnsNode
(
name
)
node
:=
EnsNode
(
name
)
resolver
,
err
:=
self
.
getResolver
(
node
)
resolver
,
err
:=
ens
.
getResolver
(
node
)
if
err
!=
nil
{
if
err
!=
nil
{
return
common
.
Hash
{},
err
return
common
.
Hash
{},
err
}
}
ret
,
err
:=
resolver
.
Content
(
node
)
ret
,
err
:=
resolver
.
Content
(
node
)
if
err
!=
nil
{
if
err
!=
nil
{
return
common
.
Hash
{},
err
return
common
.
Hash
{},
err
}
}
return
common
.
BytesToHash
(
ret
[
:
]),
nil
return
common
.
BytesToHash
(
ret
[
:
]),
nil
}
}
// Addr is a non-transactional call that returns the address associated with a name.
// Addr is a non-transactional call that returns the address associated with a name.
func
(
self
*
ENS
)
Addr
(
name
string
)
(
common
.
Address
,
error
)
{
func
(
ens
*
ENS
)
Addr
(
name
string
)
(
common
.
Address
,
error
)
{
node
:=
EnsNode
(
name
)
node
:=
EnsNode
(
name
)
resolver
,
err
:=
self
.
getResolver
(
node
)
resolver
,
err
:=
ens
.
getResolver
(
node
)
if
err
!=
nil
{
if
err
!=
nil
{
return
common
.
Address
{},
err
return
common
.
Address
{},
err
}
}
ret
,
err
:=
resolver
.
Addr
(
node
)
ret
,
err
:=
resolver
.
Addr
(
node
)
if
err
!=
nil
{
if
err
!=
nil
{
return
common
.
Address
{},
err
return
common
.
Address
{},
err
}
}
return
common
.
BytesToAddress
(
ret
[
:
]),
nil
return
common
.
BytesToAddress
(
ret
[
:
]),
nil
}
}
// SetAddress sets the address associated with a name. Only works if the caller
// SetAddress sets the address associated with a name. Only works if the caller
// owns the name, and the associated resolver implements a `setAddress` function.
// owns the name, and the associated resolver implements a `setAddress` function.
func
(
self
*
ENS
)
SetAddr
(
name
string
,
addr
common
.
Address
)
(
*
types
.
Transaction
,
error
)
{
func
(
ens
*
ENS
)
SetAddr
(
name
string
,
addr
common
.
Address
)
(
*
types
.
Transaction
,
error
)
{
node
:=
EnsNode
(
name
)
node
:=
EnsNode
(
name
)
resolver
,
err
:=
self
.
getResolver
(
node
)
resolver
,
err
:=
ens
.
getResolver
(
node
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
opts
:=
ens
.
TransactOpts
opts
:=
self
.
TransactOpts
opts
.
GasLimit
=
200000
opts
.
GasLimit
=
200000
return
resolver
.
Contract
.
SetAddr
(
&
opts
,
node
,
addr
)
return
resolver
.
Contract
.
SetAddr
(
&
opts
,
node
,
addr
)
}
}
// Register registers a new domain name for the caller, making them the owner of the new name.
// Register registers a new domain name for the caller, making them the owner of the new name.
// Only works if the registrar for the parent domain implements the FIFS registrar protocol.
// Only works if the registrar for the parent domain implements the FIFS registrar protocol.
func
(
self
*
ENS
)
Register
(
name
string
)
(
*
types
.
Transaction
,
error
)
{
func
(
ens
*
ENS
)
Register
(
name
string
)
(
*
types
.
Transaction
,
error
)
{
parentNode
,
label
:=
ensParentNode
(
name
)
parentNode
,
label
:=
ensParentNode
(
name
)
registrar
,
err
:=
self
.
getRegistrar
(
parentNode
)
registrar
,
err
:=
ens
.
getRegistrar
(
parentNode
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
return
registrar
.
Contract
.
Register
(
&
self
.
TransactOpts
,
label
,
self
.
TransactOpts
.
From
)
return
registrar
.
Contract
.
Register
(
&
ens
.
TransactOpts
,
label
,
ens
.
TransactOpts
.
From
)
}
}
// SetContentHash sets the content hash associated with a name. Only works if the caller
// SetContentHash sets the content hash associated with a name. Only works if the caller
// owns the name, and the associated resolver implements a `setContent` function.
// owns the name, and the associated resolver implements a `setContent` function.
func
(
self
*
ENS
)
SetContentHash
(
name
string
,
hash
common
.
Hash
)
(
*
types
.
Transaction
,
error
)
{
func
(
ens
*
ENS
)
SetContentHash
(
name
string
,
hash
common
.
Hash
)
(
*
types
.
Transaction
,
error
)
{
node
:=
EnsNode
(
name
)
node
:=
EnsNode
(
name
)
resolver
,
err
:=
self
.
getResolver
(
node
)
resolver
,
err
:=
ens
.
getResolver
(
node
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
opts
:=
ens
.
TransactOpts
opts
:=
self
.
TransactOpts
opts
.
GasLimit
=
200000
opts
.
GasLimit
=
200000
return
resolver
.
Contract
.
SetContent
(
&
opts
,
node
,
hash
)
return
resolver
.
Contract
.
SetContent
(
&
opts
,
node
,
hash
)
}
}
swarm/swarm.go
View file @
53b823af
...
@@ -491,7 +491,7 @@ func (self *Swarm) APIs() []rpc.API {
...
@@ -491,7 +491,7 @@ func (self *Swarm) APIs() []rpc.API {
{
{
Namespace
:
"chequebook"
,
Namespace
:
"chequebook"
,
Version
:
chequebook
.
Version
,
Version
:
chequebook
.
Version
,
Service
:
chequebook
.
NewA
pi
(
self
.
config
.
Swap
.
Chequebook
),
Service
:
chequebook
.
NewA
PI
(
self
.
config
.
Swap
.
Chequebook
),
Public
:
false
,
Public
:
false
,
},
},
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment