UNPKG

@andrekorol/kollateral-contracts

Version:

Kollateral protocol, the flash loan building block

858 lines 31.2 kB
{ "contractName": "ISoloMargin", "abi": [ { "inputs": [ { "components": [ { "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "uint256", "name": "number", "type": "uint256" } ], "internalType": "struct Types.AccountInfo[]", "name": "accounts", "type": "tuple[]" }, { "components": [ { "internalType": "enum Types.ActionType", "name": "actionType", "type": "uint8" }, { "internalType": "uint256", "name": "accountId", "type": "uint256" }, { "components": [ { "internalType": "bool", "name": "sign", "type": "bool" }, { "internalType": "enum Types.AssetDenomination", "name": "denomination", "type": "uint8" }, { "internalType": "enum Types.AssetReference", "name": "ref", "type": "uint8" }, { "internalType": "uint256", "name": "value", "type": "uint256" } ], "internalType": "struct Types.AssetAmount", "name": "amount", "type": "tuple" }, { "internalType": "uint256", "name": "primaryMarketId", "type": "uint256" }, { "internalType": "uint256", "name": "secondaryMarketId", "type": "uint256" }, { "internalType": "address", "name": "otherAddress", "type": "address" }, { "internalType": "uint256", "name": "otherAccountId", "type": "uint256" }, { "internalType": "bytes", "name": "data", "type": "bytes" } ], "internalType": "struct Types.ActionArgs[]", "name": "actions", "type": "tuple[]" } ], "name": "operate", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "marketId", "type": "uint256" } ], "name": "getMarketIsClosing", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "marketId", "type": "uint256" } ], "name": "getMarketTokenAddress", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.7.3+commit.9bfce1f6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"marketId\",\"type\":\"uint256\"}],\"name\":\"getMarketIsClosing\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"marketId\",\"type\":\"uint256\"}],\"name\":\"getMarketTokenAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"number\",\"type\":\"uint256\"}],\"internalType\":\"struct Types.AccountInfo[]\",\"name\":\"accounts\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"enum Types.ActionType\",\"name\":\"actionType\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"accountId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"sign\",\"type\":\"bool\"},{\"internalType\":\"enum Types.AssetDenomination\",\"name\":\"denomination\",\"type\":\"uint8\"},{\"internalType\":\"enum Types.AssetReference\",\"name\":\"ref\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"internalType\":\"struct Types.AssetAmount\",\"name\":\"amount\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"primaryMarketId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"secondaryMarketId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"otherAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"otherAccountId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Types.ActionArgs[]\",\"name\":\"actions\",\"type\":\"tuple[]\"}],\"name\":\"operate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"/Users/andrekorol/src/kollateral/protocol/contracts/liquidity/dydx/ISoloMargin.sol\":\"ISoloMargin\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/andrekorol/src/kollateral/protocol/contracts/liquidity/dydx/ISoloMargin.sol\":{\"keccak256\":\"0xa84cb90af092bf862ff4f94fa0efef844dbc7f1be6cb10cb698c3e5c23c6c603\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://c0abc2f5c91d4a7c5b82fa86c604280bfab8aaee1118da7678aec102de320cda\",\"dweb:/ipfs/QmRUXv3xYQdXZskrfNjNi3S7oYBQud2gSsQ4LLmeEgE9ap\"]},\"/Users/andrekorol/src/kollateral/protocol/contracts/liquidity/dydx/Types.sol\":{\"keccak256\":\"0x6ed571153190f3dd335ef6979ee462c6edbf519b0f5b4ca0d469ac7ed39b9d72\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://b9ed752bdc9d722648483115bc6bbc40c6566ba6f3ea6c1a6dea56706dfcdba3\",\"dweb:/ipfs/QmYzqrrEnrL3ALyrQZATiobh696caMHMe1V8GsmtsoVYb2\"]}},\"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;\npragma experimental ABIEncoderV2;\n\nimport \"./Types.sol\";\n\ninterface ISoloMargin {\n function operate(\n Types.AccountInfo[] memory accounts,\n Types.ActionArgs[] memory actions\n ) external;\n\n function getMarketIsClosing(uint256 marketId) external view returns (bool);\n\n function getMarketTokenAddress(uint256 marketId)\n external\n view\n returns (address);\n}\n", "sourcePath": "/Users/andrekorol/src/kollateral/protocol/contracts/liquidity/dydx/ISoloMargin.sol", "ast": { "absolutePath": "/Users/andrekorol/src/kollateral/protocol/contracts/liquidity/dydx/ISoloMargin.sol", "exportedSymbols": { "ISoloMargin": [ 2510 ], "Types": [ 3226 ] }, "id": 2511, "license": "Apache-2.0", "nodeType": "SourceUnit", "nodes": [ { "id": 2484, "literals": [ "solidity", "^", "0.7", ".0" ], "nodeType": "PragmaDirective", "src": "640:23:22" }, { "id": 2485, "literals": [ "experimental", "ABIEncoderV2" ], "nodeType": "PragmaDirective", "src": "664:33:22" }, { "absolutePath": "/Users/andrekorol/src/kollateral/protocol/contracts/liquidity/dydx/Types.sol", "file": "./Types.sol", "id": 2486, "nodeType": "ImportDirective", "scope": 2511, "sourceUnit": 3227, "src": "699:21:22", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "interface", "fullyImplemented": false, "id": 2510, "linearizedBaseContracts": [ 2510 ], "name": "ISoloMargin", "nodeType": "ContractDefinition", "nodes": [ { "functionSelector": "a67a6a45", "id": 2495, "implemented": false, "kind": "function", "modifiers": [], "name": "operate", "nodeType": "FunctionDefinition", "parameters": { "id": 2493, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 2489, "mutability": "mutable", "name": "accounts", "nodeType": "VariableDeclaration", "scope": 2495, "src": "776:35:22", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_AccountInfo_$3225_memory_ptr_$dyn_memory_ptr", "typeString": "struct Types.AccountInfo[]" }, "typeName": { "baseType": { "id": 2487, "name": "Types.AccountInfo", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 3225, "src": "776:17:22", "typeDescriptions": { "typeIdentifier": "t_struct$_AccountInfo_$3225_storage_ptr", "typeString": "struct Types.AccountInfo" } }, "id": 2488, "nodeType": "ArrayTypeName", "src": "776:19:22", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_AccountInfo_$3225_storage_$dyn_storage_ptr", "typeString": "struct Types.AccountInfo[]" } }, "visibility": "internal" }, { "constant": false, "id": 2492, "mutability": "mutable", "name": "actions", "nodeType": "VariableDeclaration", "scope": 2495, "src": "821:33:22", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_ActionArgs_$3220_memory_ptr_$dyn_memory_ptr", "typeString": "struct Types.ActionArgs[]" }, "typeName": { "baseType": { "id": 2490, "name": "Types.ActionArgs", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 3220, "src": "821:16:22", "typeDescriptions": { "typeIdentifier": "t_struct$_ActionArgs_$3220_storage_ptr", "typeString": "struct Types.ActionArgs" } }, "id": 2491, "nodeType": "ArrayTypeName", "src": "821:18:22", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_ActionArgs_$3220_storage_$dyn_storage_ptr", "typeString": "struct Types.ActionArgs[]" } }, "visibility": "internal" } ], "src": "766:94:22" }, "returnParameters": { "id": 2494, "nodeType": "ParameterList", "parameters": [], "src": "869:0:22" }, "scope": 2510, "src": "750:120:22", "stateMutability": "nonpayable", "virtual": false, "visibility": "external" }, { "functionSelector": "5ac7d17c", "id": 2502, "implemented": false, "kind": "function", "modifiers": [], "name": "getMarketIsClosing", "nodeType": "FunctionDefinition", "parameters": { "id": 2498, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 2497, "mutability": "mutable", "name": "marketId", "nodeType": "VariableDeclaration", "scope": 2502, "src": "904:16:22", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 2496, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "904:7:22", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "903:18:22" }, "returnParameters": { "id": 2501, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 2500, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "scope": 2502, "src": "945:4:22", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 2499, "name": "bool", "nodeType": "ElementaryTypeName", "src": "945:4:22", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "visibility": "internal" } ], "src": "944:6:22" }, "scope": 2510, "src": "876:75:22", "stateMutability": "view", "virtual": false, "visibility": "external" }, { "functionSelector": "062bd3e9", "id": 2509, "implemented": false, "kind": "function", "modifiers": [], "name": "getMarketTokenAddress", "nodeType": "FunctionDefinition", "parameters": { "id": 2505, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 2504, "mutability": "mutable", "name": "marketId", "nodeType": "VariableDeclaration", "scope": 2509, "src": "988:16:22", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 2503, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "988:7:22", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "987:18:22" }, "returnParameters": { "id": 2508, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 2507, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "scope": 2509, "src": "1053:7:22", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 2506, "name": "address", "nodeType": "ElementaryTypeName", "src": "1053:7:22", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "visibility": "internal" } ], "src": "1052:9:22" }, "scope": 2510, "src": "957:105:22", "stateMutability": "view", "virtual": false, "visibility": "external" } ], "scope": 2511, "src": "722:342:22" } ], "src": "640:425:22" }, "legacyAST": { "attributes": { "absolutePath": "/Users/andrekorol/src/kollateral/protocol/contracts/liquidity/dydx/ISoloMargin.sol", "exportedSymbols": { "ISoloMargin": [ 2510 ], "Types": [ 3226 ] }, "license": "Apache-2.0" }, "children": [ { "attributes": { "literals": [ "solidity", "^", "0.7", ".0" ] }, "id": 2484, "name": "PragmaDirective", "src": "640:23:22" }, { "attributes": { "literals": [ "experimental", "ABIEncoderV2" ] }, "id": 2485, "name": "PragmaDirective", "src": "664:33:22" }, { "attributes": { "SourceUnit": 3227, "absolutePath": "/Users/andrekorol/src/kollateral/protocol/contracts/liquidity/dydx/Types.sol", "file": "./Types.sol", "scope": 2511, "symbolAliases": [ null ], "unitAlias": "" }, "id": 2486, "name": "ImportDirective", "src": "699:21:22" }, { "attributes": { "abstract": false, "baseContracts": [ null ], "contractDependencies": [ null ], "contractKind": "interface", "fullyImplemented": false, "linearizedBaseContracts": [ 2510 ], "name": "ISoloMargin", "scope": 2511 }, "children": [ { "attributes": { "functionSelector": "a67a6a45", "implemented": false, "isConstructor": false, "kind": "function", "modifiers": [ null ], "name": "operate", "scope": 2510, "stateMutability": "nonpayable", "virtual": false, "visibility": "external" }, "children": [ { "children": [ { "attributes": { "constant": false, "mutability": "mutable", "name": "accounts", "scope": 2495, "stateVariable": false, "storageLocation": "memory", "type": "struct Types.AccountInfo[]", "visibility": "internal" }, "children": [ { "attributes": { "type": "struct Types.AccountInfo[]" }, "children": [ { "attributes": { "name": "Types.AccountInfo", "referencedDeclaration": 3225, "type": "struct Types.AccountInfo" }, "id": 2487, "name": "UserDefinedTypeName", "src": "776:17:22" } ], "id": 2488, "name": "ArrayTypeName", "src": "776:19:22" } ], "id": 2489, "name": "VariableDeclaration", "src": "776:35:22" }, { "attributes": { "constant": false, "mutability": "mutable", "name": "actions", "scope": 2495, "stateVariable": false, "storageLocation": "memory", "type": "struct Types.ActionArgs[]", "visibility": "internal" }, "children": [ { "attributes": { "type": "struct Types.ActionArgs[]" }, "children": [ { "attributes": { "name": "Types.ActionArgs", "referencedDeclaration": 3220, "type": "struct Types.ActionArgs" }, "id": 2490, "name": "UserDefinedTypeName", "src": "821:16:22" } ], "id": 2491, "name": "ArrayTypeName", "src": "821:18:22" } ], "id": 2492, "name": "VariableDeclaration", "src": "821:33:22" } ], "id": 2493, "name": "ParameterList", "src": "766:94:22" }, { "attributes": { "parameters": [ null ] }, "children": [], "id": 2494, "name": "ParameterList", "src": "869:0:22" } ], "id": 2495, "name": "FunctionDefinition", "src": "750:120:22" }, { "attributes": { "functionSelector": "5ac7d17c", "implemented": false, "isConstructor": false, "kind": "function", "modifiers": [ null ], "name": "getMarketIsClosing", "scope": 2510, "stateMutability": "view", "virtual": false, "visibility": "external" }, "children": [ { "children": [ { "attributes": { "constant": false, "mutability": "mutable", "name": "marketId", "scope": 2502, "stateVariable": false, "storageLocation": "default", "type": "uint256", "visibility": "internal" }, "children": [ { "attributes": { "name": "uint256", "type": "uint256" }, "id": 2496, "name": "ElementaryTypeName", "src": "904:7:22" } ], "id": 2497, "name": "VariableDeclaration", "src": "904:16:22" } ], "id": 2498, "name": "ParameterList", "src": "903:18:22" }, { "children": [ { "attributes": { "constant": false, "mutability": "mutable", "name": "", "scope": 2502, "stateVariable": false, "storageLocation": "default", "type": "bool", "visibility": "internal" }, "children": [ { "attributes": { "name": "bool", "type": "bool" }, "id": 2499, "name": "ElementaryTypeName", "src": "945:4:22" } ], "id": 2500, "name": "VariableDeclaration", "src": "945:4:22" } ], "id": 2501, "name": "ParameterList", "src": "944:6:22" } ], "id": 2502, "name": "FunctionDefinition", "src": "876:75:22" }, { "attributes": { "functionSelector": "062bd3e9", "implemented": false, "isConstructor": false, "kind": "function", "modifiers": [ null ], "name": "getMarketTokenAddress", "scope": 2510, "stateMutability": "view", "virtual": false, "visibility": "external" }, "children": [ { "children": [ { "attributes": { "constant": false, "mutability": "mutable", "name": "marketId", "scope": 2509, "stateVariable": false, "storageLocation": "default", "type": "uint256", "visibility": "internal" }, "children": [ { "attributes": { "name": "uint256", "type": "uint256" }, "id": 2503, "name": "ElementaryTypeName", "src": "988:7:22" } ], "id": 2504, "name": "VariableDeclaration", "src": "988:16:22" } ], "id": 2505, "name": "ParameterList", "src": "987:18:22" }, { "children": [ { "attributes": { "constant": false, "mutability": "mutable", "name": "", "scope": 2509, "stateVariable": false, "storageLocation": "default", "type": "address", "visibility": "internal" }, "children": [ { "attributes": { "name": "address", "stateMutability": "nonpayable", "type": "address" }, "id": 2506, "name": "ElementaryTypeName", "src": "1053:7:22" } ], "id": 2507, "name": "VariableDeclaration", "src": "1053:7:22" } ], "id": 2508, "name": "ParameterList", "src": "1052:9:22" } ], "id": 2509, "name": "FunctionDefinition", "src": "957:105:22" } ], "id": 2510, "name": "ContractDefinition", "src": "722:342:22" } ], "id": 2511, "name": "SourceUnit", "src": "640:425:22" }, "compiler": { "name": "solc", "version": "0.7.3+commit.9bfce1f6.Emscripten.clang" }, "networks": {}, "schemaVersion": "3.3.3", "updatedAt": "2021-02-01T23:13:33.221Z", "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }