-
Notifications
You must be signed in to change notification settings - Fork 8
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
Check that the twin address is a contract #653
Conversation
5d6989a
to
1c61a4f
Compare
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 have left some comments, would be good to get responses, but i think in the worst case we just create an issue to fix later ... Looks good
|
||
if (tokenType == TokenType.FungibleToken) { | ||
// ERC-20 style transfer | ||
data = abi.encodeCall(IERC20.transferFrom, (seller.assistant, sender, twin.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.
I wonder why we decided to the change this one and not the subsequent similar calls on lines 742 and 751
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.
?
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.
abi.encodeCall
was introduced in solidity 8.11. It's a safer alternative to other abi encoders since it checks types at compile time and it's suggested way to use.
We cant use the same on lines 742 and 751 because of the not yet resolved issue with overloaded functions and their selectors: ethereum/solidity#3556
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.
Thanks
twin.tokenId++; | ||
} else { | ||
// Token transfer order is descending | ||
tokenId += twin.supplyAvailable; |
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 just an aside, by i prefer the previous syntax here, it was more verbose, i like verbose as I have a simple internal parser ... but anyways, no need to change
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 reason for this change wasn't even the syntax itself, but I just wanted to remove reading storage twin.tokenId
.
tokenId = tokenId + twin.supplyAvailable
would be ok for me, too, but now that it's merged already, I won't change it.
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.
Agreed, thanks
) | ||
); | ||
); | ||
} |
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 guess also, that there is no way for us to have an unsupported TokenType at this point? If it is possible, would it be sane to have an else clause and to throw a "unknown token type" kind of revert ? If so, we could always create an issue for the next release
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.
there isn't. tokenType is defined when creating a twin, and if a seller passes a value that is not present in the TokenType enum transaction will be reverted.
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.
OK, thanks for the reply @anajuliabit
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.
Great job 👍
) | ||
); | ||
); | ||
} |
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.
there isn't. tokenType is defined when creating a twin, and if a seller passes a value that is not present in the TokenType enum transaction will be reverted.
Fix #616
This is branched from #652 which should be merged before this.