ETH Price: $3,174.86 (-8.25%)

Contract

0x06d94665f02322781303224120326167483F5BD2

Overview

ETH Balance

0 ETH

ETH Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x608060401248583462023-08-25 14:55:41334 days ago1692975341IN
 Create: TransferApprover
0 ETH0.000456710.1

Parent Transaction Hash Block From To
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TransferApprover

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 5 : TransferApprover.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;

// ====================================================================
// ======================= Transfer Approver ======================
// ====================================================================

import "./ITransferApprover.sol";
import "./IWhitelist.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

/**
 * @title Transfer Approver
 * @dev Allows accounts to be blacklisted by admin role
 */
contract TransferApprover is Ownable, ITransferApprover {
    IWhitelist private whitelist;

    enum Validation {
        ONLY_VALID,
        VALID_OR_NEW
    }

    Validation public validationType;
    uint256 public timeDelay;

    event SetValidationType(Validation _type);
    event SetTimeDelay(uint256 indexed _delay);
    event UnBlacklisted(address indexed _account);

    /* ========== CONSTRUCTOR ========== */

    constructor(address _whitelist) {
        whitelist = IWhitelist(_whitelist);
        validationType = Validation.ONLY_VALID;
    }

    /**
     * @notice Returns token transferability
     * @param _from sender address
     * @param _to beneficiary address
     * @return (bool) true - allowance, false - denial
     */
    function checkTransfer(
        address _from,
        address _to,
        uint256
    ) external view override returns (bool) {
        if (_from == address(0) || _to == address(0)) return true;

        return (isValid(_from) && isValid(_to)) ? true : false;
    }

    /**
     * @dev Checks if account is valid
     * @param _account The address to check
     */
    function isValid(address _account) public view returns (bool) {
        (IWhitelist.Status status, uint256 createdDt) = whitelist.getUser(
            _account
        );

        if (createdDt == 0) return false; // Non-WhiteList User

        if (status == IWhitelist.Status.VALID) {
            return true;
        } else if (
            status == IWhitelist.Status.NEW &&
            validationType == Validation.VALID_OR_NEW
        ) {
            return
                timeDelay == 0 || (block.timestamp - createdDt > timeDelay)
                    ? true
                    : false;
        } else {
            return false;
        }
    }

    /**
     * @dev Set time delay
     * @param _delay new time delay
     */
    function setTimeDelay(uint256 _delay) external onlyOwner {
        timeDelay = _delay;

        emit SetTimeDelay(_delay);
    }

    /**
     * @dev Set validation method
     * @param _method new validation method
     */
    function setValidationType(Validation _method) external onlyOwner {
        validationType = _method;

        emit SetValidationType(_method);
    }
}

File 2 of 5 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @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 Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling 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);
    }
}

File 3 of 5 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @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 Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 4 of 5 : ITransferApprover.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;

interface ITransferApprover {
    function checkTransfer(
        address _from,
        address _to,
        uint256 _amount
    ) external view returns (bool);
}

File 5 of 5 : IWhitelist.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;

interface IWhitelist {
    enum Status {
        INVALID,
        NEW,
        VALID
    }

