-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
4 changed files
with
71 additions
and
62 deletions.
There are no files selected for viewing
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,7 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.28; | ||
|
||
// Minimal ERC20 interface. | ||
interface IERC20 { | ||
function transfer(address to, uint256 amount) external returns (bool); | ||
} |
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,60 @@ | ||
//SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.28; | ||
|
||
import "./IERC20.sol"; | ||
|
||
// Minimal Permit2 interface, derived from | ||
// https://github.com/Uniswap/permit2/blob/main/src/interfaces/ISignatureTransfer.sol | ||
interface IPermit2 { | ||
// Token and amount in a permit message. | ||
struct TokenPermissions { | ||
// Token to transfer. | ||
IERC20 token; | ||
// Amount to transfer. | ||
uint256 amount; | ||
} | ||
|
||
// The permit2 message. | ||
struct PermitTransferFrom { | ||
// Permitted token and maximum amount. | ||
TokenPermissions permitted;// deadline on the permit signature | ||
// Unique identifier for this permit. | ||
uint256 nonce; | ||
// Expiration for this permit. | ||
uint256 deadline; | ||
} | ||
|
||
// The permit2 message for batch transfers. | ||
struct PermitBatchTransferFrom { | ||
// Permitted tokens and maximum amounts. | ||
TokenPermissions[] permitted; | ||
// Unique identifier for this permit. | ||
uint256 nonce; | ||
// Expiration for this permit. | ||
uint256 deadline; | ||
} | ||
|
||
// Transfer details for permitTransferFrom(). | ||
struct SignatureTransferDetails { | ||
// Recipient of tokens. | ||
address to; | ||
// Amount to transfer. | ||
uint256 requestedAmount; | ||
} | ||
|
||
// Consume a permit2 message and transfer tokens. | ||
function permitTransferFrom( | ||
PermitTransferFrom calldata permit, | ||
SignatureTransferDetails calldata transferDetails, | ||
address owner, | ||
bytes calldata signature | ||
) external; | ||
|
||
// Consume a batch permit2 message and transfer tokens. | ||
function permitTransferFrom( | ||
PermitBatchTransferFrom calldata permit, | ||
SignatureTransferDetails[] calldata transferDetails, | ||
address owner, | ||
bytes calldata signature | ||
) external; | ||
} |
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