-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a377753
commit 195c179
Showing
11 changed files
with
146 additions
and
88 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.17; | ||
|
||
import {Permit2ERC721} from "../../src/ERC721/Permit2ERC721.sol"; | ||
import {IAllowanceTransferERC721} from "../../src/ERC721/interfaces/IAllowanceTransferERC721.sol"; | ||
import {SignatureTransferERC721} from "../../src/ERC721/SignatureTransferERC721.sol"; | ||
import {AllowanceERC721} from "../../src/ERC721/libraries/AllowanceERC721.sol"; | ||
import {IMockPermit2} from "../mocks/IMockPermit2.sol"; | ||
|
||
contract MockPermit2ERC721 is IMockPermit2, Permit2ERC721 { | ||
function doStore(address from, address token, address spender, uint256 tokenId, uint256 word) public override { | ||
IAllowanceTransferERC721.PackedAllowance storage allowed = allowance[from][token][tokenId]; | ||
assembly { | ||
sstore(allowed.slot, word) | ||
} | ||
} | ||
|
||
function getStore(address from, address token, address spender, uint256 tokenId) | ||
public | ||
view | ||
override | ||
returns (uint256 word) | ||
{ | ||
IAllowanceTransferERC721.PackedAllowance storage allowed = allowance[from][token][tokenId]; | ||
assembly { | ||
word := sload(allowed.slot) | ||
} | ||
} | ||
|
||
function mockUpdateSome( | ||
address from, | ||
address token, | ||
address spender, | ||
uint160 updateData, | ||
uint256 tokenId, | ||
uint48 expiration | ||
) public override { | ||
// spender input unused in 721 case | ||
IAllowanceTransferERC721.PackedAllowance storage allowed = allowance[from][token][tokenId]; | ||
AllowanceERC721.updateSpenderAndExpiration(allowed, address(updateData), expiration); | ||
} | ||
|
||
function mockUpdateAll( | ||
address from, | ||
address token, | ||
address spender, | ||
uint160 updateData, | ||
uint256 tokenId, | ||
uint48 expiration, | ||
uint48 nonce | ||
) public override { | ||
IAllowanceTransferERC721.PackedAllowance storage allowed = allowance[from][token][tokenId]; | ||
AllowanceERC721.updateAll(allowed, address(updateData), expiration, nonce); | ||
} | ||
|
||
function useUnorderedNonce(address from, uint256 nonce) public override { | ||
_useUnorderedNonce(from, nonce); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 8 additions & 6 deletions
14
test/shared/AllowanceUnitTest_ERC721.t.sol β test/shared/AllowanceUnitTestERC721.t.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters