MATIC Price: $0.612676 (+1.97%)
Gas: 31 GWei
 
Transaction Hash
Method
Block
From
To
Value
0xb80c2f09577120232024-06-03 7:40:4212 days ago1717400442IN
OKX DEX: Token Approve
0 MATIC0.0008486130.00000043
0xb80c2f09577116542024-06-03 7:27:0412 days ago1717399624IN
OKX DEX: Token Approve
0 MATIC0.0008496930.00000005
0xb80c2f09577115692024-06-03 7:24:0412 days ago1717399444IN
OKX DEX: Token Approve
0 MATIC0.0008475330.00000005
0xb80c2f09577114572024-06-03 7:19:3412 days ago1717399174IN
OKX DEX: Token Approve
0 MATIC0.0008475330.00000003
0xb80c2f09573306322024-05-24 9:47:4622 days ago1716544066IN
OKX DEX: Token Approve
0 MATIC0.0010031435.50818874
Approve561714592024-04-23 18:26:3253 days ago1713896792IN
OKX DEX: Token Approve
0 MATIC0.0014078964.5735
Approve561709802024-04-23 18:07:4253 days ago1713895662IN
OKX DEX: Token Approve
0 MATIC0.0017681681.0975
Approve561708822024-04-23 18:03:4253 days ago1713895422IN
OKX DEX: Token Approve
0 MATIC0.0019418289.0625
Approve549276232024-03-21 21:02:3886 days ago1711054958IN
OKX DEX: Token Approve
0 MATIC0.00317673143.64617127
Approve527648822024-01-26 8:30:32141 days ago1706257832IN
OKX DEX: Token Approve
0 MATIC0.0039177179.9835
Approve523354822024-01-15 2:38:24153 days ago1705286304IN
OKX DEX: Token Approve
0 MATIC0.0008520639.145
Transfer520048362024-01-06 11:28:54161 days ago1704540534IN
OKX DEX: Token Approve
0.0918302 MATIC0.0015659874.57078811
Transfer520000572024-01-06 8:28:58161 days ago1704529738IN
OKX DEX: Token Approve
0.11950606 MATIC0.0019301291.91092828
Transfer520000102024-01-06 8:27:18161 days ago1704529638IN
OKX DEX: Token Approve
0.12139921 MATIC0.0019062190.77231139
Transfer519998922024-01-06 8:23:08161 days ago1704529388IN
OKX DEX: Token Approve
0.12336774 MATIC0.0017065881.26573708
Transfer519656902024-01-05 11:21:24162 days ago1704453684IN
OKX DEX: Token Approve
0.98241218 MATIC0.00245152116.73946992
Transfer519640572024-01-05 10:20:10162 days ago1704450010IN
OKX DEX: Token Approve
0.85999532 MATIC0.00270853128.97802982
Transfer514147752023-12-22 7:51:02176 days ago1703231462IN
OKX DEX: Token Approve
0.05509511 MATIC0.01185269564.41419217
Transfer Ownersh...513397942023-12-20 7:16:27178 days ago1703056587IN
OKX DEX: Token Approve
0 MATIC0.0071525250
Transfer511899092023-12-16 8:18:13182 days ago1702714693IN
OKX DEX: Token Approve
5 MATIC0.01512812720.38705014
Transfer511897612023-12-16 8:12:59182 days ago1702714379IN
OKX DEX: Token Approve
5 MATIC0.01234083587.65871956
Transfer511895252023-12-16 8:04:37182 days ago1702713877IN
OKX DEX: Token Approve
5 MATIC0.01157412551.14864454
Transfer511892332023-12-16 7:52:41182 days ago1702713161IN
OKX DEX: Token Approve
5 MATIC0.00718489342.13800782
Transfer511891902023-12-16 7:51:09182 days ago1702713069IN
OKX DEX: Token Approve
5 MATIC0.00986281469.65765758
Approve507273652023-12-04 10:16:14194 days ago1701684974IN
OKX DEX: Token Approve
0 MATIC0.01048497474.1115
View all transactions

Parent Transaction Hash Block From To Value
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TokenApprove

Compiler Version
v0.8.6+commit.11564f7e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity)

/**
 *Submitted for verification at polygonscan.com on 2023-06-26
*/

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)

// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} modifier, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
        __Context_init_unchained();
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
    uint256[50] private __gap;
}

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Context_init_unchained();
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
    uint256[49] private __gap;
}

