More Info
Private Name Tags
ContractCreator
Multichain Info
No addresses found
Latest 25 from a total of 74 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Withdraw | 20590835 | 205 days ago | IN | 0 ETH | 0.00008236 | ||||
Withdraw | 20379331 | 234 days ago | IN | 0 ETH | 0.0002037 | ||||
Transfer Ownersh... | 20336639 | 240 days ago | IN | 0 ETH | 0.00020577 | ||||
Set Min Amount | 20299317 | 245 days ago | IN | 0 ETH | 0.00008797 | ||||
Withdraw | 20025220 | 284 days ago | IN | 0 ETH | 0.00088013 | ||||
Withdraw | 20025134 | 284 days ago | IN | 0 ETH | 0.00119769 | ||||
Withdraw | 19733742 | 324 days ago | IN | 0 ETH | 0.00195624 | ||||
Withdraw | 19727069 | 325 days ago | IN | 0 ETH | 0.00074188 | ||||
Withdraw | 19727066 | 325 days ago | IN | 0 ETH | 0.00077254 | ||||
Withdraw | 19726988 | 325 days ago | IN | 0 ETH | 0.00074536 | ||||
Withdraw | 19726916 | 325 days ago | IN | 0 ETH | 0.00082422 | ||||
Set Min Amount | 19692202 | 330 days ago | IN | 0 ETH | 0.00028778 | ||||
Set Min Amount | 19692202 | 330 days ago | IN | 0 ETH | 0.00028778 | ||||
Set Min Amount | 19692202 | 330 days ago | IN | 0 ETH | 0.00028778 | ||||
Set Min Amount | 19692201 | 330 days ago | IN | 0 ETH | 0.000294 | ||||
Set Min Amount | 19692201 | 330 days ago | IN | 0 ETH | 0.000294 | ||||
Set Min Amount | 19692201 | 330 days ago | IN | 0 ETH | 0.0002939 | ||||
Set Max Amount | 19692200 | 330 days ago | IN | 0 ETH | 0.00029329 | ||||
Set Max Amount | 19692200 | 330 days ago | IN | 0 ETH | 0.00029329 | ||||
Set Max Amount | 19692200 | 330 days ago | IN | 0 ETH | 0.00029329 | ||||
Set Max Amount | 19692198 | 330 days ago | IN | 0 ETH | 0.00026749 | ||||
Set Max Amount | 19692198 | 330 days ago | IN | 0 ETH | 0.00026749 | ||||
Set Max Amount | 19692197 | 330 days ago | IN | 0 ETH | 0.00026818 | ||||
Set Fee Base | 19692196 | 330 days ago | IN | 0 ETH | 0.00026618 | ||||
Set Fee Base | 19692195 | 330 days ago | IN | 0 ETH | 0.00027381 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
Bridge
Compiler Version
v0.8.9+commit.e5eed63a
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "./Trustable.sol"; contract Bridge is Trustable { using EnumerableSet for EnumerableSet.UintSet; using SafeERC20 for ERC20; struct Order { uint256 id; uint16 tokenId; address sender; string target; uint256 amount; uint8 decimals; uint8 destination; } struct Token { ERC20 token; uint16 fee; uint256 feeBase; address feeTarget; uint256 minAmount; uint256 maxAmount; uint256 dailyLimit; uint256 bonus; uint8 decimals; } struct UserStats { uint256 transfered; uint256 limitFrom; } event OrderCreated(uint256 indexed id, Order order, uint256 fee); event OrderCompleted(uint256 indexed id, uint8 indexed dstFrom); uint256 nextOrderId = 0; uint16 tokensLength = 0; mapping(uint16 => Token) public tokens; mapping(uint16 => mapping(address => UserStats)) public stats; mapping(uint256 => Order) public orders; EnumerableSet.UintSet private orderIds; mapping(bytes32 => bool) public completed; EnumerableSet.UintSet private destinations; function setToken( uint16 tokenId, ERC20 token, uint16 fee, uint256 feeBase, address feeTarget, uint256 minAmount, uint256 maxAmount, uint256 dailyLimit, uint8 inputDecimals ) external onlyOwner { require(fee <= 10000, "invalid fee"); tokens[tokenId] = Token( token, fee, convertAmount(token, feeBase, inputDecimals), feeTarget, convertAmount(token, minAmount, inputDecimals), convertAmount(token, maxAmount, inputDecimals), convertAmount(token, dailyLimit, inputDecimals), 0, token.decimals() ); if (tokenId + 1 > tokensLength) { tokensLength = tokenId + 1; } } function convertAmount( ERC20 token, uint256 amount, uint256 decimals ) internal view returns (uint256) { return (amount * (10 ** token.decimals())) / (10 ** decimals); } function setFee(uint16 tokenId, uint16 fee) external onlyOwner { require(fee <= 10000, "invalid fee"); tokens[tokenId].fee = fee; } function setFeeBase( uint16 tokenId, uint256 feeBase, uint8 inputDecimals ) external onlyOwner { tokens[tokenId].feeBase = convertAmount( tokens[tokenId].token, feeBase, inputDecimals ); } function setFeeTarget(uint16 tokenId, address feeTarget) external onlyOwner { tokens[tokenId].feeTarget = feeTarget; } function setDailyLimit( uint16 tokenId, uint256 dailyLimit, uint8 inputDecimals ) external onlyOwner { tokens[tokenId].dailyLimit = convertAmount( tokens[tokenId].token, dailyLimit, inputDecimals ); } function setMinAmount( uint16 tokenId, uint256 minAmount, uint8 inputDecimals ) external onlyOwner { tokens[tokenId].minAmount = convertAmount( tokens[tokenId].token, minAmount, inputDecimals ); } function setMaxAmount( uint16 tokenId, uint256 maxAmount, uint8 inputDecimals ) external onlyOwner { tokens[tokenId].maxAmount = convertAmount( tokens[tokenId].token, maxAmount, inputDecimals ); } function setBonus(uint16 tokenId, uint256 bonus) external onlyOwner { tokens[tokenId].bonus = bonus; } function addDestinations(uint8[] calldata ids) external onlyOwner { for (uint256 i = 0; i < ids.length; i++) { destinations.add(ids[i]); } } function removeDestinations(uint8[] calldata ids) external onlyOwner { for (uint256 i = 0; i < ids.length; i++) { destinations.remove(ids[i]); } } function create( uint16 tokenId, uint256 amount, uint8 destination, string memory target ) external { require(destinations.contains(destination) == true, "destination not support"); Token storage tok = tokens[tokenId]; require(address(tok.token) != address(0), "unknown token"); require(amount >= tok.minAmount, "amount lower than mininum"); require(amount <= tok.maxAmount, "amount greater than mininum"); UserStats storage st = stats[tokenId][msg.sender]; bool lastIsOld = st.limitFrom + 24 hours < block.timestamp; if (lastIsOld) { st.limitFrom = block.timestamp; st.transfered = 0; } require(st.transfered + amount <= tok.dailyLimit, "daily limit exceed"); st.transfered += amount; uint256 feeAmount = tok.feeBase + (amount * tok.fee) / 10000; if (feeAmount > 0) { tok.token.safeTransferFrom(msg.sender, tok.feeTarget, feeAmount); } amount = amount - feeAmount; tok.token.safeTransferFrom(msg.sender, address(this), amount); orders[nextOrderId] = Order( nextOrderId, tokenId, msg.sender, target, amount, tok.token.decimals(), destination ); orderIds.add(nextOrderId); emit OrderCreated(nextOrderId, orders[nextOrderId], feeAmount); nextOrderId++; } function close(uint256 orderId) external onlyTrusted { orderIds.remove(orderId); } function completeOrder( uint256 orderId, uint8 dstFrom, uint16 tokenId, address payable to, uint256 amount, uint256 decimals ) external onlyTrusted { bytes32 orderHash = keccak256(abi.encodePacked(orderId, dstFrom)); require(completed[orderHash] == false, "already transfered"); Token storage tok = tokens[tokenId]; require(address(tok.token) != address(0), "unknown token"); tok.token.safeTransfer(to, convertAmount(tok.token, amount, decimals)); completed[orderHash] = true; uint256 bonus = Math.min(tok.bonus, address(this).balance); if (bonus > 0) { to.transfer(bonus); } emit OrderCompleted(orderId, dstFrom); } function withdraw( uint16 tokenId, address to, uint256 amount, uint8 inputDecimals ) external onlyTrusted { Token storage tok = tokens[tokenId]; tok.token.safeTransfer( to, convertAmount(tok.token, amount, inputDecimals) ); } function isCompleted(uint256 orderId, uint8 dstFrom) external view returns (bool) { return completed[keccak256(abi.encodePacked(orderId, dstFrom))]; } function listOrders() external view returns (Order[] memory) { Order[] memory list = new Order[](orderIds.length()); for (uint256 i = 0; i < orderIds.length(); i++) { list[i] = orders[orderIds.at(i)]; } return list; } function listTokensNames() external view returns (string[] memory) { string[] memory list = new string[](tokensLength); for (uint16 i = 0; i < tokensLength; i++) { if (address(tokens[i].token) != address(0)) { list[i] = tokens[i].token.symbol(); } } return list; } function getTokens() public view returns (Token[] memory) { Token[] memory list = new Token[](tokensLength); for (uint16 i = 0; i < tokensLength; i++) { if (address(tokens[i].token) != address(0)) { Token storage lToken = tokens[i]; list[i] = lToken; } } return list; } function getDestinations() public view returns (uint8[] memory) { uint256 size = destinations.length(); uint8[] memory list = new uint8[](size); for (uint16 i = 0; i < size; i++) { list[i] = uint8(destinations.at(i)); } return list; } receive() external payable {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; abstract contract Trustable is Ownable { mapping(address=>bool) public _isTrusted; modifier onlyTrusted { require(_isTrusted[msg.sender] || msg.sender == owner(), "not trusted"); _; } function addTrusted(address user) public onlyOwner { _isTrusted[user] = true; } function removeTrusted(address user) public onlyOwner { _isTrusted[user] = false; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @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 up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (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; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 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. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); 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 (rounding == Rounding.Up && 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 down. * * 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 + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * 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 + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * 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 + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * 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 10, 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 + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.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 functionCallWithValue(target, data, 0, "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"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or 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 { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // 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 /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.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)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @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"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @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 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
{ "remappings": [], "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "london", "libraries": {}, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"uint8","name":"dstFrom","type":"uint8"}],"name":"OrderCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint16","name":"tokenId","type":"uint16"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"string","name":"target","type":"string"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint8","name":"destination","type":"uint8"}],"indexed":false,"internalType":"struct Bridge.Order","name":"order","type":"tuple"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"OrderCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_isTrusted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8[]","name":"ids","type":"uint8[]"}],"name":"addDestinations","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"addTrusted","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"orderId","type":"uint256"}],"name":"close","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"orderId","type":"uint256"},{"internalType":"uint8","name":"dstFrom","type":"uint8"},{"internalType":"uint16","name":"tokenId","type":"uint16"},{"internalType":"address payable","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"decimals","type":"uint256"}],"name":"completeOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"completed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"tokenId","type":"uint16"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint8","name":"destination","type":"uint8"},{"internalType":"string","name":"target","type":"string"}],"name":"create","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getDestinations","outputs":[{"internalType":"uint8[]","name":"","type":"uint8[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokens","outputs":[{"components":[{"internalType":"contract ERC20","name":"token","type":"address"},{"internalType":"uint16","name":"fee","type":"uint16"},{"internalType":"uint256","name":"feeBase","type":"uint256"},{"internalType":"address","name":"feeTarget","type":"address"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"},{"internalType":"uint256","name":"dailyLimit","type":"uint256"},{"internalType":"uint256","name":"bonus","type":"uint256"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"internalType":"struct Bridge.Token[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"orderId","type":"uint256"},{"internalType":"uint8","name":"dstFrom","type":"uint8"}],"name":"isCompleted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"listOrders","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint16","name":"tokenId","type":"uint16"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"string","name":"target","type":"string"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint8","name":"destination","type":"uint8"}],"internalType":"struct Bridge.Order[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"listTokensNames","outputs":[{"internalType":"string[]","name":"","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"orders","outputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint16","name":"tokenId","type":"uint16"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"string","name":"target","type":"string"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint8","name":"destination","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8[]","name":"ids","type":"uint8[]"}],"name":"removeDestinations","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"removeTrusted","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"tokenId","type":"uint16"},{"internalType":"uint256","name":"bonus","type":"uint256"}],"name":"setBonus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"tokenId","type":"uint16"},{"internalType":"uint256","name":"dailyLimit","type":"uint256"},{"internalType":"uint8","name":"inputDecimals","type":"uint8"}],"name":"setDailyLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"tokenId","type":"uint16"},{"internalType":"uint16","name":"fee","type":"uint16"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"tokenId","type":"uint16"},{"internalType":"uint256","name":"feeBase","type":"uint256"},{"internalType":"uint8","name":"inputDecimals","type":"uint8"}],"name":"setFeeBase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"tokenId","type":"uint16"},{"internalType":"address","name":"feeTarget","type":"address"}],"name":"setFeeTarget","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"tokenId","type":"uint16"},{"internalType":"uint256","name":"maxAmount","type":"uint256"},{"internalType":"uint8","name":"inputDecimals","type":"uint8"}],"name":"setMaxAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"tokenId","type":"uint16"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint8","name":"inputDecimals","type":"uint8"}],"name":"setMinAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"tokenId","type":"uint16"},{"internalType":"contract ERC20","name":"token","type":"address"},{"internalType":"uint16","name":"fee","type":"uint16"},{"internalType":"uint256","name":"feeBase","type":"uint256"},{"internalType":"address","name":"feeTarget","type":"address"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"},{"internalType":"uint256","name":"dailyLimit","type":"uint256"},{"internalType":"uint8","name":"inputDecimals","type":"uint8"}],"name":"setToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"address","name":"","type":"address"}],"name":"stats","outputs":[{"internalType":"uint256","name":"transfered","type":"uint256"},{"internalType":"uint256","name":"limitFrom","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"tokens","outputs":[{"internalType":"contract ERC20","name":"token","type":"address"},{"internalType":"uint16","name":"fee","type":"uint16"},{"internalType":"uint256","name":"feeBase","type":"uint256"},{"internalType":"address","name":"feeTarget","type":"address"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"},{"internalType":"uint256","name":"dailyLimit","type":"uint256"},{"internalType":"uint256","name":"bonus","type":"uint256"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"tokenId","type":"uint16"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint8","name":"inputDecimals","type":"uint8"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
608060405260006002556003805461ffff1916905534801561002057600080fd5b5061002a3361002f565b61007f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b612d49806200008f6000396000f3fe6080604052600436106101c65760003560e01c8063aa6ca808116100f7578063d55e62a011610095578063f1a348fe11610064578063f1a348fe14610569578063f2fde38b14610589578063f3c20de0146105a9578063f6419d961461067857600080fd5b8063d55e62a0146104e9578063db65874914610509578063dd3705cc14610529578063e923cd9b1461054957600080fd5b8063b5caa2c0116100d1578063b5caa2c014610435578063d1ffa03914610489578063d4ad95d3146104a9578063d4d0d6e6146104c957600080fd5b8063aa6ca808146103d3578063afe6c89b146103f5578063b2017c091461041557600080fd5b806355f7c3811161016457806384a2ded41161013e57806384a2ded4146103385780638da5cb5b1461035857806399b64de114610380578063a85c38ef146103a057600080fd5b806355f7c381146102e15780635ba536bc14610301578063715018a61461032357600080fd5b8063277b08b4116101a0578063277b08b41461023f57806327e021e8146102615780633eb6be21146102915780633ffd402c146102b157600080fd5b80630aebeb4e146101d2578063176091f4146101f45780631c6045511461021f57600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed366004612160565b6106a8565b005b34801561020057600080fd5b50610209610704565b60405161021691906121d1565b60405180910390f35b34801561022b57600080fd5b506101f261023a3660046122c3565b6108f2565b34801561024b57600080fd5b50610254610945565b6040516102169190612303565b34801561026d57600080fd5b5061028161027c366004612365565b610a99565b6040519015158152602001610216565b34801561029d57600080fd5b506101f26102ac3660046122c3565b610afa565b3480156102bd57600080fd5b506102816102cc3660046123aa565b60016020526000908152604090205460ff1681565b3480156102ed57600080fd5b506101f26102fc366004612436565b610b4c565b34801561030d57600080fd5b50610316610fd0565b60405161021691906124e3565b34801561032f57600080fd5b506101f2611086565b34801561034457600080fd5b506101f261035336600461252a565b61109a565b34801561036457600080fd5b506000546040516001600160a01b039091168152602001610216565b34801561038c57600080fd5b506101f261039b366004612556565b6110d9565b3480156103ac57600080fd5b506103c06103bb366004612160565b611157565b6040516102169796959493929190612589565b3480156103df57600080fd5b506103e8611233565b60405161021691906125e0565b34801561040157600080fd5b506101f261041036600461268d565b6113ee565b34801561042157600080fd5b506101f26104303660046122c3565b61144e565b34801561044157600080fd5b5061047461045036600461252a565b60056020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610216565b34801561049557600080fd5b506101f26104a436600461268d565b6114a0565b3480156104b557600080fd5b506101f26104c4366004612702565b6114fb565b3480156104d557600080fd5b506101f26104e43660046123aa565b61151d565b3480156104f557600080fd5b506101f26105043660046123aa565b61154c565b34801561051557600080fd5b506101f261052436600461272c565b611575565b34801561053557600080fd5b506101f26105443660046127c0565b6117c7565b34801561055557600080fd5b506101f26105643660046122c3565b611856565b34801561057557600080fd5b506101f2610584366004612811565b6118a8565b34801561059557600080fd5b506101f26105a43660046123aa565b611a9d565b3480156105b557600080fd5b5061061f6105c4366004612874565b6004602081905260009182526040909120805460018201546002830154600384015494840154600585015460068601546007909601546001600160a01b0380871698600160a01b90970461ffff169795969416949060ff1689565b604080516001600160a01b039a8b16815261ffff90991660208a0152880196909652969093166060860152608085019190915260a084015260c083015260e082019290925260ff90911661010082015261012001610216565b34801561068457600080fd5b50610281610693366004612160565b60096020526000908152604090205460ff1681565b3360009081526001602052604090205460ff16806106d057506000546001600160a01b031633145b6106f55760405162461bcd60e51b81526004016106ec9061288f565b60405180910390fd5b610700600782611b16565b5050565b606060006107126007611b29565b67ffffffffffffffff81111561072a5761072a6123c7565b60405190808252806020026020018201604052801561079057816020015b6040805160e081018252600080825260208083018290529282018190526060808301526080820181905260a0820181905260c082015282526000199092019101816107485790505b50905060005b6107a06007611b29565b8110156108ec57600660006107b6600784611b33565b81526020808201929092526040908101600020815160e08101835281548152600182015461ffff811694820194909452620100009093046001600160a01b031691830191909152600281018054606084019190610812906128b4565b80601f016020809104026020016040519081016040528092919081815260200182805461083e906128b4565b801561088b5780601f106108605761010080835404028352916020019161088b565b820191906000526020600020905b81548152906001019060200180831161086e57829003601f168201915b50505091835250506003820154602082015260049091015460ff80821660408401526101009091041660609091015282518390839081106108ce576108ce6128e9565b602002602001018190525080806108e490612915565b915050610796565b50919050565b6108fa611b3f565b61ffff8316600090815260046020526040902054610925906001600160a01b03168360ff8416611b99565b61ffff909316600090815260046020819052604090912001929092555050565b60035460609060009061ffff1667ffffffffffffffff81111561096a5761096a6123c7565b60405190808252806020026020018201604052801561099d57816020015b60608152602001906001900390816109885790505b50905060005b60035461ffff90811690821610156108ec5761ffff81166000908152600460205260409020546001600160a01b031615610a875761ffff811660009081526004602081905260408083205481516395d89b4160e01b815291516001600160a01b03909116936395d89b419383810193919291829003018186803b158015610a2957600080fd5b505afa158015610a3d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610a659190810190612930565b828261ffff1681518110610a7b57610a7b6128e9565b60200260200101819052505b80610a91816129a7565b9150506109a3565b6000600960008484604051602001610ac892919091825260f81b6001600160f81b031916602082015260210190565b60408051601f198184030181529181528151602092830120835290820192909252016000205460ff1690505b92915050565b610b02611b3f565b61ffff8316600090815260046020526040902054610b2d906001600160a01b03168360ff8416611b99565b61ffff9093166000908152600460205260409020600101929092555050565b610b5a600a60ff8416611c3e565b1515600114610bab5760405162461bcd60e51b815260206004820152601760248201527f64657374696e6174696f6e206e6f7420737570706f727400000000000000000060448201526064016106ec565b61ffff8416600090815260046020526040902080546001600160a01b0316610c055760405162461bcd60e51b815260206004820152600d60248201526c3ab735b737bbb7103a37b5b2b760991b60448201526064016106ec565b8060030154841015610c595760405162461bcd60e51b815260206004820152601960248201527f616d6f756e74206c6f776572207468616e206d696e696e756d0000000000000060448201526064016106ec565b8060040154841115610cad5760405162461bcd60e51b815260206004820152601b60248201527f616d6f756e742067726561746572207468616e206d696e696e756d000000000060448201526064016106ec565b61ffff85166000908152600560209081526040808320338452909152812060018101549091904290610ce290620151806129c9565b1090508015610cf657426001830155600082555b60058301548254610d089088906129c9565b1115610d4b5760405162461bcd60e51b815260206004820152601260248201527119185a5b1e481b1a5b5a5d08195e18d9595960721b60448201526064016106ec565b85826000016000828254610d5f91906129c9565b9091555050825460009061271090610d8290600160a01b900461ffff16896129e1565b610d8c9190612a00565b8460010154610d9b91906129c9565b90508015610dc35760028401548454610dc3916001600160a01b039182169133911684611c56565b610dcd8188612a22565b8454909750610de7906001600160a01b031633308a611c56565b6040518060e0016040528060025481526020018961ffff168152602001336001600160a01b031681526020018681526020018881526020018560000160009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610e6f57600080fd5b505afa158015610e83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea79190612a39565b60ff90811682528816602091820152600280546000908152600683526040908190208451815584840151600182018054938701516001600160a01b031662010000026001600160b01b031990941661ffff9092169190911792909217909155606084015180519193610f1e938501929101906120c7565b506080820151600382015560a08201516004909101805460c09093015160ff9081166101000261ffff19909416921691909117919091179055600254610f6690600790611cc7565b506002546000818152600660205260409081902090517f61dd24c2936562d1f0ec5e049e8e19fffbf9584ae6497ae442f8910d2c3caeec91610fa9918590612af6565b60405180910390a260028054906000610fc183612915565b91905055505050505050505050565b60606000610fde600a611b29565b905060008167ffffffffffffffff811115610ffb57610ffb6123c7565b604051908082528060200260200182016040528015611024578160200160208202803683370190505b50905060005b828161ffff16101561107f57611045600a61ffff8316611b33565b828261ffff168151811061105b5761105b6128e9565b60ff9092166020928302919091019091015280611077816129a7565b91505061102a565b5092915050565b61108e611b3f565b6110986000611cd3565b565b6110a2611b3f565b61ffff91909116600090815260046020526040902060020180546001600160a01b0319166001600160a01b03909216919091179055565b6110e1611b3f565b6127108161ffff1611156111255760405162461bcd60e51b815260206004820152600b60248201526a696e76616c69642066656560a81b60448201526064016106ec565b61ffff9182166000908152600460205260409020805492909116600160a01b0261ffff60a01b19909216919091179055565b600660205260009081526040902080546001820154600283018054929361ffff831693620100009093046001600160a01b031692909190611197906128b4565b80601f01602080910402602001604051908101604052809291908181526020018280546111c3906128b4565b80156112105780601f106111e557610100808354040283529160200191611210565b820191906000526020600020905b8154815290600101906020018083116111f357829003601f168201915b50505050600383015460049093015491929160ff80821692506101009091041687565b60035460609060009061ffff1667ffffffffffffffff811115611258576112586123c7565b6040519080825280602002602001820160405280156112f157816020015b6112de60405180610120016040528060006001600160a01b03168152602001600061ffff1681526020016000815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600060ff1681525090565b8152602001906001900390816112765790505b50905060005b60035461ffff90811690821610156108ec5761ffff81166000908152600460205260409020546001600160a01b0316156113dc5761ffff80821660008181526004602081815260409283902083516101208101855281546001600160a01b038082168352600160a01b90910490971692810192909252600181015493820193909352600283015490941660608501526003820154608085015281015460a0840152600581015460c0840152600681015460e0840152600781015460ff166101008401528451909291859181106113cf576113cf6128e9565b6020026020010181905250505b806113e6816129a7565b9150506112f7565b6113f6611b3f565b60005b8181101561144957611436838383818110611416576114166128e9565b905060200201602081019061142b9190612b6a565b600a9060ff16611cc7565b508061144181612915565b9150506113f9565b505050565b611456611b3f565b61ffff8316600090815260046020526040902054611481906001600160a01b03168360ff8416611b99565b61ffff9093166000908152600460205260409020600501929092555050565b6114a8611b3f565b60005b81811015611449576114e88383838181106114c8576114c86128e9565b90506020020160208101906114dd9190612b6a565b600a9060ff16611b16565b50806114f381612915565b9150506114ab565b611503611b3f565b61ffff909116600090815260046020526040902060060155565b611525611b3f565b6001600160a01b03166000908152600160208190526040909120805460ff19169091179055565b611554611b3f565b6001600160a01b03166000908152600160205260409020805460ff19169055565b61157d611b3f565b6127108761ffff1611156115c15760405162461bcd60e51b815260206004820152600b60248201526a696e76616c69642066656560a81b60448201526064016106ec565b604051806101200160405280896001600160a01b031681526020018861ffff1681526020016115f48a898560ff16611b99565b8152602001866001600160a01b031681526020016116168a878560ff16611b99565b81526020016116298a868560ff16611b99565b815260200161163c8a858560ff16611b99565b815260200160008152602001896001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561168157600080fd5b505afa158015611695573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b99190612a39565b60ff90811690915261ffff808c1660009081526004602081815260409283902086518154928801518616600160a01b026001600160b01b03199093166001600160a01b0391821617929092178155928601516001808501919091556060870151600285018054919093166001600160a01b03199190911617909155608086015160038085019190915560a08701519284019290925560c0860151600584015560e0860151600684015561010090950151600790920180549290941660ff199092169190911790925590541690611790908b90612b87565b61ffff1611156117bc576117a5896001612b87565b6003805461ffff191661ffff929092169190911790555b505050505050505050565b3360009081526001602052604090205460ff16806117ef57506000546001600160a01b031633145b61180b5760405162461bcd60e51b81526004016106ec9061288f565b61ffff84166000908152600460205260409020805461184f90859061183d906001600160a01b03168660ff8716611b99565b83546001600160a01b03169190611d23565b5050505050565b61185e611b3f565b61ffff8316600090815260046020526040902054611889906001600160a01b03168360ff8416611b99565b61ffff9093166000908152600460205260409020600301929092555050565b3360009081526001602052604090205460ff16806118d057506000546001600160a01b031633145b6118ec5760405162461bcd60e51b81526004016106ec9061288f565b6000868660405160200161191792919091825260f81b6001600160f81b031916602082015260210190565b60408051601f1981840301815291815281516020928301206000818152600990935291205490915060ff16156119845760405162461bcd60e51b8152602060048201526012602482015271185b1c9958591e481d1c985b9cd9995c995960721b60448201526064016106ec565b61ffff8516600090815260046020526040902080546001600160a01b03166119de5760405162461bcd60e51b815260206004820152600d60248201526c3ab735b737bbb7103a37b5b2b760991b60448201526064016106ec565b80546119fa90869061183d906001600160a01b03168787611b99565b6000828152600960205260408120805460ff191660011790556006820154611a229047611d53565b90508015611a62576040516001600160a01b0387169082156108fc029083906000818181858888f19350505050158015611a60573d6000803e3d6000fd5b505b60405160ff8916908a907f2bd2d9c5f8a1215c53d8d1e6eeed2a5edde1be47f27f9d43e053043628ecb31f90600090a3505050505050505050565b611aa5611b3f565b6001600160a01b038116611b0a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106ec565b611b1381611cd3565b50565b6000611b228383611d69565b9392505050565b6000610af4825490565b6000611b228383611e5c565b6000546001600160a01b031633146110985760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106ec565b6000611ba682600a612c91565b846001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015611bdf57600080fd5b505afa158015611bf3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c179190612a39565b611c2290600a612c9d565b611c2c90856129e1565b611c369190612a00565b949350505050565b60008181526001830160205260408120541515611b22565b6040516001600160a01b0380851660248301528316604482015260648101829052611cc19085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611e86565b50505050565b6000611b228383611f58565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b03831660248201526044810182905261144990849063a9059cbb60e01b90606401611c8a565b6000818310611d625781611b22565b5090919050565b60008181526001830160205260408120548015611e52576000611d8d600183612a22565b8554909150600090611da190600190612a22565b9050818114611e06576000866000018281548110611dc157611dc16128e9565b9060005260206000200154905080876000018481548110611de457611de46128e9565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611e1757611e17612cac565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610af4565b6000915050610af4565b6000826000018281548110611e7357611e736128e9565b9060005260206000200154905092915050565b6000611edb826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611fa79092919063ffffffff16565b8051909150156114495780806020019051810190611ef99190612cc2565b6114495760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016106ec565b6000818152600183016020526040812054611f9f57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610af4565b506000610af4565b6060611c36848460008585600080866001600160a01b03168587604051611fce9190612ce4565b60006040518083038185875af1925050503d806000811461200b576040519150601f19603f3d011682016040523d82523d6000602084013e612010565b606091505b50915091506120218783838761202c565b979650505050505050565b60608315612098578251612091576001600160a01b0385163b6120915760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106ec565b5081611c36565b611c3683838151156120ad5781518083602001fd5b8060405162461bcd60e51b81526004016106ec9190612d00565b8280546120d3906128b4565b90600052602060002090601f0160209004810192826120f5576000855561213b565b82601f1061210e57805160ff191683800117855561213b565b8280016001018555821561213b579182015b8281111561213b578251825591602001919060010190612120565b5061214792915061214b565b5090565b5b80821115612147576000815560010161214c565b60006020828403121561217257600080fd5b5035919050565b60005b8381101561219457818101518382015260200161217c565b83811115611cc15750506000910152565b600081518084526121bd816020860160208601612179565b601f01601f19169290920160200192915050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561228f57888303603f190185528151805184528781015161ffff1688850152868101516001600160a01b03168785015260608082015160e08287018190529190612248838801826121a5565b92505050608080830151818701525060a060ff8184015116818701525060c080830151925061227b8187018460ff169052565b5095880195935050908601906001016121f8565b509098975050505050505050565b803561ffff811681146122af57600080fd5b919050565b60ff81168114611b1357600080fd5b6000806000606084860312156122d857600080fd5b6122e18461229d565b92506020840135915060408401356122f8816122b4565b809150509250925092565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561235857603f198886030184526123468583516121a5565b9450928501929085019060010161232a565b5092979650505050505050565b6000806040838503121561237857600080fd5b82359150602083013561238a816122b4565b809150509250929050565b6001600160a01b0381168114611b1357600080fd5b6000602082840312156123bc57600080fd5b8135611b2281612395565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612406576124066123c7565b604052919050565b600067ffffffffffffffff821115612428576124286123c7565b50601f01601f191660200190565b6000806000806080858703121561244c57600080fd5b6124558561229d565b935060208501359250604085013561246c816122b4565b9150606085013567ffffffffffffffff81111561248857600080fd5b8501601f8101871361249957600080fd5b80356124ac6124a78261240e565b6123dd565b8181528860208385010111156124c157600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b6020808252825182820181905260009190848201906040850190845b8181101561251e57835160ff16835292840192918401916001016124ff565b50909695505050505050565b6000806040838503121561253d57600080fd5b6125468361229d565b9150602083013561238a81612395565b6000806040838503121561256957600080fd5b6125728361229d565b91506125806020840161229d565b90509250929050565b87815261ffff871660208201526001600160a01b038616604082015260e0606082018190526000906125bd908301876121a5565b60808301959095525060ff92831660a0820152911660c090910152949350505050565b602080825282518282018190526000919060409081850190868401855b8281101561268057815180516001600160a01b0390811686528782015161ffff16888701528682015187870152606080830151909116908601526080808201519086015260a0808201519086015260c0808201519086015260e080820151908601526101009081015160ff169085015261012090930192908501906001016125fd565b5091979650505050505050565b600080602083850312156126a057600080fd5b823567ffffffffffffffff808211156126b857600080fd5b818501915085601f8301126126cc57600080fd5b8135818111156126db57600080fd5b8660208260051b85010111156126f057600080fd5b60209290920196919550909350505050565b6000806040838503121561271557600080fd5b61271e8361229d565b946020939093013593505050565b60008060008060008060008060006101208a8c03121561274b57600080fd5b6127548a61229d565b985060208a013561276481612395565b975061277260408b0161229d565b965060608a0135955060808a013561278981612395565b945060a08a0135935060c08a0135925060e08a013591506101008a01356127af816122b4565b809150509295985092959850929598565b600080600080608085870312156127d657600080fd5b6127df8561229d565b935060208501356127ef81612395565b9250604085013591506060850135612806816122b4565b939692955090935050565b60008060008060008060c0878903121561282a57600080fd5b86359550602087013561283c816122b4565b945061284a6040880161229d565b9350606087013561285a81612395565b9598949750929560808101359460a0909101359350915050565b60006020828403121561288657600080fd5b611b228261229d565b6020808252600b908201526a1b9bdd081d1c9d5cdd195960aa1b604082015260600190565b600181811c908216806128c857607f821691505b602082108114156108ec57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415612929576129296128ff565b5060010190565b60006020828403121561294257600080fd5b815167ffffffffffffffff81111561295957600080fd5b8201601f8101841361296a57600080fd5b80516129786124a78261240e565b81815285602083850101111561298d57600080fd5b61299e826020830160208601612179565b95945050505050565b600061ffff808316818114156129bf576129bf6128ff565b6001019392505050565b600082198211156129dc576129dc6128ff565b500190565b60008160001904831182151516156129fb576129fb6128ff565b500290565b600082612a1d57634e487b7160e01b600052601260045260246000fd5b500490565b600082821015612a3457612a346128ff565b500390565b600060208284031215612a4b57600080fd5b8151611b22816122b4565b8054600090600181811c9080831680612a7057607f831692505b6020808410821415612a9257634e487b7160e01b600052602260045260246000fd5b83885260208801828015612aad5760018114612abe57612ae9565b60ff19871682528282019750612ae9565b60008981526020902060005b87811015612ae357815484820152908601908401612aca565b83019850505b5050505050505092915050565b6040808252835490820152600183015461ffff8116606083015260101c6001600160a01b0316608082015260e060a08201526000612b3b610120830160028601612a56565b600385015460c084015260049094015460ff80821660e085015260089190911c16610100830152506020015290565b600060208284031215612b7c57600080fd5b8135611b22816122b4565b600061ffff808316818516808303821115612ba457612ba46128ff565b01949350505050565b600181815b80851115612be8578160001904821115612bce57612bce6128ff565b80851615612bdb57918102915b93841c9390800290612bb2565b509250929050565b600082612bff57506001610af4565b81612c0c57506000610af4565b8160018114612c225760028114612c2c57612c48565b6001915050610af4565b60ff841115612c3d57612c3d6128ff565b50506001821b610af4565b5060208310610133831016604e8410600b8410161715612c6b575081810a610af4565b612c758383612bad565b8060001904821115612c8957612c896128ff565b029392505050565b6000611b228383612bf0565b6000611b2260ff841683612bf0565b634e487b7160e01b600052603160045260246000fd5b600060208284031215612cd457600080fd5b81518015158114611b2257600080fd5b60008251612cf6818460208701612179565b9190910192915050565b602081526000611b2260208301846121a556fea2646970667358221220be691a9a22361a5e948b0b6caf2f5d6ab2c14e75bac22f2a454c0c24e681583264736f6c63430008090033
Deployed Bytecode
0x6080604052600436106101c65760003560e01c8063aa6ca808116100f7578063d55e62a011610095578063f1a348fe11610064578063f1a348fe14610569578063f2fde38b14610589578063f3c20de0146105a9578063f6419d961461067857600080fd5b8063d55e62a0146104e9578063db65874914610509578063dd3705cc14610529578063e923cd9b1461054957600080fd5b8063b5caa2c0116100d1578063b5caa2c014610435578063d1ffa03914610489578063d4ad95d3146104a9578063d4d0d6e6146104c957600080fd5b8063aa6ca808146103d3578063afe6c89b146103f5578063b2017c091461041557600080fd5b806355f7c3811161016457806384a2ded41161013e57806384a2ded4146103385780638da5cb5b1461035857806399b64de114610380578063a85c38ef146103a057600080fd5b806355f7c381146102e15780635ba536bc14610301578063715018a61461032357600080fd5b8063277b08b4116101a0578063277b08b41461023f57806327e021e8146102615780633eb6be21146102915780633ffd402c146102b157600080fd5b80630aebeb4e146101d2578063176091f4146101f45780631c6045511461021f57600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed366004612160565b6106a8565b005b34801561020057600080fd5b50610209610704565b60405161021691906121d1565b60405180910390f35b34801561022b57600080fd5b506101f261023a3660046122c3565b6108f2565b34801561024b57600080fd5b50610254610945565b6040516102169190612303565b34801561026d57600080fd5b5061028161027c366004612365565b610a99565b6040519015158152602001610216565b34801561029d57600080fd5b506101f26102ac3660046122c3565b610afa565b3480156102bd57600080fd5b506102816102cc3660046123aa565b60016020526000908152604090205460ff1681565b3480156102ed57600080fd5b506101f26102fc366004612436565b610b4c565b34801561030d57600080fd5b50610316610fd0565b60405161021691906124e3565b34801561032f57600080fd5b506101f2611086565b34801561034457600080fd5b506101f261035336600461252a565b61109a565b34801561036457600080fd5b506000546040516001600160a01b039091168152602001610216565b34801561038c57600080fd5b506101f261039b366004612556565b6110d9565b3480156103ac57600080fd5b506103c06103bb366004612160565b611157565b6040516102169796959493929190612589565b3480156103df57600080fd5b506103e8611233565b60405161021691906125e0565b34801561040157600080fd5b506101f261041036600461268d565b6113ee565b34801561042157600080fd5b506101f26104303660046122c3565b61144e565b34801561044157600080fd5b5061047461045036600461252a565b60056020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610216565b34801561049557600080fd5b506101f26104a436600461268d565b6114a0565b3480156104b557600080fd5b506101f26104c4366004612702565b6114fb565b3480156104d557600080fd5b506101f26104e43660046123aa565b61151d565b3480156104f557600080fd5b506101f26105043660046123aa565b61154c565b34801561051557600080fd5b506101f261052436600461272c565b611575565b34801561053557600080fd5b506101f26105443660046127c0565b6117c7565b34801561055557600080fd5b506101f26105643660046122c3565b611856565b34801561057557600080fd5b506101f2610584366004612811565b6118a8565b34801561059557600080fd5b506101f26105a43660046123aa565b611a9d565b3480156105b557600080fd5b5061061f6105c4366004612874565b6004602081905260009182526040909120805460018201546002830154600384015494840154600585015460068601546007909601546001600160a01b0380871698600160a01b90970461ffff169795969416949060ff1689565b604080516001600160a01b039a8b16815261ffff90991660208a0152880196909652969093166060860152608085019190915260a084015260c083015260e082019290925260ff90911661010082015261012001610216565b34801561068457600080fd5b50610281610693366004612160565b60096020526000908152604090205460ff1681565b3360009081526001602052604090205460ff16806106d057506000546001600160a01b031633145b6106f55760405162461bcd60e51b81526004016106ec9061288f565b60405180910390fd5b610700600782611b16565b5050565b606060006107126007611b29565b67ffffffffffffffff81111561072a5761072a6123c7565b60405190808252806020026020018201604052801561079057816020015b6040805160e081018252600080825260208083018290529282018190526060808301526080820181905260a0820181905260c082015282526000199092019101816107485790505b50905060005b6107a06007611b29565b8110156108ec57600660006107b6600784611b33565b81526020808201929092526040908101600020815160e08101835281548152600182015461ffff811694820194909452620100009093046001600160a01b031691830191909152600281018054606084019190610812906128b4565b80601f016020809104026020016040519081016040528092919081815260200182805461083e906128b4565b801561088b5780601f106108605761010080835404028352916020019161088b565b820191906000526020600020905b81548152906001019060200180831161086e57829003601f168201915b50505091835250506003820154602082015260049091015460ff80821660408401526101009091041660609091015282518390839081106108ce576108ce6128e9565b602002602001018190525080806108e490612915565b915050610796565b50919050565b6108fa611b3f565b61ffff8316600090815260046020526040902054610925906001600160a01b03168360ff8416611b99565b61ffff909316600090815260046020819052604090912001929092555050565b60035460609060009061ffff1667ffffffffffffffff81111561096a5761096a6123c7565b60405190808252806020026020018201604052801561099d57816020015b60608152602001906001900390816109885790505b50905060005b60035461ffff90811690821610156108ec5761ffff81166000908152600460205260409020546001600160a01b031615610a875761ffff811660009081526004602081905260408083205481516395d89b4160e01b815291516001600160a01b03909116936395d89b419383810193919291829003018186803b158015610a2957600080fd5b505afa158015610a3d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610a659190810190612930565b828261ffff1681518110610a7b57610a7b6128e9565b60200260200101819052505b80610a91816129a7565b9150506109a3565b6000600960008484604051602001610ac892919091825260f81b6001600160f81b031916602082015260210190565b60408051601f198184030181529181528151602092830120835290820192909252016000205460ff1690505b92915050565b610b02611b3f565b61ffff8316600090815260046020526040902054610b2d906001600160a01b03168360ff8416611b99565b61ffff9093166000908152600460205260409020600101929092555050565b610b5a600a60ff8416611c3e565b1515600114610bab5760405162461bcd60e51b815260206004820152601760248201527f64657374696e6174696f6e206e6f7420737570706f727400000000000000000060448201526064016106ec565b61ffff8416600090815260046020526040902080546001600160a01b0316610c055760405162461bcd60e51b815260206004820152600d60248201526c3ab735b737bbb7103a37b5b2b760991b60448201526064016106ec565b8060030154841015610c595760405162461bcd60e51b815260206004820152601960248201527f616d6f756e74206c6f776572207468616e206d696e696e756d0000000000000060448201526064016106ec565b8060040154841115610cad5760405162461bcd60e51b815260206004820152601b60248201527f616d6f756e742067726561746572207468616e206d696e696e756d000000000060448201526064016106ec565b61ffff85166000908152600560209081526040808320338452909152812060018101549091904290610ce290620151806129c9565b1090508015610cf657426001830155600082555b60058301548254610d089088906129c9565b1115610d4b5760405162461bcd60e51b815260206004820152601260248201527119185a5b1e481b1a5b5a5d08195e18d9595960721b60448201526064016106ec565b85826000016000828254610d5f91906129c9565b9091555050825460009061271090610d8290600160a01b900461ffff16896129e1565b610d8c9190612a00565b8460010154610d9b91906129c9565b90508015610dc35760028401548454610dc3916001600160a01b039182169133911684611c56565b610dcd8188612a22565b8454909750610de7906001600160a01b031633308a611c56565b6040518060e0016040528060025481526020018961ffff168152602001336001600160a01b031681526020018681526020018881526020018560000160009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610e6f57600080fd5b505afa158015610e83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea79190612a39565b60ff90811682528816602091820152600280546000908152600683526040908190208451815584840151600182018054938701516001600160a01b031662010000026001600160b01b031990941661ffff9092169190911792909217909155606084015180519193610f1e938501929101906120c7565b506080820151600382015560a08201516004909101805460c09093015160ff9081166101000261ffff19909416921691909117919091179055600254610f6690600790611cc7565b506002546000818152600660205260409081902090517f61dd24c2936562d1f0ec5e049e8e19fffbf9584ae6497ae442f8910d2c3caeec91610fa9918590612af6565b60405180910390a260028054906000610fc183612915565b91905055505050505050505050565b60606000610fde600a611b29565b905060008167ffffffffffffffff811115610ffb57610ffb6123c7565b604051908082528060200260200182016040528015611024578160200160208202803683370190505b50905060005b828161ffff16101561107f57611045600a61ffff8316611b33565b828261ffff168151811061105b5761105b6128e9565b60ff9092166020928302919091019091015280611077816129a7565b91505061102a565b5092915050565b61108e611b3f565b6110986000611cd3565b565b6110a2611b3f565b61ffff91909116600090815260046020526040902060020180546001600160a01b0319166001600160a01b03909216919091179055565b6110e1611b3f565b6127108161ffff1611156111255760405162461bcd60e51b815260206004820152600b60248201526a696e76616c69642066656560a81b60448201526064016106ec565b61ffff9182166000908152600460205260409020805492909116600160a01b0261ffff60a01b19909216919091179055565b600660205260009081526040902080546001820154600283018054929361ffff831693620100009093046001600160a01b031692909190611197906128b4565b80601f01602080910402602001604051908101604052809291908181526020018280546111c3906128b4565b80156112105780601f106111e557610100808354040283529160200191611210565b820191906000526020600020905b8154815290600101906020018083116111f357829003601f168201915b50505050600383015460049093015491929160ff80821692506101009091041687565b60035460609060009061ffff1667ffffffffffffffff811115611258576112586123c7565b6040519080825280602002602001820160405280156112f157816020015b6112de60405180610120016040528060006001600160a01b03168152602001600061ffff1681526020016000815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600060ff1681525090565b8152602001906001900390816112765790505b50905060005b60035461ffff90811690821610156108ec5761ffff81166000908152600460205260409020546001600160a01b0316156113dc5761ffff80821660008181526004602081815260409283902083516101208101855281546001600160a01b038082168352600160a01b90910490971692810192909252600181015493820193909352600283015490941660608501526003820154608085015281015460a0840152600581015460c0840152600681015460e0840152600781015460ff166101008401528451909291859181106113cf576113cf6128e9565b6020026020010181905250505b806113e6816129a7565b9150506112f7565b6113f6611b3f565b60005b8181101561144957611436838383818110611416576114166128e9565b905060200201602081019061142b9190612b6a565b600a9060ff16611cc7565b508061144181612915565b9150506113f9565b505050565b611456611b3f565b61ffff8316600090815260046020526040902054611481906001600160a01b03168360ff8416611b99565b61ffff9093166000908152600460205260409020600501929092555050565b6114a8611b3f565b60005b81811015611449576114e88383838181106114c8576114c86128e9565b90506020020160208101906114dd9190612b6a565b600a9060ff16611b16565b50806114f381612915565b9150506114ab565b611503611b3f565b61ffff909116600090815260046020526040902060060155565b611525611b3f565b6001600160a01b03166000908152600160208190526040909120805460ff19169091179055565b611554611b3f565b6001600160a01b03166000908152600160205260409020805460ff19169055565b61157d611b3f565b6127108761ffff1611156115c15760405162461bcd60e51b815260206004820152600b60248201526a696e76616c69642066656560a81b60448201526064016106ec565b604051806101200160405280896001600160a01b031681526020018861ffff1681526020016115f48a898560ff16611b99565b8152602001866001600160a01b031681526020016116168a878560ff16611b99565b81526020016116298a868560ff16611b99565b815260200161163c8a858560ff16611b99565b815260200160008152602001896001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561168157600080fd5b505afa158015611695573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b99190612a39565b60ff90811690915261ffff808c1660009081526004602081815260409283902086518154928801518616600160a01b026001600160b01b03199093166001600160a01b0391821617929092178155928601516001808501919091556060870151600285018054919093166001600160a01b03199190911617909155608086015160038085019190915560a08701519284019290925560c0860151600584015560e0860151600684015561010090950151600790920180549290941660ff199092169190911790925590541690611790908b90612b87565b61ffff1611156117bc576117a5896001612b87565b6003805461ffff191661ffff929092169190911790555b505050505050505050565b3360009081526001602052604090205460ff16806117ef57506000546001600160a01b031633145b61180b5760405162461bcd60e51b81526004016106ec9061288f565b61ffff84166000908152600460205260409020805461184f90859061183d906001600160a01b03168660ff8716611b99565b83546001600160a01b03169190611d23565b5050505050565b61185e611b3f565b61ffff8316600090815260046020526040902054611889906001600160a01b03168360ff8416611b99565b61ffff9093166000908152600460205260409020600301929092555050565b3360009081526001602052604090205460ff16806118d057506000546001600160a01b031633145b6118ec5760405162461bcd60e51b81526004016106ec9061288f565b6000868660405160200161191792919091825260f81b6001600160f81b031916602082015260210190565b60408051601f1981840301815291815281516020928301206000818152600990935291205490915060ff16156119845760405162461bcd60e51b8152602060048201526012602482015271185b1c9958591e481d1c985b9cd9995c995960721b60448201526064016106ec565b61ffff8516600090815260046020526040902080546001600160a01b03166119de5760405162461bcd60e51b815260206004820152600d60248201526c3ab735b737bbb7103a37b5b2b760991b60448201526064016106ec565b80546119fa90869061183d906001600160a01b03168787611b99565b6000828152600960205260408120805460ff191660011790556006820154611a229047611d53565b90508015611a62576040516001600160a01b0387169082156108fc029083906000818181858888f19350505050158015611a60573d6000803e3d6000fd5b505b60405160ff8916908a907f2bd2d9c5f8a1215c53d8d1e6eeed2a5edde1be47f27f9d43e053043628ecb31f90600090a3505050505050505050565b611aa5611b3f565b6001600160a01b038116611b0a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106ec565b611b1381611cd3565b50565b6000611b228383611d69565b9392505050565b6000610af4825490565b6000611b228383611e5c565b6000546001600160a01b031633146110985760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106ec565b6000611ba682600a612c91565b846001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015611bdf57600080fd5b505afa158015611bf3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c179190612a39565b611c2290600a612c9d565b611c2c90856129e1565b611c369190612a00565b949350505050565b60008181526001830160205260408120541515611b22565b6040516001600160a01b0380851660248301528316604482015260648101829052611cc19085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611e86565b50505050565b6000611b228383611f58565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b03831660248201526044810182905261144990849063a9059cbb60e01b90606401611c8a565b6000818310611d625781611b22565b5090919050565b60008181526001830160205260408120548015611e52576000611d8d600183612a22565b8554909150600090611da190600190612a22565b9050818114611e06576000866000018281548110611dc157611dc16128e9565b9060005260206000200154905080876000018481548110611de457611de46128e9565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611e1757611e17612cac565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610af4565b6000915050610af4565b6000826000018281548110611e7357611e736128e9565b9060005260206000200154905092915050565b6000611edb826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611fa79092919063ffffffff16565b8051909150156114495780806020019051810190611ef99190612cc2565b6114495760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016106ec565b6000818152600183016020526040812054611f9f57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610af4565b506000610af4565b6060611c36848460008585600080866001600160a01b03168587604051611fce9190612ce4565b60006040518083038185875af1925050503d806000811461200b576040519150601f19603f3d011682016040523d82523d6000602084013e612010565b606091505b50915091506120218783838761202c565b979650505050505050565b60608315612098578251612091576001600160a01b0385163b6120915760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106ec565b5081611c36565b611c3683838151156120ad5781518083602001fd5b8060405162461bcd60e51b81526004016106ec9190612d00565b8280546120d3906128b4565b90600052602060002090601f0160209004810192826120f5576000855561213b565b82601f1061210e57805160ff191683800117855561213b565b8280016001018555821561213b579182015b8281111561213b578251825591602001919060010190612120565b5061214792915061214b565b5090565b5b80821115612147576000815560010161214c565b60006020828403121561217257600080fd5b5035919050565b60005b8381101561219457818101518382015260200161217c565b83811115611cc15750506000910152565b600081518084526121bd816020860160208601612179565b601f01601f19169290920160200192915050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561228f57888303603f190185528151805184528781015161ffff1688850152868101516001600160a01b03168785015260608082015160e08287018190529190612248838801826121a5565b92505050608080830151818701525060a060ff8184015116818701525060c080830151925061227b8187018460ff169052565b5095880195935050908601906001016121f8565b509098975050505050505050565b803561ffff811681146122af57600080fd5b919050565b60ff81168114611b1357600080fd5b6000806000606084860312156122d857600080fd5b6122e18461229d565b92506020840135915060408401356122f8816122b4565b809150509250925092565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561235857603f198886030184526123468583516121a5565b9450928501929085019060010161232a565b5092979650505050505050565b6000806040838503121561237857600080fd5b82359150602083013561238a816122b4565b809150509250929050565b6001600160a01b0381168114611b1357600080fd5b6000602082840312156123bc57600080fd5b8135611b2281612395565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612406576124066123c7565b604052919050565b600067ffffffffffffffff821115612428576124286123c7565b50601f01601f191660200190565b6000806000806080858703121561244c57600080fd5b6124558561229d565b935060208501359250604085013561246c816122b4565b9150606085013567ffffffffffffffff81111561248857600080fd5b8501601f8101871361249957600080fd5b80356124ac6124a78261240e565b6123dd565b8181528860208385010111156124c157600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b6020808252825182820181905260009190848201906040850190845b8181101561251e57835160ff16835292840192918401916001016124ff565b50909695505050505050565b6000806040838503121561253d57600080fd5b6125468361229d565b9150602083013561238a81612395565b6000806040838503121561256957600080fd5b6125728361229d565b91506125806020840161229d565b90509250929050565b87815261ffff871660208201526001600160a01b038616604082015260e0606082018190526000906125bd908301876121a5565b60808301959095525060ff92831660a0820152911660c090910152949350505050565b602080825282518282018190526000919060409081850190868401855b8281101561268057815180516001600160a01b0390811686528782015161ffff16888701528682015187870152606080830151909116908601526080808201519086015260a0808201519086015260c0808201519086015260e080820151908601526101009081015160ff169085015261012090930192908501906001016125fd565b5091979650505050505050565b600080602083850312156126a057600080fd5b823567ffffffffffffffff808211156126b857600080fd5b818501915085601f8301126126cc57600080fd5b8135818111156126db57600080fd5b8660208260051b85010111156126f057600080fd5b60209290920196919550909350505050565b6000806040838503121561271557600080fd5b61271e8361229d565b946020939093013593505050565b60008060008060008060008060006101208a8c03121561274b57600080fd5b6127548a61229d565b985060208a013561276481612395565b975061277260408b0161229d565b965060608a0135955060808a013561278981612395565b945060a08a0135935060c08a0135925060e08a013591506101008a01356127af816122b4565b809150509295985092959850929598565b600080600080608085870312156127d657600080fd5b6127df8561229d565b935060208501356127ef81612395565b9250604085013591506060850135612806816122b4565b939692955090935050565b60008060008060008060c0878903121561282a57600080fd5b86359550602087013561283c816122b4565b945061284a6040880161229d565b9350606087013561285a81612395565b9598949750929560808101359460a0909101359350915050565b60006020828403121561288657600080fd5b611b228261229d565b6020808252600b908201526a1b9bdd081d1c9d5cdd195960aa1b604082015260600190565b600181811c908216806128c857607f821691505b602082108114156108ec57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415612929576129296128ff565b5060010190565b60006020828403121561294257600080fd5b815167ffffffffffffffff81111561295957600080fd5b8201601f8101841361296a57600080fd5b80516129786124a78261240e565b81815285602083850101111561298d57600080fd5b61299e826020830160208601612179565b95945050505050565b600061ffff808316818114156129bf576129bf6128ff565b6001019392505050565b600082198211156129dc576129dc6128ff565b500190565b60008160001904831182151516156129fb576129fb6128ff565b500290565b600082612a1d57634e487b7160e01b600052601260045260246000fd5b500490565b600082821015612a3457612a346128ff565b500390565b600060208284031215612a4b57600080fd5b8151611b22816122b4565b8054600090600181811c9080831680612a7057607f831692505b6020808410821415612a9257634e487b7160e01b600052602260045260246000fd5b83885260208801828015612aad5760018114612abe57612ae9565b60ff19871682528282019750612ae9565b60008981526020902060005b87811015612ae357815484820152908601908401612aca565b83019850505b5050505050505092915050565b6040808252835490820152600183015461ffff8116606083015260101c6001600160a01b0316608082015260e060a08201526000612b3b610120830160028601612a56565b600385015460c084015260049094015460ff80821660e085015260089190911c16610100830152506020015290565b600060208284031215612b7c57600080fd5b8135611b22816122b4565b600061ffff808316818516808303821115612ba457612ba46128ff565b01949350505050565b600181815b80851115612be8578160001904821115612bce57612bce6128ff565b80851615612bdb57918102915b93841c9390800290612bb2565b509250929050565b600082612bff57506001610af4565b81612c0c57506000610af4565b8160018114612c225760028114612c2c57612c48565b6001915050610af4565b60ff841115612c3d57612c3d6128ff565b50506001821b610af4565b5060208310610133831016604e8410600b8410161715612c6b575081810a610af4565b612c758383612bad565b8060001904821115612c8957612c896128ff565b029392505050565b6000611b228383612bf0565b6000611b2260ff841683612bf0565b634e487b7160e01b600052603160045260246000fd5b600060208284031215612cd457600080fd5b81518015158114611b2257600080fd5b60008251612cf6818460208701612179565b9190910192915050565b602081526000611b2260208301846121a556fea2646970667358221220be691a9a22361a5e948b0b6caf2f5d6ab2c14e75bac22f2a454c0c24e681583264736f6c63430008090033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.