@dolomite-exchange/dolomite-margin
Version:
Ethereum Smart Contracts and TypeScript library used for the DolomiteMargin trading protocol
989 lines • 44.3 kB
JSON
{
"contractName": "IExchangeWrapper",
"abi": [
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "_tradeOriginator",
"type": "address"
},
{
"internalType": "address",
"name": "_receiver",
"type": "address"
},
{
"internalType": "address",
"name": "_makerToken",
"type": "address"
},
{
"internalType": "address",
"name": "_takerToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "_requestedFillAmount",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "_orderData",
"type": "bytes"
}
],
"name": "exchange",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "_makerToken",
"type": "address"
},
{
"internalType": "address",
"name": "_takerToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "_desiredMakerToken",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "_orderData",
"type": "bytes"
}
],
"name": "getExchangeCost",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
],
"metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tradeOriginator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_makerToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_takerToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_requestedFillAmount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_orderData\",\"type\":\"bytes\"}],\"name\":\"exchange\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_makerToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_takerToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_desiredMakerToken\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_orderData\",\"type\":\"bytes\"}],\"name\":\"getExchangeCost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"dYdX * Interface that Exchange Wrappers for DolomiteMargin must implement in order to trade ERC20 tokens.\",\"methods\":{\"exchange(address,address,address,address,uint256,bytes)\":{\"params\":{\"_makerToken\":\"The token to receive (target asset; IE path[path.length - 1])\",\"_orderData\":\"Arbitrary bytes data for any information to pass to the exchange\",\"_receiver\":\"Address to set allowance on once the trade has completed\",\"_requestedFillAmount\":\"Amount of takerToken being paid\",\"_takerToken\":\"The token to pay (originator asset; IE path[0])\",\"_tradeOriginator\":\"Address of the initiator of the trade (however, this value cannot always be trusted as it is set at the discretion of the msg.sender)\"},\"return\":\"The amount of makerToken received\"},\"getExchangeCost(address,address,uint256,bytes)\":{\"params\":{\"_desiredMakerToken\":\"Amount of `_makerToken` requested\",\"_makerToken\":\"The token to receive (target asset; IE path[path.length - 1])\",\"_orderData\":\"Arbitrary bytes data for any information to pass to the exchange\",\"_takerToken\":\"The token to pay (originator asset; IE path[0])\"},\"return\":\"Amount of `_takerToken` the needed to complete the exchange\"}},\"title\":\"IExchangeWrapper\"},\"userdoc\":{\"methods\":{\"exchange(address,address,address,address,uint256,bytes)\":{\"notice\":\"Exchange some amount of takerToken for makerToken.\"},\"getExchangeCost(address,address,uint256,bytes)\":{\"notice\":\"Get amount of takerToken required to buy a certain amount of makerToken for a given trade. Should match the takerToken amount used in exchangeForAmount. If the order cannot provide exactly desiredMakerToken, then it must return the price to buy the minimum amount greater than desiredMakerToken\"}}}},\"settings\":{\"compilationTarget\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IExchangeWrapper.sol\":\"IExchangeWrapper\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IExchangeWrapper.sol\":{\"keccak256\":\"0x74799c3fac16738be41e270a70d3f7ad4f75d1dc7e5d8c58f0fe4c6128345112\",\"urls\":[\"bzz-raw://d9602af1001189d199736d17266d5fb34a32f71cd05fbcf4c0f97c0b3a642eee\",\"dweb:/ipfs/QmPto2DkZ1nKqicBMdMkaek7kGSSXqSKnf697h5zuthvsy\"]}},\"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\n\n/**\n * @title IExchangeWrapper\n * @author dYdX\n *\n * Interface that Exchange Wrappers for DolomiteMargin must implement in order to trade ERC20 tokens.\n */\ninterface IExchangeWrapper {\n\n // ============ Public Functions ============\n\n /**\n * Exchange some amount of takerToken for makerToken.\n *\n * @param _tradeOriginator Address of the initiator of the trade (however, this value\n * cannot always be trusted as it is set at the discretion of the\n * msg.sender)\n * @param _receiver Address to set allowance on once the trade has completed\n * @param _makerToken The token to receive (target asset; IE path[path.length - 1])\n * @param _takerToken The token to pay (originator asset; IE path[0])\n * @param _requestedFillAmount Amount of takerToken being paid\n * @param _orderData Arbitrary bytes data for any information to pass to the exchange\n * @return The amount of makerToken received\n */\n function exchange(\n address _tradeOriginator,\n address _receiver,\n address _makerToken,\n address _takerToken,\n uint256 _requestedFillAmount,\n bytes calldata _orderData\n )\n external\n returns (uint256);\n\n /**\n * Get amount of takerToken required to buy a certain amount of makerToken for a given trade.\n * Should match the takerToken amount used in exchangeForAmount. If the order cannot provide\n * exactly desiredMakerToken, then it must return the price to buy the minimum amount greater\n * than desiredMakerToken\n *\n * @param _makerToken The token to receive (target asset; IE path[path.length - 1])\n * @param _takerToken The token to pay (originator asset; IE path[0])\n * @param _desiredMakerToken Amount of `_makerToken` requested\n * @param _orderData Arbitrary bytes data for any information to pass to the exchange\n * @return Amount of `_takerToken` the needed to complete the exchange\n */\n function getExchangeCost(\n address _makerToken,\n address _takerToken,\n uint256 _desiredMakerToken,\n bytes calldata _orderData\n )\n external\n view\n returns (uint256);\n}\n",
"sourcePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IExchangeWrapper.sol",
"ast": {
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IExchangeWrapper.sol",
"exportedSymbols": {
"IExchangeWrapper": [
24749
]
},
"id": 24750,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 24717,
"literals": [
"solidity",
"^",
"0.5",
".7"
],
"nodeType": "PragmaDirective",
"src": "603:23:82"
},
{
"id": 24718,
"literals": [
"experimental",
"ABIEncoderV2"
],
"nodeType": "PragmaDirective",
"src": "627:33:82"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "interface",
"documentation": "@title IExchangeWrapper\n@author dYdX\n * Interface that Exchange Wrappers for DolomiteMargin must implement in order to trade ERC20 tokens.",
"fullyImplemented": false,
"id": 24749,
"linearizedBaseContracts": [
24749
],
"name": "IExchangeWrapper",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": null,
"documentation": "Exchange some amount of takerToken for makerToken.\n * @param _tradeOriginator Address of the initiator of the trade (however, this value\n cannot always be trusted as it is set at the discretion of the\n msg.sender)\n@param _receiver Address to set allowance on once the trade has completed\n@param _makerToken The token to receive (target asset; IE path[path.length - 1])\n@param _takerToken The token to pay (originator asset; IE path[0])\n@param _requestedFillAmount Amount of takerToken being paid\n@param _orderData Arbitrary bytes data for any information to pass to the exchange\n@return The amount of makerToken received",
"id": 24735,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "exchange",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 24731,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 24720,
"name": "_tradeOriginator",
"nodeType": "VariableDeclaration",
"scope": 24735,
"src": "1768:24:82",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 24719,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1768:7:82",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24722,
"name": "_receiver",
"nodeType": "VariableDeclaration",
"scope": 24735,
"src": "1802:17:82",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 24721,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1802:7:82",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24724,
"name": "_makerToken",
"nodeType": "VariableDeclaration",
"scope": 24735,
"src": "1829:19:82",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 24723,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1829:7:82",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24726,
"name": "_takerToken",
"nodeType": "VariableDeclaration",
"scope": 24735,
"src": "1858:19:82",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 24725,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1858:7:82",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24728,
"name": "_requestedFillAmount",
"nodeType": "VariableDeclaration",
"scope": 24735,
"src": "1887:28:82",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 24727,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1887:7:82",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24730,
"name": "_orderData",
"nodeType": "VariableDeclaration",
"scope": 24735,
"src": "1925:25:82",
"stateVariable": false,
"storageLocation": "calldata",
"typeDescriptions": {
"typeIdentifier": "t_bytes_calldata_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 24729,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "1925:5:82",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1758:198:82"
},
"returnParameters": {
"id": 24734,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 24733,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 24735,
"src": "1991:7:82",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 24732,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1991:7:82",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1990:9:82"
},
"scope": 24749,
"src": "1741:259:82",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "external"
},
{
"body": null,
"documentation": "Get amount of takerToken required to buy a certain amount of makerToken for a given trade.\nShould match the takerToken amount used in exchangeForAmount. If the order cannot provide\nexactly desiredMakerToken, then it must return the price to buy the minimum amount greater\nthan desiredMakerToken\n * @param _makerToken The token to receive (target asset; IE path[path.length - 1])\n@param _takerToken The token to pay (originator asset; IE path[0])\n@param _desiredMakerToken Amount of `_makerToken` requested\n@param _orderData Arbitrary bytes data for any information to pass to the exchange\n@return Amount of `_takerToken` the needed to complete the exchange",
"id": 24748,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "getExchangeCost",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 24744,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 24737,
"name": "_makerToken",
"nodeType": "VariableDeclaration",
"scope": 24748,
"src": "2835:19:82",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 24736,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2835:7:82",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24739,
"name": "_takerToken",
"nodeType": "VariableDeclaration",
"scope": 24748,
"src": "2864:19:82",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 24738,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2864:7:82",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24741,
"name": "_desiredMakerToken",
"nodeType": "VariableDeclaration",
"scope": 24748,
"src": "2893:26:82",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 24740,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2893:7:82",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24743,
"name": "_orderData",
"nodeType": "VariableDeclaration",
"scope": 24748,
"src": "2929:25:82",
"stateVariable": false,
"storageLocation": "calldata",
"typeDescriptions": {
"typeIdentifier": "t_bytes_calldata_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 24742,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "2929:5:82",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2825:135:82"
},
"returnParameters": {
"id": 24747,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 24746,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 24748,
"src": "3008:7:82",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 24745,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "3008:7:82",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "3007:9:82"
},
"scope": 24749,
"src": "2801:216:82",
"stateMutability": "view",
"superFunction": null,
"visibility": "external"
}
],
"scope": 24750,
"src": "819:2200:82"
}
],
"src": "603:2417:82"
},
"legacyAST": {
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IExchangeWrapper.sol",
"exportedSymbols": {
"IExchangeWrapper": [
24749
]
},
"id": 24750,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 24717,
"literals": [
"solidity",
"^",
"0.5",
".7"
],
"nodeType": "PragmaDirective",
"src": "603:23:82"
},
{
"id": 24718,
"literals": [
"experimental",
"ABIEncoderV2"
],
"nodeType": "PragmaDirective",
"src": "627:33:82"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "interface",
"documentation": "@title IExchangeWrapper\n@author dYdX\n * Interface that Exchange Wrappers for DolomiteMargin must implement in order to trade ERC20 tokens.",
"fullyImplemented": false,
"id": 24749,
"linearizedBaseContracts": [
24749
],
"name": "IExchangeWrapper",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": null,
"documentation": "Exchange some amount of takerToken for makerToken.\n * @param _tradeOriginator Address of the initiator of the trade (however, this value\n cannot always be trusted as it is set at the discretion of the\n msg.sender)\n@param _receiver Address to set allowance on once the trade has completed\n@param _makerToken The token to receive (target asset; IE path[path.length - 1])\n@param _takerToken The token to pay (originator asset; IE path[0])\n@param _requestedFillAmount Amount of takerToken being paid\n@param _orderData Arbitrary bytes data for any information to pass to the exchange\n@return The amount of makerToken received",
"id": 24735,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "exchange",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 24731,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 24720,
"name": "_tradeOriginator",
"nodeType": "VariableDeclaration",
"scope": 24735,
"src": "1768:24:82",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 24719,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1768:7:82",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24722,
"name": "_receiver",
"nodeType": "VariableDeclaration",
"scope": 24735,
"src": "1802:17:82",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 24721,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1802:7:82",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24724,
"name": "_makerToken",
"nodeType": "VariableDeclaration",
"scope": 24735,
"src": "1829:19:82",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 24723,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1829:7:82",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24726,
"name": "_takerToken",
"nodeType": "VariableDeclaration",
"scope": 24735,
"src": "1858:19:82",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 24725,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1858:7:82",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24728,
"name": "_requestedFillAmount",
"nodeType": "VariableDeclaration",
"scope": 24735,
"src": "1887:28:82",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 24727,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1887:7:82",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24730,
"name": "_orderData",
"nodeType": "VariableDeclaration",
"scope": 24735,
"src": "1925:25:82",
"stateVariable": false,
"storageLocation": "calldata",
"typeDescriptions": {
"typeIdentifier": "t_bytes_calldata_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 24729,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "1925:5:82",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1758:198:82"
},
"returnParameters": {
"id": 24734,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 24733,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 24735,
"src": "1991:7:82",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 24732,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1991:7:82",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1990:9:82"
},
"scope": 24749,
"src": "1741:259:82",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "external"
},
{
"body": null,
"documentation": "Get amount of takerToken required to buy a certain amount of makerToken for a given trade.\nShould match the takerToken amount used in exchangeForAmount. If the order cannot provide\nexactly desiredMakerToken, then it must return the price to buy the minimum amount greater\nthan desiredMakerToken\n * @param _makerToken The token to receive (target asset; IE path[path.length - 1])\n@param _takerToken The token to pay (originator asset; IE path[0])\n@param _desiredMakerToken Amount of `_makerToken` requested\n@param _orderData Arbitrary bytes data for any information to pass to the exchange\n@return Amount of `_takerToken` the needed to complete the exchange",
"id": 24748,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "getExchangeCost",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 24744,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 24737,
"name": "_makerToken",
"nodeType": "VariableDeclaration",
"scope": 24748,
"src": "2835:19:82",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 24736,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2835:7:82",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24739,
"name": "_takerToken",
"nodeType": "VariableDeclaration",
"scope": 24748,
"src": "2864:19:82",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 24738,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2864:7:82",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24741,
"name": "_desiredMakerToken",
"nodeType": "VariableDeclaration",
"scope": 24748,
"src": "2893:26:82",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 24740,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2893:7:82",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24743,
"name": "_orderData",
"nodeType": "VariableDeclaration",
"scope": 24748,
"src": "2929:25:82",
"stateVariable": false,
"storageLocation": "calldata",
"typeDescriptions": {
"typeIdentifier": "t_bytes_calldata_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 24742,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "2929:5:82",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2825:135:82"
},
"returnParameters": {
"id": 24747,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 24746,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 24748,
"src": "3008:7:82",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 24745,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "3008:7:82",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "3007:9:82"
},
"scope": 24749,
"src": "2801:216:82",
"stateMutability": "view",
"superFunction": null,
"visibility": "external"
}
],
"scope": 24750,
"src": "819:2200:82"
}
],
"src": "603:2417:82"
},
"compiler": {
"name": "solc",
"version": "0.5.16+commit.9c3226ce.Emscripten.clang"
},
"networks": {},
"schemaVersion": "3.0.23",
"updatedAt": "2025-06-22T04:01:53.956Z",
"devdoc": {
"author": "dYdX * Interface that Exchange Wrappers for DolomiteMargin must implement in order to trade ERC20 tokens.",
"methods": {
"exchange(address,address,address,address,uint256,bytes)": {
"params": {
"_makerToken": "The token to receive (target asset; IE path[path.length - 1])",
"_orderData": "Arbitrary bytes data for any information to pass to the exchange",
"_receiver": "Address to set allowance on once the trade has completed",
"_requestedFillAmount": "Amount of takerToken being paid",
"_takerToken": "The token to pay (originator asset; IE path[0])",
"_tradeOriginator": "Address of the initiator of the trade (however, this value cannot always be trusted as it is set at the discretion of the msg.sender)"
},
"return": "The amount of makerToken received"
},
"getExchangeCost(address,address,uint256,bytes)": {
"params": {
"_desiredMakerToken": "Amount of `_makerToken` requested",
"_makerToken": "The token to receive (target asset; IE path[path.length - 1])",
"_orderData": "Arbitrary bytes data for any information to pass to the exchange",
"_takerToken": "The token to pay (originator asset; IE path[0])"
},
"return": "Amount of `_takerToken` the needed to complete the exchange"
}
},
"title": "IExchangeWrapper"
},
"userdoc": {
"methods": {
"exchange(address,address,address,address,uint256,bytes)": {
"notice": "Exchange some amount of takerToken for makerToken."
},
"getExchangeCost(address,address,uint256,bytes)": {
"notice": "Get amount of takerToken required to buy a certain amount of makerToken for a given trade. Should match the takerToken amount used in exchangeForAmount. If the order cannot provide exactly desiredMakerToken, then it must return the price to buy the minimum amount greater than desiredMakerToken"
}
}
}
}