interface IERC20 {
    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );
    event Transfer(address indexed from, address indexed to, uint256 value);

    function name() external view returns (string memory);

    function symbol() external view returns (string memory);

    function decimals() external view returns (uint8);

    function totalSupply() external view returns (uint256);

    function balanceOf(address owner) external view returns (uint256);

    function allowance(address owner, address spender)
        external
        view
        returns (uint256);

    function approve(address spender, uint256 value) external returns (bool);

    function transfer(address to, uint256 value) external returns (bool);

    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external returns (bool);
}

library SafeMath {
    uint256 constant WAD = 10**18;
    uint256 constant RAY = 10**27;

    function wad() public pure returns (uint256) {
        return WAD;
    }

    function ray() public pure returns (uint256) {
        return RAY;
    }

    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }

    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a <= b ? a : b;
    }

    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

    function sqrt(uint256 a) internal pure returns (uint256 b) {
        if (a > 3) {
            b = a;
            uint256 x = a / 2 + 1;
            while (x < b) {
                b = x;
                x = (a / x + x) / 2;
            }
        } else if (a != 0) {
            b = 1;
        }
    }

    function wmul(uint256 a, uint256 b) internal pure returns (uint256) {
        return mul(a, b) / WAD;
    }

    function wmulRound(uint256 a, uint256 b) internal pure returns (uint256) {
        return add(mul(a, b), WAD / 2) / WAD;
    }

    function rmul(uint256 a, uint256 b) internal pure returns (uint256) {
        return mul(a, b) / RAY;
    }

    function rmulRound(uint256 a, uint256 b) internal pure returns (uint256) {
        return add(mul(a, b), RAY / 2) / RAY;
    }

    function wdiv(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(mul(a, WAD), b);
    }

    function wdivRound(uint256 a, uint256 b) internal pure returns (uint256) {
        return add(mul(a, WAD), b / 2) / b;
    }

    function rdiv(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(mul(a, RAY), b);
    }

    function rdivRound(uint256 a, uint256 b) internal pure returns (uint256) {
        return add(mul(a, RAY), b / 2) / b;
    }

    function wpow(uint256 x, uint256 n) internal pure returns (uint256) {
        uint256 result = WAD;
        while (n > 0) {
            if (n % 2 != 0) {
                result = wmul(result, x);
            }
            x = wmul(x, x);
            n /= 2;
        }
        return result;
    }

    function rpow(uint256 x, uint256 n) internal pure returns (uint256) {
        uint256 result = RAY;
        while (n > 0) {
            if (n % 2 != 0) {
                result = rmul(result, x);
            }
            x = rmul(x, x);
            n /= 2;
        }
        return result;
    }

    function divCeil(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 quotient = div(a, b);
        uint256 remainder = a - quotient * b;
        if (remainder > 0) {
            return quotient + 1;
        } else {
            return quotient;
        }
    }
}

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            codehash := extcodehash(account)
        }
        return (codehash != accountHash && codehash != 0x0);
    }

    /**
     * @dev Converts an `address` into `address payable`. Note that this is
     * simply a type cast: the actual underlying value is not changed.
     *
     * _Available since v2.4.0._
     */
    function toPayable(address account)
        internal
        pure
        returns (address payable)
    {
        return payable(account);
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     *
     * _Available since v2.4.0._
     */
    function sendValue(address recipient, uint256 amount) internal {
        require(
            address(this).balance >= amount,
            "Address: insufficient balance"
        );

        // solhint-disable-next-line avoid-call-value
        (bool success, ) = recipient.call{value: amount}("");
        require(
            success,
            "Address: unable to send value, recipient may have reverted"
        );
    }
}

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 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 ERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using SafeMath for uint256;
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        callOptionalReturn(
            token,
            abi.encodeWithSelector(token.transfer.selector, to, value)
        );
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        callOptionalReturn(
            token,
            abi.encodeWithSelector(token.transferFrom.selector, from, to, value)
        );
    }

    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        // solhint-disable-next-line max-line-length
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        callOptionalReturn(
            token,
            abi.encodeWithSelector(token.approve.selector, spender, value)
        );
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender).add(
            value
        );
        callOptionalReturn(
            token,
            abi.encodeWithSelector(
                token.approve.selector,
                spender,
                newAllowance
            )
        );
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(
            value,
            "SafeERC20: decreased allowance below zero"
        );
        callOptionalReturn(
            token,
            abi.encodeWithSelector(
                token.approve.selector,
                spender,
                newAllowance
            )
        );
    }

    /**
     * @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).
     */
    function callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves.

        // A Solidity high level call has three parts:
        //  1. The target address is checked to verify it contains contract code
        //  2. The call itself is made, and success asserted
        //  3. The return value is decoded, which in turn checks the size of the returned data.
        // solhint-disable-next-line max-line-length
        require(address(token).isContract(), "SafeERC20: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = address(token).call(data);
        require(success, "SafeERC20: low-level call failed");

        if (returndata.length > 0) {
            // Return data is optional
            // solhint-disable-next-line max-line-length
            require(
                abi.decode(returndata, (bool)),
                "SafeERC20: ERC20 operation did not succeed"
            );
        }
    }
}

/// @title Handle authorizations in dex platform
/// @notice Explain to an end user what this does
/// @dev Explain to a developer any extra details
contract TokenApprove is OwnableUpgradeable {
  using SafeERC20 for IERC20;

  address public tokenApproveProxy;

  function initialize(address _tokenApproveProxy) public initializer {
    __Ownable_init();
    tokenApproveProxy = _tokenApproveProxy;
  }

  //-------------------------------
  //------- Events ----------------
  //-------------------------------

  event ProxyUpdate(address indexed oldProxy, address indexed newProxy);

  //-------------------------------
  //------- Modifier --------------
  //-------------------------------

  //--------------------------------
  //------- Internal Functions -----
  //--------------------------------

  //---------------------------------
  //------- Admin functions ---------
  //---------------------------------

  function setApproveProxy(address _newTokenApproveProxy) external onlyOwner {
    emit ProxyUpdate(tokenApproveProxy, _newTokenApproveProxy);
    tokenApproveProxy = _newTokenApproveProxy;
  }

  //---------------------------------
  //-------  Users Functions --------
  //---------------------------------

  function claimTokens(
    address _token,
    address _who,
    address _dest,
    uint256 _amount
  ) external {
    require(msg.sender == tokenApproveProxy, "TokenApprove: Access restricted");
    if (_amount > 0) {
      IERC20(_token).safeTransferFrom(_who, _dest, _amount);
    }
  }
}

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldProxy","type":"address"},{"indexed":true,"internalType":"address","name":"newProxy","type":"address"}],"name":"ProxyUpdate","type":"event"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_who","type":"address"},{"internalType":"address","name":"_dest","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"claimTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenApproveProxy","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newTokenApproveProxy","type":"address"}],"name":"setApproveProxy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tokenApproveProxy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50610865806100206000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638da5cb5b1161005b5780638da5cb5b146100ce578063aad0ae5b146100df578063c4d66de8146100f2578063f2fde38b1461010557600080fd5b80630a5ea4661461008257806312ec8dcc14610097578063715018a6146100c6575b600080fd5b610095610090366004610707565b610118565b005b6065546100aa906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b610095610198565b6033546001600160a01b03166100aa565b6100956100ed3660046106e5565b6101ce565b6100956101003660046106e5565b610254565b6100956101133660046106e5565b610331565b6065546001600160a01b031633146101775760405162461bcd60e51b815260206004820152601f60248201527f546f6b656e417070726f76653a2041636365737320726573747269637465640060448201526064015b60405180910390fd5b8015610192576101926001600160a01b0385168484846103cc565b50505050565b6033546001600160a01b031633146101c25760405162461bcd60e51b815260040161016e906107af565b6101cc6000610426565b565b6033546001600160a01b031633146101f85760405162461bcd60e51b815260040161016e906107af565b6065546040516001600160a01b038084169216907ff213750e75b7d8975215501c91778a99d0e1d7e30453ea61619aba02b5e0d17d90600090a3606580546001600160a01b0319166001600160a01b0392909216919091179055565b600054610100900460ff1661026f5760005460ff1615610273565b303b155b6102d65760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161016e565b600054610100900460ff161580156102f8576000805461ffff19166101011790555b610300610478565b606580546001600160a01b0319166001600160a01b038416179055801561032d576000805461ff00191690555b5050565b6033546001600160a01b0316331461035b5760405162461bcd60e51b815260040161016e906107af565b6001600160a01b0381166103c05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161016e565b6103c981610426565b50565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526101929085906104af565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff1661049f5760405162461bcd60e51b815260040161016e906107e4565b6104a7610636565b6101cc61065d565b6104c1826001600160a01b031661068d565b61050d5760405162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015260640161016e565b600080836001600160a01b0316836040516105289190610774565b6000604051808303816000865af19150503d8060008114610565576040519150601f19603f3d011682016040523d82523d6000602084013e61056a565b606091505b5091509150816105bc5760405162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015260640161016e565b80511561019257808060200190518101906105d79190610752565b6101925760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161016e565b600054610100900460ff166101cc5760405162461bcd60e51b815260040161016e906107e4565b600054610100900460ff166106845760405162461bcd60e51b815260040161016e906107e4565b6101cc33610426565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906106c157508115155b949350505050565b80356001600160a01b03811681146106e057600080fd5b919050565b6000602082840312156106f757600080fd5b610700826106c9565b9392505050565b6000806000806080858703121561071d57600080fd5b610726856106c9565b9350610734602086016106c9565b9250610742604086016106c9565b9396929550929360600135925050565b60006020828403121561076457600080fd5b8151801515811461070057600080fd5b6000825160005b81811015610795576020818601810151858301520161077b565b818111156107a4576000828501525b509190910192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea2646970667358221220736658f3366fff7588b4f484e692c755406f0137d38e816d0577ecc40cf8a5f664736f6c63430008060033

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80638da5cb5b1161005b5780638da5cb5b146100ce578063aad0ae5b146100df578063c4d66de8146100f2578063f2fde38b1461010557600080fd5b80630a5ea4661461008257806312ec8dcc14610097578063715018a6146100c6575b600080fd5b610095610090366004610707565b610118565b005b6065546100aa906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b610095610198565b6033546001600160a01b03166100aa565b6100956100ed3660046106e5565b6101ce565b6100956101003660046106e5565b610254565b6100956101133660046106e5565b610331565b6065546001600160a01b031633146101775760405162461bcd60e51b815260206004820152601f60248201527f546f6b656e417070726f76653a2041636365737320726573747269637465640060448201526064015b60405180910390fd5b8015610192576101926001600160a01b0385168484846103cc565b50505050565b6033546001600160a01b031633146101c25760405162461bcd60e51b815260040161016e906107af565b6101cc6000610426565b565b6033546001600160a01b031633146101f85760405162461bcd60e51b815260040161016e906107af565b6065546040516001600160a01b038084169216907ff213750e75b7d8975215501c91778a99d0e1d7e30453ea61619aba02b5e0d17d90600090a3606580546001600160a01b0319166001600160a01b0392909216919091179055565b600054610100900460ff1661026f5760005460ff1615610273565b303b155b6102d65760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161016e565b600054610100900460ff161580156102f8576000805461ffff19166101011790555b610300610478565b606580546001600160a01b0319166001600160a01b038416179055801561032d576000805461ff00191690555b5050565b6033546001600160a01b0316331461035b5760405162461bcd60e51b815260040161016e906107af565b6001600160a01b0381166103c05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161016e565b6103c981610426565b50565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526101929085906104af565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff1661049f5760405162461bcd60e51b815260040161016e906107e4565b6104a7610636565b6101cc61065d565b6104c1826001600160a01b031661068d565b61050d5760405162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015260640161016e565b600080836001600160a01b0316836040516105289190610774565b6000604051808303816000865af19150503d8060008114610565576040519150601f19603f3d011682016040523d82523d6000602084013e61056a565b606091505b5091509150816105bc5760405162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015260640161016e565b80511561019257808060200190518101906105d79190610752565b6101925760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161016e565b600054610100900460ff166101cc5760405162461bcd60e51b815260040161016e906107e4565b600054610100900460ff166106845760405162461bcd60e51b815260040161016e906107e4565b6101cc33610426565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906106c157508115155b949350505050565b80356001600160a01b03811681146106e057600080fd5b919050565b6000602082840312156106f757600080fd5b610700826106c9565b9392505050565b6000806000806080858703121561071d57600080fd5b610726856106c9565b9350610734602086016106c9565b9250610742604086016106c9565b9396929550929360600135925050565b60006020828403121561076457600080fd5b8151801515811461070057600080fd5b6000825160005b81811015610795576020818601810151858301520161077b565b818111156107a4576000828501525b509190910192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea2646970667358221220736658f3366fff7588b4f484e692c755406f0137d38e816d0577ecc40cf8a5f664736f6c63430008060033

Deployed Bytecode Sourcemap

27262:1425:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;28386:298;;;;;;:::i;:::-;;:::i;:::-;;27344:32;;;;;-1:-1:-1;;;;;27344:32:0;;;;;;-1:-1:-1;;;;;1668:32:1;;;1650:51;;1638:2;1623:18;27344:32:0;;;;;;;13182:103;;;:::i;12531:87::-;12604:6;;-1:-1:-1;;;;;12604:6:0;12531:87;;28067:194;;;;;;:::i;:::-;;:::i;27383:141::-;;;;;;:::i;:::-;;:::i;13440:201::-;;;;;;:::i;:::-;;:::i;28386:298::-;28532:17;;-1:-1:-1;;;;;28532:17:0;28518:10;:31;28510:75;;;;-1:-1:-1;;;28510:75:0;;3062:2:1;28510:75:0;;;3044:21:1;3101:2;3081:18;;;3074:30;3140:33;3120:18;;;3113:61;3191:18;;28510:75:0;;;;;;;;;28596:11;;28592:87;;28618:53;-1:-1:-1;;;;;28618:31:0;;28650:4;28656:5;28663:7;28618:31;:53::i;:::-;28386:298;;;;:::o;13182:103::-;12604:6;;-1:-1:-1;;;;;12604:6:0;11219:10;12751:23;12743:68;;;;-1:-1:-1;;;12743:68:0;;;;;;;:::i;:::-;13247:30:::1;13274:1;13247:18;:30::i;:::-;13182:103::o:0;28067:194::-;12604:6;;-1:-1:-1;;;;;12604:6:0;11219:10;12751:23;12743:68;;;;-1:-1:-1;;;12743:68:0;;;;;;;:::i;:::-;28166:17:::1;::::0;28154:53:::1;::::0;-1:-1:-1;;;;;28154:53:0;;::::1;::::0;28166:17:::1;::::0;28154:53:::1;::::0;28166:17:::1;::::0;28154:53:::1;28214:17;:41:::0;;-1:-1:-1;;;;;;28214:41:0::1;-1:-1:-1::0;;;;;28214:41:0;;;::::1;::::0;;;::::1;::::0;;28067:194::o;27383:141::-;9566:13;;;;;;;:48;;9602:12;;;;9601:13;9566:48;;;10369:4;1312:20;1360:8;9582:16;9558:107;;;;-1:-1:-1;;;9558:107:0;;3422:2:1;9558:107:0;;;3404:21:1;3461:2;3441:18;;;3434:30;3500:34;3480:18;;;3473:62;-1:-1:-1;;;3551:18:1;;;3544:44;3605:19;;9558:107:0;3394:236:1;9558:107:0;9678:19;9701:13;;;;;;9700:14;9725:101;;;;9760:13;:20;;-1:-1:-1;;9795:19:0;;;;;9725:101;27457:16:::1;:14;:16::i;:::-;27480:17;:38:::0;;-1:-1:-1;;;;;;27480:38:0::1;-1:-1:-1::0;;;;;27480:38:0;::::1;;::::0;;9852:68;;;;9903:5;9887:21;;-1:-1:-1;;9887:21:0;;;9852:68;9273:654;27383:141;:::o;13440:201::-;12604:6;;-1:-1:-1;;;;;12604:6:0;11219:10;12751:23;12743:68;;;;-1:-1:-1;;;12743:68:0;;;;;;;:::i;:::-;-1:-1:-1;;;;;13529:22:0;::::1;13521:73;;;::::0;-1:-1:-1;;;13521:73:0;;2294:2:1;13521:73:0::1;::::0;::::1;2276:21:1::0;2333:2;2313:18;;;2306:30;2372:34;2352:18;;;2345:62;-1:-1:-1;;;2423:18:1;;;2416:36;2469:19;;13521:73:0::1;2266:228:1::0;13521:73:0::1;13605:28;13624:8;13605:18;:28::i;:::-;13440:201:::0;:::o;23572:284::-;23769:68;;;-1:-1:-1;;;;;1970:15:1;;;23769:68:0;;;1952:34:1;2022:15;;2002:18;;;1995:43;2054:18;;;;2047:34;;;23769:68:0;;;;;;;;;;1887:18:1;;;;23769:68:0;;;;;;;;-1:-1:-1;;;;;23769:68:0;-1:-1:-1;;;23769:68:0;;;23716:132;;23749:5;;23716:18;:132::i;13801:191::-;13894:6;;;-1:-1:-1;;;;;13911:17:0;;;-1:-1:-1;;;;;;13911:17:0;;;;;;;13944:40;;13894:6;;;13911:17;13894:6;;13944:40;;13875:16;;13944:40;13864:128;13801:191;:::o;12195:134::-;10169:13;;;;;;;10161:69;;;;-1:-1:-1;;;10161:69:0;;;;;;;:::i;:::-;12258:26:::1;:24;:26::i;:::-;12295;:24;:26::i;25927:1176::-:0;26531:27;26539:5;-1:-1:-1;;;;;26531:25:0;;:27::i;:::-;26523:71;;;;-1:-1:-1;;;26523:71:0;;5021:2:1;26523:71:0;;;5003:21:1;5060:2;5040:18;;;5033:30;5099:33;5079:18;;;5072:61;5150:18;;26523:71:0;4993:181:1;26523:71:0;26668:12;26682:23;26717:5;-1:-1:-1;;;;;26709:19:0;26729:4;26709:25;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;26667:67;;;;26753:7;26745:52;;;;-1:-1:-1;;;26745:52:0;;2701:2:1;26745:52:0;;;2683:21:1;;;2720:18;;;2713:30;2779:34;2759:18;;;2752:62;2831:18;;26745:52:0;2673:182:1;26745:52:0;26814:17;;:21;26810:286;;26987:10;26976:30;;;;;;;;;;;;:::i;:::-;26950:134;;;;-1:-1:-1;;;26950:134:0;;4610:2:1;26950:134:0;;;4592:21:1;4649:2;4629:18;;;4622:30;4688:34;4668:18;;;4661:62;-1:-1:-1;;;4739:18:1;;;4732:40;4789:19;;26950:134:0;4582:232:1;11063:70:0;10169:13;;;;;;;10161:69;;;;-1:-1:-1;;;10161:69:0;;;;;;;:::i;12337:113::-;10169:13;;;;;;;10161:69;;;;-1:-1:-1;;;10161:69:0;;;;;;;:::i;:::-;12410:32:::1;11219:10:::0;12410:18:::1;:32::i;20329:641::-:0;20389:4;20870:20;;20700:66;20919:23;;;;;;:42;;-1:-1:-1;20946:15:0;;;20919:42;20911:51;20329:641;-1:-1:-1;;;;20329:641:0:o;14:173:1:-;82:20;;-1:-1:-1;;;;;131:31:1;;121:42;;111:2;;177:1;174;167:12;111:2;63:124;;;:::o;192:186::-;251:6;304:2;292:9;283:7;279:23;275:32;272:2;;;320:1;317;310:12;272:2;343:29;362:9;343:29;:::i;:::-;333:39;262:116;-1:-1:-1;;;262:116:1:o;383:403::-;469:6;477;485;493;546:3;534:9;525:7;521:23;517:33;514:2;;;563:1;560;553:12;514:2;586:29;605:9;586:29;:::i;:::-;576:39;;634:38;668:2;657:9;653:18;634:38;:::i;:::-;624:48;;691:38;725:2;714:9;710:18;691:38;:::i;:::-;504:282;;;;-1:-1:-1;681:48:1;;776:2;761:18;748:32;;-1:-1:-1;;504:282:1:o;791:277::-;858:6;911:2;899:9;890:7;886:23;882:32;879:2;;;927:1;924;917:12;879:2;959:9;953:16;1012:5;1005:13;998:21;991:5;988:32;978:2;;1034:1;1031;1024:12;1073:426;1202:3;1240:6;1234:13;1265:1;1275:129;1289:6;1286:1;1283:13;1275:129;;;1387:4;1371:14;;;1367:25;;1361:32;1348:11;;;1341:53;1304:12;1275:129;;;1422:6;1419:1;1416:13;1413:2;;;1457:1;1448:6;1443:3;1439:16;1432:27;1413:2;-1:-1:-1;1477:16:1;;;;;1210:289;-1:-1:-1;;1210:289:1:o;3635:356::-;3837:2;3819:21;;;3856:18;;;3849:30;3915:34;3910:2;3895:18;;3888:62;3982:2;3967:18;;3809:182::o;3996:407::-;4198:2;4180:21;;;4237:2;4217:18;;;4210:30;4276:34;4271:2;4256:18;;4249:62;-1:-1:-1;;;4342:2:1;4327:18;;4320:41;4393:3;4378:19;;4170:233::o

Swarm Source

ipfs://736658f3366fff7588b4f484e692c755406f0137d38e816d0577ecc40cf8a5f6

Block Transaction Gas Used Reward
view all blocks produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.