Overview
xDAI Balance
xDAI Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 185 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Create Multi Sca... | 39694767 | 18 hrs ago | IN | 0 xDAI | 0.00007995 | ||||
Create Multi Cat... | 39689344 | 25 hrs ago | IN | 0 xDAI | 0.00022812 | ||||
Create Categoric... | 39676048 | 44 hrs ago | IN | 0 xDAI | 0.00669335 | ||||
Create Categoric... | 39674976 | 46 hrs ago | IN | 0 xDAI | 0.0057522 | ||||
Create Categoric... | 39674171 | 47 hrs ago | IN | 0 xDAI | 0.00256478 | ||||
Create Multi Sca... | 39667139 | 2 days ago | IN | 0 xDAI | 0.01065587 | ||||
Create Categoric... | 39663630 | 2 days ago | IN | 0 xDAI | 0.00153126 | ||||
Create Scalar Ma... | 39615492 | 5 days ago | IN | 0 xDAI | 0.00179915 | ||||
Create Scalar Ma... | 39615296 | 5 days ago | IN | 0 xDAI | 0.00173455 | ||||
Create Scalar Ma... | 39614205 | 5 days ago | IN | 0 xDAI | 0.00179247 | ||||
Create Scalar Ma... | 39612961 | 5 days ago | IN | 0 xDAI | 0.00175871 | ||||
Create Scalar Ma... | 39612928 | 5 days ago | IN | 0 xDAI | 0.00172997 | ||||
Create Categoric... | 39612889 | 5 days ago | IN | 0 xDAI | 0.00161197 | ||||
Create Scalar Ma... | 39612867 | 5 days ago | IN | 0 xDAI | 0.00165959 | ||||
Create Categoric... | 39612833 | 5 days ago | IN | 0 xDAI | 0.0015752 | ||||
Create Categoric... | 39603877 | 6 days ago | IN | 0 xDAI | 0.00187679 | ||||
Create Categoric... | 39603853 | 6 days ago | IN | 0 xDAI | 0.00181604 | ||||
Create Categoric... | 39603800 | 6 days ago | IN | 0 xDAI | 0.00186176 | ||||
Create Categoric... | 39603726 | 6 days ago | IN | 0 xDAI | 0.00175375 | ||||
Create Categoric... | 39575554 | 7 days ago | IN | 0 xDAI | 0.00260914 | ||||
Create Multi Sca... | 39556890 | 8 days ago | IN | 0 xDAI | 0.00376279 | ||||
Create Categoric... | 39553573 | 9 days ago | IN | 0 xDAI | 0.00175602 | ||||
Create Categoric... | 39440265 | 15 days ago | IN | 0 xDAI | 0.00162786 | ||||
Create Categoric... | 39440226 | 15 days ago | IN | 0 xDAI | 0.0016795 | ||||
Create Categoric... | 39440168 | 15 days ago | IN | 0 xDAI | 0.00163499 |
Latest 25 internal transactions (View All)
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.
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x47fc00bb...9293a78FB The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
MarketFactory
Compiler Version
v0.8.20+commit.a1b79de6
Contract Source Code (Solidity Standard Json-Input format)
/** * @authors: [@xyzseer] * @reviewers: [@nvm1410, @madhurMongia, @unknownunknown1, @mani99brar] * @auditors: [] * @bounties: [] * @deployments: [] */ // SPDX-License-Identifier: MIT pragma solidity 0.8.20; import {IConditionalTokens, IRealityETH_v3_0, IWrapped1155Factory} from "./Interfaces.sol"; import "./Market.sol"; import "./RealityProxy.sol"; import "@openzeppelin/contracts/proxy/Clones.sol"; contract MarketFactory { using Clones for address; /// @dev Workaround "stack too deep" errors. /// @param marketName Used only in categorical, multi categorical, and scalar markets. In multi scalar markets, the market name is formed using questionStart + outcomeType + questionEnd. /// @param outcomes The market outcomes, doesn't include the INVALID_RESULT outcome. /// @param questionStart Used to build the Reality question on multi scalar markets. /// @param questionEnd Used to build the Reality question on multi scalar markets. /// @param outcomeType Used to build the Reality question on multi scalar markets. /// @param parentOutcome conditional outcome to use (optional). /// @param parentMarket conditional market to use (optional). UNTRUSTED. /// @param category Reality question category. /// @param lang Reality question language. /// @param lowerBound Lower bound, only used for scalar markets. /// @param upperBound Upper bound, only used for scalar markets. /// @param minBond Min bond to use on Reality. /// @param openingTime Reality question opening time. /// @param tokenNames Name of the ERC20 tokens associated to each outcome. struct CreateMarketParams { string marketName; string[] outcomes; string questionStart; string questionEnd; string outcomeType; uint256 parentOutcome; address parentMarket; string category; string lang; uint256 lowerBound; uint256 upperBound; uint256 minBond; uint32 openingTime; string[] tokenNames; } /// @dev Workaround "stack too deep" errors. /// @param encodedQuestions The encoded questions containing the Reality parameters. /// @param outcomeSlotCount Conditional Tokens outcomeSlotCount. /// @param templateId Reality templateId. struct InternalMarketConfig { string[] encodedQuestions; uint256 outcomeSlotCount; uint256 templateId; } /// @dev Template for scalar and multi scalar markets. uint8 internal constant REALITY_UINT_TEMPLATE = 1; /// @dev Template for categorical markets. uint8 internal constant REALITY_SINGLE_SELECT_TEMPLATE = 2; /// @dev Template for multi categorical markets. uint8 internal constant REALITY_MULTI_SELECT_TEMPLATE = 3; /// @dev Reality question timeout. uint32 public immutable questionTimeout; /// @dev Arbitrator contract. address public immutable arbitrator; /// @dev Reality.eth contract. IRealityETH_v3_0 public immutable realitio; /// @dev Wrapped1155Factory contract. IWrapped1155Factory public immutable wrapped1155Factory; /// @dev Conditional Tokens contract. IConditionalTokens public immutable conditionalTokens; /// @dev Conditional Tokens collateral token contract. address public immutable collateralToken; /// @dev Oracle contract. RealityProxy public immutable realityProxy; /// @dev Markets created by this factory. address[] public markets; /// @dev Market contract. address public immutable market; /// @dev To be emitted when a new market is created. /// @param market The new market address. /// @param marketName The name of the market. /// @param parentMarket Conditional market to use. /// @param conditionId Conditional Tokens conditionId. /// @param questionId Conditional Tokens questionId. /// @param questionsIds Reality questions ids. event NewMarket( address indexed market, string marketName, address parentMarket, bytes32 conditionId, bytes32 questionId, bytes32[] questionsIds ); /** * @dev Constructor. * @param _market Address of the market contract that is going to be used for each new deployment. * @param _arbitrator Address of the arbitrator that is going to resolve Realitio disputes. * @param _realitio Address of the Realitio implementation. * @param _wrapped1155Factory Address of the Wrapped1155Factory implementation. * @param _conditionalTokens Address of the ConditionalTokens implementation. * @param _collateralToken Address of the collateral token. * @param _realityProxy Address of the RealityProxy implementation. * @param _questionTimeout Reality question timeout. */ constructor( address _market, address _arbitrator, IRealityETH_v3_0 _realitio, IWrapped1155Factory _wrapped1155Factory, IConditionalTokens _conditionalTokens, address _collateralToken, RealityProxy _realityProxy, uint32 _questionTimeout ) { market = _market; arbitrator = _arbitrator; realitio = _realitio; wrapped1155Factory = _wrapped1155Factory; conditionalTokens = _conditionalTokens; collateralToken = _collateralToken; realityProxy = _realityProxy; questionTimeout = _questionTimeout; } /// @dev Creates a Categorical market. /// @notice Categorical markets are associated with a Reality question that has only one answer. /// @param params CreateMarketParams instance. /// @return The new market address. function createCategoricalMarket(CreateMarketParams calldata params) external returns (address) { require(params.outcomes.length >= 2, "Outcomes count must be 2 or more"); string[] memory encodedQuestions = new string[](1); encodedQuestions[0] = encodeRealityQuestionWithOutcomes(params.marketName, params.outcomes, params.category, params.lang); return createMarket( params, params.marketName, InternalMarketConfig({ encodedQuestions: encodedQuestions, outcomeSlotCount: params.outcomes.length + 1, // additional outcome for Invalid Result. templateId: REALITY_SINGLE_SELECT_TEMPLATE }) ); } /// @dev Creates a Multi Categorical market. /// @notice Multi Categorical markets are associated with a Reality question that has one or more answers. /// @param params CreateMarketParams instance. /// @return The new market address. function createMultiCategoricalMarket(CreateMarketParams calldata params) external returns (address) { require(params.outcomes.length >= 2, "Outcomes count must be 2 or more"); string[] memory encodedQuestions = new string[](1); encodedQuestions[0] = encodeRealityQuestionWithOutcomes(params.marketName, params.outcomes, params.category, params.lang); return createMarket( params, params.marketName, InternalMarketConfig({ encodedQuestions: encodedQuestions, outcomeSlotCount: params.outcomes.length + 1, // additional outcome for Invalid Result. templateId: REALITY_MULTI_SELECT_TEMPLATE }) ); } /// @dev Creates a Scalar market. /// @notice Scalar markets are associated with a Reality question that resolves to a numeric value. /// @param params CreateMarketParams instance. /// @return The new market address. function createScalarMarket(CreateMarketParams calldata params) external returns (address) { require(params.upperBound > params.lowerBound, "upperBound must be higher than lowerBound"); // values reserved by Reality for INVALID and UNRESOLVED_ANSWER. require(params.upperBound < type(uint256).max - 2, "upperBound must be less than uint256.max - 2"); require(params.outcomes.length == 2, "Outcomes count must be 2"); string[] memory encodedQuestions = new string[](1); encodedQuestions[0] = encodeRealityQuestionWithoutOutcomes(params.marketName, params.category, params.lang); return createMarket( params, params.marketName, InternalMarketConfig({ encodedQuestions: encodedQuestions, outcomeSlotCount: 3, // additional outcome for Invalid Result. templateId: REALITY_UINT_TEMPLATE }) ); } /// @dev Creates a Multi Scalar market. /// @notice Multi Scalar markets are associated with two or more Reality questions, and each one of them resolves to a numeric value. /// @param params CreateMarketParams instance. /// @return The new market address. function createMultiScalarMarket(CreateMarketParams calldata params) external returns (address) { require(params.outcomes.length >= 2, "Outcomes count must be 2 or more"); string[] memory encodedQuestions = new string[](params.outcomes.length); for (uint256 i = 0; i < params.outcomes.length; i++) { encodedQuestions[i] = encodeRealityQuestionWithoutOutcomes( string(abi.encodePacked(params.questionStart, params.outcomes[i], params.questionEnd)), params.category, params.lang ); } return createMarket( params, string(abi.encodePacked(params.questionStart, "[", params.outcomeType, "]", params.questionEnd)), InternalMarketConfig({ encodedQuestions: encodedQuestions, outcomeSlotCount: params.outcomes.length + 1, // additional outcome for Invalid Result. templateId: REALITY_UINT_TEMPLATE }) ); } /// @dev Creates the Market and deploys the wrapped ERC20 tokens. /// @param params CreateMarketParams instance. /// @param marketName The market name. /// @param config InternalMarketConfig instance. /// @return The new market address. function createMarket( CreateMarketParams memory params, string memory marketName, InternalMarketConfig memory config ) internal returns (address) { (Market.ConditionalTokensParams memory conditionalTokensParams, Market.RealityParams memory realityParams) = createNewMarketParams(params, config); Market instance = Market(market.clone()); instance.initialize( marketName, params.outcomes, params.lowerBound, params.upperBound, conditionalTokensParams, realityParams, realityProxy ); emit NewMarket( address(instance), marketName, params.parentMarket, conditionalTokensParams.conditionId, conditionalTokensParams.questionId, realityParams.questionsIds ); markets.push(address(instance)); return address(instance); } /// @dev Creates the structures needed to initialize the new market. /// @param params CreateMarketParams instance. /// @param config InternalMarketConfig instance. /// @return Market.ConditionalTokensParams instance. /// @return Market.RealityParams instance. function createNewMarketParams( CreateMarketParams memory params, InternalMarketConfig memory config ) internal returns (Market.ConditionalTokensParams memory, Market.RealityParams memory) { bytes32 parentCollectionId = params.parentMarket == address(0) ? bytes32(0) : conditionalTokens.getCollectionId( Market(params.parentMarket).parentCollectionId(), Market(params.parentMarket).conditionId(), 1 << params.parentOutcome ); bytes32[] memory questionsIds = new bytes32[](config.encodedQuestions.length); for (uint256 i = 0; i < config.encodedQuestions.length; i++) { questionsIds[i] = askRealityQuestion(config.encodedQuestions[i], config.templateId, params.openingTime, params.minBond); } // questionId must be a hash of all the values that RealityProxy.resolve() uses to resolve a market, this way if an attacker tries to resolve a fake market by changing some value its questionId will not match the id of a valid market. bytes32 questionId = keccak256( abi.encode(questionsIds, params.outcomes.length, config.templateId, params.lowerBound, params.upperBound) ); bytes32 conditionId = prepareCondition(questionId, config.outcomeSlotCount); (IERC20[] memory wrapped1155, bytes[] memory data) = deployERC20Positions(parentCollectionId, conditionId, config.outcomeSlotCount, params.tokenNames); return ( Market.ConditionalTokensParams({ conditionId: conditionId, questionId: questionId, parentCollectionId: parentCollectionId, parentOutcome: params.parentOutcome, parentMarket: params.parentMarket, wrapped1155: wrapped1155, data: data }), Market.RealityParams({ questionsIds: questionsIds, templateId: config.templateId, encodedQuestions: config.encodedQuestions }) ); } /// @dev Encodes the question, outcomes, category and language following the Reality structure. /// If any parameter has a special character like quotes, it must be properly escaped. /// @param question The question text. /// @param outcomes[] The question outcomes. /// @param category The question category. /// @param lang The question language. /// @return The encoded question. function encodeRealityQuestionWithOutcomes( string memory question, string[] calldata outcomes, string memory category, string memory lang ) internal pure returns (string memory) { bytes memory separator = abi.encodePacked(unicode"\u241f"); bytes memory encodedOutcomes = abi.encodePacked('"', outcomes[0], '"'); for (uint256 i = 1; i < outcomes.length; i++) { encodedOutcomes = abi.encodePacked(encodedOutcomes, ',"', outcomes[i], '"'); } return string(abi.encodePacked(question, separator, encodedOutcomes, separator, category, separator, lang)); } /// @dev Encodes the question, category and language following the Reality structure. /// If any parameter has a special character like quotes, it must be properly escaped. /// @param question The question text. /// @param category The question category. /// @param lang The question language. /// @return The encoded question. function encodeRealityQuestionWithoutOutcomes( string memory question, string memory category, string memory lang ) internal pure returns (string memory) { bytes memory separator = abi.encodePacked(unicode"\u241f"); return string(abi.encodePacked(question, separator, category, separator, lang)); } /// @dev Asks a question on reality. /// @param encodedQuestion The encoded question containing the Reality parameters. /// @param templateId The Reality template id. /// @param openingTime The question opening time. /// @param minBond The question min bond. /// @return The question id. function askRealityQuestion( string memory encodedQuestion, uint256 templateId, uint32 openingTime, uint256 minBond ) internal returns (bytes32) { bytes32 content_hash = keccak256(abi.encodePacked(templateId, openingTime, encodedQuestion)); bytes32 question_id = keccak256( abi.encodePacked( content_hash, arbitrator, questionTimeout, minBond, address(realitio), address(this), uint256(0) ) ); if (realitio.getTimeout(question_id) != 0) { return question_id; } return realitio.askQuestionWithMinBond( templateId, encodedQuestion, arbitrator, questionTimeout, openingTime, 0, minBond ); } /// @dev Prepares the CTF condition and returns the conditionId. /// @param questionId An identifier for the question to be answered by the oracle. /// @param outcomeSlotCount The number of outcome slots which must be used for this condition. Must not exceed 256. /// @return Condition ID. function prepareCondition(bytes32 questionId, uint256 outcomeSlotCount) internal returns (bytes32) { bytes32 conditionId = conditionalTokens.getConditionId(address(realityProxy), questionId, outcomeSlotCount); if (conditionalTokens.getOutcomeSlotCount(conditionId) == 0) { conditionalTokens.prepareCondition(address(realityProxy), questionId, outcomeSlotCount); } return conditionId; } /// @dev Wraps the ERC1155 outcome tokens to ERC20. The INVALID_RESULT outcome is always called SER-INVALID. /// @param parentCollectionId The parentCollectionId. /// @param conditionId The conditionId. /// @param outcomeSlotCount The amount of outcomes. /// @param tokenNames The name of each outcome token. /// @return wrapped1155 Array of outcome tokens wrapped to ERC20. /// @return data Array of token data used to create each ERC20. function deployERC20Positions( bytes32 parentCollectionId, bytes32 conditionId, uint256 outcomeSlotCount, string[] memory tokenNames ) internal returns (IERC20[] memory wrapped1155, bytes[] memory data) { uint256 invalidResultIndex = outcomeSlotCount - 1; wrapped1155 = new IERC20[](outcomeSlotCount); data = new bytes[](outcomeSlotCount); for (uint256 j = 0; j < outcomeSlotCount; j++) { bytes32 collectionId = conditionalTokens.getCollectionId(parentCollectionId, conditionId, 1 << j); uint256 tokenId = conditionalTokens.getPositionId(collateralToken, collectionId); require(j == invalidResultIndex || bytes(tokenNames[j]).length != 0, "Missing token name"); bytes memory _data = abi.encodePacked( toString31(j == invalidResultIndex ? "SER-INVALID" : tokenNames[j]), toString31(j == invalidResultIndex ? "SER-INVALID" : tokenNames[j]), uint8(18) ); IERC20 _wrapped1155 = wrapped1155Factory.requireWrapped1155(address(conditionalTokens), tokenId, _data); wrapped1155[j] = _wrapped1155; data[j] = _data; } } /// @dev Encodes a short string (less than than 31 bytes long) as for storage as expected by Solidity. /// See https://github.com/gnosis/1155-to-20/pull/4#discussion_r573630922 /// @param value String to encode. /// @return encodedString The encoded string. function toString31(string memory value) internal pure returns (bytes32 encodedString) { uint256 length = bytes(value).length; require(length < 32, "string too long"); // Read the right-padded string data, which is guaranteed to fit into a single word because its length is less than 32. assembly { encodedString := mload(add(value, 0x20)) } // Now mask the string data, this ensures that the bytes past the string length are all 0s. bytes32 mask = bytes32(type(uint256).max << ((32 - length) << 3)); encodedString = encodedString & mask; // Finally, set the least significant byte to be the hex length of the encoded string, that is its byte-length times two. encodedString = encodedString | bytes32(length << 1); } /// @dev Returns all the markets created by this factory. /// @return The addresses of the markets. function allMarkets() external view returns (address[] memory) { return markets; } /// @notice Returns the amount of markets created by this factory. /// @return The amount of markets. function marketCount() external view returns (uint256) { return markets.length; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/Clones.sol) pragma solidity ^0.8.20; /** * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for * deploying minimal proxy contracts, also known as "clones". * * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies * > a minimal bytecode implementation that delegates all calls to a known, fixed address. * * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2` * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the * deterministic method. */ library Clones { /** * @dev A clone instance deployment failed. */ error ERC1167FailedCreateClone(); /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create opcode, which should never revert. */ function clone(address implementation) internal returns (address instance) { /// @solidity memory-safe-assembly assembly { // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes // of the `implementation` address with the bytecode before the address. mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000)) // Packs the remaining 17 bytes of `implementation` with the bytecode after the address. mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3)) instance := create(0, 0x09, 0x37) } if (instance == address(0)) { revert ERC1167FailedCreateClone(); } } /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create2 opcode and a `salt` to deterministically deploy * the clone. Using the same `implementation` and `salt` multiple time will revert, since * the clones cannot be deployed twice at the same address. */ function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) { /// @solidity memory-safe-assembly assembly { // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes // of the `implementation` address with the bytecode before the address. mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000)) // Packs the remaining 17 bytes of `implementation` with the bytecode after the address. mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3)) instance := create2(0, 0x09, 0x37, salt) } if (instance == address(0)) { revert ERC1167FailedCreateClone(); } } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress( address implementation, bytes32 salt, address deployer ) internal pure returns (address predicted) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(add(ptr, 0x38), deployer) mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff) mstore(add(ptr, 0x14), implementation) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73) mstore(add(ptr, 0x58), salt) mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37)) predicted := keccak256(add(ptr, 0x43), 0x55) } } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress( address implementation, bytes32 salt ) internal view returns (address predicted) { return predictDeterministicAddress(implementation, salt, address(this)); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; interface IERC20 { function transferFrom(address from, address to, uint256 amount) external returns (bool); function transfer(address to, uint256 amount) external returns (bool); function approve(address spender, uint256 amount) external returns (bool); function balanceOf(address owner) external returns (uint256); function totalSupply() external view returns (uint256); } // https://github.com/RealityETH/reality-eth-monorepo/blob/main/packages/contracts/flat/RealityETH-3.0.sol interface IRealityETH_v3_0 { function askQuestionWithMinBond( uint256 template_id, string memory question, address arbitrator, uint32 timeout, uint32 opening_ts, uint256 nonce, uint256 min_bond ) external payable returns (bytes32); function resultForOnceSettled(bytes32 question_id) external view returns (bytes32); function getContentHash(bytes32 question_id) external view returns (bytes32); function getTimeout(bytes32 question_id) external view returns (uint32); function submitAnswer(bytes32 question_id, bytes32 answer, uint256 max_previous) external payable; } interface IConditionalTokens { function payoutNumerators(bytes32 conditionId, uint256 index) external view returns (uint256); function payoutDenominator(bytes32 conditionId) external view returns (uint256); function prepareCondition(address oracle, bytes32 questionId, uint256 outcomeSlotCount) external; function reportPayouts(bytes32 questionId, uint256[] calldata payouts) external; function splitPosition( /*IERC20*/ address collateralToken, bytes32 parentCollectionId, bytes32 conditionId, uint256[] calldata partition, uint256 amount ) external; function mergePositions( /*IERC20*/ address collateralToken, bytes32 parentCollectionId, bytes32 conditionId, uint256[] calldata partition, uint256 amount ) external; function redeemPositions( /*IERC20*/ address collateralToken, bytes32 parentCollectionId, bytes32 conditionId, uint256[] calldata indexSets ) external; function getConditionId( address oracle, bytes32 questionId, uint256 outcomeSlotCount ) external pure returns (bytes32); function getCollectionId( bytes32 parentCollectionId, bytes32 conditionId, uint256 indexSet ) external view returns (bytes32); function getPositionId(address collateralToken, bytes32 collectionId) external pure returns (uint256); function getOutcomeSlotCount(bytes32 conditionId) external view returns (uint256); function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external; function balanceOf(address owner, uint256 id) external view returns (uint256); } interface IWrapped1155Factory { function requireWrapped1155( /*IERC1155*/ address multiToken, uint256 tokenId, bytes calldata data ) external /*Wrapped1155*/ returns (IERC20); function unwrap( /*IERC1155*/ address multiToken, uint256 tokenId, uint256 amount, address recipient, bytes calldata data ) external; }
/** * @authors: [@xyzseer] * @reviewers: [@nvm1410, @madhurMongia, @unknownunknown1, @mani99brar] * @auditors: [] * @bounties: [] * @deployments: [] */ // SPDX-License-Identifier: MIT pragma solidity 0.8.20; import {IERC20} from "./Interfaces.sol"; import "./RealityProxy.sol"; contract Market { /// @dev Flag to initialize the market only once. bool public initialized; /// @dev Contains the information associated to Reality. /// @param questionsIds Reality questions ids. /// @param templateId Reality templateId. /// @param encodedQuestions Encoded questions parameters, needed to create and reopen a question. struct RealityParams { bytes32[] questionsIds; uint256 templateId; string[] encodedQuestions; } /// @dev Contains the information associated to Conditional Tokens. /// @param conditionId Conditional Tokens conditionId. /// @param parentCollectionId Conditional Tokens parentCollectionId. /// @param parentOutcome Conditional outcome to use (optional). /// @param parentMarket Conditional market to use (optional). /// @param questionId Conditional Tokens questionId. /// @param wrapped1155 Outcome tokens Wrapped1155 address. /// @param data Wrapped1155 token data. struct ConditionalTokensParams { bytes32 conditionId; bytes32 parentCollectionId; uint256 parentOutcome; address parentMarket; bytes32 questionId; IERC20[] wrapped1155; bytes[] data; } /// @dev The name of the market. string public marketName; /// @dev The market outcomes, doesn't include the INVALID_RESULT outcome. string[] public outcomes; /// @dev Lower bound, only used for scalar markets. uint256 public lowerBound; /// @dev Upper bound, only used for scalar markets. uint256 public upperBound; /// @dev Conditional Tokens parameters. ConditionalTokensParams public conditionalTokensParams; /// @dev Reality parameters. RealityParams public realityParams; /// @dev Oracle contract. RealityProxy public realityProxy; /// @dev Initializer. /// @param _marketName The name of the market. /// @param _outcomes The market outcomes, doesn't include the INVALID_RESULT outcome. /// @param _lowerBound Lower bound, only used for scalar markets. /// @param _upperBound Upper bound, only used for scalar markets. /// @param _conditionalTokensParams Conditional Tokens params. /// @param _realityParams Reality params. /// @param _realityProxy Oracle contract. function initialize( string memory _marketName, string[] memory _outcomes, uint256 _lowerBound, uint256 _upperBound, ConditionalTokensParams memory _conditionalTokensParams, RealityParams memory _realityParams, RealityProxy _realityProxy ) external { require(!initialized, "Already initialized."); marketName = _marketName; outcomes = _outcomes; lowerBound = _lowerBound; upperBound = _upperBound; conditionalTokensParams = _conditionalTokensParams; realityParams = _realityParams; realityProxy = _realityProxy; initialized = true; } /// @dev The templateId associated to the Reality question. /// @return The template id. function templateId() external view returns (uint256) { return realityParams.templateId; } /// @dev Returns the Reality questions ids. Multi Scalar markets have one question for each outcome, while any other market has only one question. /// @return The Reality questions ids. function questionsIds() external view returns (bytes32[] memory) { return realityParams.questionsIds; } /// @dev Encoded questions parameters, needed to create and reopen a question. /// @param index The question index. /// @return The encoded question. function encodedQuestions(uint256 index) external view returns (string memory) { return realityParams.encodedQuestions[index]; } /// @dev Conditional Tokens questionId. /// @return the question ID. function questionId() external view returns (bytes32) { return conditionalTokensParams.questionId; } /// @dev Conditional Tokens conditionId. /// @return The condition ID. function conditionId() external view returns (bytes32) { return conditionalTokensParams.conditionId; } /// @dev Conditional Tokens parentCollectionId. /// @return The parent collection ID. function parentCollectionId() external view returns (bytes32) { return conditionalTokensParams.parentCollectionId; } /// @dev The parent market (optional). This market redeems to an outcome token of the parent market. /// @return The parent market address. function parentMarket() external view returns (address) { return conditionalTokensParams.parentMarket; } /// @dev The parent outcome (optional). The parent market's outcome token this market redeems for. /// @return The parent outcome index. function parentOutcome() external view returns (uint256) { return conditionalTokensParams.parentOutcome; } /// @dev Returns the wrapped1155 and the data corresponding to an outcome token. /// @param index The outcome index. /// @return wrapped1155 The wrapped token. /// @return data The token data. function wrappedOutcome(uint256 index) external view returns (IERC20 wrapped1155, bytes memory data) { return (conditionalTokensParams.wrapped1155[index], conditionalTokensParams.data[index]); } /// @dev Returns the wrapped1155 and the data corresponding to the parent market. /// @return wrapped1155 The wrapped token. /// @return data The token data. function parentWrappedOutcome() external view returns (IERC20 wrapped1155, bytes memory data) { if (conditionalTokensParams.parentMarket != address(0)) { (wrapped1155, data) = Market(conditionalTokensParams.parentMarket).wrappedOutcome(conditionalTokensParams.parentOutcome); } } /// @dev Returns the number of outcomes. /// Doesn't include the INVALID_RESULT outcome. /// @return numOutcomes The number of outcomes. function numOutcomes() external view returns (uint256) { return outcomes.length; } /// @dev Helper function to resolve the market. function resolve() external { realityProxy.resolve(this); } }
/** * @authors: [@xyzseer] * @reviewers: [@nvm1410, @madhurMongia, @unknownunknown1, @mani99brar] * @auditors: [] * @bounties: [] * @deployments: [] */ // SPDX-License-Identifier: MIT pragma solidity 0.8.20; import {IConditionalTokens, IRealityETH_v3_0} from "./Interfaces.sol"; import "./Market.sol"; contract RealityProxy { /// @dev Conditional Tokens contract. IConditionalTokens public immutable conditionalTokens; /// @dev Reality.eth contract. IRealityETH_v3_0 public immutable realitio; /// @dev INVALID_RESULT reserved value. bytes32 internal constant INVALID_RESULT = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff; /// @dev Template for scalar and multi scalar markets. uint256 internal constant REALITY_UINT_TEMPLATE = 1; /// @dev Template for categorical markets. uint256 internal constant REALITY_SINGLE_SELECT_TEMPLATE = 2; /// @dev Template for multi categorical markets. uint256 internal constant REALITY_MULTI_SELECT_TEMPLATE = 3; /// @dev Constructor. /// @param _conditionalTokens Conditional Tokens contract address. /// @param _realitio Reality.eth contract address. constructor(IConditionalTokens _conditionalTokens, IRealityETH_v3_0 _realitio) { conditionalTokens = _conditionalTokens; realitio = _realitio; } /// @dev Resolves the specified market. /// @param market Market to resolve. UNTRUSTED. function resolve(Market market) external { bytes32[] memory questionsIds = market.questionsIds(); uint256 numOutcomes = market.numOutcomes(); uint256 templateId = market.templateId(); uint256 low = market.lowerBound(); uint256 high = market.upperBound(); // questionId must be a hash of all the values used to resolve a market, this way if an attacker tries to resolve a fake market by changing some value its questionId will not match the id of a valid market. bytes32 questionId = keccak256(abi.encode(questionsIds, numOutcomes, templateId, low, high)); if (templateId == REALITY_SINGLE_SELECT_TEMPLATE) { resolveCategoricalMarket(questionId, questionsIds, numOutcomes); return; } if (templateId == REALITY_MULTI_SELECT_TEMPLATE) { resolveMultiCategoricalMarket(questionId, questionsIds, numOutcomes); return; } if (questionsIds.length > 1) { resolveMultiScalarMarket(questionId, questionsIds, numOutcomes); return; } resolveScalarMarket(questionId, questionsIds, low, high); } /// @dev Resolves to invalid if the answer is invalid or the result is greater than the amount of outcomes. /// @param questionId Conditional Tokens questionId. /// @param questionsIds Reality questions ids. /// @param numOutcomes The number of outcomes, excluding the INVALID_RESULT outcome. function resolveCategoricalMarket( bytes32 questionId, bytes32[] memory questionsIds, uint256 numOutcomes ) internal { uint256 answer = uint256(realitio.resultForOnceSettled(questionsIds[0])); uint256[] memory payouts = new uint256[](numOutcomes + 1); if (answer == uint256(INVALID_RESULT) || answer >= numOutcomes) { // the last outcome is INVALID_RESULT. payouts[numOutcomes] = 1; } else { payouts[answer] = 1; } conditionalTokens.reportPayouts(questionId, payouts); } /// @dev Resolves to invalid if the answer is invalid or all the results are zero. /// @param questionId Conditional Tokens questionId. /// @param questionsIds Reality questions ids. /// @param numOutcomes The number of outcomes, excluding the INVALID_RESULT outcome. function resolveMultiCategoricalMarket( bytes32 questionId, bytes32[] memory questionsIds, uint256 numOutcomes ) internal { uint256 answer = uint256(realitio.resultForOnceSettled(questionsIds[0])); uint256[] memory payouts = new uint256[](numOutcomes + 1); if (answer == uint256(INVALID_RESULT)) { // the last outcome is INVALID_RESULT. payouts[numOutcomes] = 1; } else { bool allZeroes = true; for (uint256 i = 0; i < numOutcomes; i++) { payouts[i] = (answer >> i) & 1; allZeroes = allZeroes && payouts[i] == 0; } if (allZeroes) { // invalid result. payouts[numOutcomes] = 1; } } conditionalTokens.reportPayouts(questionId, payouts); } /// @dev Resolves to invalid if the answer is invalid. /// @param questionId Conditional Tokens questionId. /// @param questionsIds Reality questions ids. /// @param low Lower bound. /// @param high Upper bound. function resolveScalarMarket( bytes32 questionId, bytes32[] memory questionsIds, uint256 low, uint256 high ) internal { uint256 answer = uint256(realitio.resultForOnceSettled(questionsIds[0])); uint256[] memory payouts = new uint256[](3); if (answer == uint256(INVALID_RESULT)) { // the last outcome is INVALID_RESULT. payouts[2] = 1; } else if (answer <= low) { payouts[0] = 1; } else if (answer >= high) { payouts[1] = 1; } else { payouts[0] = high - answer; payouts[1] = answer - low; } conditionalTokens.reportPayouts(questionId, payouts); } /// @dev If any individual result is invalid then the corresponding payout element is set to 0. /// @dev If all the elements of the payout vector are 0 or all are invalid, the market resolves to invalid. /// @param questionId Conditional Tokens questionId. /// @param questionsIds Reality questions ids. /// @param numOutcomes The number of outcomes, excluding the INVALID_RESULT outcome. function resolveMultiScalarMarket( bytes32 questionId, bytes32[] memory questionsIds, uint256 numOutcomes ) internal { uint256[] memory payouts = new uint256[](numOutcomes + 1); bool allZeroesOrInvalid = true; /* * We set maxPayout to a sufficiently large number for most possible outcomes that also avoids overflows in the following places: * https://github.com/gnosis/conditional-tokens-contracts/blob/master/contracts/ConditionalTokens.sol#L89 * https://github.com/gnosis/conditional-tokens-contracts/blob/master/contracts/ConditionalTokens.sol#L242 */ uint256 maxPayout = 2 ** (256 / 2) - 1; for (uint256 i = 0; i < numOutcomes; i++) { payouts[i] = uint256(realitio.resultForOnceSettled(questionsIds[i])); if (payouts[i] == uint256(INVALID_RESULT)) { payouts[i] = 0; } else if (payouts[i] > maxPayout) { payouts[i] = maxPayout; } allZeroesOrInvalid = allZeroesOrInvalid && payouts[i] == 0; } if (allZeroesOrInvalid) { // invalid result. payouts[numOutcomes] = 1; } conditionalTokens.reportPayouts(questionId, payouts); } }
{ "evmVersion": "paris", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 100 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_market","type":"address"},{"internalType":"address","name":"_arbitrator","type":"address"},{"internalType":"contract IRealityETH_v3_0","name":"_realitio","type":"address"},{"internalType":"contract IWrapped1155Factory","name":"_wrapped1155Factory","type":"address"},{"internalType":"contract IConditionalTokens","name":"_conditionalTokens","type":"address"},{"internalType":"address","name":"_collateralToken","type":"address"},{"internalType":"contract RealityProxy","name":"_realityProxy","type":"address"},{"internalType":"uint32","name":"_questionTimeout","type":"uint32"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ERC1167FailedCreateClone","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"market","type":"address"},{"indexed":false,"internalType":"string","name":"marketName","type":"string"},{"indexed":false,"internalType":"address","name":"parentMarket","type":"address"},{"indexed":false,"internalType":"bytes32","name":"conditionId","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"questionId","type":"bytes32"},{"indexed":false,"internalType":"bytes32[]","name":"questionsIds","type":"bytes32[]"}],"name":"NewMarket","type":"event"},{"inputs":[],"name":"allMarkets","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"arbitrator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collateralToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"conditionalTokens","outputs":[{"internalType":"contract IConditionalTokens","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"marketName","type":"string"},{"internalType":"string[]","name":"outcomes","type":"string[]"},{"internalType":"string","name":"questionStart","type":"string"},{"internalType":"string","name":"questionEnd","type":"string"},{"internalType":"string","name":"outcomeType","type":"string"},{"internalType":"uint256","name":"parentOutcome","type":"uint256"},{"internalType":"address","name":"parentMarket","type":"address"},{"internalType":"string","name":"category","type":"string"},{"internalType":"string","name":"lang","type":"string"},{"internalType":"uint256","name":"lowerBound","type":"uint256"},{"internalType":"uint256","name":"upperBound","type":"uint256"},{"internalType":"uint256","name":"minBond","type":"uint256"},{"internalType":"uint32","name":"openingTime","type":"uint32"},{"internalType":"string[]","name":"tokenNames","type":"string[]"}],"internalType":"struct MarketFactory.CreateMarketParams","name":"params","type":"tuple"}],"name":"createCategoricalMarket","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"marketName","type":"string"},{"internalType":"string[]","name":"outcomes","type":"string[]"},{"internalType":"string","name":"questionStart","type":"string"},{"internalType":"string","name":"questionEnd","type":"string"},{"internalType":"string","name":"outcomeType","type":"string"},{"internalType":"uint256","name":"parentOutcome","type":"uint256"},{"internalType":"address","name":"parentMarket","type":"address"},{"internalType":"string","name":"category","type":"string"},{"internalType":"string","name":"lang","type":"string"},{"internalType":"uint256","name":"lowerBound","type":"uint256"},{"internalType":"uint256","name":"upperBound","type":"uint256"},{"internalType":"uint256","name":"minBond","type":"uint256"},{"internalType":"uint32","name":"openingTime","type":"uint32"},{"internalType":"string[]","name":"tokenNames","type":"string[]"}],"internalType":"struct MarketFactory.CreateMarketParams","name":"params","type":"tuple"}],"name":"createMultiCategoricalMarket","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"marketName","type":"string"},{"internalType":"string[]","name":"outcomes","type":"string[]"},{"internalType":"string","name":"questionStart","type":"string"},{"internalType":"string","name":"questionEnd","type":"string"},{"internalType":"string","name":"outcomeType","type":"string"},{"internalType":"uint256","name":"parentOutcome","type":"uint256"},{"internalType":"address","name":"parentMarket","type":"address"},{"internalType":"string","name":"category","type":"string"},{"internalType":"string","name":"lang","type":"string"},{"internalType":"uint256","name":"lowerBound","type":"uint256"},{"internalType":"uint256","name":"upperBound","type":"uint256"},{"internalType":"uint256","name":"minBond","type":"uint256"},{"internalType":"uint32","name":"openingTime","type":"uint32"},{"internalType":"string[]","name":"tokenNames","type":"string[]"}],"internalType":"struct MarketFactory.CreateMarketParams","name":"params","type":"tuple"}],"name":"createMultiScalarMarket","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"marketName","type":"string"},{"internalType":"string[]","name":"outcomes","type":"string[]"},{"internalType":"string","name":"questionStart","type":"string"},{"internalType":"string","name":"questionEnd","type":"string"},{"internalType":"string","name":"outcomeType","type":"string"},{"internalType":"uint256","name":"parentOutcome","type":"uint256"},{"internalType":"address","name":"parentMarket","type":"address"},{"internalType":"string","name":"category","type":"string"},{"internalType":"string","name":"lang","type":"string"},{"internalType":"uint256","name":"lowerBound","type":"uint256"},{"internalType":"uint256","name":"upperBound","type":"uint256"},{"internalType":"uint256","name":"minBond","type":"uint256"},{"internalType":"uint32","name":"openingTime","type":"uint32"},{"internalType":"string[]","name":"tokenNames","type":"string[]"}],"internalType":"struct MarketFactory.CreateMarketParams","name":"params","type":"tuple"}],"name":"createScalarMarket","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"market","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"marketCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"markets","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"questionTimeout","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"realitio","outputs":[{"internalType":"contract IRealityETH_v3_0","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"realityProxy","outputs":[{"internalType":"contract RealityProxy","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wrapped1155Factory","outputs":[{"internalType":"contract IWrapped1155Factory","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100d55760003560e01c80637ca5cb3e116100875780637ca5cb3e146101f757806380f556051461020a5780638770b18014610231578063b1283e7714610244578063b2016bd414610257578063bc8802a21461027e578063ec979082146102a5578063ff08d88f146102b657600080fd5b8063150c5b97146100da5780631ba18b9b1461011e5780632ff8d5041461015a5780633412a3f914610181578063375a7cba146101945780635bd9e299146101a95780636cc6cde1146101d0575b600080fd5b6101017f000000000000000000000000d194319d1804c1051dd21ba1dc931ca72410b79f81565b6040516001600160a01b0390911681526020015b60405180910390f35b6101457f0000000000000000000000000000000000000000000000000000000000049d4081565b60405163ffffffff9091168152602001610115565b6101017f000000000000000000000000c260adfac11f97c001dc143d2a4f45b98e0f2d6c81565b61010161018f366004611b6a565b6102c9565b61019c6104b6565b6040516101159190611ba5565b6101017f000000000000000000000000ceafdd6bc0bef976fdcd1112955828e00543c0ce81565b6101017f00000000000000000000000068154ea682f95bf582b80dd6453fa401737491dc81565b610101610205366004611b6a565b610518565b6101017f0000000000000000000000008f76bc35f8c72e5e2ec55ebed785da5efaa9636a81565b61010161023f366004611b6a565b6107da565b610101610252366004611bf2565b6108eb565b6101017f000000000000000000000000af204776c7245bf4147c2612bf6e5972ee48370181565b6101017f000000000000000000000000e78996a233895be74a66f451f1019ca9734205cc81565b600054604051908152602001610115565b6101016102c4366004611b6a565b610915565b600060026102da6020840184611c0b565b905010156103035760405162461bcd60e51b81526004016102fa90611c54565b60405180910390fd5b604080516001808252818301909252600091816020015b606081526020019060019003908161031a57905050905061040a61033e8480611c9f565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610380925050506020860186611c0b565b61038d60e0880188611c9f565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506103d092505050610100890189611c9f565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610b3c92505050565b8160008151811061041d5761041d611ce5565b60200260200101819052506104af8361043590611ea1565b61043f8580611c9f565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516060810190915286815291505060208082019061049490890189611c0b565b6104a09150600161205b565b81526003602090910152610c54565b9392505050565b6060600080548060200260200160405190810160405280929190818152602001828054801561050e57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116104f0575b5050505050905090565b6000816101200135826101400135116105855760405162461bcd60e51b815260206004820152602960248201527f7570706572426f756e64206d75737420626520686967686572207468616e206c6044820152681bddd95c909bdd5b9960ba1b60648201526084016102fa565b610592600260001961206e565b826101400135106105fa5760405162461bcd60e51b815260206004820152602c60248201527f7570706572426f756e64206d757374206265206c657373207468616e2075696e60448201526b3a191a9b1736b0bc1016901960a11b60648201526084016102fa565b6106076020830183611c0b565b90506002146106535760405162461bcd60e51b815260206004820152601860248201527727baba31b7b6b2b99031b7bab73a1036bab9ba103132901960411b60448201526064016102fa565b604080516001808252818301909252600091816020015b606081526020019060019003908161066a57905050905061074d61068e8480611c9f565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506106d09250505060e0860186611c9f565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061071392505050610100870187611c9f565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610ddc92505050565b8160008151811061076057610760611ce5565b60200260200101819052506104af8361077890611ea1565b6107828580611c9f565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505060408051606081018252878152600360208201526001918101919091529150610c549050565b600060026107eb6020840184611c0b565b9050101561080b5760405162461bcd60e51b81526004016102fa90611c54565b604080516001808252818301909252600091816020015b606081526020019060019003908161082257905050905061084661033e8480611c9f565b8160008151811061085957610859611ce5565b60200260200101819052506104af8361087190611ea1565b61087b8580611c9f565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505060408051606081019091528681529150506020808201906108d090890189611c0b565b6108dc9150600161205b565b81526002602090910152610c54565b600081815481106108fb57600080fd5b6000918252602090912001546001600160a01b0316905081565b600060026109266020840184611c0b565b905010156109465760405162461bcd60e51b81526004016102fa90611c54565b60006109556020840184611c0b565b90506001600160401b0381111561096e5761096e611c89565b6040519080825280602002602001820160405280156109a157816020015b606081526020019060019003908161098c5790505b50905060005b6109b46020850185611c0b565b9050811015610aae57610a7e6109cd6040860186611c9f565b6109da6020880188611c0b565b858181106109ea576109ea611ce5565b90506020028101906109fc9190611c9f565b610a0960608a018a611c9f565b604051602001610a1e96959493929190612081565b60408051601f19818403018152919052610a3b60e0870187611c9f565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061071392505050610100880188611c9f565b828281518110610a9057610a90611ce5565b60200260200101819052508080610aa6906120b1565b9150506109a7565b506104af610abb84611ea1565b610ac86040860186611c9f565b610ad56080880188611c9f565b610ae260608a018a611c9f565b604051602001610af7969594939291906120ca565b60408051601f198184030181526060830190915284825290602081810190610b2190890189611c0b565b610b2d9150600161205b565b81526001602090910152610c54565b60606000604051602001610b599062e2909f60e81b815260030190565b6040516020818303038152906040529050600086866000818110610b7f57610b7f611ce5565b9050602002810190610b919190611c9f565b604051602001610ba292919061210c565b60408051601f19818403018152919052905060015b86811015610c1a5781888883818110610bd257610bd2611ce5565b9050602002810190610be49190611c9f565b604051602001610bf693929190612157565b60405160208183030381529060405291508080610c12906120b1565b915050610bb7565b5087828284888689604051602001610c389796959493929190612196565b6040516020818303038152906040529250505095945050505050565b6000806000610c638685610e3c565b915091506000610c9b7f0000000000000000000000008f76bc35f8c72e5e2ec55ebed785da5efaa9636a6001600160a01b03166111c9565b9050806001600160a01b031663d0e2ca658789602001518a61012001518b610140015188887f000000000000000000000000c260adfac11f97c001dc143d2a4f45b98e0f2d6c6040518863ffffffff1660e01b8152600401610d039796959493929190612325565b600060405180830381600087803b158015610d1d57600080fd5b505af1158015610d31573d6000803e3d6000fd5b50505060c08801518451608086015185516040516001600160a01b03871695507f109e5ac06d4835cca9a97d9014f7bb1bfafb85a2de6d4af1ad22aa8730e12c8794610d82948d949193909261242b565b60405180910390a2600080546001810182559080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5630180546001600160a01b0319166001600160a01b0383161790559695505050505050565b60606000604051602001610df99062e2909f60e81b815260030190565b60405160208183030381529060405290508481858386604051602001610e2395949392919061246d565b6040516020818303038152906040529150509392505050565b6040805160e0810182526000808252602080830182905282840182905260608084018390526080840183905260a0840181905260c084018190528451808201865281815291820192909252928301529060c08401516000906001600160a01b031615611018577f000000000000000000000000ceafdd6bc0bef976fdcd1112955828e00543c0ce6001600160a01b031663856296f78660c001516001600160a01b03166344bea37e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3791906124d8565b8760c001516001600160a01b0316632ddc7de76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9d91906124d8565b60a08901516040516001600160e01b031960e086901b168152600481019390935260248301919091526001901b6044820152606401602060405180830381865afa158015610fef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101391906124d8565b61101b565b60005b905060008460000151516001600160401b0381111561103c5761103c611c89565b604051908082528060200260200182016040528015611065578160200160208202803683370190505b50905060005b8551518110156110db576110ac8660000151828151811061108e5761108e611ce5565b602002602001015187604001518961018001518a610160015161123b565b8282815181106110be576110be611ce5565b6020908102919091010152806110d3816120b1565b91505061106b565b5060008187602001515187604001518961012001518a610140015160405160200161110a9594939291906124f1565b60405160208183030381529060405280519060200120905060006111328288602001516114cc565b905060008061114c86848b602001518d6101a001516116bf565b915091506040518060e001604052808481526020018781526020018b60a0015181526020018b60c001516001600160a01b031681526020018581526020018381526020018281525060405180606001604052808781526020018b6040015181526020018b60000151815250975097505050505050505b9250929050565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f090506001600160a01b038116611236576040516330be1a3d60e21b815260040160405180910390fd5b919050565b60008084848760405160200161125393929190612528565b60408051601f1981840301815282825280516020918201209083018190526bffffffffffffffffffffffff197f00000000000000000000000068154ea682f95bf582b80dd6453fa401737491dc606090811b8216938501939093526001600160e01b03197f0000000000000000000000000000000000000000000000000000000000049d4060e01b166054850152605884018790527f000000000000000000000000e78996a233895be74a66f451f1019ca9734205cc831b811660788501523090921b909116608c830152600060a083018190529092509060c00160408051808303601f19018152908290528051602090910120634f8812e360e11b82526004820181905291507f000000000000000000000000e78996a233895be74a66f451f1019ca9734205cc6001600160a01b031690639f1025c690602401602060405180830381865afa1580156113ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113cf9190612561565b63ffffffff16156113e35791506114c49050565b604051631212e4f160e21b81526001600160a01b037f000000000000000000000000e78996a233895be74a66f451f1019ca9734205cc169063484b93c49061147c9089908b907f00000000000000000000000068154ea682f95bf582b80dd6453fa401737491dc907f0000000000000000000000000000000000000000000000000000000000049d40908c906000908d9060040161257e565b6020604051808303816000875af115801561149b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114bf91906124d8565b925050505b949350505050565b6000807f000000000000000000000000ceafdd6bc0bef976fdcd1112955828e00543c0ce6001600160a01b031663852c6ae27f000000000000000000000000c260adfac11f97c001dc143d2a4f45b98e0f2d6c86866040518463ffffffff1660e01b815260040161153f939291906125ce565b602060405180830381865afa15801561155c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158091906124d8565b604051636a16e06160e11b8152600481018290529091507f000000000000000000000000ceafdd6bc0bef976fdcd1112955828e00543c0ce6001600160a01b03169063d42dc0c290602401602060405180830381865afa1580156115e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160c91906124d8565b6000036116b65760405163365bb9d560e21b81526001600160a01b037f000000000000000000000000ceafdd6bc0bef976fdcd1112955828e00543c0ce169063d96ee75490611683907f000000000000000000000000c260adfac11f97c001dc143d2a4f45b98e0f2d6c90889088906004016125ce565b600060405180830381600087803b15801561169d57600080fd5b505af11580156116b1573d6000803e3d6000fd5b505050505b90505b92915050565b60608060006116cf60018661206e565b9050846001600160401b038111156116e9576116e9611c89565b604051908082528060200260200182016040528015611712578160200160208202803683370190505b509250846001600160401b0381111561172d5761172d611c89565b60405190808252806020026020018201604052801561176057816020015b606081526020019060019003908161174b5790505b50915060005b85811015611ae95760405163856296f760e01b815260048101899052602481018890526001821b60448201526000907f000000000000000000000000ceafdd6bc0bef976fdcd1112955828e00543c0ce6001600160a01b03169063856296f790606401602060405180830381865afa1580156117e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061180a91906124d8565b60405163039dd75360e41b81526001600160a01b037f000000000000000000000000af204776c7245bf4147c2612bf6e5972ee48370181166004830152602482018390529192506000917f000000000000000000000000ceafdd6bc0bef976fdcd1112955828e00543c0ce16906339dd753090604401602060405180830381865afa15801561189d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118c191906124d8565b9050838314806118ec57508683815181106118de576118de611ce5565b602002602001015151600014155b61192d5760405162461bcd60e51b81526020600482015260126024820152714d697373696e6720746f6b656e206e616d6560701b60448201526064016102fa565b60006119818585146119585788858151811061194b5761194b611ce5565b6020026020010151611af4565b6040518060400160405280600b81526020016a14d1548b5253959053125160aa1b815250611af4565b61199d8686146119585789868151811061194b5761194b611ce5565b604080516020810193909352820152600960f91b606082015260610160408051601f1981840301815290829052631892c08760e11b825291506000906001600160a01b037f000000000000000000000000d194319d1804c1051dd21ba1dc931ca72410b79f1690633125810e90611a3c907f000000000000000000000000ceafdd6bc0bef976fdcd1112955828e00543c0ce90879087906004016125ef565b6020604051808303816000875af1158015611a5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a7f9190612616565b905080888681518110611a9457611a94611ce5565b60200260200101906001600160a01b031690816001600160a01b03168152505081878681518110611ac757611ac7611ce5565b6020026020010181905250505050508080611ae1906120b1565b915050611766565b505094509492505050565b805160009060208110611b3b5760405162461bcd60e51b815260206004820152600f60248201526e737472696e6720746f6f206c6f6e6760881b60448201526064016102fa565b6020830151915060006003826020611b53919061206e565b600019911b1b9290921660019190911b1792915050565b600060208284031215611b7c57600080fd5b81356001600160401b03811115611b9257600080fd5b82016101c081850312156116b657600080fd5b6020808252825182820181905260009190848201906040850190845b81811015611be65783516001600160a01b031683529284019291840191600101611bc1565b50909695505050505050565b600060208284031215611c0457600080fd5b5035919050565b6000808335601e19843603018112611c2257600080fd5b8301803591506001600160401b03821115611c3c57600080fd5b6020019150600581901b36038213156111c257600080fd5b6020808252818101527f4f7574636f6d657320636f756e74206d7573742062652032206f72206d6f7265604082015260600190565b634e487b7160e01b600052604160045260246000fd5b6000808335601e19843603018112611cb657600080fd5b8301803591506001600160401b03821115611cd057600080fd5b6020019150368190038213156111c257600080fd5b634e487b7160e01b600052603260045260246000fd5b6040516101c081016001600160401b0381118282101715611d1e57611d1e611c89565b60405290565b604051601f8201601f191681016001600160401b0381118282101715611d4c57611d4c611c89565b604052919050565b600082601f830112611d6557600080fd5b81356001600160401b03811115611d7e57611d7e611c89565b611d91601f8201601f1916602001611d24565b818152846020838601011115611da657600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112611dd457600080fd5b813560206001600160401b0380831115611df057611df0611c89565b8260051b611dff838201611d24565b9384528581018301938381019088861115611e1957600080fd5b84880192505b85831015611e5557823584811115611e375760008081fd5b611e458a87838c0101611d54565b8352509184019190840190611e1f565b98975050505050505050565b6001600160a01b0381168114611e7657600080fd5b50565b803561123681611e61565b63ffffffff81168114611e7657600080fd5b803561123681611e84565b60006101c08236031215611eb457600080fd5b611ebc611cfb565b82356001600160401b0380821115611ed357600080fd5b611edf36838701611d54565b83526020850135915080821115611ef557600080fd5b611f0136838701611dc3565b60208401526040850135915080821115611f1a57600080fd5b611f2636838701611d54565b60408401526060850135915080821115611f3f57600080fd5b611f4b36838701611d54565b60608401526080850135915080821115611f6457600080fd5b611f7036838701611d54565b608084015260a085013560a0840152611f8b60c08601611e79565b60c084015260e0850135915080821115611fa457600080fd5b611fb036838701611d54565b60e084015261010091508185013581811115611fcb57600080fd5b611fd736828801611d54565b92840192909252610120858101359084015261014080860135908401526101608086013590840152610180915061200f828601611e96565b828401526101a09150818501358181111561202957600080fd5b61203536828801611dc3565b8385015250505080915050919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156116b9576116b9612045565b818103818111156116b9576116b9612045565b85878237600086820160008152858782376000908601908152838582376000930192835250909695505050505050565b6000600182016120c3576120c3612045565b5060010190565b858782376000868201605b60f81b815285876001830137605d60f81b600191870191820152838560028301376000930160020192835250909695505050505050565b601160f91b8082526000908385600185013792909101600181019290925250600201919050565b60005b8381101561214e578181015183820152602001612136565b50506000910152565b60008451612169818460208901612133565b61161160f11b90830190815283856002830137601160f91b93016002810193909352505060030192915050565b6000885160206121a98285838e01612133565b8951918401916121bc8184848e01612133565b89519201916121ce8184848d01612133565b88519201916121e08184848c01612133565b87519201916121f28184848b01612133565b86519201916122048184848a01612133565b85519201916122168184848901612133565b919091019a9950505050505050505050565b60008151808452612240816020860160208601612133565b601f01601f19169290920160200192915050565b600081518084526020808501808196508360051b8101915082860160005b8581101561229c57828403895261228a848351612228565b98850198935090840190600101612272565b5091979650505050505050565b600081518084526020808501945080840160005b838110156122d9578151875295820195908201906001016122bd565b509495945050505050565b60008151606084526122f960608501826122a9565b9050602083015160208501526040830151848203604086015261231c8282612254565b95945050505050565b60e08152600061233860e083018a612228565b60208382038185015261234b828b612254565b9150886040850152876060850152838203608085015260e0820187518352818801518284015260408801516040840152606088015160018060a01b03808216606086015260808a0151608086015260a08a0151915060e060a0860152828251808552610100870191508584019450600093505b808410156123e0578451831682529385019360019390930192908501906123be565b5060c08b0151945085810360c08701526123fa8186612254565b9550505050505082810360a084015261241381866122e4565b915050611e5560c08301846001600160a01b03169052565b60a08152600061243e60a0830188612228565b6001600160a01b038716602084015260408301869052606083018590528281036080840152611e5581856122a9565b6000865161247f818460208b01612133565b865190830190612493818360208b01612133565b86519101906124a6818360208a01612133565b85519101906124b9818360208901612133565b84519101906124cc818360208801612133565b01979650505050505050565b6000602082840312156124ea57600080fd5b5051919050565b60a08152600061250460a08301886122a9565b90508560208301528460408301528360608301528260808301529695505050505050565b83815263ffffffff60e01b8360e01b16602082015260008251612552816024850160208701612133565b91909101602401949350505050565b60006020828403121561257357600080fd5b81516116b681611e84565b87815260e06020820152600061259760e0830189612228565b6001600160a01b039790971660408301525063ffffffff948516606082015292909316608083015260a082015260c0015292915050565b6001600160a01b039390931683526020830191909152604082015260600190565b60018060a01b038416815282602082015260606040820152600061231c6060830184612228565b60006020828403121561262857600080fd5b81516116b681611e6156fea26469706673582212203da16d07f23bea98f51d67a9c2d98f668cf635d62ddad6fdb686a3da921f46a964736f6c63430008140033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.