Forkchoice Ethereum Mainnet

Address Contract Partially Verified

Address 0xcF580C8c3dcc1f1E3f30704d65ec265bD2DFb490
Balance 0 ETH
Nonce 1
Code Size 4895 bytes
Indexed Transactions 0 (1 on-chain, 0.6% indexed)
External Etherscan · Sourcify

Contract Bytecode

4895 bytes
0x6080604052600436106101025760003560e01c806393d4457a11610095578063ce7c2ac211610064578063ce7c2ac214610307578063d0d41fe114610342578063efca2eed14610362578063f2fde38b14610378578063fc0c546a1461039857600080fd5b806393d4457a146102575780639838510914610297578063aeba8f3c146102b7578063c71784e4146102d757600080fd5b8063715018a6116100d1578063715018a61461016d57806377b54bad146101825780637e16c30c146101a25780638da5cb5b1461022557600080fd5b80631d96dabf1461010e5780632e75ab5014610130578063364333f414610150578063666da64f1461016557600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b5061012e610129366004611003565b6103b8565b005b34801561013c57600080fd5b5061012e61014b36600461102d565b61057d565b34801561015c57600080fd5b5061012e6105ac565b61012e610614565b34801561017957600080fd5b5061012e61079b565b34801561018e57600080fd5b5061012e61019d366004611003565b61080f565b3480156101ae57600080fd5b506101c26101bd366004611046565b610864565b60405161021c9190600060e082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a0830151151560a083015260c0830151151560c083015292915050565b60405180910390f35b34801561023157600080fd5b506001546001600160a01b03165b6040516001600160a01b03909116815260200161021c565b34801561026357600080fd5b50610287610272366004611046565b60056020526000908152604090205460ff1681565b604051901515815260200161021c565b3480156102a357600080fd5b5061012e6102b236600461102d565b6109cc565b3480156102c357600080fd5b5061012e6102d2366004611046565b6109fb565b3480156102e357600080fd5b506102876102f2366004611046565b60066020526000908152604090205460ff1681565b34801561031357600080fd5b50610334610322366004611046565b60046020526000908152604090205481565b60405190815260200161021c565b34801561034e57600080fd5b5061012e61035d366004611046565b610a47565b34801561036e57600080fd5b50610334600b5481565b34801561038457600080fd5b5061012e610393366004611046565b610a93565b3480156103a457600080fd5b5060025461023f906001600160a01b031681565b600260005414156104105760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60026000556008546001600160a01b0316331461046f5760405162461bcd60e51b815260206004820181905260248201527f52656c617965723a2063616c6c6572206973206e6f74207468652072656c61796044820152606401610407565b3360009081526005602052604090205460ff166104c55760405162461bcd60e51b81526020600482015260146024820152731059191c995cdcc81b9bdd081d995c9a599a595960621b6044820152606401610407565b6001600160a01b03821660009081526006602052604090205460ff16610574576001600160a01b0382166000908152600660205260409020805460ff19166001179055600b546105159082610b7e565b600b556001600160a01b03821660009081526003602052604081208054839290610540908490611077565b9091555050600254610574908390610561906001600160a01b031684610b93565b6002546001600160a01b03169190610c8b565b50506001600055565b6001546001600160a01b031633146105a75760405162461bcd60e51b81526004016104079061108f565b600955565b6001546001600160a01b031633146105d65760405162461bcd60e51b81526004016104079061108f565b60075460405147916001600160a01b03169082156108fc029083906000818181858888f19350505050158015610610573d6000803e3d6000fd5b5050565b600260005414156106675760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610407565b600260009081553381526005602052604090205460ff16610794576000600a546009546106949190611077565b111561076c57600a546009546106aa9190611077565b3410156106f25760405162461bcd60e51b8152602060048201526016602482015275696e73756666696369656e7420636c61696d2046656560501b6044820152606401610407565b600854600a546040516001600160a01b039092169181156108fc0291906000818181858888f1935050505015801561072e573d6000803e3d6000fd5b5060075460405147916001600160a01b03169082156108fc029083906000818181858888f19350505050158015610769573d6000803e3d6000fd5b50505b610794336001600160a01b03166000908152600560205260409020805460ff19166001179055565b6001600055565b6001546001600160a01b031633146107c55760405162461bcd60e51b81526004016104079061108f565b6001546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600180546001600160a01b0319169055565b6001546001600160a01b031633146108395760405162461bcd60e51b81526004016104079061108f565b600754610610906001600160a01b03166108538484610b93565b6001600160a01b0385169190610c8b565b6108a86040518060e0016040528060008152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b6040518060e00160405280600a546009546108c39190611077565b8152600b546020808301919091526001600160a01b03858116600081815260048085526040808320548188015283835260039095529084902054606086015260025493516370a0823160e01b815290810191909152608090930192610986929091169081906370a082319060240160206040518083038186803b15801561094957600080fd5b505afa15801561095d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098191906110c4565b610ce2565b81526001600160a01b0390931660008181526005602090815260408083205460ff9081161515838901529383526006909152908190205490911615159301929092525090565b6001546001600160a01b031633146109f65760405162461bcd60e51b81526004016104079061108f565b600a55565b6001546001600160a01b03163314610a255760405162461bcd60e51b81526004016104079061108f565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b03163314610a715760405162461bcd60e51b81526004016104079061108f565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b03163314610abd5760405162461bcd60e51b81526004016104079061108f565b6001600160a01b038116610b225760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610407565b6001546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000610b8a8284611077565b90505b92915050565b6000808390506000816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610bd457600080fd5b505afa158015610be8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0c91906110dd565b60ff169050600080600083600c5414610c7d5783600c541115610c575783600c54610c379190611100565b9250610c4483600a6111fb565b9150610c508783610d93565b9050610c80565b600c54610c649085611100565b9250610c7183600a6111fb565b9150610c508783610d9f565b50855b979650505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610cdd908490610dab565b505050565b6000808390506000816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610d2357600080fd5b505afa158015610d37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5b91906110dd565b60ff169050600080600083600c5414610c7d5783600c541115610d865783600c54610c649190611100565b600c54610c379085611100565b6000610b8a8284611207565b6000610b8a8284611229565b6000610e00826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610e7d9092919063ffffffff16565b805190915015610cdd5780806020019051810190610e1e9190611248565b610cdd5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610407565b6060610e8c8484600085610e96565b90505b9392505050565b606082471015610ef75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610407565b843b610f455760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610407565b600080866001600160a01b03168587604051610f61919061129a565b60006040518083038185875af1925050503d8060008114610f9e576040519150601f19603f3d011682016040523d82523d6000602084013e610fa3565b606091505b5091509150610c8082828660608315610fbd575081610e8f565b825115610fcd5782518084602001fd5b8160405162461bcd60e51b815260040161040791906112b6565b80356001600160a01b0381168114610ffe57600080fd5b919050565b6000806040838503121561101657600080fd5b61101f83610fe7565b946020939093013593505050565b60006020828403121561103f57600080fd5b5035919050565b60006020828403121561105857600080fd5b610b8a82610fe7565b634e487b7160e01b600052601160045260246000fd5b6000821982111561108a5761108a611061565b500190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000602082840312156110d657600080fd5b5051919050565b6000602082840312156110ef57600080fd5b815160ff81168114610e8f57600080fd5b60008282101561111257611112611061565b500390565b600181815b8085111561115257816000190482111561113857611138611061565b8085161561114557918102915b93841c939080029061111c565b509250929050565b60008261116957506001610b8d565b8161117657506000610b8d565b816001811461118c5760028114611196576111b2565b6001915050610b8d565b60ff8411156111a7576111a7611061565b50506001821b610b8d565b5060208310610133831016604e8410600b84101617156111d5575081810a610b8d565b6111df8383611117565b80600019048211156111f3576111f3611061565b029392505050565b6000610b8a838361115a565b60008261122457634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561124357611243611061565b500290565b60006020828403121561125a57600080fd5b81518015158114610e8f57600080fd5b60005b8381101561128557818101518382015260200161126d565b83811115611294576000848401525b50505050565b600082516112ac81846020870161126a565b9190910192915050565b60208152600082518060208401526112d581604085016020870161126a565b601f01601f1916919091016040019291505056fea2646970667358221220d9dd1738456277702c19ad55a0b24bd3fe049ace1221e8704f47fa3b37f288e064736f6c63430008090033

