@dolomite-exchange/dolomite-margin
Version:
Ethereum Smart Contracts and TypeScript library used for the DolomiteMargin trading protocol
897 lines • 41.4 kB
JSON
{
"contractName": "IAutoTrader",
"abi": [
{
"constant": false,
"inputs": [
{
"internalType": "uint256",
"name": "inputMarketId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "outputMarketId",
"type": "uint256"
},
{
"components": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "uint256",
"name": "number",
"type": "uint256"
}
],
"internalType": "struct Account.Info",
"name": "makerAccount",
"type": "tuple"
},
{
"components": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "uint256",
"name": "number",
"type": "uint256"
}
],
"internalType": "struct Account.Info",
"name": "takerAccount",
"type": "tuple"
},
{
"components": [
{
"internalType": "bool",
"name": "sign",
"type": "bool"
},
{
"internalType": "uint128",
"name": "value",
"type": "uint128"
}
],
"internalType": "struct Types.Par",
"name": "oldInputPar",
"type": "tuple"
},
{
"components": [
{
"internalType": "bool",
"name": "sign",
"type": "bool"
},
{
"internalType": "uint128",
"name": "value",
"type": "uint128"
}
],
"internalType": "struct Types.Par",
"name": "newInputPar",
"type": "tuple"
},
{
"components": [
{
"internalType": "bool",
"name": "sign",
"type": "bool"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"internalType": "struct Types.Wei",
"name": "inputDeltaWei",
"type": "tuple"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "getTradeCost",
"outputs": [
{
"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": "",
"type": "tuple"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
],
"metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"inputMarketId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"outputMarketId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"number\",\"type\":\"uint256\"}],\"internalType\":\"struct Account.Info\",\"name\":\"makerAccount\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"number\",\"type\":\"uint256\"}],\"internalType\":\"struct Account.Info\",\"name\":\"takerAccount\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"sign\",\"type\":\"bool\"},{\"internalType\":\"uint128\",\"name\":\"value\",\"type\":\"uint128\"}],\"internalType\":\"struct Types.Par\",\"name\":\"oldInputPar\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"sign\",\"type\":\"bool\"},{\"internalType\":\"uint128\",\"name\":\"value\",\"type\":\"uint128\"}],\"internalType\":\"struct Types.Par\",\"name\":\"newInputPar\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"sign\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"internalType\":\"struct Types.Wei\",\"name\":\"inputDeltaWei\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"getTradeCost\",\"outputs\":[{\"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\":\"\",\"type\":\"tuple\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"dYdX * Interface that Auto-Traders for DolomiteMargin must implement in order to approve trades.\",\"methods\":{\"getTradeCost(uint256,uint256,(address,uint256),(address,uint256),(bool,uint128),(bool,uint128),(bool,uint256),bytes)\":{\"params\":{\"data\":\"Arbitrary data passed in by the trader\",\"inputDeltaWei\":\"The change in token amount for the makerAccount for the inputMarketId\",\"inputMarketId\":\"The market for which the trader specified the original amount\",\"makerAccount\":\"The account for which this contract is making trades\",\"newInputPar\":\"The new principal amount for the makerAccount for the inputMarketId\",\"oldInputPar\":\"The old principal amount for the makerAccount for the inputMarketId\",\"outputMarketId\":\"The market for which the trader wants the resulting amount specified\",\"takerAccount\":\"The account requesting the trade\"},\"return\":\"The AssetAmount for the makerAccount for the outputMarketId\"}},\"title\":\"IAutoTrader\"},\"userdoc\":{\"methods\":{\"getTradeCost(uint256,uint256,(address,uint256),(address,uint256),(bool,uint128),(bool,uint128),(bool,uint256),bytes)\":{\"notice\":\"Allows traders to make trades approved by this smart contract. The active trader's account is the takerAccount and the passive account (for which this contract approves trades on-behalf-of) is the makerAccount.\"}}}},\"settings\":{\"compilationTarget\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IAutoTrader.sol\":\"IAutoTrader\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IAutoTrader.sol\":{\"keccak256\":\"0x123b5d92696b180c60a838d3117a9fd571851911f37c78212969015e169e14fc\",\"urls\":[\"bzz-raw://cd5d9aeb5b4e3de18ac8a51a3b2320f3e7a247b959defa9c289ee6aaf2bfc348\",\"dweb:/ipfs/QmPdjeya5BDYHEUMuz6jiwZrKJa8p2uN1vumLAJ7nhG5cN\"]},\"/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/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 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 { Account } from \"../lib/Account.sol\";\nimport { Types } from \"../lib/Types.sol\";\n\n\n/**\n * @title IAutoTrader\n * @author dYdX\n *\n * Interface that Auto-Traders for DolomiteMargin must implement in order to approve trades.\n */\ncontract IAutoTrader {\n\n // ============ Public Functions ============\n\n /**\n * Allows traders to make trades approved by this smart contract. The active trader's account is\n * the takerAccount and the passive account (for which this contract approves trades\n * on-behalf-of) is the makerAccount.\n *\n * @param inputMarketId The market for which the trader specified the original amount\n * @param outputMarketId The market for which the trader wants the resulting amount specified\n * @param makerAccount The account for which this contract is making trades\n * @param takerAccount The account requesting the trade\n * @param oldInputPar The old principal amount for the makerAccount for the inputMarketId\n * @param newInputPar The new principal amount for the makerAccount for the inputMarketId\n * @param inputDeltaWei The change in token amount for the makerAccount for the inputMarketId\n * @param data Arbitrary data passed in by the trader\n * @return The AssetAmount for the makerAccount for the outputMarketId\n */\n function getTradeCost(\n uint256 inputMarketId,\n uint256 outputMarketId,\n Account.Info memory makerAccount,\n Account.Info memory takerAccount,\n Types.Par memory oldInputPar,\n Types.Par memory newInputPar,\n Types.Wei memory inputDeltaWei,\n bytes memory data\n )\n public\n returns (Types.AssetAmount memory);\n}\n",
"sourcePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IAutoTrader.sol",
"ast": {
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IAutoTrader.sol",
"exportedSymbols": {
"IAutoTrader": [
24058
]
},
"id": 24059,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 24031,
"literals": [
"solidity",
"^",
"0.5",
".7"
],
"nodeType": "PragmaDirective",
"src": "603:23:78"
},
{
"id": 24032,
"literals": [
"experimental",
"ABIEncoderV2"
],
"nodeType": "PragmaDirective",
"src": "627:33:78"
},
{
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Account.sol",
"file": "../lib/Account.sol",
"id": 24034,
"nodeType": "ImportDirective",
"scope": 24059,
"sourceUnit": 24886,
"src": "662:45:78",
"symbolAliases": [
{
"foreign": 24033,
"local": null
}
],
"unitAlias": ""
},
{
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Types.sol",
"file": "../lib/Types.sol",
"id": 24036,
"nodeType": "ImportDirective",
"scope": 24059,
"sourceUnit": 31362,
"src": "708:41:78",
"symbolAliases": [
{
"foreign": 24035,
"local": null
}
],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": "@title IAutoTrader\n@author dYdX\n * Interface that Auto-Traders for DolomiteMargin must implement in order to approve trades.",
"fullyImplemented": false,
"id": 24058,
"linearizedBaseContracts": [
24058
],
"name": "IAutoTrader",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": null,
"documentation": "Allows traders to make trades approved by this smart contract. The active trader's account is\nthe takerAccount and the passive account (for which this contract approves trades\non-behalf-of) is the makerAccount.\n * @param inputMarketId The market for which the trader specified the original amount\n@param outputMarketId The market for which the trader wants the resulting amount specified\n@param makerAccount The account for which this contract is making trades\n@param takerAccount The account requesting the trade\n@param oldInputPar The old principal amount for the makerAccount for the inputMarketId\n@param newInputPar The new principal amount for the makerAccount for the inputMarketId\n@param inputDeltaWei The change in token amount for the makerAccount for the inputMarketId\n@param data Arbitrary data passed in by the trader\n@return The AssetAmount for the makerAccount for the outputMarketId",
"id": 24057,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "getTradeCost",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 24053,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 24038,
"name": "inputMarketId",
"nodeType": "VariableDeclaration",
"scope": 24057,
"src": "2060:21:78",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 24037,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2060:7:78",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24040,
"name": "outputMarketId",
"nodeType": "VariableDeclaration",
"scope": 24057,
"src": "2091:22:78",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 24039,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2091:7:78",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24042,
"name": "makerAccount",
"nodeType": "VariableDeclaration",
"scope": 24057,
"src": "2123:32:78",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$24851_memory_ptr",
"typeString": "struct Account.Info"
},
"typeName": {
"contractScope": null,
"id": 24041,
"name": "Account.Info",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 24851,
"src": "2123:12:78",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$24851_storage_ptr",
"typeString": "struct Account.Info"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24044,
"name": "takerAccount",
"nodeType": "VariableDeclaration",
"scope": 24057,
"src": "2165:32:78",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$24851_memory_ptr",
"typeString": "struct Account.Info"
},
"typeName": {
"contractScope": null,
"id": 24043,
"name": "Account.Info",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 24851,
"src": "2165:12:78",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$24851_storage_ptr",
"typeString": "struct Account.Info"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24046,
"name": "oldInputPar",
"nodeType": "VariableDeclaration",
"scope": 24057,
"src": "2207:28:78",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Par_$30890_memory_ptr",
"typeString": "struct Types.Par"
},
"typeName": {
"contractScope": null,
"id": 24045,
"name": "Types.Par",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 30890,
"src": "2207:9:78",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Par_$30890_storage_ptr",
"typeString": "struct Types.Par"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24048,
"name": "newInputPar",
"nodeType": "VariableDeclaration",
"scope": 24057,
"src": "2245:28:78",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Par_$30890_memory_ptr",
"typeString": "struct Types.Par"
},
"typeName": {
"contractScope": null,
"id": 24047,
"name": "Types.Par",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 30890,
"src": "2245:9:78",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Par_$30890_storage_ptr",
"typeString": "struct Types.Par"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24050,
"name": "inputDeltaWei",
"nodeType": "VariableDeclaration",
"scope": 24057,
"src": "2283:30:78",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Wei_$31149_memory_ptr",
"typeString": "struct Types.Wei"
},
"typeName": {
"contractScope": null,
"id": 24049,
"name": "Types.Wei",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 31149,
"src": "2283:9:78",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Wei_$31149_storage_ptr",
"typeString": "struct Types.Wei"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24052,
"name": "data",
"nodeType": "VariableDeclaration",
"scope": 24057,
"src": "2323:17:78",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 24051,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "2323:5:78",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2050:296:78"
},
"returnParameters": {
"id": 24056,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 24055,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 24057,
"src": "2379:24:78",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_AssetAmount_$30880_memory_ptr",
"typeString": "struct Types.AssetAmount"
},
"typeName": {
"contractScope": null,
"id": 24054,
"name": "Types.AssetAmount",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 30880,
"src": "2379:17:78",
"typeDescriptions": {
"typeIdentifier": "t_struct$_AssetAmount_$30880_storage_ptr",
"typeString": "struct Types.AssetAmount"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2378:26:78"
},
"scope": 24058,
"src": "2029:376:78",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
}
],
"scope": 24059,
"src": "894:1513:78"
}
],
"src": "603:1805:78"
},
"legacyAST": {
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IAutoTrader.sol",
"exportedSymbols": {
"IAutoTrader": [
24058
]
},
"id": 24059,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 24031,
"literals": [
"solidity",
"^",
"0.5",
".7"
],
"nodeType": "PragmaDirective",
"src": "603:23:78"
},
{
"id": 24032,
"literals": [
"experimental",
"ABIEncoderV2"
],
"nodeType": "PragmaDirective",
"src": "627:33:78"
},
{
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Account.sol",
"file": "../lib/Account.sol",
"id": 24034,
"nodeType": "ImportDirective",
"scope": 24059,
"sourceUnit": 24886,
"src": "662:45:78",
"symbolAliases": [
{
"foreign": 24033,
"local": null
}
],
"unitAlias": ""
},
{
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Types.sol",
"file": "../lib/Types.sol",
"id": 24036,
"nodeType": "ImportDirective",
"scope": 24059,
"sourceUnit": 31362,
"src": "708:41:78",
"symbolAliases": [
{
"foreign": 24035,
"local": null
}
],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": "@title IAutoTrader\n@author dYdX\n * Interface that Auto-Traders for DolomiteMargin must implement in order to approve trades.",
"fullyImplemented": false,
"id": 24058,
"linearizedBaseContracts": [
24058
],
"name": "IAutoTrader",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": null,
"documentation": "Allows traders to make trades approved by this smart contract. The active trader's account is\nthe takerAccount and the passive account (for which this contract approves trades\non-behalf-of) is the makerAccount.\n * @param inputMarketId The market for which the trader specified the original amount\n@param outputMarketId The market for which the trader wants the resulting amount specified\n@param makerAccount The account for which this contract is making trades\n@param takerAccount The account requesting the trade\n@param oldInputPar The old principal amount for the makerAccount for the inputMarketId\n@param newInputPar The new principal amount for the makerAccount for the inputMarketId\n@param inputDeltaWei The change in token amount for the makerAccount for the inputMarketId\n@param data Arbitrary data passed in by the trader\n@return The AssetAmount for the makerAccount for the outputMarketId",
"id": 24057,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "getTradeCost",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 24053,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 24038,
"name": "inputMarketId",
"nodeType": "VariableDeclaration",
"scope": 24057,
"src": "2060:21:78",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 24037,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2060:7:78",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24040,
"name": "outputMarketId",
"nodeType": "VariableDeclaration",
"scope": 24057,
"src": "2091:22:78",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 24039,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2091:7:78",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24042,
"name": "makerAccount",
"nodeType": "VariableDeclaration",
"scope": 24057,
"src": "2123:32:78",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$24851_memory_ptr",
"typeString": "struct Account.Info"
},
"typeName": {
"contractScope": null,
"id": 24041,
"name": "Account.Info",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 24851,
"src": "2123:12:78",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$24851_storage_ptr",
"typeString": "struct Account.Info"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24044,
"name": "takerAccount",
"nodeType": "VariableDeclaration",
"scope": 24057,
"src": "2165:32:78",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$24851_memory_ptr",
"typeString": "struct Account.Info"
},
"typeName": {
"contractScope": null,
"id": 24043,
"name": "Account.Info",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 24851,
"src": "2165:12:78",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$24851_storage_ptr",
"typeString": "struct Account.Info"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24046,
"name": "oldInputPar",
"nodeType": "VariableDeclaration",
"scope": 24057,
"src": "2207:28:78",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Par_$30890_memory_ptr",
"typeString": "struct Types.Par"
},
"typeName": {
"contractScope": null,
"id": 24045,
"name": "Types.Par",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 30890,
"src": "2207:9:78",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Par_$30890_storage_ptr",
"typeString": "struct Types.Par"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24048,
"name": "newInputPar",
"nodeType": "VariableDeclaration",
"scope": 24057,
"src": "2245:28:78",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Par_$30890_memory_ptr",
"typeString": "struct Types.Par"
},
"typeName": {
"contractScope": null,
"id": 24047,
"name": "Types.Par",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 30890,
"src": "2245:9:78",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Par_$30890_storage_ptr",
"typeString": "struct Types.Par"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24050,
"name": "inputDeltaWei",
"nodeType": "VariableDeclaration",
"scope": 24057,
"src": "2283:30:78",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Wei_$31149_memory_ptr",
"typeString": "struct Types.Wei"
},
"typeName": {
"contractScope": null,
"id": 24049,
"name": "Types.Wei",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 31149,
"src": "2283:9:78",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Wei_$31149_storage_ptr",
"typeString": "struct Types.Wei"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24052,
"name": "data",
"nodeType": "VariableDeclaration",
"scope": 24057,
"src": "2323:17:78",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 24051,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "2323:5:78",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2050:296:78"
},
"returnParameters": {
"id": 24056,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 24055,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 24057,
"src": "2379:24:78",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_AssetAmount_$30880_memory_ptr",
"typeString": "struct Types.AssetAmount"
},
"typeName": {
"contractScope": null,
"id": 24054,
"name": "Types.AssetAmount",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 30880,
"src": "2379:17:78",
"typeDescriptions": {
"typeIdentifier": "t_struct$_AssetAmount_$30880_storage_ptr",
"typeString": "struct Types.AssetAmount"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2378:26:78"
},
"scope": 24058,
"src": "2029:376:78",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
}
],
"scope": 24059,
"src": "894:1513:78"
}
],
"src": "603:1805:78"
},
"compiler": {
"name": "solc",
"version": "0.5.16+commit.9c3226ce.Emscripten.clang"
},
"networks": {},
"schemaVersion": "3.0.23",
"updatedAt": "2025-06-22T04:01:53.942Z",
"devdoc": {
"author": "dYdX * Interface that Auto-Traders for DolomiteMargin must implement in order to approve trades.",
"methods": {
"getTradeCost(uint256,uint256,(address,uint256),(address,uint256),(bool,uint128),(bool,uint128),(bool,uint256),bytes)": {
"params": {
"data": "Arbitrary data passed in by the trader",
"inputDeltaWei": "The change in token amount for the makerAccount for the inputMarketId",
"inputMarketId": "The market for which the trader specified the original amount",
"makerAccount": "The account for which this contract is making trades",
"newInputPar": "The new principal amount for the makerAccount for the inputMarketId",
"oldInputPar": "The old principal amount for the makerAccount for the inputMarketId",
"outputMarketId": "The market for which the trader wants the resulting amount specified",
"takerAccount": "The account requesting the trade"
},
"return": "The AssetAmount for the makerAccount for the outputMarketId"
}
},
"title": "IAutoTrader"
},
"userdoc": {
"methods": {
"getTradeCost(uint256,uint256,(address,uint256),(address,uint256),(bool,uint128),(bool,uint128),(bool,uint256),bytes)": {
"notice": "Allows traders to make trades approved by this smart contract. The active trader's account is the takerAccount and the passive account (for which this contract approves trades on-behalf-of) is the makerAccount."
}
}
}
}