{
    "Function": "weightedAndSpotCollateral",
    "File": "contracts/MarginAccount.sol",
    "Parent Contracts": [
        "contracts/legos/HubbleBase.sol",
        "node_modules/@openzeppelin/contracts/metatx/ERC2771Context.sol",
        "node_modules/@openzeppelin/contracts/security/Pausable.sol",
        "node_modules/@openzeppelin/contracts/utils/Context.sol",
        "contracts/legos/Governable.sol",
        "node_modules/@openzeppelin/contracts/proxy/utils/Initializable.sol",
        "contracts/legos/Governable.sol",
        "contracts/Interfaces.sol"
    ],
    "High-Level Calls": [
        "SafeCast",
        "IOracle"
    ],
    "Internal Calls": [],
    "Library Calls": [
        "toInt256"
    ],
    "Low-Level Calls": [],
    "Code": "function weightedAndSpotCollateral(address trader)\n        public\n        view\n        returns (int256 weighted, int256 spot)\n    {\n        Collateral[] memory assets = supportedCollateral;\n        Collateral memory _collateral;\n\n        for (uint i = 0; i < assets.length; i++) {\n            _collateral = assets[i];\n\n            int numerator = margin[i][trader] * oracle.getUnderlyingPrice(address(assets[i].token));\n            uint denomDecimals = _collateral.decimals;\n\n            spot += (numerator / int(10 ** denomDecimals));\n            weighted += (numerator * _collateral.weight.toInt256() / int(10 ** (denomDecimals + 6)));\n        }\n    }"
}