From 1edeae55eb8992eec12e70e74cbd5f3857db5a68 Mon Sep 17 00:00:00 2001 From: Yash Date: Wed, 3 Apr 2024 01:15:31 +0530 Subject: [PATCH 1/7] check EIP1271 signatures --- contracts/extension/Ownable.sol | 2 +- .../prebuilts/unaudited/airdrop/Airdrop.sol | 39 +++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/contracts/extension/Ownable.sol b/contracts/extension/Ownable.sol index bdfb98d47..0a46ea6b8 100644 --- a/contracts/extension/Ownable.sol +++ b/contracts/extension/Ownable.sol @@ -46,7 +46,7 @@ abstract contract Ownable is IOwnable { } /// @dev Lets a contract admin set a new owner for the contract. The new owner must be a contract admin. - function _setupOwner(address _newOwner) internal { + function _setupOwner(address _newOwner) internal virtual { address _prevOwner = _owner; _owner = _newOwner; diff --git a/contracts/prebuilts/unaudited/airdrop/Airdrop.sol b/contracts/prebuilts/unaudited/airdrop/Airdrop.sol index 9fba1dae6..117eee5ec 100644 --- a/contracts/prebuilts/unaudited/airdrop/Airdrop.sol +++ b/contracts/prebuilts/unaudited/airdrop/Airdrop.sol @@ -24,6 +24,10 @@ import "../../../eip/interface/IERC20.sol"; import "../../../eip/interface/IERC721.sol"; import "../../../eip/interface/IERC1155.sol"; +interface IEIP1271 { + function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4); +} + contract Airdrop is EIP712, Initializable, Ownable { using ECDSA for bytes32; @@ -40,6 +44,9 @@ contract Airdrop is EIP712, Initializable, Ownable { /// @dev Mapping from request UID => whether the request is processed. mapping(bytes32 => bool) private processed; + /// @dev Flag to indicate if signature verification should be EIP-1271 (based on whether owner is a contract) + bool private check1271; + struct AirdropContentERC20 { address recipient; uint256 amount; @@ -98,6 +105,8 @@ contract Airdrop is EIP712, Initializable, Ownable { "AirdropRequestERC1155(bytes32 uid,address tokenAddress,uint256 expirationTimestamp,AirdropContentERC1155[] contents)AirdropContentERC1155(address recipient,uint256 tokenId,uint256 amount)" ); + bytes4 private constant EIP1271_MAGIC_VALUE = 0x1626ba7e; + address private constant NATIVE_TOKEN_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; /*/////////////////////////////////////////////////////////////// @@ -406,6 +415,12 @@ contract Airdrop is EIP712, Initializable, Ownable { tokenMerkleRoot[_token] = _tokenMerkleRoot; } + function _setupOwner(address _newOwner) internal override { + super._setupOwner(_newOwner); + + check1271 = _isContract(_newOwner) ? true : false; + } + /*/////////////////////////////////////////////////////////////// Miscellaneous //////////////////////////////////////////////////////////////*/ @@ -426,6 +441,15 @@ contract Airdrop is EIP712, Initializable, Ownable { return false; } + function _isContract(address account) internal view returns (bool) { + if (account == address(0)) return false; + bytes32 codehash; + assembly { + codehash := extcodehash(account) + } + return (codehash != 0x0 && codehash != 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470); + } + function _canSetOwner() internal view virtual override returns (bool) { return msg.sender == owner(); } @@ -485,6 +509,11 @@ contract Airdrop is EIP712, Initializable, Ownable { ); bytes32 digest = _hashTypedData(structHash); + + if (check1271) { + return IEIP1271(owner()).isValidSignature(digest, signature) == EIP1271_MAGIC_VALUE; + } + address recovered = digest.recover(signature); return recovered == owner(); } @@ -499,6 +528,11 @@ contract Airdrop is EIP712, Initializable, Ownable { ); bytes32 digest = _hashTypedData(structHash); + + if (check1271) { + return IEIP1271(owner()).isValidSignature(digest, signature) == EIP1271_MAGIC_VALUE; + } + address recovered = digest.recover(signature); return recovered == owner(); } @@ -513,6 +547,11 @@ contract Airdrop is EIP712, Initializable, Ownable { ); bytes32 digest = _hashTypedData(structHash); + + if (check1271) { + return IEIP1271(owner()).isValidSignature(digest, signature) == EIP1271_MAGIC_VALUE; + } + address recovered = digest.recover(signature); return recovered == owner(); } From f3d42bf31f5f132e0843aae3f02c062edddc0022 Mon Sep 17 00:00:00 2001 From: Yash Date: Wed, 3 Apr 2024 01:32:24 +0530 Subject: [PATCH 2/7] remove state check1271 etc --- .../prebuilts/unaudited/airdrop/Airdrop.sol | 57 +++++++++---------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/contracts/prebuilts/unaudited/airdrop/Airdrop.sol b/contracts/prebuilts/unaudited/airdrop/Airdrop.sol index 117eee5ec..6938f3af6 100644 --- a/contracts/prebuilts/unaudited/airdrop/Airdrop.sol +++ b/contracts/prebuilts/unaudited/airdrop/Airdrop.sol @@ -44,9 +44,6 @@ contract Airdrop is EIP712, Initializable, Ownable { /// @dev Mapping from request UID => whether the request is processed. mapping(bytes32 => bool) private processed; - /// @dev Flag to indicate if signature verification should be EIP-1271 (based on whether owner is a contract) - bool private check1271; - struct AirdropContentERC20 { address recipient; uint256 amount; @@ -415,12 +412,6 @@ contract Airdrop is EIP712, Initializable, Ownable { tokenMerkleRoot[_token] = _tokenMerkleRoot; } - function _setupOwner(address _newOwner) internal override { - super._setupOwner(_newOwner); - - check1271 = _isContract(_newOwner) ? true : false; - } - /*/////////////////////////////////////////////////////////////// Miscellaneous //////////////////////////////////////////////////////////////*/ @@ -441,15 +432,6 @@ contract Airdrop is EIP712, Initializable, Ownable { return false; } - function _isContract(address account) internal view returns (bool) { - if (account == address(0)) return false; - bytes32 codehash; - assembly { - codehash := extcodehash(account) - } - return (codehash != 0x0 && codehash != 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470); - } - function _canSetOwner() internal view virtual override returns (bool) { return msg.sender == owner(); } @@ -509,13 +491,18 @@ contract Airdrop is EIP712, Initializable, Ownable { ); bytes32 digest = _hashTypedData(structHash); + address recovered = digest.recover(signature); - if (check1271) { - return IEIP1271(owner()).isValidSignature(digest, signature) == EIP1271_MAGIC_VALUE; + address _owner = owner(); + if (recovered != _owner) { + try IEIP1271(_owner).isValidSignature(digest, signature) returns (bytes4 magicValue) { + return magicValue == EIP1271_MAGIC_VALUE; + } catch {} + + return false; } - address recovered = digest.recover(signature); - return recovered == owner(); + return true; } function _verifyRequestSignerERC721( @@ -528,13 +515,18 @@ contract Airdrop is EIP712, Initializable, Ownable { ); bytes32 digest = _hashTypedData(structHash); + address recovered = digest.recover(signature); + + address _owner = owner(); + if (recovered != _owner) { + try IEIP1271(_owner).isValidSignature(digest, signature) returns (bytes4 magicValue) { + return magicValue == EIP1271_MAGIC_VALUE; + } catch {} - if (check1271) { - return IEIP1271(owner()).isValidSignature(digest, signature) == EIP1271_MAGIC_VALUE; + return false; } - address recovered = digest.recover(signature); - return recovered == owner(); + return true; } function _verifyRequestSignerERC1155( @@ -547,12 +539,17 @@ contract Airdrop is EIP712, Initializable, Ownable { ); bytes32 digest = _hashTypedData(structHash); + address recovered = digest.recover(signature); - if (check1271) { - return IEIP1271(owner()).isValidSignature(digest, signature) == EIP1271_MAGIC_VALUE; + address _owner = owner(); + if (recovered != _owner) { + try IEIP1271(_owner).isValidSignature(digest, signature) returns (bytes4 magicValue) { + return magicValue == EIP1271_MAGIC_VALUE; + } catch {} + + return false; } - address recovered = digest.recover(signature); - return recovered == owner(); + return true; } } From 1912283bf0b0992a434407658852d00e6205fa52 Mon Sep 17 00:00:00 2001 From: Yash Date: Wed, 3 Apr 2024 01:40:26 +0530 Subject: [PATCH 3/7] revert changes to Ownable --- contracts/extension/Ownable.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/extension/Ownable.sol b/contracts/extension/Ownable.sol index 0a46ea6b8..bdfb98d47 100644 --- a/contracts/extension/Ownable.sol +++ b/contracts/extension/Ownable.sol @@ -46,7 +46,7 @@ abstract contract Ownable is IOwnable { } /// @dev Lets a contract admin set a new owner for the contract. The new owner must be a contract admin. - function _setupOwner(address _newOwner) internal virtual { + function _setupOwner(address _newOwner) internal { address _prevOwner = _owner; _owner = _newOwner; From 84278e10f4b8aab77c6f8d32ec751c07e489e4a8 Mon Sep 17 00:00:00 2001 From: Yash Date: Wed, 3 Apr 2024 01:47:29 +0530 Subject: [PATCH 4/7] rename local variable --- .../prebuilts/unaudited/airdrop/Airdrop.sol | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/contracts/prebuilts/unaudited/airdrop/Airdrop.sol b/contracts/prebuilts/unaudited/airdrop/Airdrop.sol index 6938f3af6..711f4f000 100644 --- a/contracts/prebuilts/unaudited/airdrop/Airdrop.sol +++ b/contracts/prebuilts/unaudited/airdrop/Airdrop.sol @@ -493,9 +493,9 @@ contract Airdrop is EIP712, Initializable, Ownable { bytes32 digest = _hashTypedData(structHash); address recovered = digest.recover(signature); - address _owner = owner(); - if (recovered != _owner) { - try IEIP1271(_owner).isValidSignature(digest, signature) returns (bytes4 magicValue) { + address owner_ = owner(); + if (recovered != owner_) { + try IEIP1271(owner_).isValidSignature(digest, signature) returns (bytes4 magicValue) { return magicValue == EIP1271_MAGIC_VALUE; } catch {} @@ -517,9 +517,9 @@ contract Airdrop is EIP712, Initializable, Ownable { bytes32 digest = _hashTypedData(structHash); address recovered = digest.recover(signature); - address _owner = owner(); - if (recovered != _owner) { - try IEIP1271(_owner).isValidSignature(digest, signature) returns (bytes4 magicValue) { + address owner_ = owner(); + if (recovered != owner_) { + try IEIP1271(owner_).isValidSignature(digest, signature) returns (bytes4 magicValue) { return magicValue == EIP1271_MAGIC_VALUE; } catch {} @@ -541,9 +541,9 @@ contract Airdrop is EIP712, Initializable, Ownable { bytes32 digest = _hashTypedData(structHash); address recovered = digest.recover(signature); - address _owner = owner(); - if (recovered != _owner) { - try IEIP1271(_owner).isValidSignature(digest, signature) returns (bytes4 magicValue) { + address owner_ = owner(); + if (recovered != owner_) { + try IEIP1271(owner_).isValidSignature(digest, signature) returns (bytes4 magicValue) { return magicValue == EIP1271_MAGIC_VALUE; } catch {} From fff8db40a59460900a69044127373e4f635ebefd Mon Sep 17 00:00:00 2001 From: Yash Date: Wed, 3 Apr 2024 02:37:44 +0530 Subject: [PATCH 5/7] use SignatureCheckerLib --- .../prebuilts/unaudited/airdrop/Airdrop.sol | 37 +--- src/test/airdrop/Airdrop.t.sol | 202 +++++++++++++++++- 2 files changed, 205 insertions(+), 34 deletions(-) diff --git a/contracts/prebuilts/unaudited/airdrop/Airdrop.sol b/contracts/prebuilts/unaudited/airdrop/Airdrop.sol index 711f4f000..64859e25f 100644 --- a/contracts/prebuilts/unaudited/airdrop/Airdrop.sol +++ b/contracts/prebuilts/unaudited/airdrop/Airdrop.sol @@ -16,6 +16,7 @@ import "@solady/src/utils/MerkleProofLib.sol"; import "@solady/src/utils/ECDSA.sol"; import "@solady/src/utils/EIP712.sol"; import "@solady/src/utils/SafeTransferLib.sol"; +import "@solady/src/utils/SignatureCheckerLib.sol"; import { Initializable } from "../../../extension/Initializable.sol"; import { Ownable } from "../../../extension/Ownable.sol"; @@ -491,18 +492,8 @@ contract Airdrop is EIP712, Initializable, Ownable { ); bytes32 digest = _hashTypedData(structHash); - address recovered = digest.recover(signature); - address owner_ = owner(); - if (recovered != owner_) { - try IEIP1271(owner_).isValidSignature(digest, signature) returns (bytes4 magicValue) { - return magicValue == EIP1271_MAGIC_VALUE; - } catch {} - - return false; - } - - return true; + return SignatureCheckerLib.isValidSignatureNowCalldata(owner(), digest, signature); } function _verifyRequestSignerERC721( @@ -515,18 +506,8 @@ contract Airdrop is EIP712, Initializable, Ownable { ); bytes32 digest = _hashTypedData(structHash); - address recovered = digest.recover(signature); - address owner_ = owner(); - if (recovered != owner_) { - try IEIP1271(owner_).isValidSignature(digest, signature) returns (bytes4 magicValue) { - return magicValue == EIP1271_MAGIC_VALUE; - } catch {} - - return false; - } - - return true; + return SignatureCheckerLib.isValidSignatureNowCalldata(owner(), digest, signature); } function _verifyRequestSignerERC1155( @@ -539,17 +520,7 @@ contract Airdrop is EIP712, Initializable, Ownable { ); bytes32 digest = _hashTypedData(structHash); - address recovered = digest.recover(signature); - - address owner_ = owner(); - if (recovered != owner_) { - try IEIP1271(owner_).isValidSignature(digest, signature) returns (bytes4 magicValue) { - return magicValue == EIP1271_MAGIC_VALUE; - } catch {} - - return false; - } - return true; + return SignatureCheckerLib.isValidSignatureNowCalldata(owner(), digest, signature); } } diff --git a/src/test/airdrop/Airdrop.t.sol b/src/test/airdrop/Airdrop.t.sol index 3eef9d519..fdfdab9ca 100644 --- a/src/test/airdrop/Airdrop.t.sol +++ b/src/test/airdrop/Airdrop.t.sol @@ -1,14 +1,50 @@ // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; -import { Airdrop } from "contracts/prebuilts/unaudited/airdrop/Airdrop.sol"; +import { Airdrop, IEIP1271, ECDSA } from "contracts/prebuilts/unaudited/airdrop/Airdrop.sol"; // Test imports import { TWProxy } from "contracts/infra/TWProxy.sol"; import "../utils/BaseTest.sol"; +contract MockSmartWallet { + using ECDSA for bytes32; + + bytes4 private constant EIP1271_MAGIC_VALUE = 0x1626ba7e; + address private admin; + + constructor(address _admin) { + admin = _admin; + } + + function isValidSignature(bytes32 _hash, bytes memory _signature) public view returns (bytes4) { + if (_hash.recover(_signature) == admin) { + return EIP1271_MAGIC_VALUE; + } + } + + function onERC721Received(address, address, uint256, bytes memory) external pure returns (bytes4) { + return this.onERC721Received.selector; + } + + function onERC1155Received(address, address, uint256, uint256, bytes memory) external pure returns (bytes4) { + return this.onERC1155Received.selector; + } + + function onERC1155BatchReceived( + address, + address, + uint256[] memory, + uint256[] memory, + bytes memory + ) external pure returns (bytes4) { + return this.onERC1155BatchReceived.selector; + } +} + contract AirdropTest is BaseTest { Airdrop internal airdrop; + MockSmartWallet internal mockSmartWallet; bytes32 private constant CONTENT_TYPEHASH_ERC20 = keccak256("AirdropContentERC20(address recipient,uint256 amount)"); @@ -48,6 +84,8 @@ contract AirdropTest is BaseTest { domainSeparator = keccak256( abi.encode(TYPE_HASH_EIP712, NAME_HASH, VERSION_HASH, block.chainid, address(airdrop)) ); + + mockSmartWallet = new MockSmartWallet(signer); } function _getContentsERC20(uint256 length) internal pure returns (Airdrop.AirdropContentERC20[] memory contents) { @@ -272,6 +310,62 @@ contract AirdropTest is BaseTest { assertEq(erc20.balanceOf(signer), 100 ether - totalAmount); } + function test_state_airdropSignature_erc20_eip1271() public { + // set mockSmartWallet as contract owner + vm.prank(signer); + airdrop.setOwner(address(mockSmartWallet)); + + // mint tokens to mockSmartWallet + erc20.mint(address(mockSmartWallet), 100 ether); + vm.prank(address(mockSmartWallet)); + erc20.approve(address(airdrop), 100 ether); + + Airdrop.AirdropContentERC20[] memory contents = _getContentsERC20(10); + Airdrop.AirdropRequestERC20 memory req = Airdrop.AirdropRequestERC20({ + uid: bytes32(uint256(1)), + tokenAddress: address(erc20), + expirationTimestamp: 1000, + contents: contents + }); + + // sign with original EOA signer private key + bytes memory signature = _signReqERC20(req, privateKey); + + airdrop.airdropERC20WithSignature(req, signature); + + uint256 totalAmount; + for (uint256 i = 0; i < contents.length; i++) { + totalAmount += contents[i].amount; + assertEq(erc20.balanceOf(contents[i].recipient), contents[i].amount); + } + assertEq(erc20.balanceOf(address(mockSmartWallet)), 100 ether - totalAmount); + } + + function test_revert_airdropSignature_erc20_eip1271_invalidSignature() public { + // set mockSmartWallet as contract owner + vm.prank(signer); + airdrop.setOwner(address(mockSmartWallet)); + + // mint tokens to mockSmartWallet + erc20.mint(address(mockSmartWallet), 100 ether); + vm.prank(address(mockSmartWallet)); + erc20.approve(address(airdrop), 100 ether); + + Airdrop.AirdropContentERC20[] memory contents = _getContentsERC20(10); + Airdrop.AirdropRequestERC20 memory req = Airdrop.AirdropRequestERC20({ + uid: bytes32(uint256(1)), + tokenAddress: address(erc20), + expirationTimestamp: 1000, + contents: contents + }); + + // sign with random private key + bytes memory signature = _signReqERC20(req, 123); + + vm.expectRevert(abi.encodeWithSelector(Airdrop.AirdropRequestInvalidSigner.selector)); + airdrop.airdropERC20WithSignature(req, signature); + } + function test_revert_airdropSignature_erc20_expired() public { erc20.mint(signer, 100 ether); vm.prank(signer); @@ -490,6 +584,59 @@ contract AirdropTest is BaseTest { } } + function test_state_airdropSignature_erc721_eip1271() public { + // set mockSmartWallet as contract owner + vm.prank(signer); + airdrop.setOwner(address(mockSmartWallet)); + + // mint tokens to mockSmartWallet + erc721.mint(address(mockSmartWallet), 1000); + vm.prank(address(mockSmartWallet)); + erc721.setApprovalForAll(address(airdrop), true); + + Airdrop.AirdropContentERC721[] memory contents = _getContentsERC721(10); + Airdrop.AirdropRequestERC721 memory req = Airdrop.AirdropRequestERC721({ + uid: bytes32(uint256(1)), + tokenAddress: address(erc721), + expirationTimestamp: 1000, + contents: contents + }); + + // sign with original EOA signer private key + bytes memory signature = _signReqERC721(req, privateKey); + + airdrop.airdropERC721WithSignature(req, signature); + + for (uint256 i = 0; i < contents.length; i++) { + assertEq(erc721.ownerOf(contents[i].tokenId), contents[i].recipient); + } + } + + function test_revert_airdropSignature_erc721_eip1271_invalidSignature() public { + // set mockSmartWallet as contract owner + vm.prank(signer); + airdrop.setOwner(address(mockSmartWallet)); + + // mint tokens to mockSmartWallet + erc721.mint(address(mockSmartWallet), 1000); + vm.prank(address(mockSmartWallet)); + erc721.setApprovalForAll(address(airdrop), true); + + Airdrop.AirdropContentERC721[] memory contents = _getContentsERC721(10); + Airdrop.AirdropRequestERC721 memory req = Airdrop.AirdropRequestERC721({ + uid: bytes32(uint256(1)), + tokenAddress: address(erc721), + expirationTimestamp: 1000, + contents: contents + }); + + // sign with random private key + bytes memory signature = _signReqERC721(req, 123); + + vm.expectRevert(abi.encodeWithSelector(Airdrop.AirdropRequestInvalidSigner.selector)); + airdrop.airdropERC721WithSignature(req, signature); + } + function test_revert_airdropSignature_erc721_expired() public { erc721.mint(signer, 1000); vm.prank(signer); @@ -704,6 +851,59 @@ contract AirdropTest is BaseTest { } } + function test_state_airdropSignature_erc1155_eip1271() public { + // set mockSmartWallet as contract owner + vm.prank(signer); + airdrop.setOwner(address(mockSmartWallet)); + + // mint tokens to mockSmartWallet + erc1155.mint(address(mockSmartWallet), 0, 100 ether); + vm.prank(address(mockSmartWallet)); + erc1155.setApprovalForAll(address(airdrop), true); + + Airdrop.AirdropContentERC1155[] memory contents = _getContentsERC1155(10); + Airdrop.AirdropRequestERC1155 memory req = Airdrop.AirdropRequestERC1155({ + uid: bytes32(uint256(1)), + tokenAddress: address(erc1155), + expirationTimestamp: 1000, + contents: contents + }); + + // sign with original EOA signer private key + bytes memory signature = _signReqERC1155(req, privateKey); + + airdrop.airdropERC1155WithSignature(req, signature); + + for (uint256 i = 0; i < contents.length; i++) { + assertEq(erc1155.balanceOf(contents[i].recipient, contents[i].tokenId), contents[i].amount); + } + } + + function test_revert_airdropSignature_erc1155_eip1271_invalidSignature() public { + // set mockSmartWallet as contract owner + vm.prank(signer); + airdrop.setOwner(address(mockSmartWallet)); + + // mint tokens to mockSmartWallet + erc1155.mint(address(mockSmartWallet), 0, 100 ether); + vm.prank(address(mockSmartWallet)); + erc1155.setApprovalForAll(address(airdrop), true); + + Airdrop.AirdropContentERC1155[] memory contents = _getContentsERC1155(10); + Airdrop.AirdropRequestERC1155 memory req = Airdrop.AirdropRequestERC1155({ + uid: bytes32(uint256(1)), + tokenAddress: address(erc1155), + expirationTimestamp: 1000, + contents: contents + }); + + // sign with random private key + bytes memory signature = _signReqERC1155(req, 123); + + vm.expectRevert(abi.encodeWithSelector(Airdrop.AirdropRequestInvalidSigner.selector)); + airdrop.airdropERC1155WithSignature(req, signature); + } + function test_revert_airdropSignature_erc115_expired() public { erc1155.mint(signer, 0, 100 ether); vm.prank(signer); From 897e4bf2b9235087ccffde50cf371db67198328a Mon Sep 17 00:00:00 2001 From: Yash Date: Wed, 3 Apr 2024 02:44:05 +0530 Subject: [PATCH 6/7] cleanup --- contracts/prebuilts/unaudited/airdrop/Airdrop.sol | 4 ---- src/test/airdrop/Airdrop.t.sol | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/contracts/prebuilts/unaudited/airdrop/Airdrop.sol b/contracts/prebuilts/unaudited/airdrop/Airdrop.sol index 64859e25f..a16735233 100644 --- a/contracts/prebuilts/unaudited/airdrop/Airdrop.sol +++ b/contracts/prebuilts/unaudited/airdrop/Airdrop.sol @@ -25,10 +25,6 @@ import "../../../eip/interface/IERC20.sol"; import "../../../eip/interface/IERC721.sol"; import "../../../eip/interface/IERC1155.sol"; -interface IEIP1271 { - function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4); -} - contract Airdrop is EIP712, Initializable, Ownable { using ECDSA for bytes32; diff --git a/src/test/airdrop/Airdrop.t.sol b/src/test/airdrop/Airdrop.t.sol index fdfdab9ca..0465dc490 100644 --- a/src/test/airdrop/Airdrop.t.sol +++ b/src/test/airdrop/Airdrop.t.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; -import { Airdrop, IEIP1271, ECDSA } from "contracts/prebuilts/unaudited/airdrop/Airdrop.sol"; +import { Airdrop, ECDSA } from "contracts/prebuilts/unaudited/airdrop/Airdrop.sol"; // Test imports import { TWProxy } from "contracts/infra/TWProxy.sol"; From 1a9741310c4f15534b2d86c91fecff6f85ef939c Mon Sep 17 00:00:00 2001 From: Yash Date: Wed, 3 Apr 2024 02:44:53 +0530 Subject: [PATCH 7/7] cleanup --- contracts/prebuilts/unaudited/airdrop/Airdrop.sol | 2 -- 1 file changed, 2 deletions(-) diff --git a/contracts/prebuilts/unaudited/airdrop/Airdrop.sol b/contracts/prebuilts/unaudited/airdrop/Airdrop.sol index a16735233..8d98eeb8c 100644 --- a/contracts/prebuilts/unaudited/airdrop/Airdrop.sol +++ b/contracts/prebuilts/unaudited/airdrop/Airdrop.sol @@ -99,8 +99,6 @@ contract Airdrop is EIP712, Initializable, Ownable { "AirdropRequestERC1155(bytes32 uid,address tokenAddress,uint256 expirationTimestamp,AirdropContentERC1155[] contents)AirdropContentERC1155(address recipient,uint256 tokenId,uint256 amount)" ); - bytes4 private constant EIP1271_MAGIC_VALUE = 0x1626ba7e; - address private constant NATIVE_TOKEN_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; /*///////////////////////////////////////////////////////////////