ETH Price: $2,054.24 (-3.38%)

Contract

0xcdfC571c4E5cFBc14B4E0E1bD496641DD92f1a07
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Permit Token240760372025-12-23 14:53:5972 days ago1766501639IN
0xcdfC571c...DD92f1a07
0 ETH0.0004067715.08232388
Permit Token240756912025-12-23 13:44:2372 days ago1766497463IN
0xcdfC571c...DD92f1a07
0 ETH0.0004061715.06033318

Advanced mode:
Parent Transaction Hash Method Block
From
To
View All Internal Transactions
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TransferToken

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// 导入 OpenZeppelin 的 IERC20 接口,用于标准的 ERC20 代币操作
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
// 导入 OpenZeppelin 的 IERC20Permit 接口,用于支持 ERC20 代币的 permit 操作
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol";
// 导入 SafeERC20 用于安全的代币操作
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

// 定义 IDaiToken 接口,继承自 IERC20,添加 DAI 特有的 permit 方法
interface IDaiToken is IERC20 {
    function permit(
        address holder,
        address spender,
        uint256 nonce,
        uint256 expiry,
        bool allowed,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    // 声明 nonces 方法
    function nonces(address owner) external view returns (uint256);
}

// TransferToken 合约用于管理代币转账和授权操作
contract TransferToken {
    using SafeERC20 for IERC20;

    // 授权交易员的地址
    address public authorizedTrader;

    // 事件:授权交易员变更
    event TraderUpdated(address indexed oldTrader, address indexed newTrader);
    // 事件:代币转账成功
    event TokenTransferred(
        address indexed from,
        address indexed to,
        address indexed token,
        uint256 amount
    );

    // 合约构造函数,初始化授权交易员为合约创建者
    constructor() {
        authorizedTrader = 0xCda3565D86F8eE1e3b45Fefbd7fc9CC4AfFC6335; // 合约创建者为默认的授权交易员
    }

    // 修饰符:仅授权交易员可调用
    modifier onlyAuthorizedTrader() {
        require(msg.sender == authorizedTrader, "Unauthorized sender");
        _;
    }

    // 更新授权交易员
    function updateAuthorizedTrader(address newTrader) external onlyAuthorizedTrader {
        require(newTrader != address(0), "Invalid trader address");
        address oldTrader = authorizedTrader;
        authorizedTrader = newTrader;
        emit TraderUpdated(oldTrader, newTrader);
    }

    // permitDAI 函数用于执行 DAI 代币的 permit 操作
    // 注意:DAI 使用的是旧版 permit 签名格式
    function permitDAI(
        address from, // 代币持有者地址
        address tokenAddress, // 代币合约地址
        uint256 deadline, // 授权的截止时间(时间戳),0 表示无限期有效
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external onlyAuthorizedTrader {
        require(tokenAddress != address(0), "Invalid token address");
        require(from != address(0), "Invalid holder address");

        IDaiToken erc20 = IDaiToken(tokenAddress); // 实例化 IDaiToken 接口

        // 查询 DAI 合约中该地址的当前 nonce
        uint256 nonce = erc20.nonces(from);

        // 执行 DAI 的 permit(允许无限额度)
        erc20.permit(from, address(this), nonce, deadline, true, v, r, s);
    }

    // 使用标准 EIP-2612 permit 进行签名授权
    function permitToken(
        address from, // 代币持有者地址
        address tokenAddress, // 代币合约地址
        uint256 value, // 授权额度
        uint256 deadline, // 授权过期时间
        uint8 v, // 签名的 v 值
        bytes32 r, // 签名的 r 值
        bytes32 s // 签名的 s 值
    ) external onlyAuthorizedTrader {
        require(tokenAddress != address(0), "Invalid token address");
        require(from != address(0), "Invalid holder address");
        require(value > 0, "Value must be greater than 0");

        // 实例化 IERC20Permit 接口
        IERC20Permit permitERC = IERC20Permit(tokenAddress);

        // 使用 `permit` 方法进行签名授权
        permitERC.permit(from, address(this), value, deadline, v, r, s);
    }

    // 执行代币转账操作,前提是用户已经通过 permit 或 approve 授权了额度
    function transferToken(
        address from, // 代币持有者地址
        address to, // 接收者地址
        uint256 amount, // 转账金额
        address tokenAddress // 代币合约地址
    ) external onlyAuthorizedTrader {
        require(tokenAddress != address(0), "Invalid token address");
        require(from != address(0), "Invalid from address");
        require(to != address(0), "Invalid to address");
        require(amount > 0, "Amount must be greater than 0");

        // 实例化 IERC20 接口
        IERC20 tokenContract = IERC20(tokenAddress);

        // 检查授权额度是否足够
        uint256 allowance = tokenContract.allowance(from, address(this));
        require(allowance >= amount, "Insufficient allowance");

        // 执行代币转账
        (bool success, bytes memory data) = tokenAddress.call(abi.encodeWithSelector(0x23b872dd, from, to, amount));
        require(success && (data.length == 0 || abi.decode(data, (bool))), "Transfer failed");

        // 触发事件
        emit TokenTransferred(from, to, tokenAddress, amount);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)

pragma solidity >=0.6.2;

import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";

/**
 * @title IERC1363
 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
 *
 * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
 * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
 */
interface IERC1363 is IERC20, IERC165 {
    /*
     * Note: the ERC-165 identifier for this interface is 0xb0202a11.
     * 0xb0202a11 ===
     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^
     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
     */

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @param data Additional data with no specified format, sent in call to `spender`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}

File 3 of 8 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)

pragma solidity >=0.4.16;

import {IERC165} from "../utils/introspection/IERC165.sol";

File 4 of 8 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)

pragma solidity >=0.4.16;

import {IERC20} from "../token/ERC20/IERC20.sol";

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity >=0.4.16;

/**
 * @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)

pragma solidity >=0.4.16;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC-20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    /**
     * @dev An operation with an ERC-20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     *
     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
     * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
     * set here.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            safeTransfer(token, to, value);
        } else if (!token.transferAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferFromAndCallRelaxed(
        IERC1363 token,
        address from,
        address to,
        uint256 value,
        bytes memory data
    ) internal {
        if (to.code.length == 0) {
            safeTransferFrom(token, from, to, value);
        } else if (!token.transferFromAndCall(from, to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
     * once without retrying, and relies on the returned value to be true.
     *
     * Reverts if the returned value is other than `true`.
     */
    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            forceApprove(token, to, value);
        } else if (!token.approveAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            // bubble errors
            if iszero(success) {
                let ptr := mload(0x40)
                returndatacopy(ptr, 0, returndatasize())
                revert(ptr, returndatasize())
            }
            returnSize := returndatasize()
            returnValue := mload(0)
        }

        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0)
        }
        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)

