forked from Uniswap/permit2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMockHash.sol
36 lines (30 loc) · 1.27 KB
/
MockHash.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "forge-std/Test.sol";
import {ISignatureTransfer} from "../../src/interfaces/ISignatureTransfer.sol";
import {IAllowanceTransfer} from "../../src/interfaces/IAllowanceTransfer.sol";
import {PermitHash} from "../../src/libraries/PermitHash.sol";
contract MockHash {
using PermitHash for ISignatureTransfer.PermitTransferFrom;
using PermitHash for ISignatureTransfer.PermitBatchTransferFrom;
function hash(ISignatureTransfer.PermitTransferFrom memory permit) external view returns (bytes32) {
return permit.hash();
}
function hash(ISignatureTransfer.PermitBatchTransferFrom memory permit) external view returns (bytes32) {
return permit.hash();
}
function hashWithWitness(
ISignatureTransfer.PermitTransferFrom memory permit,
bytes32 witness,
string calldata witnessTypeString
) external view returns (bytes32) {
return permit.hashWithWitness(witness, witnessTypeString);
}
function hashWithWitness(
ISignatureTransfer.PermitBatchTransferFrom memory permit,
bytes32 witness,
string calldata witnessTypeString
) external view returns (bytes32) {
return permit.hashWithWitness(witness, witnessTypeString);
}
}