Overview
S Balance
S Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
Market
Compiler Version
v0.8.22+commit.4fc1097e
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./LMSRMath.sol"; contract Market is Initializable, ReentrancyGuardUpgradeable, PausableUpgradeable, UUPSUpgradeable, OwnableUpgradeable { // State variables address public factory; address public feeRecipient; address public reporter; address public governor; address public susdToken; uint256 public b; uint256 public resolutionDelay; string[] public outcomes; // Mutable state variables mapping(uint256 => uint256) public outcomeShares; mapping(address => mapping(uint256 => uint256)) public userShares; bool public resolved; uint256 public winningOutcome; uint256 public resolutionTimestamp; uint256 public totalFunding; uint256 public funding; uint256 public tradingFee; // Dispute mechanism variables uint256 public constant DISPUTE_PERIOD = 3 days; uint256 public reporterResolutionDeadline; mapping(uint256 => uint256) public disputeVotes; uint256 public mostVotedOutcome; uint256 public totalVotes; mapping(address => bool) public hasVoted; mapping(address => uint256) public disputeBonds; uint256 public disputeBondAmount; // Fixed point precision uint256 private constant FIXED_ONE = 1e18; // Maximum trade size as percentage of liquidity uint256 public constant MAX_TRADE_PERCENTAGE = 20; // 20% of liquidity // Events event Trade(address indexed user, int256[] amounts, uint256[] shareBalances, uint256 feesPaid); event MarketResolved(uint256 indexed outcome); event Payout(address indexed user, uint256 amount); event ResolutionProposed(uint256 indexed outcome, uint256 resolutionTimestamp); event TradingFeeSet(uint256 newFee); event DisputeSubmitted(address indexed disputer, uint256 indexed proposedOutcome, uint256 bondAmount); event VoteCast(address indexed voter, uint256 indexed outcome); event ReporterDeadlineSet(uint256 deadline); event EmergencyResolution(uint256 indexed outcome, address resolver); /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } struct MarketInitParams { string[] outcomes; address feeRecipient; uint256 resolutionDelay; address reporter; address governor; uint256 b; uint256 tradingFee; address susdToken; uint256 disputeBondAmount; } function initialize(MarketInitParams calldata params) external initializer { __ReentrancyGuard_init(); __Pausable_init(); __Ownable_init(params.governor); __UUPSUpgradeable_init(); require(params.outcomes.length >= 2, "Must have at least 2 outcomes"); require(params.feeRecipient != address(0), "Invalid fee recipient"); require(params.reporter != address(0), "Invalid reporter"); require(params.governor != address(0), "Invalid governor"); require(params.susdToken != address(0), "Invalid SUSD token"); require(params.b > 0, "Invalid liquidity parameter"); factory = msg.sender; feeRecipient = params.feeRecipient; reporter = params.reporter; governor = params.governor; susdToken = params.susdToken; b = params.b; resolutionDelay = params.resolutionDelay; tradingFee = params.tradingFee; disputeBondAmount = params.disputeBondAmount; for (uint256 i = 0; i < params.outcomes.length; i++) { outcomes.push(params.outcomes[i]); outcomeShares[i] = 1e18; } reporterResolutionDeadline = block.timestamp + 30 days; emit ReporterDeadlineSet(reporterResolutionDeadline); // Transfer ownership to the governor // _transferOwnership(_governor); } function _authorizeUpgrade(address newImplementation) internal override onlyOwner {} // Modifiers modifier onlyReporter() { require(msg.sender == reporter, "Only reporter can call this function"); _; } modifier onlyGovernor() { require(msg.sender == governor, "Only governor can call this function"); _; } modifier onlyFactory() { require(msg.sender == factory, "Only factory can call this function"); _; } // Existing Market contract functions function getCurrentShares() public view returns (uint256[] memory) { uint256[] memory shares = new uint256[](outcomes.length); for (uint256 i = 0; i < outcomes.length; i++) { shares[i] = outcomeShares[i]; } return shares; } function getCost(int256[] memory shareDeltas) public view returns (int256) { require(shareDeltas.length == outcomes.length, "Invalid array length"); // Get current shares uint256[] memory shares = getCurrentShares(); // Calculate cost using LMSR math return LMSRMath.calcCost(shares, shareDeltas, b); } function getNetCost(int256[] memory shareDeltas) public view returns (uint256) { int256 cost = getCost(shareDeltas); // If cost is negative (selling), return 0 as net cost if (cost <= 0) return 0; // Apply trading fee uint256 fee = (uint256(cost) * tradingFee) / 10000; return uint256(cost) + fee; } function getMarginalPrice(uint256 outcomeIndex) public view returns (uint256) { require(outcomeIndex < outcomes.length, "Invalid outcome index"); uint256[] memory shares = getCurrentShares(); return LMSRMath.calcMarginalPrice(outcomeIndex, shares, b); } function trade(int256[] calldata shareDeltas, uint256 maxCost) external nonReentrant whenNotPaused { // CHECKS require(!resolved, "Market already resolved"); require(shareDeltas.length == outcomes.length, "Invalid array length"); // Validate trade size to prevent manipulation uint256[] memory shares = getCurrentShares(); for (uint256 i = 0; i < shareDeltas.length; i++) { if (shareDeltas[i] > 0) { // Ensure buy orders don't exceed maximum percentage of current market shares require( uint256(shareDeltas[i]) <= (shares[i] * MAX_TRADE_PERCENTAGE) / 100, "Trade size too large" ); } else if (shareDeltas[i] < 0) { // Ensure sell orders don't exceed user's balance require( uint256(-shareDeltas[i]) <= userShares[msg.sender][i], "Insufficient shares" ); } } // Calculate cost using LMSR int256 cost = getCost(shareDeltas); // Apply trading fee (only for buys) uint256 fee = 0; uint256 tradeTotalCost = 0; if (cost > 0) { fee = (uint256(cost) * tradingFee) / 10000; tradeTotalCost = uint256(cost) + fee; // Slippage protection require(tradeTotalCost <= maxCost, "Slippage exceeded"); } // EFFECTS // Update state variables for (uint256 i = 0; i < shareDeltas.length; i++) { if (shareDeltas[i] > 0) { outcomeShares[i] += uint256(shareDeltas[i]); userShares[msg.sender][i] += uint256(shareDeltas[i]); } else if (shareDeltas[i] < 0) { outcomeShares[i] -= uint256(-shareDeltas[i]); userShares[msg.sender][i] -= uint256(-shareDeltas[i]); } } if (cost > 0) { funding += uint256(cost); totalFunding += uint256(cost) + fee; } // INTERACTIONS if (cost > 0) { // User is buying, transfer SUSD from user require( IERC20(susdToken).transferFrom(msg.sender, address(this), uint256(cost)), "Trade transfer failed" ); // Transfer fee if (fee > 0) { require( IERC20(susdToken).transferFrom(msg.sender, feeRecipient, fee), "Fee transfer failed" ); } } else if (cost < 0) { // User is selling, transfer SUSD to user require( IERC20(susdToken).transfer(msg.sender, uint256(-cost)), "Payout transfer failed" ); } // Get updated share balances for the event uint256[] memory newBalances = getCurrentShares(); emit Trade(msg.sender, shareDeltas, newBalances, fee); } function resolveMarket(uint256 outcome) external onlyReporter { require(!resolved, "Market already resolved"); require(block.timestamp >= reporterResolutionDeadline, "Too early"); require(outcome < outcomes.length, "Invalid outcome"); winningOutcome = outcome; resolutionTimestamp = block.timestamp; resolved = true; emit ResolutionProposed(outcome, resolutionTimestamp); emit MarketResolved(outcome); } function overrideResolution(uint256 outcome) external onlyGovernor { require(!resolved, "Market already resolved"); require(block.timestamp < resolutionTimestamp, "Dispute period ended"); require(outcome < outcomes.length, "Invalid outcome"); resolved = true; winningOutcome = outcome; resolutionTimestamp = 0; emit MarketResolved(outcome); } function payout() external nonReentrant { require(resolved, "Market not resolved"); uint256 shares = userShares[msg.sender][winningOutcome]; require(shares > 0, "No winning shares"); uint256 payoutAmount = shares; userShares[msg.sender][winningOutcome] = 0; require(IERC20(susdToken).transfer(msg.sender, payoutAmount), "Payout transfer failed"); emit Payout(msg.sender, payoutAmount); } // Dispute mechanism for users function submitDispute(uint256 proposedOutcome) external nonReentrant { require(!resolved, "Market already resolved"); require(proposedOutcome < outcomes.length, "Invalid outcome"); require(!hasVoted[msg.sender], "Already voted"); require(block.timestamp <= resolutionTimestamp + DISPUTE_PERIOD, "Dispute period ended"); require(IERC20(susdToken).transferFrom(msg.sender, address(this), disputeBondAmount), "Bond transfer failed"); disputeBonds[msg.sender] = disputeBondAmount; disputeVotes[proposedOutcome] += disputeBondAmount; totalVotes += disputeBondAmount; hasVoted[msg.sender] = true; if (disputeVotes[proposedOutcome] > disputeVotes[mostVotedOutcome]) { mostVotedOutcome = proposedOutcome; } emit DisputeSubmitted(msg.sender, proposedOutcome, disputeBondAmount); emit VoteCast(msg.sender, proposedOutcome); } function finalizeDispute() external nonReentrant { require(!resolved, "Market already resolved"); require(block.timestamp > resolutionTimestamp + DISPUTE_PERIOD, "Dispute period not ended"); require(totalVotes > 0, "No disputes submitted"); winningOutcome = mostVotedOutcome; resolved = true; emit MarketResolved(mostVotedOutcome); } function claimDisputeBond() external nonReentrant { require(resolved, "Market not resolved"); require(disputeBonds[msg.sender] > 0, "No bond to claim"); require(block.timestamp > resolutionTimestamp + DISPUTE_PERIOD, "Dispute period not ended"); uint256 bondAmount = disputeBonds[msg.sender]; disputeBonds[msg.sender] = 0; // If voted for winning outcome, get reward from losing votes if (hasVoted[msg.sender]) { uint256 shareOfWinningVotes = (bondAmount * 1e18) / disputeVotes[winningOutcome]; bondAmount += (totalVotes - disputeVotes[winningOutcome]) * shareOfWinningVotes / 1e18; } require(IERC20(susdToken).transfer(msg.sender, bondAmount), "Bond return failed"); } // Emergency resolution if reporter never resolves function emergencyResolve() external { require(!resolved, "Market already resolved"); require(block.timestamp > reporterResolutionDeadline, "Reporter deadline not passed"); // If disputes exist, use most voted outcome uint256 finalOutcome = totalVotes > 0 ? mostVotedOutcome : 0; resolved = true; winningOutcome = finalOutcome; emit EmergencyResolution(finalOutcome, msg.sender); emit MarketResolved(finalOutcome); } // Allow governor to set a new reporter deadline function setReporterDeadline(uint256 newDeadline) external onlyGovernor { require(newDeadline > block.timestamp, "Deadline must be in future"); reporterResolutionDeadline = newDeadline; emit ReporterDeadlineSet(newDeadline); } function verifyInitialization( string[] calldata _outcomes, uint256 _resolutionDelay, address _reporter, address _governor ) external view returns (bool) { // Verify that initialization parameters match if (_outcomes.length != outcomes.length) return false; if (_reporter != reporter) return false; if (_governor != governor) return false; if (_resolutionDelay != resolutionDelay) return false; // Verify outcomes match for (uint256 i = 0; i < _outcomes.length; i++) { if (keccak256(bytes(_outcomes[i])) != keccak256(bytes(outcomes[i]))) { return false; } } return true; } // View functions function getMarketInfo() external view returns ( string[] memory, uint256[] memory, uint256, bool, uint256 ) { uint256[] memory shares = getCurrentShares(); return (outcomes, shares, b, resolved, winningOutcome); } function getResolutionDelay() external view returns (uint256) { return resolutionDelay; } function getProposedOutcome() external view returns (uint256) { return winningOutcome; } function getResolutionTimestamp() external view returns (uint256) { return resolutionTimestamp; } function getReporter() external view returns (address) { return reporter; } function getGovernor() external view returns (address) { return governor; } function getAIAddress() external view returns (address) { return address(this); } function getTradingFee() external view returns (uint256) { return tradingFee; } // Pause/unpause functions function pause() external onlyOwner { _pause(); } function unpause() external onlyOwner { _unpause(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Ownable struct OwnableStorage { address _owner; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300; function _getOwnableStorage() private pure returns (OwnableStorage storage $) { assembly { $.slot := OwnableStorageLocation } } /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ function __Ownable_init(address initialOwner) internal onlyInitializing { __Ownable_init_unchained(initialOwner); } function __Ownable_init_unchained(address initialOwner) internal onlyInitializing { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { OwnableStorage storage $ = _getOwnableStorage(); return $._owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { OwnableStorage storage $ = _getOwnableStorage(); address oldOwner = $._owner; $._owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._initialized = 1; if (isTopLevelCall) { $._initializing = true; } _; if (isTopLevelCall) { $._initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._initialized = version; $._initializing = true; _; $._initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.2.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.22; import {IERC1822Proxiable} from "@openzeppelin/contracts/interfaces/draft-IERC1822.sol"; import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol"; import {Initializable} from "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. */ abstract contract UUPSUpgradeable is Initializable, IERC1822Proxiable { /// @custom:oz-upgrades-unsafe-allow state-variable-immutable address private immutable __self = address(this); /** * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)` * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called, * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string. * If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function * during an upgrade. */ string public constant UPGRADE_INTERFACE_VERSION = "5.0.0"; /** * @dev The call is from an unauthorized context. */ error UUPSUnauthorizedCallContext(); /** * @dev The storage `slot` is unsupported as a UUID. */ error UUPSUnsupportedProxiableUUID(bytes32 slot); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC-1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC-1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { _checkProxy(); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { _checkNotDelegated(); _; } function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /** * @dev Implementation of the ERC-1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual notDelegated returns (bytes32) { return ERC1967Utils.IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. * * @custom:oz-upgrades-unsafe-allow-reachable delegatecall */ function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data); } /** * @dev Reverts if the execution is not performed via delegatecall or the execution * context is not of a proxy with an ERC-1967 compliant implementation pointing to self. * See {_onlyProxy}. */ function _checkProxy() internal view virtual { if ( address(this) == __self || // Must be called through delegatecall ERC1967Utils.getImplementation() != __self // Must be called through an active proxy ) { revert UUPSUnauthorizedCallContext(); } } /** * @dev Reverts if the execution is performed via delegatecall. * See {notDelegated}. */ function _checkNotDelegated() internal view virtual { if (address(this) != __self) { // Must not be called through delegatecall revert UUPSUnauthorizedCallContext(); } } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call. * * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value * is expected to be the implementation slot in ERC-1967. * * Emits an {IERC1967-Upgraded} event. */ function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private { try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) { revert UUPSUnsupportedProxiableUUID(slot); } ERC1967Utils.upgradeToAndCall(newImplementation, data); } catch { // The implementation is not UUPS revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol) pragma solidity ^0.8.20; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.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 PausableUpgradeable is Initializable, ContextUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Pausable struct PausableStorage { bool _paused; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Pausable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300; function _getPausableStorage() private pure returns (PausableStorage storage $) { assembly { $.slot := PausableStorageLocation } } /** * @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); /** * @dev The operation failed because the contract is paused. */ error EnforcedPause(); /** * @dev The operation failed because the contract is not paused. */ error ExpectedPause(); /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { PausableStorage storage $ = _getPausableStorage(); $._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) { PausableStorage storage $ = _getPausableStorage(); return $._paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { if (paused()) { revert EnforcedPause(); } } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { if (!paused()) { revert ExpectedPause(); } } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { PausableStorage storage $ = _getPausableStorage(); $._paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { PausableStorage storage $ = _getPausableStorage(); $._paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at, * consider using {ReentrancyGuardTransient} instead. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; /// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard struct ReentrancyGuardStorage { uint256 _status; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00; function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) { assembly { $.slot := ReentrancyGuardStorageLocation } } /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); $._status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // On the first call to nonReentrant, _status will be NOT_ENTERED if ($._status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail $._status = ENTERED; } function _nonReentrantAfter() private { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) $._status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); return $._status == ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.20; /** * @dev ERC-1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822Proxiable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1967.sol) pragma solidity ^0.8.20; /** * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC. */ interface IERC1967 { /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Emitted when the beacon is changed. */ event BeaconUpgraded(address indexed beacon); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.20; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {UpgradeableBeacon} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.2.0) (proxy/ERC1967/ERC1967Utils.sol) pragma solidity ^0.8.22; import {IBeacon} from "../beacon/IBeacon.sol"; import {IERC1967} from "../../interfaces/IERC1967.sol"; import {Address} from "../../utils/Address.sol"; import {StorageSlot} from "../../utils/StorageSlot.sol"; /** * @dev This library provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[ERC-1967] slots. */ library ERC1967Utils { /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev The `implementation` of the proxy is invalid. */ error ERC1967InvalidImplementation(address implementation); /** * @dev The `admin` of the proxy is invalid. */ error ERC1967InvalidAdmin(address admin); /** * @dev The `beacon` of the proxy is invalid. */ error ERC1967InvalidBeacon(address beacon); /** * @dev An upgrade function sees `msg.value > 0` that may be lost. */ error ERC1967NonPayable(); /** * @dev Returns the current implementation address. */ function getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the ERC-1967 implementation slot. */ function _setImplementation(address newImplementation) private { if (newImplementation.code.length == 0) { revert ERC1967InvalidImplementation(newImplementation); } StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Performs implementation upgrade with additional setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) internal { _setImplementation(newImplementation); emit IERC1967.Upgraded(newImplementation); if (data.length > 0) { Address.functionDelegateCall(newImplementation, data); } else { _checkNonPayable(); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Returns the current admin. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by ERC-1967) using * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` */ function getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(ADMIN_SLOT).value; } /** * @dev Stores a new address in the ERC-1967 admin slot. */ function _setAdmin(address newAdmin) private { if (newAdmin == address(0)) { revert ERC1967InvalidAdmin(address(0)); } StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {IERC1967-AdminChanged} event. */ function changeAdmin(address newAdmin) internal { emit IERC1967.AdminChanged(getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Returns the current beacon. */ function getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(BEACON_SLOT).value; } /** * @dev Stores a new beacon in the ERC-1967 beacon slot. */ function _setBeacon(address newBeacon) private { if (newBeacon.code.length == 0) { revert ERC1967InvalidBeacon(newBeacon); } StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon; address beaconImplementation = IBeacon(newBeacon).implementation(); if (beaconImplementation.code.length == 0) { revert ERC1967InvalidImplementation(beaconImplementation); } } /** * @dev Change the beacon and trigger a setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-BeaconUpgraded} event. * * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for * efficiency. */ function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal { _setBeacon(newBeacon); emit IERC1967.BeaconUpgraded(newBeacon); if (data.length > 0) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } else { _checkNonPayable(); } } /** * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract * if an upgrade doesn't perform an initialization call. */ function _checkNonPayable() private { if (msg.value > 0) { revert ERC1967NonPayable(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-20 standard as defined in the ERC. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.2.0) (utils/Address.sol) pragma solidity ^0.8.20; import {Errors} from "./Errors.sol"; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert Errors.InsufficientBalance(address(this).balance, amount); } (bool success, bytes memory returndata) = recipient.call{value: amount}(""); if (!success) { _revert(returndata); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {Errors.FailedCall} error. * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert Errors.InsufficientBalance(address(this).balance, value); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case * of an unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {Errors.FailedCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly ("memory-safe") { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert Errors.FailedCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol) pragma solidity ^0.8.20; /** * @dev Collection of common custom errors used in multiple contracts * * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library. * It is recommended to avoid relying on the error API for critical functionality. * * _Available since v5.1._ */ library Errors { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error InsufficientBalance(uint256 balance, uint256 needed); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedCall(); /** * @dev The deployment failed. */ error FailedDeployment(); /** * @dev A necessary precompile is missing. */ error MissingPrecompile(address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.20; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC-1967 implementation slot: * ```solidity * contract ERC1967 { * // Define the slot. Alternatively, use the SlotDerivation library to derive the slot. * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(newImplementation.code.length > 0); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * TIP: Consider using this library along with {SlotDerivation}. */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct Int256Slot { int256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly ("memory-safe") { r.slot := slot } } /** * @dev Returns a `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly ("memory-safe") { r.slot := slot } } /** * @dev Returns a `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly ("memory-safe") { r.slot := slot } } /** * @dev Returns a `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly ("memory-safe") { r.slot := slot } } /** * @dev Returns a `Int256Slot` with member `value` located at `slot`. */ function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) { assembly ("memory-safe") { r.slot := slot } } /** * @dev Returns a `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { assembly ("memory-safe") { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { assembly ("memory-safe") { r.slot := store.slot } } /** * @dev Returns a `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { assembly ("memory-safe") { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { assembly ("memory-safe") { r.slot := store.slot } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; library LMSRMath { // Fixed point precision uint256 constant FIXED_ONE = 1e18; // Maximum value for exponentiation to avoid overflow uint256 constant MAX_EXPONENT = 100e18; function calcCost( uint256[] memory outcomeShares, int256[] memory shareDeltas, uint256 b ) internal pure returns (int256) { require(outcomeShares.length == shareDeltas.length, "Array length mismatch"); require(outcomeShares.length > 0, "Empty arrays"); require(b > 0, "Invalid liquidity parameter"); // Calculate cost before trade uint256 costBefore = calcCostFromShares(outcomeShares, b); // Calculate new outcome shares after trade uint256[] memory newShares = new uint256[](outcomeShares.length); for (uint256 i = 0; i < outcomeShares.length; i++) { if (shareDeltas[i] >= 0) { newShares[i] = outcomeShares[i] + uint256(shareDeltas[i]); } else { require(outcomeShares[i] >= uint256(-shareDeltas[i]), "Insufficient shares"); newShares[i] = outcomeShares[i] - uint256(-shareDeltas[i]); } } // Calculate cost after trade uint256 costAfter = calcCostFromShares(newShares, b); // Return difference in costs if (costAfter >= costBefore) { return int256(costAfter - costBefore); } else { return -int256(costBefore - costAfter); } } function calcCostFromShares( uint256[] memory shares, uint256 b ) internal pure returns (uint256) { uint256 sum = 0; // Calculate sum of exp(q_i/b) for all outcomes for (uint256 i = 0; i < shares.length; i++) { // Normalize shares by dividing by b uint256 normalizedShares = (shares[i] * FIXED_ONE) / b; // Prevent overflow by capping the exponent if (normalizedShares > MAX_EXPONENT) { normalizedShares = MAX_EXPONENT; } // Calculate exp(q_i/b) and add to sum sum += exp(normalizedShares); } // Calculate b * ln(sum) return (b * ln(sum)) / FIXED_ONE; } function calcMarginalPrice( uint256 outcomeIndex, uint256[] memory shares, uint256 b ) internal pure returns (uint256) { require(outcomeIndex < shares.length, "Invalid outcome index"); // Calculate sum of exp(q_i/b) for all outcomes uint256 sum = 0; for (uint256 i = 0; i < shares.length; i++) { uint256 normalizedShares = (shares[i] * FIXED_ONE) / b; if (normalizedShares > MAX_EXPONENT) { normalizedShares = MAX_EXPONENT; } sum += exp(normalizedShares); } // Calculate exp(q_i/b) for the specific outcome uint256 normalizedOutcomeShares = (shares[outcomeIndex] * FIXED_ONE) / b; if (normalizedOutcomeShares > MAX_EXPONENT) { normalizedOutcomeShares = MAX_EXPONENT; } uint256 outcomeExp = exp(normalizedOutcomeShares); // Calculate price = exp(q_i/b) / sum(exp(q_j/b)) return (outcomeExp * FIXED_ONE) / sum; } function exp(uint256 x) internal pure returns (uint256) { // If x is 0, e^0 = 1 if (x == 0) return FIXED_ONE; // If x is very large, return maximum value to avoid overflow if (x > MAX_EXPONENT) return type(uint256).max; // Taylor series approximation for e^x // e^x = 1 + x + x^2/2! + x^3/3! + ... + x^n/n! uint256 result = FIXED_ONE; // 1 uint256 term = FIXED_ONE; // Start with 1 // Add x term = (term * x) / FIXED_ONE; result += term; // Add x^2/2! term = (term * x) / (2 * FIXED_ONE); result += term; // Add x^3/3! term = (term * x) / (3 * FIXED_ONE); result += term; // Add x^4/4! term = (term * x) / (4 * FIXED_ONE); result += term; // Add x^5/5! term = (term * x) / (5 * FIXED_ONE); result += term; // Add x^6/6! term = (term * x) / (6 * FIXED_ONE); result += term; // Add x^7/7! term = (term * x) / (7 * FIXED_ONE); result += term; // Add x^8/8! term = (term * x) / (8 * FIXED_ONE); result += term; return result; } function ln(uint256 x) internal pure returns (uint256) { // If x is 0 or very small, return a very negative number // In practice, this should never happen in LMSR if (x < FIXED_ONE / 1000) { return 0; // Should revert in practice } // If x is 1, ln(1) = 0 if (x == FIXED_ONE) return 0; // If x < 1, use ln(x) = -ln(1/x) if (x < FIXED_ONE) { return type(uint256).max - ln((FIXED_ONE * FIXED_ONE) / x) + 1; } // For x > 1, use binary search to find y such that e^y = x uint256 low = 0; uint256 high = MAX_EXPONENT; uint256 mid; uint256 midExp; // Binary search for 32 iterations (sufficient precision) for (uint256 i = 0; i < 32; i++) { mid = (low + high) / 2; midExp = exp(mid); if (midExp < x) { low = mid; } else if (midExp > x) { high = mid; } else { return mid; // Exact match found } } // Return the closest approximation return (low + high) / 2; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"}],"name":"ERC1967InvalidImplementation","type":"error"},{"inputs":[],"name":"ERC1967NonPayable","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"FailedCall","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"UUPSUnauthorizedCallContext","type":"error"},{"inputs":[{"internalType":"bytes32","name":"slot","type":"bytes32"}],"name":"UUPSUnsupportedProxiableUUID","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"disputer","type":"address"},{"indexed":true,"internalType":"uint256","name":"proposedOutcome","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"bondAmount","type":"uint256"}],"name":"DisputeSubmitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"outcome","type":"uint256"},{"indexed":false,"internalType":"address","name":"resolver","type":"address"}],"name":"EmergencyResolution","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"outcome","type":"uint256"}],"name":"MarketResolved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Payout","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"ReporterDeadlineSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"outcome","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"resolutionTimestamp","type":"uint256"}],"name":"ResolutionProposed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"int256[]","name":"amounts","type":"int256[]"},{"indexed":false,"internalType":"uint256[]","name":"shareBalances","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"feesPaid","type":"uint256"}],"name":"Trade","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"TradingFeeSet","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":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"voter","type":"address"},{"indexed":true,"internalType":"uint256","name":"outcome","type":"uint256"}],"name":"VoteCast","type":"event"},{"inputs":[],"name":"DISPUTE_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_TRADE_PERCENTAGE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADE_INTERFACE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"b","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimDisputeBond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"disputeBondAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"disputeBonds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"disputeVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyResolve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"finalizeDispute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"funding","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAIAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int256[]","name":"shareDeltas","type":"int256[]"}],"name":"getCost","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentShares","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGovernor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"outcomeIndex","type":"uint256"}],"name":"getMarginalPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMarketInfo","outputs":[{"internalType":"string[]","name":"","type":"string[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int256[]","name":"shareDeltas","type":"int256[]"}],"name":"getNetCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getProposedOutcome","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReporter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getResolutionDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getResolutionTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTradingFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"hasVoted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"string[]","name":"outcomes","type":"string[]"},{"internalType":"address","name":"feeRecipient","type":"address"},{"internalType":"uint256","name":"resolutionDelay","type":"uint256"},{"internalType":"address","name":"reporter","type":"address"},{"internalType":"address","name":"governor","type":"address"},{"internalType":"uint256","name":"b","type":"uint256"},{"internalType":"uint256","name":"tradingFee","type":"uint256"},{"internalType":"address","name":"susdToken","type":"address"},{"internalType":"uint256","name":"disputeBondAmount","type":"uint256"}],"internalType":"struct Market.MarketInitParams","name":"params","type":"tuple"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mostVotedOutcome","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"outcomeShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"outcomes","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"outcome","type":"uint256"}],"name":"overrideResolution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"payout","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reporter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reporterResolutionDeadline","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"resolutionDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"resolutionTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"outcome","type":"uint256"}],"name":"resolveMarket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resolved","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newDeadline","type":"uint256"}],"name":"setReporterDeadline","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposedOutcome","type":"uint256"}],"name":"submitDispute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"susdToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalFunding","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int256[]","name":"shareDeltas","type":"int256[]"},{"internalType":"uint256","name":"maxCost","type":"uint256"}],"name":"trade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tradingFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string[]","name":"_outcomes","type":"string[]"},{"internalType":"uint256","name":"_resolutionDelay","type":"uint256"},{"internalType":"address","name":"_reporter","type":"address"},{"internalType":"address","name":"_governor","type":"address"}],"name":"verifyInitialization","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"winningOutcome","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60a0604052306080523480156200001557600080fd5b506200002062000026565b620000da565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff1615620000775760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b0390811614620000d75780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b608051613f796200010460003960008181612a0901528181612a320152612b730152613f796000f3fe6080604052600436106103765760003560e01c80638948261d116101d1578063c45a015511610102578063e53dc680116100a0578063eed2a1471161006f578063eed2a147146109cb578063f2fde38b146109eb578063f39690e414610a0b578063fe47a8a714610a2b57600080fd5b8063e53dc68014610954578063e62ff3eb1461098c578063ead1df17146109a1578063ec77537b146109b657600080fd5b8063d8ca24c1116100dc578063d8ca24c1146108d1578063d92f0810146108f1578063deb8d27814610911578063e2ae55241461092757600080fd5b8063c45a01551461087b578063cb4c86b71461089b578063d3967a6b146108b157600080fd5b8063a5bbe22b1161016f578063b2e017c711610149578063b2e017c714610810578063b79c41bc14610830578063bee4f74614610850578063c13ebbe61461086557600080fd5b8063a5bbe22b1461079d578063ad3cb1cc146107b4578063ad9914f8146107f257600080fd5b806397f03f1c116101ab57806397f03f1c1461072e5780639b34ae03146107445780639da0ae3e1461075a578063a0cd65521461078757600080fd5b80638948261d146106bc5780638da5cb5b146106de5780639236260b1461071b57600080fd5b80634f1ef286116102ab5780636399d03d11610249578063715018a611610223578063715018a61461065c5780638456cb591461067157806385af5d3514610686578063882636cb1461069c57600080fd5b80636399d03d1461061257806363bd1d4a1461063257806370aa26871461064757600080fd5b806356f433521161028557806356f433521461058a5780635a0e8290146105a05780635c975abb146105cd5780635fae6371146105f257600080fd5b80634f1ef286146105445780634fc07d751461055757806352d1902d1461057557600080fd5b806323341a05116103185780633f6fa655116102f25780633f6fa655146104d45780634020dffc146104ee578063469048401461050e5780634df7e3d01461052e57600080fd5b806323341a05146104795780632d844c491461049f5780633f4ba83a146104bf57600080fd5b80630c340a24116103545780630c340a24146104175780630d15fd77146104375780630ff352f51461044d5780631bd8db031461046457600080fd5b8063010ec4411461037b57806304f09b4a146103b857806309eef43e146103d7575b600080fd5b34801561038757600080fd5b5060025461039b906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156103c457600080fd5b50600b545b6040519081526020016103af565b3480156103e357600080fd5b506104076103f2366004613626565b60146020526000908152604090205460ff1681565b60405190151581526020016103af565b34801561042357600080fd5b5060035461039b906001600160a01b031681565b34801561044357600080fd5b506103c960135481565b34801561045957600080fd5b50610462610a41565b005b34801561047057600080fd5b50600f546103c9565b34801561048557600080fd5b5061048e610b4d565b6040516103af9594939291906136cd565b3480156104ab57600080fd5b506103c96104ba366004613762565b610c5e565b3480156104cb57600080fd5b50610462610cca565b3480156104e057600080fd5b50600a546104079060ff1681565b3480156104fa57600080fd5b50610462610509366004613762565b610cdc565b34801561051a57600080fd5b5060015461039b906001600160a01b031681565b34801561053a57600080fd5b506103c960055481565b6104626105523660046137c1565b610d91565b34801561056357600080fd5b506003546001600160a01b031661039b565b34801561058157600080fd5b506103c9610db0565b34801561059657600080fd5b506103c9600f5481565b3480156105ac57600080fd5b506103c96105bb366004613626565b60156020526000908152604090205481565b3480156105d957600080fd5b50600080516020613f048339815191525460ff16610407565b3480156105fe57600080fd5b506103c961060d366004613866565b610dcd565b34801561061e57600080fd5b5061046261062d366004613762565b610e1d565b34801561063e57600080fd5b50610462610f50565b34801561065357600080fd5b506006546103c9565b34801561066857600080fd5b5061046261112a565b34801561067d57600080fd5b5061046261113c565b34801561069257600080fd5b506103c9600c5481565b3480156106a857600080fd5b506103c96106b7366004613866565b61114c565b3480156106c857600080fd5b506106d16111b1565b6040516103af919061390b565b3480156106ea57600080fd5b507f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031661039b565b34801561072757600080fd5b503061039b565b34801561073a57600080fd5b506103c960165481565b34801561075057600080fd5b506103c9600b5481565b34801561076657600080fd5b506103c9610775366004613762565b60116020526000908152604090205481565b34801561079357600080fd5b506103c960065481565b3480156107a957600080fd5b506103c96203f48081565b3480156107c057600080fd5b506107e5604051806040016040528060058152602001640352e302e360dc1b81525081565b6040516103af919061391e565b3480156107fe57600080fd5b506002546001600160a01b031661039b565b34801561081c57600080fd5b5061046261082b36600461397c565b611246565b34801561083c57600080fd5b5061046261084b3660046139c7565b611996565b34801561085c57600080fd5b506103c9601481565b34801561087157600080fd5b506103c960105481565b34801561088757600080fd5b5060005461039b906001600160a01b031681565b3480156108a757600080fd5b506103c9600e5481565b3480156108bd57600080fd5b506104626108cc366004613762565b611eaf565b3480156108dd57600080fd5b506104076108ec366004613a02565b61217d565b3480156108fd57600080fd5b5061046261090c366004613762565b612279565b34801561091d57600080fd5b506103c960125481565b34801561093357600080fd5b506103c9610942366004613762565b60086020526000908152604090205481565b34801561096057600080fd5b506103c961096f366004613a6f565b600960209081526000928352604080842090915290825290205481565b34801561099857600080fd5b50600c546103c9565b3480156109ad57600080fd5b50610462612373565b3480156109c257600080fd5b506104626125e1565b3480156109d757600080fd5b506107e56109e6366004613762565b612705565b3480156109f757600080fd5b50610462610a06366004613626565b6127b1565b348015610a1757600080fd5b5060045461039b906001600160a01b031681565b348015610a3757600080fd5b506103c9600d5481565b600a5460ff1615610a6d5760405162461bcd60e51b8152600401610a6490613a99565b60405180910390fd5b6010544211610abe5760405162461bcd60e51b815260206004820152601c60248201527f5265706f7274657220646561646c696e65206e6f7420706173736564000000006044820152606401610a64565b60008060135411610ad0576000610ad4565b6012545b600a805460ff19166001179055600b81905560405133815290915081907fe4d6efcb12aa89dc35692182a18a22bcfd2c5d86dd221420209b7287daab0888906020015b60405180910390a260405181907f93608ecbcf057462da63f5aef413ce7f78c5e1b3bb51859d77a40845ece2bfc390600090a250565b606080600080600080610b5e6111b1565b9050600781600554600a60009054906101000a900460ff16600b5484805480602002602001604051908101604052809291908181526020016000905b82821015610c46578382906000526020600020018054610bb990613ad0565b80601f0160208091040260200160405190810160405280929190818152602001828054610be590613ad0565b8015610c325780601f10610c0757610100808354040283529160200191610c32565b820191906000526020600020905b815481529060010190602001808311610c1557829003601f168201915b505050505081526020019060010190610b9a565b50505050945095509550955095509550509091929394565b6007546000908210610caa5760405162461bcd60e51b8152602060048201526015602482015274092dcecc2d8d2c840deeae8c6dedaca40d2dcc8caf605b1b6044820152606401610a64565b6000610cb46111b1565b9050610cc383826005546127ec565b9392505050565b610cd2612949565b610cda6129a4565b565b6003546001600160a01b03163314610d065760405162461bcd60e51b8152600401610a6490613b04565b428111610d555760405162461bcd60e51b815260206004820152601a60248201527f446561646c696e65206d75737420626520696e206675747572650000000000006044820152606401610a64565b60108190556040518181527fb78308b2eb98fa00faea36698f56c2389c9bd7c8e76f7c0f7725e33135d48092906020015b60405180910390a150565b610d996129fe565b610da282612aa3565b610dac8282612aab565b5050565b6000610dba612b68565b50600080516020613ee483398151915290565b600080610dd98361114c565b905060008113610dec5750600092915050565b6000612710600f5483610dff9190613b5e565b610e099190613b75565b9050610e158183613b97565b949350505050565b6002546001600160a01b03163314610e835760405162461bcd60e51b8152602060048201526024808201527f4f6e6c79207265706f727465722063616e2063616c6c20746869732066756e636044820152633a34b7b760e11b6064820152608401610a64565b600a5460ff1615610ea65760405162461bcd60e51b8152600401610a6490613a99565b601054421015610ee45760405162461bcd60e51b8152602060048201526009602482015268546f6f206561726c7960b81b6044820152606401610a64565b6007548110610f055760405162461bcd60e51b8152600401610a6490613baa565b600b81905542600c819055600a805460ff1916600117905560405182917fffac1500e5679b3ff6518aa340b377b1b544ffde8e2e1f3a786f8b1fe9f140de91610b1791815260200190565b610f58612bb1565b600a5460ff16610fa05760405162461bcd60e51b815260206004820152601360248201527213585c9ad95d081b9bdd081c995cdbdb1d9959606a1b6044820152606401610a64565b336000908152600960209081526040808320600b54845290915290205480610ffe5760405162461bcd60e51b81526020600482015260116024820152704e6f2077696e6e696e672073686172657360781b6044820152606401610a64565b336000818152600960209081526040808320600b5484529091528082209190915560048054915163a9059cbb60e01b8152908101929092526024820183905282916001600160a01b039091169063a9059cbb906044016020604051808303816000875af1158015611073573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110979190613bd3565b6110dc5760405162461bcd60e51b815260206004820152601660248201527514185e5bdd5d081d1c985b9cd9995c8819985a5b195960521b6044820152606401610a64565b60405181815233907f5afeca38b2064c23a692c4cf353015d80ab3ecc417b4f893f372690c11fbd9a69060200160405180910390a25050610cda6001600080516020613f2483398151915255565b611132612949565b610cda6000612bfd565b611144612949565b610cda612c6e565b6007548151600091146111985760405162461bcd60e51b8152602060048201526014602482015273092dcecc2d8d2c840c2e4e4c2f240d8cadccee8d60631b6044820152606401610a64565b60006111a26111b1565b9050610cc38184600554612cb7565b6007546060906000906001600160401b038111156111d1576111d161377b565b6040519080825280602002602001820160405280156111fa578160200160208202803683370190505b50905060005b60075481101561124057600081815260086020526040902054825183908390811061122d5761122d613bf5565b6020908102919091010152600101611200565b50919050565b61124e612bb1565b611256612fa1565b600a5460ff16156112795760405162461bcd60e51b8152600401610a6490613a99565b60075482146112c15760405162461bcd60e51b8152602060048201526014602482015273092dcecc2d8d2c840c2e4e4c2f240d8cadccee8d60631b6044820152606401610a64565b60006112cb6111b1565b905060005b838110156114385760008585838181106112ec576112ec613bf5565b90506020020135131561138e576064601483838151811061130f5761130f613bf5565b60200260200101516113219190613b5e565b61132b9190613b75565b85858381811061133d5761133d613bf5565b9050602002013511156113895760405162461bcd60e51b815260206004820152601460248201527354726164652073697a6520746f6f206c6172676560601b6044820152606401610a64565b611430565b60008585838181106113a2576113a2613bf5565b905060200201351215611430573360009081526009602090815260408083208484529091529020548585838181106113dc576113dc613bf5565b905060200201356113ec90613c0b565b11156114305760405162461bcd60e51b8152602060048201526013602482015272496e73756666696369656e742073686172657360681b6044820152606401610a64565b6001016112d0565b50600061147785858080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061114c92505050565b905060008060008313156114f257612710600f54846114969190613b5e565b6114a09190613b75565b91506114ac8284613b97565b9050848111156114f25760405162461bcd60e51b815260206004820152601160248201527014db1a5c1c1859d948195e18d959591959607a1b6044820152606401610a64565b60005b8681101561167057600088888381811061151157611511613bf5565b9050602002013513156115af5787878281811061153057611530613bf5565b905060200201356008600083815260200190815260200160002060008282546115599190613b97565b90915550889050878281811061157157611571613bf5565b336000908152600960209081526040808320878452825282208054939091029490940135939250906115a4908490613b97565b909155506116689050565b60008888838181106115c3576115c3613bf5565b905060200201351215611668578787828181106115e2576115e2613bf5565b905060200201356115f290613c0b565b60008281526008602052604081208054909190611610908490613c27565b90915550889050878281811061162857611628613bf5565b9050602002013561163890613c0b565b33600090815260096020908152604080832085845290915281208054909190611662908490613c27565b90915550505b6001016114f5565b5060008313156116b35782600e600082825461168c9190613b97565b9091555061169c90508284613b97565b600d60008282546116ad9190613b97565b90915550505b600083131561184a57600480546040516323b872dd60e01b81523392810192909252306024830152604482018590526001600160a01b0316906323b872dd906064016020604051808303816000875af1158015611714573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117389190613bd3565b61177c5760405162461bcd60e51b8152602060048201526015602482015274151c985919481d1c985b9cd9995c8819985a5b1959605a1b6044820152606401610a64565b811561184557600480546001546040516323b872dd60e01b815233938101939093526001600160a01b0390811660248401526044830185905216906323b872dd906064016020604051808303816000875af11580156117df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118039190613bd3565b6118455760405162461bcd60e51b8152602060048201526013602482015272119959481d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610a64565b611922565b6000831215611922576004546001600160a01b031663a9059cbb3361186e86613c0b565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156118b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118dd9190613bd3565b6119225760405162461bcd60e51b815260206004820152601660248201527514185e5bdd5d081d1c985b9cd9995c8819985a5b195960521b6044820152606401610a64565b600061192c6111b1565b9050336001600160a01b03167f3b55ce5afbfa91d536b2a2394b85b42d8abc5fb48daa07088154bb0bc5fa6c008989848760405161196d9493929190613c3a565b60405180910390a250505050506119916001600080516020613f2483398151915255565b505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03166000811580156119db5750825b90506000826001600160401b031660011480156119f75750303b155b905081158015611a05575080155b15611a235760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315611a4d57845460ff60401b1916600160401b1785555b611a55612fd2565b611a5d612fe2565b611a75611a7060a0880160808901613626565b612ff2565b611a7d613003565b6002611a898780613c91565b90501015611ad95760405162461bcd60e51b815260206004820152601d60248201527f4d7573742068617665206174206c656173742032206f7574636f6d65730000006044820152606401610a64565b6000611aeb6040880160208901613626565b6001600160a01b031603611b395760405162461bcd60e51b8152602060048201526015602482015274125b9d985b1a5908199959481c9958da5c1a595b9d605a1b6044820152606401610a64565b6000611b4b6080880160608901613626565b6001600160a01b031603611b945760405162461bcd60e51b815260206004820152601060248201526f24b73b30b634b2103932b837b93a32b960811b6044820152606401610a64565b6000611ba660a0880160808901613626565b6001600160a01b031603611bef5760405162461bcd60e51b815260206004820152601060248201526f24b73b30b634b21033b7bb32b93737b960811b6044820152606401610a64565b6000611c02610100880160e08901613626565b6001600160a01b031603611c4d5760405162461bcd60e51b815260206004820152601260248201527124b73b30b634b21029aaa9a2103a37b5b2b760711b6044820152606401610a64565b60008660a0013511611ca15760405162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c697175696469747920706172616d6574657200000000006044820152606401610a64565b600080546001600160a01b03191633179055611cc36040870160208801613626565b600180546001600160a01b0319166001600160a01b0392909216919091179055611cf36080870160608801613626565b600280546001600160a01b0319166001600160a01b0392909216919091179055611d2360a0870160808801613626565b600380546001600160a01b0319166001600160a01b0392909216919091179055611d54610100870160e08801613626565b600480546001600160a01b0319166001600160a01b039290921691909117905560a0860135600555604086013560065560c0860135600f5561010086013560165560005b611da28780613c91565b9050811015611e1b576007611db78880613c91565b83818110611dc757611dc7613bf5565b9050602002810190611dd99190613cda565b82546001810184556000938452602090932090920191611df99183613d68565b506000818152600860205260409020670de0b6b3a76400009055600101611d98565b50611e294262278d00613b97565b60108190556040519081527fb78308b2eb98fa00faea36698f56c2389c9bd7c8e76f7c0f7725e33135d480929060200160405180910390a18315611ea757845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050565b611eb7612bb1565b600a5460ff1615611eda5760405162461bcd60e51b8152600401610a6490613a99565b6007548110611efb5760405162461bcd60e51b8152600401610a6490613baa565b3360009081526014602052604090205460ff1615611f4b5760405162461bcd60e51b815260206004820152600d60248201526c105b1c9958591e481d9bdd1959609a1b6044820152606401610a64565b6203f480600c54611f5c9190613b97565b421115611fa25760405162461bcd60e51b8152602060048201526014602482015273111a5cdc1d5d19481c195c9a5bd908195b99195960621b6044820152606401610a64565b600480546016546040516323b872dd60e01b8152339381019390935230602484015260448301526001600160a01b0316906323b872dd906064016020604051808303816000875af1158015611ffb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061201f9190613bd3565b6120625760405162461bcd60e51b8152602060048201526014602482015273109bdb99081d1c985b9cd9995c8819985a5b195960621b6044820152606401610a64565b601654336000908152601560209081526040808320849055848352601190915281208054909190612094908490613b97565b9091555050601654601380546000906120ae908490613b97565b9091555050336000908152601460209081526040808320805460ff19166001179055601254835260119091528082205483835291205411156120f05760128190555b80336001600160a01b03167fde5c01453f40d10a9cdeaaa7f2b644609198dabb4cf1d17a1496d1d506e2346d60165460405161212e91815260200190565b60405180910390a3604051819033907fa36cc2bebb74db33e9f88110a07ef56e1b31b24b4c4f51b54b1664266e29f45b90600090a361217a6001600080516020613f2483398151915255565b50565b600754600090851461219157506000612270565b6002546001600160a01b038481169116146121ae57506000612270565b6003546001600160a01b038381169116146121cb57506000612270565b60065484146121dc57506000612270565b60005b8581101561226a57600781815481106121fa576121fa613bf5565b906000526020600020016040516122119190613e28565b604051809103902087878381811061222b5761222b613bf5565b905060200281019061223d9190613cda565b60405161224b929190613e9e565b604051809103902014612262576000915050612270565b6001016121df565b50600190505b95945050505050565b6003546001600160a01b031633146122a35760405162461bcd60e51b8152600401610a6490613b04565b600a5460ff16156122c65760405162461bcd60e51b8152600401610a6490613a99565b600c54421061230e5760405162461bcd60e51b8152602060048201526014602482015273111a5cdc1d5d19481c195c9a5bd908195b99195960621b6044820152606401610a64565b600754811061232f5760405162461bcd60e51b8152600401610a6490613baa565b600a805460ff19166001179055600b8190556000600c81905560405182917f93608ecbcf057462da63f5aef413ce7f78c5e1b3bb51859d77a40845ece2bfc391a250565b61237b612bb1565b600a5460ff166123c35760405162461bcd60e51b815260206004820152601360248201527213585c9ad95d081b9bdd081c995cdbdb1d9959606a1b6044820152606401610a64565b336000908152601560205260409020546124125760405162461bcd60e51b815260206004820152601060248201526f4e6f20626f6e6420746f20636c61696d60801b6044820152606401610a64565b6203f480600c546124239190613b97565b421161246c5760405162461bcd60e51b8152602060048201526018602482015277111a5cdc1d5d19481c195c9a5bd9081b9bdd08195b99195960421b6044820152606401610a64565b33600090815260156020908152604080832080549084905560149092529091205460ff161561251257600b546000908152601160205260408120546124b983670de0b6b3a7640000613b5e565b6124c39190613b75565b600b54600090815260116020526040902054601354919250670de0b6b3a76400009183916124f091613c27565b6124fa9190613b5e565b6125049190613b75565b61250e9083613b97565b9150505b6004805460405163a9059cbb60e01b81523392810192909252602482018390526001600160a01b03169063a9059cbb906044016020604051808303816000875af1158015612564573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125889190613bd3565b6125c95760405162461bcd60e51b8152602060048201526012602482015271109bdb99081c995d1d5c9b8819985a5b195960721b6044820152606401610a64565b50610cda6001600080516020613f2483398151915255565b6125e9612bb1565b600a5460ff161561260c5760405162461bcd60e51b8152600401610a6490613a99565b6203f480600c5461261d9190613b97565b42116126665760405162461bcd60e51b8152602060048201526018602482015277111a5cdc1d5d19481c195c9a5bd9081b9bdd08195b99195960421b6044820152606401610a64565b6000601354116126b05760405162461bcd60e51b8152602060048201526015602482015274139bc8191a5cdc1d5d195cc81cdd589b5a5d1d1959605a1b6044820152606401610a64565b601254600b819055600a805460ff191660011790556040517f93608ecbcf057462da63f5aef413ce7f78c5e1b3bb51859d77a40845ece2bfc390600090a2610cda6001600080516020613f2483398151915255565b6007818154811061271557600080fd5b90600052602060002001600091509050805461273090613ad0565b80601f016020809104026020016040519081016040528092919081815260200182805461275c90613ad0565b80156127a95780601f1061277e576101008083540402835291602001916127a9565b820191906000526020600020905b81548152906001019060200180831161278c57829003601f168201915b505050505081565b6127b9612949565b6001600160a01b0381166127e357604051631e4fbdf760e01b815260006004820152602401610a64565b61217a81612bfd565b6000825184106128365760405162461bcd60e51b8152602060048201526015602482015274092dcecc2d8d2c840deeae8c6dedaca40d2dcc8caf605b1b6044820152606401610a64565b6000805b84518110156128ba57600084670de0b6b3a764000087848151811061286157612861613bf5565b60200260200101516128739190613b5e565b61287d9190613b75565b905068056bc75e2d6310000081111561289c575068056bc75e2d631000005b6128a58161300b565b6128af9084613b97565b92505060010161283a565b50600083670de0b6b3a76400008688815181106128d9576128d9613bf5565b60200260200101516128eb9190613b5e565b6128f59190613b75565b905068056bc75e2d63100000811115612914575068056bc75e2d631000005b600061291f8261300b565b905082612934670de0b6b3a764000083613b5e565b61293e9190613b75565b979650505050505050565b3361297b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6001600160a01b031614610cda5760405163118cdaa760e01b8152336004820152602401610a64565b6129ac6131c6565b600080516020613f04833981519152805460ff191681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b039091168152602001610d86565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480612a8557507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316612a79600080516020613ee4833981519152546001600160a01b031690565b6001600160a01b031614155b15610cda5760405163703e46dd60e11b815260040160405180910390fd5b61217a612949565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612b05575060408051601f3d908101601f19168201909252612b0291810190613eae565b60015b612b2d57604051634c9c8ce360e01b81526001600160a01b0383166004820152602401610a64565b600080516020613ee48339815191528114612b5e57604051632a87526960e21b815260048101829052602401610a64565b61199183836131f6565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610cda5760405163703e46dd60e11b815260040160405180910390fd5b600080516020613f24833981519152805460011901612be357604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b6001600080516020613f2483398151915255565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b612c76612fa1565b600080516020613f04833981519152805460ff191660011781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336129e6565b60008251845114612d025760405162461bcd60e51b8152602060048201526015602482015274082e4e4c2f240d8cadccee8d040dad2e6dac2e8c6d605b1b6044820152606401610a64565b6000845111612d425760405162461bcd60e51b815260206004820152600c60248201526b456d7074792061727261797360a01b6044820152606401610a64565b60008211612d925760405162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c697175696469747920706172616d6574657200000000006044820152606401610a64565b6000612d9e858461324c565b9050600085516001600160401b03811115612dbb57612dbb61377b565b604051908082528060200260200182016040528015612de4578160200160208202803683370190505b50905060005b8651811015612f64576000868281518110612e0757612e07613bf5565b602002602001015112612e7557858181518110612e2657612e26613bf5565b6020026020010151878281518110612e4057612e40613bf5565b6020026020010151612e529190613b97565b828281518110612e6457612e64613bf5565b602002602001018181525050612f5c565b858181518110612e8757612e87613bf5565b6020026020010151612e9890613c0b565b878281518110612eaa57612eaa613bf5565b60200260200101511015612ef65760405162461bcd60e51b8152602060048201526013602482015272496e73756666696369656e742073686172657360681b6044820152606401610a64565b858181518110612f0857612f08613bf5565b6020026020010151612f1990613c0b565b878281518110612f2b57612f2b613bf5565b6020026020010151612f3d9190613c27565b828281518110612f4f57612f4f613bf5565b6020026020010181815250505b600101612dea565b506000612f71828661324c565b9050828110612f8e57612f848382613c27565b9350505050610cc3565b612f988184613c27565b612f8490613c0b565b600080516020613f048339815191525460ff1615610cda5760405163d93c066560e01b815260040160405180910390fd5b612fda613302565b610cda61334b565b612fea613302565b610cda613353565b612ffa613302565b61217a81613374565b610cda613302565b6000816000036130245750670de0b6b3a7640000919050565b68056bc75e2d6310000082111561303e5750600019919050565b670de0b6b3a764000080806130538582613b5e565b61305d9190613b75565b90506130698183613b97565b915061307e670de0b6b3a76400006002613b5e565b6130888583613b5e565b6130929190613b75565b905061309e8183613b97565b91506130b3670de0b6b3a76400006003613b5e565b6130bd8583613b5e565b6130c79190613b75565b90506130d38183613b97565b91506130e8670de0b6b3a76400006004613b5e565b6130f28583613b5e565b6130fc9190613b75565b90506131088183613b97565b915061311d670de0b6b3a76400006005613b5e565b6131278583613b5e565b6131319190613b75565b905061313d8183613b97565b9150613152670de0b6b3a76400006006613b5e565b61315c8583613b5e565b6131669190613b75565b90506131728183613b97565b9150613187670de0b6b3a76400006007613b5e565b6131918583613b5e565b61319b9190613b75565b90506131a78183613b97565b91506131bc670de0b6b3a76400006008613b5e565b610dff8583613b5e565b600080516020613f048339815191525460ff16610cda57604051638dfc202b60e01b815260040160405180910390fd5b6131ff8261337c565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a28051156132445761199182826133e1565b610dac61344e565b600080805b84518110156132d157600084670de0b6b3a764000087848151811061327857613278613bf5565b602002602001015161328a9190613b5e565b6132949190613b75565b905068056bc75e2d631000008111156132b3575068056bc75e2d631000005b6132bc8161300b565b6132c69084613b97565b925050600101613251565b50670de0b6b3a76400006132e48261346d565b6132ee9085613b5e565b6132f89190613b75565b9150505b92915050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff16610cda57604051631afcd79f60e31b815260040160405180910390fd5b612be9613302565b61335b613302565b600080516020613f04833981519152805460ff19169055565b6127b9613302565b806001600160a01b03163b6000036133b257604051634c9c8ce360e01b81526001600160a01b0382166004820152602401610a64565b600080516020613ee483398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080846001600160a01b0316846040516133fe9190613ec7565b600060405180830381855af49150503d8060008114613439576040519150601f19603f3d011682016040523d82523d6000602084013e61343e565b606091505b5091509150612270858383613585565b3415610cda5760405163b398979f60e01b815260040160405180910390fd5b60006134836103e8670de0b6b3a7640000613b75565b82101561349257506000919050565b670de0b6b3a764000082036134a957506000919050565b670de0b6b3a76400008210156134f5576134de826134cf670de0b6b3a764000080613b5e565b6134d99190613b75565b61346d565b6134ea90600019613c27565b6132fc906001613b97565b600068056bc75e2d631000008180805b602081101561356457600261351a8587613b97565b6135249190613b75565b925061352f8361300b565b9150868210156135415782945061355c565b868211156135515782935061355c565b509095945050505050565b600101613505565b5060026135718486613b97565b61357b9190613b75565b9695505050505050565b60608261359a57613595826135e1565b610cc3565b81511580156135b157506001600160a01b0384163b155b156135da57604051639996b31560e01b81526001600160a01b0385166004820152602401610a64565b5080610cc3565b8051156135f15780518082602001fd5b60405163d6bda27560e01b815260040160405180910390fd5b80356001600160a01b038116811461362157600080fd5b919050565b60006020828403121561363857600080fd5b610cc38261360a565b60005b8381101561365c578181015183820152602001613644565b50506000910152565b6000815180845261367d816020860160208601613641565b601f01601f19169290920160200192915050565b60008151808452602080850194506020840160005b838110156136c2578151875295820195908201906001016136a6565b509495945050505050565b600060a0820160a0835280885180835260c08501915060c08160051b86010192506020808b0160005b838110156137245760bf19888703018552613712868351613665565b955093820193908201906001016136f6565b5050505050828103602084015261373b8188613691565b915050846040830152613752606083018515159052565b8260808301529695505050505050565b60006020828403121561377457600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156137b9576137b961377b565b604052919050565b600080604083850312156137d457600080fd5b6137dd8361360a565b91506020808401356001600160401b03808211156137fa57600080fd5b818601915086601f83011261380e57600080fd5b8135818111156138205761382061377b565b613832601f8201601f19168501613791565b9150808252878482850101111561384857600080fd5b80848401858401376000848284010152508093505050509250929050565b6000602080838503121561387957600080fd5b82356001600160401b038082111561389057600080fd5b818501915085601f8301126138a457600080fd5b8135818111156138b6576138b661377b565b8060051b91506138c7848301613791565b81815291830184019184810190888411156138e157600080fd5b938501935b838510156138ff578435825293850193908501906138e6565b98975050505050505050565b602081526000610cc36020830184613691565b602081526000610cc36020830184613665565b60008083601f84011261394357600080fd5b5081356001600160401b0381111561395a57600080fd5b6020830191508360208260051b850101111561397557600080fd5b9250929050565b60008060006040848603121561399157600080fd5b83356001600160401b038111156139a757600080fd5b6139b386828701613931565b909790965060209590950135949350505050565b6000602082840312156139d957600080fd5b81356001600160401b038111156139ef57600080fd5b82016101208185031215610cc357600080fd5b600080600080600060808688031215613a1a57600080fd5b85356001600160401b03811115613a3057600080fd5b613a3c88828901613931565b90965094505060208601359250613a556040870161360a565b9150613a636060870161360a565b90509295509295909350565b60008060408385031215613a8257600080fd5b613a8b8361360a565b946020939093013593505050565b60208082526017908201527f4d61726b657420616c7265616479207265736f6c766564000000000000000000604082015260600190565b600181811c90821680613ae457607f821691505b60208210810361124057634e487b7160e01b600052602260045260246000fd5b60208082526024908201527f4f6e6c7920676f7665726e6f722063616e2063616c6c20746869732066756e636040820152633a34b7b760e11b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176132fc576132fc613b48565b600082613b9257634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156132fc576132fc613b48565b6020808252600f908201526e496e76616c6964206f7574636f6d6560881b604082015260600190565b600060208284031215613be557600080fd5b81518015158114610cc357600080fd5b634e487b7160e01b600052603260045260246000fd5b6000600160ff1b8201613c2057613c20613b48565b5060000390565b818103818111156132fc576132fc613b48565b6060808252810184905260008560808301825b87811015613c6b578235825260209283019290910190600101613c4d565b508381036020850152613c7e8187613691565b9250505082604083015295945050505050565b6000808335601e19843603018112613ca857600080fd5b8301803591506001600160401b03821115613cc257600080fd5b6020019150600581901b360382131561397557600080fd5b6000808335601e19843603018112613cf157600080fd5b8301803591506001600160401b03821115613d0b57600080fd5b60200191503681900382131561397557600080fd5b601f821115611991576000816000526020600020601f850160051c81016020861015613d495750805b601f850160051c820191505b81811015611ea757828155600101613d55565b6001600160401b03831115613d7f57613d7f61377b565b613d9383613d8d8354613ad0565b83613d20565b6000601f841160018114613dc75760008515613daf5750838201355b600019600387901b1c1916600186901b178355613e21565b600083815260209020601f19861690835b82811015613df85786850135825560209485019460019092019101613dd8565b5086821015613e155760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b6000808354613e3681613ad0565b60018281168015613e4e5760018114613e6357613e92565b60ff1984168752821515830287019450613e92565b8760005260208060002060005b85811015613e895781548a820152908401908201613e70565b50505082870194505b50929695505050505050565b8183823760009101908152919050565b600060208284031215613ec057600080fd5b5051919050565b60008251613ed9818460208701613641565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbccd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a2646970667358221220fa0c82a7580b731612baab360e1c84ca479b18dbacfb6cd4befd128b86089ad364736f6c63430008160033
Deployed Bytecode
0x6080604052600436106103765760003560e01c80638948261d116101d1578063c45a015511610102578063e53dc680116100a0578063eed2a1471161006f578063eed2a147146109cb578063f2fde38b146109eb578063f39690e414610a0b578063fe47a8a714610a2b57600080fd5b8063e53dc68014610954578063e62ff3eb1461098c578063ead1df17146109a1578063ec77537b146109b657600080fd5b8063d8ca24c1116100dc578063d8ca24c1146108d1578063d92f0810146108f1578063deb8d27814610911578063e2ae55241461092757600080fd5b8063c45a01551461087b578063cb4c86b71461089b578063d3967a6b146108b157600080fd5b8063a5bbe22b1161016f578063b2e017c711610149578063b2e017c714610810578063b79c41bc14610830578063bee4f74614610850578063c13ebbe61461086557600080fd5b8063a5bbe22b1461079d578063ad3cb1cc146107b4578063ad9914f8146107f257600080fd5b806397f03f1c116101ab57806397f03f1c1461072e5780639b34ae03146107445780639da0ae3e1461075a578063a0cd65521461078757600080fd5b80638948261d146106bc5780638da5cb5b146106de5780639236260b1461071b57600080fd5b80634f1ef286116102ab5780636399d03d11610249578063715018a611610223578063715018a61461065c5780638456cb591461067157806385af5d3514610686578063882636cb1461069c57600080fd5b80636399d03d1461061257806363bd1d4a1461063257806370aa26871461064757600080fd5b806356f433521161028557806356f433521461058a5780635a0e8290146105a05780635c975abb146105cd5780635fae6371146105f257600080fd5b80634f1ef286146105445780634fc07d751461055757806352d1902d1461057557600080fd5b806323341a05116103185780633f6fa655116102f25780633f6fa655146104d45780634020dffc146104ee578063469048401461050e5780634df7e3d01461052e57600080fd5b806323341a05146104795780632d844c491461049f5780633f4ba83a146104bf57600080fd5b80630c340a24116103545780630c340a24146104175780630d15fd77146104375780630ff352f51461044d5780631bd8db031461046457600080fd5b8063010ec4411461037b57806304f09b4a146103b857806309eef43e146103d7575b600080fd5b34801561038757600080fd5b5060025461039b906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156103c457600080fd5b50600b545b6040519081526020016103af565b3480156103e357600080fd5b506104076103f2366004613626565b60146020526000908152604090205460ff1681565b60405190151581526020016103af565b34801561042357600080fd5b5060035461039b906001600160a01b031681565b34801561044357600080fd5b506103c960135481565b34801561045957600080fd5b50610462610a41565b005b34801561047057600080fd5b50600f546103c9565b34801561048557600080fd5b5061048e610b4d565b6040516103af9594939291906136cd565b3480156104ab57600080fd5b506103c96104ba366004613762565b610c5e565b3480156104cb57600080fd5b50610462610cca565b3480156104e057600080fd5b50600a546104079060ff1681565b3480156104fa57600080fd5b50610462610509366004613762565b610cdc565b34801561051a57600080fd5b5060015461039b906001600160a01b031681565b34801561053a57600080fd5b506103c960055481565b6104626105523660046137c1565b610d91565b34801561056357600080fd5b506003546001600160a01b031661039b565b34801561058157600080fd5b506103c9610db0565b34801561059657600080fd5b506103c9600f5481565b3480156105ac57600080fd5b506103c96105bb366004613626565b60156020526000908152604090205481565b3480156105d957600080fd5b50600080516020613f048339815191525460ff16610407565b3480156105fe57600080fd5b506103c961060d366004613866565b610dcd565b34801561061e57600080fd5b5061046261062d366004613762565b610e1d565b34801561063e57600080fd5b50610462610f50565b34801561065357600080fd5b506006546103c9565b34801561066857600080fd5b5061046261112a565b34801561067d57600080fd5b5061046261113c565b34801561069257600080fd5b506103c9600c5481565b3480156106a857600080fd5b506103c96106b7366004613866565b61114c565b3480156106c857600080fd5b506106d16111b1565b6040516103af919061390b565b3480156106ea57600080fd5b507f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031661039b565b34801561072757600080fd5b503061039b565b34801561073a57600080fd5b506103c960165481565b34801561075057600080fd5b506103c9600b5481565b34801561076657600080fd5b506103c9610775366004613762565b60116020526000908152604090205481565b34801561079357600080fd5b506103c960065481565b3480156107a957600080fd5b506103c96203f48081565b3480156107c057600080fd5b506107e5604051806040016040528060058152602001640352e302e360dc1b81525081565b6040516103af919061391e565b3480156107fe57600080fd5b506002546001600160a01b031661039b565b34801561081c57600080fd5b5061046261082b36600461397c565b611246565b34801561083c57600080fd5b5061046261084b3660046139c7565b611996565b34801561085c57600080fd5b506103c9601481565b34801561087157600080fd5b506103c960105481565b34801561088757600080fd5b5060005461039b906001600160a01b031681565b3480156108a757600080fd5b506103c9600e5481565b3480156108bd57600080fd5b506104626108cc366004613762565b611eaf565b3480156108dd57600080fd5b506104076108ec366004613a02565b61217d565b3480156108fd57600080fd5b5061046261090c366004613762565b612279565b34801561091d57600080fd5b506103c960125481565b34801561093357600080fd5b506103c9610942366004613762565b60086020526000908152604090205481565b34801561096057600080fd5b506103c961096f366004613a6f565b600960209081526000928352604080842090915290825290205481565b34801561099857600080fd5b50600c546103c9565b3480156109ad57600080fd5b50610462612373565b3480156109c257600080fd5b506104626125e1565b3480156109d757600080fd5b506107e56109e6366004613762565b612705565b3480156109f757600080fd5b50610462610a06366004613626565b6127b1565b348015610a1757600080fd5b5060045461039b906001600160a01b031681565b348015610a3757600080fd5b506103c9600d5481565b600a5460ff1615610a6d5760405162461bcd60e51b8152600401610a6490613a99565b60405180910390fd5b6010544211610abe5760405162461bcd60e51b815260206004820152601c60248201527f5265706f7274657220646561646c696e65206e6f7420706173736564000000006044820152606401610a64565b60008060135411610ad0576000610ad4565b6012545b600a805460ff19166001179055600b81905560405133815290915081907fe4d6efcb12aa89dc35692182a18a22bcfd2c5d86dd221420209b7287daab0888906020015b60405180910390a260405181907f93608ecbcf057462da63f5aef413ce7f78c5e1b3bb51859d77a40845ece2bfc390600090a250565b606080600080600080610b5e6111b1565b9050600781600554600a60009054906101000a900460ff16600b5484805480602002602001604051908101604052809291908181526020016000905b82821015610c46578382906000526020600020018054610bb990613ad0565b80601f0160208091040260200160405190810160405280929190818152602001828054610be590613ad0565b8015610c325780601f10610c0757610100808354040283529160200191610c32565b820191906000526020600020905b815481529060010190602001808311610c1557829003601f168201915b505050505081526020019060010190610b9a565b50505050945095509550955095509550509091929394565b6007546000908210610caa5760405162461bcd60e51b8152602060048201526015602482015274092dcecc2d8d2c840deeae8c6dedaca40d2dcc8caf605b1b6044820152606401610a64565b6000610cb46111b1565b9050610cc383826005546127ec565b9392505050565b610cd2612949565b610cda6129a4565b565b6003546001600160a01b03163314610d065760405162461bcd60e51b8152600401610a6490613b04565b428111610d555760405162461bcd60e51b815260206004820152601a60248201527f446561646c696e65206d75737420626520696e206675747572650000000000006044820152606401610a64565b60108190556040518181527fb78308b2eb98fa00faea36698f56c2389c9bd7c8e76f7c0f7725e33135d48092906020015b60405180910390a150565b610d996129fe565b610da282612aa3565b610dac8282612aab565b5050565b6000610dba612b68565b50600080516020613ee483398151915290565b600080610dd98361114c565b905060008113610dec5750600092915050565b6000612710600f5483610dff9190613b5e565b610e099190613b75565b9050610e158183613b97565b949350505050565b6002546001600160a01b03163314610e835760405162461bcd60e51b8152602060048201526024808201527f4f6e6c79207265706f727465722063616e2063616c6c20746869732066756e636044820152633a34b7b760e11b6064820152608401610a64565b600a5460ff1615610ea65760405162461bcd60e51b8152600401610a6490613a99565b601054421015610ee45760405162461bcd60e51b8152602060048201526009602482015268546f6f206561726c7960b81b6044820152606401610a64565b6007548110610f055760405162461bcd60e51b8152600401610a6490613baa565b600b81905542600c819055600a805460ff1916600117905560405182917fffac1500e5679b3ff6518aa340b377b1b544ffde8e2e1f3a786f8b1fe9f140de91610b1791815260200190565b610f58612bb1565b600a5460ff16610fa05760405162461bcd60e51b815260206004820152601360248201527213585c9ad95d081b9bdd081c995cdbdb1d9959606a1b6044820152606401610a64565b336000908152600960209081526040808320600b54845290915290205480610ffe5760405162461bcd60e51b81526020600482015260116024820152704e6f2077696e6e696e672073686172657360781b6044820152606401610a64565b336000818152600960209081526040808320600b5484529091528082209190915560048054915163a9059cbb60e01b8152908101929092526024820183905282916001600160a01b039091169063a9059cbb906044016020604051808303816000875af1158015611073573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110979190613bd3565b6110dc5760405162461bcd60e51b815260206004820152601660248201527514185e5bdd5d081d1c985b9cd9995c8819985a5b195960521b6044820152606401610a64565b60405181815233907f5afeca38b2064c23a692c4cf353015d80ab3ecc417b4f893f372690c11fbd9a69060200160405180910390a25050610cda6001600080516020613f2483398151915255565b611132612949565b610cda6000612bfd565b611144612949565b610cda612c6e565b6007548151600091146111985760405162461bcd60e51b8152602060048201526014602482015273092dcecc2d8d2c840c2e4e4c2f240d8cadccee8d60631b6044820152606401610a64565b60006111a26111b1565b9050610cc38184600554612cb7565b6007546060906000906001600160401b038111156111d1576111d161377b565b6040519080825280602002602001820160405280156111fa578160200160208202803683370190505b50905060005b60075481101561124057600081815260086020526040902054825183908390811061122d5761122d613bf5565b6020908102919091010152600101611200565b50919050565b61124e612bb1565b611256612fa1565b600a5460ff16156112795760405162461bcd60e51b8152600401610a6490613a99565b60075482146112c15760405162461bcd60e51b8152602060048201526014602482015273092dcecc2d8d2c840c2e4e4c2f240d8cadccee8d60631b6044820152606401610a64565b60006112cb6111b1565b905060005b838110156114385760008585838181106112ec576112ec613bf5565b90506020020135131561138e576064601483838151811061130f5761130f613bf5565b60200260200101516113219190613b5e565b61132b9190613b75565b85858381811061133d5761133d613bf5565b9050602002013511156113895760405162461bcd60e51b815260206004820152601460248201527354726164652073697a6520746f6f206c6172676560601b6044820152606401610a64565b611430565b60008585838181106113a2576113a2613bf5565b905060200201351215611430573360009081526009602090815260408083208484529091529020548585838181106113dc576113dc613bf5565b905060200201356113ec90613c0b565b11156114305760405162461bcd60e51b8152602060048201526013602482015272496e73756666696369656e742073686172657360681b6044820152606401610a64565b6001016112d0565b50600061147785858080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061114c92505050565b905060008060008313156114f257612710600f54846114969190613b5e565b6114a09190613b75565b91506114ac8284613b97565b9050848111156114f25760405162461bcd60e51b815260206004820152601160248201527014db1a5c1c1859d948195e18d959591959607a1b6044820152606401610a64565b60005b8681101561167057600088888381811061151157611511613bf5565b9050602002013513156115af5787878281811061153057611530613bf5565b905060200201356008600083815260200190815260200160002060008282546115599190613b97565b90915550889050878281811061157157611571613bf5565b336000908152600960209081526040808320878452825282208054939091029490940135939250906115a4908490613b97565b909155506116689050565b60008888838181106115c3576115c3613bf5565b905060200201351215611668578787828181106115e2576115e2613bf5565b905060200201356115f290613c0b565b60008281526008602052604081208054909190611610908490613c27565b90915550889050878281811061162857611628613bf5565b9050602002013561163890613c0b565b33600090815260096020908152604080832085845290915281208054909190611662908490613c27565b90915550505b6001016114f5565b5060008313156116b35782600e600082825461168c9190613b97565b9091555061169c90508284613b97565b600d60008282546116ad9190613b97565b90915550505b600083131561184a57600480546040516323b872dd60e01b81523392810192909252306024830152604482018590526001600160a01b0316906323b872dd906064016020604051808303816000875af1158015611714573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117389190613bd3565b61177c5760405162461bcd60e51b8152602060048201526015602482015274151c985919481d1c985b9cd9995c8819985a5b1959605a1b6044820152606401610a64565b811561184557600480546001546040516323b872dd60e01b815233938101939093526001600160a01b0390811660248401526044830185905216906323b872dd906064016020604051808303816000875af11580156117df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118039190613bd3565b6118455760405162461bcd60e51b8152602060048201526013602482015272119959481d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610a64565b611922565b6000831215611922576004546001600160a01b031663a9059cbb3361186e86613c0b565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156118b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118dd9190613bd3565b6119225760405162461bcd60e51b815260206004820152601660248201527514185e5bdd5d081d1c985b9cd9995c8819985a5b195960521b6044820152606401610a64565b600061192c6111b1565b9050336001600160a01b03167f3b55ce5afbfa91d536b2a2394b85b42d8abc5fb48daa07088154bb0bc5fa6c008989848760405161196d9493929190613c3a565b60405180910390a250505050506119916001600080516020613f2483398151915255565b505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03166000811580156119db5750825b90506000826001600160401b031660011480156119f75750303b155b905081158015611a05575080155b15611a235760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315611a4d57845460ff60401b1916600160401b1785555b611a55612fd2565b611a5d612fe2565b611a75611a7060a0880160808901613626565b612ff2565b611a7d613003565b6002611a898780613c91565b90501015611ad95760405162461bcd60e51b815260206004820152601d60248201527f4d7573742068617665206174206c656173742032206f7574636f6d65730000006044820152606401610a64565b6000611aeb6040880160208901613626565b6001600160a01b031603611b395760405162461bcd60e51b8152602060048201526015602482015274125b9d985b1a5908199959481c9958da5c1a595b9d605a1b6044820152606401610a64565b6000611b4b6080880160608901613626565b6001600160a01b031603611b945760405162461bcd60e51b815260206004820152601060248201526f24b73b30b634b2103932b837b93a32b960811b6044820152606401610a64565b6000611ba660a0880160808901613626565b6001600160a01b031603611bef5760405162461bcd60e51b815260206004820152601060248201526f24b73b30b634b21033b7bb32b93737b960811b6044820152606401610a64565b6000611c02610100880160e08901613626565b6001600160a01b031603611c4d5760405162461bcd60e51b815260206004820152601260248201527124b73b30b634b21029aaa9a2103a37b5b2b760711b6044820152606401610a64565b60008660a0013511611ca15760405162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c697175696469747920706172616d6574657200000000006044820152606401610a64565b600080546001600160a01b03191633179055611cc36040870160208801613626565b600180546001600160a01b0319166001600160a01b0392909216919091179055611cf36080870160608801613626565b600280546001600160a01b0319166001600160a01b0392909216919091179055611d2360a0870160808801613626565b600380546001600160a01b0319166001600160a01b0392909216919091179055611d54610100870160e08801613626565b600480546001600160a01b0319166001600160a01b039290921691909117905560a0860135600555604086013560065560c0860135600f5561010086013560165560005b611da28780613c91565b9050811015611e1b576007611db78880613c91565b83818110611dc757611dc7613bf5565b9050602002810190611dd99190613cda565b82546001810184556000938452602090932090920191611df99183613d68565b506000818152600860205260409020670de0b6b3a76400009055600101611d98565b50611e294262278d00613b97565b60108190556040519081527fb78308b2eb98fa00faea36698f56c2389c9bd7c8e76f7c0f7725e33135d480929060200160405180910390a18315611ea757845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050565b611eb7612bb1565b600a5460ff1615611eda5760405162461bcd60e51b8152600401610a6490613a99565b6007548110611efb5760405162461bcd60e51b8152600401610a6490613baa565b3360009081526014602052604090205460ff1615611f4b5760405162461bcd60e51b815260206004820152600d60248201526c105b1c9958591e481d9bdd1959609a1b6044820152606401610a64565b6203f480600c54611f5c9190613b97565b421115611fa25760405162461bcd60e51b8152602060048201526014602482015273111a5cdc1d5d19481c195c9a5bd908195b99195960621b6044820152606401610a64565b600480546016546040516323b872dd60e01b8152339381019390935230602484015260448301526001600160a01b0316906323b872dd906064016020604051808303816000875af1158015611ffb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061201f9190613bd3565b6120625760405162461bcd60e51b8152602060048201526014602482015273109bdb99081d1c985b9cd9995c8819985a5b195960621b6044820152606401610a64565b601654336000908152601560209081526040808320849055848352601190915281208054909190612094908490613b97565b9091555050601654601380546000906120ae908490613b97565b9091555050336000908152601460209081526040808320805460ff19166001179055601254835260119091528082205483835291205411156120f05760128190555b80336001600160a01b03167fde5c01453f40d10a9cdeaaa7f2b644609198dabb4cf1d17a1496d1d506e2346d60165460405161212e91815260200190565b60405180910390a3604051819033907fa36cc2bebb74db33e9f88110a07ef56e1b31b24b4c4f51b54b1664266e29f45b90600090a361217a6001600080516020613f2483398151915255565b50565b600754600090851461219157506000612270565b6002546001600160a01b038481169116146121ae57506000612270565b6003546001600160a01b038381169116146121cb57506000612270565b60065484146121dc57506000612270565b60005b8581101561226a57600781815481106121fa576121fa613bf5565b906000526020600020016040516122119190613e28565b604051809103902087878381811061222b5761222b613bf5565b905060200281019061223d9190613cda565b60405161224b929190613e9e565b604051809103902014612262576000915050612270565b6001016121df565b50600190505b95945050505050565b6003546001600160a01b031633146122a35760405162461bcd60e51b8152600401610a6490613b04565b600a5460ff16156122c65760405162461bcd60e51b8152600401610a6490613a99565b600c54421061230e5760405162461bcd60e51b8152602060048201526014602482015273111a5cdc1d5d19481c195c9a5bd908195b99195960621b6044820152606401610a64565b600754811061232f5760405162461bcd60e51b8152600401610a6490613baa565b600a805460ff19166001179055600b8190556000600c81905560405182917f93608ecbcf057462da63f5aef413ce7f78c5e1b3bb51859d77a40845ece2bfc391a250565b61237b612bb1565b600a5460ff166123c35760405162461bcd60e51b815260206004820152601360248201527213585c9ad95d081b9bdd081c995cdbdb1d9959606a1b6044820152606401610a64565b336000908152601560205260409020546124125760405162461bcd60e51b815260206004820152601060248201526f4e6f20626f6e6420746f20636c61696d60801b6044820152606401610a64565b6203f480600c546124239190613b97565b421161246c5760405162461bcd60e51b8152602060048201526018602482015277111a5cdc1d5d19481c195c9a5bd9081b9bdd08195b99195960421b6044820152606401610a64565b33600090815260156020908152604080832080549084905560149092529091205460ff161561251257600b546000908152601160205260408120546124b983670de0b6b3a7640000613b5e565b6124c39190613b75565b600b54600090815260116020526040902054601354919250670de0b6b3a76400009183916124f091613c27565b6124fa9190613b5e565b6125049190613b75565b61250e9083613b97565b9150505b6004805460405163a9059cbb60e01b81523392810192909252602482018390526001600160a01b03169063a9059cbb906044016020604051808303816000875af1158015612564573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125889190613bd3565b6125c95760405162461bcd60e51b8152602060048201526012602482015271109bdb99081c995d1d5c9b8819985a5b195960721b6044820152606401610a64565b50610cda6001600080516020613f2483398151915255565b6125e9612bb1565b600a5460ff161561260c5760405162461bcd60e51b8152600401610a6490613a99565b6203f480600c5461261d9190613b97565b42116126665760405162461bcd60e51b8152602060048201526018602482015277111a5cdc1d5d19481c195c9a5bd9081b9bdd08195b99195960421b6044820152606401610a64565b6000601354116126b05760405162461bcd60e51b8152602060048201526015602482015274139bc8191a5cdc1d5d195cc81cdd589b5a5d1d1959605a1b6044820152606401610a64565b601254600b819055600a805460ff191660011790556040517f93608ecbcf057462da63f5aef413ce7f78c5e1b3bb51859d77a40845ece2bfc390600090a2610cda6001600080516020613f2483398151915255565b6007818154811061271557600080fd5b90600052602060002001600091509050805461273090613ad0565b80601f016020809104026020016040519081016040528092919081815260200182805461275c90613ad0565b80156127a95780601f1061277e576101008083540402835291602001916127a9565b820191906000526020600020905b81548152906001019060200180831161278c57829003601f168201915b505050505081565b6127b9612949565b6001600160a01b0381166127e357604051631e4fbdf760e01b815260006004820152602401610a64565b61217a81612bfd565b6000825184106128365760405162461bcd60e51b8152602060048201526015602482015274092dcecc2d8d2c840deeae8c6dedaca40d2dcc8caf605b1b6044820152606401610a64565b6000805b84518110156128ba57600084670de0b6b3a764000087848151811061286157612861613bf5565b60200260200101516128739190613b5e565b61287d9190613b75565b905068056bc75e2d6310000081111561289c575068056bc75e2d631000005b6128a58161300b565b6128af9084613b97565b92505060010161283a565b50600083670de0b6b3a76400008688815181106128d9576128d9613bf5565b60200260200101516128eb9190613b5e565b6128f59190613b75565b905068056bc75e2d63100000811115612914575068056bc75e2d631000005b600061291f8261300b565b905082612934670de0b6b3a764000083613b5e565b61293e9190613b75565b979650505050505050565b3361297b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6001600160a01b031614610cda5760405163118cdaa760e01b8152336004820152602401610a64565b6129ac6131c6565b600080516020613f04833981519152805460ff191681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b039091168152602001610d86565b306001600160a01b037f0000000000000000000000005a6367b9ae791c10bffe090fba0e80d0890bb2c4161480612a8557507f0000000000000000000000005a6367b9ae791c10bffe090fba0e80d0890bb2c46001600160a01b0316612a79600080516020613ee4833981519152546001600160a01b031690565b6001600160a01b031614155b15610cda5760405163703e46dd60e11b815260040160405180910390fd5b61217a612949565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612b05575060408051601f3d908101601f19168201909252612b0291810190613eae565b60015b612b2d57604051634c9c8ce360e01b81526001600160a01b0383166004820152602401610a64565b600080516020613ee48339815191528114612b5e57604051632a87526960e21b815260048101829052602401610a64565b61199183836131f6565b306001600160a01b037f0000000000000000000000005a6367b9ae791c10bffe090fba0e80d0890bb2c41614610cda5760405163703e46dd60e11b815260040160405180910390fd5b600080516020613f24833981519152805460011901612be357604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b6001600080516020613f2483398151915255565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b612c76612fa1565b600080516020613f04833981519152805460ff191660011781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336129e6565b60008251845114612d025760405162461bcd60e51b8152602060048201526015602482015274082e4e4c2f240d8cadccee8d040dad2e6dac2e8c6d605b1b6044820152606401610a64565b6000845111612d425760405162461bcd60e51b815260206004820152600c60248201526b456d7074792061727261797360a01b6044820152606401610a64565b60008211612d925760405162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c697175696469747920706172616d6574657200000000006044820152606401610a64565b6000612d9e858461324c565b9050600085516001600160401b03811115612dbb57612dbb61377b565b604051908082528060200260200182016040528015612de4578160200160208202803683370190505b50905060005b8651811015612f64576000868281518110612e0757612e07613bf5565b602002602001015112612e7557858181518110612e2657612e26613bf5565b6020026020010151878281518110612e4057612e40613bf5565b6020026020010151612e529190613b97565b828281518110612e6457612e64613bf5565b602002602001018181525050612f5c565b858181518110612e8757612e87613bf5565b6020026020010151612e9890613c0b565b878281518110612eaa57612eaa613bf5565b60200260200101511015612ef65760405162461bcd60e51b8152602060048201526013602482015272496e73756666696369656e742073686172657360681b6044820152606401610a64565b858181518110612f0857612f08613bf5565b6020026020010151612f1990613c0b565b878281518110612f2b57612f2b613bf5565b6020026020010151612f3d9190613c27565b828281518110612f4f57612f4f613bf5565b6020026020010181815250505b600101612dea565b506000612f71828661324c565b9050828110612f8e57612f848382613c27565b9350505050610cc3565b612f988184613c27565b612f8490613c0b565b600080516020613f048339815191525460ff1615610cda5760405163d93c066560e01b815260040160405180910390fd5b612fda613302565b610cda61334b565b612fea613302565b610cda613353565b612ffa613302565b61217a81613374565b610cda613302565b6000816000036130245750670de0b6b3a7640000919050565b68056bc75e2d6310000082111561303e5750600019919050565b670de0b6b3a764000080806130538582613b5e565b61305d9190613b75565b90506130698183613b97565b915061307e670de0b6b3a76400006002613b5e565b6130888583613b5e565b6130929190613b75565b905061309e8183613b97565b91506130b3670de0b6b3a76400006003613b5e565b6130bd8583613b5e565b6130c79190613b75565b90506130d38183613b97565b91506130e8670de0b6b3a76400006004613b5e565b6130f28583613b5e565b6130fc9190613b75565b90506131088183613b97565b915061311d670de0b6b3a76400006005613b5e565b6131278583613b5e565b6131319190613b75565b905061313d8183613b97565b9150613152670de0b6b3a76400006006613b5e565b61315c8583613b5e565b6131669190613b75565b90506131728183613b97565b9150613187670de0b6b3a76400006007613b5e565b6131918583613b5e565b61319b9190613b75565b90506131a78183613b97565b91506131bc670de0b6b3a76400006008613b5e565b610dff8583613b5e565b600080516020613f048339815191525460ff16610cda57604051638dfc202b60e01b815260040160405180910390fd5b6131ff8261337c565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a28051156132445761199182826133e1565b610dac61344e565b600080805b84518110156132d157600084670de0b6b3a764000087848151811061327857613278613bf5565b602002602001015161328a9190613b5e565b6132949190613b75565b905068056bc75e2d631000008111156132b3575068056bc75e2d631000005b6132bc8161300b565b6132c69084613b97565b925050600101613251565b50670de0b6b3a76400006132e48261346d565b6132ee9085613b5e565b6132f89190613b75565b9150505b92915050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff16610cda57604051631afcd79f60e31b815260040160405180910390fd5b612be9613302565b61335b613302565b600080516020613f04833981519152805460ff19169055565b6127b9613302565b806001600160a01b03163b6000036133b257604051634c9c8ce360e01b81526001600160a01b0382166004820152602401610a64565b600080516020613ee483398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080846001600160a01b0316846040516133fe9190613ec7565b600060405180830381855af49150503d8060008114613439576040519150601f19603f3d011682016040523d82523d6000602084013e61343e565b606091505b5091509150612270858383613585565b3415610cda5760405163b398979f60e01b815260040160405180910390fd5b60006134836103e8670de0b6b3a7640000613b75565b82101561349257506000919050565b670de0b6b3a764000082036134a957506000919050565b670de0b6b3a76400008210156134f5576134de826134cf670de0b6b3a764000080613b5e565b6134d99190613b75565b61346d565b6134ea90600019613c27565b6132fc906001613b97565b600068056bc75e2d631000008180805b602081101561356457600261351a8587613b97565b6135249190613b75565b925061352f8361300b565b9150868210156135415782945061355c565b868211156135515782935061355c565b509095945050505050565b600101613505565b5060026135718486613b97565b61357b9190613b75565b9695505050505050565b60608261359a57613595826135e1565b610cc3565b81511580156135b157506001600160a01b0384163b155b156135da57604051639996b31560e01b81526001600160a01b0385166004820152602401610a64565b5080610cc3565b8051156135f15780518082602001fd5b60405163d6bda27560e01b815260040160405180910390fd5b80356001600160a01b038116811461362157600080fd5b919050565b60006020828403121561363857600080fd5b610cc38261360a565b60005b8381101561365c578181015183820152602001613644565b50506000910152565b6000815180845261367d816020860160208601613641565b601f01601f19169290920160200192915050565b60008151808452602080850194506020840160005b838110156136c2578151875295820195908201906001016136a6565b509495945050505050565b600060a0820160a0835280885180835260c08501915060c08160051b86010192506020808b0160005b838110156137245760bf19888703018552613712868351613665565b955093820193908201906001016136f6565b5050505050828103602084015261373b8188613691565b915050846040830152613752606083018515159052565b8260808301529695505050505050565b60006020828403121561377457600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156137b9576137b961377b565b604052919050565b600080604083850312156137d457600080fd5b6137dd8361360a565b91506020808401356001600160401b03808211156137fa57600080fd5b818601915086601f83011261380e57600080fd5b8135818111156138205761382061377b565b613832601f8201601f19168501613791565b9150808252878482850101111561384857600080fd5b80848401858401376000848284010152508093505050509250929050565b6000602080838503121561387957600080fd5b82356001600160401b038082111561389057600080fd5b818501915085601f8301126138a457600080fd5b8135818111156138b6576138b661377b565b8060051b91506138c7848301613791565b81815291830184019184810190888411156138e157600080fd5b938501935b838510156138ff578435825293850193908501906138e6565b98975050505050505050565b602081526000610cc36020830184613691565b602081526000610cc36020830184613665565b60008083601f84011261394357600080fd5b5081356001600160401b0381111561395a57600080fd5b6020830191508360208260051b850101111561397557600080fd5b9250929050565b60008060006040848603121561399157600080fd5b83356001600160401b038111156139a757600080fd5b6139b386828701613931565b909790965060209590950135949350505050565b6000602082840312156139d957600080fd5b81356001600160401b038111156139ef57600080fd5b82016101208185031215610cc357600080fd5b600080600080600060808688031215613a1a57600080fd5b85356001600160401b03811115613a3057600080fd5b613a3c88828901613931565b90965094505060208601359250613a556040870161360a565b9150613a636060870161360a565b90509295509295909350565b60008060408385031215613a8257600080fd5b613a8b8361360a565b946020939093013593505050565b60208082526017908201527f4d61726b657420616c7265616479207265736f6c766564000000000000000000604082015260600190565b600181811c90821680613ae457607f821691505b60208210810361124057634e487b7160e01b600052602260045260246000fd5b60208082526024908201527f4f6e6c7920676f7665726e6f722063616e2063616c6c20746869732066756e636040820152633a34b7b760e11b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176132fc576132fc613b48565b600082613b9257634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156132fc576132fc613b48565b6020808252600f908201526e496e76616c6964206f7574636f6d6560881b604082015260600190565b600060208284031215613be557600080fd5b81518015158114610cc357600080fd5b634e487b7160e01b600052603260045260246000fd5b6000600160ff1b8201613c2057613c20613b48565b5060000390565b818103818111156132fc576132fc613b48565b6060808252810184905260008560808301825b87811015613c6b578235825260209283019290910190600101613c4d565b508381036020850152613c7e8187613691565b9250505082604083015295945050505050565b6000808335601e19843603018112613ca857600080fd5b8301803591506001600160401b03821115613cc257600080fd5b6020019150600581901b360382131561397557600080fd5b6000808335601e19843603018112613cf157600080fd5b8301803591506001600160401b03821115613d0b57600080fd5b60200191503681900382131561397557600080fd5b601f821115611991576000816000526020600020601f850160051c81016020861015613d495750805b601f850160051c820191505b81811015611ea757828155600101613d55565b6001600160401b03831115613d7f57613d7f61377b565b613d9383613d8d8354613ad0565b83613d20565b6000601f841160018114613dc75760008515613daf5750838201355b600019600387901b1c1916600186901b178355613e21565b600083815260209020601f19861690835b82811015613df85786850135825560209485019460019092019101613dd8565b5086821015613e155760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b6000808354613e3681613ad0565b60018281168015613e4e5760018114613e6357613e92565b60ff1984168752821515830287019450613e92565b8760005260208060002060005b85811015613e895781548a820152908401908201613e70565b50505082870194505b50929695505050505050565b8183823760009101908152919050565b600060208284031215613ec057600080fd5b5051919050565b60008251613ed9818460208701613641565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbccd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a2646970667358221220fa0c82a7580b731612baab360e1c84ca479b18dbacfb6cd4befd128b86089ad364736f6c63430008160033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.