Hey guys, this is a piece of code from Solidity documentation.
These two interfaces Config and NameReg have never been implemented, how could contract named called it? Do I miss something here?
Thx!
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityHey guys, this is a piece of code from Solidity documentation.
These two interfaces Config and NameReg have never been implemented, how could contract named called it? Do I miss something here?
Thx!
The 2 lines of named
constructor use addresses. named
assumes that the contracts that have already been deployed at those addresses have implemented the interfaces.
config
is the contract at 0xd5f9...
.
config.lookup
returns an address
so NameReg
methods like register
can be invoked.
If the contract at 0xd5f9...
does not have a lookup
method, its fallback function would be invoked. Similar case if the register
method doesn't exist on the address returned by config.lookup(1)
.
{}
button in the editor to help with formatting. – eth♦ Aug 31 '16 at 2:33