mirror of
git://holbrook.no/eth-address-index
synced 2024-11-27 10:36:46 +01:00
Add interface definitions for token index
This commit is contained in:
parent
8dfc908510
commit
d3d731e76d
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"bytes32","name":"_key","type":"bytes32"}],"name":"addressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"entry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_key","type":"bytes32"},{"internalType":"address","name":"_token","type":"address"}],"name":"register","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"registry","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registryCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
|
||||
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"bytes32","name":"_key","type":"bytes32"}],"name":"addressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_key","type":"bytes32"},{"internalType":"address","name":"_token","type":"address"}],"name":"register","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"registry","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registryCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interfaceCode","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
|
||||
|
@ -15,6 +15,17 @@ contract TokenUniqueSymbolIndex {
|
||||
tokens.push(address(0));
|
||||
}
|
||||
|
||||
// EIP 165
|
||||
function supportsInterface(bytes4 _interfaceCode) public pure returns ( bool ) {
|
||||
if (_interfaceCode == bytes4(0x325d15e2)) {
|
||||
return true;
|
||||
}
|
||||
if (_interfaceCode == bytes4(0x01ffc9a7)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// EIP 172
|
||||
function transferOwnership() public {
|
||||
revert("owner cannot be changed");
|
||||
|
@ -52,3 +52,7 @@ except:
|
||||
|
||||
if not fail:
|
||||
raise RuntimeError('expected fail on register same token to same address')
|
||||
|
||||
assert(c.functions.supportsInterface('0x325d15e2').call())
|
||||
assert(c.functions.supportsInterface('0x01ffc9a7').call())
|
||||
assert(not c.functions.supportsInterface('0xffffffff').call())
|
||||
|
Loading…
Reference in New Issue
Block a user