Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
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:
StarkPerpetual
Compiler Version
v0.6.11+commit.5ef660b1
Contract Source Code (Solidity Multiple files format)
/* Copyright 2019,2020 StarkWare Industries Ltd. Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.starkware.co/open-source-license/ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // SPDX-License-Identifier: Apache-2.0. pragma solidity ^0.6.11; import "MainDispatcher.sol"; import "PerpetualStorage.sol"; contract StarkPerpetual is MainDispatcher, PerpetualStorage { string public constant VERSION = "1.0.0"; // Salt for a 8 bit unique spread of all relevant selectors. Pre-caclulated. // ---------- The following code was auto-generated. PLEASE DO NOT EDIT. ---------- uint256 constant MAGIC_SALT = 15691; uint256 constant IDX_MAP_0 = 0x3000000002000200000000000220022100000102300010000030103200010000; uint256 constant IDX_MAP_1 = 0x1410000000002200200000002003321010000210132000020000; uint256 constant IDX_MAP_2 = 0x3031200400000004003320020000000012022120020030000003000020; uint256 constant IDX_MAP_3 = 0x100200003000100000000000000320000410000003000030000101210000000; // ---------- End of auto-generated code. ---------- function getNumSubcontracts() internal pure override returns (uint256) { return 4; } function magicSalt() internal pure override returns(uint256) { return MAGIC_SALT; } function handlerMapSection(uint256 section) internal view override returns(uint256) { if(section == 0) { return IDX_MAP_0; } else if(section == 1) { return IDX_MAP_1; } else if(section == 2) { return IDX_MAP_2; } else if(section == 3) { return IDX_MAP_3; } revert("BAD_IDX_MAP_SECTION"); } function expectedIdByIndex(uint256 index) internal pure override returns (string memory id) { if (index == 1){ id = "StarkWare_AllVerifiers_2020_1"; } else if (index == 2){ id = "StarkWare_PerpetualTokensAndRamping_2020_1"; } else if (index == 3){ id = "StarkWare_PerpetualState_2020_1"; } else if (index == 4){ id = "StarkWare_PerpetualForcedActions_2020_1"; } else { revert("UNEXPECTED_INDEX"); } } function initializationSentinel() internal view override { string memory REVERT_MSG = "INITIALIZATION_BLOCKED"; // This initializer sets state etc. It must not be applied twice. // I.e. it can run only when the state is still empty. require(int(sharedStateHash) == 0, REVERT_MSG); require(int(globalConfigurationHash) == 0, REVERT_MSG); require(systemAssetType == 0, REVERT_MSG); } }
/* Copyright 2019,2020 StarkWare Industries Ltd. Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.starkware.co/open-source-license/ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // SPDX-License-Identifier: Apache-2.0. pragma solidity ^0.6.11; /* Common Utility librarries. I. Addresses (extending address). */ library Addresses { function isContract(address account) internal view returns (bool) { uint256 size; assembly { size := extcodesize(account) } return size > 0; } function performEthTransfer(address recipient, uint256 amount) internal { (bool success, ) = recipient.call{value: amount}(""); // NOLINT: low-level-calls. require(success, "ETH_TRANSFER_FAILED"); } /* Safe wrapper around ERC20/ERC721 calls. This is required because many deployed ERC20 contracts don't return a value. See https://github.com/ethereum/solidity/issues/4116. */ function safeTokenContractCall(address tokenAddress, bytes memory callData) internal { require(isContract(tokenAddress), "BAD_TOKEN_ADDRESS"); // NOLINTNEXTLINE: low-level-calls. (bool success, bytes memory returndata) = tokenAddress.call(callData); require(success, string(returndata)); if (returndata.length > 0) { require(abi.decode(returndata, (bool)), "TOKEN_OPERATION_FAILED"); } } /* Similar to safeTokenContractCall, but always ignores the return value. Assumes some other method is used to detect the failures (e.g. balance is checked before and after the call). */ function uncheckedTokenContractCall(address tokenAddress, bytes memory callData) internal { // NOLINTNEXTLINE: low-level-calls. (bool success, bytes memory returndata) = tokenAddress.call(callData); require(success, string(returndata)); } } library UintArray { function hashSubArray(uint256[] memory array, uint256 subArrayStart, uint256 subArraySize) internal pure returns(bytes32 subArrayHash) { require(array.length >= subArrayStart + subArraySize, "ILLEGAL_SUBARRAY_DIMENSIONS"); uint256 startOffsetBytes = 0x20 * (1 + subArrayStart); uint256 dataSizeBytes = 0x20 * subArraySize; assembly { subArrayHash := keccak256(add(array, startOffsetBytes), dataSizeBytes) } } /* Returns the address of a cell in offset within a uint256[] array. This allows assigning new variable of dynamic unit256[] pointing to a sub_array with a layout of serialied uint256[] (i.e. length+content). */ function extractSerializedUintArray(uint256[] memory programOutput, uint256 offset) internal pure returns (uint256[] memory addr) { uint256 memOffset = 0x20 * (offset + 1); assembly { addr := add(programOutput, memOffset) } } } /* II. StarkExTypes - Common data types. */ library StarkExTypes { // Structure representing a list of verifiers (validity/availability). // A statement is valid only if all the verifiers in the list agree on it. // Adding a verifier to the list is immediate - this is used for fast resolution of // any soundness issues. // Removing from the list is time-locked, to ensure that any user of the system // not content with the announced removal has ample time to leave the system before it is // removed. struct ApprovalChainData { address[] list; // Represents the time after which the verifier with the given address can be removed. // Removal of the verifier with address A is allowed only in the case the value // of unlockedForRemovalTime[A] != 0 and unlockedForRemovalTime[A] < (current time). mapping (address => uint256) unlockedForRemovalTime; } }
/* Copyright 2019,2020 StarkWare Industries Ltd. Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.starkware.co/open-source-license/ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // SPDX-License-Identifier: Apache-2.0. pragma solidity ^0.6.11; /* Holds the governance slots for ALL entities, including proxy and the main contract. */ contract GovernanceStorage { struct GovernanceInfoStruct { mapping (address => bool) effectiveGovernors; address candidateGovernor; bool initialized; } // A map from a Governor tag to its own GovernanceInfoStruct. mapping (string => GovernanceInfoStruct) internal governanceInfo; }
/* Copyright 2019,2020 StarkWare Industries Ltd. Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.starkware.co/open-source-license/ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // SPDX-License-Identifier: Apache-2.0. pragma solidity ^0.6.11; interface Identity { /* Allows a caller, typically another contract, to ensure that the provided address is of the expected type and version. */ function identify() external pure returns(string memory); }
/* Copyright 2019,2020 StarkWare Industries Ltd. Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.starkware.co/open-source-license/ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // SPDX-License-Identifier: Apache-2.0. pragma solidity ^0.6.11; /* Interface for generic dispatcher to use, which the concrete dispatcher must implement. I contains the functions that are specific to the concrete dispatcher instance. The interface is implemented as contract, because interface implies all methods external. */ abstract contract IDispatcherBase { function getSubContract(bytes4 selector) internal view virtual returns (address); function setSubContractAddress(uint256 index, address subContract) internal virtual; function getNumSubcontracts() internal pure virtual returns (uint256); function validateSubContractIndex(uint256 index, address subContract) internal pure virtual; /* Ensures initializer can be called. Reverts otherwise. */ function initializationSentinel() internal view virtual; }
/* Copyright 2019,2020 StarkWare Industries Ltd. Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.starkware.co/open-source-license/ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // SPDX-License-Identifier: Apache-2.0. pragma solidity ^0.6.11; /* The Fact Registry design pattern is a way to separate cryptographic verification from the business logic of the contract flow. A fact registry holds a hash table of verified "facts" which are represented by a hash of claims that the registry hash check and found valid. This table may be queried by accessing the isValid() function of the registry with a given hash. In addition, each fact registry exposes a registry specific function for submitting new claims together with their proofs. The information submitted varies from one registry to the other depending of the type of fact requiring verification. For further reading on the Fact Registry design pattern see this `StarkWare blog post <https://medium.com/starkware/the-fact-registry-a64aafb598b6>`_. */ interface IFactRegistry { /* Returns true if the given fact was previously registered in the contract. */ function isValid(bytes32 fact) external view returns(bool); }
/* Copyright 2019,2020 StarkWare Industries Ltd. Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.starkware.co/open-source-license/ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // SPDX-License-Identifier: Apache-2.0. pragma solidity ^0.6.11; import "MainStorage.sol"; import "MainDispatcherBase.sol"; abstract contract MainDispatcher is MainStorage, MainDispatcherBase { uint256 constant SUBCONTRACT_BITS = 4; function magicSalt() internal pure virtual returns(uint256); function handlerMapSection(uint256 section) internal view virtual returns(uint256); function expectedIdByIndex(uint256 index) internal pure virtual returns (string memory id); function validateSubContractIndex(uint256 index, address subContract) internal pure override { string memory id = SubContractor(subContract).identify(); bytes32 hashed_expected_id = keccak256(abi.encodePacked(expectedIdByIndex(index))); require( hashed_expected_id == keccak256(abi.encodePacked(id)), "MISPLACED_INDEX_OR_BAD_CONTRACT_ID" ); } function getSubContract(bytes4 selector) internal view override returns (address) { uint256 location = 0xFF & uint256(keccak256(abi.encodePacked(selector, magicSalt()))); uint256 subContractIdx; uint256 offset = (SUBCONTRACT_BITS * location) % 256; // We have 64 locations in each register, hence the >>6 (i.e. location // 64). subContractIdx = (handlerMapSection(location >> 6) >> offset) & 0xF; return subContracts[subContractIdx]; } function setSubContractAddress(uint256 index, address subContractAddress) internal override { subContracts[index] = subContractAddress; } }
/* Copyright 2019,2020 StarkWare Industries Ltd. Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.starkware.co/open-source-license/ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // SPDX-License-Identifier: Apache-2.0. pragma solidity ^0.6.11; import "SubContractor.sol"; import "IDispatcherBase.sol"; import "Common.sol"; import "StorageSlots.sol"; abstract contract MainDispatcherBase is IDispatcherBase, StorageSlots { using Addresses for address; constructor( ) internal { bytes32 slot = MAIN_DISPATCHER_SAFEGUARD_SLOT; assembly { sstore(slot, 42) } } modifier notCalledDirectly() { { // Prevent too many local variables in stack. uint256 safeGuardValue; bytes32 slot = MAIN_DISPATCHER_SAFEGUARD_SLOT; assembly { safeGuardValue := sload(slot) } require(safeGuardValue == 0, "DIRECT_CALL_DISALLOWED"); } _; } fallback() external payable { //NOLINT locked-ether. address subContractAddress = getSubContract(msg.sig); require(subContractAddress != address(0x0), "NO_CONTRACT_FOR_FUNCTION"); assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 for now, as we don"t know the out size yet. let result := delegatecall(gas(), subContractAddress, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /* 1. Extract subcontracts. 2. Verify correct sub-contract initializer size. 3. Extract sub-contract initializer data. 4. Call sub-contract initializer. The init data bytes passed to initialize are structed as following: I. N slots (uin256 size) addresses of the deployed sub-contracts. II. An address of an external initialization contract (optional, or ZERO_ADDRESS). III. (Up to) N bytes sections of the sub-contracts initializers. If already initialized (i.e. upgrade) we expect the init data to be consistent with this. and if a different size of init data is expected when upgrading, the initializerSize should reflect this. If an external initializer contract is not used, ZERO_ADDRESS is passed in its slot. If the external initializer contract is used, all the remaining init data is passed to it, and internal initialization will not occur. External Initialization Contract -------------------------------- External Initialization Contract (EIC) is a hook for custom initialization. Typically in an upgrade flow, the expected initialization contains only the addresses of the sub-contracts. Normal initialization of the sub-contracts is such that is not needed in an upgrade, and actually may be very dangerous, as changing of state on a working system may corrupt it. In the event that some state initialization is required, the EIC is a hook that allows this. It may be deployed and called specifically for this purpose. The address of the EIC must be provided (if at all) when a new implementation is added to a Proxy contract (as part of the initialization vector). Hence, it is considered part of the code open to reviewers prior to a time-locked upgrade. When a custom initialization is performed using an EIC, the main dispatcher initialize extracts and stores the sub-contracts addresses, and then yields to the EIC, skipping the rest of its initialization code. Flow of MainDispatcher initialize --------------------------------- 1. Extraction and assignment of subcontracts addresses Main dispatcher expects a valid and consistent set of addresses in the passed data. It validates that, extracts the addresses from the data, and validates that the addresses are of the expected type and order. Then those addresses are stored. 2. Extraction of EIC address The address of the EIC is extracted from the data. External Initializer Contract is optional. ZERO_ADDRESS indicates it is not used. 3a. EIC is used Dispatcher calls the EIC initialize function with the remaining data. Note - In this option 3b is not performed. 3b. EIC is not used If there is additional initialization data then: I. Sentitenl function is called to permit subcontracts initialization. II. Dispatcher loops through the subcontracts and for each one it extracts the initializing data and passes it to the subcontract's initialize function. */ // NOLINTNEXTLINE: external-function. function initialize(bytes memory data) public virtual notCalledDirectly() { // Number of sub-contracts. uint256 nSubContracts = getNumSubcontracts(); // We support currently 4 bits per contract, i.e. 16, reserving 00 leads to 15. require(nSubContracts <= 15, "TOO_MANY_SUB_CONTRACTS"); // Init data MUST include addresses for all sub-contracts + EIC. require(data.length >= 32 * (nSubContracts + 1), "SUB_CONTRACTS_NOT_PROVIDED"); // Ensure implementation is a valid contract. require(implementation().isContract(), "INVALID_IMPLEMENTATION"); // Size of passed data, excluding sub-contract addresses. uint256 additionalDataSize = data.length - 32 * (nSubContracts + 1); // Sum of subcontract initializers. Aggregated for verification near the end. uint256 totalInitSizes = 0; // Offset (within data) of sub-contract initializer vector. // Just past the sub-contract addresses. uint256 initDataContractsOffset = 32 * (nSubContracts + 1); // Extract & update contract addresses. for (uint256 nContract = 1; nContract <= nSubContracts; nContract++) { address contractAddress; // Extract sub-contract address. assembly { contractAddress := mload(add(data, mul(32, nContract))) } validateSubContractIndex(nContract, contractAddress); // Contracts are indexed from 1 and 0 is not in use here. setSubContractAddress(nContract, contractAddress); } // Check if we have an external initializer contract. address externalInitializerAddr; // 2. Extract sub-contract address, again. It's cheaper than reading from storage. assembly { externalInitializerAddr := mload(add(data, mul(32, add(nSubContracts, 1)))) } // 3(a). Yield to EIC initialization. if (externalInitializerAddr != address(0x0)) { callExternalInitializer(data, externalInitializerAddr, additionalDataSize); return; } // 3(b). Subcontracts initialization. // I. If no init data passed besides sub-contracts, return. if (additionalDataSize == 0) { return; } // Just to be on the safe side. assert(externalInitializerAddr == address(0x0)); // II. Gate further initialization. initializationSentinel(); // III. Loops through the subcontracts, extracts their data and calls their initializer. for (uint256 nContract = 1; nContract <= nSubContracts; nContract++) { address contractAddress; // Extract sub-contract address, again. It's cheaper than reading from storage. assembly { contractAddress := mload(add(data, mul(32, nContract))) } // The initializerSize returns the expected size, with respect also to the state status. // i.e. different size if it's a first init (clean state) or upgrade init (alive state). // NOLINTNEXTLINE: calls-loop. // The initializerSize is called via delegatecall, so that it can relate to the state, // and not only to the new contract code. (e.g. return 0 if state-intialized else 192). // NOLINTNEXTLINE: reentrancy-events low-level-calls calls-loop. (bool success, bytes memory returndata) = contractAddress.delegatecall( abi.encodeWithSelector(SubContractor(contractAddress).initializerSize.selector)); require(success, string(returndata)); uint256 initSize = abi.decode(returndata, (uint256)); require(initSize <= additionalDataSize, "INVALID_INITIALIZER_SIZE"); require(totalInitSizes + initSize <= additionalDataSize, "INVALID_INITIALIZER_SIZE"); if (initSize == 0) { continue; } // Extract sub-contract init vector. bytes memory subContractInitData = new bytes(initSize); for (uint256 trgOffset = 32; trgOffset <= initSize; trgOffset += 32) { assembly { mstore( add(subContractInitData, trgOffset), mload(add(add(data, trgOffset), initDataContractsOffset)) ) } } // Call sub-contract initializer. // NOLINTNEXTLINE: low-level-calls. (success, returndata) = contractAddress.delegatecall( abi.encodeWithSelector(this.initialize.selector, subContractInitData) ); require(success, string(returndata)); totalInitSizes += initSize; initDataContractsOffset += initSize; } require( additionalDataSize == totalInitSizes, "MISMATCHING_INIT_DATA_SIZE"); } function callExternalInitializer( bytes memory data, address externalInitializerAddr, uint256 dataSize) private { require(externalInitializerAddr.isContract(), "NOT_A_CONTRACT"); require(dataSize <= data.length, "INVALID_DATA_SIZE"); bytes memory extInitData = new bytes(dataSize); // Prepare memcpy pointers. uint256 srcDataOffset = 32 + data.length - dataSize; uint256 srcData; uint256 trgData; assembly { srcData := add(data, srcDataOffset) trgData := add(extInitData, 32) } // Copy initializer data to be passed to the EIC. for (uint256 seek = 0; seek < dataSize; seek += 32) { assembly { mstore( add(trgData, seek), mload(add(srcData, seek)) ) } } // NOLINTNEXTLINE: low-level-calls. (bool success, bytes memory returndata) = externalInitializerAddr.delegatecall( abi.encodeWithSelector(this.initialize.selector, extInitData) ); require(success, string(returndata)); require(returndata.length == 0, string(returndata)); } }
/* Copyright 2019,2020 StarkWare Industries Ltd. Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.starkware.co/open-source-license/ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // SPDX-License-Identifier: Apache-2.0. pragma solidity ^0.6.11; import "IFactRegistry.sol"; import "ProxyStorage.sol"; import "Common.sol"; /* Holds ALL the main contract state (storage) variables. */ contract MainStorage is ProxyStorage { uint256 constant internal LAYOUT_LENGTH = 2**64; IFactRegistry escapeVerifier_; // Global dex-frozen flag. bool stateFrozen; // NOLINT: constable-states. // Time when unFreeze can be successfully called (UNFREEZE_DELAY after freeze). uint256 unFreezeTime; // NOLINT: constable-states. // Pending deposits. // A map STARK key => asset id => vault id => quantized amount. mapping (uint256 => mapping (uint256 => mapping (uint256 => uint256))) pendingDeposits; // Cancellation requests. // A map STARK key => asset id => vault id => request timestamp. mapping (uint256 => mapping (uint256 => mapping (uint256 => uint256))) cancellationRequests; // Pending withdrawals. // A map STARK key => asset id => quantized amount. mapping (uint256 => mapping (uint256 => uint256)) pendingWithdrawals; // vault_id => escape used boolean. mapping (uint256 => bool) escapesUsed; // Number of escapes that were performed when frozen. uint256 escapesUsedCount; // NOLINT: constable-states. // NOTE: fullWithdrawalRequests is deprecated, and replaced by forcedActionRequests. // NOLINTNEXTLINE naming-convention. mapping (uint256 => mapping (uint256 => uint256)) fullWithdrawalRequests_DEPRECATED; // State sequence number. uint256 sequenceNumber; // NOLINT: constable-states uninitialized-state. // Vaults Tree Root & Height. uint256 vaultRoot; // NOLINT: constable-states uninitialized-state. uint256 vaultTreeHeight; // NOLINT: constable-states uninitialized-state. // Order Tree Root & Height. uint256 orderRoot; // NOLINT: constable-states uninitialized-state. uint256 orderTreeHeight; // NOLINT: constable-states uninitialized-state. // True if and only if the address is allowed to add tokens. mapping (address => bool) tokenAdmins; // True if and only if the address is allowed to register users. mapping (address => bool) userAdmins; // True if and only if the address is an operator (allowed to update state). mapping (address => bool) operators; // Mapping of contract ID to asset data. mapping (uint256 => bytes) assetTypeToAssetInfo; // NOLINT: uninitialized-state. // Mapping of registered contract IDs. mapping (uint256 => bool) registeredAssetType; // NOLINT: uninitialized-state. // Mapping from contract ID to quantum. mapping (uint256 => uint256) assetTypeToQuantum; // NOLINT: uninitialized-state. // This mapping is no longer in use, remains for backwards compatibility. mapping (address => uint256) starkKeys_DEPRECATED; // NOLINT: naming-convention. // Mapping from STARK public key to the Ethereum public key of its owner. mapping (uint256 => address) ethKeys; // NOLINT: uninitialized-state. // Timelocked state transition and availability verification chain. StarkExTypes.ApprovalChainData verifiersChain; StarkExTypes.ApprovalChainData availabilityVerifiersChain; // Batch id of last accepted proof. uint256 lastBatchId; // NOLINT: constable-states uninitialized-state. // Mapping between sub-contract index to sub-contract address. mapping(uint256 => address) subContracts; // NOLINT: uninitialized-state. mapping (uint256 => bool) permissiveAssetType_DEPRECATED; // NOLINT: naming-convention. // ---- END OF MAIN STORAGE AS DEPLOYED IN STARKEX2.0 ---- // Onchain-data version configured for the system. uint256 onchainDataVersion; // NOLINT: constable-states uninitialized-state. // Counter of forced action request in block. The key is the block number. mapping(uint256 => uint256) forcedRequestsInBlock; // ForcedAction requests: actionHash => requestTime. mapping(bytes32 => uint256) forcedActionRequests; // Mapping for timelocked actions. // A actionKey => activation time. mapping (bytes32 => uint256) actionsTimeLock; // Reserved storage space for Extensibility. // Every added MUST be added above the end gap, and the __endGap size must be reduced // accordingly. // NOLINTNEXTLINE: naming-convention. uint256[LAYOUT_LENGTH - 36] private __endGap; // __endGap complements layout to LAYOUT_LENGTH. }
/* Copyright 2019,2020 StarkWare Industries Ltd. Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.starkware.co/open-source-license/ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // SPDX-License-Identifier: Apache-2.0. pragma solidity ^0.6.11; import "MainStorage.sol"; /* Extends MainStorage, holds Perpetual App specific state (storage) variables. ALL State variables that are common to all applications, reside in MainStorage, whereas ALL the Perpetual app specific ones reside here. */ contract PerpetualStorage is MainStorage { uint256 systemAssetType; // NOLINT: constable-states uninitialized-state. bytes32 public globalConfigurationHash; // NOLINT: constable-states uninitialized-state. mapping(uint256 => bytes32) public configurationHash; // NOLINT: uninitialized-state. bytes32 sharedStateHash; // NOLINT: constable-states uninitialized-state. // Configuration apply time-lock. // The delay is held in storage (and not constant) // So that it can be modified during upgrade. uint256 public configurationDelay; // NOLINT: constable-states. // Reserved storage space for Extensibility. // Every added MUST be added above the end gap, and the __endGap size must be reduced // accordingly. // NOLINTNEXTLINE: naming-convention shadowing-abstract. uint256[LAYOUT_LENGTH - 5] private __endGap; // __endGap complements layout to LAYOUT_LENGTH. }
/* Copyright 2019,2020 StarkWare Industries Ltd. Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.starkware.co/open-source-license/ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // SPDX-License-Identifier: Apache-2.0. pragma solidity ^0.6.11; import "GovernanceStorage.sol"; /* Holds the Proxy-specific state variables. This contract is inherited by the GovernanceStorage (and indirectly by MainStorage) to prevent collision hazard. */ contract ProxyStorage is GovernanceStorage { // Stores the hash of the initialization vector of the added implementation. // Upon upgradeTo the implementation, the initialization vector is verified // to be identical to the one submitted when adding the implementation. mapping (address => bytes32) internal initializationHash; // The time after which we can switch to the implementation. mapping (address => uint256) internal enabledTime; // A central storage of the flags whether implementation has been initialized. // Note - it can be used flexibly enough to accommodate multiple levels of initialization // (i.e. using different key salting schemes for different initialization levels). mapping (bytes32 => bool) internal initialized; }
/* Copyright 2019,2020 StarkWare Industries Ltd. Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.starkware.co/open-source-license/ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // SPDX-License-Identifier: Apache-2.0. pragma solidity ^0.6.11; /** StorageSlots holds the arbitrary storage slots used throughout the Proxy pattern. Storage address slots are a mechanism to define an arbitrary location, that will not be overlapped by the logical contracts. */ contract StorageSlots { /* Returns the address of the current implementation. */ // NOLINTNEXTLINE external-function. function implementation() public view returns(address _implementation) { bytes32 slot = IMPLEMENTATION_SLOT; assembly { _implementation := sload(slot) } } // Storage slot with the address of the current implementation. // The address of the slot is keccak256("StarkWare2019.implemntation-slot"). // We need to keep this variable stored outside of the commonly used space, // so that it's not overrun by the logical implementation (the proxied contract). bytes32 internal constant IMPLEMENTATION_SLOT = 0x177667240aeeea7e35eabe3a35e18306f336219e1386f7710a6bf8783f761b24; // Storage slot with the address of the call-proxy current implementation. // The address of the slot is keccak256("'StarkWare2020.CallProxy.Implemntation.Slot'"). // We need to keep this variable stored outside of the commonly used space. // so that it's not overrun by the logical implementation (the proxied contract). bytes32 internal constant CALL_PROXY_IMPL_SLOT = 0x7184681641399eb4ad2fdb92114857ee6ff239f94ad635a1779978947b8843be; // This storage slot stores the finalization flag. // Once the value stored in this slot is set to non-zero // the proxy blocks implementation upgrades. // The current implementation is then referred to as Finalized. // Web3.solidityKeccak(['string'], ["StarkWare2019.finalization-flag-slot"]). bytes32 internal constant FINALIZED_STATE_SLOT = 0x7d433c6f837e8f93009937c466c82efbb5ba621fae36886d0cac433c5d0aa7d2; // Storage slot to hold the upgrade delay (time-lock). // The intention of this slot is to allow modification using an EIC. // Web3.solidityKeccak(['string'], ['StarkWare.Upgradibility.Delay.Slot']). bytes32 public constant UPGRADE_DELAY_SLOT = 0xc21dbb3089fcb2c4f4c6a67854ab4db2b0f233ea4b21b21f912d52d18fc5db1f; // Storage slot to hold the MainDispatcher init safeguard. // Web3.solidityKeccak(['string'], ['StarkWare.MainDispatcher.Init.Safeguard.Slot']). bytes32 public constant MAIN_DISPATCHER_SAFEGUARD_SLOT = 0xf3afa5472f846c7817e22b15110d7b184f2d3d6417baee645a1e963b8fac7e24; }
/* Copyright 2019,2020 StarkWare Industries Ltd. Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.starkware.co/open-source-license/ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // SPDX-License-Identifier: Apache-2.0. pragma solidity ^0.6.11; import "Identity.sol"; interface SubContractor is Identity { function initialize(bytes calldata data) external; function initializerSize() external view returns(uint256); }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"MAIN_DISPATCHER_SAFEGUARD_SLOT","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADE_DELAY_SLOT","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"configurationDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"configurationHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"globalConfigurationHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"_implementation","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50602a7ff3afa5472f846c7817e22b15110d7b184f2d3d6417baee645a1e963b8fac7e24556114ad806100446000396000f3fe60806040526004361061006b5760003560e01c806314778a83146100fe57806320cea94d14610125578063439fab911461013a5780635c60da1b146101ed578063adac3e151461021e578063c1a8513014610233578063f2011f6614610248578063ffa1ad7414610272575b60006100826000356001600160e01b0319166102fc565b90506001600160a01b0381166100da576040805162461bcd60e51b81526020600482015260186024820152772727afa1a7a72a2920a1aa2fa327a92fa32aa721aa24a7a760411b604482015290519081900360640190fd5b3660008037600080366000845af43d6000803e8080156100f9573d6000f35b3d6000fd5b34801561010a57600080fd5b50610113610388565b60408051918252519081900360200190f35b34801561013157600080fd5b506101136103ac565b34801561014657600080fd5b506101eb6004803603602081101561015d57600080fd5b810190602081018135600160201b81111561017757600080fd5b82018360208201111561018957600080fd5b803590602001918460018302840111600160201b831117156101aa57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506103d0945050505050565b005b3480156101f957600080fd5b50610202610a9c565b604080516001600160a01b039092168252519081900360200190f35b34801561022a57600080fd5b50610113610ac1565b34801561023f57600080fd5b50610113610acf565b34801561025457600080fd5b506101136004803603602081101561026b57600080fd5b5035610add565b34801561027e57600080fd5b50610287610af7565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102c15781810151838201526020016102a9565b50505050905090810190601f1680156102ee5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60008082610308610b18565b604080516001600160e01b03199093166020808501919091526024808501939093528151808503909301835260449093019052805191012060ff1690506000806101006004840206905080610360600685901c610b1e565b600f911c166000908152601e60205260409020546001600160a01b031693505050505b919050565b7ff3afa5472f846c7817e22b15110d7b184f2d3d6417baee645a1e963b8fac7e2481565b7fc21dbb3089fcb2c4f4c6a67854ab4db2b0f233ea4b21b21f912d52d18fc5db1f81565b7ff3afa5472f846c7817e22b15110d7b184f2d3d6417baee645a1e963b8fac7e248054908115610440576040805162461bcd60e51b81526020600482015260166024820152751112549150d517d0d0531317d11254d0531313d5d15160521b604482015290519081900360640190fd5b5050600061044c610c16565b9050600f81111561049d576040805162461bcd60e51b8152602060048201526016602482015275544f4f5f4d414e595f5355425f434f4e54524143545360501b604482015290519081900360640190fd5b80600101602002825110156104f9576040805162461bcd60e51b815260206004820152601a60248201527f5355425f434f4e5452414354535f4e4f545f50524f5649444544000000000000604482015290519081900360640190fd5b610512610504610a9c565b6001600160a01b0316610c1b565b61055c576040805162461bcd60e51b815260206004820152601660248201527524a72b20a624a22fa4a6a82622a6a2a72a20aa24a7a760511b604482015290519081900360640190fd5b8151600182810160200291829003916000915b84811161059a57602081028601516105878282610c21565b6105918282610e74565b5060010161056f565b50602060018501028501516001600160a01b038116156105c9576105bf868286610ea2565b5050505050610a99565b836105d8575050505050610a99565b6001600160a01b038116156105e957fe5b6105f16111b1565b60015b858111610a3e576020808202880151604080516004815260248101825292830180516001600160e01b0316633cc660ad60e01b1781529051835192936000936060936001600160a01b03871693918291908083835b602083106106685780518252601f199092019160209182019101610649565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146106c8576040519150601f19603f3d011682016040523d82523d6000602084013e6106cd565b606091505b509150915081819061075d5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561072257818101518382015260200161070a565b50505050905090810190601f16801561074f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600081806020019051602081101561077557600080fd5b50519050888111156107c9576040805162461bcd60e51b8152602060048201526018602482015277494e56414c49445f494e495449414c495a45525f53495a4560401b604482015290519081900360640190fd5b88818901111561081b576040805162461bcd60e51b8152602060048201526018602482015277494e56414c49445f494e495449414c495a45525f53495a4560401b604482015290519081900360640190fd5b806108295750505050610a36565b60608167ffffffffffffffff8111801561084257600080fd5b506040519080825280601f01601f19166020018201604052801561086d576020820181803683370190505b50905060205b82811161088c578c810189015182820152602001610873565b506040516020602482018181528351604484015283516001600160a01b0389169363439fab9160e01b9386939283926064019185019080838360005b838110156108e05781810151838201526020016108c8565b50505050905090810190601f16801561090d5780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909716969096178652518151919590945084935091508083835b6020831061096f5780518252601f199092019160209182019101610950565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146109cf576040519150601f19603f3d011682016040523d82523d6000602084013e6109d4565b606091505b5090945092508284610a275760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561072257818101518382015260200161070a565b50509687019695909501945050505b6001016105f4565b50828414610a93576040805162461bcd60e51b815260206004820152601a60248201527f4d49534d41544348494e475f494e49545f444154415f53495a45000000000000604482015290519081900360640190fd5b50505050505b50565b7f177667240aeeea7e35eabe3a35e18306f336219e1386f7710a6bf8783f761b245490565b680100000000000000015481565b680100000000000000045481565b680100000000000000026020526000908152604090205481565b604051806040016040528060058152602001640312e302e360dc1b81525081565b613d4b90565b600081610b4c57507f3000000002000200000000000220022100000102300010000030103200010000610383565b8160011415610b765750791410000000002200200000002003321010000210132000020000610383565b8160021415610ba357507c3031200400000004003320020000000012022120020030000003000020610383565b8160031415610bd357507f0100200003000100000000000000320000410000003000030000101210000000610383565b6040805162461bcd60e51b81526020600482015260136024820152722120a22fa4a22c2fa6a0a82fa9a2a1aa24a7a760691b604482015290519081900360640190fd5b600490565b3b151590565b6060816001600160a01b031663eeb728666040518163ffffffff1660e01b815260040160006040518083038186803b158015610c5c57600080fd5b505afa158015610c70573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015610c9957600080fd5b8101908080516040519392919084600160201b821115610cb857600080fd5b908301906020820185811115610ccd57600080fd5b8251600160201b811182820188101715610ce657600080fd5b82525081516020918201929091019080838360005b83811015610d13578181015183820152602001610cfb565b50505050905090810190601f168015610d405780820380516001836020036101000a031916815260200191505b5060405250505090506000610d54846112ea565b6040516020018082805190602001908083835b60208310610d865780518252601f199092019160209182019101610d67565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051602081830303815290604052805190602001209050816040516020018082805190602001908083835b60208310610df65780518252601f199092019160209182019101610dd7565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051602081830303815290604052805190602001208114610e6e5760405162461bcd60e51b81526004018080602001828103825260228152602001806114566022913960400191505060405180910390fd5b50505050565b6000918252601e602052604090912080546001600160a01b0319166001600160a01b03909216919091179055565b610eb4826001600160a01b0316610c1b565b610ef6576040805162461bcd60e51b815260206004820152600e60248201526d1393d517d057d0d3d395149050d560921b604482015290519081900360640190fd5b8251811115610f40576040805162461bcd60e51b8152602060048201526011602482015270494e56414c49445f444154415f53495a4560781b604482015290519081900360640190fd5b60608167ffffffffffffffff81118015610f5957600080fd5b506040519080825280601f01601f191660200182016040528015610f84576020820181803683370190505b5084519091508290036020818101918601810190830160005b85811015610fb5578281015182820152602001610f9d565b5060006060876001600160a01b031663439fab9160e01b876040516024018080602001828103825283818151815260200191508051906020019080838360005b8381101561100d578181015183820152602001610ff5565b50505050905090810190601f16801561103a5780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909716969096178652518151919590945084935091508083835b6020831061109c5780518252601f19909201916020918201910161107d565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146110fc576040519150601f19603f3d011682016040523d82523d6000602084013e611101565b606091505b50915091508181906111545760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561072257818101518382015260200161070a565b5080518190156111a55760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561072257818101518382015260200161070a565b50505050505050505050565b60408051808201909152601681527512539255125053125690551253d397d09313d0d2d15160521b602082015268010000000000000003548190156112375760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561072257818101518382015260200161070a565b5068010000000000000001548190156112915760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561072257818101518382015260200161070a565b50600160401b548190156112e65760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561072257818101518382015260200161070a565b5050565b6060816001141561132f575060408051808201909152601d81527f537461726b576172655f416c6c5665726966696572735f323032305f310000006020820152610383565b8160021415611358576040518060600160405280602a815260200161142c602a91399050610383565b816003141561139b575060408051808201909152601f81527f537461726b576172655f50657270657475616c53746174655f323032305f31006020820152610383565b81600414156113c457604051806060016040528060278152602001611405602791399050610383565b6040805162461bcd60e51b815260206004820152601060248201526f0aa9c8ab0a08a86a88a88be929c888ab60831b604482015290519081900360640190fdfe537461726b576172655f50657270657475616c466f72636564416374696f6e735f323032305f31537461726b576172655f50657270657475616c546f6b656e73416e6452616d70696e675f323032305f314d4953504c414345445f494e4445585f4f525f4241445f434f4e54524143545f4944a2646970667358221220f732ff32cb97c37dc794e14ef506707ad1e81781d8f82ca32cfc4a3b3dc759a164736f6c634300060b0033
Deployed Bytecode
0x60806040526004361061006b5760003560e01c806314778a83146100fe57806320cea94d14610125578063439fab911461013a5780635c60da1b146101ed578063adac3e151461021e578063c1a8513014610233578063f2011f6614610248578063ffa1ad7414610272575b60006100826000356001600160e01b0319166102fc565b90506001600160a01b0381166100da576040805162461bcd60e51b81526020600482015260186024820152772727afa1a7a72a2920a1aa2fa327a92fa32aa721aa24a7a760411b604482015290519081900360640190fd5b3660008037600080366000845af43d6000803e8080156100f9573d6000f35b3d6000fd5b34801561010a57600080fd5b50610113610388565b60408051918252519081900360200190f35b34801561013157600080fd5b506101136103ac565b34801561014657600080fd5b506101eb6004803603602081101561015d57600080fd5b810190602081018135600160201b81111561017757600080fd5b82018360208201111561018957600080fd5b803590602001918460018302840111600160201b831117156101aa57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506103d0945050505050565b005b3480156101f957600080fd5b50610202610a9c565b604080516001600160a01b039092168252519081900360200190f35b34801561022a57600080fd5b50610113610ac1565b34801561023f57600080fd5b50610113610acf565b34801561025457600080fd5b506101136004803603602081101561026b57600080fd5b5035610add565b34801561027e57600080fd5b50610287610af7565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102c15781810151838201526020016102a9565b50505050905090810190601f1680156102ee5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60008082610308610b18565b604080516001600160e01b03199093166020808501919091526024808501939093528151808503909301835260449093019052805191012060ff1690506000806101006004840206905080610360600685901c610b1e565b600f911c166000908152601e60205260409020546001600160a01b031693505050505b919050565b7ff3afa5472f846c7817e22b15110d7b184f2d3d6417baee645a1e963b8fac7e2481565b7fc21dbb3089fcb2c4f4c6a67854ab4db2b0f233ea4b21b21f912d52d18fc5db1f81565b7ff3afa5472f846c7817e22b15110d7b184f2d3d6417baee645a1e963b8fac7e248054908115610440576040805162461bcd60e51b81526020600482015260166024820152751112549150d517d0d0531317d11254d0531313d5d15160521b604482015290519081900360640190fd5b5050600061044c610c16565b9050600f81111561049d576040805162461bcd60e51b8152602060048201526016602482015275544f4f5f4d414e595f5355425f434f4e54524143545360501b604482015290519081900360640190fd5b80600101602002825110156104f9576040805162461bcd60e51b815260206004820152601a60248201527f5355425f434f4e5452414354535f4e4f545f50524f5649444544000000000000604482015290519081900360640190fd5b610512610504610a9c565b6001600160a01b0316610c1b565b61055c576040805162461bcd60e51b815260206004820152601660248201527524a72b20a624a22fa4a6a82622a6a2a72a20aa24a7a760511b604482015290519081900360640190fd5b8151600182810160200291829003916000915b84811161059a57602081028601516105878282610c21565b6105918282610e74565b5060010161056f565b50602060018501028501516001600160a01b038116156105c9576105bf868286610ea2565b5050505050610a99565b836105d8575050505050610a99565b6001600160a01b038116156105e957fe5b6105f16111b1565b60015b858111610a3e576020808202880151604080516004815260248101825292830180516001600160e01b0316633cc660ad60e01b1781529051835192936000936060936001600160a01b03871693918291908083835b602083106106685780518252601f199092019160209182019101610649565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146106c8576040519150601f19603f3d011682016040523d82523d6000602084013e6106cd565b606091505b509150915081819061075d5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561072257818101518382015260200161070a565b50505050905090810190601f16801561074f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600081806020019051602081101561077557600080fd5b50519050888111156107c9576040805162461bcd60e51b8152602060048201526018602482015277494e56414c49445f494e495449414c495a45525f53495a4560401b604482015290519081900360640190fd5b88818901111561081b576040805162461bcd60e51b8152602060048201526018602482015277494e56414c49445f494e495449414c495a45525f53495a4560401b604482015290519081900360640190fd5b806108295750505050610a36565b60608167ffffffffffffffff8111801561084257600080fd5b506040519080825280601f01601f19166020018201604052801561086d576020820181803683370190505b50905060205b82811161088c578c810189015182820152602001610873565b506040516020602482018181528351604484015283516001600160a01b0389169363439fab9160e01b9386939283926064019185019080838360005b838110156108e05781810151838201526020016108c8565b50505050905090810190601f16801561090d5780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909716969096178652518151919590945084935091508083835b6020831061096f5780518252601f199092019160209182019101610950565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146109cf576040519150601f19603f3d011682016040523d82523d6000602084013e6109d4565b606091505b5090945092508284610a275760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561072257818101518382015260200161070a565b50509687019695909501945050505b6001016105f4565b50828414610a93576040805162461bcd60e51b815260206004820152601a60248201527f4d49534d41544348494e475f494e49545f444154415f53495a45000000000000604482015290519081900360640190fd5b50505050505b50565b7f177667240aeeea7e35eabe3a35e18306f336219e1386f7710a6bf8783f761b245490565b680100000000000000015481565b680100000000000000045481565b680100000000000000026020526000908152604090205481565b604051806040016040528060058152602001640312e302e360dc1b81525081565b613d4b90565b600081610b4c57507f3000000002000200000000000220022100000102300010000030103200010000610383565b8160011415610b765750791410000000002200200000002003321010000210132000020000610383565b8160021415610ba357507c3031200400000004003320020000000012022120020030000003000020610383565b8160031415610bd357507f0100200003000100000000000000320000410000003000030000101210000000610383565b6040805162461bcd60e51b81526020600482015260136024820152722120a22fa4a22c2fa6a0a82fa9a2a1aa24a7a760691b604482015290519081900360640190fd5b600490565b3b151590565b6060816001600160a01b031663eeb728666040518163ffffffff1660e01b815260040160006040518083038186803b158015610c5c57600080fd5b505afa158015610c70573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015610c9957600080fd5b8101908080516040519392919084600160201b821115610cb857600080fd5b908301906020820185811115610ccd57600080fd5b8251600160201b811182820188101715610ce657600080fd5b82525081516020918201929091019080838360005b83811015610d13578181015183820152602001610cfb565b50505050905090810190601f168015610d405780820380516001836020036101000a031916815260200191505b5060405250505090506000610d54846112ea565b6040516020018082805190602001908083835b60208310610d865780518252601f199092019160209182019101610d67565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051602081830303815290604052805190602001209050816040516020018082805190602001908083835b60208310610df65780518252601f199092019160209182019101610dd7565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051602081830303815290604052805190602001208114610e6e5760405162461bcd60e51b81526004018080602001828103825260228152602001806114566022913960400191505060405180910390fd5b50505050565b6000918252601e602052604090912080546001600160a01b0319166001600160a01b03909216919091179055565b610eb4826001600160a01b0316610c1b565b610ef6576040805162461bcd60e51b815260206004820152600e60248201526d1393d517d057d0d3d395149050d560921b604482015290519081900360640190fd5b8251811115610f40576040805162461bcd60e51b8152602060048201526011602482015270494e56414c49445f444154415f53495a4560781b604482015290519081900360640190fd5b60608167ffffffffffffffff81118015610f5957600080fd5b506040519080825280601f01601f191660200182016040528015610f84576020820181803683370190505b5084519091508290036020818101918601810190830160005b85811015610fb5578281015182820152602001610f9d565b5060006060876001600160a01b031663439fab9160e01b876040516024018080602001828103825283818151815260200191508051906020019080838360005b8381101561100d578181015183820152602001610ff5565b50505050905090810190601f16801561103a5780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909716969096178652518151919590945084935091508083835b6020831061109c5780518252601f19909201916020918201910161107d565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146110fc576040519150601f19603f3d011682016040523d82523d6000602084013e611101565b606091505b50915091508181906111545760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561072257818101518382015260200161070a565b5080518190156111a55760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561072257818101518382015260200161070a565b50505050505050505050565b60408051808201909152601681527512539255125053125690551253d397d09313d0d2d15160521b602082015268010000000000000003548190156112375760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561072257818101518382015260200161070a565b5068010000000000000001548190156112915760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561072257818101518382015260200161070a565b50600160401b548190156112e65760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561072257818101518382015260200161070a565b5050565b6060816001141561132f575060408051808201909152601d81527f537461726b576172655f416c6c5665726966696572735f323032305f310000006020820152610383565b8160021415611358576040518060600160405280602a815260200161142c602a91399050610383565b816003141561139b575060408051808201909152601f81527f537461726b576172655f50657270657475616c53746174655f323032305f31006020820152610383565b81600414156113c457604051806060016040528060278152602001611405602791399050610383565b6040805162461bcd60e51b815260206004820152601060248201526f0aa9c8ab0a08a86a88a88be929c888ab60831b604482015290519081900360640190fdfe537461726b576172655f50657270657475616c466f72636564416374696f6e735f323032305f31537461726b576172655f50657270657475616c546f6b656e73416e6452616d70696e675f323032305f314d4953504c414345445f494e4445585f4f525f4241445f434f4e54524143545f4944a2646970667358221220f732ff32cb97c37dc794e14ef506707ad1e81781d8f82ca32cfc4a3b3dc759a164736f6c634300060b0033
Deployed Bytecode Sourcemap
723:2349:10:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1456:26:6;1485:23;1500:7;;-1:-1:-1;;;;;;1500:7:6;1485:14;:23::i;:::-;1456:52;-1:-1:-1;;;;;;1526:34:6;;1518:71;;;;;-1:-1:-1;;;1518:71:6;;;;;;;;;;;;-1:-1:-1;;;1518:71:6;;;;;;;;;;;;;;;1868:14;1865:1;1862;1849:34;2094:1;2091;2075:14;2072:1;2052:18;2045:5;2032:64;2170:16;2167:1;2164;2149:38;2208:6;2283:74;;;;2414:16;2411:1;2404:27;2283:74;2322:16;2319:1;2312:27;3054:127:11;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;2779:115;;;;;;;;;;;;;:::i;5687:4968:6:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;5687:4968:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;5687:4968:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5687:4968:6;;-1:-1:-1;5687:4968:6;;-1:-1:-1;;;;;5687:4968:6:i;:::-;;1022:194:11;;;;;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;;;;1022:194:11;;;;;;;;;;;;;;1064:38:8;;;;;;;;;;;;;:::i;1500:33::-;;;;;;;;;;;;;:::i;1165:52::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1165:52:8;;:::i;789:40:10:-;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1499:488:5;1572:7;1591:16;1652:8;1662:11;:9;:11::i;:::-;1635:39;;;-1:-1:-1;;;;;;1635:39:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1625:50;;;;;1610:4;:66;;-1:-1:-1;;;1767:3:5;1635:39;1736:27;;1735:35;1718:52;;1922:6;1886:32;1916:1;1904:8;:13;;1886:17;:32::i;:::-;1932:3;1886:42;;1885:50;1952:28;;;;:12;:28;;;;;;-1:-1:-1;;;;;1952:28:5;;-1:-1:-1;;;;1499:488:5;;;;:::o;3054:127:11:-;3115:66;3054:127;:::o;2779:115::-;2828:66;2779:115;:::o;5687:4968:6:-;3115:66:11;1269:11:6;;;1315:19;;1307:54;;;;;-1:-1:-1;;;1307:54:6;;;;;;;;;;;;-1:-1:-1;;;1307:54:6;;;;;;;;;;;;;;;5687:4968;;5819:21:::1;5843:20;:18;:20::i;:::-;5819:44;;5987:2;5970:13;:19;;5962:54;;;::::0;;-1:-1:-1;;;5962:54:6;;::::1;;::::0;::::1;::::0;::::1;::::0;;;;-1:-1:-1;;;5962:54:6;;;;;;;;;;;;;::::1;;6129:13;6145:1;6129:17;6123:2;:24;6108:4;:11;:39;;6100:78;;;::::0;;-1:-1:-1;;;6100:78:6;;::::1;;::::0;::::1;::::0;::::1;::::0;;;;::::1;::::0;;;;;;;;;;;;;::::1;;6251:29;:16;:14;:16::i;:::-;-1:-1:-1::0;;;;;6251:27:6::1;;:29::i;:::-;6243:64;;;::::0;;-1:-1:-1;;;6243:64:6;;::::1;;::::0;::::1;::::0;::::1;::::0;;;;-1:-1:-1;;;6243:64:6;;;;;;;;;;;;;::::1;;6413:11:::0;;6449:1:::1;6433:17:::0;;::::1;6427:2;:24;6413:38:::0;;;::::1;::::0;6384:26:::1;::::0;6819:473:::1;6860:13;6847:9;:26;6819:473;;7051:2;7047:18:::0;::::1;7037:29:::0;::::1;7031:36:::0;7095:52:::1;7055:9:::0;7031:36;7095:24:::1;:52::i;:::-;7232:49;7254:9;7265:15;7232:21;:49::i;:::-;-1:-1:-1::0;6875:11:6::1;;6819:473;;;-1:-1:-1::0;7567:2:6::1;7590:1;7571:21:::0;::::1;7563:30;7553:41:::0;::::1;7547:48:::0;-1:-1:-1;;;;;7665:39:6;::::1;::::0;7661:164:::1;;7720:74;7744:4;7750:23;7775:18;7720:23;:74::i;:::-;7808:7;;;;;;;7661:164;7953:23:::0;7949:60:::1;;7992:7;;;;;;;7949:60;-1:-1:-1::0;;;;;8066:39:6;::::1;::::0;8059:47:::1;;;;8161:24;:22;:24::i;:::-;8318:1;8293:2246;8334:13;8321:9;:26;8293:2246;;8572:2;8568:18:::0;;::::1;8558:29:::0;::::1;8552:36:::0;9225:79:::1;::::0;;;;;::::1;::::0;::::1;::::0;;;;::::1;::::0;;-1:-1:-1;;;;;9225:79:6::1;-1:-1:-1::0;;;9225:79:6::1;::::0;;9179:126;;;;8552:36;;8376:23:::1;::::0;9152::::1;::::0;-1:-1:-1;;;;;9179:28:6;::::1;::::0;:126;;;9225:79;9179:126;;9225:79;9179:126:::1;;;;;;::::0;;;;-1:-1:-1;;9179:126:6;;;;::::1;::::0;;::::1;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9137:168;;;;9327:7;9343:10;9319:36;;;;;-1:-1:-1::0;;;9319:36:6::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;;::::1;::::0;;;::::1;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9369:16;9399:10;9388:33;;;;;;;;;;;;::::0;::::1;;-1:-1:-1::0;9388:33:6;;-1:-1:-1;9443:30:6;;::::1;;9435:67;;;::::0;;-1:-1:-1;;;9435:67:6;;::::1;;::::0;::::1;::::0;::::1;::::0;;;;-1:-1:-1;;;9435:67:6;;;;;;;;;;;;;::::1;;9553:18;9541:8;9524:14;:25;:47;;9516:84;;;::::0;;-1:-1:-1;;;9516:84:6;;::::1;;::::0;::::1;::::0;::::1;::::0;;;;-1:-1:-1;;;9516:84:6;;;;;;;;;;;;;::::1;;9619:13:::0;9615:60:::1;;9652:8;;;;;;9615:60;9738:32;9783:8;9773:19;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;::::0;;::::1;::::0;::::1;;::::0;-1:-1:-1;9773:19:6::1;-1:-1:-1::0;9738:54:6;-1:-1:-1;9831:2:6::1;9806:322;9848:8;9835:9;:21;9806:322;;10027:20:::0;;::::1;10023:50:::0;::::1;10017:57:::0;9956:35;;::::1;9924:172:::0;9871:2:::1;9858:15;9806:322;;;-1:-1:-1::0;10306:69:6::1;::::0;::::1;;::::0;::::1;::::0;;;;;;;;;;;-1:-1:-1;;;;;10260:28:6;::::1;::::0;-1:-1:-1;;;10329:24:6;10355:19;;10306:69;;;;;;;::::1;::::0;;;;;::::1;;;;;;;::::0;;::::1;::::0;;;::::1;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1::0;10306:69:6::1;::::0;;-1:-1:-1;;10306:69:6;;::::1;::::0;;;;;;::::1;::::0;::::1;::::0;;-1:-1:-1;;;;;10306:69:6::1;-1:-1:-1::0;;;;;;10306:69:6;;::::1;::::0;;;::::1;::::0;;10260:129;;;10306:69;;10260:129;;-1:-1:-1;10260:129:6;;-1:-1:-1;10306:69:6;-1:-1:-1;10260:129:6;;10306:69;10260:129:::1;;;;;;::::0;;;;-1:-1:-1;;10260:129:6;;;;::::1;::::0;;::::1;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1::0;10236:153:6;;-1:-1:-1;10236:153:6;-1:-1:-1;10236:153:6;;10403:36:::1;;;::::0;-1:-1:-1;;;10403:36:6;;::::1;;::::0;::::1;::::0;;;;;;;;;;;;;;;;;;;;;;::::1;::::0;;;;;;;::::1;;::::0;;::::1;::::0;;;::::1;::::0;::::1;;;;;-1:-1:-1::0;;10453:26:6;;::::1;::::0;10493:35;;;::::1;::::0;-1:-1:-1;;;8293:2246:6::1;8349:11;;8293:2246;;;;10591:14;10569:18;:36;10548:100;;;::::0;;-1:-1:-1;;;10548:100:6;;::::1;;::::0;::::1;::::0;::::1;::::0;;;;::::1;::::0;;;;;;;;;;;;;::::1;;1381:1;;;;;;5687:4968:::0;:::o;1022:194:11:-;1589:66;1189:11;;1156:54::o;1064:38:8:-;;;;:::o;1500:33::-;;;;:::o;1165:52::-;;;;;;;;;;;;;:::o;789:40:10:-;;;;;;;;;;;;;;-1:-1:-1;;;789:40:10;;;;:::o;1591:95::-;1035:5;1591:95;:::o;1692:413::-;1767:7;1789:12;1786:274;;-1:-1:-1;1075:66:10;1817:16;;1786:274;1861:7;1872:1;1861:12;1858:202;;;-1:-1:-1;1176:54:10;1889:16;;1858:202;1933:7;1944:1;1933:12;1930:130;;;-1:-1:-1;1265:60:10;1961:16;;1930:130;2005:7;2016:1;2005:12;2002:58;;;-1:-1:-1;1360:65:10;2033:16;;2002:58;2069:29;;;-1:-1:-1;;;2069:29:10;;;;;;;;;;;;-1:-1:-1;;;2069:29:10;;;;;;;;;;;;;;1489:96;1577:1;1489:96;:::o;757:190:0:-;886:20;932:8;;;757:190::o;1091:402:5:-;1194:16;1227:11;-1:-1:-1;;;;;1213:35:5;;:37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1213:37:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;1213:37:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;1213:37:5;;;;;;-1:-1:-1;1213:37:5;;;;;;;;;;-1:-1:-1;1213:37:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1194:56;;1260:26;1316:24;1334:5;1316:17;:24::i;:::-;1299:42;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1299:42:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1289:53;;;;;;1260:82;;1422:2;1405:20;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1405:20:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1395:31;;;;;;1373:18;:53;1352:134;;;;-1:-1:-1;;;1352:134:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1091:402;;;;:::o;1993:149::-;2095:19;;;;:12;:19;;;;;;:40;;-1:-1:-1;;;;;;2095:40:5;-1:-1:-1;;;;;2095:40:5;;;;;;;;;1993:149::o;10661:1234:6:-;10823:36;:23;-1:-1:-1;;;;;10823:34:6;;:36::i;:::-;10815:63;;;;;-1:-1:-1;;;10815:63:6;;;;;;;;;;;;-1:-1:-1;;;10815:63:6;;;;;;;;;;;;;;;10908:4;:11;10896:8;:23;;10888:53;;;;;-1:-1:-1;;;10888:53:6;;;;;;;;;;;;-1:-1:-1;;;10888:53:6;;;;;;;;;;;;;;;10951:24;10988:8;10978:19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;10978:19:6;-1:-1:-1;11073:11:6;;10951:46;;-1:-1:-1;11068:27:6;;;:2;:27;;;;11190:24;;;;;11238:20;;11044:21;11336:228;11366:8;11359:4;:15;11336:228;;;11503:18;;;11497:25;11457:18;;;11429:111;11384:2;11376:10;11336:228;;;;11619:12;11633:23;11660;-1:-1:-1;;;;;11660:36:6;11733:24;;;11759:11;11710:61;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;11710:61:6;;;-1:-1:-1;;11710:61:6;;;;;;;;;;;;;;-1:-1:-1;;;;;11710:61:6;-1:-1:-1;;;;;;11710:61:6;;;;;;;;;11660:121;;;11710:61;;11660:121;;-1:-1:-1;11660:121:6;;-1:-1:-1;11710:61:6;-1:-1:-1;11660:121:6;;11710:61;11660:121;;;;;;;;;;-1:-1:-1;;11660:121:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;11618:163;;;;11799:7;11815:10;11791:36;;;;;-1:-1:-1;;;11791:36:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;11845:17:6;;:10;;:22;11837:51;;;;-1:-1:-1;;;11837:51:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10661:1234;;;;;;;;;:::o;2637:433:10:-;2704:51;;;;;;;;;;;;-1:-1:-1;;;2704:51:10;;;;2914:15;;2704:51;;2910:25;2902:46;;;;-1:-1:-1;;;2902:46:10;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2970:23:10;;3001:10;;2966:33;2958:54;;;;-1:-1:-1;;;2958:54:10;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;3030:15:10;3052:10;;3030:20;3022:41;;;;-1:-1:-1;;;3022:41:10;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2637:433;:::o;2111:520::-;2193:16;2225:5;2234:1;2225:10;2221:404;;;-1:-1:-1;2250:36:10;;;;;;;;;;;;;;;;;2221:404;;;2307:5;2316:1;2307:10;2303:322;;;2332:49;;;;;;;;;;;;;;;;;;;2303:322;;;2402:5;2411:1;2402:10;2398:227;;;-1:-1:-1;2427:38:10;;;;;;;;;;;;;;;;;2398:227;;;2486:5;2495:1;2486:10;2482:143;;;2511:46;;;;;;;;;;;;;;;;;;;2482:143;;;2588:26;;;-1:-1:-1;;;2588:26:10;;;;;;;;;;;;-1:-1:-1;;;2588:26:10;;;;;;;;;;;;;
Swarm Source
ipfs://f732ff32cb97c37dc794e14ef506707ad1e81781d8f82ca32cfc4a3b3dc759a1
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
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.