@dolomite-exchange/dolomite-margin
Version:
Ethereum Smart Contracts and TypeScript library used for the DolomiteMargin trading protocol
1,288 lines • 68.7 kB
JSON
{
"contractName": "IExpiry",
"abi": [
{
"constant": true,
"inputs": [],
"name": "g_expiryRampTime",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "uint256",
"name": "number",
"type": "uint256"
}
],
"internalType": "struct Account.Info",
"name": "liquidAccount",
"type": "tuple"
},
{
"internalType": "uint256",
"name": "heldMarketId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "owedMarketId",
"type": "uint256"
},
{
"internalType": "uint32",
"name": "expiry",
"type": "uint32"
}
],
"name": "getLiquidationSpreadAdjustedPrices",
"outputs": [
{
"components": [
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"internalType": "struct Monetary.Price",
"name": "heldPrice",
"type": "tuple"
},
{
"components": [
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"internalType": "struct Monetary.Price",
"name": "owedPriceAdj",
"type": "tuple"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "uint256",
"name": "heldMarketId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "owedMarketId",
"type": "uint256"
},
{
"internalType": "uint32",
"name": "expiry",
"type": "uint32"
}
],
"name": "getSpreadAdjustedPrices",
"outputs": [
{
"components": [
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"internalType": "struct Monetary.Price",
"name": "heldPrice",
"type": "tuple"
},
{
"components": [
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"internalType": "struct Monetary.Price",
"name": "owedPriceAdj",
"type": "tuple"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "uint256",
"name": "number",
"type": "uint256"
}
],
"internalType": "struct Account.Info",
"name": "account",
"type": "tuple"
},
{
"internalType": "uint256",
"name": "marketId",
"type": "uint256"
}
],
"name": "getExpiry",
"outputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
],
"metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"g_expiryRampTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"number\",\"type\":\"uint256\"}],\"internalType\":\"struct Account.Info\",\"name\":\"account\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"marketId\",\"type\":\"uint256\"}],\"name\":\"getExpiry\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"number\",\"type\":\"uint256\"}],\"internalType\":\"struct Account.Info\",\"name\":\"liquidAccount\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"heldMarketId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"owedMarketId\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"expiry\",\"type\":\"uint32\"}],\"name\":\"getLiquidationSpreadAdjustedPrices\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"internalType\":\"struct Monetary.Price\",\"name\":\"heldPrice\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"internalType\":\"struct Monetary.Price\",\"name\":\"owedPriceAdj\",\"type\":\"tuple\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"heldMarketId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"owedMarketId\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"expiry\",\"type\":\"uint32\"}],\"name\":\"getSpreadAdjustedPrices\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"internalType\":\"struct Monetary.Price\",\"name\":\"heldPrice\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"internalType\":\"struct Monetary.Price\",\"name\":\"owedPriceAdj\",\"type\":\"tuple\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Dolomite\",\"methods\":{},\"title\":\"IExpiry\"},\"userdoc\":{\"methods\":{\"getSpreadAdjustedPrices(uint256,uint256,uint32)\":{\"notice\":\"Backwards-compatible version of this function for Dolomite Margin V1\"}}}},\"settings\":{\"compilationTarget\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IExpiry.sol\":\"IExpiry\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IExpiry.sol\":{\"keccak256\":\"0xa7b197139e570e823cab42c3b8500c9c5edc8a40110970a7d6fe60f05864ba10\",\"urls\":[\"bzz-raw://4f469be063d8f694c5277650bc53ac2c0d164f62e36c6a9ab7dad126479990a9\",\"dweb:/ipfs/Qme4sTbGi4T2QhsJSweqGzqm5rxQkypy27g1vLy8ipVijV\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Account.sol\":{\"keccak256\":\"0x2059276ea5e478bd5ac7f2712e7b1b6c85d291c647a54b264909044844828e67\",\"urls\":[\"bzz-raw://f153777051d12131b13a57e5c3af10a2670927cfc7d22c9519ab20c9b4b9bc89\",\"dweb:/ipfs/QmQMP3qS5xDAVGYKDfNkbkSqBKozQGQsGqX4e8VyjRtxPS\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/DolomiteMarginMath.sol\":{\"keccak256\":\"0x53f205f6a779d579be29faa9412c806a892b3e605fff092dfd9d14d936fa019f\",\"urls\":[\"bzz-raw://0ff936f89602a63b8e6a4eb4ce8f87673c0f45b7ce29694920905a3f0b5a6a69\",\"dweb:/ipfs/QmbYME9BeEvPC1ndV8EaUDX5fDMghLc3rocNUxFtgHmg8m\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/EnumerableSet.sol\":{\"keccak256\":\"0x41a3460e34b7b8635d936e35e6568ceb5354b638f53b884530e0d4875fa0f151\",\"urls\":[\"bzz-raw://d1a5ba866ee95d455afe5075dadd91fc71c2806371f2c1b358a1f67c632bb0df\",\"dweb:/ipfs/QmW4qCjmsG8J3UJv97GwDLDM7wt1K4yLDKAwzWMY7TFYi5\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Monetary.sol\":{\"keccak256\":\"0x5257274f2d4d3605f3e97ec45fb902111fe9a22506f0b4cf308ea933bc81bfe2\",\"urls\":[\"bzz-raw://85b8023b78805063a2ec8d376f1f5983994eabd96efd8ceadb0224dbb71c5678\",\"dweb:/ipfs/QmaDhzCzRqsuHuJfhToEC4pATQHwhh7yWWsjwfuRzFT1kG\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Require.sol\":{\"keccak256\":\"0x05a2a90b41b6a5f42f0a72da63d015fb0b406a9ba2172823352e522e8bf3a606\",\"urls\":[\"bzz-raw://19883f0c6d33266f756ec5c3d17539524aa24b993c46c33f8400801d09373a6c\",\"dweb:/ipfs/QmYX2fwK3vQQDSZLMrc5wMfeb8RWrcC9CGX8XECLty8QDk\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Types.sol\":{\"keccak256\":\"0xe1bab8c8799d83e86c7a49aaf815d8e3bc8d09562d46d44d921500db5e98de0e\",\"urls\":[\"bzz-raw://8ea3d0cc4fdab6dd9bba545a792170f939b342d8d1a7051c1c6365009af72658\",\"dweb:/ipfs/QmaLJgbavu88eEit6JPqfWnw6NmGBDZfveMXxumgWywBFG\"]},\"@openzeppelin/contracts/math/SafeMath.sol\":{\"keccak256\":\"0x640b6dee7a4b830bdfd52b5031a07fc2b12209f5b2e29e5d364a7d37f69d8076\",\"urls\":[\"bzz-raw://31113152e1ddb78fe7a4197f247591ca894e93f916867beb708d8e747b6cc74f\",\"dweb:/ipfs/QmbZaJyXdpsYGykVhHH9qpVGQg9DGCxE2QufbCUy3daTgq\"]}},\"version\":1}",
"bytecode": "0x",
"deployedBytecode": "0x",
"sourceMap": "",
"deployedSourceMap": "",
"source": "/*\n\n Copyright 2021 Dolomite.\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\npragma solidity ^0.5.7;\npragma experimental ABIEncoderV2;\n\nimport { Account } from \"../../protocol/lib/Account.sol\";\nimport { Monetary } from \"../../protocol/lib/Monetary.sol\";\n\n\n/**\n * @title IExpiry\n * @author Dolomite\n */\ninterface IExpiry {\n\n // ============ Enums ============\n\n enum CallFunctionType {\n SetExpiry,\n SetApproval\n }\n\n // ============ Structs ============\n\n struct SetExpiryArg {\n Account.Info account;\n uint256 marketId;\n uint32 timeDelta;\n bool forceUpdate;\n }\n\n struct SetApprovalArg {\n address sender;\n uint32 minTimeDelta;\n }\n\n // ============ Functions ============\n\n function g_expiryRampTime() external view returns (uint256);\n\n function getLiquidationSpreadAdjustedPrices(\n Account.Info calldata liquidAccount,\n uint256 heldMarketId,\n uint256 owedMarketId,\n uint32 expiry\n )\n external\n view\n returns (Monetary.Price memory heldPrice, Monetary.Price memory owedPriceAdj);\n\n /**\n * @notice Backwards-compatible version of this function for Dolomite Margin V1\n */\n function getSpreadAdjustedPrices(\n uint256 heldMarketId,\n uint256 owedMarketId,\n uint32 expiry\n )\n external\n view\n returns (Monetary.Price memory heldPrice, Monetary.Price memory owedPriceAdj);\n\n function getExpiry(\n Account.Info calldata account,\n uint256 marketId\n )\n external\n view\n returns (uint32);\n\n}\n",
"sourcePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IExpiry.sol",
"ast": {
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IExpiry.sol",
"exportedSymbols": {
"IExpiry": [
4565
]
},
"id": 4566,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 4500,
"literals": [
"solidity",
"^",
"0.5",
".7"
],
"nodeType": "PragmaDirective",
"src": "595:23:24"
},
{
"id": 4501,
"literals": [
"experimental",
"ABIEncoderV2"
],
"nodeType": "PragmaDirective",
"src": "619:33:24"
},
{
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Account.sol",
"file": "../../protocol/lib/Account.sol",
"id": 4503,
"nodeType": "ImportDirective",
"scope": 4566,
"sourceUnit": 24886,
"src": "654:57:24",
"symbolAliases": [
{
"foreign": 4502,
"local": null
}
],
"unitAlias": ""
},
{
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Monetary.sol",
"file": "../../protocol/lib/Monetary.sol",
"id": 4505,
"nodeType": "ImportDirective",
"scope": 4566,
"sourceUnit": 27761,
"src": "712:59:24",
"symbolAliases": [
{
"foreign": 4504,
"local": null
}
],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "interface",
"documentation": "@title IExpiry\n@author Dolomite",
"fullyImplemented": false,
"id": 4565,
"linearizedBaseContracts": [
4565
],
"name": "IExpiry",
"nodeType": "ContractDefinition",
"nodes": [
{
"canonicalName": "IExpiry.CallFunctionType",
"id": 4508,
"members": [
{
"id": 4506,
"name": "SetExpiry",
"nodeType": "EnumValue",
"src": "917:9:24"
},
{
"id": 4507,
"name": "SetApproval",
"nodeType": "EnumValue",
"src": "936:11:24"
}
],
"name": "CallFunctionType",
"nodeType": "EnumDefinition",
"src": "885:68:24"
},
{
"canonicalName": "IExpiry.SetExpiryArg",
"id": 4517,
"members": [
{
"constant": false,
"id": 4510,
"name": "account",
"nodeType": "VariableDeclaration",
"scope": 4517,
"src": "1031:20:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$24851_storage_ptr",
"typeString": "struct Account.Info"
},
"typeName": {
"contractScope": null,
"id": 4509,
"name": "Account.Info",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 24851,
"src": "1031:12:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$24851_storage_ptr",
"typeString": "struct Account.Info"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4512,
"name": "marketId",
"nodeType": "VariableDeclaration",
"scope": 4517,
"src": "1061:16:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4511,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1061:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4514,
"name": "timeDelta",
"nodeType": "VariableDeclaration",
"scope": 4517,
"src": "1087:16:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
"typeName": {
"id": 4513,
"name": "uint32",
"nodeType": "ElementaryTypeName",
"src": "1087:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4516,
"name": "forceUpdate",
"nodeType": "VariableDeclaration",
"scope": 4517,
"src": "1113:16:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 4515,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "1113:4:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"name": "SetExpiryArg",
"nodeType": "StructDefinition",
"scope": 4565,
"src": "1001:135:24",
"visibility": "public"
},
{
"canonicalName": "IExpiry.SetApprovalArg",
"id": 4522,
"members": [
{
"constant": false,
"id": 4519,
"name": "sender",
"nodeType": "VariableDeclaration",
"scope": 4522,
"src": "1174:14:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4518,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1174:7:24",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4521,
"name": "minTimeDelta",
"nodeType": "VariableDeclaration",
"scope": 4522,
"src": "1198:19:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
"typeName": {
"id": 4520,
"name": "uint32",
"nodeType": "ElementaryTypeName",
"src": "1198:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"value": null,
"visibility": "internal"
}
],
"name": "SetApprovalArg",
"nodeType": "StructDefinition",
"scope": 4565,
"src": "1142:82:24",
"visibility": "public"
},
{
"body": null,
"documentation": null,
"id": 4527,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "g_expiryRampTime",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4523,
"nodeType": "ParameterList",
"parameters": [],
"src": "1299:2:24"
},
"returnParameters": {
"id": 4526,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4525,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 4527,
"src": "1325:7:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4524,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1325:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1324:9:24"
},
"scope": 4565,
"src": "1274:60:24",
"stateMutability": "view",
"superFunction": null,
"visibility": "external"
},
{
"body": null,
"documentation": null,
"id": 4542,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "getLiquidationSpreadAdjustedPrices",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4536,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4529,
"name": "liquidAccount",
"nodeType": "VariableDeclaration",
"scope": 4542,
"src": "1393:35:24",
"stateVariable": false,
"storageLocation": "calldata",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$24851_calldata_ptr",
"typeString": "struct Account.Info"
},
"typeName": {
"contractScope": null,
"id": 4528,
"name": "Account.Info",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 24851,
"src": "1393:12:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$24851_storage_ptr",
"typeString": "struct Account.Info"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4531,
"name": "heldMarketId",
"nodeType": "VariableDeclaration",
"scope": 4542,
"src": "1438:20:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4530,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1438:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4533,
"name": "owedMarketId",
"nodeType": "VariableDeclaration",
"scope": 4542,
"src": "1468:20:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4532,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1468:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4535,
"name": "expiry",
"nodeType": "VariableDeclaration",
"scope": 4542,
"src": "1498:13:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
"typeName": {
"id": 4534,
"name": "uint32",
"nodeType": "ElementaryTypeName",
"src": "1498:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1383:134:24"
},
"returnParameters": {
"id": 4541,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4538,
"name": "heldPrice",
"nodeType": "VariableDeclaration",
"scope": 4542,
"src": "1565:31:24",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Price_$27756_memory_ptr",
"typeString": "struct Monetary.Price"
},
"typeName": {
"contractScope": null,
"id": 4537,
"name": "Monetary.Price",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 27756,
"src": "1565:14:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Price_$27756_storage_ptr",
"typeString": "struct Monetary.Price"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4540,
"name": "owedPriceAdj",
"nodeType": "VariableDeclaration",
"scope": 4542,
"src": "1598:34:24",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Price_$27756_memory_ptr",
"typeString": "struct Monetary.Price"
},
"typeName": {
"contractScope": null,
"id": 4539,
"name": "Monetary.Price",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 27756,
"src": "1598:14:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Price_$27756_storage_ptr",
"typeString": "struct Monetary.Price"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1564:69:24"
},
"scope": 4565,
"src": "1340:294:24",
"stateMutability": "view",
"superFunction": null,
"visibility": "external"
},
{
"body": null,
"documentation": "@notice Backwards-compatible version of this function for Dolomite Margin V1",
"id": 4555,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "getSpreadAdjustedPrices",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4549,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4544,
"name": "heldMarketId",
"nodeType": "VariableDeclaration",
"scope": 4555,
"src": "1782:20:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4543,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1782:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4546,
"name": "owedMarketId",
"nodeType": "VariableDeclaration",
"scope": 4555,
"src": "1812:20:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4545,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1812:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4548,
"name": "expiry",
"nodeType": "VariableDeclaration",
"scope": 4555,
"src": "1842:13:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
"typeName": {
"id": 4547,
"name": "uint32",
"nodeType": "ElementaryTypeName",
"src": "1842:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1772:89:24"
},
"returnParameters": {
"id": 4554,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4551,
"name": "heldPrice",
"nodeType": "VariableDeclaration",
"scope": 4555,
"src": "1909:31:24",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Price_$27756_memory_ptr",
"typeString": "struct Monetary.Price"
},
"typeName": {
"contractScope": null,
"id": 4550,
"name": "Monetary.Price",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 27756,
"src": "1909:14:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Price_$27756_storage_ptr",
"typeString": "struct Monetary.Price"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4553,
"name": "owedPriceAdj",
"nodeType": "VariableDeclaration",
"scope": 4555,
"src": "1942:34:24",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Price_$27756_memory_ptr",
"typeString": "struct Monetary.Price"
},
"typeName": {
"contractScope": null,
"id": 4552,
"name": "Monetary.Price",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 27756,
"src": "1942:14:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Price_$27756_storage_ptr",
"typeString": "struct Monetary.Price"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1908:69:24"
},
"scope": 4565,
"src": "1740:238:24",
"stateMutability": "view",
"superFunction": null,
"visibility": "external"
},
{
"body": null,
"documentation": null,
"id": 4564,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "getExpiry",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4560,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4557,
"name": "account",
"nodeType": "VariableDeclaration",
"scope": 4564,
"src": "2012:29:24",
"stateVariable": false,
"storageLocation": "calldata",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$24851_calldata_ptr",
"typeString": "struct Account.Info"
},
"typeName": {
"contractScope": null,
"id": 4556,
"name": "Account.Info",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 24851,
"src": "2012:12:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$24851_storage_ptr",
"typeString": "struct Account.Info"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4559,
"name": "marketId",
"nodeType": "VariableDeclaration",
"scope": 4564,
"src": "2051:16:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4558,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2051:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2002:71:24"
},
"returnParameters": {
"id": 4563,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4562,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 4564,
"src": "2121:6:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
"typeName": {
"id": 4561,
"name": "uint32",
"nodeType": "ElementaryTypeName",
"src": "2121:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2120:8:24"
},
"scope": 4565,
"src": "1984:145:24",
"stateMutability": "view",
"superFunction": null,
"visibility": "external"
}
],
"scope": 4566,
"src": "820:1312:24"
}
],
"src": "595:1538:24"
},
"legacyAST": {
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IExpiry.sol",
"exportedSymbols": {
"IExpiry": [
4565
]
},
"id": 4566,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 4500,
"literals": [
"solidity",
"^",
"0.5",
".7"
],
"nodeType": "PragmaDirective",
"src": "595:23:24"
},
{
"id": 4501,
"literals": [
"experimental",
"ABIEncoderV2"
],
"nodeType": "PragmaDirective",
"src": "619:33:24"
},
{
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Account.sol",
"file": "../../protocol/lib/Account.sol",
"id": 4503,
"nodeType": "ImportDirective",
"scope": 4566,
"sourceUnit": 24886,
"src": "654:57:24",
"symbolAliases": [
{
"foreign": 4502,
"local": null
}
],
"unitAlias": ""
},
{
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Monetary.sol",
"file": "../../protocol/lib/Monetary.sol",
"id": 4505,
"nodeType": "ImportDirective",
"scope": 4566,
"sourceUnit": 27761,
"src": "712:59:24",
"symbolAliases": [
{
"foreign": 4504,
"local": null
}
],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "interface",
"documentation": "@title IExpiry\n@author Dolomite",
"fullyImplemented": false,
"id": 4565,
"linearizedBaseContracts": [
4565
],
"name": "IExpiry",
"nodeType": "ContractDefinition",
"nodes": [
{
"canonicalName": "IExpiry.CallFunctionType",
"id": 4508,
"members": [
{
"id": 4506,
"name": "SetExpiry",
"nodeType": "EnumValue",
"src": "917:9:24"
},
{
"id": 4507,
"name": "SetApproval",
"nodeType": "EnumValue",
"src": "936:11:24"
}
],
"name": "CallFunctionType",
"nodeType": "EnumDefinition",
"src": "885:68:24"
},
{
"canonicalName": "IExpiry.SetExpiryArg",
"id": 4517,
"members": [
{
"constant": false,
"id": 4510,
"name": "account",
"nodeType": "VariableDeclaration",
"scope": 4517,
"src": "1031:20:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$24851_storage_ptr",
"typeString": "struct Account.Info"
},
"typeName": {
"contractScope": null,
"id": 4509,
"name": "Account.Info",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 24851,
"src": "1031:12:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$24851_storage_ptr",
"typeString": "struct Account.Info"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4512,
"name": "marketId",
"nodeType": "VariableDeclaration",
"scope": 4517,
"src": "1061:16:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4511,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1061:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4514,
"name": "timeDelta",
"nodeType": "VariableDeclaration",
"scope": 4517,
"src": "1087:16:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
"typeName": {
"id": 4513,
"name": "uint32",
"nodeType": "ElementaryTypeName",
"src": "1087:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4516,
"name": "forceUpdate",
"nodeType": "VariableDeclaration",
"scope": 4517,
"src": "1113:16:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 4515,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "1113:4:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"name": "SetExpiryArg",
"nodeType": "StructDefinition",
"scope": 4565,
"src": "1001:135:24",
"visibility": "public"
},
{
"canonicalName": "IExpiry.SetApprovalArg",
"id": 4522,
"members": [
{
"constant": false,
"id": 4519,
"name": "sender",
"nodeType": "VariableDeclaration",
"scope": 4522,
"src": "1174:14:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4518,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1174:7:24",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4521,
"name": "minTimeDelta",
"nodeType": "VariableDeclaration",
"scope": 4522,
"src": "1198:19:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
"typeName": {
"id": 4520,
"name": "uint32",
"nodeType": "ElementaryTypeName",
"src": "1198:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"value": null,
"visibility": "internal"
}
],
"name": "SetApprovalArg",
"nodeType": "StructDefinition",
"scope": 4565,
"src": "1142:82:24",
"visibility": "public"
},
{
"body": null,
"documentation": null,
"id": 4527,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "g_expiryRampTime",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4523,
"nodeType": "ParameterList",
"parameters": [],
"src": "1299:2:24"
},
"returnParameters": {
"id": 4526,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4525,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 4527,
"src": "1325:7:24",
"stateVariable": false,
"storageLocation": "default",
"typeDe