@dolomite-exchange/dolomite-margin
Version:
Ethereum Smart Contracts and TypeScript library used for the DolomiteMargin trading protocol
407 lines • 2.09 MB
JSON
{
"contractName": "GenericTraderProxyBase",
"abi": [
{
"inputs": [
{
"internalType": "uint256",
"name": "_chainId",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"constant": true,
"inputs": [],
"name": "chainId",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "contract IDolomiteMargin",
"name": "_dolomiteMargin",
"type": "address"
},
{
"internalType": "uint256",
"name": "_marketId",
"type": "uint256"
}
],
"name": "isIsolationModeMarket",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
],
"metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"constant\":true,\"inputs\":[],\"name\":\"chainId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"contract IDolomiteMargin\",\"name\":\"_dolomiteMargin\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_marketId\",\"type\":\"uint256\"}],\"name\":\"isIsolationModeMarket\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Dolomite\",\"details\":\"Base contract with validation and utilities for trading any asset from an account\",\"methods\":{},\"title\":\"GenericTraderProxyBase\"},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/helpers/GenericTraderProxyBase.sol\":\"GenericTraderProxyBase\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/helpers/GenericTraderProxyBase.sol\":{\"keccak256\":\"0x90b66c6de853e01fb004e4f1b78d51a818ab0bc7ae822709b989f008d2e76b4d\",\"urls\":[\"bzz-raw://a8fb3f83766be9aa674e68b87b9e8806ce3e3c772be91a5e91340f6e4a0bcf1d\",\"dweb:/ipfs/QmSSgnheY4xJJcqi7zFr2wntVjfAqM77YfKXcVHBtwvKX3\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/helpers/OnlyDolomiteMargin.sol\":{\"keccak256\":\"0xe40babc0a6dd2a767d76f3e0f0a22de124c4c480f2b2227a7b924b44e57526ea\",\"urls\":[\"bzz-raw://458f7f1f16eacd4faae597090503dc1e58446e9d371640c77b2e01e3e3113f17\",\"dweb:/ipfs/QmXqTG4sWJeDh5XA286KarbqHT4qJ7m3dphS16enpqtQiX\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/interfaces/IEventEmitterRegistry.sol\":{\"keccak256\":\"0x51ae058dafa3850ba14ea352c637af48e213c4b4e69e4d398b84ec6fed91d309\",\"urls\":[\"bzz-raw://974dda23508e2d7428433db7fb280c1bc82e197fd68f9d425c57f7bf57fdf82f\",\"dweb:/ipfs/QmeTteQN1tMXChaQ4nzBvLpndVfghaoznsQDM8kAqgDeF9\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/interfaces/IExpiry.sol\":{\"keccak256\":\"0xa7b197139e570e823cab42c3b8500c9c5edc8a40110970a7d6fe60f05864ba10\",\"urls\":[\"bzz-raw://4f469be063d8f694c5277650bc53ac2c0d164f62e36c6a9ab7dad126479990a9\",\"dweb:/ipfs/Qme4sTbGi4T2QhsJSweqGzqm5rxQkypy27g1vLy8ipVijV\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/interfaces/IGenericTraderProxyBase.sol\":{\"keccak256\":\"0x2ac2830618b13f412f53c803cb8c5e79f1ea1a7da0767fb0c6430a3435153f6f\",\"urls\":[\"bzz-raw://5e128520cdac823bc7dbe5331708c650d9a4ad6a18ec3bb7d9e8739f8360cfc0\",\"dweb:/ipfs/QmcDcrnMcXUGm7NT3q6Z4idFzqcNZukrwHn5GjX44u5Win\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/interfaces/IIsolationModeToken.sol\":{\"keccak256\":\"0x7924266dd63b2bfdad669f0f3c5be0b8562533a212c40459a5e350e75c27a438\",\"urls\":[\"bzz-raw://68fc0b4a568d19902b7c938edc74416dd6fb2af7a80f1c89375dce3f55d9b89d\",\"dweb:/ipfs/QmZMT59QgrAo3tmMCaY8HxiWfix5fBXVGs7HFrnSZ7mp9g\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/interfaces/IIsolationModeUnwrapperTrader.sol\":{\"keccak256\":\"0x6b46e389ec0dff927670d76a98902763b517bf81967f9e5b73c3ff6ced2a78c8\",\"urls\":[\"bzz-raw://17cd690e571d488432192852db474420c7e8d54db3169ab9b9c7d6963e9a708a\",\"dweb:/ipfs/Qmaam6B6WyYZmrtVWkJTKc6njrbZXHnERK2ngbwyK9WckM\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/interfaces/IIsolationModeWrapperTrader.sol\":{\"keccak256\":\"0xd228f8ed8b44af8d34d6731434aa6d4146631102ec3402c5731a803393d25a9f\",\"urls\":[\"bzz-raw://186605de708fa3c5075034d0ec4e9cefacd13dd52f22ee0a485a86a4ad92d6fe\",\"dweb:/ipfs/QmcY3411rTWkk8tCGKtj7E94WC3haTbEboY1odjchra6Sn\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/lib/AccountActionLib.sol\":{\"keccak256\":\"0x5488dd7eae5ce96e479445f19301d9dd44d292a2d6739b9da1fe948eeb41edc4\",\"urls\":[\"bzz-raw://06977e07aea4d893db696173f3ee01a84008770c4e0d81fb5eb82af3a597ceaa\",\"dweb:/ipfs/QmYiH8CsXEbHypJ2gN31LnZv2tfzd2RBuSKoRgx2EbBw26\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/lib/AccountBalanceLib.sol\":{\"keccak256\":\"0x76fd16d615fe7cfceaf775b4e6524fd0462606c802b082498c768a7a4ca01a20\",\"urls\":[\"bzz-raw://56068145e300cde1c77c22e38cb753378abf2f0d4613dcb203e33ff101f169e2\",\"dweb:/ipfs/QmXvMzr9n7vzMHdUPgnc58KX4mrbQAqkq4kDETaj5Y55ZY\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/interfaces/IAccountRiskOverrideSetter.sol\":{\"keccak256\":\"0x5b9fde139ddfdaae7b650b3c3f6699e0e44605f0d9d3daadc1622eb06ad4c3f8\",\"urls\":[\"bzz-raw://2dfd5af24b6de63f94519c99fd8777a264d7cd11266fa2d525c7d72d96a9c7cf\",\"dweb:/ipfs/QmPg9fjhbnmBayZMh6yTG79xsK1PWSoAHA5pfwSXfnKKjF\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/interfaces/IDolomiteMargin.sol\":{\"keccak256\":\"0x7e86ed1ed04dc205245db9f4e7cf7cca60c3bfc46c57ade8129a463780647967\",\"urls\":[\"bzz-raw://f8fbd85afd334c12bdccbb6523ebea9172b27b7b4b132c4a48b4b4dd03ceeb2b\",\"dweb:/ipfs/QmU1srfSqBTz3kw7oz1KEzfTUJvphZiE4K8MRZcy9uJjv1\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/interfaces/IERC20Detailed.sol\":{\"keccak256\":\"0x22a62e2a8155e70300773721902f4b9118e17aa0bb5d9d1b046050a014cfb223\",\"urls\":[\"bzz-raw://03af737a33c552fbe58f6f1fbd5496854fdc28dd57be4365d56663725c083a18\",\"dweb:/ipfs/QmbgLqGAQEd6tXsZB8QaPNCAMiU6nNzP75wNbKdS65BuUF\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/interfaces/IExchangeWrapper.sol\":{\"keccak256\":\"0x74799c3fac16738be41e270a70d3f7ad4f75d1dc7e5d8c58f0fe4c6128345112\",\"urls\":[\"bzz-raw://d9602af1001189d199736d17266d5fb34a32f71cd05fbcf4c0f97c0b3a642eee\",\"dweb:/ipfs/QmPto2DkZ1nKqicBMdMkaek7kGSSXqSKnf697h5zuthvsy\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/interfaces/IInterestSetter.sol\":{\"keccak256\":\"0x546825f65490a30e29d0f6446acec49c1e895ce6b33d48ca5c05092725a63a57\",\"urls\":[\"bzz-raw://6ad3013aed985bdf6e6234ae0f7f37e6bba76c3470c33bfa24678cf19b3b412c\",\"dweb:/ipfs/QmfYaSBzxGpgiHoR7ontMJY66S5L26XwkLYoEuzsEjpbQH\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/interfaces/IOracleSentinel.sol\":{\"keccak256\":\"0xa94499fda55ef112640daed2cb1d06062e72c51c7b925c323b4e0ffa9b456ce5\",\"urls\":[\"bzz-raw://18b4a16acac577590a57f34f7ec6583e3cb35f575c948abb928b308d29cac1ab\",\"dweb:/ipfs/QmR1jLkzj6w7SjrdZ7GVW4V2vofSdMJwzjTqKpeUKABvxu\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/interfaces/IPriceOracle.sol\":{\"keccak256\":\"0x3f7c3d1397390ea44c6d5e5730d49476431c3df3b28334fe38218de5edc31138\",\"urls\":[\"bzz-raw://63ebf926fca9ce33aaabaf93805686acc25daded1648d6dab59c8c4d05116918\",\"dweb:/ipfs/QmeGkDp7ycYstpfqCYBiqoCYwy876gabx8r42o5koj3H5A\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Account.sol\":{\"keccak256\":\"0x2059276ea5e478bd5ac7f2712e7b1b6c85d291c647a54b264909044844828e67\",\"urls\":[\"bzz-raw://f153777051d12131b13a57e5c3af10a2670927cfc7d22c9519ab20c9b4b9bc89\",\"dweb:/ipfs/QmQMP3qS5xDAVGYKDfNkbkSqBKozQGQsGqX4e8VyjRtxPS\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Actions.sol\":{\"keccak256\":\"0x7b2fcf441c034952dd042b6c8b20b148359db771e7c9ac07d06369560a9f0301\",\"urls\":[\"bzz-raw://84665ee4a780360fe6160d197ba98f0bf0ab0d7c6ad87bfed6226bf2f88d8d30\",\"dweb:/ipfs/QmRDfRdAd8hSXeu4SAeeYKkKoXBhStu7n4uReYBce2JD5Z\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Bits.sol\":{\"keccak256\":\"0x6d9a641163b2dd25e648c65f5d9e4949a57938e29ddc4c9dddefd74a9964aeef\",\"urls\":[\"bzz-raw://67e5a04ed4055faafbc100d6ccca9c54448ed378a1a8c71171562edda7bcbf7c\",\"dweb:/ipfs/QmYRikK3Xbgiq3UBJkgoo2zNUSSrShVabpRHmQj6iQHhrc\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Cache.sol\":{\"keccak256\":\"0xe57c80a7621a77fcb2acb9f883fb5248e71a6dce03bc2db56df0db3fee332950\",\"urls\":[\"bzz-raw://28e221c04629674490b9a0041d4f9a5f15e669dc0cc192a5df6e2c701c36369f\",\"dweb:/ipfs/QmaL3oh8c7v9cx91pB175pyCEuzxnhNTab4UxmBMsDYfUx\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Decimal.sol\":{\"keccak256\":\"0xd9a348c2b1eec076609ba12bbec6b9c2e4ea135790a7ef4f5411feb050af2144\",\"urls\":[\"bzz-raw://d5bcff29e47d5cd02d7a9966e9f44c46ccbb4f0e4adfc4b0b86646880677db39\",\"dweb:/ipfs/QmRKfJD4FFM1AvTynSFNx1NcDg94o9SAcjz7dvMaJCfecp\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/DolomiteMarginMath.sol\":{\"keccak256\":\"0x53f205f6a779d579be29faa9412c806a892b3e605fff092dfd9d14d936fa019f\",\"urls\":[\"bzz-raw://0ff936f89602a63b8e6a4eb4ce8f87673c0f45b7ce29694920905a3f0b5a6a69\",\"dweb:/ipfs/QmbYME9BeEvPC1ndV8EaUDX5fDMghLc3rocNUxFtgHmg8m\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/EnumerableSet.sol\":{\"keccak256\":\"0x41a3460e34b7b8635d936e35e6568ceb5354b638f53b884530e0d4875fa0f151\",\"urls\":[\"bzz-raw://d1a5ba866ee95d455afe5075dadd91fc71c2806371f2c1b358a1f67c632bb0df\",\"dweb:/ipfs/QmW4qCjmsG8J3UJv97GwDLDM7wt1K4yLDKAwzWMY7TFYi5\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Events.sol\":{\"keccak256\":\"0x2345dcc1ebf53a3d5449dab083b1fb90b5362dae692f8ff3ad00078862894e9b\",\"urls\":[\"bzz-raw://ebd34c557c06caf0696774844f0ca9746412ecc452bdd978b3bca0fd71aefbde\",\"dweb:/ipfs/QmcwXXKgv77DqfhxABRg85WR6RBPTLmge5vJGp99o9kFf8\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/ExcessivelySafeCall.sol\":{\"keccak256\":\"0x9369468538c371057c907f84d438cec6b47673711fe289cc3779f8671314e06b\",\"urls\":[\"bzz-raw://0f59a670f4bc5cf1bd3dd58bdf6c31723d9d84d9da7d9283d6860cdf5f33b7c5\",\"dweb:/ipfs/QmTGuvD5WQD2z56GH35HoPJivKPeeEpbXidJVcbXZyT23C\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Interest.sol\":{\"keccak256\":\"0x141a0ecb4a746f0e5767df4b99dbe33c6362df507ae9d5c02da1c1c17bc26df3\",\"urls\":[\"bzz-raw://9ff03e64a8ce5231acde07788624bf8c7a8ff55d90b157fa32f62fa887a0eff0\",\"dweb:/ipfs/QmUVxxWeE954RDXbmHJAYnHsXcit6rSXGqZUigu8t9oH2z\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Monetary.sol\":{\"keccak256\":\"0x5257274f2d4d3605f3e97ec45fb902111fe9a22506f0b4cf308ea933bc81bfe2\",\"urls\":[\"bzz-raw://85b8023b78805063a2ec8d376f1f5983994eabd96efd8ceadb0224dbb71c5678\",\"dweb:/ipfs/QmaDhzCzRqsuHuJfhToEC4pATQHwhh7yWWsjwfuRzFT1kG\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Require.sol\":{\"keccak256\":\"0x05a2a90b41b6a5f42f0a72da63d015fb0b406a9ba2172823352e522e8bf3a606\",\"urls\":[\"bzz-raw://19883f0c6d33266f756ec5c3d17539524aa24b993c46c33f8400801d09373a6c\",\"dweb:/ipfs/QmYX2fwK3vQQDSZLMrc5wMfeb8RWrcC9CGX8XECLty8QDk\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Storage.sol\":{\"keccak256\":\"0x9c27f3cd52af28c9b6bca18097b1793f114d08284d78417467d0d05f67e9e2a9\",\"urls\":[\"bzz-raw://d1ed0e7a7f76d59f30572996d4e164ab8fb5b2ec4bfca127983f9e936b904813\",\"dweb:/ipfs/QmePVYbgrY8Yw3Vf76pmEvE9pX916Jaa9we4kjM8tGM4J1\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Time.sol\":{\"keccak256\":\"0x87ee8d3c1d6e315a116426d8c8fc6f083e220fd14dda27fad4e8d7cab3dc7305\",\"urls\":[\"bzz-raw://7c20f2c52da682c3b5917fb6a19e81f43699b1d13c62b569ed723f34da72e766\",\"dweb:/ipfs/QmbXWYXi67nHBVNDKYUpo2E9ZaEVcHLvmXQkpYLMm1d5Vm\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Token.sol\":{\"keccak256\":\"0x095b5f8eb3665f6e246200311efc8a654fa3e90f9a1a522e27a4d089e8ab3917\",\"urls\":[\"bzz-raw://5db812b752a03d601d424e6e21be38153477082af0acf51b5c98eefa5553ed18\",\"dweb:/ipfs/QmbE549QUXYTurpx8hSMLBJvuBpfYqyNE6FBCgHJDY8PLf\"]},\"/home/cdc218/projects/dolomite/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\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0xe5bb0f57cff3e299f360052ba50f1ea0fff046df2be070b6943e0e3c3fdad8a9\",\"urls\":[\"bzz-raw://59fd025151435da35faa8093a5c7a17de02de9d08ad27275c5cdf05050820d91\",\"dweb:/ipfs/QmQMvwEcPhoRXzbXyrdoeRtvLoifUW9Qh7Luho7bmUPRkc\"]},\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\":{\"keccak256\":\"0xb63221b23818d622bfd83d18e0968307e4fcb7a35536bdceded76e1cf8349acd\",\"urls\":[\"bzz-raw://44e1e8c22362c4708a8c3362735f1465f5b05e2f7315e16c7010d694ce019d73\",\"dweb:/ipfs/QmWj9g8X1hxkXRre2kwkEjLBetjuzmSbWHD81bsSojnBkS\"]}},\"version\":1}",
"bytecode": "0x",
"deployedBytecode": "0x",
"sourceMap": "",
"deployedSourceMap": "",
"source": "/*\n\n Copyright 2023 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 { ReentrancyGuard } from \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\";\n\nimport { IDolomiteMargin } from \"../../protocol/interfaces/IDolomiteMargin.sol\";\nimport { IERC20Detailed } from \"../../protocol/interfaces/IERC20Detailed.sol\";\n\nimport { Account } from \"../../protocol/lib/Account.sol\";\nimport { Actions } from \"../../protocol/lib/Actions.sol\";\nimport { Events } from \"../../protocol/lib/Events.sol\";\nimport { ExcessivelySafeCall } from \"../../protocol/lib/ExcessivelySafeCall.sol\";\nimport { Require } from \"../../protocol/lib/Require.sol\";\n\nimport { OnlyDolomiteMargin } from \"../helpers/OnlyDolomiteMargin.sol\";\n\nimport { IExpiry } from \"../interfaces/IExpiry.sol\";\nimport { IGenericTraderProxyBase } from \"../interfaces/IGenericTraderProxyBase.sol\";\nimport { IIsolationModeToken } from \"../interfaces/IIsolationModeToken.sol\";\nimport { IIsolationModeUnwrapperTrader } from \"../interfaces/IIsolationModeUnwrapperTrader.sol\";\nimport { IIsolationModeWrapperTrader } from \"../interfaces/IIsolationModeWrapperTrader.sol\";\n\nimport { AccountActionLib } from \"../lib/AccountActionLib.sol\";\n\n\n/**\n * @title GenericTraderProxyBase\n * @author Dolomite\n *\n * @dev Base contract with validation and utilities for trading any asset from an account\n */\ncontract GenericTraderProxyBase is IGenericTraderProxyBase {\n\n // ============ Constants ============\n\n bytes32 private constant FILE = \"GenericTraderProxyBase\";\n\n uint256 internal constant ARBITRUM_ONE = 42161;\n\n /// @dev The index of the trade account in the accounts array (for executing an operation)\n uint256 internal constant TRADE_ACCOUNT_ID = 0;\n uint256 internal constant ZAP_ACCOUNT_ID = 1;\n\n bytes32 internal constant GLP_ISOLATION_MODE_HASH = keccak256(bytes(\"Dolomite: Fee + Staked GLP\"));\n bytes32 internal constant ISOLATION_MODE_PREFIX_HASH = keccak256(bytes(\"Dolomite Isolation:\"));\n uint256 internal constant DOLOMITE_ISOLATION_LENGTH = 19;\n\n // ============ Fields ============\n\n uint256 public chainId;\n\n // ============ Public Functions ============\n\n constructor(uint256 _chainId) public {\n chainId = _chainId;\n }\n\n function isIsolationModeMarket(\n IDolomiteMargin _dolomiteMargin,\n uint256 _marketId\n ) public view returns (bool) {\n (bool isSuccess, bytes memory returnData) = ExcessivelySafeCall.safeStaticCall(\n _dolomiteMargin.getMarketTokenAddress(_marketId),\n IERC20Detailed(address(0)).name.selector,\n bytes(\"\")\n );\n if (!isSuccess) {\n return false;\n }\n string memory name = abi.decode(returnData, (string));\n return (\n (bytes(name).length >= DOLOMITE_ISOLATION_LENGTH\n && _hashSubstring(\n name,\n /* _startIndex = */ 0, // solium-disable-line indentation\n /* _endIndex = */ DOLOMITE_ISOLATION_LENGTH // solium-disable-line indentation\n ) == ISOLATION_MODE_PREFIX_HASH\n )\n || keccak256(bytes(name)) == GLP_ISOLATION_MODE_HASH\n );\n }\n\n // ============ Internal Functions ============\n\n function _validateMarketIdPath(\n uint256[] memory _marketIdsPath\n ) internal pure {\n Require.that(\n _marketIdsPath.length >= 2,\n FILE,\n \"Invalid market path length\"\n );\n }\n\n function _validateAmountWeis(\n uint256 _inputAmountWei,\n uint256 _minOutputAmountWei\n )\n internal\n pure\n {\n Require.that(\n _inputAmountWei != 0,\n FILE,\n \"Invalid inputAmountWei\"\n );\n Require.that(\n _minOutputAmountWei != 0,\n FILE,\n \"Invalid minOutputAmountWei\"\n );\n }\n\n function _validateTraderParams(\n GenericTraderProxyCache memory _cache,\n uint256[] memory _marketIdsPath,\n Account.Info[] memory _makerAccounts,\n TraderParam[] memory _traderParamsPath\n )\n internal\n view\n {\n Require.that(\n _marketIdsPath.length == _traderParamsPath.length + 1,\n FILE,\n \"Invalid traders params length\"\n );\n\n uint256 traderParamsPathLength = _traderParamsPath.length;\n for (uint256 i; i < traderParamsPathLength; ++i) {\n _validateTraderParam(\n _cache,\n _marketIdsPath,\n _makerAccounts,\n _traderParamsPath[i],\n /* _index = */ i // solium-disable-line indentation\n );\n }\n }\n\n function _validateTraderParam(\n GenericTraderProxyCache memory _cache,\n uint256[] memory _marketIdsPath,\n Account.Info[] memory _makerAccounts,\n TraderParam memory _traderParam,\n uint256 _index\n )\n internal\n view\n {\n Require.that(\n _traderParam.trader != address(0),\n FILE,\n \"Invalid trader at index\",\n _index\n );\n\n uint256 marketId = _marketIdsPath[_index];\n uint256 nextMarketId = _marketIdsPath[_index + 1];\n _validateIsolationModeStatusForTraderParam(\n _cache,\n marketId,\n nextMarketId,\n _traderParam\n );\n _validateTraderTypeForTraderParam(\n _cache,\n marketId,\n nextMarketId,\n _traderParam,\n _index\n );\n _validateMakerAccountForTraderParam(\n _makerAccounts,\n _traderParam,\n _index\n );\n }\n\n function _validateIsolationModeStatusForTraderParam(\n GenericTraderProxyCache memory _cache,\n uint256 _marketId,\n uint256 _nextMarketId,\n TraderParam memory _traderParam\n ) internal view {\n if (isIsolationModeMarket(_cache.dolomiteMargin, _marketId)) {\n // If the current market is in isolation mode, the trader type must be for isolation mode assets\n Require.that(\n _isUnwrapperTraderType(_traderParam.traderType),\n FILE,\n \"Invalid isolation mode unwrapper\",\n _marketId,\n uint256(uint8(_traderParam.traderType))\n );\n\n if (isIsolationModeMarket(_cache.dolomiteMargin, _nextMarketId)) {\n // If the user is unwrapping into an isolation mode asset, the next market must trust this trader\n address isolationModeToken = _cache.dolomiteMargin.getMarketTokenAddress(_nextMarketId);\n Require.that(\n IIsolationModeToken(isolationModeToken).isTokenConverterTrusted(_traderParam.trader),\n FILE,\n \"Invalid unwrap sequence\",\n _marketId,\n _nextMarketId\n );\n }\n } else if (isIsolationModeMarket(_cache.dolomiteMargin, _nextMarketId)) {\n // If the next market is in isolation mode, the trader must wrap the current asset into the isolation asset.\n Require.that(\n _isWrapperTraderType(_traderParam.traderType),\n FILE,\n \"Invalid isolation mode wrapper\",\n _nextMarketId,\n uint256(uint8(_traderParam.traderType))\n );\n } else {\n // If neither asset is in isolation mode, the trader type must be for non-isolation mode assets\n Require.that(\n _traderParam.traderType == TraderType.ExternalLiquidity\n || _traderParam.traderType == TraderType.InternalLiquidity,\n FILE,\n \"Invalid trader type\",\n uint256(uint8(_traderParam.traderType))\n );\n }\n }\n\n function _validateTraderTypeForTraderParam(\n GenericTraderProxyCache memory _cache,\n uint256 _marketId,\n uint256 _nextMarketId,\n TraderParam memory _traderParam,\n uint256 _index\n ) internal view {\n if (_isUnwrapperTraderType(_traderParam.traderType)) {\n IIsolationModeUnwrapperTrader unwrapperTrader = IIsolationModeUnwrapperTrader(_traderParam.trader);\n address isolationModeToken = _cache.dolomiteMargin.getMarketTokenAddress(_marketId);\n Require.that(\n unwrapperTrader.token() == isolationModeToken,\n FILE,\n \"Invalid input for unwrapper\",\n _index,\n _marketId\n );\n Require.that(\n unwrapperTrader.isValidOutputToken(_cache.dolomiteMargin.getMarketTokenAddress(_nextMarketId)),\n FILE,\n \"Invalid output for unwrapper\",\n _index + 1,\n _nextMarketId\n );\n Require.that(\n IIsolationModeToken(isolationModeToken).isTokenConverterTrusted(_traderParam.trader),\n FILE,\n \"Unwrapper trader not enabled\",\n _traderParam.trader,\n _marketId\n );\n } else if (_isWrapperTraderType(_traderParam.traderType)) {\n IIsolationModeWrapperTrader wrapperTrader = IIsolationModeWrapperTrader(_traderParam.trader);\n address isolationModeToken = _cache.dolomiteMargin.getMarketTokenAddress(_nextMarketId);\n Require.that(\n wrapperTrader.isValidInputToken(_cache.dolomiteMargin.getMarketTokenAddress(_marketId)),\n FILE,\n \"Invalid input for wrapper\",\n _index,\n _marketId\n );\n Require.that(\n wrapperTrader.token() == isolationModeToken,\n FILE,\n \"Invalid output for wrapper\",\n _index + 1,\n _nextMarketId\n );\n Require.that(\n IIsolationModeToken(isolationModeToken).isTokenConverterTrusted(_traderParam.trader),\n FILE,\n \"Wrapper trader not enabled\",\n _traderParam.trader,\n _nextMarketId\n );\n }\n }\n\n function _validateMakerAccountForTraderParam(\n Account.Info[] memory _makerAccounts,\n TraderParam memory _traderParam,\n uint256 _index\n ) internal pure {\n if (TraderType.InternalLiquidity == _traderParam.traderType) {\n // The makerAccountOwner should be set if the traderType is InternalLiquidity\n Require.that(\n _traderParam.makerAccountIndex < _makerAccounts.length\n && _makerAccounts[_traderParam.makerAccountIndex].owner != address(0),\n FILE,\n \"Invalid maker account owner\",\n _index\n );\n } else {\n // The makerAccountOwner and makerAccountNumber is not used if the traderType is not InternalLiquidity\n Require.that(\n _traderParam.makerAccountIndex == 0,\n FILE,\n \"Invalid maker account owner\",\n _index\n );\n }\n }\n\n function _validateZapAccount(\n GenericTraderProxyCache memory _cache,\n Account.Info memory _account,\n uint256[] memory _marketIdsPath\n ) internal view {\n uint256 marketIdsLength = _marketIdsPath.length;\n for (uint256 i; i < marketIdsLength; ++i) {\n // Panic if we're zapping to an account that has any value in it. Why? Because we don't want execute trades\n // where we sell ALL if there's already value in the account. That would mess up the user's holdings and\n // unintentionally sell assets the user does not want to sell.\n assert(_cache.dolomiteMargin.getAccountPar(_account, _marketIdsPath[i]).value == 0);\n }\n }\n\n function _getAccounts(\n GenericTraderProxyCache memory _cache,\n Account.Info[] memory _makerAccounts,\n address _tradeAccountOwner,\n uint256 _tradeAccountNumber\n )\n internal\n view\n returns (Account.Info[] memory)\n {\n Account.Info[] memory accounts = new Account.Info[](_cache.traderAccountStartIndex + _makerAccounts.length);\n accounts[TRADE_ACCOUNT_ID] = Account.Info({\n owner: _tradeAccountOwner,\n number: _tradeAccountNumber\n });\n accounts[ZAP_ACCOUNT_ID] = Account.Info({\n owner: _tradeAccountOwner,\n number: _calculateZapAccountNumber(_tradeAccountOwner, _tradeAccountNumber)\n });\n _appendTradersToAccounts(_cache, _makerAccounts, accounts);\n return accounts;\n }\n\n function _appendTradersToAccounts(\n GenericTraderProxyCache memory _cache,\n Account.Info[] memory _makerAccounts,\n Account.Info[] memory _accounts\n )\n internal\n pure\n {\n uint256 makerAccountsLength = _makerAccounts.length;\n for (uint256 i; i < makerAccountsLength; ++i) {\n Account.Info memory account = _accounts[_cache.traderAccountStartIndex + i];\n assert(account.owner == address(0) && account.number == 0);\n\n _accounts[_cache.traderAccountStartIndex + i] = Account.Info({\n owner: _makerAccounts[i].owner,\n number: _makerAccounts[i].number\n });\n }\n }\n\n function _getActionsLengthForTraderParams(\n TraderParam[] memory _tradersPath\n )\n internal\n pure\n returns (uint256)\n {\n uint256 actionsLength = 2; // start at 2 for the zap in/out of the zap account (2 transfer actions)\n uint256 tradersPathLength = _tradersPath.length;\n for (uint256 i; i < tradersPathLength; ++i) {\n if (_isUnwrapperTraderType(_tradersPath[i].traderType)) {\n actionsLength += IIsolationModeUnwrapperTrader(_tradersPath[i].trader).actionsLength();\n } else if (_isWrapperTraderType(_tradersPath[i].traderType)) {\n actionsLength += IIsolationModeWrapperTrader(_tradersPath[i].trader).actionsLength();\n } else {\n actionsLength += 1;\n }\n }\n return actionsLength;\n }\n\n function _appendTraderActions(\n Account.Info[] memory _accounts,\n Actions.ActionArgs[] memory _actions,\n GenericTraderProxyCache memory _cache,\n uint256[] memory _marketIdsPath,\n uint256 _inputAmountWei,\n uint256 _minOutputAmountWei,\n TraderParam[] memory _tradersPath\n )\n internal\n view\n {\n // Before the trades are started, transfer inputAmountWei of the inputMarket from the TRADE account to the ZAP account\n if (_inputAmountWei == AccountActionLib.all()) {\n // Transfer such that we TARGET w/e the trader has right now, before the trades occur\n _actions[_cache.actionsCursor++] = AccountActionLib.encodeTransferToTargetAmountAction(\n TRADE_ACCOUNT_ID,\n ZAP_ACCOUNT_ID,\n _marketIdsPath[0],\n /* _targetAmountWei = */ _cache.dolomiteMargin.getAccountWei(\n _accounts[TRADE_ACCOUNT_ID],\n _marketIdsPath[0]\n )\n );\n } else {\n _actions[_cache.actionsCursor++] = AccountActionLib.encodeTransferAction(\n TRADE_ACCOUNT_ID,\n ZAP_ACCOUNT_ID,\n _marketIdsPath[0],\n _inputAmountWei\n );\n }\n\n uint256 tradersPathLength = _tradersPath.length;\n for (uint256 i; i < tradersPathLength; ++i) {\n if (_tradersPath[i].traderType == TraderType.ExternalLiquidity) {\n _actions[_cache.actionsCursor++] = AccountActionLib.encodeExternalSellAction(\n ZAP_ACCOUNT_ID,\n _marketIdsPath[i],\n _marketIdsPath[i + 1],\n _tradersPath[i].trader,\n AccountActionLib.all(),\n _getMinOutputAmountWeiForIndex(_minOutputAmountWei, i, tradersPathLength),\n _tradersPath[i].tradeData\n );\n } else if (_tradersPath[i].traderType == TraderType.InternalLiquidity) {\n uint256 customInputAmountWei = AccountActionLib.all();\n bytes memory tradeData = _tradersPath[i].tradeData;\n if (chainId == ARBITRUM_ONE) {\n (\n customInputAmountWei,\n tradeData\n ) = abi.decode(tradeData, (uint256, bytes));\n Require.that(\n (i == 0 && customInputAmountWei == _inputAmountWei) || i != 0,\n FILE,\n \"Invalid custom input amount\"\n );\n }\n _actions[_cache.actionsCursor++] = AccountActionLib.encodeInternalTradeActionWithCustomData(\n ZAP_ACCOUNT_ID,\n /* _makerAccountId = */ _tradersPath[i].makerAccountIndex + _cache.traderAccountStartIndex,\n _marketIdsPath[i],\n _marketIdsPath[i + 1],\n _tradersPath[i].trader,\n customInputAmountWei,\n tradeData\n );\n } else if (_isUnwrapperTraderType(_tradersPath[i].traderType)) {\n // We can't use a Require for the following assert, because there's already an invariant that enforces\n // the trader is an `IsolationModeWrapper` if the market ID at `i + 1` is in isolation mode. Meaning,\n // an unwrapper can never appear at the non-zero index because there is an invariant that checks the\n // `IsolationModeWrapper` is the last index\n assert(i == 0);\n Actions.ActionArgs[] memory unwrapActions = IIsolationModeUnwrapperTrader(_tradersPath[i].trader)\n .createActionsForUnwrapping(\n IIsolationModeUnwrapperTrader.CreateActionsForUnwrappingParams({\n primaryAccountId: ZAP_ACCOUNT_ID,\n otherAccountId: _otherAccountId(),\n primaryAccountOwner: _accounts[ZAP_ACCOUNT_ID].owner,\n primaryAccountNumber: _accounts[ZAP_ACCOUNT_ID].number,\n otherAccountOwner: _accounts[_otherAccountId()].owner,\n otherAccountNumber: _accounts[_otherAccountId()].number,\n outputMarket: _marketIdsPath[i + 1],\n inputMarket: _marketIdsPath[i],\n minOutputAmount: _getMinOutputAmountWeiForIndex(\n _minOutputAmountWei,\n /* _index = */ i, // solium-disable-line indentation\n _tradersPath.length\n ),\n /* Cannot use ALL since it messes up the actions */\n inputAmount: _inputAmountWei,\n orderData: _tradersPath[i].tradeData\n })\n );\n\n for (uint256 j; j < unwrapActions.length; ++j) {\n _actions[_cache.actionsCursor++] = unwrapActions[j];\n }\n } else {\n // Panic if the developer messed up the `else` statement here\n assert(_isWrapperTraderType(_tradersPath[i].traderType));\n Require.that(\n i == tradersPathLength - 1,\n FILE,\n \"Wrapper must be the last trader\"\n );\n\n Actions.ActionArgs[] memory wrapActions = IIsolationModeWrapperTrader(_tradersPath[i].trader)\n .createActionsForWrapping(\n IIsolationModeWrapperTrader.CreateActionsForWrappingParams({\n primaryAccountId: ZAP_ACCOUNT_ID,\n otherAccountId: _otherAccountId(),\n primaryAccountOwner: _accounts[ZAP_ACCOUNT_ID].owner,\n primaryAccountNumber: _accounts[ZAP_ACCOUNT_ID].number,\n otherAccountOwner: _accounts[_otherAccountId()].owner,\n otherAccountNumber: _accounts[_otherAccountId()].number,\n outputMarket: _marketIdsPath[i + 1],\n inputMarket: _marketIdsPath[i],\n minOutputAmount: _getMinOutputAmountWeiForIndex(\n _minOutputAmountWei,\n /* _index = */ i, // solium-disable-line indentation\n _tradersPath.length\n ),\n inputAmount: AccountActionLib.all(),\n orderData: _tradersPath[i].tradeData\n })\n );\n\n for (uint256 j; j < wrapActions.length; ++j) {\n _actions[_cache.actionsCursor++] = wrapActions[j];\n }\n }\n }\n\n // When the trades are finished, transfer all of the outputMarket from the ZAP account to the TRADE account\n _actions[_cache.actionsCursor++] = AccountActionLib.encodeTransferAction(\n ZAP_ACCOUNT_ID,\n TRADE_ACCOUNT_ID,\n _marketIdsPath[_marketIdsPath.length - 1],\n AccountActionLib.all()\n );\n }\n\n /**\n * @return The index of the account that is not the Zap account. For the liquidation contract, this is\n * the account being liquidated. For the GenericTrader contract this is the same as the trader account.\n */\n function _otherAccountId() internal pure returns (uint256);\n\n function _isWrapperTraderType(\n TraderType _traderType\n )\n internal\n pure\n returns (bool)\n {\n return TraderType.IsolationModeWrapper == _traderType;\n }\n\n function _isUnwrapperTraderType(\n TraderType _traderType\n )\n internal\n pure\n returns (bool)\n {\n return TraderType.IsolationModeUnwrapper == _traderType;\n }\n\n // ==================== Private Functions ====================\n\n function _calculateZapAccountNumber(\n address _tradeAccountOwner,\n uint256 _tradeAccountNumber\n )\n private\n view\n returns (uint256)\n {\n return uint256(keccak256(abi.encodePacked(_tradeAccountOwner, _tradeAccountNumber, block.timestamp)));\n }\n\n function _getMinOutputAmountWeiForIndex(\n uint256 _minOutputAmountWei,\n uint256 _index,\n uint256 _tradersPathLength\n )\n private\n pure\n returns (uint256)\n {\n return _index == _tradersPathLength - 1 ? _minOutputAmountWei : 1;\n }\n\n function _hashSubstring(\n string memory _value,\n uint256 _startIndex,\n uint256 _endIndex\n )\n private\n pure\n returns (bytes32)\n {\n bytes memory strBytes = bytes(_value);\n bytes memory result = new bytes(_endIndex - _startIndex);\n for (uint256 i = _startIndex; i < _endIndex; i++) {\n result[i - _startIndex] = strBytes[i];\n }\n return keccak256(result);\n }\n}\n",
"sourcePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/helpers/GenericTraderProxyBase.sol",
"ast": {
"absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/helpers/GenericTraderProxyBase.sol",
"exportedSymbols": {
"GenericTraderProxyBase": [
1610
]
},
"id": 1611,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 155,
"literals": [
"solidity",
"^",
"0.5",
".7"
],
"nodeType": "PragmaDirective",
"src": "595:23:2"
},
{
"id": 156,
"literals": [
"experimental",
"ABIEncoderV2"
],
"nodeType": "PragmaDirective",
"src": "619:33:2"
},
{
"absolutePath": "@openzeppelin/contracts/utils/ReentrancyGuard.sol",
"file": "@openzeppelin/contracts/utils/ReentrancyGuard.sol",
"id": 158,
"nodeType": "ImportDirective",
"scope": 1611,
"sourceUnit": 38093,
"src": "654:84:2",
"symbolAliases": [
{
"foreign": 157,
"local": null
}
],
"unitAlias": ""
},
{
"absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/interfaces/IDolomiteMargin.sol",
"file": "../../protocol/interfaces/IDolomiteMargin.sol",
"id": 160,
"nodeType": "ImportDirective",
"scope": 1611,
"sourceUnit": 24694,
"src": "740:80:2",
"symbolAliases": [
{
"foreign": 159,
"local": null
}
],
"unitAlias": ""
},
{
"absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/interfaces/IERC20Detailed.sol",
"file": "../../protocol/interfaces/IERC20Detailed.sol",
"id": 162,
"nodeType": "ImportDirective",
"scope": 1611,
"sourceUnit": 24716,
"src": "821:78:2",
"symbolAliases": [
{
"foreign": 161,
"local": null
}
],
"unitAlias": ""
},
{
"absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Account.sol",
"file": "../../protocol/lib/Account.sol",
"id": 164,
"nodeType": "ImportDirective",
"scope": 1611,
"sourceUnit": 24886,
"src": "901:57:2",
"symbolAliases": [
{
"foreign": 163,
"local": null
}
],
"unitAlias": ""
},
{
"absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Actions.sol",
"file": "../../protocol/lib/Actions.sol",
"id": 166,
"nodeType": "ImportDirective",
"scope": 1611,
"sourceUnit": 25370,
"src": "959:57:2",
"symbolAliases": [
{
"foreign": 165,
"local": null
}
],
"unitAlias": ""
},
{
"absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Events.sol",
"file": "../../protocol/lib/Events.sol",
"id": 168,
"nodeType": "ImportDirective",
"scope": 1611,
"sourceUnit": 27154,
"src": "1017:55:2",
"symbolAliases": [
{
"foreign": 167,
"local": null
}
],
"unitAlias": ""
},
{
"absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/ExcessivelySafeCall.sol",
"file": "../../protocol/lib/ExcessivelySafeCall.sol",
"id": 170,
"nodeType": "ImportDirective",
"scope": 1611,
"sourceUnit": 27218,
"src": "1073:81:2",
"symbolAliases": [
{
"foreign": 169,
"local": null
}
],
"unitAlias": ""
},
{
"absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Require.sol",
"file": "../../protocol/lib/Require.sol",
"id": 172,
"nodeType": "ImportDirective",
"scope": 1611,
"sourceUnit": 28453,
"src": "1155:57:2",
"symbolAliases": [
{
"foreign": 171,
"local": null
}
],
"unitAlias": ""
},
{
"absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/helpers/OnlyDolomiteMargin.sol",
"file": "../helpers/OnlyDolomiteMargin.sol",
"id": 174,
"nodeType": "ImportDirective",
"scope": 1611,
"sourceUnit": 3067,
"src": "1214:71:2",
"symbolAliases": [
{
"foreign": 173,
"local": null
}
],
"unitAlias": ""
},
{
"absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/interfaces/IExpiry.sol",
"file": "../interfaces/IExpiry.sol",
"id": 176,
"nodeType": "ImportDirective",
"scope": 1611,
"sourceUnit": 4566,
"src": "1287:52:2",
"symbolAliases": [
{
"foreign": 175,
"local": null
}
],
"unitAlias": ""
},
{
"absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/interfaces/IGenericTraderProxyBase.sol",
"file": "../interfaces/IGenericTraderProxyBase.sol",
"id": 178,
"nodeType": "ImportDirective",
"scope": 1611,
"sourceUnit": 4609,
"src": "1340:84:2",
"symbolAliases": [
{
"foreign": 177,
"local": null
}
],
"unitAlias": ""
},
{
"absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/interfaces/IIsolationModeToken.sol",
"file": "../interfaces/IIsolationModeToken.sol",
"id": 180,
"nodeType": "ImportDirective",
"scope": 1611,
"sourceUnit": 4713,
"src": "1425:76:2",
"symbolAliases": [
{
"foreign": 179,
"local": null
}
],
"unitAlias": ""
},
{
"absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/interfaces/IIsolationModeUnwrapperTrader.sol",
"file": "../interfaces/IIsolationModeUnwrapperTrader.sol",
"id": 182,
"nodeType": "ImportDirective",
"scope": 1611,
"sourceUnit": 4771,
"src": "1502:96:2",
"symbolAliases": [
{
"foreign": 181,
"local": null
}
],
"unitAlias": ""
},
{
"absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/interfaces/IIsolationModeWrapperTrader.sol",
"file": "../interfaces/IIsolationModeWrapperTrader.sol",
"id": 184,
"nodeType": "ImportDirective",
"scope": 1611,
"sourceUnit": 4829,
"src": "1599:92:2",
"symbolAliases": [
{
"foreign": 183,
"local": null
}
],
"unitAlias": ""
},
{
"absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/lib/AccountActionLib.sol",
"file": "../lib/AccountActionLib.sol",
"id": 186,
"nodeType": "ImportDirective",
"scope": 1611,
"sourceUnit": 5820,
"src": "1693:63:2",
"symbolAliases": [
{
"foreign": 185,
"local": null
}
],
"unitAlias": ""
},
{
"baseContracts": [
{
"arguments": null,
"baseName": {
"contractScope": null,
"id": 187,
"name": "IGenericTraderProxyBase",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 4608,
"src": "1951:23:2",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IGenericTraderProxyBase_$4608",
"typeString": "contract IGenericTraderProxyBase"
}
},
"id": 188,
"nodeType": "InheritanceSpecifier",
"src": "1951:23:2"
}
],
"contractDependencies": [
4608
],
"contractKind": "contract",
"documentation": "@title GenericTraderProxyBase\n@author Dolomite\n * @dev Base contract with validation and utilities for trading any asset from an account",
"fullyImplemented": false,
"id": 1610,
"linearizedBaseContracts": [
1610,
4608
],
"name": "GenericTraderProxyBase",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": true,
"id": 191,
"name": "FILE",
"nodeType": "VariableDeclaration",
"scope": 1610,
"src": "2026:56:2",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 189,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "2026:7:2",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": {
"argumentTypes": null,
"hexValue": "47656e6572696354726164657250726f787942617365",
"id": 190,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2058:24:2",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_03664385853a22f68601b1e035ddf1153af2f8f76aa75847698e36a1619ef043",
"typeString": "literal_string \"GenericTraderProx