More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 30,398 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Withdraw | 58501891 | 77 days ago | IN | 0 POL | 0.00187017 | ||||
Withdraw | 58501882 | 77 days ago | IN | 0 POL | 0.00187017 | ||||
Withdraw | 53554232 | 206 days ago | IN | 0 POL | 0.00797939 | ||||
Withdraw | 52698772 | 228 days ago | IN | 0 POL | 0.00423823 | ||||
Withdraw | 52698715 | 228 days ago | IN | 0 POL | 0.00423905 | ||||
Withdraw | 46966364 | 374 days ago | IN | 0 POL | 0.0187017 | ||||
Withdraw | 43290516 | 468 days ago | IN | 0 POL | 0.01282473 | ||||
Deposit | 42770268 | 481 days ago | IN | 0.015 POL | 0.0177106 | ||||
Withdraw | 42437236 | 489 days ago | IN | 0 POL | 0.01137467 | ||||
Withdraw | 42437167 | 489 days ago | IN | 0 POL | 0.01411911 | ||||
Withdraw | 41626999 | 510 days ago | IN | 0 POL | 0.01252195 | ||||
Withdraw | 41619858 | 510 days ago | IN | 0 POL | 0.01084075 | ||||
Withdraw | 41619805 | 510 days ago | IN | 0 POL | 0.00988696 | ||||
Withdraw | 41619793 | 510 days ago | IN | 0 POL | 0.01098413 | ||||
Deposit | 41588320 | 511 days ago | IN | 5 POL | 0.02054104 | ||||
Deposit | 41474238 | 514 days ago | IN | 1 POL | 0.00815573 | ||||
Deposit | 40818764 | 531 days ago | IN | 0.1 POL | 0.01512424 | ||||
Withdraw | 40606362 | 537 days ago | IN | 0 POL | 0.01672724 | ||||
Withdraw | 40606360 | 537 days ago | IN | 0 POL | 0.01661817 | ||||
Withdraw | 39220498 | 574 days ago | IN | 0 POL | 0.01454449 | ||||
Withdraw | 39027769 | 579 days ago | IN | 0 POL | 0.0100203 | ||||
Deposit | 38328992 | 597 days ago | IN | 0.1 POL | 0.00389509 | ||||
Deposit | 38142712 | 601 days ago | IN | 0.1 POL | 0.00338962 | ||||
Deposit | 37640933 | 614 days ago | IN | 1 POL | 0.00446567 | ||||
Deposit | 37476091 | 618 days ago | IN | 1 POL | 0.00334074 |
Latest 25 internal transactions (View All)
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
58501891 | 77 days ago | 0.3942123 POL | ||||
58501882 | 77 days ago | 1.68658029 POL | ||||
53554232 | 206 days ago | 0.09010097 POL | ||||
52698772 | 228 days ago | 0.01809812 POL | ||||
52698715 | 228 days ago | 0.07699034 POL | ||||
46966364 | 374 days ago | 0.15766444 POL | ||||
43290516 | 468 days ago | 0.94662266 POL | ||||
42437236 | 489 days ago | 0.00459655 POL | ||||
42437167 | 489 days ago | 0.01984378 POL | ||||
42437167 | 489 days ago | 0.0000785 POL | ||||
41626999 | 510 days ago | 3.06096098 POL | ||||
41619858 | 510 days ago | 0.03972288 POL | ||||
41619805 | 510 days ago | 0.18182935 POL | ||||
41619793 | 510 days ago | 0.84602799 POL | ||||
40606362 | 537 days ago | 0.19923062 POL | ||||
40606360 | 537 days ago | 0.19923062 POL | ||||
39220498 | 574 days ago | 1.74773565 POL | ||||
39027769 | 579 days ago | 0.2008073 POL | ||||
37217032 | 624 days ago | 0.07968544 POL | ||||
37176710 | 625 days ago | 0.1415546 POL | ||||
36809618 | 634 days ago | 3.68547968 POL | ||||
36809618 | 634 days ago | 5.89412904 POL | ||||
36809618 | 634 days ago | 5.84728028 POL | ||||
36809618 | 634 days ago | 3.857082 POL | ||||
36809618 | 634 days ago | 1.12639196 POL |
Loading...
Loading
Contract Name:
BhavishNativeVault
Compiler Version
v0.8.13+commit.abaa5c0e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BSD-4-Clause pragma solidity ^0.8.13; import { BaseVault, IBhavishAdministrator, IBhavishPrediction, IBhavishSDKImpl, IVaultProtector } from "./BaseVault.sol"; import { IBhavishSDK } from "../Interface/IBhavishSDK.sol"; import { AccessControl } from "@openzeppelin/contracts/access/AccessControl.sol"; /** * @title Bhavish Native Vault * This works on native currency only */ contract BhavishNativeVault is AccessControl, BaseVault { IBhavishSDK public bhavishSDK; constructor( IBhavishAdministrator _bhavishAdmin, // Bhavish Admin Address IBhavishSDK _bhavishSDK, // Bhavish SDK Address bytes32 _underlying, bytes32 _strike, string memory _supportedCurrency, IVaultProtector _protector ) BaseVault(_bhavishAdmin, _supportedCurrency, _underlying, _strike, _protector) { bhavishSDK = _bhavishSDK; } function totalAssets() public view override returns (uint256) { return address(this).balance; } function getPredictionMarketAddr() internal override returns (address) { return IBhavishSDKImpl(address(bhavishSDK)).predictionMap(assetPair.underlying, assetPair.strike); } function _performPrediction( uint256 _roundId, bool _nextPredictionUp, uint256 _predictAmount ) internal override { bhavishSDK.predict{ value: _predictAmount }( IBhavishSDK.PredictionStruct(assetPair.underlying, assetPair.strike, _roundId, _nextPredictionUp), address(this), address(this) ); } function performClaim(uint256[] memory _roundIds) external override { uint256 totalBetAmount = 0; uint256 beforeBalance = address(this).balance; for (uint256 i = 0; i < _roundIds.length; i++) { if (!claimRefundMap[_roundIds[i]] && (!isClaimable(_roundIds[i]) || isClaimPending(_roundIds[i]))) { totalBetAmount += getRoundBetAmount(_roundIds[i]); claimRefundMap[_roundIds[i]] = true; } } bhavishSDK.claim( IBhavishSDK.PredictionStruct(assetPair.underlying, assetPair.strike, 0, false), _roundIds, bytes32(""), false, 0 ); uint256 claimedAmount = address(this).balance - beforeBalance; // win or loss vaultDeposit.totalDeposit = vaultDeposit.totalDeposit + claimedAmount - totalBetAmount; } function performRefund(uint256[] memory _roundIds) external override { uint256 totalBetAmount = 0; uint256 beforeBalance = address(this).balance; for (uint256 i = 0; i < _roundIds.length; i++) { if (!claimRefundMap[_roundIds[i]] && (!isClaimable(_roundIds[i]) || isClaimPending(_roundIds[i]))) { totalBetAmount += getRoundBetAmount(_roundIds[i]); bhavishSDK.refundUsers( IBhavishSDK.PredictionStruct(assetPair.underlying, assetPair.strike, 0, false), _roundIds[i] ); claimRefundMap[_roundIds[i]] = true; } } uint256 totalRefundAmount = address(this).balance - beforeBalance; vaultDeposit.totalDeposit = vaultDeposit.totalDeposit + totalRefundAmount - totalBetAmount; } function _safeTransfer(address _to, uint256 _value) internal override { (bool success, ) = _to.call{ value: _value }(""); require(success, "TransferHelper: TRANSFER_FAILED"); } function deposit() external payable whenNotPaused nonReentrant { _depositToVault(msg.value); } function withdraw(uint256 _shares) external nonReentrant { uint256 assetAmount = _withdrawFromVault(_shares); _safeTransfer(msg.sender, assetAmount); vaultDeposit.userDeposits[msg.sender] = convertToAssets(vaultDeposit.userShares[msg.sender]); } }
// SPDX-License-Identifier: BSD-4-Clause pragma solidity ^0.8.13; import { IBhavishAdministrator } from "../Interface/IBhavishAdministrator.sol"; import { IBhavishPrediction } from "../Interface/IBhavishPrediction.sol"; import { AccessControl } from "@openzeppelin/contracts/access/AccessControl.sol"; import { Address } from "@openzeppelin/contracts/utils/Address.sol"; import { Pausable } from "@openzeppelin/contracts/security/Pausable.sol"; import { SafeMath } from "@openzeppelin/contracts/utils/math/SafeMath.sol"; import { Math } from "@openzeppelin/contracts/utils/math/Math.sol"; import { ReentrancyGuard } from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import { IVaultProtector } from "../Interface/IVaultProtector.sol"; interface IBhavishSDKImpl { function predictionMap(bytes32 _underlying, bytes32 _strike) external returns (address); } interface IBhavishPredictionImpl { function bhavishPredictionStorage() external returns (address storageAddr); function _claimable(IBhavishPrediction.Round memory _round, IBhavishPrediction.BetInfo memory _betInfo) external pure returns (bool); } interface IBhavishStorage { function getPredictionRound(uint256 _roundId) external returns (IBhavishPrediction.Round memory round); function getBetInfo(uint256 _roundId, address _userAddress) external returns (IBhavishPrediction.BetInfo memory betInfo); } /** * @title Base Vault */ abstract contract BaseVault is Pausable, AccessControl, ReentrancyGuard { using Address for address; using Math for uint256; using SafeMath for uint256; struct VaultDeposit { mapping(address => uint256) userDeposits; mapping(address => uint256) userLastDepositTime; mapping(address => uint256) userShares; uint256 totalDeposit; uint256 maxCapacity; uint256 shares; } struct VaultConfig { uint256 predictionPerc; uint256 minPredictionPerc; uint256 withdrawFeeRatio; uint256 performanceFeeRatio; uint256 previousRoundId; uint256 penultimateRoundId; uint256 lockPeriod; string supportedCurrency; } enum TransactionType { DEPOSIT, WITHDRAW } IBhavishAdministrator public bhavishAdmin; VaultDeposit public vaultDeposit; IBhavishPrediction.AssetPair public assetPair; VaultConfig public vaultConfig; IVaultProtector public protector; mapping(uint256 => bool) public claimRefundMap; uint256 public constant DENOMINATOR = 10000; uint256 public constant MAX_PERFORMANCE_FEE = 5000; uint256 public constant MAX_WITHDRAW_FEE = 100; bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE"); event FeeCollected(uint256 fee); event DepositProcessed(address indexed owner, uint256 assetAmount, uint256 shares); event WithdrawProcessed(address indexed owner, uint256 assetAmount, uint256 shares); event NewOperator(address indexed operator); event NewWithdrawFee(uint256 _fee); event NewPerformanceFee(uint256 _fee); event NewPredictionPerc(uint256 _perc); event NewMinPredictionPerc(uint256 _perc); event NewMaxCapacity(uint256 cap); event NewBhavishAdmin(IBhavishAdministrator _admin); event NewVaultProtector(IVaultProtector _protector); event NewLockPeriod(uint256 _period); // Implement following virtual methods function _performPrediction( uint256 _roundId, bool _nextPredictionUp, uint256 _predictAmount ) internal virtual; function _safeTransfer(address to, uint256 value) internal virtual; function getPredictionMarketAddr() internal virtual returns (address); function totalAssets() public view virtual returns (uint256); function performClaim(uint256[] memory _roundIds) external virtual; function performRefund(uint256[] calldata roundIds) external virtual; modifier onlyOperator(address _userAddress) { require(hasRole(OPERATOR_ROLE, _userAddress), "Caller Is Not Operator"); _; } modifier validateUser(address _userAddress) { require(msg.sender == _userAddress, "invalid user address"); _; } modifier validateMaxCap(uint256 _amount) { require(vaultDeposit.maxCapacity >= vaultDeposit.totalDeposit + _amount, "Vault reached max capacity"); _; } modifier onlyAdmin(address _address) { require(hasRole(DEFAULT_ADMIN_ROLE, _address), "Address not an admin"); _; } constructor( IBhavishAdministrator _bhavishAdmin, string memory _supportedCurrency, bytes32 _underlying, bytes32 _strike, IVaultProtector _protector ) { bhavishAdmin = _bhavishAdmin; vaultConfig.supportedCurrency = _supportedCurrency; vaultConfig.predictionPerc = 300; vaultConfig.minPredictionPerc = 1000; // 10% of predictionPerc vaultConfig.withdrawFeeRatio = 0; vaultConfig.performanceFeeRatio = 1000; vaultConfig.lockPeriod = 1 days; assetPair = IBhavishPrediction.AssetPair(_underlying, _strike); protector = _protector; _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); } receive() external payable {} function setOperator(address _operator) external onlyAdmin(msg.sender) { require(!address(_operator).isContract(), "Operator cannot be a contract"); require(_operator != address(0), "Cannot be zero address"); grantRole(OPERATOR_ROLE, _operator); emit NewOperator(_operator); } function _getPerformanceFeeRatio(uint256 _amount) internal view returns (uint256) { return (_amount * vaultConfig.performanceFeeRatio) / DENOMINATOR; } function _getWithdrawFeeRatio(uint256 _amount) internal view returns (uint256) { return (_amount * vaultConfig.withdrawFeeRatio) / DENOMINATOR; } function previewWithdraw(uint256 _shares, address _userAddress) public view returns (uint256, uint256) { // for values like 33.33% uint256 perc = (_shares * 100).ceilDiv(vaultDeposit.userShares[_userAddress]); uint256 amount = (vaultDeposit.userDeposits[_userAddress] * perc) / 100; uint256 redeemShares = convertToAssets(_shares); (, uint256 profit) = redeemShares.trySub(amount); // withdraw fee only from deposit uint256 fee = _getWithdrawFeeRatio(amount); // performance fee only from profits if (profit > 0) fee += _getPerformanceFeeRatio(profit); return (fee, redeemShares); } function pause() external whenNotPaused onlyAdmin(msg.sender) { _pause(); } function unpause() external whenPaused onlyAdmin(msg.sender) { _unpause(); } function getUserDeposits(address _userAddress) public view returns (uint256) { return vaultDeposit.userDeposits[_userAddress]; } function getUserLastDepositTime(address _userAddress) public view returns (uint256) { return vaultDeposit.userLastDepositTime[_userAddress]; } function getUserShares(address _userAddress) public view returns (uint256) { return vaultDeposit.userShares[_userAddress]; } function setWithdrawFee(uint256 _fee) public onlyAdmin(msg.sender) { require(_fee <= MAX_WITHDRAW_FEE, "Cannot be > 1%"); vaultConfig.withdrawFeeRatio = _fee; emit NewWithdrawFee(_fee); } function setPerformanceFee(uint256 _fee) public onlyAdmin(msg.sender) { require(_fee <= MAX_PERFORMANCE_FEE, "Cannot be > 50%"); vaultConfig.performanceFeeRatio = _fee; emit NewPerformanceFee(_fee); } function setPredictionPerc(uint256 _perc) public onlyAdmin(msg.sender) { require(_perc <= 10000, "Cannot be 100%"); vaultConfig.predictionPerc = _perc; emit NewPredictionPerc(_perc); } function setMinPredictionPerc(uint256 _perc) public onlyAdmin(msg.sender) { require(_perc <= 10000, "Cannot be 100%"); vaultConfig.minPredictionPerc = _perc; emit NewMinPredictionPerc(_perc); } function setMaxCapacity(uint256 cap) public onlyAdmin(msg.sender) { vaultDeposit.maxCapacity = cap; emit NewMaxCapacity(cap); } function setBhavishAdmin(IBhavishAdministrator _admin) external onlyAdmin(msg.sender) { bhavishAdmin = _admin; emit NewBhavishAdmin(_admin); } function setVaultProtector(IVaultProtector _protector) external onlyAdmin(msg.sender) { protector = _protector; emit NewVaultProtector(_protector); } function getMaxCapacity() public view returns (uint256) { return vaultDeposit.maxCapacity; } function setLockPeriod(uint256 _period) public onlyAdmin(msg.sender) { require(_period >= 1 days && _period <= 7 days, "Cannot be < 1 days & > 7 days"); vaultConfig.lockPeriod = _period; emit NewLockPeriod(_period); } function _depositToVault(uint256 _assetAmount) internal whenNotPaused validateMaxCap(_assetAmount) returns (uint256 shares) { require(_assetAmount > 0, "Invalid Deposit Amount"); vaultDeposit.userDeposits[msg.sender] = _calculateAssets(vaultDeposit.userShares[msg.sender], _assetAmount); vaultDeposit.userLastDepositTime[msg.sender] = block.timestamp; shares = convertToShares(_assetAmount); vaultDeposit.totalDeposit += _assetAmount; vaultDeposit.userDeposits[msg.sender] += _assetAmount; vaultDeposit.userShares[msg.sender] += shares; vaultDeposit.shares += shares; emit DepositProcessed(msg.sender, _assetAmount, shares); } function convertToAssets(uint256 _shares) public view returns (uint256) { uint256 supply = vaultDeposit.shares; return (supply == 0) ? _shares : _shares.mulDiv(totalAssets(), supply, Math.Rounding.Down); } function _calculateAssets(uint256 _shares, uint256 _amount) internal view returns (uint256) { uint256 supply = vaultDeposit.shares; return (supply == 0 || _amount == 0) ? _shares : _shares.mulDiv(totalAssets() - _amount, supply, Math.Rounding.Down); } function convertToShares(uint256 _amount) public view returns (uint256) { uint256 supply = vaultDeposit.shares; return (_amount == 0 || supply == 0) ? _amount : _amount.mulDiv(supply, vaultDeposit.totalDeposit, Math.Rounding.Down); } function _withdrawFromVault(uint256 _shares) internal returns (uint256 assetAmount) { require( vaultDeposit.userLastDepositTime[msg.sender] + vaultConfig.lockPeriod < block.timestamp, "can't remove within lock period" ); require(_shares <= vaultDeposit.userShares[msg.sender], "Insufficient shares"); (uint256 fee, uint256 amount) = previewWithdraw(_shares, msg.sender); assetAmount = amount - fee; vaultDeposit.totalDeposit -= amount; vaultDeposit.userShares[msg.sender] -= _shares; vaultDeposit.shares -= _shares; emit WithdrawProcessed(msg.sender, assetAmount, _shares); if (fee > 0) { _transferToAdmin(fee); emit FeeCollected(fee); } } function getStorageAddr() internal returns (address storageAddr) { storageAddr = IBhavishPredictionImpl(getPredictionMarketAddr()).bhavishPredictionStorage(); } function getPredictionRoundStatus(uint256 _roundId) public returns (IBhavishPrediction.RoundState roundStatus) { IBhavishPrediction.Round memory roundDetails = IBhavishStorage(getStorageAddr()).getPredictionRound(_roundId); roundStatus = roundDetails.roundState; } function getPredictionRound(uint256 _roundId) public returns (IBhavishPrediction.Round memory roundDetails) { roundDetails = IBhavishStorage(getStorageAddr()).getPredictionRound(_roundId); } function getBetInfo(uint256 _roundId) public returns (IBhavishPrediction.BetInfo memory betInfo) { betInfo = IBhavishStorage(getStorageAddr()).getBetInfo(_roundId, address(this)); } function isClaimable(uint256 _roundId) public returns (bool _isClaimable) { _isClaimable = IBhavishPredictionImpl(getPredictionMarketAddr())._claimable( getPredictionRound(_roundId), getBetInfo(_roundId) ); } function isClaimPending(uint256 _roundId) public returns (bool) { IBhavishPrediction.BetInfo memory betInfo = getBetInfo(_roundId); return betInfo.amountDispersed == 0; } function getRoundBetAmount(uint256 _roundId) public returns (uint256 _amount) { IBhavishPrediction.BetInfo memory betInfo = getBetInfo(_roundId); _amount = betInfo.upPredictAmount + betInfo.downPredictAmount; } function performClaimAndRefund() internal { if (isClaimPending(vaultConfig.penultimateRoundId)) { uint256[] memory roundIds = new uint256[](1); roundIds[0] = vaultConfig.penultimateRoundId; IBhavishPrediction.RoundState rStatus = getPredictionRoundStatus(vaultConfig.penultimateRoundId); if (rStatus == IBhavishPrediction.RoundState.ENDED) this.performClaim(roundIds); else if (rStatus == IBhavishPrediction.RoundState.CANCELLED) this.performRefund(roundIds); } if (isClaimPending(vaultConfig.previousRoundId)) { uint256[] memory roundIds = new uint256[](1); roundIds[0] = vaultConfig.previousRoundId; IBhavishPrediction.RoundState rStatus = getPredictionRoundStatus(vaultConfig.previousRoundId); if (rStatus == IBhavishPrediction.RoundState.ENDED) this.performClaim(roundIds); else if (rStatus == IBhavishPrediction.RoundState.CANCELLED) this.performRefund(roundIds); } } function performPrediction(uint256 roundId, bool nextPredictionUp) external whenNotPaused onlyOperator(msg.sender) { // Predict only Percentage defined from the current balance uint256 predictedAmount = getRoundBetAmount(roundId); IBhavishPrediction.Round memory round = getPredictionRound(roundId); uint256 toBePredictedAmount = protector.getMaxPredictAmount( address(this).balance, vaultConfig.predictionPerc, vaultConfig.minPredictionPerc, round.downPredictAmount, round.upPredictAmount, predictedAmount, nextPredictionUp ); // this will also take crae first time prediction using when predictedAmount ==0 if (toBePredictedAmount > 0) { _performPrediction(roundId, nextPredictionUp, toBePredictedAmount); } // solve for case when perform predict called more than once in a round if (vaultConfig.previousRoundId != roundId) { performClaimAndRefund(); vaultConfig.penultimateRoundId = vaultConfig.previousRoundId; vaultConfig.previousRoundId = roundId; } } function _transferToAdmin(uint256 _fee) internal { _safeTransfer(address(bhavishAdmin), _fee); } }
// SPDX-License-Identifier: BSD-4-Clause pragma solidity ^0.8.13; import "./../Integrations/Swap/BhavishSwap.sol"; interface IBhavishSDK { event PredictionMarketProvider(uint256 indexed _month, address indexed _provider); struct PredictionStruct { bytes32 underlying; bytes32 strike; uint256 roundId; bool directionUp; } function predict( PredictionStruct memory _predStruct, address _userAddress, address _provider ) external payable; function predictWithGasless(PredictionStruct memory _predStruct, address _provider) external payable; function minimumGaslessBetAmount() external returns (uint256); function swapAndPredict( BhavishSwap.SwapStruct memory _swapStruct, PredictionStruct memory _predStruct, uint256 slippage, address _provider ) external; function swapAndPredictWithGasless( BhavishSwap.SwapStruct memory _swapStruct, PredictionStruct memory _predStruct, uint256 slippage, address _provider ) external; function claim( PredictionStruct memory _predStruct, uint256[] calldata roundIds, bytes32 toAsset, bool convert, uint256 slippage ) external; function refundUsers(PredictionStruct memory _predStruct, uint256 roundId) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: BSD-4-Clause pragma solidity ^0.8.13; /** * @title IBhavishAdministrator */ interface IBhavishAdministrator { /** * @dev Emitted when Treasury is claimed by the admin * @param admin Address of the admin * @param amount Amount claimed by the admin */ event TreasuryClaim(address indexed admin, uint256 amount); /** * @dev Claim the treasury amount. Can be performed only by admin * @param _amount Amount that admin wants to claim */ function claimTreasury(uint256 _amount) external; }
// SPDX-License-Identifier: BSD-4-Clause pragma solidity ^0.8.13; interface IBhavishPrediction { enum RoundState { CREATED, STARTED, ENDED, CANCELLED } struct Round { uint256 roundId; RoundState roundState; uint256 upPredictAmount; uint256 downPredictAmount; uint256 totalAmount; uint256 rewardBaseCalAmount; uint256 rewardAmount; uint256 startPrice; uint256 endPrice; uint256 roundStartTimestamp; uint256 roundEndTimestamp; } struct BetInfo { uint256 upPredictAmount; uint256 downPredictAmount; uint256 amountDispersed; } struct AssetPair { bytes32 underlying; bytes32 strike; } struct PredictionMarketStatus { bool startPredictionMarketOnce; bool createPredictionMarketOnce; } /** * @notice Create Round Zero round * @dev callable by Operator * @param _roundzeroStartTimestamp: round zero round start timestamp */ function createPredictionMarket(uint256 _roundzeroStartTimestamp) external; /** * @notice Start Zero round * @dev callable by Operator */ function startPredictionMarket() external; /** * @notice Execute round * @dev Callable by Operator */ function executeRound() external; /** * @notice Bet Bull position * @param roundId: Round Id * @param userAddress: Address of the user */ function predictUp(uint256 roundId, address userAddress) external payable; /** * @notice Bet Bear position * @param roundId: Round Id * @param userAddress: Address of the user */ function predictDown(uint256 roundId, address userAddress) external payable; function getCurrentRoundDetails() external view returns (IBhavishPrediction.Round memory); function claim( uint256[] calldata roundIds, bytes32 toAsset, bool convert, uint256 slippage, address userAddress ) external; function refundUsers(uint256 _predictRoundId, address userAddress) external; function getAverageBetAmount(uint256[] calldata roundIds, address userAddress) external returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev 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) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @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.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. It the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. // We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`. // This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`. // Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a // good first aproximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1; uint256 x = a; if (x >> 128 > 0) { x >>= 128; result <<= 64; } if (x >> 64 > 0) { x >>= 64; result <<= 32; } if (x >> 32 > 0) { x >>= 32; result <<= 16; } if (x >> 16 > 0) { x >>= 16; result <<= 8; } if (x >> 8 > 0) { x >>= 8; result <<= 4; } if (x >> 4 > 0) { x >>= 4; result <<= 2; } if (x >> 2 > 0) { result <<= 1; } // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { uint256 result = sqrt(a); if (rounding == Rounding.Up && result * result < a) { result += 1; } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: BSD-4-Clause pragma solidity ^0.8.13; interface IVaultProtector { function getMaxPredictAmount( uint256 vaultBalance, uint256 predictionPerc, uint256 minPredictionPerc, uint256 roundDownPredictAmount, uint256 roundUpPredictAmount, uint256 predictedAmount, bool nextPredictionUp ) external view returns (uint256 maxAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: BSD-4-Clause import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "../../Interface/IBhavishSDK.sol"; pragma solidity ^0.8.13; contract BhavishSwap is AccessControl { using SafeERC20 for IERC20; address public UNISWAP_FACTORY; address public UNISWAP_ROUTER; mapping(bytes32 => address[]) public pathMapper; uint256 public decimals = 3; struct SwapStruct { uint256 amountIn; uint256 deadline; bytes32 fromAsset; bytes32 toAsset; } modifier onlyAsset(bytes32 fromAsset, bytes32 toAsset) { address[] memory path = getPath(fromAsset, toAsset); require(path.length > 1, "Asset swap not supported"); _; } modifier onlyAdmin(address _address) { require(hasRole(DEFAULT_ADMIN_ROLE, _address), "Address not an admin"); _; } constructor(address uniswapFactory, address uniswapRouter) { UNISWAP_FACTORY = uniswapFactory; UNISWAP_ROUTER = uniswapRouter; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); } /** * @notice Add funds */ receive() external payable {} function setPath( bytes32 fromAsset, bytes32 toAsset, address[] memory path ) external onlyAdmin(msg.sender) { require(path.length > 1, "Path cannot be empty or 1"); pathMapper[keccak256((abi.encode(fromAsset, toAsset)))] = path; } function getPath(bytes32 fromAsset, bytes32 toAsset) public view returns (address[] memory) { return pathMapper[keccak256(abi.encode(fromAsset, toAsset))]; } // Get the amounts out for the specified path function getAmountsOut( uint256 amountIn, bytes32 fromAsset, bytes32 toAsset ) public view onlyAsset(fromAsset, toAsset) returns (uint256[] memory amounts) { address[] memory path = getPath(fromAsset, toAsset); amounts = new uint256[](path.length); amounts = IUniswapV2Router02(UNISWAP_ROUTER).getAmountsOut(amountIn, path); } function swapExactTokensForETH( SwapStruct memory _swapStruct, address to, uint256 slippage ) external onlyAsset(_swapStruct.fromAsset, _swapStruct.toAsset) returns (uint256[] memory amounts) { address[] memory path = getPath(_swapStruct.fromAsset, _swapStruct.toAsset); uint256[] memory amountsOut = getAmountsOut(_swapStruct.amountIn, _swapStruct.fromAsset, _swapStruct.toAsset); uint256 amountOut = amountsOut[amountsOut.length - 1] - ((amountsOut[amountsOut.length - 1] * slippage) / 10**decimals); IERC20(path[0]).safeApprove(UNISWAP_ROUTER, _swapStruct.amountIn); amounts = IUniswapV2Router02(UNISWAP_ROUTER).swapExactTokensForETH( _swapStruct.amountIn, amountOut, path, to, _swapStruct.deadline ); } function swapExactETHForTokens( SwapStruct memory _swapStruct, address to, uint256 slippage ) external payable onlyAsset(_swapStruct.fromAsset, _swapStruct.toAsset) returns (uint256[] memory amounts) { address[] memory path = getPath(_swapStruct.fromAsset, _swapStruct.toAsset); uint256[] memory amountsOut = getAmountsOut(msg.value, _swapStruct.fromAsset, _swapStruct.toAsset); uint256 amountOut = amountsOut[amountsOut.length - 1] - ((amountsOut[amountsOut.length - 1] * slippage) / 10**decimals); amounts = IUniswapV2Router02(UNISWAP_ROUTER).swapExactETHForTokens{ value: msg.value }( amountOut, path, to, _swapStruct.deadline ); } }
pragma solidity >=0.6.2; import './IUniswapV2Router01.sol'; interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; }
pragma solidity >=0.5.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; }
pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
pragma solidity >=0.6.2; 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 removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IBhavishAdministrator","name":"_bhavishAdmin","type":"address"},{"internalType":"contract IBhavishSDK","name":"_bhavishSDK","type":"address"},{"internalType":"bytes32","name":"_underlying","type":"bytes32"},{"internalType":"bytes32","name":"_strike","type":"bytes32"},{"internalType":"string","name":"_supportedCurrency","type":"string"},{"internalType":"contract IVaultProtector","name":"_protector","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assetAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"DepositProcessed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"FeeCollected","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IBhavishAdministrator","name":"_admin","type":"address"}],"name":"NewBhavishAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_period","type":"uint256"}],"name":"NewLockPeriod","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"cap","type":"uint256"}],"name":"NewMaxCapacity","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_perc","type":"uint256"}],"name":"NewMinPredictionPerc","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"}],"name":"NewOperator","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"NewPerformanceFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_perc","type":"uint256"}],"name":"NewPredictionPerc","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IVaultProtector","name":"_protector","type":"address"}],"name":"NewVaultProtector","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"NewWithdrawFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assetAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"WithdrawProcessed","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PERFORMANCE_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_WITHDRAW_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"assetPair","outputs":[{"internalType":"bytes32","name":"underlying","type":"bytes32"},{"internalType":"bytes32","name":"strike","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bhavishAdmin","outputs":[{"internalType":"contract IBhavishAdministrator","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bhavishSDK","outputs":[{"internalType":"contract IBhavishSDK","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"claimRefundMap","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"convertToAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"convertToShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_roundId","type":"uint256"}],"name":"getBetInfo","outputs":[{"components":[{"internalType":"uint256","name":"upPredictAmount","type":"uint256"},{"internalType":"uint256","name":"downPredictAmount","type":"uint256"},{"internalType":"uint256","name":"amountDispersed","type":"uint256"}],"internalType":"struct IBhavishPrediction.BetInfo","name":"betInfo","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getMaxCapacity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_roundId","type":"uint256"}],"name":"getPredictionRound","outputs":[{"components":[{"internalType":"uint256","name":"roundId","type":"uint256"},{"internalType":"enum IBhavishPrediction.RoundState","name":"roundState","type":"uint8"},{"internalType":"uint256","name":"upPredictAmount","type":"uint256"},{"internalType":"uint256","name":"downPredictAmount","type":"uint256"},{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"uint256","name":"rewardBaseCalAmount","type":"uint256"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"internalType":"uint256","name":"startPrice","type":"uint256"},{"internalType":"uint256","name":"endPrice","type":"uint256"},{"internalType":"uint256","name":"roundStartTimestamp","type":"uint256"},{"internalType":"uint256","name":"roundEndTimestamp","type":"uint256"}],"internalType":"struct IBhavishPrediction.Round","name":"roundDetails","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_roundId","type":"uint256"}],"name":"getPredictionRoundStatus","outputs":[{"internalType":"enum IBhavishPrediction.RoundState","name":"roundStatus","type":"uint8"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_roundId","type":"uint256"}],"name":"getRoundBetAmount","outputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_userAddress","type":"address"}],"name":"getUserDeposits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_userAddress","type":"address"}],"name":"getUserLastDepositTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_userAddress","type":"address"}],"name":"getUserShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_roundId","type":"uint256"}],"name":"isClaimPending","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_roundId","type":"uint256"}],"name":"isClaimable","outputs":[{"internalType":"bool","name":"_isClaimable","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_roundIds","type":"uint256[]"}],"name":"performClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"roundId","type":"uint256"},{"internalType":"bool","name":"nextPredictionUp","type":"bool"}],"name":"performPrediction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_roundIds","type":"uint256[]"}],"name":"performRefund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"address","name":"_userAddress","type":"address"}],"name":"previewWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protector","outputs":[{"internalType":"contract IVaultProtector","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IBhavishAdministrator","name":"_admin","type":"address"}],"name":"setBhavishAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_period","type":"uint256"}],"name":"setLockPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cap","type":"uint256"}],"name":"setMaxCapacity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_perc","type":"uint256"}],"name":"setMinPredictionPerc","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setPerformanceFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_perc","type":"uint256"}],"name":"setPredictionPerc","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IVaultProtector","name":"_protector","type":"address"}],"name":"setVaultProtector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setWithdrawFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vaultConfig","outputs":[{"internalType":"uint256","name":"predictionPerc","type":"uint256"},{"internalType":"uint256","name":"minPredictionPerc","type":"uint256"},{"internalType":"uint256","name":"withdrawFeeRatio","type":"uint256"},{"internalType":"uint256","name":"performanceFeeRatio","type":"uint256"},{"internalType":"uint256","name":"previousRoundId","type":"uint256"},{"internalType":"uint256","name":"penultimateRoundId","type":"uint256"},{"internalType":"uint256","name":"lockPeriod","type":"uint256"},{"internalType":"string","name":"supportedCurrency","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vaultDeposit","outputs":[{"internalType":"uint256","name":"totalDeposit","type":"uint256"},{"internalType":"uint256","name":"maxCapacity","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60806040523480156200001157600080fd5b506040516200353138038062003531833981016040819052620000349162000286565b6000805460ff191690556001600255600380546001600160a01b0319166001600160a01b0388161790558151869083908690869085906200007d9060139060208701906200019f565b5061012c600c556103e8600d8190556000600e819055600f919091556201518060125560408051808201909152848152602001839052600a849055600b839055601480546001600160a01b0319166001600160a01b038416179055620000e4903362000116565b5050601680546001600160a01b0319166001600160a01b03999099169890981790975550620003f29650505050505050565b60008281526001602090815260408083206001600160a01b038516845290915290205460ff166200019b5760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45b5050565b828054620001ad90620003b6565b90600052602060002090601f016020900481019282620001d157600085556200021c565b82601f10620001ec57805160ff19168380011785556200021c565b828001600101855582156200021c579182015b828111156200021c578251825591602001919060010190620001ff565b506200022a9291506200022e565b5090565b5b808211156200022a57600081556001016200022f565b6001600160a01b03811681146200025b57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b8051620002818162000245565b919050565b60008060008060008060c08789031215620002a057600080fd5b8651620002ad8162000245565b80965050602080880151620002c28162000245565b604089015160608a015160808b015192985090965094506001600160401b0380821115620002ef57600080fd5b818a0191508a601f8301126200030457600080fd5b8151818111156200031957620003196200025e565b604051601f8201601f19908116603f011681019083821181831017156200034457620003446200025e565b816040528281528d868487010111156200035d57600080fd5b600093505b8284101562000381578484018601518185018701529285019262000362565b82841115620003935760008684830101525b809750505050505050620003aa60a0880162000274565b90509295509295509295565b600181811c90821680620003cb57607f821691505b602082108103620003ec57634e487b7160e01b600052602260045260246000fd5b50919050565b61312f80620004026000396000f3fe6080604052600436106102b15760003560e01c8063918f867411610175578063c5bf0501116100dc578063d4b0de2f11610095578063efc033d41161006f578063efc033d4146108cf578063f5b541a6146108ef578063fa7745ea14610923578063fd52f7221461095357600080fd5b8063d4b0de2f1461087a578063d547741f1461088f578063e1deded1146108af57600080fd5b8063c5bf0501146107d2578063c6e6f592146107f2578063caf0acb114610812578063cd87780214610832578063cfc765b214610852578063d0e30db01461087257600080fd5b8063b3ab15fb1161012e578063b3ab15fb146106ec578063b6ac642a1461070c578063ba0cb22b1461072c578063bd9de03c14610762578063bdca916514610782578063be65d27a1461079857600080fd5b8063918f86741461064157806391d1485414610657578063a217fddf14610677578063a7ffb4fd1461068c578063ab4d139e146106ac578063b33f0e48146106cc57600080fd5b8063325f700e1161021957806374edf926116101d257806374edf92614610576578063779972da1461059657806379141f80146105b65780637cc34bb4146105e35780638456cb591461060c57806389610a091461062157600080fd5b8063325f700e146104b157806336568abe146104e95780633f4ba83a14610509578063453d91c11461051e5780635c975abb1461053e57806370897b231461055657600080fd5b8063241ace8b1161026b578063241ace8b146103c6578063248a9ca3146103db5780632a5bf6d21461040c5780632d148d0a146104425780632e1a7d4d1461046f5780632f2ff15d1461049157600080fd5b8062c42570146102bd57806301e1d1141461030657806301ffc9a71461031957806303c6ae3b1461034957806307a2d13a1461037657806310082c751461039657600080fd5b366102b857005b600080fd5b3480156102c957600080fd5b506102f36102d836600461297d565b6001600160a01b031660009081526005602052604090205490565b6040519081526020015b60405180910390f35b34801561031257600080fd5b50476102f3565b34801561032557600080fd5b5061033961033436600461299a565b610973565b60405190151581526020016102fd565b34801561035557600080fd5b506103696103643660046129c4565b6109aa565b6040516102fd9190612a15565b34801561038257600080fd5b506102f36103913660046129c4565b610a31565b3480156103a257600080fd5b50600a54600b546103b1919082565b604080519283526020830191909152016102fd565b3480156103d257600080fd5b506008546102f3565b3480156103e757600080fd5b506102f36103f63660046129c4565b6000908152600160208190526040909120015490565b34801561041857600080fd5b506102f361042736600461297d565b6001600160a01b031660009081526004602052604090205490565b34801561044e57600080fd5b5061046261045d3660046129c4565b610a58565b6040516102fd9190612a9e565b34801561047b57600080fd5b5061048f61048a3660046129c4565b610b2f565b005b34801561049d57600080fd5b5061048f6104ac366004612aad565b610bd2565b3480156104bd57600080fd5b506003546104d1906001600160a01b031681565b6040516001600160a01b0390911681526020016102fd565b3480156104f557600080fd5b5061048f610504366004612aad565b610bfd565b34801561051557600080fd5b5061048f610c7b565b34801561052a57600080fd5b5061048f6105393660046129c4565b610cb6565b34801561054a57600080fd5b5060005460ff16610339565b34801561056257600080fd5b5061048f6105713660046129c4565b610d1b565b34801561058257600080fd5b5061048f610591366004612aeb565b610dbc565b3480156105a257600080fd5b5061048f6105b13660046129c4565b610f2e565b3480156105c257600080fd5b506105d66105d13660046129c4565b610fed565b6040516102fd9190612b10565b3480156105ef57600080fd5b506105f861108c565b6040516102fd989796959493929190612b8d565b34801561061857600080fd5b5061048f611141565b34801561062d57600080fd5b5061033961063c3660046129c4565b611179565b34801561064d57600080fd5b506102f361271081565b34801561066357600080fd5b50610339610672366004612aad565b611201565b34801561068357600080fd5b506102f3600081565b34801561069857600080fd5b5061048f6106a736600461297d565b61122c565b3480156106b857600080fd5b5061048f6106c736600461297d565b6112a2565b3480156106d857600080fd5b5061048f6106e7366004612c4b565b611318565b3480156106f857600080fd5b5061048f61070736600461297d565b611542565b34801561071857600080fd5b5061048f6107273660046129c4565b611673565b34801561073857600080fd5b506102f361074736600461297d565b6001600160a01b031660009081526006602052604090205490565b34801561076e57600080fd5b506016546104d1906001600160a01b031681565b34801561078e57600080fd5b506102f361138881565b3480156107a457600080fd5b506007546008546009546107b792919083565b604080519384526020840192909252908201526060016102fd565b3480156107de57600080fd5b5061048f6107ed3660046129c4565b611712565b3480156107fe57600080fd5b506102f361080d3660046129c4565b6117b2565b34801561081e57600080fd5b506102f361082d3660046129c4565b6117d9565b34801561083e57600080fd5b5061048f61084d366004612c4b565b6117f8565b34801561085e57600080fd5b5061048f61086d3660046129c4565b61198d565b61048f611a2d565b34801561088657600080fd5b506102f3606481565b34801561089b57600080fd5b5061048f6108aa366004612aad565b611a9b565b3480156108bb57600080fd5b506103b16108ca366004612aad565b611ac1565b3480156108db57600080fd5b506103396108ea3660046129c4565b611b7f565b3480156108fb57600080fd5b506102f37f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92981565b34801561092f57600080fd5b5061033961093e3660046129c4565b60156020526000908152604090205460ff1681565b34801561095f57600080fd5b506014546104d1906001600160a01b031681565b60006001600160e01b03198216637965db0b60e01b14806109a457506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000806109b5611b97565b6001600160a01b0316632d148d0a846040518263ffffffff1660e01b81526004016109e291815260200190565b610160604051808303816000875af1158015610a02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a269190612d05565b602001519392505050565b6009546000908015610a4f57610a4a8347836000611c09565b610a51565b825b9392505050565b610ab66040805161016081019091526000808252602082019081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b610abe611b97565b6001600160a01b0316632d148d0a836040518263ffffffff1660e01b8152600401610aeb91815260200190565b610160604051808303816000875af1158015610b0b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a49190612d05565b6002805403610b855760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b600280556000610b9482611c66565b9050610ba03382611e24565b33600090815260066020526040902054610bb990610a31565b3360009081526004602052604090205550506001600255565b60008281526001602081905260409091200154610bee81611ec7565b610bf88383611ed1565b505050565b6001600160a01b0381163314610c6d5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610b7c565b610c778282611f3c565b5050565b610c83611fa3565b33610c8f600082611201565b610cab5760405162461bcd60e51b8152600401610b7c90612d9f565b610cb3611fee565b50565b33610cc2600082611201565b610cde5760405162461bcd60e51b8152600401610b7c90612d9f565b60088290556040518281527f7d1add0669a53e17afbce52bebfe0a7ff2b70671e398396278f7695a64b6d19b906020015b60405180910390a15050565b33610d27600082611201565b610d435760405162461bcd60e51b8152600401610b7c90612d9f565b611388821115610d875760405162461bcd60e51b815260206004820152600f60248201526e43616e6e6f74206265203e2035302560881b6044820152606401610b7c565b600f8290556040518281527fefeafcf03e479a9566d7ef321b4816de0ba19cfa3cd0fae2f8c5f4a0afb342c490602001610d0f565b610dc4612040565b33610def7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92982611201565b610e345760405162461bcd60e51b815260206004820152601660248201527521b0b63632b91024b9902737ba1027b832b930ba37b960511b6044820152606401610b7c565b6000610e3f846117d9565b90506000610e4c85610a58565b601454600c54600d5460608401516040808601519051633cd4cea960e21b8152476004820152602481019490945260448401929092526064830152608482015260a4810185905286151560c48201529192506000916001600160a01b039091169063f3533aa49060e401602060405180830381865afa158015610ed3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef79190612dcd565b90508015610f0a57610f0a868683612086565b6010548614610f2657610f1b612136565b601080546011558690555b505050505050565b33610f3a600082611201565b610f565760405162461bcd60e51b8152600401610b7c90612d9f565b620151808210158015610f6c575062093a808211155b610fb85760405162461bcd60e51b815260206004820152601d60248201527f43616e6e6f74206265203c203120646179732026203e203720646179730000006044820152606401610b7c565b60128290556040518281527fdb58c3448fa6dc4b2401b39b9ef3a0c9de44312a88055379c5f3bfe435781cc090602001610d0f565b61101160405180606001604052806000815260200160008152602001600081525090565b611019611b97565b604051630736449d60e11b8152600481018490523060248201526001600160a01b039190911690630e6c893a906044016060604051808303816000875af1158015611068573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a49190612de6565b600c8054600d54600e54600f54601054601154601254601380549798969795969495939492939192916110be90612e42565b80601f01602080910402602001604051908101604052809291908181526020018280546110ea90612e42565b80156111375780601f1061110c57610100808354040283529160200191611137565b820191906000526020600020905b81548152906001019060200180831161111a57829003601f168201915b5050505050905088565b611149612040565b33611155600082611201565b6111715760405162461bcd60e51b8152600401610b7c90612d9f565b610cb3612395565b60006111836123d2565b6001600160a01b031663a200373461119a84610a58565b6111a385610fed565b6040518363ffffffff1660e01b81526004016111c0929190612e7c565b602060405180830381865afa1580156111dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a49190612eae565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b33611238600082611201565b6112545760405162461bcd60e51b8152600401610b7c90612d9f565b600380546001600160a01b0319166001600160a01b0384169081179091556040519081527f522a9d966ec0cd5f95c79b749fc0883540288e3f3c64ae32dd6fab638ba9cec590602001610d0f565b336112ae600082611201565b6112ca5760405162461bcd60e51b8152600401610b7c90612d9f565b601480546001600160a01b0319166001600160a01b0384169081179091556040519081527f93736a6ccabac1168b1b91a65761893b69081ecb8486c4ab251920a6a78e4eaf90602001610d0f565b600047815b835181101561150e576015600085838151811061133c5761133c612ecb565b60209081029190910181015182528101919091526040016000205460ff161580156113ad575061138484828151811061137757611377612ecb565b6020026020010151611179565b15806113ad57506113ad8482815181106113a0576113a0612ecb565b6020026020010151611b7f565b156114fc576113d48482815181106113c7576113c7612ecb565b60200260200101516117d9565b6113de9084612ef7565b60165460408051608081018252600a548152600b5460208201526000918101829052606081019190915286519295506001600160a01b03909116916351cb2c91919087908590811061143257611432612ecb565b60200260200101516040518363ffffffff1660e01b8152600401611484929190825181526020808401519082015260408084015190820152606092830151151592810192909252608082015260a00190565b600060405180830381600087803b15801561149e57600080fd5b505af11580156114b2573d6000803e3d6000fd5b505050506001601560008684815181106114ce576114ce612ecb565b6020026020010151815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8061150681612f0f565b91505061131d565b50600061151b8247612f28565b9050828160046003015461152f9190612ef7565b6115399190612f28565b60075550505050565b3361154e600082611201565b61156a5760405162461bcd60e51b8152600401610b7c90612d9f565b6001600160a01b0382163b156115c25760405162461bcd60e51b815260206004820152601d60248201527f4f70657261746f722063616e6e6f74206265206120636f6e74726163740000006044820152606401610b7c565b6001600160a01b0382166116115760405162461bcd60e51b815260206004820152601660248201527543616e6e6f74206265207a65726f206164647265737360501b6044820152606401610b7c565b61163b7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92983610bd2565b6040516001600160a01b038316907fda12ee837e6978172aaf54b16145ffe08414fd8710092ef033c71b8eb6ec189a90600090a25050565b3361167f600082611201565b61169b5760405162461bcd60e51b8152600401610b7c90612d9f565b60648211156116dd5760405162461bcd60e51b815260206004820152600e60248201526d43616e6e6f74206265203e20312560901b6044820152606401610b7c565b600e8290556040518281527fd5fe46099fa396290a7f57e36c3c3c8774e2562c18ed5d1dcc0fa75071e03f1d90602001610d0f565b3361171e600082611201565b61173a5760405162461bcd60e51b8152600401610b7c90612d9f565b61271082111561177d5760405162461bcd60e51b815260206004820152600e60248201526d43616e6e6f74206265203130302560901b6044820152606401610b7c565b600d8290556040518281527f348eef0db4960fc5edb37b243ae66c01e53b655236ab21382be247b1fe3f840690602001610d0f565b6009546000908215806117c3575080155b610a4f57600754610a4a90849083906000611c09565b6000806117e583610fed565b60208101518151919250610a5191612ef7565b600047815b83518110156118f1576015600085838151811061181c5761181c612ecb565b60209081029190910181015182528101919091526040016000205460ff16158015611873575061185784828151811061137757611377612ecb565b158061187357506118738482815181106113a0576113a0612ecb565b156118df5761188d8482815181106113c7576113c7612ecb565b6118979084612ef7565b92506001601560008684815181106118b1576118b1612ecb565b6020026020010151815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806118e981612f0f565b9150506117fd565b5060165460408051608081018252600a548152600b546020820152600081830181905260608201819052915163125ebf4560e11b81526001600160a01b03909316926324bd7e8a9261194d929188919081908190600401612f7a565b600060405180830381600087803b15801561196757600080fd5b505af115801561197b573d6000803e3d6000fd5b505050506000814761151b9190612f28565b33611999600082611201565b6119b55760405162461bcd60e51b8152600401610b7c90612d9f565b6127108211156119f85760405162461bcd60e51b815260206004820152600e60248201526d43616e6e6f74206265203130302560901b6044820152606401610b7c565b600c8290556040518281527f98a644a4de85241e1d19656b2373f45f9795449b4ebe85b20ea2cf14902163f890602001610d0f565b611a35612040565b6002805403611a865760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610b7c565b60028055611a933461242f565b506001600255565b60008281526001602081905260409091200154611ab781611ec7565b610bf88383611f3c565b6001600160a01b03811660009081526006602052604081205481908190611af390611aed876064612fd3565b906125e3565b6001600160a01b03851660009081526004602052604081205491925090606490611b1e908490612fd3565b611b289190613008565b90506000611b3587610a31565b90506000611b438284612615565b9150506000611b5184612637565b90508115611b6f57611b6282612655565b611b6c9082612ef7565b90505b95509093505050505b9250929050565b600080611b8b83610fed565b60400151159392505050565b6000611ba16123d2565b6001600160a01b031663e8712bd46040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611be0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c04919061302a565b905090565b600080611c17868686612669565b90506001836002811115611c2d57611c2d6129dd565b148015611c4a575060008480611c4557611c45612ff2565b868809115b15611c5d57611c5a600182612ef7565b90505b95945050505050565b6012543360009081526005602052604081205490914291611c879190612ef7565b10611cd45760405162461bcd60e51b815260206004820152601f60248201527f63616e27742072656d6f76652077697468696e206c6f636b20706572696f64006044820152606401610b7c565b33600090815260066020526040902054821115611d295760405162461bcd60e51b8152602060048201526013602482015272496e73756666696369656e742073686172657360681b6044820152606401610b7c565b600080611d368433611ac1565b9092509050611d458282612f28565b92508060046003016000828254611d5c9190612f28565b90915550503360009081526006602052604081208054869290611d80908490612f28565b909155505060098054859190600090611d9a908490612f28565b9091555050604080518481526020810186905233917febad37b830b1857ef9af5983fc20dc0ded12dc472ba1e22e06fd3a9465b4506c910160405180910390a28115611e1d57611de982612717565b6040518281527fc472cb3a7a659a876494d66b3063145f279701771d6150b9329c31611ed6405c9060200160405180910390a15b5050919050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611e71576040519150601f19603f3d011682016040523d82523d6000602084013e611e76565b606091505b5050905080610bf85760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c4544006044820152606401610b7c565b610cb3813361272d565b611edb8282611201565b610c775760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b611f468282611201565b15610c775760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60005460ff16611fec5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610b7c565b565b611ff6611fa3565b6000805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60005460ff1615611fec5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610b7c565b60165460408051608081018252600a548152600b546020820190815281830187815286151560608401908152935163511d84d960e01b81529251600484015290516024830152516044820152905115156064820152306084820181905260a48201526001600160a01b039091169063511d84d990839060c4016000604051808303818588803b15801561211857600080fd5b505af115801561212c573d6000803e3d6000fd5b5050505050505050565b60115461214290611b7f565b156122855760408051600180825281830190925260009160208083019080368337019050509050600c600501548160008151811061218257612182612ecb565b602002602001018181525050600061219e600c600501546109aa565b905060028160038111156121b4576121b46129dd565b03612213576040516366c3bc0160e11b8152309063cd877802906121dc908590600401613047565b600060405180830381600087803b1580156121f657600080fd5b505af115801561220a573d6000803e3d6000fd5b50505050612282565b6003816003811115612227576122276129dd565b0361228257604051631667e1c960e31b8152309063b33f0e489061224f908590600401613047565b600060405180830381600087803b15801561226957600080fd5b505af115801561227d573d6000803e3d6000fd5b505050505b50505b60105461229190611b7f565b15611fec5760408051600180825281830190925260009160208083019080368337019050509050600c60040154816000815181106122d1576122d1612ecb565b60200260200101818152505060006122ed600c600401546109aa565b90506002816003811115612303576123036129dd565b03612359576040516366c3bc0160e11b8152309063cd8778029061232b908590600401613047565b600060405180830381600087803b15801561234557600080fd5b505af1158015610f26573d6000803e3d6000fd5b600381600381111561236d5761236d6129dd565b03610c7757604051631667e1c960e31b8152309063b33f0e489061232b908590600401613047565b61239d612040565b6000805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586120233390565b601654600a54600b54604051630bc28d3f60e41b81526000936001600160a01b03169263bc28d3f09261241092600401918252602082015260400190565b6020604051808303816000875af1158015611be0573d6000803e3d6000fd5b6000612439612040565b6007548290612449908290612ef7565b600854101561249a5760405162461bcd60e51b815260206004820152601a60248201527f5661756c742072656163686564206d61782063617061636974790000000000006044820152606401610b7c565b600083116124e35760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a590811195c1bdcda5d08105b5bdd5b9d60521b6044820152606401610b7c565b336000908152600660205260409020546124fd9084612791565b336000908152600460209081526040808320939093556005905220429055612524836117b2565b9150826004600301600082825461253b9190612ef7565b9091555050336000908152600460205260408120805485929061255f908490612ef7565b90915550503360009081526006602052604081208054849290612583908490612ef7565b90915550506009805483919060009061259d908490612ef7565b9091555050604080518481526020810184905233917f782ea2005b7f873a0190a1ccb553c732171348d6e16d2b7d3d493c0677dc296e910160405180910390a250919050565b6000821561260c57816125f7600185612f28565b6126019190613008565b610a4a906001612ef7565b60009392505050565b6000808383111561262b57506000905080611b78565b50600193919092039150565b600e546000906127109061264b9084612fd3565b6109a49190613008565b600f546000906127109061264b9084612fd3565b60008080600019858709858702925082811083820303915050806000036126a35783828161269957612699612ff2565b0492505050610a51565b8084116126af57600080fd5b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b600354610cb3906001600160a01b031682611e24565b6127378282611201565b610c775761274f816001600160a01b031660146127cc565b61275a8360206127cc565b60405160200161276b92919061305a565b60408051601f198184030181529082905262461bcd60e51b8252610b7c916004016130cf565b6009546000908015806127a2575082155b6127c2576127bd6127b38447612f28565b8590836000611c09565b6127c4565b835b949350505050565b606060006127db836002612fd3565b6127e6906002612ef7565b67ffffffffffffffff8111156127fe576127fe612bda565b6040519080825280601f01601f191660200182016040528015612828576020820181803683370190505b509050600360fc1b8160008151811061284357612843612ecb565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061287257612872612ecb565b60200101906001600160f81b031916908160001a9053506000612896846002612fd3565b6128a1906001612ef7565b90505b6001811115612919576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106128d5576128d5612ecb565b1a60f81b8282815181106128eb576128eb612ecb565b60200101906001600160f81b031916908160001a90535060049490941c93612912816130e2565b90506128a4565b508315610a515760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610b7c565b6001600160a01b0381168114610cb357600080fd5b60006020828403121561298f57600080fd5b8135610a5181612968565b6000602082840312156129ac57600080fd5b81356001600160e01b031981168114610a5157600080fd5b6000602082840312156129d657600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b60048110612a1157634e487b7160e01b600052602160045260246000fd5b9052565b602081016109a482846129f3565b805182526020810151612a3960208401826129f3565b5060408101516040830152606081015160608301526080810151608083015260a081015160a083015260c081015160c083015260e081015160e08301526101008082015181840152506101208082015181840152506101408082015181840152505050565b61016081016109a48284612a23565b60008060408385031215612ac057600080fd5b823591506020830135612ad281612968565b809150509250929050565b8015158114610cb357600080fd5b60008060408385031215612afe57600080fd5b823591506020830135612ad281612add565b815181526020808301519082015260408083015190820152606081016109a4565b60005b83811015612b4c578181015183820152602001612b34565b83811115612b5b576000848401525b50505050565b60008151808452612b79816020860160208601612b31565b601f01601f19169290920160200192915050565b60006101008a83528960208401528860408401528760608401528660808401528560a08401528460c08401528060e0840152612bcb81840185612b61565b9b9a5050505050505050505050565b634e487b7160e01b600052604160045260246000fd5b604051610160810167ffffffffffffffff81118282101715612c1457612c14612bda565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715612c4357612c43612bda565b604052919050565b60006020808385031215612c5e57600080fd5b823567ffffffffffffffff80821115612c7657600080fd5b818501915085601f830112612c8a57600080fd5b813581811115612c9c57612c9c612bda565b8060051b9150612cad848301612c1a565b8181529183018401918481019088841115612cc757600080fd5b938501935b83851015612ce557843582529385019390850190612ccc565b98975050505050505050565b805160048110612d0057600080fd5b919050565b60006101608284031215612d1857600080fd5b612d20612bf0565b82518152612d3060208401612cf1565b602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c082015260e083015160e08201526101008084015181830152506101208084015181830152506101408084015181830152508091505092915050565b60208082526014908201527320b2323932b9b9903737ba1030b71030b236b4b760611b604082015260600190565b600060208284031215612ddf57600080fd5b5051919050565b600060608284031215612df857600080fd5b6040516060810181811067ffffffffffffffff82111715612e1b57612e1b612bda565b80604052508251815260208301516020820152604083015160408201528091505092915050565b600181811c90821680612e5657607f821691505b602082108103612e7657634e487b7160e01b600052602260045260246000fd5b50919050565b6101c08101612e8b8285612a23565b8251610160830152602083015161018083015260408301516101a0830152610a51565b600060208284031215612ec057600080fd5b8151610a5181612add565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008219821115612f0a57612f0a612ee1565b500190565b600060018201612f2157612f21612ee1565b5060010190565b600082821015612f3a57612f3a612ee1565b500390565b600081518084526020808501945080840160005b83811015612f6f57815187529582019590820190600101612f53565b509495945050505050565b8551815260208087015190820152604080870151908201526060808701511515908201526000610100806080840152612fb581840188612f3f565b60a0840196909652505091151560c083015260e09091015292915050565b6000816000190483118215151615612fed57612fed612ee1565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261302557634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561303c57600080fd5b8151610a5181612968565b602081526000610a516020830184612f3f565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613092816017850160208801612b31565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516130c3816028840160208801612b31565b01602801949350505050565b602081526000610a516020830184612b61565b6000816130f1576130f1612ee1565b50600019019056fea2646970667358221220215458a753cb89e19257f3eda0f23d73683977fb9a755afbb7012397daf2bf1364736f6c634300080d00330000000000000000000000009728f7772f95a7346c22c831ff6bac565662d8da0000000000000000000000004e60a426ea122cb35c35fbda9f5f732995b9e2264554480000000000000000000000000000000000000000000000000000000000555344000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000dbfe8c34ee4ca993a655600b9dbbd67e24a49b2b00000000000000000000000000000000000000000000000000000000000000054d41544943000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106102b15760003560e01c8063918f867411610175578063c5bf0501116100dc578063d4b0de2f11610095578063efc033d41161006f578063efc033d4146108cf578063f5b541a6146108ef578063fa7745ea14610923578063fd52f7221461095357600080fd5b8063d4b0de2f1461087a578063d547741f1461088f578063e1deded1146108af57600080fd5b8063c5bf0501146107d2578063c6e6f592146107f2578063caf0acb114610812578063cd87780214610832578063cfc765b214610852578063d0e30db01461087257600080fd5b8063b3ab15fb1161012e578063b3ab15fb146106ec578063b6ac642a1461070c578063ba0cb22b1461072c578063bd9de03c14610762578063bdca916514610782578063be65d27a1461079857600080fd5b8063918f86741461064157806391d1485414610657578063a217fddf14610677578063a7ffb4fd1461068c578063ab4d139e146106ac578063b33f0e48146106cc57600080fd5b8063325f700e1161021957806374edf926116101d257806374edf92614610576578063779972da1461059657806379141f80146105b65780637cc34bb4146105e35780638456cb591461060c57806389610a091461062157600080fd5b8063325f700e146104b157806336568abe146104e95780633f4ba83a14610509578063453d91c11461051e5780635c975abb1461053e57806370897b231461055657600080fd5b8063241ace8b1161026b578063241ace8b146103c6578063248a9ca3146103db5780632a5bf6d21461040c5780632d148d0a146104425780632e1a7d4d1461046f5780632f2ff15d1461049157600080fd5b8062c42570146102bd57806301e1d1141461030657806301ffc9a71461031957806303c6ae3b1461034957806307a2d13a1461037657806310082c751461039657600080fd5b366102b857005b600080fd5b3480156102c957600080fd5b506102f36102d836600461297d565b6001600160a01b031660009081526005602052604090205490565b6040519081526020015b60405180910390f35b34801561031257600080fd5b50476102f3565b34801561032557600080fd5b5061033961033436600461299a565b610973565b60405190151581526020016102fd565b34801561035557600080fd5b506103696103643660046129c4565b6109aa565b6040516102fd9190612a15565b34801561038257600080fd5b506102f36103913660046129c4565b610a31565b3480156103a257600080fd5b50600a54600b546103b1919082565b604080519283526020830191909152016102fd565b3480156103d257600080fd5b506008546102f3565b3480156103e757600080fd5b506102f36103f63660046129c4565b6000908152600160208190526040909120015490565b34801561041857600080fd5b506102f361042736600461297d565b6001600160a01b031660009081526004602052604090205490565b34801561044e57600080fd5b5061046261045d3660046129c4565b610a58565b6040516102fd9190612a9e565b34801561047b57600080fd5b5061048f61048a3660046129c4565b610b2f565b005b34801561049d57600080fd5b5061048f6104ac366004612aad565b610bd2565b3480156104bd57600080fd5b506003546104d1906001600160a01b031681565b6040516001600160a01b0390911681526020016102fd565b3480156104f557600080fd5b5061048f610504366004612aad565b610bfd565b34801561051557600080fd5b5061048f610c7b565b34801561052a57600080fd5b5061048f6105393660046129c4565b610cb6565b34801561054a57600080fd5b5060005460ff16610339565b34801561056257600080fd5b5061048f6105713660046129c4565b610d1b565b34801561058257600080fd5b5061048f610591366004612aeb565b610dbc565b3480156105a257600080fd5b5061048f6105b13660046129c4565b610f2e565b3480156105c257600080fd5b506105d66105d13660046129c4565b610fed565b6040516102fd9190612b10565b3480156105ef57600080fd5b506105f861108c565b6040516102fd989796959493929190612b8d565b34801561061857600080fd5b5061048f611141565b34801561062d57600080fd5b5061033961063c3660046129c4565b611179565b34801561064d57600080fd5b506102f361271081565b34801561066357600080fd5b50610339610672366004612aad565b611201565b34801561068357600080fd5b506102f3600081565b34801561069857600080fd5b5061048f6106a736600461297d565b61122c565b3480156106b857600080fd5b5061048f6106c736600461297d565b6112a2565b3480156106d857600080fd5b5061048f6106e7366004612c4b565b611318565b3480156106f857600080fd5b5061048f61070736600461297d565b611542565b34801561071857600080fd5b5061048f6107273660046129c4565b611673565b34801561073857600080fd5b506102f361074736600461297d565b6001600160a01b031660009081526006602052604090205490565b34801561076e57600080fd5b506016546104d1906001600160a01b031681565b34801561078e57600080fd5b506102f361138881565b3480156107a457600080fd5b506007546008546009546107b792919083565b604080519384526020840192909252908201526060016102fd565b3480156107de57600080fd5b5061048f6107ed3660046129c4565b611712565b3480156107fe57600080fd5b506102f361080d3660046129c4565b6117b2565b34801561081e57600080fd5b506102f361082d3660046129c4565b6117d9565b34801561083e57600080fd5b5061048f61084d366004612c4b565b6117f8565b34801561085e57600080fd5b5061048f61086d3660046129c4565b61198d565b61048f611a2d565b34801561088657600080fd5b506102f3606481565b34801561089b57600080fd5b5061048f6108aa366004612aad565b611a9b565b3480156108bb57600080fd5b506103b16108ca366004612aad565b611ac1565b3480156108db57600080fd5b506103396108ea3660046129c4565b611b7f565b3480156108fb57600080fd5b506102f37f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92981565b34801561092f57600080fd5b5061033961093e3660046129c4565b60156020526000908152604090205460ff1681565b34801561095f57600080fd5b506014546104d1906001600160a01b031681565b60006001600160e01b03198216637965db0b60e01b14806109a457506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000806109b5611b97565b6001600160a01b0316632d148d0a846040518263ffffffff1660e01b81526004016109e291815260200190565b610160604051808303816000875af1158015610a02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a269190612d05565b602001519392505050565b6009546000908015610a4f57610a4a8347836000611c09565b610a51565b825b9392505050565b610ab66040805161016081019091526000808252602082019081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b610abe611b97565b6001600160a01b0316632d148d0a836040518263ffffffff1660e01b8152600401610aeb91815260200190565b610160604051808303816000875af1158015610b0b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a49190612d05565b6002805403610b855760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b600280556000610b9482611c66565b9050610ba03382611e24565b33600090815260066020526040902054610bb990610a31565b3360009081526004602052604090205550506001600255565b60008281526001602081905260409091200154610bee81611ec7565b610bf88383611ed1565b505050565b6001600160a01b0381163314610c6d5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610b7c565b610c778282611f3c565b5050565b610c83611fa3565b33610c8f600082611201565b610cab5760405162461bcd60e51b8152600401610b7c90612d9f565b610cb3611fee565b50565b33610cc2600082611201565b610cde5760405162461bcd60e51b8152600401610b7c90612d9f565b60088290556040518281527f7d1add0669a53e17afbce52bebfe0a7ff2b70671e398396278f7695a64b6d19b906020015b60405180910390a15050565b33610d27600082611201565b610d435760405162461bcd60e51b8152600401610b7c90612d9f565b611388821115610d875760405162461bcd60e51b815260206004820152600f60248201526e43616e6e6f74206265203e2035302560881b6044820152606401610b7c565b600f8290556040518281527fefeafcf03e479a9566d7ef321b4816de0ba19cfa3cd0fae2f8c5f4a0afb342c490602001610d0f565b610dc4612040565b33610def7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92982611201565b610e345760405162461bcd60e51b815260206004820152601660248201527521b0b63632b91024b9902737ba1027b832b930ba37b960511b6044820152606401610b7c565b6000610e3f846117d9565b90506000610e4c85610a58565b601454600c54600d5460608401516040808601519051633cd4cea960e21b8152476004820152602481019490945260448401929092526064830152608482015260a4810185905286151560c48201529192506000916001600160a01b039091169063f3533aa49060e401602060405180830381865afa158015610ed3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef79190612dcd565b90508015610f0a57610f0a868683612086565b6010548614610f2657610f1b612136565b601080546011558690555b505050505050565b33610f3a600082611201565b610f565760405162461bcd60e51b8152600401610b7c90612d9f565b620151808210158015610f6c575062093a808211155b610fb85760405162461bcd60e51b815260206004820152601d60248201527f43616e6e6f74206265203c203120646179732026203e203720646179730000006044820152606401610b7c565b60128290556040518281527fdb58c3448fa6dc4b2401b39b9ef3a0c9de44312a88055379c5f3bfe435781cc090602001610d0f565b61101160405180606001604052806000815260200160008152602001600081525090565b611019611b97565b604051630736449d60e11b8152600481018490523060248201526001600160a01b039190911690630e6c893a906044016060604051808303816000875af1158015611068573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a49190612de6565b600c8054600d54600e54600f54601054601154601254601380549798969795969495939492939192916110be90612e42565b80601f01602080910402602001604051908101604052809291908181526020018280546110ea90612e42565b80156111375780601f1061110c57610100808354040283529160200191611137565b820191906000526020600020905b81548152906001019060200180831161111a57829003601f168201915b5050505050905088565b611149612040565b33611155600082611201565b6111715760405162461bcd60e51b8152600401610b7c90612d9f565b610cb3612395565b60006111836123d2565b6001600160a01b031663a200373461119a84610a58565b6111a385610fed565b6040518363ffffffff1660e01b81526004016111c0929190612e7c565b602060405180830381865afa1580156111dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a49190612eae565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b33611238600082611201565b6112545760405162461bcd60e51b8152600401610b7c90612d9f565b600380546001600160a01b0319166001600160a01b0384169081179091556040519081527f522a9d966ec0cd5f95c79b749fc0883540288e3f3c64ae32dd6fab638ba9cec590602001610d0f565b336112ae600082611201565b6112ca5760405162461bcd60e51b8152600401610b7c90612d9f565b601480546001600160a01b0319166001600160a01b0384169081179091556040519081527f93736a6ccabac1168b1b91a65761893b69081ecb8486c4ab251920a6a78e4eaf90602001610d0f565b600047815b835181101561150e576015600085838151811061133c5761133c612ecb565b60209081029190910181015182528101919091526040016000205460ff161580156113ad575061138484828151811061137757611377612ecb565b6020026020010151611179565b15806113ad57506113ad8482815181106113a0576113a0612ecb565b6020026020010151611b7f565b156114fc576113d48482815181106113c7576113c7612ecb565b60200260200101516117d9565b6113de9084612ef7565b60165460408051608081018252600a548152600b5460208201526000918101829052606081019190915286519295506001600160a01b03909116916351cb2c91919087908590811061143257611432612ecb565b60200260200101516040518363ffffffff1660e01b8152600401611484929190825181526020808401519082015260408084015190820152606092830151151592810192909252608082015260a00190565b600060405180830381600087803b15801561149e57600080fd5b505af11580156114b2573d6000803e3d6000fd5b505050506001601560008684815181106114ce576114ce612ecb565b6020026020010151815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8061150681612f0f565b91505061131d565b50600061151b8247612f28565b9050828160046003015461152f9190612ef7565b6115399190612f28565b60075550505050565b3361154e600082611201565b61156a5760405162461bcd60e51b8152600401610b7c90612d9f565b6001600160a01b0382163b156115c25760405162461bcd60e51b815260206004820152601d60248201527f4f70657261746f722063616e6e6f74206265206120636f6e74726163740000006044820152606401610b7c565b6001600160a01b0382166116115760405162461bcd60e51b815260206004820152601660248201527543616e6e6f74206265207a65726f206164647265737360501b6044820152606401610b7c565b61163b7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92983610bd2565b6040516001600160a01b038316907fda12ee837e6978172aaf54b16145ffe08414fd8710092ef033c71b8eb6ec189a90600090a25050565b3361167f600082611201565b61169b5760405162461bcd60e51b8152600401610b7c90612d9f565b60648211156116dd5760405162461bcd60e51b815260206004820152600e60248201526d43616e6e6f74206265203e20312560901b6044820152606401610b7c565b600e8290556040518281527fd5fe46099fa396290a7f57e36c3c3c8774e2562c18ed5d1dcc0fa75071e03f1d90602001610d0f565b3361171e600082611201565b61173a5760405162461bcd60e51b8152600401610b7c90612d9f565b61271082111561177d5760405162461bcd60e51b815260206004820152600e60248201526d43616e6e6f74206265203130302560901b6044820152606401610b7c565b600d8290556040518281527f348eef0db4960fc5edb37b243ae66c01e53b655236ab21382be247b1fe3f840690602001610d0f565b6009546000908215806117c3575080155b610a4f57600754610a4a90849083906000611c09565b6000806117e583610fed565b60208101518151919250610a5191612ef7565b600047815b83518110156118f1576015600085838151811061181c5761181c612ecb565b60209081029190910181015182528101919091526040016000205460ff16158015611873575061185784828151811061137757611377612ecb565b158061187357506118738482815181106113a0576113a0612ecb565b156118df5761188d8482815181106113c7576113c7612ecb565b6118979084612ef7565b92506001601560008684815181106118b1576118b1612ecb565b6020026020010151815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806118e981612f0f565b9150506117fd565b5060165460408051608081018252600a548152600b546020820152600081830181905260608201819052915163125ebf4560e11b81526001600160a01b03909316926324bd7e8a9261194d929188919081908190600401612f7a565b600060405180830381600087803b15801561196757600080fd5b505af115801561197b573d6000803e3d6000fd5b505050506000814761151b9190612f28565b33611999600082611201565b6119b55760405162461bcd60e51b8152600401610b7c90612d9f565b6127108211156119f85760405162461bcd60e51b815260206004820152600e60248201526d43616e6e6f74206265203130302560901b6044820152606401610b7c565b600c8290556040518281527f98a644a4de85241e1d19656b2373f45f9795449b4ebe85b20ea2cf14902163f890602001610d0f565b611a35612040565b6002805403611a865760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610b7c565b60028055611a933461242f565b506001600255565b60008281526001602081905260409091200154611ab781611ec7565b610bf88383611f3c565b6001600160a01b03811660009081526006602052604081205481908190611af390611aed876064612fd3565b906125e3565b6001600160a01b03851660009081526004602052604081205491925090606490611b1e908490612fd3565b611b289190613008565b90506000611b3587610a31565b90506000611b438284612615565b9150506000611b5184612637565b90508115611b6f57611b6282612655565b611b6c9082612ef7565b90505b95509093505050505b9250929050565b600080611b8b83610fed565b60400151159392505050565b6000611ba16123d2565b6001600160a01b031663e8712bd46040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611be0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c04919061302a565b905090565b600080611c17868686612669565b90506001836002811115611c2d57611c2d6129dd565b148015611c4a575060008480611c4557611c45612ff2565b868809115b15611c5d57611c5a600182612ef7565b90505b95945050505050565b6012543360009081526005602052604081205490914291611c879190612ef7565b10611cd45760405162461bcd60e51b815260206004820152601f60248201527f63616e27742072656d6f76652077697468696e206c6f636b20706572696f64006044820152606401610b7c565b33600090815260066020526040902054821115611d295760405162461bcd60e51b8152602060048201526013602482015272496e73756666696369656e742073686172657360681b6044820152606401610b7c565b600080611d368433611ac1565b9092509050611d458282612f28565b92508060046003016000828254611d5c9190612f28565b90915550503360009081526006602052604081208054869290611d80908490612f28565b909155505060098054859190600090611d9a908490612f28565b9091555050604080518481526020810186905233917febad37b830b1857ef9af5983fc20dc0ded12dc472ba1e22e06fd3a9465b4506c910160405180910390a28115611e1d57611de982612717565b6040518281527fc472cb3a7a659a876494d66b3063145f279701771d6150b9329c31611ed6405c9060200160405180910390a15b5050919050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611e71576040519150601f19603f3d011682016040523d82523d6000602084013e611e76565b606091505b5050905080610bf85760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c4544006044820152606401610b7c565b610cb3813361272d565b611edb8282611201565b610c775760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b611f468282611201565b15610c775760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60005460ff16611fec5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610b7c565b565b611ff6611fa3565b6000805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60005460ff1615611fec5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610b7c565b60165460408051608081018252600a548152600b546020820190815281830187815286151560608401908152935163511d84d960e01b81529251600484015290516024830152516044820152905115156064820152306084820181905260a48201526001600160a01b039091169063511d84d990839060c4016000604051808303818588803b15801561211857600080fd5b505af115801561212c573d6000803e3d6000fd5b5050505050505050565b60115461214290611b7f565b156122855760408051600180825281830190925260009160208083019080368337019050509050600c600501548160008151811061218257612182612ecb565b602002602001018181525050600061219e600c600501546109aa565b905060028160038111156121b4576121b46129dd565b03612213576040516366c3bc0160e11b8152309063cd877802906121dc908590600401613047565b600060405180830381600087803b1580156121f657600080fd5b505af115801561220a573d6000803e3d6000fd5b50505050612282565b6003816003811115612227576122276129dd565b0361228257604051631667e1c960e31b8152309063b33f0e489061224f908590600401613047565b600060405180830381600087803b15801561226957600080fd5b505af115801561227d573d6000803e3d6000fd5b505050505b50505b60105461229190611b7f565b15611fec5760408051600180825281830190925260009160208083019080368337019050509050600c60040154816000815181106122d1576122d1612ecb565b60200260200101818152505060006122ed600c600401546109aa565b90506002816003811115612303576123036129dd565b03612359576040516366c3bc0160e11b8152309063cd8778029061232b908590600401613047565b600060405180830381600087803b15801561234557600080fd5b505af1158015610f26573d6000803e3d6000fd5b600381600381111561236d5761236d6129dd565b03610c7757604051631667e1c960e31b8152309063b33f0e489061232b908590600401613047565b61239d612040565b6000805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586120233390565b601654600a54600b54604051630bc28d3f60e41b81526000936001600160a01b03169263bc28d3f09261241092600401918252602082015260400190565b6020604051808303816000875af1158015611be0573d6000803e3d6000fd5b6000612439612040565b6007548290612449908290612ef7565b600854101561249a5760405162461bcd60e51b815260206004820152601a60248201527f5661756c742072656163686564206d61782063617061636974790000000000006044820152606401610b7c565b600083116124e35760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a590811195c1bdcda5d08105b5bdd5b9d60521b6044820152606401610b7c565b336000908152600660205260409020546124fd9084612791565b336000908152600460209081526040808320939093556005905220429055612524836117b2565b9150826004600301600082825461253b9190612ef7565b9091555050336000908152600460205260408120805485929061255f908490612ef7565b90915550503360009081526006602052604081208054849290612583908490612ef7565b90915550506009805483919060009061259d908490612ef7565b9091555050604080518481526020810184905233917f782ea2005b7f873a0190a1ccb553c732171348d6e16d2b7d3d493c0677dc296e910160405180910390a250919050565b6000821561260c57816125f7600185612f28565b6126019190613008565b610a4a906001612ef7565b60009392505050565b6000808383111561262b57506000905080611b78565b50600193919092039150565b600e546000906127109061264b9084612fd3565b6109a49190613008565b600f546000906127109061264b9084612fd3565b60008080600019858709858702925082811083820303915050806000036126a35783828161269957612699612ff2565b0492505050610a51565b8084116126af57600080fd5b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b600354610cb3906001600160a01b031682611e24565b6127378282611201565b610c775761274f816001600160a01b031660146127cc565b61275a8360206127cc565b60405160200161276b92919061305a565b60408051601f198184030181529082905262461bcd60e51b8252610b7c916004016130cf565b6009546000908015806127a2575082155b6127c2576127bd6127b38447612f28565b8590836000611c09565b6127c4565b835b949350505050565b606060006127db836002612fd3565b6127e6906002612ef7565b67ffffffffffffffff8111156127fe576127fe612bda565b6040519080825280601f01601f191660200182016040528015612828576020820181803683370190505b509050600360fc1b8160008151811061284357612843612ecb565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061287257612872612ecb565b60200101906001600160f81b031916908160001a9053506000612896846002612fd3565b6128a1906001612ef7565b90505b6001811115612919576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106128d5576128d5612ecb565b1a60f81b8282815181106128eb576128eb612ecb565b60200101906001600160f81b031916908160001a90535060049490941c93612912816130e2565b90506128a4565b508315610a515760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610b7c565b6001600160a01b0381168114610cb357600080fd5b60006020828403121561298f57600080fd5b8135610a5181612968565b6000602082840312156129ac57600080fd5b81356001600160e01b031981168114610a5157600080fd5b6000602082840312156129d657600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b60048110612a1157634e487b7160e01b600052602160045260246000fd5b9052565b602081016109a482846129f3565b805182526020810151612a3960208401826129f3565b5060408101516040830152606081015160608301526080810151608083015260a081015160a083015260c081015160c083015260e081015160e08301526101008082015181840152506101208082015181840152506101408082015181840152505050565b61016081016109a48284612a23565b60008060408385031215612ac057600080fd5b823591506020830135612ad281612968565b809150509250929050565b8015158114610cb357600080fd5b60008060408385031215612afe57600080fd5b823591506020830135612ad281612add565b815181526020808301519082015260408083015190820152606081016109a4565b60005b83811015612b4c578181015183820152602001612b34565b83811115612b5b576000848401525b50505050565b60008151808452612b79816020860160208601612b31565b601f01601f19169290920160200192915050565b60006101008a83528960208401528860408401528760608401528660808401528560a08401528460c08401528060e0840152612bcb81840185612b61565b9b9a5050505050505050505050565b634e487b7160e01b600052604160045260246000fd5b604051610160810167ffffffffffffffff81118282101715612c1457612c14612bda565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715612c4357612c43612bda565b604052919050565b60006020808385031215612c5e57600080fd5b823567ffffffffffffffff80821115612c7657600080fd5b818501915085601f830112612c8a57600080fd5b813581811115612c9c57612c9c612bda565b8060051b9150612cad848301612c1a565b8181529183018401918481019088841115612cc757600080fd5b938501935b83851015612ce557843582529385019390850190612ccc565b98975050505050505050565b805160048110612d0057600080fd5b919050565b60006101608284031215612d1857600080fd5b612d20612bf0565b82518152612d3060208401612cf1565b602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c082015260e083015160e08201526101008084015181830152506101208084015181830152506101408084015181830152508091505092915050565b60208082526014908201527320b2323932b9b9903737ba1030b71030b236b4b760611b604082015260600190565b600060208284031215612ddf57600080fd5b5051919050565b600060608284031215612df857600080fd5b6040516060810181811067ffffffffffffffff82111715612e1b57612e1b612bda565b80604052508251815260208301516020820152604083015160408201528091505092915050565b600181811c90821680612e5657607f821691505b602082108103612e7657634e487b7160e01b600052602260045260246000fd5b50919050565b6101c08101612e8b8285612a23565b8251610160830152602083015161018083015260408301516101a0830152610a51565b600060208284031215612ec057600080fd5b8151610a5181612add565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008219821115612f0a57612f0a612ee1565b500190565b600060018201612f2157612f21612ee1565b5060010190565b600082821015612f3a57612f3a612ee1565b500390565b600081518084526020808501945080840160005b83811015612f6f57815187529582019590820190600101612f53565b509495945050505050565b8551815260208087015190820152604080870151908201526060808701511515908201526000610100806080840152612fb581840188612f3f565b60a0840196909652505091151560c083015260e09091015292915050565b6000816000190483118215151615612fed57612fed612ee1565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261302557634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561303c57600080fd5b8151610a5181612968565b602081526000610a516020830184612f3f565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613092816017850160208801612b31565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516130c3816028840160208801612b31565b01602801949350505050565b602081526000610a516020830184612b61565b6000816130f1576130f1612ee1565b50600019019056fea2646970667358221220215458a753cb89e19257f3eda0f23d73683977fb9a755afbb7012397daf2bf1364736f6c634300080d0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000009728f7772f95a7346c22c831ff6bac565662d8da0000000000000000000000004e60a426ea122cb35c35fbda9f5f732995b9e2264554480000000000000000000000000000000000000000000000000000000000555344000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000dbfe8c34ee4ca993a655600b9dbbd67e24a49b2b00000000000000000000000000000000000000000000000000000000000000054d41544943000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _bhavishAdmin (address): 0x9728f7772f95a7346c22C831Ff6bAC565662d8dA
Arg [1] : _bhavishSDK (address): 0x4e60a426eA122Cb35C35FBDA9F5F732995B9E226
Arg [2] : _underlying (bytes32): 0x4554480000000000000000000000000000000000000000000000000000000000
Arg [3] : _strike (bytes32): 0x5553440000000000000000000000000000000000000000000000000000000000
Arg [4] : _supportedCurrency (string): MATIC
Arg [5] : _protector (address): 0xdbFe8C34EE4CA993A655600b9dBBD67e24a49b2B
-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 0000000000000000000000009728f7772f95a7346c22c831ff6bac565662d8da
Arg [1] : 0000000000000000000000004e60a426ea122cb35c35fbda9f5f732995b9e226
Arg [2] : 4554480000000000000000000000000000000000000000000000000000000000
Arg [3] : 5553440000000000000000000000000000000000000000000000000000000000
Arg [4] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [5] : 000000000000000000000000dbfe8c34ee4ca993a655600b9dbbd67e24a49b2b
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [7] : 4d41544943000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
POL | Polygon (POL) | 100.00% | $0.376547 | 42.2221 | $15.9 |
[ 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.