UNPKG

@dolomite-exchange/dolomite-margin

Version:

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

713 lines (712 loc) 119 kB
{ "contractName": "AuthorizationBase", "abi": [ { "inputs": [ { "internalType": "address", "name": "_dolomiteMargin", "type": "address" } ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, { "constant": true, "inputs": [], "name": "DOLOMITE_MARGIN", "outputs": [ { "internalType": "contract IDolomiteMargin", "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "internalType": "address", "name": "_caller", "type": "address" }, { "internalType": "bool", "name": "_isAuthorized", "type": "bool" } ], "name": "setIsCallerAuthorized", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [ { "internalType": "address", "name": "_caller", "type": "address" } ], "name": "isCallerAuthorized", "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\":\"address\",\"name\":\"_dolomiteMargin\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"constant\":true,\"inputs\":[],\"name\":\"DOLOMITE_MARGIN\",\"outputs\":[{\"internalType\":\"contract IDolomiteMargin\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_caller\",\"type\":\"address\"}],\"name\":\"isCallerAuthorized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_caller\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"_isAuthorized\",\"type\":\"bool\"}],\"name\":\"setIsCallerAuthorized\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/external/helpers/AuthorizationBase.sol\":\"AuthorizationBase\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/external/helpers/AuthorizationBase.sol\":{\"keccak256\":\"0x9e8714656c5aed3b5d613fba31aad7fe31aa29705b1aa5bcac1f6b212b981224\",\"urls\":[\"bzz-raw://f17b337718b8c9e11410fea50b39d167315c7e2fa9f49e3d7085a59ebee8b0ff\",\"dweb:/ipfs/Qmbbru5r6njELqeUJCifcnTvk63rT5rhnDCCr2iTLsjW1U\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IAuthorizationBase.sol\":{\"keccak256\":\"0x5f5f602ae759236163193b77c44ee72ef9de8f7824fd9b5aa77b187cbdbb8ef6\",\"urls\":[\"bzz-raw://309b4925df2804a2aa54ec193d10db4b88b7b61eb47d87e5bbb98b95adf71889\",\"dweb:/ipfs/QmdaJ1WJQiMo1sMhvpgmYZScVELoo8h5CTupXXSR2S5tsP\"]},\"/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/IDolomiteMargin.sol\":{\"keccak256\":\"0x7e86ed1ed04dc205245db9f4e7cf7cca60c3bfc46c57ade8129a463780647967\",\"urls\":[\"bzz-raw://f8fbd85afd334c12bdccbb6523ebea9172b27b7b4b132c4a48b4b4dd03ceeb2b\",\"dweb:/ipfs/QmU1srfSqBTz3kw7oz1KEzfTUJvphZiE4K8MRZcy9uJjv1\"]},\"/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/Actions.sol\":{\"keccak256\":\"0x7b2fcf441c034952dd042b6c8b20b148359db771e7c9ac07d06369560a9f0301\",\"urls\":[\"bzz-raw://84665ee4a780360fe6160d197ba98f0bf0ab0d7c6ad87bfed6226bf2f88d8d30\",\"dweb:/ipfs/QmRDfRdAd8hSXeu4SAeeYKkKoXBhStu7n4uReYBce2JD5Z\"]},\"/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": "0x608060405234801561001057600080fd5b5060405161096d38038061096d8339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b0319909216919091179055610908806100656000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806315c14a4a146100465780634929d08114610077578063f697ae99146100be575b600080fd5b61004e6100fb565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6100aa6004803603602081101561008d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610117565b604080519115158252519081900360200190f35b6100f9600480360360408110156100d457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001351515610146565b005b60005473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff165b919050565b600054604080517f052f72d700000000000000000000000000000000000000000000000000000000815233600482015290516102e09273ffffffffffffffffffffffffffffffffffffffff169163052f72d7916024808301926020929190829003018186803b1580156101b857600080fd5b505afa1580156101cc573d6000803e3d6000fd5b505050506040513d60208110156101e257600080fd5b5051806102985750600054604080517f8da5cb5b0000000000000000000000000000000000000000000000000000000081529051339273ffffffffffffffffffffffffffffffffffffffff1691638da5cb5b916004808301926020929190829003018186803b15801561025457600080fd5b505afa158015610268573d6000803e3d6000fd5b505050506040513d602081101561027e57600080fd5b505173ffffffffffffffffffffffffffffffffffffffff16145b7f417574686f72697a6174696f6e426173650000000000000000000000000000007f756e617574686f72697a6564000000000000000000000000000000000000000085610336565b73ffffffffffffffffffffffffffffffffffffffff91909116600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b83610684576103448361068a565b7f3a2000000000000000000000000000000000000000000000000000000000000061036e8461068a565b7f203c0000000000000000000000000000000000000000000000000000000000006103988561073a565b603e60f81b6040516020018087805190602001908083835b602083106103ed57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016103b0565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790527fffff0000000000000000000000000000000000000000000000000000000000008a16919093019081528751600290910192880191508083835b6020831061049c57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161045f565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790527fffff0000000000000000000000000000000000000000000000000000000000008816919093019081528551600290910192860191508083835b6020831061054b57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161050e565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790527fff0000000000000000000000000000000000000000000000000000000000000095909516920191825250604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe101815260018301918290527f08c379a000000000000000000000000000000000000000000000000000000000909152600582018481528151602584015281519199509750879650604590910194509187019250819050838360005b83811015610649578181015183820152602001610631565b50505050905090810190601f1680156106765780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50505050565b6040805160208082018490528251808303820181529183019092526060915b801561071f5781517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff909101908290829081106106e257fe5b01602001517fff00000000000000000000000000000000000000000000000000000000000000161561071a5760010181529050610141565b6106a9565b5060408051600080825260208201909252905b509392505050565b60408051602a808252606082810190935273ffffffffffffffffffffffffffffffffffffffff8416918391602082018180388339019050509050603060f81b8160008151811061078657fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350607860f81b816001815181106107c757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060005b60148110156107325760028102610812600f85166108b1565b83826029038151811061082157fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600484901c9350610863600f85166108b1565b83826028038151811061087257fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053505060049290921c916001016107f9565b6000600a8210156108c957506030810160f81b610141565b5060570160f81b9056fea265627a7a72315820566d76c8c7d39c5430c8bbe95c0c857df6f5d0affd977a459105045843e6e36864736f6c63430005100032", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c806315c14a4a146100465780634929d08114610077578063f697ae99146100be575b600080fd5b61004e6100fb565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6100aa6004803603602081101561008d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610117565b604080519115158252519081900360200190f35b6100f9600480360360408110156100d457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001351515610146565b005b60005473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff165b919050565b600054604080517f052f72d700000000000000000000000000000000000000000000000000000000815233600482015290516102e09273ffffffffffffffffffffffffffffffffffffffff169163052f72d7916024808301926020929190829003018186803b1580156101b857600080fd5b505afa1580156101cc573d6000803e3d6000fd5b505050506040513d60208110156101e257600080fd5b5051806102985750600054604080517f8da5cb5b0000000000000000000000000000000000000000000000000000000081529051339273ffffffffffffffffffffffffffffffffffffffff1691638da5cb5b916004808301926020929190829003018186803b15801561025457600080fd5b505afa158015610268573d6000803e3d6000fd5b505050506040513d602081101561027e57600080fd5b505173ffffffffffffffffffffffffffffffffffffffff16145b7f417574686f72697a6174696f6e426173650000000000000000000000000000007f756e617574686f72697a6564000000000000000000000000000000000000000085610336565b73ffffffffffffffffffffffffffffffffffffffff91909116600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b83610684576103448361068a565b7f3a2000000000000000000000000000000000000000000000000000000000000061036e8461068a565b7f203c0000000000000000000000000000000000000000000000000000000000006103988561073a565b603e60f81b6040516020018087805190602001908083835b602083106103ed57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016103b0565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790527fffff0000000000000000000000000000000000000000000000000000000000008a16919093019081528751600290910192880191508083835b6020831061049c57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161045f565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790527fffff0000000000000000000000000000000000000000000000000000000000008816919093019081528551600290910192860191508083835b6020831061054b57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161050e565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790527fff0000000000000000000000000000000000000000000000000000000000000095909516920191825250604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe101815260018301918290527f08c379a000000000000000000000000000000000000000000000000000000000909152600582018481528151602584015281519199509750879650604590910194509187019250819050838360005b83811015610649578181015183820152602001610631565b50505050905090810190601f1680156106765780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50505050565b6040805160208082018490528251808303820181529183019092526060915b801561071f5781517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff909101908290829081106106e257fe5b01602001517fff00000000000000000000000000000000000000000000000000000000000000161561071a5760010181529050610141565b6106a9565b5060408051600080825260208201909252905b509392505050565b60408051602a808252606082810190935273ffffffffffffffffffffffffffffffffffffffff8416918391602082018180388339019050509050603060f81b8160008151811061078657fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350607860f81b816001815181106107c757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060005b60148110156107325760028102610812600f85166108b1565b83826029038151811061082157fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600484901c9350610863600f85166108b1565b83826028038151811061087257fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053505060049290921c916001016107f9565b6000600a8210156108c957506030810160f81b610141565b5060570160f81b9056fea265627a7a72315820566d76c8c7d39c5430c8bbe95c0c857df6f5d0affd977a459105045843e6e36864736f6c63430005100032", "sourceMap": "837:1230:1:-;;;1455:133;8:9:-1;5:2;;;30:1;27;20:12;5:2;1455:133:1;;;;;;;;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;1455:133:1;1531:15;:50;;-1:-1:-1;;;;;1531:50:1;;;-1:-1:-1;;;;;;1531:50:1;;;;;;;;;837:1230;;;;;;", "deployedSourceMap": "837:1230:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;837:1230:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1045:38;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1939:126;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;1939:126:1;;;;:::i;:::-;;;;;;;;;;;;;;;;;;1594:339;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;1594:339:1;;;;;;;;;;;:::i;:::-;;1045:38;;;;;;:::o;1939:126::-;2030:28;;;2007:4;2030:28;;;:19;:28;;;;;;;;1939:126;;;;:::o;1594:339::-;1707:15;;:47;;;;;;1743:10;1707:47;;;;;;1681:191;;1707:15;;;:35;;:47;;;;;;;;;;;;;;:15;:47;;;5:2:-1;;;;30:1;27;20:12;5:2;1707:47:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1707:47:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;1707:47:1;;:88;;-1:-1:-1;1758:15:1;;:23;;;;;;;;1785:10;;1758:37;:15;;:21;;:23;;;;;;;;;;;;;;:15;:23;;;5:2:-1;;;;30:1;27;20:12;5:2;1758:23:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1758:23:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;1758:23:1;:37;;;1707:88;1809:4;1681:191;1855:7;1681:12;:191::i;:::-;1882:28;;;;;;;;;:19;:28;;;;;:44;;;;;;;;;;;;;1594:339::o;2962:561:99:-;3122:4;3117:400;;3236:24;3255:4;3236:18;:24::i;:::-;3286:5;3317:26;3336:6;3317:18;:26::i;:::-;3369:6;3401:19;3411:8;3401:9;:19::i;:::-;1182:4;3446:6;;3194:280;;;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;3194:280:99;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3194:280:99;;;36:153:-1;66:2;61:3;58:11;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;3194:280:99;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3194:280:99;;;36:153:-1;66:2;61:3;58:11;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;3194:280:99;;;;;;;;;;-1:-1:-1;3194:280:99;;;26:21:-1;;;22:32;;6:49;;274:1;3194:280:99;;;;;;3142:364;;;;;;;;;;;;;;;;;;3194:280;;-1:-1:-1;3142:364:99;-1:-1:-1;3142:364:99;;-1:-1:-1;3142:364:99;;;;;-1:-1:-1;3142:364:99;;;;-1:-1:-1;3142:364:99;;-1:-1:-1;3142:364:99;;-1:-1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;3142:364:99;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3117:400;2962:561;;;;:::o;6359:968::-;6560:23;;;;;;;;;;;;26:21:-1;;;22:32;;6:49;;6560:23:99;;;;;;6463:12;;6689:572;6710:6;;6689:572;;6962:9;;6864:3;;;;;6962:6;;6864:3;;6962:9;;;;;;;;;;;;:14;6958:293;;7017:1;7013:5;7143:22;;7150:6;-1:-1:-1;7223:13:99;;6958:293;6689:572;;;-1:-1:-1;7308:12:99;;;7318:1;7308:12;;;;;;;;;;;-1:-1:-1;7301:19:99;6359:968;-1:-1:-1;;;6359:968:99:o;8252:958::-;8524:13;;;8534:2;8524:13;;;8346:12;8524:13;;;;;;8386:14;;;;8346:12;;8524:13;;;21:6:-1;;104:10;8524:13:99;87:34:-1;135:17;;-1:-1;8524:13:99;8502:35;;902:2;8601:23;;8589:6;8596:1;8589:9;;;;;;;;;;;:35;;;;;;;;;;;1010:3;8646:27;;8634:6;8641:1;8634:9;;;;;;;;;;;:39;;;;;;;;;;;8787:9;8782:398;8802:2;8798:1;:6;8782:398;;;8891:1;8887:5;;8984:23;1232:3;8989:17;;8984:4;:23::i;:::-;8963:6;8975:5;8970:2;:10;8963:18;;;;;;;;;;;:44;;;;;;;;;;;9030:1;9025;:6;;9021:10;;9122:23;1232:3;9127:1;:17;9122:4;:23::i;:::-;9101:6;9113:5;9108:2;:10;9101:18;;;;;;;;;;;:44;;;;;;;;;;-1:-1:-1;;9168:1:99;9163:6;;;;;8806:3;;8782:398;;10178:325;10267:4;10335:2;10327:5;:10;10323:79;;;-1:-1:-1;902:2:99;10371:18;;10360:31;;10353:38;;10323:79;-1:-1:-1;956:2:99;10467:27;10456:40;;;10178:325::o", "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;\n\nimport { IDolomiteMargin } from \"../../protocol/interfaces/IDolomiteMargin.sol\";\nimport { Require } from \"../../protocol/lib/Require.sol\";\n\nimport { IAuthorizationBase } from \"../interfaces/IAuthorizationBase.sol\";\n\n\ncontract AuthorizationBase is IAuthorizationBase {\n\n // ============ Constants ============\n\n bytes32 private constant FILE = \"AuthorizationBase\";\n\n // ============ State Variables ============\n\n IDolomiteMargin public DOLOMITE_MARGIN;\n mapping(address => bool) private _isCallerAuthorized;\n\n // ============ Modifiers ============\n\n modifier requireIsCallerAuthorized(address _caller) {\n Require.that(\n _isCallerAuthorized[_caller],\n FILE,\n \"unauthorized\",\n _caller\n );\n _;\n }\n\n // ============ Constructor ============\n\n constructor(\n address _dolomiteMargin\n )\n public\n {\n DOLOMITE_MARGIN = IDolomiteMargin(_dolomiteMargin);\n }\n\n function setIsCallerAuthorized(address _caller, bool _isAuthorized) external {\n Require.that(\n DOLOMITE_MARGIN.getIsGlobalOperator(msg.sender) || DOLOMITE_MARGIN.owner() == msg.sender,\n FILE,\n \"unauthorized\",\n _caller\n );\n _isCallerAuthorized[_caller] = _isAuthorized;\n }\n\n function isCallerAuthorized(address _caller) external view returns (bool) {\n return _isCallerAuthorized[_caller];\n }\n}\n", "sourcePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/external/helpers/AuthorizationBase.sol", "ast": { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/external/helpers/AuthorizationBase.sol", "exportedSymbols": { "AuthorizationBase": [ 153 ] }, "id": 154, "nodeType": "SourceUnit", "nodes": [ { "id": 60, "literals": [ "solidity", "^", "0.5", ".7" ], "nodeType": "PragmaDirective", "src": "595:23:1" }, { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IDolomiteMargin.sol", "file": "../../protocol/interfaces/IDolomiteMargin.sol", "id": 62, "nodeType": "ImportDirective", "scope": 154, "sourceUnit": 24694, "src": "620:80:1", "symbolAliases": [ { "foreign": 61, "local": null } ], "unitAlias": "" }, { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Require.sol", "file": "../../protocol/lib/Require.sol", "id": 64, "nodeType": "ImportDirective", "scope": 154, "sourceUnit": 28453, "src": "701:57:1", "symbolAliases": [ { "foreign": 63, "local": null } ], "unitAlias": "" }, { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IAuthorizationBase.sol", "file": "../interfaces/IAuthorizationBase.sol", "id": 66, "nodeType": "ImportDirective", "scope": 154, "sourceUnit": 4000, "src": "760:74:1", "symbolAliases": [ { "foreign": 65, "local": null } ], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 67, "name": "IAuthorizationBase", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 3999, "src": "867:18:1", "typeDescriptions": { "typeIdentifier": "t_contract$_IAuthorizationBase_$3999", "typeString": "contract IAuthorizationBase" } }, "id": 68, "nodeType": "InheritanceSpecifier", "src": "867:18:1" } ], "contractDependencies": [ 3999 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 153, "linearizedBaseContracts": [ 153, 3999 ], "name": "AuthorizationBase", "nodeType": "ContractDefinition", "nodes": [ { "constant": true, "id": 71, "name": "FILE", "nodeType": "VariableDeclaration", "scope": 153, "src": "937:51:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 69, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "937:7:1", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": { "argumentTypes": null, "hexValue": "417574686f72697a6174696f6e42617365", "id": 70, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "969:19:1", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_c35edb2f02df840be8253033baa98de89c8bee22c996e060fefa171b8d50fc3a", "typeString": "literal_string \"AuthorizationBase\"" }, "value": "AuthorizationBase" }, "visibility": "private" }, { "constant": false, "id": 73, "name": "DOLOMITE_MARGIN", "nodeType": "VariableDeclaration", "scope": 153, "src": "1045:38:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IDolomiteMargin_$24693", "typeString": "contract IDolomiteMargin" }, "typeName": { "contractScope": null, "id": 72, "name": "IDolomiteMargin", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 24693, "src": "1045:15:1", "typeDescriptions": { "typeIdentifier": "t_contract$_IDolomiteMargin_$24693", "typeString": "contract IDolomiteMargin" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 77, "name": "_isCallerAuthorized", "nodeType": "VariableDeclaration", "scope": 153, "src": "1089:52:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", "typeString": "mapping(address => bool)" }, "typeName": { "id": 76, "keyType": { "id": 74, "name": "address", "nodeType": "ElementaryTypeName", "src": "1097:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "1089:24:1", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", "typeString": "mapping(address => bool)" }, "valueType": { "id": 75, "name": "bool", "nodeType": "ElementaryTypeName", "src": "1108:4:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } }, "value": null, "visibility": "private" }, { "body": { "id": 93, "nodeType": "Block", "src": "1244:159:1", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 84, "name": "_isCallerAuthorized", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 77, "src": "1280:19:1", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", "typeString": "mapping(address => bool)" } }, "id": 86, "indexExpression": { "argumentTypes": null, "id": 85, "name": "_caller", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 79, "src": "1300:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1280:28:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "id": 87, "name": "FILE", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 71, "src": "1322:4:1", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, { "argumentTypes": null, "hexValue": "756e617574686f72697a6564", "id": 88, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1340:14:1", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_926a1b84b861d31f2d45224162461e1d5ff4377725d977d8f792bb84825a0348", "typeString": "literal_string \"unauthorized\"" }, "value": "unauthorized" }, { "argumentTypes": null, "id": 89, "name": "_caller", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 79, "src": "1368:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, { "typeIdentifier": "t_stringliteral_926a1b84b861d31f2d45224162461e1d5ff4377725d977d8f792bb84825a0348", "typeString": "literal_string \"unauthorized\"" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "expression": { "argumentTypes": null, "id": 81, "name": "Require", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 28452, "src": "1254:7:1", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_Require_$28452_$", "typeString": "type(library Require)" } }, "id": 83, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "that", "nodeType": "MemberAccess", "referencedDeclaration": 27930, "src": "1254:12:1", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_bytes32_$_t_bytes32_$_t_address_$returns$__$", "typeString": "function (bool,bytes32,bytes32,address) pure" } }, "id": 90, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1254:131:1", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 91, "nodeType": "ExpressionStatement", "src": "1254:131:1" }, { "id": 92, "nodeType": "PlaceholderStatement", "src": "1395:1:1" } ] }, "documentation": null, "id": 94, "name": "requireIsCallerAuthorized", "nodeType": "ModifierDefinition", "parameters": { "id": 80, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 79, "name": "_caller", "nodeType": "VariableDeclaration", "scope": 94, "src": "1227:15:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 78, "name": "address", "nodeType": "ElementaryTypeName", "src": "1227:7:1", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1226:17:1" }, "src": "1192:211:1", "visibility": "internal" }, { "body": { "id": 105, "nodeType": "Block", "src": "1521:67:1", "statements": [ { "expression": { "argumentTypes": null, "id": 103, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 99, "name": "DOLOMITE_MARGIN", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 73, "src": "1531:15:1", "typeDescriptions": { "typeIdentifier": "t_contract$_IDolomiteMargin_$24693", "typeString": "contract IDolomiteMargin" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 101, "name": "_dolomiteMargin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 96, "src": "1565:15:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 100, "name": "IDolomiteMargin", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 24693, "src": "1549:15:1", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IDolomiteMargin_$24693_$", "typeString": "type(contract IDolomiteMargin)" } }, "id": 102, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1549:32:1", "typeDescriptions": { "typeIdentifier": "t_contract$_IDolomiteMargin_$24693", "typeString": "contract IDolomiteMargin" } }, "src": "1531:50:1", "typeDescriptions": { "typeIdentifier": "t_contract$_IDolomiteMargin_$24693", "typeString": "contract IDolomiteMargin" } }, "id": 104, "nodeType": "ExpressionStatement", "src": "1531:50:1" } ] }, "documentation": null, "id": 106, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 97, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 96, "name": "_dolomiteMargin", "nodeType": "VariableDeclaration", "scope": 106, "src": "1476:23:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 95, "name": "address", "nodeType": "ElementaryTypeName", "src": "1476:7:1", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1466:39:1" }, "returnParameters": { "id": 98, "nodeType": "ParameterList", "parameters": [], "src": "1521:0:1" }, "scope": 153, "src": "1455:133:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 139, "nodeType": "Block", "src": "1671:262:1", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bool", "typeString": "bool" }, "id": 127, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 118, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 38107, "src": "1743:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 119, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1743:10:1", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address_payable", "typeString": "address payable" } ], "expression": { "argumentTypes": null,