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

Merged
merged 2 commits into from
Dec 14, 2021
Merged

update to solidity 0.8 #140

merged 2 commits into from
Dec 14, 2021

Conversation

ralph-pichler
Copy link
Member

  • update to solidity 0.8
  • remove unnecessary SafeMath dependency
  • remove unnecessary abicoder pragma (this should help with source verification)
  • replace ERC20 dependency with IERC20

Copy link
Collaborator

@Eknir Eknir left a 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 { }

@@ -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 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

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) {
Copy link
Collaborator

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?

Copy link
Member Author

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.

@Eknir
Copy link
Collaborator

Eknir commented Dec 13, 2021

While you are upgrading, perhaps it makes sense to sanitize https://github.com/ethersphere/swap-swear-and-swindle/blob/master/package.json as well?

Copy link
Collaborator

@Eknir Eknir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ralph-pichler ralph-pichler merged commit 2dafd90 into master Dec 14, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants