@dolomite-exchange/dolomite-margin
Version:
Ethereum Smart Contracts and TypeScript library used for the DolomiteMargin trading protocol
452 lines • 19 kB
JSON
{
"contractName": "Time",
"abi": [],
"metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"dYdX * Library for dealing with time, assuming timestamps fit within 32 bits (valid until year 2106)\",\"methods\":{},\"title\":\"Time\"},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Time.sol\":\"Time\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"/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/Require.sol\":{\"keccak256\":\"0x05a2a90b41b6a5f42f0a72da63d015fb0b406a9ba2172823352e522e8bf3a606\",\"urls\":[\"bzz-raw://19883f0c6d33266f756ec5c3d17539524aa24b993c46c33f8400801d09373a6c\",\"dweb:/ipfs/QmYX2fwK3vQQDSZLMrc5wMfeb8RWrcC9CGX8XECLty8QDk\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Time.sol\":{\"keccak256\":\"0x87ee8d3c1d6e315a116426d8c8fc6f083e220fd14dda27fad4e8d7cab3dc7305\",\"urls\":[\"bzz-raw://7c20f2c52da682c3b5917fb6a19e81f43699b1d13c62b569ed723f34da72e766\",\"dweb:/ipfs/QmbXWYXi67nHBVNDKYUpo2E9ZaEVcHLvmXQkpYLMm1d5Vm\"]},\"@openzeppelin/contracts/math/SafeMath.sol\":{\"keccak256\":\"0x640b6dee7a4b830bdfd52b5031a07fc2b12209f5b2e29e5d364a7d37f69d8076\",\"urls\":[\"bzz-raw://31113152e1ddb78fe7a4197f247591ca894e93f916867beb708d8e747b6cc74f\",\"dweb:/ipfs/QmbZaJyXdpsYGykVhHH9qpVGQg9DGCxE2QufbCUy3daTgq\"]}},\"version\":1}",
"bytecode": "0x60636023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea365627a7a7231582027433c5d0b1561292171316a867473b82db3ab9e2eb92fc7df32aa9e3ac6aec66c6578706572696d656e74616cf564736f6c63430005100040",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea365627a7a7231582027433c5d0b1561292171316a867473b82db3ab9e2eb92fc7df32aa9e3ac6aec66c6578706572696d656e74616cf564736f6c63430005100040",
"sourceMap": "866:220:102:-;;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": "866:220:102:-;;;;;;;;",
"source": "/*\n\n Copyright 2019 dYdX Trading Inc.\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 { DolomiteMarginMath } from \"./DolomiteMarginMath.sol\";\n\n\n/**\n * @title Time\n * @author dYdX\n *\n * Library for dealing with time, assuming timestamps fit within 32 bits (valid until year 2106)\n */\nlibrary Time {\n\n // ============ Library Functions ============\n\n function currentTime()\n internal\n view\n returns (uint32)\n {\n return DolomiteMarginMath.to32(block.timestamp);\n }\n}\n",
"sourcePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Time.sol",
"ast": {
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Time.sol",
"exportedSymbols": {
"Time": [
30729
]
},
"id": 30730,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 30713,
"literals": [
"solidity",
"^",
"0.5",
".7"
],
"nodeType": "PragmaDirective",
"src": "603:23:102"
},
{
"id": 30714,
"literals": [
"experimental",
"ABIEncoderV2"
],
"nodeType": "PragmaDirective",
"src": "627:33:102"
},
{
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/DolomiteMarginMath.sol",
"file": "./DolomiteMarginMath.sol",
"id": 30716,
"nodeType": "ImportDirective",
"scope": 30730,
"sourceUnit": 26239,
"src": "662:62:102",
"symbolAliases": [
{
"foreign": 30715,
"local": null
}
],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": "@title Time\n@author dYdX\n * Library for dealing with time, assuming timestamps fit within 32 bits (valid until year 2106)",
"fullyImplemented": true,
"id": 30729,
"linearizedBaseContracts": [
30729
],
"name": "Time",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 30727,
"nodeType": "Block",
"src": "1020:64:102",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 30723,
"name": "block",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 38097,
"src": "1061:5:102",
"typeDescriptions": {
"typeIdentifier": "t_magic_block",
"typeString": "block"
}
},
"id": 30724,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "timestamp",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "1061:15:102",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"id": 30721,
"name": "DolomiteMarginMath",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 26238,
"src": "1037:18:102",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_DolomiteMarginMath_$26238_$",
"typeString": "type(library DolomiteMarginMath)"
}
},
"id": 30722,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "to32",
"nodeType": "MemberAccess",
"referencedDeclaration": 26237,
"src": "1037:23:102",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint32_$",
"typeString": "function (uint256) pure returns (uint32)"
}
},
"id": 30725,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1037:40:102",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"functionReturnParameters": 30720,
"id": 30726,
"nodeType": "Return",
"src": "1030:47:102"
}
]
},
"documentation": null,
"id": 30728,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "currentTime",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 30717,
"nodeType": "ParameterList",
"parameters": [],
"src": "958:2:102"
},
"returnParameters": {
"id": 30720,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 30719,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 30728,
"src": "1008:6:102",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
"typeName": {
"id": 30718,
"name": "uint32",
"nodeType": "ElementaryTypeName",
"src": "1008:6:102",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1007:8:102"
},
"scope": 30729,
"src": "938:146:102",
"stateMutability": "view",
"superFunction": null,
"visibility": "internal"
}
],
"scope": 30730,
"src": "866:220:102"
}
],
"src": "603:484:102"
},
"legacyAST": {
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Time.sol",
"exportedSymbols": {
"Time": [
30729
]
},
"id": 30730,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 30713,
"literals": [
"solidity",
"^",
"0.5",
".7"
],
"nodeType": "PragmaDirective",
"src": "603:23:102"
},
{
"id": 30714,
"literals": [
"experimental",
"ABIEncoderV2"
],
"nodeType": "PragmaDirective",
"src": "627:33:102"
},
{
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/DolomiteMarginMath.sol",
"file": "./DolomiteMarginMath.sol",
"id": 30716,
"nodeType": "ImportDirective",
"scope": 30730,
"sourceUnit": 26239,
"src": "662:62:102",
"symbolAliases": [
{
"foreign": 30715,
"local": null
}
],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": "@title Time\n@author dYdX\n * Library for dealing with time, assuming timestamps fit within 32 bits (valid until year 2106)",
"fullyImplemented": true,
"id": 30729,
"linearizedBaseContracts": [
30729
],
"name": "Time",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 30727,
"nodeType": "Block",
"src": "1020:64:102",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 30723,
"name": "block",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 38097,
"src": "1061:5:102",
"typeDescriptions": {
"typeIdentifier": "t_magic_block",
"typeString": "block"
}
},
"id": 30724,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "timestamp",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "1061:15:102",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"id": 30721,
"name": "DolomiteMarginMath",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 26238,
"src": "1037:18:102",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_DolomiteMarginMath_$26238_$",
"typeString": "type(library DolomiteMarginMath)"
}
},
"id": 30722,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "to32",
"nodeType": "MemberAccess",
"referencedDeclaration": 26237,
"src": "1037:23:102",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint32_$",
"typeString": "function (uint256) pure returns (uint32)"
}
},
"id": 30725,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1037:40:102",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"functionReturnParameters": 30720,
"id": 30726,
"nodeType": "Return",
"src": "1030:47:102"
}
]
},
"documentation": null,
"id": 30728,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "currentTime",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 30717,
"nodeType": "ParameterList",
"parameters": [],
"src": "958:2:102"
},
"returnParameters": {
"id": 30720,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 30719,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 30728,
"src": "1008:6:102",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
"typeName": {
"id": 30718,
"name": "uint32",
"nodeType": "ElementaryTypeName",
"src": "1008:6:102",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1007:8:102"
},
"scope": 30729,
"src": "938:146:102",
"stateMutability": "view",
"superFunction": null,
"visibility": "internal"
}
],
"scope": 30730,
"src": "866:220:102"
}
],
"src": "603:484:102"
},
"compiler": {
"name": "solc",
"version": "0.5.16+commit.9c3226ce.Emscripten.clang"
},
"networks": {},
"schemaVersion": "3.0.23",
"updatedAt": "2025-06-22T04:01:54.067Z",
"devdoc": {
"author": "dYdX * Library for dealing with time, assuming timestamps fit within 32 bits (valid until year 2106)",
"methods": {},
"title": "Time"
},
"userdoc": {
"methods": {}
}
}