UNPKG

witnet-solidity-bridge

Version:

Witnet Solidity Bridge contracts for EVM-compatible chains

745 lines 27.5 kB
{ "contractName": "Payable", "abi": [ { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "Received", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "Transfer", "type": "event" }, { "inputs": [], "name": "currency", "outputs": [ { "internalType": "contract IERC20", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.8.30+commit.73712a01\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Received\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"currency\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/patterns/Payable.sol\":\"Payable\"},\"evmVersion\":\"prague\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x74ed01eb66b923d0d0cfe3be84604ac04b76482a55f9dd655e1ef4d367f95bc2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5282825a626cfe924e504274b864a652b0023591fa66f06a067b25b51ba9b303\",\"dweb:/ipfs/QmeCfPykghhMc81VJTrHTC7sF6CRvaA1FXVq2pJhwYp1dV\"]},\"project:/contracts/patterns/Payable.sol\":{\"keccak256\":\"0x29ce79b9329cc854ddb0ee546e5a17f3cedafa91c7d614f43e8d6537680b1734\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://00d5ce85f66c3c32b8b69bfed2f07f40d14ac72c2f67d2de6601de0be16b5af1\",\"dweb:/ipfs/QmZogwLRBjFUJVSzR8YuMfo3mKg8WvYVbn2QvWXsCVP92V\"]}},\"version\":1}", "bytecode": "0x", "deployedBytecode": "0x", "immutableReferences": {}, "generatedSources": [], "deployedGeneratedSources": [], "sourceMap": "", "deployedSourceMap": "", "source": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity >=0.6.0 <0.9.0;\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\n\r\nabstract contract Payable {\r\n IERC20 public immutable currency;\r\n\r\n event Received(address indexed from, uint256 value);\r\n event Transfer(address indexed to, uint256 value);\r\n\r\n constructor(address _currency) {\r\n currency = IERC20(_currency);\r\n }\r\n\r\n /// Gets current transaction price.\r\n function _getGasPrice() internal view virtual returns (uint256);\r\n\r\n /// Gets message actual sender.\r\n function _getMsgSender() internal view virtual returns (address);\r\n\r\n /// Gets current payment value.\r\n function _getMsgValue() internal view virtual returns (uint256);\r\n\r\n /// Perform safe transfer or whatever token is used for paying rewards.\r\n function __safeTransferTo(address payable, uint256) internal virtual;\r\n}\r\n", "sourcePath": "C:\\Users\\guill\\github\\guidiaz\\witnet-solidity-bridge\\contracts\\patterns\\Payable.sol", "ast": { "absolutePath": "project:/contracts/patterns/Payable.sol", "exportedSymbols": { "IERC20": [ 493 ], "Payable": [ 45766 ] }, "id": 45767, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 45711, "literals": [ "solidity", ">=", "0.6", ".0", "<", "0.9", ".0" ], "nodeType": "PragmaDirective", "src": "35:31:132" }, { "absolutePath": "@openzeppelin/contracts/token/ERC20/IERC20.sol", "file": "@openzeppelin/contracts/token/ERC20/IERC20.sol", "id": 45712, "nameLocation": "-1:-1:-1", "nodeType": "ImportDirective", "scope": 45767, "sourceUnit": 494, "src": "70:56:132", "symbolAliases": [], "unitAlias": "" }, { "abstract": true, "baseContracts": [], "canonicalName": "Payable", "contractDependencies": [], "contractKind": "contract", "fullyImplemented": false, "id": 45766, "linearizedBaseContracts": [ 45766 ], "name": "Payable", "nameLocation": "148:7:132", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "functionSelector": "e5a6b10f", "id": 45715, "mutability": "immutable", "name": "currency", "nameLocation": "187:8:132", "nodeType": "VariableDeclaration", "scope": 45766, "src": "163:32:132", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$493", "typeString": "contract IERC20" }, "typeName": { "id": 45714, "nodeType": "UserDefinedTypeName", "pathNode": { "id": 45713, "name": "IERC20", "nameLocations": [ "163:6:132" ], "nodeType": "IdentifierPath", "referencedDeclaration": 493, "src": "163:6:132" }, "referencedDeclaration": 493, "src": "163:6:132", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$493", "typeString": "contract IERC20" } }, "visibility": "public" }, { "anonymous": false, "eventSelector": "88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f88525874", "id": 45721, "name": "Received", "nameLocation": "210:8:132", "nodeType": "EventDefinition", "parameters": { "id": 45720, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 45717, "indexed": true, "mutability": "mutable", "name": "from", "nameLocation": "235:4:132", "nodeType": "VariableDeclaration", "scope": 45721, "src": "219:20:132", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 45716, "name": "address", "nodeType": "ElementaryTypeName", "src": "219:7:132", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "visibility": "internal" }, { "constant": false, "id": 45719, "indexed": false, "mutability": "mutable", "name": "value", "nameLocation": "249:5:132", "nodeType": "VariableDeclaration", "scope": 45721, "src": "241:13:132", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 45718, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "241:7:132", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "218:37:132" }, "src": "204:52:132" }, { "anonymous": false, "eventSelector": "69ca02dd4edd7bf0a4abb9ed3b7af3f14778db5d61921c7dc7cd545266326de2", "id": 45727, "name": "Transfer", "nameLocation": "268:8:132", "nodeType": "EventDefinition", "parameters": { "id": 45726, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 45723, "indexed": true, "mutability": "mutable", "name": "to", "nameLocation": "293:2:132", "nodeType": "VariableDeclaration", "scope": 45727, "src": "277:18:132", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 45722, "name": "address", "nodeType": "ElementaryTypeName", "src": "277:7:132", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "visibility": "internal" }, { "constant": false, "id": 45725, "indexed": false, "mutability": "mutable", "name": "value", "nameLocation": "305:5:132", "nodeType": "VariableDeclaration", "scope": 45727, "src": "297:13:132", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 45724, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "297:7:132", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "276:35:132" }, "src": "262:50:132" }, { "body": { "id": 45738, "nodeType": "Block", "src": "351:47:132", "statements": [ { "expression": { "id": 45736, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "id": 45732, "name": "currency", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 45715, "src": "362:8:132", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$493", "typeString": "contract IERC20" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "arguments": [ { "id": 45734, "name": "_currency", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 45729, "src": "380:9:132", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 45733, "name": "IERC20", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 493, "src": "373:6:132", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IERC20_$493_$", "typeString": "type(contract IERC20)" } }, "id": 45735, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "nameLocations": [], "names": [], "nodeType": "FunctionCall", "src": "373:17:132", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$493", "typeString": "contract IERC20" } }, "src": "362:28:132", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$493", "typeString": "contract IERC20" } }, "id": 45737, "nodeType": "ExpressionStatement", "src": "362:28:132" } ] }, "id": 45739, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nameLocation": "-1:-1:-1", "nodeType": "FunctionDefinition", "parameters": { "id": 45730, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 45729, "mutability": "mutable", "name": "_currency", "nameLocation": "340:9:132", "nodeType": "VariableDeclaration", "scope": 45739, "src": "332:17:132", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 45728, "name": "address", "nodeType": "ElementaryTypeName", "src": "332:7:132", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "visibility": "internal" } ], "src": "331:19:132" }, "returnParameters": { "id": 45731, "nodeType": "ParameterList", "parameters": [], "src": "351:0:132" }, "scope": 45766, "src": "320:78:132", "stateMutability": "nonpayable", "virtual": false, "visibility": "internal" }, { "documentation": { "id": 45740, "nodeType": "StructuredDocumentation", "src": "406:35:132", "text": "Gets current transaction price." }, "id": 45745, "implemented": false, "kind": "function", "modifiers": [], "name": "_getGasPrice", "nameLocation": "456:12:132", "nodeType": "FunctionDefinition", "parameters": { "id": 45741, "nodeType": "ParameterList", "parameters": [], "src": "468:2:132" }, "returnParameters": { "id": 45744, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 45743, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "scope": 45745, "src": "502:7:132", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 45742, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "502:7:132", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "501:9:132" }, "scope": 45766, "src": "447:64:132", "stateMutability": "view", "virtual": true, "visibility": "internal" }, { "documentation": { "id": 45746, "nodeType": "StructuredDocumentation", "src": "519:31:132", "text": "Gets message actual sender." }, "id": 45751, "implemented": false, "kind": "function", "modifiers": [], "name": "_getMsgSender", "nameLocation": "565:13:132", "nodeType": "FunctionDefinition", "parameters": { "id": 45747, "nodeType": "ParameterList", "parameters": [], "src": "578:2:132" }, "returnParameters": { "id": 45750, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 45749, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "scope": 45751, "src": "612:7:132", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 45748, "name": "address", "nodeType": "ElementaryTypeName", "src": "612:7:132", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "visibility": "internal" } ], "src": "611:9:132" }, "scope": 45766, "src": "556:65:132", "stateMutability": "view", "virtual": true, "visibility": "internal" }, { "documentation": { "id": 45752, "nodeType": "StructuredDocumentation", "src": "629:31:132", "text": "Gets current payment value." }, "id": 45757, "implemented": false, "kind": "function", "modifiers": [], "name": "_getMsgValue", "nameLocation": "675:12:132", "nodeType": "FunctionDefinition", "parameters": { "id": 45753, "nodeType": "ParameterList", "parameters": [], "src": "687:2:132" }, "returnParameters": { "id": 45756, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 45755, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "scope": 45757, "src": "721:7:132", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 45754, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "721:7:132", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "720:9:132" }, "scope": 45766, "src": "666:64:132", "stateMutability": "view", "virtual": true, "visibility": "internal" }, { "documentation": { "id": 45758, "nodeType": "StructuredDocumentation", "src": "738:71:132", "text": "Perform safe transfer or whatever token is used for paying rewards." }, "id": 45765, "implemented": false, "kind": "function", "modifiers": [], "name": "__safeTransferTo", "nameLocation": "824:16:132", "nodeType": "FunctionDefinition", "parameters": { "id": 45763, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 45760, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "scope": 45765, "src": "841:15:132", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "typeName": { "id": 45759, "name": "address", "nodeType": "ElementaryTypeName", "src": "841:15:132", "stateMutability": "payable", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "visibility": "internal" }, { "constant": false, "id": 45762, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "scope": 45765, "src": "858:7:132", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 45761, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "858:7:132", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "840:26:132" }, "returnParameters": { "id": 45764, "nodeType": "ParameterList", "parameters": [], "src": "883:0:132" }, "scope": 45766, "src": "815:69:132", "stateMutability": "nonpayable", "virtual": true, "visibility": "internal" } ], "scope": 45767, "src": "130:757:132", "usedErrors": [], "usedEvents": [ 45721, 45727 ] } ], "src": "35:854:132" }, "compiler": { "name": "solc", "version": "0.8.30+commit.73712a01.Emscripten.clang" }, "networks": {}, "schemaVersion": "3.4.16", "updatedAt": "2025-10-15T14:34:46.051Z", "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }