UNPKG

@cartesi/logger

Version:
204 lines 9.95 kB
{ "contractName": "InstantiatorImpl", "sourceName": "@cartesi/util/contracts/InstantiatorImpl.sol", "abi": [ { "inputs": [], "name": "currentIndex", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" } ], "name": "getNonce", "outputs": [ { "internalType": "uint256", "name": "currentNonce", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" }, { "internalType": "address", "name": "", "type": "address" } ], "name": "getSubInstances", "outputs": [ { "internalType": "address[]", "name": "_addresses", "type": "address[]" }, { "internalType": "uint256[]", "name": "_indices", "type": "uint256[]" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" } ], "name": "isActive", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" }, { "internalType": "address", "name": "_user", "type": "address" } ], "name": "isConcerned", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" } ], "bytecode": "0x", "deployedBytecode": "0x", "linkReferences": {}, "deployedLinkReferences": {}, "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, "evm": { "bytecode": { "generatedSources": [], "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "deployedBytecode": { "generatedSources": [], "immutableReferences": {}, "linkReferences": {}, "object": "", "opcodes": "", "sourceMap": "" }, "gasEstimates": null, "methodIdentifiers": { "currentIndex()": "26987b60", "getNonce(uint256)": "3d46b819", "getSubInstances(uint256,address)": "c526656c", "isActive(uint256)": "82afd23b", "isConcerned(uint256,address)": "01ff62ab" } }, "metadata": "{\"compiler\":{\"version\":\"0.7.4+commit.3f05b770\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"currentIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getNonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"currentNonce\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"getSubInstances\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_addresses\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_indices\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"isActive\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"isConcerned\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@cartesi/util/contracts/InstantiatorImpl.sol\":\"InstantiatorImpl\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@cartesi/util/contracts/Instantiator.sol\":{\"content\":\"// Copyright 2020 Cartesi Pte. Ltd.\\n\\n// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\n\\npragma solidity ^0.7.0;\\n\\n\\ninterface Instantiator {\\n\\n modifier onlyInstantiated(uint256 _index) virtual;\\n\\n modifier onlyActive(uint256 _index) virtual;\\n\\n modifier increasesNonce(uint256 _index) virtual;\\n\\n function isActive(uint256 _index) external view returns (bool);\\n\\n function getNonce(uint256 _index) external view returns (uint256);\\n\\n function isConcerned(uint256 _index, address _user) external view returns (bool);\\n\\n function getSubInstances(uint256 _index, address) external view returns (address[] memory _addresses, uint256[] memory _indices);\\n}\\n\",\"keccak256\":\"0x416e612dc09b10765de32ec06cf0a7ee4e050e16db8bf3b8ad832a6082b7dfd6\",\"license\":\"Apache-2.0\"},\"@cartesi/util/contracts/InstantiatorImpl.sol\":{\"content\":\"// Copyright 2020 Cartesi Pte. Ltd.\\n\\n// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./Instantiator.sol\\\";\\n\\nabstract contract InstantiatorImpl is Instantiator {\\n uint256 public currentIndex = 0;\\n\\n mapping(uint256 => bool) internal active;\\n mapping(uint256 => uint256) internal nonce;\\n\\n modifier onlyInstantiated(uint256 _index) override {\\n require(currentIndex > _index, \\\"Index not instantiated\\\");\\n _;\\n }\\n\\n modifier onlyActive(uint256 _index) override {\\n require(currentIndex > _index, \\\"Index not instantiated\\\");\\n require(isActive(_index), \\\"Index inactive\\\");\\n _;\\n }\\n\\n modifier increasesNonce(uint256 _index) override {\\n nonce[_index]++;\\n _;\\n }\\n\\n function isActive(uint256 _index) public override view returns (bool) {\\n return (active[_index]);\\n }\\n\\n function getNonce(uint256 _index)\\n public\\n override\\n view\\n onlyActive(_index)\\n returns (uint256 currentNonce)\\n {\\n return nonce[_index];\\n }\\n\\n function deactivate(uint256 _index) internal {\\n active[_index] = false;\\n nonce[_index] = 0;\\n }\\n}\\n\",\"keccak256\":\"0x8f8e29b807e5c55198206a370b4d8751cbd98a663e3f89faff274e2f9d7cae75\",\"license\":\"Apache-2.0\"}},\"version\":1}", "storageLayout": { "storage": [ { "astId": 89, "contract": "@cartesi/util/contracts/InstantiatorImpl.sol:InstantiatorImpl", "label": "currentIndex", "offset": 0, "slot": "0", "type": "t_uint256" }, { "astId": 93, "contract": "@cartesi/util/contracts/InstantiatorImpl.sol:InstantiatorImpl", "label": "active", "offset": 0, "slot": "1", "type": "t_mapping(t_uint256,t_bool)" }, { "astId": 97, "contract": "@cartesi/util/contracts/InstantiatorImpl.sol:InstantiatorImpl", "label": "nonce", "offset": 0, "slot": "2", "type": "t_mapping(t_uint256,t_uint256)" } ], "types": { "t_bool": { "encoding": "inplace", "label": "bool", "numberOfBytes": "1" }, "t_mapping(t_uint256,t_bool)": { "encoding": "mapping", "key": "t_uint256", "label": "mapping(uint256 => bool)", "numberOfBytes": "32", "value": "t_bool" }, "t_mapping(t_uint256,t_uint256)": { "encoding": "mapping", "key": "t_uint256", "label": "mapping(uint256 => uint256)", "numberOfBytes": "32", "value": "t_uint256" }, "t_uint256": { "encoding": "inplace", "label": "uint256", "numberOfBytes": "32" } } }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }