-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
update to solidity 0.8 #140
Conversation
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.
Thank you for the upgrade. One minor suggestion for improving.
Pay attention to ln 243 => if you want to keep this functioning the same, you should add unchecked { }
contracts/ERC20SimpleSwap.sol
Outdated
@@ -62,7 +56,7 @@ contract ERC20SimpleSwap { | |||
); | |||
|
|||
// the EIP712 domain this contract uses | |||
function domain() internal pure returns (EIP712Domain memory) { | |||
function domain() internal view returns (EIP712Domain memory) { | |||
uint256 chainId; | |||
assembly { |
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.
Solidity 0.8 exposes block.chainid
, see: https://docs.soliditylang.org/en/v0.8.0/units-and-global-variables.html
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.
nice
@@ -85,7 +79,7 @@ contract ERC20SimpleSwap { | |||
} | |||
|
|||
// recover a signature with the EIP712 signing scheme | |||
function recoverEIP712(bytes32 hash, bytes memory sig) internal pure returns (address) { |
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.
Could you please explain this 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.
querying the chainid is no longer considered pure in 0.8. as this calls domain()
, this function cannot be pure either.
While you are upgrading, perhaps it makes sense to sanitize https://github.com/ethersphere/swap-swear-and-swindle/blob/master/package.json as well? |
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.
LGTM!
SafeMath
dependencyabicoder
pragma (this should help with source verification)ERC20
dependency withIERC20