@dolomite-exchange/dolomite-margin
Version:
Ethereum Smart Contracts and TypeScript library used for the DolomiteMargin trading protocol
724 lines • 102 kB
JSON
{
"contractName": "IBorrowPositionProxyV2",
"abi": [
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "_fromAccountOwner",
"type": "address"
},
{
"internalType": "uint256",
"name": "_fromAccountNumber",
"type": "uint256"
},
{
"internalType": "address",
"name": "_toAccountOwner",
"type": "address"
},
{
"internalType": "uint256",
"name": "_toAccountNumber",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_collateralMarketId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_amountWei",
"type": "uint256"
},
{
"internalType": "enum AccountBalanceLib.BalanceCheckFlag",
"name": "_balanceCheckFlag",
"type": "uint8"
}
],
"name": "openBorrowPositionWithDifferentAccounts",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "_borrowAccountOwner",
"type": "address"
},
{
"internalType": "uint256",
"name": "_borrowAccountNumber",
"type": "uint256"
},
{
"internalType": "address",
"name": "_toAccountOwner",
"type": "address"
},
{
"internalType": "uint256",
"name": "_toAccountNumber",
"type": "uint256"
},
{
"internalType": "uint256[]",
"name": "_collateralMarketIds",
"type": "uint256[]"
}
],
"name": "closeBorrowPositionWithDifferentAccounts",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "_fromAccountOwner",
"type": "address"
},
{
"internalType": "uint256",
"name": "_fromAccountNumber",
"type": "uint256"
},
{
"internalType": "address",
"name": "_toAccountOwner",
"type": "address"
},
{
"internalType": "uint256",
"name": "_toAccountNumber",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_marketId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_amountWei",
"type": "uint256"
},
{
"internalType": "enum AccountBalanceLib.BalanceCheckFlag",
"name": "_balanceCheckFlag",
"type": "uint8"
}
],
"name": "transferBetweenAccountsWithDifferentAccounts",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "_fromAccountOwner",
"type": "address"
},
{
"internalType": "uint256",
"name": "_fromAccountNumber",
"type": "uint256"
},
{
"internalType": "address",
"name": "_borrowAccountOwner",
"type": "address"
},
{
"internalType": "uint256",
"name": "_borrowAccountNumber",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_marketId",
"type": "uint256"
},
{
"internalType": "enum AccountBalanceLib.BalanceCheckFlag",
"name": "_balanceCheckFlag",
"type": "uint8"
}
],
"name": "repayAllForBorrowPositionWithDifferentAccounts",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
],
"metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_borrowAccountOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_borrowAccountNumber\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_toAccountOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAccountNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"_collateralMarketIds\",\"type\":\"uint256[]\"}],\"name\":\"closeBorrowPositionWithDifferentAccounts\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromAccountOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromAccountNumber\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_toAccountOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAccountNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_collateralMarketId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_amountWei\",\"type\":\"uint256\"},{\"internalType\":\"enum AccountBalanceLib.BalanceCheckFlag\",\"name\":\"_balanceCheckFlag\",\"type\":\"uint8\"}],\"name\":\"openBorrowPositionWithDifferentAccounts\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromAccountOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromAccountNumber\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_borrowAccountOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_borrowAccountNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_marketId\",\"type\":\"uint256\"},{\"internalType\":\"enum AccountBalanceLib.BalanceCheckFlag\",\"name\":\"_balanceCheckFlag\",\"type\":\"uint8\"}],\"name\":\"repayAllForBorrowPositionWithDifferentAccounts\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromAccountOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromAccountNumber\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_toAccountOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_toAccountNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_marketId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_amountWei\",\"type\":\"uint256\"},{\"internalType\":\"enum AccountBalanceLib.BalanceCheckFlag\",\"name\":\"_balanceCheckFlag\",\"type\":\"uint8\"}],\"name\":\"transferBetweenAccountsWithDifferentAccounts\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Dolomite\",\"methods\":{\"closeBorrowPositionWithDifferentAccounts(address,uint256,address,uint256,uint256[])\":{\"params\":{\"_borrowAccountNumber\":\"The index from which `msg.sender` collateral will be withdrawn\",\"_borrowAccountOwner\":\"The account from which collateral will be withdrawn\",\"_collateralMarketIds\":\"The IDs of the markets being withdrawn, to close the position\",\"_toAccountNumber\":\"The index into which `_borrowAccountOwner` will be depositing leftover collateral\",\"_toAccountOwner\":\"The account into which `_borrowAccountOwner` will be depositing leftover collateral\"}},\"openBorrowPositionWithDifferentAccounts(address,uint256,address,uint256,uint256,uint256,uint8)\":{\"params\":{\"_amountWei\":\"The amount, in Wei, to deposit\",\"_balanceCheckFlag\":\"Flag used to check if `_fromAccountNumber`, `_toAccountNumber`, or both accounts can go negative after the transfer settles. Setting the flag to `AccountBalanceLib.BalanceCheckFlag.None=3` results in neither account being checked.\",\"_collateralMarketId\":\"The ID of the market being deposited\",\"_fromAccountNumber\":\"The index from which `_toAccountOwner` will be sourcing the deposit\",\"_fromAccountOwner\":\"The account from which the user will be sourcing the deposit\",\"_toAccountNumber\":\"The index into which `_fromAccountOwner` will be depositing\",\"_toAccountOwner\":\"The account into which `_fromAccountOwner` will be depositing\"}},\"repayAllForBorrowPositionWithDifferentAccounts(address,uint256,address,uint256,uint256,uint8)\":{\"params\":{\"_balanceCheckFlag\":\"Flag used to check if `_fromAccountNumber`, `_borrowAccountNumber`, or both accounts can go negative after the transfer settles. Setting the flag to `AccountBalanceLib.BalanceCheckFlag.None=3` results in neither account being checked.\",\"_borrowAccountNumber\":\"The index of the borrow position for that will receive the deposited assets\",\"_borrowAccountOwner\":\"The account of the borrow position that will receive the deposited assets\",\"_fromAccountNumber\":\"The index from which `msg.sender` will be depositing assets\",\"_fromAccountOwner\":\"The account from which assets will be withdrawn for repayment\",\"_marketId\":\"The ID of the market being transferred\"}},\"transferBetweenAccountsWithDifferentAccounts(address,uint256,address,uint256,uint256,uint256,uint8)\":{\"params\":{\"_amountWei\":\"The amount, in Wei, to transfer\",\"_balanceCheckFlag\":\"Flag used to check if `_fromAccountNumber`, `_toAccountNumber`, or both accounts can go negative after the transfer settles. Setting the flag to `AccountBalanceLib.BalanceCheckFlag.None=3` results in neither account being checked.\",\"_fromAccountNumber\":\"The index from which `msg.sender` will be withdrawing assets\",\"_fromAccountOwner\":\"The account from which assets will be withdrawn\",\"_marketId\":\"The ID of the market being transferred\",\"_toAccountNumber\":\"The index into which `msg.sender` will be depositing assets\",\"_toAccountOwner\":\"The account to which assets will be deposited\"}}},\"title\":\"IBorrowPositionProxyV2\"},\"userdoc\":{\"methods\":{\"closeBorrowPositionWithDifferentAccounts(address,uint256,address,uint256,uint256[])\":{\"notice\":\"This method can only be called once the user's debt has been reduced to zero. Sends all `_collateralMarketIds` from `_borrowAccountNumber` to `_toAccountNumber`. The caller must be authorized to call this function.\"},\"openBorrowPositionWithDifferentAccounts(address,uint256,address,uint256,uint256,uint256,uint8)\":{\"notice\":\"Opens a borrow position for the given `to account` while sourcing funds from `from account`. The caller must be authorized to call this function.\"},\"repayAllForBorrowPositionWithDifferentAccounts(address,uint256,address,uint256,uint256,uint8)\":{\"notice\":\"Repays a borrow position for the given `borrow account` while sourcing funds from `from account`. The caller must be authorized to call this function.\"},\"transferBetweenAccountsWithDifferentAccounts(address,uint256,address,uint256,uint256,uint256,uint8)\":{\"notice\":\"Transfers assets to a given `to account` while sourcing funds from `from account`. The caller must be authorized to call this function.\"}},\"notice\":\"Similar to IBorrowPositionProxyV1, but allows for transferring positions/assets between wallets. Useful for wallets that need to manage isolated assets in an owned-vault. All of the below write-functions require the caller to be authorized to make an invocation.\"}},\"settings\":{\"compilationTarget\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IBorrowPositionProxyV2.sol\":\"IBorrowPositionProxyV2\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IBorrowPositionProxyV2.sol\":{\"keccak256\":\"0x506c533d153f9daa5568cfbfa6d242844781a666d29ef4fc3024dcba3280d2e6\",\"urls\":[\"bzz-raw://8876f7bb38fba35d2b47e45a9fbb2cb9fa2fbac236fcf41b99371cf2251d8dda\",\"dweb:/ipfs/QmdFERieZMz2VwzMnUcuCLxvYxXu6sRbTzLvbjAX3SFGas\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/external/lib/AccountBalanceLib.sol\":{\"keccak256\":\"0x76fd16d615fe7cfceaf775b4e6524fd0462606c802b082498c768a7a4ca01a20\",\"urls\":[\"bzz-raw://56068145e300cde1c77c22e38cb753378abf2f0d4613dcb203e33ff101f169e2\",\"dweb:/ipfs/QmXvMzr9n7vzMHdUPgnc58KX4mrbQAqkq4kDETaj5Y55ZY\"]},\"/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": "0x",
"deployedBytecode": "0x",
"sourceMap": "",
"deployedSourceMap": "",
"source": "/*\n\n Copyright 2022 Dolomite.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.5.7;\n\nimport { AccountBalanceLib } from \"../lib/AccountBalanceLib.sol\";\n\n\n/**\n * @title IBorrowPositionProxyV2\n * @author Dolomite\n * @notice Similar to IBorrowPositionProxyV1, but allows for transferring positions/assets between wallets. Useful\n * for wallets that need to manage isolated assets in an owned-vault. All of the below write-functions require\n * the caller to be authorized to make an invocation.\n */\ninterface IBorrowPositionProxyV2 {\n\n // ========================= Functions =========================\n\n /**\n * @notice Opens a borrow position for the given `to account` while sourcing funds from `from account`. The caller\n * must be authorized to call this function.\n *\n * @param _fromAccountOwner The account from which the user will be sourcing the deposit\n * @param _fromAccountNumber The index from which `_toAccountOwner` will be sourcing the deposit\n * @param _toAccountOwner The account into which `_fromAccountOwner` will be depositing\n * @param _toAccountNumber The index into which `_fromAccountOwner` will be depositing\n * @param _collateralMarketId The ID of the market being deposited\n * @param _amountWei The amount, in Wei, to deposit\n * @param _balanceCheckFlag Flag used to check if `_fromAccountNumber`, `_toAccountNumber`, or both accounts can\n * go negative after the transfer settles. Setting the flag to\n * `AccountBalanceLib.BalanceCheckFlag.None=3` results in neither account being\n * checked.\n */\n function openBorrowPositionWithDifferentAccounts(\n address _fromAccountOwner,\n uint256 _fromAccountNumber,\n address _toAccountOwner,\n uint256 _toAccountNumber,\n uint256 _collateralMarketId,\n uint256 _amountWei,\n AccountBalanceLib.BalanceCheckFlag _balanceCheckFlag\n ) external;\n\n /**\n * @notice This method can only be called once the user's debt has been reduced to zero. Sends all\n * `_collateralMarketIds` from `_borrowAccountNumber` to `_toAccountNumber`. The caller must be authorized\n * to call this function.\n *\n * @param _borrowAccountOwner The account from which collateral will be withdrawn\n * @param _borrowAccountNumber The index from which `msg.sender` collateral will be withdrawn\n * @param _toAccountOwner The account into which `_borrowAccountOwner` will be depositing leftover collateral\n * @param _toAccountNumber The index into which `_borrowAccountOwner` will be depositing leftover collateral\n * @param _collateralMarketIds The IDs of the markets being withdrawn, to close the position\n */\n function closeBorrowPositionWithDifferentAccounts(\n address _borrowAccountOwner,\n uint256 _borrowAccountNumber,\n address _toAccountOwner,\n uint256 _toAccountNumber,\n uint256[] calldata _collateralMarketIds\n ) external;\n\n /**\n * @notice Transfers assets to a given `to account` while sourcing funds from `from account`. The caller must be\n * authorized to call this function.\n *\n * @param _fromAccountOwner The account from which assets will be withdrawn\n * @param _fromAccountNumber The index from which `msg.sender` will be withdrawing assets\n * @param _toAccountOwner The account to which assets will be deposited\n * @param _toAccountNumber The index into which `msg.sender` will be depositing assets\n * @param _marketId The ID of the market being transferred\n * @param _amountWei The amount, in Wei, to transfer\n * @param _balanceCheckFlag Flag used to check if `_fromAccountNumber`, `_toAccountNumber`, or both accounts can\n * go negative after the transfer settles. Setting the flag to\n * `AccountBalanceLib.BalanceCheckFlag.None=3` results in neither account being\n * checked.\n */\n function transferBetweenAccountsWithDifferentAccounts(\n address _fromAccountOwner,\n uint256 _fromAccountNumber,\n address _toAccountOwner,\n uint256 _toAccountNumber,\n uint256 _marketId,\n uint256 _amountWei,\n AccountBalanceLib.BalanceCheckFlag _balanceCheckFlag\n ) external;\n\n /**\n * @notice Repays a borrow position for the given `borrow account` while sourcing funds from `from account`. The\n * caller must be authorized to call this function.\n *\n * @param _fromAccountOwner The account from which assets will be withdrawn for repayment\n * @param _fromAccountNumber The index from which `msg.sender` will be depositing assets\n * @param _borrowAccountOwner The account of the borrow position that will receive the deposited assets\n * @param _borrowAccountNumber The index of the borrow position for that will receive the deposited assets\n * @param _marketId The ID of the market being transferred\n * @param _balanceCheckFlag Flag used to check if `_fromAccountNumber`, `_borrowAccountNumber`, or both accounts\n * can go negative after the transfer settles. Setting the flag to\n * `AccountBalanceLib.BalanceCheckFlag.None=3` results in neither account being\n * checked.\n */\n function repayAllForBorrowPositionWithDifferentAccounts(\n address _fromAccountOwner,\n uint256 _fromAccountNumber,\n address _borrowAccountOwner,\n uint256 _borrowAccountNumber,\n uint256 _marketId,\n AccountBalanceLib.BalanceCheckFlag _balanceCheckFlag\n ) external;\n}\n",
"sourcePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IBorrowPositionProxyV2.sol",
"ast": {
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IBorrowPositionProxyV2.sol",
"exportedSymbols": {
"IBorrowPositionProxyV2": [
4125
]
},
"id": 4126,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 4059,
"literals": [
"solidity",
"^",
"0.5",
".7"
],
"nodeType": "PragmaDirective",
"src": "595:23:16"
},
{
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/external/lib/AccountBalanceLib.sol",
"file": "../lib/AccountBalanceLib.sol",
"id": 4061,
"nodeType": "ImportDirective",
"scope": 4126,
"sourceUnit": 5892,
"src": "620:65:16",
"symbolAliases": [
{
"foreign": 4060,
"local": null
}
],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "interface",
"documentation": "@title IBorrowPositionProxyV2\n@author Dolomite\n@notice Similar to IBorrowPositionProxyV1, but allows for transferring positions/assets between wallets. Useful\n for wallets that need to manage isolated assets in an owned-vault. All of the below write-functions require\n the caller to be authorized to make an invocation.",
"fullyImplemented": false,
"id": 4125,
"linearizedBaseContracts": [
4125
],
"name": "IBorrowPositionProxyV2",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": null,
"documentation": "@notice Opens a borrow position for the given `to account` while sourcing funds from `from account`. The caller\n must be authorized to call this function.\n * @param _fromAccountOwner The account from which the user will be sourcing the deposit\n@param _fromAccountNumber The index from which `_toAccountOwner` will be sourcing the deposit\n@param _toAccountOwner The account into which `_fromAccountOwner` will be depositing\n@param _toAccountNumber The index into which `_fromAccountOwner` will be depositing\n@param _collateralMarketId The ID of the market being deposited\n@param _amountWei The amount, in Wei, to deposit\n@param _balanceCheckFlag Flag used to check if `_fromAccountNumber`, `_toAccountNumber`, or both accounts can\n go negative after the transfer settles. Setting the flag to\n `AccountBalanceLib.BalanceCheckFlag.None=3` results in neither account being\n checked.",
"id": 4078,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "openBorrowPositionWithDifferentAccounts",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4076,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4063,
"name": "_fromAccountOwner",
"nodeType": "VariableDeclaration",
"scope": 4078,
"src": "2330:25:16",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4062,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2330:7:16",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4065,
"name": "_fromAccountNumber",
"nodeType": "VariableDeclaration",
"scope": 4078,
"src": "2365:26:16",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4064,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2365:7:16",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4067,
"name": "_toAccountOwner",
"nodeType": "VariableDeclaration",
"scope": 4078,
"src": "2401:23:16",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4066,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2401:7:16",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4069,
"name": "_toAccountNumber",
"nodeType": "VariableDeclaration",
"scope": 4078,
"src": "2434:24:16",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4068,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2434:7:16",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4071,
"name": "_collateralMarketId",
"nodeType": "VariableDeclaration",
"scope": 4078,
"src": "2468:27:16",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4070,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2468:7:16",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4073,
"name": "_amountWei",
"nodeType": "VariableDeclaration",
"scope": 4078,
"src": "2505:18:16",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4072,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2505:7:16",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4075,
"name": "_balanceCheckFlag",
"nodeType": "VariableDeclaration",
"scope": 4078,
"src": "2533:52:16",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_enum$_BalanceCheckFlag_$5841",
"typeString": "enum AccountBalanceLib.BalanceCheckFlag"
},
"typeName": {
"contractScope": null,
"id": 4074,
"name": "AccountBalanceLib.BalanceCheckFlag",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 5841,
"src": "2533:34:16",
"typeDescriptions": {
"typeIdentifier": "t_enum$_BalanceCheckFlag_$5841",
"typeString": "enum AccountBalanceLib.BalanceCheckFlag"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2320:271:16"
},
"returnParameters": {
"id": 4077,
"nodeType": "ParameterList",
"parameters": [],
"src": "2600:0:16"
},
"scope": 4125,
"src": "2272:329:16",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "external"
},
{
"body": null,
"documentation": "@notice This method can only be called once the user's debt has been reduced to zero. Sends all\n `_collateralMarketIds` from `_borrowAccountNumber` to `_toAccountNumber`. The caller must be authorized\n to call this function.\n * @param _borrowAccountOwner The account from which collateral will be withdrawn\n@param _borrowAccountNumber The index from which `msg.sender` collateral will be withdrawn\n@param _toAccountOwner The account into which `_borrowAccountOwner` will be depositing leftover collateral\n@param _toAccountNumber The index into which `_borrowAccountOwner` will be depositing leftover collateral\n@param _collateralMarketIds The IDs of the markets being withdrawn, to close the position",
"id": 4092,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "closeBorrowPositionWithDifferentAccounts",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4090,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4080,
"name": "_borrowAccountOwner",
"nodeType": "VariableDeclaration",
"scope": 4092,
"src": "3476:27:16",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4079,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "3476:7:16",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4082,
"name": "_borrowAccountNumber",
"nodeType": "VariableDeclaration",
"scope": 4092,
"src": "3513:28:16",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4081,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "3513:7:16",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4084,
"name": "_toAccountOwner",
"nodeType": "VariableDeclaration",
"scope": 4092,
"src": "3551:23:16",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4083,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "3551:7:16",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4086,
"name": "_toAccountNumber",
"nodeType": "VariableDeclaration",
"scope": 4092,
"src": "3584:24:16",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4085,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "3584:7:16",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4089,
"name": "_collateralMarketIds",
"nodeType": "VariableDeclaration",
"scope": 4092,
"src": "3618:39:16",
"stateVariable": false,
"storageLocation": "calldata",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_uint256_$dyn_calldata_ptr",
"typeString": "uint256[]"
},
"typeName": {
"baseType": {
"id": 4087,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "3618:7:16",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 4088,
"length": null,
"nodeType": "ArrayTypeName",
"src": "3618:9:16",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr",
"typeString": "uint256[]"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "3466:197:16"
},
"returnParameters": {
"id": 4091,
"nodeType": "ParameterList",
"parameters": [],
"src": "3672:0:16"
},
"scope": 4125,
"src": "3417:256:16",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "external"
},
{
"body": null,
"documentation": "@notice Transfers assets to a given `to account` while sourcing funds from `from account`. The caller must be\n authorized to call this function.\n * @param _fromAccountOwner The account from which assets will be withdrawn\n@param _fromAccountNumber The index from which `msg.sender` will be withdrawing assets\n@param _toAccountOwner The account to which assets will be deposited\n@param _toAccountNumber The index into which `msg.sender` will be depositing assets\n@param _marketId The ID of the market being transferred\n@param _amountWei The amount, in Wei, to transfer\n@param _balanceCheckFlag Flag used to check if `_fromAccountNumber`, `_toAccountNumber`, or both accounts can\n go negative after the transfer settles. Setting the flag to\n `AccountBalanceLib.BalanceCheckFlag.None=3` results in neither account being\n checked.",
"id": 4109,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "transferBetweenAccountsWithDifferentAccounts",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4107,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4094,
"name": "_fromAccountOwner",
"nodeType": "VariableDeclaration",
"scope": 4109,
"src": "4810:25:16",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4093,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "4810:7:16",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4096,
"name": "_fromAccountNumber",
"nodeType": "VariableDeclaration",
"scope": 4109,
"src": "4845:26:16",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4095,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "4845:7:16",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4098,
"name": "_toAccountOwner",
"nodeType": "VariableDeclaration",
"scope": 4109,
"src": "4881:23:16",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4097,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "4881:7:16",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4100,
"name": "_toAccountNumber",
"nodeType": "VariableDeclaration",
"scope": 4109,
"src": "4914:24:16",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4099,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "4914:7:16",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uin