@dolomite-exchange/dolomite-margin
Version:
Ethereum Smart Contracts and TypeScript library used for the DolomiteMargin trading protocol
786 lines • 101 kB
JSON
{
"contractName": "Permission",
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "trusted",
"type": "bool"
}
],
"name": "LogOperatorSet",
"type": "event"
},
{
"constant": false,
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"internalType": "bool",
"name": "trusted",
"type": "bool"
}
],
"internalType": "struct Types.OperatorArg[]",
"name": "args",
"type": "tuple[]"
}
],
"name": "setOperators",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
],
"metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"trusted\",\"type\":\"bool\"}],\"name\":\"LogOperatorSet\",\"type\":\"event\"},{\"constant\":false,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"trusted\",\"type\":\"bool\"}],\"internalType\":\"struct Types.OperatorArg[]\",\"name\":\"args\",\"type\":\"tuple[]\"}],\"name\":\"setOperators\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"dYdX * Public function that allows other addresses to manage accounts\",\"methods\":{\"setOperators((address,bool)[])\":{\"params\":{\"args\":\"A list of OperatorArgs which have an address and a boolean. The boolean value denotes whether to approve (true) or revoke approval (false) for that address.\"}}},\"title\":\"Permission\"},\"userdoc\":{\"methods\":{\"setOperators((address,bool)[])\":{\"notice\":\"Approves/disapproves any number of operators. An operator is an external address that has the same permissions to manipulate an account as the owner of the account. Operators are simply addresses and therefore may either be externally-owned Ethereum accounts OR smart contracts. * Operators are also able to act as AutoTrader contracts on behalf of the account owner if the operator is a smart contract and implements the IAutoTrader interface.\"}}}},\"settings\":{\"compilationTarget\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/Permission.sol\":\"Permission\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/HasState.sol\":{\"keccak256\":\"0x5b3ef0033e519ea3f2a7877f659d653465e51f944ee5bb1957c8a089a151f609\",\"urls\":[\"bzz-raw://0f7e2c3b46ea904552e101c7bfffb647afc56408960814bab1989f2c05a34092\",\"dweb:/ipfs/QmWP3jVoYx9UYajjbDdUTBjkJT84gdJXoxaq7npTR4qVb3\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/Permission.sol\":{\"keccak256\":\"0x157aabb0fe4711f828790ef35a507d44c427c48b5f01b01eacbefe7a0a7815a7\",\"urls\":[\"bzz-raw://3eb031d9e809cb032dc52d5f197a70387aee9a7d5e02d27fd3f1c00451aefb32\",\"dweb:/ipfs/QmVnYud1bJ9BmRQnpQEGvnmFWTixmBZQBHbCxFy8UMo8ZK\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IAccountRiskOverrideSetter.sol\":{\"keccak256\":\"0x5b9fde139ddfdaae7b650b3c3f6699e0e44605f0d9d3daadc1622eb06ad4c3f8\",\"urls\":[\"bzz-raw://2dfd5af24b6de63f94519c99fd8777a264d7cd11266fa2d525c7d72d96a9c7cf\",\"dweb:/ipfs/QmPg9fjhbnmBayZMh6yTG79xsK1PWSoAHA5pfwSXfnKKjF\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IERC20Detailed.sol\":{\"keccak256\":\"0x22a62e2a8155e70300773721902f4b9118e17aa0bb5d9d1b046050a014cfb223\",\"urls\":[\"bzz-raw://03af737a33c552fbe58f6f1fbd5496854fdc28dd57be4365d56663725c083a18\",\"dweb:/ipfs/QmbgLqGAQEd6tXsZB8QaPNCAMiU6nNzP75wNbKdS65BuUF\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IInterestSetter.sol\":{\"keccak256\":\"0x546825f65490a30e29d0f6446acec49c1e895ce6b33d48ca5c05092725a63a57\",\"urls\":[\"bzz-raw://6ad3013aed985bdf6e6234ae0f7f37e6bba76c3470c33bfa24678cf19b3b412c\",\"dweb:/ipfs/QmfYaSBzxGpgiHoR7ontMJY66S5L26XwkLYoEuzsEjpbQH\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IOracleSentinel.sol\":{\"keccak256\":\"0xa94499fda55ef112640daed2cb1d06062e72c51c7b925c323b4e0ffa9b456ce5\",\"urls\":[\"bzz-raw://18b4a16acac577590a57f34f7ec6583e3cb35f575c948abb928b308d29cac1ab\",\"dweb:/ipfs/QmR1jLkzj6w7SjrdZ7GVW4V2vofSdMJwzjTqKpeUKABvxu\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IPriceOracle.sol\":{\"keccak256\":\"0x3f7c3d1397390ea44c6d5e5730d49476431c3df3b28334fe38218de5edc31138\",\"urls\":[\"bzz-raw://63ebf926fca9ce33aaabaf93805686acc25daded1648d6dab59c8c4d05116918\",\"dweb:/ipfs/QmeGkDp7ycYstpfqCYBiqoCYwy876gabx8r42o5koj3H5A\"]},\"/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/Bits.sol\":{\"keccak256\":\"0x6d9a641163b2dd25e648c65f5d9e4949a57938e29ddc4c9dddefd74a9964aeef\",\"urls\":[\"bzz-raw://67e5a04ed4055faafbc100d6ccca9c54448ed378a1a8c71171562edda7bcbf7c\",\"dweb:/ipfs/QmYRikK3Xbgiq3UBJkgoo2zNUSSrShVabpRHmQj6iQHhrc\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Cache.sol\":{\"keccak256\":\"0xe57c80a7621a77fcb2acb9f883fb5248e71a6dce03bc2db56df0db3fee332950\",\"urls\":[\"bzz-raw://28e221c04629674490b9a0041d4f9a5f15e669dc0cc192a5df6e2c701c36369f\",\"dweb:/ipfs/QmaL3oh8c7v9cx91pB175pyCEuzxnhNTab4UxmBMsDYfUx\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Decimal.sol\":{\"keccak256\":\"0xd9a348c2b1eec076609ba12bbec6b9c2e4ea135790a7ef4f5411feb050af2144\",\"urls\":[\"bzz-raw://d5bcff29e47d5cd02d7a9966e9f44c46ccbb4f0e4adfc4b0b86646880677db39\",\"dweb:/ipfs/QmRKfJD4FFM1AvTynSFNx1NcDg94o9SAcjz7dvMaJCfecp\"]},\"/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/Interest.sol\":{\"keccak256\":\"0x141a0ecb4a746f0e5767df4b99dbe33c6362df507ae9d5c02da1c1c17bc26df3\",\"urls\":[\"bzz-raw://9ff03e64a8ce5231acde07788624bf8c7a8ff55d90b157fa32f62fa887a0eff0\",\"dweb:/ipfs/QmUVxxWeE954RDXbmHJAYnHsXcit6rSXGqZUigu8t9oH2z\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Monetary.sol\":{\"keccak256\":\"0x5257274f2d4d3605f3e97ec45fb902111fe9a22506f0b4cf308ea933bc81bfe2\",\"urls\":[\"bzz-raw://85b8023b78805063a2ec8d376f1f5983994eabd96efd8ceadb0224dbb71c5678\",\"dweb:/ipfs/QmaDhzCzRqsuHuJfhToEC4pATQHwhh7yWWsjwfuRzFT1kG\"]},\"/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/Storage.sol\":{\"keccak256\":\"0x9c27f3cd52af28c9b6bca18097b1793f114d08284d78417467d0d05f67e9e2a9\",\"urls\":[\"bzz-raw://d1ed0e7a7f76d59f30572996d4e164ab8fb5b2ec4bfca127983f9e936b904813\",\"dweb:/ipfs/QmePVYbgrY8Yw3Vf76pmEvE9pX916Jaa9we4kjM8tGM4J1\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Time.sol\":{\"keccak256\":\"0x87ee8d3c1d6e315a116426d8c8fc6f083e220fd14dda27fad4e8d7cab3dc7305\",\"urls\":[\"bzz-raw://7c20f2c52da682c3b5917fb6a19e81f43699b1d13c62b569ed723f34da72e766\",\"dweb:/ipfs/QmbXWYXi67nHBVNDKYUpo2E9ZaEVcHLvmXQkpYLMm1d5Vm\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Token.sol\":{\"keccak256\":\"0x095b5f8eb3665f6e246200311efc8a654fa3e90f9a1a522e27a4d089e8ab3917\",\"urls\":[\"bzz-raw://5db812b752a03d601d424e6e21be38153477082af0acf51b5c98eefa5553ed18\",\"dweb:/ipfs/QmbE549QUXYTurpx8hSMLBJvuBpfYqyNE6FBCgHJDY8PLf\"]},\"/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\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0xe5bb0f57cff3e299f360052ba50f1ea0fff046df2be070b6943e0e3c3fdad8a9\",\"urls\":[\"bzz-raw://59fd025151435da35faa8093a5c7a17de02de9d08ad27275c5cdf05050820d91\",\"dweb:/ipfs/QmQMvwEcPhoRXzbXyrdoeRtvLoifUW9Qh7Luho7bmUPRkc\"]}},\"version\":1}",
"bytecode": "0x608060405234801561001057600080fd5b5061034b806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806385b53fc814610030575b600080fd5b61004361003e366004610200565b610045565b005b805160005b8181101561011757600083828151811061006057fe5b6020026020010151600001519050600084838151811061007c57fe5b602002602001015160200151905080610096576002610099565b60015b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff881684529091529081902060ff9390931690925590517f4d7f317d2088d039c2a95a09fcbf9cc9191fad5905f883c937cc3d317c4a6327906101059085908590610255565b60405180910390a2505060010161004a565b505050565b8035610127816102e8565b92915050565b600082601f83011261013e57600080fd5b813561015161014c8261029e565b610277565b9150818183526020840193506020810190508385604084028201111561017657600080fd5b60005b838110156101a4578161018c88826101b9565b84525060209092019160409190910190600101610179565b5050505092915050565b8035610127816102ff565b6000604082840312156101cb57600080fd5b6101d56040610277565b905060006101e3848461011c565b82525060206101f4848483016101ae565b60208301525092915050565b60006020828403121561021257600080fd5b813567ffffffffffffffff81111561022957600080fd5b6102358482850161012d565b949350505050565b610246816102bf565b82525050565b610246816102ca565b60408101610263828561023d565b610270602083018461024c565b9392505050565b60405181810167ffffffffffffffff8111828210171561029657600080fd5b604052919050565b600067ffffffffffffffff8211156102b557600080fd5b5060209081020190565b6000610127826102cf565b151590565b73ffffffffffffffffffffffffffffffffffffffff1690565b6102f1816102bf565b81146102fc57600080fd5b50565b6102f1816102ca56fea365627a7a72315820233f2ff9ef3311756b2889e8bb13f4597a552122f59aa5647cc48eb01a23e6726c6578706572696d656e74616cf564736f6c63430005100040",
"deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c806385b53fc814610030575b600080fd5b61004361003e366004610200565b610045565b005b805160005b8181101561011757600083828151811061006057fe5b6020026020010151600001519050600084838151811061007c57fe5b602002602001015160200151905080610096576002610099565b60015b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff881684529091529081902060ff9390931690925590517f4d7f317d2088d039c2a95a09fcbf9cc9191fad5905f883c937cc3d317c4a6327906101059085908590610255565b60405180910390a2505060010161004a565b505050565b8035610127816102e8565b92915050565b600082601f83011261013e57600080fd5b813561015161014c8261029e565b610277565b9150818183526020840193506020810190508385604084028201111561017657600080fd5b60005b838110156101a4578161018c88826101b9565b84525060209092019160409190910190600101610179565b5050505092915050565b8035610127816102ff565b6000604082840312156101cb57600080fd5b6101d56040610277565b905060006101e3848461011c565b82525060206101f4848483016101ae565b60208301525092915050565b60006020828403121561021257600080fd5b813567ffffffffffffffff81111561022957600080fd5b6102358482850161012d565b949350505050565b610246816102bf565b82525050565b610246816102ca565b60408101610263828561023d565b610270602083018461024c565b9392505050565b60405181810167ffffffffffffffff8111828210171561029657600080fd5b604052919050565b600067ffffffffffffffff8211156102b557600080fd5b5060209081020190565b6000610127826102cf565b151590565b73ffffffffffffffffffffffffffffffffffffffff1690565b6102f1816102bf565b81146102fc57600080fd5b50565b6102f1816102ca56fea365627a7a72315820233f2ff9ef3311756b2889e8bb13f4597a552122f59aa5647cc48eb01a23e6726c6578706572696d656e74616cf564736f6c63430005100040",
"sourceMap": "863:1369:67:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;863:1369:67;;;;;;;",
"deployedSourceMap": "863:1369:67:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;863:1369:67;;;;;;;;;;;;;;;;;;;1816:414;;;;;;;;;:::i;:::-;;;1931:11;;1914:14;1952:272;1972:6;1968:1;:10;1952:272;;;1999:16;2018:4;2023:1;2018:7;;;;;;;;;;;;;;:16;;;1999:35;;2048:12;2063:4;2068:1;2063:7;;;;;;;;;;;;;;:15;;;2048:30;;2134:7;:15;;2148:1;2134:15;;;2144:1;2134:15;2110:10;2092:7;:29;;;:17;:29;;;;;;;;;:39;;;;;;;;;;;:57;;;;;;;;2168:45;;;;;;2122:8;;2205:7;;2168:45;;;;;;;;;;-1:-1:-1;;1980:3:67;;1952:272;;;;1816:414;;:::o;5:130:-1:-;72:20;;97:33;72:20;97:33;;;57:78;;;;;177:785;;320:3;313:4;305:6;301:17;297:27;287:2;;338:1;335;328:12;287:2;375:6;362:20;397:106;412:90;495:6;412:90;;;397:106;;;388:115;;520:5;545:6;538:5;531:21;575:4;567:6;563:17;553:27;;597:4;592:3;588:14;581:21;;650:6;697:3;689:4;681:6;677:17;672:3;668:27;665:36;662:2;;;714:1;711;704:12;662:2;739:1;724:232;749:6;746:1;743:13;724:232;;;807:3;829:63;888:3;876:10;829:63;;;817:76;;-1:-1;916:4;907:14;;;;944:4;935:14;;;;;771:1;764:9;724:232;;;728:14;280:682;;;;;;;;970:124;1034:20;;1059:30;1034:20;1059:30;;1132:472;;1247:4;1235:9;1230:3;1226:19;1222:30;1219:2;;;1265:1;1262;1255:12;1219:2;1283:20;1298:4;1283:20;;;1274:29;-1:-1;1357:1;1389:49;1434:3;1414:9;1389:49;;;1364:75;;-1:-1;1503:2;1536:46;1578:3;1554:22;;;1536:46;;;1529:4;1522:5;1518:16;1511:72;1460:134;1213:391;;;;;1611:429;;1766:2;1754:9;1745:7;1741:23;1737:32;1734:2;;;1782:1;1779;1772:12;1734:2;1817:31;;1868:18;1857:30;;1854:2;;;1900:1;1897;1890:12;1854:2;1920:104;2016:7;2007:6;1996:9;1992:22;1920:104;;;1910:114;1728:312;-1:-1;;;;1728:312;2047:113;2130:24;2148:5;2130:24;;;2125:3;2118:37;2112:48;;;2167:104;2244:21;2259:5;2244:21;;2278:312;2418:2;2403:18;;2432:71;2407:9;2476:6;2432:71;;;2514:66;2576:2;2565:9;2561:18;2552:6;2514:66;;;2389:201;;;;;;2597:256;2659:2;2653:9;2685:17;;;2760:18;2745:34;;2781:22;;;2742:62;2739:2;;;2817:1;2814;2807:12;2739:2;2833;2826:22;2637:216;;-1:-1;2637:216;2860:330;;3045:18;3037:6;3034:30;3031:2;;;3077:1;3074;3067:12;3031:2;-1:-1;3112:4;3100:17;;;3165:15;;2968:222;3197:91;;3259:24;3277:5;3259:24;;3295:85;3361:13;3354:21;;3337:43;3387:121;3460:42;3449:54;;3432:76;3515:117;3584:24;3602:5;3584:24;;;3577:5;3574:35;3564:2;;3623:1;3620;3613:12;3564:2;3558:74;;3639:111;3705:21;3720:5;3705:21;",
"source": "/*\n\n Copyright 2019 dYdX Trading Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.5.7;\npragma experimental ABIEncoderV2;\n\nimport { Types } from \"./lib/Types.sol\";\n\nimport { HasState } from \"./HasState.sol\";\n\n\n/**\n * @title Permission\n * @author dYdX\n *\n * Public function that allows other addresses to manage accounts\n */\ncontract Permission is\n HasState\n{\n // ============ Events ============\n\n event LogOperatorSet(\n address indexed owner,\n address operator,\n bool trusted\n );\n\n // ============ Public Functions ============\n\n /**\n * Approves/disapproves any number of operators. An operator is an external address that has the\n * same permissions to manipulate an account as the owner of the account. Operators are simply\n * addresses and therefore may either be externally-owned Ethereum accounts OR smart contracts.\n *\n * Operators are also able to act as AutoTrader contracts on behalf of the account owner if the\n * operator is a smart contract and implements the IAutoTrader interface.\n *\n * @param args A list of OperatorArgs which have an address and a boolean. The boolean value\n * denotes whether to approve (true) or revoke approval (false) for that address.\n */\n function setOperators(\n Types.OperatorArg[] memory args\n )\n public\n {\n uint256 length = args.length;\n for (uint256 i; i < length; ++i) {\n address operator = args[i].operator;\n bool trusted = args[i].trusted;\n g_state.operators[msg.sender][operator] = trusted ? 1 : 2;\n emit LogOperatorSet(msg.sender, operator, trusted);\n }\n }\n}\n",
"sourcePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/Permission.sol",
"ast": {
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/Permission.sol",
"exportedSymbols": {
"Permission": [
18184
]
},
"id": 18185,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 18110,
"literals": [
"solidity",
"^",
"0.5",
".7"
],
"nodeType": "PragmaDirective",
"src": "603:23:67"
},
{
"id": 18111,
"literals": [
"experimental",
"ABIEncoderV2"
],
"nodeType": "PragmaDirective",
"src": "627:33:67"
},
{
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Types.sol",
"file": "./lib/Types.sol",
"id": 18113,
"nodeType": "ImportDirective",
"scope": 18185,
"sourceUnit": 31362,
"src": "662:40:67",
"symbolAliases": [
{
"foreign": 18112,
"local": null
}
],
"unitAlias": ""
},
{
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/HasState.sol",
"file": "./HasState.sol",
"id": 18115,
"nodeType": "ImportDirective",
"scope": 18185,
"sourceUnit": 18071,
"src": "704:42:67",
"symbolAliases": [
{
"foreign": 18114,
"local": null
}
],
"unitAlias": ""
},
{
"baseContracts": [
{
"arguments": null,
"baseName": {
"contractScope": null,
"id": 18116,
"name": "HasState",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 18070,
"src": "890:8:67",
"typeDescriptions": {
"typeIdentifier": "t_contract$_HasState_$18070",
"typeString": "contract HasState"
}
},
"id": 18117,
"nodeType": "InheritanceSpecifier",
"src": "890:8:67"
}
],
"contractDependencies": [
18070
],
"contractKind": "contract",
"documentation": "@title Permission\n@author dYdX\n * Public function that allows other addresses to manage accounts",
"fullyImplemented": true,
"id": 18184,
"linearizedBaseContracts": [
18184,
18070
],
"name": "Permission",
"nodeType": "ContractDefinition",
"nodes": [
{
"anonymous": false,
"documentation": null,
"id": 18125,
"name": "LogOperatorSet",
"nodeType": "EventDefinition",
"parameters": {
"id": 18124,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 18119,
"indexed": true,
"name": "owner",
"nodeType": "VariableDeclaration",
"scope": 18125,
"src": "976:21:67",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 18118,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "976:7:67",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 18121,
"indexed": false,
"name": "operator",
"nodeType": "VariableDeclaration",
"scope": 18125,
"src": "1007:16:67",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 18120,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1007:7:67",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 18123,
"indexed": false,
"name": "trusted",
"nodeType": "VariableDeclaration",
"scope": 18125,
"src": "1033:12:67",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 18122,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "1033:4:67",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "966:85:67"
},
"src": "946:106:67"
},
{
"body": {
"id": 18182,
"nodeType": "Block",
"src": "1904:326:67",
"statements": [
{
"assignments": [
18132
],
"declarations": [
{
"constant": false,
"id": 18132,
"name": "length",
"nodeType": "VariableDeclaration",
"scope": 18182,
"src": "1914:14:67",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 18131,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1914:7:67",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 18135,
"initialValue": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 18133,
"name": "args",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 18128,
"src": "1931:4:67",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_struct$_OperatorArg_$30865_memory_$dyn_memory_ptr",
"typeString": "struct Types.OperatorArg memory[] memory"
}
},
"id": 18134,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "length",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "1931:11:67",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1914:28:67"
},
{
"body": {
"id": 18180,
"nodeType": "Block",
"src": "1985:239:67",
"statements": [
{
"assignments": [
18146
],
"declarations": [
{
"constant": false,
"id": 18146,
"name": "operator",
"nodeType": "VariableDeclaration",
"scope": 18180,
"src": "1999:16:67",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 18145,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1999:7:67",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 18151,
"initialValue": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 18147,
"name": "args",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 18128,
"src": "2018:4:67",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_struct$_OperatorArg_$30865_memory_$dyn_memory_ptr",
"typeString": "struct Types.OperatorArg memory[] memory"
}
},
"id": 18149,
"indexExpression": {
"argumentTypes": null,
"id": 18148,
"name": "i",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 18137,
"src": "2023:1:67",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "2018:7:67",
"typeDescriptions": {
"typeIdentifier": "t_struct$_OperatorArg_$30865_memory",
"typeString": "struct Types.OperatorArg memory"
}
},
"id": 18150,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "operator",
"nodeType": "MemberAccess",
"referencedDeclaration": 30862,
"src": "2018:16:67",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1999:35:67"
},
{
"assignments": [
18153
],
"declarations": [
{
"constant": false,
"id": 18153,
"name": "trusted",
"nodeType": "VariableDeclaration",
"scope": 18180,
"src": "2048:12:67",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 18152,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "2048:4:67",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 18158,
"initialValue": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 18154,
"name": "args",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 18128,
"src": "2063:4:67",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_struct$_OperatorArg_$30865_memory_$dyn_memory_ptr",
"typeString": "struct Types.OperatorArg memory[] memory"
}
},
"id": 18156,
"indexExpression": {
"argumentTypes": null,
"id": 18155,
"name": "i",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 18137,
"src": "2068:1:67",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "2063:7:67",
"typeDescriptions": {
"typeIdentifier": "t_struct$_OperatorArg_$30865_memory",
"typeString": "struct Types.OperatorArg memory"
}
},
"id": 18157,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "trusted",
"nodeType": "MemberAccess",
"referencedDeclaration": 30864,
"src": "2063:15:67",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "2048:30:67"
},
{
"expression": {
"argumentTypes": null,
"id": 18171,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 18159,
"name": "g_state",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 18069,
"src": "2092:7:67",
"typeDescriptions": {
"typeIdentifier": "t_struct$_State_$28760_storage",
"typeString": "struct Storage.State storage ref"
}
},
"id": 18164,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "operators",
"nodeType": "MemberAccess",
"referencedDeclaration": 28747,
"src": "2092:17:67",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$",
"typeString": "mapping(address => mapping(address => uint256))"
}
},
"id": 18165,
"indexExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 18161,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 38107,
"src": "2110:3:67",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 18162,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "2110:10:67",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "2092:29:67",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
}
},
"id": 18166,
"indexExpression": {
"argumentTypes": null,
"id": 18163,
"name": "operator",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 18146,
"src": "2122:8:67",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "2092:39:67",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"condition": {
"argumentTypes": null,
"id": 18167,
"name": "trusted",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 18153,
"src": "2134:7:67",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseExpression": {
"argumentTypes": null,
"hexValue": "32",
"id": 18169,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2148:1:67",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_2_by_1",
"typeString": "int_const 2"
},
"value": "2"
},
"id": 18170,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "Conditional",
"src": "2134:15:67",
"trueExpression": {
"argumentTypes": null,
"hexValue": "31",
"id": 18168,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2144:1:67",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "1"
},
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
}
},
"src": "2092:57:67",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 18172,
"nodeType": "ExpressionStatement",
"src": "2092:57:67"
},
{
"eventCall": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 18174,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 38107,
"src": "2183:3:67",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 18175,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "2183:10:67",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"argumentTypes": null,
"id": 18176,
"name": "operator",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 18146,
"src": "2195:8:67",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 18177,
"name": "trusted",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 18153,
"src": "2205:7:67",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_bool",
"typeString": "bool"
}
],
"id": 18173,
"name": "LogOperatorSet",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 18125,
"src": "2168:14:67",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_bool_$returns$__$",
"typeString": "f