Contract 0xe29c9a493ede58028163ab04215e18a8acd0472c 1

 
 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x7c4179330ce2ebadc21f0f1e0df4eea45c7a9e58b80e68c47c36ca86b18af7b0Craft336659262022-09-28 9:26:1439 mins ago0x5d49e47dca89e2abc649ed04bf08f0a198242a0a IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.029024357472 40.740000018
0x771c5e5dbd58dfdc48d4352f5d37a2ad3e94ac05566c6ba8b27c4ae2e7954662Craft336651212022-09-28 8:58:321 hr 6 mins ago0xe21084a9ed5769b2ba974d83767952ebd55c1899 IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.02487802068 34.920000001
0xf8153b809ec34093f1b4fc064c62db55fc6e6a37265aa3fc7d8fa74da57c7d9bCraft336643682022-09-28 8:32:351 hr 32 mins ago0xeae707f06a65102d6ab4300a53a0ce63d6f1bcd7 IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.021372870016 30.000000023
0xc77c167e6d1caf5d2db4b6f5c2a2f580ed860b4c0216150938448b6ed4be4c1dCraft336642012022-09-28 8:26:531 hr 38 mins ago0xdc1b5ae805313b2102d273dd7b153e56a7dc64c1 IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.021896430013 30.000000019
0x956cca28c6a395f9c03283be2234424e552ef0c7f967e0406013c35d9ed4f070Craft336603822022-09-28 6:15:273 hrs 49 mins ago0x7fb5f456494895b55ff6f9f59912f0315b2f7dae IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.021634470072 30.0000001
0x65b08ab90be188c574dbfd1d72ef6460d5db2091cf0f6b85c37f9dcb61485f07Craft336578982022-09-28 4:50:035 hrs 15 mins ago0x130b695836435e365258aa5a682a395323cf5487 IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.021373230009 30.000000013
0xeefd965cf48a356d7ee5f98a9e73019d8b263fbe02234c0db3e24853eb8fb26cCraft336574352022-09-28 4:34:065 hrs 31 mins ago0x366b7004c10c216ee73326d602624a92851e1eb0 IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.021373230015 30.000000022
0x0ed249d0d604cd0c1c46056815c5261bf3ae3180b0ee19a0898a488c8acf6392Craft336573112022-09-28 4:29:505 hrs 35 mins ago0x366b7004c10c216ee73326d602624a92851e1eb0 IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.022120706719 31.049699998
0x0d807f38bc2fbba81db0a62592b9fa022167e1a57ac2c3d39ed919580949017cCraft336573102022-09-28 4:29:485 hrs 35 mins ago0x366b7004c10c216ee73326d602624a92851e1eb0 IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.022391460103 31.049699997
0xc897a3c241810bc154944b54dc28f7ada92647f4bb219dd957be05ed7ef3e103Craft336572552022-09-28 4:27:545 hrs 37 mins ago0x366b7004c10c216ee73326d602624a92851e1eb0 IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.008267510794 30.555000016
0xcbf9174bd04b90dd044d68fe314783c859bb502fa798ae79f5f605bc3440b81bCraft336572532022-09-28 4:27:505 hrs 37 mins ago0x366b7004c10c216ee73326d602624a92851e1eb0 IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.008267510794 30.555000016
0x6a8014a4360a18dd1cec187e3a9655f755b967fd4a9983cb717baf987dfea7cbCraft336570992022-09-28 4:22:345 hrs 42 mins ago0x366b7004c10c216ee73326d602624a92851e1eb0 IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.021373230011 30.000000016
0xba0395588be37900b01db04658e51078d2d0ab476168dac5c1380d8ebbd7f155Craft336570952022-09-28 4:22:265 hrs 42 mins ago0x366b7004c10c216ee73326d602624a92851e1eb0 IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.021896430012 30.000000017
0x154f36945a3ce9af39b982db1be2649069fad0b4942c8db67215abacb40da92dCraft336568232022-09-28 4:13:025 hrs 52 mins ago0xe190e563f6682c08e96a0798ab48dd25d607ab83 IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.021373230012 30.000000017
0x8d004347c90b764250f361b59822703e76a74a823b78c0671598f785d11a6f88Craft336534832022-09-28 2:15:597 hrs 49 mins ago0xeeaf81be226696b8811aed7b6303be2e73f1b36d IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.021819496528 30.626390857
0x8306c9bda00ff74ecb65837aa70330cffc90de605f6834427af342d322e45a6dCraft336532872022-09-28 2:09:157 hrs 56 mins ago0xeeaf81be226696b8811aed7b6303be2e73f1b36d IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.025499708887 35.792028937
0x832b7f0c5683d276dea47e66d7c7a7623588ce766bf485c3f408a5954638c19cCraft336525192022-09-28 1:42:508 hrs 22 mins ago0x0a3afcf9c5595b577e8bf5fb82a5f94c7c06edd8 IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.024878439721 34.920000002
0x3746e562b15776bd428585db176f89223b9b41ea715e781373b25042623b2555Craft336512232022-09-28 0:56:589 hrs 8 mins ago0xb9688533067d7457b663cad7f309d344bbd66a50 IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.021423100873 30.070000005
0x421357bcd39d30a7da529a17563ff2a1b2b56f15474bc620962eebe7beefb863Craft336512192022-09-28 0:56:429 hrs 8 mins ago0x30ad4d578e1fcfb75c038470d80105faac722a79 IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.021422740032 30.070000003
0x3af4d70d0e2112442c7bb32e1550223609dc3653ee73388f2c0aab289a54706cCraft336491902022-09-27 23:46:1610 hrs 19 mins ago0xb9688533067d7457b663cad7f309d344bbd66a50 IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.023408123931 32.856227998
0xb7140fb283ee83f7e8ec6f08e8e97b23ab02850c456ad818dd37c980066ad433Craft336490102022-09-27 23:40:0410 hrs 25 mins ago0xaaa76e0a7d90ea524f3477b9f569ff9c058d234a IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.021373230009 30.000000014
0x6219b2ee6aef61a5e959d23a84d042feb4e7f460a658136ff5baa6edbca63181Craft336483152022-09-27 23:16:1010 hrs 49 mins ago0x04ab099010da16e70c1fc05fac8239335ff1d0f7 IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.02418737195 33.95
0xeea9a948abaaa3afb60ae453a3d71804c1f9b06434b7f1363eabd8ae25023f0dCraft336483072022-09-27 23:15:5410 hrs 49 mins ago0x04ab099010da16e70c1fc05fac8239335ff1d0f7 IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.027159064866 38.121142476
0x5978468f1a4526d83df541867834252806a7cfad03fee7325f44dfd0b75b1dfbCraft336482992022-09-27 23:15:3810 hrs 49 mins ago0x04ab099010da16e70c1fc05fac8239335ff1d0f7 IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.02321045533 32.578775408
0x671d655ed127e175b60be37e5f7cac438fbda1d440ac39683f771b6f54b515e9Craft336482892022-09-27 23:15:1810 hrs 50 mins ago0x04ab099010da16e70c1fc05fac8239335ff1d0f7 IN  0xe29c9a493ede58028163ab04215e18a8acd0472c0 MATIC0.023928304464 33.5863664
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CraftHelper

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
default evmVersion, Unlicense license

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 7 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)

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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, 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 `from` to `to` 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 from,
        address to,
        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 2 of 7 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

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 3 of 7 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @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
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 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);
            }
        }
    }
}

File 4 of 7 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    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);
        }
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    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);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 5 of 7 : IUniswapV2Factory.sol
pragma solidity >=0.5.0;

interface IUniswapV2Factory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint);

    function feeTo() external view returns (address);
    function feeToSetter() external view returns (address);

    function getPair(address tokenA, address tokenB) external view returns (address pair);
    function allPairs(uint) external view returns (address pair);
    function allPairsLength() external view returns (uint);

    function createPair(address tokenA, address tokenB) external returns (address pair);

    function setFeeTo(address) external;
    function setFeeToSetter(address) external;
}

File 6 of 7 : IUniswapV2Pair.sol
pragma solidity >=0.5.0;

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

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);
    function factory() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
    function price0CumulativeLast() external view returns (uint);
    function price1CumulativeLast() external view returns (uint);
    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);
    function burn(address to) external returns (uint amount0, uint amount1);
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function skim(address to) external;
    function sync() external;

    function initialize(address, address) external;
}

File 7 of 7 : CraftHelper.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.8.4;

import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol";
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";

interface ICrafter {
  function craft(address to, uint256 recipeId) external returns (bytes32);
}

/*
 * @title CraftHelper
 * @notice CraftHelper is an utility contract that helps craft items.
 * Craft recipes consist of a list of ERC20 that can be of several types:
 *  1. Classic ERC20
 *  2. Comethswap LP ERC20
 * To ease the usage of the Items.craft() method, this helper contract also provides
 * liquidity to Comethswap for recipes that need it.
 *
 * User must approve usage of all ERC20 the CraftHelper manipulates
 */
contract CraftHelper {
  using SafeERC20 for IERC20;
  using SafeMath for uint256;

  struct CraftIngredient {
    // Following field should be set if ingredient is a classic ERC20 token
    address token;

    // Following fields should be set if ingredient is a Comethswap LP
    address token0;
    uint256 amount0Max;
    address token1;
    uint256 amount1Max;

    // Following field is generic. It must always be provided.
    uint256 amount;
  }

  IUniswapV2Factory public factory;
  ICrafter public crafter;

  constructor(ICrafter _crafter, IUniswapV2Factory _factory) {
    crafter = _crafter;
    factory = _factory;
  }

  function craft(address to, uint256 recipeId, CraftIngredient[] memory ingredients) external {
    for (uint256 i = 0; i < ingredients.length; i++) {
      if (ingredients[i].token != address(0)) {
        IERC20(ingredients[i].token).safeTransferFrom(
          msg.sender,
          address(crafter),
          ingredients[i].amount
        );
      } else {
        _addLiquidity(
          IERC20(ingredients[i].token0),
          IERC20(ingredients[i].token1),
          ingredients[i].amount0Max,
          ingredients[i].amount1Max,
          ingredients[i].amount
        );
      }
    }

    crafter.craft(to, recipeId);
  }

  function _addLiquidity(
    IERC20 token0, IERC20 token1,
    uint256 amount0Max, uint256 amount1Max,
    uint256 lpAmount) private {
    IUniswapV2Pair lp = IUniswapV2Pair(factory.getPair(address(token0), address(token1)));

    (uint256 amount0, uint256 amount1) = _computeLpAmounts(lp, lpAmount);
    require(amount0 <= amount0Max, "token0 exceeds max amount");
    require(amount1 <= amount1Max, "token1 exceeds max amount");

    token0.safeTransferFrom(msg.sender, address(lp), amount0);
    token1.safeTransferFrom(msg.sender, address(lp), amount1);

    lp.mint(address(crafter));
  }

  function _computeLpAmounts(IUniswapV2Pair pair, uint256 amount) private view returns (uint256, uint256) {
    (uint112 reserve0, uint112 reserve1,) = pair.getReserves();
    uint256 totalSupply = pair.totalSupply();
    uint256 kLast = pair.kLast();

    if (factory.feeTo() != address(0)) {
      if (kLast != 0) {
        uint rootK = sqrt(uint(reserve0).mul(reserve1));
        uint rootKLast = sqrt(kLast);
        if (rootK > rootKLast) {
          uint numerator = totalSupply.mul(rootK.sub(rootKLast));
          uint denominator = rootK.mul(9).add(rootKLast);
          totalSupply = totalSupply.add(numerator / denominator);
        }
      }
    }

    uint256 amount0 = amount.mul(reserve0) / totalSupply;
    uint256 amount1 = amount.mul(reserve1) / totalSupply;

    return (amount0, amount1);
  }

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

Settings
{
  "evmVersion": "istanbul",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 1000000
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract ICrafter","name":"_crafter","type":"address"},{"internalType":"contract IUniswapV2Factory","name":"_factory","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"recipeId","type":"uint256"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"uint256","name":"amount0Max","type":"uint256"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint256","name":"amount1Max","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct CraftHelper.CraftIngredient[]","name":"ingredients","type":"tuple[]"}],"name":"craft","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"crafter","outputs":[{"internalType":"contract ICrafter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"contract IUniswapV2Factory","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b506040516113b73803806113b783398101604081905261002f91610060565b600180546001600160a01b039384166001600160a01b031991821617909155600080549290931691161790556100b1565b60008060408385031215610072578182fd5b825161007d81610099565b602084015190925061008e81610099565b809150509250929050565b6001600160a01b03811681146100ae57600080fd5b50565b6112f7806100c06000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80632413a3fc14610046578063b60099b71461008f578063c45a0155146100a4575b600080fd5b6001546100669073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6100a261009d366004610e9c565b6100c4565b005b6000546100669073ffffffffffffffffffffffffffffffffffffffff1681565b60005b815181101561039757600073ffffffffffffffffffffffffffffffffffffffff16828281518110610121577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff16146102245761021f33600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168484815181106101a8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015160a001518585815181106101ed577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1661044a909392919063ffffffff16565b610385565b610385828281518110610260577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151602001518383815181106102a5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151606001518484815181106102ea577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516040015185858151811061032f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015160800151868681518110610374577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015160a001516104df565b8061038f81611205565b9150506100c7565b506001546040517fc1d942c100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152602482018590529091169063c1d942c190604401602060405180830381600087803b15801561040c57600080fd5b505af1158015610420573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104449190610fe9565b50505050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905261044490859061076b565b600080546040517fe6a4390500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff888116600483015287811660248301529091169063e6a439059060440160206040518083038186803b15801561055357600080fd5b505afa158015610567573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058b9190610e80565b905060008061059a838561087c565b915091508582111561060d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f746f6b656e302065786365656473206d617820616d6f756e740000000000000060448201526064015b60405180910390fd5b84811115610677576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f746f6b656e312065786365656473206d617820616d6f756e74000000000000006044820152606401610604565b61069973ffffffffffffffffffffffffffffffffffffffff891633858561044a565b6106bb73ffffffffffffffffffffffffffffffffffffffff881633858461044a565b6001546040517f6a62784200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015290841690636a62784290602401602060405180830381600087803b15801561072857600080fd5b505af115801561073c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107609190610fe9565b505050505050505050565b60006107cd826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16610bcc9092919063ffffffff16565b80519091501561087757808060200190518101906107eb9190610fc9565b610877576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610604565b505050565b6000806000808573ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156108c857600080fd5b505afa1580156108dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109009190611001565b509150915060008673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561094d57600080fd5b505afa158015610961573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109859190610fe9565b905060008773ffffffffffffffffffffffffffffffffffffffff16637464fc3d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156109cf57600080fd5b505afa1580156109e3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a079190610fe9565b9050600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b158015610a8757600080fd5b505afa158015610a9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abf9190610e80565b73ffffffffffffffffffffffffffffffffffffffff1614610b6b578015610b6b576000610b07610b026dffffffffffffffffffffffffffff878116908716610be5565b610bf1565b90506000610b1483610bf1565b905080821115610b68576000610b34610b2d8484610c61565b8690610be5565b90506000610b4d83610b47866009610be5565b90610c6d565b9050610b63610b5c828461114c565b8790610c6d565b955050505b50505b600082610b88896dffffffffffffffffffffffffffff8816610be5565b610b92919061114c565b9050600083610bb18a6dffffffffffffffffffffffffffff8816610be5565b610bbb919061114c565b919a91995090975050505050505050565b6060610bdb8484600085610c79565b90505b9392505050565b6000610bde8284611185565b60006003821115610c525750806000610c0b60028361114c565b610c16906001611134565b90505b81811015610c4c57905080600281610c31818661114c565b610c3b9190611134565b610c45919061114c565b9050610c19565b50919050565b8115610c5c575060015b919050565b6000610bde82846111c2565b6000610bde8284611134565b606082471015610d0b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610604565b73ffffffffffffffffffffffffffffffffffffffff85163b610d89576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610604565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051610db2919061104f565b60006040518083038185875af1925050503d8060008114610def576040519150601f19603f3d011682016040523d82523d6000602084013e610df4565b606091505b5091509150610e04828286610e0f565b979650505050505050565b60608315610e1e575081610bde565b825115610e2e5782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610604919061106b565b80516dffffffffffffffffffffffffffff81168114610c5c57600080fd5b600060208284031215610e91578081fd5b8151610bde8161129c565b60008060006060808587031215610eb1578283fd5b8435610ebc8161129c565b9350602085810135935060408087013567ffffffffffffffff80821115610ee1578586fd5b818901915089601f830112610ef4578586fd5b813581811115610f0657610f0661126d565b610f14858260051b016110e5565b818152858101925083860160c0808402860188018e1015610f3357898afd5b8995505b83861015610fb65780828f031215610f4d57898afd5b610f556110bc565b8235610f608161129c565b815282890135610f6f8161129c565b818a0152828801358882015289830135610f888161129c565b818b01526080838101359082015260a080840135908201528552600195909501949387019390810190610f37565b5050809750505050505050509250925092565b600060208284031215610fda578081fd5b81518015158114610bde578182fd5b600060208284031215610ffa578081fd5b5051919050565b600080600060608486031215611015578283fd5b61101e84610e62565b925061102c60208501610e62565b9150604084015163ffffffff81168114611044578182fd5b809150509250925092565b600082516110618184602087016111d9565b9190910192915050565b602081526000825180602084015261108a8160408501602087016111d9565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60405160c0810167ffffffffffffffff811182821017156110df576110df61126d565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561112c5761112c61126d565b604052919050565b600082198211156111475761114761123e565b500190565b600082611180577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156111bd576111bd61123e565b500290565b6000828210156111d4576111d461123e565b500390565b60005b838110156111f45781810151838201526020016111dc565b838111156104445750506000910152565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156112375761123761123e565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff811681146112be57600080fd5b5056fea2646970667358221220245d780b1197934246efcc672a0759a45b5823c7b0ab62606de17e6a7e3e4be364736f6c634300080400330000000000000000000000009c25ee0f938122a504be82189536df74687858e4000000000000000000000000800b052609c355ca8103e06f022aa30647ead60a

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

0000000000000000000000009c25ee0f938122a504be82189536df74687858e4000000000000000000000000800b052609c355ca8103e06f022aa30647ead60a

-----Decoded View---------------
Arg [0] : _crafter (address): 0x9c25ee0f938122a504be82189536df74687858e4
Arg [1] : _factory (address): 0x800b052609c355ca8103e06f022aa30647ead60a

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000009c25ee0f938122a504be82189536df74687858e4
Arg [1] : 000000000000000000000000800b052609c355ca8103e06f022aa30647ead60a


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.