@andrekorol/kollateral-contracts
Version:
Kollateral protocol, the flash loan building block
1,226 lines (1,225 loc) • 85.4 kB
JSON
{
"contractName": "WETHHandler",
"abi": [],
"metadata": "{\"compiler\":{\"version\":\"0.7.3+commit.9bfce1f6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"/Users/andrekorol/src/kollateral/protocol/contracts/common/utils/WETHHandler.sol\":\"WETHHandler\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/andrekorol/src/kollateral/protocol/contracts/common/utils/IWETH.sol\":{\"keccak256\":\"0x714f003eb93b5f91739e36fdc22ba3eaca8c82a83d11013b1dc776d63aa242cb\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://47d70bd07837927806c759fe38c1fc8933bc8de2e4f56f6c234ca5e338ded961\",\"dweb:/ipfs/QmeDYFtSUQVG1fQEXgVMh2AE2fs3rGYnG8L8C7uK4fDWg9\"]},\"/Users/andrekorol/src/kollateral/protocol/contracts/common/utils/WETHHandler.sol\":{\"keccak256\":\"0x5fb1478553b344b7bf23aa86ed0eabc424b3463570ce95651bf2c341b0312c9f\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://a0617b46289ba31a4dfff0dbd294aec021969e0f2143bb5598e9e71060f21455\",\"dweb:/ipfs/QmefJFyX2wUJzFmYJffBEqK4tukgwuFvUerYjwfBYNwbQL\"]}},\"version\":1}",
"bytecode": "0x",
"deployedBytecode": "0x",
"immutableReferences": {},
"generatedSources": [],
"deployedGeneratedSources": [],
"sourceMap": "",
"deployedSourceMap": "",
"source": "/*\n\n Copyright 2020 Kollateral LLC.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\n// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.7.0;\n\nimport \"./IWETH.sol\";\n\nabstract contract WETHHandler {\n address payable internal _wethAddress;\n\n constructor(address payable wethAddress) {\n _wethAddress = wethAddress;\n }\n\n function wrap(uint256 tokenAmount) internal {\n require(\n address(this).balance >= tokenAmount,\n \"WETHHandler: not enough ether balance\"\n );\n IWETH(_wethAddress).deposit{value: tokenAmount}();\n }\n\n function unwrap(uint256 tokenAmount) internal {\n IWETH weth = IWETH(_wethAddress);\n require(\n weth.balanceOf(address(this)) >= tokenAmount,\n \"WETHHandler: not enough weth balance\"\n );\n weth.withdraw(tokenAmount);\n }\n}\n",
"sourcePath": "/Users/andrekorol/src/kollateral/protocol/contracts/common/utils/WETHHandler.sol",
"ast": {
"absolutePath": "/Users/andrekorol/src/kollateral/protocol/contracts/common/utils/WETHHandler.sol",
"exportedSymbols": {
"IWETH": [
1578
],
"WETHHandler": [
1650
]
},
"id": 1651,
"license": "Apache-2.0",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1580,
"literals": [
"solidity",
"^",
"0.7",
".0"
],
"nodeType": "PragmaDirective",
"src": "640:23:11"
},
{
"absolutePath": "/Users/andrekorol/src/kollateral/protocol/contracts/common/utils/IWETH.sol",
"file": "./IWETH.sol",
"id": 1581,
"nodeType": "ImportDirective",
"scope": 1651,
"sourceUnit": 1579,
"src": "665:21:11",
"symbolAliases": [],
"unitAlias": ""
},
{
"abstract": true,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"fullyImplemented": true,
"id": 1650,
"linearizedBaseContracts": [
1650
],
"name": "WETHHandler",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"id": 1583,
"mutability": "mutable",
"name": "_wethAddress",
"nodeType": "VariableDeclaration",
"scope": 1650,
"src": "724:37:11",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
"typeName": {
"id": 1582,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "724:15:11",
"stateMutability": "payable",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"visibility": "internal"
},
{
"body": {
"id": 1592,
"nodeType": "Block",
"src": "809:43:11",
"statements": [
{
"expression": {
"id": 1590,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 1588,
"name": "_wethAddress",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1583,
"src": "819:12:11",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"id": 1589,
"name": "wethAddress",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1585,
"src": "834:11:11",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "819:26:11",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"id": 1591,
"nodeType": "ExpressionStatement",
"src": "819:26:11"
}
]
},
"id": 1593,
"implemented": true,
"kind": "constructor",
"modifiers": [],
"name": "",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1586,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1585,
"mutability": "mutable",
"name": "wethAddress",
"nodeType": "VariableDeclaration",
"scope": 1593,
"src": "780:27:11",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
"typeName": {
"id": 1584,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "780:15:11",
"stateMutability": "payable",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"visibility": "internal"
}
],
"src": "779:29:11"
},
"returnParameters": {
"id": 1587,
"nodeType": "ParameterList",
"parameters": [],
"src": "809:0:11"
},
"scope": 1650,
"src": "768:84:11",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 1617,
"nodeType": "Block",
"src": "902:196:11",
"statements": [
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 1605,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"expression": {
"arguments": [
{
"id": 1601,
"name": "this",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -28,
"src": "941:4:11",
"typeDescriptions": {
"typeIdentifier": "t_contract$_WETHHandler_$1650",
"typeString": "contract WETHHandler"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_WETHHandler_$1650",
"typeString": "contract WETHHandler"
}
],
"id": 1600,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "933:7:11",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 1599,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "933:7:11",
"typeDescriptions": {}
}
},
"id": 1602,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "933:13:11",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 1603,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "balance",
"nodeType": "MemberAccess",
"src": "933:21:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">=",
"rightExpression": {
"id": 1604,
"name": "tokenAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1595,
"src": "958:11:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "933:36:11",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"hexValue": "5745544848616e646c65723a206e6f7420656e6f7567682065746865722062616c616e6365",
"id": 1606,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "983:39:11",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_12cbd338f3d380472e6e6f021fa4387f5d4c1cdea9b46c0fb1077fc4dfd79d34",
"typeString": "literal_string \"WETHHandler: not enough ether balance\""
},
"value": "WETHHandler: not enough ether balance"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_12cbd338f3d380472e6e6f021fa4387f5d4c1cdea9b46c0fb1077fc4dfd79d34",
"typeString": "literal_string \"WETHHandler: not enough ether balance\""
}
],
"id": 1598,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "912:7:11",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 1607,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "912:120:11",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 1608,
"nodeType": "ExpressionStatement",
"src": "912:120:11"
},
{
"expression": {
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": [],
"expression": {
"arguments": [
{
"id": 1610,
"name": "_wethAddress",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1583,
"src": "1048:12:11",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
],
"id": 1609,
"name": "IWETH",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1578,
"src": "1042:5:11",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_IWETH_$1578_$",
"typeString": "type(contract IWETH)"
}
},
"id": 1611,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1042:19:11",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_IWETH_$1578",
"typeString": "contract IWETH"
}
},
"id": 1612,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "deposit",
"nodeType": "MemberAccess",
"referencedDeclaration": 1572,
"src": "1042:27:11",
"typeDescriptions": {
"typeIdentifier": "t_function_external_payable$__$returns$__$",
"typeString": "function () payable external"
}
},
"id": 1614,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"names": [
"value"
],
"nodeType": "FunctionCallOptions",
"options": [
{
"id": 1613,
"name": "tokenAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1595,
"src": "1077:11:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"src": "1042:47:11",
"typeDescriptions": {
"typeIdentifier": "t_function_external_payable$__$returns$__$value",
"typeString": "function () payable external"
}
},
"id": 1615,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1042:49:11",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 1616,
"nodeType": "ExpressionStatement",
"src": "1042:49:11"
}
]
},
"id": 1618,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "wrap",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1596,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1595,
"mutability": "mutable",
"name": "tokenAmount",
"nodeType": "VariableDeclaration",
"scope": 1618,
"src": "872:19:11",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1594,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "872:7:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "871:21:11"
},
"returnParameters": {
"id": 1597,
"nodeType": "ParameterList",
"parameters": [],
"src": "902:0:11"
},
"scope": 1650,
"src": "858:240:11",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 1648,
"nodeType": "Block",
"src": "1150:222:11",
"statements": [
{
"assignments": [
1624
],
"declarations": [
{
"constant": false,
"id": 1624,
"mutability": "mutable",
"name": "weth",
"nodeType": "VariableDeclaration",
"scope": 1648,
"src": "1160:10:11",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IWETH_$1578",
"typeString": "contract IWETH"
},
"typeName": {
"id": 1623,
"name": "IWETH",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 1578,
"src": "1160:5:11",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IWETH_$1578",
"typeString": "contract IWETH"
}
},
"visibility": "internal"
}
],
"id": 1628,
"initialValue": {
"arguments": [
{
"id": 1626,
"name": "_wethAddress",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1583,
"src": "1179:12:11",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
],
"id": 1625,
"name": "IWETH",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1578,
"src": "1173:5:11",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_IWETH_$1578_$",
"typeString": "type(contract IWETH)"
}
},
"id": 1627,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1173:19:11",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_IWETH_$1578",
"typeString": "contract IWETH"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1160:32:11"
},
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 1638,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"arguments": [
{
"arguments": [
{
"id": 1634,
"name": "this",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -28,
"src": "1246:4:11",
"typeDescriptions": {
"typeIdentifier": "t_contract$_WETHHandler_$1650",
"typeString": "contract WETHHandler"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_WETHHandler_$1650",
"typeString": "contract WETHHandler"
}
],
"id": 1633,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1238:7:11",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 1632,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1238:7:11",
"typeDescriptions": {}
}
},
"id": 1635,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1238:13:11",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"expression": {
"id": 1630,
"name": "weth",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1624,
"src": "1223:4:11",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IWETH_$1578",
"typeString": "contract IWETH"
}
},
"id": 1631,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "balanceOf",
"nodeType": "MemberAccess",
"referencedDeclaration": 1569,
"src": "1223:14:11",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$_t_address_$returns$_t_uint256_$",
"typeString": "function (address) view external returns (uint256)"
}
},
"id": 1636,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1223:29:11",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">=",
"rightExpression": {
"id": 1637,
"name": "tokenAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1620,
"src": "1256:11:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1223:44:11",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"hexValue": "5745544848616e646c65723a206e6f7420656e6f75676820776574682062616c616e6365",
"id": 1639,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1281:38:11",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_6ba38f48388cccc2aad8df6212f9a1bd83ecc1af6e75fcd6ca310674b55e41d6",
"typeString": "literal_string \"WETHHandler: not enough weth balance\""
},
"value": "WETHHandler: not enough weth balance"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_6ba38f48388cccc2aad8df6212f9a1bd83ecc1af6e75fcd6ca310674b55e41d6",
"typeString": "literal_string \"WETHHandler: not enough weth balance\""
}
],
"id": 1629,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "1202:7:11",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 1640,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1202:127:11",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 1641,
"nodeType": "ExpressionStatement",
"src": "1202:127:11"
},
{
"expression": {
"arguments": [
{
"id": 1645,
"name": "tokenAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1620,
"src": "1353:11:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"id": 1642,
"name": "weth",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1624,
"src": "1339:4:11",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IWETH_$1578",
"typeString": "contract IWETH"
}
},
"id": 1644,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "withdraw",
"nodeType": "MemberAccess",
"referencedDeclaration": 1577,
"src": "1339:13:11",
"typeDescriptions": {
"typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$",
"typeString": "function (uint256) external"
}
},
"id": 1646,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1339:26:11",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 1647,
"nodeType": "ExpressionStatement",
"src": "1339:26:11"
}
]
},
"id": 1649,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "unwrap",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1621,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1620,
"mutability": "mutable",
"name": "tokenAmount",
"nodeType": "VariableDeclaration",
"scope": 1649,
"src": "1120:19:11",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1619,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1120:7:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "1119:21:11"
},
"returnParameters": {
"id": 1622,
"nodeType": "ParameterList",
"parameters": [],
"src": "1150:0:11"
},
"scope": 1650,
"src": "1104:268:11",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
}
],
"scope": 1651,
"src": "688:686:11"
}
],
"src": "640:735:11"
},
"legacyAST": {
"attributes": {
"absolutePath": "/Users/andrekorol/src/kollateral/protocol/contracts/common/utils/WETHHandler.sol",
"exportedSymbols": {
"IWETH": [
1578
],
"WETHHandler": [
1650
]
},
"license": "Apache-2.0"
},
"children": [
{
"attributes": {
"literals": [
"solidity",
"^",
"0.7",
".0"
]
},
"id": 1580,
"name": "PragmaDirective",
"src": "640:23:11"
},
{
"attributes": {
"SourceUnit": 1579,
"absolutePath": "/Users/andrekorol/src/kollateral/protocol/contracts/common/utils/IWETH.sol",
"file": "./IWETH.sol",
"scope": 1651,
"symbolAliases": [
null
],
"unitAlias": ""
},
"id": 1581,
"name": "ImportDirective",
"src": "665:21:11"
},
{
"attributes": {
"abstract": true,
"baseContracts": [
null
],
"contractDependencies": [
null
],
"contractKind": "contract",
"fullyImplemented": true,
"linearizedBaseContracts": [
1650
],
"name": "WETHHandler",
"scope": 1651
},
"children": [
{
"attributes": {
"constant": false,
"mutability": "mutable",
"name": "_wethAddress",
"scope": 1650,
"stateVariable": true,
"storageLocation": "default",
"type": "address payable",
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "payable",
"type": "address payable"
},
"id": 1582,
"name": "ElementaryTypeName",
"src": "724:15:11"
}
],
"id": 1583,
"name": "VariableDeclaration",
"src": "724:37:11"
},
{
"attributes": {
"implemented": true,
"isConstructor": true,
"kind": "constructor",
"modifiers": [
null
],
"name": "",
"scope": 1650,
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"mutability": "mutable",
"name": "wethAddress",
"scope": 1593,
"stateVariable": false,
"storageLocation": "default",
"type": "address payable",
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "payable",
"type": "address payable"
},
"id": 1584,
"name": "ElementaryTypeName",
"src": "780:15:11"
}
],
"id": 1585,
"name": "VariableDeclaration",
"src": "780:27:11"
}
],
"id": 1586,
"name": "ParameterList",
"src": "779:29:11"
},
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 1587,
"name": "ParameterList",
"src": "809:0:11"
},
{
"children": [
{
"children": [
{
"attributes": {
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "=",
"type": "address payable"
},
"children": [
{
"attributes": {
"overloadedDeclarations": [
null
],
"referencedDeclaration": 1583,
"type": "address payable",
"value": "_wethAddress"
},
"id": 1588,
"name": "Identifier",
"src": "819:12:11"
},
{
"attributes": {
"overloadedDeclarations": [
null
],
"referencedDeclaration": 1585,
"type": "address payable",
"value": "wethAddress"
},
"id": 1589,
"name": "Identifier",
"src": "834:11:11"
}
],
"id": 1590,
"name": "Assignment",
"src": "819:26:11"
}
],
"id": 1591,
"name": "ExpressionStatement",
"src": "819:26:11"
}
],
"id": 1592,
"name": "Block",
"src": "809:43:11"
}
],
"id": 1593,
"name": "FunctionDefinition",
"src": "768:84:11"
},
{
"attributes": {
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers": [
null
],
"name": "wrap",
"scope": 1650,
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"mutability": "mutable",
"name": "tokenAmount",
"scope": 1618,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 1594,
"name": "ElementaryTypeName",
"src": "872:7:11"
}
],
"id": 1595,
"name": "VariableDeclaration",
"src": "872:19:11"
}
],
"id": 1596,
"name": "ParameterList",
"src": "871:21:11"
},
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 1597,
"name": "ParameterList",
"src": "902:0:11"
},
{
"children": [
{
"children": [
{
"attributes": {
"isConstant": false,