Overview
ETH Balance
0.816917856000000001 ETH
Eth Value
$2,543.09 (@ $3,113.03/ETH)Token Holdings
More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 319 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Cancel Offer | 21164927 | 8 days ago | IN | 0 ETH | 0.00100992 | ||||
Token To Settle ... | 21141749 | 12 days ago | IN | 0 ETH | 0.00031031 | ||||
Settle Cancelled | 20990722 | 33 days ago | IN | 0 ETH | 0.00200616 | ||||
Settle Filleds | 20976050 | 35 days ago | IN | 0 ETH | 0.00298697 | ||||
Token To Settle ... | 20974982 | 35 days ago | IN | 0 ETH | 0.00032463 | ||||
Fill Offer ETH | 20967829 | 36 days ago | IN | 0.00199336 ETH | 0.00227595 | ||||
Settle Filleds | 20875978 | 49 days ago | IN | 0 ETH | 0.00077158 | ||||
Settle Filleds | 20875300 | 49 days ago | IN | 0 ETH | 0.00077105 | ||||
Settle Filleds | 20875297 | 49 days ago | IN | 0 ETH | 0.00074296 | ||||
Settle Filleds | 20875296 | 49 days ago | IN | 0 ETH | 0.00050904 | ||||
Settle Filleds | 20874901 | 49 days ago | IN | 0 ETH | 0.00073976 | ||||
Cancel Offer | 20869472 | 50 days ago | IN | 0 ETH | 0.00119865 | ||||
Cancel Offer | 20869425 | 50 days ago | IN | 0 ETH | 0.00108244 | ||||
Cancel Offer | 20869419 | 50 days ago | IN | 0 ETH | 0.00096763 | ||||
Settle Filleds | 20869050 | 50 days ago | IN | 0 ETH | 0.00208272 | ||||
Cancel Offer | 20868864 | 50 days ago | IN | 0 ETH | 0.00172621 | ||||
Token To Settle ... | 20868859 | 50 days ago | IN | 0 ETH | 0.00058903 | ||||
Token To Settle ... | 20868851 | 50 days ago | IN | 0 ETH | 0.0006018 | ||||
Fill Offer ETH | 20818184 | 57 days ago | IN | 0.07836679 ETH | 0.00145048 | ||||
Cancel Offer | 20748580 | 67 days ago | IN | 0 ETH | 0.00012294 | ||||
New Offer ETH | 20705512 | 73 days ago | IN | 0.007809 ETH | 0.00015852 | ||||
Fill Offer ETH | 20704806 | 73 days ago | IN | 0.002901 ETH | 0.00027365 | ||||
Create Token | 20575035 | 91 days ago | IN | 0 ETH | 0.00011731 | ||||
Create Token | 20575032 | 91 days ago | IN | 0 ETH | 0.00010876 | ||||
Create Token | 20540110 | 96 days ago | IN | 0 ETH | 0.00020144 |
Advanced mode: Intended for advanced users or developers and will display all Internal Transactions including zero value transfers. Name tag integration is not available in advanced view.
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | ||||
---|---|---|---|---|---|---|---|
21164927 | 8 days ago | 0.00063123 ETH | |||||
21164927 | 8 days ago | 0.12561521 ETH | |||||
20990722 | 33 days ago | 0 ETH | |||||
20990722 | 33 days ago | 0.063318 ETH | |||||
20976050 | 35 days ago | 0 ETH | |||||
20976050 | 35 days ago | 0.00332227 ETH | |||||
20976050 | 35 days ago | 0 ETH | |||||
20976050 | 35 days ago | 0 ETH | |||||
20976050 | 35 days ago | 0 ETH | |||||
20976050 | 35 days ago | 0 ETH | |||||
20976050 | 35 days ago | 0.00299004 ETH | |||||
20976050 | 35 days ago | 0 ETH | |||||
20976050 | 35 days ago | 0 ETH | |||||
20976050 | 35 days ago | 0 ETH | |||||
20976050 | 35 days ago | 0 ETH | |||||
20976050 | 35 days ago | 0.00299004 ETH | |||||
20976050 | 35 days ago | 0 ETH | |||||
20976050 | 35 days ago | 0 ETH | |||||
20976050 | 35 days ago | 0 ETH | |||||
20976050 | 35 days ago | 0 ETH | |||||
20976050 | 35 days ago | 0.00398673 ETH | |||||
20976050 | 35 days ago | 0 ETH | |||||
20976050 | 35 days ago | 0 ETH | |||||
20976050 | 35 days ago | 0 ETH | |||||
20875978 | 49 days ago | 0 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
PremiusMarket
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.16; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; struct Token { address token; uint48 settleTime; uint48 settleDuration; uint152 settleRate; // number of token per point uint8 status; // } struct Offer { uint8 offerType; bytes32 tokenId; address exToken; uint256 amount; uint256 value; uint256 collateral; uint256 filledAmount; uint8 status; address offeredBy; bool fullMatch; } struct Order { uint256 offerId; uint256 amount; address seller; address buyer; uint8 status; } struct Config { uint256 pledgeRate; uint256 feeRefund; uint256 feeSettle; address feeWallet; } contract PremiusMarket is AccessControl, ReentrancyGuard { using SafeERC20 for IERC20; uint256 constant WEI6 = 10 ** 6; uint8 constant OFFER_BUY = 1; uint8 constant OFFER_SELL = 2; // Status // Offer status uint8 constant STATUS_OFFER_OPEN = 1; uint8 constant STATUS_OFFER_FILLED = 2; uint8 constant STATUS_OFFER_CANCELLED = 3; // Order Status uint8 constant STATUS_ORDER_OPEN = 1; uint8 constant STATUS_ORDER_SETTLE_FILLED = 2; uint8 constant STATUS_ORDER_SETTLE_CANCELLED = 3; uint8 constant STATUS_ORDER_CANCELLED = 3; // token status uint8 constant STATUS_TOKEN_ACTIVE = 1; uint8 constant STATUS_TOKEN_INACTIVE = 2; uint8 constant STATUS_TOKEN_SETTLE = 3; bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE"); mapping(address => bool) public acceptedTokens; mapping(bytes32 => bool) public tokenCreated; mapping(bytes32 => Token) public tokens; mapping(uint256 => Offer) public offers; uint256 public lastOfferId; mapping(uint256 => Order) public orders; uint256 public lastOrderId; Config public config; // event event NewOffer( uint256 id, uint8 offerType, bytes32 tokenId, address exToken, uint256 amount, uint256 value, uint256 collateral, bool fullMatch, address doer ); event NewToken(bytes32 tokenId, uint256 settleDuration); event NewOrder(uint256 id, uint256 offerId, uint256 amount, address seller, address buyer); event SettleFilled(uint256 orderId, uint256 value, uint256 fee, address doer); event SettleCancelled(uint256 orderId, uint256 value, uint256 fee, address doer); event CancelOrder(uint256 orderId, address doer); event CancelOffer(uint256 offerId, uint256 refundValue, uint256 refundFee, address doer); event UpdateAcceptedTokens(address[] tokens, bool isAccepted); event CloseOffer(uint256 offerId, uint256 refundAmount); event UpdateConfig( address oldFeeWallet, uint256 oldFeeSettle, uint256 oldFeeRefund, uint256 oldPledgeRate, address newFeeWallet, uint256 newFeeSettle, uint256 newFeeRefund, uint256 newPledgeRate ); event TokenToSettlePhase(bytes32 tokenId, address token, uint256 settleRate, uint256 settleTime); event UpdateTokenStatus(bytes32 tokenId, uint8 oldValue, uint8 newValue); event TokenForceCancelSettlePhase(bytes32 tokenId); event Settle2Steps(uint256 orderId, bytes32 hash, address doer); event UpdateTokenSettleDuration(bytes32 tokenId, uint48 oldValue, uint48 newValue); constructor(address adminAddress, address feeWalletAddress) { require(adminAddress != address(0), "Admin address cannot be the zero address"); require(feeWalletAddress != address(0), "Fee wallet address cannot be the zero address"); _grantRole(DEFAULT_ADMIN_ROLE, adminAddress); _grantRole(OPERATOR_ROLE, adminAddress); config.pledgeRate = WEI6; // 1:1 config.feeWallet = feeWalletAddress; config.feeSettle = WEI6 / 50; // 2.0% config.feeRefund = WEI6 / 200; // 0.5% } /////////////////////////// ////// SYSTEM ACTION ////// /////////////////////////// /** * @dev Creates a new token. Only addresses with the OPERATOR_ROLE role can call this function. * @param tokenId The unique identifier of the token. * @param settleDuration The duration of the settlement, in seconds, representing the time from the start of the transaction to when it can be settled. */ function createToken(bytes32 tokenId, uint48 settleDuration) external onlyRole(OPERATOR_ROLE) { require(settleDuration >= 24 * 60 * 60, "createToken: Minimum 24h for settling"); //+ require(!tokenCreated[tokenId], "createToken: Token already exists"); tokenCreated[tokenId] = true; Token storage _token = tokens[tokenId]; _token.settleDuration = settleDuration; _token.status = STATUS_TOKEN_ACTIVE; emit NewToken(tokenId, settleDuration); } /** * @dev Moves a token to the settlement phase. Only addresses with the OPERATOR_ROLE role can call this function. * @param tokenId The unique identifier of the token. * @param tokenAddress The contract address of the token. * @param settleRate The settlement rate, representing how many tokens can be exchanged for 1M points. */ function tokenToSettlePhase( bytes32 tokenId, address tokenAddress, uint152 settleRate // how many token for 1M points ) external onlyRole(OPERATOR_ROLE) { Token storage _token = tokens[tokenId]; require(tokenAddress != address(0), "tokenToSettlePhase: Invalid Token Address"); require(settleRate > 0, "tokenToSettlePhase:Invalid Settle Rate"); require( _token.status == STATUS_TOKEN_ACTIVE || _token.status == STATUS_TOKEN_INACTIVE, "tokenToSettlePhase:Invalid Token Status" ); _token.token = tokenAddress; _token.settleRate = settleRate; // update token settle status & time _token.status = STATUS_TOKEN_SETTLE; _token.settleTime = uint48(block.timestamp); emit TokenToSettlePhase(tokenId, tokenAddress, settleRate, block.timestamp); } /** * @param tokenId The unique identifier of the token. */ function tokenToggleActivation(bytes32 tokenId) external onlyRole(OPERATOR_ROLE) { Token storage _token = tokens[tokenId]; uint8 fromStatus = _token.status; uint8 toStatus = fromStatus == STATUS_TOKEN_ACTIVE ? STATUS_TOKEN_INACTIVE : STATUS_TOKEN_ACTIVE; require(fromStatus == STATUS_TOKEN_ACTIVE || fromStatus == STATUS_TOKEN_INACTIVE, "Cannot Change Token Status"); _token.status = toStatus; emit UpdateTokenStatus(tokenId, fromStatus, toStatus); } /** * @param tokenId The unique identifier of the token. */ function tokenForceCancelSettlePhase(bytes32 tokenId) external onlyRole(OPERATOR_ROLE) { Token storage _token = tokens[tokenId]; require(_token.status == STATUS_TOKEN_SETTLE, "Invalid Token Status"); _token.status = STATUS_TOKEN_INACTIVE; emit TokenForceCancelSettlePhase(tokenId); } /** * @param tokenId The unique identifier of the token. * @param newValue The new settle duration value in seconds. */ function updateSettleDuration(bytes32 tokenId, uint48 newValue) external onlyRole(OPERATOR_ROLE) { require(newValue >= 24 * 60 * 60, "Minimum 24h for settling"); Token storage _token = tokens[tokenId]; uint48 oldValue = _token.settleDuration; _token.settleDuration = newValue; emit UpdateTokenSettleDuration(tokenId, oldValue, newValue); } /** * @param orderId The ID of the order to be canceled. */ function forceCancelOrder(uint256 orderId) public nonReentrant onlyRole(OPERATOR_ROLE) { Order storage order = orders[orderId]; Offer storage offer = offers[order.offerId]; require(order.status == STATUS_OFFER_OPEN, "Invalid Order Status"); // PMA-3 uint8 targetDecimals; if (offer.exToken == address(0)) { targetDecimals = 18; } else { targetDecimals = IERC20Metadata(offer.exToken).decimals(); } // calculate refund value uint256 buyerRefundValue = convertDecimals( (order.amount * offer.value) / offer.amount, 18, // source decimals targetDecimals ); uint256 sellerRefundValue = convertDecimals( (order.amount * offer.collateral) / offer.amount, 18, // source decimals targetDecimals ); address buyer = order.buyer; address seller = order.seller; // refund if (offer.exToken == address(0)) { // refund ETH if (buyerRefundValue > 0 && buyer != address(0)) { (bool success,) = buyer.call{value: buyerRefundValue}(""); require(success, "Transfer Funds to Seller Fail"); } if (sellerRefundValue > 0 && seller != address(0)) { (bool success,) = seller.call{value: sellerRefundValue}(""); require(success, "Transfer Funds to Seller Fail"); } } else { IERC20 iexToken = IERC20(offer.exToken); if (buyerRefundValue > 0 && buyer != address(0)) { iexToken.safeTransfer(buyer, buyerRefundValue); } if (sellerRefundValue > 0 && seller != address(0)) { iexToken.safeTransfer(seller, sellerRefundValue); } } order.status = STATUS_ORDER_CANCELLED; emit CancelOrder(orderId, _msgSender()); } /** * @param orderId The ID of the order being settled. * @param hash A hash representing transaction details or verification information, used for additional security or validation. */ function settle2Steps(uint256 orderId, bytes32 hash) public nonReentrant onlyRole(OPERATOR_ROLE) { Order storage order = orders[orderId]; Offer storage offer = offers[order.offerId]; Token storage token = tokens[offer.tokenId]; // check condition require(token.status == STATUS_TOKEN_SETTLE, "Invalid Status"); require(token.token != address(0) && token.settleRate > 0, "Token Not Set"); //PMA-5 require(token.settleTime > 0, "Settling Time Not Started"); require(order.status == STATUS_ORDER_OPEN, "Invalid Order Status"); uint8 targetDecimals; if (offer.exToken == address(0)) { targetDecimals = 18; } else { targetDecimals = IERC20Metadata(offer.exToken).decimals(); } // calculate and adjust the precision of the settlement value uint256 collateral = convertDecimals((order.amount * offer.collateral) / offer.amount, 18, targetDecimals); uint256 value = convertDecimals((order.amount * offer.value) / offer.amount, 18, targetDecimals); // transfer liquid to seller uint256 settleFee = (value * config.feeSettle) / WEI6; uint256 totalValue = value + collateral - settleFee; if (offer.exToken == address(0)) { // by ETH (bool success1,) = order.seller.call{value: totalValue}(""); (bool success2,) = config.feeWallet.call{value: settleFee}(""); require(success1 && success2, "Transfer Funds Fail"); } else { // by exToken IERC20 iexToken = IERC20(offer.exToken); iexToken.safeTransfer(order.seller, totalValue); iexToken.safeTransfer(config.feeWallet, settleFee); } order.status = STATUS_ORDER_SETTLE_FILLED; emit Settle2Steps(orderId, hash, _msgSender()); emit SettleFilled(orderId, totalValue, settleFee, _msgSender()); } /** * @param orderIds An array of order IDs to be settled. * @param hashes An array of hashes, each corresponding to a transaction in the `orderIds` array for verification. */ function settle2StepsBatch(uint256[] memory orderIds, bytes32[] memory hashes) external { require(orderIds.length == hashes.length, "Invalid Input"); for (uint256 i = 0; i < orderIds.length; i++) { settle2Steps(orderIds[i], hashes[i]); } } ///////////////////////// ////// USER ACTION ////// ///////////////////////// /** * @param offerType Specifies the type of offer: 1 for buy, 2 for sell. * @param tokenId The unique identifier of the token for which the offer is being made. * @param amount The amount of tokens being offered for buy/sell. * @param value The total value (in exchange token or ETH) that the offerer is willing to pay or receive. * @param exToken The token address against which the offer is being made. Address(0) if the offer is in ETH. * @param fullMatch A boolean indicating if the offer must be fully matched (true) or can be partially filled (false). */ function newOffer(uint8 offerType, bytes32 tokenId, uint256 amount, uint256 value, address exToken, bool fullMatch) external nonReentrant { Token storage token = tokens[tokenId]; require(token.status == STATUS_TOKEN_ACTIVE, "Invalid Token"); require(exToken != address(0) && acceptedTokens[exToken], "Invalid Offer Token"); require(amount > 0 && value > 0, "Invalid Amount or Value"); uint8 targetDecimals = IERC20Metadata(exToken).decimals(); uint256 adjustedValue = convertDecimalsCeil(value, 18, targetDecimals); uint256 collateral = (value * config.pledgeRate) / WEI6; uint256 adjustedCollateral = convertDecimalsCeil(collateral, 18, targetDecimals); uint256 _transferAmount = offerType == OFFER_BUY ? adjustedValue : adjustedCollateral; IERC20 iexToken = IERC20(exToken); iexToken.safeTransferFrom(_msgSender(), address(this), _transferAmount); // create new offer _newOffer(offerType, tokenId, exToken, amount, value, collateral, fullMatch); } /** * @param offerType, tokenId, amount, value, and fullMatch parameters have the same definitions as in `newOffer`. */ function newOfferETH(uint8 offerType, bytes32 tokenId, uint256 amount, uint256 value, bool fullMatch) external payable nonReentrant { Token storage token = tokens[tokenId]; require(token.status == STATUS_TOKEN_ACTIVE, "Invalid Token"); require(amount > 0 && value > 0, "Invalid Amount or Value"); // collateral uint256 collateral = (value * config.pledgeRate) / WEI6; uint256 _ethAmount = offerType == OFFER_BUY ? value : collateral; require(_ethAmount <= msg.value, "Insufficient Funds"); // (PMA-1)If the sent ETH is more than required, refund the excess if (msg.value > _ethAmount) { uint256 excessAmount = msg.value - _ethAmount; (bool refundSuccess,) = msg.sender.call{value: excessAmount}(""); require(refundSuccess, "Refund of excess ETH failed"); } // create new offer _newOffer(offerType, tokenId, address(0), amount, value, collateral, fullMatch); } /** * @param offerId The ID of the offer being filled. * @param amount The amount of the offer the filler wishes to fulfill. Must not exceed the available amount in the offer. */ function fillOffer(uint256 offerId, uint256 amount) external nonReentrant { Offer storage offer = offers[offerId]; Token storage token = tokens[offer.tokenId]; require(offer.status == STATUS_OFFER_OPEN, "Invalid Offer Status"); require(token.status == STATUS_TOKEN_ACTIVE, "Invalid token Status"); require(amount > 0, "Invalid Amount"); require(offer.amount - offer.filledAmount >= amount, "Insufficient Allocations"); require(offer.fullMatch == false || offer.amount == amount, "FullMatch required"); require(offer.exToken != address(0), "Invalid Offer Token"); // transfer value or collateral IERC20 iexToken = IERC20(offer.exToken); uint256 _transferAmount; address buyer; address seller; uint8 targetDecimals = IERC20Metadata(offer.exToken).decimals(); if (offer.offerType == OFFER_BUY) { uint256 collateralAmount = (offer.collateral * amount) / offer.amount; _transferAmount = convertDecimalsCeil(collateralAmount, 18, targetDecimals); buyer = offer.offeredBy; seller = _msgSender(); } else { uint256 valueAmount = (offer.value * amount) / offer.amount; _transferAmount = convertDecimalsCeil(valueAmount, 18, targetDecimals); buyer = _msgSender(); seller = offer.offeredBy; } iexToken.safeTransferFrom(_msgSender(), address(this), _transferAmount); // new order _fillOffer(offerId, amount, buyer, seller); } /** * @param offerId The ID of the offer to be filled. * @param amount The amount of the offer that the user wishes to fulfill. */ function fillOfferETH(uint256 offerId, uint256 amount) external payable nonReentrant { Offer storage offer = offers[offerId]; Token storage token = tokens[offer.tokenId]; require(offer.status == STATUS_OFFER_OPEN, "Invalid Offer Status"); require(token.status == STATUS_TOKEN_ACTIVE, "Invalid token Status"); require(amount > 0, "Invalid Amount"); require(offer.amount - offer.filledAmount >= amount, "Insufficient Allocations"); require(offer.fullMatch == false || offer.amount == amount, "FullMatch required"); require(offer.exToken == address(0), "Invalid Offer Token"); // transfer value or collecteral uint256 _ethAmount; address buyer; address seller; if (offer.offerType == OFFER_BUY) { _ethAmount = (offer.collateral * amount) / offer.amount; buyer = offer.offeredBy; seller = _msgSender(); } else { _ethAmount = (offer.value * amount) / offer.amount; buyer = _msgSender(); seller = offer.offeredBy; } require(msg.value >= _ethAmount, "Insufficient Funds"); // (PMA-1)Refund excess ETH if (msg.value > _ethAmount) { uint256 excessAmount = msg.value - _ethAmount; (bool refundSuccess,) = msg.sender.call{value: excessAmount}(""); require(refundSuccess, "Refund of excess ETH failed"); } // new order _fillOffer(offerId, amount, buyer, seller); } /** * @param offerId The ID of the offer to be cancelled. */ function cancelOffer(uint256 offerId) public nonReentrant { Offer storage offer = offers[offerId]; require(offer.offeredBy == _msgSender(), "Offer Owner Only"); require(offer.status == STATUS_OFFER_OPEN, "Invalid Offer Status"); uint256 refundAmount = offer.amount - offer.filledAmount; require(refundAmount > 0, "Insufficient Allocations"); // calculate refund uint8 targetDecimals; if (offer.exToken == address(0)) { targetDecimals = 18; } else { targetDecimals = IERC20Metadata(offer.exToken).decimals(); } uint256 refundValue; if (offer.offerType == OFFER_BUY) { refundValue = convertDecimals( (refundAmount * offer.value) / offer.amount, 18, // source decimals targetDecimals ); } else { refundValue = convertDecimals( (refundAmount * offer.collateral) / offer.amount, 18, // source decimals targetDecimals ); } uint256 refundFee = (refundValue * config.feeRefund) / WEI6; refundValue -= refundFee; // refund if (offer.exToken == address(0)) { // refund ETH (bool success1,) = offer.offeredBy.call{value: refundValue}(""); (bool success2,) = config.feeWallet.call{value: refundFee}(""); require(success1 && success2, "Transfer Funds Fail"); } else { IERC20 iexToken = IERC20(offer.exToken); iexToken.safeTransfer(offer.offeredBy, refundValue); iexToken.safeTransfer(config.feeWallet, refundFee); } offer.status = STATUS_OFFER_CANCELLED; emit CancelOffer(offerId, refundValue, refundFee, _msgSender()); } /** * @param orderId The ID of the order to settle. */ function settleFilled(uint256 orderId) public nonReentrant { Order storage order = orders[orderId]; Offer storage offer = offers[order.offerId]; Token storage token = tokens[offer.tokenId]; // check condition require(token.status == STATUS_TOKEN_SETTLE, "Invalid Status"); require(token.token != address(0) && token.settleRate > 0, "Token Not Set"); //PMA-5 require(token.settleTime > 0, "Settling Time Not Started"); require(order.seller == _msgSender(), "Seller Only"); require(order.status == STATUS_ORDER_OPEN, "Invalid Order Status"); uint8 exTokenDecimals; if (offer.exToken == address(0)) { exTokenDecimals = 18; } else { exTokenDecimals = IERC20Metadata(offer.exToken).decimals(); } uint256 collateral = convertDecimals((order.amount * offer.collateral) / offer.amount, 18, exTokenDecimals); uint256 value = convertDecimals((order.amount * offer.value) / offer.amount, 18, exTokenDecimals); // transfer token to buyer IERC20 iToken = IERC20(token.token); uint8 tokenDecimals = IERC20Metadata(token.token).decimals(); // calculate token amount uint256 tokenAmount = convertDecimals((order.amount * token.settleRate) / WEI6, 18, tokenDecimals); uint256 tokenAmountFee = (tokenAmount * config.feeSettle) / WEI6; // transfer order fee in token to fee wallet iToken.safeTransferFrom(order.seller, config.feeWallet, tokenAmountFee); // transfer token after fee to buyer iToken.safeTransferFrom(order.seller, order.buyer, tokenAmount - tokenAmountFee); // transfer liquid to seller uint256 settleFee = (value * config.feeSettle) / WEI6; uint256 totalValue = value + collateral - settleFee; if (offer.exToken == address(0)) { // by ETH (bool success1,) = order.seller.call{value: totalValue}(""); (bool success2,) = config.feeWallet.call{value: settleFee}(""); require(success1 && success2, "Transfer Funds Fail"); } else { // by exToken IERC20 iexToken = IERC20(offer.exToken); iexToken.safeTransfer(order.seller, totalValue); iexToken.safeTransfer(config.feeWallet, settleFee); } order.status = STATUS_ORDER_SETTLE_FILLED; emit SettleFilled(orderId, totalValue, settleFee, _msgSender()); } /** * @param orderId The ID of the order to cancel settlement for. */ function settleCancelled(uint256 orderId) public nonReentrant { Order storage order = orders[orderId]; Offer storage offer = offers[order.offerId]; Token storage token = tokens[offer.tokenId]; // check condition require(token.status == STATUS_TOKEN_SETTLE, "Invalid Status"); require(block.timestamp > token.settleTime + token.settleDuration, "Settling Time Not Ended Yet"); require(order.status == STATUS_ORDER_OPEN, "Invalid Order Status"); require(order.buyer == _msgSender() || hasRole(OPERATOR_ROLE, _msgSender()), "Buyer or Operator Only"); uint8 exTokenDecimals; if (offer.exToken == address(0)) { exTokenDecimals = 18; } else { exTokenDecimals = IERC20Metadata(offer.exToken).decimals(); } uint256 collateral = convertDecimals((order.amount * offer.collateral) / offer.amount, 18, exTokenDecimals); uint256 value = convertDecimals((order.amount * offer.value) / offer.amount, 18, exTokenDecimals); // transfer liquid to buyer uint256 settleFee = (collateral * config.feeSettle * 2) / WEI6; uint256 totalValue = value + collateral - settleFee; if (offer.exToken == address(0)) { // by ETH (bool success1,) = order.buyer.call{value: totalValue}(""); (bool success2,) = config.feeWallet.call{value: settleFee}(""); require(success1 && success2, "Transfer Funds Fail"); } else { // by exToken IERC20 iexToken = IERC20(offer.exToken); iexToken.safeTransfer(order.buyer, totalValue); iexToken.safeTransfer(config.feeWallet, settleFee); } order.status = STATUS_ORDER_SETTLE_CANCELLED; emit SettleCancelled(orderId, totalValue, settleFee, _msgSender()); } /** * @param orderIds An array of order IDs to be forcibly cancelled. */ function forceCancelOrders(uint256[] memory orderIds) external { for (uint256 i = 0; i < orderIds.length; i++) { forceCancelOrder(orderIds[i]); } } /** * @param offerIds An array of offer IDs that the user wishes to cancel. */ function cancelOffers(uint256[] memory offerIds) external { for (uint256 i = 0; i < offerIds.length; i++) { cancelOffer(offerIds[i]); } } /** * @param orderIds An array of order IDs to be settled. */ function settleFilleds(uint256[] memory orderIds) external { for (uint256 i = 0; i < orderIds.length; i++) { settleFilled(orderIds[i]); } } /** * @param orderIds An array of order IDs for which settlement is to be cancelled. */ function settleCancelleds(uint256[] memory orderIds) external { for (uint256 i = 0; i < orderIds.length; i++) { settleCancelled(orderIds[i]); } } /** * @param offerIds An array of offer IDs to be filled. * @param amounts An array of amounts, each corresponding to an offer in the `offerIds` array. */ function fillOffers(uint256[] memory offerIds, uint256[] memory amounts) external nonReentrant { require(offerIds.length == amounts.length, "Invalid Input"); for (uint256 i = 0; i < offerIds.length; i++) { uint256 offerId = offerIds[i]; uint256 amount = amounts[i]; Offer storage offer = offers[offerId]; Token storage token = tokens[offer.tokenId]; require(offer.status == STATUS_OFFER_OPEN, "Invalid Offer Status"); require(token.status == STATUS_TOKEN_ACTIVE, "Invalid token Status"); require(amount > 0, "Invalid Amount"); require(offer.amount - offer.filledAmount >= amount, "Insufficient Allocations"); require(offer.fullMatch == false || offer.amount == amount, "FullMatch required"); require(offer.exToken != address(0), "Invalid Offer Token"); // transfer value or collateral IERC20 iexToken = IERC20(offer.exToken); uint256 _transferAmount; address buyer; address seller; uint8 targetDecimals = IERC20Metadata(offer.exToken).decimals(); if (offer.offerType == OFFER_BUY) { uint256 collateralAmount = (offer.collateral * amount) / offer.amount; _transferAmount = convertDecimalsCeil(collateralAmount, 18, targetDecimals); buyer = offer.offeredBy; seller = _msgSender(); } else { uint256 valueAmount = (offer.value * amount) / offer.amount; _transferAmount = convertDecimalsCeil(valueAmount, 18, targetDecimals); buyer = _msgSender(); seller = offer.offeredBy; } iexToken.safeTransferFrom(_msgSender(), address(this), _transferAmount); // new order _fillOffer(offerId, amount, buyer, seller); } } /** * @param offerIds An array of offer IDs to be filled. * @param amounts An array of amounts, each corresponding to an offer in the `offerIds` array. */ function fillOffersETH(uint256[] memory offerIds, uint256[] memory amounts) external payable nonReentrant { require(offerIds.length == amounts.length, "Invalid Input"); uint256 totalEthAmount = 0; for (uint256 i = 0; i < offerIds.length; i++) { uint256 offerId = offerIds[i]; uint256 amount = amounts[i]; Offer storage offer = offers[offerId]; Token storage token = tokens[offer.tokenId]; require(offer.status == STATUS_OFFER_OPEN, "Invalid Offer Status"); require(token.status == STATUS_TOKEN_ACTIVE, "Invalid token Status"); require(amount > 0, "Invalid Amount"); require(offer.amount - offer.filledAmount >= amount, "Insufficient Allocations"); require(offer.fullMatch == false || offer.amount == amount, "FullMatch required"); require(offer.exToken == address(0), "Invalid Offer Token"); uint256 _ethAmount; if (offer.offerType == OFFER_BUY) { _ethAmount = (offer.collateral * amount) / offer.amount; } else { _ethAmount = (offer.value * amount) / offer.amount; } totalEthAmount += _ethAmount; // Assuming _fillOffer handles the logic for each offer correctly _fillOffer(offerId, amount, offer.offeredBy, _msgSender()); } require(msg.value >= totalEthAmount, "Insufficient Funds"); // (PMA-1)Refund excess ETH if (msg.value > totalEthAmount) { uint256 excessAmount = msg.value - totalEthAmount; (bool refundSuccess,) = msg.sender.call{value: excessAmount}(""); require(refundSuccess, "Refund of excess ETH failed"); } } /////////////////////////// ///////// SETTER ////////// /////////////////////////// /** * @param feeWallet_ The address of the wallet where transaction fees are collected. * @param feeSettle_ The fee percentage charged upon the successful settlement of an order. * @param feeRefund_ The fee percentage charged when an offer is cancelled and funds are refunded. * @param pledgeRate_ The required collateral percentage for creating sell offers. */ function updateConfig(address feeWallet_, uint256 feeSettle_, uint256 feeRefund_, uint256 pledgeRate_) external onlyRole(OPERATOR_ROLE) { require(feeWallet_ != address(0), "Invalid Address"); require(feeSettle_ <= WEI6 / 10, "Settle Fee <= 10%"); require(feeRefund_ <= WEI6 / 10, "Cancel Fee <= 10%"); //PMA-2 limit pledge rate from 1% to 100%. require(pledgeRate_ >= WEI6 / 100 && pledgeRate_ <= WEI6, "Pledge Rate out of range"); emit UpdateConfig( config.feeWallet, config.feeSettle, config.feeRefund, config.pledgeRate, feeWallet_, feeSettle_, feeRefund_, pledgeRate_ ); // update config.feeWallet = feeWallet_; config.feeSettle = feeSettle_; config.feeRefund = feeRefund_; config.pledgeRate = pledgeRate_; } /** * @param tokenAddresses An array of token addresses to be updated. * @param isAccepted Boolean flag indicating whether the tokens should be accepted (true) or not (false). */ function setAcceptedTokens(address[] memory tokenAddresses, bool isAccepted) external onlyRole(OPERATOR_ROLE) { for (uint256 i = 0; i < tokenAddresses.length; i++) { acceptedTokens[tokenAddresses[i]] = isAccepted; } emit UpdateAcceptedTokens(tokenAddresses, isAccepted); } /////////////////////////// ///////// GETTER ////////// /////////////////////////// /** * @param offerId The unique identifier of the offer. */ function offerAmount(uint256 offerId) external view returns (uint256) { return offers[offerId].amount; } /** * @param offerId The unique identifier of the offer. */ function offerAmountAvailable(uint256 offerId) external view returns (uint256) { return offers[offerId].amount - offers[offerId].filledAmount; } /** * @param offerId The unique identifier of the offer. */ function offerValue(uint256 offerId) external view returns (uint256) { return offers[offerId].value; } /** * @param offerId The unique identifier of the offer. */ function offerExToken(uint256 offerId) external view returns (address) { return offers[offerId].exToken; } /** * @param offerId The unique identifier of the offer. */ function isBuyOffer(uint256 offerId) external view returns (bool) { return offers[offerId].offerType == OFFER_BUY; } /** * @param offerId The unique identifier of the offer. */ function isSellOffer(uint256 offerId) external view returns (bool) { return offers[offerId].offerType == OFFER_SELL; } /** * @param offerId The unique identifier of the offer. */ function offerStatus(uint256 offerId) external view returns (uint256) { return offers[offerId].status; } /** * @param orderId The unique identifier of the order. */ function orderStatus(uint256 orderId) external view returns (uint256) { return orders[orderId].status; } /** * @param id The unique identifier of the token, typically derived from its properties or a hash of its metadata. */ function tokensInfo(bytes32 id) external view returns (Token memory tokenInfo) { return tokens[id]; } /** * @param id The unique identifier of the offer. */ function offersInfo(uint256 id) external view returns (Offer memory) { return offers[id]; } /** * @param id The unique identifier of the order. */ function ordersInfo(uint256 id) external view returns (Order memory) { return orders[id]; } /** * Accesses the current configuration settings of the platform, including fees and the pledge rate. */ function configInfo() external view returns (Config memory) { return config; } /** * Checks whether a specific token is accepted for trading on the platform. * @param token The address of the token in question. */ function isAcceptedToken(address token) external view returns (bool) { return acceptedTokens[token]; } /** * Retrieves the identifier of the last offer made in the market, indicative of the total number of offers created. */ function lastOfferIdInfo() external view returns (uint256) { return lastOfferId; } /** * Returns the identifier of the last order processed in the system, serving as a measure of the platform's trading volume. */ function lastOrderIdInfo() external view returns (uint256) { return lastOrderId; } /////////////////////////// //////// INTERNAL ///////// /////////////////////////// /** * @param offerType Specifies whether it's a buy or sell offer. * @param tokenId The unique identifier for the token being traded. * @param exToken The address of the exchange token or ETH used for the trade. * @param amount The amount of the token being offered. * @param value The total value (in exToken or ETH) of the offer. * @param collateral The required collateral for the offer, applicable for sell offers. * @param fullMatch Indicates whether the offer requires to be filled in its entirety. */ function _newOffer( uint8 offerType, bytes32 tokenId, address exToken, uint256 amount, uint256 value, uint256 collateral, bool fullMatch ) internal { // create new offer offers[++lastOfferId] = Offer(offerType, tokenId, exToken, amount, value, collateral, 0, STATUS_OFFER_OPEN, _msgSender(), fullMatch); emit NewOffer(lastOfferId, offerType, tokenId, exToken, amount, value, collateral, fullMatch, _msgSender()); } /** * @param offerId The ID of the offer being filled. * @param amount The amount of the offer that is being fulfilled. * @param buyer The address of the buyer in the transaction. * @param seller The address of the seller. */ function _fillOffer(uint256 offerId, uint256 amount, address buyer, address seller) internal { Offer storage offer = offers[offerId]; // new order orders[++lastOrderId] = Order(offerId, amount, seller, buyer, STATUS_ORDER_OPEN); // check if offer is fullfilled offer.filledAmount += amount; if (offer.filledAmount == offer.amount) { offer.status = STATUS_OFFER_FILLED; emit CloseOffer(offerId, 0); } emit NewOrder(lastOrderId, offerId, amount, seller, buyer); } /** * @dev Withdraws stuck tokens from the contract. Only addresses with the UPGRADER_ROLE role can call this function. * @param _token The address of the token to withdraw. * @param _to The address to receive the withdrawn tokens. * @notice Use this function with caution to avoid accidentally moving funds. */ function withdrawStuckToken(address _token, address _to) external onlyRole(DEFAULT_ADMIN_ROLE) { require(_token != address(0) && !acceptedTokens[_token], "Invalid Token Address"); uint256 _contractBalance = IERC20(_token).balanceOf(address(this)); IERC20(_token).safeTransfer(_to, _contractBalance); } /** * @dev Convert value from sourceDecimals to targetDecimals. */ function convertDecimals(uint256 value, uint8 sourceDecimals, uint8 targetDecimals) internal pure returns (uint256 result) { if (sourceDecimals == targetDecimals) { result = value; } else if (sourceDecimals < targetDecimals) { result = value * (10 ** (targetDecimals - sourceDecimals)); } else { result = value / (10 ** (sourceDecimals - targetDecimals)); } } /** * @dev Convert value from sourceDecimals to targetDecimals, rounded up. */ function convertDecimalsCeil(uint256 value, uint8 sourceDecimals, uint8 targetDecimals) internal pure returns (uint256 result) { if (sourceDecimals == targetDecimals) { result = value; } else if (sourceDecimals < targetDecimals) { result = value * (10 ** (targetDecimals - sourceDecimals)); } else { uint256 temp = 10 ** (sourceDecimals - targetDecimals); result = value / temp; if (value % temp != 0) { result += 1; } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) pragma solidity ^0.8.20; import {IAccessControl} from "./IAccessControl.sol"; import {Context} from "../utils/Context.sol"; import {ERC165} from "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address account => bool) hasRole; bytes32 adminRole; } mapping(bytes32 role => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with an {AccessControlUnauthorizedAccount} error including the required role. */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual returns (bool) { return _roles[role].hasRole[account]; } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()` * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier. */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account` * is missing `role`. */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert AccessControlUnauthorizedAccount(account, role); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address callerConfirmation) public virtual { if (callerConfirmation != _msgSender()) { revert AccessControlBadConfirmation(); } _revokeRole(role, callerConfirmation); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual returns (bool) { if (!hasRole(role, account)) { _roles[role].hasRole[account] = true; emit RoleGranted(role, account, _msgSender()); return true; } else { return false; } } /** * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { if (hasRole(role, account)) { _roles[role].hasRole[account] = false; emit RoleRevoked(role, account, _msgSender()); return true; } else { return false; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol) pragma solidity ^0.8.20; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev The `account` is missing a role. */ error AccessControlUnauthorizedAccount(address account, bytes32 neededRole); /** * @dev The caller of a function is not the expected one. * * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}. */ error AccessControlBadConfirmation(); /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. */ function renounceRole(bytes32 role, address callerConfirmation) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ 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 v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @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. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ 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]. * * CAUTION: See Security Considerations above. */ 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 (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../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; /** * @dev An operation with an ERC20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @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); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @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). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // 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 cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @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 or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * 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. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @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`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) 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 FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @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; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; uint256 private _status; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); constructor() { _status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be NOT_ENTERED if (_status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail _status = ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == ENTERED; } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; /// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) /// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) /// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. abstract contract ERC20 { /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 amount); event Approval( address indexed owner, address indexed spender, uint256 amount ); /*////////////////////////////////////////////////////////////// METADATA STORAGE //////////////////////////////////////////////////////////////*/ string public name; string public symbol; uint8 public immutable decimals; /*////////////////////////////////////////////////////////////// ERC20 STORAGE //////////////////////////////////////////////////////////////*/ uint256 public totalSupply; mapping(address => uint256) public balanceOf; mapping(address => mapping(address => uint256)) public allowance; /*////////////////////////////////////////////////////////////// EIP-2612 STORAGE //////////////////////////////////////////////////////////////*/ uint256 internal immutable INITIAL_CHAIN_ID; bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR; mapping(address => uint256) public nonces; /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor(string memory _name, string memory _symbol, uint8 _decimals) { name = _name; symbol = _symbol; decimals = _decimals; INITIAL_CHAIN_ID = block.chainid; INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); } /*////////////////////////////////////////////////////////////// ERC20 LOGIC //////////////////////////////////////////////////////////////*/ function approve( address spender, uint256 amount ) public virtual returns (bool) { allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } function transfer( address to, uint256 amount ) public virtual returns (bool) { balanceOf[msg.sender] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(msg.sender, to, amount); return true; } function transferFrom( address from, address to, uint256 amount ) public virtual returns (bool) { uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount; balanceOf[from] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(from, to, amount); return true; } /*////////////////////////////////////////////////////////////// EIP-2612 LOGIC //////////////////////////////////////////////////////////////*/ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); // Unchecked because the only math done is incrementing // the owner's nonce which cannot realistically overflow. unchecked { address recoveredAddress = ecrecover( keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR(), keccak256( abi.encode( keccak256( "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" ), owner, spender, value, nonces[owner]++, deadline ) ) ) ), v, r, s ); require( recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER" ); allowance[recoveredAddress][spender] = value; } emit Approval(owner, spender, value); } function DOMAIN_SEPARATOR() public view virtual returns (bytes32) { return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator(); } function computeDomainSeparator() internal view virtual returns (bytes32) { return keccak256( abi.encode( keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ), keccak256(bytes(name)), keccak256("1"), block.chainid, address(this) ) ); } /*////////////////////////////////////////////////////////////// INTERNAL MINT/BURN LOGIC //////////////////////////////////////////////////////////////*/ function _mint(address to, uint256 amount) internal virtual { totalSupply += amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(address(0), to, amount); } function _burn(address from, uint256 amount) internal virtual { balanceOf[from] -= amount; // Cannot underflow because a user's balance // will never be larger than the total supply. unchecked { totalSupply -= amount; } emit Transfer(from, address(0), amount); } } contract Token is ERC20 { string constant TokenName = "LuckyToken"; string constant Symbol = "LT"; uint8 constant Decimals = 6; uint256 public immutable initSupply = 100000000 ether; address public immutable owner; uint256 public constant MINT_ONCE = 10000 ether; constructor() ERC20(TokenName, Symbol, Decimals) { _mint(msg.sender, initSupply); owner = msg.sender; } function publicMint() external { _mint(msg.sender, MINT_ONCE); } function mintTo(address _to, uint256 _amount) external { require(msg.sender == owner, "onlyOwner"); _mint(_to, _amount); } }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"adminAddress","type":"address"},{"internalType":"address","name":"feeWalletAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"offerId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"refundValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"refundFee","type":"uint256"},{"indexed":false,"internalType":"address","name":"doer","type":"address"}],"name":"CancelOffer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"orderId","type":"uint256"},{"indexed":false,"internalType":"address","name":"doer","type":"address"}],"name":"CancelOrder","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"offerId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"refundAmount","type":"uint256"}],"name":"CloseOffer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint8","name":"offerType","type":"uint8"},{"indexed":false,"internalType":"bytes32","name":"tokenId","type":"bytes32"},{"indexed":false,"internalType":"address","name":"exToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"collateral","type":"uint256"},{"indexed":false,"internalType":"bool","name":"fullMatch","type":"bool"},{"indexed":false,"internalType":"address","name":"doer","type":"address"}],"name":"NewOffer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"offerId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"seller","type":"address"},{"indexed":false,"internalType":"address","name":"buyer","type":"address"}],"name":"NewOrder","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"tokenId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"settleDuration","type":"uint256"}],"name":"NewToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"orderId","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"hash","type":"bytes32"},{"indexed":false,"internalType":"address","name":"doer","type":"address"}],"name":"Settle2Steps","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"orderId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"address","name":"doer","type":"address"}],"name":"SettleCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"orderId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"address","name":"doer","type":"address"}],"name":"SettleFilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"tokenId","type":"bytes32"}],"name":"TokenForceCancelSettlePhase","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"tokenId","type":"bytes32"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"settleRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"settleTime","type":"uint256"}],"name":"TokenToSettlePhase","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"tokens","type":"address[]"},{"indexed":false,"internalType":"bool","name":"isAccepted","type":"bool"}],"name":"UpdateAcceptedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldFeeWallet","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldFeeSettle","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"oldFeeRefund","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"oldPledgeRate","type":"uint256"},{"indexed":false,"internalType":"address","name":"newFeeWallet","type":"address"},{"indexed":false,"internalType":"uint256","name":"newFeeSettle","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newFeeRefund","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newPledgeRate","type":"uint256"}],"name":"UpdateConfig","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"tokenId","type":"bytes32"},{"indexed":false,"internalType":"uint48","name":"oldValue","type":"uint48"},{"indexed":false,"internalType":"uint48","name":"newValue","type":"uint48"}],"name":"UpdateTokenSettleDuration","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"tokenId","type":"bytes32"},{"indexed":false,"internalType":"uint8","name":"oldValue","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"newValue","type":"uint8"}],"name":"UpdateTokenStatus","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"acceptedTokens","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"offerId","type":"uint256"}],"name":"cancelOffer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"offerIds","type":"uint256[]"}],"name":"cancelOffers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"config","outputs":[{"internalType":"uint256","name":"pledgeRate","type":"uint256"},{"internalType":"uint256","name":"feeRefund","type":"uint256"},{"internalType":"uint256","name":"feeSettle","type":"uint256"},{"internalType":"address","name":"feeWallet","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"configInfo","outputs":[{"components":[{"internalType":"uint256","name":"pledgeRate","type":"uint256"},{"internalType":"uint256","name":"feeRefund","type":"uint256"},{"internalType":"uint256","name":"feeSettle","type":"uint256"},{"internalType":"address","name":"feeWallet","type":"address"}],"internalType":"struct Config","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"tokenId","type":"bytes32"},{"internalType":"uint48","name":"settleDuration","type":"uint48"}],"name":"createToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"offerId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"fillOffer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"offerId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"fillOfferETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"offerIds","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"fillOffers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"offerIds","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"fillOffersETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"orderId","type":"uint256"}],"name":"forceCancelOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"orderIds","type":"uint256[]"}],"name":"forceCancelOrders","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"isAcceptedToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"offerId","type":"uint256"}],"name":"isBuyOffer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"offerId","type":"uint256"}],"name":"isSellOffer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastOfferId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastOfferIdInfo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastOrderId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastOrderIdInfo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"offerType","type":"uint8"},{"internalType":"bytes32","name":"tokenId","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"exToken","type":"address"},{"internalType":"bool","name":"fullMatch","type":"bool"}],"name":"newOffer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"offerType","type":"uint8"},{"internalType":"bytes32","name":"tokenId","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bool","name":"fullMatch","type":"bool"}],"name":"newOfferETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"offerId","type":"uint256"}],"name":"offerAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"offerId","type":"uint256"}],"name":"offerAmountAvailable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"offerId","type":"uint256"}],"name":"offerExToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"offerId","type":"uint256"}],"name":"offerStatus","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"offerId","type":"uint256"}],"name":"offerValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"offers","outputs":[{"internalType":"uint8","name":"offerType","type":"uint8"},{"internalType":"bytes32","name":"tokenId","type":"bytes32"},{"internalType":"address","name":"exToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"collateral","type":"uint256"},{"internalType":"uint256","name":"filledAmount","type":"uint256"},{"internalType":"uint8","name":"status","type":"uint8"},{"internalType":"address","name":"offeredBy","type":"address"},{"internalType":"bool","name":"fullMatch","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"offersInfo","outputs":[{"components":[{"internalType":"uint8","name":"offerType","type":"uint8"},{"internalType":"bytes32","name":"tokenId","type":"bytes32"},{"internalType":"address","name":"exToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"collateral","type":"uint256"},{"internalType":"uint256","name":"filledAmount","type":"uint256"},{"internalType":"uint8","name":"status","type":"uint8"},{"internalType":"address","name":"offeredBy","type":"address"},{"internalType":"bool","name":"fullMatch","type":"bool"}],"internalType":"struct Offer","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"orderId","type":"uint256"}],"name":"orderStatus","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"orders","outputs":[{"internalType":"uint256","name":"offerId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"seller","type":"address"},{"internalType":"address","name":"buyer","type":"address"},{"internalType":"uint8","name":"status","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"ordersInfo","outputs":[{"components":[{"internalType":"uint256","name":"offerId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"seller","type":"address"},{"internalType":"address","name":"buyer","type":"address"},{"internalType":"uint8","name":"status","type":"uint8"}],"internalType":"struct Order","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokenAddresses","type":"address[]"},{"internalType":"bool","name":"isAccepted","type":"bool"}],"name":"setAcceptedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"orderId","type":"uint256"},{"internalType":"bytes32","name":"hash","type":"bytes32"}],"name":"settle2Steps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"orderIds","type":"uint256[]"},{"internalType":"bytes32[]","name":"hashes","type":"bytes32[]"}],"name":"settle2StepsBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"orderId","type":"uint256"}],"name":"settleCancelled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"orderIds","type":"uint256[]"}],"name":"settleCancelleds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"orderId","type":"uint256"}],"name":"settleFilled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"orderIds","type":"uint256[]"}],"name":"settleFilleds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"tokenCreated","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"tokenId","type":"bytes32"}],"name":"tokenForceCancelSettlePhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"tokenId","type":"bytes32"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint152","name":"settleRate","type":"uint152"}],"name":"tokenToSettlePhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"tokenId","type":"bytes32"}],"name":"tokenToggleActivation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"tokens","outputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint48","name":"settleTime","type":"uint48"},{"internalType":"uint48","name":"settleDuration","type":"uint48"},{"internalType":"uint152","name":"settleRate","type":"uint152"},{"internalType":"uint8","name":"status","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"id","type":"bytes32"}],"name":"tokensInfo","outputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint48","name":"settleTime","type":"uint48"},{"internalType":"uint48","name":"settleDuration","type":"uint48"},{"internalType":"uint152","name":"settleRate","type":"uint152"},{"internalType":"uint8","name":"status","type":"uint8"}],"internalType":"struct Token","name":"tokenInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"feeWallet_","type":"address"},{"internalType":"uint256","name":"feeSettle_","type":"uint256"},{"internalType":"uint256","name":"feeRefund_","type":"uint256"},{"internalType":"uint256","name":"pledgeRate_","type":"uint256"}],"name":"updateConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"tokenId","type":"bytes32"},{"internalType":"uint48","name":"newValue","type":"uint48"}],"name":"updateSettleDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_to","type":"address"}],"name":"withdrawStuckToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b50604051620056ad380380620056ad83398101604081905262000034916200026b565b600180556001600160a01b038216620000a55760405162461bcd60e51b815260206004820152602860248201527f41646d696e20616464726573732063616e6e6f7420626520746865207a65726f604482015267206164647265737360c01b60648201526084015b60405180910390fd5b6001600160a01b038116620001135760405162461bcd60e51b815260206004820152602d60248201527f4665652077616c6c657420616464726573732063616e6e6f742062652074686560448201526c207a65726f206164647265737360981b60648201526084016200009c565b620001206000836200019f565b506200014d7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929836200019f565b50620f42406009819055600c80546001600160a01b0319166001600160a01b0384161790556200018090603290620002a3565b600b556200019360c8620f4240620002a3565b600a5550620002c69050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1662000244576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620001fb3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000248565b5060005b92915050565b80516001600160a01b03811681146200026657600080fd5b919050565b600080604083850312156200027f57600080fd5b6200028a836200024e565b91506200029a602084016200024e565b90509250929050565b600082620002c157634e487b7160e01b600052601260045260246000fd5b500490565b6153d780620002d66000396000f3fe6080604052600436106103505760003560e01c806379502c55116101c6578063cfcdeb7e116100f7578063e7a7594911610095578063f1ee8fdd1161006f578063f1ee8fdd14610f57578063f564f0ae14610f77578063f5b541a614610f8a578063ffb1267614610fac57600080fd5b8063e7a7594914610de9578063ef706adf14610e19578063f017015014610e3957600080fd5b8063dc8beea9116100d1578063dc8beea914610d28578063deb2ec6a14610d79578063e3df748a14610d99578063e4cb62c014610dc957600080fd5b8063cfcdeb7e14610cb5578063d547741f14610cd5578063d843b2c714610cf557600080fd5b8063985a7c1d11610164578063a85c38ef1161013e578063a85c38ef14610ba9578063aaab596a14610c3b578063bc205ad314610c5b578063bff4945014610c7b57600080fd5b8063985a7c1d14610b54578063a1bd91e114610b74578063a217fddf14610b9457600080fd5b806386aa7db0116101a057806386aa7db0146109745780638a72ea6a14610994578063904194a314610a7a57806391d1485414610b3457600080fd5b806379502c55146108f557806381cc37b21461093157806382dc4a051461094457600080fd5b806336568abe116102a0578063643268c91161023e5780637400f52d116102185780637400f52d1461079d57806375b5908a146107bd57806378447e7f146107dd5780637857f9fb146107fd57600080fd5b8063643268c914610716578063670017f41461072c5780636a951f201461077d57600080fd5b80634a99533b1161027a5780634a99533b146106985780634ae25a86146106ad5780635662ecc7146106cd5780635d3473e3146106e357600080fd5b806336568abe146105255780633b6e750f146105455780633baf67841461057e57600080fd5b80631f25a2d81161030d578063248a9ca3116102e7578063248a9ca3146104925780632d670584146104d05780632f2ff15d146104f057806331a37c1e1461051057600080fd5b80631f25a2d8146104325780631f4846d81461045257806321146fa21461047257600080fd5b806301ffc9a71461035557806306f13da91461038a5780630b8aacb91461039f57806316b4cdb2146103bf57806317b137ba146103df57806318b4f367146103ff575b600080fd5b34801561036157600080fd5b5061037561037036600461486c565b610fdc565b60405190151581526020015b60405180910390f35b61039d610398366004614970565b611013565b005b3480156103ab57600080fd5b5061039d6103ba366004614a18565b61130d565b3480156103cb57600080fd5b5061039d6103da366004614a7d565b61150f565b3480156103eb57600080fd5b5061039d6103fa366004614a9f565b611981565b34801561040b57600080fd5b5061037561041a366004614ad4565b60009081526005602052604090205460ff1660021490565b34801561043e57600080fd5b5061039d61044d366004614aed565b6119b7565b34801561045e57600080fd5b5061039d61046d366004614a9f565b611bd0565b34801561047e57600080fd5b5061039d61048d366004614b26565b611c06565b34801561049e57600080fd5b506104c26104ad366004614ad4565b60009081526020819052604090206001015490565b604051908152602001610381565b3480156104dc57600080fd5b5061039d6104eb366004614b61565b611cf9565b3480156104fc57600080fd5b5061039d61050b366004614c1c565b611d6f565b34801561051c57600080fd5b506008546104c2565b34801561053157600080fd5b5061039d610540366004614c1c565b611d9a565b34801561055157600080fd5b50610375610560366004614c48565b6001600160a01b031660009081526002602052604090205460ff1690565b34801561058a57600080fd5b5061068b610599366004614ad4565b6040805161014081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081019190915250600090815260056020818152604092839020835161014081018552815460ff908116825260018301549382019390935260028201546001600160a01b039081169582019590955260038201546060820152600482015460808201529281015460a0840152600681015460c08401526007015480821660e084015261010080820490941693830193909352600160a81b909204909116151561012082015290565b6040516103819190614c63565b3480156106a457600080fd5b506006546104c2565b3480156106b957600080fd5b5061039d6106c8366004614a9f565b611dcd565b3480156106d957600080fd5b506104c260085481565b3480156106ef57600080fd5b506103756106fe366004614ad4565b60009081526005602052604090205460ff1660011490565b34801561072257600080fd5b506104c260065481565b34801561073857600080fd5b50610741611e03565b60405161038191908151815260208083015190820152604080830151908201526060918201516001600160a01b03169181019190915260800190565b34801561078957600080fd5b5061039d610798366004614ad4565b611e6d565b3480156107a957600080fd5b5061039d6107b8366004614ad4565b611f79565b3480156107c957600080fd5b5061039d6107d8366004614970565b612042565b3480156107e957600080fd5b5061039d6107f8366004614a7d565b612340565b34801561080957600080fd5b506108a4610818366004614ad4565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915250600090815260076020908152604091829020825160a0810184528154815260018201549281019290925260028101546001600160a01b0390811693830193909352600301549182166060820152600160a01b90910460ff16608082015290565b604051610381919081518152602080830151908201526040808301516001600160a01b03908116918301919091526060808401519091169082015260809182015160ff169181019190915260a00190565b34801561090157600080fd5b50600954600a54600b54600c54610921939291906001600160a01b031684565b6040516103819493929190614cf9565b61039d61093f366004614a7d565b6125c0565b34801561095057600080fd5b5061037561095f366004614c48565b60026020526000908152604090205460ff1681565b34801561098057600080fd5b5061039d61098f366004614d1d565b612840565b3480156109a057600080fd5b50610a196109af366004614ad4565b60056020819052600091825260409091208054600182015460028301546003840154600485015495850154600686015460079096015460ff9586169794966001600160a01b03948516969395949293909282821692610100810490911691600160a81b909104168a565b6040805160ff9b8c168152602081019a909a526001600160a01b03988916908a01526060890196909652608088019490945260a087019290925260c086015290941660e0840152921661010082015290151561012082015261014001610381565b348015610a8657600080fd5b50610aea610a95366004614ad4565b600460205260009081526040902080546001909101546001600160a01b0382169165ffffffffffff600160a01b8204811692600160d01b90920416906001600160981b0381169060ff600160981b9091041685565b604080516001600160a01b0396909616865265ffffffffffff948516602087015292909316918401919091526001600160981b0316606083015260ff16608082015260a001610381565b348015610b4057600080fd5b50610375610b4f366004614c1c565b612a5a565b348015610b6057600080fd5b5061039d610b6f366004614d69565b612a83565b348015610b8057600080fd5b506104c2610b8f366004614ad4565b612b2a565b348015610ba057600080fd5b506104c2600081565b348015610bb557600080fd5b50610c04610bc4366004614ad4565b6007602052600090815260409020805460018201546002830154600390930154919290916001600160a01b0391821691811690600160a01b900460ff1685565b6040805195865260208601949094526001600160a01b039283169385019390935216606083015260ff16608082015260a001610381565b348015610c4757600080fd5b5061039d610c56366004614ad4565b612b4d565b348015610c6757600080fd5b5061039d610c76366004614e13565b6130af565b348015610c8757600080fd5b506104c2610c96366004614ad4565b600090815260076020526040902060030154600160a01b900460ff1690565b348015610cc157600080fd5b5061039d610cd0366004614a9f565b6131b0565b348015610ce157600080fd5b5061039d610cf0366004614c1c565b6131e6565b348015610d0157600080fd5b506104c2610d10366004614ad4565b60009081526005602052604090206007015460ff1690565b348015610d3457600080fd5b50610d61610d43366004614ad4565b6000908152600560205260409020600201546001600160a01b031690565b6040516001600160a01b039091168152602001610381565b348015610d8557600080fd5b5061039d610d94366004614ad4565b61320b565b348015610da557600080fd5b506104c2610db4366004614ad4565b60009081526005602052604090206004015490565b348015610dd557600080fd5b5061039d610de4366004614ad4565b6135cd565b348015610df557600080fd5b506104c2610e04366004614ad4565b60009081526005602052604090206003015490565b348015610e2557600080fd5b5061039d610e34366004614ad4565b6139e7565b348015610e4557600080fd5b50610ef8610e54366004614ad4565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915250600090815260046020908152604091829020825160a08101845281546001600160a01b038116825265ffffffffffff600160a01b8204811694830194909452600160d01b9004909216928201929092526001909101546001600160981b038116606083015260ff600160981b90910416608082015290565b6040805182516001600160a01b0316815260208084015165ffffffffffff908116918301919091528383015116918101919091526060808301516001600160981b03169082015260809182015160ff169181019190915260a001610381565b348015610f6357600080fd5b5061039d610f72366004614b26565b613d5c565b61039d610f85366004614e3d565b613ee1565b348015610f9657600080fd5b506104c260008051602061538283398151915281565b348015610fb857600080fd5b50610375610fc7366004614ad4565b60036020526000908152604090205460ff1681565b60006001600160e01b03198216637965db0b60e01b148061100d57506301ffc9a760e01b6001600160e01b03198316145b92915050565b61101b614097565b80518251146110455760405162461bcd60e51b815260040161103c90614e93565b60405180910390fd5b6000805b835181101561125c57600084828151811061106657611066614eba565b60200260200101519050600084838151811061108457611084614eba565b602090810291909101810151600084815260058352604080822060018082015484526004909552912060078201549294509092909160ff16146110d95760405162461bcd60e51b815260040161103c90614ed0565b600181810154600160981b900460ff16146111065760405162461bcd60e51b815260040161103c90614efe565b600083116111265760405162461bcd60e51b815260040161103c90614f2c565b828260060154836003015461113b9190614f6a565b10156111595760405162461bcd60e51b815260040161103c90614f7d565b6007820154600160a81b900460ff1615806111775750828260030154145b6111935760405162461bcd60e51b815260040161103c90614fb4565b60028201546001600160a01b0316156111be5760405162461bcd60e51b815260040161103c90614fe0565b815460009060ff16600019016111f45782600301548484600501546111e3919061500d565b6111ed919061503a565b9050611216565b8260030154848460040154611209919061500d565b611213919061503a565b90505b611220818861504e565b965061124b85858560070160019054906101000a90046001600160a01b03166112463390565b6140c1565b505060019093019250611049915050565b508034101561127d5760405162461bcd60e51b815260040161103c90615061565b803411156112ff5760006112918234614f6a565b604051909150600090339083908381818185875af1925050503d80600081146112d6576040519150601f19603f3d011682016040523d82523d6000602084013e6112db565b606091505b50509050806112fc5760405162461bcd60e51b815260040161103c9061508d565b50505b5061130960018055565b5050565b611315614097565b6000858152600460205260409020600180820154600160981b900460ff16146113705760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2102a37b5b2b760991b604482015260640161103c565b6001600160a01b038316158015906113a057506001600160a01b03831660009081526002602052604090205460ff165b6113bc5760405162461bcd60e51b815260040161103c90614fe0565b6000851180156113cc5750600084115b6114125760405162461bcd60e51b8152602060048201526017602482015276496e76616c696420416d6f756e74206f722056616c756560481b604482015260640161103c565b6000836001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611452573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147691906150c4565b9050600061148686601284614270565b90506000620f42406009600001548861149f919061500d565b6114a9919061503a565b905060006114b982601286614270565b9050600060ff8c166001146114ce57816114d0565b835b9050876114e86001600160a01b038216333085614305565b6114f78d8d8b8e8e898e61436c565b5050505050505061150760018055565b505050505050565b611517614097565b60008051602061538283398151915261152f8161453c565b60008381526007602090815260408083208054845260058352818420600180820154865260049094529190932091820154909190600160981b900460ff1660031461158c5760405162461bcd60e51b815260040161103c906150e1565b80546001600160a01b0316158015906115b1575060018101546001600160981b031615155b6115ed5760405162461bcd60e51b815260206004820152600d60248201526c151bdad95b88139bdd0814d95d609a1b604482015260640161103c565b8054600160a01b900465ffffffffffff166116465760405162461bcd60e51b815260206004820152601960248201527814d95d1d1b1a5b99c8151a5b5948139bdd0814dd185c9d1959603a1b604482015260640161103c565b6003830154600160a01b900460ff166001146116745760405162461bcd60e51b815260040161103c90615109565b60028201546000906001600160a01b03166116915750601261170d565b8260020160009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156116e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170a91906150c4565b90505b600061173d84600301548560050154876001015461172b919061500d565b611735919061503a565b601284614546565b9050600061176f85600301548660040154886001015461175d919061500d565b611767919061503a565b601285614546565b90506000620f424060096002015483611788919061500d565b611792919061503a565b90506000816117a1858561504e565b6117ab9190614f6a565b60028801549091506001600160a01b031661189e5760028801546040516000916001600160a01b03169083908381818185875af1925050503d806000811461180f576040519150601f19603f3d011682016040523d82523d6000602084013e611814565b606091505b5050600c546040519192506000916001600160a01b039091169085908381818185875af1925050503d8060008114611868576040519150601f19603f3d011682016040523d82523d6000602084013e61186d565b606091505b5050905081801561187b5750805b6118975760405162461bcd60e51b815260040161103c90615137565b50506118dd565b600280880154908901546001600160a01b03918216916118c1918391168461459b565b600c546118db906001600160a01b0383811691168561459b565b505b60038801805460ff60a01b1916600160a11b179055604080518c8152602081018c9052338183015290517fbac7c71779ccc41f8c859e9d622536f76f0375a85b23e1b3d4134f613a9fff54916060908290030190a17f94d22e970a1abb720b741045e471af3fa516f4e2ede6b665387332888f92f2138b8284336040516119679493929190614cf9565b60405180910390a150505050505050505061130960018055565b60005b8151811015611309576119af8282815181106119a2576119a2614eba565b6020026020010151612b4d565b600101611984565b6000805160206153828339815191526119cf8161453c565b6001600160a01b038516611a175760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964204164647265737360881b604482015260640161103c565b611a25600a620f424061503a565b841115611a685760405162461bcd60e51b8152602060048201526011602482015270536574746c6520466565203c3d2031302560781b604482015260640161103c565b611a76600a620f424061503a565b831115611ab95760405162461bcd60e51b815260206004820152601160248201527043616e63656c20466565203c3d2031302560781b604482015260640161103c565b611ac76064620f424061503a565b8210158015611ad95750620f42408211155b611b255760405162461bcd60e51b815260206004820152601860248201527f506c656467652052617465206f7574206f662072616e67650000000000000000604482015260640161103c565b600c54600b54600a54600954604080516001600160a01b03958616815260208101949094528301919091526060820152908616608082015260a0810185905260c0810184905260e081018390527f72fe78202ae1d56b2334bc8c804db955e2349789b271b7f55e8109f7122f0a11906101000160405180910390a150600c80546001600160a01b0319166001600160a01b039590951694909417909355600b91909155600a55600955565b60005b815181101561130957611bfe828281518110611bf157611bf1614eba565b60200260200101516135cd565b600101611bd3565b600080516020615382833981519152611c1e8161453c565b620151808265ffffffffffff161015611c795760405162461bcd60e51b815260206004820152601860248201527f4d696e696d756d2032346820666f7220736574746c696e670000000000000000604482015260640161103c565b600083815260046020908152604091829020805465ffffffffffff868116600160d01b8181026001600160d01b03851617855586518a8152930490911693820184905293810193909352917fd5042937eda12ebddebb9d9ecaf0d88595a67d0d28513340610674acbd48274b906060015b60405180910390a15050505050565b8051825114611d1a5760405162461bcd60e51b815260040161103c90614e93565b60005b8251811015611d6a57611d62838281518110611d3b57611d3b614eba565b6020026020010151838381518110611d5557611d55614eba565b602002602001015161150f565b600101611d1d565b505050565b600082815260208190526040902060010154611d8a8161453c565b611d9483836145cc565b50505050565b6001600160a01b0381163314611dc35760405163334bd91960e11b815260040160405180910390fd5b611d6a828261465e565b60005b815181101561130957611dfb828281518110611dee57611dee614eba565b60200260200101516139e7565b600101611dd0565b611e37604051806080016040528060008152602001600081526020016000815260200160006001600160a01b031681525090565b50604080516080810182526009548152600a546020820152600b5491810191909152600c546001600160a01b0316606082015290565b600080516020615382833981519152611e858161453c565b60008281526004602052604081206001808201549192600160981b90920460ff1691908214611eb5576001611eb8565b60025b905060ff821660011480611ecf575060ff82166002145b611f1b5760405162461bcd60e51b815260206004820152601a60248201527f43616e6e6f74204368616e676520546f6b656e20537461747573000000000000604482015260640161103c565b60018301805460ff838116600160981b810260ff60981b19909316929092179092556040805188815292851660208401528201527f853e3a954af7889419a6922a1bc350b54c6217937a4a2aed1176ed3f5a1dfb5290606001611cea565b600080516020615382833981519152611f918161453c565b60008281526004602052604090206001810154600160981b900460ff16600314611ff45760405162461bcd60e51b8152602060048201526014602482015273496e76616c696420546f6b656e2053746174757360601b604482015260640161103c565b60018101805460ff60981b1916600160991b1790556040518381527f6ac56c552b96d07b41e8ee97200f747e7476892e0e2e53e9803199bfe014b0a8906020015b60405180910390a1505050565b61204a614097565b805182511461206b5760405162461bcd60e51b815260040161103c90614e93565b60005b82518110156112ff57600083828151811061208b5761208b614eba565b6020026020010151905060008383815181106120a9576120a9614eba565b602090810291909101810151600084815260058352604080822060018082015484526004909552912060078201549294509092909160ff16146120fe5760405162461bcd60e51b815260040161103c90614ed0565b600181810154600160981b900460ff161461212b5760405162461bcd60e51b815260040161103c90614efe565b6000831161214b5760405162461bcd60e51b815260040161103c90614f2c565b82826006015483600301546121609190614f6a565b101561217e5760405162461bcd60e51b815260040161103c90614f7d565b6007820154600160a81b900460ff16158061219c5750828260030154145b6121b85760405162461bcd60e51b815260040161103c90614fb4565b60028201546001600160a01b03166121e25760405162461bcd60e51b815260040161103c90614fe0565b60028201546040805163313ce56760e01b815290516001600160a01b0390921691600091829182918291869163313ce5679160048083019260209291908290030181865afa158015612238573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061225c91906150c4565b875490915060ff16600019016122bc5760008760030154898960050154612283919061500d565b61228d919061503a565b905061229b81601284614270565b600789015490955061010090046001600160a01b0316935033925050612308565b600087600301548989600401546122d3919061500d565b6122dd919061503a565b90506122eb81601284614270565b945033600789015490945061010090046001600160a01b03169250505b61231f335b6001600160a01b038716903087614305565b61232b898985856140c1565b50506001909701965061206e95505050505050565b612348614097565b60008281526005602090815260408083206001808201548552600490935292206007830154909160ff909116146123915760405162461bcd60e51b815260040161103c90614ed0565b600181810154600160981b900460ff16146123be5760405162461bcd60e51b815260040161103c90614efe565b600083116123de5760405162461bcd60e51b815260040161103c90614f2c565b82826006015483600301546123f39190614f6a565b10156124115760405162461bcd60e51b815260040161103c90614f7d565b6007820154600160a81b900460ff16158061242f5750828260030154145b61244b5760405162461bcd60e51b815260040161103c90614fb4565b60028201546001600160a01b03166124755760405162461bcd60e51b815260040161103c90614fe0565b60028201546040805163313ce56760e01b815290516001600160a01b0390921691600091829182918291869163313ce5679160048083019260209291908290030181865afa1580156124cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124ef91906150c4565b875490915060ff166000190161254f5760008760030154898960050154612516919061500d565b612520919061503a565b905061252e81601284614270565b600789015490955061010090046001600160a01b031693503392505061259b565b60008760030154898960040154612566919061500d565b612570919061503a565b905061257e81601284614270565b945033600789015490945061010090046001600160a01b03169250505b6125a43361230d565b6125b0898985856140c1565b5050505050505061130960018055565b6125c8614097565b60008281526005602090815260408083206001808201548552600490935292206007830154909160ff909116146126115760405162461bcd60e51b815260040161103c90614ed0565b600181810154600160981b900460ff161461263e5760405162461bcd60e51b815260040161103c90614efe565b6000831161265e5760405162461bcd60e51b815260040161103c90614f2c565b82826006015483600301546126739190614f6a565b10156126915760405162461bcd60e51b815260040161103c90614f7d565b6007820154600160a81b900460ff1615806126af5750828260030154145b6126cb5760405162461bcd60e51b815260040161103c90614fb4565b60028201546001600160a01b0316156126f65760405162461bcd60e51b815260040161103c90614fe0565b81546000908190819060ff166000190161274957846003015486866005015461271f919061500d565b612729919061503a565b600786015490935061010090046001600160a01b03169150339050612784565b846003015486866004015461275e919061500d565b612768919061503a565b925033600786015490925061010090046001600160a01b031690505b823410156127a45760405162461bcd60e51b815260040161103c90615061565b823411156128265760006127b88434614f6a565b604051909150600090339083908381818185875af1925050503d80600081146127fd576040519150601f19603f3d011682016040523d82523d6000602084013e612802565b606091505b50509050806128235760405162461bcd60e51b815260040161103c9061508d565b50505b612832878784846140c1565b505050505061130960018055565b6000805160206153828339815191526128588161453c565b60008481526004602052604090206001600160a01b0384166128ce5760405162461bcd60e51b815260206004820152602960248201527f746f6b656e546f536574746c6550686173653a20496e76616c696420546f6b656044820152686e204164647265737360b81b606482015260840161103c565b6000836001600160981b0316116129365760405162461bcd60e51b815260206004820152602660248201527f746f6b656e546f536574746c6550686173653a496e76616c696420536574746c60448201526565205261746560d01b606482015260840161103c565b600181810154600160981b900460ff16148061296057506001810154600160981b900460ff166002145b6129bc5760405162461bcd60e51b815260206004820152602760248201527f746f6b656e546f536574746c6550686173653a496e76616c696420546f6b656e6044820152662053746174757360c81b606482015260840161103c565b80546001820180546001600160981b0386166001600160a01b03199091168117600360981b179091556001600160a01b0386166001600160d01b03199092168217600160a01b4265ffffffffffff81169190910291909117845560408051898152602081019490945283019190915260608201527f973839ac031e9779c3158a52ae98cb3b0be8a378b1adc2b2ce2c14f89c81489590608001611cea565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b600080516020615382833981519152612a9b8161453c565b60005b8351811015612af8578260026000868481518110612abe57612abe614eba565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101612a9e565b507f6a980e8ca36409cff27b8778560e2a0f5183fea53171bc0aeff7317906c7c1f48383604051612035929190615164565b6000818152600560205260408120600681015460039091015461100d9190614f6a565b612b55614097565b60008181526007602090815260408083208054845260058352818420600180820154865260049094529190932091820154909190600160981b900460ff16600314612bb25760405162461bcd60e51b815260040161103c906150e1565b80546001600160a01b031615801590612bd7575060018101546001600160981b031615155b612c135760405162461bcd60e51b815260206004820152600d60248201526c151bdad95b88139bdd0814d95d609a1b604482015260640161103c565b8054600160a01b900465ffffffffffff16612c6c5760405162461bcd60e51b815260206004820152601960248201527814d95d1d1b1a5b99c8151a5b5948139bdd0814dd185c9d1959603a1b604482015260640161103c565b60028301546001600160a01b03163314612cb65760405162461bcd60e51b815260206004820152600b60248201526a53656c6c6572204f6e6c7960a81b604482015260640161103c565b6003830154600160a01b900460ff16600114612ce45760405162461bcd60e51b815260040161103c90615109565b60028201546000906001600160a01b0316612d0157506012612d7d565b8260020160009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612d56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d7a91906150c4565b90505b6000612d9b84600301548560050154876001015461172b919061500d565b90506000612dbb85600301548660040154886001015461175d919061500d565b84546040805163313ce56760e01b815290519293506001600160a01b0390911691600091839163313ce567916004808201926020929091908290030181865afa158015612e0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e3091906150c4565b600180880154908a0154919250600091612e5c91620f42409161172b916001600160981b03169061500d565b90506000620f424060096002015483612e75919061500d565b612e7f919061503a565b60028b0154600c54919250612ea4916001600160a01b03878116928116911684614305565b60028a015460038b0154612edb916001600160a01b039081169116612ec98486614f6a565b6001600160a01b038816929190614305565b600b54600090620f424090612ef0908861500d565b612efa919061503a565b9050600081612f09898961504e565b612f139190614f6a565b60028c01549091506001600160a01b03166130065760028c01546040516000916001600160a01b03169083908381818185875af1925050503d8060008114612f77576040519150601f19603f3d011682016040523d82523d6000602084013e612f7c565b606091505b5050600c546040519192506000916001600160a01b039091169085908381818185875af1925050503d8060008114612fd0576040519150601f19603f3d011682016040523d82523d6000602084013e612fd5565b606091505b50509050818015612fe35750805b612fff5760405162461bcd60e51b815260040161103c90615137565b5050613045565b6002808c0154908d01546001600160a01b0391821691613029918391168461459b565b600c54613043906001600160a01b0383811691168561459b565b505b60038c01805460ff60a01b1916600160a11b1790557f94d22e970a1abb720b741045e471af3fa516f4e2ede6b665387332888f92f2138d82843360405161308f9493929190614cf9565b60405180910390a15050505050505050505050506130ac60018055565b50565b60006130ba8161453c565b6001600160a01b038316158015906130eb57506001600160a01b03831660009081526002602052604090205460ff16155b61312f5760405162461bcd60e51b8152602060048201526015602482015274496e76616c696420546f6b656e204164647265737360581b604482015260640161103c565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa158015613176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061319a91906151bd565b9050611d946001600160a01b038516848361459b565b60005b8151811015611309576131de8282815181106131d1576131d1614eba565b602002602001015161320b565b6001016131b3565b6000828152602081905260409020600101546132018161453c565b611d94838361465e565b613213614097565b60008051602061538283398151915261322b8161453c565b60008281526007602090815260408083208054845260059092529091206003820154600160a01b900460ff166001146132765760405162461bcd60e51b815260040161103c90615109565b60028101546000906001600160a01b03166132935750601261330f565b8160020160009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156132e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061330c91906150c4565b90505b600061332d83600301548460040154866001015461172b919061500d565b9050600061334d84600301548560050154876001015461175d919061500d565b6003860154600280880154908701549293506001600160a01b039182169290821691166134fd5760008411801561338c57506001600160a01b03821615155b15613436576000826001600160a01b03168560405160006040518083038185875af1925050503d80600081146133de576040519150601f19603f3d011682016040523d82523d6000602084013e6133e3565b606091505b50509050806134345760405162461bcd60e51b815260206004820152601d60248201527f5472616e736665722046756e647320746f2053656c6c6572204661696c000000604482015260640161103c565b505b60008311801561344e57506001600160a01b03811615155b156134f8576000816001600160a01b03168460405160006040518083038185875af1925050503d80600081146134a0576040519150601f19603f3d011682016040523d82523d6000602084013e6134a5565b606091505b50509050806134f65760405162461bcd60e51b815260206004820152601d60248201527f5472616e736665722046756e647320746f2053656c6c6572204661696c000000604482015260640161103c565b505b61356e565b60028601546001600160a01b0316841580159061352257506001600160a01b03831615155b1561353b5761353b6001600160a01b038216848761459b565b60008411801561355357506001600160a01b03821615155b1561356c5761356c6001600160a01b038216838661459b565b505b60038701805460ff60a01b1916600360a01b179055604080518a81523360208201527f22369ba22944aadf9e9d6f4c51462417a50ea7876b9c62c7c46b5522e9c672cc91015b60405180910390a150505050505050506130ac60018055565b6135d5614097565b60008181526007602090815260408083208054845260058352818420600180820154865260049094529190932091820154909190600160981b900460ff166003146136325760405162461bcd60e51b815260040161103c906150e1565b80546136569065ffffffffffff600160d01b8204811691600160a01b9004166151d6565b65ffffffffffff1642116136ac5760405162461bcd60e51b815260206004820152601b60248201527f536574746c696e672054696d65204e6f7420456e646564205965740000000000604482015260640161103c565b6003830154600160a01b900460ff166001146136da5760405162461bcd60e51b815260040161103c90615109565b60038301546001600160a01b0316331480613708575061370860008051602061538283398151915233612a5a565b61374d5760405162461bcd60e51b81526020600482015260166024820152754275796572206f72204f70657261746f72204f6e6c7960501b604482015260640161103c565b60028201546000906001600160a01b031661376a575060126137e6565b8260020160009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156137bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137e391906150c4565b90505b600061380484600301548560050154876001015461172b919061500d565b9050600061382485600301548660040154886001015461175d919061500d565b90506000620f42406009600201548461383d919061500d565b61384890600261500d565b613852919061503a565b9050600081613861858561504e565b61386b9190614f6a565b60028801549091506001600160a01b031661395e5760038801546040516000916001600160a01b03169083908381818185875af1925050503d80600081146138cf576040519150601f19603f3d011682016040523d82523d6000602084013e6138d4565b606091505b5050600c546040519192506000916001600160a01b039091169085908381818185875af1925050503d8060008114613928576040519150601f19603f3d011682016040523d82523d6000602084013e61392d565b606091505b5050905081801561393b5750805b6139575760405162461bcd60e51b815260040161103c90615137565b505061399d565b600287015460038901546001600160a01b0391821691613981918391168461459b565b600c5461399b906001600160a01b0383811691168561459b565b505b60038801805460ff60a01b1916600360a01b1790557f6353c0ce500c8ea1f1026c8f39a6e0c2d1b2f17034fcd8a4b021c72e6e293e51898284336040516135b49493929190614cf9565b6139ef614097565b600081815260056020526040902060078101546001600160a01b03610100909104163314613a525760405162461bcd60e51b815260206004820152601060248201526f4f66666572204f776e6572204f6e6c7960801b604482015260640161103c565b600781015460ff16600114613a795760405162461bcd60e51b815260040161103c90614ed0565b600081600601548260030154613a8f9190614f6a565b905060008111613ab15760405162461bcd60e51b815260040161103c90614f7d565b60028201546000906001600160a01b0316613ace57506012613b4a565b8260020160009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015613b23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b4791906150c4565b90505b825460009060ff1660001901613b7957613b72846003015485600401548561172b919061500d565b9050613b94565b613b91846003015485600501548561172b919061500d565b90505b600a54600090620f424090613ba9908461500d565b613bb3919061503a565b9050613bbf8183614f6a565b60028601549092506001600160a01b0316613cb757600785015460405160009161010090046001600160a01b03169084908381818185875af1925050503d8060008114613c28576040519150601f19603f3d011682016040523d82523d6000602084013e613c2d565b606091505b5050600c546040519192506000916001600160a01b039091169084908381818185875af1925050503d8060008114613c81576040519150601f19603f3d011682016040523d82523d6000602084013e613c86565b606091505b50509050818015613c945750805b613cb05760405162461bcd60e51b815260040161103c90615137565b5050613cfc565b600285015460078601546001600160a01b0391821691613ce0918391610100909104168561459b565b600c54613cfa906001600160a01b0383811691168461459b565b505b60078501805460ff191660031790557ff65e543d34c6936603a3741b3eace109133f172d25637c2445b95c1f3288e937868383613d363390565b604051613d469493929190614cf9565b60405180910390a150505050506130ac60018055565b600080516020615382833981519152613d748161453c565b620151808265ffffffffffff161015613ddd5760405162461bcd60e51b815260206004820152602560248201527f637265617465546f6b656e3a204d696e696d756d2032346820666f7220736574604482015264746c696e6760d81b606482015260840161103c565b60008381526003602052604090205460ff1615613e465760405162461bcd60e51b815260206004820152602160248201527f637265617465546f6b656e3a20546f6b656e20616c72656164792065786973746044820152607360f81b606482015260840161103c565b6000838152600360209081526040808320805460ff191660019081179091556004835292819020805465ffffffffffff8716600160d01b81026001600160d01b03909216919091178255938101805460ff60981b1916600160981b1790558151878152928301939093527f1da02fe9181848bf1b401dde762d155f0da084c24db69129a3c7479f970ddbcc910160405180910390a150505050565b613ee9614097565b6000848152600460205260409020600180820154600160981b900460ff1614613f445760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2102a37b5b2b760991b604482015260640161103c565b600084118015613f545750600083115b613f9a5760405162461bcd60e51b8152602060048201526017602482015276496e76616c696420416d6f756e74206f722056616c756560481b604482015260640161103c565b600954600090620f424090613faf908661500d565b613fb9919061503a565b9050600060ff8816600114613fce5781613fd0565b845b905034811115613ff25760405162461bcd60e51b815260040161103c90615061565b803411156140745760006140068234614f6a565b604051909150600090339083908381818185875af1925050503d806000811461404b576040519150601f19603f3d011682016040523d82523d6000602084013e614050565b606091505b50509050806140715760405162461bcd60e51b815260040161103c9061508d565b50505b614084888860008989878a61436c565b50505061409060018055565b5050505050565b6002600154036140ba57604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b60006005600086815260200190815260200160002090506040518060a00160405280868152602001858152602001836001600160a01b03168152602001846001600160a01b03168152602001600160ff1681525060076000600860008154614128906151fc565b918290555081526020808201929092526040908101600090812084518155928401516001840155908301516002830180546001600160a01b039283166001600160a01b031990911617905560608401516003909301805460809095015160ff16600160a01b026001600160a81b031990951693909116929092179290921790556006820180548692906141bc90849061504e565b909155505060038101546006820154036142195760078101805460ff1916600217905560408051868152600060208201527f37a30d6e3fcaec3144b11d51892b9eadbb0ec4d2a8a813d64bb6065c3adfcffa910160405180910390a15b600854604080519182526020820187905281018590526001600160a01b038084166060830152841660808201527fdc3effd7f2b46d1989f8b9ec5abba2e3c07eaa9caa9511c8af3c9444ecbb52f29060a001611cea565b60008160ff168360ff16036142865750826142fe565b8160ff168360ff1610156142ba5761429e8383615215565b6142a990600a615312565b6142b3908561500d565b90506142fe565b60006142c68385615215565b6142d190600a615312565b90506142dd818661503a565b91506142e98186615321565b156142fc576142f960018361504e565b91505b505b9392505050565b6040516001600160a01b038481166024830152838116604483015260648201839052611d949186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050506146c9565b6040518061014001604052808860ff168152602001878152602001866001600160a01b0316815260200185815260200184815260200183815260200160008152602001600160ff1681526020016143c03390565b6001600160a01b03168152602001821515815250600560006006600081546143e7906151fc565b9182905550815260208082019290925260409081016000208351815460ff191660ff918216178255928401516001820155908301516002820180546001600160a01b0319166001600160a01b03928316179055606084015160038301556080840151600483015560a0840151600583015560c084015160068084019190915560e0850151600790930180546101008088015161012090980151959096166001600160a81b031990911617959092169093029390931760ff60a81b1916600160a81b9115159190910217909155547f8f8f88015929d8eeb82fcc5c324b9713dc52572eae5cf9e6e80f7e2d81ae089890888888888888883360408051998a5260ff90981660208a0152968801959095526001600160a01b039384166060880152608087019290925260a086015260c085015290151560e0840152166101008201526101200160405180910390a150505050505050565b6130ac813361472c565b60008160ff168360ff160361455c5750826142fe565b8160ff168360ff1610156145745761429e8383615215565b61457e8284615215565b61458990600a615312565b614593908561503a565b949350505050565b6040516001600160a01b03838116602483015260448201839052611d6a91859182169063a9059cbb9060640161433a565b60006145d88383612a5a565b614656576000838152602081815260408083206001600160a01b03861684529091529020805460ff1916600117905561460e3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161100d565b50600061100d565b600061466a8383612a5a565b15614656576000838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161100d565b60006146de6001600160a01b03841683614765565b905080516000141580156147035750808060200190518101906147019190615335565b155b15611d6a57604051635274afe760e01b81526001600160a01b038416600482015260240161103c565b6147368282612a5a565b6113095760405163e2517d3f60e01b81526001600160a01b03821660048201526024810183905260440161103c565b60606142fe8383600084600080856001600160a01b0316848660405161478b9190615352565b60006040518083038185875af1925050503d80600081146147c8576040519150601f19603f3d011682016040523d82523d6000602084013e6147cd565b606091505b50915091506147dd8683836147e7565b9695505050505050565b6060826147fc576147f782614843565b6142fe565b815115801561481357506001600160a01b0384163b155b1561483c57604051639996b31560e01b81526001600160a01b038516600482015260240161103c565b50806142fe565b8051156148535780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60006020828403121561487e57600080fd5b81356001600160e01b0319811681146142fe57600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156148d5576148d5614896565b604052919050565b600067ffffffffffffffff8211156148f7576148f7614896565b5060051b60200190565b600082601f83011261491257600080fd5b81356020614927614922836148dd565b6148ac565b8083825260208201915060208460051b87010193508684111561494957600080fd5b602086015b84811015614965578035835291830191830161494e565b509695505050505050565b6000806040838503121561498357600080fd5b823567ffffffffffffffff8082111561499b57600080fd5b6149a786838701614901565b935060208501359150808211156149bd57600080fd5b506149ca85828601614901565b9150509250929050565b60ff811681146130ac57600080fd5b80356001600160a01b03811681146149fa57600080fd5b919050565b80151581146130ac57600080fd5b80356149fa816149ff565b60008060008060008060c08789031215614a3157600080fd5b8635614a3c816149d4565b9550602087013594506040870135935060608701359250614a5f608088016149e3565b915060a0870135614a6f816149ff565b809150509295509295509295565b60008060408385031215614a9057600080fd5b50508035926020909101359150565b600060208284031215614ab157600080fd5b813567ffffffffffffffff811115614ac857600080fd5b61459384828501614901565b600060208284031215614ae657600080fd5b5035919050565b60008060008060808587031215614b0357600080fd5b614b0c856149e3565b966020860135965060408601359560600135945092505050565b60008060408385031215614b3957600080fd5b82359150602083013565ffffffffffff81168114614b5657600080fd5b809150509250929050565b60008060408385031215614b7457600080fd5b823567ffffffffffffffff80821115614b8c57600080fd5b614b9886838701614901565b9350602091508185013581811115614baf57600080fd5b85019050601f81018613614bc257600080fd5b8035614bd0614922826148dd565b81815260059190911b82018301908381019088831115614bef57600080fd5b928401925b82841015614c0d57833582529284019290840190614bf4565b80955050505050509250929050565b60008060408385031215614c2f57600080fd5b82359150614c3f602084016149e3565b90509250929050565b600060208284031215614c5a57600080fd5b6142fe826149e3565b815160ff1681526101408101602083015160208301526040830151614c9360408401826001600160a01b03169052565b50606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e0830151614cd060e084018260ff169052565b50610100838101516001600160a01b031690830152610120928301511515929091019190915290565b938452602084019290925260408301526001600160a01b0316606082015260800190565b600080600060608486031215614d3257600080fd5b83359250614d42602085016149e3565b915060408401356001600160981b0381168114614d5e57600080fd5b809150509250925092565b60008060408385031215614d7c57600080fd5b823567ffffffffffffffff811115614d9357600080fd5b8301601f81018513614da457600080fd5b80356020614db4614922836148dd565b82815260059290921b83018101918181019088841115614dd357600080fd5b938201935b83851015614df857614de9856149e3565b82529382019390820190614dd8565b9550614e079050868201614a0d565b93505050509250929050565b60008060408385031215614e2657600080fd5b614e2f836149e3565b9150614c3f602084016149e3565b600080600080600060a08688031215614e5557600080fd5b8535614e60816149d4565b94506020860135935060408601359250606086013591506080860135614e85816149ff565b809150509295509295909350565b6020808252600d908201526c125b9d985b1a5908125b9c1d5d609a1b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b602080825260149082015273496e76616c6964204f666665722053746174757360601b604082015260600190565b602080825260149082015273496e76616c696420746f6b656e2053746174757360601b604082015260600190565b6020808252600e908201526d125b9d985b1a5908105b5bdd5b9d60921b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b8181038181111561100d5761100d614f54565b60208082526018908201527f496e73756666696369656e7420416c6c6f636174696f6e730000000000000000604082015260600190565b602080825260129082015271119d5b1b13585d18da081c995c5d5a5c995960721b604082015260600190565b60208082526013908201527224b73b30b634b21027b33332b9102a37b5b2b760691b604082015260600190565b808202811582820484141761100d5761100d614f54565b634e487b7160e01b600052601260045260246000fd5b60008261504957615049615024565b500490565b8082018082111561100d5761100d614f54565b602080825260129082015271496e73756666696369656e742046756e647360701b604082015260600190565b6020808252601b908201527f526566756e64206f662065786365737320455448206661696c65640000000000604082015260600190565b6000602082840312156150d657600080fd5b81516142fe816149d4565b6020808252600e908201526d496e76616c69642053746174757360901b604082015260600190565b602080825260149082015273496e76616c6964204f726465722053746174757360601b604082015260600190565b602080825260139082015272151c985b9cd9995c88119d5b991cc811985a5b606a1b604082015260600190565b604080825283519082018190526000906020906060840190828701845b828110156151a65781516001600160a01b031684529284019290840190600101615181565b505050809250505082151560208301529392505050565b6000602082840312156151cf57600080fd5b5051919050565b65ffffffffffff8181168382160190808211156151f5576151f5614f54565b5092915050565b60006001820161520e5761520e614f54565b5060010190565b60ff828116828216039081111561100d5761100d614f54565b600181815b8085111561526957816000190482111561524f5761524f614f54565b8085161561525c57918102915b93841c9390800290615233565b509250929050565b6000826152805750600161100d565b8161528d5750600061100d565b81600181146152a357600281146152ad576152c9565b600191505061100d565b60ff8411156152be576152be614f54565b50506001821b61100d565b5060208310610133831016604e8410600b84101617156152ec575081810a61100d565b6152f6838361522e565b806000190482111561530a5761530a614f54565b029392505050565b60006142fe60ff841683615271565b60008261533057615330615024565b500690565b60006020828403121561534757600080fd5b81516142fe816149ff565b6000825160005b818110156153735760208186018101518583015201615359565b50600092019182525091905056fe97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929a2646970667358221220242f49119d97806b76fe30960e4d7df5008d68e708a3fbfbeebc6e0ac290c4fe64736f6c6343000818003300000000000000000000000010f4861365511ae1a11dbd2210bcccad42bcbf1a000000000000000000000000c4137ee33e81b181fb0a6511835ecef6a6740d97
Deployed Bytecode
0x6080604052600436106103505760003560e01c806379502c55116101c6578063cfcdeb7e116100f7578063e7a7594911610095578063f1ee8fdd1161006f578063f1ee8fdd14610f57578063f564f0ae14610f77578063f5b541a614610f8a578063ffb1267614610fac57600080fd5b8063e7a7594914610de9578063ef706adf14610e19578063f017015014610e3957600080fd5b8063dc8beea9116100d1578063dc8beea914610d28578063deb2ec6a14610d79578063e3df748a14610d99578063e4cb62c014610dc957600080fd5b8063cfcdeb7e14610cb5578063d547741f14610cd5578063d843b2c714610cf557600080fd5b8063985a7c1d11610164578063a85c38ef1161013e578063a85c38ef14610ba9578063aaab596a14610c3b578063bc205ad314610c5b578063bff4945014610c7b57600080fd5b8063985a7c1d14610b54578063a1bd91e114610b74578063a217fddf14610b9457600080fd5b806386aa7db0116101a057806386aa7db0146109745780638a72ea6a14610994578063904194a314610a7a57806391d1485414610b3457600080fd5b806379502c55146108f557806381cc37b21461093157806382dc4a051461094457600080fd5b806336568abe116102a0578063643268c91161023e5780637400f52d116102185780637400f52d1461079d57806375b5908a146107bd57806378447e7f146107dd5780637857f9fb146107fd57600080fd5b8063643268c914610716578063670017f41461072c5780636a951f201461077d57600080fd5b80634a99533b1161027a5780634a99533b146106985780634ae25a86146106ad5780635662ecc7146106cd5780635d3473e3146106e357600080fd5b806336568abe146105255780633b6e750f146105455780633baf67841461057e57600080fd5b80631f25a2d81161030d578063248a9ca3116102e7578063248a9ca3146104925780632d670584146104d05780632f2ff15d146104f057806331a37c1e1461051057600080fd5b80631f25a2d8146104325780631f4846d81461045257806321146fa21461047257600080fd5b806301ffc9a71461035557806306f13da91461038a5780630b8aacb91461039f57806316b4cdb2146103bf57806317b137ba146103df57806318b4f367146103ff575b600080fd5b34801561036157600080fd5b5061037561037036600461486c565b610fdc565b60405190151581526020015b60405180910390f35b61039d610398366004614970565b611013565b005b3480156103ab57600080fd5b5061039d6103ba366004614a18565b61130d565b3480156103cb57600080fd5b5061039d6103da366004614a7d565b61150f565b3480156103eb57600080fd5b5061039d6103fa366004614a9f565b611981565b34801561040b57600080fd5b5061037561041a366004614ad4565b60009081526005602052604090205460ff1660021490565b34801561043e57600080fd5b5061039d61044d366004614aed565b6119b7565b34801561045e57600080fd5b5061039d61046d366004614a9f565b611bd0565b34801561047e57600080fd5b5061039d61048d366004614b26565b611c06565b34801561049e57600080fd5b506104c26104ad366004614ad4565b60009081526020819052604090206001015490565b604051908152602001610381565b3480156104dc57600080fd5b5061039d6104eb366004614b61565b611cf9565b3480156104fc57600080fd5b5061039d61050b366004614c1c565b611d6f565b34801561051c57600080fd5b506008546104c2565b34801561053157600080fd5b5061039d610540366004614c1c565b611d9a565b34801561055157600080fd5b50610375610560366004614c48565b6001600160a01b031660009081526002602052604090205460ff1690565b34801561058a57600080fd5b5061068b610599366004614ad4565b6040805161014081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081019190915250600090815260056020818152604092839020835161014081018552815460ff908116825260018301549382019390935260028201546001600160a01b039081169582019590955260038201546060820152600482015460808201529281015460a0840152600681015460c08401526007015480821660e084015261010080820490941693830193909352600160a81b909204909116151561012082015290565b6040516103819190614c63565b3480156106a457600080fd5b506006546104c2565b3480156106b957600080fd5b5061039d6106c8366004614a9f565b611dcd565b3480156106d957600080fd5b506104c260085481565b3480156106ef57600080fd5b506103756106fe366004614ad4565b60009081526005602052604090205460ff1660011490565b34801561072257600080fd5b506104c260065481565b34801561073857600080fd5b50610741611e03565b60405161038191908151815260208083015190820152604080830151908201526060918201516001600160a01b03169181019190915260800190565b34801561078957600080fd5b5061039d610798366004614ad4565b611e6d565b3480156107a957600080fd5b5061039d6107b8366004614ad4565b611f79565b3480156107c957600080fd5b5061039d6107d8366004614970565b612042565b3480156107e957600080fd5b5061039d6107f8366004614a7d565b612340565b34801561080957600080fd5b506108a4610818366004614ad4565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915250600090815260076020908152604091829020825160a0810184528154815260018201549281019290925260028101546001600160a01b0390811693830193909352600301549182166060820152600160a01b90910460ff16608082015290565b604051610381919081518152602080830151908201526040808301516001600160a01b03908116918301919091526060808401519091169082015260809182015160ff169181019190915260a00190565b34801561090157600080fd5b50600954600a54600b54600c54610921939291906001600160a01b031684565b6040516103819493929190614cf9565b61039d61093f366004614a7d565b6125c0565b34801561095057600080fd5b5061037561095f366004614c48565b60026020526000908152604090205460ff1681565b34801561098057600080fd5b5061039d61098f366004614d1d565b612840565b3480156109a057600080fd5b50610a196109af366004614ad4565b60056020819052600091825260409091208054600182015460028301546003840154600485015495850154600686015460079096015460ff9586169794966001600160a01b03948516969395949293909282821692610100810490911691600160a81b909104168a565b6040805160ff9b8c168152602081019a909a526001600160a01b03988916908a01526060890196909652608088019490945260a087019290925260c086015290941660e0840152921661010082015290151561012082015261014001610381565b348015610a8657600080fd5b50610aea610a95366004614ad4565b600460205260009081526040902080546001909101546001600160a01b0382169165ffffffffffff600160a01b8204811692600160d01b90920416906001600160981b0381169060ff600160981b9091041685565b604080516001600160a01b0396909616865265ffffffffffff948516602087015292909316918401919091526001600160981b0316606083015260ff16608082015260a001610381565b348015610b4057600080fd5b50610375610b4f366004614c1c565b612a5a565b348015610b6057600080fd5b5061039d610b6f366004614d69565b612a83565b348015610b8057600080fd5b506104c2610b8f366004614ad4565b612b2a565b348015610ba057600080fd5b506104c2600081565b348015610bb557600080fd5b50610c04610bc4366004614ad4565b6007602052600090815260409020805460018201546002830154600390930154919290916001600160a01b0391821691811690600160a01b900460ff1685565b6040805195865260208601949094526001600160a01b039283169385019390935216606083015260ff16608082015260a001610381565b348015610c4757600080fd5b5061039d610c56366004614ad4565b612b4d565b348015610c6757600080fd5b5061039d610c76366004614e13565b6130af565b348015610c8757600080fd5b506104c2610c96366004614ad4565b600090815260076020526040902060030154600160a01b900460ff1690565b348015610cc157600080fd5b5061039d610cd0366004614a9f565b6131b0565b348015610ce157600080fd5b5061039d610cf0366004614c1c565b6131e6565b348015610d0157600080fd5b506104c2610d10366004614ad4565b60009081526005602052604090206007015460ff1690565b348015610d3457600080fd5b50610d61610d43366004614ad4565b6000908152600560205260409020600201546001600160a01b031690565b6040516001600160a01b039091168152602001610381565b348015610d8557600080fd5b5061039d610d94366004614ad4565b61320b565b348015610da557600080fd5b506104c2610db4366004614ad4565b60009081526005602052604090206004015490565b348015610dd557600080fd5b5061039d610de4366004614ad4565b6135cd565b348015610df557600080fd5b506104c2610e04366004614ad4565b60009081526005602052604090206003015490565b348015610e2557600080fd5b5061039d610e34366004614ad4565b6139e7565b348015610e4557600080fd5b50610ef8610e54366004614ad4565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915250600090815260046020908152604091829020825160a08101845281546001600160a01b038116825265ffffffffffff600160a01b8204811694830194909452600160d01b9004909216928201929092526001909101546001600160981b038116606083015260ff600160981b90910416608082015290565b6040805182516001600160a01b0316815260208084015165ffffffffffff908116918301919091528383015116918101919091526060808301516001600160981b03169082015260809182015160ff169181019190915260a001610381565b348015610f6357600080fd5b5061039d610f72366004614b26565b613d5c565b61039d610f85366004614e3d565b613ee1565b348015610f9657600080fd5b506104c260008051602061538283398151915281565b348015610fb857600080fd5b50610375610fc7366004614ad4565b60036020526000908152604090205460ff1681565b60006001600160e01b03198216637965db0b60e01b148061100d57506301ffc9a760e01b6001600160e01b03198316145b92915050565b61101b614097565b80518251146110455760405162461bcd60e51b815260040161103c90614e93565b60405180910390fd5b6000805b835181101561125c57600084828151811061106657611066614eba565b60200260200101519050600084838151811061108457611084614eba565b602090810291909101810151600084815260058352604080822060018082015484526004909552912060078201549294509092909160ff16146110d95760405162461bcd60e51b815260040161103c90614ed0565b600181810154600160981b900460ff16146111065760405162461bcd60e51b815260040161103c90614efe565b600083116111265760405162461bcd60e51b815260040161103c90614f2c565b828260060154836003015461113b9190614f6a565b10156111595760405162461bcd60e51b815260040161103c90614f7d565b6007820154600160a81b900460ff1615806111775750828260030154145b6111935760405162461bcd60e51b815260040161103c90614fb4565b60028201546001600160a01b0316156111be5760405162461bcd60e51b815260040161103c90614fe0565b815460009060ff16600019016111f45782600301548484600501546111e3919061500d565b6111ed919061503a565b9050611216565b8260030154848460040154611209919061500d565b611213919061503a565b90505b611220818861504e565b965061124b85858560070160019054906101000a90046001600160a01b03166112463390565b6140c1565b505060019093019250611049915050565b508034101561127d5760405162461bcd60e51b815260040161103c90615061565b803411156112ff5760006112918234614f6a565b604051909150600090339083908381818185875af1925050503d80600081146112d6576040519150601f19603f3d011682016040523d82523d6000602084013e6112db565b606091505b50509050806112fc5760405162461bcd60e51b815260040161103c9061508d565b50505b5061130960018055565b5050565b611315614097565b6000858152600460205260409020600180820154600160981b900460ff16146113705760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2102a37b5b2b760991b604482015260640161103c565b6001600160a01b038316158015906113a057506001600160a01b03831660009081526002602052604090205460ff165b6113bc5760405162461bcd60e51b815260040161103c90614fe0565b6000851180156113cc5750600084115b6114125760405162461bcd60e51b8152602060048201526017602482015276496e76616c696420416d6f756e74206f722056616c756560481b604482015260640161103c565b6000836001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611452573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147691906150c4565b9050600061148686601284614270565b90506000620f42406009600001548861149f919061500d565b6114a9919061503a565b905060006114b982601286614270565b9050600060ff8c166001146114ce57816114d0565b835b9050876114e86001600160a01b038216333085614305565b6114f78d8d8b8e8e898e61436c565b5050505050505061150760018055565b505050505050565b611517614097565b60008051602061538283398151915261152f8161453c565b60008381526007602090815260408083208054845260058352818420600180820154865260049094529190932091820154909190600160981b900460ff1660031461158c5760405162461bcd60e51b815260040161103c906150e1565b80546001600160a01b0316158015906115b1575060018101546001600160981b031615155b6115ed5760405162461bcd60e51b815260206004820152600d60248201526c151bdad95b88139bdd0814d95d609a1b604482015260640161103c565b8054600160a01b900465ffffffffffff166116465760405162461bcd60e51b815260206004820152601960248201527814d95d1d1b1a5b99c8151a5b5948139bdd0814dd185c9d1959603a1b604482015260640161103c565b6003830154600160a01b900460ff166001146116745760405162461bcd60e51b815260040161103c90615109565b60028201546000906001600160a01b03166116915750601261170d565b8260020160009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156116e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170a91906150c4565b90505b600061173d84600301548560050154876001015461172b919061500d565b611735919061503a565b601284614546565b9050600061176f85600301548660040154886001015461175d919061500d565b611767919061503a565b601285614546565b90506000620f424060096002015483611788919061500d565b611792919061503a565b90506000816117a1858561504e565b6117ab9190614f6a565b60028801549091506001600160a01b031661189e5760028801546040516000916001600160a01b03169083908381818185875af1925050503d806000811461180f576040519150601f19603f3d011682016040523d82523d6000602084013e611814565b606091505b5050600c546040519192506000916001600160a01b039091169085908381818185875af1925050503d8060008114611868576040519150601f19603f3d011682016040523d82523d6000602084013e61186d565b606091505b5050905081801561187b5750805b6118975760405162461bcd60e51b815260040161103c90615137565b50506118dd565b600280880154908901546001600160a01b03918216916118c1918391168461459b565b600c546118db906001600160a01b0383811691168561459b565b505b60038801805460ff60a01b1916600160a11b179055604080518c8152602081018c9052338183015290517fbac7c71779ccc41f8c859e9d622536f76f0375a85b23e1b3d4134f613a9fff54916060908290030190a17f94d22e970a1abb720b741045e471af3fa516f4e2ede6b665387332888f92f2138b8284336040516119679493929190614cf9565b60405180910390a150505050505050505061130960018055565b60005b8151811015611309576119af8282815181106119a2576119a2614eba565b6020026020010151612b4d565b600101611984565b6000805160206153828339815191526119cf8161453c565b6001600160a01b038516611a175760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964204164647265737360881b604482015260640161103c565b611a25600a620f424061503a565b841115611a685760405162461bcd60e51b8152602060048201526011602482015270536574746c6520466565203c3d2031302560781b604482015260640161103c565b611a76600a620f424061503a565b831115611ab95760405162461bcd60e51b815260206004820152601160248201527043616e63656c20466565203c3d2031302560781b604482015260640161103c565b611ac76064620f424061503a565b8210158015611ad95750620f42408211155b611b255760405162461bcd60e51b815260206004820152601860248201527f506c656467652052617465206f7574206f662072616e67650000000000000000604482015260640161103c565b600c54600b54600a54600954604080516001600160a01b03958616815260208101949094528301919091526060820152908616608082015260a0810185905260c0810184905260e081018390527f72fe78202ae1d56b2334bc8c804db955e2349789b271b7f55e8109f7122f0a11906101000160405180910390a150600c80546001600160a01b0319166001600160a01b039590951694909417909355600b91909155600a55600955565b60005b815181101561130957611bfe828281518110611bf157611bf1614eba565b60200260200101516135cd565b600101611bd3565b600080516020615382833981519152611c1e8161453c565b620151808265ffffffffffff161015611c795760405162461bcd60e51b815260206004820152601860248201527f4d696e696d756d2032346820666f7220736574746c696e670000000000000000604482015260640161103c565b600083815260046020908152604091829020805465ffffffffffff868116600160d01b8181026001600160d01b03851617855586518a8152930490911693820184905293810193909352917fd5042937eda12ebddebb9d9ecaf0d88595a67d0d28513340610674acbd48274b906060015b60405180910390a15050505050565b8051825114611d1a5760405162461bcd60e51b815260040161103c90614e93565b60005b8251811015611d6a57611d62838281518110611d3b57611d3b614eba565b6020026020010151838381518110611d5557611d55614eba565b602002602001015161150f565b600101611d1d565b505050565b600082815260208190526040902060010154611d8a8161453c565b611d9483836145cc565b50505050565b6001600160a01b0381163314611dc35760405163334bd91960e11b815260040160405180910390fd5b611d6a828261465e565b60005b815181101561130957611dfb828281518110611dee57611dee614eba565b60200260200101516139e7565b600101611dd0565b611e37604051806080016040528060008152602001600081526020016000815260200160006001600160a01b031681525090565b50604080516080810182526009548152600a546020820152600b5491810191909152600c546001600160a01b0316606082015290565b600080516020615382833981519152611e858161453c565b60008281526004602052604081206001808201549192600160981b90920460ff1691908214611eb5576001611eb8565b60025b905060ff821660011480611ecf575060ff82166002145b611f1b5760405162461bcd60e51b815260206004820152601a60248201527f43616e6e6f74204368616e676520546f6b656e20537461747573000000000000604482015260640161103c565b60018301805460ff838116600160981b810260ff60981b19909316929092179092556040805188815292851660208401528201527f853e3a954af7889419a6922a1bc350b54c6217937a4a2aed1176ed3f5a1dfb5290606001611cea565b600080516020615382833981519152611f918161453c565b60008281526004602052604090206001810154600160981b900460ff16600314611ff45760405162461bcd60e51b8152602060048201526014602482015273496e76616c696420546f6b656e2053746174757360601b604482015260640161103c565b60018101805460ff60981b1916600160991b1790556040518381527f6ac56c552b96d07b41e8ee97200f747e7476892e0e2e53e9803199bfe014b0a8906020015b60405180910390a1505050565b61204a614097565b805182511461206b5760405162461bcd60e51b815260040161103c90614e93565b60005b82518110156112ff57600083828151811061208b5761208b614eba565b6020026020010151905060008383815181106120a9576120a9614eba565b602090810291909101810151600084815260058352604080822060018082015484526004909552912060078201549294509092909160ff16146120fe5760405162461bcd60e51b815260040161103c90614ed0565b600181810154600160981b900460ff161461212b5760405162461bcd60e51b815260040161103c90614efe565b6000831161214b5760405162461bcd60e51b815260040161103c90614f2c565b82826006015483600301546121609190614f6a565b101561217e5760405162461bcd60e51b815260040161103c90614f7d565b6007820154600160a81b900460ff16158061219c5750828260030154145b6121b85760405162461bcd60e51b815260040161103c90614fb4565b60028201546001600160a01b03166121e25760405162461bcd60e51b815260040161103c90614fe0565b60028201546040805163313ce56760e01b815290516001600160a01b0390921691600091829182918291869163313ce5679160048083019260209291908290030181865afa158015612238573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061225c91906150c4565b875490915060ff16600019016122bc5760008760030154898960050154612283919061500d565b61228d919061503a565b905061229b81601284614270565b600789015490955061010090046001600160a01b0316935033925050612308565b600087600301548989600401546122d3919061500d565b6122dd919061503a565b90506122eb81601284614270565b945033600789015490945061010090046001600160a01b03169250505b61231f335b6001600160a01b038716903087614305565b61232b898985856140c1565b50506001909701965061206e95505050505050565b612348614097565b60008281526005602090815260408083206001808201548552600490935292206007830154909160ff909116146123915760405162461bcd60e51b815260040161103c90614ed0565b600181810154600160981b900460ff16146123be5760405162461bcd60e51b815260040161103c90614efe565b600083116123de5760405162461bcd60e51b815260040161103c90614f2c565b82826006015483600301546123f39190614f6a565b10156124115760405162461bcd60e51b815260040161103c90614f7d565b6007820154600160a81b900460ff16158061242f5750828260030154145b61244b5760405162461bcd60e51b815260040161103c90614fb4565b60028201546001600160a01b03166124755760405162461bcd60e51b815260040161103c90614fe0565b60028201546040805163313ce56760e01b815290516001600160a01b0390921691600091829182918291869163313ce5679160048083019260209291908290030181865afa1580156124cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124ef91906150c4565b875490915060ff166000190161254f5760008760030154898960050154612516919061500d565b612520919061503a565b905061252e81601284614270565b600789015490955061010090046001600160a01b031693503392505061259b565b60008760030154898960040154612566919061500d565b612570919061503a565b905061257e81601284614270565b945033600789015490945061010090046001600160a01b03169250505b6125a43361230d565b6125b0898985856140c1565b5050505050505061130960018055565b6125c8614097565b60008281526005602090815260408083206001808201548552600490935292206007830154909160ff909116146126115760405162461bcd60e51b815260040161103c90614ed0565b600181810154600160981b900460ff161461263e5760405162461bcd60e51b815260040161103c90614efe565b6000831161265e5760405162461bcd60e51b815260040161103c90614f2c565b82826006015483600301546126739190614f6a565b10156126915760405162461bcd60e51b815260040161103c90614f7d565b6007820154600160a81b900460ff1615806126af5750828260030154145b6126cb5760405162461bcd60e51b815260040161103c90614fb4565b60028201546001600160a01b0316156126f65760405162461bcd60e51b815260040161103c90614fe0565b81546000908190819060ff166000190161274957846003015486866005015461271f919061500d565b612729919061503a565b600786015490935061010090046001600160a01b03169150339050612784565b846003015486866004015461275e919061500d565b612768919061503a565b925033600786015490925061010090046001600160a01b031690505b823410156127a45760405162461bcd60e51b815260040161103c90615061565b823411156128265760006127b88434614f6a565b604051909150600090339083908381818185875af1925050503d80600081146127fd576040519150601f19603f3d011682016040523d82523d6000602084013e612802565b606091505b50509050806128235760405162461bcd60e51b815260040161103c9061508d565b50505b612832878784846140c1565b505050505061130960018055565b6000805160206153828339815191526128588161453c565b60008481526004602052604090206001600160a01b0384166128ce5760405162461bcd60e51b815260206004820152602960248201527f746f6b656e546f536574746c6550686173653a20496e76616c696420546f6b656044820152686e204164647265737360b81b606482015260840161103c565b6000836001600160981b0316116129365760405162461bcd60e51b815260206004820152602660248201527f746f6b656e546f536574746c6550686173653a496e76616c696420536574746c60448201526565205261746560d01b606482015260840161103c565b600181810154600160981b900460ff16148061296057506001810154600160981b900460ff166002145b6129bc5760405162461bcd60e51b815260206004820152602760248201527f746f6b656e546f536574746c6550686173653a496e76616c696420546f6b656e6044820152662053746174757360c81b606482015260840161103c565b80546001820180546001600160981b0386166001600160a01b03199091168117600360981b179091556001600160a01b0386166001600160d01b03199092168217600160a01b4265ffffffffffff81169190910291909117845560408051898152602081019490945283019190915260608201527f973839ac031e9779c3158a52ae98cb3b0be8a378b1adc2b2ce2c14f89c81489590608001611cea565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b600080516020615382833981519152612a9b8161453c565b60005b8351811015612af8578260026000868481518110612abe57612abe614eba565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101612a9e565b507f6a980e8ca36409cff27b8778560e2a0f5183fea53171bc0aeff7317906c7c1f48383604051612035929190615164565b6000818152600560205260408120600681015460039091015461100d9190614f6a565b612b55614097565b60008181526007602090815260408083208054845260058352818420600180820154865260049094529190932091820154909190600160981b900460ff16600314612bb25760405162461bcd60e51b815260040161103c906150e1565b80546001600160a01b031615801590612bd7575060018101546001600160981b031615155b612c135760405162461bcd60e51b815260206004820152600d60248201526c151bdad95b88139bdd0814d95d609a1b604482015260640161103c565b8054600160a01b900465ffffffffffff16612c6c5760405162461bcd60e51b815260206004820152601960248201527814d95d1d1b1a5b99c8151a5b5948139bdd0814dd185c9d1959603a1b604482015260640161103c565b60028301546001600160a01b03163314612cb65760405162461bcd60e51b815260206004820152600b60248201526a53656c6c6572204f6e6c7960a81b604482015260640161103c565b6003830154600160a01b900460ff16600114612ce45760405162461bcd60e51b815260040161103c90615109565b60028201546000906001600160a01b0316612d0157506012612d7d565b8260020160009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612d56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d7a91906150c4565b90505b6000612d9b84600301548560050154876001015461172b919061500d565b90506000612dbb85600301548660040154886001015461175d919061500d565b84546040805163313ce56760e01b815290519293506001600160a01b0390911691600091839163313ce567916004808201926020929091908290030181865afa158015612e0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e3091906150c4565b600180880154908a0154919250600091612e5c91620f42409161172b916001600160981b03169061500d565b90506000620f424060096002015483612e75919061500d565b612e7f919061503a565b60028b0154600c54919250612ea4916001600160a01b03878116928116911684614305565b60028a015460038b0154612edb916001600160a01b039081169116612ec98486614f6a565b6001600160a01b038816929190614305565b600b54600090620f424090612ef0908861500d565b612efa919061503a565b9050600081612f09898961504e565b612f139190614f6a565b60028c01549091506001600160a01b03166130065760028c01546040516000916001600160a01b03169083908381818185875af1925050503d8060008114612f77576040519150601f19603f3d011682016040523d82523d6000602084013e612f7c565b606091505b5050600c546040519192506000916001600160a01b039091169085908381818185875af1925050503d8060008114612fd0576040519150601f19603f3d011682016040523d82523d6000602084013e612fd5565b606091505b50509050818015612fe35750805b612fff5760405162461bcd60e51b815260040161103c90615137565b5050613045565b6002808c0154908d01546001600160a01b0391821691613029918391168461459b565b600c54613043906001600160a01b0383811691168561459b565b505b60038c01805460ff60a01b1916600160a11b1790557f94d22e970a1abb720b741045e471af3fa516f4e2ede6b665387332888f92f2138d82843360405161308f9493929190614cf9565b60405180910390a15050505050505050505050506130ac60018055565b50565b60006130ba8161453c565b6001600160a01b038316158015906130eb57506001600160a01b03831660009081526002602052604090205460ff16155b61312f5760405162461bcd60e51b8152602060048201526015602482015274496e76616c696420546f6b656e204164647265737360581b604482015260640161103c565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa158015613176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061319a91906151bd565b9050611d946001600160a01b038516848361459b565b60005b8151811015611309576131de8282815181106131d1576131d1614eba565b602002602001015161320b565b6001016131b3565b6000828152602081905260409020600101546132018161453c565b611d94838361465e565b613213614097565b60008051602061538283398151915261322b8161453c565b60008281526007602090815260408083208054845260059092529091206003820154600160a01b900460ff166001146132765760405162461bcd60e51b815260040161103c90615109565b60028101546000906001600160a01b03166132935750601261330f565b8160020160009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156132e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061330c91906150c4565b90505b600061332d83600301548460040154866001015461172b919061500d565b9050600061334d84600301548560050154876001015461175d919061500d565b6003860154600280880154908701549293506001600160a01b039182169290821691166134fd5760008411801561338c57506001600160a01b03821615155b15613436576000826001600160a01b03168560405160006040518083038185875af1925050503d80600081146133de576040519150601f19603f3d011682016040523d82523d6000602084013e6133e3565b606091505b50509050806134345760405162461bcd60e51b815260206004820152601d60248201527f5472616e736665722046756e647320746f2053656c6c6572204661696c000000604482015260640161103c565b505b60008311801561344e57506001600160a01b03811615155b156134f8576000816001600160a01b03168460405160006040518083038185875af1925050503d80600081146134a0576040519150601f19603f3d011682016040523d82523d6000602084013e6134a5565b606091505b50509050806134f65760405162461bcd60e51b815260206004820152601d60248201527f5472616e736665722046756e647320746f2053656c6c6572204661696c000000604482015260640161103c565b505b61356e565b60028601546001600160a01b0316841580159061352257506001600160a01b03831615155b1561353b5761353b6001600160a01b038216848761459b565b60008411801561355357506001600160a01b03821615155b1561356c5761356c6001600160a01b038216838661459b565b505b60038701805460ff60a01b1916600360a01b179055604080518a81523360208201527f22369ba22944aadf9e9d6f4c51462417a50ea7876b9c62c7c46b5522e9c672cc91015b60405180910390a150505050505050506130ac60018055565b6135d5614097565b60008181526007602090815260408083208054845260058352818420600180820154865260049094529190932091820154909190600160981b900460ff166003146136325760405162461bcd60e51b815260040161103c906150e1565b80546136569065ffffffffffff600160d01b8204811691600160a01b9004166151d6565b65ffffffffffff1642116136ac5760405162461bcd60e51b815260206004820152601b60248201527f536574746c696e672054696d65204e6f7420456e646564205965740000000000604482015260640161103c565b6003830154600160a01b900460ff166001146136da5760405162461bcd60e51b815260040161103c90615109565b60038301546001600160a01b0316331480613708575061370860008051602061538283398151915233612a5a565b61374d5760405162461bcd60e51b81526020600482015260166024820152754275796572206f72204f70657261746f72204f6e6c7960501b604482015260640161103c565b60028201546000906001600160a01b031661376a575060126137e6565b8260020160009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156137bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137e391906150c4565b90505b600061380484600301548560050154876001015461172b919061500d565b9050600061382485600301548660040154886001015461175d919061500d565b90506000620f42406009600201548461383d919061500d565b61384890600261500d565b613852919061503a565b9050600081613861858561504e565b61386b9190614f6a565b60028801549091506001600160a01b031661395e5760038801546040516000916001600160a01b03169083908381818185875af1925050503d80600081146138cf576040519150601f19603f3d011682016040523d82523d6000602084013e6138d4565b606091505b5050600c546040519192506000916001600160a01b039091169085908381818185875af1925050503d8060008114613928576040519150601f19603f3d011682016040523d82523d6000602084013e61392d565b606091505b5050905081801561393b5750805b6139575760405162461bcd60e51b815260040161103c90615137565b505061399d565b600287015460038901546001600160a01b0391821691613981918391168461459b565b600c5461399b906001600160a01b0383811691168561459b565b505b60038801805460ff60a01b1916600360a01b1790557f6353c0ce500c8ea1f1026c8f39a6e0c2d1b2f17034fcd8a4b021c72e6e293e51898284336040516135b49493929190614cf9565b6139ef614097565b600081815260056020526040902060078101546001600160a01b03610100909104163314613a525760405162461bcd60e51b815260206004820152601060248201526f4f66666572204f776e6572204f6e6c7960801b604482015260640161103c565b600781015460ff16600114613a795760405162461bcd60e51b815260040161103c90614ed0565b600081600601548260030154613a8f9190614f6a565b905060008111613ab15760405162461bcd60e51b815260040161103c90614f7d565b60028201546000906001600160a01b0316613ace57506012613b4a565b8260020160009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015613b23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b4791906150c4565b90505b825460009060ff1660001901613b7957613b72846003015485600401548561172b919061500d565b9050613b94565b613b91846003015485600501548561172b919061500d565b90505b600a54600090620f424090613ba9908461500d565b613bb3919061503a565b9050613bbf8183614f6a565b60028601549092506001600160a01b0316613cb757600785015460405160009161010090046001600160a01b03169084908381818185875af1925050503d8060008114613c28576040519150601f19603f3d011682016040523d82523d6000602084013e613c2d565b606091505b5050600c546040519192506000916001600160a01b039091169084908381818185875af1925050503d8060008114613c81576040519150601f19603f3d011682016040523d82523d6000602084013e613c86565b606091505b50509050818015613c945750805b613cb05760405162461bcd60e51b815260040161103c90615137565b5050613cfc565b600285015460078601546001600160a01b0391821691613ce0918391610100909104168561459b565b600c54613cfa906001600160a01b0383811691168461459b565b505b60078501805460ff191660031790557ff65e543d34c6936603a3741b3eace109133f172d25637c2445b95c1f3288e937868383613d363390565b604051613d469493929190614cf9565b60405180910390a150505050506130ac60018055565b600080516020615382833981519152613d748161453c565b620151808265ffffffffffff161015613ddd5760405162461bcd60e51b815260206004820152602560248201527f637265617465546f6b656e3a204d696e696d756d2032346820666f7220736574604482015264746c696e6760d81b606482015260840161103c565b60008381526003602052604090205460ff1615613e465760405162461bcd60e51b815260206004820152602160248201527f637265617465546f6b656e3a20546f6b656e20616c72656164792065786973746044820152607360f81b606482015260840161103c565b6000838152600360209081526040808320805460ff191660019081179091556004835292819020805465ffffffffffff8716600160d01b81026001600160d01b03909216919091178255938101805460ff60981b1916600160981b1790558151878152928301939093527f1da02fe9181848bf1b401dde762d155f0da084c24db69129a3c7479f970ddbcc910160405180910390a150505050565b613ee9614097565b6000848152600460205260409020600180820154600160981b900460ff1614613f445760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2102a37b5b2b760991b604482015260640161103c565b600084118015613f545750600083115b613f9a5760405162461bcd60e51b8152602060048201526017602482015276496e76616c696420416d6f756e74206f722056616c756560481b604482015260640161103c565b600954600090620f424090613faf908661500d565b613fb9919061503a565b9050600060ff8816600114613fce5781613fd0565b845b905034811115613ff25760405162461bcd60e51b815260040161103c90615061565b803411156140745760006140068234614f6a565b604051909150600090339083908381818185875af1925050503d806000811461404b576040519150601f19603f3d011682016040523d82523d6000602084013e614050565b606091505b50509050806140715760405162461bcd60e51b815260040161103c9061508d565b50505b614084888860008989878a61436c565b50505061409060018055565b5050505050565b6002600154036140ba57604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b60006005600086815260200190815260200160002090506040518060a00160405280868152602001858152602001836001600160a01b03168152602001846001600160a01b03168152602001600160ff1681525060076000600860008154614128906151fc565b918290555081526020808201929092526040908101600090812084518155928401516001840155908301516002830180546001600160a01b039283166001600160a01b031990911617905560608401516003909301805460809095015160ff16600160a01b026001600160a81b031990951693909116929092179290921790556006820180548692906141bc90849061504e565b909155505060038101546006820154036142195760078101805460ff1916600217905560408051868152600060208201527f37a30d6e3fcaec3144b11d51892b9eadbb0ec4d2a8a813d64bb6065c3adfcffa910160405180910390a15b600854604080519182526020820187905281018590526001600160a01b038084166060830152841660808201527fdc3effd7f2b46d1989f8b9ec5abba2e3c07eaa9caa9511c8af3c9444ecbb52f29060a001611cea565b60008160ff168360ff16036142865750826142fe565b8160ff168360ff1610156142ba5761429e8383615215565b6142a990600a615312565b6142b3908561500d565b90506142fe565b60006142c68385615215565b6142d190600a615312565b90506142dd818661503a565b91506142e98186615321565b156142fc576142f960018361504e565b91505b505b9392505050565b6040516001600160a01b038481166024830152838116604483015260648201839052611d949186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050506146c9565b6040518061014001604052808860ff168152602001878152602001866001600160a01b0316815260200185815260200184815260200183815260200160008152602001600160ff1681526020016143c03390565b6001600160a01b03168152602001821515815250600560006006600081546143e7906151fc565b9182905550815260208082019290925260409081016000208351815460ff191660ff918216178255928401516001820155908301516002820180546001600160a01b0319166001600160a01b03928316179055606084015160038301556080840151600483015560a0840151600583015560c084015160068084019190915560e0850151600790930180546101008088015161012090980151959096166001600160a81b031990911617959092169093029390931760ff60a81b1916600160a81b9115159190910217909155547f8f8f88015929d8eeb82fcc5c324b9713dc52572eae5cf9e6e80f7e2d81ae089890888888888888883360408051998a5260ff90981660208a0152968801959095526001600160a01b039384166060880152608087019290925260a086015260c085015290151560e0840152166101008201526101200160405180910390a150505050505050565b6130ac813361472c565b60008160ff168360ff160361455c5750826142fe565b8160ff168360ff1610156145745761429e8383615215565b61457e8284615215565b61458990600a615312565b614593908561503a565b949350505050565b6040516001600160a01b03838116602483015260448201839052611d6a91859182169063a9059cbb9060640161433a565b60006145d88383612a5a565b614656576000838152602081815260408083206001600160a01b03861684529091529020805460ff1916600117905561460e3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161100d565b50600061100d565b600061466a8383612a5a565b15614656576000838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161100d565b60006146de6001600160a01b03841683614765565b905080516000141580156147035750808060200190518101906147019190615335565b155b15611d6a57604051635274afe760e01b81526001600160a01b038416600482015260240161103c565b6147368282612a5a565b6113095760405163e2517d3f60e01b81526001600160a01b03821660048201526024810183905260440161103c565b60606142fe8383600084600080856001600160a01b0316848660405161478b9190615352565b60006040518083038185875af1925050503d80600081146147c8576040519150601f19603f3d011682016040523d82523d6000602084013e6147cd565b606091505b50915091506147dd8683836147e7565b9695505050505050565b6060826147fc576147f782614843565b6142fe565b815115801561481357506001600160a01b0384163b155b1561483c57604051639996b31560e01b81526001600160a01b038516600482015260240161103c565b50806142fe565b8051156148535780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60006020828403121561487e57600080fd5b81356001600160e01b0319811681146142fe57600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156148d5576148d5614896565b604052919050565b600067ffffffffffffffff8211156148f7576148f7614896565b5060051b60200190565b600082601f83011261491257600080fd5b81356020614927614922836148dd565b6148ac565b8083825260208201915060208460051b87010193508684111561494957600080fd5b602086015b84811015614965578035835291830191830161494e565b509695505050505050565b6000806040838503121561498357600080fd5b823567ffffffffffffffff8082111561499b57600080fd5b6149a786838701614901565b935060208501359150808211156149bd57600080fd5b506149ca85828601614901565b9150509250929050565b60ff811681146130ac57600080fd5b80356001600160a01b03811681146149fa57600080fd5b919050565b80151581146130ac57600080fd5b80356149fa816149ff565b60008060008060008060c08789031215614a3157600080fd5b8635614a3c816149d4565b9550602087013594506040870135935060608701359250614a5f608088016149e3565b915060a0870135614a6f816149ff565b809150509295509295509295565b60008060408385031215614a9057600080fd5b50508035926020909101359150565b600060208284031215614ab157600080fd5b813567ffffffffffffffff811115614ac857600080fd5b61459384828501614901565b600060208284031215614ae657600080fd5b5035919050565b60008060008060808587031215614b0357600080fd5b614b0c856149e3565b966020860135965060408601359560600135945092505050565b60008060408385031215614b3957600080fd5b82359150602083013565ffffffffffff81168114614b5657600080fd5b809150509250929050565b60008060408385031215614b7457600080fd5b823567ffffffffffffffff80821115614b8c57600080fd5b614b9886838701614901565b9350602091508185013581811115614baf57600080fd5b85019050601f81018613614bc257600080fd5b8035614bd0614922826148dd565b81815260059190911b82018301908381019088831115614bef57600080fd5b928401925b82841015614c0d57833582529284019290840190614bf4565b80955050505050509250929050565b60008060408385031215614c2f57600080fd5b82359150614c3f602084016149e3565b90509250929050565b600060208284031215614c5a57600080fd5b6142fe826149e3565b815160ff1681526101408101602083015160208301526040830151614c9360408401826001600160a01b03169052565b50606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e0830151614cd060e084018260ff169052565b50610100838101516001600160a01b031690830152610120928301511515929091019190915290565b938452602084019290925260408301526001600160a01b0316606082015260800190565b600080600060608486031215614d3257600080fd5b83359250614d42602085016149e3565b915060408401356001600160981b0381168114614d5e57600080fd5b809150509250925092565b60008060408385031215614d7c57600080fd5b823567ffffffffffffffff811115614d9357600080fd5b8301601f81018513614da457600080fd5b80356020614db4614922836148dd565b82815260059290921b83018101918181019088841115614dd357600080fd5b938201935b83851015614df857614de9856149e3565b82529382019390820190614dd8565b9550614e079050868201614a0d565b93505050509250929050565b60008060408385031215614e2657600080fd5b614e2f836149e3565b9150614c3f602084016149e3565b600080600080600060a08688031215614e5557600080fd5b8535614e60816149d4565b94506020860135935060408601359250606086013591506080860135614e85816149ff565b809150509295509295909350565b6020808252600d908201526c125b9d985b1a5908125b9c1d5d609a1b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b602080825260149082015273496e76616c6964204f666665722053746174757360601b604082015260600190565b602080825260149082015273496e76616c696420746f6b656e2053746174757360601b604082015260600190565b6020808252600e908201526d125b9d985b1a5908105b5bdd5b9d60921b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b8181038181111561100d5761100d614f54565b60208082526018908201527f496e73756666696369656e7420416c6c6f636174696f6e730000000000000000604082015260600190565b602080825260129082015271119d5b1b13585d18da081c995c5d5a5c995960721b604082015260600190565b60208082526013908201527224b73b30b634b21027b33332b9102a37b5b2b760691b604082015260600190565b808202811582820484141761100d5761100d614f54565b634e487b7160e01b600052601260045260246000fd5b60008261504957615049615024565b500490565b8082018082111561100d5761100d614f54565b602080825260129082015271496e73756666696369656e742046756e647360701b604082015260600190565b6020808252601b908201527f526566756e64206f662065786365737320455448206661696c65640000000000604082015260600190565b6000602082840312156150d657600080fd5b81516142fe816149d4565b6020808252600e908201526d496e76616c69642053746174757360901b604082015260600190565b602080825260149082015273496e76616c6964204f726465722053746174757360601b604082015260600190565b602080825260139082015272151c985b9cd9995c88119d5b991cc811985a5b606a1b604082015260600190565b604080825283519082018190526000906020906060840190828701845b828110156151a65781516001600160a01b031684529284019290840190600101615181565b505050809250505082151560208301529392505050565b6000602082840312156151cf57600080fd5b5051919050565b65ffffffffffff8181168382160190808211156151f5576151f5614f54565b5092915050565b60006001820161520e5761520e614f54565b5060010190565b60ff828116828216039081111561100d5761100d614f54565b600181815b8085111561526957816000190482111561524f5761524f614f54565b8085161561525c57918102915b93841c9390800290615233565b509250929050565b6000826152805750600161100d565b8161528d5750600061100d565b81600181146152a357600281146152ad576152c9565b600191505061100d565b60ff8411156152be576152be614f54565b50506001821b61100d565b5060208310610133831016604e8410600b84101617156152ec575081810a61100d565b6152f6838361522e565b806000190482111561530a5761530a614f54565b029392505050565b60006142fe60ff841683615271565b60008261533057615330615024565b500690565b60006020828403121561534757600080fd5b81516142fe816149ff565b6000825160005b818110156153735760208186018101518583015201615359565b50600092019182525091905056fe97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929a2646970667358221220242f49119d97806b76fe30960e4d7df5008d68e708a3fbfbeebc6e0ac290c4fe64736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000010f4861365511ae1a11dbd2210bcccad42bcbf1a000000000000000000000000c4137ee33e81b181fb0a6511835ecef6a6740d97
-----Decoded View---------------
Arg [0] : adminAddress (address): 0x10F4861365511AE1a11dbD2210bCCCad42BCBF1A
Arg [1] : feeWalletAddress (address): 0xC4137Ee33e81B181fB0a6511835eCef6a6740d97
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000010f4861365511ae1a11dbd2210bcccad42bcbf1a
Arg [1] : 000000000000000000000000c4137ee33e81b181fb0a6511835ecef6a6740d97
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | Ether (ETH) | 45.61% | $3,113.73 | 0.8169 | $2,543.66 |
ETH | 21.54% | $1 | 1,200 | $1,201.2 | |
ETH | 15.99% | $1 | 890.82 | $891.71 | |
SCROLL | 8.66% | $3,113.03 | 0.1552 | $483.04 | |
SCROLL | 0.58% | $1 | 32.101 | $32.13 | |
BSC | 5.21% | $613.46 | 0.474 | $290.77 | |
BSC | 0.03% | $1 | 1.424 | $1.43 | |
ARB | 1.05% | $3,113.14 | 0.0188 | $58.49 | |
LINEA | 0.65% | $3,113.73 | 0.0116 | $36.23 | |
LINEA | 0.18% | $1 | 10 | $10.02 | |
ARBNOVA | 0.51% | $3,113.83 | 0.009122 | $28.4 | |
ZKSYNC | <0.01% | $3,113.03 | 0.000014 | $0.043582 |
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.