Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x29E1e561...b82450095 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
PredictionMarket
Compiler Version
v0.8.21+commit.d9974bed
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; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./RefProgramCodeGenerator.sol"; import "./Gelato/AutomateTaskCreator.sol"; import "./IUniswapV2Factory.sol"; import "./IUniswapV2Router.sol"; interface IERC20Balance { function decimals() external view returns (uint8); } interface IPredictionFactory { function addEthPayout(uint256 value) external; function owner() external view returns (address); } interface INonce { function generatedNonce( address user, uint256 roundID ) external pure returns (uint256); } contract PredictionMarket is Ownable, ReentrancyGuard, AutomateTaskCreator { using EnumerableSet for EnumerableSet.UintSet; using EnumerableSet for EnumerableSet.AddressSet; event BetBear(address indexed user, uint256 indexed round, uint256 amount); event BetBull(address indexed user, uint256 indexed round, uint256 amount); event BullClaimed( address indexed user, uint256 roundId, uint256 amountClaimed ); event BearClaimed( address indexed user, uint256 roundId, uint256 amountClaimed ); event CounterTaskCreated(bytes32 taskId); receive() external payable {} address public predictionFactory; AggregatorV3Interface internal dataFeed; bytes32 public taskId; address private _refProgramCodeGenerator; bool public isRefProgramOpen; mapping(address => EnumerableSet.UintSet) private _userActivatedCodes; mapping(address => EnumerableSet.UintSet) private _userGeneratedCodes; mapping(uint256 => EnumerableSet.AddressSet) private _CodeClaimedAddresses; uint256 public totalCodesUsed; address public router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; address public treasuryWallet; address public token; address public pair; uint256 public roundID; uint256 public roundPeriod = 30 minutes; uint256 public bufferTime = 40; uint256 public minimumBet = 0.01 ether; uint256 public poolFee = 500; bool public isStopped; struct Round { uint256 startTimestamp; uint256 expireTimestamp; uint256 openPrice; uint256 closePrice; uint256 bearBetsAmount; uint256 bullBetsAmount; uint256 totalEthBets; bool roundClose; } mapping(uint256 => Round) private rounds; struct UserEntries { uint256 bullEntries; uint256 bearEntries; uint256 totalEthBetted; uint256 totalEthWon; bool bullClaimed; bool bearClaimed; } mapping(address => mapping(uint256 => UserEntries)) private userEntries; mapping(address => EnumerableSet.UintSet) private _userBetRounds; uint256 public totalEthPayoutsMade; constructor( address _token, address _automate, address _fundsOwner ) payable AutomateTaskCreator(_automate, _fundsOwner) { require(hasEthLiquidity(_token), "Pair has no liquidity"); dataFeed = AggregatorV3Interface( 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419 ); token = _token; pair = getPair(_token); treasuryWallet = _fundsOwner; predictionFactory = msg.sender; require(pair != address(0), "No pair found"); depositFunds(msg.value, 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE); createTask(); } // Ref programm function getUserActivatedCodes( address user ) public view returns (uint256[] memory) { return _userActivatedCodes[user].values(); } function getUserGeneratedCodes( address user ) public view returns (uint256[] memory) { return _userGeneratedCodes[user].values(); } function getCodesUsedAddresses( uint256 code ) public view returns (address[] memory) { return _CodeClaimedAddresses[code].values(); } function getCodesUsedCount(uint256 code) public view returns (uint256) { return _CodeClaimedAddresses[code].length(); } function getUserGeneratedCodesCount( address user ) public view returns (uint256) { return _userGeneratedCodes[user].length(); } function getUserActivatedCodesCount( address user ) public view returns (uint256) { return _userActivatedCodes[user].length(); } function isCodeUsable( uint256 code, address user ) public view returns (bool) { address sharer = _CodeClaimedAddresses[code].at(0); if (_CodeClaimedAddresses[code].length() != 1 || user == sharer) { return false; } if (sharer == address(0)) { return false; } return true; } function updateRefProgrammStatus() public onlyOwner { if (!isRefProgramOpen && _refProgramCodeGenerator == address(0)) { RefProgramCodeGenerator refProgramCodeGenerator = new RefProgramCodeGenerator(); _refProgramCodeGenerator = address(refProgramCodeGenerator); } isRefProgramOpen = !isRefProgramOpen; } function setPoolFee(uint256 _newFee) external onlyOwner { require(_newFee <= 2_000, "Fee too high"); poolFee = _newFee; } function setRoundPeriod(uint256 _newRoundPeriod) public onlyOwner { roundPeriod = _newRoundPeriod; } // End ref program function depositFunds(uint256 _amount, address _token) public payable { uint256 ethValue = _token == ETH ? _amount : 0; taskTreasury.depositFunds{value: ethValue}( address(this), _token, _amount ); } function createTask() public { require(taskId == bytes32(""), "Already started task"); ModuleData memory moduleData = ModuleData({ modules: new Module[](2), args: new bytes[](2) }); moduleData.modules[0] = Module.RESOLVER; moduleData.modules[1] = Module.PROXY; moduleData.args[0] = _resolverModuleArg( address(this), abi.encodeCall(this.checker, ()) ); moduleData.args[1] = _proxyModuleArg(); bytes32 id = _createTask( address(this), abi.encode(this.startNewRound.selector), moduleData, address(0) ); taskId = id; emit CounterTaskCreated(id); } function getRoundInfo( uint256 roundId ) public view returns ( uint256 startTimestamp, uint256 expireTimestamp, uint256 openPrice, uint256 closePrice, uint256 bearBetsAmount, uint256 bullBetsAmount, uint256 totalEthBets, bool roundClose ) { Round storage round = rounds[roundId]; return ( round.startTimestamp, round.expireTimestamp, round.openPrice, round.closePrice, round.bearBetsAmount, round.bullBetsAmount, round.totalEthBets, round.roundClose ); } function getUserEntries( address user, uint256 roundId ) public view returns ( uint256 bullEntries, uint256 bearEntries, uint256 totalEthBetted, uint256 totalEthWon, bool bullClaimed, bool bearClaimed ) { UserEntries storage entries = userEntries[user][roundId]; return ( entries.bullEntries, entries.bearEntries, entries.totalEthBetted, entries.totalEthWon, entries.bullClaimed, entries.bearClaimed ); } function getUserRounds( address user ) public view returns (uint256[] memory) { return _userBetRounds[user].values(); } function getTokenPriceEth() internal view returns (uint256) { uint256 totalEth = IERC20(IUniswapV2Router01(router).WETH()).balanceOf( pair ) * 10 ** IERC20Balance(token).decimals(); uint256 tokenBalance = IERC20(token).balanceOf(pair); return totalEth / tokenBalance; } function getChainlinkDataFeedLatestAnswer() internal view returns (int) { // prettier-ignore ( /* uint80 roundID */, int answer, /*uint startedAt*/, /*uint timeStamp*/, /*uint80 answeredInRound*/ ) = dataFeed.latestRoundData(); return answer; } function getTokenPriceUSD() public view returns (uint256) { uint256 ethPrice = uint256(getChainlinkDataFeedLatestAnswer()); uint256 tokenEthPrice = getTokenPriceEth(); return ethPrice * tokenEthPrice; } function getPair(address _token) internal view returns (address) { address _pair; address factory = IUniswapV2Router01(router).factory(); address wEth = IUniswapV2Router01(router).WETH(); _pair = IUniswapV2Factory(factory).getPair(_token, wEth); return _pair; } function checker() public view returns (bool canExec, bytes memory execPayload) { Round storage roundData = rounds[roundID]; if (roundID == 0 && roundData.startTimestamp == 0) { canExec = true; } else if (!isStopped) { canExec = roundData.expireTimestamp < block.timestamp; } execPayload = abi.encodeCall(this.startNewRound, ()); } function stop() public { require( msg.sender == owner() || msg.sender == IPredictionFactory(predictionFactory).owner() ); isStopped = !isStopped; } function newRoundStartable() public view returns (bool canExec) { Round storage roundData = rounds[roundID]; if (roundID == 0 && roundData.startTimestamp == 0) { canExec = true; } else if (!isStopped) { canExec = roundData.expireTimestamp < block.timestamp; } } function startNewRound() public { require(newRoundStartable(), "Round not ended"); Round storage currentRound = rounds[roundID]; Round storage nextRound = rounds[roundID + 1]; if (roundID == 0 && currentRound.startTimestamp == 0) { currentRound.startTimestamp = block.timestamp; currentRound.expireTimestamp = block.timestamp + roundPeriod; currentRound.openPrice = getTokenPriceUSD(); } else { currentRound.closePrice = getTokenPriceUSD(); currentRound.roundClose = true; nextRound.startTimestamp = block.timestamp; nextRound.expireTimestamp = block.timestamp + roundPeriod; nextRound.openPrice = getTokenPriceUSD(); roundID++; } } function roundResult(uint256 _roundID) public view returns (bool isBull) { Round storage roundData = rounds[_roundID]; return (roundData.openPrice < roundData.closePrice); } function isEven(uint256 _roundID) public view returns (bool) { Round storage roundData = rounds[_roundID]; return (roundData.openPrice == roundData.closePrice); } function bettingOpen() public view returns (bool) { Round storage roundData = rounds[roundID]; return roundData.expireTimestamp - bufferTime > block.timestamp; } function enterBull(uint256 amount, uint256 refCode) public payable { require(amount == msg.value, "Amount incorrect"); require(msg.value >= minimumBet, "Bet more"); UserEntries storage userData = userEntries[msg.sender][roundID + 1]; require( userData.bearEntries == 0 && userData.bullEntries == 0, "Already entered" ); bool canBet = bettingOpen(); require(canBet); if (isRefProgramOpen) { uint256 userNonce = INonce(_refProgramCodeGenerator).generatedNonce( _msgSender(), roundID ) % 9999999; _userGeneratedCodes[msg.sender].add(userNonce); _userActivatedCodes[msg.sender].add(userNonce); _CodeClaimedAddresses[userNonce].add(msg.sender); totalCodesUsed++; if (refCode != 0) { require( isCodeUsable(refCode, msg.sender), "Code does not exist or used" ); address sharer = _CodeClaimedAddresses[refCode].at(0); uint256 newCode = refCode % 9999; _userActivatedCodes[sharer].add(newCode); _userActivatedCodes[msg.sender].add(refCode); _CodeClaimedAddresses[refCode].add(msg.sender); totalCodesUsed++; } } Round storage roundData = rounds[roundID + 1]; uint256 fee = (amount * poolFee) / 10_000; bool success; (success, ) = address(treasuryWallet).call{value: fee}(""); amount -= fee; roundData.bullBetsAmount += amount; roundData.totalEthBets += amount; userData.bullEntries += amount; userData.totalEthBetted += amount; _userBetRounds[msg.sender].add(roundID + 1); emit BetBull(msg.sender, roundID + 1, amount); } function enterBear(uint256 amount, uint256 refCode) public payable { require(amount == msg.value, "Amount incorrect"); require(msg.value >= minimumBet, "Bet more"); UserEntries storage userData = userEntries[msg.sender][roundID + 1]; require( userData.bullEntries == 0 || userData.bearEntries == 0, "Already entered" ); bool canBet = bettingOpen(); require(canBet); if (isRefProgramOpen) { uint256 userNonce = INonce(_refProgramCodeGenerator).generatedNonce( _msgSender(), roundID ) % 9999999; _userGeneratedCodes[msg.sender].add(userNonce); _userActivatedCodes[msg.sender].add(userNonce); _CodeClaimedAddresses[userNonce].add(msg.sender); totalCodesUsed++; if (refCode != 0) { require( isCodeUsable(refCode, msg.sender), "Code does not exist or used" ); address sharer = _CodeClaimedAddresses[refCode].at(0); uint256 newCode = refCode % 9999; _userActivatedCodes[sharer].add(newCode); _userActivatedCodes[msg.sender].add(refCode); _CodeClaimedAddresses[refCode].add(msg.sender); totalCodesUsed++; } } Round storage roundData = rounds[roundID + 1]; uint256 fee = (amount * poolFee) / 10_000; bool success; (success, ) = address(treasuryWallet).call{value: fee}(""); amount -= fee; roundData.bearBetsAmount += amount; roundData.totalEthBets += amount; userData.bearEntries += amount; userData.totalEthBetted += amount; _userBetRounds[msg.sender].add(roundID + 1); emit BetBear(msg.sender, roundID + 1, amount); } function bullShare( address user, uint256 _roundID ) public view returns (uint256 share) { Round storage roundData = rounds[_roundID]; UserEntries storage userData = userEntries[user][_roundID]; uint256 bullAmnt = roundData.bullBetsAmount; uint256 betAmnt = userData.bullEntries; if (betAmnt > 0) { share = (betAmnt * 10_000) / bullAmnt; } else { share = 0; } } function bearShare( address user, uint256 _roundID ) public view returns (uint256 share) { Round storage roundData = rounds[_roundID]; UserEntries storage userData = userEntries[user][_roundID]; uint256 bearAmnt = roundData.bearBetsAmount; uint256 betAmnt = userData.bearEntries; if (betAmnt > 0) { share = (betAmnt * 10_000) / bearAmnt; } else { share = 0; } } function bullMutiplier(uint256 _roundID) public view returns (uint256) { Round storage roundData = rounds[_roundID]; uint256 bulls = roundData.bullBetsAmount; uint256 bears = roundData.bearBetsAmount; uint256 multipiler; if (bulls > 0 && bears > 0) { multipiler = 10_000 + ((bears * 10_000) / bulls); } else if (bears > 0 && bulls == 0) { multipiler = 10_000 + ((bears * 10_000) / minimumBet); } else { multipiler = 10_000; } return multipiler; } function bearMutiplier(uint256 _roundID) public view returns (uint256) { Round storage roundData = rounds[_roundID]; uint256 bulls = roundData.bullBetsAmount; uint256 bears = roundData.bearBetsAmount; uint256 multipiler; if (bears > 0 && bulls > 0) { multipiler = 10_000 + ((bulls * 10_000) / bears); } else if (bulls > 0 && bears == 0) { multipiler = 10_000 + ((bulls * 10_000) / minimumBet); } else { multipiler = 10_000; } return multipiler; } function rewardBullsClaimableAmntsView( address user, uint256 _roundID ) public view returns (uint256 amountClaimable) { Round storage roundData = rounds[_roundID]; UserEntries storage userData = userEntries[user][_roundID]; uint256 userShare = bullShare(user, _roundID); uint256 totalEthPot = roundData.totalEthBets; bool isClaimable = totalEthPot > 0 && userShare > 0 && roundData.roundClose && roundResult(_roundID); amountClaimable = 0; if (isClaimable) { amountClaimable = (totalEthPot * userShare) / 10_000; } else if ( !roundResult(_roundID) && roundData.bearBetsAmount == 0 && userShare > 0 ) { amountClaimable = userData.bullEntries; } } function rewardBearsClaimableAmntsView( address user, uint256 _roundID ) public view returns (uint256 amountClaimable) { Round storage roundData = rounds[_roundID]; UserEntries storage userData = userEntries[user][_roundID]; uint256 userShare = bearShare(user, _roundID); uint256 totalEthPot = roundData.totalEthBets; bool isClaimable = totalEthPot > 0 && userShare > 0 && roundData.roundClose && !roundResult(_roundID); amountClaimable = 0; if (isClaimable) { amountClaimable = (totalEthPot * userShare) / 10_000; } else if ( roundResult(_roundID) && roundData.bullBetsAmount == 0 && roundData.roundClose && userShare > 0 ) { amountClaimable = userData.bearEntries; } } function rewardBullsClaimableAmnts( address user, uint256 _roundID ) public view returns (uint256 amountClaimable) { Round storage roundData = rounds[_roundID]; UserEntries storage userData = userEntries[user][_roundID]; uint256 userShare = bullShare(user, _roundID); uint256 totalEthPot = roundData.totalEthBets; bool isClaimable = totalEthPot > 0 && userShare > 0 && roundData.roundClose && roundResult(_roundID) && !userData.bullClaimed; if (isClaimable) { amountClaimable = (totalEthPot * userShare) / 10_000; } else if ( !roundResult(_roundID) && roundData.bearBetsAmount == 0 && userShare > 0 && roundData.roundClose && !userData.bullClaimed ) { amountClaimable = userData.bullEntries; } } function rewardBearsClaimableAmnts( address user, uint256 _roundID ) public view returns (uint256 amountClaimable) { Round storage roundData = rounds[_roundID]; UserEntries storage userData = userEntries[user][_roundID]; uint256 userShare = bearShare(user, _roundID); uint256 totalEthPot = roundData.totalEthBets; bool isClaimable = totalEthPot > 0 && userShare > 0 && roundData.roundClose && !roundResult(_roundID) && !userData.bearClaimed; if (isClaimable) { amountClaimable = (totalEthPot * userShare) / 10_000; } else if ( roundResult(_roundID) && roundData.bullBetsAmount == 0 && userShare > 0 && !userData.bearClaimed ) { amountClaimable = userData.bearEntries; } } function claimBull( address user, uint256 _roundID ) internal returns (uint256 amntClaimed) { UserEntries storage userData = userEntries[user][_roundID]; uint256 userShare = bullShare(user, _roundID); require(userShare > 0, "No claims"); require(!userData.bullClaimed, "already claimed"); require(!isEven(_roundID)); uint256 totalAmntWon = rewardBullsClaimableAmnts(user, _roundID); bool success; (success, ) = address(user).call{value: totalAmntWon}(""); userData.totalEthWon += totalAmntWon; userData.bullClaimed = true; IPredictionFactory(predictionFactory).addEthPayout(totalAmntWon); amntClaimed = totalAmntWon; emit BullClaimed(user, _roundID, totalAmntWon); } function claimBear( address user, uint256 _roundID ) internal returns (uint256 amntClaimed) { UserEntries storage userData = userEntries[user][_roundID]; uint256 userShare = bearShare(user, _roundID); require(userShare > 0, "No claims"); require(!userData.bearClaimed, "already claimed"); require(!isEven(_roundID)); uint256 totalAmntWon = rewardBearsClaimableAmnts(user, _roundID); bool success; (success, ) = address(user).call{value: totalAmntWon}(""); userData.totalEthWon += totalAmntWon; userData.bearClaimed = true; IPredictionFactory(predictionFactory).addEthPayout(totalAmntWon); amntClaimed = totalAmntWon; emit BearClaimed(user, _roundID, totalAmntWon); } function claimWinnings(address user, uint256 _roundID) public nonReentrant { Round storage roundData = rounds[_roundID]; UserEntries storage userData = userEntries[user][_roundID]; uint256 userBullShare = bullShare(user, _roundID); uint256 userBearShare = bearShare(user, _roundID); require(roundData.roundClose, "Round is not closed"); require(userBullShare > 0 || userBearShare > 0, "Nothing to claim"); if (roundResult(_roundID) && !isEven(_roundID) && userBullShare > 0) { totalEthPayoutsMade += claimBull(user, _roundID); } else if ( !roundResult(_roundID) && !isEven(_roundID) && userBearShare > 0 ) { totalEthPayoutsMade += claimBear(user, _roundID); } else if (isEven(_roundID)) { if (userBullShare > 0) { bool success; (success, ) = address(user).call{value: userData.bullEntries}( "" ); totalEthPayoutsMade += userData.bullEntries; userData.totalEthWon += userData.bullEntries; userData.bullClaimed = true; emit BullClaimed(user, _roundID, userData.bullEntries); } else if (userBearShare > 0) { bool success; (success, ) = address(user).call{value: userData.bearEntries}( "" ); totalEthPayoutsMade += userData.bearEntries; userData.totalEthWon += userData.bearEntries; userData.bearClaimed = true; emit BearClaimed(user, _roundID, userData.bullEntries); } } if ( userBullShare > 0 && roundData.bearBetsAmount == 0 && !roundResult(_roundID) && !userData.bullClaimed ) { totalEthPayoutsMade += claimBull(user, _roundID); } if ( userBearShare > 0 && roundData.bullBetsAmount == 0 && roundResult(_roundID) && !userData.bearClaimed ) { totalEthPayoutsMade += claimBear(user, _roundID); } } function hasEthLiquidity(address tokenAddress) public view returns (bool) { address[] memory path = new address[](2); path[0] = tokenAddress; path[1] = IUniswapV2Router01(router).WETH(); try IUniswapV2Router01(router).getAmountsOut(0.01 ether, path) returns ( uint256[] memory amounts ) { return amounts[1] > 0; } catch { return false; } } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.8.0; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function quote( uint amountA, uint reserveA, uint reserveB ) external pure returns (uint amountB); function getAmountsOut( uint256 amountIn, address[] memory path ) external view returns (uint256[] memory amounts); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.8.0; interface IUniswapV2Factory { event PairCreated( address indexed token0, address indexed token1, address pair, uint ); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.14; import "./AutomateReady.sol"; /** * @dev Inherit this contract to allow your smart contract * to be a task creator and create tasks. */ abstract contract AutomateTaskCreator is AutomateReady { using SafeERC20 for IERC20; address public immutable fundsOwner; ITaskTreasuryUpgradable public immutable taskTreasury; constructor( address _automate, address _fundsOwner ) AutomateReady(_automate, address(this)) { fundsOwner = _fundsOwner; taskTreasury = automate.taskTreasury(); } /** * @dev * Withdraw funds from this contract's Gelato balance to fundsOwner. */ function withdrawFunds(uint256 _amount) external { require( msg.sender == fundsOwner, "Only funds owner can withdraw funds" ); taskTreasury.withdrawFunds( payable(fundsOwner), 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE, _amount ); } function _depositFunds(uint256 _amount, address _token) internal { uint256 ethValue = _token == ETH ? _amount : 0; taskTreasury.depositFunds{value: ethValue}( address(this), _token, _amount ); } function _createTask( address _execAddress, bytes memory _execDataOrSelector, ModuleData memory _moduleData, address _feeToken ) internal returns (bytes32) { return automate.createTask( _execAddress, _execDataOrSelector, _moduleData, _feeToken ); } function _cancelTask(bytes32 _taskId) internal { automate.cancelTask(_taskId); } function _resolverModuleArg( address _resolverAddress, bytes memory _resolverData ) internal pure returns (bytes memory) { return abi.encode(_resolverAddress, _resolverData); } function _timeModuleArg( uint256 _startTime, uint256 _interval ) internal pure returns (bytes memory) { return abi.encode(uint128(_startTime), uint128(_interval)); } function _proxyModuleArg() internal pure returns (bytes memory) { return bytes(""); } function _singleExecModuleArg() internal pure returns (bytes memory) { return bytes(""); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.2 <0.9.0; contract RefProgramCodeGenerator { function generatedNonce( address user, uint256 roundID ) public pure returns (uint256) { uint256 id = uint256( keccak256(abi.encodePacked(user, roundID)) ) % 9999; uint256 randomNumber = uint256(keccak256(abi.encodePacked(id, user))); return randomNumber; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); function getRoundData( uint80 _roundId ) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.14; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./Types.sol"; /** * @dev Inherit this contract to allow your smart contract to * - Make synchronous fee payments. * - Have call restrictions for functions to be automated. */ // solhint-disable private-vars-leading-underscore abstract contract AutomateReady { IAutomate public immutable automate; address public immutable dedicatedMsgSender; address private immutable feeCollector; address internal constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; address private constant OPS_PROXY_FACTORY = 0xC815dB16D4be6ddf2685C201937905aBf338F5D7; /** * @dev * Only tasks created by _taskCreator defined in constructor can call * the functions with this modifier. */ modifier onlyDedicatedMsgSender() { require(msg.sender == dedicatedMsgSender, "Only dedicated msg.sender"); _; } /** * @dev * _taskCreator is the address which will create tasks for this contract. */ constructor(address _automate, address _taskCreator) { automate = IAutomate(_automate); IGelato gelato = IGelato(IAutomate(_automate).gelato()); feeCollector = gelato.feeCollector(); (dedicatedMsgSender, ) = IOpsProxyFactory(OPS_PROXY_FACTORY).getProxyOf( _taskCreator ); } /** * @dev * Transfers fee to gelato for synchronous fee payments. * * _fee & _feeToken should be queried from IAutomate.getFeeDetails() */ function _transfer(uint256 _fee, address _feeToken) internal { if (_feeToken == ETH) { (bool success, ) = feeCollector.call{value: _fee}(""); require(success, "_transfer: ETH transfer failed"); } else { SafeERC20.safeTransfer(IERC20(_feeToken), feeCollector, _fee); } } function _getFeeDetails() internal view returns (uint256 fee, address feeToken) { (fee, feeToken) = automate.getFeeDetails(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.12; enum Module { RESOLVER, TIME, PROXY, SINGLE_EXEC } struct ModuleData { Module[] modules; bytes[] args; } interface IAutomate { function createTask( address execAddress, bytes calldata execDataOrSelector, ModuleData calldata moduleData, address feeToken ) external returns (bytes32 taskId); function cancelTask(bytes32 taskId) external; function getFeeDetails() external view returns (uint256, address); function gelato() external view returns (address payable); function taskTreasury() external view returns (ITaskTreasuryUpgradable); } interface ITaskTreasuryUpgradable { function depositFunds( address receiver, address token, uint256 amount ) external payable; function withdrawFunds( address payable receiver, address token, uint256 amount ) external; } interface IOpsProxyFactory { function getProxyOf(address account) external view returns (address, bool); } interface IGelato { function feeCollector() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_automate","type":"address"},{"internalType":"address","name":"_fundsOwner","type":"address"}],"stateMutability":"payable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountClaimed","type":"uint256"}],"name":"BearClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"round","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BetBear","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"round","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BetBull","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountClaimed","type":"uint256"}],"name":"BullClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"taskId","type":"bytes32"}],"name":"CounterTaskCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"automate","outputs":[{"internalType":"contract IAutomate","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_roundID","type":"uint256"}],"name":"bearMutiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"_roundID","type":"uint256"}],"name":"bearShare","outputs":[{"internalType":"uint256","name":"share","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bettingOpen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bufferTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_roundID","type":"uint256"}],"name":"bullMutiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"_roundID","type":"uint256"}],"name":"bullShare","outputs":[{"internalType":"uint256","name":"share","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"checker","outputs":[{"internalType":"bool","name":"canExec","type":"bool"},{"internalType":"bytes","name":"execPayload","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"_roundID","type":"uint256"}],"name":"claimWinnings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"createTask","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dedicatedMsgSender","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_token","type":"address"}],"name":"depositFunds","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"refCode","type":"uint256"}],"name":"enterBear","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"refCode","type":"uint256"}],"name":"enterBull","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"fundsOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"code","type":"uint256"}],"name":"getCodesUsedAddresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"code","type":"uint256"}],"name":"getCodesUsedCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"roundId","type":"uint256"}],"name":"getRoundInfo","outputs":[{"internalType":"uint256","name":"startTimestamp","type":"uint256"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"},{"internalType":"uint256","name":"openPrice","type":"uint256"},{"internalType":"uint256","name":"closePrice","type":"uint256"},{"internalType":"uint256","name":"bearBetsAmount","type":"uint256"},{"internalType":"uint256","name":"bullBetsAmount","type":"uint256"},{"internalType":"uint256","name":"totalEthBets","type":"uint256"},{"internalType":"bool","name":"roundClose","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokenPriceUSD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserActivatedCodes","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserActivatedCodesCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roundId","type":"uint256"}],"name":"getUserEntries","outputs":[{"internalType":"uint256","name":"bullEntries","type":"uint256"},{"internalType":"uint256","name":"bearEntries","type":"uint256"},{"internalType":"uint256","name":"totalEthBetted","type":"uint256"},{"internalType":"uint256","name":"totalEthWon","type":"uint256"},{"internalType":"bool","name":"bullClaimed","type":"bool"},{"internalType":"bool","name":"bearClaimed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserGeneratedCodes","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserGeneratedCodesCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserRounds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"hasEthLiquidity","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"code","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"isCodeUsable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_roundID","type":"uint256"}],"name":"isEven","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isRefProgramOpen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isStopped","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minimumBet","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"newRoundStartable","outputs":[{"internalType":"bool","name":"canExec","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"predictionFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"_roundID","type":"uint256"}],"name":"rewardBearsClaimableAmnts","outputs":[{"internalType":"uint256","name":"amountClaimable","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"_roundID","type":"uint256"}],"name":"rewardBearsClaimableAmntsView","outputs":[{"internalType":"uint256","name":"amountClaimable","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"_roundID","type":"uint256"}],"name":"rewardBullsClaimableAmnts","outputs":[{"internalType":"uint256","name":"amountClaimable","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"_roundID","type":"uint256"}],"name":"rewardBullsClaimableAmntsView","outputs":[{"internalType":"uint256","name":"amountClaimable","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"roundID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"roundPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_roundID","type":"uint256"}],"name":"roundResult","outputs":[{"internalType":"bool","name":"isBull","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newFee","type":"uint256"}],"name":"setPoolFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newRoundPeriod","type":"uint256"}],"name":"setRoundPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startNewRound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"taskId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"taskTreasury","outputs":[{"internalType":"contract ITaskTreasuryUpgradable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalCodesUsed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalEthPayoutsMade","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasuryWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"updateRefProgrammStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Deployed Bytecode
0x608060405260043610610374575f3560e01c80638da5cb5b116101c8578063c1dea166116100fd578063e16eeac71161009d578063f785de231161006d578063f785de2314610b17578063f887ea4014610b2a578063fbeffd0f14610b49578063fc0c546a14610b68575f80fd5b8063e16eeac714610a87578063e40fd8fe14610aa6578063e60a321314610ac5578063f2fde38b14610af8575f80fd5b8063cf5303cf116100d8578063cf5303cf14610a07578063cfba0a4e14610a29578063d27ace4a14610a3c578063d354e7c814610a68575f80fd5b8063c1dea166146109bf578063c38a8afd146109de578063c70c01bd146109f3575f80fd5b8063a747649311610168578063ac50d95111610143578063ac50d951146108da578063b64c6268146108fa578063ba7b670314610996578063bd85948c146109ab575f80fd5b8063a747649314610888578063a8aa1b311461089c578063a8f2d676146108bb575f80fd5b80639932d36f116101a35780639932d36f146108225780639fc65bac14610835578063a47a4cee14610854578063a5c9d93014610873575f80fd5b80638da5cb5b146107c85780639501dc87146107e457806397aaec9414610803575f80fd5b80632a2e1320116102a95780633c9d35cb11610249578063522543971161021957806352254397146106eb578063706812d4146106ff578063715018a61461071457806388c3ffb014610728575f80fd5b80633c9d35cb146106615780633f683b6a146106805780634626402b1461069957806346ee3c59146106b8575f80fd5b806333fc4f981161028457806333fc4f98146105e557806335098bcd146106045780633a506294146106235780633af3adaf14610642575f80fd5b80632a2e1320146105645780632bed99a31461059a5780633322b23d146105d0575f80fd5b806315b19770116103145780631c154f4d116102ef5780631c154f4d146104c757806323af3449146104e6578063273b78811461050557806328f150eb14610531575f80fd5b806315b197701461047557806315d3129f14610489578063183085c0146104a8575f80fd5b8063089fe6aa1161034f578063089fe6aa14610409578063112cee441461042c57806314f8b42414610441578063155dd5ee14610456575f80fd5b8063049aacfe1461037f57806304af2e23146103cf57806307da68f5146103f3575f80fd5b3661037b57005b5f80fd5b34801561038a575f80fd5b506103b27f000000000000000000000000b3f5503f93d5ef84b06993a1975b9d21b962892f81565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156103da575f80fd5b506103e3610b87565b60405190151581526020016103c6565b3480156103fe575f80fd5b50610407610bca565b005b348015610414575f80fd5b5061041e60125481565b6040519081526020016103c6565b348015610437575f80fd5b5061041e600f5481565b34801561044c575f80fd5b5061041e600e5481565b348015610461575f80fd5b50610407610470366004613313565b610c82565b348015610480575f80fd5b506103e3610dc5565b348015610494575f80fd5b5061041e6104a3366004613313565b610def565b3480156104b3575f80fd5b506104076104c236600461333e565b610e0b565b3480156104d2575f80fd5b506103e36104e1366004613368565b611299565b3480156104f1575f80fd5b5061041e610500366004613368565b611412565b348015610510575f80fd5b5061052461051f366004613368565b611432565b6040516103c69190613383565b34801561053c575f80fd5b506103b27f00000000000000000000000040aca2046fc0f5d19db64fa1eb9029622d017e7381565b34801561056f575f80fd5b506103e361057e366004613313565b5f90815260146020526040902060038101546002909101541490565b3480156105a5575f80fd5b506103e36105b4366004613313565b5f90815260146020526040902060038101546002909101541090565b3480156105db575f80fd5b5061041e60045481565b3480156105f0575f80fd5b5061041e6105ff366004613368565b611455565b34801561060f575f80fd5b5061041e61061e36600461333e565b611475565b34801561062e575f80fd5b5061052461063d366004613368565b611564565b34801561064d575f80fd5b5061041e61065c36600461333e565b611587565b34801561066c575f80fd5b506002546103b2906001600160a01b031681565b34801561068b575f80fd5b506013546103e39060ff1681565b3480156106a4575f80fd5b50600b546103b2906001600160a01b031681565b3480156106c3575f80fd5b506103b27f000000000000000000000000bd47235a36f2e1462ac9cdaf70170137d05ebd0781565b3480156106f6575f80fd5b5061041e611674565b34801561070a575f80fd5b5061041e60175481565b34801561071f575f80fd5b5061040761169c565b348015610733575f80fd5b5061078b610742366004613313565b5f9081526014602052604090208054600182015460028301546003840154600485015460058601546006870154600790970154959794969395929491939092909160ff90911690565b604080519889526020890197909752958701949094526060860192909252608085015260a084015260c0830152151560e0820152610100016103c6565b3480156107d3575f80fd5b505f546001600160a01b03166103b2565b3480156107ef575f80fd5b506104076107fe366004613313565b6116af565b34801561080e575f80fd5b5061041e61081d36600461333e565b6116fd565b6104076108303660046133c6565b611764565b348015610840575f80fd5b5061041e61084f366004613313565b611be5565b34801561085f575f80fd5b5061052461086e366004613368565b611c69565b34801561087e575f80fd5b5061041e60095481565b348015610893575f80fd5b50610407611c8c565b3480156108a7575f80fd5b50600d546103b2906001600160a01b031681565b3480156108c6575f80fd5b5061041e6108d536600461333e565b611ec6565b3480156108e5575f80fd5b506005546103e390600160a01b900460ff1681565b348015610905575f80fd5b5061096561091436600461333e565b6001600160a01b03919091165f908152601560209081526040808320938352929052208054600182015460028301546003840154600490940154929491939092909160ff8083169261010090041690565b60408051968752602087019590955293850192909252606084015215156080830152151560a082015260c0016103c6565b3480156109a1575f80fd5b5061041e60105481565b3480156109b6575f80fd5b50610407611fc9565b3480156109ca575f80fd5b5061041e6109d936600461333e565b6120cf565b3480156109e9575f80fd5b5061041e60115481565b3480156109fe575f80fd5b50610407612114565b348015610a12575f80fd5b50610a1b6121ae565b6040516103c6929190613429565b610407610a373660046133c6565b612221565b348015610a47575f80fd5b50610a5b610a56366004613313565b612684565b6040516103c6919061348d565b348015610a73575f80fd5b5061041e610a82366004613313565b61269d565b348015610a92575f80fd5b506103e3610aa136600461349f565b6126f6565b348015610ab1575f80fd5b50610407610ac0366004613313565b612777565b348015610ad0575f80fd5b506103b27f0000000000000000000000002807b4ae232b624023f87d0e237a3b1bf200fd9981565b348015610b03575f80fd5b50610407610b12366004613368565b612784565b610407610b2536600461349f565b6127fd565b348015610b35575f80fd5b50600a546103b2906001600160a01b031681565b348015610b54575f80fd5b5061041e610b6336600461333e565b6128ba565b348015610b73575f80fd5b50600c546103b2906001600160a01b031681565b600e545f8181526014602052604081209091158015610ba557508054155b15610bb257600191505090565b60135460ff16610bc6574281600101541091505b5090565b5f546001600160a01b0316331480610c66575060025f9054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c2d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c5191906134cd565b6001600160a01b0316336001600160a01b0316145b610c6e575f80fd5b6013805460ff19811660ff90911615179055565b336001600160a01b037f000000000000000000000000bd47235a36f2e1462ac9cdaf70170137d05ebd071614610d0b5760405162461bcd60e51b815260206004820152602360248201527f4f6e6c792066756e6473206f776e65722063616e2077697468647261772066756044820152626e647360e81b60648201526084015b60405180910390fd5b604051631c20fadd60e01b81526001600160a01b037f000000000000000000000000bd47235a36f2e1462ac9cdaf70170137d05ebd078116600483015273eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6024830152604482018390527f0000000000000000000000002807b4ae232b624023f87d0e237a3b1bf200fd991690631c20fadd906064015f604051808303815f87803b158015610dac575f80fd5b505af1158015610dbe573d5f803e3d5ffd5b5050505050565b600e545f90815260146020526040812060105460018201544291610de8916134fc565b1191505090565b5f818152600860205260408120610e05906129c1565b92915050565b610e136129ca565b5f8181526014602090815260408083206001600160a01b03861684526015835281842085855290925282209091610e4a85856120cf565b90505f610e5786866116fd565b600785015490915060ff16610ea45760405162461bcd60e51b8152602060048201526013602482015272149bdd5b99081a5cc81b9bdd0818db1bdcd959606a1b6044820152606401610d02565b5f821180610eb157505f81115b610ef05760405162461bcd60e51b815260206004820152601060248201526f4e6f7468696e6720746f20636c61696d60801b6044820152606401610d02565b5f8581526014602052604090206003810154600290910154108015610f2b57505f858152601460205260409020600381015460029091015414155b8015610f3657505f82115b15610f6057610f458686612a23565b60175f828254610f55919061350f565b909155506111b29050565b5f858152601460205260409020600381015460029091015410158015610f9c57505f858152601460205260409020600381015460029091015414155b8015610fa757505f81115b15610fb657610f458686612c2d565b5f8581526014602052604090206003810154600290910154036111b25781156110c05782546040515f916001600160a01b038916918381818185875af1925050503d805f8114611021576040519150601f19603f3d011682016040523d82523d5f602084013e611026565b606091505b505080915050835f015460175f828254611040919061350f565b909155505083546003850180545f9061105a90849061350f565b909155505060048401805460ff1916600117905583546040516001600160a01b038916917ffcbf1134234fabe3b44212e6eeae1cae5be3f26345b55ca3d4705fbbb42794eb916110b2918a8252602082015260400190565b60405180910390a2506111b2565b80156111b25760018301546040515f916001600160a01b038916918381818185875af1925050503d805f8114611111576040519150601f19603f3d011682016040523d82523d5f602084013e611116565b606091505b505080915050836001015460175f828254611131919061350f565b909155505060018401546003850180545f9061114e90849061350f565b909155505060048401805461ff00191661010017905583546040516001600160a01b038916917fe993d55d9ab86c819fba9ce459c811bf397f795bb5c00a0db1789c6212dab826916111a8918a8252602082015260400190565b60405180910390a2505b5f821180156111c357506004840154155b80156111e557505f858152601460205260409020600381015460029091015410155b80156111f65750600483015460ff16155b1561121b576112058686612a23565b60175f828254611215919061350f565b90915550505b5f8111801561122c57506005840154155b801561124d57505f8581526014602052604090206003810154600290910154105b801561126357506004830154610100900460ff16155b15611288576112728686612c2d565b60175f828254611282919061350f565b90915550505b5050505061129560018055565b5050565b6040805160028082526060820183525f928392919060208301908036833701905050905082815f815181106112d0576112d0613536565b6001600160a01b03928316602091820292909201810191909152600a54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611327573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061134b91906134cd565b8160018151811061135e5761135e613536565b6001600160a01b039283166020918202929092010152600a5460405163d06ca61f60e01b815291169063d06ca61f906113a490662386f26fc1000090859060040161354a565b5f60405180830381865afa9250505080156113e057506040513d5f823e601f3d908101601f191682016040526113dd9190810190613562565b60015b6113ec57505f92915050565b5f8160018151811061140057611400613536565b60200260200101511192505050919050565b6001600160a01b0381165f908152600760205260408120610e05906129c1565b6001600160a01b0381165f908152600760205260409020606090610e0590612e2c565b6001600160a01b0381165f908152600660205260408120610e05906129c1565b5f8181526014602090815260408083206001600160a01b0386168452601583528184208585529092528220826114ab86866120cf565b60068401549091505f81158015906114c257505f83115b80156114d25750600785015460ff165b80156114f357505f8781526014602052604090206003810154600290910154105b90505f9550801561151c5761271061150b848461361b565b6115159190613646565b9550611559565b5f87815260146020526040902060038101546002909101541015801561154457506004850154155b801561154f57505f83115b1561155957835495505b505050505092915050565b6001600160a01b0381165f908152601660205260409020606090610e0590612e2c565b5f8181526014602090815260408083206001600160a01b0386168452601583528184208585529092528220826115bd86866116fd565b60068401549091505f81158015906115d457505f83115b80156115e45750600785015460ff165b801561160657505f878152601460205260409020600381015460029091015410155b90505f9550801561161e5761271061150b848461361b565b5f878152601460205260409020600381015460029091015410801561164557506005850154155b80156116555750600785015460ff165b801561166057505f83115b156115595750505060010154949350505050565b5f8061167e612e3f565b90505f611689612ec0565b9050611695818361361b565b9250505090565b6116a46130a9565b6116ad5f613102565b565b6116b76130a9565b6107d08111156116f85760405162461bcd60e51b815260206004820152600c60248201526b08ccaca40e8dede40d0d2ced60a31b6044820152606401610d02565b601255565b5f8181526014602090815260408083206001600160a01b038616845260158352818420858552909252822060048201546001820154801561175657816117458261271061361b565b61174f9190613646565b945061175a565b5f94505b5050505092915050565b3482146117a65760405162461bcd60e51b815260206004820152601060248201526f105b5bdd5b9d081a5b98dbdc9c9958dd60821b6044820152606401610d02565b6011543410156117e35760405162461bcd60e51b8152602060048201526008602482015267426574206d6f726560c01b6044820152606401610d02565b335f908152601560205260408120600e54829061180190600161350f565b81526020019081526020015f20905080600101545f14801561182257508054155b6118605760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e48195b9d195c9959608a1b6044820152606401610d02565b5f611869610dc5565b905080611874575f80fd5b600554600160a01b900460ff1615611a69576005545f906298967f906001600160a01b031663a1c13f3a33600e546040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa1580156118e9573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061190d9190613659565b6119179190613670565b335f9081526007602052604090209091506119329082613151565b50335f90815260066020526040902061194b9082613151565b505f818152600860205260409020611963903361315c565b5060098054905f61197383613683565b90915550508315611a675761198884336126f6565b6119d45760405162461bcd60e51b815260206004820152601b60248201527f436f646520646f6573206e6f74206578697374206f72207573656400000000006044820152606401610d02565b5f8481526008602052604081206119eb9082613170565b90505f6119fa61270f87613670565b6001600160a01b0383165f908152600660205260409020909150611a1e9082613151565b50335f908152600660205260409020611a379087613151565b505f868152600860205260409020611a4f903361315c565b5060098054905f611a5f83613683565b919050555050505b505b5f60145f600e546001611a7c919061350f565b81526020019081526020015f2090505f61271060125487611a9d919061361b565b611aa79190613646565b600b546040519192505f916001600160a01b039091169083908381818185875af1925050503d805f8114611af6576040519150601f19603f3d011682016040523d82523d5f602084013e611afb565b606091505b50909150611b0b905082886134fc565b965086836005015f828254611b20919061350f565b9250508190555086836006015f828254611b3a919061350f565b90915550508454879086905f90611b5290849061350f565b9250508190555086856002015f828254611b6c919061350f565b9091555050600e54611b9790611b8390600161350f565b335f90815260166020526040902090613151565b50600e54611ba690600161350f565b60405188815233907f438122d8cff518d18388099a5181f0d17a12b4f1b55faedf6e4a6acee0060c12906020015b60405180910390a350505050505050565b5f81815260146020526040812060058101546004820154838115801590611c0b57505f83115b15611c3a5781611c1d8461271061361b565b611c279190613646565b611c339061271061350f565b9050611c60565b5f83118015611c47575081155b15611c5b57601154611c1d8461271061361b565b506127105b95945050505050565b6001600160a01b0381165f908152600660205260409020606090610e0590612e2c565b60045415611cd35760405162461bcd60e51b8152602060048201526014602482015273416c72656164792073746172746564207461736b60601b6044820152606401610d02565b60408051600281830181815260a0830184525f938392906060840190803683370190505081526040805160028082526060820190925260209092019190816020015b6060815260200190600190039081611d155750509052805180519192505f918290611d4257611d42613536565b60200260200101906003811115611d5b57611d5b61369b565b90816003811115611d6e57611d6e61369b565b815250506002815f0151600181518110611d8a57611d8a613536565b60200260200101906003811115611da357611da361369b565b90816003811115611db657611db661369b565b9052506040805160048152602481019091526020810180516001600160e01b031663cf5303cf60e01b179052611ded90309061317b565b81602001515f81518110611e0357611e03613536565b6020026020010181905250611e2260408051602081019091525f815290565b8160200151600181518110611e3957611e39613536565b60200260200101819052505f611e873063bd85948c60e01b604051602001611e7191906001600160e01b031991909116815260200190565b604051602081830303815290604052845f6131a7565b60048190556040518181529091507fa585557108354aa3685e5fe0424ad88ab5bcabc78119a3d599ae901ccb1999939060200160405180910390a15050565b5f8181526014602090815260408083206001600160a01b038616845260158352818420858552909252822082611efc86866116fd565b60068401549091505f8115801590611f1357505f83115b8015611f235750600785015460ff165b8015611f4557505f878152601460205260409020600381015460029091015410155b8015611f5b57506004840154610100900460ff16155b90508015611f705761271061150b848461361b565b5f8781526014602052604090206003810154600290910154108015611f9757506005850154155b8015611fa257505f83115b801561166057506004840154610100900460ff166115595750505060010154949350505050565b611fd1610b87565b61200f5760405162461bcd60e51b815260206004820152600f60248201526e149bdd5b99081b9bdd08195b991959608a1b6044820152606401610d02565b600e545f818152601460208190526040822092829061202f90600161350f565b81526020019081526020015f209050600e545f14801561204e57508154155b156120795742808355600f546120639161350f565b6001830155612070611674565b60028301555050565b612081611674565b600383015560078201805460ff1916600117905542808255600f546120a59161350f565b60018201556120b2611674565b6002820155600e8054905f6120c683613683565b91905055505050565b5f8181526014602090815260408083206001600160a01b038616845260158352818420858552909252822060058201548154801561175657816117458261271061361b565b61211c6130a9565b600554600160a01b900460ff1615801561213f57506005546001600160a01b0316155b1561218d575f60405161215190613306565b604051809103905ff08015801561216a573d5f803e3d5ffd5b50600580546001600160a01b0319166001600160a01b0392909216919091179055505b6005805460ff60a01b198116600160a01b9182900460ff1615909102179055565b600e545f8181526014602052604081209091606091901580156121d057508054155b156121de57600192506121f2565b60135460ff166121f2574281600101541092505b50506040805160048152602481019091526020810180516001600160e01b0316632f61652360e21b1790529091565b3482146122635760405162461bcd60e51b815260206004820152601060248201526f105b5bdd5b9d081a5b98dbdc9c9958dd60821b6044820152606401610d02565b6011543410156122a05760405162461bcd60e51b8152602060048201526008602482015267426574206d6f726560c01b6044820152606401610d02565b335f908152601560205260408120600e5482906122be90600161350f565b81526020019081526020015f209050805f01545f14806122e057506001810154155b61231e5760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e48195b9d195c9959608a1b6044820152606401610d02565b5f612327610dc5565b905080612332575f80fd5b600554600160a01b900460ff1615612527576005545f906298967f906001600160a01b031663a1c13f3a33600e546040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa1580156123a7573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123cb9190613659565b6123d59190613670565b335f9081526007602052604090209091506123f09082613151565b50335f9081526006602052604090206124099082613151565b505f818152600860205260409020612421903361315c565b5060098054905f61243183613683565b909155505083156125255761244684336126f6565b6124925760405162461bcd60e51b815260206004820152601b60248201527f436f646520646f6573206e6f74206578697374206f72207573656400000000006044820152606401610d02565b5f8481526008602052604081206124a99082613170565b90505f6124b861270f87613670565b6001600160a01b0383165f9081526006602052604090209091506124dc9082613151565b50335f9081526006602052604090206124f59087613151565b505f86815260086020526040902061250d903361315c565b5060098054905f61251d83613683565b919050555050505b505b5f60145f600e54600161253a919061350f565b81526020019081526020015f2090505f6127106012548761255b919061361b565b6125659190613646565b600b546040519192505f916001600160a01b039091169083908381818185875af1925050503d805f81146125b4576040519150601f19603f3d011682016040523d82523d5f602084013e6125b9565b606091505b509091506125c9905082886134fc565b965086836004015f8282546125de919061350f565b9250508190555086836006015f8282546125f8919061350f565b9250508190555086856001015f828254612612919061350f565b9250508190555086856002015f82825461262c919061350f565b9091555050600e5461264390611b8390600161350f565b50600e5461265290600161350f565b60405188815233907f0d8c1fe3e67ab767116a81f122b83c2557a8c2564019cb7c4f83de1aeb1f1f0d90602001611bd4565b5f818152600860205260409020606090610e0590612e2c565b5f818152601460205260408120600581015460048201548382158015906126c357505f82115b156126d55782611c1d8361271061361b565b5f821180156126e2575082155b15611c5b57601154611c1d8361271061361b565b5f828152600860205260408120819061270f9082613170565b5f858152600860205260409020909150612728906129c1565b60011415806127485750806001600160a01b0316836001600160a01b0316145b15612756575f915050610e05565b6001600160a01b03811661276d575f915050610e05565b5060019392505050565b61277f6130a9565b600f55565b61278c6130a9565b6001600160a01b0381166127f15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610d02565b6127fa81613102565b50565b5f6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14612828575f61282a565b825b60405163c1461d5760e01b81523060048201526001600160a01b038481166024830152604482018690529192507f0000000000000000000000002807b4ae232b624023f87d0e237a3b1bf200fd999091169063c1461d579083906064015f604051808303818588803b15801561289e575f80fd5b505af11580156128b0573d5f803e3d5ffd5b5050505050505050565b5f8181526014602090815260408083206001600160a01b0386168452601583528184208585529092528220826128f086866120cf565b60068401549091505f811580159061290757505f83115b80156129175750600785015460ff165b801561293857505f8781526014602052604090206003810154600290910154105b80156129495750600484015460ff16155b9050801561295e5761271061150b848461361b565b5f87815260146020526040902060038101546002909101541015801561298657506004850154155b801561299157505f83115b80156129a15750600785015460ff165b801561154f5750600484015460ff16611559575050905495945050505050565b5f610e05825490565b600260015403612a1c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d02565b6002600155565b6001600160a01b0382165f908152601560209081526040808320848452909152812081612a5085856120cf565b90505f8111612a8d5760405162461bcd60e51b81526020600482015260096024820152684e6f20636c61696d7360b81b6044820152606401610d02565b600482015460ff1615612ad45760405162461bcd60e51b815260206004820152600f60248201526e185b1c9958591e4818db185a5b5959608a1b6044820152606401610d02565b5f848152601460205260409020600381015460029091015403612af5575f80fd5b5f612b0086866128ba565b90505f866001600160a01b0316826040515f6040518083038185875af1925050503d805f8114612b4b576040519150601f19603f3d011682016040523d82523d5f602084013e612b50565b606091505b50508091505081846003015f828254612b69919061350f565b90915550506004848101805460ff1916600117905560025460405163909ea24960e01b81529182018490526001600160a01b03169063909ea249906024015f604051808303815f87803b158015612bbe575f80fd5b505af1158015612bd0573d5f803e3d5ffd5b50505050819450866001600160a01b03167ffcbf1134234fabe3b44212e6eeae1cae5be3f26345b55ca3d4705fbbb42794eb8784604051612c1b929190918252602082015260400190565b60405180910390a25050505092915050565b6001600160a01b0382165f908152601560209081526040808320848452909152812081612c5a85856116fd565b90505f8111612c975760405162461bcd60e51b81526020600482015260096024820152684e6f20636c61696d7360b81b6044820152606401610d02565b6004820154610100900460ff1615612ce35760405162461bcd60e51b815260206004820152600f60248201526e185b1c9958591e4818db185a5b5959608a1b6044820152606401610d02565b5f848152601460205260409020600381015460029091015403612d04575f80fd5b5f612d0f8686611ec6565b90505f866001600160a01b0316826040515f6040518083038185875af1925050503d805f8114612d5a576040519150601f19603f3d011682016040523d82523d5f602084013e612d5f565b606091505b50508091505081846003015f828254612d78919061350f565b90915550506004848101805461ff00191661010017905560025460405163909ea24960e01b81529182018490526001600160a01b03169063909ea249906024015f604051808303815f87803b158015612dcf575f80fd5b505af1158015612de1573d5f803e3d5ffd5b50505050819450866001600160a01b03167fe993d55d9ab86c819fba9ce459c811bf397f795bb5c00a0db1789c6212dab8268784604051612c1b929190918252602082015260400190565b60605f612e388361323b565b9392505050565b5f8060035f9054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015612e91573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612eb591906136cd565b509195945050505050565b5f80600c5f9054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612f12573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612f369190613719565b612f4190600a613819565b600a5f9054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612f91573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612fb591906134cd565b600d546040516370a0823160e01b81526001600160a01b0391821660048201529116906370a0823190602401602060405180830381865afa158015612ffc573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906130209190613659565b61302a919061361b565b600c54600d546040516370a0823160e01b81526001600160a01b0391821660048201529293505f929116906370a0823190602401602060405180830381865afa158015613079573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061309d9190613659565b90506116958183613646565b5f546001600160a01b031633146116ad5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d02565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f612e388383613294565b5f612e38836001600160a01b038416613294565b5f612e3883836132e0565b60608282604051602001613190929190613827565b604051602081830303815290604052905092915050565b604051633323b46760e01b81525f906001600160a01b037f000000000000000000000000b3f5503f93d5ef84b06993a1975b9d21b962892f1690633323b467906131fb90889088908890889060040161389d565b6020604051808303815f875af1158015613217573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c609190613659565b6060815f0180548060200260200160405190810160405280929190818152602001828054801561328857602002820191905f5260205f20905b815481526020019060010190808311613274575b50505050509050919050565b5f8181526001830160205260408120546132d957508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155610e05565b505f610e05565b5f825f0182815481106132f5576132f5613536565b905f5260205f200154905092915050565b61019b8061395583390190565b5f60208284031215613323575f80fd5b5035919050565b6001600160a01b03811681146127fa575f80fd5b5f806040838503121561334f575f80fd5b823561335a8161332a565b946020939093013593505050565b5f60208284031215613378575f80fd5b8135612e388161332a565b602080825282518282018190525f9190848201906040850190845b818110156133ba5783518352928401929184019160010161339e565b50909695505050505050565b5f80604083850312156133d7575f80fd5b50508035926020909101359150565b5f81518084525f5b8181101561340a576020818501810151868301820152016133ee565b505f602082860101526020601f19601f83011685010191505092915050565b8215158152604060208201525f61344360408301846133e6565b949350505050565b5f8151808452602080850194508084015f5b838110156134825781516001600160a01b03168752958201959082019060010161345d565b509495945050505050565b602081525f612e38602083018461344b565b5f80604083850312156134b0575f80fd5b8235915060208301356134c28161332a565b809150509250929050565b5f602082840312156134dd575f80fd5b8151612e388161332a565b634e487b7160e01b5f52601160045260245ffd5b81810381811115610e0557610e056134e8565b80820180821115610e0557610e056134e8565b634e487b7160e01b5f52604160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b828152604060208201525f613443604083018461344b565b5f6020808385031215613573575f80fd5b825167ffffffffffffffff8082111561358a575f80fd5b818501915085601f83011261359d575f80fd5b8151818111156135af576135af613522565b8060051b604051601f19603f830116810181811085821117156135d4576135d4613522565b6040529182528482019250838101850191888311156135f1575f80fd5b938501935b8285101561360f578451845293850193928501926135f6565b98975050505050505050565b8082028115828204841417610e0557610e056134e8565b634e487b7160e01b5f52601260045260245ffd5b5f8261365457613654613632565b500490565b5f60208284031215613669575f80fd5b5051919050565b5f8261367e5761367e613632565b500690565b5f60018201613694576136946134e8565b5060010190565b634e487b7160e01b5f52602160045260245ffd5b805169ffffffffffffffffffff811681146136c8575f80fd5b919050565b5f805f805f60a086880312156136e1575f80fd5b6136ea866136af565b945060208601519350604086015192506060860151915061370d608087016136af565b90509295509295909350565b5f60208284031215613729575f80fd5b815160ff81168114612e38575f80fd5b600181815b8085111561377357815f1904821115613759576137596134e8565b8085161561376657918102915b93841c939080029061373e565b509250929050565b5f8261378957506001610e05565b8161379557505f610e05565b81600181146137ab57600281146137b5576137d1565b6001915050610e05565b60ff8411156137c6576137c66134e8565b50506001821b610e05565b5060208310610133831016604e8410600b84101617156137f4575081810a610e05565b6137fe8383613739565b805f1904821115613811576138116134e8565b029392505050565b5f612e3860ff84168361377b565b6001600160a01b03831681526040602082018190525f90613443908301846133e6565b5f81518084526020808501808196508360051b810191508286015f5b8581101561389057828403895261387e8483516133e6565b98850198935090840190600101613866565b5091979650505050505050565b6001600160a01b0385168152608060208083018290525f916138c1908401876133e6565b838103604080860191909152865181835280519183018290528301905f906060840190825b8181101561391f578451600480821061390c57634e487b7160e01b865260218152602486fd5b50835293860193918601916001016138e6565b505084890151925083810385850152613938818461384a565b95505050505050611c6060608301846001600160a01b0316905256fe608060405234801561000f575f80fd5b5061017e8061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063a1c13f3a1461002d575b5f80fd5b61004061003b3660046100f4565b610052565b60405190815260200160405180910390f35b6040516bffffffffffffffffffffffff19606084901b166020820152603481018290525f90819061270f90605401604051602081830303815290604052805190602001205f1c6100a29190610129565b90505f81856040516020016100d392919091825260601b6bffffffffffffffffffffffff1916602082015260340190565b60408051808303601f19018152919052805160209091012095945050505050565b5f8060408385031215610105575f80fd5b82356001600160a01b038116811461011b575f80fd5b946020939093013593505050565b5f8261014357634e487b7160e01b5f52601260045260245ffd5b50069056fea2646970667358221220160003ce8970b43e3df45c3d2f6f2f5d371669742883cb2535feb7966548fbfd64736f6c63430008150033a26469706673582212203effa5ef3063a47eb4b17827ff0523c7d0796661f262275345e8d989d2049e5164736f6c63430008150033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.