diff --git a/contracts/contracts/connectors/ConnectGelatoDataFullMakerToMaker.sol b/contracts/contracts/connectors/ConnectGelatoDataFullMakerToMaker.sol index 66c1cba..82cb5bf 100644 --- a/contracts/contracts/connectors/ConnectGelatoDataFullMakerToMaker.sol +++ b/contracts/contracts/connectors/ConnectGelatoDataFullMakerToMaker.sol @@ -51,7 +51,7 @@ contract ConnectGelatoDataFullMakerToMaker is ConnectorInterface { // solhint-disable const-name-snakecase string public constant override name = - "ConnectGelatoDataFullMakerToMaker-v1.0"; + "ConnectGelatoDataFullMakerToMaker-v2.0"; uint256 internal immutable _id; address internal immutable _connectGelatoExecutorPayment; diff --git a/deployments/mainnet/ConnectGelatoDataFullMakerToMaker.json b/deployments/mainnet/ConnectGelatoDataFullMakerToMaker.json index 1707659..0fda36a 100644 --- a/deployments/mainnet/ConnectGelatoDataFullMakerToMaker.json +++ b/deployments/mainnet/ConnectGelatoDataFullMakerToMaker.json @@ -1,5 +1,5 @@ { - "address": "0xC853d1C2fa720FB12848AEceFcbB6e05bA16476c", + "address": "0xB809a89cBF9e6C9c717AC99763CE07b82ab1c140", "abi": [ { "inputs": [ @@ -134,27 +134,27 @@ "type": "function" } ], - "transactionHash": "0x3a57d71e24ecbfbbc568484969ba94eb791aa6220884d06c984869cfa46ab351", + "transactionHash": "0x3eec78301f1e131a646321172953aed4eb7a1c9e0e2067881016bbec18060cb7", "receipt": { "to": null, "from": "0x5B753BF02a42bC73B5846dfd16a8F2e082b99a6a", - "contractAddress": "0xC853d1C2fa720FB12848AEceFcbB6e05bA16476c", - "transactionIndex": 95, - "gasUsed": "1966644", + "contractAddress": "0xB809a89cBF9e6C9c717AC99763CE07b82ab1c140", + "transactionIndex": 97, + "gasUsed": "1966656", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x6965f69ead151d59b10880ac289acae54b9b94d5a04867ec42eaef952f90f0f4", - "transactionHash": "0x3a57d71e24ecbfbbc568484969ba94eb791aa6220884d06c984869cfa46ab351", + "blockHash": "0xf82b50adb5a7f0ce69b64a9d2782edb2d1e44d1f1d222a628d4c1346b98dacf3", + "transactionHash": "0x3eec78301f1e131a646321172953aed4eb7a1c9e0e2067881016bbec18060cb7", "logs": [], - "blockNumber": 11348674, - "cumulativeGasUsed": "8509514", + "blockNumber": 11359721, + "cumulativeGasUsed": "10019184", "status": 1, "byzantium": true }, - "args": [59, "0x5A6bC81908Df5EC5DC4ad3Bd59AEabA1B86Fc126"], - "solcInputHash": "ec40e61019af6f0225ab4926f4a0148d", - "metadata": "{\"compiler\":{\"version\":\"0.7.4+commit.3f05b770\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"connectGelatoExecutorPayment\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"OK\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"connectorID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_type\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_vaultAId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_vaultBId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_colToken\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_colType\",\"type\":\"string\"}],\"name\":\"getDataAndCastMakerToMaker\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_dsa\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_actionData\",\"type\":\"bytes\"},{\"internalType\":\"enum DataFlow\",\"name\":\"\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"termsOk\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"connectorID()\":{\"details\":\"Connector Details\"},\"getDataAndCastMakerToMaker(uint256,uint256,address,string)\":{\"details\":\"payable to be compatible in conjunction with DSA.cast payable target\",\"params\":{\"_colToken\":\"vault's col token address .\",\"_colType\":\"colType of the new vault. example : ETH-B, ETH-A.\",\"_vaultAId\":\"Id of the unsafe vault of the client of Vault A Collateral.\",\"_vaultBId\":\"Id of the vault B Collateral of the client.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getDataAndCastMakerToMaker(uint256,uint256,address,string)\":{\"notice\":\"Entry Point for DSA.cast DebtBridge from e.g ETH-A to ETH-B\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/contracts/connectors/ConnectGelatoDataFullMakerToMaker.sol\":\"ConnectGelatoDataFullMakerToMaker\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@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/connectors/ConnectGelatoDataFullMakerToMaker.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\npragma experimental ABIEncoderV2;\\n\\nimport {GelatoBytes} from \\\"../../lib/GelatoBytes.sol\\\";\\nimport {sub} from \\\"../../vendor/DSMath.sol\\\";\\nimport {\\n AccountInterface,\\n ConnectorInterface\\n} from \\\"../../interfaces/InstaDapp/IInstaDapp.sol\\\";\\nimport {\\n IConnectInstaPoolV2\\n} from \\\"../../interfaces/InstaDapp/connectors/IConnectInstaPoolV2.sol\\\";\\nimport {\\n DAI,\\n CONNECT_MAKER,\\n INSTA_POOL_V2\\n} from \\\"../../constants/CInstaDapp.sol\\\";\\nimport {\\n _getMakerVaultDebt,\\n _getMakerVaultCollateralBalance,\\n _isVaultOwner\\n} from \\\"../../functions/dapps/FMaker.sol\\\";\\nimport {\\n _encodeFlashPayback\\n} from \\\"../../functions/InstaDapp/connectors/FInstaPoolV2.sol\\\";\\nimport {\\n _encodePaybackMakerVault,\\n _encodedWithdrawMakerVault,\\n _encodeOpenMakerVault,\\n _encodedDepositMakerVault,\\n _encodeBorrowMakerVault\\n} from \\\"../../functions/InstaDapp/connectors/FConnectMaker.sol\\\";\\nimport {\\n _encodePayExecutor\\n} from \\\"../../functions/InstaDapp/connectors/FConnectGelatoExecutorPayment.sol\\\";\\nimport {_getGelatoExecutorFees} from \\\"../../functions/gelato/FGelato.sol\\\";\\nimport {\\n _getFlashLoanRoute,\\n _getGasCostMakerToMaker,\\n _getRealisedDebt\\n} from \\\"../../functions/gelato/FGelatoDebtBridge.sol\\\";\\nimport {\\n DataFlow\\n} from \\\"@gelatonetwork/core/contracts/gelato_core/interfaces/IGelatoCore.sol\\\";\\n\\ncontract ConnectGelatoDataFullMakerToMaker is ConnectorInterface {\\n using GelatoBytes for bytes;\\n\\n string public constant OK = \\\"OK\\\";\\n\\n // solhint-disable const-name-snakecase\\n string public constant override name =\\n \\\"ConnectGelatoDataFullMakerToMaker-v1.0\\\";\\n uint256 internal immutable _id;\\n address internal immutable _connectGelatoExecutorPayment;\\n\\n constructor(uint256 id, address connectGelatoExecutorPayment) {\\n _id = id;\\n _connectGelatoExecutorPayment = connectGelatoExecutorPayment;\\n }\\n\\n /// @dev Connector Details\\n function connectorID()\\n external\\n view\\n override\\n returns (uint256 _type, uint256 id)\\n {\\n (_type, id) = (1, _id); // Should put specific value.\\n }\\n\\n // ====== ACTION TERMS CHECK ==========\\n // Overriding IGelatoAction's function (optional)\\n function termsOk(\\n uint256, // taskReceipId\\n address _dsa,\\n bytes calldata _actionData,\\n DataFlow,\\n uint256, // value\\n uint256 // cycleId\\n ) public view returns (string memory) {\\n (uint256 vaultAId, , , ) =\\n abi.decode(_actionData[4:], (uint256, uint256, address, string));\\n\\n if (vaultAId == 0)\\n return \\\"ConnectGelatoDataFullMakerToMaker: Vault A Id is not valid\\\";\\n if (!_isVaultOwner(vaultAId, _dsa))\\n return\\n \\\"ConnectGelatoDataFullMakerToMaker: Vault A not owned by dsa\\\";\\n return OK;\\n }\\n\\n /// @notice Entry Point for DSA.cast DebtBridge from e.g ETH-A to ETH-B\\n /// @dev payable to be compatible in conjunction with DSA.cast payable target\\n /// @param _vaultAId Id of the unsafe vault of the client of Vault A Collateral.\\n /// @param _vaultBId Id of the vault B Collateral of the client.\\n /// @param _colToken vault's col token address .\\n /// @param _colType colType of the new vault. example : ETH-B, ETH-A.\\n function getDataAndCastMakerToMaker(\\n uint256 _vaultAId,\\n uint256 _vaultBId,\\n address _colToken,\\n string calldata _colType\\n ) external payable {\\n (address[] memory targets, bytes[] memory datas) =\\n _dataMakerToMaker(_vaultAId, _vaultBId, _colToken, _colType);\\n\\n _cast(targets, datas);\\n }\\n\\n function _cast(address[] memory targets, bytes[] memory datas) internal {\\n // Instapool V2 / FlashLoan call\\n bytes memory castData =\\n abi.encodeWithSelector(\\n AccountInterface.cast.selector,\\n targets,\\n datas,\\n msg.sender // msg.sender == GelatoCore\\n );\\n\\n (bool success, bytes memory returndata) =\\n address(this).delegatecall(castData);\\n if (!success) {\\n returndata.revertWithError(\\n \\\"ConnectGelatoDataFullMakerToMaker._cast:\\\"\\n );\\n }\\n }\\n\\n /* solhint-disable function-max-lines */\\n\\n function _dataMakerToMaker(\\n uint256 _vaultAId,\\n uint256 _vaultBId,\\n address _colToken,\\n string calldata _colType\\n ) internal view returns (address[] memory targets, bytes[] memory datas) {\\n targets = new address[](1);\\n targets[0] = INSTA_POOL_V2;\\n\\n _vaultBId = _isVaultOwner(_vaultBId, address(this)) ? _vaultBId : 0;\\n\\n uint256 wDaiToBorrow = _getRealisedDebt(_getMakerVaultDebt(_vaultAId));\\n uint256 wColToWithdrawFromMaker =\\n _getMakerVaultCollateralBalance(_vaultAId);\\n uint256 route = _getFlashLoanRoute(DAI, wDaiToBorrow);\\n uint256 gasCost = _getGasCostMakerToMaker(_vaultBId == 0, route);\\n uint256 gasFeesPaidFromCol = _getGelatoExecutorFees(gasCost);\\n\\n (address[] memory _targets, bytes[] memory _datas) =\\n _vaultBId == 0\\n ? _spellsMakerToNewMakerVault(\\n _vaultAId,\\n _colToken,\\n _colType,\\n wDaiToBorrow,\\n wColToWithdrawFromMaker,\\n gasFeesPaidFromCol\\n )\\n : _spellsMakerToMaker(\\n _vaultAId,\\n _vaultBId,\\n _colToken,\\n wDaiToBorrow,\\n wColToWithdrawFromMaker,\\n gasFeesPaidFromCol\\n );\\n\\n datas = new bytes[](1);\\n datas[0] = abi.encodeWithSelector(\\n IConnectInstaPoolV2.flashBorrowAndCast.selector,\\n DAI,\\n wDaiToBorrow,\\n route,\\n abi.encode(_targets, _datas)\\n );\\n }\\n\\n function _spellsMakerToNewMakerVault(\\n uint256 _vaultAId,\\n address _colToken,\\n string calldata _colType,\\n uint256 _wDaiToBorrow,\\n uint256 _wColToWithdrawFromMaker,\\n uint256 _gasFeesPaidFromCol\\n ) internal view returns (address[] memory targets, bytes[] memory datas) {\\n targets = new address[](7);\\n targets[0] = CONNECT_MAKER; // payback\\n targets[1] = CONNECT_MAKER; // withdraw\\n targets[2] = CONNECT_MAKER; // open new B vault\\n targets[3] = CONNECT_MAKER; // deposit\\n targets[4] = CONNECT_MAKER; // borrow\\n targets[5] = _connectGelatoExecutorPayment; // payExecutor\\n targets[6] = INSTA_POOL_V2; // flashPayback\\n\\n datas = new bytes[](7);\\n datas[0] = _encodePaybackMakerVault(_vaultAId, uint256(-1), 0, 600);\\n datas[1] = _encodedWithdrawMakerVault(_vaultAId, uint256(-1), 0, 0);\\n datas[2] = _encodeOpenMakerVault(_colType);\\n datas[3] = _encodedDepositMakerVault(\\n 0,\\n sub(_wColToWithdrawFromMaker, _gasFeesPaidFromCol),\\n 0,\\n 0\\n );\\n datas[4] = _encodeBorrowMakerVault(0, 0, 600, 0);\\n datas[5] = _encodePayExecutor(_colToken, _gasFeesPaidFromCol, 0, 0);\\n datas[6] = _encodeFlashPayback(DAI, _wDaiToBorrow, 0, 0);\\n }\\n\\n function _spellsMakerToMaker(\\n uint256 _vaultAId,\\n uint256 _vaultBId,\\n address _colToken,\\n uint256 _wDaiToBorrow,\\n uint256 _wColToWithdrawFromMaker,\\n uint256 _gasFeesPaidFromCol\\n ) internal view returns (address[] memory targets, bytes[] memory datas) {\\n targets = new address[](6);\\n targets[0] = CONNECT_MAKER; // payback\\n targets[1] = CONNECT_MAKER; // withdraw\\n targets[2] = CONNECT_MAKER; // deposit\\n targets[3] = CONNECT_MAKER; // borrow\\n targets[4] = _connectGelatoExecutorPayment; // payExecutor\\n targets[5] = INSTA_POOL_V2; // flashPayback\\n\\n datas = new bytes[](6);\\n datas[0] = _encodePaybackMakerVault(_vaultAId, uint256(-1), 0, 600);\\n datas[1] = _encodedWithdrawMakerVault(_vaultAId, uint256(-1), 0, 0);\\n datas[2] = _encodedDepositMakerVault(\\n _vaultBId,\\n sub(_wColToWithdrawFromMaker, _gasFeesPaidFromCol),\\n 0,\\n 0\\n );\\n datas[3] = _encodeBorrowMakerVault(_vaultBId, 0, 600, 0);\\n datas[4] = _encodePayExecutor(_colToken, _gasFeesPaidFromCol, 0, 0);\\n datas[5] = _encodeFlashPayback(DAI, _wDaiToBorrow, 0, 0);\\n }\\n\\n /* solhint-enable function-max-lines */\\n}\\n\",\"keccak256\":\"0xf6bb423e8c90f99c1dc627eab4a2a78f463b601afcdf2f9ed69198615b4a6deb\",\"license\":\"UNLICENSED\"},\"contracts/functions/InstaDapp/connectors/FConnectGelatoExecutorPayment.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\nimport {\\n IConnectGelatoExecutorPayment\\n} from \\\"../../../interfaces/InstaDapp/connectors/IConnectGelatoExecutorPayment.sol\\\";\\n\\nfunction _encodePayExecutor(\\n address _token,\\n uint256 _amt,\\n uint256 _getId,\\n uint256 _setId\\n) pure returns (bytes memory) {\\n return\\n abi.encodeWithSelector(\\n IConnectGelatoExecutorPayment.payExecutor.selector,\\n _token,\\n _amt,\\n _getId,\\n _setId\\n );\\n}\\n\",\"keccak256\":\"0xf10adbeb5605a93cd85113efce1131bd2f2140045c7384fb2a0720865e245993\",\"license\":\"UNLICENSED\"},\"contracts/functions/InstaDapp/connectors/FConnectMaker.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\nimport {\\n IConnectMaker\\n} from \\\"../../../interfaces/InstaDapp/connectors/IConnectMaker.sol\\\";\\n\\nfunction _encodeOpenMakerVault(string memory _colType)\\n pure\\n returns (bytes memory)\\n{\\n return abi.encodeWithSelector(IConnectMaker.open.selector, _colType);\\n}\\n\\nfunction _encodeBorrowMakerVault(\\n uint256 _vaultId,\\n uint256 _amt,\\n uint256 _getId,\\n uint256 _setId\\n) pure returns (bytes memory) {\\n return\\n abi.encodeWithSelector(\\n IConnectMaker.borrow.selector,\\n _vaultId,\\n _amt,\\n _getId,\\n _setId\\n );\\n}\\n\\nfunction _encodedDepositMakerVault(\\n uint256 _vaultId,\\n uint256 _amt,\\n uint256 _getId,\\n uint256 _setId\\n) pure returns (bytes memory) {\\n return\\n abi.encodeWithSelector(\\n IConnectMaker.deposit.selector,\\n _vaultId,\\n _amt,\\n _getId,\\n _setId\\n );\\n}\\n\\nfunction _encodePaybackMakerVault(\\n uint256 _vaultId,\\n uint256 _amt,\\n uint256 _getId,\\n uint256 _setId\\n) pure returns (bytes memory) {\\n return\\n abi.encodeWithSelector(\\n IConnectMaker.payback.selector,\\n _vaultId,\\n _amt,\\n _getId,\\n _setId\\n );\\n}\\n\\nfunction _encodedWithdrawMakerVault(\\n uint256 _vaultId,\\n uint256 _amt,\\n uint256 _getId,\\n uint256 _setId\\n) pure returns (bytes memory) {\\n return\\n abi.encodeWithSelector(\\n IConnectMaker.withdraw.selector,\\n _vaultId,\\n _amt,\\n _getId,\\n _setId\\n );\\n}\\n\",\"keccak256\":\"0xfa8041540cf9da58828fac9ba047fb07b6bcbbbad32104509b39fd80179b268e\",\"license\":\"UNLICENSED\"},\"contracts/functions/InstaDapp/connectors/FInstaPoolV2.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\nimport {\\n IConnectInstaPoolV2\\n} from \\\"../../../interfaces/InstaDapp/connectors/IConnectInstaPoolV2.sol\\\";\\n\\nfunction _encodeFlashPayback(\\n address _token,\\n uint256 _amt,\\n uint256 _getId,\\n uint256 _setId\\n) pure returns (bytes memory) {\\n return\\n abi.encodeWithSelector(\\n IConnectInstaPoolV2.flashPayback.selector,\\n _token,\\n _amt,\\n _getId,\\n _setId\\n );\\n}\\n\",\"keccak256\":\"0x8fe117434ff22e07779d28853cd904266601d05801b879831e10ba1e2dd01052\",\"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/connectors/IConnectGelatoExecutorPayment.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\nimport {ConnectorInterface} from \\\"../IInstaDapp.sol\\\";\\n\\ninterface IConnectGelatoExecutorPayment is ConnectorInterface {\\n function payExecutor(\\n address _token,\\n uint256 _amt,\\n uint256 _getId,\\n uint256 _setId\\n ) external payable;\\n}\\n\",\"keccak256\":\"0x91bd2005f4cb1b8b1d56a9a25414a1d4b0149696da45bad0833afc785222da7b\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/InstaDapp/connectors/IConnectInstaPoolV2.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\ninterface IConnectInstaPoolV2 {\\n function flashBorrowAndCast(\\n address token,\\n uint256 amt,\\n uint256 route,\\n bytes memory data\\n ) external payable;\\n\\n function flashPayback(\\n address token,\\n uint256 amt,\\n uint256 getId,\\n uint256 setId\\n ) external payable;\\n}\\n\",\"keccak256\":\"0x30c1635f1efcf446ce7352a3a4c66a1b38e71e6203783d940639a8cceeb36e5e\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/InstaDapp/connectors/IConnectMaker.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\ninterface IConnectMaker {\\n function payback(\\n uint256 vault,\\n uint256 amt,\\n uint256 getId,\\n uint256 setId\\n ) external payable;\\n\\n function borrow(\\n uint256 vault,\\n uint256 amt,\\n uint256 getId,\\n uint256 setId\\n ) external payable;\\n\\n function open(string calldata colType)\\n external\\n payable\\n returns (uint256 vault);\\n\\n function withdraw(\\n uint256 vault,\\n uint256 amt,\\n uint256 getId,\\n uint256 setId\\n ) external payable;\\n\\n function deposit(\\n uint256 vault,\\n uint256 amt,\\n uint256 getId,\\n uint256 setId\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xc8c479e941784f6b470b2244e777f1cdc0a7a8e2af55de3dae199018e6d9d131\",\"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": "0x60c060405234801561001057600080fd5b5060405162002346380380620023468339810160408190526100319161004c565b60809190915260601b6001600160601b03191660a052610087565b6000806040838503121561005e578182fd5b825160208401519092506001600160a01b038116811461007c578182fd5b809150509250929050565b60805160a05160601c612293620000b360003980610d33528061106652508061014d52506122936000f3fe60806040526004361061004a5760003560e01c806306fdde031461004f57806345c4b9b51461007a578063d48fe2801461008f578063eb15f781146100a4578063eb9e7126146100c7575b600080fd5b34801561005b57600080fd5b506100646100e7565b6040516100719190611f92565b60405180910390f35b61008d610088366004611d92565b610103565b005b34801561009b57600080fd5b5061006461012a565b3480156100b057600080fd5b506100b9610148565b604051610071929190612050565b3480156100d357600080fd5b506100646100e2366004611c5e565b61016f565b6040518060600160405280602681526020016122386026913981565b6060806101138787878787610212565b9150915061012182826103fc565b50505050505050565b604051806040016040528060028152602001614f4b60f01b81525081565b6001907f000000000000000000000000000000000000000000000000000000000000000090565b60606000610180866004818a612082565b81019061018d9190611ce5565b505050905080600014156101bc576040518060600160405280603a815260200161219b603a9139915050610207565b6101c681896104e0565b6101eb576040518060600160405280603b81526020016121fd603b9139915050610207565b50506040805180820190915260028152614f4b60f01b60208201525b979650505050505050565b6040805160018082528183019092526060918291906020808301908036833701905050915073eb4bf86589f808f90eec8e964dbf16bd4d2849058260008151811061025957fe5b60200260200101906001600160a01b031690816001600160a01b03168152505061028386306104e0565b61028e576000610290565b855b955060006102a56102a0896106ea565b61094f565b905060006102b289610963565b905060006102d4736b175474e89094c44da98b954eedeac495271d0f84610a84565b905060006102e38a1583610b90565b905060006102f082610bf0565b90506060808c1561030e576103098e8e8e8a8a88610c03565b61031d565b61031d8e8d8d8d8b8b89610ef3565b604080516001808252818301909252929450909250816020015b6060815260200190600190039081610337579050509750638d0a9b1b60e01b736b175474e89094c44da98b954eedeac495271d0f88878585604051602001610380929190611f26565b60408051601f19818403018152908290526103a094939291602401611eef565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050886000815181106103e057fe5b6020026020010181905250505050505050509550959350505050565b606063e0e90acf60e01b83833360405160240161041b93929190611f54565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050905060006060306001600160a01b03168360405161046c9190611ebf565b600060405180830381855af49150503d80600081146104a7576040519150601f19603f3d011682016040523d82523d6000602084013e6104ac565b606091505b5091509150816104d9576104d96040518060600160405280602881526020016121d5602891398290611278565b5050505050565b6000826104ef575060006106e4565b735ef30b9986345249bc32d8928b7ee64de9435e396001600160a01b0316638161b120846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561054757600080fd5b505afa92505050801561056c57506040513d602081101561056757600080fd5b505160015b6106d3576105786120e0565b806105835750610686565b806040516020018080742326b0b5b2b9172fb4b9ab30bab63a27bbb732b91d60591b81525060150182805190602001908083835b602083106105d65780518252601f1990920191602091820191016105b7565b51815160209384036101000a60001901801990921691161790526040805192909401828103601f190183529384905262461bcd60e51b84526004840181815282516024860152825192965094508493604401925085019080838360005b8381101561064b578181015183820152602001610633565b50505050905090810190601f1680156106785780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b6040805162461bcd60e51b815260206004820152601e60248201527f464d616b65722e5f69735661756c744f776e65723a756e646566696e65640000604482015290519081900360640190fd5b6001600160a01b0383811691161490505b92915050565b6000735ef30b9986345249bc32d8928b7ee64de9435e39818061070d8386611529565b915091506000836001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b15801561074c57600080fd5b505afa158015610760573d6000803e3d6000fd5b505050506040513d602081101561077657600080fd5b505160408051636cb1c69b60e11b81526004810186905290519192506000916001600160a01b0384169163d9638d369160248083019260a0929190829003018186803b1580156107c557600080fd5b505afa1580156107d9573d6000803e3d6000fd5b505050506040513d60a08110156107ef57600080fd5b5060200151604080516309092f9760e21b8152600481018790526001600160a01b038681166024830152825193945060009390861692632424be5c9260448082019391829003018186803b15801561084657600080fd5b505afa15801561085a573d6000803e3d6000fd5b505050506040513d604081101561087057600080fd5b5060209081015160408051633612d9a360e11b81526001600160a01b038881166004830152915192945060009391871692636c25b34692602480840193919291829003018186803b1580156108c457600080fd5b505afa1580156108d8573d6000803e3d6000fd5b505050506040513d60208110156108ee57600080fd5b505190506000610907610901848661161e565b83611681565b90506b033b2e3c9fd0803ce800000081049850806109318a6b033b2e3c9fd0803ce800000061161e565b1061093c5788610941565b886001015b9a9950505050505050505050565b60006106e482670df27a2cdf4480006116d1565b600080735ef30b9986345249bc32d8928b7ee64de9435e3990506000816001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b1580156109b857600080fd5b505afa1580156109cc573d6000803e3d6000fd5b505050506040513d60208110156109e257600080fd5b505190506000806109f38487611529565b915091506000836001600160a01b0316632424be5c84846040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050604080518083038186803b158015610a4d57600080fd5b505afa158015610a61573d6000803e3d6000fd5b505050506040513d6040811015610a7757600080fd5b5051979650505050505050565b6000610a8e611b72565b604051635a860c8760e01b815273a004a5afba04b74037e9e52ba1f7eb02b5e6150990635a860c8790610ac5908790600401611edb565b60806040518083038186803b158015610add57600080fd5b505afa158015610af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b159190611bff565b90508281600001511115610b2d5760009150506106e4565b8281602001511115610b435760019150506106e4565b8281604001511115610b595760029150506106e4565b8281606001511115610b6f5760039150506106e4565b60405162461bcd60e51b8152600401610b8790612002565b60405180910390fd5b6000610b9b82611706565b610be983610bc057610bab61172a565b8360048110610bb657fe5b6020020151610be4565b610be4610bcb61172a565b8460048110610bd657fe5b6020020151620249f0611765565b6117b4565b9392505050565b60006106e482610bfe6117d6565b61161e565b60408051600680825260e082019092526060918291906020820160c08036833701905050915073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600081518110610c4b57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600181518110610c8d57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600281518110610ccf57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600381518110610d1157fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f000000000000000000000000000000000000000000000000000000000000000082600481518110610d5f57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073eb4bf86589f808f90eec8e964dbf16bd4d28490582600581518110610da157fe5b6001600160a01b039290921660209283029190910182015260408051600680825260e082019092529182015b6060815260200190600190039081610dcd579050509050610df58860001960006102586118ae565b81600081518110610e0257fe5b6020026020010181905250610e1c88600019600080611903565b81600181518110610e2957fe5b6020026020010181905250610e4a87610e428686611681565b600080611958565b81600281518110610e5757fe5b6020026020010181905250610e7287600061025860006119ad565b81600381518110610e7f57fe5b6020026020010181905250610e978684600080611a02565b81600481518110610ea457fe5b6020026020010181905250610ed0736b175474e89094c44da98b954eedeac495271d0f86600080611a5f565b81600581518110610edd57fe5b6020026020010181905250965096945050505050565b60408051600780825261010082019092526060918291906020820160e08036833701905050915073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600081518110610f3c57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600181518110610f7e57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600281518110610fc057fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a98260038151811061100257fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a98260048151811061104457fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000000000000000000000000000000000000000000008260058151811061109257fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073eb4bf86589f808f90eec8e964dbf16bd4d284905826006815181106110d457fe5b6001600160a01b039290921660209283029190910182015260408051600780825261010082019092529182015b60608152602001906001900390816111015790505090506111298960001960006102586118ae565b8160008151811061113657fe5b602002602001018190525061115089600019600080611903565b8160018151811061115d57fe5b60200260200101819052506111a787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611abc92505050565b816002815181106111b457fe5b60200260200101819052506111ce6000610e428686611681565b816003815181106111db57fe5b60200260200101819052506111f660008061025860006119ad565b8160048151811061120357fe5b602002602001018190525061121b8884600080611a02565b8160058151811061122857fe5b6020026020010181905250611254736b175474e89094c44da98b954eedeac495271d0f86600080611a5f565b8160068151811061126157fe5b602002602001018190525097509795505050505050565b602082518161128357fe5b066004141561146257602082015162461bcd60e51b6001600160e01b0319821614156113a05760448301925081836040516020018083805190602001908083835b602083106112e35780518252601f1990920191602091820191016112c4565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b6020831061132b5780518252601f19909201916020918201910161130c565b51815160209384036101000a60001901801990921691161790526040805192909401828103601f190183529384905262461bcd60e51b8452600484018181528251602486015282519297509550859450604490930192860191508083836000831561064b578181015183820152602001610633565b816040516020018082805190602001908083835b602083106113d35780518252601f1990920191602091820191016113b4565b51815160001960209485036101000a0190811690199091161790526e2737a2b93937b929b2b632b1ba37b960891b9390910192835260408051601019818603018152600f85019182905262461bcd60e51b90915260138401828152815160338601528151919650945084936053019250908501908083836000831561064b578181015183820152602001610633565b806040516020018082805190602001908083835b602083106114955780518252601f199092019160209182019101611476565b51815160001960209485036101000a01908116901990911617905273556e657870656374656452657475726e6461746160601b9390910192835260408051600b19818603018152601485019182905262461bcd60e51b90915260188401828152815160388601528151919650945084936058019250908501908083836000831561064b578181015183820152602001610633565b600080836001600160a01b0316632c2cb9fd846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561157057600080fd5b505afa158015611584573d6000803e3d6000fd5b505050506040513d602081101561159a57600080fd5b505160408051632726b07360e01b81526004810186905290519193506001600160a01b03861691632726b07391602480820192602092909190829003018186803b1580156115e757600080fd5b505afa1580156115fb573d6000803e3d6000fd5b505050506040513d602081101561161157600080fd5b5051919491935090915050565b60008115806116395750508082028282828161163657fe5b04145b6106e4576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b808203828111156106e4576040805162461bcd60e51b815260206004820152601560248201527464732d6d6174682d7375622d756e646572666c6f7760581b604482015290519081900360640190fd5b6000670de0b6b3a76400006116f76116e9858561161e565b6706f05b59d3b20000611765565b816116fe57fe5b049392505050565b60048111156117275760405162461bcd60e51b8152600401610b8790611fa5565b50565b611732611b9a565b6040518060800160405280621e8480815260200162249f008152602001622b7cd08152602001623567e081525090505b90565b808201828110156106e4576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6164642d6f766572666c6f7760601b604482015290519081900360640190fd5b600060646117c883610bfe60646014611765565b816117cf57fe5b0492915050565b60008073169e633a2d1e6c10dd91238ba11c4a708dfef37c6001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561182657600080fd5b505afa15801561183a573d6000803e3d6000fd5b505050506040513d602081101561185057600080fd5b50519050600081136118a9576040805162461bcd60e51b815260206004820152601b60248201527f5f67657447656c61746f47617350726963653a306f7242656c6f770000000000604482015290519081900360640190fd5b905090565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316636af06d1b60e11b179052949350505050565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b03166319d3ec6d60e21b179052949350505050565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316632505c3d960e01b179052949350505050565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b031663088eca4160e11b179052949350505050565b604080516001600160a01b0386166024820152604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316631911336f60e01b179052949350505050565b604080516001600160a01b0386166024820152604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316630427301d60e31b179052949350505050565b60405160206024820181815283516044840152835160609363e4dcb06b60e01b9386939283926064019185019080838360005b83811015611b07578181015183820152602001611aef565b50505050905090810190601f168015611b345780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990961695909517909452509192505050919050565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b60405180608001604052806004906020820280368337509192915050565b60008083601f840112611bc9578182fd5b50813567ffffffffffffffff811115611be0578182fd5b602083019150836020828501011115611bf857600080fd5b9250929050565b600060808284031215611c10578081fd5b6040516080810181811067ffffffffffffffff82111715611c2d57fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600080600080600080600060c0888a031215611c78578283fd5b873596506020880135611c8a81612185565b9550604088013567ffffffffffffffff811115611ca5578384fd5b611cb18a828b01611bb8565b909650945050606088013560048110611cc8578384fd5b969995985093969295946080840135945060a09093013592915050565b60008060008060808587031215611cfa578384fd5b8435935060208086013593506040860135611d1481612185565b9250606086013567ffffffffffffffff80821115611d30578384fd5b818801915088601f830112611d43578384fd5b813581811115611d4f57fe5b611d61601f8201601f1916850161205e565b91508082528984828501011115611d76578485fd5b8084840185840137810190920192909252939692955090935050565b600080600080600060808688031215611da9578081fd5b85359450602086013593506040860135611dc281612185565b9250606086013567ffffffffffffffff811115611ddd578182fd5b611de988828901611bb8565b969995985093965092949392505050565b6000815180845260208085019450808401835b83811015611e325781516001600160a01b031687529582019590820190600101611e0d565b509495945050505050565b60008282518085526020808601955080818302840101818601855b84811015611e8657601f19868403018952611e74838351611e93565b98840198925090830190600101611e58565b5090979650505050505050565b60008151808452611eab8160208601602086016120aa565b601f01601f19169290920160200192915050565b60008251611ed18184602087016120aa565b9190910192915050565b6001600160a01b0391909116815260200190565b600060018060a01b038616825284602083015283604083015260806060830152611f1c6080830184611e93565b9695505050505050565b600060408252611f396040830185611dfa565b8281036020840152611f4b8185611e3d565b95945050505050565b600060608252611f676060830186611dfa565b8281036020840152611f798186611e3d565b91505060018060a01b0383166040830152949350505050565b600060208252610be96020830184611e93565b6020808252603e908201527f4647656c61746f446562744272696467652e5f676574476173436f73744d616b60408201527f6572546f4d616b65723a20696e76616c696420726f75746520696e6465780000606082015260800190565b6020808252602e908201527f4647656c61746f446562744272696467652e5f676574466c6173684c6f616e5260408201526d1bdd5d194e881a5b1b1a5c5d5a5960921b606082015260800190565b918252602082015260400190565b60405181810167ffffffffffffffff8111828210171561207a57fe5b604052919050565b60008085851115612091578182fd5b8386111561209d578182fd5b5050820193919092039150565b60005b838110156120c55781810151838201526020016120ad565b838111156120d4576000848401525b50505050565b60e01c90565b600060443d10156120f057611762565b600481823e6308c379a061210482516120da565b1461210e57611762565b6040513d600319016004823e80513d67ffffffffffffffff816024840111818411171561213e5750505050611762565b828401925082519150808211156121585750505050611762565b503d8301602082840101111561217057505050611762565b601f01601f1916810160200160405291505090565b6001600160a01b038116811461172757600080fdfe436f6e6e65637447656c61746f4461746146756c6c4d616b6572546f4d616b65723a205661756c742041204964206973206e6f742076616c6964436f6e6e65637447656c61746f4461746146756c6c4d616b6572546f4d616b65722e5f636173743a436f6e6e65637447656c61746f4461746146756c6c4d616b6572546f4d616b65723a205661756c742041206e6f74206f776e656420627920647361436f6e6e65637447656c61746f4461746146756c6c4d616b6572546f4d616b65722d76312e30a2646970667358221220078a95606849d0045d0cf410d3308399b4459607710ee9b5e0ec259a65225f1c64736f6c63430007040033", - "deployedBytecode": "0x60806040526004361061004a5760003560e01c806306fdde031461004f57806345c4b9b51461007a578063d48fe2801461008f578063eb15f781146100a4578063eb9e7126146100c7575b600080fd5b34801561005b57600080fd5b506100646100e7565b6040516100719190611f92565b60405180910390f35b61008d610088366004611d92565b610103565b005b34801561009b57600080fd5b5061006461012a565b3480156100b057600080fd5b506100b9610148565b604051610071929190612050565b3480156100d357600080fd5b506100646100e2366004611c5e565b61016f565b6040518060600160405280602681526020016122386026913981565b6060806101138787878787610212565b9150915061012182826103fc565b50505050505050565b604051806040016040528060028152602001614f4b60f01b81525081565b6001907f000000000000000000000000000000000000000000000000000000000000000090565b60606000610180866004818a612082565b81019061018d9190611ce5565b505050905080600014156101bc576040518060600160405280603a815260200161219b603a9139915050610207565b6101c681896104e0565b6101eb576040518060600160405280603b81526020016121fd603b9139915050610207565b50506040805180820190915260028152614f4b60f01b60208201525b979650505050505050565b6040805160018082528183019092526060918291906020808301908036833701905050915073eb4bf86589f808f90eec8e964dbf16bd4d2849058260008151811061025957fe5b60200260200101906001600160a01b031690816001600160a01b03168152505061028386306104e0565b61028e576000610290565b855b955060006102a56102a0896106ea565b61094f565b905060006102b289610963565b905060006102d4736b175474e89094c44da98b954eedeac495271d0f84610a84565b905060006102e38a1583610b90565b905060006102f082610bf0565b90506060808c1561030e576103098e8e8e8a8a88610c03565b61031d565b61031d8e8d8d8d8b8b89610ef3565b604080516001808252818301909252929450909250816020015b6060815260200190600190039081610337579050509750638d0a9b1b60e01b736b175474e89094c44da98b954eedeac495271d0f88878585604051602001610380929190611f26565b60408051601f19818403018152908290526103a094939291602401611eef565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050886000815181106103e057fe5b6020026020010181905250505050505050509550959350505050565b606063e0e90acf60e01b83833360405160240161041b93929190611f54565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050905060006060306001600160a01b03168360405161046c9190611ebf565b600060405180830381855af49150503d80600081146104a7576040519150601f19603f3d011682016040523d82523d6000602084013e6104ac565b606091505b5091509150816104d9576104d96040518060600160405280602881526020016121d5602891398290611278565b5050505050565b6000826104ef575060006106e4565b735ef30b9986345249bc32d8928b7ee64de9435e396001600160a01b0316638161b120846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561054757600080fd5b505afa92505050801561056c57506040513d602081101561056757600080fd5b505160015b6106d3576105786120e0565b806105835750610686565b806040516020018080742326b0b5b2b9172fb4b9ab30bab63a27bbb732b91d60591b81525060150182805190602001908083835b602083106105d65780518252601f1990920191602091820191016105b7565b51815160209384036101000a60001901801990921691161790526040805192909401828103601f190183529384905262461bcd60e51b84526004840181815282516024860152825192965094508493604401925085019080838360005b8381101561064b578181015183820152602001610633565b50505050905090810190601f1680156106785780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b6040805162461bcd60e51b815260206004820152601e60248201527f464d616b65722e5f69735661756c744f776e65723a756e646566696e65640000604482015290519081900360640190fd5b6001600160a01b0383811691161490505b92915050565b6000735ef30b9986345249bc32d8928b7ee64de9435e39818061070d8386611529565b915091506000836001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b15801561074c57600080fd5b505afa158015610760573d6000803e3d6000fd5b505050506040513d602081101561077657600080fd5b505160408051636cb1c69b60e11b81526004810186905290519192506000916001600160a01b0384169163d9638d369160248083019260a0929190829003018186803b1580156107c557600080fd5b505afa1580156107d9573d6000803e3d6000fd5b505050506040513d60a08110156107ef57600080fd5b5060200151604080516309092f9760e21b8152600481018790526001600160a01b038681166024830152825193945060009390861692632424be5c9260448082019391829003018186803b15801561084657600080fd5b505afa15801561085a573d6000803e3d6000fd5b505050506040513d604081101561087057600080fd5b5060209081015160408051633612d9a360e11b81526001600160a01b038881166004830152915192945060009391871692636c25b34692602480840193919291829003018186803b1580156108c457600080fd5b505afa1580156108d8573d6000803e3d6000fd5b505050506040513d60208110156108ee57600080fd5b505190506000610907610901848661161e565b83611681565b90506b033b2e3c9fd0803ce800000081049850806109318a6b033b2e3c9fd0803ce800000061161e565b1061093c5788610941565b886001015b9a9950505050505050505050565b60006106e482670df27a2cdf4480006116d1565b600080735ef30b9986345249bc32d8928b7ee64de9435e3990506000816001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b1580156109b857600080fd5b505afa1580156109cc573d6000803e3d6000fd5b505050506040513d60208110156109e257600080fd5b505190506000806109f38487611529565b915091506000836001600160a01b0316632424be5c84846040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050604080518083038186803b158015610a4d57600080fd5b505afa158015610a61573d6000803e3d6000fd5b505050506040513d6040811015610a7757600080fd5b5051979650505050505050565b6000610a8e611b72565b604051635a860c8760e01b815273a004a5afba04b74037e9e52ba1f7eb02b5e6150990635a860c8790610ac5908790600401611edb565b60806040518083038186803b158015610add57600080fd5b505afa158015610af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b159190611bff565b90508281600001511115610b2d5760009150506106e4565b8281602001511115610b435760019150506106e4565b8281604001511115610b595760029150506106e4565b8281606001511115610b6f5760039150506106e4565b60405162461bcd60e51b8152600401610b8790612002565b60405180910390fd5b6000610b9b82611706565b610be983610bc057610bab61172a565b8360048110610bb657fe5b6020020151610be4565b610be4610bcb61172a565b8460048110610bd657fe5b6020020151620249f0611765565b6117b4565b9392505050565b60006106e482610bfe6117d6565b61161e565b60408051600680825260e082019092526060918291906020820160c08036833701905050915073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600081518110610c4b57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600181518110610c8d57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600281518110610ccf57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600381518110610d1157fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f000000000000000000000000000000000000000000000000000000000000000082600481518110610d5f57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073eb4bf86589f808f90eec8e964dbf16bd4d28490582600581518110610da157fe5b6001600160a01b039290921660209283029190910182015260408051600680825260e082019092529182015b6060815260200190600190039081610dcd579050509050610df58860001960006102586118ae565b81600081518110610e0257fe5b6020026020010181905250610e1c88600019600080611903565b81600181518110610e2957fe5b6020026020010181905250610e4a87610e428686611681565b600080611958565b81600281518110610e5757fe5b6020026020010181905250610e7287600061025860006119ad565b81600381518110610e7f57fe5b6020026020010181905250610e978684600080611a02565b81600481518110610ea457fe5b6020026020010181905250610ed0736b175474e89094c44da98b954eedeac495271d0f86600080611a5f565b81600581518110610edd57fe5b6020026020010181905250965096945050505050565b60408051600780825261010082019092526060918291906020820160e08036833701905050915073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600081518110610f3c57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600181518110610f7e57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600281518110610fc057fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a98260038151811061100257fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a98260048151811061104457fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000000000000000000000000000000000000000000008260058151811061109257fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073eb4bf86589f808f90eec8e964dbf16bd4d284905826006815181106110d457fe5b6001600160a01b039290921660209283029190910182015260408051600780825261010082019092529182015b60608152602001906001900390816111015790505090506111298960001960006102586118ae565b8160008151811061113657fe5b602002602001018190525061115089600019600080611903565b8160018151811061115d57fe5b60200260200101819052506111a787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611abc92505050565b816002815181106111b457fe5b60200260200101819052506111ce6000610e428686611681565b816003815181106111db57fe5b60200260200101819052506111f660008061025860006119ad565b8160048151811061120357fe5b602002602001018190525061121b8884600080611a02565b8160058151811061122857fe5b6020026020010181905250611254736b175474e89094c44da98b954eedeac495271d0f86600080611a5f565b8160068151811061126157fe5b602002602001018190525097509795505050505050565b602082518161128357fe5b066004141561146257602082015162461bcd60e51b6001600160e01b0319821614156113a05760448301925081836040516020018083805190602001908083835b602083106112e35780518252601f1990920191602091820191016112c4565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b6020831061132b5780518252601f19909201916020918201910161130c565b51815160209384036101000a60001901801990921691161790526040805192909401828103601f190183529384905262461bcd60e51b8452600484018181528251602486015282519297509550859450604490930192860191508083836000831561064b578181015183820152602001610633565b816040516020018082805190602001908083835b602083106113d35780518252601f1990920191602091820191016113b4565b51815160001960209485036101000a0190811690199091161790526e2737a2b93937b929b2b632b1ba37b960891b9390910192835260408051601019818603018152600f85019182905262461bcd60e51b90915260138401828152815160338601528151919650945084936053019250908501908083836000831561064b578181015183820152602001610633565b806040516020018082805190602001908083835b602083106114955780518252601f199092019160209182019101611476565b51815160001960209485036101000a01908116901990911617905273556e657870656374656452657475726e6461746160601b9390910192835260408051600b19818603018152601485019182905262461bcd60e51b90915260188401828152815160388601528151919650945084936058019250908501908083836000831561064b578181015183820152602001610633565b600080836001600160a01b0316632c2cb9fd846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561157057600080fd5b505afa158015611584573d6000803e3d6000fd5b505050506040513d602081101561159a57600080fd5b505160408051632726b07360e01b81526004810186905290519193506001600160a01b03861691632726b07391602480820192602092909190829003018186803b1580156115e757600080fd5b505afa1580156115fb573d6000803e3d6000fd5b505050506040513d602081101561161157600080fd5b5051919491935090915050565b60008115806116395750508082028282828161163657fe5b04145b6106e4576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b808203828111156106e4576040805162461bcd60e51b815260206004820152601560248201527464732d6d6174682d7375622d756e646572666c6f7760581b604482015290519081900360640190fd5b6000670de0b6b3a76400006116f76116e9858561161e565b6706f05b59d3b20000611765565b816116fe57fe5b049392505050565b60048111156117275760405162461bcd60e51b8152600401610b8790611fa5565b50565b611732611b9a565b6040518060800160405280621e8480815260200162249f008152602001622b7cd08152602001623567e081525090505b90565b808201828110156106e4576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6164642d6f766572666c6f7760601b604482015290519081900360640190fd5b600060646117c883610bfe60646014611765565b816117cf57fe5b0492915050565b60008073169e633a2d1e6c10dd91238ba11c4a708dfef37c6001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561182657600080fd5b505afa15801561183a573d6000803e3d6000fd5b505050506040513d602081101561185057600080fd5b50519050600081136118a9576040805162461bcd60e51b815260206004820152601b60248201527f5f67657447656c61746f47617350726963653a306f7242656c6f770000000000604482015290519081900360640190fd5b905090565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316636af06d1b60e11b179052949350505050565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b03166319d3ec6d60e21b179052949350505050565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316632505c3d960e01b179052949350505050565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b031663088eca4160e11b179052949350505050565b604080516001600160a01b0386166024820152604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316631911336f60e01b179052949350505050565b604080516001600160a01b0386166024820152604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316630427301d60e31b179052949350505050565b60405160206024820181815283516044840152835160609363e4dcb06b60e01b9386939283926064019185019080838360005b83811015611b07578181015183820152602001611aef565b50505050905090810190601f168015611b345780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990961695909517909452509192505050919050565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b60405180608001604052806004906020820280368337509192915050565b60008083601f840112611bc9578182fd5b50813567ffffffffffffffff811115611be0578182fd5b602083019150836020828501011115611bf857600080fd5b9250929050565b600060808284031215611c10578081fd5b6040516080810181811067ffffffffffffffff82111715611c2d57fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600080600080600080600060c0888a031215611c78578283fd5b873596506020880135611c8a81612185565b9550604088013567ffffffffffffffff811115611ca5578384fd5b611cb18a828b01611bb8565b909650945050606088013560048110611cc8578384fd5b969995985093969295946080840135945060a09093013592915050565b60008060008060808587031215611cfa578384fd5b8435935060208086013593506040860135611d1481612185565b9250606086013567ffffffffffffffff80821115611d30578384fd5b818801915088601f830112611d43578384fd5b813581811115611d4f57fe5b611d61601f8201601f1916850161205e565b91508082528984828501011115611d76578485fd5b8084840185840137810190920192909252939692955090935050565b600080600080600060808688031215611da9578081fd5b85359450602086013593506040860135611dc281612185565b9250606086013567ffffffffffffffff811115611ddd578182fd5b611de988828901611bb8565b969995985093965092949392505050565b6000815180845260208085019450808401835b83811015611e325781516001600160a01b031687529582019590820190600101611e0d565b509495945050505050565b60008282518085526020808601955080818302840101818601855b84811015611e8657601f19868403018952611e74838351611e93565b98840198925090830190600101611e58565b5090979650505050505050565b60008151808452611eab8160208601602086016120aa565b601f01601f19169290920160200192915050565b60008251611ed18184602087016120aa565b9190910192915050565b6001600160a01b0391909116815260200190565b600060018060a01b038616825284602083015283604083015260806060830152611f1c6080830184611e93565b9695505050505050565b600060408252611f396040830185611dfa565b8281036020840152611f4b8185611e3d565b95945050505050565b600060608252611f676060830186611dfa565b8281036020840152611f798186611e3d565b91505060018060a01b0383166040830152949350505050565b600060208252610be96020830184611e93565b6020808252603e908201527f4647656c61746f446562744272696467652e5f676574476173436f73744d616b60408201527f6572546f4d616b65723a20696e76616c696420726f75746520696e6465780000606082015260800190565b6020808252602e908201527f4647656c61746f446562744272696467652e5f676574466c6173684c6f616e5260408201526d1bdd5d194e881a5b1b1a5c5d5a5960921b606082015260800190565b918252602082015260400190565b60405181810167ffffffffffffffff8111828210171561207a57fe5b604052919050565b60008085851115612091578182fd5b8386111561209d578182fd5b5050820193919092039150565b60005b838110156120c55781810151838201526020016120ad565b838111156120d4576000848401525b50505050565b60e01c90565b600060443d10156120f057611762565b600481823e6308c379a061210482516120da565b1461210e57611762565b6040513d600319016004823e80513d67ffffffffffffffff816024840111818411171561213e5750505050611762565b828401925082519150808211156121585750505050611762565b503d8301602082840101111561217057505050611762565b601f01601f1916810160200160405291505090565b6001600160a01b038116811461172757600080fdfe436f6e6e65637447656c61746f4461746146756c6c4d616b6572546f4d616b65723a205661756c742041204964206973206e6f742076616c6964436f6e6e65637447656c61746f4461746146756c6c4d616b6572546f4d616b65722e5f636173743a436f6e6e65637447656c61746f4461746146756c6c4d616b6572546f4d616b65723a205661756c742041206e6f74206f776e656420627920647361436f6e6e65637447656c61746f4461746146756c6c4d616b6572546f4d616b65722d76312e30a2646970667358221220078a95606849d0045d0cf410d3308399b4459607710ee9b5e0ec259a65225f1c64736f6c63430007040033", + "args": [60, "0x5A6bC81908Df5EC5DC4ad3Bd59AEabA1B86Fc126"], + "solcInputHash": "f356241e44bbb1ebd4fe25347635c673", + "metadata": "{\"compiler\":{\"version\":\"0.7.4+commit.3f05b770\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"connectGelatoExecutorPayment\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"OK\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"connectorID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_type\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_vaultAId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_vaultBId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_colToken\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_colType\",\"type\":\"string\"}],\"name\":\"getDataAndCastMakerToMaker\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_dsa\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_actionData\",\"type\":\"bytes\"},{\"internalType\":\"enum DataFlow\",\"name\":\"\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"termsOk\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"connectorID()\":{\"details\":\"Connector Details\"},\"getDataAndCastMakerToMaker(uint256,uint256,address,string)\":{\"details\":\"payable to be compatible in conjunction with DSA.cast payable target\",\"params\":{\"_colToken\":\"vault's col token address .\",\"_colType\":\"colType of the new vault. example : ETH-B, ETH-A.\",\"_vaultAId\":\"Id of the unsafe vault of the client of Vault A Collateral.\",\"_vaultBId\":\"Id of the vault B Collateral of the client.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getDataAndCastMakerToMaker(uint256,uint256,address,string)\":{\"notice\":\"Entry Point for DSA.cast DebtBridge from e.g ETH-A to ETH-B\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/contracts/connectors/ConnectGelatoDataFullMakerToMaker.sol\":\"ConnectGelatoDataFullMakerToMaker\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@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(2519000), 3140500, 3971000, 4345000];\\n}\\n\\nuint256 constant PREMIUM = 30;\\nuint256 constant VAULT_CREATION_COST = 200000;\\n\",\"keccak256\":\"0x5cca1830963e20e729d4daf462aa9280b10d77a8c18170eb54368d7b410d6671\",\"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/connectors/ConnectGelatoDataFullMakerToMaker.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\npragma experimental ABIEncoderV2;\\n\\nimport {GelatoBytes} from \\\"../../lib/GelatoBytes.sol\\\";\\nimport {sub} from \\\"../../vendor/DSMath.sol\\\";\\nimport {\\n AccountInterface,\\n ConnectorInterface\\n} from \\\"../../interfaces/InstaDapp/IInstaDapp.sol\\\";\\nimport {\\n IConnectInstaPoolV2\\n} from \\\"../../interfaces/InstaDapp/connectors/IConnectInstaPoolV2.sol\\\";\\nimport {\\n DAI,\\n CONNECT_MAKER,\\n INSTA_POOL_V2\\n} from \\\"../../constants/CInstaDapp.sol\\\";\\nimport {\\n _getMakerVaultDebt,\\n _getMakerVaultCollateralBalance,\\n _isVaultOwner\\n} from \\\"../../functions/dapps/FMaker.sol\\\";\\nimport {\\n _encodeFlashPayback\\n} from \\\"../../functions/InstaDapp/connectors/FInstaPoolV2.sol\\\";\\nimport {\\n _encodePaybackMakerVault,\\n _encodedWithdrawMakerVault,\\n _encodeOpenMakerVault,\\n _encodedDepositMakerVault,\\n _encodeBorrowMakerVault\\n} from \\\"../../functions/InstaDapp/connectors/FConnectMaker.sol\\\";\\nimport {\\n _encodePayExecutor\\n} from \\\"../../functions/InstaDapp/connectors/FConnectGelatoExecutorPayment.sol\\\";\\nimport {_getGelatoExecutorFees} from \\\"../../functions/gelato/FGelato.sol\\\";\\nimport {\\n _getFlashLoanRoute,\\n _getGasCostMakerToMaker,\\n _getRealisedDebt\\n} from \\\"../../functions/gelato/FGelatoDebtBridge.sol\\\";\\nimport {\\n DataFlow\\n} from \\\"@gelatonetwork/core/contracts/gelato_core/interfaces/IGelatoCore.sol\\\";\\n\\ncontract ConnectGelatoDataFullMakerToMaker is ConnectorInterface {\\n using GelatoBytes for bytes;\\n\\n string public constant OK = \\\"OK\\\";\\n\\n // solhint-disable const-name-snakecase\\n string public constant override name =\\n \\\"ConnectGelatoDataFullMakerToMaker-v2.0\\\";\\n uint256 internal immutable _id;\\n address internal immutable _connectGelatoExecutorPayment;\\n\\n constructor(uint256 id, address connectGelatoExecutorPayment) {\\n _id = id;\\n _connectGelatoExecutorPayment = connectGelatoExecutorPayment;\\n }\\n\\n /// @dev Connector Details\\n function connectorID()\\n external\\n view\\n override\\n returns (uint256 _type, uint256 id)\\n {\\n (_type, id) = (1, _id); // Should put specific value.\\n }\\n\\n // ====== ACTION TERMS CHECK ==========\\n // Overriding IGelatoAction's function (optional)\\n function termsOk(\\n uint256, // taskReceipId\\n address _dsa,\\n bytes calldata _actionData,\\n DataFlow,\\n uint256, // value\\n uint256 // cycleId\\n ) public view returns (string memory) {\\n (uint256 vaultAId, , , ) =\\n abi.decode(_actionData[4:], (uint256, uint256, address, string));\\n\\n if (vaultAId == 0)\\n return \\\"ConnectGelatoDataFullMakerToMaker: Vault A Id is not valid\\\";\\n if (!_isVaultOwner(vaultAId, _dsa))\\n return\\n \\\"ConnectGelatoDataFullMakerToMaker: Vault A not owned by dsa\\\";\\n return OK;\\n }\\n\\n /// @notice Entry Point for DSA.cast DebtBridge from e.g ETH-A to ETH-B\\n /// @dev payable to be compatible in conjunction with DSA.cast payable target\\n /// @param _vaultAId Id of the unsafe vault of the client of Vault A Collateral.\\n /// @param _vaultBId Id of the vault B Collateral of the client.\\n /// @param _colToken vault's col token address .\\n /// @param _colType colType of the new vault. example : ETH-B, ETH-A.\\n function getDataAndCastMakerToMaker(\\n uint256 _vaultAId,\\n uint256 _vaultBId,\\n address _colToken,\\n string calldata _colType\\n ) external payable {\\n (address[] memory targets, bytes[] memory datas) =\\n _dataMakerToMaker(_vaultAId, _vaultBId, _colToken, _colType);\\n\\n _cast(targets, datas);\\n }\\n\\n function _cast(address[] memory targets, bytes[] memory datas) internal {\\n // Instapool V2 / FlashLoan call\\n bytes memory castData =\\n abi.encodeWithSelector(\\n AccountInterface.cast.selector,\\n targets,\\n datas,\\n msg.sender // msg.sender == GelatoCore\\n );\\n\\n (bool success, bytes memory returndata) =\\n address(this).delegatecall(castData);\\n if (!success) {\\n returndata.revertWithError(\\n \\\"ConnectGelatoDataFullMakerToMaker._cast:\\\"\\n );\\n }\\n }\\n\\n /* solhint-disable function-max-lines */\\n\\n function _dataMakerToMaker(\\n uint256 _vaultAId,\\n uint256 _vaultBId,\\n address _colToken,\\n string calldata _colType\\n ) internal view returns (address[] memory targets, bytes[] memory datas) {\\n targets = new address[](1);\\n targets[0] = INSTA_POOL_V2;\\n\\n _vaultBId = _isVaultOwner(_vaultBId, address(this)) ? _vaultBId : 0;\\n\\n uint256 wDaiToBorrow = _getRealisedDebt(_getMakerVaultDebt(_vaultAId));\\n uint256 wColToWithdrawFromMaker =\\n _getMakerVaultCollateralBalance(_vaultAId);\\n uint256 route = _getFlashLoanRoute(DAI, wDaiToBorrow);\\n uint256 gasCost = _getGasCostMakerToMaker(_vaultBId == 0, route);\\n uint256 gasFeesPaidFromCol = _getGelatoExecutorFees(gasCost);\\n\\n (address[] memory _targets, bytes[] memory _datas) =\\n _vaultBId == 0\\n ? _spellsMakerToNewMakerVault(\\n _vaultAId,\\n _colToken,\\n _colType,\\n wDaiToBorrow,\\n wColToWithdrawFromMaker,\\n gasFeesPaidFromCol\\n )\\n : _spellsMakerToMaker(\\n _vaultAId,\\n _vaultBId,\\n _colToken,\\n wDaiToBorrow,\\n wColToWithdrawFromMaker,\\n gasFeesPaidFromCol\\n );\\n\\n datas = new bytes[](1);\\n datas[0] = abi.encodeWithSelector(\\n IConnectInstaPoolV2.flashBorrowAndCast.selector,\\n DAI,\\n wDaiToBorrow,\\n route,\\n abi.encode(_targets, _datas)\\n );\\n }\\n\\n function _spellsMakerToNewMakerVault(\\n uint256 _vaultAId,\\n address _colToken,\\n string calldata _colType,\\n uint256 _wDaiToBorrow,\\n uint256 _wColToWithdrawFromMaker,\\n uint256 _gasFeesPaidFromCol\\n ) internal view returns (address[] memory targets, bytes[] memory datas) {\\n targets = new address[](7);\\n targets[0] = CONNECT_MAKER; // payback\\n targets[1] = CONNECT_MAKER; // withdraw\\n targets[2] = CONNECT_MAKER; // open new B vault\\n targets[3] = CONNECT_MAKER; // deposit\\n targets[4] = CONNECT_MAKER; // borrow\\n targets[5] = _connectGelatoExecutorPayment; // payExecutor\\n targets[6] = INSTA_POOL_V2; // flashPayback\\n\\n datas = new bytes[](7);\\n datas[0] = _encodePaybackMakerVault(_vaultAId, uint256(-1), 0, 600);\\n datas[1] = _encodedWithdrawMakerVault(_vaultAId, uint256(-1), 0, 0);\\n datas[2] = _encodeOpenMakerVault(_colType);\\n datas[3] = _encodedDepositMakerVault(\\n 0,\\n sub(_wColToWithdrawFromMaker, _gasFeesPaidFromCol),\\n 0,\\n 0\\n );\\n datas[4] = _encodeBorrowMakerVault(0, 0, 600, 0);\\n datas[5] = _encodePayExecutor(_colToken, _gasFeesPaidFromCol, 0, 0);\\n datas[6] = _encodeFlashPayback(DAI, _wDaiToBorrow, 0, 0);\\n }\\n\\n function _spellsMakerToMaker(\\n uint256 _vaultAId,\\n uint256 _vaultBId,\\n address _colToken,\\n uint256 _wDaiToBorrow,\\n uint256 _wColToWithdrawFromMaker,\\n uint256 _gasFeesPaidFromCol\\n ) internal view returns (address[] memory targets, bytes[] memory datas) {\\n targets = new address[](6);\\n targets[0] = CONNECT_MAKER; // payback\\n targets[1] = CONNECT_MAKER; // withdraw\\n targets[2] = CONNECT_MAKER; // deposit\\n targets[3] = CONNECT_MAKER; // borrow\\n targets[4] = _connectGelatoExecutorPayment; // payExecutor\\n targets[5] = INSTA_POOL_V2; // flashPayback\\n\\n datas = new bytes[](6);\\n datas[0] = _encodePaybackMakerVault(_vaultAId, uint256(-1), 0, 600);\\n datas[1] = _encodedWithdrawMakerVault(_vaultAId, uint256(-1), 0, 0);\\n datas[2] = _encodedDepositMakerVault(\\n _vaultBId,\\n sub(_wColToWithdrawFromMaker, _gasFeesPaidFromCol),\\n 0,\\n 0\\n );\\n datas[3] = _encodeBorrowMakerVault(_vaultBId, 0, 600, 0);\\n datas[4] = _encodePayExecutor(_colToken, _gasFeesPaidFromCol, 0, 0);\\n datas[5] = _encodeFlashPayback(DAI, _wDaiToBorrow, 0, 0);\\n }\\n\\n /* solhint-enable function-max-lines */\\n}\\n\",\"keccak256\":\"0x913cf92d048db23896d441efec7e75c3614478d86da25b5fd1a5b6ea1734eb84\",\"license\":\"UNLICENSED\"},\"contracts/functions/InstaDapp/connectors/FConnectGelatoExecutorPayment.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\nimport {\\n IConnectGelatoExecutorPayment\\n} from \\\"../../../interfaces/InstaDapp/connectors/IConnectGelatoExecutorPayment.sol\\\";\\n\\nfunction _encodePayExecutor(\\n address _token,\\n uint256 _amt,\\n uint256 _getId,\\n uint256 _setId\\n) pure returns (bytes memory) {\\n return\\n abi.encodeWithSelector(\\n IConnectGelatoExecutorPayment.payExecutor.selector,\\n _token,\\n _amt,\\n _getId,\\n _setId\\n );\\n}\\n\",\"keccak256\":\"0xf10adbeb5605a93cd85113efce1131bd2f2140045c7384fb2a0720865e245993\",\"license\":\"UNLICENSED\"},\"contracts/functions/InstaDapp/connectors/FConnectMaker.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\nimport {\\n IConnectMaker\\n} from \\\"../../../interfaces/InstaDapp/connectors/IConnectMaker.sol\\\";\\n\\nfunction _encodeOpenMakerVault(string memory _colType)\\n pure\\n returns (bytes memory)\\n{\\n return abi.encodeWithSelector(IConnectMaker.open.selector, _colType);\\n}\\n\\nfunction _encodeBorrowMakerVault(\\n uint256 _vaultId,\\n uint256 _amt,\\n uint256 _getId,\\n uint256 _setId\\n) pure returns (bytes memory) {\\n return\\n abi.encodeWithSelector(\\n IConnectMaker.borrow.selector,\\n _vaultId,\\n _amt,\\n _getId,\\n _setId\\n );\\n}\\n\\nfunction _encodedDepositMakerVault(\\n uint256 _vaultId,\\n uint256 _amt,\\n uint256 _getId,\\n uint256 _setId\\n) pure returns (bytes memory) {\\n return\\n abi.encodeWithSelector(\\n IConnectMaker.deposit.selector,\\n _vaultId,\\n _amt,\\n _getId,\\n _setId\\n );\\n}\\n\\nfunction _encodePaybackMakerVault(\\n uint256 _vaultId,\\n uint256 _amt,\\n uint256 _getId,\\n uint256 _setId\\n) pure returns (bytes memory) {\\n return\\n abi.encodeWithSelector(\\n IConnectMaker.payback.selector,\\n _vaultId,\\n _amt,\\n _getId,\\n _setId\\n );\\n}\\n\\nfunction _encodedWithdrawMakerVault(\\n uint256 _vaultId,\\n uint256 _amt,\\n uint256 _getId,\\n uint256 _setId\\n) pure returns (bytes memory) {\\n return\\n abi.encodeWithSelector(\\n IConnectMaker.withdraw.selector,\\n _vaultId,\\n _amt,\\n _getId,\\n _setId\\n );\\n}\\n\",\"keccak256\":\"0xfa8041540cf9da58828fac9ba047fb07b6bcbbbad32104509b39fd80179b268e\",\"license\":\"UNLICENSED\"},\"contracts/functions/InstaDapp/connectors/FInstaPoolV2.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\nimport {\\n IConnectInstaPoolV2\\n} from \\\"../../../interfaces/InstaDapp/connectors/IConnectInstaPoolV2.sol\\\";\\n\\nfunction _encodeFlashPayback(\\n address _token,\\n uint256 _amt,\\n uint256 _getId,\\n uint256 _setId\\n) pure returns (bytes memory) {\\n return\\n abi.encodeWithSelector(\\n IConnectInstaPoolV2.flashPayback.selector,\\n _token,\\n _amt,\\n _getId,\\n _setId\\n );\\n}\\n\",\"keccak256\":\"0x8fe117434ff22e07779d28853cd904266601d05801b879831e10ba1e2dd01052\",\"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/connectors/IConnectGelatoExecutorPayment.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\nimport {ConnectorInterface} from \\\"../IInstaDapp.sol\\\";\\n\\ninterface IConnectGelatoExecutorPayment is ConnectorInterface {\\n function payExecutor(\\n address _token,\\n uint256 _amt,\\n uint256 _getId,\\n uint256 _setId\\n ) external payable;\\n}\\n\",\"keccak256\":\"0x91bd2005f4cb1b8b1d56a9a25414a1d4b0149696da45bad0833afc785222da7b\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/InstaDapp/connectors/IConnectInstaPoolV2.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\ninterface IConnectInstaPoolV2 {\\n function flashBorrowAndCast(\\n address token,\\n uint256 amt,\\n uint256 route,\\n bytes memory data\\n ) external payable;\\n\\n function flashPayback(\\n address token,\\n uint256 amt,\\n uint256 getId,\\n uint256 setId\\n ) external payable;\\n}\\n\",\"keccak256\":\"0x30c1635f1efcf446ce7352a3a4c66a1b38e71e6203783d940639a8cceeb36e5e\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/InstaDapp/connectors/IConnectMaker.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\ninterface IConnectMaker {\\n function payback(\\n uint256 vault,\\n uint256 amt,\\n uint256 getId,\\n uint256 setId\\n ) external payable;\\n\\n function borrow(\\n uint256 vault,\\n uint256 amt,\\n uint256 getId,\\n uint256 setId\\n ) external payable;\\n\\n function open(string calldata colType)\\n external\\n payable\\n returns (uint256 vault);\\n\\n function withdraw(\\n uint256 vault,\\n uint256 amt,\\n uint256 getId,\\n uint256 setId\\n ) external payable;\\n\\n function deposit(\\n uint256 vault,\\n uint256 amt,\\n uint256 getId,\\n uint256 setId\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xc8c479e941784f6b470b2244e777f1cdc0a7a8e2af55de3dae199018e6d9d131\",\"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": "0x60c060405234801561001057600080fd5b5060405162002346380380620023468339810160408190526100319161004c565b60809190915260601b6001600160601b03191660a052610087565b6000806040838503121561005e578182fd5b825160208401519092506001600160a01b038116811461007c578182fd5b809150509250929050565b60805160a05160601c612293620000b360003980610d33528061106652508061014d52506122936000f3fe60806040526004361061004a5760003560e01c806306fdde031461004f57806345c4b9b51461007a578063d48fe2801461008f578063eb15f781146100a4578063eb9e7126146100c7575b600080fd5b34801561005b57600080fd5b506100646100e7565b6040516100719190611f92565b60405180910390f35b61008d610088366004611d92565b610103565b005b34801561009b57600080fd5b5061006461012a565b3480156100b057600080fd5b506100b9610148565b604051610071929190612050565b3480156100d357600080fd5b506100646100e2366004611c5e565b61016f565b6040518060600160405280602681526020016121fd6026913981565b6060806101138787878787610212565b9150915061012182826103fc565b50505050505050565b604051806040016040528060028152602001614f4b60f01b81525081565b6001907f000000000000000000000000000000000000000000000000000000000000000090565b60606000610180866004818a612082565b81019061018d9190611ce5565b505050905080600014156101bc576040518060600160405280603a815260200161219b603a9139915050610207565b6101c681896104e0565b6101eb576040518060600160405280603b8152602001612223603b9139915050610207565b50506040805180820190915260028152614f4b60f01b60208201525b979650505050505050565b6040805160018082528183019092526060918291906020808301908036833701905050915073eb4bf86589f808f90eec8e964dbf16bd4d2849058260008151811061025957fe5b60200260200101906001600160a01b031690816001600160a01b03168152505061028386306104e0565b61028e576000610290565b855b955060006102a56102a0896106ea565b61094f565b905060006102b289610963565b905060006102d4736b175474e89094c44da98b954eedeac495271d0f84610a84565b905060006102e38a1583610b90565b905060006102f082610bf0565b90506060808c1561030e576103098e8e8e8a8a88610c03565b61031d565b61031d8e8d8d8d8b8b89610ef3565b604080516001808252818301909252929450909250816020015b6060815260200190600190039081610337579050509750638d0a9b1b60e01b736b175474e89094c44da98b954eedeac495271d0f88878585604051602001610380929190611f26565b60408051601f19818403018152908290526103a094939291602401611eef565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050886000815181106103e057fe5b6020026020010181905250505050505050509550959350505050565b606063e0e90acf60e01b83833360405160240161041b93929190611f54565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050905060006060306001600160a01b03168360405161046c9190611ebf565b600060405180830381855af49150503d80600081146104a7576040519150601f19603f3d011682016040523d82523d6000602084013e6104ac565b606091505b5091509150816104d9576104d96040518060600160405280602881526020016121d5602891398290611278565b5050505050565b6000826104ef575060006106e4565b735ef30b9986345249bc32d8928b7ee64de9435e396001600160a01b0316638161b120846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561054757600080fd5b505afa92505050801561056c57506040513d602081101561056757600080fd5b505160015b6106d3576105786120e0565b806105835750610686565b806040516020018080742326b0b5b2b9172fb4b9ab30bab63a27bbb732b91d60591b81525060150182805190602001908083835b602083106105d65780518252601f1990920191602091820191016105b7565b51815160209384036101000a60001901801990921691161790526040805192909401828103601f190183529384905262461bcd60e51b84526004840181815282516024860152825192965094508493604401925085019080838360005b8381101561064b578181015183820152602001610633565b50505050905090810190601f1680156106785780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b6040805162461bcd60e51b815260206004820152601e60248201527f464d616b65722e5f69735661756c744f776e65723a756e646566696e65640000604482015290519081900360640190fd5b6001600160a01b0383811691161490505b92915050565b6000735ef30b9986345249bc32d8928b7ee64de9435e39818061070d8386611529565b915091506000836001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b15801561074c57600080fd5b505afa158015610760573d6000803e3d6000fd5b505050506040513d602081101561077657600080fd5b505160408051636cb1c69b60e11b81526004810186905290519192506000916001600160a01b0384169163d9638d369160248083019260a0929190829003018186803b1580156107c557600080fd5b505afa1580156107d9573d6000803e3d6000fd5b505050506040513d60a08110156107ef57600080fd5b5060200151604080516309092f9760e21b8152600481018790526001600160a01b038681166024830152825193945060009390861692632424be5c9260448082019391829003018186803b15801561084657600080fd5b505afa15801561085a573d6000803e3d6000fd5b505050506040513d604081101561087057600080fd5b5060209081015160408051633612d9a360e11b81526001600160a01b038881166004830152915192945060009391871692636c25b34692602480840193919291829003018186803b1580156108c457600080fd5b505afa1580156108d8573d6000803e3d6000fd5b505050506040513d60208110156108ee57600080fd5b505190506000610907610901848661161e565b83611681565b90506b033b2e3c9fd0803ce800000081049850806109318a6b033b2e3c9fd0803ce800000061161e565b1061093c5788610941565b886001015b9a9950505050505050505050565b60006106e482670df27a2cdf4480006116d1565b600080735ef30b9986345249bc32d8928b7ee64de9435e3990506000816001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b1580156109b857600080fd5b505afa1580156109cc573d6000803e3d6000fd5b505050506040513d60208110156109e257600080fd5b505190506000806109f38487611529565b915091506000836001600160a01b0316632424be5c84846040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050604080518083038186803b158015610a4d57600080fd5b505afa158015610a61573d6000803e3d6000fd5b505050506040513d6040811015610a7757600080fd5b5051979650505050505050565b6000610a8e611b72565b604051635a860c8760e01b815273a004a5afba04b74037e9e52ba1f7eb02b5e6150990635a860c8790610ac5908790600401611edb565b60806040518083038186803b158015610add57600080fd5b505afa158015610af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b159190611bff565b90508281600001511115610b2d5760009150506106e4565b8281602001511115610b435760019150506106e4565b8281604001511115610b595760029150506106e4565b8281606001511115610b6f5760039150506106e4565b60405162461bcd60e51b8152600401610b8790612002565b60405180910390fd5b6000610b9b82611706565b610be983610bc057610bab61172a565b8360048110610bb657fe5b6020020151610be4565b610be4610bcb61172a565b8460048110610bd657fe5b602002015162030d40611765565b6117b4565b9392505050565b60006106e482610bfe6117d6565b61161e565b60408051600680825260e082019092526060918291906020820160c08036833701905050915073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600081518110610c4b57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600181518110610c8d57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600281518110610ccf57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600381518110610d1157fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f000000000000000000000000000000000000000000000000000000000000000082600481518110610d5f57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073eb4bf86589f808f90eec8e964dbf16bd4d28490582600581518110610da157fe5b6001600160a01b039290921660209283029190910182015260408051600680825260e082019092529182015b6060815260200190600190039081610dcd579050509050610df58860001960006102586118ae565b81600081518110610e0257fe5b6020026020010181905250610e1c88600019600080611903565b81600181518110610e2957fe5b6020026020010181905250610e4a87610e428686611681565b600080611958565b81600281518110610e5757fe5b6020026020010181905250610e7287600061025860006119ad565b81600381518110610e7f57fe5b6020026020010181905250610e978684600080611a02565b81600481518110610ea457fe5b6020026020010181905250610ed0736b175474e89094c44da98b954eedeac495271d0f86600080611a5f565b81600581518110610edd57fe5b6020026020010181905250965096945050505050565b60408051600780825261010082019092526060918291906020820160e08036833701905050915073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600081518110610f3c57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600181518110610f7e57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600281518110610fc057fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a98260038151811061100257fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a98260048151811061104457fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000000000000000000000000000000000000000000008260058151811061109257fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073eb4bf86589f808f90eec8e964dbf16bd4d284905826006815181106110d457fe5b6001600160a01b039290921660209283029190910182015260408051600780825261010082019092529182015b60608152602001906001900390816111015790505090506111298960001960006102586118ae565b8160008151811061113657fe5b602002602001018190525061115089600019600080611903565b8160018151811061115d57fe5b60200260200101819052506111a787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611abc92505050565b816002815181106111b457fe5b60200260200101819052506111ce6000610e428686611681565b816003815181106111db57fe5b60200260200101819052506111f660008061025860006119ad565b8160048151811061120357fe5b602002602001018190525061121b8884600080611a02565b8160058151811061122857fe5b6020026020010181905250611254736b175474e89094c44da98b954eedeac495271d0f86600080611a5f565b8160068151811061126157fe5b602002602001018190525097509795505050505050565b602082518161128357fe5b066004141561146257602082015162461bcd60e51b6001600160e01b0319821614156113a05760448301925081836040516020018083805190602001908083835b602083106112e35780518252601f1990920191602091820191016112c4565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b6020831061132b5780518252601f19909201916020918201910161130c565b51815160209384036101000a60001901801990921691161790526040805192909401828103601f190183529384905262461bcd60e51b8452600484018181528251602486015282519297509550859450604490930192860191508083836000831561064b578181015183820152602001610633565b816040516020018082805190602001908083835b602083106113d35780518252601f1990920191602091820191016113b4565b51815160001960209485036101000a0190811690199091161790526e2737a2b93937b929b2b632b1ba37b960891b9390910192835260408051601019818603018152600f85019182905262461bcd60e51b90915260138401828152815160338601528151919650945084936053019250908501908083836000831561064b578181015183820152602001610633565b806040516020018082805190602001908083835b602083106114955780518252601f199092019160209182019101611476565b51815160001960209485036101000a01908116901990911617905273556e657870656374656452657475726e6461746160601b9390910192835260408051600b19818603018152601485019182905262461bcd60e51b90915260188401828152815160388601528151919650945084936058019250908501908083836000831561064b578181015183820152602001610633565b600080836001600160a01b0316632c2cb9fd846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561157057600080fd5b505afa158015611584573d6000803e3d6000fd5b505050506040513d602081101561159a57600080fd5b505160408051632726b07360e01b81526004810186905290519193506001600160a01b03861691632726b07391602480820192602092909190829003018186803b1580156115e757600080fd5b505afa1580156115fb573d6000803e3d6000fd5b505050506040513d602081101561161157600080fd5b5051919491935090915050565b60008115806116395750508082028282828161163657fe5b04145b6106e4576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b808203828111156106e4576040805162461bcd60e51b815260206004820152601560248201527464732d6d6174682d7375622d756e646572666c6f7760581b604482015290519081900360640190fd5b6000670de0b6b3a76400006116f76116e9858561161e565b6706f05b59d3b20000611765565b816116fe57fe5b049392505050565b60048111156117275760405162461bcd60e51b8152600401610b8790611fa5565b50565b611732611b9a565b604051806080016040528062266fd88152602001622feb948152602001623c97b8815260200162424ca881525090505b90565b808201828110156106e4576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6164642d6f766572666c6f7760601b604482015290519081900360640190fd5b600060646117c883610bfe6064601e611765565b816117cf57fe5b0492915050565b60008073169e633a2d1e6c10dd91238ba11c4a708dfef37c6001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561182657600080fd5b505afa15801561183a573d6000803e3d6000fd5b505050506040513d602081101561185057600080fd5b50519050600081136118a9576040805162461bcd60e51b815260206004820152601b60248201527f5f67657447656c61746f47617350726963653a306f7242656c6f770000000000604482015290519081900360640190fd5b905090565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316636af06d1b60e11b179052949350505050565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b03166319d3ec6d60e21b179052949350505050565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316632505c3d960e01b179052949350505050565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b031663088eca4160e11b179052949350505050565b604080516001600160a01b0386166024820152604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316631911336f60e01b179052949350505050565b604080516001600160a01b0386166024820152604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316630427301d60e31b179052949350505050565b60405160206024820181815283516044840152835160609363e4dcb06b60e01b9386939283926064019185019080838360005b83811015611b07578181015183820152602001611aef565b50505050905090810190601f168015611b345780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990961695909517909452509192505050919050565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b60405180608001604052806004906020820280368337509192915050565b60008083601f840112611bc9578182fd5b50813567ffffffffffffffff811115611be0578182fd5b602083019150836020828501011115611bf857600080fd5b9250929050565b600060808284031215611c10578081fd5b6040516080810181811067ffffffffffffffff82111715611c2d57fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600080600080600080600060c0888a031215611c78578283fd5b873596506020880135611c8a81612185565b9550604088013567ffffffffffffffff811115611ca5578384fd5b611cb18a828b01611bb8565b909650945050606088013560048110611cc8578384fd5b969995985093969295946080840135945060a09093013592915050565b60008060008060808587031215611cfa578384fd5b8435935060208086013593506040860135611d1481612185565b9250606086013567ffffffffffffffff80821115611d30578384fd5b818801915088601f830112611d43578384fd5b813581811115611d4f57fe5b611d61601f8201601f1916850161205e565b91508082528984828501011115611d76578485fd5b8084840185840137810190920192909252939692955090935050565b600080600080600060808688031215611da9578081fd5b85359450602086013593506040860135611dc281612185565b9250606086013567ffffffffffffffff811115611ddd578182fd5b611de988828901611bb8565b969995985093965092949392505050565b6000815180845260208085019450808401835b83811015611e325781516001600160a01b031687529582019590820190600101611e0d565b509495945050505050565b60008282518085526020808601955080818302840101818601855b84811015611e8657601f19868403018952611e74838351611e93565b98840198925090830190600101611e58565b5090979650505050505050565b60008151808452611eab8160208601602086016120aa565b601f01601f19169290920160200192915050565b60008251611ed18184602087016120aa565b9190910192915050565b6001600160a01b0391909116815260200190565b600060018060a01b038616825284602083015283604083015260806060830152611f1c6080830184611e93565b9695505050505050565b600060408252611f396040830185611dfa565b8281036020840152611f4b8185611e3d565b95945050505050565b600060608252611f676060830186611dfa565b8281036020840152611f798186611e3d565b91505060018060a01b0383166040830152949350505050565b600060208252610be96020830184611e93565b6020808252603e908201527f4647656c61746f446562744272696467652e5f676574476173436f73744d616b60408201527f6572546f4d616b65723a20696e76616c696420726f75746520696e6465780000606082015260800190565b6020808252602e908201527f4647656c61746f446562744272696467652e5f676574466c6173684c6f616e5260408201526d1bdd5d194e881a5b1b1a5c5d5a5960921b606082015260800190565b918252602082015260400190565b60405181810167ffffffffffffffff8111828210171561207a57fe5b604052919050565b60008085851115612091578182fd5b8386111561209d578182fd5b5050820193919092039150565b60005b838110156120c55781810151838201526020016120ad565b838111156120d4576000848401525b50505050565b60e01c90565b600060443d10156120f057611762565b600481823e6308c379a061210482516120da565b1461210e57611762565b6040513d600319016004823e80513d67ffffffffffffffff816024840111818411171561213e5750505050611762565b828401925082519150808211156121585750505050611762565b503d8301602082840101111561217057505050611762565b601f01601f1916810160200160405291505090565b6001600160a01b038116811461172757600080fdfe436f6e6e65637447656c61746f4461746146756c6c4d616b6572546f4d616b65723a205661756c742041204964206973206e6f742076616c6964436f6e6e65637447656c61746f4461746146756c6c4d616b6572546f4d616b65722e5f636173743a436f6e6e65637447656c61746f4461746146756c6c4d616b6572546f4d616b65722d76322e30436f6e6e65637447656c61746f4461746146756c6c4d616b6572546f4d616b65723a205661756c742041206e6f74206f776e656420627920647361a26469706673582212200f880689c4b7bec24cd4cdece7682753b1b9a3597d0683d1eb7f5c63bd8627a364736f6c63430007040033", + "deployedBytecode": "0x60806040526004361061004a5760003560e01c806306fdde031461004f57806345c4b9b51461007a578063d48fe2801461008f578063eb15f781146100a4578063eb9e7126146100c7575b600080fd5b34801561005b57600080fd5b506100646100e7565b6040516100719190611f92565b60405180910390f35b61008d610088366004611d92565b610103565b005b34801561009b57600080fd5b5061006461012a565b3480156100b057600080fd5b506100b9610148565b604051610071929190612050565b3480156100d357600080fd5b506100646100e2366004611c5e565b61016f565b6040518060600160405280602681526020016121fd6026913981565b6060806101138787878787610212565b9150915061012182826103fc565b50505050505050565b604051806040016040528060028152602001614f4b60f01b81525081565b6001907f000000000000000000000000000000000000000000000000000000000000000090565b60606000610180866004818a612082565b81019061018d9190611ce5565b505050905080600014156101bc576040518060600160405280603a815260200161219b603a9139915050610207565b6101c681896104e0565b6101eb576040518060600160405280603b8152602001612223603b9139915050610207565b50506040805180820190915260028152614f4b60f01b60208201525b979650505050505050565b6040805160018082528183019092526060918291906020808301908036833701905050915073eb4bf86589f808f90eec8e964dbf16bd4d2849058260008151811061025957fe5b60200260200101906001600160a01b031690816001600160a01b03168152505061028386306104e0565b61028e576000610290565b855b955060006102a56102a0896106ea565b61094f565b905060006102b289610963565b905060006102d4736b175474e89094c44da98b954eedeac495271d0f84610a84565b905060006102e38a1583610b90565b905060006102f082610bf0565b90506060808c1561030e576103098e8e8e8a8a88610c03565b61031d565b61031d8e8d8d8d8b8b89610ef3565b604080516001808252818301909252929450909250816020015b6060815260200190600190039081610337579050509750638d0a9b1b60e01b736b175474e89094c44da98b954eedeac495271d0f88878585604051602001610380929190611f26565b60408051601f19818403018152908290526103a094939291602401611eef565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050886000815181106103e057fe5b6020026020010181905250505050505050509550959350505050565b606063e0e90acf60e01b83833360405160240161041b93929190611f54565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050905060006060306001600160a01b03168360405161046c9190611ebf565b600060405180830381855af49150503d80600081146104a7576040519150601f19603f3d011682016040523d82523d6000602084013e6104ac565b606091505b5091509150816104d9576104d96040518060600160405280602881526020016121d5602891398290611278565b5050505050565b6000826104ef575060006106e4565b735ef30b9986345249bc32d8928b7ee64de9435e396001600160a01b0316638161b120846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561054757600080fd5b505afa92505050801561056c57506040513d602081101561056757600080fd5b505160015b6106d3576105786120e0565b806105835750610686565b806040516020018080742326b0b5b2b9172fb4b9ab30bab63a27bbb732b91d60591b81525060150182805190602001908083835b602083106105d65780518252601f1990920191602091820191016105b7565b51815160209384036101000a60001901801990921691161790526040805192909401828103601f190183529384905262461bcd60e51b84526004840181815282516024860152825192965094508493604401925085019080838360005b8381101561064b578181015183820152602001610633565b50505050905090810190601f1680156106785780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b6040805162461bcd60e51b815260206004820152601e60248201527f464d616b65722e5f69735661756c744f776e65723a756e646566696e65640000604482015290519081900360640190fd5b6001600160a01b0383811691161490505b92915050565b6000735ef30b9986345249bc32d8928b7ee64de9435e39818061070d8386611529565b915091506000836001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b15801561074c57600080fd5b505afa158015610760573d6000803e3d6000fd5b505050506040513d602081101561077657600080fd5b505160408051636cb1c69b60e11b81526004810186905290519192506000916001600160a01b0384169163d9638d369160248083019260a0929190829003018186803b1580156107c557600080fd5b505afa1580156107d9573d6000803e3d6000fd5b505050506040513d60a08110156107ef57600080fd5b5060200151604080516309092f9760e21b8152600481018790526001600160a01b038681166024830152825193945060009390861692632424be5c9260448082019391829003018186803b15801561084657600080fd5b505afa15801561085a573d6000803e3d6000fd5b505050506040513d604081101561087057600080fd5b5060209081015160408051633612d9a360e11b81526001600160a01b038881166004830152915192945060009391871692636c25b34692602480840193919291829003018186803b1580156108c457600080fd5b505afa1580156108d8573d6000803e3d6000fd5b505050506040513d60208110156108ee57600080fd5b505190506000610907610901848661161e565b83611681565b90506b033b2e3c9fd0803ce800000081049850806109318a6b033b2e3c9fd0803ce800000061161e565b1061093c5788610941565b886001015b9a9950505050505050505050565b60006106e482670df27a2cdf4480006116d1565b600080735ef30b9986345249bc32d8928b7ee64de9435e3990506000816001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b1580156109b857600080fd5b505afa1580156109cc573d6000803e3d6000fd5b505050506040513d60208110156109e257600080fd5b505190506000806109f38487611529565b915091506000836001600160a01b0316632424be5c84846040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050604080518083038186803b158015610a4d57600080fd5b505afa158015610a61573d6000803e3d6000fd5b505050506040513d6040811015610a7757600080fd5b5051979650505050505050565b6000610a8e611b72565b604051635a860c8760e01b815273a004a5afba04b74037e9e52ba1f7eb02b5e6150990635a860c8790610ac5908790600401611edb565b60806040518083038186803b158015610add57600080fd5b505afa158015610af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b159190611bff565b90508281600001511115610b2d5760009150506106e4565b8281602001511115610b435760019150506106e4565b8281604001511115610b595760029150506106e4565b8281606001511115610b6f5760039150506106e4565b60405162461bcd60e51b8152600401610b8790612002565b60405180910390fd5b6000610b9b82611706565b610be983610bc057610bab61172a565b8360048110610bb657fe5b6020020151610be4565b610be4610bcb61172a565b8460048110610bd657fe5b602002015162030d40611765565b6117b4565b9392505050565b60006106e482610bfe6117d6565b61161e565b60408051600680825260e082019092526060918291906020820160c08036833701905050915073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600081518110610c4b57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600181518110610c8d57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600281518110610ccf57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600381518110610d1157fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f000000000000000000000000000000000000000000000000000000000000000082600481518110610d5f57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073eb4bf86589f808f90eec8e964dbf16bd4d28490582600581518110610da157fe5b6001600160a01b039290921660209283029190910182015260408051600680825260e082019092529182015b6060815260200190600190039081610dcd579050509050610df58860001960006102586118ae565b81600081518110610e0257fe5b6020026020010181905250610e1c88600019600080611903565b81600181518110610e2957fe5b6020026020010181905250610e4a87610e428686611681565b600080611958565b81600281518110610e5757fe5b6020026020010181905250610e7287600061025860006119ad565b81600381518110610e7f57fe5b6020026020010181905250610e978684600080611a02565b81600481518110610ea457fe5b6020026020010181905250610ed0736b175474e89094c44da98b954eedeac495271d0f86600080611a5f565b81600581518110610edd57fe5b6020026020010181905250965096945050505050565b60408051600780825261010082019092526060918291906020820160e08036833701905050915073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600081518110610f3c57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600181518110610f7e57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600281518110610fc057fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a98260038151811061100257fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a98260048151811061104457fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000000000000000000000000000000000000000000008260058151811061109257fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073eb4bf86589f808f90eec8e964dbf16bd4d284905826006815181106110d457fe5b6001600160a01b039290921660209283029190910182015260408051600780825261010082019092529182015b60608152602001906001900390816111015790505090506111298960001960006102586118ae565b8160008151811061113657fe5b602002602001018190525061115089600019600080611903565b8160018151811061115d57fe5b60200260200101819052506111a787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611abc92505050565b816002815181106111b457fe5b60200260200101819052506111ce6000610e428686611681565b816003815181106111db57fe5b60200260200101819052506111f660008061025860006119ad565b8160048151811061120357fe5b602002602001018190525061121b8884600080611a02565b8160058151811061122857fe5b6020026020010181905250611254736b175474e89094c44da98b954eedeac495271d0f86600080611a5f565b8160068151811061126157fe5b602002602001018190525097509795505050505050565b602082518161128357fe5b066004141561146257602082015162461bcd60e51b6001600160e01b0319821614156113a05760448301925081836040516020018083805190602001908083835b602083106112e35780518252601f1990920191602091820191016112c4565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b6020831061132b5780518252601f19909201916020918201910161130c565b51815160209384036101000a60001901801990921691161790526040805192909401828103601f190183529384905262461bcd60e51b8452600484018181528251602486015282519297509550859450604490930192860191508083836000831561064b578181015183820152602001610633565b816040516020018082805190602001908083835b602083106113d35780518252601f1990920191602091820191016113b4565b51815160001960209485036101000a0190811690199091161790526e2737a2b93937b929b2b632b1ba37b960891b9390910192835260408051601019818603018152600f85019182905262461bcd60e51b90915260138401828152815160338601528151919650945084936053019250908501908083836000831561064b578181015183820152602001610633565b806040516020018082805190602001908083835b602083106114955780518252601f199092019160209182019101611476565b51815160001960209485036101000a01908116901990911617905273556e657870656374656452657475726e6461746160601b9390910192835260408051600b19818603018152601485019182905262461bcd60e51b90915260188401828152815160388601528151919650945084936058019250908501908083836000831561064b578181015183820152602001610633565b600080836001600160a01b0316632c2cb9fd846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561157057600080fd5b505afa158015611584573d6000803e3d6000fd5b505050506040513d602081101561159a57600080fd5b505160408051632726b07360e01b81526004810186905290519193506001600160a01b03861691632726b07391602480820192602092909190829003018186803b1580156115e757600080fd5b505afa1580156115fb573d6000803e3d6000fd5b505050506040513d602081101561161157600080fd5b5051919491935090915050565b60008115806116395750508082028282828161163657fe5b04145b6106e4576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b808203828111156106e4576040805162461bcd60e51b815260206004820152601560248201527464732d6d6174682d7375622d756e646572666c6f7760581b604482015290519081900360640190fd5b6000670de0b6b3a76400006116f76116e9858561161e565b6706f05b59d3b20000611765565b816116fe57fe5b049392505050565b60048111156117275760405162461bcd60e51b8152600401610b8790611fa5565b50565b611732611b9a565b604051806080016040528062266fd88152602001622feb948152602001623c97b8815260200162424ca881525090505b90565b808201828110156106e4576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6164642d6f766572666c6f7760601b604482015290519081900360640190fd5b600060646117c883610bfe6064601e611765565b816117cf57fe5b0492915050565b60008073169e633a2d1e6c10dd91238ba11c4a708dfef37c6001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561182657600080fd5b505afa15801561183a573d6000803e3d6000fd5b505050506040513d602081101561185057600080fd5b50519050600081136118a9576040805162461bcd60e51b815260206004820152601b60248201527f5f67657447656c61746f47617350726963653a306f7242656c6f770000000000604482015290519081900360640190fd5b905090565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316636af06d1b60e11b179052949350505050565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b03166319d3ec6d60e21b179052949350505050565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316632505c3d960e01b179052949350505050565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b031663088eca4160e11b179052949350505050565b604080516001600160a01b0386166024820152604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316631911336f60e01b179052949350505050565b604080516001600160a01b0386166024820152604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316630427301d60e31b179052949350505050565b60405160206024820181815283516044840152835160609363e4dcb06b60e01b9386939283926064019185019080838360005b83811015611b07578181015183820152602001611aef565b50505050905090810190601f168015611b345780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990961695909517909452509192505050919050565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b60405180608001604052806004906020820280368337509192915050565b60008083601f840112611bc9578182fd5b50813567ffffffffffffffff811115611be0578182fd5b602083019150836020828501011115611bf857600080fd5b9250929050565b600060808284031215611c10578081fd5b6040516080810181811067ffffffffffffffff82111715611c2d57fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600080600080600080600060c0888a031215611c78578283fd5b873596506020880135611c8a81612185565b9550604088013567ffffffffffffffff811115611ca5578384fd5b611cb18a828b01611bb8565b909650945050606088013560048110611cc8578384fd5b969995985093969295946080840135945060a09093013592915050565b60008060008060808587031215611cfa578384fd5b8435935060208086013593506040860135611d1481612185565b9250606086013567ffffffffffffffff80821115611d30578384fd5b818801915088601f830112611d43578384fd5b813581811115611d4f57fe5b611d61601f8201601f1916850161205e565b91508082528984828501011115611d76578485fd5b8084840185840137810190920192909252939692955090935050565b600080600080600060808688031215611da9578081fd5b85359450602086013593506040860135611dc281612185565b9250606086013567ffffffffffffffff811115611ddd578182fd5b611de988828901611bb8565b969995985093965092949392505050565b6000815180845260208085019450808401835b83811015611e325781516001600160a01b031687529582019590820190600101611e0d565b509495945050505050565b60008282518085526020808601955080818302840101818601855b84811015611e8657601f19868403018952611e74838351611e93565b98840198925090830190600101611e58565b5090979650505050505050565b60008151808452611eab8160208601602086016120aa565b601f01601f19169290920160200192915050565b60008251611ed18184602087016120aa565b9190910192915050565b6001600160a01b0391909116815260200190565b600060018060a01b038616825284602083015283604083015260806060830152611f1c6080830184611e93565b9695505050505050565b600060408252611f396040830185611dfa565b8281036020840152611f4b8185611e3d565b95945050505050565b600060608252611f676060830186611dfa565b8281036020840152611f798186611e3d565b91505060018060a01b0383166040830152949350505050565b600060208252610be96020830184611e93565b6020808252603e908201527f4647656c61746f446562744272696467652e5f676574476173436f73744d616b60408201527f6572546f4d616b65723a20696e76616c696420726f75746520696e6465780000606082015260800190565b6020808252602e908201527f4647656c61746f446562744272696467652e5f676574466c6173684c6f616e5260408201526d1bdd5d194e881a5b1b1a5c5d5a5960921b606082015260800190565b918252602082015260400190565b60405181810167ffffffffffffffff8111828210171561207a57fe5b604052919050565b60008085851115612091578182fd5b8386111561209d578182fd5b5050820193919092039150565b60005b838110156120c55781810151838201526020016120ad565b838111156120d4576000848401525b50505050565b60e01c90565b600060443d10156120f057611762565b600481823e6308c379a061210482516120da565b1461210e57611762565b6040513d600319016004823e80513d67ffffffffffffffff816024840111818411171561213e5750505050611762565b828401925082519150808211156121585750505050611762565b503d8301602082840101111561217057505050611762565b601f01601f1916810160200160405291505090565b6001600160a01b038116811461172757600080fdfe436f6e6e65637447656c61746f4461746146756c6c4d616b6572546f4d616b65723a205661756c742041204964206973206e6f742076616c6964436f6e6e65637447656c61746f4461746146756c6c4d616b6572546f4d616b65722e5f636173743a436f6e6e65637447656c61746f4461746146756c6c4d616b6572546f4d616b65722d76322e30436f6e6e65637447656c61746f4461746146756c6c4d616b6572546f4d616b65723a205661756c742041206e6f74206f776e656420627920647361a26469706673582212200f880689c4b7bec24cd4cdece7682753b1b9a3597d0683d1eb7f5c63bd8627a364736f6c63430007040033", "devdoc": { "kind": "dev", "methods": { diff --git a/deployments/mainnet/solcInputs/f356241e44bbb1ebd4fe25347635c673.json b/deployments/mainnet/solcInputs/f356241e44bbb1ebd4fe25347635c673.json new file mode 100644 index 0000000..cc66784 --- /dev/null +++ b/deployments/mainnet/solcInputs/f356241e44bbb1ebd4fe25347635c673.json @@ -0,0 +1,198 @@ +{ + "language": "Solidity", + "sources": { + "@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" + }, + "@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" + }, + "@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}" + }, + "@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" + }, + "contracts/contracts/gelato/conditions/ConditionMakerVaultUnsafe.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 {wmul, wdiv} from \"../../../vendor/DSMath.sol\";\nimport {GelatoBytes} from \"../../../lib/GelatoBytes.sol\";\nimport {\n IInstaMakerResolver\n} from \"../../../interfaces/InstaDapp/resolvers/IInstaMakerResolver.sol\";\n\n/// @title ConditionMakerVaultUnsafe\n/// @notice Condition tracking Maker vault collateralization safety requirements.\n/// @author Gelato Team\ncontract ConditionMakerVaultUnsafe 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 /// @return The encoded payload for your Task's Condition.data field.\n function getConditionData(\n uint256 _vaultId,\n address _priceOracle,\n bytes calldata _oraclePayload,\n uint256 _minColRatio\n ) public pure virtual returns (bytes memory) {\n return\n abi.encodeWithSelector(\n this.isVaultUnsafe.selector,\n _vaultId,\n _priceOracle,\n _oraclePayload,\n _minColRatio\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 (\n uint256 _vaultID,\n address _priceOracle,\n bytes memory _oraclePayload,\n uint256 _minColRatio\n ) = abi.decode(_conditionData[4:], (uint256, address, bytes, uint256));\n\n return\n isVaultUnsafe(_vaultID, _priceOracle, _oraclePayload, _minColRatio);\n }\n\n /// @notice Specific implementation of this Condition's ok function\n /// @dev The price oracle must return a uint256 WAD (10**18) value.\n /// @param _vaultId The id of the Maker vault\n /// @param _priceOracle The price oracle contract to supply the collateral price\n /// e.g. Maker's ETH/USD oracle for ETH collateral pricing.\n /// @param _oraclePayload The data for making the staticcall to the oracle's read\n /// method e.g. the selector for MakerOracle's read fn.\n /// @param _minColRatio The minimum collateral ratio measured in the price\n /// of the collateral as specified by the _priceOracle.\n /// @return OK if the Maker Vault is unsafe, otherwise some error message.\n function isVaultUnsafe(\n uint256 _vaultId,\n address _priceOracle,\n bytes memory _oraclePayload,\n uint256 _minColRatio\n ) public view virtual returns (string memory) {\n (bool success, bytes memory returndata) =\n _priceOracle.staticcall(_oraclePayload);\n\n if (!success) {\n returndata.revertWithError(\n \"ConditionMakerVaultUnsafe.isVaultUnsafe:oracle:\"\n );\n }\n\n uint256 colPriceInWad = abi.decode(returndata, (uint256));\n\n IInstaMakerResolver.VaultData memory vault =\n IInstaMakerResolver(0x0A7008B38E7015F8C36A49eEbc32513ECA8801E5)\n .getVaultById(_vaultId);\n\n uint256 colRatio =\n wdiv(wmul(vault.collateral, colPriceInWad), vault.debt);\n\n return colRatio < _minColRatio ? OK : \"MakerVaultNotUnsafe\";\n }\n}\n" + }, + "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" + }, + "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" + }, + "contracts/interfaces/InstaDapp/resolvers/IInstaMakerResolver.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\npragma experimental ABIEncoderV2;\n\ninterface IInstaMakerResolver {\n struct VaultData {\n uint256 id;\n address owner;\n string colType;\n uint256 collateral;\n uint256 art;\n uint256 debt;\n uint256 liquidatedCol;\n uint256 borrowRate;\n uint256 colPrice;\n uint256 liquidationRatio;\n address vaultAddress;\n }\n\n function getVaultById(uint256 id) external view returns (VaultData memory);\n}\n" + }, + "contracts/contracts/resolvers/PriceOracleResolver.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\npragma experimental ABIEncoderV2;\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {GelatoBytes} from \"../../lib/GelatoBytes.sol\";\n\n/// @title PriceOracleResolver\n/// @notice Contract with convenience methods to retrieve oracle addresses or to mock test.\n/// @dev Can be used to:\n/// - Query oracle address for Gelato Condition payloads on frontend\n/// - Test Conditions by using `getMockPrice(address _test)` as `oraclePayload`\ncontract PriceOracleResolver is Ownable {\n using GelatoBytes for bytes;\n\n mapping(string => address) public oracle;\n mapping(string => bytes) public oraclePayload;\n mapping(address => uint256) public mockPrice;\n\n /// @notice Adds a new Oracle address\n /// @dev Only owner can call this, but existing oracle entries are immutable\n /// @param _oracle The descriptor of the oracle e.g. ETH/USD-Maker-v1\n /// @param _oracleAddress The address of the oracle contract\n /// @param _oraclePayload The payload with function selector for the oracle request.\n function addOracle(\n string memory _oracle,\n address _oracleAddress,\n bytes calldata _oraclePayload\n ) external onlyOwner {\n require(\n oracle[_oracle] == address(0),\n \"PriceOracleResolver.addOracle: set\"\n );\n oracle[_oracle] = _oracleAddress;\n oraclePayload[_oracle] = _oraclePayload;\n }\n\n /// @notice Function that allows easy oracle data testing in production.\n /// @dev Your mock prices cannot be overriden by someone else.\n /// @param _mockPrice The mock data you want to test against.\n function setMockPrice(uint256 _mockPrice) public {\n mockPrice[msg.sender] = _mockPrice;\n }\n\n /// @notice Use with setMockPrice for easy testing in production.\n /// @dev Encode oracle=PriceOracleResolver and oraclePayload=getMockPrice(tester)\n /// to test your Conditions or Actions that make dynamic calls to price oracles.\n /// @param _tester The msg.sender during setMockPrice.\n /// @return The tester's mockPrice.\n function getMockPrice(address _tester) external view returns (uint256) {\n return mockPrice[_tester];\n }\n\n /// @notice A generelized getter for a price supplied by an oracle contract.\n /// @dev The oracle returndata must be formatted as a single uint256.\n /// @param _oracle The descriptor of our oracle e.g. ETH/USD-Maker-v1\n /// @return The uint256 oracle price\n function getPrice(string memory _oracle) external view returns (uint256) {\n address oracleAddr = oracle[_oracle];\n if (oracleAddr == address(0))\n revert(\"PriceOracleResolver.getPrice: no oracle\");\n (bool success, bytes memory returndata) =\n oracleAddr.staticcall(oraclePayload[_oracle]);\n if (!success)\n returndata.revertWithError(\"PriceOracleResolver.getPrice:\");\n return abi.decode(returndata, (uint256));\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\nimport \"../GSN/Context.sol\";\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor () internal {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n}\n" + }, + "@openzeppelin/contracts/GSN/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with GSN meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address payable) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes memory) {\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\n }\n}\n" + }, + "contracts/contracts/gelato/conditions/ConditionDestVaultWillBeSafe.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 _getMakerVaultDebt,\n _getMakerVaultCollateralBalance,\n _vaultWillBeSafe,\n _newVaultWillBeSafe,\n _isVaultOwner\n} from \"../../../functions/dapps/FMaker.sol\";\nimport {DAI} from \"../../../constants/CInstaDapp.sol\";\nimport {\n _getFlashLoanRoute,\n _getGasCostMakerToMaker,\n _getRealisedDebt\n} from \"../../../functions/gelato/FGelatoDebtBridge.sol\";\nimport {_getGelatoExecutorFees} from \"../../../functions/gelato/FGelato.sol\";\nimport {GelatoBytes} from \"../../../lib/GelatoBytes.sol\";\nimport {sub} from \"../../../vendor/DSMath.sol\";\n\ncontract ConditionDestVaultWillBeSafe is GelatoConditionsStandard {\n using GelatoBytes for bytes;\n\n function getConditionData(\n address _dsa,\n uint256 _fromVaultId,\n uint256 _destVaultId,\n string calldata _destColType\n ) public pure virtual returns (bytes memory) {\n return\n abi.encodeWithSelector(\n this.destVaultWillBeSafe.selector,\n _dsa,\n _fromVaultId,\n _destVaultId,\n _destColType\n );\n }\n\n function ok(\n uint256,\n bytes calldata _conditionData,\n uint256\n ) public view virtual override returns (string memory) {\n (\n address _dsa,\n uint256 _fromVaultId,\n uint256 _destVaultId,\n string memory _destColType\n ) = abi.decode(_conditionData[4:], (address, uint256, uint256, string));\n\n return\n destVaultWillBeSafe(_dsa, _fromVaultId, _destVaultId, _destColType);\n }\n\n function destVaultWillBeSafe(\n address _dsa,\n uint256 _fromVaultId,\n uint256 _destVaultId,\n string memory _destColType\n ) public view returns (string memory) {\n _destVaultId = _isVaultOwner(_destVaultId, _dsa) ? _destVaultId : 0;\n uint256 wDaiToBorrow =\n _getRealisedDebt(_getMakerVaultDebt(_fromVaultId));\n uint256 wColToDeposit =\n sub(\n _getMakerVaultCollateralBalance(_fromVaultId),\n _getGelatoExecutorFees(\n _getGasCostMakerToMaker(\n _destVaultId == 0,\n _getFlashLoanRoute(DAI, wDaiToBorrow)\n )\n )\n );\n\n return\n destVaultWillBeSafeExplicit(\n _destVaultId,\n wDaiToBorrow,\n wColToDeposit,\n _destColType\n )\n ? OK\n : \"DestVaultWillNotBeSafe\";\n }\n\n function destVaultWillBeSafeExplicit(\n uint256 _vaultId,\n uint256 _wDaiToBorrow,\n uint256 _wColToDeposit,\n string memory _colType\n ) public view returns (bool) {\n return\n _vaultId == 0\n ? _newVaultWillBeSafe(_colType, _wDaiToBorrow, _wColToDeposit)\n : _vaultWillBeSafe(_vaultId, _wDaiToBorrow, _wColToDeposit);\n }\n}\n" + }, + "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" + }, + "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" + }, + "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" + }, + "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" + }, + "contracts/constants/CMaker.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\n\naddress constant MCD_MANAGER = 0x5ef30b9986345249bc32d8928B7ee64DE9435E39;\n" + }, + "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" + }, + "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" + }, + "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" + }, + "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" + }, + "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" + }, + "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(2519000), 3140500, 3971000, 4345000];\n}\n\nuint256 constant PREMIUM = 30;\nuint256 constant VAULT_CREATION_COST = 200000;\n" + }, + "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" + }, + "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" + }, + "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" + }, + "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" + }, + "contracts/functions/InstaDapp/FInstaDapp.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\n\nimport {MemoryInterface} from \"../../interfaces/InstaDapp/IInstaDapp.sol\";\nimport {INSTA_MEMORY} from \"../../constants/CInstaDapp.sol\";\n\nfunction _setUint(uint256 setId, uint256 val) {\n if (setId != 0) MemoryInterface(INSTA_MEMORY).setUint(setId, val);\n}\n\nfunction _getUint(uint256 getId, uint256 val) returns (uint256 returnVal) {\n returnVal = getId == 0 ? val : MemoryInterface(INSTA_MEMORY).getUint(getId);\n}\n" + }, + "contracts/contracts/connectors/ConnectGelatoDataPartialRefinanceMaker.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\npragma experimental ABIEncoderV2;\n\nimport {GelatoBytes} from \"../../lib/GelatoBytes.sol\";\nimport {sub, wmul} from \"../../vendor/DSMath.sol\";\nimport {\n AccountInterface,\n ConnectorInterface\n} from \"../../interfaces/InstaDapp/IInstaDapp.sol\";\nimport {\n IConnectInstaPoolV2\n} from \"../../interfaces/InstaDapp/connectors/IConnectInstaPoolV2.sol\";\nimport {\n DAI,\n CONNECT_MAKER,\n CONNECT_COMPOUND,\n INSTA_POOL_V2\n} from \"../../constants/CInstaDapp.sol\";\nimport {\n _getMakerVaultDebt,\n _getMakerVaultCollateralBalance\n} from \"../../functions/dapps/FMaker.sol\";\nimport {\n _encodeFlashPayback\n} from \"../../functions/InstaDapp/connectors/FInstaPoolV2.sol\";\nimport {\n _encodePaybackMakerVault,\n _encodedWithdrawMakerVault,\n _encodeOpenMakerVault,\n _encodedDepositMakerVault,\n _encodeBorrowMakerVault\n} from \"../../functions/InstaDapp/connectors/FConnectMaker.sol\";\nimport {\n _encodePayExecutor\n} from \"../../functions/InstaDapp/connectors/FConnectGelatoExecutorPayment.sol\";\nimport {\n _encodeDepositCompound,\n _encodeBorrowCompound\n} from \"../../functions/InstaDapp/connectors/FConnectCompound.sol\";\nimport {_getGelatoExecutorFees} from \"../../functions/gelato/FGelato.sol\";\nimport {\n _wCalcCollateralToWithdraw,\n _wCalcDebtToRepay\n} from \"../../functions/gelato/FGelatoDebtBridge.sol\";\n\ncontract ConnectGelatoDataPartialRefinanceMaker is ConnectorInterface {\n using GelatoBytes for bytes;\n\n // vaultId: Id of the unsafe vault of the client.\n // token: vault's col token address .\n // wMinColRatioMaker: Min col ratio (wad) on Maker debt position\n // wMinColRatioB: Min col ratio (wad) on debt position B (e.g. Compound, Maker, ...)\n // priceOracle: The price oracle contract to supply the collateral price\n // e.g. Maker's ETH/USD oracle for ETH collateral pricing.\n // oraclePayload: The data for making the staticcall to the oracle's read\n // method e.g. the function selector of MakerOracle's read function.\n struct PartialDebtBridgePayload {\n uint256 vaultId;\n address colToken;\n string colType;\n uint256 wMinColRatioMaker;\n uint256 wMinColRatioB;\n address priceOracle;\n bytes oraclePayload;\n }\n\n // solhint-disable const-name-snakecase\n string public constant override name =\n \"ConnectGelatoDataPartialRefinanceMaker-v1.0\";\n uint256 internal immutable _id;\n address internal immutable _connectGelatoExecutorPayment;\n\n uint256 public constant GAS_COST = 1850000;\n\n constructor(uint256 id, address connectGelatoExecutorPayment) {\n _id = id;\n _connectGelatoExecutorPayment = connectGelatoExecutorPayment;\n }\n\n /// @dev Connector Details\n function connectorID()\n external\n view\n override\n returns (uint256 _type, uint256 id)\n {\n (_type, id) = (1, _id); // Should put specific value.\n }\n\n /// @notice Entry Point for DSA.cast DebtBridge from e.g ETH-A to ETH-B\n /// @dev payable to be compatible in conjunction with DSA.cast payable target\n /// @param _payload See PartialDebtBridgePayload struct\n function getDataAndCastMakerToMaker(\n PartialDebtBridgePayload calldata _payload\n ) external payable {\n (address[] memory targets, bytes[] memory datas) =\n _dataMakerToMaker(_payload);\n\n _cast(targets, datas);\n }\n\n /// @notice Entry Point for DSA.cast DebtBridge from Maker to Compound\n /// @dev payable to be compatible in conjunction with DSA.cast payable target\n /// @param _payload See PartialDebtBridgePayload struct\n function getDataAndCastMakerToCompound(\n PartialDebtBridgePayload calldata _payload\n ) external payable {\n (address[] memory targets, bytes[] memory datas) =\n _dataMakerToCompound(_payload);\n\n _cast(targets, datas);\n }\n\n function _cast(address[] memory targets, bytes[] memory datas) internal {\n // Instapool V2 / FlashLoan call\n bytes memory castData =\n abi.encodeWithSelector(\n AccountInterface.cast.selector,\n targets,\n datas,\n msg.sender // msg.sender == GelatoCore\n );\n\n (bool success, bytes memory returndata) =\n address(this).delegatecall(castData);\n if (!success)\n returndata.revertWithError(\n \"ConnectGelatoDataPartialRefinanceMaker._cast:\"\n );\n }\n\n /* solhint-disable function-max-lines */\n\n function _dataMakerToMaker(PartialDebtBridgePayload calldata _payload)\n internal\n view\n returns (address[] memory targets, bytes[] memory datas)\n {\n targets = new address[](1);\n targets[0] = INSTA_POOL_V2;\n\n (\n uint256 wDaiDebtToMove,\n uint256 wColToWithdrawFromMaker,\n uint256 gasFeesPaidFromCol\n ) =\n computeDebtBridge(\n _payload.vaultId,\n _payload.wMinColRatioMaker,\n _payload.wMinColRatioB,\n _payload.priceOracle,\n _payload.oraclePayload\n );\n\n address[] memory _targets = new address[](7);\n _targets[0] = CONNECT_MAKER; // payback\n _targets[1] = CONNECT_MAKER; // withdraw\n _targets[2] = CONNECT_MAKER; // open ETH-B vault\n _targets[3] = CONNECT_MAKER; // deposit\n _targets[4] = CONNECT_MAKER; // borrow\n _targets[5] = _connectGelatoExecutorPayment; // payExecutor\n _targets[6] = INSTA_POOL_V2; // flashPayback\n\n bytes[] memory _datas = new bytes[](7);\n _datas[0] = _encodePaybackMakerVault(\n _payload.vaultId,\n uint256(-1),\n 0,\n 0\n );\n _datas[1] = _encodedWithdrawMakerVault(\n _payload.vaultId,\n uint256(-1),\n 0,\n 0\n );\n _datas[2] = _encodeOpenMakerVault(_payload.colType);\n _datas[3] = _encodedDepositMakerVault(\n 0,\n sub(wColToWithdrawFromMaker, gasFeesPaidFromCol),\n 0,\n 0\n );\n _datas[4] = _encodeBorrowMakerVault(0, wDaiDebtToMove, 0, 0);\n _datas[5] = _encodePayExecutor(\n _payload.colToken,\n gasFeesPaidFromCol,\n 0,\n 0\n );\n _datas[6] = _encodeFlashPayback(DAI, wDaiDebtToMove, 0, 0);\n\n datas = new bytes[](1);\n datas[0] = abi.encodeWithSelector(\n IConnectInstaPoolV2.flashBorrowAndCast.selector,\n DAI,\n wDaiDebtToMove,\n 0,\n abi.encode(_targets, _datas)\n );\n }\n\n function _dataMakerToCompound(PartialDebtBridgePayload calldata _payload)\n internal\n view\n returns (address[] memory targets, bytes[] memory datas)\n {\n targets = new address[](1);\n targets[0] = INSTA_POOL_V2;\n\n (\n uint256 wDaiDebtToMove,\n uint256 wColToWithdrawFromMaker,\n uint256 gasFeesPaidFromCol\n ) =\n computeDebtBridge(\n _payload.vaultId,\n _payload.wMinColRatioMaker,\n _payload.wMinColRatioB,\n _payload.priceOracle,\n _payload.oraclePayload\n );\n\n address[] memory _targets = new address[](6);\n _targets[0] = CONNECT_MAKER; // payback\n _targets[1] = CONNECT_MAKER; // withdraw\n _targets[2] = CONNECT_COMPOUND; // deposit\n _targets[3] = CONNECT_COMPOUND; // borrow\n _targets[4] = _connectGelatoExecutorPayment; // payExecutor\n _targets[5] = INSTA_POOL_V2; // flashPayback\n\n bytes[] memory _datas = new bytes[](6);\n _datas[0] = _encodePaybackMakerVault(\n _payload.vaultId,\n uint256(-1),\n 0,\n 0\n );\n _datas[1] = _encodedWithdrawMakerVault(\n _payload.vaultId,\n uint256(-1),\n 0,\n 0\n );\n _datas[2] = _encodeDepositCompound(\n _payload.colToken,\n sub(wColToWithdrawFromMaker, gasFeesPaidFromCol),\n 0,\n 0\n );\n _datas[3] = _encodeBorrowCompound(DAI, wDaiDebtToMove, 0, 0);\n _datas[4] = _encodePayExecutor(\n _payload.colToken,\n gasFeesPaidFromCol,\n 0,\n 0\n );\n _datas[5] = _encodeFlashPayback(DAI, wDaiDebtToMove, 0, 0);\n\n datas = new bytes[](1);\n datas[0] = abi.encodeWithSelector(\n IConnectInstaPoolV2.flashBorrowAndCast.selector,\n DAI,\n wDaiDebtToMove,\n 0,\n abi.encode(_targets, _datas)\n );\n }\n\n /// @notice Computes values needed for DebtBridge Maker->ProtocolB\n /// @dev Use wad for colRatios.\n /// @param _vaultId The id of the makerDAO vault.\n /// @param _wMinColRatioMaker Min col ratio (wad) on Maker debt position\n /// @param _wMinColRatioB Min col ratio (wad) on debt position B (e.g. Compound, Maker, ...)\n /// @param _priceOracle The price oracle contract to supply the collateral price\n /// e.g. Maker's ETH/USD oracle for ETH collateral pricing.\n /// @param _oraclePayload The data for making the staticcall to the oracle's read\n /// method e.g. the function selector of MakerOracle's read function.\n /// @return wDaiDebtToMove DAI Debt (wad) to:\n /// flashBorrow->repay Maker->withdraw from B->flashPayback.\n /// @return wColToWithdrawFromMaker (wad) to: withdraw from Maker and deposit on B.\n /// @return gasFeesPaidFromCol Gelato automation-gas-fees paid from user's collateral\n function computeDebtBridge(\n uint256 _vaultId,\n uint256 _wMinColRatioMaker,\n uint256 _wMinColRatioB,\n address _priceOracle,\n bytes calldata _oraclePayload\n )\n public\n view\n returns (\n uint256 wDaiDebtToMove,\n uint256 wColToWithdrawFromMaker,\n uint256 gasFeesPaidFromCol\n )\n {\n uint256 wColPrice;\n\n // Stack too deep\n {\n (bool success, bytes memory returndata) =\n _priceOracle.staticcall(_oraclePayload);\n\n if (!success) {\n GelatoBytes.revertWithError(\n returndata,\n \"ConnectGelatoPartialDebtBridgeFromMaker.computeDebtBridge:oracle:\"\n );\n }\n\n wColPrice = abi.decode(returndata, (uint256));\n }\n\n // TO DO: add fee mechanism for non-ETH collateral debt bridge\n // uint256 gasFeesPaidFromCol = _mul(GAS_COST, wmul(_getGelatoGasPrice(), latestPrice));\n gasFeesPaidFromCol = _getGelatoExecutorFees(GAS_COST);\n\n uint256 wPricedCol =\n wmul(\n sub(\n _getMakerVaultCollateralBalance(_vaultId),\n gasFeesPaidFromCol\n ),\n wColPrice\n );\n\n uint256 wDaiDebtOnMaker = _getMakerVaultDebt(_vaultId);\n\n wColToWithdrawFromMaker = _wCalcCollateralToWithdraw(\n _wMinColRatioMaker,\n _wMinColRatioB,\n wColPrice,\n wPricedCol,\n wDaiDebtOnMaker\n );\n\n wDaiDebtToMove = _wCalcDebtToRepay(\n _wMinColRatioMaker,\n _wMinColRatioB,\n wPricedCol,\n wDaiDebtOnMaker\n );\n }\n\n /* solhint-enable function-max-lines */\n}\n" + }, + "contracts/interfaces/InstaDapp/connectors/IConnectInstaPoolV2.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\n\ninterface IConnectInstaPoolV2 {\n function flashBorrowAndCast(\n address token,\n uint256 amt,\n uint256 route,\n bytes memory data\n ) external payable;\n\n function flashPayback(\n address token,\n uint256 amt,\n uint256 getId,\n uint256 setId\n ) external payable;\n}\n" + }, + "contracts/functions/InstaDapp/connectors/FInstaPoolV2.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\n\nimport {\n IConnectInstaPoolV2\n} from \"../../../interfaces/InstaDapp/connectors/IConnectInstaPoolV2.sol\";\n\nfunction _encodeFlashPayback(\n address _token,\n uint256 _amt,\n uint256 _getId,\n uint256 _setId\n) pure returns (bytes memory) {\n return\n abi.encodeWithSelector(\n IConnectInstaPoolV2.flashPayback.selector,\n _token,\n _amt,\n _getId,\n _setId\n );\n}\n" + }, + "contracts/functions/InstaDapp/connectors/FConnectMaker.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\n\nimport {\n IConnectMaker\n} from \"../../../interfaces/InstaDapp/connectors/IConnectMaker.sol\";\n\nfunction _encodeOpenMakerVault(string memory _colType)\n pure\n returns (bytes memory)\n{\n return abi.encodeWithSelector(IConnectMaker.open.selector, _colType);\n}\n\nfunction _encodeBorrowMakerVault(\n uint256 _vaultId,\n uint256 _amt,\n uint256 _getId,\n uint256 _setId\n) pure returns (bytes memory) {\n return\n abi.encodeWithSelector(\n IConnectMaker.borrow.selector,\n _vaultId,\n _amt,\n _getId,\n _setId\n );\n}\n\nfunction _encodedDepositMakerVault(\n uint256 _vaultId,\n uint256 _amt,\n uint256 _getId,\n uint256 _setId\n) pure returns (bytes memory) {\n return\n abi.encodeWithSelector(\n IConnectMaker.deposit.selector,\n _vaultId,\n _amt,\n _getId,\n _setId\n );\n}\n\nfunction _encodePaybackMakerVault(\n uint256 _vaultId,\n uint256 _amt,\n uint256 _getId,\n uint256 _setId\n) pure returns (bytes memory) {\n return\n abi.encodeWithSelector(\n IConnectMaker.payback.selector,\n _vaultId,\n _amt,\n _getId,\n _setId\n );\n}\n\nfunction _encodedWithdrawMakerVault(\n uint256 _vaultId,\n uint256 _amt,\n uint256 _getId,\n uint256 _setId\n) pure returns (bytes memory) {\n return\n abi.encodeWithSelector(\n IConnectMaker.withdraw.selector,\n _vaultId,\n _amt,\n _getId,\n _setId\n );\n}\n" + }, + "contracts/functions/InstaDapp/connectors/FConnectGelatoExecutorPayment.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\n\nimport {\n IConnectGelatoExecutorPayment\n} from \"../../../interfaces/InstaDapp/connectors/IConnectGelatoExecutorPayment.sol\";\n\nfunction _encodePayExecutor(\n address _token,\n uint256 _amt,\n uint256 _getId,\n uint256 _setId\n) pure returns (bytes memory) {\n return\n abi.encodeWithSelector(\n IConnectGelatoExecutorPayment.payExecutor.selector,\n _token,\n _amt,\n _getId,\n _setId\n );\n}\n" + }, + "contracts/functions/InstaDapp/connectors/FConnectCompound.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\n\nimport {\n IConnectCompound\n} from \"../../../interfaces/InstaDapp/connectors/IConnectCompound.sol\";\n\nfunction _encodeDepositCompound(\n address _token,\n uint256 _amt,\n uint256 _getId,\n uint256 _setId\n) pure returns (bytes memory) {\n return\n abi.encodeWithSelector(\n IConnectCompound.deposit.selector,\n _token,\n _amt,\n _getId,\n _setId\n );\n}\n\nfunction _encodeBorrowCompound(\n address _token,\n uint256 _amt,\n uint256 _getId,\n uint256 _setId\n) pure returns (bytes memory) {\n return\n abi.encodeWithSelector(\n IConnectCompound.borrow.selector,\n _token,\n _amt,\n _getId,\n _setId\n );\n}\n" + }, + "contracts/interfaces/InstaDapp/connectors/IConnectMaker.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\n\ninterface IConnectMaker {\n function payback(\n uint256 vault,\n uint256 amt,\n uint256 getId,\n uint256 setId\n ) external payable;\n\n function borrow(\n uint256 vault,\n uint256 amt,\n uint256 getId,\n uint256 setId\n ) external payable;\n\n function open(string calldata colType)\n external\n payable\n returns (uint256 vault);\n\n function withdraw(\n uint256 vault,\n uint256 amt,\n uint256 getId,\n uint256 setId\n ) external payable;\n\n function deposit(\n uint256 vault,\n uint256 amt,\n uint256 getId,\n uint256 setId\n ) external payable;\n}\n" + }, + "contracts/interfaces/InstaDapp/connectors/IConnectGelatoExecutorPayment.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\n\nimport {ConnectorInterface} from \"../IInstaDapp.sol\";\n\ninterface IConnectGelatoExecutorPayment is ConnectorInterface {\n function payExecutor(\n address _token,\n uint256 _amt,\n uint256 _getId,\n uint256 _setId\n ) external payable;\n}\n" + }, + "contracts/interfaces/InstaDapp/connectors/IConnectCompound.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\n\ninterface IConnectCompound {\n function borrow(\n address token,\n uint256 amt,\n uint256 getId,\n uint256 setId\n ) external payable;\n\n function deposit(\n address token,\n uint256 amt,\n uint256 getId,\n uint256 setId\n ) external payable;\n}\n" + }, + "contracts/contracts/connectors/ConnectGelatoDataFullMakerToMaker.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\npragma experimental ABIEncoderV2;\n\nimport {GelatoBytes} from \"../../lib/GelatoBytes.sol\";\nimport {sub} from \"../../vendor/DSMath.sol\";\nimport {\n AccountInterface,\n ConnectorInterface\n} from \"../../interfaces/InstaDapp/IInstaDapp.sol\";\nimport {\n IConnectInstaPoolV2\n} from \"../../interfaces/InstaDapp/connectors/IConnectInstaPoolV2.sol\";\nimport {\n DAI,\n CONNECT_MAKER,\n INSTA_POOL_V2\n} from \"../../constants/CInstaDapp.sol\";\nimport {\n _getMakerVaultDebt,\n _getMakerVaultCollateralBalance,\n _isVaultOwner\n} from \"../../functions/dapps/FMaker.sol\";\nimport {\n _encodeFlashPayback\n} from \"../../functions/InstaDapp/connectors/FInstaPoolV2.sol\";\nimport {\n _encodePaybackMakerVault,\n _encodedWithdrawMakerVault,\n _encodeOpenMakerVault,\n _encodedDepositMakerVault,\n _encodeBorrowMakerVault\n} from \"../../functions/InstaDapp/connectors/FConnectMaker.sol\";\nimport {\n _encodePayExecutor\n} from \"../../functions/InstaDapp/connectors/FConnectGelatoExecutorPayment.sol\";\nimport {_getGelatoExecutorFees} from \"../../functions/gelato/FGelato.sol\";\nimport {\n _getFlashLoanRoute,\n _getGasCostMakerToMaker,\n _getRealisedDebt\n} from \"../../functions/gelato/FGelatoDebtBridge.sol\";\nimport {\n DataFlow\n} from \"@gelatonetwork/core/contracts/gelato_core/interfaces/IGelatoCore.sol\";\n\ncontract ConnectGelatoDataFullMakerToMaker is ConnectorInterface {\n using GelatoBytes for bytes;\n\n string public constant OK = \"OK\";\n\n // solhint-disable const-name-snakecase\n string public constant override name =\n \"ConnectGelatoDataFullMakerToMaker-v2.0\";\n uint256 internal immutable _id;\n address internal immutable _connectGelatoExecutorPayment;\n\n constructor(uint256 id, address connectGelatoExecutorPayment) {\n _id = id;\n _connectGelatoExecutorPayment = connectGelatoExecutorPayment;\n }\n\n /// @dev Connector Details\n function connectorID()\n external\n view\n override\n returns (uint256 _type, uint256 id)\n {\n (_type, id) = (1, _id); // Should put specific value.\n }\n\n // ====== ACTION TERMS CHECK ==========\n // Overriding IGelatoAction's function (optional)\n function termsOk(\n uint256, // taskReceipId\n address _dsa,\n bytes calldata _actionData,\n DataFlow,\n uint256, // value\n uint256 // cycleId\n ) public view returns (string memory) {\n (uint256 vaultAId, , , ) =\n abi.decode(_actionData[4:], (uint256, uint256, address, string));\n\n if (vaultAId == 0)\n return \"ConnectGelatoDataFullMakerToMaker: Vault A Id is not valid\";\n if (!_isVaultOwner(vaultAId, _dsa))\n return\n \"ConnectGelatoDataFullMakerToMaker: Vault A not owned by dsa\";\n return OK;\n }\n\n /// @notice Entry Point for DSA.cast DebtBridge from e.g ETH-A to ETH-B\n /// @dev payable to be compatible in conjunction with DSA.cast payable target\n /// @param _vaultAId Id of the unsafe vault of the client of Vault A Collateral.\n /// @param _vaultBId Id of the vault B Collateral of the client.\n /// @param _colToken vault's col token address .\n /// @param _colType colType of the new vault. example : ETH-B, ETH-A.\n function getDataAndCastMakerToMaker(\n uint256 _vaultAId,\n uint256 _vaultBId,\n address _colToken,\n string calldata _colType\n ) external payable {\n (address[] memory targets, bytes[] memory datas) =\n _dataMakerToMaker(_vaultAId, _vaultBId, _colToken, _colType);\n\n _cast(targets, datas);\n }\n\n function _cast(address[] memory targets, bytes[] memory datas) internal {\n // Instapool V2 / FlashLoan call\n bytes memory castData =\n abi.encodeWithSelector(\n AccountInterface.cast.selector,\n targets,\n datas,\n msg.sender // msg.sender == GelatoCore\n );\n\n (bool success, bytes memory returndata) =\n address(this).delegatecall(castData);\n if (!success) {\n returndata.revertWithError(\n \"ConnectGelatoDataFullMakerToMaker._cast:\"\n );\n }\n }\n\n /* solhint-disable function-max-lines */\n\n function _dataMakerToMaker(\n uint256 _vaultAId,\n uint256 _vaultBId,\n address _colToken,\n string calldata _colType\n ) internal view returns (address[] memory targets, bytes[] memory datas) {\n targets = new address[](1);\n targets[0] = INSTA_POOL_V2;\n\n _vaultBId = _isVaultOwner(_vaultBId, address(this)) ? _vaultBId : 0;\n\n uint256 wDaiToBorrow = _getRealisedDebt(_getMakerVaultDebt(_vaultAId));\n uint256 wColToWithdrawFromMaker =\n _getMakerVaultCollateralBalance(_vaultAId);\n uint256 route = _getFlashLoanRoute(DAI, wDaiToBorrow);\n uint256 gasCost = _getGasCostMakerToMaker(_vaultBId == 0, route);\n uint256 gasFeesPaidFromCol = _getGelatoExecutorFees(gasCost);\n\n (address[] memory _targets, bytes[] memory _datas) =\n _vaultBId == 0\n ? _spellsMakerToNewMakerVault(\n _vaultAId,\n _colToken,\n _colType,\n wDaiToBorrow,\n wColToWithdrawFromMaker,\n gasFeesPaidFromCol\n )\n : _spellsMakerToMaker(\n _vaultAId,\n _vaultBId,\n _colToken,\n wDaiToBorrow,\n wColToWithdrawFromMaker,\n gasFeesPaidFromCol\n );\n\n datas = new bytes[](1);\n datas[0] = abi.encodeWithSelector(\n IConnectInstaPoolV2.flashBorrowAndCast.selector,\n DAI,\n wDaiToBorrow,\n route,\n abi.encode(_targets, _datas)\n );\n }\n\n function _spellsMakerToNewMakerVault(\n uint256 _vaultAId,\n address _colToken,\n string calldata _colType,\n uint256 _wDaiToBorrow,\n uint256 _wColToWithdrawFromMaker,\n uint256 _gasFeesPaidFromCol\n ) internal view returns (address[] memory targets, bytes[] memory datas) {\n targets = new address[](7);\n targets[0] = CONNECT_MAKER; // payback\n targets[1] = CONNECT_MAKER; // withdraw\n targets[2] = CONNECT_MAKER; // open new B vault\n targets[3] = CONNECT_MAKER; // deposit\n targets[4] = CONNECT_MAKER; // borrow\n targets[5] = _connectGelatoExecutorPayment; // payExecutor\n targets[6] = INSTA_POOL_V2; // flashPayback\n\n datas = new bytes[](7);\n datas[0] = _encodePaybackMakerVault(_vaultAId, uint256(-1), 0, 600);\n datas[1] = _encodedWithdrawMakerVault(_vaultAId, uint256(-1), 0, 0);\n datas[2] = _encodeOpenMakerVault(_colType);\n datas[3] = _encodedDepositMakerVault(\n 0,\n sub(_wColToWithdrawFromMaker, _gasFeesPaidFromCol),\n 0,\n 0\n );\n datas[4] = _encodeBorrowMakerVault(0, 0, 600, 0);\n datas[5] = _encodePayExecutor(_colToken, _gasFeesPaidFromCol, 0, 0);\n datas[6] = _encodeFlashPayback(DAI, _wDaiToBorrow, 0, 0);\n }\n\n function _spellsMakerToMaker(\n uint256 _vaultAId,\n uint256 _vaultBId,\n address _colToken,\n uint256 _wDaiToBorrow,\n uint256 _wColToWithdrawFromMaker,\n uint256 _gasFeesPaidFromCol\n ) internal view returns (address[] memory targets, bytes[] memory datas) {\n targets = new address[](6);\n targets[0] = CONNECT_MAKER; // payback\n targets[1] = CONNECT_MAKER; // withdraw\n targets[2] = CONNECT_MAKER; // deposit\n targets[3] = CONNECT_MAKER; // borrow\n targets[4] = _connectGelatoExecutorPayment; // payExecutor\n targets[5] = INSTA_POOL_V2; // flashPayback\n\n datas = new bytes[](6);\n datas[0] = _encodePaybackMakerVault(_vaultAId, uint256(-1), 0, 600);\n datas[1] = _encodedWithdrawMakerVault(_vaultAId, uint256(-1), 0, 0);\n datas[2] = _encodedDepositMakerVault(\n _vaultBId,\n sub(_wColToWithdrawFromMaker, _gasFeesPaidFromCol),\n 0,\n 0\n );\n datas[3] = _encodeBorrowMakerVault(_vaultBId, 0, 600, 0);\n datas[4] = _encodePayExecutor(_colToken, _gasFeesPaidFromCol, 0, 0);\n datas[5] = _encodeFlashPayback(DAI, _wDaiToBorrow, 0, 0);\n }\n\n /* solhint-enable function-max-lines */\n}\n" + }, + "contracts/contracts/gelato/conditions/ConditionCompareUintsFromTwoSources.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\n\nimport {\n GelatoConditionsStandard\n} from \"@gelatonetwork/core/contracts/conditions/GelatoConditionsStandard.sol\";\nimport {SafeMath} from \"@openzeppelin/contracts/math/SafeMath.sol\";\nimport {\n IGelatoCore\n} from \"@gelatonetwork/core/contracts/gelato_core/interfaces/IGelatoCore.sol\";\nimport {GelatoBytes} from \"../../../lib/GelatoBytes.sol\";\n\n/// @notice A general contract for retrieving and comparing 2 uints from 2 contracts.\n/// @dev This contract only works if the refContracts fns returndata has a uint in\n/// the first 32-byte position.\ncontract ConditionCompareUintsFromTwoSources is GelatoConditionsStandard {\n using GelatoBytes for bytes;\n using SafeMath for uint256;\n\n /// @notice Helper to encode the Condition.data field off-chain\n function getConditionData(\n address _sourceA,\n address _sourceB,\n bytes calldata _sourceAData,\n bytes calldata _sourceBData,\n uint256 _minSpread\n ) public pure virtual returns (bytes memory) {\n return\n abi.encode(\n _sourceA,\n _sourceB,\n _sourceAData,\n _sourceBData,\n _minSpread\n );\n }\n\n /// @notice Gelato Standard Condition function.\n /// @dev Every Gelato Condition must have this function selector as entry point.\n /// @param _conditionData The encoded data from getConditionData()\n function ok(\n uint256,\n bytes calldata _conditionData,\n uint256\n ) public view virtual override returns (string memory) {\n (\n address _sourceA,\n address _sourceB,\n bytes memory _sourceAData,\n bytes memory _sourceBData,\n uint256 _minSpread\n ) =\n abi.decode(\n _conditionData,\n (address, address, bytes, bytes, uint256)\n );\n return\n compare(_sourceA, _sourceB, _sourceAData, _sourceBData, _minSpread);\n }\n\n /// @notice Compares 2 values from sourceA and sourceB to check if minSpread is there.\n /// @dev If you want to trigger when ContractA uint is greater than or equal\n /// to ContractB by _minSpread: (ContractA=_sourceA, ContractB=_sourceB)\n /// For the reverse (lower than/equal to): (ContractA=_sourceB, ContractB=_sourceA)\n /// @param _sourceA The first contract that returns a uint for comparison.\n /// @param _sourceB The second contract that returns a uint256 for comparison.\n /// @param _sourceAData Payload for retrieving the uint from _sourceA.\n /// @param _sourceBData Payload for retrieving the uint from _sourceB.\n /// @param _minSpread The minimum diff between sourceA and sourceB\n /// for the Condition to be relevant.\n /// @return OK if the Condition is fulfilled.\n function compare(\n address _sourceA,\n address _sourceB,\n bytes memory _sourceAData,\n bytes memory _sourceBData,\n uint256 _minSpread\n ) public view virtual returns (string memory) {\n // Retrieve uint256 from sourceA\n (bool success, bytes memory returndata) =\n _sourceA.staticcall(_sourceAData);\n if (!success) {\n return\n returndata.returnError(\n \"ConditionCompareTwoUints.compare._sourceA:\"\n );\n }\n uint256 a = abi.decode(returndata, (uint256));\n\n // Retrieve uint256 from sourceB\n (success, returndata) = _sourceB.staticcall(_sourceBData);\n if (!success) {\n return\n returndata.returnError(\n \"ConditionCompareTwoUints.compare._sourceB:\"\n );\n }\n uint256 b = abi.decode(returndata, (uint256));\n\n if (a >= b.add(_minSpread)) return OK;\n return \"ANotGreaterOrEqualToBbyMinspread\";\n }\n}\n" + }, + "@openzeppelin/contracts/math/SafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\n * checks.\n *\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\n * in bugs, because programmers usually assume that an overflow raises an\n * error, which is the standard behavior in high level programming languages.\n * `SafeMath` restores this intuition by reverting the transaction when an\n * operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers. Reverts on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers. Reverts with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * Reverts when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return mod(a, b, \"SafeMath: modulo by zero\");\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * Reverts with custom message when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b != 0, errorMessage);\n return a % b;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"../../math/SafeMath.sol\";\nimport \"../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using SafeMath for uint256;\n using Address for address;\n\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n // solhint-disable-next-line max-line-length\n require((value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 newAllowance = token.allowance(address(this), spender).add(value);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 newAllowance = token.allowance(address(this), spender).sub(value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) { // Return data is optional\n // solhint-disable-next-line max-line-length\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.2 <0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n // solhint-disable-next-line no-inline-assembly\n assembly { size := extcodesize(account) }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\n (bool success, ) = recipient.call{ value: amount }(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain`call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.staticcall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/contracts/connectors/ConnectGelatoExecutorPayment.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\n\nimport {\n IConnectGelatoExecutorPayment\n} from \"../../interfaces/InstaDapp/connectors/IConnectGelatoExecutorPayment.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/SafeERC20.sol\";\nimport {_getUint, _setUint} from \"../../functions/InstaDapp/FInstaDapp.sol\";\nimport {ETH} from \"../../constants/CInstaDapp.sol\";\n\n/// @title ConnectGelatoExecutorPayment\n/// @notice InstaDapp Connector to compensate Gelato Executors for automation-gas.\n/// @author Gelato Team\ncontract ConnectGelatoExecutorPayment is IConnectGelatoExecutorPayment {\n using Address for address payable;\n using SafeERC20 for IERC20;\n\n // solhint-disable-next-line const-name-snakecase\n string public constant override name = \"ConnectGelatoExecutorPayment-v1.0\";\n\n uint256 internal immutable _id;\n\n constructor(uint256 id) {\n _id = id;\n }\n\n /// @dev Connector Details\n function connectorID()\n external\n view\n override\n returns (uint256 _type, uint256 id)\n {\n (_type, id) = (1, _id); // Should put specific value.\n }\n\n /// @notice Transfers automation gas fees to Gelato Executor\n /// @dev Gelato Executor risks:\n /// - _getId does not match actual InstaMemory executor payment slot\n /// - _token balance not in DSA\n /// - worthless _token risk\n /// payable to be compatible in conjunction with DSA.cast payable target\n /// @param _token The token used to pay the Executor.\n /// @param _amt The amount of _token to pay the Gelato Executor.\n /// @param _getId The InstaMemory slot at which the payment amount was stored.\n /// @param _setId The InstaMemory slot to save the executor payout amound in.\n function payExecutor(\n address _token,\n uint256 _amt,\n uint256 _getId,\n uint256 _setId\n ) external payable override {\n uint256 amt = _getUint(_getId, _amt);\n _setUint(_setId, amt);\n if (_token == ETH) payable(tx.origin).sendValue(amt);\n else IERC20(_token).safeTransfer(tx.origin, amt);\n }\n}\n" + }, + "contracts/contracts/connectors/ConnectGelatoDataFullMakerToCompound.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\npragma experimental ABIEncoderV2;\n\nimport {GelatoBytes} from \"../../lib/GelatoBytes.sol\";\nimport {sub} from \"../../vendor/DSMath.sol\";\nimport {\n AccountInterface,\n ConnectorInterface\n} from \"../../interfaces/InstaDapp/IInstaDapp.sol\";\nimport {\n IConnectInstaPoolV2\n} from \"../../interfaces/InstaDapp/connectors/IConnectInstaPoolV2.sol\";\nimport {\n DAI,\n CONNECT_MAKER,\n CONNECT_COMPOUND,\n INSTA_POOL_V2\n} from \"../../constants/CInstaDapp.sol\";\nimport {\n _getMakerVaultDebt,\n _getMakerVaultCollateralBalance,\n _isVaultOwner\n} from \"../../functions/dapps/FMaker.sol\";\nimport {\n _encodeFlashPayback\n} from \"../../functions/InstaDapp/connectors/FInstaPoolV2.sol\";\nimport {\n _encodePaybackMakerVault,\n _encodedWithdrawMakerVault\n} from \"../../functions/InstaDapp/connectors/FConnectMaker.sol\";\nimport {\n _encodePayExecutor\n} from \"../../functions/InstaDapp/connectors/FConnectGelatoExecutorPayment.sol\";\nimport {\n _encodeDepositCompound,\n _encodeBorrowCompound\n} from \"../../functions/InstaDapp/connectors/FConnectCompound.sol\";\nimport {_getGelatoExecutorFees} from \"../../functions/gelato/FGelato.sol\";\nimport {\n _getFlashLoanRoute,\n _getGasCostMakerToCompound,\n _getRealisedDebt\n} from \"../../functions/gelato/FGelatoDebtBridge.sol\";\nimport {\n DataFlow\n} from \"@gelatonetwork/core/contracts/gelato_core/interfaces/IGelatoCore.sol\";\n\ncontract ConnectGelatoDataFullMakerToCompound is ConnectorInterface {\n using GelatoBytes for bytes;\n\n string public constant OK = \"OK\";\n\n // solhint-disable const-name-snakecase\n string public constant override name =\n \"ConnectGelatoDataFullMakerToCompound-v1.0\";\n uint256 internal immutable _id;\n address internal immutable _connectGelatoExecutorPayment;\n\n constructor(uint256 id, address connectGelatoExecutorPayment) {\n _id = id;\n _connectGelatoExecutorPayment = connectGelatoExecutorPayment;\n }\n\n /// @dev Connector Details\n function connectorID()\n external\n view\n override\n returns (uint256 _type, uint256 id)\n {\n (_type, id) = (1, _id); // Should put specific value.\n }\n\n // ====== ACTION TERMS CHECK ==========\n /// @notice GelatoCore protocol standard function\n /// @dev GelatoCore calls this to verify that a Task is executable\n function termsOk(\n uint256, // taskReceipId\n address _dsa,\n bytes calldata _actionData,\n DataFlow, // DataFlow\n uint256, // value\n uint256 // cycleId\n ) public view returns (string memory) {\n (uint256 vaultId, ) = abi.decode(_actionData[4:], (uint256, address));\n\n if (vaultId == 0)\n return\n \"ConnectGelatoDataFullMakerToCompound: Vault Id is not valid\";\n if (!_isVaultOwner(vaultId, _dsa))\n return\n \"ConnectGelatoDataFullMakerToCompound: Vault not owned by dsa\";\n return OK;\n }\n\n /// @notice Entry Point for DSA.cast DebtBridge from Maker to Compound\n /// @dev payable to be compatible in conjunction with DSA.cast payable target\n /// @param _vaultId Id of the unsafe vault of the client.\n /// @param _colToken vault's col token address .\n function getDataAndCastMakerToCompound(uint256 _vaultId, address _colToken)\n external\n payable\n {\n (address[] memory targets, bytes[] memory datas) =\n _dataMakerToCompound(_vaultId, _colToken);\n\n _cast(targets, datas);\n }\n\n function _cast(address[] memory targets, bytes[] memory datas) internal {\n // Instapool V2 / FlashLoan call\n bytes memory castData =\n abi.encodeWithSelector(\n AccountInterface.cast.selector,\n targets,\n datas,\n msg.sender // msg.sender == GelatoCore\n );\n\n (bool success, bytes memory returndata) =\n address(this).delegatecall(castData);\n if (!success) {\n returndata.revertWithError(\n \"ConnectGelatoDataFullRefinanceMaker._cast:\"\n );\n }\n }\n\n /* solhint-disable function-max-lines */\n\n function _dataMakerToCompound(uint256 _vaultId, address _colToken)\n internal\n view\n returns (address[] memory targets, bytes[] memory datas)\n {\n targets = new address[](1);\n targets[0] = INSTA_POOL_V2;\n\n uint256 wDaiToBorrow = _getRealisedDebt(_getMakerVaultDebt(_vaultId));\n uint256 wColToWithdrawFromMaker =\n _getMakerVaultCollateralBalance(_vaultId);\n uint256 route = _getFlashLoanRoute(DAI, wDaiToBorrow);\n uint256 gasCost = _getGasCostMakerToCompound(route);\n uint256 gasFeesPaidFromCol = _getGelatoExecutorFees(gasCost);\n\n address[] memory _targets = new address[](6);\n _targets[0] = CONNECT_MAKER; // payback\n _targets[1] = CONNECT_MAKER; // withdraw\n _targets[2] = CONNECT_COMPOUND; // deposit\n _targets[3] = CONNECT_COMPOUND; // borrow\n _targets[4] = _connectGelatoExecutorPayment; // payExecutor\n _targets[5] = INSTA_POOL_V2; // flashPayback\n\n bytes[] memory _datas = new bytes[](6);\n _datas[0] = _encodePaybackMakerVault(_vaultId, uint256(-1), 0, 600);\n _datas[1] = _encodedWithdrawMakerVault(_vaultId, uint256(-1), 0, 0);\n _datas[2] = _encodeDepositCompound(\n _colToken,\n sub(wColToWithdrawFromMaker, gasFeesPaidFromCol),\n 0,\n 0\n );\n _datas[3] = _encodeBorrowCompound(DAI, 0, 600, 0);\n _datas[4] = _encodePayExecutor(_colToken, gasFeesPaidFromCol, 0, 0);\n _datas[5] = _encodeFlashPayback(DAI, wDaiToBorrow, 0, 0);\n\n datas = new bytes[](1);\n datas[0] = abi.encodeWithSelector(\n IConnectInstaPoolV2.flashBorrowAndCast.selector,\n DAI,\n wDaiToBorrow,\n route,\n abi.encode(_targets, _datas)\n );\n }\n\n /* solhint-enable function-max-lines */\n}\n" + }, + "contracts/__mocks__/connectors/MockConnectGelatoDataFullMakerToMaker.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\npragma experimental ABIEncoderV2;\n\nimport {GelatoBytes} from \"../../lib/GelatoBytes.sol\";\nimport {sub} from \"../../vendor/DSMath.sol\";\nimport {\n AccountInterface,\n ConnectorInterface\n} from \"../../interfaces/InstaDapp/IInstaDapp.sol\";\nimport {\n IConnectInstaPoolV2\n} from \"../../interfaces/InstaDapp/connectors/IConnectInstaPoolV2.sol\";\nimport {\n DAI,\n CONNECT_MAKER,\n CONNECT_COMPOUND,\n INSTA_POOL_V2\n} from \"../../constants/CInstaDapp.sol\";\nimport {\n _getMakerVaultDebt,\n _getMakerVaultCollateralBalance,\n _isVaultOwner\n} from \"../../functions/dapps/FMaker.sol\";\nimport {\n _encodeFlashPayback\n} from \"../../functions/InstaDapp/connectors/FInstaPoolV2.sol\";\nimport {\n _encodePaybackMakerVault,\n _encodedWithdrawMakerVault,\n _encodeOpenMakerVault,\n _encodedDepositMakerVault,\n _encodeBorrowMakerVault\n} from \"../../functions/InstaDapp/connectors/FConnectMaker.sol\";\nimport {\n _encodePayExecutor\n} from \"../../functions/InstaDapp/connectors/FConnectGelatoExecutorPayment.sol\";\nimport {\n _encodeDepositCompound,\n _encodeBorrowCompound\n} from \"../../functions/InstaDapp/connectors/FConnectCompound.sol\";\nimport {_getGelatoExecutorFees} from \"../../functions/gelato/FGelato.sol\";\nimport {\n _getFlashLoanRoute,\n _getGasCostMakerToMaker,\n _getGasCostMakerToCompound,\n _getRealisedDebt\n} from \"../../functions/gelato/FGelatoDebtBridge.sol\";\nimport {\n DataFlow\n} from \"@gelatonetwork/core/contracts/gelato_core/interfaces/IGelatoCore.sol\";\n\ncontract MockConnectGelatoDataFullMakerToMaker is ConnectorInterface {\n using GelatoBytes for bytes;\n\n string public constant OK = \"OK\";\n\n // solhint-disable const-name-snakecase\n string public constant override name =\n \"MockConnectGelatoDataFullMakerToMaker-v1.0\";\n uint256 internal immutable _id;\n address internal immutable _connectGelatoExecutorPayment;\n\n constructor(uint256 id, address connectGelatoExecutorPayment) {\n _id = id;\n _connectGelatoExecutorPayment = connectGelatoExecutorPayment;\n }\n\n /// @dev Connector Details\n function connectorID()\n external\n view\n override\n returns (uint256 _type, uint256 id)\n {\n (_type, id) = (1, _id); // Should put specific value.\n }\n\n // ====== ACTION TERMS CHECK ==========\n // Overriding IGelatoAction's function (optional)\n function termsOk(\n uint256, // taskReceipId\n address _dsa,\n bytes calldata _actionData,\n DataFlow,\n uint256, // value\n uint256 // cycleId\n ) public view returns (string memory) {\n (, uint256 vaultAId, , , ) =\n abi.decode(\n _actionData[4:],\n (uint256, uint256, uint256, address, string)\n );\n\n if (vaultAId == 0)\n return \"ConnectGelatoDataFullMakerToMaker: Vault A Id is not valid\";\n if (!_isVaultOwner(vaultAId, _dsa))\n return\n \"ConnectGelatoDataFullMakerToMaker: Vault A not owned by dsa\";\n return OK;\n }\n\n /// @notice Entry Point for DSA.cast DebtBridge from e.g ETH-A to ETH-B\n /// @dev payable to be compatible in conjunction with DSA.cast payable target\n /// @param _mockRoute we mock this behavior for gas-reporter testing\n /// @param _vaultAId Id of the unsafe vault of the client of Vault A Collateral.\n /// @param _vaultBId Id of the vault B Collateral of the client.\n /// @param _colToken vault's col token address .\n /// @param _colType colType of the new vault. example : ETH-B, ETH-A.\n function getDataAndCastMakerToMaker(\n uint256 _mockRoute,\n uint256 _vaultAId,\n uint256 _vaultBId,\n address _colToken,\n string calldata _colType\n ) external payable {\n (address[] memory targets, bytes[] memory datas) =\n _dataMakerToMaker(\n _mockRoute,\n _vaultAId,\n _vaultBId,\n _colToken,\n _colType\n );\n\n _cast(targets, datas);\n }\n\n function _cast(address[] memory targets, bytes[] memory datas) internal {\n // Instapool V2 / FlashLoan call\n bytes memory castData =\n abi.encodeWithSelector(\n AccountInterface.cast.selector,\n targets,\n datas,\n msg.sender // msg.sender == GelatoCore\n );\n\n (bool success, bytes memory returndata) =\n address(this).delegatecall(castData);\n if (!success) {\n returndata.revertWithError(\n \"ConnectGelatoDataFullMakerToMaker._cast:\"\n );\n }\n }\n\n /* solhint-disable function-max-lines */\n\n function _dataMakerToMaker(\n uint256 _mockRoute,\n uint256 _vaultAId,\n uint256 _vaultBId,\n address _colToken,\n string calldata _colType\n ) internal view returns (address[] memory targets, bytes[] memory datas) {\n targets = new address[](1);\n targets[0] = INSTA_POOL_V2;\n\n _vaultBId = _isVaultOwner(_vaultBId, address(this)) ? _vaultBId : 0;\n\n uint256 wDaiToBorrow = _getRealisedDebt(_getMakerVaultDebt(_vaultAId));\n uint256 wColToWithdrawFromMaker =\n _getMakerVaultCollateralBalance(_vaultAId);\n uint256 route = _getFlashLoanRoute(DAI, wDaiToBorrow);\n\n // Mock Route\n route = _mockRoute;\n\n uint256 gasCost = _getGasCostMakerToMaker(_vaultBId == 0, route);\n uint256 gasFeesPaidFromCol = _getGelatoExecutorFees(gasCost);\n\n (address[] memory _targets, bytes[] memory _datas) =\n _vaultBId == 0\n ? _spellsMakerToNewMakerVault(\n _vaultAId,\n _colToken,\n _colType,\n wDaiToBorrow,\n wColToWithdrawFromMaker,\n gasFeesPaidFromCol\n )\n : _spellsMakerToMaker(\n _vaultAId,\n _vaultBId,\n _colToken,\n wDaiToBorrow,\n wColToWithdrawFromMaker,\n gasFeesPaidFromCol\n );\n\n datas = new bytes[](1);\n datas[0] = abi.encodeWithSelector(\n IConnectInstaPoolV2.flashBorrowAndCast.selector,\n DAI,\n wDaiToBorrow,\n route,\n abi.encode(_targets, _datas)\n );\n }\n\n function _spellsMakerToNewMakerVault(\n uint256 _vaultAId,\n address _colToken,\n string calldata _colType,\n uint256 _wDaiToBorrow,\n uint256 _wColToWithdrawFromMaker,\n uint256 _gasFeesPaidFromCol\n ) internal view returns (address[] memory targets, bytes[] memory datas) {\n targets = new address[](7);\n targets[0] = CONNECT_MAKER; // payback\n targets[1] = CONNECT_MAKER; // withdraw\n targets[2] = CONNECT_MAKER; // open new B vault\n targets[3] = CONNECT_MAKER; // deposit\n targets[4] = CONNECT_MAKER; // borrow\n targets[5] = _connectGelatoExecutorPayment; // payExecutor\n targets[6] = INSTA_POOL_V2; // flashPayback\n\n datas = new bytes[](7);\n datas[0] = _encodePaybackMakerVault(_vaultAId, uint256(-1), 0, 600);\n datas[1] = _encodedWithdrawMakerVault(_vaultAId, uint256(-1), 0, 0);\n datas[2] = _encodeOpenMakerVault(_colType);\n datas[3] = _encodedDepositMakerVault(\n 0,\n sub(_wColToWithdrawFromMaker, _gasFeesPaidFromCol),\n 0,\n 0\n );\n datas[4] = _encodeBorrowMakerVault(0, 0, 600, 0);\n datas[5] = _encodePayExecutor(_colToken, _gasFeesPaidFromCol, 0, 0);\n datas[6] = _encodeFlashPayback(DAI, _wDaiToBorrow, 0, 0);\n }\n\n function _spellsMakerToMaker(\n uint256 _vaultAId,\n uint256 _vaultBId,\n address _colToken,\n uint256 _wDaiToBorrow,\n uint256 _wColToWithdrawFromMaker,\n uint256 _gasFeesPaidFromCol\n ) internal view returns (address[] memory targets, bytes[] memory datas) {\n targets = new address[](6);\n targets[0] = CONNECT_MAKER; // payback\n targets[1] = CONNECT_MAKER; // withdraw\n targets[2] = CONNECT_MAKER; // deposit\n targets[3] = CONNECT_MAKER; // borrow\n targets[4] = _connectGelatoExecutorPayment; // payExecutor\n targets[5] = INSTA_POOL_V2; // flashPayback\n\n datas = new bytes[](6);\n datas[0] = _encodePaybackMakerVault(_vaultAId, uint256(-1), 0, 600);\n datas[1] = _encodedWithdrawMakerVault(_vaultAId, uint256(-1), 0, 0);\n datas[2] = _encodedDepositMakerVault(\n _vaultBId,\n sub(_wColToWithdrawFromMaker, _gasFeesPaidFromCol),\n 0,\n 0\n );\n datas[3] = _encodeBorrowMakerVault(_vaultBId, 0, 600, 0);\n datas[4] = _encodePayExecutor(_colToken, _gasFeesPaidFromCol, 0, 0);\n datas[5] = _encodeFlashPayback(DAI, _wDaiToBorrow, 0, 0);\n }\n\n /* solhint-enable function-max-lines */\n}\n" + }, + "contracts/contracts/resolvers/MakerResolver.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\n\nimport {\n _getMakerRawVaultDebt,\n _getMakerVaultDebt,\n _getMakerVaultCollateralBalance,\n _vaultWillBeSafe,\n _newVaultWillBeSafe\n} from \"../../functions/dapps/FMaker.sol\";\n\ncontract MakerResolver {\n /// @dev Return Debt in wad of the vault associated to the vaultId.\n function getMakerVaultRawDebt(uint256 _vaultId)\n public\n view\n returns (uint256)\n {\n return _getMakerRawVaultDebt(_vaultId);\n }\n\n function getMakerVaultDebt(uint256 _vaultId) public view returns (uint256) {\n return _getMakerVaultDebt(_vaultId);\n }\n\n /// @dev Return Collateral in wad of the vault associated to the vaultId.\n function getMakerVaultCollateralBalance(uint256 _vaultId)\n public\n view\n returns (uint256)\n {\n return _getMakerVaultCollateralBalance(_vaultId);\n }\n\n function vaultWillBeSafe(\n uint256 _vaultId,\n uint256 _amtToBorrow,\n uint256 _colToDeposit\n ) public view returns (bool) {\n return _vaultWillBeSafe(_vaultId, _amtToBorrow, _colToDeposit);\n }\n\n function newVaultWillBeSafe(\n string memory _colType,\n uint256 _amtToBorrow,\n uint256 _colToDeposit\n ) public view returns (bool) {\n return _newVaultWillBeSafe(_colType, _amtToBorrow, _colToDeposit);\n }\n}\n" + }, + "contracts/__mocks__/gelato/MockDebtBridgeETHBExecutor.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\npragma experimental ABIEncoderV2;\n\n// import \"hardhat/console.sol\"; // Uncomment this line for using gasLeft Method\nimport {\n TaskReceipt\n} from \"@gelatonetwork/core/contracts/gelato_core/interfaces/IGelatoCore.sol\";\nimport {\n IGelatoCore\n} from \"@gelatonetwork/core/contracts/gelato_core/interfaces/IGelatoCore.sol\";\nimport {\n IGelatoExecutors\n} from \"@gelatonetwork/core/contracts/gelato_core/interfaces/IGelatoExecutors.sol\";\nimport {GelatoBytes} from \"../../lib/GelatoBytes.sol\";\n\n/// @dev Automatic gas-reporting for ConnectGelatoDataFullRefinanceMaker ETHA => ETHB\n// via hardhat-gas-reporter\ncontract MockDebtBridgeETHBExecutor {\n using GelatoBytes for bytes;\n address public gelatoCore;\n\n constructor(address _gelatoCore) payable {\n gelatoCore = _gelatoCore;\n IGelatoExecutors(gelatoCore).stakeExecutor{value: msg.value}();\n }\n\n function canExec(\n TaskReceipt calldata _taskReceipt,\n uint256 _gasLimit,\n uint256 _execTxGasPrice\n ) external view returns (string memory) {\n return\n IGelatoCore(gelatoCore).canExec(\n _taskReceipt,\n _gasLimit,\n _execTxGasPrice\n );\n }\n\n function exec(TaskReceipt memory _taskReceipt) public {\n // uint256 gasLeft = gasleft();\n IGelatoCore(gelatoCore).exec(_taskReceipt);\n // console.log(\"Gas Cost for Task Execution %s\", gasLeft - gasleft());\n }\n\n function execViaRoute0(TaskReceipt memory _taskReceipt) public {\n // uint256 gasLeft = gasleft();\n IGelatoCore(gelatoCore).exec(_taskReceipt);\n // console.log(\"Gas Cost execViaRoute0: %s\", gasLeft - gasleft());\n }\n\n function execViaRoute0AndOpenVault(TaskReceipt memory _taskReceipt) public {\n // uint256 gasLeft = gasleft();\n IGelatoCore(gelatoCore).exec(_taskReceipt);\n // console.log(\n // \"Gas Cost execViaRoute0AndOpenVault: %s\",\n // gasLeft - gasleft()\n // );\n }\n\n function execViaRoute1(TaskReceipt memory _taskReceipt) public {\n // uint256 gasLeft = gasleft();\n IGelatoCore(gelatoCore).exec(_taskReceipt);\n // console.log(\"Gas Cost execViaRoute1: %s\", gasLeft - gasleft());\n }\n\n function execViaRoute1AndOpenVault(TaskReceipt memory _taskReceipt) public {\n // uint256 gasLeft = gasleft();\n IGelatoCore(gelatoCore).exec(_taskReceipt);\n // console.log(\n // \"Gas Cost execViaRoute1AndOpenVault: %s\",\n // gasLeft - gasleft()\n // );\n }\n\n function execViaRoute2(TaskReceipt memory _taskReceipt) public {\n // uint256 gasLeft = gasleft();\n IGelatoCore(gelatoCore).exec(_taskReceipt);\n // console.log(\"Gas Cost execViaRoute2: %s\", gasLeft - gasleft());\n }\n\n function execViaRoute2AndOpenVault(TaskReceipt memory _taskReceipt) public {\n // uint256 gasLeft = gasleft();\n IGelatoCore(gelatoCore).exec(_taskReceipt);\n // console.log(\n // \"Gas Cost execViaRoute2AndOpenVault %s\",\n // gasLeft - gasleft()\n // );\n }\n\n function execViaRoute3(TaskReceipt memory _taskReceipt) public {\n // uint256 gasLeft = gasleft();\n IGelatoCore(gelatoCore).exec(_taskReceipt);\n // console.log(\"Gas Cost execViaRoute3: %s\", gasLeft - gasleft());\n }\n\n function execViaRoute3AndOpenVault(TaskReceipt memory _taskReceipt) public {\n // uint256 gasLeft = gasleft();\n IGelatoCore(gelatoCore).exec(_taskReceipt);\n // console.log(\n // \"Gas Cost execViaRoute3AndOpenVAult: %s\",\n // gasLeft - gasleft()\n // );\n }\n}\n" + }, + "@gelatonetwork/core/contracts/gelato_core/interfaces/IGelatoExecutors.sol": { + "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity >=0.6.10;\n\ninterface IGelatoExecutors {\n event LogExecutorStaked(address indexed executor, uint256 oldStake, uint256 newStake);\n event LogExecutorUnstaked(address indexed executor);\n\n event LogExecutorBalanceWithdrawn(\n address indexed executor,\n uint256 withdrawAmount\n );\n\n /// @notice Stake on Gelato to become a whitelisted executor\n /// @dev Msg.value has to be >= minExecutorStake\n function stakeExecutor() external payable;\n\n /// @notice Unstake on Gelato to become de-whitelisted and withdraw minExecutorStake\n function unstakeExecutor() external;\n\n /// @notice Re-assigns multiple providers to other executors\n /// @dev Executors must re-assign all providers before being able to unstake\n /// @param _providers List of providers to re-assign\n /// @param _newExecutor Address of new executor to assign providers to\n function multiReassignProviders(address[] calldata _providers, address _newExecutor)\n external;\n\n\n /// @notice Withdraw excess Execur Stake\n /// @dev Can only be called if executor is isExecutorMinStaked\n /// @param _withdrawAmount Amount to withdraw\n /// @return Amount that was actually withdrawn\n function withdrawExcessExecutorStake(uint256 _withdrawAmount) external returns(uint256);\n\n}\n" + }, + "@gelatonetwork/core/contracts/libraries/GelatoBytes.sol": { + "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity >=0.6.10;\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 revertWithErrorString(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" + }, + "@gelatonetwork/core/contracts/gelato_core/interfaces/IGelatoSysAdmin.sol": { + "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity >=0.6.10;\n\ninterface IGelatoSysAdmin {\n struct GelatoSysAdminInitialState {\n address gelatoGasPriceOracle;\n bytes oracleRequestData;\n uint256 gelatoMaxGas;\n uint256 internalGasRequirement;\n uint256 minExecutorStake;\n uint256 executorSuccessShare;\n uint256 sysAdminSuccessShare;\n uint256 totalSuccessShare;\n }\n\n // Events\n event LogGelatoGasPriceOracleSet(address indexed oldOracle, address indexed newOracle);\n event LogOracleRequestDataSet(bytes oldData, bytes newData);\n\n event LogGelatoMaxGasSet(uint256 oldMaxGas, uint256 newMaxGas);\n event LogInternalGasRequirementSet(uint256 oldRequirment, uint256 newRequirment);\n\n event LogMinExecutorStakeSet(uint256 oldMin, uint256 newMin);\n\n event LogExecutorSuccessShareSet(uint256 oldShare, uint256 newShare, uint256 total);\n event LogSysAdminSuccessShareSet(uint256 oldShare, uint256 newShare, uint256 total);\n\n event LogSysAdminFundsWithdrawn(uint256 oldBalance, uint256 newBalance);\n\n // State Writing\n\n /// @notice Assign new gas price oracle\n /// @dev Only callable by sysAdmin\n /// @param _newOracle Address of new oracle\n function setGelatoGasPriceOracle(address _newOracle) external;\n\n /// @notice Assign new gas price oracle\n /// @dev Only callable by sysAdmin\n /// @param _requestData The encoded payload for the staticcall to the oracle.\n function setOracleRequestData(bytes calldata _requestData) external;\n\n /// @notice Assign new maximum gas limit providers can consume in executionWrapper()\n /// @dev Only callable by sysAdmin\n /// @param _newMaxGas New maximum gas limit\n function setGelatoMaxGas(uint256 _newMaxGas) external;\n\n /// @notice Assign new interal gas limit requirement for exec()\n /// @dev Only callable by sysAdmin\n /// @param _newRequirement New internal gas requirement\n function setInternalGasRequirement(uint256 _newRequirement) external;\n\n /// @notice Assign new minimum executor stake\n /// @dev Only callable by sysAdmin\n /// @param _newMin New minimum executor stake\n function setMinExecutorStake(uint256 _newMin) external;\n\n /// @notice Assign new success share for executors to receive after successful execution\n /// @dev Only callable by sysAdmin\n /// @param _percentage New % success share of total gas consumed\n function setExecutorSuccessShare(uint256 _percentage) external;\n\n /// @notice Assign new success share for sysAdmin to receive after successful execution\n /// @dev Only callable by sysAdmin\n /// @param _percentage New % success share of total gas consumed\n function setSysAdminSuccessShare(uint256 _percentage) external;\n\n /// @notice Withdraw sysAdmin funds\n /// @dev Only callable by sysAdmin\n /// @param _amount Amount to withdraw\n /// @param _to Address to receive the funds\n function withdrawSysAdminFunds(uint256 _amount, address payable _to) external returns(uint256);\n\n // State Reading\n /// @notice Unaccounted tx overhead that will be refunded to executors\n function EXEC_TX_OVERHEAD() external pure returns(uint256);\n\n /// @notice Addess of current Gelato Gas Price Oracle\n function gelatoGasPriceOracle() external view returns(address);\n\n /// @notice Getter for oracleRequestData state variable\n function oracleRequestData() external view returns(bytes memory);\n\n /// @notice Gas limit an executor has to submit to get refunded even if actions revert\n function gelatoMaxGas() external view returns(uint256);\n\n /// @notice Internal gas limit requirements ti ensure executor payout\n function internalGasRequirement() external view returns(uint256);\n\n /// @notice Minimum stake required from executors\n function minExecutorStake() external view returns(uint256);\n\n /// @notice % Fee executors get as a reward for a successful execution\n function executorSuccessShare() external view returns(uint256);\n\n /// @notice Total % Fee executors and sysAdmin collectively get as a reward for a successful execution\n /// @dev Saves a state read\n function totalSuccessShare() external view returns(uint256);\n\n /// @notice Get total fee providers pay executors for a successful execution\n /// @param _gas Gas consumed by transaction\n /// @param _gasPrice Current gelato gas price\n function executorSuccessFee(uint256 _gas, uint256 _gasPrice)\n external\n view\n returns(uint256);\n\n /// @notice % Fee sysAdmin gets as a reward for a successful execution\n function sysAdminSuccessShare() external view returns(uint256);\n\n /// @notice Get total fee providers pay sysAdmin for a successful execution\n /// @param _gas Gas consumed by transaction\n /// @param _gasPrice Current gelato gas price\n function sysAdminSuccessFee(uint256 _gas, uint256 _gasPrice)\n external\n view\n returns(uint256);\n\n /// @notice Get sysAdminds funds\n function sysAdminFunds() external view returns(uint256);\n}\n" + }, + "@gelatonetwork/core/contracts/actions/IGelatoAction.sol": { + "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity >=0.6.10;\n\nimport {DataFlow} from \"../gelato_core/interfaces/IGelatoCore.sol\";\n\n/// @title IGelatoAction - solidity interface of GelatoActionsStandard\n/// @notice all the APIs and events of GelatoActionsStandard\n/// @dev all the APIs are implemented inside GelatoActionsStandard\ninterface IGelatoAction {\n event LogOneWay(\n address origin,\n address sendToken,\n uint256 sendAmount,\n address destination\n );\n\n event LogTwoWay(\n address origin,\n address sendToken,\n uint256 sendAmount,\n address destination,\n address receiveToken,\n uint256 receiveAmount,\n address receiver\n );\n\n /// @notice Providers can use this for pre-execution sanity checks, to prevent reverts.\n /// @dev GelatoCore checks this in canExec and passes the parameters.\n /// @param _taskReceiptId The id of the task from which all arguments are passed.\n /// @param _userProxy The userProxy of the task. Often address(this) for delegatecalls.\n /// @param _actionData The encoded payload to be used in the Action.\n /// @param _dataFlow The dataFlow of the Action.\n /// @param _value A special param for ETH sending Actions. If the Action sends ETH\n /// in its Action function implementation, one should expect msg.value therein to be\n /// equal to _value. So Providers can check in termsOk that a valid ETH value will\n /// be used because they also have access to the same value when encoding the\n /// execPayload on their ProviderModule.\n /// @param _cycleId For tasks that are part of a Cycle.\n /// @return Returns OK, if Task can be executed safely according to the Provider's\n /// terms laid out in this function implementation.\n function termsOk(\n uint256 _taskReceiptId,\n address _userProxy,\n bytes calldata _actionData,\n DataFlow _dataFlow,\n uint256 _value,\n uint256 _cycleId\n )\n external\n view\n returns(string memory);\n}\n" + }, + "@gelatonetwork/core/contracts/libraries/GelatoTaskReceipt.sol": { + "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity >=0.6.10;\n\nimport {Task, TaskReceipt} from \"../gelato_core/interfaces/IGelatoCore.sol\";\n\nlibrary GelatoTaskReceipt {\n function task(TaskReceipt memory _TR) internal pure returns(Task memory) {\n return _TR.tasks[_TR.index];\n }\n\n function nextIndex(TaskReceipt memory _TR) internal pure returns(uint256) {\n return _TR.index == _TR.tasks.length - 1 ? 0 : _TR.index + 1;\n }\n\n function selfProvider(TaskReceipt memory _TR) internal pure returns(bool) {\n return _TR.provider.addr == _TR.userProxy;\n }\n}" + }, + "@gelatonetwork/core/contracts/gelato_core/interfaces/IGelatoProviders.sol": { + "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity >=0.6.10;\npragma experimental ABIEncoderV2;\n\nimport {IGelatoProviderModule} from \"../../provider_modules/IGelatoProviderModule.sol\";\nimport {Action, Provider, Task, TaskReceipt} from \"./IGelatoCore.sol\";\nimport {IGelatoCondition} from \"../../conditions/IGelatoCondition.sol\";\n\n// TaskSpec - Will be whitelised by providers and selected by users\nstruct TaskSpec {\n IGelatoCondition[] conditions; // Address: optional AddressZero for self-conditional actions\n Action[] actions;\n uint256 gasPriceCeil;\n}\n\ninterface IGelatoProviders {\n // Provider Funding\n event LogFundsProvided(\n address indexed provider,\n uint256 amount,\n uint256 newProviderFunds\n );\n event LogFundsUnprovided(\n address indexed provider,\n uint256 realWithdrawAmount,\n uint256 newProviderFunds\n );\n\n // Executor By Provider\n event LogProviderAssignedExecutor(\n address indexed provider,\n address indexed oldExecutor,\n address indexed newExecutor\n );\n event LogExecutorAssignedExecutor(\n address indexed provider,\n address indexed oldExecutor,\n address indexed newExecutor\n );\n\n // Actions\n event LogTaskSpecProvided(address indexed provider, bytes32 indexed taskSpecHash);\n event LogTaskSpecUnprovided(address indexed provider, bytes32 indexed taskSpecHash);\n event LogTaskSpecGasPriceCeilSet(\n address indexed provider,\n bytes32 taskSpecHash,\n uint256 oldTaskSpecGasPriceCeil,\n uint256 newTaskSpecGasPriceCeil\n );\n\n // Provider Module\n event LogProviderModuleAdded(\n address indexed provider,\n IGelatoProviderModule indexed module\n );\n event LogProviderModuleRemoved(\n address indexed provider,\n IGelatoProviderModule indexed module\n );\n\n // =========== GELATO PROVIDER APIs ==============\n\n /// @notice Validation that checks whether Task Spec is being offered by the selected provider\n /// @dev Checked in submitTask(), unless provider == userProxy\n /// @param _provider Address of selected provider\n /// @param _taskSpec Task Spec\n /// @return Expected to return \"OK\"\n function isTaskSpecProvided(address _provider, TaskSpec calldata _taskSpec)\n external\n view\n returns(string memory);\n\n /// @notice Validates that provider has provider module whitelisted + conducts isProvided check in ProviderModule\n /// @dev Checked in submitTask() if provider == userProxy\n /// @param _userProxy userProxy passed by GelatoCore during submission and exec\n /// @param _provider Gelato Provider object: provider address and module.\n /// @param _task Task defined in IGelatoCore\n /// @return Expected to return \"OK\"\n function providerModuleChecks(\n address _userProxy,\n Provider calldata _provider,\n Task calldata _task\n )\n external\n view\n returns(string memory);\n\n\n /// @notice Validate if provider module and seleced TaskSpec is whitelisted by provider\n /// @dev Combines \"isTaskSpecProvided\" and providerModuleChecks\n /// @param _userProxy userProxy passed by GelatoCore during submission and exec\n /// @param _provider Gelato Provider object: provider address and module.\n /// @param _task Task defined in IGelatoCore\n /// @return res Expected to return \"OK\"\n function isTaskProvided(\n address _userProxy,\n Provider calldata _provider,\n Task calldata _task\n )\n external\n view\n returns(string memory res);\n\n\n /// @notice Validate if selected TaskSpec is whitelisted by provider and that current gelatoGasPrice is below GasPriceCeil\n /// @dev If gasPriceCeil is != 0, Task Spec is whitelisted\n /// @param _userProxy userProxy passed by GelatoCore during submission and exec\n /// @param _provider Gelato Provider object: provider address and module.\n /// @param _task Task defined in IGelatoCore\n /// @param _gelatoGasPrice Task Receipt defined in IGelatoCore\n /// @return res Expected to return \"OK\"\n function providerCanExec(\n address _userProxy,\n Provider calldata _provider,\n Task calldata _task,\n uint256 _gelatoGasPrice\n )\n external\n view\n returns(string memory res);\n\n // =========== PROVIDER STATE WRITE APIs ==============\n // Provider Funding\n /// @notice Deposit ETH as provider on Gelato\n /// @param _provider Address of provider who receives ETH deposit\n function provideFunds(address _provider) external payable;\n\n /// @notice Withdraw provider funds from gelato\n /// @param _withdrawAmount Amount\n /// @return amount that will be withdrawn\n function unprovideFunds(uint256 _withdrawAmount) external returns(uint256);\n\n /// @notice Assign executor as provider\n /// @param _executor Address of new executor\n function providerAssignsExecutor(address _executor) external;\n\n /// @notice Assign executor as previous selected executor\n /// @param _provider Address of provider whose executor to change\n /// @param _newExecutor Address of new executor\n function executorAssignsExecutor(address _provider, address _newExecutor) external;\n\n // (Un-)provide Task Spec\n\n /// @notice Whitelist TaskSpecs (A combination of a Condition, Action(s) and a gasPriceCeil) that users can select from\n /// @dev If gasPriceCeil is == 0, Task Spec will be executed at any gas price (no ceil)\n /// @param _taskSpecs Task Receipt List defined in IGelatoCore\n function provideTaskSpecs(TaskSpec[] calldata _taskSpecs) external;\n\n /// @notice De-whitelist TaskSpecs (A combination of a Condition, Action(s) and a gasPriceCeil) that users can select from\n /// @dev If gasPriceCeil was set to NO_CEIL, Input NO_CEIL constant as GasPriceCeil\n /// @param _taskSpecs Task Receipt List defined in IGelatoCore\n function unprovideTaskSpecs(TaskSpec[] calldata _taskSpecs) external;\n\n /// @notice Update gasPriceCeil of selected Task Spec\n /// @param _taskSpecHash Result of hashTaskSpec()\n /// @param _gasPriceCeil New gas price ceil for Task Spec\n function setTaskSpecGasPriceCeil(bytes32 _taskSpecHash, uint256 _gasPriceCeil) external;\n\n // Provider Module\n /// @notice Whitelist new provider Module(s)\n /// @param _modules Addresses of the modules which will be called during providerModuleChecks()\n function addProviderModules(IGelatoProviderModule[] calldata _modules) external;\n\n /// @notice De-Whitelist new provider Module(s)\n /// @param _modules Addresses of the modules which will be removed\n function removeProviderModules(IGelatoProviderModule[] calldata _modules) external;\n\n // Batch (un-)provide\n\n /// @notice Whitelist new executor, TaskSpec(s) and Module(s) in one tx\n /// @param _executor Address of new executor of provider\n /// @param _taskSpecs List of Task Spec which will be whitelisted by provider\n /// @param _modules List of module addresses which will be whitelisted by provider\n function multiProvide(\n address _executor,\n TaskSpec[] calldata _taskSpecs,\n IGelatoProviderModule[] calldata _modules\n )\n external\n payable;\n\n\n /// @notice De-Whitelist TaskSpec(s), Module(s) and withdraw funds from gelato in one tx\n /// @param _withdrawAmount Amount to withdraw from ProviderFunds\n /// @param _taskSpecs List of Task Spec which will be de-whitelisted by provider\n /// @param _modules List of module addresses which will be de-whitelisted by provider\n function multiUnprovide(\n uint256 _withdrawAmount,\n TaskSpec[] calldata _taskSpecs,\n IGelatoProviderModule[] calldata _modules\n )\n external;\n\n // =========== PROVIDER STATE READ APIs ==============\n // Provider Funding\n\n /// @notice Get balance of provider\n /// @param _provider Address of provider\n /// @return Provider Balance\n function providerFunds(address _provider) external view returns(uint256);\n\n /// @notice Get min stake required by all providers for executors to call exec\n /// @param _gelatoMaxGas Current gelatoMaxGas\n /// @param _gelatoGasPrice Current gelatoGasPrice\n /// @return How much provider balance is required for executor to submit exec tx\n function minExecProviderFunds(uint256 _gelatoMaxGas, uint256 _gelatoGasPrice)\n external\n view\n returns(uint256);\n\n /// @notice Check if provider has sufficient funds for executor to call exec\n /// @param _provider Address of provider\n /// @param _gelatoMaxGas Currentt gelatoMaxGas\n /// @param _gelatoGasPrice Current gelatoGasPrice\n /// @return Whether provider is liquid (true) or not (false)\n function isProviderLiquid(\n address _provider,\n uint256 _gelatoMaxGas,\n uint256 _gelatoGasPrice\n )\n external\n view\n returns(bool);\n\n // Executor Stake\n\n /// @notice Get balance of executor\n /// @param _executor Address of executor\n /// @return Executor Balance\n function executorStake(address _executor) external view returns(uint256);\n\n /// @notice Check if executor has sufficient stake on gelato\n /// @param _executor Address of provider\n /// @return Whether executor has sufficient stake (true) or not (false)\n function isExecutorMinStaked(address _executor) external view returns(bool);\n\n /// @notice Get executor of provider\n /// @param _provider Address of provider\n /// @return Provider's executor\n function executorByProvider(address _provider)\n external\n view\n returns(address);\n\n /// @notice Get num. of providers which haved assigned an executor\n /// @param _executor Address of executor\n /// @return Count of how many providers assigned the executor\n function executorProvidersCount(address _executor) external view returns(uint256);\n\n /// @notice Check if executor has one or more providers assigned\n /// @param _executor Address of provider\n /// @return Where 1 or more providers have assigned the executor\n function isExecutorAssigned(address _executor) external view returns(bool);\n\n // Task Spec and Gas Price Ceil\n /// @notice The maximum gas price the transaction will be executed with\n /// @param _provider Address of provider\n /// @param _taskSpecHash Hash of provider TaskSpec\n /// @return Max gas price an executor will execute the transaction with in wei\n function taskSpecGasPriceCeil(address _provider, bytes32 _taskSpecHash)\n external\n view\n returns(uint256);\n\n /// @notice Returns the hash of the formatted TaskSpec.\n /// @dev The action.data field of each Action is stripped before hashing.\n /// @param _taskSpec TaskSpec\n /// @return keccak256 hash of encoded condition address and Action List\n function hashTaskSpec(TaskSpec calldata _taskSpec) external view returns(bytes32);\n\n /// @notice Constant used to specify the highest gas price available in the gelato system\n /// @dev Input 0 as gasPriceCeil and it will be assigned to NO_CEIL\n /// @return MAX_UINT\n function NO_CEIL() external pure returns(uint256);\n\n // Providers' Module Getters\n\n /// @notice Check if inputted module is whitelisted by provider\n /// @param _provider Address of provider\n /// @param _module Address of module\n /// @return true if it is whitelisted\n function isModuleProvided(address _provider, IGelatoProviderModule _module)\n external\n view\n returns(bool);\n\n /// @notice Get all whitelisted provider modules from a given provider\n /// @param _provider Address of provider\n /// @return List of whitelisted provider modules\n function providerModules(address _provider)\n external\n view\n returns(IGelatoProviderModule[] memory);\n}\n" + }, + "contracts/__mocks__/gelato/MockFGelatoDebtBridge.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\n\nimport {\n _wCalcCollateralToWithdraw,\n _wCalcDebtToRepay,\n _getFlashLoanRoute,\n _getGasCostMakerToMaker,\n _getGasCostMakerToCompound,\n _getRealisedDebt\n} from \"../../functions/gelato/FGelatoDebtBridge.sol\";\n\ncontract FGelatoDebtBridgeMock {\n function wCalcCollateralToWithdraw(\n uint256 _wMinColRatioMaker,\n uint256 _wMinColRatioB,\n uint256 _wColPrice,\n uint256 _wPricedCol,\n uint256 _wDaiDebtOnMaker\n ) public pure returns (uint256) {\n return\n _wCalcCollateralToWithdraw(\n _wMinColRatioMaker,\n _wMinColRatioB,\n _wColPrice,\n _wPricedCol,\n _wDaiDebtOnMaker\n );\n }\n\n function wCalcDebtToRepay(\n uint256 _wMinColRatioMaker,\n uint256 _wMinColRatioB,\n uint256 _wPricedCol,\n uint256 _wDaiDebtOnMaker\n ) public pure returns (uint256) {\n return\n _wCalcDebtToRepay(\n _wMinColRatioMaker,\n _wMinColRatioB,\n _wPricedCol,\n _wDaiDebtOnMaker\n );\n }\n\n function getFlashLoanRoute(address _tokenA, uint256 _wTokenADebtToMove)\n public\n view\n returns (uint256)\n {\n return _getFlashLoanRoute(_tokenA, _wTokenADebtToMove);\n }\n\n function getGasCostMakerToMaker(bool _newVault, uint256 _route)\n public\n pure\n returns (uint256)\n {\n return _getGasCostMakerToMaker(_newVault, _route);\n }\n\n function getGasCostMakerToCompound(uint256 _route)\n public\n pure\n returns (uint256)\n {\n return _getGasCostMakerToCompound(_route);\n }\n\n function getRealisedDebt(uint256 _debtToMove)\n public\n pure\n returns (uint256)\n {\n return _getRealisedDebt(_debtToMove);\n }\n}\n" + }, + "@gelatonetwork/core/contracts/libraries/GelatoString.sol": { + "content": "// \"SPDX-License-Identifier: UNLICENSED\"\npragma solidity >=0.6.10;\n\nlibrary GelatoString {\n function startsWithOK(string memory _str) internal pure returns (bool) {\n if (\n bytes(_str).length >= 2 &&\n bytes(_str)[0] == \"O\" &&\n bytes(_str)[1] == \"K\"\n ) return true;\n return false;\n }\n\n function revertWithInfo(string memory _error, string memory _tracingInfo)\n internal\n pure\n {\n revert(string(abi.encodePacked(_tracingInfo, _error)));\n }\n\n function prefix(string memory _second, string memory _first)\n internal\n pure\n returns (string memory)\n {\n return string(abi.encodePacked(_first, _second));\n }\n\n function suffix(string memory _first, string memory _second)\n internal\n pure\n returns (string memory)\n {\n return string(abi.encodePacked(_first, _second));\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": ["ast"] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} diff --git a/hardhat.config.js b/hardhat.config.js index b3e7948..59e3c50 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -60,7 +60,7 @@ module.exports = { accounts: DEPLOYER_PK_MAINNET ? [DEPLOYER_PK_MAINNET] : [], chainId: 1, url: `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_ID}`, - gasPrice: parseInt(utils.parseUnits("15", "gwei")), + gasPrice: parseInt(utils.parseUnits("35", "gwei")), timeout: 150000, // Custom ...mainnetDeployments,