witnet-solidity-bridge
Version:
Witnet Solidity Bridge contracts for EVM-compatible chains
1,081 lines (1,080 loc) • 115 kB
JSON
{
"contractName": "WitnetUpgradableBase",
"abi": [
{
"inputs": [],
"name": "InvalidInitialization",
"type": "error"
},
{
"inputs": [],
"name": "NotInitializing",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
}
],
"name": "OwnableInvalidOwner",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "OwnableUnauthorizedAccount",
"type": "error"
},
{
"inputs": [],
"name": "ReentrancyGuardReentrantCall",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint64",
"name": "version",
"type": "uint64"
}
],
"name": "Initialized",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferStarted",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "baseAddr",
"type": "address"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "baseCodehash",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "string",
"name": "versionTag",
"type": "string"
}
],
"name": "Upgraded",
"type": "event"
},
{
"stateMutability": "nonpayable",
"type": "fallback"
},
{
"inputs": [],
"name": "acceptOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "base",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "codehash",
"outputs": [
{
"internalType": "bytes32",
"name": "_codehash",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "deployer",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"name": "initialize",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "isUpgradable",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
}
],
"name": "isUpgradableFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pendingOwner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "proxiableUUID",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "class",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "version",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
}
],
"metadata": "{\"compiler\":{\"version\":\"0.8.25+commit.b61c2a91\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"InvalidInitialization\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotInitializing\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"OwnableInvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"OwnableUnauthorizedAccount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ReentrancyGuardReentrantCall\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"version\",\"type\":\"uint64\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"baseAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"baseCodehash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"versionTag\",\"type\":\"string\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"nonpayable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"base\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"class\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"codehash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"_codehash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deployer\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isUpgradable\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"}],\"name\":\"isUpgradableFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Guillermo D\\u00edaz <guillermo@otherplane.com>\",\"errors\":{\"InvalidInitialization()\":[{\"details\":\"The contract is already initialized.\"}],\"NotInitializing()\":[{\"details\":\"The contract is not initializing.\"}],\"OwnableInvalidOwner(address)\":[{\"details\":\"The owner is not a valid owner account. (eg. `address(0)`)\"}],\"OwnableUnauthorizedAccount(address)\":[{\"details\":\"The caller account is not authorized to perform an operation.\"}],\"ReentrancyGuardReentrantCall()\":[{\"details\":\"Unauthorized reentrant call.\"}]},\"events\":{\"Initialized(uint64)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"Upgraded(address,address,bytes32,string)\":{\"params\":{\"baseAddr\":\"The address of the new implementation contract.\",\"baseCodehash\":\"The EVM-codehash of the new implementation contract.\",\"from\":\"The address who ordered the upgrading. Namely, the WRB operator in \\\"trustable\\\" implementations.\",\"versionTag\":\"Ascii-encoded version literal with which the implementation deployer decided to tag it.\"}}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"base()\":{\"details\":\"Retrieves base contract. Differs from address(this) when called via delegate-proxy pattern.\"},\"codehash()\":{\"details\":\"Retrieves the immutable codehash of this contract, even if invoked as delegatecall.\"},\"initialize(bytes)\":{\"details\":\"Must fail when trying to upgrade to same logic contract more than once.\"},\"isUpgradable()\":{\"details\":\"Determines whether the logic of this contract is potentially upgradable.\"},\"isUpgradableFrom(address)\":{\"details\":\"Tells whether provided address could eventually upgrade the contract.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"}},\"stateVariables\":{\"proxiableUUID\":{\"details\":\"Gets immutable \\\"heritage blood line\\\" (ie. genotype) as a Proxiable, and eventually Upgradeable, contract. If implemented as an Upgradeable touch, upgrading this contract to another one with a different `proxiableUUID()` value should fail.\"}},\"title\":\"Witnet Request Board base contract, with an Upgradeable (and Destructible) touch.\",\"version\":1},\"userdoc\":{\"events\":{\"Upgraded(address,address,bytes32,string)\":{\"notice\":\"Emitted every time the contract gets upgraded.\"}},\"kind\":\"user\",\"methods\":{\"initialize(bytes)\":{\"notice\":\"Re-initialize contract's storage context upon a new upgrade from a proxy. \"},\"version()\":{\"notice\":\"Retrieves human-readable version tag of current implementation.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/core/WitnetUpgradableBase.sol\":\"WitnetUpgradableBase\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"keccak256\":\"0x631188737069917d2f909d29ce62c4d48611d326686ba6683e26b72a23bfac0b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7a61054ae84cd6c4d04c0c4450ba1d6de41e27e0a2c4f1bcdf58f796b401c609\",\"dweb:/ipfs/QmUvtdp7X1mRVyC3CsHrtPbgoqWaXHp3S1ZR24tpAQYJWM\"]},\"@openzeppelin/contracts/access/Ownable.sol\":{\"keccak256\":\"0xff6d0bb2e285473e5311d9d3caacb525ae3538a80758c10649a4d61029b017bb\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8ed324d3920bb545059d66ab97d43e43ee85fd3bd52e03e401f020afb0b120f6\",\"dweb:/ipfs/QmfEckWLmZkDDcoWrkEvMWhms66xwTLff9DDhegYpvHo1a\"]},\"@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6a708e8a5bdb1011c2c381c9a5cfd8a9a956d7d0a9dc1bd8bcdaf52f76ef2f12\",\"dweb:/ipfs/Qmax9WHBnVsZP46ZxEMNRQpLQnrdE4dK8LehML1Py8FowF\"]},\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\":{\"keccak256\":\"0x11a5a79827df29e915a12740caf62fe21ebe27c08c9ae3e09abe9ee3ba3866d3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3cf0c69ab827e3251db9ee6a50647d62c90ba580a4d7bbff21f2bea39e7b2f4a\",\"dweb:/ipfs/QmZiKwtKU1SBX4RGfQtY7PZfiapbbu6SZ9vizGQD9UHjRA\"]},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"keccak256\":\"0xddce8e17e3d3f9ed818b4f4c4478a8262aab8b11ed322f1bf5ed705bb4bd97fa\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8084aa71a4cc7d2980972412a88fe4f114869faea3fefa5436431644eb5c0287\",\"dweb:/ipfs/Qmbqfs5dRdPvHVKY8kTaeyc65NdqXRQwRK7h9s5UJEhD1p\"]},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x79796192ec90263f21b464d5bc90b777a525971d3de8232be80d9c4f9fb353b8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f6fda447a62815e8064f47eff0dd1cf58d9207ad69b5d32280f8d7ed1d1e4621\",\"dweb:/ipfs/QmfDRc7pxfaXB2Dh9np5Uf29Na3pQ7tafRS684wd3GLjVL\"]},\"project:/contracts/core/WitnetProxy.sol\":{\"keccak256\":\"0x2b2f56fc69bf0e01f6f1062202d1682cd394fa3b3d9ff2f8f833ab51c9e866cc\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8017f76a71e4a52a5a5e249081c92510bac5b91f03f727e66ff4406238521337\",\"dweb:/ipfs/QmdWcPAL3MGtxGdpX5CMfgzz4YzxYEeCiFRoGHVCr8rLEL\"]},\"project:/contracts/core/WitnetUpgradableBase.sol\":{\"keccak256\":\"0x9cea47781e0005266e14fadf8d1ee565d0814d4d51b30dced11bdee37b663060\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://fb1f843f53c693f4b5a8f32249ac2eb93095671b99c90aa7c6d335eb7153e827\",\"dweb:/ipfs/QmSLvVGCcg2FZVWPB82yVb57SFixkuDm2BqjvgzJpnYfZp\"]},\"project:/contracts/patterns/Initializable.sol\":{\"keccak256\":\"0xaac470e87f361cf15d68d1618d6eb7d4913885d33ccc39c797841a9591d44296\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ef3760b2039feda8715d4bd9f8de8e3885f25573d12ba92f52d626ba880a08bf\",\"dweb:/ipfs/QmP2mfHPBKkjTAKft95sPDb4PBsjfmAwc47Kdcv3xYSf3g\"]},\"project:/contracts/patterns/Ownable.sol\":{\"keccak256\":\"0x494bda32f9a218d9c33ea82112129c0933ab52f57eabfbf0d14a8742a3370800\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6c4cf04ebb052fed9d15cf93ff4523955ee311aa4425ee85f0e80b4489c94e76\",\"dweb:/ipfs/QmfMf4WD7woTaQSTbJxxoan2aXSeY7ovY5NoipSBw5rMPK\"]},\"project:/contracts/patterns/Ownable2Step.sol\":{\"keccak256\":\"0x7033d8133957a291cf9b8be30bfc4b95e6414a20995911d1b5df8ea149580604\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e20a079adc224113306392d27e0cf202c6c4a7678c4705fd3bbbca99c1e9b816\",\"dweb:/ipfs/QmWrFv2SbSokhrWhwL94sW5x1HyT7rX5f4Scowe4bWHHqu\"]},\"project:/contracts/patterns/Proxiable.sol\":{\"keccak256\":\"0x86032205378fed9ed2bf155eed8ce4bdbb13b7f5960850c6d50954a38b61a3d8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f89978eda4244a13f42a6092a94ac829bb3e38c92d77d4978b9f32894b187a63\",\"dweb:/ipfs/Qmbc1XaFCvLm3Sxvh7tP29Ug32jBGy3avsCqBGAptxs765\"]},\"project:/contracts/patterns/ReentrancyGuard.sol\":{\"keccak256\":\"0x1470caf4bd78b79f706e28a8a85c95a6e13ec33eda04275e5da84464130831e6\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c974fb4dc29718a84f9ab5fa3f8c25c7f889050a38445e16c3ead5ff9d4b4bab\",\"dweb:/ipfs/QmbuGjkSjngbTZMRPijL9p56fP9cK5jMnWsFmvYAQj3qAY\"]},\"project:/contracts/patterns/Upgradeable.sol\":{\"keccak256\":\"0xbeb025c71f037acb1a668174eb6930631bf397129beb825f2660e5d8cf19614f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://fe6ce4dcd500093ae069d35b91829ccb471e1ca33ed0851fb053fbfe76c78aba\",\"dweb:/ipfs/QmT7huvCFS6bHDxt7HhEogJmyvYNbeb6dFTJudsVSX6nEs\"]}},\"version\":1}",
"bytecode": "0x",
"deployedBytecode": "0x",
"immutableReferences": {},
"generatedSources": [],
"deployedGeneratedSources": [],
"sourceMap": "",
"deployedSourceMap": "",
"source": "// SPDX-License-Identifier: MIT\r\n// solhint-disable var-name-mixedcase\r\n// solhint-disable payable-fallback\r\n\r\npragma solidity >=0.8.0 <0.9.0;\r\n\r\nimport \"../patterns/Ownable2Step.sol\";\r\nimport \"../patterns/ReentrancyGuard.sol\";\r\nimport \"../patterns/Upgradeable.sol\";\r\n\r\nimport \"./WitnetProxy.sol\";\r\n\r\n/// @title Witnet Request Board base contract, with an Upgradeable (and Destructible) touch.\r\n/// @author Guillermo Díaz <guillermo@otherplane.com>\r\nabstract contract WitnetUpgradableBase\r\n is\r\n Ownable2Step,\r\n Upgradeable, \r\n ReentrancyGuard\r\n{\r\n bytes32 internal immutable _WITNET_UPGRADABLE_VERSION;\r\n\r\n address public immutable deployer = msg.sender;\r\n\r\n constructor(\r\n bool _upgradable,\r\n bytes32 _versionTag,\r\n string memory _proxiableUUID\r\n )\r\n Upgradeable(_upgradable)\r\n {\r\n _WITNET_UPGRADABLE_VERSION = _versionTag;\r\n proxiableUUID = keccak256(bytes(_proxiableUUID));\r\n }\r\n \r\n /// @dev Reverts if proxy delegatecalls to unexistent method.\r\n fallback() virtual external {\r\n _revert(\"not implemented\");\r\n }\r\n\r\n\r\n function class() virtual public view returns (string memory) {\r\n return type(WitnetUpgradableBase).name;\r\n }\r\n \r\n // ================================================================================================================\r\n // --- Overrides 'Proxiable' --------------------------------------------------------------------------------------\r\n\r\n /// @dev Gets immutable \"heritage blood line\" (ie. genotype) as a Proxiable, and eventually Upgradeable, contract.\r\n /// If implemented as an Upgradeable touch, upgrading this contract to another one with a different \r\n /// `proxiableUUID()` value should fail.\r\n bytes32 public immutable override proxiableUUID;\r\n\r\n\r\n // ================================================================================================================\r\n // --- Overrides 'Upgradeable' --------------------------------------------------------------------------------------\r\n\r\n /// Retrieves human-readable version tag of current implementation.\r\n function version() public view virtual override returns (string memory) {\r\n return _toString(_WITNET_UPGRADABLE_VERSION);\r\n }\r\n\r\n\r\n // ================================================================================================================\r\n // --- Internal methods -------------------------------------------------------------------------------------------\r\n\r\n function _require(\r\n bool _condition, \r\n string memory _message\r\n )\r\n internal view\r\n {\r\n if (!_condition) {\r\n _revert(_message);\r\n }\r\n }\r\n\r\n function _revert(string memory _message)\r\n internal view\r\n {\r\n revert(\r\n string(abi.encodePacked(\r\n class(),\r\n \": \",\r\n _message\r\n ))\r\n );\r\n }\r\n\r\n /// Converts bytes32 into string.\r\n function _toString(bytes32 _bytes32)\r\n internal pure\r\n returns (string memory)\r\n {\r\n bytes memory _bytes = new bytes(_toStringLength(_bytes32));\r\n for (uint _i = 0; _i < _bytes.length;) {\r\n _bytes[_i] = _bytes32[_i];\r\n unchecked {\r\n _i ++;\r\n }\r\n }\r\n return string(_bytes);\r\n }\r\n\r\n // Calculate length of string-equivalent to given bytes32.\r\n function _toStringLength(bytes32 _bytes32)\r\n internal pure\r\n returns (uint _length)\r\n {\r\n for (; _length < 32; ) {\r\n if (_bytes32[_length] == 0) {\r\n break;\r\n }\r\n unchecked {\r\n _length ++;\r\n }\r\n }\r\n }\r\n\r\n}",
"sourcePath": "C:\\Users\\guill\\github\\witnet\\witnet-solidity-bridge\\contracts\\core\\WitnetUpgradableBase.sol",
"ast": {
"absolutePath": "project:/contracts/core/WitnetUpgradableBase.sol",
"exportedSymbols": {
"Context": [
509
],
"ERC165": [
602
],
"IERC165": [
614
],
"Initializable": [
253
],
"Ownable": [
401
],
"Ownable2Step": [
24094
],
"Proxiable": [
24189
],
"ReentrancyGuard": [
578
],
"Upgradeable": [
24304
],
"WitnetProxy": [
3700
],
"WitnetUpgradableBase": [
3887
]
},
"id": 3888,
"license": "MIT",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 3702,
"literals": [
"solidity",
">=",
"0.8",
".0",
"<",
"0.9",
".0"
],
"nodeType": "PragmaDirective",
"src": "111:31:28"
},
{
"absolutePath": "project:/contracts/patterns/Ownable2Step.sol",
"file": "../patterns/Ownable2Step.sol",
"id": 3703,
"nameLocation": "-1:-1:-1",
"nodeType": "ImportDirective",
"scope": 3888,
"sourceUnit": 24095,
"src": "146:38:28",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "project:/contracts/patterns/ReentrancyGuard.sol",
"file": "../patterns/ReentrancyGuard.sol",
"id": 3704,
"nameLocation": "-1:-1:-1",
"nodeType": "ImportDirective",
"scope": 3888,
"sourceUnit": 24193,
"src": "186:41:28",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "project:/contracts/patterns/Upgradeable.sol",
"file": "../patterns/Upgradeable.sol",
"id": 3705,
"nameLocation": "-1:-1:-1",
"nodeType": "ImportDirective",
"scope": 3888,
"sourceUnit": 24305,
"src": "229:37:28",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "project:/contracts/core/WitnetProxy.sol",
"file": "./WitnetProxy.sol",
"id": 3706,
"nameLocation": "-1:-1:-1",
"nodeType": "ImportDirective",
"scope": 3888,
"sourceUnit": 3701,
"src": "270:27:28",
"symbolAliases": [],
"unitAlias": ""
},
{
"abstract": true,
"baseContracts": [
{
"baseName": {
"id": 3708,
"name": "Ownable2Step",
"nameLocations": [
"507:12:28"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 24094,
"src": "507:12:28"
},
"id": 3709,
"nodeType": "InheritanceSpecifier",
"src": "507:12:28"
},
{
"baseName": {
"id": 3710,
"name": "Upgradeable",
"nameLocations": [
"530:11:28"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 24304,
"src": "530:11:28"
},
"id": 3711,
"nodeType": "InheritanceSpecifier",
"src": "530:11:28"
},
{
"baseName": {
"id": 3712,
"name": "ReentrancyGuard",
"nameLocations": [
"553:15:28"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 578,
"src": "553:15:28"
},
"id": 3713,
"nodeType": "InheritanceSpecifier",
"src": "553:15:28"
}
],
"canonicalName": "WitnetUpgradableBase",
"contractDependencies": [],
"contractKind": "contract",
"documentation": {
"id": 3707,
"nodeType": "StructuredDocumentation",
"src": "301:150:28",
"text": "@title Witnet Request Board base contract, with an Upgradeable (and Destructible) touch.\n @author Guillermo Díaz <guillermo@otherplane.com>"
},
"fullyImplemented": false,
"id": 3887,
"linearizedBaseContracts": [
3887,
578,
24304,
24189,
253,
24094,
401,
509
],
"name": "WitnetUpgradableBase",
"nameLocation": "469:20:28",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"id": 3715,
"mutability": "immutable",
"name": "_WITNET_UPGRADABLE_VERSION",
"nameLocation": "604:26:28",
"nodeType": "VariableDeclaration",
"scope": 3887,
"src": "577:53:28",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 3714,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "577:7:28",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"visibility": "internal"
},
{
"constant": false,
"functionSelector": "d5f39488",
"id": 3719,
"mutability": "immutable",
"name": "deployer",
"nameLocation": "664:8:28",
"nodeType": "VariableDeclaration",
"scope": 3887,
"src": "639:46:28",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 3716,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "639:7:28",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": {
"expression": {
"id": 3717,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4294967281,
"src": "675:3:28",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 3718,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberLocation": "679:6:28",
"memberName": "sender",
"nodeType": "MemberAccess",
"src": "675:10:28",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "public"
},
{
"body": {
"id": 3744,
"nodeType": "Block",
"src": "864:118:28",
"statements": [
{
"expression": {
"id": 3733,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 3731,
"name": "_WITNET_UPGRADABLE_VERSION",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3715,
"src": "875:26:28",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"id": 3732,
"name": "_versionTag",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3723,
"src": "904:11:28",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"src": "875:40:28",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"id": 3734,
"nodeType": "ExpressionStatement",
"src": "875:40:28"
},
{
"expression": {
"id": 3742,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 3735,
"name": "proxiableUUID",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3769,
"src": "926:13:28",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"arguments": [
{
"arguments": [
{
"id": 3739,
"name": "_proxiableUUID",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3725,
"src": "958:14:28",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
],
"id": 3738,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "952:5:28",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_bytes_storage_ptr_$",
"typeString": "type(bytes storage pointer)"
},
"typeName": {
"id": 3737,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "952:5:28",
"typeDescriptions": {}
}
},
"id": 3740,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "952:21:28",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
],
"id": 3736,
"name": "keccak256",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4294967288,
"src": "942:9:28",
"typeDescriptions": {
"typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$",
"typeString": "function (bytes memory) pure returns (bytes32)"
}
},
"id": 3741,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "942:32:28",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"src": "926:48:28",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"id": 3743,
"nodeType": "ExpressionStatement",
"src": "926:48:28"
}
]
},
"id": 3745,
"implemented": true,
"kind": "constructor",
"modifiers": [
{
"arguments": [
{
"id": 3728,
"name": "_upgradable",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3721,
"src": "846:11:28",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
],
"id": 3729,
"kind": "baseConstructorSpecifier",
"modifierName": {
"id": 3727,
"name": "Upgradeable",
"nameLocations": [
"834:11:28"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 24304,
"src": "834:11:28"
},
"nodeType": "ModifierInvocation",
"src": "834:24:28"
}
],
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 3726,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 3721,
"mutability": "mutable",
"name": "_upgradable",
"nameLocation": "725:11:28",
"nodeType": "VariableDeclaration",
"scope": 3745,
"src": "720:16:28",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 3720,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "720:4:28",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 3723,
"mutability": "mutable",
"name": "_versionTag",
"nameLocation": "759:11:28",
"nodeType": "VariableDeclaration",
"scope": 3745,
"src": "751:19:28",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 3722,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "751:7:28",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 3725,
"mutability": "mutable",
"name": "_proxiableUUID",
"nameLocation": "799:14:28",
"nodeType": "VariableDeclaration",
"scope": 3745,
"src": "785:28:28",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string"
},
"typeName": {
"id": 3724,
"name": "string",
"nodeType": "ElementaryTypeName",
"src": "785:6:28",
"typeDescriptions": {
"typeIdentifier": "t_string_storage_ptr",
"typeString": "string"
}
},
"visibility": "internal"
}
],
"src": "705:119:28"
},
"returnParameters": {
"id": 3730,
"nodeType": "ParameterList",
"parameters": [],
"src": "864:0:28"
},
"scope": 3887,
"src": "694:288:28",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 3753,
"nodeType": "Block",
"src": "1089:45:28",
"statements": [
{
"expression": {
"arguments": [
{
"hexValue": "6e6f7420696d706c656d656e746564",
"id": 3750,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1108:17:28",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_32d075b43bd38f25ee5981ec20d2adc90449bf9822d065b5dee1ff7a3dcb82b9",
"typeString": "literal_string \"not implemented\""
},
"value": "not implemented"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_stringliteral_32d075b43bd38f25ee5981ec20d2adc90449bf9822d065b5dee1ff7a3dcb82b9",
"typeString": "literal_string \"not implemented\""
}
],
"id": 3749,
"name": "_revert",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3816,
"src": "1100:7:28",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_string_memory_ptr_$returns$__$",
"typeString": "function (string memory) view"
}
},
"id": 3751,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "1100:26:28",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 3752,
"nodeType": "ExpressionStatement",
"src": "1100:26:28"
}
]
},
"documentation": {
"id": 3746,
"nodeType": "StructuredDocumentation",
"src": "994:61:28",
"text": "@dev Reverts if proxy delegatecalls to unexistent method."
},
"id": 3754,
"implemented": true,
"kind": "fallback",
"modifiers": [],
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 3747,
"nodeType": "ParameterList",
"parameters": [],
"src": "1069:2:28"
},
"returnParameters": {
"id": 3748,
"nodeType": "ParameterList",
"parameters": [],
"src": "1089:0:28"
},
"scope": 3887,
"src": "1061:73:28",
"stateMutability": "nonpayable",
"virtual": true,
"visibility": "external"
},
{
"body": {
"id": 3764,
"nodeType": "Block",
"src": "1205:57:28",
"statements": [
{
"expression": {
"expression": {
"arguments": [
{
"id": 3760,
"name": "WitnetUpgradableBase",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3887,
"src": "1228:20:28",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_WitnetUpgradableBase_$3887_$",
"typeString": "type(contract WitnetUpgradableBase)"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_type$_t_contract$_WitnetUpgradableBase_$3887_$",
"typeString": "type(contract WitnetUpgradableBase)"
}
],
"id": 3759,
"name": "type",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4294967269,
"src": "1223:4:28",
"typeDescriptions": {
"typeIdentifier": "t_function_metatype_pure$__$returns$__$",
"typeString": "function () pure"
}
},
"id": 3761,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "1223:26:28",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_magic_meta_type_t_contract$_WitnetUpgradableBase_$3887",
"typeString": "type(contract WitnetUpgradableBase)"
}
},
"id": 3762,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"memberLocation": "1250:4:28",
"memberName": "name",
"nodeType": "MemberAccess",
"src": "1223:31:28",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
},
"functionReturnParameters": 3758,
"id": 3763,
"nodeType": "Return",
"src": "1216:38:28"
}
]
},
"functionSelector": "bff852fa",
"id": 3765,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "class",
"nameLocation": "1153:5:28",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 3755,
"nodeType": "ParameterList",
"parameters": [],
"src": "1158:2:28"
},
"returnParameters": {
"id": 3758,
"nodeType": "ParameterList",
"parameters": [