ETH Price: $2,515.78 (+3.06%)

Contract

0xb8C1Aaf54751efA11D2D8A5DF503b8afB6d80322
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Paused140058012022-01-14 20:32:42962 days ago1642192362IN
0xb8C1Aaf5...fB6d80322
0 ETH0.00737551157.42491455
Withdraw Token140057882022-01-14 20:29:45962 days ago1642192185IN
0xb8C1Aaf5...fB6d80322
0 ETH0.00738701141.08135832
Withdraw Token140057822022-01-14 20:29:04962 days ago1642192144IN
0xb8C1Aaf5...fB6d80322
0 ETH0.00995637171.08943515
Deposit139916162022-01-12 15:52:47964 days ago1642002767IN
0xb8C1Aaf5...fB6d80322
0 ETH0.0188072127.84882649
Deposit139447272022-01-05 9:46:19971 days ago1641375979IN
0xb8C1Aaf5...fB6d80322
0 ETH0.0136834690.06483843
Deposit139384282022-01-04 10:17:02972 days ago1641291422IN
0xb8C1Aaf5...fB6d80322
0 ETH0.0086295966.39730204
Deposit139337922022-01-03 17:19:04973 days ago1641230344IN
0xb8C1Aaf5...fB6d80322
0 ETH0.0124752395.98622606
Deposit139337352022-01-03 17:09:05973 days ago1641229745IN
0xb8C1Aaf5...fB6d80322
0 ETH0.02471685125.20316242
Deposit139288892022-01-02 23:00:22974 days ago1641164422IN
0xb8C1Aaf5...fB6d80322
0 ETH0.0135038103.85706243
Deposit139265692022-01-02 14:32:54974 days ago1641133974IN
0xb8C1Aaf5...fB6d80322
0 ETH0.0065343550.26778288
Deposit139256862022-01-02 11:22:23974 days ago1641122543IN
0xb8C1Aaf5...fB6d80322
0 ETH0.0089004468.45076342
Deposit139245912022-01-02 7:06:15975 days ago1641107175IN
0xb8C1Aaf5...fB6d80322
0 ETH0.0090158561.30272788
Deposit139204982022-01-01 15:59:56975 days ago1641052796IN
0xb8C1Aaf5...fB6d80322
0 ETH0.0107462879.73143146
Deposit139165252022-01-01 1:15:43976 days ago1640999743IN
0xb8C1Aaf5...fB6d80322
0 ETH0.0092024168.25145401
Deposit139151542021-12-31 20:10:31976 days ago1640981431IN
0xb8C1Aaf5...fB6d80322
0 ETH0.01455703111.99184828
Deposit139149402021-12-31 19:22:14976 days ago1640978534IN
0xb8C1Aaf5...fB6d80322
0 ETH0.0144487698.236785
Deposit139141912021-12-31 16:30:28976 days ago1640968228IN
0xb8C1Aaf5...fB6d80322
0 ETH0.0089544868.88012659
Deposit139116492021-12-31 6:55:54977 days ago1640933754IN
0xb8C1Aaf5...fB6d80322
0 ETH0.009252671.18537802
Deposit139078672021-12-30 16:51:31977 days ago1640883091IN
0xb8C1Aaf5...fB6d80322
0 ETH0.0115156188.58779962
Deposit138942702021-12-28 14:28:38979 days ago1640701718IN
0xb8C1Aaf5...fB6d80322
0 ETH0.0100081974.25523922
Deposit138930972021-12-28 10:09:33979 days ago1640686173IN
0xb8C1Aaf5...fB6d80322
0 ETH0.0091848864.54549587
Deposit138897112021-12-27 21:31:06980 days ago1640640666IN
0xb8C1Aaf5...fB6d80322
0 ETH0.0074385157.22858733
Deposit138894682021-12-27 20:40:52980 days ago1640637652IN
0xb8C1Aaf5...fB6d80322
0 ETH0.0094816672.93871985
Deposit138839792021-12-27 0:14:32981 days ago1640564072IN
0xb8C1Aaf5...fB6d80322
0 ETH0.01344152103.41783403
Deposit138839532021-12-27 0:07:38981 days ago1640563658IN
0xb8C1Aaf5...fB6d80322
0 ETH0.0120897189.66834705
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SkyrimRefund

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 8 : SkyrimRefund.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { MerkleProof } from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

contract SkyrimRefund is Ownable, ReentrancyGuard {
    using SafeERC20 for IERC20;

    uint256 public immutable rate;
    IERC20 public immutable input;
    IERC20 public immutable output;
    bytes32 public merkleRoot;
    bool public paused;
    mapping(address => uint256) public deposits;
    uint256 public totalDeposits;
    uint256 public totalUsers;

    event SetMerkleRoot(bytes32 merkleRoot);
    event SetPaused(bool paused);
    event Swap(address indexed user, uint256 amount);

    constructor(uint256 _rate, address _input, address _output, bytes32 _merkleRoot) Ownable() {
        rate = _rate;
        input = IERC20(_input);
        output = IERC20(_output);
        merkleRoot = _merkleRoot;
    }

    function setMerkleRoot(bytes32 _merkleRoot) external onlyOwner {
        merkleRoot = _merkleRoot;
        emit SetMerkleRoot(_merkleRoot);
    }

    function setPaused(bool _paused) external onlyOwner {
        paused = _paused;
        emit SetPaused(_paused);
    }

    function deposit(uint256 amount, uint256 allocation, bytes32[] calldata merkleProof) external nonReentrant {
        require(!paused, "paused");
        require(amount > 0, "need amount > 0");
        
        bytes32 node = keccak256(abi.encodePacked(msg.sender, allocation));
        require(MerkleProof.verify(merkleProof, merkleRoot, node), "invalid proof");

        if (deposits[msg.sender] == 0) {
            totalUsers++;
        }
        totalDeposits += amount;
        deposits[msg.sender] += amount;
        require(deposits[msg.sender] <= allocation, "over allocation");

        IERC20(input).safeTransferFrom(msg.sender, address(this), amount);
        IERC20(output).safeTransfer(msg.sender, amount * rate / 1e12);
        
        emit Swap(msg.sender, amount);
    }

    function withdrawToken(address token, uint amount) external onlyOwner {
        IERC20(token).safeTransfer(msg.sender, amount);
    }
}

File 2 of 8 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @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);

    /**
     * @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);
}

File 3 of 8 : MerkleProof.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Trees proofs.
 *
 * The proofs can be generated using the JavaScript library
 * https://github.com/miguelmota/merkletreejs[merkletreejs].
 * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
 *
 * See `test/utils/cryptography/MerkleProof.test.js` for some examples.
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        bytes32 computedHash = leaf;

        for (uint256 i = 0; i < proof.length; i++) {
            bytes32 proofElement = proof[i];

            if (computedHash <= proofElement) {
                // Hash(current computed hash + current element of the proof)
                computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
            } else {
                // Hash(current element of the proof + current computed hash)
                computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
            }
        }

        // Check if the computed hash (root) is equal to the provided root
        return computedHash == root;
    }
}

File 4 of 8 : Ownable.sol
// SPDX-License-Identifier: MIT

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() {
        _setOwner(_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 {
        _setOwner(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");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 5 of 8 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @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 make 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;
    }
}

File 6 of 8 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

/**
 * @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");
        }
    }
}

File 7 of 8 : Context.sol
// SPDX-License-Identifier: MIT

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 8 of 8 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @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);
            }
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"_rate","type":"uint256"},{"internalType":"address","name":"_input","type":"address"},{"internalType":"address","name":"_output","type":"address"},{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"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":false,"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"name":"SetMerkleRoot","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"paused","type":"bool"}],"name":"SetPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Swap","type":"event"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"allocation","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"deposits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"input","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"output","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"name":"setMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalDeposits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalUsers","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":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60e060405234801561001057600080fd5b50604051610f9b380380610f9b83398101604081905261002f916100cf565b61003833610063565b600180556080939093526001600160601b0319606092831b811660a052911b1660c052600255610113565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146100ca57600080fd5b919050565b600080600080608085870312156100e557600080fd5b845193506100f5602086016100b3565b9250610103604086016100b3565b6060959095015193969295505050565b60805160a05160601c60c05160601c610e3e61015d60003960008181610213015261063e0152600081816101ec01526105ce01526000818161011401526106050152610e3e6000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c806384eb773111610097578063eaed3f4f11610066578063eaed3f4f146101e7578063f20eaeb81461020e578063f2fde38b14610235578063fc7e286d1461024857600080fd5b806384eb7731146101935780638da5cb5b146101a65780639e281a98146101cb578063bff1f9e1146101de57600080fd5b80635c975abb116100d35780635c975abb14610152578063715018a61461016f5780637cb64759146101775780637d8820971461018a57600080fd5b806316c38b3c146100fa5780632c4e722e1461010f5780632eb4a7ab14610149575b600080fd5b61010d610108366004610bd4565b610268565b005b6101367f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b61013660025481565b60035461015f9060ff1681565b6040519015158152602001610140565b61010d6102e3565b61010d610185366004610c0e565b610319565b61013660055481565b61010d6101a1366004610c27565b610378565b6000546001600160a01b03165b6040516001600160a01b039091168152602001610140565b61010d6101d9366004610baa565b6106a5565b61013660065481565b6101b37f000000000000000000000000000000000000000000000000000000000000000081565b6101b37f000000000000000000000000000000000000000000000000000000000000000081565b61010d610243366004610b8f565b6106e7565b610136610256366004610b8f565b60046020526000908152604090205481565b6000546001600160a01b0316331461029b5760405162461bcd60e51b815260040161029290610cf9565b60405180910390fd5b6003805460ff19168215159081179091556040519081527f3c70af01296aef045b2f5c9d3c30b05d4428fd257145b9c7fcd76418e65b5980906020015b60405180910390a150565b6000546001600160a01b0316331461030d5760405162461bcd60e51b815260040161029290610cf9565b6103176000610782565b565b6000546001600160a01b031633146103435760405162461bcd60e51b815260040161029290610cf9565b60028190556040518181527f914960aef5e033ce5cae8a7992d4b7a6f0f9741227b66acb67c605b7019f8a46906020016102d8565b600260015414156103cb5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610292565b600260015560035460ff161561040c5760405162461bcd60e51b81526020600482015260066024820152651c185d5cd95960d21b6044820152606401610292565b6000841161044e5760405162461bcd60e51b815260206004820152600f60248201526e06e65656420616d6f756e74203e203608c1b6044820152606401610292565b6040516bffffffffffffffffffffffff193360601b166020820152603481018490526000906054016040516020818303038152906040528051906020012090506104cf8383808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505060025491508490506107d2565b61050b5760405162461bcd60e51b815260206004820152600d60248201526c34b73b30b634b210383937b7b360991b6044820152606401610292565b33600090815260046020526040902054610535576006805490600061052f83610db3565b91905055505b84600560008282546105479190610d2e565b9091555050336000908152600460205260408120805487929061056b908490610d2e565b9091555050336000908152600460205260409020548410156105c15760405162461bcd60e51b815260206004820152600f60248201526e37bb32b91030b63637b1b0ba34b7b760891b6044820152606401610292565b6105f66001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333088610883565b6106653364e8d4a5100061062a7f000000000000000000000000000000000000000000000000000000000000000089610d68565b6106349190610d46565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691906108f4565b60405185815233907f562c219552544ec4c9d7a8eb850f80ea152973e315372bf4999fe7c953ea004f9060200160405180910390a2505060018055505050565b6000546001600160a01b031633146106cf5760405162461bcd60e51b815260040161029290610cf9565b6106e36001600160a01b03831633836108f4565b5050565b6000546001600160a01b031633146107115760405162461bcd60e51b815260040161029290610cf9565b6001600160a01b0381166107765760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610292565b61077f81610782565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600081815b85518110156108765760008682815181106107f4576107f4610de4565b60200260200101519050808311610836576040805160208101859052908101829052606001604051602081830303815290604052805190602001209250610863565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b508061086e81610db3565b9150506107d7565b50831490505b9392505050565b6040516001600160a01b03808516602483015283166044820152606481018290526108ee9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610929565b50505050565b6040516001600160a01b03831660248201526044810182905261092490849063a9059cbb60e01b906064016108b7565b505050565b600061097e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166109fb9092919063ffffffff16565b805190915015610924578080602001905181019061099c9190610bf1565b6109245760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610292565b6060610a0a8484600085610a12565b949350505050565b606082471015610a735760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610292565b843b610ac15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610292565b600080866001600160a01b03168587604051610add9190610caa565b60006040518083038185875af1925050503d8060008114610b1a576040519150601f19603f3d011682016040523d82523d6000602084013e610b1f565b606091505b5091509150610b2f828286610b3a565b979650505050505050565b60608315610b4957508161087c565b825115610b595782518084602001fd5b8160405162461bcd60e51b81526004016102929190610cc6565b80356001600160a01b0381168114610b8a57600080fd5b919050565b600060208284031215610ba157600080fd5b61087c82610b73565b60008060408385031215610bbd57600080fd5b610bc683610b73565b946020939093013593505050565b600060208284031215610be657600080fd5b813561087c81610dfa565b600060208284031215610c0357600080fd5b815161087c81610dfa565b600060208284031215610c2057600080fd5b5035919050565b60008060008060608587031215610c3d57600080fd5b8435935060208501359250604085013567ffffffffffffffff80821115610c6357600080fd5b818701915087601f830112610c7757600080fd5b813581811115610c8657600080fd5b8860208260051b8501011115610c9b57600080fd5b95989497505060200194505050565b60008251610cbc818460208701610d87565b9190910192915050565b6020815260008251806020840152610ce5816040850160208701610d87565b601f01601f19169190910160400192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115610d4157610d41610dce565b500190565b600082610d6357634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615610d8257610d82610dce565b500290565b60005b83811015610da2578181015183820152602001610d8a565b838111156108ee5750506000910152565b6000600019821415610dc757610dc7610dce565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b801515811461077f57600080fdfea26469706673582212204401fd7debf31329044deb356ff26f5bba7c45ad909845f6f960ae68e00c2f2a64736f6c63430008070033000000000000000000000000000000000000000000000000000000d8ea7ca4170000000000000000000000002610f0bfc21ef389fe4d03cfb7de9ac1e6c99d6e00000000000000000000000069fa0fee221ad11012bab0fdb45d444d3d2ce71c363fef2ff9710367ad90ffcc2b0e7845b015015888dfc95ebf904b75132bc002

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806384eb773111610097578063eaed3f4f11610066578063eaed3f4f146101e7578063f20eaeb81461020e578063f2fde38b14610235578063fc7e286d1461024857600080fd5b806384eb7731146101935780638da5cb5b146101a65780639e281a98146101cb578063bff1f9e1146101de57600080fd5b80635c975abb116100d35780635c975abb14610152578063715018a61461016f5780637cb64759146101775780637d8820971461018a57600080fd5b806316c38b3c146100fa5780632c4e722e1461010f5780632eb4a7ab14610149575b600080fd5b61010d610108366004610bd4565b610268565b005b6101367f000000000000000000000000000000000000000000000000000000d8ea7ca41781565b6040519081526020015b60405180910390f35b61013660025481565b60035461015f9060ff1681565b6040519015158152602001610140565b61010d6102e3565b61010d610185366004610c0e565b610319565b61013660055481565b61010d6101a1366004610c27565b610378565b6000546001600160a01b03165b6040516001600160a01b039091168152602001610140565b61010d6101d9366004610baa565b6106a5565b61013660065481565b6101b37f0000000000000000000000002610f0bfc21ef389fe4d03cfb7de9ac1e6c99d6e81565b6101b37f00000000000000000000000069fa0fee221ad11012bab0fdb45d444d3d2ce71c81565b61010d610243366004610b8f565b6106e7565b610136610256366004610b8f565b60046020526000908152604090205481565b6000546001600160a01b0316331461029b5760405162461bcd60e51b815260040161029290610cf9565b60405180910390fd5b6003805460ff19168215159081179091556040519081527f3c70af01296aef045b2f5c9d3c30b05d4428fd257145b9c7fcd76418e65b5980906020015b60405180910390a150565b6000546001600160a01b0316331461030d5760405162461bcd60e51b815260040161029290610cf9565b6103176000610782565b565b6000546001600160a01b031633146103435760405162461bcd60e51b815260040161029290610cf9565b60028190556040518181527f914960aef5e033ce5cae8a7992d4b7a6f0f9741227b66acb67c605b7019f8a46906020016102d8565b600260015414156103cb5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610292565b600260015560035460ff161561040c5760405162461bcd60e51b81526020600482015260066024820152651c185d5cd95960d21b6044820152606401610292565b6000841161044e5760405162461bcd60e51b815260206004820152600f60248201526e06e65656420616d6f756e74203e203608c1b6044820152606401610292565b6040516bffffffffffffffffffffffff193360601b166020820152603481018490526000906054016040516020818303038152906040528051906020012090506104cf8383808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505060025491508490506107d2565b61050b5760405162461bcd60e51b815260206004820152600d60248201526c34b73b30b634b210383937b7b360991b6044820152606401610292565b33600090815260046020526040902054610535576006805490600061052f83610db3565b91905055505b84600560008282546105479190610d2e565b9091555050336000908152600460205260408120805487929061056b908490610d2e565b9091555050336000908152600460205260409020548410156105c15760405162461bcd60e51b815260206004820152600f60248201526e37bb32b91030b63637b1b0ba34b7b760891b6044820152606401610292565b6105f66001600160a01b037f0000000000000000000000002610f0bfc21ef389fe4d03cfb7de9ac1e6c99d6e16333088610883565b6106653364e8d4a5100061062a7f000000000000000000000000000000000000000000000000000000d8ea7ca41789610d68565b6106349190610d46565b6001600160a01b037f00000000000000000000000069fa0fee221ad11012bab0fdb45d444d3d2ce71c1691906108f4565b60405185815233907f562c219552544ec4c9d7a8eb850f80ea152973e315372bf4999fe7c953ea004f9060200160405180910390a2505060018055505050565b6000546001600160a01b031633146106cf5760405162461bcd60e51b815260040161029290610cf9565b6106e36001600160a01b03831633836108f4565b5050565b6000546001600160a01b031633146107115760405162461bcd60e51b815260040161029290610cf9565b6001600160a01b0381166107765760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610292565b61077f81610782565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600081815b85518110156108765760008682815181106107f4576107f4610de4565b60200260200101519050808311610836576040805160208101859052908101829052606001604051602081830303815290604052805190602001209250610863565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b508061086e81610db3565b9150506107d7565b50831490505b9392505050565b6040516001600160a01b03808516602483015283166044820152606481018290526108ee9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610929565b50505050565b6040516001600160a01b03831660248201526044810182905261092490849063a9059cbb60e01b906064016108b7565b505050565b600061097e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166109fb9092919063ffffffff16565b805190915015610924578080602001905181019061099c9190610bf1565b6109245760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610292565b6060610a0a8484600085610a12565b949350505050565b606082471015610a735760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610292565b843b610ac15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610292565b600080866001600160a01b03168587604051610add9190610caa565b60006040518083038185875af1925050503d8060008114610b1a576040519150601f19603f3d011682016040523d82523d6000602084013e610b1f565b606091505b5091509150610b2f828286610b3a565b979650505050505050565b60608315610b4957508161087c565b825115610b595782518084602001fd5b8160405162461bcd60e51b81526004016102929190610cc6565b80356001600160a01b0381168114610b8a57600080fd5b919050565b600060208284031215610ba157600080fd5b61087c82610b73565b60008060408385031215610bbd57600080fd5b610bc683610b73565b946020939093013593505050565b600060208284031215610be657600080fd5b813561087c81610dfa565b600060208284031215610c0357600080fd5b815161087c81610dfa565b600060208284031215610c2057600080fd5b5035919050565b60008060008060608587031215610c3d57600080fd5b8435935060208501359250604085013567ffffffffffffffff80821115610c6357600080fd5b818701915087601f830112610c7757600080fd5b813581811115610c8657600080fd5b8860208260051b8501011115610c9b57600080fd5b95989497505060200194505050565b60008251610cbc818460208701610d87565b9190910192915050565b6020815260008251806020840152610ce5816040850160208701610d87565b601f01601f19169190910160400192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115610d4157610d41610dce565b500190565b600082610d6357634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615610d8257610d82610dce565b500290565b60005b83811015610da2578181015183820152602001610d8a565b838111156108ee5750506000910152565b6000600019821415610dc757610dc7610dce565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b801515811461077f57600080fdfea26469706673582212204401fd7debf31329044deb356ff26f5bba7c45ad909845f6f960ae68e00c2f2a64736f6c63430008070033

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

000000000000000000000000000000000000000000000000000000d8ea7ca4170000000000000000000000002610f0bfc21ef389fe4d03cfb7de9ac1e6c99d6e00000000000000000000000069fa0fee221ad11012bab0fdb45d444d3d2ce71c363fef2ff9710367ad90ffcc2b0e7845b015015888dfc95ebf904b75132bc002

-----Decoded View---------------
Arg [0] : _rate (uint256): 931646972951
Arg [1] : _input (address): 0x2610F0bFC21EF389fe4D03CFB7De9ac1E6C99D6E
Arg [2] : _output (address): 0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c
Arg [3] : _merkleRoot (bytes32): 0x363fef2ff9710367ad90ffcc2b0e7845b015015888dfc95ebf904b75132bc002

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000000000000000000000000000000000d8ea7ca417
Arg [1] : 0000000000000000000000002610f0bfc21ef389fe4d03cfb7de9ac1e6c99d6e
Arg [2] : 00000000000000000000000069fa0fee221ad11012bab0fdb45d444d3d2ce71c
Arg [3] : 363fef2ff9710367ad90ffcc2b0e7845b015015888dfc95ebf904b75132bc002


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
Loading...
Loading
[ Download: CSV Export  ]

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