-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IPN-54 tokenizer adds function to reserve and tokenize at once #164
base: main
Are you sure you want to change the base?
IPN-54 tokenizer adds function to reserve and tokenize at once #164
Conversation
Signed-off-by: stadolf <[email protected]>
full test case for reservation issuance Signed-off-by: stadolf <[email protected]>
@@ -176,6 +184,11 @@ contract Tokenizer is UUPSUpgradeable, OwnableUpgradeable, IControlIPTs { | |||
|
|||
/// @dev this will be called by IPTs. Right now the controller is the IPNFT's current owner, it can be a Governor in the future. | |||
function controllerOf(uint256 ipnftId) public view override returns (address) { | |||
//todo: check whether this is safe (or if I can trick myself to be the controller somehow) | |||
//reservations are deleted upon mints, so this imo should be good | |||
if (ipnft.reservations(ipnftId) != address(0)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this correct:
return ipnft.reservations(ipnftId) || ipnft.ownerOf(ipnftId)
if the ipnft is minted it will return ipnft.ownerOf(ipnftId)
as ipnft.reservations(ipnftId)
would be address(0)
abd vice versa.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would never assume by default whether a language besides Javascript would automatically cast an (address(0)) to a boolean (true). That code is pretty concise imo. If there's a reservation it returns its initiator, otherwise the holder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes yes the code is clear, I just wanted to know whether the other optiion is also correct or not
No description provided.