Skip to content
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

Use the TPLToken #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

come-maiz
Copy link
Contributor

Fixes #15

function DummyValidator(Jurisdiction _jurisdiction)
TransactionChecker(_jurisdiction)
public
{
jurisdiction = _jurisdiction;
}

function validate() public {
jurisdiction.addAttribute(msg.sender, "VALID", 1);
Copy link
Contributor Author

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.

Copy link
Collaborator

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.

Copy link
Contributor Author

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.

Copy link
Collaborator

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.

@come-maiz come-maiz requested a review from frangio June 2, 2018 06:56
@@ -27,17 +28,8 @@ contract SampleToken is MintableToken {
public
returns (bool)
{
require(jurisdiction.hasAttribute(_to, "VALID"));
require(validator.transferAllowed(msg.sender, _to, _amount));
Copy link
Collaborator

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 DummyValidator(Jurisdiction _jurisdiction)
TransactionChecker(_jurisdiction)
public
{
jurisdiction = _jurisdiction;
}

function validate() public {
jurisdiction.addAttribute(msg.sender, "VALID", 1);
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants