ETH Price: $3,388.25 (-2.66%)
Gas: 1 Gwei

Contract

0x7F13d793010115E9b4db341E60f522AaFAd5f34a
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Batch Take201269792024-06-19 16:28:239 days ago1718814503IN
0x7F13d793...aFAd5f34a
0 ETH0.0016341913.37510184
Batch Take201094212024-06-17 5:28:1111 days ago1718602091IN
0x7F13d793...aFAd5f34a
0 ETH0.000322372.63849815
Batch Take198963102024-05-18 10:43:5941 days ago1716029039IN
0x7F13d793...aFAd5f34a
0 ETH0.00040213.29139057
Batch Take198380872024-05-10 7:16:5949 days ago1715325419IN
0x7F13d793...aFAd5f34a
0 ETH0.000482263.94706304
Batch Take198380632024-05-10 7:12:1149 days ago1715325131IN
0x7F13d793...aFAd5f34a
0 ETH0.000511224.18455346
Batch Take198201082024-05-07 18:54:3552 days ago1715108075IN
0x7F13d793...aFAd5f34a
0 ETH0.001087948.90433872
Adjust Order197385812024-04-26 9:16:3563 days ago1714122995IN
0x7F13d793...aFAd5f34a
0 ETH0.000254137.17803532
Batch Take197385632024-04-26 9:12:5963 days ago1714122779IN
0x7F13d793...aFAd5f34a
0 ETH0.001016438.31904383
Batch Take196907222024-04-19 16:38:2370 days ago1713544703IN
0x7F13d793...aFAd5f34a
0 ETH0.0019104715.63633748
Batch Take195621842024-04-01 16:31:3588 days ago1711989095IN
0x7F13d793...aFAd5f34a
0 ETH0.0041874434.2721966
Batch Take195621212024-04-01 16:18:5988 days ago1711988339IN
0x7F13d793...aFAd5f34a
0 ETH0.0051393436.89882009
0x60806040195242832024-03-27 7:47:5993 days ago1711525679IN
 Create: LybraOrder
0 ETH0.0476776925.63096321

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

Contract Source Code Verified (Exact Match)

Contract Name:
LybraOrder

Compiler Version
v0.8.25+commit.b61c2a91

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 3 : Order.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.19;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";

contract LybraOrder {
    IERC20 public eUSDV1 = IERC20(0x97de57eC338AB5d51557DA3434828C5DbFaDA371);
    IERC20 public eUSDV2 = IERC20(0xdf3ac4F479375802A821f7b7b46Cd7EB5E4262cC);
    IERC20 public peUSD = IERC20(0xD585aaafA2B58b1CD75092B51ade9Fa4Ce52F247);
    IERC20 public USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);

    Order[] public orders;

    enum TokenType {
        eUSDV1,
        eUSDV2,
        peUSD
    }

    struct Order {
        address maker;
        TokenType tokenType;
        bool buyOrSale;
        uint256 price;
        uint256 remainingAmount;
        bool isActive;
    }

    event MakeOrder(address indexed user, uint256 id, TokenType indexed tokenType, bool indexed buyOrSale, uint256 price, uint256 remainingAmount, uint256 time);
    event TakeOrder(uint256 id, address indexed taker, TokenType indexed tokenType, bool indexed buyOrSale, uint256 price, uint256 amount, uint256 time);
    event AdjustOrder(uint256 id, address indexed maker, uint256 price, uint256 amount, bool indexed isActive, uint256 time);

    // --- Functions ---

    constructor() {
    }

    function makeOrder(TokenType tokenType, bool buyOrSale, uint256 price, uint256 totalAmount) external {
        _makeOrder(msg.sender, tokenType, buyOrSale, price, totalAmount);
    }

    function adjustOrder(uint256 orderId, uint256 price, uint256 amount, bool isActive) external {
        Order memory order = orders[orderId];
        require(order.maker == msg.sender, "NA");
        order.price = price;
        order.remainingAmount = amount;
        order.isActive = isActive;
        orders[orderId] = order;
        emit AdjustOrder(orderId, msg.sender, price, amount, isActive, block.timestamp);
    }

    function takeOrder(uint256 orderId, uint256 takeAmount) external {
        _takeOrder(msg.sender, orderId, takeAmount);
    }

    function batchTake(uint256[] memory ids, uint256[] memory amounts, Order memory order) external {
        for(uint i = 0; i < ids.length; i++) {
            if(order.tokenType != orders[ids[i]].tokenType) continue;
            if(order.buyOrSale == orders[ids[i]].buyOrSale) continue;
            if((order.buyOrSale && orders[ids[i]].price > order.price) || (!order.buyOrSale && orders[ids[i]].price < order.price)) continue;
            if(checkOrder(msg.sender, ids[i], amounts[i]))
                _takeOrder(msg.sender, ids[i], amounts[i]);
        }
        if(order.remainingAmount > 0) {
            _makeOrder(msg.sender, order.tokenType, order.buyOrSale, order.price, order.remainingAmount);
        } 
    }

    function _makeOrder(address _maker, TokenType _tokenType, bool _buyOrSale, uint256 _price, uint256 _totalAmount) internal {
        require(_price >= 5e5 && _price <= 2e6, "OR");
        orders.push(Order({maker: _maker,
        tokenType: _tokenType,
        buyOrSale: _buyOrSale,
        price: _price,
        remainingAmount: _totalAmount,
        isActive: true
        }));
        emit MakeOrder(_maker, orders.length - 1, _tokenType, _buyOrSale, _price, _totalAmount, block.timestamp);
    }

    function _takeOrder(address _taker, uint256 _id, uint256 _takeAmount) internal {
        Order memory order = orders[_id];
        require(order.isActive && order.remainingAmount >= _takeAmount, "NA");
        IERC20 token = order.tokenType == TokenType.eUSDV1 ? eUSDV1 : order.tokenType == TokenType.eUSDV2 ? eUSDV2 : peUSD;
        bool returnA;
        bool returnB;
        if(order.buyOrSale) {
            returnA = token.transferFrom(_taker, order.maker, _takeAmount);
            returnB = USDC.transferFrom(order.maker, _taker, _takeAmount * order.price / 1e18);
        } else {
            returnA = USDC.transferFrom(_taker, order.maker, _takeAmount * order.price / 1e18);
            returnB = token.transferFrom(order.maker, _taker, _takeAmount);
        }
        require(returnA && returnB, "TF");
        orders[_id].remainingAmount -= _takeAmount;
        if(order.remainingAmount == _takeAmount) {
            orders[_id].isActive = false;
        }
        emit TakeOrder(_id, _taker, order.tokenType, order.buyOrSale, order.price, _takeAmount, block.timestamp);
    }

    

    function checkOrder(address taker, uint256 orderId, uint256 takeAmount) public view returns(bool) {
        Order memory order = orders[orderId];
        if(!order.isActive || order.remainingAmount < takeAmount) {
            return false;
        }

        IERC20 token = order.tokenType == TokenType.eUSDV1 ? eUSDV1 : order.tokenType == TokenType.eUSDV2 ? eUSDV2 : peUSD;
        if(order.buyOrSale) {
            if(token.allowance(taker, address(this)) < takeAmount || token.balanceOf(taker) < takeAmount || USDC.allowance(order.maker, address(this)) < takeAmount * order.price / 1e18 || USDC.balanceOf(order.maker) < takeAmount * order.price / 1e18) {
                return false;
            }
        } else {
            if(USDC.allowance(taker, address(this)) < takeAmount * order.price / 1e18 || USDC.balanceOf(taker) < takeAmount * order.price / 1e18 || token.allowance(order.maker, address(this)) < takeAmount || token.balanceOf(order.maker) < takeAmount) {
                return false;
            }
        }
        return true;
    }

    function checkOrderValidAmount(uint256 orderId) public view returns(uint256) {
        Order memory order = orders[orderId];
        if(!order.isActive) {
            return 0;
        }
        if(order.buyOrSale) {
            uint a = Math.min(USDC.allowance(order.maker, address(this)) * 1e18 / order.price, USDC.balanceOf(order.maker) * 1e18 / order.price);
            return Math.min(order.remainingAmount, a);
        } else {
            IERC20 token = order.tokenType == TokenType.eUSDV1 ? eUSDV1 : order.tokenType == TokenType.eUSDV2 ? eUSDV2 : peUSD;
            uint a = Math.min(token.allowance(order.maker, address(this)), token.balanceOf(order.maker));
            return Math.min(order.remainingAmount, a);
        }
    }

    function batchCheckOrderValidAmount(uint256[] memory ids) external view returns(uint256[] memory, uint256[] memory) {
        uint256[] memory numbers = new uint[](ids.length);
        uint256[] memory prices = new uint[](ids.length);
        for(uint i = 0; i < ids.length; i++) {
            numbers[i] = checkOrderValidAmount(ids[i]);
            prices[i] =  orders[ids[i]].price;
        }
        return (numbers, prices);
    }

    function getOrders(uint256[] memory ids) external view returns(Order[] memory) {
        Order[] memory returnOrders = new Order[](ids.length);
        for(uint i = 0; i < ids.length; i++) {
            returnOrders[i] = orders[ids[i]];
        }
        return returnOrders;
    }
}

File 2 of 3 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     */
    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 subtraction of two unsigned integers, with an overflow flag.
     */
    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.
     */
    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.
     */
    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.
     */
    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 largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
     * denominator == 0.
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
     * Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0 = x * y; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.
            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.

            uint256 twos = denominator & (0 - denominator);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
            // works in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
     * towards zero.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
        }
    }

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}

File 3 of 3 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` 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 value) external returns (bool);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"bool","name":"isActive","type":"bool"},{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"}],"name":"AdjustOrder","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"enum LybraOrder.TokenType","name":"tokenType","type":"uint8"},{"indexed":true,"internalType":"bool","name":"buyOrSale","type":"bool"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"remainingAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"}],"name":"MakeOrder","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"taker","type":"address"},{"indexed":true,"internalType":"enum LybraOrder.TokenType","name":"tokenType","type":"uint8"},{"indexed":true,"internalType":"bool","name":"buyOrSale","type":"bool"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"}],"name":"TakeOrder","type":"event"},{"inputs":[],"name":"USDC","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"orderId","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"isActive","type":"bool"}],"name":"adjustOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"batchCheckOrderValidAmount","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"components":[{"internalType":"address","name":"maker","type":"address"},{"internalType":"enum LybraOrder.TokenType","name":"tokenType","type":"uint8"},{"internalType":"bool","name":"buyOrSale","type":"bool"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"remainingAmount","type":"uint256"},{"internalType":"bool","name":"isActive","type":"bool"}],"internalType":"struct LybraOrder.Order","name":"order","type":"tuple"}],"name":"batchTake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"taker","type":"address"},{"internalType":"uint256","name":"orderId","type":"uint256"},{"internalType":"uint256","name":"takeAmount","type":"uint256"}],"name":"checkOrder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"orderId","type":"uint256"}],"name":"checkOrderValidAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eUSDV1","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eUSDV2","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"getOrders","outputs":[{"components":[{"internalType":"address","name":"maker","type":"address"},{"internalType":"enum LybraOrder.TokenType","name":"tokenType","type":"uint8"},{"internalType":"bool","name":"buyOrSale","type":"bool"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"remainingAmount","type":"uint256"},{"internalType":"bool","name":"isActive","type":"bool"}],"internalType":"struct LybraOrder.Order[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum LybraOrder.TokenType","name":"tokenType","type":"uint8"},{"internalType":"bool","name":"buyOrSale","type":"bool"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"totalAmount","type":"uint256"}],"name":"makeOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"orders","outputs":[{"internalType":"address","name":"maker","type":"address"},{"internalType":"enum LybraOrder.TokenType","name":"tokenType","type":"uint8"},{"internalType":"bool","name":"buyOrSale","type":"bool"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"remainingAmount","type":"uint256"},{"internalType":"bool","name":"isActive","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"peUSD","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"orderId","type":"uint256"},{"internalType":"uint256","name":"takeAmount","type":"uint256"}],"name":"takeOrder","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040525f80546001600160a01b03199081167397de57ec338ab5d51557da3434828c5dbfada3711790915560018054821673df3ac4f479375802a821f7b7b46cd7eb5e4262cc17905560028054821673d585aaafa2b58b1cd75092b51ade9fa4ce52f2471790556003805490911673a0b86991c6218b36c1d19d4a2e9eb0ce3606eb481790553480156091575f80fd5b50611f018061009f5f395ff3fe608060405234801561000f575f80fd5b50600436106100cb575f3560e01c806376f5528c116100885780638ddb1224116100635780638ddb1224146101c7578063a85c38ef146101e8578063c4e01a381461020d578063d562a21c14610220575f80fd5b806376f5528c146101815780637beef374146101a257806389a30271146101b4575f80fd5b806303652027146100cf57806307ebe5dd146100f85780632eab93cb1461011b57806339db709f146101305780634387699a1461015b578063589f58991461016e575b5f80fd5b6100e26100dd366004611a76565b610233565b6040516100ef9190611adc565b60405180910390f35b61010b610106366004611b84565b6103b0565b60405190151581526020016100ef565b61012e610129366004611bb4565b61095f565b005b600154610143906001600160a01b031681565b6040516001600160a01b0390911681526020016100ef565b61012e610169366004611bf2565b61096e565b61012e61017c366004611ccd565b610b9f565b61019461018f366004611d0e565b610bb2565b6040519081526020016100ef565b5f54610143906001600160a01b031681565b600354610143906001600160a01b031681565b6101da6101d5366004611a76565b610f2a565b6040516100ef929190611d5f565b6101fb6101f6366004611d0e565b611072565b6040516100ef96959493929190611d83565b61012e61021b366004611dc6565b6110ca565b600254610143906001600160a01b031681565b60605f825167ffffffffffffffff8111156102505761025061199e565b6040519080825280602002602001820160405280156102ae57816020015b6040805160c0810182525f8082526020808301829052928201819052606082018190526080820181905260a082015282525f1990920191018161026e5790505b5090505f5b83518110156103a95760048482815181106102d0576102d0611e04565b6020026020010151815481106102e8576102e8611e04565b5f9182526020918290206040805160c0810190915260049092020180546001600160a01b0381168352919290919083019060ff600160a01b90910416600281111561033557610335611aa8565b600281111561034657610346611aa8565b8152815460ff600160a81b90910481161515602083015260018301546040830152600283015460608301526003909201549091161515608090910152825183908390811061039657610396611e04565b60209081029190910101526001016102b3565b5092915050565b5f80600484815481106103c5576103c5611e04565b5f9182526020918290206040805160c0810190915260049092020180546001600160a01b0381168352919290919083019060ff600160a01b90910416600281111561041257610412611aa8565b600281111561042357610423611aa8565b8152815460ff600160a81b9091048116151560208301526001830154604083015260028301546060830152600390920154909116151560809091015260a081015190915015806104765750828160800151105b15610484575f915050610958565b5f808260200151600281111561049c5761049c611aa8565b146104e0576001826020015160028111156104b9576104b9611aa8565b146104cf576002546001600160a01b03166104ec565b6001546001600160a01b03166104ec565b5f546001600160a01b03165b905081604001511561072757604051636eb1769f60e11b81526001600160a01b03878116600483015230602483015285919083169063dd62ed3e90604401602060405180830381865afa158015610545573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105699190611e18565b10806105dd57506040516370a0823160e01b81526001600160a01b0387811660048301528591908316906370a0823190602401602060405180830381865afa1580156105b7573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105db9190611e18565b105b8061067b5750670de0b6b3a76400008260600151856105fc9190611e43565b6106069190611e5a565b6003548351604051636eb1769f60e11b81526001600160a01b03918216600482015230602482015291169063dd62ed3e90604401602060405180830381865afa158015610655573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106799190611e18565b105b806107135750670de0b6b3a764000082606001518561069a9190611e43565b6106a49190611e5a565b60035483516040516370a0823160e01b81526001600160a01b0391821660048201529116906370a0823190602401602060405180830381865afa1580156106ed573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107119190611e18565b105b15610722575f92505050610958565b610951565b670de0b6b3a76400008260600151856107409190611e43565b61074a9190611e5a565b600354604051636eb1769f60e11b81526001600160a01b0389811660048301523060248301529091169063dd62ed3e90604401602060405180830381865afa158015610798573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107bc9190611e18565b10806108545750670de0b6b3a76400008260600151856107dc9190611e43565b6107e69190611e5a565b6003546040516370a0823160e01b81526001600160a01b038981166004830152909116906370a0823190602401602060405180830381865afa15801561082e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108529190611e18565b105b806108ce57508151604051636eb1769f60e11b81526001600160a01b039182166004820152306024820152859183169063dd62ed3e90604401602060405180830381865afa1580156108a8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108cc9190611e18565b105b80610942575081516040516370a0823160e01b81526001600160a01b03918216600482015285918316906370a0823190602401602060405180830381865afa15801561091c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109409190611e18565b105b15610951575f92505050610958565b6001925050505b9392505050565b61096a3383836112ed565b5050565b5f5b8351811015610b7257600484828151811061098d5761098d611e04565b6020026020010151815481106109a5576109a5611e04565b5f918252602090912060049091020154600160a01b900460ff1660028111156109d0576109d0611aa8565b826020015160028111156109e6576109e6611aa8565b03610b6a5760048482815181106109ff576109ff611e04565b602002602001015181548110610a1757610a17611e04565b905f5260205f2090600402015f0160159054906101000a900460ff161515826040015115150315610b6a5781604001518015610a91575081606001516004858381518110610a6757610a67611e04565b602002602001015181548110610a7f57610a7f611e04565b905f5260205f20906004020160010154115b80610ae757508160400151158015610ae7575081606001516004858381518110610abd57610abd611e04565b602002602001015181548110610ad557610ad5611e04565b905f5260205f20906004020160010154105b610b6a57610b2833858381518110610b0157610b01611e04565b6020026020010151858481518110610b1b57610b1b611e04565b60200260200101516103b0565b15610b6a57610b6a33858381518110610b4357610b43611e04565b6020026020010151858481518110610b5d57610b5d611e04565b60200260200101516112ed565b600101610970565b50608081015115610b9a57610b9a3382602001518360400151846060015185608001516117b9565b505050565b610bac33858585856117b9565b50505050565b5f8060048381548110610bc757610bc7611e04565b5f9182526020918290206040805160c0810190915260049092020180546001600160a01b0381168352919290919083019060ff600160a01b909104166002811115610c1457610c14611aa8565b6002811115610c2557610c25611aa8565b8152815460ff600160a81b9091048116151560208301526001830154604083015260028301546060830152600390920154909116151560809091015260a0810151909150610c7557505f92915050565b806040015115610dc55760608101516003548251604051636eb1769f60e11b81526001600160a01b0391821660048201523060248201525f93610dad939092169063dd62ed3e90604401602060405180830381865afa158015610cda573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cfe9190611e18565b610d1090670de0b6b3a7640000611e43565b610d1a9190611e5a565b606084015160035485516040516370a0823160e01b81526001600160a01b0391821660048201529116906370a0823190602401602060405180830381865afa158015610d68573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d8c9190611e18565b610d9e90670de0b6b3a7640000611e43565b610da89190611e5a565b611985565b9050610dbd826080015182611985565b949350505050565b5f8082602001516002811115610ddd57610ddd611aa8565b14610e2157600182602001516002811115610dfa57610dfa611aa8565b14610e10576002546001600160a01b0316610e2d565b6001546001600160a01b0316610e2d565b5f546001600160a01b03165b8251604051636eb1769f60e11b81526001600160a01b0391821660048201523060248201529192505f91610f119184169063dd62ed3e90604401602060405180830381865afa158015610e82573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ea69190611e18565b84516040516370a0823160e01b81526001600160a01b039182166004820152908516906370a0823190602401602060405180830381865afa158015610eed573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610da89190611e18565b9050610f21836080015182611985565b95945050505050565b6060805f835167ffffffffffffffff811115610f4857610f4861199e565b604051908082528060200260200182016040528015610f71578160200160208202803683370190505b5090505f845167ffffffffffffffff811115610f8f57610f8f61199e565b604051908082528060200260200182016040528015610fb8578160200160208202803683370190505b5090505f5b855181101561106757610fe8868281518110610fdb57610fdb611e04565b6020026020010151610bb2565b838281518110610ffa57610ffa611e04565b602002602001018181525050600486828151811061101a5761101a611e04565b60200260200101518154811061103257611032611e04565b905f5260205f2090600402016001015482828151811061105457611054611e04565b6020908102919091010152600101610fbd565b509094909350915050565b60048181548110611081575f80fd5b5f91825260209091206004909102018054600182015460028301546003909301546001600160a01b038316945060ff600160a01b8404811694600160a81b909404811693911686565b5f600485815481106110de576110de611e04565b5f9182526020918290206040805160c0810190915260049092020180546001600160a01b0381168352919290919083019060ff600160a01b90910416600281111561112b5761112b611aa8565b600281111561113c5761113c611aa8565b8152815460ff600160a81b9091048116151560208301526001830154604083015260028301546060830152600390920154909116151560809091015280519091506001600160a01b031633146111be5760405162461bcd60e51b81526020600482015260026024820152614e4160f01b60448201526064015b60405180910390fd5b606081018490526080810183905281151560a082015260048054829190879081106111eb576111eb611e04565b5f918252602091829020835160049092020180546001600160a01b039092166001600160a01b0319831681178255928401519092909183916001600160a81b031990911617600160a01b83600281111561124757611247611aa8565b0217905550604082810151825460ff60a81b1916600160a81b911515919091021782556060808401516001840155608080850151600285015560a0909401516003909301805460ff19169315159390931790925580518881526020810188905290810186905242918101919091528315159133917f6bfb30252e66e837aeeb246382f8d11515425f19b39e34d9702f121f6762592e910160405180910390a35050505050565b5f6004838154811061130157611301611e04565b5f9182526020918290206040805160c0810190915260049092020180546001600160a01b0381168352919290919083019060ff600160a01b90910416600281111561134e5761134e611aa8565b600281111561135f5761135f611aa8565b8152815460ff600160a81b9091048116151560208301526001830154604083015260028301546060830152600390920154909116151560809091015260a081015190915080156113b3575081816080015110155b6113e45760405162461bcd60e51b81526020600482015260026024820152614e4160f01b60448201526064016111b5565b5f80826020015160028111156113fc576113fc611aa8565b146114405760018260200151600281111561141957611419611aa8565b1461142f576002546001600160a01b031661144c565b6001546001600160a01b031661144c565b5f546001600160a01b03165b90505f8083604001511561156f5783516040516323b872dd60e01b81526001600160a01b038516916323b872dd9161148a918b918a90600401611e79565b6020604051808303815f875af11580156114a6573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114ca9190611e9d565b600354855160608701519294506001600160a01b03909116916323b872dd91908a90670de0b6b3a764000090611500908b611e43565b61150a9190611e5a565b6040518463ffffffff1660e01b815260040161152893929190611e79565b6020604051808303815f875af1158015611544573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115689190611e9d565b905061167f565b600354845160608601516001600160a01b03909216916323b872dd918a91670de0b6b3a7640000906115a1908b611e43565b6115ab9190611e5a565b6040518463ffffffff1660e01b81526004016115c993929190611e79565b6020604051808303815f875af11580156115e5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116099190611e9d565b84516040516323b872dd60e01b81529193506001600160a01b038516916323b872dd9161163c918b908a90600401611e79565b6020604051808303815f875af1158015611658573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061167c9190611e9d565b90505b8180156116895750805b6116ba5760405162461bcd60e51b81526020600482015260026024820152612a2360f11b60448201526064016111b5565b84600487815481106116ce576116ce611e04565b905f5260205f2090600402016002015f8282546116eb9190611eb8565b90915550506080840151859003611732575f6004878154811061171057611710611e04565b5f9182526020909120600490910201600301805460ff19169115159190911790555b836040015115158460200151600281111561174f5761174f611aa8565b886001600160a01b03167f21b201a72ae75574ff32c9d2f59a4f66fee316f9ab27dcde17ea67570982b3e18988606001518a426040516117a8949392919093845260208401929092526040830152606082015260800190565b60405180910390a450505050505050565b6207a12082101580156117cf5750621e84808211155b6118005760405162461bcd60e51b815260206004820152600260248201526127a960f11b60448201526064016111b5565b60046040518060c00160405280876001600160a01b0316815260200186600281111561182e5761182e611aa8565b8152851515602080830191909152604082018690526060820185905260016080909201829052835491820184555f93845292839020825160049092020180546001600160a01b031981166001600160a01b03909316928317825593830151929390929183916001600160a81b03191617600160a01b8360028111156118b5576118b5611aa8565b02179055506040820151815460ff60a81b1916600160a81b9115159190910217815560608201516001820155608082015160028083019190915560a0909201516003909101805460ff191691151591909117905583151590859081111561191e5761191e611aa8565b6004546001600160a01b038816907f1f09d64b9665385888a918b10c2a5a47ef1bb40b4697bfdb0f4d6ab60b0d09d59061195a90600190611eb8565b6040805191825260208201889052810186905242606082015260800160405180910390a45050505050565b5f8183106119935781611995565b825b90505b92915050565b634e487b7160e01b5f52604160045260245ffd5b60405160c0810167ffffffffffffffff811182821017156119d5576119d561199e565b60405290565b5f82601f8301126119ea575f80fd5b8135602067ffffffffffffffff80831115611a0757611a0761199e565b8260051b604051601f19603f83011681018181108482111715611a2c57611a2c61199e565b6040529384526020818701810194908101925087851115611a4b575f80fd5b6020870191505b84821015611a6b57813583529183019190830190611a52565b979650505050505050565b5f60208284031215611a86575f80fd5b813567ffffffffffffffff811115611a9c575f80fd5b610dbd848285016119db565b634e487b7160e01b5f52602160045260245ffd5b60038110611ad857634e487b7160e01b5f52602160045260245ffd5b9052565b602080825282518282018190525f919060409081850190868401855b82811015611b5c57815180516001600160a01b0316855286810151611b1f88870182611abc565b5080860151151585870152606080820151908601526080808201519086015260a09081015115159085015260c09093019290850190600101611af8565b5091979650505050505050565b80356001600160a01b0381168114611b7f575f80fd5b919050565b5f805f60608486031215611b96575f80fd5b611b9f84611b69565b95602085013595506040909401359392505050565b5f8060408385031215611bc5575f80fd5b50508035926020909101359150565b803560038110611b7f575f80fd5b8015158114611bef575f80fd5b50565b5f805f838503610100811215611c06575f80fd5b843567ffffffffffffffff80821115611c1d575f80fd5b611c29888389016119db565b95506020870135915080821115611c3e575f80fd5b50611c4b878288016119db565b93505060c0603f1982011215611c5f575f80fd5b50611c686119b2565b611c7460408601611b69565b8152611c8260608601611bd4565b60208201526080850135611c9581611be2565b604082015260a0850135606082015260c0850135608082015260e0850135611cbc81611be2565b60a082015292959194509192509050565b5f805f8060808587031215611ce0575f80fd5b611ce985611bd4565b93506020850135611cf981611be2565b93969395505050506040820135916060013590565b5f60208284031215611d1e575f80fd5b5035919050565b5f815180845260208085019450602084015f5b83811015611d5457815187529582019590820190600101611d38565b509495945050505050565b604081525f611d716040830185611d25565b8281036020840152610f218185611d25565b6001600160a01b038716815260c08101611da06020830188611abc565b941515604082015260608101939093526080830191909152151560a09091015292915050565b5f805f8060808587031215611dd9575f80fd5b8435935060208501359250604085013591506060850135611df981611be2565b939692955090935050565b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215611e28575f80fd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b808202811582820484141761199857611998611e2f565b5f82611e7457634e487b7160e01b5f52601260045260245ffd5b500490565b6001600160a01b039384168152919092166020820152604081019190915260600190565b5f60208284031215611ead575f80fd5b815161095881611be2565b8181038181111561199857611998611e2f56fea2646970667358221220904e8aee9ff222ae012c11532c9720b3fd993245c34c4ed419ee709a3d7a612464736f6c63430008190033

Deployed Bytecode

0x608060405234801561000f575f80fd5b50600436106100cb575f3560e01c806376f5528c116100885780638ddb1224116100635780638ddb1224146101c7578063a85c38ef146101e8578063c4e01a381461020d578063d562a21c14610220575f80fd5b806376f5528c146101815780637beef374146101a257806389a30271146101b4575f80fd5b806303652027146100cf57806307ebe5dd146100f85780632eab93cb1461011b57806339db709f146101305780634387699a1461015b578063589f58991461016e575b5f80fd5b6100e26100dd366004611a76565b610233565b6040516100ef9190611adc565b60405180910390f35b61010b610106366004611b84565b6103b0565b60405190151581526020016100ef565b61012e610129366004611bb4565b61095f565b005b600154610143906001600160a01b031681565b6040516001600160a01b0390911681526020016100ef565b61012e610169366004611bf2565b61096e565b61012e61017c366004611ccd565b610b9f565b61019461018f366004611d0e565b610bb2565b6040519081526020016100ef565b5f54610143906001600160a01b031681565b600354610143906001600160a01b031681565b6101da6101d5366004611a76565b610f2a565b6040516100ef929190611d5f565b6101fb6101f6366004611d0e565b611072565b6040516100ef96959493929190611d83565b61012e61021b366004611dc6565b6110ca565b600254610143906001600160a01b031681565b60605f825167ffffffffffffffff8111156102505761025061199e565b6040519080825280602002602001820160405280156102ae57816020015b6040805160c0810182525f8082526020808301829052928201819052606082018190526080820181905260a082015282525f1990920191018161026e5790505b5090505f5b83518110156103a95760048482815181106102d0576102d0611e04565b6020026020010151815481106102e8576102e8611e04565b5f9182526020918290206040805160c0810190915260049092020180546001600160a01b0381168352919290919083019060ff600160a01b90910416600281111561033557610335611aa8565b600281111561034657610346611aa8565b8152815460ff600160a81b90910481161515602083015260018301546040830152600283015460608301526003909201549091161515608090910152825183908390811061039657610396611e04565b60209081029190910101526001016102b3565b5092915050565b5f80600484815481106103c5576103c5611e04565b5f9182526020918290206040805160c0810190915260049092020180546001600160a01b0381168352919290919083019060ff600160a01b90910416600281111561041257610412611aa8565b600281111561042357610423611aa8565b8152815460ff600160a81b9091048116151560208301526001830154604083015260028301546060830152600390920154909116151560809091015260a081015190915015806104765750828160800151105b15610484575f915050610958565b5f808260200151600281111561049c5761049c611aa8565b146104e0576001826020015160028111156104b9576104b9611aa8565b146104cf576002546001600160a01b03166104ec565b6001546001600160a01b03166104ec565b5f546001600160a01b03165b905081604001511561072757604051636eb1769f60e11b81526001600160a01b03878116600483015230602483015285919083169063dd62ed3e90604401602060405180830381865afa158015610545573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105699190611e18565b10806105dd57506040516370a0823160e01b81526001600160a01b0387811660048301528591908316906370a0823190602401602060405180830381865afa1580156105b7573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105db9190611e18565b105b8061067b5750670de0b6b3a76400008260600151856105fc9190611e43565b6106069190611e5a565b6003548351604051636eb1769f60e11b81526001600160a01b03918216600482015230602482015291169063dd62ed3e90604401602060405180830381865afa158015610655573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106799190611e18565b105b806107135750670de0b6b3a764000082606001518561069a9190611e43565b6106a49190611e5a565b60035483516040516370a0823160e01b81526001600160a01b0391821660048201529116906370a0823190602401602060405180830381865afa1580156106ed573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107119190611e18565b105b15610722575f92505050610958565b610951565b670de0b6b3a76400008260600151856107409190611e43565b61074a9190611e5a565b600354604051636eb1769f60e11b81526001600160a01b0389811660048301523060248301529091169063dd62ed3e90604401602060405180830381865afa158015610798573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107bc9190611e18565b10806108545750670de0b6b3a76400008260600151856107dc9190611e43565b6107e69190611e5a565b6003546040516370a0823160e01b81526001600160a01b038981166004830152909116906370a0823190602401602060405180830381865afa15801561082e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108529190611e18565b105b806108ce57508151604051636eb1769f60e11b81526001600160a01b039182166004820152306024820152859183169063dd62ed3e90604401602060405180830381865afa1580156108a8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108cc9190611e18565b105b80610942575081516040516370a0823160e01b81526001600160a01b03918216600482015285918316906370a0823190602401602060405180830381865afa15801561091c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109409190611e18565b105b15610951575f92505050610958565b6001925050505b9392505050565b61096a3383836112ed565b5050565b5f5b8351811015610b7257600484828151811061098d5761098d611e04565b6020026020010151815481106109a5576109a5611e04565b5f918252602090912060049091020154600160a01b900460ff1660028111156109d0576109d0611aa8565b826020015160028111156109e6576109e6611aa8565b03610b6a5760048482815181106109ff576109ff611e04565b602002602001015181548110610a1757610a17611e04565b905f5260205f2090600402015f0160159054906101000a900460ff161515826040015115150315610b6a5781604001518015610a91575081606001516004858381518110610a6757610a67611e04565b602002602001015181548110610a7f57610a7f611e04565b905f5260205f20906004020160010154115b80610ae757508160400151158015610ae7575081606001516004858381518110610abd57610abd611e04565b602002602001015181548110610ad557610ad5611e04565b905f5260205f20906004020160010154105b610b6a57610b2833858381518110610b0157610b01611e04565b6020026020010151858481518110610b1b57610b1b611e04565b60200260200101516103b0565b15610b6a57610b6a33858381518110610b4357610b43611e04565b6020026020010151858481518110610b5d57610b5d611e04565b60200260200101516112ed565b600101610970565b50608081015115610b9a57610b9a3382602001518360400151846060015185608001516117b9565b505050565b610bac33858585856117b9565b50505050565b5f8060048381548110610bc757610bc7611e04565b5f9182526020918290206040805160c0810190915260049092020180546001600160a01b0381168352919290919083019060ff600160a01b909104166002811115610c1457610c14611aa8565b6002811115610c2557610c25611aa8565b8152815460ff600160a81b9091048116151560208301526001830154604083015260028301546060830152600390920154909116151560809091015260a0810151909150610c7557505f92915050565b806040015115610dc55760608101516003548251604051636eb1769f60e11b81526001600160a01b0391821660048201523060248201525f93610dad939092169063dd62ed3e90604401602060405180830381865afa158015610cda573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cfe9190611e18565b610d1090670de0b6b3a7640000611e43565b610d1a9190611e5a565b606084015160035485516040516370a0823160e01b81526001600160a01b0391821660048201529116906370a0823190602401602060405180830381865afa158015610d68573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d8c9190611e18565b610d9e90670de0b6b3a7640000611e43565b610da89190611e5a565b611985565b9050610dbd826080015182611985565b949350505050565b5f8082602001516002811115610ddd57610ddd611aa8565b14610e2157600182602001516002811115610dfa57610dfa611aa8565b14610e10576002546001600160a01b0316610e2d565b6001546001600160a01b0316610e2d565b5f546001600160a01b03165b8251604051636eb1769f60e11b81526001600160a01b0391821660048201523060248201529192505f91610f119184169063dd62ed3e90604401602060405180830381865afa158015610e82573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ea69190611e18565b84516040516370a0823160e01b81526001600160a01b039182166004820152908516906370a0823190602401602060405180830381865afa158015610eed573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610da89190611e18565b9050610f21836080015182611985565b95945050505050565b6060805f835167ffffffffffffffff811115610f4857610f4861199e565b604051908082528060200260200182016040528015610f71578160200160208202803683370190505b5090505f845167ffffffffffffffff811115610f8f57610f8f61199e565b604051908082528060200260200182016040528015610fb8578160200160208202803683370190505b5090505f5b855181101561106757610fe8868281518110610fdb57610fdb611e04565b6020026020010151610bb2565b838281518110610ffa57610ffa611e04565b602002602001018181525050600486828151811061101a5761101a611e04565b60200260200101518154811061103257611032611e04565b905f5260205f2090600402016001015482828151811061105457611054611e04565b6020908102919091010152600101610fbd565b509094909350915050565b60048181548110611081575f80fd5b5f91825260209091206004909102018054600182015460028301546003909301546001600160a01b038316945060ff600160a01b8404811694600160a81b909404811693911686565b5f600485815481106110de576110de611e04565b5f9182526020918290206040805160c0810190915260049092020180546001600160a01b0381168352919290919083019060ff600160a01b90910416600281111561112b5761112b611aa8565b600281111561113c5761113c611aa8565b8152815460ff600160a81b9091048116151560208301526001830154604083015260028301546060830152600390920154909116151560809091015280519091506001600160a01b031633146111be5760405162461bcd60e51b81526020600482015260026024820152614e4160f01b60448201526064015b60405180910390fd5b606081018490526080810183905281151560a082015260048054829190879081106111eb576111eb611e04565b5f918252602091829020835160049092020180546001600160a01b039092166001600160a01b0319831681178255928401519092909183916001600160a81b031990911617600160a01b83600281111561124757611247611aa8565b0217905550604082810151825460ff60a81b1916600160a81b911515919091021782556060808401516001840155608080850151600285015560a0909401516003909301805460ff19169315159390931790925580518881526020810188905290810186905242918101919091528315159133917f6bfb30252e66e837aeeb246382f8d11515425f19b39e34d9702f121f6762592e910160405180910390a35050505050565b5f6004838154811061130157611301611e04565b5f9182526020918290206040805160c0810190915260049092020180546001600160a01b0381168352919290919083019060ff600160a01b90910416600281111561134e5761134e611aa8565b600281111561135f5761135f611aa8565b8152815460ff600160a81b9091048116151560208301526001830154604083015260028301546060830152600390920154909116151560809091015260a081015190915080156113b3575081816080015110155b6113e45760405162461bcd60e51b81526020600482015260026024820152614e4160f01b60448201526064016111b5565b5f80826020015160028111156113fc576113fc611aa8565b146114405760018260200151600281111561141957611419611aa8565b1461142f576002546001600160a01b031661144c565b6001546001600160a01b031661144c565b5f546001600160a01b03165b90505f8083604001511561156f5783516040516323b872dd60e01b81526001600160a01b038516916323b872dd9161148a918b918a90600401611e79565b6020604051808303815f875af11580156114a6573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114ca9190611e9d565b600354855160608701519294506001600160a01b03909116916323b872dd91908a90670de0b6b3a764000090611500908b611e43565b61150a9190611e5a565b6040518463ffffffff1660e01b815260040161152893929190611e79565b6020604051808303815f875af1158015611544573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115689190611e9d565b905061167f565b600354845160608601516001600160a01b03909216916323b872dd918a91670de0b6b3a7640000906115a1908b611e43565b6115ab9190611e5a565b6040518463ffffffff1660e01b81526004016115c993929190611e79565b6020604051808303815f875af11580156115e5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116099190611e9d565b84516040516323b872dd60e01b81529193506001600160a01b038516916323b872dd9161163c918b908a90600401611e79565b6020604051808303815f875af1158015611658573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061167c9190611e9d565b90505b8180156116895750805b6116ba5760405162461bcd60e51b81526020600482015260026024820152612a2360f11b60448201526064016111b5565b84600487815481106116ce576116ce611e04565b905f5260205f2090600402016002015f8282546116eb9190611eb8565b90915550506080840151859003611732575f6004878154811061171057611710611e04565b5f9182526020909120600490910201600301805460ff19169115159190911790555b836040015115158460200151600281111561174f5761174f611aa8565b886001600160a01b03167f21b201a72ae75574ff32c9d2f59a4f66fee316f9ab27dcde17ea67570982b3e18988606001518a426040516117a8949392919093845260208401929092526040830152606082015260800190565b60405180910390a450505050505050565b6207a12082101580156117cf5750621e84808211155b6118005760405162461bcd60e51b815260206004820152600260248201526127a960f11b60448201526064016111b5565b60046040518060c00160405280876001600160a01b0316815260200186600281111561182e5761182e611aa8565b8152851515602080830191909152604082018690526060820185905260016080909201829052835491820184555f93845292839020825160049092020180546001600160a01b031981166001600160a01b03909316928317825593830151929390929183916001600160a81b03191617600160a01b8360028111156118b5576118b5611aa8565b02179055506040820151815460ff60a81b1916600160a81b9115159190910217815560608201516001820155608082015160028083019190915560a0909201516003909101805460ff191691151591909117905583151590859081111561191e5761191e611aa8565b6004546001600160a01b038816907f1f09d64b9665385888a918b10c2a5a47ef1bb40b4697bfdb0f4d6ab60b0d09d59061195a90600190611eb8565b6040805191825260208201889052810186905242606082015260800160405180910390a45050505050565b5f8183106119935781611995565b825b90505b92915050565b634e487b7160e01b5f52604160045260245ffd5b60405160c0810167ffffffffffffffff811182821017156119d5576119d561199e565b60405290565b5f82601f8301126119ea575f80fd5b8135602067ffffffffffffffff80831115611a0757611a0761199e565b8260051b604051601f19603f83011681018181108482111715611a2c57611a2c61199e565b6040529384526020818701810194908101925087851115611a4b575f80fd5b6020870191505b84821015611a6b57813583529183019190830190611a52565b979650505050505050565b5f60208284031215611a86575f80fd5b813567ffffffffffffffff811115611a9c575f80fd5b610dbd848285016119db565b634e487b7160e01b5f52602160045260245ffd5b60038110611ad857634e487b7160e01b5f52602160045260245ffd5b9052565b602080825282518282018190525f919060409081850190868401855b82811015611b5c57815180516001600160a01b0316855286810151611b1f88870182611abc565b5080860151151585870152606080820151908601526080808201519086015260a09081015115159085015260c09093019290850190600101611af8565b5091979650505050505050565b80356001600160a01b0381168114611b7f575f80fd5b919050565b5f805f60608486031215611b96575f80fd5b611b9f84611b69565b95602085013595506040909401359392505050565b5f8060408385031215611bc5575f80fd5b50508035926020909101359150565b803560038110611b7f575f80fd5b8015158114611bef575f80fd5b50565b5f805f838503610100811215611c06575f80fd5b843567ffffffffffffffff80821115611c1d575f80fd5b611c29888389016119db565b95506020870135915080821115611c3e575f80fd5b50611c4b878288016119db565b93505060c0603f1982011215611c5f575f80fd5b50611c686119b2565b611c7460408601611b69565b8152611c8260608601611bd4565b60208201526080850135611c9581611be2565b604082015260a0850135606082015260c0850135608082015260e0850135611cbc81611be2565b60a082015292959194509192509050565b5f805f8060808587031215611ce0575f80fd5b611ce985611bd4565b93506020850135611cf981611be2565b93969395505050506040820135916060013590565b5f60208284031215611d1e575f80fd5b5035919050565b5f815180845260208085019450602084015f5b83811015611d5457815187529582019590820190600101611d38565b509495945050505050565b604081525f611d716040830185611d25565b8281036020840152610f218185611d25565b6001600160a01b038716815260c08101611da06020830188611abc565b941515604082015260608101939093526080830191909152151560a09091015292915050565b5f805f8060808587031215611dd9575f80fd5b8435935060208501359250604085013591506060850135611df981611be2565b939692955090935050565b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215611e28575f80fd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b808202811582820484141761199857611998611e2f565b5f82611e7457634e487b7160e01b5f52601260045260245ffd5b500490565b6001600160a01b039384168152919092166020820152604081019190915260600190565b5f60208284031215611ead575f80fd5b815161095881611be2565b8181038181111561199857611998611e2f56fea2646970667358221220904e8aee9ff222ae012c11532c9720b3fd993245c34c4ed419ee709a3d7a612464736f6c63430008190033

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.