    function getUser(address _account) external view returns (Status, uint256);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_whitelist","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"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":"uint256","name":"_delay","type":"uint256"}],"name":"SetTimeDelay","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"enum TransferApprover.Validation","name":"_type","type":"uint8"}],"name":"SetValidationType","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_account","type":"address"}],"name":"UnBlacklisted","type":"event"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"checkTransfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"isValid","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","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":"uint256","name":"_delay","type":"uint256"}],"name":"setTimeDelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum TransferApprover.Validation","name":"_method","type":"uint8"}],"name":"setValidationType","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"timeDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"validationType","outputs":[{"internalType":"enum TransferApprover.Validation","name":"","type":"uint8"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b5060405161073a38038061073a83398101604081905261002f916100ad565b6100383361005d565b600180546001600160a81b0319166001600160a01b03929092169190911790556100dd565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100bf57600080fd5b81516001600160a01b03811681146100d657600080fd5b9392505050565b61064e806100ec6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c80638b1b925f116100665780638b1b925f146100f25780638da5cb5b14610115578063c9dec36114610130578063cc1dd94f14610147578063f2fde38b1461015a57600080fd5b806339af6ba9146100985780634494563b146100ad57806358ce89ed146100c0578063715018a6146100ea575b600080fd5b6100ab6100a63660046104d4565b61016d565b005b6100ab6100bb3660046104ed565b6101a8565b6001546100d490600160a01b900460ff1681565b6040516100e19190610524565b60405180910390f35b6100ab610213565b610105610100366004610568565b610227565b60405190151581526020016100e1565b6000546040516001600160a01b0390911681526020016100e1565b61013960025481565b6040519081526020016100e1565b610105610155366004610583565b61034f565b6100ab610168366004610568565b6103ac565b61017561042a565b600281905560405181907f686c8e2718d18513f6db902673788613b463cd8664d66d21093ec01147afd69090600090a250565b6101b061042a565b6001805482919060ff60a01b1916600160a01b83838111156101d4576101d461050e565b02179055507fa158b4e3dbc9101af8f1ed0f79574ea5f14f82fa4cfb8a1d5ef8102b7e9fc5af816040516102089190610524565b60405180910390a150565b61021b61042a565b6102256000610484565b565b600154604051636f77926b60e01b81526001600160a01b0383811660048301526000928392839290911690636f77926b906024016040805180830381865afa158015610277573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061029b91906105bf565b91509150806000036102b1575060009392505050565b60028260028111156102c5576102c561050e565b036102d4575060019392505050565b60018260028111156102e8576102e861050e565b14801561031157506001808054600160a01b900460ff169081111561030f5761030f61050e565b145b1561034557600254158061032f575060025461032d82426105f1565b115b61033a57600061033d565b60015b949350505050565b5060009392505050565b60006001600160a01b038416158061036e57506001600160a01b038316155b1561037b575060016103a5565b61038484610227565b8015610394575061039483610227565b61039f5760006103a2565b60015b90505b9392505050565b6103b461042a565b6001600160a01b03811661041e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61042781610484565b50565b6000546001600160a01b031633146102255760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610415565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156104e657600080fd5b5035919050565b6000602082840312156104ff57600080fd5b8135600281106103a557600080fd5b634e487b7160e01b600052602160045260246000fd5b602081016002831061054657634e487b7160e01b600052602160045260246000fd5b91905290565b80356001600160a01b038116811461056357600080fd5b919050565b60006020828403121561057a57600080fd5b6103a58261054c565b60008060006060848603121561059857600080fd5b6105a18461054c565b92506105af6020850161054c565b9150604084013590509250925092565b600080604083850312156105d257600080fd5b8251600381106105e157600080fd5b6020939093015192949293505050565b8181038181111561061257634e487b7160e01b600052601160045260246000fd5b9291505056fea2646970667358221220d883b9ffd977e332c7bc908d8c1c61846b474fabfbc565e3360514cb1ce6d63664736f6c63430008130033000000000000000000000000fb66e1922675c8cc53f7da7143da7d4172e0a9f6

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100935760003560e01c80638b1b925f116100665780638b1b925f146100f25780638da5cb5b14610115578063c9dec36114610130578063cc1dd94f14610147578063f2fde38b1461015a57600080fd5b806339af6ba9146100985780634494563b146100ad57806358ce89ed146100c0578063715018a6146100ea575b600080fd5b6100ab6100a63660046104d4565b61016d565b005b6100ab6100bb3660046104ed565b6101a8565b6001546100d490600160a01b900460ff1681565b6040516100e19190610524565b60405180910390f35b6100ab610213565b610105610100366004610568565b610227565b60405190151581526020016100e1565b6000546040516001600160a01b0390911681526020016100e1565b61013960025481565b6040519081526020016100e1565b610105610155366004610583565b61034f565b6100ab610168366004610568565b6103ac565b61017561042a565b600281905560405181907f686c8e2718d18513f6db902673788613b463cd8664d66d21093ec01147afd69090600090a250565b6101b061042a565b6001805482919060ff60a01b1916600160a01b83838111156101d4576101d461050e565b02179055507fa158b4e3dbc9101af8f1ed0f79574ea5f14f82fa4cfb8a1d5ef8102b7e9fc5af816040516102089190610524565b60405180910390a150565b61021b61042a565b6102256000610484565b565b600154604051636f77926b60e01b81526001600160a01b0383811660048301526000928392839290911690636f77926b906024016040805180830381865afa158015610277573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061029b91906105bf565b91509150806000036102b1575060009392505050565b60028260028111156102c5576102c561050e565b036102d4575060019392505050565b60018260028111156102e8576102e861050e565b14801561031157506001808054600160a01b900460ff169081111561030f5761030f61050e565b145b1561034557600254158061032f575060025461032d82426105f1565b115b61033a57600061033d565b60015b949350505050565b5060009392505050565b60006001600160a01b038416158061036e57506001600160a01b038316155b1561037b575060016103a5565b61038484610227565b8015610394575061039483610227565b61039f5760006103a2565b60015b90505b9392505050565b6103b461042a565b6001600160a01b03811661041e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61042781610484565b50565b6000546001600160a01b031633146102255760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610415565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156104e657600080fd5b5035919050565b6000602082840312156104ff57600080fd5b8135600281106103a557600080fd5b634e487b7160e01b600052602160045260246000fd5b602081016002831061054657634e487b7160e01b600052602160045260246000fd5b91905290565b80356001600160a01b038116811461056357600080fd5b919050565b60006020828403121561057a57600080fd5b6103a58261054c565b60008060006060848603121561059857600080fd5b6105a18461054c565b92506105af6020850161054c565b9150604084013590509250925092565b600080604083850312156105d257600080fd5b8251600381106105e157600080fd5b6020939093015192949293505050565b8181038181111561061257634e487b7160e01b600052601160045260246000fd5b9291505056fea2646970667358221220d883b9ffd977e332c7bc908d8c1c61846b474fabfbc565e3360514cb1ce6d63664736f6c63430008130033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000fb66e1922675c8cc53f7da7143da7d4172e0a9f6

-----Decoded View---------------
Arg [0] : _whitelist (address): 0xFB66e1922675c8Cc53F7Da7143DA7d4172E0A9f6

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000fb66e1922675c8cc53f7da7143da7d4172e0a9f6


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
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.