UNPKG

@dolomite-exchange/dolomite-margin

Version:

Ethereum Smart Contracts and TypeScript library used for the DolomiteMargin trading protocol

1,100 lines (1,099 loc) 74.2 kB
{ "contractName": "IIsolationModeWrapperTrader", "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" }, { "constant": true, "inputs": [], "name": "token", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "internalType": "address", "name": "_inputToken", "type": "address" } ], "name": "isValidInputToken", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "actionsLength", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "pure", "type": "function" }, { "constant": true, "inputs": [ { "components": [ { "internalType": "uint256", "name": "primaryAccountId", "type": "uint256" }, { "internalType": "uint256", "name": "otherAccountId", "type": "uint256" }, { "internalType": "address", "name": "primaryAccountOwner", "type": "address" }, { "internalType": "uint256", "name": "primaryAccountNumber", "type": "uint256" }, { "internalType": "address", "name": "otherAccountOwner", "type": "address" }, { "internalType": "uint256", "name": "otherAccountNumber", "type": "uint256" }, { "internalType": "uint256", "name": "outputMarket", "type": "uint256" }, { "internalType": "uint256", "name": "inputMarket", "type": "uint256" }, { "internalType": "uint256", "name": "minOutputAmount", "type": "uint256" }, { "internalType": "uint256", "name": "inputAmount", "type": "uint256" }, { "internalType": "bytes", "name": "orderData", "type": "bytes" } ], "internalType": "struct IIsolationModeWrapperTrader.CreateActionsForWrappingParams", "name": "_params", "type": "tuple" } ], "name": "createActionsForWrapping", "outputs": [ { "components": [ { "internalType": "enum Actions.ActionType", "name": "actionType", "type": "uint8" }, { "internalType": "uint256", "name": "accountId", "type": "uint256" }, { "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": "amount", "type": "tuple" }, { "internalType": "uint256", "name": "primaryMarketId", "type": "uint256" }, { "internalType": "uint256", "name": "secondaryMarketId", "type": "uint256" }, { "internalType": "address", "name": "otherAddress", "type": "address" }, { "internalType": "uint256", "name": "otherAccountId", "type": "uint256" }, { "internalType": "bytes", "name": "data", "type": "bytes" } ], "internalType": "struct Actions.ActionArgs[]", "name": "", "type": "tuple[]" } ], "payable": false, "stateMutability": "view", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"actionsLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"primaryAccountId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"otherAccountId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"primaryAccountOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"primaryAccountNumber\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"otherAccountOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"otherAccountNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"outputMarket\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"inputMarket\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minOutputAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"inputAmount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"orderData\",\"type\":\"bytes\"}],\"internalType\":\"struct IIsolationModeWrapperTrader.CreateActionsForWrappingParams\",\"name\":\"_params\",\"type\":\"tuple\"}],\"name\":\"createActionsForWrapping\",\"outputs\":[{\"components\":[{\"internalType\":\"enum Actions.ActionType\",\"name\":\"actionType\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"accountId\",\"type\":\"uint256\"},{\"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\":\"amount\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"primaryMarketId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"secondaryMarketId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"otherAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"otherAccountId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Actions.ActionArgs[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"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\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_inputToken\",\"type\":\"address\"}],\"name\":\"isValidInputToken\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Dolomite * Interface for a contract that can convert a token into an isolation mode token.\",\"methods\":{\"actionsLength()\":{\"return\":\"The number of actions used to wrap a valid input token into the this wrapper's Isolation Mode token.\"},\"createActionsForWrapping((uint256,uint256,address,uint256,address,uint256,uint256,uint256,uint256,uint256,bytes))\":{\"params\":{\"_params\":\"The parameters for creating the actions for wrapping.\"},\"return\":\"The actions that will be executed to unwrap the `_inputMarket` into `_outputMarket`.\"},\"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\"},\"isValidInputToken(address)\":{\"return\":\"True if the `_inputToken` is a valid input token for this contract, to be wrapped into `token()`\"},\"token()\":{\"return\":\"The isolation mode token that this contract can wrap (the output token)\"}},\"title\":\"IIsolationModeWrapperTrader\"},\"userdoc\":{\"methods\":{\"createActionsForWrapping((uint256,uint256,address,uint256,address,uint256,uint256,uint256,uint256,uint256,bytes))\":{\"notice\":\"Creates the necessary actions for selling the `_inputMarket` into `_outputMarket`. Note, the `_outputMarket` should be equal to `token()` and `_inputMarket` should be validated to be a correct market that can be transformed into `token()`.\"},\"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/external/interfaces/IIsolationModeWrapperTrader.sol\":\"IIsolationModeWrapperTrader\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IIsolationModeWrapperTrader.sol\":{\"keccak256\":\"0xd228f8ed8b44af8d34d6731434aa6d4146631102ec3402c5731a803393d25a9f\",\"urls\":[\"bzz-raw://186605de708fa3c5075034d0ec4e9cefacd13dd52f22ee0a485a86a4ad92d6fe\",\"dweb:/ipfs/QmcY3411rTWkk8tCGKtj7E94WC3haTbEboY1odjchra6Sn\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IExchangeWrapper.sol\":{\"keccak256\":\"0x74799c3fac16738be41e270a70d3f7ad4f75d1dc7e5d8c58f0fe4c6128345112\",\"urls\":[\"bzz-raw://d9602af1001189d199736d17266d5fb34a32f71cd05fbcf4c0f97c0b3a642eee\",\"dweb:/ipfs/QmPto2DkZ1nKqicBMdMkaek7kGSSXqSKnf697h5zuthvsy\"]},\"/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/Actions.sol\":{\"keccak256\":\"0x7b2fcf441c034952dd042b6c8b20b148359db771e7c9ac07d06369560a9f0301\",\"urls\":[\"bzz-raw://84665ee4a780360fe6160d197ba98f0bf0ab0d7c6ad87bfed6226bf2f88d8d30\",\"dweb:/ipfs/QmRDfRdAd8hSXeu4SAeeYKkKoXBhStu7n4uReYBce2JD5Z\"]},\"/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 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 { Actions } from \"../../protocol/lib/Actions.sol\";\n\nimport { IExchangeWrapper } from \"../../protocol/interfaces/IExchangeWrapper.sol\";\n\n\n/**\n * @title IIsolationModeWrapperTrader\n * @author Dolomite\n *\n * Interface for a contract that can convert a token into an isolation mode token.\n */\ncontract IIsolationModeWrapperTrader is IExchangeWrapper {\n\n struct CreateActionsForWrappingParams {\n /// @dev The index of the account (according the Accounts[] array) that is performing the sell.\n uint256 primaryAccountId;\n /// @dev The index of the account (according the Accounts[] array) that is being liquidated. This is set to\n /// `_primaryAccountId` if a liquidation is not occurring.\n uint256 otherAccountId;\n /// @dev The address of the owner of the account that is performing the sell.\n address primaryAccountOwner;\n /// @dev The account number of the owner of the account that is performing the sell.\n uint256 primaryAccountNumber;\n /// @dev The address of the owner of the account that is being liquidated. This is set to\n /// `_primaryAccountOwner` if a liquidation is not occurring.\n address otherAccountOwner;\n /// @dev The account number of the owner of the account that is being liquidated. This is set to\n /// `_primaryAccountNumber` if a liquidation is not occurring.\n uint256 otherAccountNumber;\n /// @dev The market that is being outputted by the wrapping, should be equal to `token().\n uint256 outputMarket;\n /// @dev The market that is being used to wrap into `token()`.\n uint256 inputMarket;\n /// @dev The min amount of `_outputMarket` that must be outputted by the wrapping.\n uint256 minOutputAmount;\n /// @dev The amount of the `_inputMarket` that the _primaryAccountId must sell.\n uint256 inputAmount;\n /// @dev The calldata to pass through to any external sales that occur.\n bytes orderData;\n }\n\n /**\n * @return The isolation mode token that this contract can wrap (the output token)\n */\n function token() external view returns (address);\n\n /**\n * @return True if the `_inputToken` is a valid input token for this contract, to be wrapped into `token()`\n */\n function isValidInputToken(address _inputToken) external view returns (bool);\n\n /**\n * @return The number of actions used to wrap a valid input token into the this wrapper's Isolation Mode token.\n */\n function actionsLength() external pure returns (uint256);\n\n /**\n * @notice Creates the necessary actions for selling the `_inputMarket` into `_outputMarket`. Note, the\n * `_outputMarket` should be equal to `token()` and `_inputMarket` should be validated to be a correct\n * market that can be transformed into `token()`.\n *\n * @param _params The parameters for creating the actions for wrapping.\n * @return The actions that will be executed to unwrap the `_inputMarket` into `_outputMarket`.\n */\n function createActionsForWrapping(\n CreateActionsForWrappingParams calldata _params\n ) external view returns (Actions.ActionArgs[] memory); // solium-disable-line indentation\n}\n", "sourcePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IIsolationModeWrapperTrader.sol", "ast": { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IIsolationModeWrapperTrader.sol", "exportedSymbols": { "IIsolationModeWrapperTrader": [ 4828 ] }, "id": 4829, "nodeType": "SourceUnit", "nodes": [ { "id": 4772, "literals": [ "solidity", "^", "0.5", ".7" ], "nodeType": "PragmaDirective", "src": "595:23:29" }, { "id": 4773, "literals": [ "experimental", "ABIEncoderV2" ], "nodeType": "PragmaDirective", "src": "619:33:29" }, { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Actions.sol", "file": "../../protocol/lib/Actions.sol", "id": 4775, "nodeType": "ImportDirective", "scope": 4829, "sourceUnit": 25370, "src": "654:57:29", "symbolAliases": [ { "foreign": 4774, "local": null } ], "unitAlias": "" }, { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IExchangeWrapper.sol", "file": "../../protocol/interfaces/IExchangeWrapper.sol", "id": 4777, "nodeType": "ImportDirective", "scope": 4829, "sourceUnit": 24750, "src": "713:82:29", "symbolAliases": [ { "foreign": 4776, "local": null } ], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 4778, "name": "IExchangeWrapper", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 24749, "src": "993:16:29", "typeDescriptions": { "typeIdentifier": "t_contract$_IExchangeWrapper_$24749", "typeString": "contract IExchangeWrapper" } }, "id": 4779, "nodeType": "InheritanceSpecifier", "src": "993:16:29" } ], "contractDependencies": [ 24749 ], "contractKind": "contract", "documentation": "@title IIsolationModeWrapperTrader\n@author Dolomite\n * Interface for a contract that can convert a token into an isolation mode token.", "fullyImplemented": false, "id": 4828, "linearizedBaseContracts": [ 4828, 24749 ], "name": "IIsolationModeWrapperTrader", "nodeType": "ContractDefinition", "nodes": [ { "canonicalName": "IIsolationModeWrapperTrader.CreateActionsForWrappingParams", "id": 4802, "members": [ { "constant": false, "id": 4781, "name": "primaryAccountId", "nodeType": "VariableDeclaration", "scope": 4802, "src": "1172:24:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4780, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1172:7:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4783, "name": "otherAccountId", "nodeType": "VariableDeclaration", "scope": 4802, "src": "1400:22:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4782, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1400:7:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4785, "name": "primaryAccountOwner", "nodeType": "VariableDeclaration", "scope": 4802, "src": "1521:27:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4784, "name": "address", "nodeType": "ElementaryTypeName", "src": "1521:7:29", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4787, "name": "primaryAccountNumber", "nodeType": "VariableDeclaration", "scope": 4802, "src": "1654:28:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4786, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1654:7:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4789, "name": "otherAccountOwner", "nodeType": "VariableDeclaration", "scope": 4802, "src": "1871:25:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4788, "name": "address", "nodeType": "ElementaryTypeName", "src": "1871:7:29", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4791, "name": "otherAccountNumber", "nodeType": "VariableDeclaration", "scope": 4802, "src": "2093:26:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4790, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2093:7:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4793, "name": "outputMarket", "nodeType": "VariableDeclaration", "scope": 4802, "src": "2230:20:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4792, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2230:7:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4795, "name": "inputMarket", "nodeType": "VariableDeclaration", "scope": 4802, "src": "2334:19:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4794, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2334:7:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4797, "name": "minOutputAmount", "nodeType": "VariableDeclaration", "scope": 4802, "src": "2457:23:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4796, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2457:7:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4799, "name": "inputAmount", "nodeType": "VariableDeclaration", "scope": 4802, "src": "2581:19:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4798, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2581:7:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4801, "name": "orderData", "nodeType": "VariableDeclaration", "scope": 4802, "src": "2693:15:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes_storage_ptr", "typeString": "bytes" }, "typeName": { "id": 4800, "name": "bytes", "nodeType": "ElementaryTypeName", "src": "2693:5:29", "typeDescriptions": { "typeIdentifier": "t_bytes_storage_ptr", "typeString": "bytes" } }, "value": null, "visibility": "internal" } ], "name": "CreateActionsForWrappingParams", "nodeType": "StructDefinition", "scope": 4828, "src": "1017:1698:29", "visibility": "public" }, { "body": null, "documentation": "@return The isolation mode token that this contract can wrap (the output token)", "id": 4807, "implemented": false, "kind": "function", "modifiers": [], "name": "token", "nodeType": "FunctionDefinition", "parameters": { "id": 4803, "nodeType": "ParameterList", "parameters": [], "src": "2838:2:29" }, "returnParameters": { "id": 4806, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4805, "name": "", "nodeType": "VariableDeclaration", "scope": 4807, "src": "2864:7:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4804, "name": "address", "nodeType": "ElementaryTypeName", "src": "2864:7:29", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "2863:9:29" }, "scope": 4828, "src": "2824:49:29", "stateMutability": "view", "superFunction": null, "visibility": "external" }, { "body": null, "documentation": "@return True if the `_inputToken` is a valid input token for this contract, to be wrapped into `token()`", "id": 4814, "implemented": false, "kind": "function", "modifiers": [], "name": "isValidInputToken", "nodeType": "FunctionDefinition", "parameters": { "id": 4810, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4809, "name": "_inputToken", "nodeType": "VariableDeclaration", "scope": 4814, "src": "3034:19:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4808, "name": "address", "nodeType": "ElementaryTypeName", "src": "3034:7:29", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "3033:21:29" }, "returnParameters": { "id": 4813, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4812, "name": "", "nodeType": "VariableDeclaration", "scope": 4814, "src": "3078:4:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 4811, "name": "bool", "nodeType": "ElementaryTypeName", "src": "3078:4:29", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" } ], "src": "3077:6:29" }, "scope": 4828, "src": "3007:77:29", "stateMutability": "view", "superFunction": null, "visibility": "external" }, { "body": null, "documentation": "@return The number of actions used to wrap a valid input token into the this wrapper's Isolation Mode token.", "id": 4819, "implemented": false, "kind": "function", "modifiers": [], "name": "actionsLength", "nodeType": "FunctionDefinition", "parameters": { "id": 4815, "nodeType": "ParameterList", "parameters": [], "src": "3245:2:29" }, "returnParameters": { "id": 4818, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4817, "name": "", "nodeType": "VariableDeclaration", "scope": 4819, "src": "3271:7:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4816, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "3271:7:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "3270:9:29" }, "scope": 4828, "src": "3223:57:29", "stateMutability": "pure", "superFunction": null, "visibility": "external" }, { "body": null, "documentation": "@notice Creates the necessary actions for selling the `_inputMarket` into `_outputMarket`. Note, the\n `_outputMarket` should be equal to `token()` and `_inputMarket` should be validated to be a correct\n market that can be transformed into `token()`.\n * @param _params The parameters for creating the actions for wrapping.\n@return The actions that will be executed to unwrap the `_inputMarket` into `_outputMarket`.", "id": 4827, "implemented": false, "kind": "function", "modifiers": [], "name": "createActionsForWrapping", "nodeType": "FunctionDefinition", "parameters": { "id": 4822, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4821, "name": "_params", "nodeType": "VariableDeclaration", "scope": 4827, "src": "3828:47:29", "stateVariable": false, "storageLocation": "calldata", "typeDescriptions": { "typeIdentifier": "t_struct$_CreateActionsForWrappingParams_$4802_calldata_ptr", "typeString": "struct IIsolationModeWrapperTrader.CreateActionsForWrappingParams" }, "typeName": { "contractScope": null, "id": 4820, "name": "CreateActionsForWrappingParams", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4802, "src": "3828:30:29", "typeDescriptions": { "typeIdentifier": "t_struct$_CreateActionsForWrappingParams_$4802_storage_ptr", "typeString": "struct IIsolationModeWrapperTrader.CreateActionsForWrappingParams" } }, "value": null, "visibility": "internal" } ], "src": "3818:63:29" }, "returnParameters": { "id": 4826, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4825, "name": "", "nodeType": "VariableDeclaration", "scope": 4827, "src": "3905:27:29", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_ActionArgs_$24930_memory_$dyn_memory_ptr", "typeString": "struct Actions.ActionArgs[]" }, "typeName": { "baseType": { "contractScope": null, "id": 4823, "name": "Actions.ActionArgs", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 24930, "src": "3905:18:29", "typeDescriptions": { "typeIdentifier": "t_struct$_ActionArgs_$24930_storage_ptr", "typeString": "struct Actions.ActionArgs" } }, "id": 4824, "length": null, "nodeType": "ArrayTypeName", "src": "3905:20:29", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_ActionArgs_$24930_storage_$dyn_storage_ptr", "typeString": "struct Actions.ActionArgs[]" } }, "value": null, "visibility": "internal" } ], "src": "3904:29:29" }, "scope": 4828, "src": "3785:149:29", "stateMutability": "view", "superFunction": null, "visibility": "external" } ], "scope": 4829, "src": "953:3018:29" } ], "src": "595:3377:29" }, "legacyAST": { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IIsolationModeWrapperTrader.sol", "exportedSymbols": { "IIsolationModeWrapperTrader": [ 4828 ] }, "id": 4829, "nodeType": "SourceUnit", "nodes": [ { "id": 4772, "literals": [ "solidity", "^", "0.5", ".7" ], "nodeType": "PragmaDirective", "src": "595:23:29" }, { "id": 4773, "literals": [ "experimental", "ABIEncoderV2" ], "nodeType": "PragmaDirective", "src": "619:33:29" }, { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Actions.sol", "file": "../../protocol/lib/Actions.sol", "id": 4775, "nodeType": "ImportDirective", "scope": 4829, "sourceUnit": 25370, "src": "654:57:29", "symbolAliases": [ { "foreign": 4774, "local": null } ], "unitAlias": "" }, { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IExchangeWrapper.sol", "file": "../../protocol/interfaces/IExchangeWrapper.sol", "id": 4777, "nodeType": "ImportDirective", "scope": 4829, "sourceUnit": 24750, "src": "713:82:29", "symbolAliases": [ { "foreign": 4776, "local": null } ], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 4778, "name": "IExchangeWrapper", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 24749, "src": "993:16:29", "typeDescriptions": { "typeIdentifier": "t_contract$_IExchangeWrapper_$24749", "typeString": "contract IExchangeWrapper" } }, "id": 4779, "nodeType": "InheritanceSpecifier", "src": "993:16:29" } ], "contractDependencies": [ 24749 ], "contractKind": "contract", "documentation": "@title IIsolationModeWrapperTrader\n@author Dolomite\n * Interface for a contract that can convert a token into an isolation mode token.", "fullyImplemented": false, "id": 4828, "linearizedBaseContracts": [ 4828, 24749 ], "name": "IIsolationModeWrapperTrader", "nodeType": "ContractDefinition", "nodes": [ { "canonicalName": "IIsolationModeWrapperTrader.CreateActionsForWrappingParams", "id": 4802, "members": [ { "constant": false, "id": 4781, "name": "primaryAccountId", "nodeType": "VariableDeclaration", "scope": 4802, "src": "1172:24:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4780, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1172:7:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } },