Skip to content

Commit 8605661

Browse files
committed
can do without OZ v5
1 parent bfd017d commit 8605661

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pragma solidity >= 0.8.11;
33

44
import { ISuperfluidToken } from "./ISuperfluidToken.sol";
55
import { IERC20, IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
6-
import { IERC20Permit } from "@openzeppelin/contracts-v5/token/ERC20/extensions/IERC20Permit.sol";
6+
import { IERC20Permit } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol";
77
import { IERC777 } from "@openzeppelin/contracts/token/ERC777/IERC777.sol";
88
import { IPoolAdminNFT } from "../agreements/gdav1/IPoolAdminNFT.sol";
99
import { IPoolMemberNFT } from "../agreements/gdav1/IPoolMemberNFT.sol";

packages/ethereum-contracts/contracts/superfluid/SuperToken.sol

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";
2020
import { IERC777Recipient } from "@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol";
2121
import { IERC777Sender } from "@openzeppelin/contracts/token/ERC777/IERC777Sender.sol";
2222
import { Address } from "@openzeppelin/contracts/utils/Address.sol";
23-
24-
import { ECDSA } from "@openzeppelin/contracts-v5/utils/cryptography/ECDSA.sol";
25-
import { MessageHashUtils } from "@openzeppelin/contracts-v5/utils/cryptography/MessageHashUtils.sol";
23+
import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
2624

2725
// placeholder types needed as an intermediate step before complete removal of FlowNFTs
2826
// solhint-disable-next-line no-empty-blocks
@@ -259,7 +257,18 @@ contract SuperToken is
259257
)
260258
);
261259

262-
bytes32 hash = MessageHashUtils.toTypedDataHash(DOMAIN_SEPARATOR(), structHash);
260+
bytes32 domainSeparator = DOMAIN_SEPARATOR();
261+
// Get the keccak256 digest of the EIP-712 typed data (ERC-191 version `0x01`).
262+
// solhint-disable-next-line max-line-length
263+
// Snippet taken from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.2.0/contracts/utils/cryptography/MessageHashUtils.sol
264+
bytes32 hash;
265+
assembly ("memory-safe") {
266+
let ptr := mload(0x40)
267+
mstore(ptr, hex"19_01")
268+
mstore(add(ptr, 0x02), domainSeparator)
269+
mstore(add(ptr, 0x22), structHash)
270+
hash := keccak256(ptr, 0x42)
271+
}
263272

264273
address signer = ECDSA.recover(hash, v, r, s);
265274
if (signer != owner) revert SUPER_TOKEN_PERMIT_INVALID_SIGNER(signer, owner);

packages/ethereum-contracts/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"@decentral.ee/web3-helpers": "0.5.3",
77
"@nomiclabs/hardhat-ethers": "2.2.3",
88
"@openzeppelin/contracts": "4.9.6",
9-
"@openzeppelin/contracts-v5": "npm:@openzeppelin/contracts@5.2.0",
109
"@truffle/contract": "4.6.31",
1110
"ethereumjs-tx": "2.1.2",
1211
"ethereumjs-util": "7.1.5",

yarn.lock

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3318,11 +3318,6 @@
33183318
find-up "^4.1.0"
33193319
fs-extra "^8.1.0"
33203320

3321-
"@openzeppelin/contracts-v5@npm:@openzeppelin/contracts@5.2.0":
3322-
version "5.2.0"
3323-
resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-5.2.0.tgz#bd020694218202b811b0ea3eec07277814c658da"
3324-
integrity sha512-bxjNie5z89W1Ea0NZLZluFh8PrFNn9DH8DQlujEok2yjsOlraUPKID5p1Wk3qdNbf6XkQ1Os2RvfiHrrXLHWKA==
3325-
33263321
"@openzeppelin/contracts@4.9.6", "@openzeppelin/contracts@^4.9.6":
33273322
version "4.9.6"
33283323
resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-4.9.6.tgz#2a880a24eb19b4f8b25adc2a5095f2aa27f39677"

0 commit comments

Comments
 (0)