Skip to content

Instantly share code, notes, and snippets.

@bogdan
Created July 20, 2021 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bogdan/c2f1203154404f3332d23685cc8aa580 to your computer and use it in GitHub Desktop.
Save bogdan/c2f1203154404f3332d23685cc8aa580 to your computer and use it in GitHub Desktop.
contract ReverseResolver is CustomContext {
mapping (address => uint256) reverses;
IERC721 registry;
constructor(address_registry) {
registry = IERC721(_registry);
}
function reverseOf(address account) public view returns (uint256) {
uint tokenId = reverses[account];
require(registry.ownerOf(tokenId) == account);
return tokenId;
}
function registerReverse(uint256 tokenId) public {
address sender = _msgSender();
require(registry.ownerOf(tokenId) == sender);
reverses[sender] = tokenId;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment