Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 19268228 | 201 days ago | IN | 0 ETH | 0.15566211 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
PreMarket
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.20; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.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 PreMarket is Initializable, OwnableUpgradeable, AccessControlUpgradeable, ReentrancyGuardUpgradeable { 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"); struct PreMarketStorage { mapping(address => bool) acceptedTokens; mapping(bytes32 => Token) tokens; mapping(uint256 => Offer) offers; uint256 lastOfferId; mapping(uint256 => Order) orders; uint256 lastOrderId; Config config; } // keccak256(abi.encode(uint256(keccak256("loot.storage.PreMarket")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant PreMarketStorageLocation = 0xe0eb0c6bc05973c9317c77fe5b658559f9e21630d35f19f70b8603a4f231f900; function _getOwnStorage() private pure returns (PreMarketStorage storage $) { assembly { $.slot := PreMarketStorageLocation } } // 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 ); function initialize() public initializer { __Ownable_init(msg.sender); __AccessControl_init_unchained(); _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); // init value PreMarketStorage storage $ = _getOwnStorage(); $.config.pledgeRate = WEI6; // 1:1 $.config.feeWallet = owner(); $.config.feeSettle = WEI6 / 40; // 2.5% $.config.feeRefund = WEI6 / 200; // 0.5% } /////////////////////////// ////// SYSTEM ACTION ////// /////////////////////////// function createToken( bytes32 tokenId, uint48 settleDuration ) external onlyRole(OPERATOR_ROLE) { PreMarketStorage storage $ = _getOwnStorage(); require(settleDuration >= 24 * 60 * 60, "Minimum 24h for settling"); Token storage _token = $.tokens[tokenId]; _token.settleDuration = settleDuration; _token.status = STATUS_TOKEN_ACTIVE; emit NewToken(tokenId, settleDuration); } function tokenToSettlePhase( bytes32 tokenId, address tokenAddress, uint152 settleRate // how many token for 1M points ) external onlyRole(OPERATOR_ROLE) { PreMarketStorage storage $ = _getOwnStorage(); Token storage _token = $.tokens[tokenId]; require(tokenAddress != address(0), "Invalid Token Address"); require(settleRate > 0, "Invalid Settle Rate"); require( _token.status == STATUS_TOKEN_ACTIVE || _token.status == STATUS_TOKEN_INACTIVE, "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 ); } function tokenToggleActivation( bytes32 tokenId ) external onlyRole(OPERATOR_ROLE) { PreMarketStorage storage $ = _getOwnStorage(); 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); } // in case wrong setting for settle function tokenForceCancelSettlePhase(bytes32 tokenId) external onlyOwner { PreMarketStorage storage $ = _getOwnStorage(); Token storage _token = $.tokens[tokenId]; require(_token.status == STATUS_TOKEN_SETTLE, "Invalid Token Status"); _token.status = STATUS_TOKEN_INACTIVE; emit TokenForceCancelSettlePhase(tokenId); } function updateSettleDuration( bytes32 tokenId, uint48 newValue ) external onlyOwner { PreMarketStorage storage $ = _getOwnStorage(); 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); } // force cancel order - by Operator // refund for both seller & buyer function forceCancelOrder( uint256 orderId ) public nonReentrant onlyRole(OPERATOR_ROLE) { PreMarketStorage storage $ = _getOwnStorage(); Order storage order = $.orders[orderId]; Offer storage offer = $.offers[order.offerId]; require(order.status == STATUS_OFFER_OPEN, "Invalid Order Status"); // calculate refund uint256 buyerRefundValue = (order.amount * offer.value) / offer.amount; // value uint256 sellerRefundValue = (order.amount * offer.collateral) / offer.amount; // collateral 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, msg.sender); } // 2 steps settle: // Tx1: Seller sending token to system vault/buyer // Tx2: then Operator verify and settle to pay seller money+collateral function settle2Steps( uint256 orderId, bytes32 hash ) public nonReentrant onlyRole(OPERATOR_ROLE) { PreMarketStorage storage $ = _getOwnStorage(); 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" ); require( block.timestamp > token.settleTime, "Settling Time Not Started" ); require(order.status == STATUS_ORDER_OPEN, "Invalid Order Status"); uint256 collateral = (order.amount * offer.collateral) / offer.amount; uint256 value = (order.amount * offer.value) / offer.amount; // 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, msg.sender); emit SettleFilled(orderId, totalValue, settleFee, msg.sender); } 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 ////// ///////////////////////// // make a offer request function newOffer( uint8 offerType, bytes32 tokenId, uint256 amount, uint256 value, address exToken, bool fullMatch ) external nonReentrant { PreMarketStorage storage $ = _getOwnStorage(); 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"); IERC20 iexToken = IERC20(exToken); // collateral uint256 collateral = (value * $.config.pledgeRate) / WEI6; // transfer offer value (offer buy) or collateral (offer sell) uint256 _transferAmount = offerType == OFFER_BUY ? value : collateral; iexToken.safeTransferFrom(msg.sender, address(this), _transferAmount); // create new offer _newOffer( offerType, tokenId, exToken, amount, value, collateral, fullMatch ); } // New offer in ETH function newOfferETH( uint8 offerType, bytes32 tokenId, uint256 amount, uint256 value, bool fullMatch ) external payable nonReentrant { PreMarketStorage storage $ = _getOwnStorage(); 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"); // create new offer _newOffer( offerType, tokenId, address(0), amount, value, collateral, fullMatch ); } // take a buy request function fillOffer(uint256 offerId, uint256 amount) external nonReentrant { PreMarketStorage storage $ = _getOwnStorage(); 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 IERC20 iexToken = IERC20(offer.exToken); uint256 _transferAmount; address buyer; address seller; if (offer.offerType == OFFER_BUY) { _transferAmount = (offer.collateral * amount) / offer.amount; buyer = offer.offeredBy; seller = msg.sender; } else { _transferAmount = (offer.value * amount) / offer.amount; buyer = msg.sender; seller = offer.offeredBy; } iexToken.safeTransferFrom(msg.sender, address(this), _transferAmount); // new order _fillOffer(offerId, amount, buyer, seller); } function fillOfferETH( uint256 offerId, uint256 amount ) external payable nonReentrant { PreMarketStorage storage $ = _getOwnStorage(); 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 = msg.sender; } else { _ethAmount = (offer.value * amount) / offer.amount; buyer = msg.sender; seller = offer.offeredBy; } require(msg.value >= _ethAmount, "Insufficient Funds"); // new order _fillOffer(offerId, amount, buyer, seller); } // close unfullfilled offer - by Offer owner function cancelOffer(uint256 offerId) public nonReentrant { PreMarketStorage storage $ = _getOwnStorage(); Offer storage offer = $.offers[offerId]; require(offer.offeredBy == msg.sender, "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 uint256 refundValue; if (offer.offerType == OFFER_BUY) { refundValue = (refundAmount * offer.value) / offer.amount; } else { refundValue = (refundAmount * offer.collateral) / offer.amount; } 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, msg.sender); } // settle order - deliver token to finillize the order function settleFilled(uint256 orderId) public nonReentrant { PreMarketStorage storage $ = _getOwnStorage(); 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" ); require( block.timestamp > token.settleTime, "Settling Time Not Started" ); require(order.seller == msg.sender, "Seller Only"); require(order.status == STATUS_ORDER_OPEN, "Invalid Order Status"); uint256 collateral = (order.amount * offer.collateral) / offer.amount; uint256 value = (order.amount * offer.value) / offer.amount; // transfer token to buyer IERC20 iToken = IERC20(token.token); // calculate token amount base on it's decimals uint256 tokenAmount = (order.amount * token.settleRate) / WEI6; 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, msg.sender); } // cancel unfilled order by token buyer after fullfill time frame // token seller lose collateral to token buyer function settleCancelled(uint256 orderId) public nonReentrant { PreMarketStorage storage $ = _getOwnStorage(); 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 == msg.sender || hasRole(OPERATOR_ROLE, msg.sender), "Buyer or Operator Only" ); uint256 collateral = (order.amount * offer.collateral) / offer.amount; uint256 value = (order.amount * offer.value) / offer.amount; // 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, msg.sender); } // Batch actions function forceCancelOrders(uint256[] memory orderIds) external { for (uint256 i = 0; i < orderIds.length; i++) { forceCancelOrder(orderIds[i]); } } function cancelOffers(uint256[] memory offerIds) external { for (uint256 i = 0; i < offerIds.length; i++) { cancelOffer(offerIds[i]); } } function settleFilleds(uint256[] memory orderIds) external { for (uint256 i = 0; i < orderIds.length; i++) { settleFilled(orderIds[i]); } } function settleCancelleds(uint256[] memory orderIds) external { for (uint256 i = 0; i < orderIds.length; i++) { settleCancelled(orderIds[i]); } } /////////////////////////// ///////// SETTER ////////// /////////////////////////// function updateConfig( address feeWallet_, uint256 feeSettle_, uint256 feeRefund_, uint256 pledgeRate_ ) external onlyRole(OPERATOR_ROLE) { PreMarketStorage storage $ = _getOwnStorage(); require(feeWallet_ != address(0), "Invalid Address"); require(feeSettle_ <= WEI6 / 100, "Settle Fee <= 10%"); require(feeRefund_ <= WEI6 / 100, "Cancel Fee <= 10%"); 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_; } function setAcceptedTokens( address[] memory tokenAddresses, bool isAccepted ) external onlyRole(OPERATOR_ROLE) { PreMarketStorage storage $ = _getOwnStorage(); for (uint256 i = 0; i < tokenAddresses.length; i++) { $.acceptedTokens[tokenAddresses[i]] = isAccepted; } emit UpdateAcceptedTokens(tokenAddresses, isAccepted); } /////////////////////////// ///////// GETTER ////////// /////////////////////////// function offerAmount(uint256 offerId) external view returns (uint256) { PreMarketStorage storage $ = _getOwnStorage(); return $.offers[offerId].amount; } function offerAmountAvailable( uint256 offerId ) external view returns (uint256) { PreMarketStorage storage $ = _getOwnStorage(); return $.offers[offerId].amount - $.offers[offerId].filledAmount; } function offerValue(uint256 offerId) external view returns (uint256) { PreMarketStorage storage $ = _getOwnStorage(); return $.offers[offerId].value; } function offerExToken(uint256 offerId) external view returns (address) { PreMarketStorage storage $ = _getOwnStorage(); return $.offers[offerId].exToken; } function isBuyOffer(uint256 offerId) external view returns (bool) { PreMarketStorage storage $ = _getOwnStorage(); return $.offers[offerId].offerType == OFFER_BUY; } function isSellOffer(uint256 offerId) external view returns (bool) { PreMarketStorage storage $ = _getOwnStorage(); return $.offers[offerId].offerType == OFFER_SELL; } function offerStatus(uint256 offerId) external view returns (uint256) { PreMarketStorage storage $ = _getOwnStorage(); return $.offers[offerId].status; } function orderStatus(uint256 orderId) external view returns (uint256) { PreMarketStorage storage $ = _getOwnStorage(); return $.orders[orderId].status; } function tokens(bytes32 tokenId) external view returns (Token memory) { PreMarketStorage storage $ = _getOwnStorage(); return $.tokens[tokenId]; } function offers(uint256 id) external view returns (Offer memory) { PreMarketStorage storage $ = _getOwnStorage(); return $.offers[id]; } function orders(uint256 id) external view returns (Order memory) { PreMarketStorage storage $ = _getOwnStorage(); return $.orders[id]; } function config() external view returns (Config memory) { PreMarketStorage storage $ = _getOwnStorage(); return $.config; } function isAcceptedToken(address token) external view returns (bool) { PreMarketStorage storage $ = _getOwnStorage(); return $.acceptedTokens[token]; } function lastOfferId() external view returns (uint256) { PreMarketStorage storage $ = _getOwnStorage(); return $.lastOfferId; } function lastOrderId() external view returns (uint256) { PreMarketStorage storage $ = _getOwnStorage(); return $.lastOrderId; } /////////////////////////// //////// INTERNAL ///////// /////////////////////////// function _newOffer( uint8 offerType, bytes32 tokenId, address exToken, uint256 amount, uint256 value, uint256 collateral, bool fullMatch ) internal { PreMarketStorage storage $ = _getOwnStorage(); // create new offer $.offers[++$.lastOfferId] = Offer( offerType, tokenId, exToken, amount, value, collateral, 0, STATUS_OFFER_OPEN, msg.sender, fullMatch ); emit NewOffer( $.lastOfferId, offerType, tokenId, exToken, amount, value, collateral, fullMatch, msg.sender ); } function _fillOffer( uint256 offerId, uint256 amount, address buyer, address seller ) internal { PreMarketStorage storage $ = _getOwnStorage(); 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); } // get stuck token in contract function withdrawStuckToken( address _token, address _to ) external onlyOwner { PreMarketStorage storage $ = _getOwnStorage(); require( _token != address(0) && !$.acceptedTokens[_token], "Invalid Token Address" ); uint256 _contractBalance = IERC20(_token).balanceOf(address(this)); IERC20(_token).safeTransfer(_to, _contractBalance); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) pragma solidity ^0.8.20; import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol"; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {ERC165Upgradeable} from "../utils/introspection/ERC165Upgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.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 AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControl, ERC165Upgradeable { struct RoleData { mapping(address account => bool) hasRole; bytes32 adminRole; } bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /// @custom:storage-location erc7201:openzeppelin.storage.AccessControl struct AccessControlStorage { mapping(bytes32 role => RoleData) _roles; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControl")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant AccessControlStorageLocation = 0x02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800; function _getAccessControlStorage() private pure returns (AccessControlStorage storage $) { assembly { $.slot := AccessControlStorageLocation } } /** * @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); _; } function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } /** * @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) { AccessControlStorage storage $ = _getAccessControlStorage(); 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) { AccessControlStorage storage $ = _getAccessControlStorage(); 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 { AccessControlStorage storage $ = _getAccessControlStorage(); 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) { AccessControlStorage storage $ = _getAccessControlStorage(); 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) { AccessControlStorage storage $ = _getAccessControlStorage(); 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/Ownable.sol) pragma solidity ^0.8.20; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Ownable struct OwnableStorage { address _owner; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300; function _getOwnableStorage() private pure returns (OwnableStorage storage $) { assembly { $.slot := OwnableStorageLocation } } /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ function __Ownable_init(address initialOwner) internal onlyInitializing { __Ownable_init_unchained(initialOwner); } function __Ownable_init_unchained(address initialOwner) internal onlyInitializing { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { OwnableStorage storage $ = _getOwnableStorage(); return $._owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { OwnableStorage storage $ = _getOwnableStorage(); address oldOwner = $._owner; $._owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._initialized = 1; if (isTopLevelCall) { $._initializing = true; } _; if (isTopLevelCall) { $._initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._initialized = version; $._initializing = true; _; $._initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Context.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @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 ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import {Initializable} from "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165 { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @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/ReentrancyGuard.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @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 ReentrancyGuardUpgradeable is Initializable { // 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; /// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard struct ReentrancyGuardStorage { uint256 _status; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00; function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) { assembly { $.slot := ReentrancyGuardStorageLocation } } /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); $._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 { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // 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 { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // 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) { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); return $._status == ENTERED; } }
// 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) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.20; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822Proxiable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.20; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {UpgradeableBeacon} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol) pragma solidity ^0.8.20; import {IBeacon} from "../beacon/IBeacon.sol"; import {Address} from "../../utils/Address.sol"; import {StorageSlot} from "../../utils/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. */ library ERC1967Utils { // We re-declare ERC-1967 events here because they can't be used directly from IERC1967. // This will be fixed in Solidity 0.8.21. At that point we should remove these events. /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Emitted when the beacon is changed. */ event BeaconUpgraded(address indexed beacon); /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev The `implementation` of the proxy is invalid. */ error ERC1967InvalidImplementation(address implementation); /** * @dev The `admin` of the proxy is invalid. */ error ERC1967InvalidAdmin(address admin); /** * @dev The `beacon` of the proxy is invalid. */ error ERC1967InvalidBeacon(address beacon); /** * @dev An upgrade function sees `msg.value > 0` that may be lost. */ error ERC1967NonPayable(); /** * @dev Returns the current implementation address. */ function getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { if (newImplementation.code.length == 0) { revert ERC1967InvalidImplementation(newImplementation); } StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Performs implementation upgrade with additional setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); if (data.length > 0) { Address.functionDelegateCall(newImplementation, data); } else { _checkNonPayable(); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Returns the current admin. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` */ function getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { if (newAdmin == address(0)) { revert ERC1967InvalidAdmin(address(0)); } StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {IERC1967-AdminChanged} event. */ function changeAdmin(address newAdmin) internal { emit AdminChanged(getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Returns the current beacon. */ function getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { if (newBeacon.code.length == 0) { revert ERC1967InvalidBeacon(newBeacon); } StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon; address beaconImplementation = IBeacon(newBeacon).implementation(); if (beaconImplementation.code.length == 0) { revert ERC1967InvalidImplementation(beaconImplementation); } } /** * @dev Change the beacon and trigger a setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-BeaconUpgraded} event. * * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for * efficiency. */ function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } else { _checkNonPayable(); } } /** * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract * if an upgrade doesn't perform an initialization call. */ function _checkNonPayable() private { if (msg.value > 0) { revert ERC1967NonPayable(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.20; import {IERC1822Proxiable} from "../../interfaces/draft-IERC1822.sol"; import {ERC1967Utils} from "../ERC1967/ERC1967Utils.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. */ abstract contract UUPSUpgradeable is IERC1822Proxiable { /// @custom:oz-upgrades-unsafe-allow state-variable-immutable address private immutable __self = address(this); /** * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)` * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called, * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string. * If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function * during an upgrade. */ string public constant UPGRADE_INTERFACE_VERSION = "5.0.0"; /** * @dev The call is from an unauthorized context. */ error UUPSUnauthorizedCallContext(); /** * @dev The storage `slot` is unsupported as a UUID. */ error UUPSUnsupportedProxiableUUID(bytes32 slot); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { _checkProxy(); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { _checkNotDelegated(); _; } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual notDelegated returns (bytes32) { return ERC1967Utils.IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. * * @custom:oz-upgrades-unsafe-allow-reachable delegatecall */ function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data); } /** * @dev Reverts if the execution is not performed via delegatecall or the execution * context is not of a proxy with an ERC1967-compliant implementation pointing to self. * See {_onlyProxy}. */ function _checkProxy() internal view virtual { if ( address(this) == __self || // Must be called through delegatecall ERC1967Utils.getImplementation() != __self // Must be called through an active proxy ) { revert UUPSUnauthorizedCallContext(); } } /** * @dev Reverts if the execution is performed via delegatecall. * See {notDelegated}. */ function _checkNotDelegated() internal view virtual { if (address(this) != __self) { // Must not be called through delegatecall revert UUPSUnauthorizedCallContext(); } } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call. * * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value * is expected to be the implementation slot in ERC1967. * * Emits an {IERC1967-Upgraded} event. */ function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private { try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) { revert UUPSUnsupportedProxiableUUID(slot); } ERC1967Utils.upgradeToAndCall(newImplementation, data); } catch { // The implementation is not UUPS revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation); } } }
// 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.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.20; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS } /** * @dev The signature derives the `address(0)`. */ error ECDSAInvalidSignature(); /** * @dev The signature has an invalid length. */ error ECDSAInvalidSignatureLength(uint256 length); /** * @dev The signature has an S value that is in the upper half order. */ error ECDSAInvalidSignatureS(bytes32 s); /** * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not * return address(0) without also returning an error description. Errors are documented using an enum (error type) * and a bytes32 providing additional information about the error. * * If no error is returned, then the address can be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length)); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) { unchecked { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); // We do not check for an overflow here since the shift operation results in 0 or 1. uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError, bytes32) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS, s); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature, bytes32(0)); } return (signer, RecoverError.NoError, bytes32(0)); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s); _throwError(error, errorArg); return recovered; } /** * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided. */ function _throwError(RecoverError error, bytes32 errorArg) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert ECDSAInvalidSignature(); } else if (error == RecoverError.InvalidSignatureLength) { revert ECDSAInvalidSignatureLength(uint256(errorArg)); } else if (error == RecoverError.InvalidSignatureS) { revert ECDSAInvalidSignatureS(errorArg); } } }
// 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/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.20; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(newImplementation.code.length > 0); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"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":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","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":"uint64","name":"version","type":"uint64"}],"name":"Initialized","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":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","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":"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":[{"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":"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":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","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":"lastOrderId","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":"id","type":"uint256"}],"name":"offers","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":"id","type":"uint256"}],"name":"orders","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":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","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":"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":"tokenId","type":"bytes32"}],"name":"tokens","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":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","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
608060405234801561001057600080fd5b50614869806100206000396000f3fe6080604052600436106102ae5760003560e01c806386aa7db011610175578063cfcdeb7e116100dc578063e4cb62c011610095578063f1ee8fdd1161006f578063f1ee8fdd1461092f578063f2fde38b1461094f578063f564f0ae1461096f578063f5b541a61461098257600080fd5b8063e4cb62c0146108cf578063e7a75949146108ef578063ef706adf1461090f57600080fd5b8063cfcdeb7e1461080f578063d547741f1461082f578063d843b2c71461084f578063dc8beea91461086f578063deb2ec6a1461088f578063e3df748a146108af57600080fd5b8063a1bd91e11161012e578063a1bd91e114610709578063a217fddf14610729578063a85c38ef1461073e578063aaab596a146107af578063bc205ad3146107cf578063bff49450146107ef57600080fd5b806386aa7db0146105d05780638a72ea6a146105f05780638da5cb5b1461061d578063904194a31461064a57806391d14854146106c9578063985a7c1d146106e957600080fd5b80633b6e750f11610219578063715018a6116101d2578063715018a6146105025780637400f52d1461051757806378447e7f1461053757806379502c55146105575780638129fc1c146105a857806381cc37b2146105bd57600080fd5b80633b6e750f146104585780634ae25a86146104785780635662ecc7146104985780635d3473e3146104ad578063643268c9146104cd5780636a951f20146104e257600080fd5b80631f4846d81161026b5780631f4846d81461038a57806321146fa2146103aa578063248a9ca3146103ca5780632d670584146103f85780632f2ff15d1461041857806336568abe1461043857600080fd5b806301ffc9a7146102b35780630b8aacb9146102e857806316b4cdb21461030a57806317b137ba1461032a57806318b4f3671461034a5780631f25a2d81461036a575b600080fd5b3480156102bf57600080fd5b506102d36102ce366004613f7d565b6109a4565b60405190151581526020015b60405180910390f35b3480156102f457600080fd5b50610308610303366004613fed565b6109db565b005b34801561031657600080fd5b50610308610325366004614050565b610b79565b34801561033657600080fd5b50610308610345366004614148565b610f67565b34801561035657600080fd5b506102d3610365366004614185565b610fa7565b34801561037657600080fd5b5061030861038536600461419e565b610fd1565b34801561039657600080fd5b506103086103a5366004614148565b61119b565b3480156103b657600080fd5b506103086103c53660046141d7565b6111db565b3480156103d657600080fd5b506103ea6103e5366004614185565b6112c7565b6040519081526020016102df565b34801561040457600080fd5b50610308610413366004614212565b6112e9565b34801561042457600080fd5b506103086104333660046142cd565b611389565b34801561044457600080fd5b506103086104533660046142cd565b6113ab565b34801561046457600080fd5b506102d36104733660046142f9565b6113de565b34801561048457600080fd5b50610308610493366004614148565b61140c565b3480156104a457600080fd5b506103ea61144c565b3480156104b957600080fd5b506102d36104c8366004614185565b611461565b3480156104d957600080fd5b506103ea611487565b3480156104ee57600080fd5b506103086104fd366004614185565b61149c565b34801561050e57600080fd5b506103086115c0565b34801561052357600080fd5b50610308610532366004614185565b6115d4565b34801561054357600080fd5b50610308610552366004614050565b61169d565b34801561056357600080fd5b5061056c61192b565b6040516102df91908151815260208083015190820152604080830151908201526060918201516001600160a01b03169181019190915260800190565b3480156105b457600080fd5b506103086119aa565b6103086105cb366004614050565b611b2f565b3480156105dc57600080fd5b506103086105eb366004614314565b611ddc565b3480156105fc57600080fd5b5061061061060b366004614185565b611fb9565b6040516102df9190614360565b34801561062957600080fd5b506106326120b9565b6040516001600160a01b0390911681526020016102df565b34801561065657600080fd5b5061066a610665366004614185565b6120e7565b6040805182516001600160a01b0316815260208084015165ffffffffffff908116918301919091528383015116918101919091526060808301516001600160981b03169082015260809182015160ff169181019190915260a0016102df565b3480156106d557600080fd5b506102d36106e43660046142cd565b612196565b3480156106f557600080fd5b506103086107043660046143f6565b6121ce565b34801561071557600080fd5b506103ea610724366004614185565b61229b565b34801561073557600080fd5b506103ea600081565b34801561074a57600080fd5b5061075e610759366004614185565b6122d4565b6040516102df919081518152602080830151908201526040808301516001600160a01b03908116918301919091526060808401519091169082015260809182015160ff169181019190915260a00190565b3480156107bb57600080fd5b506103086107ca366004614185565b61236c565b3480156107db57600080fd5b506103086107ea3660046144a0565b61280d565b3480156107fb57600080fd5b506103ea61080a366004614185565b612917565b34801561081b57600080fd5b5061030861082a366004614148565b612944565b34801561083b57600080fd5b5061030861084a3660046142cd565b612984565b34801561085b57600080fd5b506103ea61086a366004614185565b6129a0565b34801561087b57600080fd5b5061063261088a366004614185565b6129c6565b34801561089b57600080fd5b506103086108aa366004614185565b6129f6565b3480156108bb57600080fd5b506103ea6108ca366004614185565b612d4e565b3480156108db57600080fd5b506103086108ea366004614185565b612d71565b3480156108fb57600080fd5b506103ea61090a366004614185565b613118565b34801561091b57600080fd5b5061030861092a366004614185565b61313b565b34801561093b57600080fd5b5061030861094a3660046141d7565b613441565b34801561095b57600080fd5b5061030861096a3660046142f9565b613543565b61030861097d3660046144ca565b61357e565b34801561098e57600080fd5b506103ea6000805160206147d483398151915281565b60006001600160e01b03198216637965db0b60e01b14806109d557506301ffc9a760e01b6001600160e01b03198316145b92915050565b6109e36136f1565b60006109ed613729565b6000878152600180830160205260409091208082015492935091600160981b900460ff1614610a535760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2102a37b5b2b760991b60448201526064015b60405180910390fd5b6001600160a01b03841615801590610a8357506001600160a01b03841660009081526020839052604090205460ff165b610a9f5760405162461bcd60e51b8152600401610a4a9061451e565b600086118015610aaf5750600085115b610af55760405162461bcd60e51b8152602060048201526017602482015276496e76616c696420416d6f756e74206f722056616c756560481b6044820152606401610a4a565b60068201548490600090620f424090610b0e9089614561565b610b189190614578565b9050600060ff8b16600114610b2d5781610b2f565b875b9050610b466001600160a01b03841633308461374d565b610b558b8b898c8c878c6137b4565b5050505050610b71600160008051602061481483398151915255565b505050505050565b610b816136f1565b6000805160206147d4833981519152610b99816139a7565b6000610ba3613729565b6000858152600482016020908152604080832080548452600285018352818420600180820154865280870190945291909320918201549394509192600160981b900460ff16600314610c075760405162461bcd60e51b8152600401610a4a9061459a565b80546001600160a01b031615801590610c2c575060018101546001600160981b031615155b610c685760405162461bcd60e51b815260206004820152600d60248201526c151bdad95b88139bdd0814d95d609a1b6044820152606401610a4a565b8054600160a01b900465ffffffffffff164211610cc35760405162461bcd60e51b815260206004820152601960248201527814d95d1d1b1a5b99c8151a5b5948139bdd0814dd185c9d1959603a1b6044820152606401610a4a565b6003830154600160a01b900460ff16600114610cf15760405162461bcd60e51b8152600401610a4a906145c2565b6000826003015483600501548560010154610d0c9190614561565b610d169190614578565b90506000836003015484600401548660010154610d339190614561565b610d3d9190614578565b90506000620f4240876006016002015483610d589190614561565b610d629190614578565b9050600081610d7185856145f0565b610d7b9190614603565b60028701549091506001600160a01b0316610e705760028701546040516000916001600160a01b03169083908381818185875af1925050503d8060008114610ddf576040519150601f19603f3d011682016040523d82523d6000602084013e610de4565b606091505b505060098a01546040519192506000916001600160a01b039091169085908381818185875af1925050503d8060008114610e3a576040519150601f19603f3d011682016040523d82523d6000602084013e610e3f565b606091505b50509050818015610e4d5750805b610e695760405162461bcd60e51b8152600401610a4a90614616565b5050610eb1565b600280870154908801546001600160a01b0391821691610e9391839116846139b1565b6009890154610eaf906001600160a01b038381169116856139b1565b505b60038701805460ff60a01b1916600160a11b179055604080518c8152602081018c9052338183015290517fbac7c71779ccc41f8c859e9d622536f76f0375a85b23e1b3d4134f613a9fff54916060908290030190a17f94d22e970a1abb720b741045e471af3fa516f4e2ede6b665387332888f92f2138b828433604051610f3b9493929190614643565b60405180910390a1505050505050505050610f63600160008051602061481483398151915255565b5050565b60005b8151811015610f6357610f95828281518110610f8857610f88614667565b602002602001015161236c565b80610f9f8161467d565b915050610f6a565b600080610fb2613729565b6000938452600290810160205260409093205460ff1690921492915050565b6000805160206147d4833981519152610fe9816139a7565b6000610ff3613729565b90506001600160a01b03861661103d5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964204164647265737360881b6044820152606401610a4a565b61104b6064620f4240614578565b85111561108e5760405162461bcd60e51b8152602060048201526011602482015270536574746c6520466565203c3d2031302560781b6044820152606401610a4a565b61109c6064620f4240614578565b8411156110df5760405162461bcd60e51b815260206004820152601160248201527043616e63656c20466565203c3d2031302560781b6044820152606401610a4a565b6009810154600882015460078301546006840154604080516001600160a01b03958616815260208101949094528301919091526060820152908716608082015260a0810186905260c0810185905260e081018490527f72fe78202ae1d56b2334bc8c804db955e2349789b271b7f55e8109f7122f0a11906101000160405180910390a16009810180546001600160a01b0319166001600160a01b0397909716969096179095555060088401929092556007830155600690910155565b60005b8151811015610f63576111c98282815181106111bc576111bc614667565b6020026020010151612d71565b806111d38161467d565b91505061119e565b6111e36139e2565b60006111ed613729565b9050620151808265ffffffffffff1610156112455760405162461bcd60e51b81526020600482015260186024820152774d696e696d756d2032346820666f7220736574746c696e6760401b6044820152606401610a4a565b6000838152600182016020908152604091829020805465ffffffffffff868116600160d01b8181026001600160d01b03851617855586518a8152930490911693820184905293810193909352917fd5042937eda12ebddebb9d9ecaf0d88595a67d0d28513340610674acbd48274b906060015b60405180910390a15050505050565b60009081526000805160206147f4833981519152602052604090206001015490565b805182511461132a5760405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a5908125b9c1d5d609a1b6044820152606401610a4a565b60005b82518110156113845761137283828151811061134b5761134b614667565b602002602001015183838151811061136557611365614667565b6020026020010151610b79565b8061137c8161467d565b91505061132d565b505050565b611392826112c7565b61139b816139a7565b6113a58383613a14565b50505050565b6001600160a01b03811633146113d45760405163334bd91960e11b815260040160405180910390fd5b6113848282613ac0565b6000806113e9613729565b6001600160a01b0390931660009081526020939093525050604090205460ff1690565b60005b8151811015610f635761143a82828151811061142d5761142d614667565b602002602001015161313b565b806114448161467d565b91505061140f565b600080611457613729565b6005015492915050565b60008061146c613729565b60009384526002016020525050604090205460ff1660011490565b600080611492613729565b6003015492915050565b6000805160206147d48339815191526114b4816139a7565b60006114be613729565b60008481526001828101602052604082208082015493945092600160981b900460ff16919082146114f05760016114f3565b60025b905060ff82166001148061150a575060ff82166002145b6115565760405162461bcd60e51b815260206004820152601a60248201527f43616e6e6f74204368616e676520546f6b656e205374617475730000000000006044820152606401610a4a565b60018301805460ff838116600160981b810260ff60981b19909316929092179092556040805189815292851660208401528201527f853e3a954af7889419a6922a1bc350b54c6217937a4a2aed1176ed3f5a1dfb52906060015b60405180910390a1505050505050565b6115c86139e2565b6115d26000613b3c565b565b6115dc6139e2565b60006115e6613729565b6000838152600180830160205260409091209081015491925090600160981b900460ff166003146116505760405162461bcd60e51b8152602060048201526014602482015273496e76616c696420546f6b656e2053746174757360601b6044820152606401610a4a565b60018101805460ff60981b1916600160991b1790556040518381527f6ac56c552b96d07b41e8ee97200f747e7476892e0e2e53e9803199bfe014b0a89060200160405180910390a1505050565b6116a56136f1565b60006116af613729565b60008481526002820160209081526040808320600180820154855280860190935292206007830154939450919260ff16146116fc5760405162461bcd60e51b8152600401610a4a90614696565b600181810154600160981b900460ff16146117505760405162461bcd60e51b8152602060048201526014602482015273496e76616c696420746f6b656e2053746174757360601b6044820152606401610a4a565b600084116117915760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908105b5bdd5b9d60921b6044820152606401610a4a565b83826006015483600301546117a69190614603565b10156117c45760405162461bcd60e51b8152600401610a4a906146c4565b6007820154600160a81b900460ff1615806117e25750838260030154145b6118235760405162461bcd60e51b8152602060048201526012602482015271119d5b1b13585d18da081c995c5d5a5c995960721b6044820152606401610a4a565b60028201546001600160a01b031661184d5760405162461bcd60e51b8152600401610a4a9061451e565b600282015482546001600160a01b03909116906000908190819060ff16600019016118b15785600301548887600501546118879190614561565b6118919190614578565b600787015490935061010090046001600160a01b031691503390506118ec565b85600301548887600401546118c69190614561565b6118d09190614578565b600787015490935033925061010090046001600160a01b031690505b6119016001600160a01b03851633308661374d565b61190d89898484613bad565b50505050505050610f63600160008051602061481483398151915255565b61195f604051806080016040528060008152602001600081526020016000815260200160006001600160a01b031681525090565b6000611969613729565b6040805160808101825260068301548152600783015460208201526008830154918101919091526009909101546001600160a01b0316606082015292915050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff166000811580156119f05750825b905060008267ffffffffffffffff166001148015611a0d5750303b155b905081158015611a1b575080155b15611a395760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315611a6357845460ff60401b1916600160401b1785555b611a6c33613d70565b611a74613d81565b611a7f600033613a14565b506000611a8a613729565b620f424060068201559050611a9d6120b9565b6009820180546001600160a01b0319166001600160a01b0392909216919091179055611acd6028620f4240614578565b6008820155611ae060c8620f4240614578565b6007909101558315611b2857845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2906020016112b8565b5050505050565b611b376136f1565b6000611b41613729565b60008481526002820160209081526040808320600180820154855280860190935292206007830154939450919260ff1614611b8e5760405162461bcd60e51b8152600401610a4a90614696565b600181810154600160981b900460ff1614611be25760405162461bcd60e51b8152602060048201526014602482015273496e76616c696420746f6b656e2053746174757360601b6044820152606401610a4a565b60008411611c235760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908105b5bdd5b9d60921b6044820152606401610a4a565b8382600601548360030154611c389190614603565b1015611c565760405162461bcd60e51b8152600401610a4a906146c4565b6007820154600160a81b900460ff161580611c745750838260030154145b611cb55760405162461bcd60e51b8152602060048201526012602482015271119d5b1b13585d18da081c995c5d5a5c995960721b6044820152606401610a4a565b60028201546001600160a01b031615611ce05760405162461bcd60e51b8152600401610a4a9061451e565b81546000908190819060ff1660001901611d33578460030154878660050154611d099190614561565b611d139190614578565b600786015490935061010090046001600160a01b03169150339050611d6e565b8460030154878660040154611d489190614561565b611d529190614578565b600786015490935033925061010090046001600160a01b031690505b82341015611db35760405162461bcd60e51b8152602060048201526012602482015271496e73756666696369656e742046756e647360701b6044820152606401610a4a565b611dbf88888484613bad565b505050505050610f63600160008051602061481483398151915255565b6000805160206147d4833981519152611df4816139a7565b6000611dfe613729565b600086815260018201602052604090209091506001600160a01b038516611e5f5760405162461bcd60e51b8152602060048201526015602482015274496e76616c696420546f6b656e204164647265737360581b6044820152606401610a4a565b6000846001600160981b031611611eae5760405162461bcd60e51b8152602060048201526013602482015272496e76616c696420536574746c65205261746560681b6044820152606401610a4a565b600181810154600160981b900460ff161480611ed857506001810154600160981b900460ff166002145b611f1b5760405162461bcd60e51b8152602060048201526014602482015273496e76616c696420546f6b656e2053746174757360601b6044820152606401610a4a565b80546001820180546001600160981b0387166001600160a01b03199091168117600360981b179091556001600160a01b0387166001600160d01b03199092168217600160a01b4265ffffffffffff811691909102919091178455604080518a8152602081019490945283019190915260608201527f973839ac031e9779c3158a52ae98cb3b0be8a378b1adc2b2ce2c14f89c814895906080016115b0565b6040805161014081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290526101008101829052610120810182905290612012613729565b600093845260029081016020908152604094859020855161014081018752815460ff9081168252600183015493820193909352928101546001600160a01b03908116968401969096526003810154606084015260048101546080840152600581015460a0840152600681015460c08401526007015480821660e084015261010080820490961695830195909552600160a81b90940490931615156101208401525090919050565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6040805160a08101825260008082526020820181905291810182905260608101829052608081018290529061211a613729565b600093845260019081016020908152604094859020855160a08101875281546001600160a01b038116825265ffffffffffff600160a01b8204811694830194909452600160d01b9004909216958201959095529301546001600160981b038116606085015260ff600160981b9091041660808401525090919050565b60009182526000805160206147f4833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000805160206147d48339815191526121e6816139a7565b60006121f0613729565b905060005b845181101561225b578382600001600087848151811061221757612217614667565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806122538161467d565b9150506121f5565b507f6a980e8ca36409cff27b8778560e2a0f5183fea53171bc0aeff7317906c7c1f4848460405161228d9291906146fb565b60405180910390a150505050565b6000806122a6613729565b6000848152600282016020526040902060068101546003909101549192506122cd91614603565b9392505050565b6040805160a081018252600080825260208201819052918101829052606081018290526080810182905290612307613729565b60009384526004016020908152604093849020845160a0810186528154815260018201549281019290925260028101546001600160a01b0390811695830195909552600301549384166060820152600160a01b90930460ff1660808401525090919050565b6123746136f1565b600061237e613729565b6000838152600482016020908152604080832080548452600285018352818420600180820154865280870190945291909320918201549394509192600160981b900460ff166003146123e25760405162461bcd60e51b8152600401610a4a9061459a565b80546001600160a01b031615801590612407575060018101546001600160981b031615155b6124435760405162461bcd60e51b815260206004820152600d60248201526c151bdad95b88139bdd0814d95d609a1b6044820152606401610a4a565b8054600160a01b900465ffffffffffff16421161249e5760405162461bcd60e51b815260206004820152601960248201527814d95d1d1b1a5b99c8151a5b5948139bdd0814dd185c9d1959603a1b6044820152606401610a4a565b60028301546001600160a01b031633146124e85760405162461bcd60e51b815260206004820152600b60248201526a53656c6c6572204f6e6c7960a81b6044820152606401610a4a565b6003830154600160a01b900460ff166001146125165760405162461bcd60e51b8152600401610a4a906145c2565b60008260030154836005015485600101546125319190614561565b61253b9190614578565b905060008360030154846004015486600101546125589190614561565b6125629190614578565b8354600180860154908801549293506001600160a01b0390911691600091620f424091612598916001600160981b031690614561565b6125a29190614578565b90506000620f42408960060160020154836125bd9190614561565b6125c79190614578565b600289015460098b01549192506125ee916001600160a01b0386811692811691168461374d565b60028801546003890154612625916001600160a01b0390811691166126138486614603565b6001600160a01b03871692919061374d565b6008890154600090620f42409061263c9087614561565b6126469190614578565b905060008161265588886145f0565b61265f9190614603565b60028a01549091506001600160a01b03166127545760028a01546040516000916001600160a01b03169083908381818185875af1925050503d80600081146126c3576040519150601f19603f3d011682016040523d82523d6000602084013e6126c8565b606091505b505060098d01546040519192506000916001600160a01b039091169085908381818185875af1925050503d806000811461271e576040519150601f19603f3d011682016040523d82523d6000602084013e612723565b606091505b505090508180156127315750805b61274d5760405162461bcd60e51b8152600401610a4a90614616565b5050612795565b6002808a0154908b01546001600160a01b039182169161277791839116846139b1565b60098c0154612793906001600160a01b038381169116856139b1565b505b60038a01805460ff60a01b1916600160a11b1790556040517f94d22e970a1abb720b741045e471af3fa516f4e2ede6b665387332888f92f213906127e0908e90849086903390614643565b60405180910390a1505050505050505050505061280a600160008051602061481483398151915255565b50565b6128156139e2565b600061281f613729565b90506001600160a01b0383161580159061285257506001600160a01b03831660009081526020829052604090205460ff16155b6128965760405162461bcd60e51b8152602060048201526015602482015274496e76616c696420546f6b656e204164647265737360581b6044820152606401610a4a565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa1580156128dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612901919061474f565b90506113a56001600160a01b03851684836139b1565b600080612922613729565b600093845260040160205250506040902060030154600160a01b900460ff1690565b60005b8151811015610f635761297282828151811061296557612965614667565b60200260200101516129f6565b8061297c8161467d565b915050612947565b61298d826112c7565b612996816139a7565b6113a58383613ac0565b6000806129ab613729565b60009384526002016020525050604090206007015460ff1690565b6000806129d1613729565b600093845260029081016020526040909320909201546001600160a01b031692915050565b6129fe6136f1565b6000805160206147d4833981519152612a16816139a7565b6000612a20613729565b60008481526004820160209081526040808320805484526002850190925290912060038201549293509091600160a01b900460ff16600114612a745760405162461bcd60e51b8152600401610a4a906145c2565b6000816003015482600401548460010154612a8f9190614561565b612a999190614578565b90506000826003015483600501548560010154612ab69190614561565b612ac09190614578565b6003850154600280870154908601549293506001600160a01b03918216929082169116612c7057600084118015612aff57506001600160a01b03821615155b15612ba9576000826001600160a01b03168560405160006040518083038185875af1925050503d8060008114612b51576040519150601f19603f3d011682016040523d82523d6000602084013e612b56565b606091505b5050905080612ba75760405162461bcd60e51b815260206004820152601d60248201527f5472616e736665722046756e647320746f2053656c6c6572204661696c0000006044820152606401610a4a565b505b600083118015612bc157506001600160a01b03811615155b15612c6b576000816001600160a01b03168460405160006040518083038185875af1925050503d8060008114612c13576040519150601f19603f3d011682016040523d82523d6000602084013e612c18565b606091505b5050905080612c695760405162461bcd60e51b815260206004820152601d60248201527f5472616e736665722046756e647320746f2053656c6c6572204661696c0000006044820152606401610a4a565b505b612ce1565b60028501546001600160a01b03168415801590612c9557506001600160a01b03831615155b15612cae57612cae6001600160a01b03821684876139b1565b600084118015612cc657506001600160a01b03821615155b15612cdf57612cdf6001600160a01b03821683866139b1565b505b60038601805460ff60a01b1916600360a01b179055604080518a81523360208201527f22369ba22944aadf9e9d6f4c51462417a50ea7876b9c62c7c46b5522e9c672cc91015b60405180910390a1505050505050505061280a600160008051602061481483398151915255565b600080612d59613729565b60009384526002016020525050604090206004015490565b612d796136f1565b6000612d83613729565b6000838152600482016020908152604080832080548452600285018352818420600180820154865280870190945291909320918201549394509192600160981b900460ff16600314612de75760405162461bcd60e51b8152600401610a4a9061459a565b8054612e0b9065ffffffffffff600160d01b8204811691600160a01b900416614768565b65ffffffffffff164211612e615760405162461bcd60e51b815260206004820152601b60248201527f536574746c696e672054696d65204e6f7420456e6465642059657400000000006044820152606401610a4a565b6003830154600160a01b900460ff16600114612e8f5760405162461bcd60e51b8152600401610a4a906145c2565b60038301546001600160a01b0316331480612ebd5750612ebd6000805160206147d483398151915233612196565b612f025760405162461bcd60e51b81526020600482015260166024820152754275796572206f72204f70657261746f72204f6e6c7960501b6044820152606401610a4a565b6000826003015483600501548560010154612f1d9190614561565b612f279190614578565b90506000836003015484600401548660010154612f449190614561565b612f4e9190614578565b90506000620f4240876006016002015484612f699190614561565b612f74906002614561565b612f7e9190614578565b9050600081612f8d85856145f0565b612f979190614603565b60028701549091506001600160a01b031661308c5760038701546040516000916001600160a01b03169083908381818185875af1925050503d8060008114612ffb576040519150601f19603f3d011682016040523d82523d6000602084013e613000565b606091505b505060098a01546040519192506000916001600160a01b039091169085908381818185875af1925050503d8060008114613056576040519150601f19603f3d011682016040523d82523d6000602084013e61305b565b606091505b505090508180156130695750805b6130855760405162461bcd60e51b8152600401610a4a90614616565b50506130cd565b600286015460038801546001600160a01b03918216916130af91839116846139b1565b60098901546130cb906001600160a01b038381169116856139b1565b505b60038701805460ff60a01b1916600360a01b1790556040517f6353c0ce500c8ea1f1026c8f39a6e0c2d1b2f17034fcd8a4b021c72e6e293e5190612d27908b90849086903390614643565b600080613123613729565b60009384526002016020525050604090206003015490565b6131436136f1565b600061314d613729565b6000838152600282016020526040902060078101549192509061010090046001600160a01b031633146131b55760405162461bcd60e51b815260206004820152601060248201526f4f66666572204f776e6572204f6e6c7960801b6044820152606401610a4a565b600781015460ff166001146131dc5760405162461bcd60e51b8152600401610a4a90614696565b6000816006015482600301546131f29190614603565b9050600081116132145760405162461bcd60e51b8152600401610a4a906146c4565b815460009060ff166000190161324957600383015460048401546132389084614561565b6132429190614578565b905061326a565b6003830154600584015461325d9084614561565b6132679190614578565b90505b6007840154600090620f4240906132819084614561565b61328b9190614578565b90506132978183614603565b60028501549092506001600160a01b031661339157600784015460405160009161010090046001600160a01b03169084908381818185875af1925050503d8060008114613300576040519150601f19603f3d011682016040523d82523d6000602084013e613305565b606091505b505060098701546040519192506000916001600160a01b039091169084908381818185875af1925050503d806000811461335b576040519150601f19603f3d011682016040523d82523d6000602084013e613360565b606091505b5050905081801561336e5750805b61338a5760405162461bcd60e51b8152600401610a4a90614616565b50506133d8565b600284015460078501546001600160a01b03918216916133ba91839161010090910416856139b1565b60098601546133d6906001600160a01b038381169116846139b1565b505b60078401805460ff191660031790556040517ff65e543d34c6936603a3741b3eace109133f172d25637c2445b95c1f3288e9379061341d908890859085903390614643565b60405180910390a1505050505061280a600160008051602061481483398151915255565b6000805160206147d4833981519152613459816139a7565b6000613463613729565b9050620151808365ffffffffffff1610156134bb5760405162461bcd60e51b81526020600482015260186024820152774d696e696d756d2032346820666f7220736574746c696e6760401b6044820152606401610a4a565b60008481526001808301602052604091829020805465ffffffffffff8716600160d01b026001600160d01b03909116178155908101805460ff60981b1916600160981b17905590517f1da02fe9181848bf1b401dde762d155f0da084c24db69129a3c7479f970ddbcc906112b8908790879091825265ffffffffffff16602082015260400190565b61354b6139e2565b6001600160a01b03811661357557604051631e4fbdf760e01b815260006004820152602401610a4a565b61280a81613b3c565b6135866136f1565b6000613590613729565b6000868152600180830160205260409091208082015492935091600160981b900460ff16146135f15760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2102a37b5b2b760991b6044820152606401610a4a565b6000851180156136015750600084115b6136475760405162461bcd60e51b8152602060048201526017602482015276496e76616c696420416d6f756e74206f722056616c756560481b6044820152606401610a4a565b6006820154600090620f42409061365e9087614561565b6136689190614578565b9050600060ff891660011461367d578161367f565b855b9050348111156136c65760405162461bcd60e51b8152602060048201526012602482015271496e73756666696369656e742046756e647360701b6044820152606401610a4a565b6136d6898960008a8a878b6137b4565b50505050611b28600160008051602061481483398151915255565b60008051602061481483398151915280546001190161372357604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b7fe0eb0c6bc05973c9317c77fe5b658559f9e21630d35f19f70b8603a4f231f90090565b6040516001600160a01b0384811660248301528381166044830152606482018390526113a59186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050613d89565b60006137be613729565b90506040518061014001604052808960ff168152602001888152602001876001600160a01b0316815260200186815260200185815260200184815260200160008152602001600160ff168152602001336001600160a01b0316815260200183151581525081600201600083600301600081546138399061467d565b9182905550815260208082019290925260409081016000208351815460ff91821660ff19909116178255928401516001820155838201516002820180546001600160a01b039283166001600160a01b031990911617905560608501516003808401919091556080860151600484015560a0860151600584015560c0860151600684015560e08601516007909301805461010080890151610120909901511515600160a81b0260ff60a81b1999909516026001600160a81b0319909116949096169390931794909417949094169390931790925582015490517f8f8f88015929d8eeb82fcc5c324b9713dc52572eae5cf9e6e80f7e2d81ae089891613995918b908b908b908b908b908b908b90339098895260ff97909716602089015260408801959095526001600160a01b039384166060880152608087019290925260a086015260c085015290151560e0840152166101008201526101200190565b60405180910390a15050505050505050565b61280a8133613dec565b6040516001600160a01b0383811660248301526044820183905261138491859182169063a9059cbb90606401613782565b336139eb6120b9565b6001600160a01b0316146115d25760405163118cdaa760e01b8152336004820152602401610a4a565b60006000805160206147f4833981519152613a2f8484612196565b613aaf576000848152602082815260408083206001600160a01b03871684529091529020805460ff19166001179055613a653390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a460019150506109d5565b60009150506109d5565b5092915050565b60006000805160206147f4833981519152613adb8484612196565b15613aaf576000848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a460019150506109d5565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b6000613bb7613729565b9050600081600201600087815260200190815260200160002090506040518060a00160405280878152602001868152602001846001600160a01b03168152602001856001600160a01b03168152602001600160ff168152508260040160008460050160008154613c269061467d565b918290555081526020808201929092526040908101600090812084518155928401516001840155908301516002830180546001600160a01b039283166001600160a01b031990911617905560608401516003909301805460809095015160ff16600160a01b026001600160a81b03199095169390911692909217929092179055600682018054879290613cba9084906145f0565b90915550506003810154600682015403613d175760078101805460ff1916600217905560408051878152600060208201527f37a30d6e3fcaec3144b11d51892b9eadbb0ec4d2a8a813d64bb6065c3adfcffa910160405180910390a15b6005820154604080519182526020820188905281018690526001600160a01b038085166060830152851660808201527fdc3effd7f2b46d1989f8b9ec5abba2e3c07eaa9caa9511c8af3c9444ecbb52f29060a0016115b0565b613d78613e25565b61280a81613e6e565b6115d2613e25565b6000613d9e6001600160a01b03841683613e76565b90508051600014158015613dc3575080806020019051810190613dc19190614787565b155b1561138457604051635274afe760e01b81526001600160a01b0384166004820152602401610a4a565b613df68282612196565b610f635760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610a4a565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff166115d257604051631afcd79f60e31b815260040160405180910390fd5b61354b613e25565b60606122cd8383600084600080856001600160a01b03168486604051613e9c91906147a4565b60006040518083038185875af1925050503d8060008114613ed9576040519150601f19603f3d011682016040523d82523d6000602084013e613ede565b606091505b5091509150613eee868383613ef8565b9695505050505050565b606082613f0d57613f0882613f54565b6122cd565b8151158015613f2457506001600160a01b0384163b155b15613f4d57604051639996b31560e01b81526001600160a01b0385166004820152602401610a4a565b50806122cd565b805115613f645780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b600060208284031215613f8f57600080fd5b81356001600160e01b0319811681146122cd57600080fd5b803560ff81168114613fb857600080fd5b919050565b80356001600160a01b0381168114613fb857600080fd5b801515811461280a57600080fd5b8035613fb881613fd4565b60008060008060008060c0878903121561400657600080fd5b61400f87613fa7565b955060208701359450604087013593506060870135925061403260808801613fbd565b915060a087013561404281613fd4565b809150509295509295509295565b6000806040838503121561406357600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156140b1576140b1614072565b604052919050565b600067ffffffffffffffff8211156140d3576140d3614072565b5060051b60200190565b600082601f8301126140ee57600080fd5b813560206141036140fe836140b9565b614088565b82815260059290921b8401810191818101908684111561412257600080fd5b8286015b8481101561413d5780358352918301918301614126565b509695505050505050565b60006020828403121561415a57600080fd5b813567ffffffffffffffff81111561417157600080fd5b61417d848285016140dd565b949350505050565b60006020828403121561419757600080fd5b5035919050565b600080600080608085870312156141b457600080fd5b6141bd85613fbd565b966020860135965060408601359560600135945092505050565b600080604083850312156141ea57600080fd5b82359150602083013565ffffffffffff8116811461420757600080fd5b809150509250929050565b6000806040838503121561422557600080fd5b823567ffffffffffffffff8082111561423d57600080fd5b614249868387016140dd565b935060209150818501358181111561426057600080fd5b85019050601f8101861361427357600080fd5b80356142816140fe826140b9565b81815260059190911b820183019083810190888311156142a057600080fd5b928401925b828410156142be578335825292840192908401906142a5565b80955050505050509250929050565b600080604083850312156142e057600080fd5b823591506142f060208401613fbd565b90509250929050565b60006020828403121561430b57600080fd5b6122cd82613fbd565b60008060006060848603121561432957600080fd5b8335925061433960208501613fbd565b915060408401356001600160981b038116811461435557600080fd5b809150509250925092565b815160ff168152610140810160208301516020830152604083015161439060408401826001600160a01b03169052565b50606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e08301516143cd60e084018260ff169052565b50610100838101516001600160a01b031690830152610120928301511515929091019190915290565b6000806040838503121561440957600080fd5b823567ffffffffffffffff81111561442057600080fd5b8301601f8101851361443157600080fd5b803560206144416140fe836140b9565b82815260059290921b8301810191818101908884111561446057600080fd5b938201935b838510156144855761447685613fbd565b82529382019390820190614465565b95506144949050868201613fe2565b93505050509250929050565b600080604083850312156144b357600080fd5b6144bc83613fbd565b91506142f060208401613fbd565b600080600080600060a086880312156144e257600080fd5b6144eb86613fa7565b9450602086013593506040860135925060608601359150608086013561451081613fd4565b809150509295509295909350565b60208082526013908201527224b73b30b634b21027b33332b9102a37b5b2b760691b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176109d5576109d561454b565b60008261459557634e487b7160e01b600052601260045260246000fd5b500490565b6020808252600e908201526d496e76616c69642053746174757360901b604082015260600190565b602080825260149082015273496e76616c6964204f726465722053746174757360601b604082015260600190565b808201808211156109d5576109d561454b565b818103818111156109d5576109d561454b565b602080825260139082015272151c985b9cd9995c88119d5b991cc811985a5b606a1b604082015260600190565b938452602084019290925260408301526001600160a01b0316606082015260800190565b634e487b7160e01b600052603260045260246000fd5b60006001820161468f5761468f61454b565b5060010190565b602080825260149082015273496e76616c6964204f666665722053746174757360601b604082015260600190565b60208082526018908201527f496e73756666696369656e7420416c6c6f636174696f6e730000000000000000604082015260600190565b604080825283519082018190526000906020906060840190828701845b8281101561473d5781516001600160a01b031684529284019290840190600101614718565b50505093151592019190915250919050565b60006020828403121561476157600080fd5b5051919050565b65ffffffffffff818116838216019080821115613ab957613ab961454b565b60006020828403121561479957600080fd5b81516122cd81613fd4565b6000825160005b818110156147c557602081860181015185830152016147ab565b50600092019182525091905056fe97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92902dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a264697066735822122064ac8f2a85e1a2b635019a1ccc1f68b07ace6ab2eeb9e2aab9ffd2d6a600f4ea64736f6c63430008140033
Deployed Bytecode
0x6080604052600436106102ae5760003560e01c806386aa7db011610175578063cfcdeb7e116100dc578063e4cb62c011610095578063f1ee8fdd1161006f578063f1ee8fdd1461092f578063f2fde38b1461094f578063f564f0ae1461096f578063f5b541a61461098257600080fd5b8063e4cb62c0146108cf578063e7a75949146108ef578063ef706adf1461090f57600080fd5b8063cfcdeb7e1461080f578063d547741f1461082f578063d843b2c71461084f578063dc8beea91461086f578063deb2ec6a1461088f578063e3df748a146108af57600080fd5b8063a1bd91e11161012e578063a1bd91e114610709578063a217fddf14610729578063a85c38ef1461073e578063aaab596a146107af578063bc205ad3146107cf578063bff49450146107ef57600080fd5b806386aa7db0146105d05780638a72ea6a146105f05780638da5cb5b1461061d578063904194a31461064a57806391d14854146106c9578063985a7c1d146106e957600080fd5b80633b6e750f11610219578063715018a6116101d2578063715018a6146105025780637400f52d1461051757806378447e7f1461053757806379502c55146105575780638129fc1c146105a857806381cc37b2146105bd57600080fd5b80633b6e750f146104585780634ae25a86146104785780635662ecc7146104985780635d3473e3146104ad578063643268c9146104cd5780636a951f20146104e257600080fd5b80631f4846d81161026b5780631f4846d81461038a57806321146fa2146103aa578063248a9ca3146103ca5780632d670584146103f85780632f2ff15d1461041857806336568abe1461043857600080fd5b806301ffc9a7146102b35780630b8aacb9146102e857806316b4cdb21461030a57806317b137ba1461032a57806318b4f3671461034a5780631f25a2d81461036a575b600080fd5b3480156102bf57600080fd5b506102d36102ce366004613f7d565b6109a4565b60405190151581526020015b60405180910390f35b3480156102f457600080fd5b50610308610303366004613fed565b6109db565b005b34801561031657600080fd5b50610308610325366004614050565b610b79565b34801561033657600080fd5b50610308610345366004614148565b610f67565b34801561035657600080fd5b506102d3610365366004614185565b610fa7565b34801561037657600080fd5b5061030861038536600461419e565b610fd1565b34801561039657600080fd5b506103086103a5366004614148565b61119b565b3480156103b657600080fd5b506103086103c53660046141d7565b6111db565b3480156103d657600080fd5b506103ea6103e5366004614185565b6112c7565b6040519081526020016102df565b34801561040457600080fd5b50610308610413366004614212565b6112e9565b34801561042457600080fd5b506103086104333660046142cd565b611389565b34801561044457600080fd5b506103086104533660046142cd565b6113ab565b34801561046457600080fd5b506102d36104733660046142f9565b6113de565b34801561048457600080fd5b50610308610493366004614148565b61140c565b3480156104a457600080fd5b506103ea61144c565b3480156104b957600080fd5b506102d36104c8366004614185565b611461565b3480156104d957600080fd5b506103ea611487565b3480156104ee57600080fd5b506103086104fd366004614185565b61149c565b34801561050e57600080fd5b506103086115c0565b34801561052357600080fd5b50610308610532366004614185565b6115d4565b34801561054357600080fd5b50610308610552366004614050565b61169d565b34801561056357600080fd5b5061056c61192b565b6040516102df91908151815260208083015190820152604080830151908201526060918201516001600160a01b03169181019190915260800190565b3480156105b457600080fd5b506103086119aa565b6103086105cb366004614050565b611b2f565b3480156105dc57600080fd5b506103086105eb366004614314565b611ddc565b3480156105fc57600080fd5b5061061061060b366004614185565b611fb9565b6040516102df9190614360565b34801561062957600080fd5b506106326120b9565b6040516001600160a01b0390911681526020016102df565b34801561065657600080fd5b5061066a610665366004614185565b6120e7565b6040805182516001600160a01b0316815260208084015165ffffffffffff908116918301919091528383015116918101919091526060808301516001600160981b03169082015260809182015160ff169181019190915260a0016102df565b3480156106d557600080fd5b506102d36106e43660046142cd565b612196565b3480156106f557600080fd5b506103086107043660046143f6565b6121ce565b34801561071557600080fd5b506103ea610724366004614185565b61229b565b34801561073557600080fd5b506103ea600081565b34801561074a57600080fd5b5061075e610759366004614185565b6122d4565b6040516102df919081518152602080830151908201526040808301516001600160a01b03908116918301919091526060808401519091169082015260809182015160ff169181019190915260a00190565b3480156107bb57600080fd5b506103086107ca366004614185565b61236c565b3480156107db57600080fd5b506103086107ea3660046144a0565b61280d565b3480156107fb57600080fd5b506103ea61080a366004614185565b612917565b34801561081b57600080fd5b5061030861082a366004614148565b612944565b34801561083b57600080fd5b5061030861084a3660046142cd565b612984565b34801561085b57600080fd5b506103ea61086a366004614185565b6129a0565b34801561087b57600080fd5b5061063261088a366004614185565b6129c6565b34801561089b57600080fd5b506103086108aa366004614185565b6129f6565b3480156108bb57600080fd5b506103ea6108ca366004614185565b612d4e565b3480156108db57600080fd5b506103086108ea366004614185565b612d71565b3480156108fb57600080fd5b506103ea61090a366004614185565b613118565b34801561091b57600080fd5b5061030861092a366004614185565b61313b565b34801561093b57600080fd5b5061030861094a3660046141d7565b613441565b34801561095b57600080fd5b5061030861096a3660046142f9565b613543565b61030861097d3660046144ca565b61357e565b34801561098e57600080fd5b506103ea6000805160206147d483398151915281565b60006001600160e01b03198216637965db0b60e01b14806109d557506301ffc9a760e01b6001600160e01b03198316145b92915050565b6109e36136f1565b60006109ed613729565b6000878152600180830160205260409091208082015492935091600160981b900460ff1614610a535760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2102a37b5b2b760991b60448201526064015b60405180910390fd5b6001600160a01b03841615801590610a8357506001600160a01b03841660009081526020839052604090205460ff165b610a9f5760405162461bcd60e51b8152600401610a4a9061451e565b600086118015610aaf5750600085115b610af55760405162461bcd60e51b8152602060048201526017602482015276496e76616c696420416d6f756e74206f722056616c756560481b6044820152606401610a4a565b60068201548490600090620f424090610b0e9089614561565b610b189190614578565b9050600060ff8b16600114610b2d5781610b2f565b875b9050610b466001600160a01b03841633308461374d565b610b558b8b898c8c878c6137b4565b5050505050610b71600160008051602061481483398151915255565b505050505050565b610b816136f1565b6000805160206147d4833981519152610b99816139a7565b6000610ba3613729565b6000858152600482016020908152604080832080548452600285018352818420600180820154865280870190945291909320918201549394509192600160981b900460ff16600314610c075760405162461bcd60e51b8152600401610a4a9061459a565b80546001600160a01b031615801590610c2c575060018101546001600160981b031615155b610c685760405162461bcd60e51b815260206004820152600d60248201526c151bdad95b88139bdd0814d95d609a1b6044820152606401610a4a565b8054600160a01b900465ffffffffffff164211610cc35760405162461bcd60e51b815260206004820152601960248201527814d95d1d1b1a5b99c8151a5b5948139bdd0814dd185c9d1959603a1b6044820152606401610a4a565b6003830154600160a01b900460ff16600114610cf15760405162461bcd60e51b8152600401610a4a906145c2565b6000826003015483600501548560010154610d0c9190614561565b610d169190614578565b90506000836003015484600401548660010154610d339190614561565b610d3d9190614578565b90506000620f4240876006016002015483610d589190614561565b610d629190614578565b9050600081610d7185856145f0565b610d7b9190614603565b60028701549091506001600160a01b0316610e705760028701546040516000916001600160a01b03169083908381818185875af1925050503d8060008114610ddf576040519150601f19603f3d011682016040523d82523d6000602084013e610de4565b606091505b505060098a01546040519192506000916001600160a01b039091169085908381818185875af1925050503d8060008114610e3a576040519150601f19603f3d011682016040523d82523d6000602084013e610e3f565b606091505b50509050818015610e4d5750805b610e695760405162461bcd60e51b8152600401610a4a90614616565b5050610eb1565b600280870154908801546001600160a01b0391821691610e9391839116846139b1565b6009890154610eaf906001600160a01b038381169116856139b1565b505b60038701805460ff60a01b1916600160a11b179055604080518c8152602081018c9052338183015290517fbac7c71779ccc41f8c859e9d622536f76f0375a85b23e1b3d4134f613a9fff54916060908290030190a17f94d22e970a1abb720b741045e471af3fa516f4e2ede6b665387332888f92f2138b828433604051610f3b9493929190614643565b60405180910390a1505050505050505050610f63600160008051602061481483398151915255565b5050565b60005b8151811015610f6357610f95828281518110610f8857610f88614667565b602002602001015161236c565b80610f9f8161467d565b915050610f6a565b600080610fb2613729565b6000938452600290810160205260409093205460ff1690921492915050565b6000805160206147d4833981519152610fe9816139a7565b6000610ff3613729565b90506001600160a01b03861661103d5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964204164647265737360881b6044820152606401610a4a565b61104b6064620f4240614578565b85111561108e5760405162461bcd60e51b8152602060048201526011602482015270536574746c6520466565203c3d2031302560781b6044820152606401610a4a565b61109c6064620f4240614578565b8411156110df5760405162461bcd60e51b815260206004820152601160248201527043616e63656c20466565203c3d2031302560781b6044820152606401610a4a565b6009810154600882015460078301546006840154604080516001600160a01b03958616815260208101949094528301919091526060820152908716608082015260a0810186905260c0810185905260e081018490527f72fe78202ae1d56b2334bc8c804db955e2349789b271b7f55e8109f7122f0a11906101000160405180910390a16009810180546001600160a01b0319166001600160a01b0397909716969096179095555060088401929092556007830155600690910155565b60005b8151811015610f63576111c98282815181106111bc576111bc614667565b6020026020010151612d71565b806111d38161467d565b91505061119e565b6111e36139e2565b60006111ed613729565b9050620151808265ffffffffffff1610156112455760405162461bcd60e51b81526020600482015260186024820152774d696e696d756d2032346820666f7220736574746c696e6760401b6044820152606401610a4a565b6000838152600182016020908152604091829020805465ffffffffffff868116600160d01b8181026001600160d01b03851617855586518a8152930490911693820184905293810193909352917fd5042937eda12ebddebb9d9ecaf0d88595a67d0d28513340610674acbd48274b906060015b60405180910390a15050505050565b60009081526000805160206147f4833981519152602052604090206001015490565b805182511461132a5760405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a5908125b9c1d5d609a1b6044820152606401610a4a565b60005b82518110156113845761137283828151811061134b5761134b614667565b602002602001015183838151811061136557611365614667565b6020026020010151610b79565b8061137c8161467d565b91505061132d565b505050565b611392826112c7565b61139b816139a7565b6113a58383613a14565b50505050565b6001600160a01b03811633146113d45760405163334bd91960e11b815260040160405180910390fd5b6113848282613ac0565b6000806113e9613729565b6001600160a01b0390931660009081526020939093525050604090205460ff1690565b60005b8151811015610f635761143a82828151811061142d5761142d614667565b602002602001015161313b565b806114448161467d565b91505061140f565b600080611457613729565b6005015492915050565b60008061146c613729565b60009384526002016020525050604090205460ff1660011490565b600080611492613729565b6003015492915050565b6000805160206147d48339815191526114b4816139a7565b60006114be613729565b60008481526001828101602052604082208082015493945092600160981b900460ff16919082146114f05760016114f3565b60025b905060ff82166001148061150a575060ff82166002145b6115565760405162461bcd60e51b815260206004820152601a60248201527f43616e6e6f74204368616e676520546f6b656e205374617475730000000000006044820152606401610a4a565b60018301805460ff838116600160981b810260ff60981b19909316929092179092556040805189815292851660208401528201527f853e3a954af7889419a6922a1bc350b54c6217937a4a2aed1176ed3f5a1dfb52906060015b60405180910390a1505050505050565b6115c86139e2565b6115d26000613b3c565b565b6115dc6139e2565b60006115e6613729565b6000838152600180830160205260409091209081015491925090600160981b900460ff166003146116505760405162461bcd60e51b8152602060048201526014602482015273496e76616c696420546f6b656e2053746174757360601b6044820152606401610a4a565b60018101805460ff60981b1916600160991b1790556040518381527f6ac56c552b96d07b41e8ee97200f747e7476892e0e2e53e9803199bfe014b0a89060200160405180910390a1505050565b6116a56136f1565b60006116af613729565b60008481526002820160209081526040808320600180820154855280860190935292206007830154939450919260ff16146116fc5760405162461bcd60e51b8152600401610a4a90614696565b600181810154600160981b900460ff16146117505760405162461bcd60e51b8152602060048201526014602482015273496e76616c696420746f6b656e2053746174757360601b6044820152606401610a4a565b600084116117915760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908105b5bdd5b9d60921b6044820152606401610a4a565b83826006015483600301546117a69190614603565b10156117c45760405162461bcd60e51b8152600401610a4a906146c4565b6007820154600160a81b900460ff1615806117e25750838260030154145b6118235760405162461bcd60e51b8152602060048201526012602482015271119d5b1b13585d18da081c995c5d5a5c995960721b6044820152606401610a4a565b60028201546001600160a01b031661184d5760405162461bcd60e51b8152600401610a4a9061451e565b600282015482546001600160a01b03909116906000908190819060ff16600019016118b15785600301548887600501546118879190614561565b6118919190614578565b600787015490935061010090046001600160a01b031691503390506118ec565b85600301548887600401546118c69190614561565b6118d09190614578565b600787015490935033925061010090046001600160a01b031690505b6119016001600160a01b03851633308661374d565b61190d89898484613bad565b50505050505050610f63600160008051602061481483398151915255565b61195f604051806080016040528060008152602001600081526020016000815260200160006001600160a01b031681525090565b6000611969613729565b6040805160808101825260068301548152600783015460208201526008830154918101919091526009909101546001600160a01b0316606082015292915050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff166000811580156119f05750825b905060008267ffffffffffffffff166001148015611a0d5750303b155b905081158015611a1b575080155b15611a395760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315611a6357845460ff60401b1916600160401b1785555b611a6c33613d70565b611a74613d81565b611a7f600033613a14565b506000611a8a613729565b620f424060068201559050611a9d6120b9565b6009820180546001600160a01b0319166001600160a01b0392909216919091179055611acd6028620f4240614578565b6008820155611ae060c8620f4240614578565b6007909101558315611b2857845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2906020016112b8565b5050505050565b611b376136f1565b6000611b41613729565b60008481526002820160209081526040808320600180820154855280860190935292206007830154939450919260ff1614611b8e5760405162461bcd60e51b8152600401610a4a90614696565b600181810154600160981b900460ff1614611be25760405162461bcd60e51b8152602060048201526014602482015273496e76616c696420746f6b656e2053746174757360601b6044820152606401610a4a565b60008411611c235760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908105b5bdd5b9d60921b6044820152606401610a4a565b8382600601548360030154611c389190614603565b1015611c565760405162461bcd60e51b8152600401610a4a906146c4565b6007820154600160a81b900460ff161580611c745750838260030154145b611cb55760405162461bcd60e51b8152602060048201526012602482015271119d5b1b13585d18da081c995c5d5a5c995960721b6044820152606401610a4a565b60028201546001600160a01b031615611ce05760405162461bcd60e51b8152600401610a4a9061451e565b81546000908190819060ff1660001901611d33578460030154878660050154611d099190614561565b611d139190614578565b600786015490935061010090046001600160a01b03169150339050611d6e565b8460030154878660040154611d489190614561565b611d529190614578565b600786015490935033925061010090046001600160a01b031690505b82341015611db35760405162461bcd60e51b8152602060048201526012602482015271496e73756666696369656e742046756e647360701b6044820152606401610a4a565b611dbf88888484613bad565b505050505050610f63600160008051602061481483398151915255565b6000805160206147d4833981519152611df4816139a7565b6000611dfe613729565b600086815260018201602052604090209091506001600160a01b038516611e5f5760405162461bcd60e51b8152602060048201526015602482015274496e76616c696420546f6b656e204164647265737360581b6044820152606401610a4a565b6000846001600160981b031611611eae5760405162461bcd60e51b8152602060048201526013602482015272496e76616c696420536574746c65205261746560681b6044820152606401610a4a565b600181810154600160981b900460ff161480611ed857506001810154600160981b900460ff166002145b611f1b5760405162461bcd60e51b8152602060048201526014602482015273496e76616c696420546f6b656e2053746174757360601b6044820152606401610a4a565b80546001820180546001600160981b0387166001600160a01b03199091168117600360981b179091556001600160a01b0387166001600160d01b03199092168217600160a01b4265ffffffffffff811691909102919091178455604080518a8152602081019490945283019190915260608201527f973839ac031e9779c3158a52ae98cb3b0be8a378b1adc2b2ce2c14f89c814895906080016115b0565b6040805161014081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290526101008101829052610120810182905290612012613729565b600093845260029081016020908152604094859020855161014081018752815460ff9081168252600183015493820193909352928101546001600160a01b03908116968401969096526003810154606084015260048101546080840152600581015460a0840152600681015460c08401526007015480821660e084015261010080820490961695830195909552600160a81b90940490931615156101208401525090919050565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6040805160a08101825260008082526020820181905291810182905260608101829052608081018290529061211a613729565b600093845260019081016020908152604094859020855160a08101875281546001600160a01b038116825265ffffffffffff600160a01b8204811694830194909452600160d01b9004909216958201959095529301546001600160981b038116606085015260ff600160981b9091041660808401525090919050565b60009182526000805160206147f4833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000805160206147d48339815191526121e6816139a7565b60006121f0613729565b905060005b845181101561225b578382600001600087848151811061221757612217614667565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806122538161467d565b9150506121f5565b507f6a980e8ca36409cff27b8778560e2a0f5183fea53171bc0aeff7317906c7c1f4848460405161228d9291906146fb565b60405180910390a150505050565b6000806122a6613729565b6000848152600282016020526040902060068101546003909101549192506122cd91614603565b9392505050565b6040805160a081018252600080825260208201819052918101829052606081018290526080810182905290612307613729565b60009384526004016020908152604093849020845160a0810186528154815260018201549281019290925260028101546001600160a01b0390811695830195909552600301549384166060820152600160a01b90930460ff1660808401525090919050565b6123746136f1565b600061237e613729565b6000838152600482016020908152604080832080548452600285018352818420600180820154865280870190945291909320918201549394509192600160981b900460ff166003146123e25760405162461bcd60e51b8152600401610a4a9061459a565b80546001600160a01b031615801590612407575060018101546001600160981b031615155b6124435760405162461bcd60e51b815260206004820152600d60248201526c151bdad95b88139bdd0814d95d609a1b6044820152606401610a4a565b8054600160a01b900465ffffffffffff16421161249e5760405162461bcd60e51b815260206004820152601960248201527814d95d1d1b1a5b99c8151a5b5948139bdd0814dd185c9d1959603a1b6044820152606401610a4a565b60028301546001600160a01b031633146124e85760405162461bcd60e51b815260206004820152600b60248201526a53656c6c6572204f6e6c7960a81b6044820152606401610a4a565b6003830154600160a01b900460ff166001146125165760405162461bcd60e51b8152600401610a4a906145c2565b60008260030154836005015485600101546125319190614561565b61253b9190614578565b905060008360030154846004015486600101546125589190614561565b6125629190614578565b8354600180860154908801549293506001600160a01b0390911691600091620f424091612598916001600160981b031690614561565b6125a29190614578565b90506000620f42408960060160020154836125bd9190614561565b6125c79190614578565b600289015460098b01549192506125ee916001600160a01b0386811692811691168461374d565b60028801546003890154612625916001600160a01b0390811691166126138486614603565b6001600160a01b03871692919061374d565b6008890154600090620f42409061263c9087614561565b6126469190614578565b905060008161265588886145f0565b61265f9190614603565b60028a01549091506001600160a01b03166127545760028a01546040516000916001600160a01b03169083908381818185875af1925050503d80600081146126c3576040519150601f19603f3d011682016040523d82523d6000602084013e6126c8565b606091505b505060098d01546040519192506000916001600160a01b039091169085908381818185875af1925050503d806000811461271e576040519150601f19603f3d011682016040523d82523d6000602084013e612723565b606091505b505090508180156127315750805b61274d5760405162461bcd60e51b8152600401610a4a90614616565b5050612795565b6002808a0154908b01546001600160a01b039182169161277791839116846139b1565b60098c0154612793906001600160a01b038381169116856139b1565b505b60038a01805460ff60a01b1916600160a11b1790556040517f94d22e970a1abb720b741045e471af3fa516f4e2ede6b665387332888f92f213906127e0908e90849086903390614643565b60405180910390a1505050505050505050505061280a600160008051602061481483398151915255565b50565b6128156139e2565b600061281f613729565b90506001600160a01b0383161580159061285257506001600160a01b03831660009081526020829052604090205460ff16155b6128965760405162461bcd60e51b8152602060048201526015602482015274496e76616c696420546f6b656e204164647265737360581b6044820152606401610a4a565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa1580156128dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612901919061474f565b90506113a56001600160a01b03851684836139b1565b600080612922613729565b600093845260040160205250506040902060030154600160a01b900460ff1690565b60005b8151811015610f635761297282828151811061296557612965614667565b60200260200101516129f6565b8061297c8161467d565b915050612947565b61298d826112c7565b612996816139a7565b6113a58383613ac0565b6000806129ab613729565b60009384526002016020525050604090206007015460ff1690565b6000806129d1613729565b600093845260029081016020526040909320909201546001600160a01b031692915050565b6129fe6136f1565b6000805160206147d4833981519152612a16816139a7565b6000612a20613729565b60008481526004820160209081526040808320805484526002850190925290912060038201549293509091600160a01b900460ff16600114612a745760405162461bcd60e51b8152600401610a4a906145c2565b6000816003015482600401548460010154612a8f9190614561565b612a999190614578565b90506000826003015483600501548560010154612ab69190614561565b612ac09190614578565b6003850154600280870154908601549293506001600160a01b03918216929082169116612c7057600084118015612aff57506001600160a01b03821615155b15612ba9576000826001600160a01b03168560405160006040518083038185875af1925050503d8060008114612b51576040519150601f19603f3d011682016040523d82523d6000602084013e612b56565b606091505b5050905080612ba75760405162461bcd60e51b815260206004820152601d60248201527f5472616e736665722046756e647320746f2053656c6c6572204661696c0000006044820152606401610a4a565b505b600083118015612bc157506001600160a01b03811615155b15612c6b576000816001600160a01b03168460405160006040518083038185875af1925050503d8060008114612c13576040519150601f19603f3d011682016040523d82523d6000602084013e612c18565b606091505b5050905080612c695760405162461bcd60e51b815260206004820152601d60248201527f5472616e736665722046756e647320746f2053656c6c6572204661696c0000006044820152606401610a4a565b505b612ce1565b60028501546001600160a01b03168415801590612c9557506001600160a01b03831615155b15612cae57612cae6001600160a01b03821684876139b1565b600084118015612cc657506001600160a01b03821615155b15612cdf57612cdf6001600160a01b03821683866139b1565b505b60038601805460ff60a01b1916600360a01b179055604080518a81523360208201527f22369ba22944aadf9e9d6f4c51462417a50ea7876b9c62c7c46b5522e9c672cc91015b60405180910390a1505050505050505061280a600160008051602061481483398151915255565b600080612d59613729565b60009384526002016020525050604090206004015490565b612d796136f1565b6000612d83613729565b6000838152600482016020908152604080832080548452600285018352818420600180820154865280870190945291909320918201549394509192600160981b900460ff16600314612de75760405162461bcd60e51b8152600401610a4a9061459a565b8054612e0b9065ffffffffffff600160d01b8204811691600160a01b900416614768565b65ffffffffffff164211612e615760405162461bcd60e51b815260206004820152601b60248201527f536574746c696e672054696d65204e6f7420456e6465642059657400000000006044820152606401610a4a565b6003830154600160a01b900460ff16600114612e8f5760405162461bcd60e51b8152600401610a4a906145c2565b60038301546001600160a01b0316331480612ebd5750612ebd6000805160206147d483398151915233612196565b612f025760405162461bcd60e51b81526020600482015260166024820152754275796572206f72204f70657261746f72204f6e6c7960501b6044820152606401610a4a565b6000826003015483600501548560010154612f1d9190614561565b612f279190614578565b90506000836003015484600401548660010154612f449190614561565b612f4e9190614578565b90506000620f4240876006016002015484612f699190614561565b612f74906002614561565b612f7e9190614578565b9050600081612f8d85856145f0565b612f979190614603565b60028701549091506001600160a01b031661308c5760038701546040516000916001600160a01b03169083908381818185875af1925050503d8060008114612ffb576040519150601f19603f3d011682016040523d82523d6000602084013e613000565b606091505b505060098a01546040519192506000916001600160a01b039091169085908381818185875af1925050503d8060008114613056576040519150601f19603f3d011682016040523d82523d6000602084013e61305b565b606091505b505090508180156130695750805b6130855760405162461bcd60e51b8152600401610a4a90614616565b50506130cd565b600286015460038801546001600160a01b03918216916130af91839116846139b1565b60098901546130cb906001600160a01b038381169116856139b1565b505b60038701805460ff60a01b1916600360a01b1790556040517f6353c0ce500c8ea1f1026c8f39a6e0c2d1b2f17034fcd8a4b021c72e6e293e5190612d27908b90849086903390614643565b600080613123613729565b60009384526002016020525050604090206003015490565b6131436136f1565b600061314d613729565b6000838152600282016020526040902060078101549192509061010090046001600160a01b031633146131b55760405162461bcd60e51b815260206004820152601060248201526f4f66666572204f776e6572204f6e6c7960801b6044820152606401610a4a565b600781015460ff166001146131dc5760405162461bcd60e51b8152600401610a4a90614696565b6000816006015482600301546131f29190614603565b9050600081116132145760405162461bcd60e51b8152600401610a4a906146c4565b815460009060ff166000190161324957600383015460048401546132389084614561565b6132429190614578565b905061326a565b6003830154600584015461325d9084614561565b6132679190614578565b90505b6007840154600090620f4240906132819084614561565b61328b9190614578565b90506132978183614603565b60028501549092506001600160a01b031661339157600784015460405160009161010090046001600160a01b03169084908381818185875af1925050503d8060008114613300576040519150601f19603f3d011682016040523d82523d6000602084013e613305565b606091505b505060098701546040519192506000916001600160a01b039091169084908381818185875af1925050503d806000811461335b576040519150601f19603f3d011682016040523d82523d6000602084013e613360565b606091505b5050905081801561336e5750805b61338a5760405162461bcd60e51b8152600401610a4a90614616565b50506133d8565b600284015460078501546001600160a01b03918216916133ba91839161010090910416856139b1565b60098601546133d6906001600160a01b038381169116846139b1565b505b60078401805460ff191660031790556040517ff65e543d34c6936603a3741b3eace109133f172d25637c2445b95c1f3288e9379061341d908890859085903390614643565b60405180910390a1505050505061280a600160008051602061481483398151915255565b6000805160206147d4833981519152613459816139a7565b6000613463613729565b9050620151808365ffffffffffff1610156134bb5760405162461bcd60e51b81526020600482015260186024820152774d696e696d756d2032346820666f7220736574746c696e6760401b6044820152606401610a4a565b60008481526001808301602052604091829020805465ffffffffffff8716600160d01b026001600160d01b03909116178155908101805460ff60981b1916600160981b17905590517f1da02fe9181848bf1b401dde762d155f0da084c24db69129a3c7479f970ddbcc906112b8908790879091825265ffffffffffff16602082015260400190565b61354b6139e2565b6001600160a01b03811661357557604051631e4fbdf760e01b815260006004820152602401610a4a565b61280a81613b3c565b6135866136f1565b6000613590613729565b6000868152600180830160205260409091208082015492935091600160981b900460ff16146135f15760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2102a37b5b2b760991b6044820152606401610a4a565b6000851180156136015750600084115b6136475760405162461bcd60e51b8152602060048201526017602482015276496e76616c696420416d6f756e74206f722056616c756560481b6044820152606401610a4a565b6006820154600090620f42409061365e9087614561565b6136689190614578565b9050600060ff891660011461367d578161367f565b855b9050348111156136c65760405162461bcd60e51b8152602060048201526012602482015271496e73756666696369656e742046756e647360701b6044820152606401610a4a565b6136d6898960008a8a878b6137b4565b50505050611b28600160008051602061481483398151915255565b60008051602061481483398151915280546001190161372357604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b7fe0eb0c6bc05973c9317c77fe5b658559f9e21630d35f19f70b8603a4f231f90090565b6040516001600160a01b0384811660248301528381166044830152606482018390526113a59186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050613d89565b60006137be613729565b90506040518061014001604052808960ff168152602001888152602001876001600160a01b0316815260200186815260200185815260200184815260200160008152602001600160ff168152602001336001600160a01b0316815260200183151581525081600201600083600301600081546138399061467d565b9182905550815260208082019290925260409081016000208351815460ff91821660ff19909116178255928401516001820155838201516002820180546001600160a01b039283166001600160a01b031990911617905560608501516003808401919091556080860151600484015560a0860151600584015560c0860151600684015560e08601516007909301805461010080890151610120909901511515600160a81b0260ff60a81b1999909516026001600160a81b0319909116949096169390931794909417949094169390931790925582015490517f8f8f88015929d8eeb82fcc5c324b9713dc52572eae5cf9e6e80f7e2d81ae089891613995918b908b908b908b908b908b908b90339098895260ff97909716602089015260408801959095526001600160a01b039384166060880152608087019290925260a086015260c085015290151560e0840152166101008201526101200190565b60405180910390a15050505050505050565b61280a8133613dec565b6040516001600160a01b0383811660248301526044820183905261138491859182169063a9059cbb90606401613782565b336139eb6120b9565b6001600160a01b0316146115d25760405163118cdaa760e01b8152336004820152602401610a4a565b60006000805160206147f4833981519152613a2f8484612196565b613aaf576000848152602082815260408083206001600160a01b03871684529091529020805460ff19166001179055613a653390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a460019150506109d5565b60009150506109d5565b5092915050565b60006000805160206147f4833981519152613adb8484612196565b15613aaf576000848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a460019150506109d5565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b6000613bb7613729565b9050600081600201600087815260200190815260200160002090506040518060a00160405280878152602001868152602001846001600160a01b03168152602001856001600160a01b03168152602001600160ff168152508260040160008460050160008154613c269061467d565b918290555081526020808201929092526040908101600090812084518155928401516001840155908301516002830180546001600160a01b039283166001600160a01b031990911617905560608401516003909301805460809095015160ff16600160a01b026001600160a81b03199095169390911692909217929092179055600682018054879290613cba9084906145f0565b90915550506003810154600682015403613d175760078101805460ff1916600217905560408051878152600060208201527f37a30d6e3fcaec3144b11d51892b9eadbb0ec4d2a8a813d64bb6065c3adfcffa910160405180910390a15b6005820154604080519182526020820188905281018690526001600160a01b038085166060830152851660808201527fdc3effd7f2b46d1989f8b9ec5abba2e3c07eaa9caa9511c8af3c9444ecbb52f29060a0016115b0565b613d78613e25565b61280a81613e6e565b6115d2613e25565b6000613d9e6001600160a01b03841683613e76565b90508051600014158015613dc3575080806020019051810190613dc19190614787565b155b1561138457604051635274afe760e01b81526001600160a01b0384166004820152602401610a4a565b613df68282612196565b610f635760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610a4a565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff166115d257604051631afcd79f60e31b815260040160405180910390fd5b61354b613e25565b60606122cd8383600084600080856001600160a01b03168486604051613e9c91906147a4565b60006040518083038185875af1925050503d8060008114613ed9576040519150601f19603f3d011682016040523d82523d6000602084013e613ede565b606091505b5091509150613eee868383613ef8565b9695505050505050565b606082613f0d57613f0882613f54565b6122cd565b8151158015613f2457506001600160a01b0384163b155b15613f4d57604051639996b31560e01b81526001600160a01b0385166004820152602401610a4a565b50806122cd565b805115613f645780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b600060208284031215613f8f57600080fd5b81356001600160e01b0319811681146122cd57600080fd5b803560ff81168114613fb857600080fd5b919050565b80356001600160a01b0381168114613fb857600080fd5b801515811461280a57600080fd5b8035613fb881613fd4565b60008060008060008060c0878903121561400657600080fd5b61400f87613fa7565b955060208701359450604087013593506060870135925061403260808801613fbd565b915060a087013561404281613fd4565b809150509295509295509295565b6000806040838503121561406357600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156140b1576140b1614072565b604052919050565b600067ffffffffffffffff8211156140d3576140d3614072565b5060051b60200190565b600082601f8301126140ee57600080fd5b813560206141036140fe836140b9565b614088565b82815260059290921b8401810191818101908684111561412257600080fd5b8286015b8481101561413d5780358352918301918301614126565b509695505050505050565b60006020828403121561415a57600080fd5b813567ffffffffffffffff81111561417157600080fd5b61417d848285016140dd565b949350505050565b60006020828403121561419757600080fd5b5035919050565b600080600080608085870312156141b457600080fd5b6141bd85613fbd565b966020860135965060408601359560600135945092505050565b600080604083850312156141ea57600080fd5b82359150602083013565ffffffffffff8116811461420757600080fd5b809150509250929050565b6000806040838503121561422557600080fd5b823567ffffffffffffffff8082111561423d57600080fd5b614249868387016140dd565b935060209150818501358181111561426057600080fd5b85019050601f8101861361427357600080fd5b80356142816140fe826140b9565b81815260059190911b820183019083810190888311156142a057600080fd5b928401925b828410156142be578335825292840192908401906142a5565b80955050505050509250929050565b600080604083850312156142e057600080fd5b823591506142f060208401613fbd565b90509250929050565b60006020828403121561430b57600080fd5b6122cd82613fbd565b60008060006060848603121561432957600080fd5b8335925061433960208501613fbd565b915060408401356001600160981b038116811461435557600080fd5b809150509250925092565b815160ff168152610140810160208301516020830152604083015161439060408401826001600160a01b03169052565b50606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e08301516143cd60e084018260ff169052565b50610100838101516001600160a01b031690830152610120928301511515929091019190915290565b6000806040838503121561440957600080fd5b823567ffffffffffffffff81111561442057600080fd5b8301601f8101851361443157600080fd5b803560206144416140fe836140b9565b82815260059290921b8301810191818101908884111561446057600080fd5b938201935b838510156144855761447685613fbd565b82529382019390820190614465565b95506144949050868201613fe2565b93505050509250929050565b600080604083850312156144b357600080fd5b6144bc83613fbd565b91506142f060208401613fbd565b600080600080600060a086880312156144e257600080fd5b6144eb86613fa7565b9450602086013593506040860135925060608601359150608086013561451081613fd4565b809150509295509295909350565b60208082526013908201527224b73b30b634b21027b33332b9102a37b5b2b760691b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176109d5576109d561454b565b60008261459557634e487b7160e01b600052601260045260246000fd5b500490565b6020808252600e908201526d496e76616c69642053746174757360901b604082015260600190565b602080825260149082015273496e76616c6964204f726465722053746174757360601b604082015260600190565b808201808211156109d5576109d561454b565b818103818111156109d5576109d561454b565b602080825260139082015272151c985b9cd9995c88119d5b991cc811985a5b606a1b604082015260600190565b938452602084019290925260408301526001600160a01b0316606082015260800190565b634e487b7160e01b600052603260045260246000fd5b60006001820161468f5761468f61454b565b5060010190565b602080825260149082015273496e76616c6964204f666665722053746174757360601b604082015260600190565b60208082526018908201527f496e73756666696369656e7420416c6c6f636174696f6e730000000000000000604082015260600190565b604080825283519082018190526000906020906060840190828701845b8281101561473d5781516001600160a01b031684529284019290840190600101614718565b50505093151592019190915250919050565b60006020828403121561476157600080fd5b5051919050565b65ffffffffffff818116838216019080821115613ab957613ab961454b565b60006020828403121561479957600080fd5b81516122cd81613fd4565b6000825160005b818110156147c557602081860181015185830152016147ab565b50600092019182525091905056fe97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92902dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a264697066735822122064ac8f2a85e1a2b635019a1ccc1f68b07ace6ab2eeb9e2aab9ffd2d6a600f4ea64736f6c63430008140033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.