From 5d074fe97bd4bca39bf9af2498190d9f0fb96318 Mon Sep 17 00:00:00 2001 From: Ryan Ghods Date: Wed, 29 Nov 2023 15:07:03 -0800 Subject: [PATCH] fixes --- src/lib/Constants.sol | 9 +++------ .../erc20/ERC20ConduitPreapproved_Solady.sol | 19 +++++++------------ 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/lib/Constants.sol b/src/lib/Constants.sol index 02e56a8..b98dae3 100644 --- a/src/lib/Constants.sol +++ b/src/lib/Constants.sol @@ -26,11 +26,8 @@ uint256 constant SOLADY_ERC20_APPROVAL_EVENT_SIGNATURE = 0; /// @dev Solady ERC20 nonces slot seed with signature prefix. uint256 constant SOLADY_ERC20_NONCES_SLOT_SEED_WITH_SIGNATURE_PREFIX = 0x383775081901; /// @dev `keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")`. -bytes32 constant SOLADY_ERC20_DOMAIN_TYPEHASH = -0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f; +bytes32 constant SOLADY_ERC20_DOMAIN_TYPEHASH = 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f; /// @dev Solady ERC20 version hash: `keccak256("1")`. -bytes32 constant SOLADY_ERC20_VERSION_HASH = -0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6; +bytes32 constant SOLADY_ERC20_VERSION_HASH = 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6; /// @dev `keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)")`. -bytes32 constant SOLADY_ERC20_PERMIT_TYPEHASH = -0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; \ No newline at end of file +bytes32 constant SOLADY_ERC20_PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; diff --git a/src/tokens/erc20/ERC20ConduitPreapproved_Solady.sol b/src/tokens/erc20/ERC20ConduitPreapproved_Solady.sol index cd11b8f..b9ea7e0 100644 --- a/src/tokens/erc20/ERC20ConduitPreapproved_Solady.sol +++ b/src/tokens/erc20/ERC20ConduitPreapproved_Solady.sol @@ -10,7 +10,7 @@ import { SOLADY_ERC20_NONCES_SLOT_SEED_WITH_SIGNATURE_PREFIX, SOLADY_ERC20_DOMAIN_TYPEHASH, SOLADY_ERC20_PERMIT_TYPEHASH, - SOLADY_ERC20_VERSION_TYPEHASH, + SOLADY_ERC20_VERSION_HASH, SOLADY_ERC20_APPROVAL_EVENT_SIGNATURE } from "../../lib/Constants.sol"; import {IPreapprovalForAll} from "../../interfaces/IPreapprovalForAll.sol"; @@ -108,15 +108,11 @@ abstract contract ERC20ConduitPreapproved_Solady is ERC20, IPreapprovalForAll { return true; } - function permit( - address owner, - address spender, - uint256 value, - uint256 deadline, - uint8 v, - bytes32 r, - bytes32 s - ) public virtual { + function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) + public + virtual + override + { bytes32 nameHash = _constantNameHash(); // We simply calculate it on-the-fly to allow for cases where the `name` may change. if (nameHash == bytes32(0)) nameHash = keccak256(bytes(name())); @@ -173,8 +169,7 @@ abstract contract ERC20ConduitPreapproved_Solady is ERC20, IPreapprovalForAll { mstore(0x40, or(shl(160, SOLADY_ERC20_ALLOWANCE_SLOT_SEED), spender)) // "flip" allowance value if caller is CONDUIT and if value is 0 or type(uint256).max. - value := - xor(value, mul(and(eq(caller(), CONDUIT), iszero(and(value, not(value)))), not(0))) + value := xor(value, mul(and(eq(caller(), CONDUIT), iszero(and(value, not(value)))), not(0))) sstore(keccak256(0x2c, 0x34), value) // Emit the {Approval} event.