Overview
ETH Balance
0 ETH
ETH Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
SportPositionalMarketManager
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // Inheritance import "../../utils/proxy/solidity-0.8.0/ProxyOwned.sol"; import "../../utils/proxy/solidity-0.8.0/ProxyPausable.sol"; // Libraries import "../../utils/libraries/AddressSetLib.sol"; import "@openzeppelin/contracts-4.4.1/utils/math/SafeMath.sol"; // Internal references import "./SportPositionalMarketFactory.sol"; import "./SportPositionalMarket.sol"; import "./SportPosition.sol"; import "../../interfaces/ISportPositionalMarketManager.sol"; import "../../interfaces/ISportPositionalMarket.sol"; import "../../interfaces/ITherundownConsumer.sol"; import "@openzeppelin/contracts-4.4.1/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "../../interfaces/IGamesOddsObtainer.sol"; import "../../interfaces/IGamesPlayerProps.sol"; import "../../interfaces/IGameChildMarket.sol"; contract SportPositionalMarketManager is Initializable, ProxyOwned, ProxyPausable, ISportPositionalMarketManager { /* ========== LIBRARIES ========== */ using SafeMath for uint; using AddressSetLib for AddressSetLib.AddressSet; /* ========== STATE VARIABLES ========== */ uint public override expiryDuration; bool public override marketCreationEnabled; bool public customMarketCreationEnabled; uint public override totalDeposited; AddressSetLib.AddressSet internal _activeMarkets; AddressSetLib.AddressSet internal _maturedMarkets; SportPositionalMarketManager internal _migratingManager; IERC20 public sUSD; address public theRundownConsumer; address public sportPositionalMarketFactory; bool public needsTransformingCollateral; mapping(address => bool) public whitelistedAddresses; address private apexConsumer; // deprecated uint public cancelTimeout; mapping(address => bool) public whitelistedCancelAddresses; address public oddsObtainer; mapping(address => bool) public isDoubleChance; bool public override isDoubleChanceSupported; mapping(address => address[]) public doubleChanceMarketsByParent; mapping(uint => bool) public override doesSportSupportDoubleChance; address public playerProps; /* ========== CONSTRUCTOR ========== */ function initialize(address _owner, IERC20 _sUSD) external initializer { setOwner(_owner); sUSD = _sUSD; // Temporarily change the owner so that the setters don't revert. owner = msg.sender; marketCreationEnabled = true; customMarketCreationEnabled = false; } /* ========== SETTERS ========== */ function setSportPositionalMarketFactory(address _sportPositionalMarketFactory) external onlyOwner { sportPositionalMarketFactory = _sportPositionalMarketFactory; emit SetSportPositionalMarketFactory(_sportPositionalMarketFactory); } function setTherundownConsumer(address _theRundownConsumer) external onlyOwner { theRundownConsumer = _theRundownConsumer; emit SetTherundownConsumer(_theRundownConsumer); } function setOddsObtainer(address _oddsObtainer) external onlyOwner { oddsObtainer = _oddsObtainer; emit SetObtainerAddress(_oddsObtainer); } function setPlayerProps(address _playerProps) external onlyOwner { playerProps = _playerProps; emit SetPlayerPropsAddress(_playerProps); } function getOddsObtainer() external view override returns (address obtainer) { obtainer = oddsObtainer; } /// @notice setNeedsTransformingCollateral sets needsTransformingCollateral value /// @param _needsTransformingCollateral boolen value to be set function setNeedsTransformingCollateral(bool _needsTransformingCollateral) external onlyOwner { needsTransformingCollateral = _needsTransformingCollateral; } /// @notice setWhitelistedAddresses enables whitelist addresses of given array /// @param _whitelistedAddresses array of whitelisted addresses /// @param _flag adding or removing from whitelist (true: add, false: remove) function setWhitelistedAddresses( address[] calldata _whitelistedAddresses, bool _flag, uint8 _group ) external onlyOwner { require(_whitelistedAddresses.length > 0, "Whitelisted addresses cannot be empty"); for (uint256 index = 0; index < _whitelistedAddresses.length; index++) { // only if current flag is different, if same skip it if (_group == 1) { if (whitelistedAddresses[_whitelistedAddresses[index]] != _flag) { whitelistedAddresses[_whitelistedAddresses[index]] = _flag; emit AddedIntoWhitelist(_whitelistedAddresses[index], _flag); } } if (_group == 2) { if (whitelistedCancelAddresses[_whitelistedAddresses[index]] != _flag) { whitelistedCancelAddresses[_whitelistedAddresses[index]] = _flag; emit AddedIntoWhitelist(_whitelistedAddresses[index], _flag); } } } } /* ========== VIEWS ========== */ /* ---------- Market Information ---------- */ function isKnownMarket(address candidate) public view override returns (bool) { return _activeMarkets.contains(candidate) || _maturedMarkets.contains(candidate); } function isActiveMarket(address candidate) public view override returns (bool) { return _activeMarkets.contains(candidate) && !ISportPositionalMarket(candidate).paused(); } function isDoubleChanceMarket(address candidate) public view override returns (bool) { return isDoubleChance[candidate]; } function numActiveMarkets() external view override returns (uint) { return _activeMarkets.elements.length; } function activeMarkets(uint index, uint pageSize) external view override returns (address[] memory) { return _activeMarkets.getPage(index, pageSize); } function numMaturedMarkets() external view override returns (uint) { return _maturedMarkets.elements.length; } function getActiveMarketAddress(uint _index) external view override returns (address) { if (_index < _activeMarkets.elements.length) { return _activeMarkets.elements[_index]; } else { return address(0); } } function getDoubleChanceMarketsByParentMarket(address market) external view returns (address[] memory) { return _getDoubleChanceMarkets(market); } function maturedMarkets(uint index, uint pageSize) external view override returns (address[] memory) { return _maturedMarkets.getPage(index, pageSize); } function setMarketPaused(address _market, bool _paused) external override { require( msg.sender == owner || msg.sender == theRundownConsumer || msg.sender == oddsObtainer || msg.sender == playerProps || whitelistedAddresses[msg.sender], "Invalid caller" ); require(ISportPositionalMarket(_market).paused() != _paused, "No state change"); ISportPositionalMarket(_market).setPaused(_paused); } function updateDatesForMarket(address _market, uint256 _newStartTime) external override { require(msg.sender == owner || msg.sender == theRundownConsumer, "Invalid caller"); uint expiry = _newStartTime.add(expiryDuration); // Update main market _updateDatesForMarket(_market, _newStartTime, expiry); // Update child markets _updateDatesForChildMarkets(_market, _newStartTime, expiry, oddsObtainer); _updateDatesForChildMarkets(_market, _newStartTime, expiry, playerProps); } function _updateDatesForChildMarkets( address _market, uint256 _newStartTime, uint256 _expiry, address _childMarketContract ) internal { uint numberOfChildMarkets = IGameChildMarket(_childMarketContract).numberOfChildMarkets(_market); for (uint i = 0; i < numberOfChildMarkets; i++) { address child = IGameChildMarket(_childMarketContract).mainMarketChildMarketIndex(_market, i); _updateDatesForMarket(child, _newStartTime, _expiry); } } function isMarketPaused(address _market) external view override returns (bool) { return ISportPositionalMarket(_market).paused(); } function queryMintsAndMaturityStatusForParents(address[] memory _parents) external view returns ( bool[] memory _hasAnyMintsArray, bool[] memory _isMaturedArray, bool[] memory _isResolvedArray ) { _hasAnyMintsArray = new bool[](_parents.length); _isMaturedArray = new bool[](_parents.length); _isResolvedArray = new bool[](_parents.length); for (uint i = 0; i < _parents.length; i++) { (bool _hasAnyMints, uint _maturity) = _hasAnyMintsAndMaturityDatesForMarket(_parents[i]); _isResolvedArray[i] = _isResolvedMarket(_parents[i]); _hasAnyMintsArray[i] = _hasAnyMints; _isMaturedArray[i] = _maturity <= block.timestamp; } } function queryMintsAndMaturityStatusForPlayerProps(address[] memory _playerPropsMarkets) external view override returns ( bool[] memory _hasAnyMintsArray, bool[] memory _isMaturedArray, bool[] memory _isResolvedArray, uint[] memory _maturities ) { _hasAnyMintsArray = new bool[](_playerPropsMarkets.length); _isMaturedArray = new bool[](_playerPropsMarkets.length); _isResolvedArray = new bool[](_playerPropsMarkets.length); _maturities = new uint[](_playerPropsMarkets.length); for (uint i = 0; i < _playerPropsMarkets.length; i++) { (bool _hasAnyMints, uint _maturity) = _hasAnyMintsAndMaturityDatesForPP(_playerPropsMarkets[i]); _isResolvedArray[i] = _isResolvedMarket(_playerPropsMarkets[i]); _hasAnyMintsArray[i] = _hasAnyMints; _isMaturedArray[i] = _maturity <= block.timestamp; _maturities[i] = _maturity; } } function _hasAnyMintsAndMaturityDatesForMarket(address _parent) internal view returns (bool _hasAnyMints, uint _maturity) { ISportPositionalMarket marketContract = ISportPositionalMarket(_parent); (uint maturity, ) = marketContract.times(); _hasAnyMints = marketContract.optionsInitialized() || _hasAnyMintsForChildren(_parent); _maturity = maturity; } function _hasAnyMintsAndMaturityDatesForPP(address _market) internal view returns (bool _hasAnyMints, uint _maturity) { ISportPositionalMarket marketContract = ISportPositionalMarket(_market); (uint maturity, ) = marketContract.times(); _hasAnyMints = marketContract.optionsInitialized(); _maturity = maturity; } function _isResolvedMarket(address _market) internal view returns (bool _flag) { return ISportPositionalMarket(_market).resolved(); } function _getDoubleChanceMarkets(address market) internal view returns (address[] memory markets) { uint length = doubleChanceMarketsByParent[market].length; if (length > 0) { markets = new address[](length); for (uint i = 0; i < length; i++) { markets[i] = doubleChanceMarketsByParent[market][i]; } } } /* ========== MUTATIVE FUNCTIONS ========== */ /* ---------- Setters ---------- */ function setExpiryDuration(uint _expiryDuration) public onlyOwner { expiryDuration = _expiryDuration; emit ExpiryDurationUpdated(_expiryDuration); } function setsUSD(address _address) external onlyOwner { sUSD = IERC20(_address); emit SetsUSD(_address); } /* ---------- Deposit Management ---------- */ function incrementTotalDeposited(uint delta) external onlyActiveMarkets notPaused { totalDeposited = totalDeposited.add(delta); } function decrementTotalDeposited(uint delta) external onlyKnownMarkets notPaused { // NOTE: As individual market debt is not tracked here, the underlying markets // need to be careful never to subtract more debt than they added. // This can't be enforced without additional state/communication overhead. totalDeposited = totalDeposited.sub(delta); } /* ---------- Market Lifecycle ---------- */ function createMarket( bytes32 gameId, string memory gameLabel, uint maturity, uint initialMint, // initial sUSD to mint options for, uint positionCount, uint[] memory tags, bool isChild, address parentMarket ) external override notPaused returns ( ISportPositionalMarket // no support for returning PositionalMarket polymorphically given the interface ) { require(marketCreationEnabled, "Market creation is disabled"); require( msg.sender == theRundownConsumer || msg.sender == oddsObtainer || msg.sender == playerProps, "Invalid creator" ); uint expiry = maturity.add(expiryDuration); require(block.timestamp < maturity, "Maturity has to be in the future"); // We also require maturity < expiry. But there is no need to check this. // The market itself validates the capital and skew requirements. ISportPositionalMarket market = _createMarket( SportPositionalMarketFactory.SportPositionCreationMarketParameters( msg.sender, gameId, gameLabel, [maturity, expiry], positionCount, tags, isChild, parentMarket, false ) ); if (positionCount > 2 && isDoubleChanceSupported) { _createDoubleChanceMarkets(msg.sender, gameId, maturity, expiry, address(market), tags[0]); } return market; } function createDoubleChanceMarketsForParent(address market) external notPaused onlyOwner { require(marketCreationEnabled, "Market creation is disabled"); require(isDoubleChanceSupported, "Double chance not supported"); ISportPositionalMarket marketContract = ISportPositionalMarket(market); require(marketContract.optionsCount() > 2, "Not supported for 2 options market"); (uint maturity, uint expiry) = marketContract.times(); _createDoubleChanceMarkets( marketContract.creator(), marketContract.getGameId(), maturity, expiry, market, marketContract.tags(0) ); } function _createMarket(SportPositionalMarketFactory.SportPositionCreationMarketParameters memory parameters) internal returns (ISportPositionalMarket) { SportPositionalMarket market = SportPositionalMarketFactory(sportPositionalMarketFactory).createMarket(parameters); _activeMarkets.add(address(market)); (IPosition up, IPosition down, IPosition draw) = market.getOptions(); emit MarketCreated( address(market), parameters.creator, parameters.gameId, parameters.times[0], parameters.times[1], address(up), address(down), address(draw) ); emit MarketLabel(address(market), parameters.gameLabel); return market; } function _createDoubleChanceMarkets( address creator, bytes32 gameId, uint maturity, uint expiry, address market, uint tag ) internal onlySupportedGameId(gameId) { string[3] memory labels = ["HomeTeamNotToLose", "AwayTeamNotToLose", "NoDraw"]; uint[] memory tagsDoubleChance = new uint[](2); tagsDoubleChance[0] = tag; tagsDoubleChance[1] = 10003; for (uint i = 0; i < 3; i++) { ISportPositionalMarket doubleChanceMarket = _createMarket( SportPositionalMarketFactory.SportPositionCreationMarketParameters( creator, gameId, labels[i], [maturity, expiry], 2, tagsDoubleChance, false, address(market), true ) ); _activeMarkets.add(address(doubleChanceMarket)); doubleChanceMarketsByParent[address(market)].push(address(doubleChanceMarket)); isDoubleChance[address(doubleChanceMarket)] = true; IGamesOddsObtainer(oddsObtainer).setChildMarketGameId(gameId, address(doubleChanceMarket)); emit DoubleChanceMarketCreated(address(market), address(doubleChanceMarket), tagsDoubleChance[1], labels[i]); } } function transferSusdTo( address sender, address receiver, uint amount ) external override { //only to be called by markets themselves require(isKnownMarket(address(msg.sender)), "Market unknown."); amount = _transformCollateral(amount); amount = needsTransformingCollateral ? amount + 1 : amount; bool success = sUSD.transferFrom(sender, receiver, amount); if (!success) { revert("TransferFrom function failed"); } } function resolveMarket(address market, uint _outcome) external override { require( msg.sender == theRundownConsumer || msg.sender == owner || msg.sender == oddsObtainer || msg.sender == playerProps || whitelistedCancelAddresses[msg.sender], "Invalid resolver" ); require(_activeMarkets.contains(market), "Not an active market"); require(!isDoubleChance[market], "Not supported for double chance markets"); // unpause if paused if (ISportPositionalMarket(market).paused()) { ISportPositionalMarket(market).setPaused(false); } SportPositionalMarket(market).resolve(_outcome); _activeMarkets.remove(market); _maturedMarkets.add(market); if (doubleChanceMarketsByParent[market].length > 0) { if (_outcome == 1) { // HomeTeamNotLose, NoDraw SportPositionalMarket(doubleChanceMarketsByParent[market][0]).resolve(1); SportPositionalMarket(doubleChanceMarketsByParent[market][1]).resolve(2); SportPositionalMarket(doubleChanceMarketsByParent[market][2]).resolve(1); } else if (_outcome == 2) { // AwayTeamNotLose, NoDraw SportPositionalMarket(doubleChanceMarketsByParent[market][0]).resolve(2); SportPositionalMarket(doubleChanceMarketsByParent[market][1]).resolve(1); SportPositionalMarket(doubleChanceMarketsByParent[market][2]).resolve(1); } else if (_outcome == 3) { // HomeTeamNotLose, AwayTeamNotLose SportPositionalMarket(doubleChanceMarketsByParent[market][0]).resolve(1); SportPositionalMarket(doubleChanceMarketsByParent[market][1]).resolve(1); SportPositionalMarket(doubleChanceMarketsByParent[market][2]).resolve(2); } else { // cancelled SportPositionalMarket(doubleChanceMarketsByParent[market][0]).resolve(0); SportPositionalMarket(doubleChanceMarketsByParent[market][1]).resolve(0); SportPositionalMarket(doubleChanceMarketsByParent[market][2]).resolve(0); } for (uint i = 0; i < doubleChanceMarketsByParent[market].length; i++) { _activeMarkets.remove(doubleChanceMarketsByParent[market][i]); _maturedMarkets.add(doubleChanceMarketsByParent[market][i]); } } } function resolveMarketWithResult( address _market, uint _outcome, uint8 _homeScore, uint8 _awayScore, address _consumer, bool _useBackupOdds ) external { require(msg.sender == owner || whitelistedCancelAddresses[msg.sender], "Invalid resolver"); require(!isDoubleChance[_market], "Not supported for double chance markets"); if (_outcome != 0) { require(!_useBackupOdds, "Only use backup odds on cancelation, if needed!"); } if (_consumer == theRundownConsumer) { ITherundownConsumer(theRundownConsumer).resolveMarketManually( _market, _outcome, _homeScore, _awayScore, _useBackupOdds ); } } function cancelMarketsForParents(address[] memory _parents) external { for (uint i = 0; i < _parents.length; i++) { require(!isDoubleChance[_parents[i]], "Not supported for double chance markets"); (bool _hasAnyMints, uint _maturity) = _hasAnyMintsAndMaturityDatesForMarket(_parents[i]); if (!_hasAnyMints && _maturity <= block.timestamp && !_isResolvedMarket(_parents[i])) { ITherundownConsumer(theRundownConsumer).resolveMarketManually(_parents[i], 0, 0, 0, false); } } } function cancelMarketsForPlayerProps(address[] memory _playerPropsMarkets) external { for (uint i = 0; i < _playerPropsMarkets.length; i++) { require(!isDoubleChance[_playerPropsMarkets[i]], "Not supported for double chance markets"); (bool _hasAnyMints, uint _maturity) = _hasAnyMintsAndMaturityDatesForPP(_playerPropsMarkets[i]); if (!_hasAnyMints && _maturity <= block.timestamp && !_isResolvedMarket(_playerPropsMarkets[i])) { IGamesPlayerProps(playerProps).cancelMarketFromManager(_playerPropsMarkets[i]); } } } function overrideResolveWithCancel(address market, uint _outcome) external { require(msg.sender == owner || whitelistedCancelAddresses[msg.sender], "Invalid resolver"); require(_outcome == 0, "Can only set 0 outcome"); require(SportPositionalMarket(market).resolved(), "Market not resolved"); require(!_activeMarkets.contains(market), "Active market"); require(!isDoubleChance[market], "Not supported for double chance markets"); // unpause if paused if (ISportPositionalMarket(market).paused()) { ISportPositionalMarket(market).setPaused(false); } SportPositionalMarket(market).resolve(_outcome); if (doubleChanceMarketsByParent[market].length > 0) { SportPositionalMarket(doubleChanceMarketsByParent[market][0]).resolve(0); SportPositionalMarket(doubleChanceMarketsByParent[market][1]).resolve(0); SportPositionalMarket(doubleChanceMarketsByParent[market][2]).resolve(0); } } function expireMarkets(address[] calldata markets) external override notPaused onlyOwner { for (uint i = 0; i < markets.length; i++) { address market = markets[i]; require(isKnownMarket(address(market)), "Market unknown."); // The market itself handles decrementing the total deposits. SportPositionalMarket(market).expire(payable(msg.sender)); // Note that we required that the market is known, which guarantees // its index is defined and that the list of markets is not empty. _maturedMarkets.remove(market); emit MarketExpired(market); } } function restoreInvalidOddsForMarket( address _market, uint _homeOdds, uint _awayOdds, uint _drawOdds ) external onlyOwner { require(isKnownMarket(address(_market)), "Market unknown."); require(SportPositionalMarket(_market).cancelled(), "Market not cancelled."); SportPositionalMarket(_market).restoreInvalidOdds(_homeOdds, _awayOdds, _drawOdds); emit OddsForMarketRestored(_market, _homeOdds, _awayOdds, _drawOdds); } function setMarketCreationEnabled(bool enabled) external onlyOwner { if (enabled != marketCreationEnabled) { marketCreationEnabled = enabled; emit MarketCreationEnabledUpdated(enabled); } } function setCancelTimeout(uint _cancelTimeout) external onlyOwner { cancelTimeout = _cancelTimeout; } function setIsDoubleChanceSupported(bool _isDoubleChanceSupported) external onlyOwner { isDoubleChanceSupported = _isDoubleChanceSupported; emit DoubleChanceSupportChanged(_isDoubleChanceSupported); } function setSupportedSportForDoubleChance(uint[] memory _sportIds, bool _isSupported) external onlyOwner { for (uint256 index = 0; index < _sportIds.length; index++) { // only if current flag is different, if same skip it if (doesSportSupportDoubleChance[_sportIds[index]] != _isSupported) { doesSportSupportDoubleChance[_sportIds[index]] = _isSupported; emit SupportedSportForDoubleChanceAdded(_sportIds[index], _isSupported); } } } // support USDC with 6 decimals function transformCollateral(uint value) external view override returns (uint) { return _transformCollateral(value); } function _transformCollateral(uint value) internal view returns (uint) { if (needsTransformingCollateral) { return value / 1e12; } else { return value; } } function _updateDatesForMarket( address _market, uint256 _newStartTime, uint256 _expiry ) internal { ISportPositionalMarket(_market).updateDates(_newStartTime, _expiry); emit DatesUpdatedForMarket(_market, _newStartTime, _expiry); } function _hasAnyMintsForChildren(address _market) internal view returns (bool) { return _hasAnyMints(_market, true) || _hasAnyMints(_market, false) || _hasAnyMintsDoubleChance(_market); } function _hasAnyMints(address _market, bool checkPlayerProps) internal view returns (bool) { uint numberOfChildMarkets; address childMarketContract; if (checkPlayerProps) { numberOfChildMarkets = IGameChildMarket(playerProps).numberOfChildMarkets(_market); childMarketContract = playerProps; } else { numberOfChildMarkets = IGameChildMarket(oddsObtainer).numberOfChildMarkets(_market); childMarketContract = oddsObtainer; } for (uint i = 0; i < numberOfChildMarkets; i++) { address child = IGameChildMarket(childMarketContract).mainMarketChildMarketIndex(_market, i); if (ISportPositionalMarket(child).optionsInitialized()) { return true; } } return false; } function _hasAnyMintsDoubleChance(address _market) internal view returns (bool) { address[] memory childMarkets = _getDoubleChanceMarkets(_market); for (uint i = 0; i < childMarkets.length; i++) { if (childMarkets[i] != address(0) && ISportPositionalMarket(childMarkets[i]).optionsInitialized()) { return true; } } return false; } function reverseTransformCollateral(uint value) external view override returns (uint) { if (needsTransformingCollateral) { return value * 1e12; } else { return value; } } function isWhitelistedAddress(address _address) external view override returns (bool) { return whitelistedAddresses[_address]; } /* ========== MODIFIERS ========== */ modifier onlyActiveMarkets() { require(_activeMarkets.contains(msg.sender), "Permitted only for active markets."); _; } modifier onlyKnownMarkets() { require(isKnownMarket(msg.sender), "Permitted only for known markets."); _; } modifier onlySupportedGameId(bytes32 gameId) { uint sportId = ITherundownConsumer(theRundownConsumer).sportsIdPerGame(gameId); if (doesSportSupportDoubleChance[sportId] && isDoubleChanceSupported) { _; } } /* ========== EVENTS ========== */ event MarketCreated( address market, address indexed creator, bytes32 indexed gameId, uint maturityDate, uint expiryDate, address up, address down, address draw ); event MarketLabel(address market, string gameLabel); event MarketExpired(address market); event MarketCreationEnabledUpdated(bool enabled); event MarketsMigrated(SportPositionalMarketManager receivingManager, SportPositionalMarket[] markets); event MarketsReceived(SportPositionalMarketManager migratingManager, SportPositionalMarket[] markets); event SetMigratingManager(address migratingManager); event ExpiryDurationUpdated(uint duration); event MaxTimeToMaturityUpdated(uint duration); event CreatorCapitalRequirementUpdated(uint value); event SetSportPositionalMarketFactory(address _sportPositionalMarketFactory); event SetsUSD(address _address); event SetTherundownConsumer(address theRundownConsumer); event SetObtainerAddress(address _obratiner); event SetPlayerPropsAddress(address _playerProps); event OddsForMarketRestored(address _market, uint _homeOdds, uint _awayOdds, uint _drawOdds); event AddedIntoWhitelist(address _whitelistAddress, bool _flag); event DatesUpdatedForMarket(address _market, uint256 _newStartTime, uint256 _expiry); event DoubleChanceMarketCreated(address _parentMarket, address _doubleChanceMarket, uint tag, string label); event DoubleChanceSupportChanged(bool _isDoubleChanceSupported); event SupportedSportForDoubleChanceAdded(uint _sportId, bool _isSupported); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // Clone of syntetix contract without constructor contract ProxyOwned { address public owner; address public nominatedOwner; bool private _initialized; bool private _transferredAtInit; function setOwner(address _owner) public { require(_owner != address(0), "Owner address cannot be 0"); require(!_initialized, "Already initialized, use nominateNewOwner"); _initialized = true; owner = _owner; emit OwnerChanged(address(0), _owner); } function nominateNewOwner(address _owner) external onlyOwner { nominatedOwner = _owner; emit OwnerNominated(_owner); } function acceptOwnership() external { require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership"); emit OwnerChanged(owner, nominatedOwner); owner = nominatedOwner; nominatedOwner = address(0); } function transferOwnershipAtInit(address proxyAddress) external onlyOwner { require(proxyAddress != address(0), "Invalid address"); require(!_transferredAtInit, "Already transferred"); owner = proxyAddress; _transferredAtInit = true; emit OwnerChanged(owner, proxyAddress); } modifier onlyOwner { _onlyOwner(); _; } function _onlyOwner() private view { require(msg.sender == owner, "Only the contract owner may perform this action"); } event OwnerNominated(address newOwner); event OwnerChanged(address oldOwner, address newOwner); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // Inheritance import "./ProxyOwned.sol"; // Clone of syntetix contract without constructor contract ProxyPausable is ProxyOwned { uint public lastPauseTime; bool public paused; /** * @notice Change the paused state of the contract * @dev Only the contract owner may call this. */ function setPaused(bool _paused) external onlyOwner { // Ensure we're actually changing the state before we do anything if (_paused == paused) { return; } // Set our paused state. paused = _paused; // If applicable, set the last pause time. if (paused) { lastPauseTime = block.timestamp; } // Let everyone know that our pause state has changed. emit PauseChanged(paused); } event PauseChanged(bool isPaused); modifier notPaused { require(!paused, "This action cannot be performed while the contract is paused"); _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library AddressSetLib { struct AddressSet { address[] elements; mapping(address => uint) indices; } function contains(AddressSet storage set, address candidate) internal view returns (bool) { if (set.elements.length == 0) { return false; } uint index = set.indices[candidate]; return index != 0 || set.elements[0] == candidate; } function getPage( AddressSet storage set, uint index, uint pageSize ) internal view returns (address[] memory) { // NOTE: This implementation should be converted to slice operators if the compiler is updated to v0.6.0+ uint endIndex = index + pageSize; // The check below that endIndex <= index handles overflow. // If the page extends past the end of the list, truncate it. if (endIndex > set.elements.length) { endIndex = set.elements.length; } if (endIndex <= index) { return new address[](0); } uint n = endIndex - index; // We already checked for negative overflow. address[] memory page = new address[](n); for (uint i; i < n; i++) { page[i] = set.elements[i + index]; } return page; } function add(AddressSet storage set, address element) internal { // Adding to a set is an idempotent operation. if (!contains(set, element)) { set.indices[element] = set.elements.length; set.elements.push(element); } } function remove(AddressSet storage set, address element) internal { require(contains(set, element), "Element not in set."); // Replace the removed element with the last element of the list. uint index = set.indices[element]; uint lastIndex = set.elements.length - 1; // We required that element is in the list, so it is not empty. if (index != lastIndex) { // No need to shift the last element if it is the one we want to delete. address shiftedElement = set.elements[lastIndex]; set.elements[index] = shiftedElement; set.indices[shiftedElement] = index; } set.elements.pop(); delete set.indices[element]; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
pragma solidity ^0.8.0; // Inheritance import "../../utils/proxy/solidity-0.8.0/ProxyOwned.sol"; // Internal references import "./SportPosition.sol"; import "./SportPositionalMarket.sol"; import "./SportPositionalMarketFactory.sol"; import "@openzeppelin/contracts-4.4.1/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts-4.4.1/proxy/Clones.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; contract SportPositionalMarketFactory is Initializable, ProxyOwned { /* ========== STATE VARIABLES ========== */ address public positionalMarketManager; address public positionalMarketMastercopy; address public positionMastercopy; address public sportsAMM; struct SportPositionCreationMarketParameters { address creator; bytes32 gameId; string gameLabel; uint[2] times; // [maturity, expiry] uint positionCount; uint[] tags; bool isChild; address parentMarket; bool isDoubleChance; } /* ========== INITIALIZER ========== */ function initialize(address _owner) external initializer { setOwner(_owner); } /* ========== MUTATIVE FUNCTIONS ========== */ function createMarket(SportPositionCreationMarketParameters calldata _parameters) external returns (SportPositionalMarket) { require(positionalMarketManager == msg.sender, "Only permitted by the manager."); SportPositionalMarket pom = SportPositionalMarket(Clones.clone(positionalMarketMastercopy)); address[] memory positions = new address[](_parameters.positionCount); pom.initialize( SportPositionalMarket.SportPositionalMarketParameters( positionalMarketManager, _parameters.creator, _parameters.gameId, _parameters.gameLabel, _parameters.times, _parameters.positionCount, positions, _parameters.tags, _parameters.isChild, _parameters.parentMarket, _parameters.isDoubleChance, address(this) ) ); emit MarketCreated( address(pom), _parameters.gameId, _parameters.gameLabel, _parameters.times[0], _parameters.times[1], 0, _parameters.positionCount, _parameters.tags, _parameters.isChild, _parameters.parentMarket ); return pom; } /* ========== SETTERS ========== */ function setSportPositionalMarketManager(address _positionalMarketManager) external onlyOwner { positionalMarketManager = _positionalMarketManager; emit SportPositionalMarketManagerChanged(_positionalMarketManager); } function setSportPositionalMarketMastercopy(address _positionalMarketMastercopy) external onlyOwner { positionalMarketMastercopy = _positionalMarketMastercopy; emit SportPositionalMarketMastercopyChanged(_positionalMarketMastercopy); } function setSportPositionMastercopy(address _positionMastercopy) external onlyOwner { positionMastercopy = _positionMastercopy; emit SportPositionMastercopyChanged(_positionMastercopy); } function setSportsAMM(address _sportsAMM) external onlyOwner { sportsAMM = _sportsAMM; emit SetSportsAMM(_sportsAMM); } event SportPositionalMarketManagerChanged(address _positionalMarketManager); event SportPositionalMarketMastercopyChanged(address _positionalMarketMastercopy); event SportPositionMastercopyChanged(address _positionMastercopy); event SetSportsAMM(address _sportsAMM); event SetLimitOrderProvider(address _limitOrderProvider); event MarketCreated( address market, bytes32 indexed gameId, string gameLabel, uint maturityDate, uint expiryDate, uint initialMint, uint positionCount, uint[] tags, bool isChild, address parent ); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // Inheritance import "../../OwnedWithInit.sol"; import "../../interfaces/ISportPositionalMarket.sol"; import "../../interfaces/ITherundownConsumer.sol"; import "../../interfaces/ISportsAMM.sol"; import "../../interfaces/ISportPositionalMarketFactory.sol"; // Libraries import "@openzeppelin/contracts-4.4.1/utils/math/SafeMath.sol"; // Internal references import "./SportPositionalMarketManager.sol"; import "./SportPosition.sol"; import "@openzeppelin/contracts-4.4.1/token/ERC20/IERC20.sol"; contract SportPositionalMarket is OwnedWithInit, ISportPositionalMarket { /* ========== LIBRARIES ========== */ using SafeMath for uint; /* ========== TYPES ========== */ struct Options { SportPosition home; SportPosition away; SportPosition draw; } struct Times { uint maturity; uint expiry; } struct GameDetails { bytes32 gameId; string gameLabel; } struct SportPositionalMarketParameters { address owner; address creator; bytes32 gameId; string gameLabel; uint[2] times; // [maturity, expiry] uint positionCount; address[] positions; uint[] tags; bool isChild; address parentMarket; bool isDoubleChance; address factory; } /* ========== STATE VARIABLES ========== */ Options public options; uint public override optionsCount; Times public parentTimes; GameDetails private gameDetails; string private childGameLabel; uint[] public override tags; uint public finalResult; // `deposited` tracks the sum of all deposits. // This must explicitly be kept, in case tokens are transferred to the contract directly. uint public override deposited; address public override creator; bool public override resolved; bool public override cancelled; uint public cancelTimestamp; uint public homeOddsOnCancellation; uint public awayOddsOnCancellation; uint public drawOddsOnCancellation; bool public invalidOdds; bool public initialized = false; bool public override paused; bool public override isChild; ISportPositionalMarket public override parentMarket; bool public override isDoubleChance; bool public override optionsInitialized; address public factory; /* ========== CONSTRUCTOR ========== */ function initialize(SportPositionalMarketParameters calldata _parameters) external { require(!initialized, "Positional Market already initialized"); initialized = true; initOwner(_parameters.owner); optionsCount = _parameters.positionCount; require(optionsCount == _parameters.positions.length, "Position count mismatch"); creator = _parameters.creator; if (_parameters.isChild || _parameters.isDoubleChance) { isChild = _parameters.isChild; isDoubleChance = _parameters.isDoubleChance; parentMarket = ISportPositionalMarket(_parameters.parentMarket); childGameLabel = _parameters.gameLabel; } else { parentTimes = Times(_parameters.times[0], _parameters.times[1]); gameDetails = GameDetails(_parameters.gameId, _parameters.gameLabel); } tags = _parameters.tags; factory = _parameters.factory; } /* ---------- External Contracts ---------- */ function _manager() internal view returns (SportPositionalMarketManager) { return SportPositionalMarketManager(owner); } /* ---------- Phases ---------- */ function _times() internal view returns (Times memory) { if (isChild || isDoubleChance) { (uint maturity, uint expiry) = parentMarket.times(); return Times(maturity, expiry); } return parentTimes; } function _matured() internal view returns (bool) { return _times().maturity < block.timestamp; } function _expired() internal view returns (bool) { return resolved && (_times().expiry < block.timestamp || deposited == 0); } function _isPaused() internal view returns (bool) { return isDoubleChance ? parentMarket.paused() : paused; } function getTags() external view override returns (uint tag1, uint tag2) { if (tags.length > 1) { tag1 = tags[0]; tag2 = tags[1]; } else { tag1 = tags[0]; } } function getTagsLength() external view override returns (uint tagsLength) { return tags.length; } function times() external view override returns (uint maturity, uint destruction) { Times memory time = _times(); return (time.maturity, time.expiry); } function phase() external view override returns (Phase) { if (!_matured()) { return Phase.Trading; } if (!_expired()) { return Phase.Maturity; } return Phase.Expiry; } function setPaused(bool _paused) external override onlyOwner managerNotPaused { require(paused != _paused, "State not changed"); paused = _paused; emit PauseUpdated(_paused); } function updateDates(uint256 _maturity, uint256 _expiry) external override onlyOwner managerNotPaused noDoubleChance { require(_maturity > block.timestamp, "Maturity must be in a future"); if (!isChild) { parentTimes = Times(_maturity, _expiry); } emit DatesUpdated(_maturity, _expiry); } /* ---------- Market Resolution ---------- */ function canResolve() public view override returns (bool) { return !resolved && _matured() && !paused; } function getGameDetails() external view override returns (bytes32 gameId, string memory gameLabel) { return (_getDetails().gameId, _getDetails().gameLabel); } function getParentMarketPositionsUint() public view override returns (uint position1, uint position2) { if (isDoubleChance) { (IPosition home, , ) = parentMarket.getOptions(); if (_hasNotBeenInitialized(home)) { if ( keccak256(abi.encodePacked(_getDetails().gameLabel)) == keccak256(abi.encodePacked("HomeTeamNotToLose")) ) { (position1, position2) = (0, 2); } else if ( keccak256(abi.encodePacked(_getDetails().gameLabel)) == keccak256(abi.encodePacked("AwayTeamNotToLose")) ) { (position1, position2) = (1, 2); } else { (position1, position2) = (0, 1); } } } } function getParentMarketPositions() public view override returns (IPosition position1, IPosition position2) { if (isDoubleChance) { (IPosition home, IPosition away, IPosition draw) = parentMarket.getOptions(); if (keccak256(abi.encodePacked(_getDetails().gameLabel)) == keccak256(abi.encodePacked("HomeTeamNotToLose"))) { (position1, position2) = (home, draw); } else if ( keccak256(abi.encodePacked(_getDetails().gameLabel)) == keccak256(abi.encodePacked("AwayTeamNotToLose")) ) { (position1, position2) = (away, draw); } else { (position1, position2) = (home, away); } } } function _result() internal view returns (Side) { if (!resolved || cancelled) { return Side.Cancelled; } else if (finalResult == 3 && optionsCount > 2) { return Side.Draw; } else { return finalResult == 1 ? Side.Home : Side.Away; } } function result() external view override returns (Side) { return _result(); } /* ---------- Option Balances and Mints ---------- */ function getGameId() external view override returns (bytes32) { return _getDetails().gameId; } function getStampedOdds() public view override returns ( uint, uint, uint ) { if (cancelled) { if (isDoubleChance) { (uint position1Odds, uint position2Odds) = _getParentPositionOdds(); return (position1Odds + position2Odds, 0, 0); } return (homeOddsOnCancellation, awayOddsOnCancellation, drawOddsOnCancellation); } else { return (0, 0, 0); } } function _getParentPositionOdds() internal view returns (uint odds1, uint odds2) { (uint homeOddsParent, uint awayOddsParent, uint drawOddsParent) = parentMarket.getStampedOdds(); (IPosition position1, IPosition position2) = getParentMarketPositions(); (IPosition home, IPosition away, ) = parentMarket.getOptions(); if (_hasNotBeenInitialized(home)) { return (0, 0); } odds1 = position1 == home ? homeOddsParent : position1 == away ? awayOddsParent : drawOddsParent; odds2 = position2 == home ? homeOddsParent : position2 == away ? awayOddsParent : drawOddsParent; } function _balancesOf(address account) internal view returns ( uint home, uint away, uint draw ) { if (!optionsInitialized) { return (0, 0, 0); } if (optionsCount > 2) { return ( options.home.getBalanceOf(account), options.away.getBalanceOf(account), options.draw.getBalanceOf(account) ); } return (options.home.getBalanceOf(account), options.away.getBalanceOf(account), 0); } function balancesOf(address account) external view override returns ( uint home, uint away, uint draw ) { return _balancesOf(account); } function totalSupplies() external view override returns ( uint home, uint away, uint draw ) { if (optionsCount > 2) { return (options.home.totalSupply(), options.away.totalSupply(), options.draw.totalSupply()); } return (options.home.totalSupply(), options.away.totalSupply(), 0); } function getOptions() external view override returns ( IPosition home, IPosition away, IPosition draw ) { home = options.home; away = options.away; draw = options.draw; } function _getMaximumBurnable(address account) internal view returns (uint amount) { (uint homeBalance, uint awayBalance, uint drawBalance) = _balancesOf(account); uint min = homeBalance; if (min > awayBalance) { min = awayBalance; if (optionsCount > 2 && drawBalance < min) { min = drawBalance; } } else { if (optionsCount > 2 && drawBalance < min) { min = drawBalance; } } return min; } function _getDetails() internal view returns (GameDetails memory) { if (isChild || isDoubleChance) { (bytes32 gameId, ) = parentMarket.getGameDetails(); return GameDetails(gameId, childGameLabel); } return gameDetails; } /* ---------- Utilities ---------- */ function _incrementDeposited(uint value) internal returns (uint _deposited) { _deposited = deposited.add(value); deposited = _deposited; _manager().incrementTotalDeposited(value); } function _decrementDeposited(uint value) internal returns (uint _deposited) { _deposited = deposited.sub(value); deposited = _deposited; _manager().decrementTotalDeposited(value); } function _requireManagerNotPaused() internal view { require(!_manager().paused(), "This action cannot be performed while the contract is paused"); } function requireUnpaused() external view { _requireManagerNotPaused(); } /* ========== MUTATIVE FUNCTIONS ========== */ /* ---------- Minting ---------- */ function mint(uint value) external override { require(!_matured() && !_isPaused(), "Minting inactive"); require(msg.sender == ISportPositionalMarketFactory(factory).sportsAMM(), "Invalid minter"); if (value == 0) { return; } _mint(msg.sender, value); if (!isDoubleChance) { _incrementDeposited(value); _manager().transferSusdTo(msg.sender, address(this), value); } } function _mint(address minter, uint amount) internal { if (!optionsInitialized) { _initializeOptions(); } if (isDoubleChance) { options.home.mint(minter, amount); emit Mint(Side.Home, minter, amount); } else { options.home.mint(minter, amount); options.away.mint(minter, amount); emit Mint(Side.Home, minter, amount); emit Mint(Side.Away, minter, amount); if (optionsCount > 2) { options.draw.mint(minter, amount); emit Mint(Side.Draw, minter, amount); } } } function initializeOptions() external override { _initializeOptions(); } function _initializeOptions() internal { require(!optionsInitialized, "already initialized"); address[] memory positions = new address[](optionsCount); for (uint i = 0; i < optionsCount; i++) { positions[i] = address(SportPosition(Clones.clone(ISportPositionalMarketFactory(factory).positionMastercopy()))); } // Instantiate the options themselves options.home = SportPosition(positions[0]); options.away = SportPosition(positions[1]); if (isChild) { require(tags.length > 1, "Child markets must have more then one tag"); if (tags[1] == 10001) { options.home.initialize(_getDetails().gameLabel, "HOME", ISportPositionalMarketFactory(factory).sportsAMM()); options.away.initialize(_getDetails().gameLabel, "AWAY", ISportPositionalMarketFactory(factory).sportsAMM()); } else if (tags[1] == 10002 || tags[1] == 10010) { options.home.initialize(_getDetails().gameLabel, "OVER", ISportPositionalMarketFactory(factory).sportsAMM()); options.away.initialize( _getDetails().gameLabel, "UNDER", ISportPositionalMarketFactory(factory).sportsAMM() ); } } else { options.home.initialize(_getDetails().gameLabel, "HOME", ISportPositionalMarketFactory(factory).sportsAMM()); options.away.initialize(_getDetails().gameLabel, "AWAY", ISportPositionalMarketFactory(factory).sportsAMM()); } if (optionsCount > 2) { options.draw = SportPosition(positions[2]); options.draw.initialize(_getDetails().gameLabel, "DRAW", ISportPositionalMarketFactory(factory).sportsAMM()); } optionsInitialized = true; emit PositionsInitialized( address(this), address(options.home), address(options.away), optionsCount > 2 ? address(options.draw) : address(0) ); } function _hasNotBeenInitialized(IPosition home) internal view returns (bool) { return address(home) == address(0); } /* ---------- Market Resolution ---------- */ function resolve(uint _outcome) external onlyOwner managerNotPaused { require(_outcome <= optionsCount, "Invalid outcome"); if (_outcome == 0) { cancelled = true; cancelTimestamp = block.timestamp; if (!isDoubleChance) { stampOdds(); } } else { require(canResolve(), "Can not resolve market"); } finalResult = _outcome; resolved = true; emit MarketResolved(_result(), deposited, 0, 0); } function stampOdds() internal { uint[] memory odds = new uint[](optionsCount); odds = ITherundownConsumer(creator).getNormalizedOddsForMarket(address(this)); if (odds[0] == 0 || odds[1] == 0) { invalidOdds = true; } homeOddsOnCancellation = odds[0]; awayOddsOnCancellation = odds[1]; drawOddsOnCancellation = optionsCount > 2 ? odds[2] : 0; emit StoredOddsOnCancellation(homeOddsOnCancellation, awayOddsOnCancellation, drawOddsOnCancellation); } /* ---------- Claiming and Exercising Options ---------- */ function exerciseOptions() external override { // The market must be resolved if it has not been. require(resolved, "Unresolved"); require(!_isPaused(), "Paused"); // If the account holds no options, revert. (uint homeBalance, uint awayBalance, uint drawBalance) = _balancesOf(msg.sender); require(homeBalance != 0 || awayBalance != 0 || drawBalance != 0, "Nothing to exercise"); if (isDoubleChance && _canExerciseParentOptions()) { parentMarket.exerciseOptions(); } // Each option only needs to be exercised if the account holds any of it. if (homeBalance != 0) { options.home.exercise(msg.sender); } if (awayBalance != 0) { options.away.exercise(msg.sender); } if (drawBalance != 0) { options.draw.exercise(msg.sender); } uint payout = _getPayout(homeBalance, awayBalance, drawBalance); if (cancelled) { require( block.timestamp > cancelTimestamp.add(_manager().cancelTimeout()) && !invalidOdds, "Unexpired timeout/ invalid odds" ); payout = calculatePayoutOnCancellation(homeBalance, awayBalance, drawBalance); } emit OptionsExercised(msg.sender, payout); if (payout != 0) { if (!isDoubleChance) { _decrementDeposited(payout); } payout = _manager().transformCollateral(payout); ISportsAMM(ISportPositionalMarketFactory(factory).sportsAMM()).sUSD().transfer(msg.sender, payout); } } function _canExerciseParentOptions() internal view returns (bool) { if (!parentMarket.resolved() && !parentMarket.canResolve()) { return false; } (uint homeBalance, uint awayBalance, uint drawBalance) = parentMarket.balancesOf(address(this)); if (homeBalance == 0 && awayBalance == 0 && drawBalance == 0) { return false; } return true; } function _getPayout( uint homeBalance, uint awayBalance, uint drawBalance ) internal view returns (uint payout) { if (isDoubleChance) { if (_result() == Side.Home) { payout = homeBalance; } } else { payout = (_result() == Side.Home) ? homeBalance : awayBalance; if (optionsCount > 2 && _result() != Side.Home) { payout = _result() == Side.Away ? awayBalance : drawBalance; } } } function restoreInvalidOdds( uint _homeOdds, uint _awayOdds, uint _drawOdds ) external override onlyOwner { require(_homeOdds > 0 && _awayOdds > 0, "Invalid odd"); homeOddsOnCancellation = _homeOdds; awayOddsOnCancellation = _awayOdds; drawOddsOnCancellation = optionsCount > 2 ? _drawOdds : 0; invalidOdds = false; emit StoredOddsOnCancellation(homeOddsOnCancellation, awayOddsOnCancellation, drawOddsOnCancellation); } function calculatePayoutOnCancellation( uint _homeBalance, uint _awayBalance, uint _drawBalance ) public view returns (uint payout) { if (!cancelled) { return 0; } else { if (isDoubleChance) { (uint position1Odds, uint position2Odds) = _getParentPositionOdds(); payout = _homeBalance.mul(position1Odds).div(1e18); payout = payout.add(_homeBalance.mul(position2Odds).div(1e18)); } else { payout = _homeBalance.mul(homeOddsOnCancellation).div(1e18); payout = payout.add(_awayBalance.mul(awayOddsOnCancellation).div(1e18)); payout = payout.add(_drawBalance.mul(drawOddsOnCancellation).div(1e18)); } } } /* ---------- Market Expiry ---------- */ function _selfDestruct(address payable beneficiary) internal { uint _deposited = deposited; if (_deposited != 0) { _decrementDeposited(_deposited); } // Transfer the balance rather than the deposit value in case there are any synths left over // from direct transfers. uint balance = ISportsAMM(ISportPositionalMarketFactory(factory).sportsAMM()).sUSD().balanceOf(address(this)); if (balance != 0) { ISportsAMM(ISportPositionalMarketFactory(factory).sportsAMM()).sUSD().transfer(beneficiary, balance); } // Destroy the option tokens before destroying the market itself. options.home.expire(beneficiary); options.away.expire(beneficiary); selfdestruct(beneficiary); } function expire(address payable beneficiary) external onlyOwner { require(_expired(), "Unexpired options remaining"); emit Expired(beneficiary); _selfDestruct(beneficiary); } /* ========== MODIFIERS ========== */ modifier managerNotPaused() { _requireManagerNotPaused(); _; } modifier noDoubleChance() { require(!isDoubleChance, "Not supported for double chance markets"); _; } /* ========== EVENTS ========== */ event Mint(Side side, address indexed account, uint value); event MarketResolved(Side result, uint deposited, uint poolFees, uint creatorFees); event OptionsExercised(address indexed account, uint value); event OptionsBurned(address indexed account, uint value); event Expired(address beneficiary); event StoredOddsOnCancellation(uint homeOdds, uint awayOdds, uint drawOdds); event PauseUpdated(bool _paused); event DatesUpdated(uint256 _maturity, uint256 _expiry); event PositionsInitialized(address _market, address _home, address _away, address _draw); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // Inheritance import "@openzeppelin/contracts-4.4.1/token/ERC20/IERC20.sol"; import "../../interfaces/IPosition.sol"; // Libraries import "@openzeppelin/contracts-4.4.1/utils/math/SafeMath.sol"; // Internal references import "./SportPositionalMarket.sol"; contract SportPosition is IERC20, IPosition { /* ========== LIBRARIES ========== */ using SafeMath for uint; /* ========== STATE VARIABLES ========== */ string public name; string public symbol; uint8 public constant decimals = 18; SportPositionalMarket public market; mapping(address => uint) public override balanceOf; uint public override totalSupply; // The argument order is allowance[owner][spender] mapping(address => mapping(address => uint)) private allowances; // Enforce a 1 cent minimum amount uint internal constant _MINIMUM_AMOUNT = 1e16; address public sportsAMM; /* ========== CONSTRUCTOR ========== */ bool public initialized = false; function initialize( string calldata _name, string calldata _symbol, address _sportsAMM ) external { require(!initialized, "Positional Market already initialized"); initialized = true; name = _name; symbol = _symbol; market = SportPositionalMarket(msg.sender); // add through constructor sportsAMM = _sportsAMM; } function allowance(address owner, address spender) external view override returns (uint256) { if (spender == sportsAMM) { return 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff; } else { return allowances[owner][spender]; } } function _requireMinimumAmount(uint amount) internal pure returns (uint) { require(amount >= _MINIMUM_AMOUNT || amount == 0, "Balance < $0.01"); return amount; } function mint(address minter, uint amount) external onlyMarket { _requireMinimumAmount(amount); totalSupply = totalSupply.add(amount); balanceOf[minter] = balanceOf[minter].add(amount); // Increment rather than assigning since a transfer may have occurred. emit Transfer(address(0), minter, amount); emit Issued(minter, amount); } // This must only be invoked after maturity. function exercise(address claimant) external onlyMarket { uint balance = balanceOf[claimant]; if (balance == 0) { return; } balanceOf[claimant] = 0; totalSupply = totalSupply.sub(balance); emit Transfer(claimant, address(0), balance); emit Burned(claimant, balance); } // This must only be invoked after maturity. function exerciseWithAmount(address claimant, uint amount) external override onlyMarket { require(amount > 0, "Can not exercise zero amount!"); require(balanceOf[claimant] >= amount, "Balance must be greather or equal amount that is burned"); balanceOf[claimant] = balanceOf[claimant] - amount; totalSupply = totalSupply.sub(amount); emit Transfer(claimant, address(0), amount); emit Burned(claimant, amount); } // This must only be invoked after the exercise window is complete. // Note that any options which have not been exercised will linger. function expire(address payable beneficiary) external onlyMarket { selfdestruct(beneficiary); } /* ---------- ERC20 Functions ---------- */ function _transfer( address _from, address _to, uint _value ) internal returns (bool success) { market.requireUnpaused(); require(_to != address(0) && _to != address(this), "Invalid address"); uint fromBalance = balanceOf[_from]; require(_value <= fromBalance, "Insufficient balance"); balanceOf[_from] = fromBalance.sub(_value); balanceOf[_to] = balanceOf[_to].add(_value); emit Transfer(_from, _to, _value); return true; } function transfer(address _to, uint _value) external override returns (bool success) { return _transfer(msg.sender, _to, _value); } function transferFrom( address _from, address _to, uint _value ) external override returns (bool success) { if (msg.sender != sportsAMM) { uint fromAllowance = allowances[_from][msg.sender]; require(_value <= fromAllowance, "Insufficient allowance"); allowances[_from][msg.sender] = fromAllowance.sub(_value); } return _transfer(_from, _to, _value); } function approve(address _spender, uint _value) external override returns (bool success) { require(_spender != address(0)); allowances[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function getBalanceOf(address account) external view override returns (uint) { return balanceOf[account]; } function getTotalSupply() external view override returns (uint) { return totalSupply; } /* ========== MODIFIERS ========== */ modifier onlyMarket() { require(msg.sender == address(market), "Only market allowed"); _; } /* ========== EVENTS ========== */ event Issued(address indexed account, uint value); event Burned(address indexed account, uint value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../interfaces/ISportPositionalMarket.sol"; interface ISportPositionalMarketManager { /* ========== VIEWS / VARIABLES ========== */ function marketCreationEnabled() external view returns (bool); function totalDeposited() external view returns (uint); function numActiveMarkets() external view returns (uint); function activeMarkets(uint index, uint pageSize) external view returns (address[] memory); function numMaturedMarkets() external view returns (uint); function maturedMarkets(uint index, uint pageSize) external view returns (address[] memory); function isActiveMarket(address candidate) external view returns (bool); function isDoubleChanceMarket(address candidate) external view returns (bool); function doesSportSupportDoubleChance(uint _sport) external view returns (bool); function isDoubleChanceSupported() external view returns (bool); function isKnownMarket(address candidate) external view returns (bool); function getActiveMarketAddress(uint _index) external view returns (address); function transformCollateral(uint value) external view returns (uint); function reverseTransformCollateral(uint value) external view returns (uint); function isMarketPaused(address _market) external view returns (bool); function expiryDuration() external view returns (uint); function isWhitelistedAddress(address _address) external view returns (bool); function getOddsObtainer() external view returns (address obtainer); /* ========== MUTATIVE FUNCTIONS ========== */ function createMarket( bytes32 gameId, string memory gameLabel, uint maturity, uint initialMint, // initial sUSD to mint options for, uint positionCount, uint[] memory tags, bool isChild, address parentMarket ) external returns (ISportPositionalMarket); function setMarketPaused(address _market, bool _paused) external; function updateDatesForMarket(address _market, uint256 _newStartTime) external; function resolveMarket(address market, uint outcome) external; function expireMarkets(address[] calldata market) external; function transferSusdTo( address sender, address receiver, uint amount ) external; function queryMintsAndMaturityStatusForPlayerProps(address[] memory _playerPropsMarkets) external view returns ( bool[] memory _hasAnyMintsArray, bool[] memory _isMaturedArray, bool[] memory _isResolvedArray, uint[] memory _maturities ); }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.16; import "../interfaces/IPositionalMarketManager.sol"; import "../interfaces/IPosition.sol"; import "../interfaces/IPriceFeed.sol"; interface ISportPositionalMarket { /* ========== TYPES ========== */ enum Phase { Trading, Maturity, Expiry } enum Side { Cancelled, Home, Away, Draw } /* ========== VIEWS / VARIABLES ========== */ function getOptions() external view returns ( IPosition home, IPosition away, IPosition draw ); function times() external view returns (uint maturity, uint destruction); function getGameDetails() external view returns (bytes32 gameId, string memory gameLabel); function getGameId() external view returns (bytes32); function deposited() external view returns (uint); function optionsCount() external view returns (uint); function creator() external view returns (address); function resolved() external view returns (bool); function cancelled() external view returns (bool); function paused() external view returns (bool); function phase() external view returns (Phase); function canResolve() external view returns (bool); function result() external view returns (Side); function isChild() external view returns (bool); function optionsInitialized() external view returns (bool); function tags(uint idx) external view returns (uint); function getTags() external view returns (uint tag1, uint tag2); function getTagsLength() external view returns (uint tagsLength); function getParentMarketPositions() external view returns (IPosition position1, IPosition position2); function getParentMarketPositionsUint() external view returns (uint position1, uint position2); function getStampedOdds() external view returns ( uint, uint, uint ); function balancesOf(address account) external view returns ( uint home, uint away, uint draw ); function totalSupplies() external view returns ( uint home, uint away, uint draw ); function isDoubleChance() external view returns (bool); function parentMarket() external view returns (ISportPositionalMarket); /* ========== MUTATIVE FUNCTIONS ========== */ function setPaused(bool _paused) external; function updateDates(uint256 _maturity, uint256 _expiry) external; function mint(uint value) external; function exerciseOptions() external; function restoreInvalidOdds( uint _homeOdds, uint _awayOdds, uint _drawOdds ) external; function initializeOptions() external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface ITherundownConsumer { struct GameCreate { bytes32 gameId; uint256 startTime; int24 homeOdds; int24 awayOdds; int24 drawOdds; string homeTeam; string awayTeam; } // view functions function supportedSport(uint _sportId) external view returns (bool); function gameOnADate(bytes32 _gameId) external view returns (uint); function isGameResolvedOrCanceled(bytes32 _gameId) external view returns (bool); function getNormalizedOddsForMarket(address _market) external view returns (uint[] memory); function getGamesPerDatePerSport(uint _sportId, uint _date) external view returns (bytes32[] memory); function getGamePropsForOdds(address _market) external view returns ( uint, uint, bytes32 ); function gameIdPerMarket(address _market) external view returns (bytes32); function getGameCreatedById(bytes32 _gameId) external view returns (GameCreate memory); function isChildMarket(address _market) external view returns (bool); function gameFulfilledCreated(bytes32 _gameId) external view returns (bool); function playerProps() external view returns (address); function oddsObtainer() external view returns (address); // write functions function fulfillGamesCreated( bytes32 _requestId, bytes[] memory _games, uint _sportsId, uint _date ) external; function fulfillGamesResolved( bytes32 _requestId, bytes[] memory _games, uint _sportsId ) external; function fulfillGamesOdds(bytes32 _requestId, bytes[] memory _games) external; function setPausedByCanceledStatus(address _market, bool _flag) external; function setGameIdPerChildMarket(bytes32 _gameId, address _child) external; function pauseOrUnpauseMarket(address _market, bool _pause) external; function pauseOrUnpauseMarketForPlayerProps( address _market, bool _pause, bool _invalidOdds, bool _circuitBreakerMain ) external; function setChildMarkets( bytes32 _gameId, address _main, address _child, bool _isSpread, int16 _spreadHome, uint24 _totalOver ) external; function resolveMarketManually( address _market, uint _outcome, uint8 _homeScore, uint8 _awayScore, bool _usebackupOdds ) external; function getOddsForGame(bytes32 _gameId) external view returns ( int24, int24, int24 ); function sportsIdPerGame(bytes32 _gameId) external view returns (uint); function getGameStartTime(bytes32 _gameId) external view returns (uint256); function getLastUpdatedFromGameResolve(bytes32 _gameId) external view returns (uint40); function marketPerGameId(bytes32 _gameId) external view returns (address); function marketResolved(address _market) external view returns (bool); function marketCanceled(address _market) external view returns (bool); function invalidOdds(address _market) external view returns (bool); function isPausedByCanceledStatus(address _market) external view returns (bool); function isSportOnADate(uint _date, uint _sportId) external view returns (bool); function isSportTwoPositionsSport(uint _sportsId) external view returns (bool); function marketForTeamName(string memory _teamName) external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; import "../../utils/AddressUpgradeable.sol"; /** * @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 a proxied contract can't have 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. * * 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 initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IGamesOddsObtainer { struct GameOdds { bytes32 gameId; int24 homeOdds; int24 awayOdds; int24 drawOdds; int16 spreadHome; int24 spreadHomeOdds; int16 spreadAway; int24 spreadAwayOdds; uint24 totalOver; int24 totalOverOdds; uint24 totalUnder; int24 totalUnderOdds; } // view function getActiveChildMarketsFromParent(address _parent) external view returns (address, address); function getSpreadTotalsChildMarketsFromParent(address _parent) external view returns ( uint numOfSpreadMarkets, address[] memory spreadMarkets, uint numOfTotalsMarkets, address[] memory totalMarkets ); function areOddsValid( bytes32 _gameId, bool _useBackup, bool _isTwoPositional ) external view returns (bool); function invalidOdds(address _market) external view returns (bool); function playersReportTimestamp(address _market) external view returns (uint); function getNormalizedOdds(bytes32 _gameId) external view returns (uint[] memory); function getNormalizedOddsForMarket(address _market) external view returns (uint[] memory); function getOddsForGames(bytes32[] memory _gameIds) external view returns (int24[] memory odds); function mainMarketChildMarketIndex(address _main, uint _index) external view returns (address); function numberOfChildMarkets(address _main) external view returns (uint); function mainMarketSpreadChildMarket(address _main, int16 _spread) external view returns (address); function mainMarketTotalChildMarket(address _main, uint24 _total) external view returns (address); function childMarketMainMarket(address _market) external view returns (address); function childMarketTotal(address _market) external view returns (uint24); function currentActiveTotalChildMarket(address _main) external view returns (address); function currentActiveSpreadChildMarket(address _main) external view returns (address); function isSpreadChildMarket(address _child) external view returns (bool); function childMarketCreated(address _child) external view returns (bool); function getOddsForGame(bytes32 _gameId) external view returns ( int24, int24, int24, int24, int24, int24, int24 ); function getLinesForGame(bytes32 _gameId) external view returns ( int16, int16, uint24, uint24 ); // executable function obtainOdds( bytes32 requestId, GameOdds memory _game, uint _sportId, address _main, bool _isTwoPositional, bool _isPlayersReport ) external; function setFirstOdds( bytes32 _gameId, int24 _homeOdds, int24 _awayOdds, int24 _drawOdds ) external; function setFirstNormalizedOdds(bytes32 _gameId, address _market) external; function setBackupOddsAsMainOddsForGame(bytes32 _gameId) external; function pauseUnpauseChildMarkets(address _main, bool _flag) external; function pauseUnpauseCurrentActiveChildMarket( bytes32 _gameId, address _main, bool _flag ) external; function resolveChildMarkets( address _market, uint _outcome, uint8 _homeScore, uint8 _awayScore ) external; function setChildMarketGameId(bytes32 gameId, address market) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IGamesPlayerProps { struct PlayerProps { bytes32 gameId; bytes32 playerId; uint8 option; string playerName; uint16 line; int24 overOdds; int24 underOdds; } struct PlayerPropsResolver { bytes32 gameId; bytes32 playerId; uint8 option; uint16 score; uint8 statusId; } function obtainPlayerProps(PlayerProps memory _player, uint _sportId) external; function resolvePlayerProps(PlayerPropsResolver memory _result) external; function cancelMarketFromManager(address _market) external; function pauseAllPlayerPropsMarketForMain( address _main, bool _flag, bool _invalidOddsOnMain, bool _circuitBreakerMain ) external; function createFulfilledForPlayerProps( bytes32 gameId, bytes32 playerId, uint8 option ) external view returns (bool); function cancelPlayerPropsMarketForMain(address _main) external; function getNormalizedOddsForMarket(address _market) external view returns (uint[] memory); function mainMarketChildMarketIndex(address _main, uint _index) external view returns (address); function numberOfChildMarkets(address _main) external view returns (uint); function doesSportSupportPlayerProps(uint _sportId) external view returns (bool); function pausedByInvalidOddsOnMain(address _main) external view returns (bool); function pausedByCircuitBreakerOnMain(address _main) external view returns (bool); function playerIdPerChildMarket(address _market) external view returns (bytes32); function optionIdPerChildMarket(address _market) external view returns (uint8); function getAllOptionsWithPlayersForGameId(bytes32 _gameId) external view returns ( bytes32[] memory _playerIds, uint8[] memory _options, bool[] memory _isResolved, address[][] memory _childMarketsPerOption ); function getPlayerPropsDataForMarket(address _market) external view returns ( address, bytes32, bytes32, uint8 ); function getPlayerPropForOption( bytes32 gameId, bytes32 playerId, uint8 option ) external view returns ( uint16, int24, int24, bool ); function fulfillPlayerPropsCLResolved(bytes[] memory _playerProps) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IGameChildMarket { function mainMarketChildMarketIndex(address _main, uint _index) external view returns (address); function numberOfChildMarkets(address _main) external view returns (uint); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (proxy/Clones.sol) pragma solidity ^0.8.0; /** * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for * deploying minimal proxy contracts, also known as "clones". * * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies * > a minimal bytecode implementation that delegates all calls to a known, fixed address. * * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2` * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the * deterministic method. * * _Available since v3.4._ */ library Clones { /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create opcode, which should never revert. */ function clone(address implementation) internal returns (address instance) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) instance := create(0, ptr, 0x37) } require(instance != address(0), "ERC1167: create failed"); } /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create2 opcode and a `salt` to deterministically deploy * the clone. Using the same `implementation` and `salt` multiple time will revert, since * the clones cannot be deployed twice at the same address. */ function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) instance := create2(0, ptr, 0x37, salt) } require(instance != address(0), "ERC1167: create2 failed"); } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress( address implementation, bytes32 salt, address deployer ) internal pure returns (address predicted) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000) mstore(add(ptr, 0x38), shl(0x60, deployer)) mstore(add(ptr, 0x4c), salt) mstore(add(ptr, 0x6c), keccak256(ptr, 0x37)) predicted := keccak256(add(ptr, 0x37), 0x55) } } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress(address implementation, bytes32 salt) internal view returns (address predicted) { return predictDeterministicAddress(implementation, salt, address(this)); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.16; import "./IPositionalMarket.sol"; interface IPosition { /* ========== VIEWS / VARIABLES ========== */ function getBalanceOf(address account) external view returns (uint); function getTotalSupply() external view returns (uint); function exerciseWithAmount(address claimant, uint amount) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.16; import "../interfaces/IPositionalMarketManager.sol"; import "../interfaces/IPosition.sol"; import "../interfaces/IPriceFeed.sol"; interface IPositionalMarket { /* ========== TYPES ========== */ enum Phase { Trading, Maturity, Expiry } enum Side { Up, Down } /* ========== VIEWS / VARIABLES ========== */ function getOptions() external view returns (IPosition up, IPosition down); function times() external view returns (uint maturity, uint destructino); function getOracleDetails() external view returns ( bytes32 key, uint strikePrice, uint finalPrice ); function fees() external view returns (uint poolFee, uint creatorFee); function deposited() external view returns (uint); function creator() external view returns (address); function resolved() external view returns (bool); function phase() external view returns (Phase); function oraclePrice() external view returns (uint); function oraclePriceAndTimestamp() external view returns (uint price, uint updatedAt); function canResolve() external view returns (bool); function result() external view returns (Side); function balancesOf(address account) external view returns (uint up, uint down); function totalSupplies() external view returns (uint up, uint down); function getMaximumBurnable(address account) external view returns (uint amount); /* ========== MUTATIVE FUNCTIONS ========== */ function mint(uint value) external; function exerciseOptions() external returns (uint); function burnOptions(uint amount) external; function burnOptionsMaximum() external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.16; import "../interfaces/IPositionalMarket.sol"; interface IPositionalMarketManager { /* ========== VIEWS / VARIABLES ========== */ function durations() external view returns (uint expiryDuration, uint maxTimeToMaturity); function capitalRequirement() external view returns (uint); function marketCreationEnabled() external view returns (bool); function onlyAMMMintingAndBurning() external view returns (bool); function transformCollateral(uint value) external view returns (uint); function reverseTransformCollateral(uint value) external view returns (uint); function totalDeposited() external view returns (uint); function numActiveMarkets() external view returns (uint); function activeMarkets(uint index, uint pageSize) external view returns (address[] memory); function numMaturedMarkets() external view returns (uint); function maturedMarkets(uint index, uint pageSize) external view returns (address[] memory); function isActiveMarket(address candidate) external view returns (bool); function isKnownMarket(address candidate) external view returns (bool); function getThalesAMM() external view returns (address); /* ========== MUTATIVE FUNCTIONS ========== */ function createMarket( bytes32 oracleKey, uint strikePrice, uint maturity, uint initialMint // initial sUSD to mint options for, ) external returns (IPositionalMarket); function resolveMarket(address market) external; function expireMarkets(address[] calldata market) external; function transferSusdTo( address sender, address receiver, uint amount ) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.16; interface IPriceFeed { // Structs struct RateAndUpdatedTime { uint216 rate; uint40 time; } // Mutative functions function addAggregator(bytes32 currencyKey, address aggregatorAddress) external; function removeAggregator(bytes32 currencyKey) external; // Views function rateForCurrency(bytes32 currencyKey) external view returns (uint); function rateAndUpdatedTime(bytes32 currencyKey) external view returns (uint rate, uint time); function getRates() external view returns (uint[] memory); function getCurrencies() external view returns (bytes32[] memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract OwnedWithInit { address public owner; address public nominatedOwner; constructor() {} function initOwner(address _owner) internal { require(owner == address(0), "Init can only be called when owner is 0"); owner = _owner; emit OwnerChanged(address(0), _owner); } function nominateNewOwner(address _owner) external onlyOwner { nominatedOwner = _owner; emit OwnerNominated(_owner); } function acceptOwnership() external { require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership"); emit OwnerChanged(owner, nominatedOwner); owner = nominatedOwner; nominatedOwner = address(0); } modifier onlyOwner { _onlyOwner(); _; } function _onlyOwner() private view { require(msg.sender == owner, "Only the contract owner may perform this action"); } event OwnerNominated(address newOwner); event OwnerChanged(address oldOwner, address newOwner); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../interfaces/ISportAMMRiskManager.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; interface ISportsAMM { /* ========== VIEWS / VARIABLES ========== */ enum Position { Home, Away, Draw } struct SellRequirements { address user; address market; Position position; uint amount; uint expectedPayout; uint additionalSlippage; } function theRundownConsumer() external view returns (address); function riskManager() external view returns (ISportAMMRiskManager riskManager); function getMarketDefaultOdds(address _market, bool isSell) external view returns (uint[] memory); function isMarketInAMMTrading(address _market) external view returns (bool); function isMarketForSportOnePositional(uint _tag) external view returns (bool); function availableToBuyFromAMM(address market, Position position) external view returns (uint _available); function parlayAMM() external view returns (address); function minSupportedOdds() external view returns (uint); function maxSupportedOdds() external view returns (uint); function minSupportedOddsPerSport(uint) external view returns (uint); function min_spread() external view returns (uint); function max_spread() external view returns (uint); function minimalTimeLeftToMaturity() external view returns (uint); function getSpentOnGame(address market) external view returns (uint); function safeBoxImpact() external view returns (uint); function manager() external view returns (address); function getLiquidityPool() external view returns (address); function sUSD() external view returns (IERC20Upgradeable); function buyFromAMM( address market, Position position, uint amount, uint expectedPayout, uint additionalSlippage ) external; function buyFromAmmQuote( address market, Position position, uint amount ) external view returns (uint); function buyFromAmmQuoteForParlayAMM( address market, Position position, uint amount ) external view returns (uint); function updateParlayVolume(address _account, uint _amount) external; function buyPriceImpact( address market, ISportsAMM.Position position, uint amount ) external view returns (int impact); function obtainOdds(address _market, ISportsAMM.Position _position) external view returns (uint oddsToReturn); function buyFromAmmQuoteWithDifferentCollateral( address market, ISportsAMM.Position position, uint amount, address collateral ) external view returns (uint collateralQuote, uint sUSDToPay); function availableToBuyFromAMMWithBaseOdds( address market, ISportsAMM.Position position, uint baseOdds, uint balance, bool useBalance ) external view returns (uint availableAmount); function floorBaseOdds(uint baseOdds, address market) external view returns (uint); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface ISportPositionalMarketFactory { function sportsAMM() external view returns (address); function positionMastercopy() external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface ISportAMMRiskManager { function calculateCapToBeUsed(address _market) external view returns (uint toReturn); function isTotalSpendingLessThanTotalRisk(uint _totalSpent, address _market) external view returns (bool _isNotRisky); function isMarketForSportOnePositional(uint _tag) external view returns (bool); function isMarketForPlayerPropsOnePositional(uint _tag) external view returns (bool); function minSupportedOddsPerSport(uint tag) external view returns (uint); function minSpreadPerSport(uint tag1, uint tag2) external view returns (uint); function maxSpreadPerSport(uint tag) external view returns (uint); function getMinSpreadToUse( bool useDefaultMinSpread, address market, uint min_spread, uint min_spreadPerAddress ) external view returns (uint); function getMaxSpreadForMarket(address _market, uint max_spread) external view returns (uint); function getMinOddsForMarket(address _market, uint minSupportedOdds) external view returns (uint minOdds); function getCapAndMaxSpreadForMarket(address _market, uint max_spread) external view returns (uint, uint); function getCapMaxSpreadAndMinOddsForMarket( address _market, uint max_spread, uint minSupportedOdds ) external view returns ( uint cap, uint maxSpread, uint minOddsForMarket ); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_whitelistAddress","type":"address"},{"indexed":false,"internalType":"bool","name":"_flag","type":"bool"}],"name":"AddedIntoWhitelist","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"CreatorCapitalRequirementUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_market","type":"address"},{"indexed":false,"internalType":"uint256","name":"_newStartTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_expiry","type":"uint256"}],"name":"DatesUpdatedForMarket","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_parentMarket","type":"address"},{"indexed":false,"internalType":"address","name":"_doubleChanceMarket","type":"address"},{"indexed":false,"internalType":"uint256","name":"tag","type":"uint256"},{"indexed":false,"internalType":"string","name":"label","type":"string"}],"name":"DoubleChanceMarketCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"_isDoubleChanceSupported","type":"bool"}],"name":"DoubleChanceSupportChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"}],"name":"ExpiryDurationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"market","type":"address"},{"indexed":true,"internalType":"address","name":"creator","type":"address"},{"indexed":true,"internalType":"bytes32","name":"gameId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"maturityDate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"expiryDate","type":"uint256"},{"indexed":false,"internalType":"address","name":"up","type":"address"},{"indexed":false,"internalType":"address","name":"down","type":"address"},{"indexed":false,"internalType":"address","name":"draw","type":"address"}],"name":"MarketCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"}],"name":"MarketCreationEnabledUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"market","type":"address"}],"name":"MarketExpired","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"market","type":"address"},{"indexed":false,"internalType":"string","name":"gameLabel","type":"string"}],"name":"MarketLabel","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract SportPositionalMarketManager","name":"receivingManager","type":"address"},{"indexed":false,"internalType":"contract SportPositionalMarket[]","name":"markets","type":"address[]"}],"name":"MarketsMigrated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract SportPositionalMarketManager","name":"migratingManager","type":"address"},{"indexed":false,"internalType":"contract SportPositionalMarket[]","name":"markets","type":"address[]"}],"name":"MarketsReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"}],"name":"MaxTimeToMaturityUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_market","type":"address"},{"indexed":false,"internalType":"uint256","name":"_homeOdds","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_awayOdds","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_drawOdds","type":"uint256"}],"name":"OddsForMarketRestored","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isPaused","type":"bool"}],"name":"PauseChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"migratingManager","type":"address"}],"name":"SetMigratingManager","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_obratiner","type":"address"}],"name":"SetObtainerAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_playerProps","type":"address"}],"name":"SetPlayerPropsAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_sportPositionalMarketFactory","type":"address"}],"name":"SetSportPositionalMarketFactory","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"theRundownConsumer","type":"address"}],"name":"SetTherundownConsumer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_address","type":"address"}],"name":"SetsUSD","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_sportId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"_isSupported","type":"bool"}],"name":"SupportedSportForDoubleChanceAdded","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"pageSize","type":"uint256"}],"name":"activeMarkets","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_parents","type":"address[]"}],"name":"cancelMarketsForParents","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_playerPropsMarkets","type":"address[]"}],"name":"cancelMarketsForPlayerProps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cancelTimeout","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"}],"name":"createDoubleChanceMarketsForParent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"gameId","type":"bytes32"},{"internalType":"string","name":"gameLabel","type":"string"},{"internalType":"uint256","name":"maturity","type":"uint256"},{"internalType":"uint256","name":"initialMint","type":"uint256"},{"internalType":"uint256","name":"positionCount","type":"uint256"},{"internalType":"uint256[]","name":"tags","type":"uint256[]"},{"internalType":"bool","name":"isChild","type":"bool"},{"internalType":"address","name":"parentMarket","type":"address"}],"name":"createMarket","outputs":[{"internalType":"contract ISportPositionalMarket","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"customMarketCreationEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"delta","type":"uint256"}],"name":"decrementTotalDeposited","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"doesSportSupportDoubleChance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"doubleChanceMarketsByParent","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"markets","type":"address[]"}],"name":"expireMarkets","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"expiryDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getActiveMarketAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"}],"name":"getDoubleChanceMarketsByParentMarket","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOddsObtainer","outputs":[{"internalType":"address","name":"obtainer","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"delta","type":"uint256"}],"name":"incrementTotalDeposited","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"contract IERC20","name":"_sUSD","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"candidate","type":"address"}],"name":"isActiveMarket","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isDoubleChance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"candidate","type":"address"}],"name":"isDoubleChanceMarket","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isDoubleChanceSupported","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"candidate","type":"address"}],"name":"isKnownMarket","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_market","type":"address"}],"name":"isMarketPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"isWhitelistedAddress","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastPauseTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"marketCreationEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"pageSize","type":"uint256"}],"name":"maturedMarkets","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"needsTransformingCollateral","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nominatedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numActiveMarkets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numMaturedMarkets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oddsObtainer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"},{"internalType":"uint256","name":"_outcome","type":"uint256"}],"name":"overrideResolveWithCancel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"playerProps","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_parents","type":"address[]"}],"name":"queryMintsAndMaturityStatusForParents","outputs":[{"internalType":"bool[]","name":"_hasAnyMintsArray","type":"bool[]"},{"internalType":"bool[]","name":"_isMaturedArray","type":"bool[]"},{"internalType":"bool[]","name":"_isResolvedArray","type":"bool[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_playerPropsMarkets","type":"address[]"}],"name":"queryMintsAndMaturityStatusForPlayerProps","outputs":[{"internalType":"bool[]","name":"_hasAnyMintsArray","type":"bool[]"},{"internalType":"bool[]","name":"_isMaturedArray","type":"bool[]"},{"internalType":"bool[]","name":"_isResolvedArray","type":"bool[]"},{"internalType":"uint256[]","name":"_maturities","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"},{"internalType":"uint256","name":"_outcome","type":"uint256"}],"name":"resolveMarket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_market","type":"address"},{"internalType":"uint256","name":"_outcome","type":"uint256"},{"internalType":"uint8","name":"_homeScore","type":"uint8"},{"internalType":"uint8","name":"_awayScore","type":"uint8"},{"internalType":"address","name":"_consumer","type":"address"},{"internalType":"bool","name":"_useBackupOdds","type":"bool"}],"name":"resolveMarketWithResult","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_market","type":"address"},{"internalType":"uint256","name":"_homeOdds","type":"uint256"},{"internalType":"uint256","name":"_awayOdds","type":"uint256"},{"internalType":"uint256","name":"_drawOdds","type":"uint256"}],"name":"restoreInvalidOddsForMarket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"reverseTransformCollateral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sUSD","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cancelTimeout","type":"uint256"}],"name":"setCancelTimeout","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_expiryDuration","type":"uint256"}],"name":"setExpiryDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isDoubleChanceSupported","type":"bool"}],"name":"setIsDoubleChanceSupported","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"enabled","type":"bool"}],"name":"setMarketCreationEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_market","type":"address"},{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setMarketPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_needsTransformingCollateral","type":"bool"}],"name":"setNeedsTransformingCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_oddsObtainer","type":"address"}],"name":"setOddsObtainer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_playerProps","type":"address"}],"name":"setPlayerProps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_sportPositionalMarketFactory","type":"address"}],"name":"setSportPositionalMarketFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_sportIds","type":"uint256[]"},{"internalType":"bool","name":"_isSupported","type":"bool"}],"name":"setSupportedSportForDoubleChance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_theRundownConsumer","type":"address"}],"name":"setTherundownConsumer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_whitelistedAddresses","type":"address[]"},{"internalType":"bool","name":"_flag","type":"bool"},{"internalType":"uint8","name":"_group","type":"uint8"}],"name":"setWhitelistedAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"setsUSD","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sportPositionalMarketFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"theRundownConsumer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDeposited","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"proxyAddress","type":"address"}],"name":"transferOwnershipAtInit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferSusdTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transformCollateral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_market","type":"address"},{"internalType":"uint256","name":"_newStartTime","type":"uint256"}],"name":"updateDatesForMarket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedAddresses","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedCancelAddresses","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50615bcb80620000216000396000f3fe608060405234801561001057600080fd5b50600436106104075760003560e01c80637fdb733f11610220578063b91f5e3511610130578063e62b8889116100b8578063f65d145411610087578063f65d145414610937578063fab44cbb1461095a578063fb6cede61461096d578063ff50abdc1461098f578063ffbc538a1461099857600080fd5b8063e62b8889146108eb578063e73efc9b146108fe578063ed7afdec14610911578063edc892e11461092457600080fd5b8063c6e9e7d7116100ff578063c6e9e7d714610892578063cf7fb264146108a5578063dd5adfa3146108b8578063e116ee5a146108cb578063e28c130b146108d857600080fd5b8063b91f5e3514610846578063bb96af6514610859578063c014fb841461086c578063c3b83f5f1461087f57600080fd5b80639418f6c7116101b3578063aeab584911610182578063aeab5849146107f3578063b037c8e514610806578063b162e06114610819578063b3ee14241461082a578063b908feb21461083357600080fd5b80639418f6c7146107a25780639eb5d8b4146107c5578063ac60c486146107d8578063ad6b22ce146107e057600080fd5b80638da5cb5b116101ef5780638da5cb5b146107595780638fe812b41461077257806391b4ded9146107865780639324cac71461078f57600080fd5b80637fdb733f146106fd57806385f2a72e1461071057806389c6318d146107235780638d924e731461073657600080fd5b80633c5a2ef01161031b5780635fae0576116102ae5780636b3a09841161027d5780636b3a0984146106a95780636ec38a4e146106bc57806371943de3146106cf57806379ba5097146106e25780637f8c2d61146106ea57600080fd5b80635fae05761461063157806364af2d871461065d57806368c7f2161461066a5780636a5fd5661461067d57600080fd5b806355f14427116102ea57806355f14427146105db5780635c975abb146105ee5780635d7fb8e2146105fb5780635e7ba7101461060e57600080fd5b80633c5a2ef01461058f578063485cc955146105a25780634cde32ce146105b557806353a47bb7146105c857600080fd5b80631627540c1161039e57806317fd849a1161036d57806317fd849a1461053a57806321a92a271461054d57806327d31e3b146105605780633744734d1461057357806339ab4c411461057c57600080fd5b80631627540c146104c957806316c38b3c146104dc578063172653eb146104ef57806317eaaa4a1461050f57600080fd5b80630def299d116103da5780630def299d1461047e5780630e429aeb1461049157806313af4035146104a357806315502840146104b657600080fd5b806302610c501461040c57806306c933d8146104235780630b3be3f3146104565780630c863e061461046b575b600080fd5b6007545b6040519081526020015b60405180910390f35b610446610431366004615178565b600f6020526000908152604090205460ff1681565b604051901515815260200161041a565b610469610464366004615178565b6109ab565b005b610469610479366004615178565b610a08565b61046961048c3660046153d0565b610a5e565b60055461044690610100900460ff1681565b6104696104b1366004615178565b610c14565b6104696104c4366004615645565b610d48565b6104696104d7366004615178565b610d85565b6104696104ea3660046154af565b610ddb565b6105026104fd366004615178565b610e51565b60405161041a91906157db565b61052261051d366004615255565b610e62565b6040516001600160a01b03909116815260200161041a565b610410610548366004615645565b610e9a565b61046961055b366004615178565b610ec7565b61046961056e36600461536d565b61124b565b61041060115481565b61046961058a3660046154af565b611560565b600e54610522906001600160a01b031681565b6104696105b0366004615228565b6115b9565b6105226105c33660046154ff565b6116bf565b600154610522906001600160a01b031681565b6104696105e9366004615645565b6118e7565b6003546104469060ff1681565b601854610522906001600160a01b031681565b61044661061c366004615178565b60126020526000908152604090205460ff1681565b61044661063f366004615178565b6001600160a01b03166000908152600f602052604090205460ff1690565b6005546104469060ff1681565b610469610678366004615178565b6118f4565b61044661068b366004615178565b6001600160a01b031660009081526014602052604090205460ff1690565b6104696106b7366004615645565b61194a565b6104466106ca366004615178565b6119df565b6104696106dd366004615178565b611a6b565b610469611ac1565b6104696106f83660046151f0565b611bbe565b61046961070b3660046153d0565b611d7e565b61046961071e366004615178565b611f35565b61050261073136600461565d565b611f8b565b6107496107443660046153d0565b611fa0565b60405161041a9493929190615861565b600054610522906201000090046001600160a01b031681565b600e5461044690600160a01b900460ff1681565b61041060025481565b600c54610522906001600160a01b031681565b6104466107b0366004615178565b60146020526000908152604090205460ff1681565b6104696107d3366004615255565b612230565b600954610410565b601354610522906001600160a01b031681565b610469610801366004615645565b6122f0565b6104696108143660046152ba565b612382565b6013546001600160a01b0316610522565b61041060045481565b6104696108413660046151b0565b61250e565b610469610854366004615255565b612644565b600d54610522906001600160a01b031681565b61046961087a36600461532e565b613040565b61046961088d366004615178565b613190565b6104696108a0366004615280565b6132a9565b6104466108b3366004615178565b61344b565b6105226108c6366004615645565b6134be565b6015546104469060ff1681565b6104696108e636600461546b565b613510565b6104466108f9366004615178565b613640565b61050261090c36600461565d565b61365e565b61046961091f366004615255565b61366c565b610410610932366004615645565b613b25565b610446610945366004615645565b60176020526000908152604090205460ff1681565b6104696109683660046154af565b613b30565b61098061097b3660046153d0565b613b56565b60405161041a93929190615828565b61041060065481565b6104696109a63660046154af565b613d63565b6109b3613dac565b600c80546001600160a01b0319166001600160a01b0383169081179091556040519081527fbae3da9b16d7b09b9f1a0d00cb2fafc0f94895fde1e0e2d9e31529efa028da06906020015b60405180910390a150565b610a10613dac565b601380546001600160a01b0319166001600160a01b0383169081179091556040519081527fabcd3d442bfb8eed13cda6bd397d12a7a75f9d4b9d85df42729d6470fab78503906020016109fd565b60005b8151811015610c105760146000838381518110610a8e57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff1615610adb5760405162461bcd60e51b8152600401610ad29061590c565b60405180910390fd5b600080610b0e848481518110610b0157634e487b7160e01b600052603260045260246000fd5b6020026020010151613e26565b9150915081158015610b205750428111155b8015610b595750610b57848481518110610b4a57634e487b7160e01b600052603260045260246000fd5b6020026020010151613f1e565b155b15610bfb5760185484516001600160a01b0390911690635938541f90869086908110610b9557634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b8152600401610bc891906001600160a01b0391909116815260200190565b600060405180830381600087803b158015610be257600080fd5b505af1158015610bf6573d6000803e3d6000fd5b505050505b50508080610c0890615b2b565b915050610a61565b5050565b6001600160a01b038116610c6a5760405162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f742062652030000000000000006044820152606401610ad2565b600154600160a01b900460ff1615610cd65760405162461bcd60e51b815260206004820152602960248201527f416c726561647920696e697469616c697a65642c20757365206e6f6d696e617460448201526832a732bba7bbb732b960b91b6064820152608401610ad2565b6001805460ff60a01b1916600160a01b179055600080546001600160a01b03831662010000810262010000600160b01b03199092169190911782556040805192835260208301919091527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91016109fd565b610d50613dac565b60048190556040518181527ff378a0fd4ad3ffd9d7d50986f16b04acd2dc42691c4f412f34e8eefe883e6652906020016109fd565b610d8d613dac565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce22906020016109fd565b610de3613dac565b60035460ff1615158115151415610df75750565b6003805460ff191682151590811790915560ff1615610e1557426002555b60035460405160ff909116151581527f8fb6c181ee25a520cf3dd6565006ef91229fcfe5a989566c2a3b8c115570cec5906020016109fd565b50565b6060610e5c82613f59565b92915050565b60166020528160005260406000208181548110610e7e57600080fd5b6000918252602090912001546001600160a01b03169150829050565b600e54600090600160a01b900460ff1615610ebe57610e5c8264e8d4a51000615af5565b5090565b919050565b60035460ff1615610eea5760405162461bcd60e51b8152600401610ad290615953565b610ef2613dac565b60055460ff16610f445760405162461bcd60e51b815260206004820152601b60248201527f4d61726b6574206372656174696f6e2069732064697361626c656400000000006044820152606401610ad2565b60155460ff16610f965760405162461bcd60e51b815260206004820152601b60248201527f446f75626c65206368616e6365206e6f7420737570706f7274656400000000006044820152606401610ad2565b60008190506002816001600160a01b0316631a1dbabb6040518163ffffffff1660e01b815260040160206040518083038186803b158015610fd657600080fd5b505afa158015610fea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061100e91906154e7565b116110665760405162461bcd60e51b815260206004820152602260248201527f4e6f7420737570706f7274656420666f722032206f7074696f6e73206d61726b604482015261195d60f21b6064820152608401610ad2565b600080826001600160a01b0316639e3b34bf6040518163ffffffff1660e01b8152600401604080518083038186803b1580156110a157600080fd5b505afa1580156110b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d9919061567e565b91509150611245836001600160a01b03166302d05d3f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561111957600080fd5b505afa15801561112d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111519190615194565b846001600160a01b031663c0bd83516040518163ffffffff1660e01b815260040160206040518083038186803b15801561118a57600080fd5b505afa15801561119e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c291906154e7565b6040516308208aaf60e21b8152600060048201528590859089906001600160a01b038a16906320822abc9060240160206040518083038186803b15801561120857600080fd5b505afa15801561121c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124091906154e7565b614080565b50505050565b611253613dac565b826112ae5760405162461bcd60e51b815260206004820152602560248201527f57686974656c6973746564206164647265737365732063616e6e6f7420626520604482015264656d70747960d81b6064820152608401610ad2565b60005b83811015611559578160ff166001141561140057821515600f60008787858181106112ec57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906113019190615178565b6001600160a01b0316815260208101919091526040016000205460ff161515146114005782600f600087878581811061134a57634e487b7160e01b600052603260045260246000fd5b905060200201602081019061135f9190615178565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790557f58d7a3ccc34541e162fcfc87b84be7b78c34d1e1e7f15de6e4dd67d0fe70aecd8585838181106113c857634e487b7160e01b600052603260045260246000fd5b90506020020160208101906113dd9190615178565b604080516001600160a01b03909216825285151560208301520160405180910390a15b8160ff1660021415611547578215156012600087878581811061143357634e487b7160e01b600052603260045260246000fd5b90506020020160208101906114489190615178565b6001600160a01b0316815260208101919091526040016000205460ff1615151461154757826012600087878581811061149157634e487b7160e01b600052603260045260246000fd5b90506020020160208101906114a69190615178565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790557f58d7a3ccc34541e162fcfc87b84be7b78c34d1e1e7f15de6e4dd67d0fe70aecd85858381811061150f57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906115249190615178565b604080516001600160a01b03909216825285151560208301520160405180910390a15b8061155181615b2b565b9150506112b1565b5050505050565b611568613dac565b60055460ff16151581151514610e4e576005805460ff19168215159081179091556040519081527fcc590b6309435383b617aaa0cae6aba938f2ee471cfb539201dd7655a23caff9906020016109fd565b600054610100900460ff166115d45760005460ff16156115d8565b303b155b61163b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610ad2565b600054610100900460ff1615801561165d576000805461ffff19166101011790555b61166683610c14565b600c80546001600160a01b0319166001600160a01b0384161790556000805462010000600160b01b0319163362010000021790556005805461ffff1916600117905580156116ba576000805461ff00191690555b505050565b60035460009060ff16156116e55760405162461bcd60e51b8152600401610ad290615953565b60055460ff166117375760405162461bcd60e51b815260206004820152601b60248201527f4d61726b6574206372656174696f6e2069732064697361626c656400000000006044820152606401610ad2565b600d546001600160a01b031633148061175a57506013546001600160a01b031633145b8061176f57506018546001600160a01b031633145b6117ad5760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b21031b932b0ba37b960891b6044820152606401610ad2565b60006117c46004548961443590919063ffffffff16565b90508742106118155760405162461bcd60e51b815260206004820181905260248201527f4d617475726974792068617320746f20626520696e20746865206675747572656044820152606401610ad2565b600061188a604051806101200160405280336001600160a01b031681526020018d81526020018c815260200160405180604001604052808d81526020018681525081526020018981526020018881526020018715158152602001866001600160a01b0316815260200160001515815250614441565b905060028711801561189e575060155460ff165b156118d9576118d9338c8b85858b6000815181106118cc57634e487b7160e01b600052603260045260246000fd5b6020026020010151614080565b9a9950505050505050505050565b6118ef613dac565b601155565b6118fc613dac565b600d80546001600160a01b0319166001600160a01b0383169081179091556040519081527f82c2f8aad8de17db4e2115c03f9a95266ac400ef1f7c7895c5a6487e45bcb279906020016109fd565b61195333613640565b6119a95760405162461bcd60e51b815260206004820152602160248201527f5065726d6974746564206f6e6c7920666f72206b6e6f776e206d61726b6574736044820152601760f91b6064820152608401610ad2565b60035460ff16156119cc5760405162461bcd60e51b8152600401610ad290615953565b6006546119d99082614643565b60065550565b60006119ec60078361464f565b8015610e5c5750816001600160a01b0316635c975abb6040518163ffffffff1660e01b815260040160206040518083038186803b158015611a2c57600080fd5b505afa158015611a40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6491906154cb565b1592915050565b611a73613dac565b600e80546001600160a01b0319166001600160a01b0383169081179091556040519081527f7860d99a18d1d40974259a27a70db54aed4b0ed3584556d2f266af2a0990be68906020016109fd565b6001546001600160a01b03163314611b395760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b6064820152608401610ad2565b60005460015460408051620100009093046001600160a01b03908116845290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a1600180546000805462010000600160b01b0319166001600160a01b03831662010000021790556001600160a01b0319169055565b6000546201000090046001600160a01b0316331480611be75750600d546001600160a01b031633145b80611bfc57506013546001600160a01b031633145b80611c1157506018546001600160a01b031633145b80611c2b5750336000908152600f602052604090205460ff165b611c685760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21031b0b63632b960911b6044820152606401610ad2565b801515826001600160a01b0316635c975abb6040518163ffffffff1660e01b815260040160206040518083038186803b158015611ca457600080fd5b505afa158015611cb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cdc91906154cb565b15151415611d1e5760405162461bcd60e51b815260206004820152600f60248201526e4e6f207374617465206368616e676560881b6044820152606401610ad2565b6040516305b0e2cf60e21b815281151560048201526001600160a01b038316906316c38b3c906024015b600060405180830381600087803b158015611d6257600080fd5b505af1158015611d76573d6000803e3d6000fd5b505050505050565b60005b8151811015610c105760146000838381518110611dae57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff1615611df25760405162461bcd60e51b8152600401610ad29061590c565b600080611e25848481518110611e1857634e487b7160e01b600052603260045260246000fd5b60200260200101516146d1565b9150915081158015611e375750428111155b8015611e635750611e61848481518110610b4a57634e487b7160e01b600052603260045260246000fd5b155b15611f2057600d5484516001600160a01b039091169063099177e990869086908110611e9f57634e487b7160e01b600052603260045260246000fd5b60209081029190910101516040516001600160e01b031960e084901b1681526001600160a01b0390911660048201526000602482018190526044820181905260648201819052608482015260a401600060405180830381600087803b158015611f0757600080fd5b505af1158015611f1b573d6000803e3d6000fd5b505050505b50508080611f2d90615b2b565b915050611d81565b611f3d613dac565b601880546001600160a01b0319166001600160a01b0383169081179091556040519081527fb29efe346fda749edc8ac04767e9facace07f2dd8deb4ad51a68f5cd887a57fd906020016109fd565b6060611f99600984846147ce565b9392505050565b60608060608084516001600160401b03811115611fcd57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611ff6578160200160208202803683370190505b50935084516001600160401b0381111561202057634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015612049578160200160208202803683370190505b50925084516001600160401b0381111561207357634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561209c578160200160208202803683370190505b50915084516001600160401b038111156120c657634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156120ef578160200160208202803683370190505b50905060005b855181101561222857600080612124888481518110610b0157634e487b7160e01b600052603260045260246000fd5b9150915061214b888481518110610b4a57634e487b7160e01b600052603260045260246000fd5b85848151811061216b57634e487b7160e01b600052603260045260246000fd5b6020026020010190151590811515815250508187848151811061219e57634e487b7160e01b600052603260045260246000fd5b602002602001019015159081151581525050428111158684815181106121d457634e487b7160e01b600052603260045260246000fd5b6020026020010190151590811515815250508084848151811061220757634e487b7160e01b600052603260045260246000fd5b6020026020010181815250505050808061222090615b2b565b9150506120f5565b509193509193565b6000546201000090046001600160a01b03163314806122595750600d546001600160a01b031633145b6122965760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21031b0b63632b960911b6044820152606401610ad2565b60006122ad6004548361443590919063ffffffff16565b90506122ba838383614912565b6013546122d5908490849084906001600160a01b03166149c3565b6018546116ba908490849084906001600160a01b03166149c3565b6122fb60073361464f565b6123525760405162461bcd60e51b815260206004820152602260248201527f5065726d6974746564206f6e6c7920666f7220616374697665206d61726b6574604482015261399760f11b6064820152608401610ad2565b60035460ff16156123755760405162461bcd60e51b8152600401610ad290615953565b6006546119d99082614435565b6000546201000090046001600160a01b03163314806123b057503360009081526012602052604090205460ff165b6123cc5760405162461bcd60e51b8152600401610ad2906158b9565b6001600160a01b03861660009081526014602052604090205460ff16156124055760405162461bcd60e51b8152600401610ad29061590c565b84156124715780156124715760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c7920757365206261636b7570206f646473206f6e2063616e63656c617460448201526e696f6e2c206966206e65656465642160881b6064820152608401610ad2565b600d546001600160a01b0383811691161415611d7657600d5460405163099177e960e01b81526001600160a01b0388811660048301526024820188905260ff80881660448401528616606483015283151560848301529091169063099177e99060a401600060405180830381600087803b1580156124ee57600080fd5b505af1158015612502573d6000803e3d6000fd5b50505050505050505050565b61251733613640565b6125335760405162461bcd60e51b8152600401610ad2906158e3565b61253c81614af1565b600e54909150600160a01b900460ff166125565780612561565b612561816001615abd565b600c546040516323b872dd60e01b81526001600160a01b038681166004830152858116602483015260448201849052929350600092909116906323b872dd90606401602060405180830381600087803b1580156125bd57600080fd5b505af11580156125d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125f591906154cb565b9050806112455760405162461bcd60e51b815260206004820152601c60248201527f5472616e7366657246726f6d2066756e6374696f6e206661696c6564000000006044820152606401610ad2565b600d546001600160a01b031633148061266d57506000546201000090046001600160a01b031633145b8061268257506013546001600160a01b031633145b8061269757506018546001600160a01b031633145b806126b157503360009081526012602052604090205460ff165b6126cd5760405162461bcd60e51b8152600401610ad2906158b9565b6126d860078361464f565b61271b5760405162461bcd60e51b8152602060048201526014602482015273139bdd08185b881858dd1a5d99481b585c9ad95d60621b6044820152606401610ad2565b6001600160a01b03821660009081526014602052604090205460ff16156127545760405162461bcd60e51b8152600401610ad29061590c565b816001600160a01b0316635c975abb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561278d57600080fd5b505afa1580156127a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c591906154cb565b15612825576040516305b0e2cf60e21b8152600060048201526001600160a01b038316906316c38b3c90602401600060405180830381600087803b15801561280c57600080fd5b505af1158015612820573d6000803e3d6000fd5b505050505b604051634f896d4f60e01b8152600481018290526001600160a01b03831690634f896d4f90602401600060405180830381600087803b15801561286757600080fd5b505af115801561287b573d6000803e3d6000fd5b50505050612893826007614b1590919063ffffffff16565b61289e600983614c98565b6001600160a01b03821660009081526016602052604090205415610c10578060011415612aaa576001600160a01b038216600090815260166020526040812080549091906128fc57634e487b7160e01b600052603260045260246000fd5b600091825260209091200154604051634f896d4f60e01b8152600160048201526001600160a01b0390911690634f896d4f90602401600060405180830381600087803b15801561294b57600080fd5b505af115801561295f573d6000803e3d6000fd5b505050506001600160a01b03821660009081526016602052604090208054600190811061299c57634e487b7160e01b600052603260045260246000fd5b600091825260209091200154604051634f896d4f60e01b8152600260048201526001600160a01b0390911690634f896d4f906024015b600060405180830381600087803b1580156129ec57600080fd5b505af1158015612a00573d6000803e3d6000fd5b505050506001600160a01b038216600090815260166020526040902080546002908110612a3d57634e487b7160e01b600052603260045260246000fd5b600091825260209091200154604051634f896d4f60e01b8152600160048201526001600160a01b0390911690634f896d4f906024015b600060405180830381600087803b158015612a8d57600080fd5b505af1158015612aa1573d6000803e3d6000fd5b50505050612f57565b8060021415612bc4576001600160a01b03821660009081526016602052604081208054909190612aea57634e487b7160e01b600052603260045260246000fd5b600091825260209091200154604051634f896d4f60e01b8152600260048201526001600160a01b0390911690634f896d4f90602401600060405180830381600087803b158015612b3957600080fd5b505af1158015612b4d573d6000803e3d6000fd5b505050506001600160a01b038216600090815260166020526040902080546001908110612b8a57634e487b7160e01b600052603260045260246000fd5b600091825260209091200154604051634f896d4f60e01b8152600160048201526001600160a01b0390911690634f896d4f906024016129d2565b8060031415612d7e576001600160a01b03821660009081526016602052604081208054909190612c0457634e487b7160e01b600052603260045260246000fd5b600091825260209091200154604051634f896d4f60e01b8152600160048201526001600160a01b0390911690634f896d4f90602401600060405180830381600087803b158015612c5357600080fd5b505af1158015612c67573d6000803e3d6000fd5b505050506001600160a01b038216600090815260166020526040902080546001908110612ca457634e487b7160e01b600052603260045260246000fd5b600091825260209091200154604051634f896d4f60e01b8152600160048201526001600160a01b0390911690634f896d4f90602401600060405180830381600087803b158015612cf357600080fd5b505af1158015612d07573d6000803e3d6000fd5b505050506001600160a01b038216600090815260166020526040902080546002908110612d4457634e487b7160e01b600052603260045260246000fd5b600091825260209091200154604051634f896d4f60e01b8152600260048201526001600160a01b0390911690634f896d4f90602401612a73565b6001600160a01b03821660009081526016602052604081208054909190612db557634e487b7160e01b600052603260045260246000fd5b6000918252602082200154604051634f896d4f60e01b815260048101929092526001600160a01b031690634f896d4f90602401600060405180830381600087803b158015612e0257600080fd5b505af1158015612e16573d6000803e3d6000fd5b505050506001600160a01b038216600090815260166020526040902080546001908110612e5357634e487b7160e01b600052603260045260246000fd5b6000918252602082200154604051634f896d4f60e01b815260048101929092526001600160a01b031690634f896d4f90602401600060405180830381600087803b158015612ea057600080fd5b505af1158015612eb4573d6000803e3d6000fd5b505050506001600160a01b038216600090815260166020526040902080546002908110612ef157634e487b7160e01b600052603260045260246000fd5b6000918252602082200154604051634f896d4f60e01b815260048101929092526001600160a01b031690634f896d4f90602401600060405180830381600087803b158015612f3e57600080fd5b505af1158015612f52573d6000803e3d6000fd5b505050505b60005b6001600160a01b0383166000908152601660205260409020548110156116ba576001600160a01b03831660009081526016602052604090208054612fd4919083908110612fb757634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546007906001600160a01b0316614b15565b6001600160a01b0383166000908152601660205260409020805461302e91908390811061301157634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546009906001600160a01b0316614c98565b8061303881615b2b565b915050612f5a565b60035460ff16156130635760405162461bcd60e51b8152600401610ad290615953565b61306b613dac565b60005b818110156116ba57600083838381811061309857634e487b7160e01b600052603260045260246000fd5b90506020020160208101906130ad9190615178565b90506130b881613640565b6130d45760405162461bcd60e51b8152600401610ad2906158e3565b60405163646d919f60e11b81523360048201526001600160a01b0382169063c8db233e90602401600060405180830381600087803b15801561311557600080fd5b505af1158015613129573d6000803e3d6000fd5b50505050613141816009614b1590919063ffffffff16565b6040516001600160a01b03821681527f16e62064e42f5aec62df22ae895ef539f153e0d4ea290e2cc4e0e8f708f2fbbc9060200160405180910390a1508061318881615b2b565b91505061306e565b613198613dac565b6001600160a01b0381166131e05760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b6044820152606401610ad2565b600154600160a81b900460ff16156132305760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481d1c985b9cd9995c9c9959606a1b6044820152606401610ad2565b600080546001600160a01b038381166201000081810262010000600160b01b031990941693909317938490556001805460ff60a81b1916600160a81b1790556040805193909404909116825260208201527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91016109fd565b6132b1613dac565b6132ba84613640565b6132d65760405162461bcd60e51b8152600401610ad2906158e3565b836001600160a01b0316639a82a09a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561330f57600080fd5b505afa158015613323573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061334791906154cb565b61338b5760405162461bcd60e51b815260206004820152601560248201527426b0b935b2ba103737ba1031b0b731b2b63632b21760591b6044820152606401610ad2565b6040516364ee874960e11b81526004810184905260248101839052604481018290526001600160a01b0385169063c9dd0e9290606401600060405180830381600087803b1580156133db57600080fd5b505af11580156133ef573d6000803e3d6000fd5b5050604080516001600160a01b038816815260208101879052908101859052606081018490527f11b2eca36fe7a3aaee80f5737d95923d4ac267614f4de9a91e63b24baa2bc1cf9250608001905060405180910390a150505050565b6000816001600160a01b0316635c975abb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561348657600080fd5b505afa15801561349a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5c91906154cb565b6007546000908210156135085760078054839081106134ed57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031692915050565b506000919050565b613518613dac565b60005b82518110156116ba578115156017600085848151811061354b57634e487b7160e01b600052603260045260246000fd5b60209081029190910181015182528101919091526040016000205460ff1615151461362e57816017600085848151811061359557634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002060006101000a81548160ff0219169083151502179055507fe98ab4bde655ceada15ea801bef97987659458457b2f770527e7c9ed5aeac98483828151811061360357634e487b7160e01b600052603260045260246000fd5b6020026020010151836040516136259291909182521515602082015260400190565b60405180910390a15b8061363881615b2b565b91505061351b565b600061364d60078361464f565b80610e5c5750610e5c60098361464f565b6060611f99600784846147ce565b6000546201000090046001600160a01b031633148061369a57503360009081526012602052604090205460ff165b6136b65760405162461bcd60e51b8152600401610ad2906158b9565b80156136fd5760405162461bcd60e51b815260206004820152601660248201527543616e206f6e6c79207365742030206f7574636f6d6560501b6044820152606401610ad2565b816001600160a01b0316633f6fa6556040518163ffffffff1660e01b815260040160206040518083038186803b15801561373657600080fd5b505afa15801561374a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061376e91906154cb565b6137b05760405162461bcd60e51b815260206004820152601360248201527213585c9ad95d081b9bdd081c995cdbdb1d9959606a1b6044820152606401610ad2565b6137bb60078361464f565b156137f85760405162461bcd60e51b815260206004820152600d60248201526c1058dd1a5d99481b585c9ad95d609a1b6044820152606401610ad2565b6001600160a01b03821660009081526014602052604090205460ff16156138315760405162461bcd60e51b8152600401610ad29061590c565b816001600160a01b0316635c975abb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561386a57600080fd5b505afa15801561387e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138a291906154cb565b15613902576040516305b0e2cf60e21b8152600060048201526001600160a01b038316906316c38b3c90602401600060405180830381600087803b1580156138e957600080fd5b505af11580156138fd573d6000803e3d6000fd5b505050505b604051634f896d4f60e01b8152600481018290526001600160a01b03831690634f896d4f90602401600060405180830381600087803b15801561394457600080fd5b505af1158015613958573d6000803e3d6000fd5b505050506001600160a01b03821660009081526016602052604090205415610c10576001600160a01b038216600090815260166020526040812080549091906139b157634e487b7160e01b600052603260045260246000fd5b6000918252602082200154604051634f896d4f60e01b815260048101929092526001600160a01b031690634f896d4f90602401600060405180830381600087803b1580156139fe57600080fd5b505af1158015613a12573d6000803e3d6000fd5b505050506001600160a01b038216600090815260166020526040902080546001908110613a4f57634e487b7160e01b600052603260045260246000fd5b6000918252602082200154604051634f896d4f60e01b815260048101929092526001600160a01b031690634f896d4f90602401600060405180830381600087803b158015613a9c57600080fd5b505af1158015613ab0573d6000803e3d6000fd5b505050506001600160a01b038216600090815260166020526040902080546002908110613aed57634e487b7160e01b600052603260045260246000fd5b6000918252602082200154604051634f896d4f60e01b815260048101929092526001600160a01b031690634f896d4f90602401611d48565b6000610e5c82614af1565b613b38613dac565b600e8054911515600160a01b0260ff60a01b19909216919091179055565b606080606083516001600160401b03811115613b8257634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015613bab578160200160208202803683370190505b50925083516001600160401b03811115613bd557634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015613bfe578160200160208202803683370190505b50915083516001600160401b03811115613c2857634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015613c51578160200160208202803683370190505b50905060005b8451811015613d5b57600080613c86878481518110611e1857634e487b7160e01b600052603260045260246000fd5b91509150613cad878481518110610b4a57634e487b7160e01b600052603260045260246000fd5b848481518110613ccd57634e487b7160e01b600052603260045260246000fd5b60200260200101901515908115158152505081868481518110613d0057634e487b7160e01b600052603260045260246000fd5b60200260200101901515908115158152505042811115858481518110613d3657634e487b7160e01b600052603260045260246000fd5b9115156020928302919091019091015250819050613d5381615b2b565b915050613c57565b509193909250565b613d6b613dac565b6015805460ff19168215159081179091556040519081527fafa98ec751b49f853d1a5f51c4b6df2a6248c9daa73a920ee644094abe32e41e906020016109fd565b6000546201000090046001600160a01b03163314613e245760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b6064820152608401610ad2565b565b60008060008390506000816001600160a01b0316639e3b34bf6040518163ffffffff1660e01b8152600401604080518083038186803b158015613e6857600080fd5b505afa158015613e7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ea0919061567e565b509050816001600160a01b031663ef83f7246040518163ffffffff1660e01b815260040160206040518083038186803b158015613edc57600080fd5b505afa158015613ef0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f1491906154cb565b9590945092505050565b6000816001600160a01b0316633f6fa6556040518163ffffffff1660e01b815260040160206040518083038186803b15801561348657600080fd5b6001600160a01b038116600090815260166020526040902054606090801561407a57806001600160401b03811115613fa157634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015613fca578160200160208202803683370190505b50915060005b81811015614078576001600160a01b038416600090815260166020526040902080548290811061401057634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b031683828151811061404e57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03909216602092830291909101909101528061407081615b2b565b915050613fd0565b505b50919050565b600d54604051631c2ab73160e21b81526004810187905286916000916001600160a01b03909116906370aadcc49060240160206040518083038186803b1580156140c957600080fd5b505afa1580156140dd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061410191906154e7565b60008181526017602052604090205490915060ff168015614124575060155460ff165b1561442b576040805160a0810182526011606080830182815270486f6d655465616d4e6f74546f4c6f736560781b608085015283528351808501855291825270417761795465616d4e6f74546f4c6f736560781b602080840191909152808401929092528351808501855260068152654e6f4472617760d01b81840152838501528351600280825291810185529293600093928301908036833701905050905084816000815181106141e657634e487b7160e01b600052603260045260246000fd5b6020026020010181815250506127138160018151811061421657634e487b7160e01b600052603260045260246000fd5b60200260200101818152505060005b60038110156144275760006142c96040518061012001604052808e6001600160a01b031681526020018d815260200186856003811061427457634e487b7160e01b600052603260045260246000fd5b6020020151815260200160405180604001604052808e81526020018d8152508152602001600281526020018581526020016000151581526020018a6001600160a01b0316815260200160011515815250614441565b90506142d6600782614c98565b6001600160a01b0388811660009081526016602090815260408083208054600180820183559185528385200180546001600160a01b031916878716908117909155808552601490935292819020805460ff19169093179092556013549151631c71e4e760e31b8152600481018f9052602481019190915291169063e38f273890604401600060405180830381600087803b15801561437357600080fd5b505af1158015614387573d6000803e3d6000fd5b505050507f0cf6abc895e0e76ef58c3555c8cd5ffca2afecb927fccd65c136122c0c39404f8882856001815181106143cf57634e487b7160e01b600052603260045260246000fd5b60200260200101518786600381106143f757634e487b7160e01b600052603260045260246000fd5b602002015160405161440c949392919061577a565b60405180910390a1508061441f81615b2b565b915050614225565b5050505b5050505050505050565b6000611f998284615abd565b600e54604051634f3565e360e01b815260009182916001600160a01b0390911690634f3565e3906144769086906004016159b0565b602060405180830381600087803b15801561449057600080fd5b505af11580156144a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144c89190615194565b90506144d5600782614c98565b6000806000836001600160a01b031663cc2ee1966040518163ffffffff1660e01b815260040160606040518083038186803b15801561451357600080fd5b505afa158015614527573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061454b91906155f9565b925092509250856020015186600001516001600160a01b03167f5b94d36374b7499bec3849984d165c16e10e3ee59241963bd809a169d1a9cf268689606001516000600281106145ab57634e487b7160e01b600052603260045260246000fd5b6020908102919091015160608c810151830151604080516001600160a01b039687168152948501939093528383015289841690830152878316608083015291861660a082015290519081900360c00190a37f319d1be996912ef0acee5fb7cc9b908129bf7bc7290609b7578839c4a1689bad8487604001516040516146319291906157b7565b60405180910390a15091949350505050565b6000611f998284615b14565b815460009061466057506000610e5c565b6001600160a01b0382166000908152600184016020526040902054801515806146c95750826001600160a01b0316846000016000815481106146b257634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b0316145b949350505050565b60008060008390506000816001600160a01b0316639e3b34bf6040518163ffffffff1660e01b8152600401604080518083038186803b15801561471357600080fd5b505afa158015614727573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061474b919061567e565b509050816001600160a01b031663ef83f7246040518163ffffffff1660e01b815260040160206040518083038186803b15801561478757600080fd5b505afa15801561479b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147bf91906154cb565b80613f145750613f1485614cea565b606060006147dc8385615abd565b85549091508111156147ec575083545b838111614809575050604080516000815260208101909152611f99565b60006148158583615b14565b90506000816001600160401b0381111561483f57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015614868578160200160208202803683370190505b50905060005b8281101561490757876148818883615abd565b8154811061489f57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168282815181106148dd57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0390921660209283029190910190910152806148ff81615b2b565b91505061486e565b509695505050505050565b6040516339acb21f60e21b815260048101839052602481018290526001600160a01b0384169063e6b2c87c90604401600060405180830381600087803b15801561495b57600080fd5b505af115801561496f573d6000803e3d6000fd5b5050604080516001600160a01b0387168152602081018690529081018490527f0915c734742076f135119aa0d73364ab8589b1a6d441c764678c275613a3c6e19250606001905060405180910390a1505050565b604051630ceda8e960e41b81526001600160a01b0385811660048301526000919083169063ceda8e909060240160206040518083038186803b158015614a0857600080fd5b505afa158015614a1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614a4091906154e7565b905060005b81811015611d765760405163088f63ab60e31b81526001600160a01b038781166004830152602482018390526000919085169063447b1d589060440160206040518083038186803b158015614a9957600080fd5b505afa158015614aad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614ad19190615194565b9050614ade818787614912565b5080614ae981615b2b565b915050614a45565b600e54600090600160a01b900460ff1615610ebe57610e5c64e8d4a5100083615ad5565b614b1f828261464f565b614b615760405162461bcd60e51b815260206004820152601360248201527222b632b6b2b73a103737ba1034b71039b2ba1760691b6044820152606401610ad2565b6001600160a01b0381166000908152600180840160205260408220548454909291614b8b91615b14565b9050808214614c33576000846000018281548110614bb957634e487b7160e01b600052603260045260246000fd5b60009182526020909120015485546001600160a01b0390911691508190869085908110614bf657634e487b7160e01b600052603260045260246000fd5b600091825260208083209190910180546001600160a01b0319166001600160a01b0394851617905592909116815260018601909152604090208290555b8354849080614c5257634e487b7160e01b600052603160045260246000fd5b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b0394909416815260019490940190925250506040812055565b614ca2828261464f565b610c105781546001600160a01b038216600081815260018086016020908152604083208590559084018655858252902090910180546001600160a01b03191690911790555050565b6000614cf7826001614d17565b80614d085750614d08826000614d17565b80610e5c5750610e5c82614f77565b60008060008315614db557601854604051630ceda8e960e41b81526001600160a01b0387811660048301529091169063ceda8e909060240160206040518083038186803b158015614d6757600080fd5b505afa158015614d7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614d9f91906154e7565b6018549092506001600160a01b03169050614e44565b601354604051630ceda8e960e41b81526001600160a01b0387811660048301529091169063ceda8e909060240160206040518083038186803b158015614dfa57600080fd5b505afa158015614e0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614e3291906154e7565b6013549092506001600160a01b031690505b60005b82811015614f6b5760405163088f63ab60e31b81526001600160a01b038781166004830152602482018390526000919084169063447b1d589060440160206040518083038186803b158015614e9b57600080fd5b505afa158015614eaf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614ed39190615194565b9050806001600160a01b031663ef83f7246040518163ffffffff1660e01b815260040160206040518083038186803b158015614f0e57600080fd5b505afa158015614f22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614f4691906154cb565b15614f58576001945050505050610e5c565b5080614f6381615b2b565b915050614e47565b50600095945050505050565b600080614f8383613f59565b905060005b815181101561508f5760006001600160a01b0316828281518110614fbc57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03161415801561506e5750818181518110614ff657634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031663ef83f7246040518163ffffffff1660e01b815260040160206040518083038186803b15801561503657600080fd5b505afa15801561504a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061506e91906154cb565b1561507d575060019392505050565b8061508781615b2b565b915050614f88565b5060009392505050565b8035610ec281615b72565b60008083601f8401126150b5578182fd5b5081356001600160401b038111156150cb578182fd5b6020830191508360208260051b85010111156150e657600080fd5b9250929050565b600082601f8301126150fd578081fd5b8135602061511261510d83615a9a565b615a6a565b80838252828201915082860187848660051b8901011115615131578586fd5b855b8581101561514f57813584529284019290840190600101615133565b5090979650505050505050565b8035610ec281615b87565b803560ff81168114610ec257600080fd5b600060208284031215615189578081fd5b8135611f9981615b72565b6000602082840312156151a5578081fd5b8151611f9981615b72565b6000806000606084860312156151c4578182fd5b83356151cf81615b72565b925060208401356151df81615b72565b929592945050506040919091013590565b60008060408385031215615202578182fd5b823561520d81615b72565b9150602083013561521d81615b87565b809150509250929050565b6000806040838503121561523a578182fd5b823561524581615b72565b9150602083013561521d81615b72565b60008060408385031215615267578182fd5b823561527281615b72565b946020939093013593505050565b60008060008060808587031215615295578081fd5b84356152a081615b72565b966020860135965060408601359560600135945092505050565b60008060008060008060c087890312156152d2578384fd5b86356152dd81615b72565b9550602087013594506152f260408801615167565b935061530060608801615167565b9250608087013561531081615b72565b915060a087013561532081615b87565b809150509295509295509295565b60008060208385031215615340578182fd5b82356001600160401b03811115615355578283fd5b615361858286016150a4565b90969095509350505050565b60008060008060608587031215615382578182fd5b84356001600160401b03811115615397578283fd5b6153a3878288016150a4565b90955093505060208501356153b781615b87565b91506153c560408601615167565b905092959194509250565b600060208083850312156153e2578182fd5b82356001600160401b038111156153f7578283fd5b8301601f81018513615407578283fd5b803561541561510d82615a9a565b80828252848201915084840188868560051b8701011115615434578687fd5b8694505b8385101561545f57803561544b81615b72565b835260019490940193918501918501615438565b50979650505050505050565b6000806040838503121561547d578182fd5b82356001600160401b03811115615492578283fd5b61549e858286016150ed565b925050602083013561521d81615b87565b6000602082840312156154c0578081fd5b8135611f9981615b87565b6000602082840312156154dc578081fd5b8151611f9981615b87565b6000602082840312156154f8578081fd5b5051919050565b600080600080600080600080610100898b03121561551b578586fd5b883597506020808a01356001600160401b0380821115615539578889fd5b818c0191508c601f83011261554c578889fd5b81358181111561555e5761555e615b5c565b615570601f8201601f19168501615a6a565b8181528e85838601011115615583578a8bfd5b81858501868301378a858383010152809b50505060408c0135985060608c0135975060808c0135965060a08c01359250808311156155bf578485fd5b50506155cd8b828c016150ed565b9350506155dc60c08a0161515c565b91506155ea60e08a01615099565b90509295985092959890939650565b60008060006060848603121561560d578081fd5b835161561881615b72565b602085015190935061562981615b72565b604085015190925061563a81615b72565b809150509250925092565b600060208284031215615656578081fd5b5035919050565b6000806040838503121561566f578182fd5b50508035926020909101359150565b60008060408385031215615690578182fd5b505080516020909101519092909150565b6000815180845260208085019450808401835b838110156156d25781511515875295820195908201906001016156b4565b509495945050505050565b8060005b60028110156112455781518452602093840193909101906001016156e1565b6000815180845260208085019450808401835b838110156156d257815187529582019590820190600101615713565b60008151808452815b8181101561575457602081850181015186830182015201615738565b818111156157655782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906157ad9083018461572f565b9695505050505050565b6001600160a01b03831681526040602082018190526000906146c99083018461572f565b6020808252825182820181905260009190848201906040850190845b8181101561581c5783516001600160a01b0316835292840192918401916001016157f7565b50909695505050505050565b60608152600061583b60608301866156a1565b828103602084015261584d81866156a1565b905082810360408401526157ad81856156a1565b60808152600061587460808301876156a1565b828103602084015261588681876156a1565b9050828103604084015261589a81866156a1565b905082810360608401526158ae8185615700565b979650505050505050565b60208082526010908201526f24b73b30b634b2103932b9b7b63b32b960811b604082015260600190565b6020808252600f908201526e26b0b935b2ba103ab735b737bbb71760891b604082015260600190565b60208082526027908201527f4e6f7420737570706f7274656420666f7220646f75626c65206368616e6365206040820152666d61726b65747360c81b606082015260800190565b6020808252603c908201527f5468697320616374696f6e2063616e6e6f7420626520706572666f726d65642060408201527f7768696c652074686520636f6e74726163742069732070617573656400000000606082015260800190565b602081526159ca6020820183516001600160a01b03169052565b60208201516040820152600060408301516101408060608501526159f261016085018361572f565b91506060850151615a0660808601826156dd565b50608085015160c085015260a0850151848303601f190160e0860152615a2c8382615700565b92505060c0850151610100615a448187018315159052565b60e08701516001600160a01b031661012087015290950151151593019290925250919050565b604051601f8201601f191681016001600160401b0381118282101715615a9257615a92615b5c565b604052919050565b60006001600160401b03821115615ab357615ab3615b5c565b5060051b60200190565b60008219821115615ad057615ad0615b46565b500190565b600082615af057634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615615b0f57615b0f615b46565b500290565b600082821015615b2657615b26615b46565b500390565b6000600019821415615b3f57615b3f615b46565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610e4e57600080fd5b8015158114610e4e57600080fdfea2646970667358221220753bff78ceed73961a5002f39ac803c65f41ea7ed47fd52c0b7f9cd1328cdbf164736f6c63430008040033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106104075760003560e01c80637fdb733f11610220578063b91f5e3511610130578063e62b8889116100b8578063f65d145411610087578063f65d145414610937578063fab44cbb1461095a578063fb6cede61461096d578063ff50abdc1461098f578063ffbc538a1461099857600080fd5b8063e62b8889146108eb578063e73efc9b146108fe578063ed7afdec14610911578063edc892e11461092457600080fd5b8063c6e9e7d7116100ff578063c6e9e7d714610892578063cf7fb264146108a5578063dd5adfa3146108b8578063e116ee5a146108cb578063e28c130b146108d857600080fd5b8063b91f5e3514610846578063bb96af6514610859578063c014fb841461086c578063c3b83f5f1461087f57600080fd5b80639418f6c7116101b3578063aeab584911610182578063aeab5849146107f3578063b037c8e514610806578063b162e06114610819578063b3ee14241461082a578063b908feb21461083357600080fd5b80639418f6c7146107a25780639eb5d8b4146107c5578063ac60c486146107d8578063ad6b22ce146107e057600080fd5b80638da5cb5b116101ef5780638da5cb5b146107595780638fe812b41461077257806391b4ded9146107865780639324cac71461078f57600080fd5b80637fdb733f146106fd57806385f2a72e1461071057806389c6318d146107235780638d924e731461073657600080fd5b80633c5a2ef01161031b5780635fae0576116102ae5780636b3a09841161027d5780636b3a0984146106a95780636ec38a4e146106bc57806371943de3146106cf57806379ba5097146106e25780637f8c2d61146106ea57600080fd5b80635fae05761461063157806364af2d871461065d57806368c7f2161461066a5780636a5fd5661461067d57600080fd5b806355f14427116102ea57806355f14427146105db5780635c975abb146105ee5780635d7fb8e2146105fb5780635e7ba7101461060e57600080fd5b80633c5a2ef01461058f578063485cc955146105a25780634cde32ce146105b557806353a47bb7146105c857600080fd5b80631627540c1161039e57806317fd849a1161036d57806317fd849a1461053a57806321a92a271461054d57806327d31e3b146105605780633744734d1461057357806339ab4c411461057c57600080fd5b80631627540c146104c957806316c38b3c146104dc578063172653eb146104ef57806317eaaa4a1461050f57600080fd5b80630def299d116103da5780630def299d1461047e5780630e429aeb1461049157806313af4035146104a357806315502840146104b657600080fd5b806302610c501461040c57806306c933d8146104235780630b3be3f3146104565780630c863e061461046b575b600080fd5b6007545b6040519081526020015b60405180910390f35b610446610431366004615178565b600f6020526000908152604090205460ff1681565b604051901515815260200161041a565b610469610464366004615178565b6109ab565b005b610469610479366004615178565b610a08565b61046961048c3660046153d0565b610a5e565b60055461044690610100900460ff1681565b6104696104b1366004615178565b610c14565b6104696104c4366004615645565b610d48565b6104696104d7366004615178565b610d85565b6104696104ea3660046154af565b610ddb565b6105026104fd366004615178565b610e51565b60405161041a91906157db565b61052261051d366004615255565b610e62565b6040516001600160a01b03909116815260200161041a565b610410610548366004615645565b610e9a565b61046961055b366004615178565b610ec7565b61046961056e36600461536d565b61124b565b61041060115481565b61046961058a3660046154af565b611560565b600e54610522906001600160a01b031681565b6104696105b0366004615228565b6115b9565b6105226105c33660046154ff565b6116bf565b600154610522906001600160a01b031681565b6104696105e9366004615645565b6118e7565b6003546104469060ff1681565b601854610522906001600160a01b031681565b61044661061c366004615178565b60126020526000908152604090205460ff1681565b61044661063f366004615178565b6001600160a01b03166000908152600f602052604090205460ff1690565b6005546104469060ff1681565b610469610678366004615178565b6118f4565b61044661068b366004615178565b6001600160a01b031660009081526014602052604090205460ff1690565b6104696106b7366004615645565b61194a565b6104466106ca366004615178565b6119df565b6104696106dd366004615178565b611a6b565b610469611ac1565b6104696106f83660046151f0565b611bbe565b61046961070b3660046153d0565b611d7e565b61046961071e366004615178565b611f35565b61050261073136600461565d565b611f8b565b6107496107443660046153d0565b611fa0565b60405161041a9493929190615861565b600054610522906201000090046001600160a01b031681565b600e5461044690600160a01b900460ff1681565b61041060025481565b600c54610522906001600160a01b031681565b6104466107b0366004615178565b60146020526000908152604090205460ff1681565b6104696107d3366004615255565b612230565b600954610410565b601354610522906001600160a01b031681565b610469610801366004615645565b6122f0565b6104696108143660046152ba565b612382565b6013546001600160a01b0316610522565b61041060045481565b6104696108413660046151b0565b61250e565b610469610854366004615255565b612644565b600d54610522906001600160a01b031681565b61046961087a36600461532e565b613040565b61046961088d366004615178565b613190565b6104696108a0366004615280565b6132a9565b6104466108b3366004615178565b61344b565b6105226108c6366004615645565b6134be565b6015546104469060ff1681565b6104696108e636600461546b565b613510565b6104466108f9366004615178565b613640565b61050261090c36600461565d565b61365e565b61046961091f366004615255565b61366c565b610410610932366004615645565b613b25565b610446610945366004615645565b60176020526000908152604090205460ff1681565b6104696109683660046154af565b613b30565b61098061097b3660046153d0565b613b56565b60405161041a93929190615828565b61041060065481565b6104696109a63660046154af565b613d63565b6109b3613dac565b600c80546001600160a01b0319166001600160a01b0383169081179091556040519081527fbae3da9b16d7b09b9f1a0d00cb2fafc0f94895fde1e0e2d9e31529efa028da06906020015b60405180910390a150565b610a10613dac565b601380546001600160a01b0319166001600160a01b0383169081179091556040519081527fabcd3d442bfb8eed13cda6bd397d12a7a75f9d4b9d85df42729d6470fab78503906020016109fd565b60005b8151811015610c105760146000838381518110610a8e57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff1615610adb5760405162461bcd60e51b8152600401610ad29061590c565b60405180910390fd5b600080610b0e848481518110610b0157634e487b7160e01b600052603260045260246000fd5b6020026020010151613e26565b9150915081158015610b205750428111155b8015610b595750610b57848481518110610b4a57634e487b7160e01b600052603260045260246000fd5b6020026020010151613f1e565b155b15610bfb5760185484516001600160a01b0390911690635938541f90869086908110610b9557634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b8152600401610bc891906001600160a01b0391909116815260200190565b600060405180830381600087803b158015610be257600080fd5b505af1158015610bf6573d6000803e3d6000fd5b505050505b50508080610c0890615b2b565b915050610a61565b5050565b6001600160a01b038116610c6a5760405162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f742062652030000000000000006044820152606401610ad2565b600154600160a01b900460ff1615610cd65760405162461bcd60e51b815260206004820152602960248201527f416c726561647920696e697469616c697a65642c20757365206e6f6d696e617460448201526832a732bba7bbb732b960b91b6064820152608401610ad2565b6001805460ff60a01b1916600160a01b179055600080546001600160a01b03831662010000810262010000600160b01b03199092169190911782556040805192835260208301919091527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91016109fd565b610d50613dac565b60048190556040518181527ff378a0fd4ad3ffd9d7d50986f16b04acd2dc42691c4f412f34e8eefe883e6652906020016109fd565b610d8d613dac565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce22906020016109fd565b610de3613dac565b60035460ff1615158115151415610df75750565b6003805460ff191682151590811790915560ff1615610e1557426002555b60035460405160ff909116151581527f8fb6c181ee25a520cf3dd6565006ef91229fcfe5a989566c2a3b8c115570cec5906020016109fd565b50565b6060610e5c82613f59565b92915050565b60166020528160005260406000208181548110610e7e57600080fd5b6000918252602090912001546001600160a01b03169150829050565b600e54600090600160a01b900460ff1615610ebe57610e5c8264e8d4a51000615af5565b5090565b919050565b60035460ff1615610eea5760405162461bcd60e51b8152600401610ad290615953565b610ef2613dac565b60055460ff16610f445760405162461bcd60e51b815260206004820152601b60248201527f4d61726b6574206372656174696f6e2069732064697361626c656400000000006044820152606401610ad2565b60155460ff16610f965760405162461bcd60e51b815260206004820152601b60248201527f446f75626c65206368616e6365206e6f7420737570706f7274656400000000006044820152606401610ad2565b60008190506002816001600160a01b0316631a1dbabb6040518163ffffffff1660e01b815260040160206040518083038186803b158015610fd657600080fd5b505afa158015610fea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061100e91906154e7565b116110665760405162461bcd60e51b815260206004820152602260248201527f4e6f7420737570706f7274656420666f722032206f7074696f6e73206d61726b604482015261195d60f21b6064820152608401610ad2565b600080826001600160a01b0316639e3b34bf6040518163ffffffff1660e01b8152600401604080518083038186803b1580156110a157600080fd5b505afa1580156110b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d9919061567e565b91509150611245836001600160a01b03166302d05d3f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561111957600080fd5b505afa15801561112d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111519190615194565b846001600160a01b031663c0bd83516040518163ffffffff1660e01b815260040160206040518083038186803b15801561118a57600080fd5b505afa15801561119e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c291906154e7565b6040516308208aaf60e21b8152600060048201528590859089906001600160a01b038a16906320822abc9060240160206040518083038186803b15801561120857600080fd5b505afa15801561121c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124091906154e7565b614080565b50505050565b611253613dac565b826112ae5760405162461bcd60e51b815260206004820152602560248201527f57686974656c6973746564206164647265737365732063616e6e6f7420626520604482015264656d70747960d81b6064820152608401610ad2565b60005b83811015611559578160ff166001141561140057821515600f60008787858181106112ec57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906113019190615178565b6001600160a01b0316815260208101919091526040016000205460ff161515146114005782600f600087878581811061134a57634e487b7160e01b600052603260045260246000fd5b905060200201602081019061135f9190615178565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790557f58d7a3ccc34541e162fcfc87b84be7b78c34d1e1e7f15de6e4dd67d0fe70aecd8585838181106113c857634e487b7160e01b600052603260045260246000fd5b90506020020160208101906113dd9190615178565b604080516001600160a01b03909216825285151560208301520160405180910390a15b8160ff1660021415611547578215156012600087878581811061143357634e487b7160e01b600052603260045260246000fd5b90506020020160208101906114489190615178565b6001600160a01b0316815260208101919091526040016000205460ff1615151461154757826012600087878581811061149157634e487b7160e01b600052603260045260246000fd5b90506020020160208101906114a69190615178565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790557f58d7a3ccc34541e162fcfc87b84be7b78c34d1e1e7f15de6e4dd67d0fe70aecd85858381811061150f57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906115249190615178565b604080516001600160a01b03909216825285151560208301520160405180910390a15b8061155181615b2b565b9150506112b1565b5050505050565b611568613dac565b60055460ff16151581151514610e4e576005805460ff19168215159081179091556040519081527fcc590b6309435383b617aaa0cae6aba938f2ee471cfb539201dd7655a23caff9906020016109fd565b600054610100900460ff166115d45760005460ff16156115d8565b303b155b61163b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610ad2565b600054610100900460ff1615801561165d576000805461ffff19166101011790555b61166683610c14565b600c80546001600160a01b0319166001600160a01b0384161790556000805462010000600160b01b0319163362010000021790556005805461ffff1916600117905580156116ba576000805461ff00191690555b505050565b60035460009060ff16156116e55760405162461bcd60e51b8152600401610ad290615953565b60055460ff166117375760405162461bcd60e51b815260206004820152601b60248201527f4d61726b6574206372656174696f6e2069732064697361626c656400000000006044820152606401610ad2565b600d546001600160a01b031633148061175a57506013546001600160a01b031633145b8061176f57506018546001600160a01b031633145b6117ad5760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b21031b932b0ba37b960891b6044820152606401610ad2565b60006117c46004548961443590919063ffffffff16565b90508742106118155760405162461bcd60e51b815260206004820181905260248201527f4d617475726974792068617320746f20626520696e20746865206675747572656044820152606401610ad2565b600061188a604051806101200160405280336001600160a01b031681526020018d81526020018c815260200160405180604001604052808d81526020018681525081526020018981526020018881526020018715158152602001866001600160a01b0316815260200160001515815250614441565b905060028711801561189e575060155460ff165b156118d9576118d9338c8b85858b6000815181106118cc57634e487b7160e01b600052603260045260246000fd5b6020026020010151614080565b9a9950505050505050505050565b6118ef613dac565b601155565b6118fc613dac565b600d80546001600160a01b0319166001600160a01b0383169081179091556040519081527f82c2f8aad8de17db4e2115c03f9a95266ac400ef1f7c7895c5a6487e45bcb279906020016109fd565b61195333613640565b6119a95760405162461bcd60e51b815260206004820152602160248201527f5065726d6974746564206f6e6c7920666f72206b6e6f776e206d61726b6574736044820152601760f91b6064820152608401610ad2565b60035460ff16156119cc5760405162461bcd60e51b8152600401610ad290615953565b6006546119d99082614643565b60065550565b60006119ec60078361464f565b8015610e5c5750816001600160a01b0316635c975abb6040518163ffffffff1660e01b815260040160206040518083038186803b158015611a2c57600080fd5b505afa158015611a40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6491906154cb565b1592915050565b611a73613dac565b600e80546001600160a01b0319166001600160a01b0383169081179091556040519081527f7860d99a18d1d40974259a27a70db54aed4b0ed3584556d2f266af2a0990be68906020016109fd565b6001546001600160a01b03163314611b395760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b6064820152608401610ad2565b60005460015460408051620100009093046001600160a01b03908116845290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a1600180546000805462010000600160b01b0319166001600160a01b03831662010000021790556001600160a01b0319169055565b6000546201000090046001600160a01b0316331480611be75750600d546001600160a01b031633145b80611bfc57506013546001600160a01b031633145b80611c1157506018546001600160a01b031633145b80611c2b5750336000908152600f602052604090205460ff165b611c685760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21031b0b63632b960911b6044820152606401610ad2565b801515826001600160a01b0316635c975abb6040518163ffffffff1660e01b815260040160206040518083038186803b158015611ca457600080fd5b505afa158015611cb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cdc91906154cb565b15151415611d1e5760405162461bcd60e51b815260206004820152600f60248201526e4e6f207374617465206368616e676560881b6044820152606401610ad2565b6040516305b0e2cf60e21b815281151560048201526001600160a01b038316906316c38b3c906024015b600060405180830381600087803b158015611d6257600080fd5b505af1158015611d76573d6000803e3d6000fd5b505050505050565b60005b8151811015610c105760146000838381518110611dae57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff1615611df25760405162461bcd60e51b8152600401610ad29061590c565b600080611e25848481518110611e1857634e487b7160e01b600052603260045260246000fd5b60200260200101516146d1565b9150915081158015611e375750428111155b8015611e635750611e61848481518110610b4a57634e487b7160e01b600052603260045260246000fd5b155b15611f2057600d5484516001600160a01b039091169063099177e990869086908110611e9f57634e487b7160e01b600052603260045260246000fd5b60209081029190910101516040516001600160e01b031960e084901b1681526001600160a01b0390911660048201526000602482018190526044820181905260648201819052608482015260a401600060405180830381600087803b158015611f0757600080fd5b505af1158015611f1b573d6000803e3d6000fd5b505050505b50508080611f2d90615b2b565b915050611d81565b611f3d613dac565b601880546001600160a01b0319166001600160a01b0383169081179091556040519081527fb29efe346fda749edc8ac04767e9facace07f2dd8deb4ad51a68f5cd887a57fd906020016109fd565b6060611f99600984846147ce565b9392505050565b60608060608084516001600160401b03811115611fcd57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611ff6578160200160208202803683370190505b50935084516001600160401b0381111561202057634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015612049578160200160208202803683370190505b50925084516001600160401b0381111561207357634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561209c578160200160208202803683370190505b50915084516001600160401b038111156120c657634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156120ef578160200160208202803683370190505b50905060005b855181101561222857600080612124888481518110610b0157634e487b7160e01b600052603260045260246000fd5b9150915061214b888481518110610b4a57634e487b7160e01b600052603260045260246000fd5b85848151811061216b57634e487b7160e01b600052603260045260246000fd5b6020026020010190151590811515815250508187848151811061219e57634e487b7160e01b600052603260045260246000fd5b602002602001019015159081151581525050428111158684815181106121d457634e487b7160e01b600052603260045260246000fd5b6020026020010190151590811515815250508084848151811061220757634e487b7160e01b600052603260045260246000fd5b6020026020010181815250505050808061222090615b2b565b9150506120f5565b509193509193565b6000546201000090046001600160a01b03163314806122595750600d546001600160a01b031633145b6122965760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21031b0b63632b960911b6044820152606401610ad2565b60006122ad6004548361443590919063ffffffff16565b90506122ba838383614912565b6013546122d5908490849084906001600160a01b03166149c3565b6018546116ba908490849084906001600160a01b03166149c3565b6122fb60073361464f565b6123525760405162461bcd60e51b815260206004820152602260248201527f5065726d6974746564206f6e6c7920666f7220616374697665206d61726b6574604482015261399760f11b6064820152608401610ad2565b60035460ff16156123755760405162461bcd60e51b8152600401610ad290615953565b6006546119d99082614435565b6000546201000090046001600160a01b03163314806123b057503360009081526012602052604090205460ff165b6123cc5760405162461bcd60e51b8152600401610ad2906158b9565b6001600160a01b03861660009081526014602052604090205460ff16156124055760405162461bcd60e51b8152600401610ad29061590c565b84156124715780156124715760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c7920757365206261636b7570206f646473206f6e2063616e63656c617460448201526e696f6e2c206966206e65656465642160881b6064820152608401610ad2565b600d546001600160a01b0383811691161415611d7657600d5460405163099177e960e01b81526001600160a01b0388811660048301526024820188905260ff80881660448401528616606483015283151560848301529091169063099177e99060a401600060405180830381600087803b1580156124ee57600080fd5b505af1158015612502573d6000803e3d6000fd5b50505050505050505050565b61251733613640565b6125335760405162461bcd60e51b8152600401610ad2906158e3565b61253c81614af1565b600e54909150600160a01b900460ff166125565780612561565b612561816001615abd565b600c546040516323b872dd60e01b81526001600160a01b038681166004830152858116602483015260448201849052929350600092909116906323b872dd90606401602060405180830381600087803b1580156125bd57600080fd5b505af11580156125d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125f591906154cb565b9050806112455760405162461bcd60e51b815260206004820152601c60248201527f5472616e7366657246726f6d2066756e6374696f6e206661696c6564000000006044820152606401610ad2565b600d546001600160a01b031633148061266d57506000546201000090046001600160a01b031633145b8061268257506013546001600160a01b031633145b8061269757506018546001600160a01b031633145b806126b157503360009081526012602052604090205460ff165b6126cd5760405162461bcd60e51b8152600401610ad2906158b9565b6126d860078361464f565b61271b5760405162461bcd60e51b8152602060048201526014602482015273139bdd08185b881858dd1a5d99481b585c9ad95d60621b6044820152606401610ad2565b6001600160a01b03821660009081526014602052604090205460ff16156127545760405162461bcd60e51b8152600401610ad29061590c565b816001600160a01b0316635c975abb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561278d57600080fd5b505afa1580156127a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c591906154cb565b15612825576040516305b0e2cf60e21b8152600060048201526001600160a01b038316906316c38b3c90602401600060405180830381600087803b15801561280c57600080fd5b505af1158015612820573d6000803e3d6000fd5b505050505b604051634f896d4f60e01b8152600481018290526001600160a01b03831690634f896d4f90602401600060405180830381600087803b15801561286757600080fd5b505af115801561287b573d6000803e3d6000fd5b50505050612893826007614b1590919063ffffffff16565b61289e600983614c98565b6001600160a01b03821660009081526016602052604090205415610c10578060011415612aaa576001600160a01b038216600090815260166020526040812080549091906128fc57634e487b7160e01b600052603260045260246000fd5b600091825260209091200154604051634f896d4f60e01b8152600160048201526001600160a01b0390911690634f896d4f90602401600060405180830381600087803b15801561294b57600080fd5b505af115801561295f573d6000803e3d6000fd5b505050506001600160a01b03821660009081526016602052604090208054600190811061299c57634e487b7160e01b600052603260045260246000fd5b600091825260209091200154604051634f896d4f60e01b8152600260048201526001600160a01b0390911690634f896d4f906024015b600060405180830381600087803b1580156129ec57600080fd5b505af1158015612a00573d6000803e3d6000fd5b505050506001600160a01b038216600090815260166020526040902080546002908110612a3d57634e487b7160e01b600052603260045260246000fd5b600091825260209091200154604051634f896d4f60e01b8152600160048201526001600160a01b0390911690634f896d4f906024015b600060405180830381600087803b158015612a8d57600080fd5b505af1158015612aa1573d6000803e3d6000fd5b50505050612f57565b8060021415612bc4576001600160a01b03821660009081526016602052604081208054909190612aea57634e487b7160e01b600052603260045260246000fd5b600091825260209091200154604051634f896d4f60e01b8152600260048201526001600160a01b0390911690634f896d4f90602401600060405180830381600087803b158015612b3957600080fd5b505af1158015612b4d573d6000803e3d6000fd5b505050506001600160a01b038216600090815260166020526040902080546001908110612b8a57634e487b7160e01b600052603260045260246000fd5b600091825260209091200154604051634f896d4f60e01b8152600160048201526001600160a01b0390911690634f896d4f906024016129d2565b8060031415612d7e576001600160a01b03821660009081526016602052604081208054909190612c0457634e487b7160e01b600052603260045260246000fd5b600091825260209091200154604051634f896d4f60e01b8152600160048201526001600160a01b0390911690634f896d4f90602401600060405180830381600087803b158015612c5357600080fd5b505af1158015612c67573d6000803e3d6000fd5b505050506001600160a01b038216600090815260166020526040902080546001908110612ca457634e487b7160e01b600052603260045260246000fd5b600091825260209091200154604051634f896d4f60e01b8152600160048201526001600160a01b0390911690634f896d4f90602401600060405180830381600087803b158015612cf357600080fd5b505af1158015612d07573d6000803e3d6000fd5b505050506001600160a01b038216600090815260166020526040902080546002908110612d4457634e487b7160e01b600052603260045260246000fd5b600091825260209091200154604051634f896d4f60e01b8152600260048201526001600160a01b0390911690634f896d4f90602401612a73565b6001600160a01b03821660009081526016602052604081208054909190612db557634e487b7160e01b600052603260045260246000fd5b6000918252602082200154604051634f896d4f60e01b815260048101929092526001600160a01b031690634f896d4f90602401600060405180830381600087803b158015612e0257600080fd5b505af1158015612e16573d6000803e3d6000fd5b505050506001600160a01b038216600090815260166020526040902080546001908110612e5357634e487b7160e01b600052603260045260246000fd5b6000918252602082200154604051634f896d4f60e01b815260048101929092526001600160a01b031690634f896d4f90602401600060405180830381600087803b158015612ea057600080fd5b505af1158015612eb4573d6000803e3d6000fd5b505050506001600160a01b038216600090815260166020526040902080546002908110612ef157634e487b7160e01b600052603260045260246000fd5b6000918252602082200154604051634f896d4f60e01b815260048101929092526001600160a01b031690634f896d4f90602401600060405180830381600087803b158015612f3e57600080fd5b505af1158015612f52573d6000803e3d6000fd5b505050505b60005b6001600160a01b0383166000908152601660205260409020548110156116ba576001600160a01b03831660009081526016602052604090208054612fd4919083908110612fb757634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546007906001600160a01b0316614b15565b6001600160a01b0383166000908152601660205260409020805461302e91908390811061301157634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546009906001600160a01b0316614c98565b8061303881615b2b565b915050612f5a565b60035460ff16156130635760405162461bcd60e51b8152600401610ad290615953565b61306b613dac565b60005b818110156116ba57600083838381811061309857634e487b7160e01b600052603260045260246000fd5b90506020020160208101906130ad9190615178565b90506130b881613640565b6130d45760405162461bcd60e51b8152600401610ad2906158e3565b60405163646d919f60e11b81523360048201526001600160a01b0382169063c8db233e90602401600060405180830381600087803b15801561311557600080fd5b505af1158015613129573d6000803e3d6000fd5b50505050613141816009614b1590919063ffffffff16565b6040516001600160a01b03821681527f16e62064e42f5aec62df22ae895ef539f153e0d4ea290e2cc4e0e8f708f2fbbc9060200160405180910390a1508061318881615b2b565b91505061306e565b613198613dac565b6001600160a01b0381166131e05760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b6044820152606401610ad2565b600154600160a81b900460ff16156132305760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481d1c985b9cd9995c9c9959606a1b6044820152606401610ad2565b600080546001600160a01b038381166201000081810262010000600160b01b031990941693909317938490556001805460ff60a81b1916600160a81b1790556040805193909404909116825260208201527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91016109fd565b6132b1613dac565b6132ba84613640565b6132d65760405162461bcd60e51b8152600401610ad2906158e3565b836001600160a01b0316639a82a09a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561330f57600080fd5b505afa158015613323573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061334791906154cb565b61338b5760405162461bcd60e51b815260206004820152601560248201527426b0b935b2ba103737ba1031b0b731b2b63632b21760591b6044820152606401610ad2565b6040516364ee874960e11b81526004810184905260248101839052604481018290526001600160a01b0385169063c9dd0e9290606401600060405180830381600087803b1580156133db57600080fd5b505af11580156133ef573d6000803e3d6000fd5b5050604080516001600160a01b038816815260208101879052908101859052606081018490527f11b2eca36fe7a3aaee80f5737d95923d4ac267614f4de9a91e63b24baa2bc1cf9250608001905060405180910390a150505050565b6000816001600160a01b0316635c975abb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561348657600080fd5b505afa15801561349a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5c91906154cb565b6007546000908210156135085760078054839081106134ed57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031692915050565b506000919050565b613518613dac565b60005b82518110156116ba578115156017600085848151811061354b57634e487b7160e01b600052603260045260246000fd5b60209081029190910181015182528101919091526040016000205460ff1615151461362e57816017600085848151811061359557634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002060006101000a81548160ff0219169083151502179055507fe98ab4bde655ceada15ea801bef97987659458457b2f770527e7c9ed5aeac98483828151811061360357634e487b7160e01b600052603260045260246000fd5b6020026020010151836040516136259291909182521515602082015260400190565b60405180910390a15b8061363881615b2b565b91505061351b565b600061364d60078361464f565b80610e5c5750610e5c60098361464f565b6060611f99600784846147ce565b6000546201000090046001600160a01b031633148061369a57503360009081526012602052604090205460ff165b6136b65760405162461bcd60e51b8152600401610ad2906158b9565b80156136fd5760405162461bcd60e51b815260206004820152601660248201527543616e206f6e6c79207365742030206f7574636f6d6560501b6044820152606401610ad2565b816001600160a01b0316633f6fa6556040518163ffffffff1660e01b815260040160206040518083038186803b15801561373657600080fd5b505afa15801561374a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061376e91906154cb565b6137b05760405162461bcd60e51b815260206004820152601360248201527213585c9ad95d081b9bdd081c995cdbdb1d9959606a1b6044820152606401610ad2565b6137bb60078361464f565b156137f85760405162461bcd60e51b815260206004820152600d60248201526c1058dd1a5d99481b585c9ad95d609a1b6044820152606401610ad2565b6001600160a01b03821660009081526014602052604090205460ff16156138315760405162461bcd60e51b8152600401610ad29061590c565b816001600160a01b0316635c975abb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561386a57600080fd5b505afa15801561387e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138a291906154cb565b15613902576040516305b0e2cf60e21b8152600060048201526001600160a01b038316906316c38b3c90602401600060405180830381600087803b1580156138e957600080fd5b505af11580156138fd573d6000803e3d6000fd5b505050505b604051634f896d4f60e01b8152600481018290526001600160a01b03831690634f896d4f90602401600060405180830381600087803b15801561394457600080fd5b505af1158015613958573d6000803e3d6000fd5b505050506001600160a01b03821660009081526016602052604090205415610c10576001600160a01b038216600090815260166020526040812080549091906139b157634e487b7160e01b600052603260045260246000fd5b6000918252602082200154604051634f896d4f60e01b815260048101929092526001600160a01b031690634f896d4f90602401600060405180830381600087803b1580156139fe57600080fd5b505af1158015613a12573d6000803e3d6000fd5b505050506001600160a01b038216600090815260166020526040902080546001908110613a4f57634e487b7160e01b600052603260045260246000fd5b6000918252602082200154604051634f896d4f60e01b815260048101929092526001600160a01b031690634f896d4f90602401600060405180830381600087803b158015613a9c57600080fd5b505af1158015613ab0573d6000803e3d6000fd5b505050506001600160a01b038216600090815260166020526040902080546002908110613aed57634e487b7160e01b600052603260045260246000fd5b6000918252602082200154604051634f896d4f60e01b815260048101929092526001600160a01b031690634f896d4f90602401611d48565b6000610e5c82614af1565b613b38613dac565b600e8054911515600160a01b0260ff60a01b19909216919091179055565b606080606083516001600160401b03811115613b8257634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015613bab578160200160208202803683370190505b50925083516001600160401b03811115613bd557634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015613bfe578160200160208202803683370190505b50915083516001600160401b03811115613c2857634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015613c51578160200160208202803683370190505b50905060005b8451811015613d5b57600080613c86878481518110611e1857634e487b7160e01b600052603260045260246000fd5b91509150613cad878481518110610b4a57634e487b7160e01b600052603260045260246000fd5b848481518110613ccd57634e487b7160e01b600052603260045260246000fd5b60200260200101901515908115158152505081868481518110613d0057634e487b7160e01b600052603260045260246000fd5b60200260200101901515908115158152505042811115858481518110613d3657634e487b7160e01b600052603260045260246000fd5b9115156020928302919091019091015250819050613d5381615b2b565b915050613c57565b509193909250565b613d6b613dac565b6015805460ff19168215159081179091556040519081527fafa98ec751b49f853d1a5f51c4b6df2a6248c9daa73a920ee644094abe32e41e906020016109fd565b6000546201000090046001600160a01b03163314613e245760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b6064820152608401610ad2565b565b60008060008390506000816001600160a01b0316639e3b34bf6040518163ffffffff1660e01b8152600401604080518083038186803b158015613e6857600080fd5b505afa158015613e7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ea0919061567e565b509050816001600160a01b031663ef83f7246040518163ffffffff1660e01b815260040160206040518083038186803b158015613edc57600080fd5b505afa158015613ef0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f1491906154cb565b9590945092505050565b6000816001600160a01b0316633f6fa6556040518163ffffffff1660e01b815260040160206040518083038186803b15801561348657600080fd5b6001600160a01b038116600090815260166020526040902054606090801561407a57806001600160401b03811115613fa157634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015613fca578160200160208202803683370190505b50915060005b81811015614078576001600160a01b038416600090815260166020526040902080548290811061401057634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b031683828151811061404e57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03909216602092830291909101909101528061407081615b2b565b915050613fd0565b505b50919050565b600d54604051631c2ab73160e21b81526004810187905286916000916001600160a01b03909116906370aadcc49060240160206040518083038186803b1580156140c957600080fd5b505afa1580156140dd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061410191906154e7565b60008181526017602052604090205490915060ff168015614124575060155460ff165b1561442b576040805160a0810182526011606080830182815270486f6d655465616d4e6f74546f4c6f736560781b608085015283528351808501855291825270417761795465616d4e6f74546f4c6f736560781b602080840191909152808401929092528351808501855260068152654e6f4472617760d01b81840152838501528351600280825291810185529293600093928301908036833701905050905084816000815181106141e657634e487b7160e01b600052603260045260246000fd5b6020026020010181815250506127138160018151811061421657634e487b7160e01b600052603260045260246000fd5b60200260200101818152505060005b60038110156144275760006142c96040518061012001604052808e6001600160a01b031681526020018d815260200186856003811061427457634e487b7160e01b600052603260045260246000fd5b6020020151815260200160405180604001604052808e81526020018d8152508152602001600281526020018581526020016000151581526020018a6001600160a01b0316815260200160011515815250614441565b90506142d6600782614c98565b6001600160a01b0388811660009081526016602090815260408083208054600180820183559185528385200180546001600160a01b031916878716908117909155808552601490935292819020805460ff19169093179092556013549151631c71e4e760e31b8152600481018f9052602481019190915291169063e38f273890604401600060405180830381600087803b15801561437357600080fd5b505af1158015614387573d6000803e3d6000fd5b505050507f0cf6abc895e0e76ef58c3555c8cd5ffca2afecb927fccd65c136122c0c39404f8882856001815181106143cf57634e487b7160e01b600052603260045260246000fd5b60200260200101518786600381106143f757634e487b7160e01b600052603260045260246000fd5b602002015160405161440c949392919061577a565b60405180910390a1508061441f81615b2b565b915050614225565b5050505b5050505050505050565b6000611f998284615abd565b600e54604051634f3565e360e01b815260009182916001600160a01b0390911690634f3565e3906144769086906004016159b0565b602060405180830381600087803b15801561449057600080fd5b505af11580156144a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144c89190615194565b90506144d5600782614c98565b6000806000836001600160a01b031663cc2ee1966040518163ffffffff1660e01b815260040160606040518083038186803b15801561451357600080fd5b505afa158015614527573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061454b91906155f9565b925092509250856020015186600001516001600160a01b03167f5b94d36374b7499bec3849984d165c16e10e3ee59241963bd809a169d1a9cf268689606001516000600281106145ab57634e487b7160e01b600052603260045260246000fd5b6020908102919091015160608c810151830151604080516001600160a01b039687168152948501939093528383015289841690830152878316608083015291861660a082015290519081900360c00190a37f319d1be996912ef0acee5fb7cc9b908129bf7bc7290609b7578839c4a1689bad8487604001516040516146319291906157b7565b60405180910390a15091949350505050565b6000611f998284615b14565b815460009061466057506000610e5c565b6001600160a01b0382166000908152600184016020526040902054801515806146c95750826001600160a01b0316846000016000815481106146b257634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b0316145b949350505050565b60008060008390506000816001600160a01b0316639e3b34bf6040518163ffffffff1660e01b8152600401604080518083038186803b15801561471357600080fd5b505afa158015614727573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061474b919061567e565b509050816001600160a01b031663ef83f7246040518163ffffffff1660e01b815260040160206040518083038186803b15801561478757600080fd5b505afa15801561479b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147bf91906154cb565b80613f145750613f1485614cea565b606060006147dc8385615abd565b85549091508111156147ec575083545b838111614809575050604080516000815260208101909152611f99565b60006148158583615b14565b90506000816001600160401b0381111561483f57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015614868578160200160208202803683370190505b50905060005b8281101561490757876148818883615abd565b8154811061489f57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b03168282815181106148dd57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0390921660209283029190910190910152806148ff81615b2b565b91505061486e565b509695505050505050565b6040516339acb21f60e21b815260048101839052602481018290526001600160a01b0384169063e6b2c87c90604401600060405180830381600087803b15801561495b57600080fd5b505af115801561496f573d6000803e3d6000fd5b5050604080516001600160a01b0387168152602081018690529081018490527f0915c734742076f135119aa0d73364ab8589b1a6d441c764678c275613a3c6e19250606001905060405180910390a1505050565b604051630ceda8e960e41b81526001600160a01b0385811660048301526000919083169063ceda8e909060240160206040518083038186803b158015614a0857600080fd5b505afa158015614a1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614a4091906154e7565b905060005b81811015611d765760405163088f63ab60e31b81526001600160a01b038781166004830152602482018390526000919085169063447b1d589060440160206040518083038186803b158015614a9957600080fd5b505afa158015614aad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614ad19190615194565b9050614ade818787614912565b5080614ae981615b2b565b915050614a45565b600e54600090600160a01b900460ff1615610ebe57610e5c64e8d4a5100083615ad5565b614b1f828261464f565b614b615760405162461bcd60e51b815260206004820152601360248201527222b632b6b2b73a103737ba1034b71039b2ba1760691b6044820152606401610ad2565b6001600160a01b0381166000908152600180840160205260408220548454909291614b8b91615b14565b9050808214614c33576000846000018281548110614bb957634e487b7160e01b600052603260045260246000fd5b60009182526020909120015485546001600160a01b0390911691508190869085908110614bf657634e487b7160e01b600052603260045260246000fd5b600091825260208083209190910180546001600160a01b0319166001600160a01b0394851617905592909116815260018601909152604090208290555b8354849080614c5257634e487b7160e01b600052603160045260246000fd5b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b0394909416815260019490940190925250506040812055565b614ca2828261464f565b610c105781546001600160a01b038216600081815260018086016020908152604083208590559084018655858252902090910180546001600160a01b03191690911790555050565b6000614cf7826001614d17565b80614d085750614d08826000614d17565b80610e5c5750610e5c82614f77565b60008060008315614db557601854604051630ceda8e960e41b81526001600160a01b0387811660048301529091169063ceda8e909060240160206040518083038186803b158015614d6757600080fd5b505afa158015614d7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614d9f91906154e7565b6018549092506001600160a01b03169050614e44565b601354604051630ceda8e960e41b81526001600160a01b0387811660048301529091169063ceda8e909060240160206040518083038186803b158015614dfa57600080fd5b505afa158015614e0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614e3291906154e7565b6013549092506001600160a01b031690505b60005b82811015614f6b5760405163088f63ab60e31b81526001600160a01b038781166004830152602482018390526000919084169063447b1d589060440160206040518083038186803b158015614e9b57600080fd5b505afa158015614eaf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614ed39190615194565b9050806001600160a01b031663ef83f7246040518163ffffffff1660e01b815260040160206040518083038186803b158015614f0e57600080fd5b505afa158015614f22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614f4691906154cb565b15614f58576001945050505050610e5c565b5080614f6381615b2b565b915050614e47565b50600095945050505050565b600080614f8383613f59565b905060005b815181101561508f5760006001600160a01b0316828281518110614fbc57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03161415801561506e5750818181518110614ff657634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031663ef83f7246040518163ffffffff1660e01b815260040160206040518083038186803b15801561503657600080fd5b505afa15801561504a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061506e91906154cb565b1561507d575060019392505050565b8061508781615b2b565b915050614f88565b5060009392505050565b8035610ec281615b72565b60008083601f8401126150b5578182fd5b5081356001600160401b038111156150cb578182fd5b6020830191508360208260051b85010111156150e657600080fd5b9250929050565b600082601f8301126150fd578081fd5b8135602061511261510d83615a9a565b615a6a565b80838252828201915082860187848660051b8901011115615131578586fd5b855b8581101561514f57813584529284019290840190600101615133565b5090979650505050505050565b8035610ec281615b87565b803560ff81168114610ec257600080fd5b600060208284031215615189578081fd5b8135611f9981615b72565b6000602082840312156151a5578081fd5b8151611f9981615b72565b6000806000606084860312156151c4578182fd5b83356151cf81615b72565b925060208401356151df81615b72565b929592945050506040919091013590565b60008060408385031215615202578182fd5b823561520d81615b72565b9150602083013561521d81615b87565b809150509250929050565b6000806040838503121561523a578182fd5b823561524581615b72565b9150602083013561521d81615b72565b60008060408385031215615267578182fd5b823561527281615b72565b946020939093013593505050565b60008060008060808587031215615295578081fd5b84356152a081615b72565b966020860135965060408601359560600135945092505050565b60008060008060008060c087890312156152d2578384fd5b86356152dd81615b72565b9550602087013594506152f260408801615167565b935061530060608801615167565b9250608087013561531081615b72565b915060a087013561532081615b87565b809150509295509295509295565b60008060208385031215615340578182fd5b82356001600160401b03811115615355578283fd5b615361858286016150a4565b90969095509350505050565b60008060008060608587031215615382578182fd5b84356001600160401b03811115615397578283fd5b6153a3878288016150a4565b90955093505060208501356153b781615b87565b91506153c560408601615167565b905092959194509250565b600060208083850312156153e2578182fd5b82356001600160401b038111156153f7578283fd5b8301601f81018513615407578283fd5b803561541561510d82615a9a565b80828252848201915084840188868560051b8701011115615434578687fd5b8694505b8385101561545f57803561544b81615b72565b835260019490940193918501918501615438565b50979650505050505050565b6000806040838503121561547d578182fd5b82356001600160401b03811115615492578283fd5b61549e858286016150ed565b925050602083013561521d81615b87565b6000602082840312156154c0578081fd5b8135611f9981615b87565b6000602082840312156154dc578081fd5b8151611f9981615b87565b6000602082840312156154f8578081fd5b5051919050565b600080600080600080600080610100898b03121561551b578586fd5b883597506020808a01356001600160401b0380821115615539578889fd5b818c0191508c601f83011261554c578889fd5b81358181111561555e5761555e615b5c565b615570601f8201601f19168501615a6a565b8181528e85838601011115615583578a8bfd5b81858501868301378a858383010152809b50505060408c0135985060608c0135975060808c0135965060a08c01359250808311156155bf578485fd5b50506155cd8b828c016150ed565b9350506155dc60c08a0161515c565b91506155ea60e08a01615099565b90509295985092959890939650565b60008060006060848603121561560d578081fd5b835161561881615b72565b602085015190935061562981615b72565b604085015190925061563a81615b72565b809150509250925092565b600060208284031215615656578081fd5b5035919050565b6000806040838503121561566f578182fd5b50508035926020909101359150565b60008060408385031215615690578182fd5b505080516020909101519092909150565b6000815180845260208085019450808401835b838110156156d25781511515875295820195908201906001016156b4565b509495945050505050565b8060005b60028110156112455781518452602093840193909101906001016156e1565b6000815180845260208085019450808401835b838110156156d257815187529582019590820190600101615713565b60008151808452815b8181101561575457602081850181015186830182015201615738565b818111156157655782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906157ad9083018461572f565b9695505050505050565b6001600160a01b03831681526040602082018190526000906146c99083018461572f565b6020808252825182820181905260009190848201906040850190845b8181101561581c5783516001600160a01b0316835292840192918401916001016157f7565b50909695505050505050565b60608152600061583b60608301866156a1565b828103602084015261584d81866156a1565b905082810360408401526157ad81856156a1565b60808152600061587460808301876156a1565b828103602084015261588681876156a1565b9050828103604084015261589a81866156a1565b905082810360608401526158ae8185615700565b979650505050505050565b60208082526010908201526f24b73b30b634b2103932b9b7b63b32b960811b604082015260600190565b6020808252600f908201526e26b0b935b2ba103ab735b737bbb71760891b604082015260600190565b60208082526027908201527f4e6f7420737570706f7274656420666f7220646f75626c65206368616e6365206040820152666d61726b65747360c81b606082015260800190565b6020808252603c908201527f5468697320616374696f6e2063616e6e6f7420626520706572666f726d65642060408201527f7768696c652074686520636f6e74726163742069732070617573656400000000606082015260800190565b602081526159ca6020820183516001600160a01b03169052565b60208201516040820152600060408301516101408060608501526159f261016085018361572f565b91506060850151615a0660808601826156dd565b50608085015160c085015260a0850151848303601f190160e0860152615a2c8382615700565b92505060c0850151610100615a448187018315159052565b60e08701516001600160a01b031661012087015290950151151593019290925250919050565b604051601f8201601f191681016001600160401b0381118282101715615a9257615a92615b5c565b604052919050565b60006001600160401b03821115615ab357615ab3615b5c565b5060051b60200190565b60008219821115615ad057615ad0615b46565b500190565b600082615af057634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615615b0f57615b0f615b46565b500290565b600082821015615b2657615b26615b46565b500390565b6000600019821415615b3f57615b3f615b46565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610e4e57600080fd5b8015158114610e4e57600080fdfea2646970667358221220753bff78ceed73961a5002f39ac803c65f41ea7ed47fd52c0b7f9cd1328cdbf164736f6c63430008040033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 29 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.