-
Notifications
You must be signed in to change notification settings - Fork 2
Use the TPLToken #16
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
base: master
Are you sure you want to change the base?
Use the TPLToken #16
Conversation
| } | ||
|
|
||
| function validate() public { | ||
| jurisdiction.addAttribute(msg.sender, "VALID", 1); |
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 found this weird, because the Registry doesn't have addAttribute, just hasAttribute.
Maybe, the idea is to have a checker that just checks hasAttribute, and a validator that calls addAttribute.
Or maybe we should include addAttribute to Registry, so it's nicer to do both on the same validator.
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.
Registry seems to be the read-only interface of Jurisdiction. 🤷♂️
It looks good to me like this.
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.
What's weird is that now the validator has a variable called registry and another called jurisdiction, and they point to the same instance.
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.
Ah, right. I don't see a way out of this. We can't cast the registry variable safely because we don't know if TransactionChecker ever changes it to be something different.
| returns (bool) | ||
| { | ||
| require(jurisdiction.hasAttribute(_to, "VALID")); | ||
| require(validator.transferAllowed(msg.sender, _to, _amount)); |
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.
This is not clear in the TPL spec, but I think we should be checking transferAllowed(0x0, _to, _amount), i.e. from = 0x0 which is usually how minting is thought of.
| } | ||
|
|
||
| function validate() public { | ||
| jurisdiction.addAttribute(msg.sender, "VALID", 1); |
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.
Registry seems to be the read-only interface of Jurisdiction. 🤷♂️
It looks good to me like this.
Fixes #15