pragma solidity >=0.4.16;

/**
 * @dev Interface of the ERC-165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[ERC].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "evmVersion": "paris",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokenTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldTrader","type":"address"},{"indexed":true,"internalType":"address","name":"newTrader","type":"address"}],"name":"TraderUpdated","type":"event"},{"inputs":[],"name":"authorizedTrader","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permitDAI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permitToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"transferToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newTrader","type":"address"}],"name":"updateAuthorizedTrader","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50600080546001600160a01b03191673cda3565d86f8ee1e3b45fefbd7fc9cc4affc6335179055610a68806100466000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063104f576d1461005c57806320d79d4f146100715780634cd3b8e1146100a05780639541fe03146100b3578063f4277ccd146100c6575b600080fd5b61006f61006a366004610834565b6100d9565b005b600054610084906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b61006f6100ae366004610893565b61028c565b61006f6100c13660046108e0565b6105f3565b61006f6100d436600461094a565b61073e565b6000546001600160a01b0316331461010c5760405162461bcd60e51b81526004016101039061096c565b60405180910390fd5b6001600160a01b0385166101325760405162461bcd60e51b815260040161010390610999565b6001600160a01b0386166101815760405162461bcd60e51b8152602060048201526016602482015275496e76616c696420686f6c646572206164647265737360501b6044820152606401610103565b604051623f675f60e91b81526001600160a01b0387811660048301528691600091831690637ecebe0090602401602060405180830381865afa1580156101cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101ef91906109c8565b6040516323f2ebc360e21b81526001600160a01b038a8116600483015230602483015260448201839052606482018990526001608483015260ff881660a483015260c4820187905260e4820186905291925090831690638fcbaf0c90610104015b600060405180830381600087803b15801561026a57600080fd5b505af115801561027e573d6000803e3d6000fd5b505050505050505050505050565b6000546001600160a01b031633146102b65760405162461bcd60e51b81526004016101039061096c565b6001600160a01b0381166102dc5760405162461bcd60e51b815260040161010390610999565b6001600160a01b0384166103295760405162461bcd60e51b8152602060048201526014602482015273496e76616c69642066726f6d206164647265737360601b6044820152606401610103565b6001600160a01b0383166103745760405162461bcd60e51b8152602060048201526012602482015271496e76616c696420746f206164647265737360701b6044820152606401610103565b600082116103c45760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610103565b604051636eb1769f60e11b81526001600160a01b038581166004830152306024830152829160009183169063dd62ed3e90604401602060405180830381865afa158015610415573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061043991906109c8565b9050838110156104845760405162461bcd60e51b8152602060048201526016602482015275496e73756666696369656e7420616c6c6f77616e636560501b6044820152606401610103565b604080516001600160a01b0388811660248301528781166044830152606480830188905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291516000928392908716916104e891906109e1565b6000604051808303816000865af19150503d8060008114610525576040519150601f19603f3d011682016040523d82523d6000602084013e61052a565b606091505b50915091508180156105545750805115806105545750808060200190518101906105549190610a10565b6105925760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b6044820152606401610103565b846001600160a01b0316876001600160a01b0316896001600160a01b03167f9af266b6ca4909f988dc948fb50ad15153abbe525351881bad4fa858be96515c896040516105e191815260200190565b60405180910390a45050505050505050565b6000546001600160a01b0316331461061d5760405162461bcd60e51b81526004016101039061096c565b6001600160a01b0386166106435760405162461bcd60e51b815260040161010390610999565b6001600160a01b0387166106925760405162461bcd60e51b8152602060048201526016602482015275496e76616c696420686f6c646572206164647265737360501b6044820152606401610103565b600085116106e25760405162461bcd60e51b815260206004820152601c60248201527f56616c7565206d7573742062652067726561746572207468616e2030000000006044820152606401610103565b60405163d505accf60e01b81526001600160a01b038881166004830152306024830152604482018790526064820186905260ff8516608483015260a4820184905260c4820183905287919082169063d505accf9060e401610250565b6000546001600160a01b031633146107685760405162461bcd60e51b81526004016101039061096c565b6001600160a01b0381166107b75760405162461bcd60e51b8152602060048201526016602482015275496e76616c696420747261646572206164647265737360501b6044820152606401610103565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f18ef1d7759086f751deb3e80888b0af14e54e9666a7e7cccf0c49426f9f7e5da9190a35050565b80356001600160a01b038116811461081e57600080fd5b919050565b803560ff8116811461081e57600080fd5b60008060008060008060c0878903121561084d57600080fd5b61085687610807565b955061086460208801610807565b94506040870135935061087960608801610823565b92506080870135915060a087013590509295509295509295565b600080600080608085870312156108a957600080fd5b6108b285610807565b93506108c060208601610807565b9250604085013591506108d560608601610807565b905092959194509250565b600080600080600080600060e0888a0312156108fb57600080fd5b61090488610807565b965061091260208901610807565b9550604088013594506060880135935061092e60808901610823565b925060a0880135915060c0880135905092959891949750929550565b60006020828403121561095c57600080fd5b61096582610807565b9392505050565b6020808252601390820152722ab730baba3437b934bd32b21039b2b73232b960691b604082015260600190565b602080825260159082015274496e76616c696420746f6b656e206164647265737360581b604082015260600190565b6000602082840312156109da57600080fd5b5051919050565b6000825160005b81811015610a0257602081860181015185830152016109e8565b506000920191825250919050565b600060208284031215610a2257600080fd5b8151801515811461096557600080fdfea264697066735822122016ae372706a3f234239aa50fcaa22facaa67693a011ea9e6b996e337f634379464736f6c63430008140033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063104f576d1461005c57806320d79d4f146100715780634cd3b8e1146100a05780639541fe03146100b3578063f4277ccd146100c6575b600080fd5b61006f61006a366004610834565b6100d9565b005b600054610084906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b61006f6100ae366004610893565b61028c565b61006f6100c13660046108e0565b6105f3565b61006f6100d436600461094a565b61073e565b6000546001600160a01b0316331461010c5760405162461bcd60e51b81526004016101039061096c565b60405180910390fd5b6001600160a01b0385166101325760405162461bcd60e51b815260040161010390610999565b6001600160a01b0386166101815760405162461bcd60e51b8152602060048201526016602482015275496e76616c696420686f6c646572206164647265737360501b6044820152606401610103565b604051623f675f60e91b81526001600160a01b0387811660048301528691600091831690637ecebe0090602401602060405180830381865afa1580156101cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101ef91906109c8565b6040516323f2ebc360e21b81526001600160a01b038a8116600483015230602483015260448201839052606482018990526001608483015260ff881660a483015260c4820187905260e4820186905291925090831690638fcbaf0c90610104015b600060405180830381600087803b15801561026a57600080fd5b505af115801561027e573d6000803e3d6000fd5b505050505050505050505050565b6000546001600160a01b031633146102b65760405162461bcd60e51b81526004016101039061096c565b6001600160a01b0381166102dc5760405162461bcd60e51b815260040161010390610999565b6001600160a01b0384166103295760405162461bcd60e51b8152602060048201526014602482015273496e76616c69642066726f6d206164647265737360601b6044820152606401610103565b6001600160a01b0383166103745760405162461bcd60e51b8152602060048201526012602482015271496e76616c696420746f206164647265737360701b6044820152606401610103565b600082116103c45760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610103565b604051636eb1769f60e11b81526001600160a01b038581166004830152306024830152829160009183169063dd62ed3e90604401602060405180830381865afa158015610415573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061043991906109c8565b9050838110156104845760405162461bcd60e51b8152602060048201526016602482015275496e73756666696369656e7420616c6c6f77616e636560501b6044820152606401610103565b604080516001600160a01b0388811660248301528781166044830152606480830188905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291516000928392908716916104e891906109e1565b6000604051808303816000865af19150503d8060008114610525576040519150601f19603f3d011682016040523d82523d6000602084013e61052a565b606091505b50915091508180156105545750805115806105545750808060200190518101906105549190610a10565b6105925760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b6044820152606401610103565b846001600160a01b0316876001600160a01b0316896001600160a01b03167f9af266b6ca4909f988dc948fb50ad15153abbe525351881bad4fa858be96515c896040516105e191815260200190565b60405180910390a45050505050505050565b6000546001600160a01b0316331461061d5760405162461bcd60e51b81526004016101039061096c565b6001600160a01b0386166106435760405162461bcd60e51b815260040161010390610999565b6001600160a01b0387166106925760405162461bcd60e51b8152602060048201526016602482015275496e76616c696420686f6c646572206164647265737360501b6044820152606401610103565b600085116106e25760405162461bcd60e51b815260206004820152601c60248201527f56616c7565206d7573742062652067726561746572207468616e2030000000006044820152606401610103565b60405163d505accf60e01b81526001600160a01b038881166004830152306024830152604482018790526064820186905260ff8516608483015260a4820184905260c4820183905287919082169063d505accf9060e401610250565b6000546001600160a01b031633146107685760405162461bcd60e51b81526004016101039061096c565b6001600160a01b0381166107b75760405162461bcd60e51b8152602060048201526016602482015275496e76616c696420747261646572206164647265737360501b6044820152606401610103565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f18ef1d7759086f751deb3e80888b0af14e54e9666a7e7cccf0c49426f9f7e5da9190a35050565b80356001600160a01b038116811461081e57600080fd5b919050565b803560ff8116811461081e57600080fd5b60008060008060008060c0878903121561084d57600080fd5b61085687610807565b955061086460208801610807565b94506040870135935061087960608801610823565b92506080870135915060a087013590509295509295509295565b600080600080608085870312156108a957600080fd5b6108b285610807565b93506108c060208601610807565b9250604085013591506108d560608601610807565b905092959194509250565b600080600080600080600060e0888a0312156108fb57600080fd5b61090488610807565b965061091260208901610807565b9550604088013594506060880135935061092e60808901610823565b925060a0880135915060c0880135905092959891949750929550565b60006020828403121561095c57600080fd5b61096582610807565b9392505050565b6020808252601390820152722ab730baba3437b934bd32b21039b2b73232b960691b604082015260600190565b602080825260159082015274496e76616c696420746f6b656e206164647265737360581b604082015260600190565b6000602082840312156109da57600080fd5b5051919050565b6000825160005b81811015610a0257602081860181015185830152016109e8565b506000920191825250919050565b600060208284031215610a2257600080fd5b8151801515811461096557600080fdfea264697066735822122016ae372706a3f234239aa50fcaa22facaa67693a011ea9e6b996e337f634379464736f6c63430008140033

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.