@dolomite-exchange/dolomite-margin
Version:
Ethereum Smart Contracts and TypeScript library used for the DolomiteMargin trading protocol
852 lines • 35.4 kB
JSON
{
"contractName": "AccountMarginLib",
"abi": [],
"metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Dolomite * Library contract that has various utility functions for margin positions/accounts\",\"methods\":{},\"title\":\"AccountMarginLib\"},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/lib/AccountMarginLib.sol\":\"AccountMarginLib\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/lib/AccountMarginLib.sol\":{\"keccak256\":\"0x89ae8f313e4049678e631e37b5be6997bfbe0e166ed7fd1950d3a5e92d5d5a7b\",\"urls\":[\"bzz-raw://4bd3b9451005677e94a0420e4a464f05e12fb1333a2233041dbdc10bf43deb30\",\"dweb:/ipfs/QmNT6XZipEpNVVJrKpXqcNH1mtzVqTe3kVXDQKFxV1WYSe\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Account.sol\":{\"keccak256\":\"0x2059276ea5e478bd5ac7f2712e7b1b6c85d291c647a54b264909044844828e67\",\"urls\":[\"bzz-raw://f153777051d12131b13a57e5c3af10a2670927cfc7d22c9519ab20c9b4b9bc89\",\"dweb:/ipfs/QmQMP3qS5xDAVGYKDfNkbkSqBKozQGQsGqX4e8VyjRtxPS\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/DolomiteMarginMath.sol\":{\"keccak256\":\"0x53f205f6a779d579be29faa9412c806a892b3e605fff092dfd9d14d936fa019f\",\"urls\":[\"bzz-raw://0ff936f89602a63b8e6a4eb4ce8f87673c0f45b7ce29694920905a3f0b5a6a69\",\"dweb:/ipfs/QmbYME9BeEvPC1ndV8EaUDX5fDMghLc3rocNUxFtgHmg8m\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/EnumerableSet.sol\":{\"keccak256\":\"0x41a3460e34b7b8635d936e35e6568ceb5354b638f53b884530e0d4875fa0f151\",\"urls\":[\"bzz-raw://d1a5ba866ee95d455afe5075dadd91fc71c2806371f2c1b358a1f67c632bb0df\",\"dweb:/ipfs/QmW4qCjmsG8J3UJv97GwDLDM7wt1K4yLDKAwzWMY7TFYi5\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Require.sol\":{\"keccak256\":\"0x05a2a90b41b6a5f42f0a72da63d015fb0b406a9ba2172823352e522e8bf3a606\",\"urls\":[\"bzz-raw://19883f0c6d33266f756ec5c3d17539524aa24b993c46c33f8400801d09373a6c\",\"dweb:/ipfs/QmYX2fwK3vQQDSZLMrc5wMfeb8RWrcC9CGX8XECLty8QDk\"]},\"/home/cdc218/projects/dolomite/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": "0x60636023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea365627a7a72315820f412a78d16e62be9d53b3e180c6e28b49af9047f79113b66762d9bab99c8b71b6c6578706572696d656e74616cf564736f6c63430005100040",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea365627a7a72315820f412a78d16e62be9d53b3e180c6e28b49af9047f79113b66762d9bab99c8b71b6c6578706572696d656e74616cf564736f6c63430005100040",
"sourceMap": "857:782:36:-;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24",
"deployedSourceMap": "857:782:36:-;;;;;;;;",
"source": "/*\n\n Copyright 2022 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\";\n\n\n/**\n * @title AccountMarginLib\n * @author Dolomite\n *\n * Library contract that has various utility functions for margin positions/accounts\n */\nlibrary AccountMarginLib {\n\n // ============ Constants ============\n\n bytes32 private constant FILE = \"AccountMarginLib\";\n\n // ============ Functions ============\n\n /**\n * Checks if an account is margin account by whether or not it's `>= 100` (since users have to split assets into\n * segments of 32).\n */\n function isMarginAccount(\n uint256 _accountIndex\n ) internal pure returns (bool) {\n return _accountIndex >= 100;\n }\n\n /**\n * Checks if an account is margin account by whether or not it's `>= 100` (since users have to split assets into\n * segments of 32).\n */\n function isMarginAccount(\n Account.Info memory _account\n ) internal pure returns (bool) {\n return _account.number >= 100;\n }\n}\n",
"sourcePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/lib/AccountMarginLib.sol",
"ast": {
"absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/lib/AccountMarginLib.sol",
"exportedSymbols": {
"AccountMarginLib": [
5925
]
},
"id": 5926,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 5893,
"literals": [
"solidity",
"^",
"0.5",
".7"
],
"nodeType": "PragmaDirective",
"src": "595:23:36"
},
{
"id": 5894,
"literals": [
"experimental",
"ABIEncoderV2"
],
"nodeType": "PragmaDirective",
"src": "619:33:36"
},
{
"absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Account.sol",
"file": "../../protocol/lib/Account.sol",
"id": 5896,
"nodeType": "ImportDirective",
"scope": 5926,
"sourceUnit": 24886,
"src": "654:57:36",
"symbolAliases": [
{
"foreign": 5895,
"local": null
}
],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": "@title AccountMarginLib\n@author Dolomite\n * Library contract that has various utility functions for margin positions/accounts",
"fullyImplemented": true,
"id": 5925,
"linearizedBaseContracts": [
5925
],
"name": "AccountMarginLib",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": true,
"id": 5899,
"name": "FILE",
"nodeType": "VariableDeclaration",
"scope": 5925,
"src": "933:50:36",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 5897,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "933:7:36",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": {
"argumentTypes": null,
"hexValue": "4163636f756e744d617267696e4c6962",
"id": 5898,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "965:18:36",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_bb8380f78c160408819a21ad3e375d3cc53583382631e9e16b4f324c625fbcb1",
"typeString": "literal_string \"AccountMarginLib\""
},
"value": "AccountMarginLib"
},
"visibility": "private"
},
{
"body": {
"id": 5910,
"nodeType": "Block",
"src": "1284:44:36",
"statements": [
{
"expression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 5908,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 5906,
"name": "_accountIndex",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5901,
"src": "1301:13:36",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">=",
"rightExpression": {
"argumentTypes": null,
"hexValue": "313030",
"id": 5907,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1318:3:36",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_100_by_1",
"typeString": "int_const 100"
},
"value": "100"
},
"src": "1301:20:36",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"functionReturnParameters": 5905,
"id": 5909,
"nodeType": "Return",
"src": "1294:27:36"
}
]
},
"documentation": " Checks if an account is margin account by whether or not it's `>= 100` (since users have to split assets into\n segments of 32).",
"id": 5911,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "isMarginAccount",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 5902,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5901,
"name": "_accountIndex",
"nodeType": "VariableDeclaration",
"scope": 5911,
"src": "1227:21:36",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 5900,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1227:7:36",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1217:37:36"
},
"returnParameters": {
"id": 5905,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5904,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 5911,
"src": "1278:4:36",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 5903,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "1278:4:36",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1277:6:36"
},
"scope": 5925,
"src": "1193:135:36",
"stateMutability": "pure",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 5923,
"nodeType": "Block",
"src": "1591:46:36",
"statements": [
{
"expression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 5921,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 5918,
"name": "_account",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5913,
"src": "1608:8:36",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$24851_memory_ptr",
"typeString": "struct Account.Info memory"
}
},
"id": 5919,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "number",
"nodeType": "MemberAccess",
"referencedDeclaration": 24850,
"src": "1608:15:36",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">=",
"rightExpression": {
"argumentTypes": null,
"hexValue": "313030",
"id": 5920,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1627:3:36",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_100_by_1",
"typeString": "int_const 100"
},
"value": "100"
},
"src": "1608:22:36",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"functionReturnParameters": 5917,
"id": 5922,
"nodeType": "Return",
"src": "1601:29:36"
}
]
},
"documentation": " Checks if an account is margin account by whether or not it's `>= 100` (since users have to split assets into\n segments of 32).",
"id": 5924,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "isMarginAccount",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 5914,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5913,
"name": "_account",
"nodeType": "VariableDeclaration",
"scope": 5924,
"src": "1527:28:36",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$24851_memory_ptr",
"typeString": "struct Account.Info"
},
"typeName": {
"contractScope": null,
"id": 5912,
"name": "Account.Info",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 24851,
"src": "1527:12:36",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$24851_storage_ptr",
"typeString": "struct Account.Info"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1517:44:36"
},
"returnParameters": {
"id": 5917,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5916,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 5924,
"src": "1585:4:36",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 5915,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "1585:4:36",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1584:6:36"
},
"scope": 5925,
"src": "1493:144:36",
"stateMutability": "pure",
"superFunction": null,
"visibility": "internal"
}
],
"scope": 5926,
"src": "857:782:36"
}
],
"src": "595:1045:36"
},
"legacyAST": {
"absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/lib/AccountMarginLib.sol",
"exportedSymbols": {
"AccountMarginLib": [
5925
]
},
"id": 5926,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 5893,
"literals": [
"solidity",
"^",
"0.5",
".7"
],
"nodeType": "PragmaDirective",
"src": "595:23:36"
},
{
"id": 5894,
"literals": [
"experimental",
"ABIEncoderV2"
],
"nodeType": "PragmaDirective",
"src": "619:33:36"
},
{
"absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Account.sol",
"file": "../../protocol/lib/Account.sol",
"id": 5896,
"nodeType": "ImportDirective",
"scope": 5926,
"sourceUnit": 24886,
"src": "654:57:36",
"symbolAliases": [
{
"foreign": 5895,
"local": null
}
],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": "@title AccountMarginLib\n@author Dolomite\n * Library contract that has various utility functions for margin positions/accounts",
"fullyImplemented": true,
"id": 5925,
"linearizedBaseContracts": [
5925
],
"name": "AccountMarginLib",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": true,
"id": 5899,
"name": "FILE",
"nodeType": "VariableDeclaration",
"scope": 5925,
"src": "933:50:36",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 5897,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "933:7:36",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": {
"argumentTypes": null,
"hexValue": "4163636f756e744d617267696e4c6962",
"id": 5898,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "965:18:36",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_bb8380f78c160408819a21ad3e375d3cc53583382631e9e16b4f324c625fbcb1",
"typeString": "literal_string \"AccountMarginLib\""
},
"value": "AccountMarginLib"
},
"visibility": "private"
},
{
"body": {
"id": 5910,
"nodeType": "Block",
"src": "1284:44:36",
"statements": [
{
"expression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 5908,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 5906,
"name": "_accountIndex",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5901,
"src": "1301:13:36",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">=",
"rightExpression": {
"argumentTypes": null,
"hexValue": "313030",
"id": 5907,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1318:3:36",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_100_by_1",
"typeString": "int_const 100"
},
"value": "100"
},
"src": "1301:20:36",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"functionReturnParameters": 5905,
"id": 5909,
"nodeType": "Return",
"src": "1294:27:36"
}
]
},
"documentation": " Checks if an account is margin account by whether or not it's `>= 100` (since users have to split assets into\n segments of 32).",
"id": 5911,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "isMarginAccount",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 5902,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5901,
"name": "_accountIndex",
"nodeType": "VariableDeclaration",
"scope": 5911,
"src": "1227:21:36",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 5900,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1227:7:36",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1217:37:36"
},
"returnParameters": {
"id": 5905,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5904,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 5911,
"src": "1278:4:36",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 5903,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "1278:4:36",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1277:6:36"
},
"scope": 5925,
"src": "1193:135:36",
"stateMutability": "pure",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 5923,
"nodeType": "Block",
"src": "1591:46:36",
"statements": [
{
"expression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 5921,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 5918,
"name": "_account",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5913,
"src": "1608:8:36",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$24851_memory_ptr",
"typeString": "struct Account.Info memory"
}
},
"id": 5919,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "number",
"nodeType": "MemberAccess",
"referencedDeclaration": 24850,
"src": "1608:15:36",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">=",
"rightExpression": {
"argumentTypes": null,
"hexValue": "313030",
"id": 5920,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1627:3:36",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_100_by_1",
"typeString": "int_const 100"
},
"value": "100"
},
"src": "1608:22:36",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"functionReturnParameters": 5917,
"id": 5922,
"nodeType": "Return",
"src": "1601:29:36"
}
]
},
"documentation": " Checks if an account is margin account by whether or not it's `>= 100` (since users have to split assets into\n segments of 32).",
"id": 5924,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "isMarginAccount",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 5914,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5913,
"name": "_account",
"nodeType": "VariableDeclaration",
"scope": 5924,
"src": "1527:28:36",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$24851_memory_ptr",
"typeString": "struct Account.Info"
},
"typeName": {
"contractScope": null,
"id": 5912,
"name": "Account.Info",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 24851,
"src": "1527:12:36",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$24851_storage_ptr",
"typeString": "struct Account.Info"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1517:44:36"
},
"returnParameters": {
"id": 5917,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5916,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 5924,
"src": "1585:4:36",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 5915,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "1585:4:36",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1584:6:36"
},
"scope": 5925,
"src": "1493:144:36",
"stateMutability": "pure",
"superFunction": null,
"visibility": "internal"
}
],
"scope": 5926,
"src": "857:782:36"
}
],
"src": "595:1045:36"
},
"compiler": {
"name": "solc",
"version": "0.5.16+commit.9c3226ce.Emscripten.clang"
},
"networks": {},
"schemaVersion": "3.0.23",
"updatedAt": "2026-03-02T16:38:28.581Z",
"devdoc": {
"author": "Dolomite * Library contract that has various utility functions for margin positions/accounts",
"methods": {},
"title": "AccountMarginLib"
},
"userdoc": {
"methods": {}
}
}