UNPKG

@dolomite-exchange/dolomite-margin

Version:

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

910 lines 101 kB
{ "contractName": "TestAccountRiskOverrideSetter", "abi": [ { "constant": true, "inputs": [ { "internalType": "address", "name": "", "type": "address" }, { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "g_liquidationSpreadOverrides", "outputs": [ { "internalType": "uint256", "name": "value", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "internalType": "address", "name": "", "type": "address" }, { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "g_marginRatioOverrides", "outputs": [ { "internalType": "uint256", "name": "value", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "components": [ { "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "uint256", "name": "number", "type": "uint256" } ], "internalType": "struct Account.Info", "name": "_account", "type": "tuple" }, { "components": [ { "internalType": "uint256", "name": "value", "type": "uint256" } ], "internalType": "struct Decimal.D256", "name": "_marginRatioOverride", "type": "tuple" }, { "components": [ { "internalType": "uint256", "name": "value", "type": "uint256" } ], "internalType": "struct Decimal.D256", "name": "_liquidationSpreadOverride", "type": "tuple" } ], "name": "setAccountRiskOverride", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [ { "components": [ { "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "uint256", "name": "number", "type": "uint256" } ], "internalType": "struct Account.Info", "name": "_account", "type": "tuple" } ], "name": "getAccountRiskOverride", "outputs": [ { "components": [ { "internalType": "uint256", "name": "value", "type": "uint256" } ], "internalType": "struct Decimal.D256", "name": "marginRatioOverride", "type": "tuple" }, { "components": [ { "internalType": "uint256", "name": "value", "type": "uint256" } ], "internalType": "struct Decimal.D256", "name": "liquidationSpreadOverride", "type": "tuple" } ], "payable": false, "stateMutability": "view", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"g_liquidationSpreadOverrides\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"g_marginRatioOverrides\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"number\",\"type\":\"uint256\"}],\"internalType\":\"struct Account.Info\",\"name\":\"_account\",\"type\":\"tuple\"}],\"name\":\"getAccountRiskOverride\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"internalType\":\"struct Decimal.D256\",\"name\":\"marginRatioOverride\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"internalType\":\"struct Decimal.D256\",\"name\":\"liquidationSpreadOverride\",\"type\":\"tuple\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"number\",\"type\":\"uint256\"}],\"internalType\":\"struct Account.Info\",\"name\":\"_account\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"internalType\":\"struct Decimal.D256\",\"name\":\"_marginRatioOverride\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"internalType\":\"struct Decimal.D256\",\"name\":\"_liquidationSpreadOverride\",\"type\":\"tuple\"}],\"name\":\"setAccountRiskOverride\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Dolomite * Account risk override for testing\",\"methods\":{},\"title\":\"TestAccountRiskOverrideSetter\"},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/testing/TestAccountRiskOverrideSetter.sol\":\"TestAccountRiskOverrideSetter\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"/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/lib/Account.sol\":{\"keccak256\":\"0x2059276ea5e478bd5ac7f2712e7b1b6c85d291c647a54b264909044844828e67\",\"urls\":[\"bzz-raw://f153777051d12131b13a57e5c3af10a2670927cfc7d22c9519ab20c9b4b9bc89\",\"dweb:/ipfs/QmQMP3qS5xDAVGYKDfNkbkSqBKozQGQsGqX4e8VyjRtxPS\"]},\"/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/Require.sol\":{\"keccak256\":\"0x05a2a90b41b6a5f42f0a72da63d015fb0b406a9ba2172823352e522e8bf3a606\",\"urls\":[\"bzz-raw://19883f0c6d33266f756ec5c3d17539524aa24b993c46c33f8400801d09373a6c\",\"dweb:/ipfs/QmYX2fwK3vQQDSZLMrc5wMfeb8RWrcC9CGX8XECLty8QDk\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Types.sol\":{\"keccak256\":\"0xe1bab8c8799d83e86c7a49aaf815d8e3bc8d09562d46d44d921500db5e98de0e\",\"urls\":[\"bzz-raw://8ea3d0cc4fdab6dd9bba545a792170f939b342d8d1a7051c1c6365009af72658\",\"dweb:/ipfs/QmaLJgbavu88eEit6JPqfWnw6NmGBDZfveMXxumgWywBFG\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/testing/TestAccountRiskOverrideSetter.sol\":{\"keccak256\":\"0x2be568ca93c8faa4e78f02c637b94473a599559f3ef9a96007afc8c0d599febd\",\"urls\":[\"bzz-raw://d632a20a998b2e35a721eadd8fcd629d97a7fa4d2856f0d6b52f8f91df7ef1ef\",\"dweb:/ipfs/QmfVyoRh4kb1TXf6bfCNKjqdovNVMtYDjM4Whp2XmpqDix\"]},\"@openzeppelin/contracts/math/SafeMath.sol\":{\"keccak256\":\"0x640b6dee7a4b830bdfd52b5031a07fc2b12209f5b2e29e5d364a7d37f69d8076\",\"urls\":[\"bzz-raw://31113152e1ddb78fe7a4197f247591ca894e93f916867beb708d8e747b6cc74f\",\"dweb:/ipfs/QmbZaJyXdpsYGykVhHH9qpVGQg9DGCxE2QufbCUy3daTgq\"]}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b50610426806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80633734f3a114610051578063526f00d01461007a5780639e279dcc1461008d578063ca235420146100a2575b600080fd5b61006461005f366004610278565b6100c3565b604051610071919061036d565b60405180910390f35b610064610088366004610278565b6100e0565b6100a061009b3660046102d8565b6100fa565b005b6100b56100b03660046102b2565b610153565b60405161007192919061034b565b600160209081526000928352604080842090915290825290205481565b600060208181529281526040808220909352908152205481565b825173ffffffffffffffffffffffffffffffffffffffff90811660009081526020818152604080832082880180518552908352818420965190965595519092168152600182528481209351815292905291902090519055565b61015b6101cf565b6101636101cf565b5050805173ffffffffffffffffffffffffffffffffffffffff908116600090815260208181526040808320828601805185529083528184208651909516845260018352818420905184528252918290208251808301845293548452825191820190925290548152915091565b6040518060200160405280600081525090565b80356101ed816103c3565b92915050565b60006020828403121561020557600080fd5b61020f602061037b565b9050600061021d848461026d565b82525092915050565b60006040828403121561023857600080fd5b610242604061037b565b9050600061025084846101e2565b82525060206102618484830161026d565b60208301525092915050565b80356101ed816103da565b6000806040838503121561028b57600080fd5b600061029785856101e2565b92505060206102a88582860161026d565b9150509250929050565b6000604082840312156102c457600080fd5b60006102d08484610226565b949350505050565b6000806000608084860312156102ed57600080fd5b60006102f98686610226565b935050604061030a868287016101f3565b925050606061031b868287016101f3565b9150509250925092565b80516020830190610336848261033c565b50505050565b610345816103c0565b82525050565b604081016103598285610325565b6103666020830184610325565b9392505050565b602081016101ed828461033c565b60405181810167ffffffffffffffff8111828210171561039a57600080fd5b604052919050565b600073ffffffffffffffffffffffffffffffffffffffff82166101ed565b90565b6103cc816103a2565b81146103d757600080fd5b50565b6103cc816103c056fea365627a7a72315820993e20c437e3209d6234cde8f35553006093488f2588c53df0530645456e08866c6578706572696d656e74616cf564736f6c63430005100040", "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c80633734f3a114610051578063526f00d01461007a5780639e279dcc1461008d578063ca235420146100a2575b600080fd5b61006461005f366004610278565b6100c3565b604051610071919061036d565b60405180910390f35b610064610088366004610278565b6100e0565b6100a061009b3660046102d8565b6100fa565b005b6100b56100b03660046102b2565b610153565b60405161007192919061034b565b600160209081526000928352604080842090915290825290205481565b600060208181529281526040808220909352908152205481565b825173ffffffffffffffffffffffffffffffffffffffff90811660009081526020818152604080832082880180518552908352818420965190965595519092168152600182528481209351815292905291902090519055565b61015b6101cf565b6101636101cf565b5050805173ffffffffffffffffffffffffffffffffffffffff908116600090815260208181526040808320828601805185529083528184208651909516845260018352818420905184528252918290208251808301845293548452825191820190925290548152915091565b6040518060200160405280600081525090565b80356101ed816103c3565b92915050565b60006020828403121561020557600080fd5b61020f602061037b565b9050600061021d848461026d565b82525092915050565b60006040828403121561023857600080fd5b610242604061037b565b9050600061025084846101e2565b82525060206102618484830161026d565b60208301525092915050565b80356101ed816103da565b6000806040838503121561028b57600080fd5b600061029785856101e2565b92505060206102a88582860161026d565b9150509250929050565b6000604082840312156102c457600080fd5b60006102d08484610226565b949350505050565b6000806000608084860312156102ed57600080fd5b60006102f98686610226565b935050604061030a868287016101f3565b925050606061031b868287016101f3565b9150509250925092565b80516020830190610336848261033c565b50505050565b610345816103c0565b82525050565b604081016103598285610325565b6103666020830184610325565b9392505050565b602081016101ed828461033c565b60405181810167ffffffffffffffff8111828210171561039a57600080fd5b604052919050565b600073ffffffffffffffffffffffffffffffffffffffff82166101ed565b90565b6103cc816103a2565b81146103d757600080fd5b50565b6103cc816103c056fea365627a7a72315820993e20c437e3209d6234cde8f35553006093488f2588c53df0530645456e08866c6578706572696d656e74616cf564736f6c63430005100040", "sourceMap": "975:1098:110:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;975:1098:110;;;;;;;", "deployedSourceMap": "975:1098:110:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;975:1098:110;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1140:89;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;1051:83;;;;;;;;;:::i;1236:396::-;;;;;;;;;:::i;:::-;;1638:433;;;;;;;;;:::i;:::-;;;;;;;;;1140:89;;;;;;;;;;;;;;;;;;;;;;;;:::o;1051:83::-;;;;;;;;;;;;;;;;;;;;;;:::o;1236:396::-;1470:14;;1447:38;;;;:22;:38;;;;;;;;;;;1486:15;;;;;1447:55;;;;;;;;:78;;;;;1564:14;;1535:44;;;;;:28;:44;;;;;1580:15;;1535:61;;;;;;;;:90;;;;1236:396::o;1638:433::-;1780:39;;:::i;:::-;1833:45;;:::i;:::-;-1:-1:-1;;1947:14:110;;1924:38;;;;:22;:38;;;;;;;;;;;1963:15;;;;;1924:55;;;;;;;;2022:14;;1993:44;;;;;:28;:44;;;;;2038:15;;1993:61;;;;;;;;1903:161;;;;;;;;;;;;;;;;;;;;;;;1638:433;;;:::o;975:1098::-;;;;;;;;;;;;;;:::o;5:130:-1:-;72:20;;97:33;72:20;97:33;;;57:78;;;;;168:322;;280:4;268:9;263:3;259:19;255:30;252:2;;;298:1;295;288:12;252:2;316:20;331:4;316:20;;;307:29;-1:-1;387:1;419:49;464:3;444:9;419:49;;;394:75;;-1:-1;405:5;246:244;-1:-1;;246:244;523:468;;635:4;623:9;618:3;614:19;610:30;607:2;;;653:1;650;643:12;607:2;671:20;686:4;671:20;;;662:29;-1:-1;742:1;774:49;819:3;799:9;774:49;;;749:75;;-1:-1;887:2;920:49;965:3;941:22;;;920:49;;;913:4;906:5;902:16;895:75;845:136;601:390;;;;;998:130;1065:20;;1090:33;1065:20;1090:33;;1135:366;;;1256:2;1244:9;1235:7;1231:23;1227:32;1224:2;;;1272:1;1269;1262:12;1224:2;1307:1;1324:53;1369:7;1349:9;1324:53;;;1314:63;;1286:97;1414:2;1432:53;1477:7;1468:6;1457:9;1453:22;1432:53;;;1422:63;;1393:98;1218:283;;;;;;1508:287;;1635:2;1623:9;1614:7;1610:23;1606:32;1603:2;;;1651:1;1648;1641:12;1603:2;1686:1;1703:76;1771:7;1751:9;1703:76;;;1693:86;1597:198;-1:-1;;;;1597:198;1802:630;;;;2009:3;1997:9;1988:7;1984:23;1980:33;1977:2;;;2026:1;2023;2016:12;1977:2;2061:1;2078:76;2146:7;2126:9;2078:76;;;2068:86;;2040:120;2191:2;2209:76;2277:7;2268:6;2257:9;2253:22;2209:76;;;2199:86;;2170:121;2322:2;2340:76;2408:7;2399:6;2388:9;2384:22;2340:76;;;2330:86;;2301:121;1971:461;;;;;;2488:319;2694:23;;2627:4;2618:14;;;2723:63;2622:3;2694:23;2723:63;;;2647:145;2600:207;;;;2814:103;2887:24;2905:5;2887:24;;;2882:3;2875:37;2869:48;;;3044:508;3282:2;3267:18;;3296:117;3271:9;3386:6;3296:117;;;3424:118;3538:2;3527:9;3523:18;3514:6;3424:118;;;3253:299;;;;;;3559:213;3677:2;3662:18;;3691:71;3666:9;3735:6;3691:71;;3779:256;3841:2;3835:9;3867:17;;;3942:18;3927:34;;3963:22;;;3924:62;3921:2;;;3999:1;3996;3989:12;3921:2;4015;4008:22;3819:216;;-1:-1;3819:216;4042:91;;4213:42;4202:54;;4104:24;4185:76;4268:72;4330:5;4313:27;4347:117;4416:24;4434:5;4416:24;;;4409:5;4406:35;4396:2;;4455:1;4452;4445:12;4396:2;4390:74;;4471:117;4540:24;4558:5;4540:24;", "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 { IAccountRiskOverrideSetter } from \"../protocol/interfaces/IAccountRiskOverrideSetter.sol\";\n\nimport { Account } from \"../protocol/lib/Account.sol\";\nimport { Decimal } from \"../protocol/lib/Decimal.sol\";\n\n\n/**\n * @title TestAccountRiskOverrideSetter\n * @author Dolomite\n *\n * Account risk override for testing\n */\ncontract TestAccountRiskOverrideSetter is IAccountRiskOverrideSetter {\n\n mapping (address => mapping(uint256 => Decimal.D256)) public g_marginRatioOverrides;\n mapping (address => mapping(uint256 => Decimal.D256)) public g_liquidationSpreadOverrides;\n\n function setAccountRiskOverride(\n Account.Info memory _account,\n Decimal.D256 memory _marginRatioOverride,\n Decimal.D256 memory _liquidationSpreadOverride\n )\n public\n {\n g_marginRatioOverrides[_account.owner][_account.number] = _marginRatioOverride;\n g_liquidationSpreadOverrides[_account.owner][_account.number] = _liquidationSpreadOverride;\n }\n\n function getAccountRiskOverride(\n Account.Info memory _account\n )\n public\n view\n returns\n (\n Decimal.D256 memory marginRatioOverride,\n Decimal.D256 memory liquidationSpreadOverride\n )\n {\n return (\n g_marginRatioOverrides[_account.owner][_account.number],\n g_liquidationSpreadOverrides[_account.owner][_account.number]\n );\n }\n}\n", "sourcePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/testing/TestAccountRiskOverrideSetter.sol", "ast": { "absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/testing/TestAccountRiskOverrideSetter.sol", "exportedSymbols": { "TestAccountRiskOverrideSetter": [ 32294 ] }, "id": 32295, "nodeType": "SourceUnit", "nodes": [ { "id": 32216, "literals": [ "solidity", "^", "0.5", ".7" ], "nodeType": "PragmaDirective", "src": "595:23:110" }, { "id": 32217, "literals": [ "experimental", "ABIEncoderV2" ], "nodeType": "PragmaDirective", "src": "619:33:110" }, { "absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/interfaces/IAccountRiskOverrideSetter.sol", "file": "../protocol/interfaces/IAccountRiskOverrideSetter.sol", "id": 32219, "nodeType": "ImportDirective", "scope": 32295, "sourceUnit": 24030, "src": "654:99:110", "symbolAliases": [ { "foreign": 32218, "local": null } ], "unitAlias": "" }, { "absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Account.sol", "file": "../protocol/lib/Account.sol", "id": 32221, "nodeType": "ImportDirective", "scope": 32295, "sourceUnit": 24886, "src": "755:54:110", "symbolAliases": [ { "foreign": 32220, "local": null } ], "unitAlias": "" }, { "absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Decimal.sol", "file": "../protocol/lib/Decimal.sol", "id": 32223, "nodeType": "ImportDirective", "scope": 32295, "sourceUnit": 26024, "src": "810:54:110", "symbolAliases": [ { "foreign": 32222, "local": null } ], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 32224, "name": "IAccountRiskOverrideSetter", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 24029, "src": "1017:26:110", "typeDescriptions": { "typeIdentifier": "t_contract$_IAccountRiskOverrideSetter_$24029", "typeString": "contract IAccountRiskOverrideSetter" } }, "id": 32225, "nodeType": "InheritanceSpecifier", "src": "1017:26:110" } ], "contractDependencies": [ 24029 ], "contractKind": "contract", "documentation": "@title TestAccountRiskOverrideSetter\n@author Dolomite\n * Account risk override for testing", "fullyImplemented": true, "id": 32294, "linearizedBaseContracts": [ 32294, 24029 ], "name": "TestAccountRiskOverrideSetter", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 32231, "name": "g_marginRatioOverrides", "nodeType": "VariableDeclaration", "scope": 32294, "src": "1051:83:110", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_uint256_$_t_struct$_D256_$25950_storage_$_$", "typeString": "mapping(address => mapping(uint256 => struct Decimal.D256))" }, "typeName": { "id": 32230, "keyType": { "id": 32226, "name": "address", "nodeType": "ElementaryTypeName", "src": "1060:7:110", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "1051:53:110", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_uint256_$_t_struct$_D256_$25950_storage_$_$", "typeString": "mapping(address => mapping(uint256 => struct Decimal.D256))" }, "valueType": { "id": 32229, "keyType": { "id": 32227, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1079:7:110", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Mapping", "src": "1071:32:110", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_D256_$25950_storage_$", "typeString": "mapping(uint256 => struct Decimal.D256)" }, "valueType": { "contractScope": null, "id": 32228, "name": "Decimal.D256", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 25950, "src": "1090:12:110", "typeDescriptions": { "typeIdentifier": "t_struct$_D256_$25950_storage_ptr", "typeString": "struct Decimal.D256" } } } }, "value": null, "visibility": "public" }, { "constant": false, "id": 32237, "name": "g_liquidationSpreadOverrides", "nodeType": "VariableDeclaration", "scope": 32294, "src": "1140:89:110", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_uint256_$_t_struct$_D256_$25950_storage_$_$", "typeString": "mapping(address => mapping(uint256 => struct Decimal.D256))" }, "typeName": { "id": 32236, "keyType": { "id": 32232, "name": "address", "nodeType": "ElementaryTypeName", "src": "1149:7:110", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "1140:53:110", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_uint256_$_t_struct$_D256_$25950_storage_$_$", "typeString": "mapping(address => mapping(uint256 => struct Decimal.D256))" }, "valueType": { "id": 32235, "keyType": { "id": 32233, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1168:7:110", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Mapping", "src": "1160:32:110", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_D256_$25950_storage_$", "typeString": "mapping(uint256 => struct Decimal.D256)" }, "valueType": { "contractScope": null, "id": 32234, "name": "Decimal.D256", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 25950, "src": "1179:12:110", "typeDescriptions": { "typeIdentifier": "t_struct$_D256_$25950_storage_ptr", "typeString": "struct Decimal.D256" } } } }, "value": null, "visibility": "public" }, { "body": { "id": 32266, "nodeType": "Block", "src": "1437:195:110", "statements": [ { "expression": { "argumentTypes": null, "id": 32254, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 32246, "name": "g_marginRatioOverrides", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 32231, "src": "1447:22:110", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_uint256_$_t_struct$_D256_$25950_storage_$_$", "typeString": "mapping(address => mapping(uint256 => struct Decimal.D256 storage ref))" } }, "id": 32251, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 32247, "name": "_account", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 32239, "src": "1470:8:110", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_memory_ptr", "typeString": "struct Account.Info memory" } }, "id": 32248, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "owner", "nodeType": "MemberAccess", "referencedDeclaration": 24848, "src": "1470:14:110", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1447:38:110", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_D256_$25950_storage_$", "typeString": "mapping(uint256 => struct Decimal.D256 storage ref)" } }, "id": 32252, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 32249, "name": "_account", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 32239, "src": "1486:8:110", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_memory_ptr", "typeString": "struct Account.Info memory" } }, "id": 32250, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "number", "nodeType": "MemberAccess", "referencedDeclaration": 24850, "src": "1486:15:110", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "1447:55:110", "typeDescriptions": { "typeIdentifier": "t_struct$_D256_$25950_storage", "typeString": "struct Decimal.D256 storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 32253, "name": "_marginRatioOverride", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 32241, "src": "1505:20:110", "typeDescriptions": { "typeIdentifier": "t_struct$_D256_$25950_memory_ptr", "typeString": "struct Decimal.D256 memory" } }, "src": "1447:78:110", "typeDescriptions": { "typeIdentifier": "t_struct$_D256_$25950_storage", "typeString": "struct Decimal.D256 storage ref" } }, "id": 32255, "nodeType": "ExpressionStatement", "src": "1447:78:110" }, { "expression": { "argumentTypes": null, "id": 32264, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 32256, "name": "g_liquidationSpreadOverrides", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 32237, "src": "1535:28:110", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_uint256_$_t_struct$_D256_$25950_storage_$_$", "typeString": "mapping(address => mapping(uint256 => struct Decimal.D256 storage ref))" } }, "id": 32261, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 32257, "name": "_account", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 32239, "src": "1564:8:110", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_memory_ptr", "typeString": "struct Account.Info memory" } }, "id": 32258, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "owner", "nodeType": "MemberAccess", "referencedDeclaration": 24848, "src": "1564:14:110", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1535:44:110", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_D256_$25950_storage_$", "typeString": "mapping(uint256 => struct Decimal.D256 storage ref)" } }, "id": 32262, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 32259, "name": "_account", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 32239, "src": "1580:8:110", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_memory_ptr", "typeString": "struct Account.Info memory" } }, "id": 32260, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "number", "nodeType": "MemberAccess", "referencedDeclaration": 24850, "src": "1580:15:110", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "1535:61:110", "typeDescriptions": { "typeIdentifier": "t_struct$_D256_$25950_storage", "typeString": "struct Decimal.D256 storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 32263, "name": "_liquidationSpreadOverride", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 32243, "src": "1599:26:110", "typeDescriptions": { "typeIdentifier": "t_struct$_D256_$25950_memory_ptr", "typeString": "struct Decimal.D256 memory" } }, "src": "1535:90:110", "typeDescriptions": { "typeIdentifier": "t_struct$_D256_$25950_storage", "typeString": "struct Decimal.D256 storage ref" } }, "id": 32265, "nodeType": "ExpressionStatement", "src": "1535:90:110" } ] }, "documentation": null, "id": 32267, "implemented": true, "kind": "function", "modifiers": [], "name": "setAccountRiskOverride", "nodeType": "FunctionDefinition", "parameters": { "id": 32244, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 32239, "name": "_account", "nodeType": "VariableDeclaration", "scope": 32267, "src": "1277:28:110", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_memory_ptr", "typeString": "struct Account.Info" }, "typeName": { "contractScope": null, "id": 32238, "name": "Account.Info", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 24851, "src": "1277:12:110", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_storage_ptr", "typeString": "struct Account.Info" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 32241, "name": "_marginRatioOverride", "nodeType": "VariableDeclaration", "scope": 32267, "src": "1315:40:110", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_struct$_D256_$25950_memory_ptr", "typeString": "struct Decimal.D256" }, "typeName": { "contractScope": null, "id": 32240, "name": "Decimal.D256", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 25950, "src": "1315:12:110", "typeDescriptions": { "typeIdentifier": "t_struct$_D256_$25950_storage_ptr", "typeString": "struct Decimal.D256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 32243, "name": "_liquidationSpreadOverride", "nodeType": "VariableDeclaration", "scope": 32267, "src": "1365:46:110", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_struct$_D256_$25950_memory_ptr", "typeString": "struct Decimal.D256" }, "typeName": { "contractScope": null, "id": 32242, "name": "Decimal.D256", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 25950, "src": "1365:12:110", "typeDescriptions": { "typeIdentifier": "t_struct$_D256_$25950_storage_ptr", "typeString": "struct Decimal.D256" } }, "value": null, "visibility": "internal" } ], "src": "1267:150:110" }, "returnParameters": { "id": 32245, "nodeType": "ParameterList", "parameters": [], "src": "1437:0:110" }, "scope": 32294, "src": "1236:396:110", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 32292, "nodeType": "Block", "src": "1893:178:110", "statements": [ { "expression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 32276, "name": "g_marginRatioOverrides", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 32231, "src": "1924:22:110", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_uint256_$_t_struct$_D256_$25950_storage_$_$", "typeString": "mapping(address => mapping(uint256 => struct Decimal.D256 storage ref))" } }, "id": 32279, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 32277, "name": "_account", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 32269, "src": "1947:8:110", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_memory_ptr", "typeString": "struct Account.Info memory" } }, "id": 32278, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "owner", "nodeType": "MemberAccess", "referencedDeclaration": 24848, "src": "1947:14:110", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1924:38:110", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_D256_$25950_storage_$", "typeString": "mapping(uint256 => struct Decimal.D256 storage ref)" } }, "id": 32282, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 32280, "name": "_account", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 32269, "src": "1963:8:110", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_memory_ptr", "typeString": "struct Account.Info memory" } }, "id": 32281, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "number", "nodeType": "MemberAccess", "referencedDeclaration": 24850, "src": "1963:15:110", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1924:55:110", "typeDescriptions": { "typeIdentifier": "t_struct$_D256_$25950_storage", "typeString": "struct Decimal.D256 storage ref" } }, { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 32283, "name": "g_liquidationSpreadOverri