Verified Source Code Partial Match

Compiler: v0.8.9+commit.e5eed63a EVM: london Optimization: Yes (200 runs)
BTMDashboard.sol 731 lines
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/**
 * SAFEMATH LIBRARY
 */
library SafeMath {
    
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // 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 (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

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

    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

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

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

    /**
     * @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 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) {
        // 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 Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

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

        (bool success, bytes memory returndata) = target.delegatecall(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);
            }
        }
    }
}

/**
 * @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 IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    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));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    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'
        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) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _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. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

abstract contract Ownable {
    address private _owner;

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

    constructor () {
        address msgSender = msg.sender;
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

    function owner() public view returns (address) {
        return _owner;
    }

    modifier onlyOwner() {
        require(_owner == msg.sender, "Ownable: caller is not the owner");
        _;
    }

    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

contract BTMDashboard is ReentrancyGuard,Ownable {
    using SafeMath for uint256;
	using SafeERC20 for IERC20;

	IERC20 public token;

    struct AllInfo {
        uint256 claimFee;
        uint256 totalDistributed;
        uint256 userShare;
        uint256 totalClaimed;
        uint256 balance;
        bool verifiedAddress;
        bool distributedAddress;
    }
    	
    mapping (address => uint256) shareholderClaims;
    mapping (address => uint256) public shares;
    mapping (address => bool) public verifiedAddress;
    mapping (address => bool) public distributedAddress;
	
    address private devAddress;
    address private relayAddress;
    uint256 private claimFee;
    uint256 private relayFee = 1000000000000000;
    uint256 public totalDistributed;
	
	uint256 private _weiDecimal = 18;
	
	receive() external payable {}
	
	modifier onlyRelay() {
        require(relayAddress == msg.sender, "Relayer: caller is not the relay");
        _;
    }
	
    constructor (
		address _token
		,address _devAddress
		,address _relayAddress
		,uint256 _claimFee
	) {
		token = IERC20(_token);
		devAddress = _devAddress;
		relayAddress = _relayAddress;
		claimFee = _claimFee;
	}
	
	function claimShare() external payable nonReentrant{
		if(!verifiedAddress[msg.sender]){
			if((claimFee + relayFee) > 0){
				require(msg.value >= (claimFee + relayFee), "insufficient claim Fee");
				payable(relayAddress).transfer(relayFee);
				
				uint256 amount = address(this).balance;
				payable(devAddress).transfer(amount);
			}
			
			verifyAddress(msg.sender);
		}
    }
	
	function verifyAddress(address user) internal {
		verifiedAddress[user] = true;
	}
	
    function distributeShare(address shareholder, uint256 amount) external nonReentrant onlyRelay {
        require(verifiedAddress[msg.sender], "Address not verified");
		if(!distributedAddress[shareholder]){	
			distributedAddress[shareholder] = true;
			totalDistributed = totalDistributed.add(amount);
			shareholderClaims[shareholder] += amount;
			token.safeTransfer(shareholder, _getTokenAmount(address(token),amount));
		}
    }

    function getAllInfo(address user) public view returns (AllInfo memory) {
        return AllInfo(
            (claimFee + relayFee),
            totalDistributed,
            shares[user],
            shareholderClaims[user],
			_getReverseTokenAmount(address(token),token.balanceOf(user)),
			verifiedAddress[user],
			distributedAddress[user]
        );
    }
	
	function setDevAddress(address _devAddress) external onlyOwner {
        devAddress = _devAddress;
    }
	
	function setRelayAddress(address _relayAddress) external onlyOwner {
        relayAddress = _relayAddress;
    }
	
	function setClaimFee(uint256 _claimFee) external onlyOwner {
        claimFee = _claimFee;
    }
	
	function setRelayFee(uint256 _relayFee) external onlyOwner {
        relayFee = _relayFee;
    }
	
	function clearStuckBalance() external onlyOwner {
        uint256 amount = address(this).balance;
        payable(devAddress).transfer(amount);
    }
	
	function clearStuckToken(address TokenAddress, uint256 amount) external onlyOwner {
        IERC20(TokenAddress).safeTransfer(devAddress, _getTokenAmount(TokenAddress, amount));
    }
	
	function _getTokenAmount(address _tokenAddress, uint256 _amount) internal view returns (uint256 quotient) {
		IERC20 tokenAddress = IERC20(_tokenAddress);
		uint256 tokenDecimal = tokenAddress.decimals();
		uint256 decimalDiff = 0;
		uint256 decimalDiffConverter = 0;
		uint256 amount = 0;
			
		if(_weiDecimal != tokenDecimal){
			if(_weiDecimal > tokenDecimal){
				decimalDiff = _weiDecimal - tokenDecimal;
				decimalDiffConverter = 10**decimalDiff;
				amount = _amount.div(decimalDiffConverter);
			} else {
				decimalDiff = tokenDecimal - _weiDecimal;
				decimalDiffConverter = 10**decimalDiff;
				amount = _amount.mul(decimalDiffConverter);
			}		
		} else {
			amount = _amount;
		}
		
		uint256 _quotient = amount;
		
		return (_quotient);
    }
	
	function _getReverseTokenAmount(address _tokenAddress, uint256 _amount) internal view returns (uint256 quotient) {
		IERC20 tokenAddress = IERC20(_tokenAddress);
		uint256 tokenDecimal = tokenAddress.decimals();
		uint256 decimalDiff = 0;
		uint256 decimalDiffConverter = 0;
		uint256 amount = 0;
			
		if(_weiDecimal != tokenDecimal){
			if(_weiDecimal > tokenDecimal){
				decimalDiff = _weiDecimal - tokenDecimal;
				decimalDiffConverter = 10**decimalDiff;
				amount = _amount.mul(decimalDiffConverter);
			} else {
				decimalDiff = tokenDecimal - _weiDecimal;
				decimalDiffConverter = 10**decimalDiff;
				amount = _amount.div(decimalDiffConverter);
			}		
		} else {
			amount = _amount;
		}
		
		uint256 _quotient = amount;
		
		return (_quotient);
    }
}

Read Contract

distributedAddress 0xc71784e4 → bool
getAllInfo 0x7e16c30c → tuple
owner 0x8da5cb5b → address
shares 0xce7c2ac2 → uint256
token 0xfc0c546a → address
totalDistributed 0xefca2eed → uint256
verifiedAddress 0x93d4457a → bool

Write Contract 10 functions

These functions modify contract state and require a wallet transaction to execute.

claimShare 0x666da64f
No parameters
clearStuckBalance 0x364333f4
No parameters
clearStuckToken 0x77b54bad
address TokenAddress
uint256 amount
distributeShare 0x1d96dabf
address shareholder
uint256 amount
renounceOwnership 0x715018a6
No parameters
setClaimFee 0x2e75ab50
uint256 _claimFee
setDevAddress 0xd0d41fe1
address _devAddress
setRelayAddress 0xaeba8f3c
address _relayAddress
setRelayFee 0x98385109
uint256 _relayFee
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

This address has 1 on-chain transactions, but only 0.6% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →