witnet-solidity-bridge
Version:
Witnet Solidity Bridge contracts for EVM-compatible chains
989 lines (988 loc) • 247 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": [],
"name": "isUpgradable",
"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": [
{
"internalType": "bytes",
"name": "_initData",
"type": "bytes"
}
],
"name": "initialize",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_from",
"type": "address"
}
],
"name": "isUpgradableFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "version",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
}
],
"metadata": "{\"compiler\":{\"version\":\"0.8.30+commit.73712a01\"},\"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\":\"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\":\"_initData\",\"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@witnet.io>\",\"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.\"},\"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.\"},\"isUpgradableFrom(address)\":{\"notice\":\"Tells whether provided address could eventually upgrade the contract.\"},\"version()\":{\"notice\":\"Retrieves human-readable version tag of current implementation.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/core/WitnetUpgradableBase.sol\":\"WitnetUpgradableBase\"},\"evmVersion\":\"prague\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"keccak256\":\"0xdb4d24ee2c087c391d587cd17adfe5b3f9d93b3110b1388c2ab6c7c0ad1dcd05\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ab7b6d5b9e2b88176312967fe0f0e78f3d9a1422fa5e4b64e2440c35869b5d08\",\"dweb:/ipfs/QmXKYWWyzcLg1B2k7Sb1qkEXgLCYfXecR9wYW5obRzWP1Q\"]},\"@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\":\"0x2d9dc2fe26180f74c11c13663647d38e259e45f95eb88f57b61d2160b0109d3e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://81233d1f98060113d9922180bb0f14f8335856fe9f339134b09335e9f678c377\",\"dweb:/ipfs/QmWh6R35SarhAn4z2wH8SU456jJSYL2FgucfTFgbHJJN4E\"]},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x8891738ffe910f0cf2da09566928589bf5d63f4524dd734fd9cedbac3274dd5c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://971f954442df5c2ef5b5ebf1eb245d7105d9fbacc7386ee5c796df1d45b21617\",\"dweb:/ipfs/QmadRjHbkicwqwwh61raUEapaVEtaLMcYbQZWs9gUkgj3u\"]},\"project:/contracts/core/WitnetProxy.sol\":{\"keccak256\":\"0x6f0ec2c544192c9439bde88f5ed4efec5bdef506cb0dcb739c29329a798033fe\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ca05338334632aab3aef3c17a4b8686251ec488da49b9fcd3712642e57e0ce2a\",\"dweb:/ipfs/QmZk1uDdytKFii4TXUnJkFBBB3CZVSPKKR85ugFjWUTufS\"]},\"project:/contracts/core/WitnetUpgradableBase.sol\":{\"keccak256\":\"0x4cea0415b77897e151454ce87c1e20b7dc9f232de72b54a6740c90e076f7e1b9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e0b803611c3a863ac5806b16e7d2a48b0e062fece262c750d121b5e9e17eb082\",\"dweb:/ipfs/QmVhFt1TkbkZ48jLsN5LgnpzpTdoMbfqGyMSJxjaEqisht\"]},\"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\":\"0x45ed9d1f98e2a7a5bd1a7040dbd4292f1458fa1cb212d0143718684efa436bd5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://45d347c5ef492b33dcf3953bb3911fe7160a6c812e69ed84d2511f0847e19229\",\"dweb:/ipfs/QmZp3icE2gQBoJp8KorWC1GfGC8mK29sK9fEveKRMNCY1U\"]},\"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\":\"0x49d1a83abc7a9b39d224677dde65ead4b7f1104332a94c9e619854b2a6b3a89e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e6a798a953af921a5b4e24e3f78bebae97819a85c90deb12ec505952faa42814\",\"dweb:/ipfs/QmVJhv4x3MXf4aDbMC5Q259K8kZNvxSXzmy8anoow7nS7k\"]}},\"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@witnet.io>\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 /* solhint-disable no-complex-fallback */\r\n fallback() virtual external { \r\n revert(string(abi.encodePacked(\r\n \"WitnetUpgradableBase: not implemented: 0x\",\r\n _toHexString(uint8(bytes1(msg.sig))),\r\n _toHexString(uint8(bytes1(msg.sig << 8))),\r\n _toHexString(uint8(bytes1(msg.sig << 16))),\r\n _toHexString(uint8(bytes1(msg.sig << 24)))\r\n )));\r\n }\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 /// @notice Re-initialize contract's storage context upon a new upgrade from a proxy.\r\n /// @dev Must fail when trying to upgrade to same logic contract more than once.\r\n function initialize(bytes memory _initData) virtual override public {\r\n address _owner = owner();\r\n if (_owner == address(0)) {\r\n // upon first upgrade, extract decode owner address from _intidata\r\n (_owner, _initData) = abi.decode(_initData, (address, bytes));\r\n _transferOwnership(_owner);\r\n \r\n } else {\r\n // only owner can initialize an existing proxy:\r\n require(msg.sender == _owner, \"not the owner\");\r\n }\r\n __initializeUpgradableData(_initData);\r\n if (\r\n __proxiable().codehash != bytes32(0)\r\n && __proxiable().codehash == codehash()\r\n ) {\r\n revert(\"already initialized codehash\");\r\n }\r\n __proxiable().codehash = codehash();\r\n emit Upgraded(owner(), base(), codehash(), version());\r\n }\r\n\r\n /// Tells whether provided address could eventually upgrade the contract.\r\n function isUpgradableFrom(address _from) external view virtual override returns (bool) {\r\n return (\r\n // false if the WRB is intrinsically not upgradable, or `_from` is no owner\r\n isUpgradable()\r\n && owner() == _from\r\n );\r\n }\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 _toHexString(uint8 _u)\r\n internal pure\r\n returns (string memory)\r\n {\r\n bytes memory b2 = new bytes(2);\r\n uint8 d0 = uint8(_u / 16) + 48;\r\n uint8 d1 = uint8(_u % 16) + 48;\r\n if (d0 > 57)\r\n d0 += 7;\r\n if (d1 > 57)\r\n d1 += 7;\r\n b2[0] = bytes1(d0);\r\n b2[1] = bytes1(d1);\r\n return string(b2);\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\\guidiaz\\witnet-solidity-bridge\\contracts\\core\\WitnetUpgradableBase.sol",
"ast": {
"absolutePath": "project:/contracts/core/WitnetUpgradableBase.sol",
"exportedSymbols": {
"Context": [
523
],
"ERC165": [
616
],
"IERC165": [
628
],
"Initializable": [
267
],
"Ownable": [
415
],
"Ownable2Step": [
45709
],
"Proxiable": [
45810
],
"ReentrancyGuard": [
592
],
"Upgradeable": [
45930
],
"WitnetProxy": [
8994
],
"WitnetUpgradableBase": [
9373
]
},
"id": 9374,
"license": "MIT",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 8996,
"literals": [
"solidity",
">=",
"0.8",
".0",
"<",
"0.9",
".0"
],
"nodeType": "PragmaDirective",
"src": "111:31:26"
},
{
"absolutePath": "project:/contracts/patterns/Ownable2Step.sol",
"file": "../patterns/Ownable2Step.sol",
"id": 8997,
"nameLocation": "-1:-1:-1",
"nodeType": "ImportDirective",
"scope": 9374,
"sourceUnit": 45710,
"src": "146:38:26",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "project:/contracts/patterns/ReentrancyGuard.sol",
"file": "../patterns/ReentrancyGuard.sol",
"id": 8998,
"nameLocation": "-1:-1:-1",
"nodeType": "ImportDirective",
"scope": 9374,
"sourceUnit": 45814,
"src": "186:41:26",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "project:/contracts/patterns/Upgradeable.sol",
"file": "../patterns/Upgradeable.sol",
"id": 8999,
"nameLocation": "-1:-1:-1",
"nodeType": "ImportDirective",
"scope": 9374,
"sourceUnit": 45931,
"src": "229:37:26",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "project:/contracts/core/WitnetProxy.sol",
"file": "./WitnetProxy.sol",
"id": 9000,
"nameLocation": "-1:-1:-1",
"nodeType": "ImportDirective",
"scope": 9374,
"sourceUnit": 8995,
"src": "270:27:26",
"symbolAliases": [],
"unitAlias": ""
},
{
"abstract": true,
"baseContracts": [
{
"baseName": {
"id": 9002,
"name": "Ownable2Step",
"nameLocations": [
"502:12:26"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 45709,
"src": "502:12:26"
},
"id": 9003,
"nodeType": "InheritanceSpecifier",
"src": "502:12:26"
},
{
"baseName": {
"id": 9004,
"name": "Upgradeable",
"nameLocations": [
"525:11:26"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 45930,
"src": "525:11:26"
},
"id": 9005,
"nodeType": "InheritanceSpecifier",
"src": "525:11:26"
},
{
"baseName": {
"id": 9006,
"name": "ReentrancyGuard",
"nameLocations": [
"548:15:26"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 592,
"src": "548:15:26"
},
"id": 9007,
"nodeType": "InheritanceSpecifier",
"src": "548:15:26"
}
],
"canonicalName": "WitnetUpgradableBase",
"contractDependencies": [],
"contractKind": "contract",
"documentation": {
"id": 9001,
"nodeType": "StructuredDocumentation",
"src": "301:145:26",
"text": "@title Witnet Request Board base contract, with an Upgradeable (and Destructible) touch.\n @author Guillermo Díaz <guillermo@witnet.io>"
},
"fullyImplemented": false,
"id": 9373,
"linearizedBaseContracts": [
9373,
592,
45930,
45810,
267,
45709,
415,
523
],
"name": "WitnetUpgradableBase",
"nameLocation": "464:20:26",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"id": 9009,
"mutability": "immutable",
"name": "_WITNET_UPGRADABLE_VERSION",
"nameLocation": "599:26:26",
"nodeType": "VariableDeclaration",
"scope": 9373,
"src": "572:53:26",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 9008,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "572:7:26",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"visibility": "internal"
},
{
"constant": false,
"functionSelector": "d5f39488",
"id": 9013,
"mutability": "immutable",
"name": "deployer",
"nameLocation": "659:8:26",
"nodeType": "VariableDeclaration",
"scope": 9373,
"src": "634:46:26",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 9010,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "634:7:26",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": {
"expression": {
"id": 9011,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4294967281,
"src": "670:3:26",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 9012,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberLocation": "674:6:26",
"memberName": "sender",
"nodeType": "MemberAccess",
"src": "670:10:26",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "public"
},
{
"body": {
"id": 9038,
"nodeType": "Block",
"src": "859:118:26",
"statements": [
{
"expression": {
"id": 9027,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 9025,
"name": "_WITNET_UPGRADABLE_VERSION",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9009,
"src": "870:26:26",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"id": 9026,
"name": "_versionTag",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9017,
"src": "899:11:26",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"src": "870:40:26",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"id": 9028,
"nodeType": "ExpressionStatement",
"src": "870:40:26"
},
{
"expression": {
"id": 9036,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 9029,
"name": "proxiableUUID",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9104,
"src": "921:13:26",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"arguments": [
{
"arguments": [
{
"id": 9033,
"name": "_proxiableUUID",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9019,
"src": "953:14:26",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
],
"id": 9032,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "947:5:26",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_bytes_storage_ptr_$",
"typeString": "type(bytes storage pointer)"
},
"typeName": {
"id": 9031,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "947:5:26",
"typeDescriptions": {}
}
},
"id": 9034,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "947:21:26",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
],
"id": 9030,
"name": "keccak256",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4294967288,
"src": "937:9:26",
"typeDescriptions": {
"typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$",
"typeString": "function (bytes memory) pure returns (bytes32)"
}
},
"id": 9035,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "937:32:26",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"src": "921:48:26",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"id": 9037,
"nodeType": "ExpressionStatement",
"src": "921:48:26"
}
]
},
"id": 9039,
"implemented": true,
"kind": "constructor",
"modifiers": [
{
"arguments": [
{
"id": 9022,
"name": "_upgradable",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9015,
"src": "841:11:26",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
],
"id": 9023,
"kind": "baseConstructorSpecifier",
"modifierName": {
"id": 9021,
"name": "Upgradeable",
"nameLocations": [
"829:11:26"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 45930,
"src": "829:11:26"
},
"nodeType": "ModifierInvocation",
"src": "829:24:26"
}
],
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 9020,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 9015,
"mutability": "mutable",
"name": "_upgradable",
"nameLocation": "720:11:26",
"nodeType": "VariableDeclaration",
"scope": 9039,
"src": "715:16:26",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 9014,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "715:4:26",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 9017,
"mutability": "mutable",
"name": "_versionTag",
"nameLocation": "754:11:26",
"nodeType": "VariableDeclaration",
"scope": 9039,
"src": "746:19:26",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 9016,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "746:7:26",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 9019,
"mutability": "mutable",
"name": "_proxiableUUID",
"nameLocation": "794:14:26",
"nodeType": "VariableDeclaration",
"scope": 9039,
"src": "780:28:26",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string"
},
"typeName": {
"id": 9018,
"name": "string",
"nodeType": "ElementaryTypeName",
"src": "780:6:26",
"typeDescriptions": {
"typeIdentifier": "t_string_storage_ptr",
"typeString": "string"
}
},
"visibility": "internal"
}
],
"src": "700:119:26"
},
"returnParameters": {
"id": 9024,
"nodeType": "ParameterList",
"parameters": [],
"src": "859:0:26"
},
"scope": 9373,
"src": "689:288:26",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 9099,
"nodeType": "Block",
"src": "1131:342:26",
"statements": [
{
"expression": {
"arguments": [
{
"arguments": [
{
"arguments": [
{
"hexValue": "5769746e657455706772616461626c65426173653a206e6f7420696d706c656d656e7465643a203078",
"id": 9048,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1188:43:26",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_ecda1eb336220fc8a9b6c69d764b8872b0f5ce6949b5b718b3e7bf6d52b1de44",
"typeString": "literal_string \"WitnetUpgradableBase: not implemented: 0x\""
},
"value": "WitnetUpgradableBase: not implemented: 0x"
},
{
"arguments": [
{
"arguments": [
{
"arguments": [
{
"expression": {
"id": 9054,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4294967281,
"src": "1272:3:26",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 9055,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberLocation": "1276:3:26",
"memberName": "sig",
"nodeType": "MemberAccess",
"src": "1272:7:26",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
],
"id": 9053,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1265:6:26",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_bytes1_$",
"typeString": "type(bytes1)"
},
"typeName": {
"id": 9052,
"name": "bytes1",
"nodeType": "ElementaryTypeName",
"src": "1265:6:26",
"typeDescriptions": {}
}
},
"id": 9056,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "1265:15:26",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_bytes1",
"typeString": "bytes1"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes1",
"typeString": "bytes1"
}
],
"id": 9051,