UNPKG

witnet-solidity-bridge

Version:

Witnet Solidity Bridge contracts for EVM-compatible chains

684 lines 25.2 kB
{ "contractName": "Payable", "abi": [ { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "from", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "Received", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "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.25+commit.b61c2a91\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Received\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"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\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0xe06a3f08a987af6ad2e1c1e774405d4fe08f1694b67517438b467cecf0da0ef7\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://df6f0c459663c9858b6cba2cda1d14a7d05a985bed6d2de72bd8e78c25ee79db\",\"dweb:/ipfs/QmeTTxZ7qVk9rjEv2R4CpCwdf8UMCcRqDNMvzNxHc3Fnn9\"]},\"project:/contracts/patterns/Payable.sol\":{\"keccak256\":\"0x83401b23b1c144561e674e86738e0d907c8fa15d90d79254415b3f5f215035c9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e031f9a24c7030cd2d160a64a581fd3a69a06d7dc71bcf704b48f391c3d63fc6\",\"dweb:/ipfs/QmVpX6PdfgPGJZp3W5H4CGqVUqmNx9ttb4V5cz3YgBTypQ\"]}},\"version\":1}", "bytecode": "0x", "deployedBytecode": "0x", "immutableReferences": {}, "generatedSources": [], "deployedGeneratedSources": [], "sourceMap": "", "deployedSourceMap": "", "source": "// SPDX-License-Identifier: MIT\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 from, uint256 value);\r\n event Transfer(address 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 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\\witnet\\witnet-solidity-bridge\\contracts\\patterns\\Payable.sol", "ast": { "absolutePath": "project:/contracts/patterns/Payable.sol", "exportedSymbols": { "IERC20": [ 479 ], "Payable": [ 24145 ] }, "id": 24146, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 24096, "literals": [ "solidity", ">=", "0.6", ".0", "<", "0.9", ".0" ], "nodeType": "PragmaDirective", "src": "33:31:80" }, { "absolutePath": "@openzeppelin/contracts/token/ERC20/IERC20.sol", "file": "@openzeppelin/contracts/token/ERC20/IERC20.sol", "id": 24097, "nameLocation": "-1:-1:-1", "nodeType": "ImportDirective", "scope": 24146, "sourceUnit": 480, "src": "68:56:80", "symbolAliases": [], "unitAlias": "" }, { "abstract": true, "baseContracts": [], "canonicalName": "Payable", "contractDependencies": [], "contractKind": "contract", "fullyImplemented": false, "id": 24145, "linearizedBaseContracts": [ 24145 ], "name": "Payable", "nameLocation": "146:7:80", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "functionSelector": "e5a6b10f", "id": 24100, "mutability": "immutable", "name": "currency", "nameLocation": "185:8:80", "nodeType": "VariableDeclaration", "scope": 24145, "src": "161:32:80", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$479", "typeString": "contract IERC20" }, "typeName": { "id": 24099, "nodeType": "UserDefinedTypeName", "pathNode": { "id": 24098, "name": "IERC20", "nameLocations": [ "161:6:80" ], "nodeType": "IdentifierPath", "referencedDeclaration": 479, "src": "161:6:80" }, "referencedDeclaration": 479, "src": "161:6:80", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$479", "typeString": "contract IERC20" } }, "visibility": "public" }, { "anonymous": false, "eventSelector": "88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f88525874", "id": 24106, "name": "Received", "nameLocation": "208:8:80", "nodeType": "EventDefinition", "parameters": { "id": 24105, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 24102, "indexed": false, "mutability": "mutable", "name": "from", "nameLocation": "225:4:80", "nodeType": "VariableDeclaration", "scope": 24106, "src": "217:12:80", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 24101, "name": "address", "nodeType": "ElementaryTypeName", "src": "217:7:80", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "visibility": "internal" }, { "constant": false, "id": 24104, "indexed": false, "mutability": "mutable", "name": "value", "nameLocation": "239:5:80", "nodeType": "VariableDeclaration", "scope": 24106, "src": "231:13:80", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 24103, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "231:7:80", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "216:29:80" }, "src": "202:44:80" }, { "anonymous": false, "eventSelector": "69ca02dd4edd7bf0a4abb9ed3b7af3f14778db5d61921c7dc7cd545266326de2", "id": 24112, "name": "Transfer", "nameLocation": "258:8:80", "nodeType": "EventDefinition", "parameters": { "id": 24111, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 24108, "indexed": false, "mutability": "mutable", "name": "to", "nameLocation": "275:2:80", "nodeType": "VariableDeclaration", "scope": 24112, "src": "267:10:80", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 24107, "name": "address", "nodeType": "ElementaryTypeName", "src": "267:7:80", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "visibility": "internal" }, { "constant": false, "id": 24110, "indexed": false, "mutability": "mutable", "name": "value", "nameLocation": "287:5:80", "nodeType": "VariableDeclaration", "scope": 24112, "src": "279:13:80", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 24109, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "279:7:80", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "266:27:80" }, "src": "252:42:80" }, { "body": { "id": 24123, "nodeType": "Block", "src": "333:47:80", "statements": [ { "expression": { "id": 24121, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "id": 24117, "name": "currency", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 24100, "src": "344:8:80", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$479", "typeString": "contract IERC20" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "arguments": [ { "id": 24119, "name": "_currency", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 24114, "src": "362:9:80", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 24118, "name": "IERC20", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 479, "src": "355:6:80", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IERC20_$479_$", "typeString": "type(contract IERC20)" } }, "id": 24120, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "nameLocations": [], "names": [], "nodeType": "FunctionCall", "src": "355:17:80", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$479", "typeString": "contract IERC20" } }, "src": "344:28:80", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$479", "typeString": "contract IERC20" } }, "id": 24122, "nodeType": "ExpressionStatement", "src": "344:28:80" } ] }, "id": 24124, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nameLocation": "-1:-1:-1", "nodeType": "FunctionDefinition", "parameters": { "id": 24115, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 24114, "mutability": "mutable", "name": "_currency", "nameLocation": "322:9:80", "nodeType": "VariableDeclaration", "scope": 24124, "src": "314:17:80", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 24113, "name": "address", "nodeType": "ElementaryTypeName", "src": "314:7:80", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "visibility": "internal" } ], "src": "313:19:80" }, "returnParameters": { "id": 24116, "nodeType": "ParameterList", "parameters": [], "src": "333:0:80" }, "scope": 24145, "src": "302:78:80", "stateMutability": "nonpayable", "virtual": false, "visibility": "internal" }, { "documentation": { "id": 24125, "nodeType": "StructuredDocumentation", "src": "388:35:80", "text": "Gets current transaction price." }, "id": 24130, "implemented": false, "kind": "function", "modifiers": [], "name": "_getGasPrice", "nameLocation": "438:12:80", "nodeType": "FunctionDefinition", "parameters": { "id": 24126, "nodeType": "ParameterList", "parameters": [], "src": "450:2:80" }, "returnParameters": { "id": 24129, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 24128, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "scope": 24130, "src": "484:7:80", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 24127, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "484:7:80", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "483:9:80" }, "scope": 24145, "src": "429:64:80", "stateMutability": "view", "virtual": true, "visibility": "internal" }, { "documentation": { "id": 24131, "nodeType": "StructuredDocumentation", "src": "501:31:80", "text": "Gets current payment value." }, "id": 24136, "implemented": false, "kind": "function", "modifiers": [], "name": "_getMsgValue", "nameLocation": "547:12:80", "nodeType": "FunctionDefinition", "parameters": { "id": 24132, "nodeType": "ParameterList", "parameters": [], "src": "559:2:80" }, "returnParameters": { "id": 24135, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 24134, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "scope": 24136, "src": "593:7:80", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 24133, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "593:7:80", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "592:9:80" }, "scope": 24145, "src": "538:64:80", "stateMutability": "view", "virtual": true, "visibility": "internal" }, { "documentation": { "id": 24137, "nodeType": "StructuredDocumentation", "src": "610:71:80", "text": "Perform safe transfer or whatever token is used for paying rewards." }, "id": 24144, "implemented": false, "kind": "function", "modifiers": [], "name": "__safeTransferTo", "nameLocation": "696:16:80", "nodeType": "FunctionDefinition", "parameters": { "id": 24142, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 24139, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "scope": 24144, "src": "713:15:80", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "typeName": { "id": 24138, "name": "address", "nodeType": "ElementaryTypeName", "src": "713:15:80", "stateMutability": "payable", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "visibility": "internal" }, { "constant": false, "id": 24141, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "scope": 24144, "src": "730:7:80", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 24140, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "730:7:80", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "712:26:80" }, "returnParameters": { "id": 24143, "nodeType": "ParameterList", "parameters": [], "src": "755:0:80" }, "scope": 24145, "src": "687:69:80", "stateMutability": "nonpayable", "virtual": true, "visibility": "internal" } ], "scope": 24146, "src": "128:631:80", "usedErrors": [], "usedEvents": [ 24106, 24112 ] } ], "src": "33:728:80" }, "compiler": { "name": "solc", "version": "0.8.25+commit.b61c2a91.Emscripten.clang" }, "networks": {}, "schemaVersion": "3.4.16", "updatedAt": "2024-12-05T09:36:04.712Z", "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }