{ "address": "0x19202579F1Aed3Fa00807Ac89EbD92901021A15f", "abi": [ { "inputs": [ { "internalType": "uint256", "name": "_vaultId", "type": "uint256" }, { "internalType": "uint256", "name": "_ratioLimit", "type": "uint256" } ], "name": "getConditionData", "outputs": [ { "internalType": "bytes", "name": "", "type": "bytes" } ], "stateMutability": "pure", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_vaultId", "type": "uint256" }, { "internalType": "uint256", "name": "_ratioLimit", "type": "uint256" } ], "name": "isAffordable", "outputs": [ { "internalType": "string", "name": "", "type": "string" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "bytes", "name": "_conditionData", "type": "bytes" }, { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "ok", "outputs": [ { "internalType": "string", "name": "", "type": "string" } ], "stateMutability": "view", "type": "function" } ], "transactionHash": "0x2af52ccf7dcf3e2f59f788d9beeab569c9fea6eb33b440992ac31e4c5356643c", "receipt": { "to": null, "from": "0x5B753BF02a42bC73B5846dfd16a8F2e082b99a6a", "contractAddress": "0x19202579F1Aed3Fa00807Ac89EbD92901021A15f", "transactionIndex": 127, "gasUsed": "797549", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "blockHash": "0x8153d07f3c6c291919b4b8c89c6a0c6da4d8aa6e7adbdf2e97b487717b028e75", "transactionHash": "0x2af52ccf7dcf3e2f59f788d9beeab569c9fea6eb33b440992ac31e4c5356643c", "logs": [], "blockNumber": 11348200, "cumulativeGasUsed": "9840264", "status": 1, "byzantium": true }, "args": [], "solcInputHash": "bf7cd3f181208953a3fd533c358cf962", "metadata": "{\"compiler\":{\"version\":\"0.7.4+commit.3f05b770\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_vaultId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_ratioLimit\",\"type\":\"uint256\"}],\"name\":\"getConditionData\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_vaultId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_ratioLimit\",\"type\":\"uint256\"}],\"name\":\"isAffordable\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_conditionData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"ok\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Gelato Team\",\"kind\":\"dev\",\"methods\":{\"getConditionData(uint256,uint256)\":{\"details\":\"Use the return for your Task's Condition.data field off-chain.WARNING _ratioLimit should be in wad standard.\",\"returns\":{\"_0\":\"The encoded payload for your Task's Condition.data field.\"}},\"isAffordable(uint256,uint256)\":{\"details\":\"Check if the debt refinancing action is affordable.WARNING _ratioLimit should be in wad standard.\",\"params\":{\"_ratioLimit\":\"the maximum limit define by the user up on which the debt is too expensive for him\",\"_vaultId\":\"The id of the Maker vault\"},\"returns\":{\"_0\":\"OK if the Debt Bridge is affordable, otherwise some error message.\"}},\"ok(uint256,bytes,uint256)\":{\"details\":\"A standard interface for GelatoCore to read Conditions\",\"params\":{\"_conditionData\":\"The data you get from `getConditionData()`\"},\"returns\":{\"_0\":\"OK if the Condition is there, else some error message.\"}}},\"title\":\"ConditionDebtBridgeIsAffordable\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getConditionData(uint256,uint256)\":{\"notice\":\"Convenience function for off-chain _conditionData encoding\"},\"isAffordable(uint256,uint256)\":{\"notice\":\"Specific implementation of this Condition's ok function\"},\"ok(uint256,bytes,uint256)\":{\"notice\":\"Standard GelatoCore system function\"}},\"notice\":\"Condition checking if Debt Refinance is affordable.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/contracts/gelato/conditions/ConditionDebtBridgeIsAffordable.sol\":\"ConditionDebtBridgeIsAffordable\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gelatonetwork/core/contracts/conditions/GelatoConditionsStandard.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity >=0.6.10;\\n\\nimport \\\"./IGelatoCondition.sol\\\";\\n\\nabstract contract GelatoConditionsStandard is IGelatoCondition {\\n string internal constant OK = \\\"OK\\\";\\n}\\n\",\"keccak256\":\"0xa3d9ee5c4398914bbc0fe75fe54e57b73b8a4367caf9a40d9e5fd1ba9d4adb89\",\"license\":\"UNLICENSED\"},\"@gelatonetwork/core/contracts/conditions/IGelatoCondition.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity >=0.6.10;\\npragma experimental ABIEncoderV2;\\n\\n/// @title IGelatoCondition - solidity interface of GelatoConditionsStandard\\n/// @notice all the APIs of GelatoConditionsStandard\\n/// @dev all the APIs are implemented inside GelatoConditionsStandard\\ninterface IGelatoCondition {\\n\\n /// @notice GelatoCore calls this to verify securely the specified Condition securely\\n /// @dev Be careful only to encode a Task's condition.data as is and not with the\\n /// \\\"ok\\\" selector or _taskReceiptId, since those two things are handled by GelatoCore.\\n /// @param _taskReceiptId This is passed by GelatoCore so we can rely on it as a secure\\n /// source of Task identification.\\n /// @param _conditionData This is the Condition.data field developers must encode their\\n /// Condition's specific parameters in.\\n /// @param _cycleId For Tasks that are executed as part of a cycle.\\n function ok(uint256 _taskReceiptId, bytes calldata _conditionData, uint256 _cycleId)\\n external\\n view\\n returns(string memory);\\n}\",\"keccak256\":\"0xd07607af93227ec5f8c2f5401289937b98c298f0d2398c1ba7410f82a6253964\",\"license\":\"UNLICENSED\"},\"@gelatonetwork/core/contracts/gelato_core/interfaces/IGelatoCore.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity >=0.6.10;\\npragma experimental ABIEncoderV2;\\n\\nimport {IGelatoProviderModule} from \\\"../../provider_modules/IGelatoProviderModule.sol\\\";\\nimport {IGelatoCondition} from \\\"../../conditions/IGelatoCondition.sol\\\";\\n\\nstruct Provider {\\n address addr; // if msg.sender == provider => self-Provider\\n IGelatoProviderModule module; // can be IGelatoProviderModule(0) for self-Providers\\n}\\n\\nstruct Condition {\\n IGelatoCondition inst; // can be AddressZero for self-conditional Actions\\n bytes data; // can be bytes32(0) for self-conditional Actions\\n}\\n\\nenum Operation { Call, Delegatecall }\\n\\nenum DataFlow { None, In, Out, InAndOut }\\n\\nstruct Action {\\n address addr;\\n bytes data;\\n Operation operation;\\n DataFlow dataFlow;\\n uint256 value;\\n bool termsOkCheck;\\n}\\n\\nstruct Task {\\n Condition[] conditions; // optional\\n Action[] actions;\\n uint256 selfProviderGasLimit; // optional: 0 defaults to gelatoMaxGas\\n uint256 selfProviderGasPriceCeil; // optional: 0 defaults to NO_CEIL\\n}\\n\\nstruct TaskReceipt {\\n uint256 id;\\n address userProxy;\\n Provider provider;\\n uint256 index;\\n Task[] tasks;\\n uint256 expiryDate;\\n uint256 cycleId; // auto-filled by GelatoCore. 0 for non-cyclic/chained tasks\\n uint256 submissionsLeft;\\n}\\n\\ninterface IGelatoCore {\\n event LogTaskSubmitted(\\n uint256 indexed taskReceiptId,\\n bytes32 indexed taskReceiptHash,\\n TaskReceipt taskReceipt\\n );\\n\\n event LogExecSuccess(\\n address indexed executor,\\n uint256 indexed taskReceiptId,\\n uint256 executorSuccessFee,\\n uint256 sysAdminSuccessFee\\n );\\n event LogCanExecFailed(\\n address indexed executor,\\n uint256 indexed taskReceiptId,\\n string reason\\n );\\n event LogExecReverted(\\n address indexed executor,\\n uint256 indexed taskReceiptId,\\n uint256 executorRefund,\\n string reason\\n );\\n\\n event LogTaskCancelled(uint256 indexed taskReceiptId, address indexed cancellor);\\n\\n /// @notice API to query whether Task can be submitted successfully.\\n /// @dev In submitTask the msg.sender must be the same as _userProxy here.\\n /// @param _provider Gelato Provider object: provider address and module.\\n /// @param _userProxy The userProxy from which the task will be submitted.\\n /// @param _task Selected provider, conditions, actions, expiry date of the task\\n function canSubmitTask(\\n address _userProxy,\\n Provider calldata _provider,\\n Task calldata _task,\\n uint256 _expiryDate\\n )\\n external\\n view\\n returns(string memory);\\n\\n /// @notice API to submit a single Task.\\n /// @dev You can let users submit multiple tasks at once by batching calls to this.\\n /// @param _provider Gelato Provider object: provider address and module.\\n /// @param _task A Gelato Task object: provider, conditions, actions.\\n /// @param _expiryDate From then on the task cannot be executed. 0 for infinity.\\n function submitTask(\\n Provider calldata _provider,\\n Task calldata _task,\\n uint256 _expiryDate\\n )\\n external;\\n\\n\\n /// @notice A Gelato Task Cycle consists of 1 or more Tasks that automatically submit\\n /// the next one, after they have been executed.\\n /// @param _provider Gelato Provider object: provider address and module.\\n /// @param _tasks This can be a single task or a sequence of tasks.\\n /// @param _expiryDate After this no task of the sequence can be executed any more.\\n /// @param _cycles How many full cycles will be submitted\\n function submitTaskCycle(\\n Provider calldata _provider,\\n Task[] calldata _tasks,\\n uint256 _expiryDate,\\n uint256 _cycles\\n )\\n external;\\n\\n\\n /// @notice A Gelato Task Cycle consists of 1 or more Tasks that automatically submit\\n /// the next one, after they have been executed.\\n /// @dev CAUTION: _sumOfRequestedTaskSubmits does not mean the number of cycles.\\n /// @dev If _sumOfRequestedTaskSubmits = 1 && _tasks.length = 2, only the first task\\n /// would be submitted, but not the second\\n /// @param _provider Gelato Provider object: provider address and module.\\n /// @param _tasks This can be a single task or a sequence of tasks.\\n /// @param _expiryDate After this no task of the sequence can be executed any more.\\n /// @param _sumOfRequestedTaskSubmits The TOTAL number of Task auto-submits\\n /// that should have occured once the cycle is complete:\\n /// _sumOfRequestedTaskSubmits = 0 => One Task will resubmit the next Task infinitly\\n /// _sumOfRequestedTaskSubmits = 1 => One Task will resubmit no other task\\n /// _sumOfRequestedTaskSubmits = 2 => One Task will resubmit 1 other task\\n /// ...\\n function submitTaskChain(\\n Provider calldata _provider,\\n Task[] calldata _tasks,\\n uint256 _expiryDate,\\n uint256 _sumOfRequestedTaskSubmits\\n )\\n external;\\n\\n // ================ Exec Suite =========================\\n /// @notice Off-chain API for executors to check, if a TaskReceipt is executable\\n /// @dev GelatoCore checks this during execution, in order to safeguard the Conditions\\n /// @param _TR TaskReceipt, consisting of user task, user proxy address and id\\n /// @param _gasLimit Task.selfProviderGasLimit is used for SelfProviders. All other\\n /// Providers must use gelatoMaxGas. If the _gasLimit is used by an Executor and the\\n /// tx reverts, a refund is paid by the Provider and the TaskReceipt is annulated.\\n /// @param _execTxGasPrice Must be used by Executors. Gas Price fed by gelatoCore's\\n /// Gas Price Oracle. Executors can query the current gelatoGasPrice from events.\\n function canExec(TaskReceipt calldata _TR, uint256 _gasLimit, uint256 _execTxGasPrice)\\n external\\n view\\n returns(string memory);\\n\\n /// @notice Executors call this when Conditions allow it to execute submitted Tasks.\\n /// @dev Executors get rewarded for successful Execution. The Task remains open until\\n /// successfully executed, or when the execution failed, despite of gelatoMaxGas usage.\\n /// In the latter case Executors are refunded by the Task Provider.\\n /// @param _TR TaskReceipt: id, userProxy, Task.\\n function exec(TaskReceipt calldata _TR) external;\\n\\n /// @notice Cancel task\\n /// @dev Callable only by userProxy or selected provider\\n /// @param _TR TaskReceipt: id, userProxy, Task.\\n function cancelTask(TaskReceipt calldata _TR) external;\\n\\n /// @notice Cancel multiple tasks at once\\n /// @dev Callable only by userProxy or selected provider\\n /// @param _taskReceipts TaskReceipts: id, userProxy, Task.\\n function multiCancelTasks(TaskReceipt[] calldata _taskReceipts) external;\\n\\n /// @notice Compute hash of task receipt\\n /// @param _TR TaskReceipt, consisting of user task, user proxy address and id\\n /// @return hash of taskReceipt\\n function hashTaskReceipt(TaskReceipt calldata _TR) external pure returns(bytes32);\\n\\n // ================ Getters =========================\\n /// @notice Returns the taskReceiptId of the last TaskReceipt submitted\\n /// @return currentId currentId, last TaskReceiptId submitted\\n function currentTaskReceiptId() external view returns(uint256);\\n\\n /// @notice Returns computed taskReceipt hash, used to check for taskReceipt validity\\n /// @param _taskReceiptId Id of taskReceipt emitted in submission event\\n /// @return hash of taskReceipt\\n function taskReceiptHash(uint256 _taskReceiptId) external view returns(bytes32);\\n}\\n\",\"keccak256\":\"0x93fdb67219b2d675621f935f3f7bc460b7283e797198741a95fabbafc7e33fee\",\"license\":\"UNLICENSED\"},\"@gelatonetwork/core/contracts/provider_modules/IGelatoProviderModule.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity >=0.6.10;\\npragma experimental ABIEncoderV2;\\n\\nimport {Action, Task} from \\\"../gelato_core/interfaces/IGelatoCore.sol\\\";\\n\\ninterface IGelatoProviderModule {\\n\\n /// @notice Check if provider agrees to pay for inputted task receipt\\n /// @dev Enables arbitrary checks by provider\\n /// @param _userProxy The smart contract account of the user who submitted the Task.\\n /// @param _provider The account of the Provider who uses the ProviderModule.\\n /// @param _task Gelato Task to be executed.\\n /// @return \\\"OK\\\" if provider agrees\\n function isProvided(address _userProxy, address _provider, Task calldata _task)\\n external\\n view\\n returns(string memory);\\n\\n /// @notice Convert action specific payload into proxy specific payload\\n /// @dev Encoded multiple actions into a multisend\\n /// @param _taskReceiptId Unique ID of Gelato Task to be executed.\\n /// @param _userProxy The smart contract account of the user who submitted the Task.\\n /// @param _provider The account of the Provider who uses the ProviderModule.\\n /// @param _task Gelato Task to be executed.\\n /// @param _cycleId For Tasks that form part of a cycle/chain.\\n /// @return Encoded payload that will be used for low-level .call on user proxy\\n /// @return checkReturndata if true, fwd returndata from userProxy.call to ProviderModule\\n function execPayload(\\n uint256 _taskReceiptId,\\n address _userProxy,\\n address _provider,\\n Task calldata _task,\\n uint256 _cycleId\\n )\\n external\\n view\\n returns(bytes memory, bool checkReturndata);\\n\\n /// @notice Called by GelatoCore.exec to verifiy that no revert happend on userProxy\\n /// @dev If a caught revert is detected, this fn should revert with the detected error\\n /// @param _proxyReturndata Data from GelatoCore._exec.userProxy.call(execPayload)\\n function execRevertCheck(bytes calldata _proxyReturndata) external pure;\\n}\\n\",\"keccak256\":\"0x8d08ceddbc4e686d070e916d2bcffc69c5a640b56866bc2cef0256b564eb14dc\",\"license\":\"UNLICENSED\"},\"contracts/constants/CDebtBridge.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\nfunction GAS_COSTS_FOR_FULL_REFINANCE() pure returns (uint256[4] memory) {\\n return [uint256(2000000), 2400000, 2850000, 3500000];\\n}\\n\\nuint256 constant PREMIUM = 20;\\nuint256 constant VAULT_CREATION_COST = 150000;\\n\",\"keccak256\":\"0x6f1d97db0c063fb543f009496d5a4bc268b436d19cbc9fa609557220e8a59f38\",\"license\":\"UNLICENSED\"},\"contracts/constants/CGelato.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\nimport {\\n IGelatoGasPriceOracle\\n} from \\\"../interfaces/gelato/IGelatoGasPriceOracle.sol\\\";\\n\\nIGelatoGasPriceOracle constant GELATO_GAS_PRICE_ORACLE = IGelatoGasPriceOracle(\\n 0x169E633A2D1E6c10dD91238Ba11c4A708dfEF37C\\n);\\n\",\"keccak256\":\"0xc74081014a09fb9211119b434c31dc97a3a937b13b45de9f9abcebfb56c7e9ba\",\"license\":\"UNLICENSED\"},\"contracts/constants/CInstaDapp.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\n// InstaDapp\\naddress constant INSTA_MEMORY = 0x8a5419CfC711B2343c17a6ABf4B2bAFaBb06957F;\\n\\n// Connectors\\naddress constant CONNECT_MAKER = 0xac02030d8a8F49eD04b2f52C394D3F901A10F8A9;\\naddress constant CONNECT_COMPOUND = 0x15FdD1e902cAC70786fe7D31013B1a806764B5a2;\\naddress constant INSTA_POOL_V2 = 0xeB4bf86589f808f90EEC8e964dBF16Bd4D284905;\\n\\n// Tokens\\naddress constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\\naddress constant DAI = 0x6B175474E89094C44Da98b954EedeAC495271d0F;\\n\\n// Insta Pool\\naddress constant INSTA_POOL_RESOLVER = 0xa004a5afBa04b74037E9E52bA1f7eb02b5E61509;\\nuint256 constant ROUTE_1_TOLERANCE = 1005e15;\\n\\n// Insta Mapping\\naddress constant INSTA_MAPPING = 0xe81F70Cc7C0D46e12d70efc60607F16bbD617E88;\\n\",\"keccak256\":\"0x0cbe5f37f9df8be40b791e526926ff413816606b8917976693765925bd3b5f27\",\"license\":\"UNLICENSED\"},\"contracts/constants/CMaker.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\naddress constant MCD_MANAGER = 0x5ef30b9986345249bc32d8928B7ee64DE9435E39;\\n\",\"keccak256\":\"0x216362392e679feeaebba65883e7ab77e5a96e1a881f9305d83f3d3881fbddc4\",\"license\":\"UNLICENSED\"},\"contracts/contracts/gelato/conditions/ConditionDebtBridgeIsAffordable.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\npragma experimental ABIEncoderV2;\\n\\nimport {\\n GelatoConditionsStandard\\n} from \\\"@gelatonetwork/core/contracts/conditions/GelatoConditionsStandard.sol\\\";\\nimport {\\n IGelatoCore\\n} from \\\"@gelatonetwork/core/contracts/gelato_core/interfaces/IGelatoCore.sol\\\";\\nimport {GelatoBytes} from \\\"../../../lib/GelatoBytes.sol\\\";\\nimport {\\n _getMakerVaultDebt,\\n _getMakerVaultCollateralBalance\\n} from \\\"../../../functions/dapps/FMaker.sol\\\";\\nimport {\\n _getFlashLoanRoute,\\n _getGasCostMakerToMaker,\\n _getRealisedDebt\\n} from \\\"../../../functions/gelato/FGelatoDebtBridge.sol\\\";\\nimport {_getGelatoExecutorFees} from \\\"../../../functions/gelato/FGelato.sol\\\";\\nimport {DAI} from \\\"../../../constants/CInstaDapp.sol\\\";\\nimport {wdiv} from \\\"../../../vendor/DSMath.sol\\\";\\n\\n/// @title ConditionDebtBridgeIsAffordable\\n/// @notice Condition checking if Debt Refinance is affordable.\\n/// @author Gelato Team\\ncontract ConditionDebtBridgeIsAffordable is GelatoConditionsStandard {\\n using GelatoBytes for bytes;\\n\\n /// @notice Convenience function for off-chain _conditionData encoding\\n /// @dev Use the return for your Task's Condition.data field off-chain.\\n /// @dev WARNING _ratioLimit should be in wad standard.\\n /// @return The encoded payload for your Task's Condition.data field.\\n function getConditionData(uint256 _vaultId, uint256 _ratioLimit)\\n public\\n pure\\n virtual\\n returns (bytes memory)\\n {\\n return\\n abi.encodeWithSelector(\\n this.isAffordable.selector,\\n _vaultId,\\n _ratioLimit\\n );\\n }\\n\\n /// @notice Standard GelatoCore system function\\n /// @dev A standard interface for GelatoCore to read Conditions\\n /// @param _conditionData The data you get from `getConditionData()`\\n /// @return OK if the Condition is there, else some error message.\\n function ok(\\n uint256,\\n bytes calldata _conditionData,\\n uint256\\n ) public view virtual override returns (string memory) {\\n (uint256 _vaultID, uint256 _ratioLimit) =\\n abi.decode(_conditionData[4:], (uint256, uint256));\\n\\n return isAffordable(_vaultID, _ratioLimit);\\n }\\n\\n /// @notice Specific implementation of this Condition's ok function\\n /// @dev Check if the debt refinancing action is affordable.\\n /// @dev WARNING _ratioLimit should be in wad standard.\\n /// @param _vaultId The id of the Maker vault\\n /// @param _ratioLimit the maximum limit define by the user up on which\\n /// the debt is too expensive for him\\n /// @return OK if the Debt Bridge is affordable, otherwise some error message.\\n function isAffordable(uint256 _vaultId, uint256 _ratioLimit)\\n public\\n view\\n returns (string memory)\\n {\\n uint256 wColToWithdrawFromMaker =\\n _getMakerVaultCollateralBalance(_vaultId);\\n uint256 gasFeesPaidFromCol =\\n _getGelatoExecutorFees(\\n _getGasCostMakerToMaker(\\n false,\\n _getFlashLoanRoute(\\n DAI,\\n _getRealisedDebt(_getMakerVaultDebt(_vaultId))\\n )\\n )\\n );\\n if (wdiv(gasFeesPaidFromCol, wColToWithdrawFromMaker) >= _ratioLimit)\\n return \\\"DebtBridgeNotAffordable\\\";\\n return OK;\\n }\\n}\\n\",\"keccak256\":\"0xd9106fe79d0a9359ca9e92a60d618e98df08f4e7f241280ce0f9ca40ae820dc4\",\"license\":\"UNLICENSED\"},\"contracts/functions/dapps/FMaker.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\nimport {MCD_MANAGER} from \\\"../../constants/CMaker.sol\\\";\\nimport {INSTA_MAPPING} from \\\"../../constants/CInstaDapp.sol\\\";\\nimport {\\n ITokenJoinInterface\\n} from \\\"../../interfaces/dapps/Maker/ITokenJoinInterface.sol\\\";\\nimport {IMcdManager} from \\\"../../interfaces/dapps/Maker/IMcdManager.sol\\\";\\nimport {InstaMapping} from \\\"../../interfaces/InstaDapp/IInstaDapp.sol\\\";\\nimport {IVat} from \\\"../../interfaces/dapps/Maker/IVat.sol\\\";\\nimport {RAY, add, sub, mul} from \\\"../../vendor/DSMath.sol\\\";\\nimport {_stringToBytes32, _convertTo18} from \\\"../../vendor/Convert.sol\\\";\\n\\nfunction _getMakerVaultDebt(uint256 _vaultId) view returns (uint256 wad) {\\n IMcdManager manager = IMcdManager(MCD_MANAGER);\\n\\n (bytes32 ilk, address urn) = _getVaultData(manager, _vaultId);\\n IVat vat = IVat(manager.vat());\\n (, uint256 rate, , , ) = vat.ilks(ilk);\\n (, uint256 art) = vat.urns(ilk, urn);\\n uint256 dai = vat.dai(urn);\\n\\n uint256 rad = sub(mul(art, rate), dai);\\n wad = rad / RAY;\\n\\n wad = mul(wad, RAY) < rad ? wad + 1 : wad;\\n}\\n\\nfunction _getMakerRawVaultDebt(uint256 _vaultId) view returns (uint256 tab) {\\n IMcdManager manager = IMcdManager(MCD_MANAGER);\\n\\n (bytes32 ilk, address urn) = _getVaultData(manager, _vaultId);\\n IVat vat = IVat(manager.vat());\\n (, uint256 rate, , , ) = vat.ilks(ilk);\\n (, uint256 art) = vat.urns(ilk, urn);\\n\\n uint256 rad = mul(art, rate);\\n\\n tab = rad / RAY;\\n tab = mul(tab, RAY) < rad ? tab + 1 : tab;\\n}\\n\\nfunction _getMakerVaultCollateralBalance(uint256 _vaultId)\\n view\\n returns (uint256)\\n{\\n IMcdManager manager = IMcdManager(MCD_MANAGER);\\n\\n IVat vat = IVat(manager.vat());\\n (bytes32 ilk, address urn) = _getVaultData(manager, _vaultId);\\n (uint256 ink, ) = vat.urns(ilk, urn);\\n\\n return ink;\\n}\\n\\nfunction _vaultWillBeSafe(\\n uint256 _vaultId,\\n uint256 _amtToBorrow,\\n uint256 _colToDeposit\\n) view returns (bool) {\\n require(_vaultId != 0, \\\"_vaultWillBeSafe: invalid vault id.\\\");\\n\\n IMcdManager manager = IMcdManager(MCD_MANAGER);\\n\\n (bytes32 ilk, address urn) = _getVaultData(manager, _vaultId);\\n\\n ITokenJoinInterface tokenJoinContract =\\n ITokenJoinInterface(InstaMapping(INSTA_MAPPING).gemJoinMapping(ilk));\\n\\n IVat vat = IVat(manager.vat());\\n (, uint256 rate, uint256 spot, , ) = vat.ilks(ilk);\\n (uint256 ink, uint256 art) = vat.urns(ilk, urn);\\n uint256 dai = vat.dai(urn);\\n\\n uint256 dink = _convertTo18(tokenJoinContract.dec(), _colToDeposit);\\n uint256 dart = _getBorrowAmt(_amtToBorrow, dai, rate);\\n\\n ink = add(ink, dink);\\n art = add(art, dart);\\n\\n uint256 tab = mul(rate, art);\\n\\n return tab <= mul(ink, spot);\\n}\\n\\nfunction _newVaultWillBeSafe(\\n string memory _colType,\\n uint256 _amtToBorrow,\\n uint256 _colToDeposit\\n) view returns (bool) {\\n IMcdManager manager = IMcdManager(MCD_MANAGER);\\n IVat vat = IVat(manager.vat());\\n\\n bytes32 ilk = _stringToBytes32(_colType);\\n\\n (, uint256 rate, uint256 spot, , ) = vat.ilks(ilk);\\n\\n ITokenJoinInterface tokenJoinContract =\\n ITokenJoinInterface(InstaMapping(INSTA_MAPPING).gemJoinMapping(ilk));\\n\\n uint256 ink = _convertTo18(tokenJoinContract.dec(), _colToDeposit);\\n uint256 art = _getBorrowAmt(_amtToBorrow, 0, rate);\\n\\n uint256 tab = mul(rate, art);\\n\\n return tab <= mul(ink, spot);\\n}\\n\\nfunction _getVaultData(IMcdManager manager, uint256 vault)\\n view\\n returns (bytes32 ilk, address urn)\\n{\\n ilk = manager.ilks(vault);\\n urn = manager.urns(vault);\\n}\\n\\nfunction _getBorrowAmt(\\n uint256 _amt,\\n uint256 _dai,\\n uint256 _rate\\n) pure returns (uint256 dart) {\\n dart = sub(mul(_amt, RAY), _dai) / _rate;\\n dart = mul(dart, _rate) < mul(_amt, RAY) ? dart + 1 : dart;\\n}\\n\\nfunction _isVaultOwner(uint256 _vaultId, address _owner) view returns (bool) {\\n if (_vaultId == 0) return false;\\n\\n try IMcdManager(MCD_MANAGER).owns(_vaultId) returns (address owner) {\\n return _owner == owner;\\n } catch Error(string memory error) {\\n revert(string(abi.encodePacked(\\\"FMaker._isVaultOwner:\\\", error)));\\n } catch {\\n revert(\\\"FMaker._isVaultOwner:undefined\\\");\\n }\\n}\\n\",\"keccak256\":\"0xf0717d8116b60ba87e0ea9cd1ce0ec2c105f29cec41c1964d6f3a4b89e372cab\",\"license\":\"UNLICENSED\"},\"contracts/functions/gelato/FGelato.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\nimport {GELATO_GAS_PRICE_ORACLE} from \\\"../../constants/CGelato.sol\\\";\\nimport {mul} from \\\"../../vendor/DSMath.sol\\\";\\n\\nfunction _getGelatoGasPrice() view returns (uint256) {\\n int256 oracleGasPrice = GELATO_GAS_PRICE_ORACLE.latestAnswer();\\n if (oracleGasPrice <= 0) revert(\\\"_getGelatoGasPrice:0orBelow\\\");\\n return uint256(oracleGasPrice);\\n}\\n\\nfunction _getGelatoExecutorFees(uint256 _gas) view returns (uint256) {\\n return mul(_gas, _getGelatoGasPrice());\\n}\\n\",\"keccak256\":\"0x99d0f6c116d772e7c97b5c4eeffa01ae79ad2d53bfa3977a923ba5cfa090dcca\",\"license\":\"UNLICENSED\"},\"contracts/functions/gelato/FGelatoDebtBridge.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\npragma experimental ABIEncoderV2;\\n\\nimport {add, sub, mul, wmul, wdiv} from \\\"../../vendor/DSMath.sol\\\";\\nimport {\\n INSTA_POOL_RESOLVER,\\n ROUTE_1_TOLERANCE\\n} from \\\"../../constants/CInstaDapp.sol\\\";\\nimport {\\n GAS_COSTS_FOR_FULL_REFINANCE,\\n PREMIUM,\\n VAULT_CREATION_COST\\n} from \\\"../../constants/CDebtBridge.sol\\\";\\nimport {\\n IInstaPoolResolver\\n} from \\\"../../interfaces/InstaDapp/resolvers/IInstaPoolResolver.sol\\\";\\n\\nfunction _wCalcCollateralToWithdraw(\\n uint256 _wMinColRatioA,\\n uint256 _wMinColRatioB,\\n uint256 _wColPrice,\\n uint256 _wPricedCol,\\n uint256 _wDebtOnA\\n) pure returns (uint256) {\\n return\\n wdiv(\\n sub(\\n _wPricedCol,\\n wdiv(\\n sub(\\n wmul(_wMinColRatioA, _wPricedCol),\\n wmul(_wMinColRatioA, wmul(_wMinColRatioB, _wDebtOnA))\\n ),\\n sub(_wMinColRatioA, _wMinColRatioB)\\n )\\n ),\\n _wColPrice\\n );\\n}\\n\\nfunction _wCalcDebtToRepay(\\n uint256 _wMinColRatioA,\\n uint256 _wMinColRatioB,\\n uint256 _wPricedCol,\\n uint256 _wDebtOnA\\n) pure returns (uint256) {\\n return\\n sub(\\n _wDebtOnA,\\n wmul(\\n wdiv(1e18, _wMinColRatioA),\\n wdiv(\\n sub(\\n wmul(_wMinColRatioA, _wPricedCol),\\n wmul(_wMinColRatioA, wmul(_wMinColRatioB, _wDebtOnA))\\n ),\\n sub(_wMinColRatioA, _wMinColRatioB)\\n )\\n )\\n );\\n}\\n\\nfunction _getFlashLoanRoute(address _tokenA, uint256 _wTokenADebtToMove)\\n view\\n returns (uint256)\\n{\\n IInstaPoolResolver.RouteData memory rData =\\n IInstaPoolResolver(INSTA_POOL_RESOLVER).getTokenLimit(_tokenA);\\n\\n if (rData.dydx > _wTokenADebtToMove) return 0;\\n if (rData.maker > _wTokenADebtToMove) return 1;\\n if (rData.compound > _wTokenADebtToMove) return 2;\\n if (rData.aave > _wTokenADebtToMove) return 3;\\n revert(\\\"FGelatoDebtBridge._getFlashLoanRoute: illiquid\\\");\\n}\\n\\nfunction _getGasCostMakerToMaker(bool _newVault, uint256 _route)\\n pure\\n returns (uint256)\\n{\\n _checkRouteIndex(_route);\\n return\\n _getGasCostPremium(\\n _newVault\\n ? add(\\n GAS_COSTS_FOR_FULL_REFINANCE()[_route],\\n VAULT_CREATION_COST\\n )\\n : GAS_COSTS_FOR_FULL_REFINANCE()[_route]\\n );\\n}\\n\\nfunction _getGasCostMakerToCompound(uint256 _route) pure returns (uint256) {\\n _checkRouteIndex(_route);\\n return _getGasCostPremium(GAS_COSTS_FOR_FULL_REFINANCE()[_route]);\\n}\\n\\nfunction _getGasCostPremium(uint256 _rawGasCost) pure returns (uint256) {\\n return mul(_rawGasCost, add(100, PREMIUM)) / 100;\\n}\\n\\nfunction _getRealisedDebt(uint256 _debtToMove) pure returns (uint256) {\\n return wmul(_debtToMove, ROUTE_1_TOLERANCE);\\n}\\n\\nfunction _checkRouteIndex(uint256 _route) pure {\\n require(\\n _route <= 4,\\n \\\"FGelatoDebtBridge._getGasCostMakerToMaker: invalid route index\\\"\\n );\\n}\\n\",\"keccak256\":\"0x6a54ab47243c50da6599bed5036ad32f49387ad709127b019a217e1c1335ab2f\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/InstaDapp/IInstaDapp.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\npragma experimental ABIEncoderV2;\\n\\n/// @notice Interface InstaDapp Index\\ninterface IndexInterface {\\n function connectors(uint256 version) external view returns (address);\\n\\n function list() external view returns (address);\\n}\\n\\n/// @notice Interface InstaDapp List\\ninterface ListInterface {\\n function accountID(address _account) external view returns (uint64);\\n}\\n\\n/// @notice Interface InstaDapp InstaMemory\\ninterface MemoryInterface {\\n function setUint(uint256 _id, uint256 _val) external;\\n\\n function getUint(uint256 _id) external returns (uint256);\\n}\\n\\n/// @notice Interface InstaDapp Defi Smart Account wallet\\ninterface AccountInterface {\\n function cast(\\n address[] calldata _targets,\\n bytes[] calldata _datas,\\n address _origin\\n ) external payable returns (bytes32[] memory responses);\\n\\n function version() external view returns (uint256);\\n\\n function isAuth(address user) external view returns (bool);\\n\\n function shield() external view returns (bool);\\n}\\n\\ninterface ConnectorInterface {\\n function connectorID() external view returns (uint256 _type, uint256 _id);\\n\\n function name() external view returns (string memory);\\n}\\n\\ninterface InstaMapping {\\n function gemJoinMapping(bytes32) external view returns (address);\\n}\\n\",\"keccak256\":\"0x09243467e98503c35d8f5b972c5595ee2684f64bf080f46785e7b85aca83562d\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/InstaDapp/resolvers/IInstaPoolResolver.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity 0.7.4;\\npragma experimental ABIEncoderV2;\\n\\ninterface IInstaPoolResolver {\\n struct RouteData {\\n uint256 dydx;\\n uint256 maker;\\n uint256 compound;\\n uint256 aave;\\n }\\n\\n function getTokenLimit(address token)\\n external\\n view\\n returns (RouteData memory);\\n}\\n\",\"keccak256\":\"0x036703684cf8156fdc57c8d6ed583b2d273688e1dd26cf78c19bf2fbb59c7885\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/dapps/Maker/IMcdManager.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\ninterface IMcdManager {\\n function ilks(uint256) external view returns (bytes32);\\n\\n function urns(uint256) external view returns (address);\\n\\n function vat() external view returns (address);\\n\\n function owns(uint256) external view returns (address);\\n}\\n\",\"keccak256\":\"0x53eec95121b3713ce3b308a5fd41935dad42ebd5b90fd4565677c20f2238dc2e\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/dapps/Maker/ITokenJoinInterface.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\ninterface ITokenJoinInterface {\\n function dec() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x9f4ce4d37db51dfd0c9d536e630a3c5a4df3cfeb46aef16d8e78222c9c66c3de\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/dapps/Maker/IVat.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\ninterface IVat {\\n function ilks(bytes32)\\n external\\n view\\n returns (\\n uint256,\\n uint256,\\n uint256,\\n uint256,\\n uint256\\n );\\n\\n function dai(address) external view returns (uint256);\\n\\n function urns(bytes32, address) external view returns (uint256, uint256);\\n}\\n\",\"keccak256\":\"0xde979af6019a257b13de06e94180a344fe8cd2e7dc0790988b8f6204a01f95e8\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/gelato/IGelatoGasPriceOracle.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\ninterface IGelatoGasPriceOracle {\\n function latestAnswer() external view returns (int256);\\n}\\n\",\"keccak256\":\"0x0fee271af60cac14cba61a365efbaaa6c214965e2ea9ce70c1a2eb62b8d57db5\",\"license\":\"UNLICENSED\"},\"contracts/lib/GelatoBytes.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\nlibrary GelatoBytes {\\n function calldataSliceSelector(bytes calldata _bytes)\\n internal\\n pure\\n returns (bytes4 selector)\\n {\\n selector =\\n _bytes[0] |\\n (bytes4(_bytes[1]) >> 8) |\\n (bytes4(_bytes[2]) >> 16) |\\n (bytes4(_bytes[3]) >> 24);\\n }\\n\\n function memorySliceSelector(bytes memory _bytes)\\n internal\\n pure\\n returns (bytes4 selector)\\n {\\n selector =\\n _bytes[0] |\\n (bytes4(_bytes[1]) >> 8) |\\n (bytes4(_bytes[2]) >> 16) |\\n (bytes4(_bytes[3]) >> 24);\\n }\\n\\n function revertWithError(bytes memory _bytes, string memory _tracingInfo)\\n internal\\n pure\\n {\\n // 68: 32-location, 32-length, 4-ErrorSelector, UTF-8 err\\n if (_bytes.length % 32 == 4) {\\n bytes4 selector;\\n assembly {\\n selector := mload(add(0x20, _bytes))\\n }\\n if (selector == 0x08c379a0) {\\n // Function selector for Error(string)\\n assembly {\\n _bytes := add(_bytes, 68)\\n }\\n revert(string(abi.encodePacked(_tracingInfo, string(_bytes))));\\n } else {\\n revert(\\n string(abi.encodePacked(_tracingInfo, \\\"NoErrorSelector\\\"))\\n );\\n }\\n } else {\\n revert(\\n string(abi.encodePacked(_tracingInfo, \\\"UnexpectedReturndata\\\"))\\n );\\n }\\n }\\n\\n function returnError(bytes memory _bytes, string memory _tracingInfo)\\n internal\\n pure\\n returns (string memory)\\n {\\n // 68: 32-location, 32-length, 4-ErrorSelector, UTF-8 err\\n if (_bytes.length % 32 == 4) {\\n bytes4 selector;\\n assembly {\\n selector := mload(add(0x20, _bytes))\\n }\\n if (selector == 0x08c379a0) {\\n // Function selector for Error(string)\\n assembly {\\n _bytes := add(_bytes, 68)\\n }\\n return string(abi.encodePacked(_tracingInfo, string(_bytes)));\\n } else {\\n return\\n string(abi.encodePacked(_tracingInfo, \\\"NoErrorSelector\\\"));\\n }\\n } else {\\n return\\n string(abi.encodePacked(_tracingInfo, \\\"UnexpectedReturndata\\\"));\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9038c820e041814ca2311bf582f2123171865b36c9438a7c6f85eb99406ec45c\",\"license\":\"UNLICENSED\"},\"contracts/vendor/Convert.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\nimport {mul as _mul} from \\\"./DSMath.sol\\\";\\n\\nfunction _stringToBytes32(string memory str) pure returns (bytes32 result) {\\n require(bytes(str).length != 0, \\\"string-empty\\\");\\n assembly {\\n result := mload(add(str, 32))\\n }\\n}\\n\\nfunction _convertTo18(uint256 _dec, uint256 _amt) pure returns (uint256 amt) {\\n amt = _mul(_amt, 10**(18 - _dec));\\n}\\n\",\"keccak256\":\"0x7feec80ffbcff215032733f837e646f1389aa8052cf9aa2d7a33aac0249a1bc4\",\"license\":\"UNLICENSED\"},\"contracts/vendor/DSMath.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: AGPL-3.0-or-later\\\"\\n/// math.sol -- mixin for inline numerical wizardry\\n\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU General Public License for more details.\\n\\n// You should have received a copy of the GNU General Public License\\n// along with this program. If not, see .\\n\\npragma solidity 0.7.4;\\n\\nfunction add(uint256 x, uint256 y) pure returns (uint256 z) {\\n require((z = x + y) >= x, \\\"ds-math-add-overflow\\\");\\n}\\n\\nfunction sub(uint256 x, uint256 y) pure returns (uint256 z) {\\n require((z = x - y) <= x, \\\"ds-math-sub-underflow\\\");\\n}\\n\\nfunction mul(uint256 x, uint256 y) pure returns (uint256 z) {\\n require(y == 0 || (z = x * y) / y == x, \\\"ds-math-mul-overflow\\\");\\n}\\n\\nfunction min(uint256 x, uint256 y) pure returns (uint256 z) {\\n return x <= y ? x : y;\\n}\\n\\nfunction max(uint256 x, uint256 y) pure returns (uint256 z) {\\n return x >= y ? x : y;\\n}\\n\\nfunction imin(int256 x, int256 y) pure returns (int256 z) {\\n return x <= y ? x : y;\\n}\\n\\nfunction imax(int256 x, int256 y) pure returns (int256 z) {\\n return x >= y ? x : y;\\n}\\n\\nuint256 constant WAD = 10**18;\\nuint256 constant RAY = 10**27;\\n\\n//rounds to zero if x*y < WAD / 2\\nfunction wmul(uint256 x, uint256 y) pure returns (uint256 z) {\\n z = add(mul(x, y), WAD / 2) / WAD;\\n}\\n\\n//rounds to zero if x*y < WAD / 2\\nfunction rmul(uint256 x, uint256 y) pure returns (uint256 z) {\\n z = add(mul(x, y), RAY / 2) / RAY;\\n}\\n\\n//rounds to zero if x*y < WAD / 2\\nfunction wdiv(uint256 x, uint256 y) pure returns (uint256 z) {\\n z = add(mul(x, WAD), y / 2) / y;\\n}\\n\\n//rounds to zero if x*y < RAY / 2\\nfunction rdiv(uint256 x, uint256 y) pure returns (uint256 z) {\\n z = add(mul(x, RAY), y / 2) / y;\\n}\\n\\n// This famous algorithm is called \\\"exponentiation by squaring\\\"\\n// and calculates x^n with x as fixed-point and n as regular unsigned.\\n//\\n// It's O(log n), instead of O(n) for naive repeated multiplication.\\n//\\n// These facts are why it works:\\n//\\n// If n is even, then x^n = (x^2)^(n/2).\\n// If n is odd, then x^n = x * x^(n-1),\\n// and applying the equation for even x gives\\n// x^n = x * (x^2)^((n-1) / 2).\\n//\\n// Also, EVM division is flooring and\\n// floor[(n-1) / 2] = floor[n / 2].\\n//\\nfunction rpow(uint256 x, uint256 n) pure returns (uint256 z) {\\n z = n % 2 != 0 ? x : RAY;\\n\\n for (n /= 2; n != 0; n /= 2) {\\n x = rmul(x, x);\\n\\n if (n % 2 != 0) {\\n z = rmul(z, x);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa0b7c69e573cd75641300eaa6f8dffd94d1334b1561079e75aa9e740689f30f7\",\"license\":\"AGPL-3.0-or-later\"}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b50610d79806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063a99891c514610046578063be9eea981461006f578063c39db98314610082575b600080fd5b610059610054366004610b52565b610095565b6040516100669190610c4f565b60405180910390f35b61005961007d366004610bcf565b6100cd565b610059610090366004610bcf565b610195565b60606000806100a78560048189610d1b565b8101906100b49190610bcf565b915091506100c282826100cd565b979650505050505050565b606060006100da846101ec565b9050600061011e6101196000610114736b175474e89094c44da98b954eedeac495271d0f61010f61010a8b61030d565b610572565b610586565b610692565b6106f2565b90508361012b8284610705565b1061016f576040518060400160405280601781526020017f446562744272696467654e6f744166666f726461626c650000000000000000008152509250505061018f565b604051806040016040528060028152602001614f4b60f01b815250925050505b92915050565b606063be9eea9860e01b83836040516024016101b2929190610d0d565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152905092915050565b600080735ef30b9986345249bc32d8928b7ee64de9435e3990506000816001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b15801561024157600080fd5b505afa158015610255573d6000803e3d6000fd5b505050506040513d602081101561026b57600080fd5b5051905060008061027c8487610736565b915091506000836001600160a01b0316632424be5c84846040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050604080518083038186803b1580156102d657600080fd5b505afa1580156102ea573d6000803e3d6000fd5b505050506040513d604081101561030057600080fd5b5051979650505050505050565b6000735ef30b9986345249bc32d8928b7ee64de9435e3981806103308386610736565b915091506000836001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b15801561036f57600080fd5b505afa158015610383573d6000803e3d6000fd5b505050506040513d602081101561039957600080fd5b505160408051636cb1c69b60e11b81526004810186905290519192506000916001600160a01b0384169163d9638d369160248083019260a0929190829003018186803b1580156103e857600080fd5b505afa1580156103fc573d6000803e3d6000fd5b505050506040513d60a081101561041257600080fd5b5060200151604080516309092f9760e21b8152600481018790526001600160a01b038681166024830152825193945060009390861692632424be5c9260448082019391829003018186803b15801561046957600080fd5b505afa15801561047d573d6000803e3d6000fd5b505050506040513d604081101561049357600080fd5b5060209081015160408051633612d9a360e11b81526001600160a01b038881166004830152915192945060009391871692636c25b34692602480840193919291829003018186803b1580156104e757600080fd5b505afa1580156104fb573d6000803e3d6000fd5b505050506040513d602081101561051157600080fd5b50519050600061052a610524848661082b565b8361088e565b90506b033b2e3c9fd0803ce800000081049850806105548a6b033b2e3c9fd0803ce800000061082b565b1061055f5788610564565b886001015b9a9950505050505050505050565b600061018f82670df27a2cdf4480006108de565b6000610590610aad565b604051635a860c8760e01b815273a004a5afba04b74037e9e52ba1f7eb02b5e6150990635a860c87906105c7908790600401610c3b565b60806040518083038186803b1580156105df57600080fd5b505afa1580156105f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106179190610af3565b9050828160000151111561062f57600091505061018f565b828160200151111561064557600191505061018f565b828160400151111561065b57600291505061018f565b828160600151111561067157600391505061018f565b60405162461bcd60e51b815260040161068990610cbf565b60405180910390fd5b600061069d82610906565b6106eb836106c2576106ad61092a565b83600481106106b857fe5b60200201516106e6565b6106e66106cd61092a565b84600481106106d857fe5b6020020151620249f0610964565b6109b3565b9392505050565b600061018f826107006109d5565b61082b565b60008161072761071d85670de0b6b3a764000061082b565b6002855b04610964565b8161072e57fe5b049392505050565b600080836001600160a01b0316632c2cb9fd846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561077d57600080fd5b505afa158015610791573d6000803e3d6000fd5b505050506040513d60208110156107a757600080fd5b505160408051632726b07360e01b81526004810186905290519193506001600160a01b03861691632726b07391602480820192602092909190829003018186803b1580156107f457600080fd5b505afa158015610808573d6000803e3d6000fd5b505050506040513d602081101561081e57600080fd5b5051919491935090915050565b60008115806108465750508082028282828161084357fe5b04145b61018f576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b8082038281111561018f576040805162461bcd60e51b815260206004820152601560248201527464732d6d6174682d7375622d756e646572666c6f7760581b604482015290519081900360640190fd5b6000670de0b6b3a76400006107276108f6858561082b565b6002670de0b6b3a7640000610721565b60048111156109275760405162461bcd60e51b815260040161068990610c62565b50565b610932610ad5565b6040518060800160405280621e8480815260200162249f008152602001622b7cd08152602001623567e0815250905090565b8082018281101561018f576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6164642d6f766572666c6f7760601b604482015290519081900360640190fd5b600060646109c78361070060646014610964565b816109ce57fe5b0492915050565b60008073169e633a2d1e6c10dd91238ba11c4a708dfef37c6001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610a2557600080fd5b505afa158015610a39573d6000803e3d6000fd5b505050506040513d6020811015610a4f57600080fd5b5051905060008113610aa8576040805162461bcd60e51b815260206004820152601b60248201527f5f67657447656c61746f47617350726963653a306f7242656c6f770000000000604482015290519081900360640190fd5b905090565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b60405180608001604052806004906020820280368337509192915050565b600060808284031215610b04578081fd5b6040516080810181811067ffffffffffffffff82111715610b2157fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b60008060008060608587031215610b67578283fd5b84359350602085013567ffffffffffffffff80821115610b85578485fd5b818701915087601f830112610b98578485fd5b813581811115610ba6578586fd5b886020828501011115610bb7578586fd5b95986020929092019750949560400135945092505050565b60008060408385031215610be1578182fd5b50508035926020909101359150565b60008151808452815b81811015610c1557602081850181015186830182015201610bf9565b81811115610c265782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6000602082526106eb6020830184610bf0565b6020808252603e908201527f4647656c61746f446562744272696467652e5f676574476173436f73744d616b60408201527f6572546f4d616b65723a20696e76616c696420726f75746520696e6465780000606082015260800190565b6020808252602e908201527f4647656c61746f446562744272696467652e5f676574466c6173684c6f616e5260408201526d1bdd5d194e881a5b1b1a5c5d5a5960921b606082015260800190565b918252602082015260400190565b60008085851115610d2a578182fd5b83861115610d36578182fd5b505082019391909203915056fea264697066735822122004aae87907141d31e49c23db1aa471a5723120691650e4fde15eb6b9c612e79d64736f6c63430007040033", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063a99891c514610046578063be9eea981461006f578063c39db98314610082575b600080fd5b610059610054366004610b52565b610095565b6040516100669190610c4f565b60405180910390f35b61005961007d366004610bcf565b6100cd565b610059610090366004610bcf565b610195565b60606000806100a78560048189610d1b565b8101906100b49190610bcf565b915091506100c282826100cd565b979650505050505050565b606060006100da846101ec565b9050600061011e6101196000610114736b175474e89094c44da98b954eedeac495271d0f61010f61010a8b61030d565b610572565b610586565b610692565b6106f2565b90508361012b8284610705565b1061016f576040518060400160405280601781526020017f446562744272696467654e6f744166666f726461626c650000000000000000008152509250505061018f565b604051806040016040528060028152602001614f4b60f01b815250925050505b92915050565b606063be9eea9860e01b83836040516024016101b2929190610d0d565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152905092915050565b600080735ef30b9986345249bc32d8928b7ee64de9435e3990506000816001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b15801561024157600080fd5b505afa158015610255573d6000803e3d6000fd5b505050506040513d602081101561026b57600080fd5b5051905060008061027c8487610736565b915091506000836001600160a01b0316632424be5c84846040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050604080518083038186803b1580156102d657600080fd5b505afa1580156102ea573d6000803e3d6000fd5b505050506040513d604081101561030057600080fd5b5051979650505050505050565b6000735ef30b9986345249bc32d8928b7ee64de9435e3981806103308386610736565b915091506000836001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b15801561036f57600080fd5b505afa158015610383573d6000803e3d6000fd5b505050506040513d602081101561039957600080fd5b505160408051636cb1c69b60e11b81526004810186905290519192506000916001600160a01b0384169163d9638d369160248083019260a0929190829003018186803b1580156103e857600080fd5b505afa1580156103fc573d6000803e3d6000fd5b505050506040513d60a081101561041257600080fd5b5060200151604080516309092f9760e21b8152600481018790526001600160a01b038681166024830152825193945060009390861692632424be5c9260448082019391829003018186803b15801561046957600080fd5b505afa15801561047d573d6000803e3d6000fd5b505050506040513d604081101561049357600080fd5b5060209081015160408051633612d9a360e11b81526001600160a01b038881166004830152915192945060009391871692636c25b34692602480840193919291829003018186803b1580156104e757600080fd5b505afa1580156104fb573d6000803e3d6000fd5b505050506040513d602081101561051157600080fd5b50519050600061052a610524848661082b565b8361088e565b90506b033b2e3c9fd0803ce800000081049850806105548a6b033b2e3c9fd0803ce800000061082b565b1061055f5788610564565b886001015b9a9950505050505050505050565b600061018f82670df27a2cdf4480006108de565b6000610590610aad565b604051635a860c8760e01b815273a004a5afba04b74037e9e52ba1f7eb02b5e6150990635a860c87906105c7908790600401610c3b565b60806040518083038186803b1580156105df57600080fd5b505afa1580156105f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106179190610af3565b9050828160000151111561062f57600091505061018f565b828160200151111561064557600191505061018f565b828160400151111561065b57600291505061018f565b828160600151111561067157600391505061018f565b60405162461bcd60e51b815260040161068990610cbf565b60405180910390fd5b600061069d82610906565b6106eb836106c2576106ad61092a565b83600481106106b857fe5b60200201516106e6565b6106e66106cd61092a565b84600481106106d857fe5b6020020151620249f0610964565b6109b3565b9392505050565b600061018f826107006109d5565b61082b565b60008161072761071d85670de0b6b3a764000061082b565b6002855b04610964565b8161072e57fe5b049392505050565b600080836001600160a01b0316632c2cb9fd846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561077d57600080fd5b505afa158015610791573d6000803e3d6000fd5b505050506040513d60208110156107a757600080fd5b505160408051632726b07360e01b81526004810186905290519193506001600160a01b03861691632726b07391602480820192602092909190829003018186803b1580156107f457600080fd5b505afa158015610808573d6000803e3d6000fd5b505050506040513d602081101561081e57600080fd5b5051919491935090915050565b60008115806108465750508082028282828161084357fe5b04145b61018f576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b8082038281111561018f576040805162461bcd60e51b815260206004820152601560248201527464732d6d6174682d7375622d756e646572666c6f7760581b604482015290519081900360640190fd5b6000670de0b6b3a76400006107276108f6858561082b565b6002670de0b6b3a7640000610721565b60048111156109275760405162461bcd60e51b815260040161068990610c62565b50565b610932610ad5565b6040518060800160405280621e8480815260200162249f008152602001622b7cd08152602001623567e0815250905090565b8082018281101561018f576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6164642d6f766572666c6f7760601b604482015290519081900360640190fd5b600060646109c78361070060646014610964565b816109ce57fe5b0492915050565b60008073169e633a2d1e6c10dd91238ba11c4a708dfef37c6001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610a2557600080fd5b505afa158015610a39573d6000803e3d6000fd5b505050506040513d6020811015610a4f57600080fd5b5051905060008113610aa8576040805162461bcd60e51b815260206004820152601b60248201527f5f67657447656c61746f47617350726963653a306f7242656c6f770000000000604482015290519081900360640190fd5b905090565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b60405180608001604052806004906020820280368337509192915050565b600060808284031215610b04578081fd5b6040516080810181811067ffffffffffffffff82111715610b2157fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b60008060008060608587031215610b67578283fd5b84359350602085013567ffffffffffffffff80821115610b85578485fd5b818701915087601f830112610b98578485fd5b813581811115610ba6578586fd5b886020828501011115610bb7578586fd5b95986020929092019750949560400135945092505050565b60008060408385031215610be1578182fd5b50508035926020909101359150565b60008151808452815b81811015610c1557602081850181015186830182015201610bf9565b81811115610c265782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6000602082526106eb6020830184610bf0565b6020808252603e908201527f4647656c61746f446562744272696467652e5f676574476173436f73744d616b60408201527f6572546f4d616b65723a20696e76616c696420726f75746520696e6465780000606082015260800190565b6020808252602e908201527f4647656c61746f446562744272696467652e5f676574466c6173684c6f616e5260408201526d1bdd5d194e881a5b1b1a5c5d5a5960921b606082015260800190565b918252602082015260400190565b60008085851115610d2a578182fd5b83861115610d36578182fd5b505082019391909203915056fea264697066735822122004aae87907141d31e49c23db1aa471a5723120691650e4fde15eb6b9c612e79d64736f6c63430007040033", "devdoc": { "author": "Gelato Team", "kind": "dev", "methods": { "getConditionData(uint256,uint256)": { "details": "Use the return for your Task's Condition.data field off-chain.WARNING _ratioLimit should be in wad standard.", "returns": { "_0": "The encoded payload for your Task's Condition.data field." } }, "isAffordable(uint256,uint256)": { "details": "Check if the debt refinancing action is affordable.WARNING _ratioLimit should be in wad standard.", "params": { "_ratioLimit": "the maximum limit define by the user up on which the debt is too expensive for him", "_vaultId": "The id of the Maker vault" }, "returns": { "_0": "OK if the Debt Bridge is affordable, otherwise some error message." } }, "ok(uint256,bytes,uint256)": { "details": "A standard interface for GelatoCore to read Conditions", "params": { "_conditionData": "The data you get from `getConditionData()`" }, "returns": { "_0": "OK if the Condition is there, else some error message." } } }, "title": "ConditionDebtBridgeIsAffordable", "version": 1 }, "userdoc": { "kind": "user", "methods": { "getConditionData(uint256,uint256)": { "notice": "Convenience function for off-chain _conditionData encoding" }, "isAffordable(uint256,uint256)": { "notice": "Specific implementation of this Condition's ok function" }, "ok(uint256,bytes,uint256)": { "notice": "Standard GelatoCore system function" } }, "notice": "Condition checking if Debt Refinance is affordable.", "version": 1 }, "storageLayout": { "storage": [], "types": null } }