diff --git a/.solhint.json b/.solhint.json index ef0ef3f..9867e6a 100644 --- a/.solhint.json +++ b/.solhint.json @@ -10,7 +10,7 @@ "no-empty-blocks": "error", "no-unused-vars": "error", "payable-fallback": "off", - "reason-string": ["off", {"maxLength": 32}], + "reason-string": ["off", { "maxLength": 32 }], "constructor-syntax": "off", "comprehensive-interface": "off", "quotes": ["error", "double"], @@ -20,7 +20,7 @@ "func-name-mixedcase": "error", "func-param-name-mixedcase": "error", "modifier-name-mixedcase": "error", - "private-vars-leading-underscore": ["error", {"strict": false}], + "private-vars-leading-underscore": ["error", { "strict": false }], "var-name-mixedcase": "error", "imports-on-top": "error", "ordering": "error", @@ -34,7 +34,7 @@ "check-send-result": "error", "compiler-version": ["error", "0.7.4"], "mark-callable-contracts": "off", - "func-visibility": ["error", {"ignoreConstructors": true}], + "func-visibility": ["error", { "ignoreConstructors": true }], "multiple-sends": "error", "no-complex-fallback": "error", "no-inline-assembly": "off", diff --git a/contracts/contracts/connectors/ConnectGelatoDataFullRefinanceMaker.sol b/contracts/contracts/connectors/ConnectGelatoDataFullRefinanceMaker.sol index 6b869c1..09c7180 100644 --- a/contracts/contracts/connectors/ConnectGelatoDataFullRefinanceMaker.sol +++ b/contracts/contracts/connectors/ConnectGelatoDataFullRefinanceMaker.sol @@ -50,9 +50,8 @@ contract ConnectGelatoDataFullRefinanceMaker is ConnectorInterface { using GelatoBytes for bytes; // solhint-disable const-name-snakecase - string - public constant - override name = "ConnectGelatoDataFullRefinanceMaker-v1.0"; + string public constant override name = + "ConnectGelatoDataFullRefinanceMaker-v1.0"; uint256 internal immutable _id; address internal immutable _connectGelatoProviderPayment; @@ -83,12 +82,8 @@ contract ConnectGelatoDataFullRefinanceMaker is ConnectorInterface { address _colToken, string calldata _colType ) external payable { - (address[] memory targets, bytes[] memory datas) = _dataMakerToMaker( - _vaultAId, - _vaultBId, - _colToken, - _colType - ); + (address[] memory targets, bytes[] memory datas) = + _dataMakerToMaker(_vaultAId, _vaultBId, _colToken, _colType); _cast(targets, datas); } @@ -101,26 +96,24 @@ contract ConnectGelatoDataFullRefinanceMaker is ConnectorInterface { external payable { - (address[] memory targets, bytes[] memory datas) = _dataMakerToCompound( - _vaultId, - _colToken - ); + (address[] memory targets, bytes[] memory datas) = + _dataMakerToCompound(_vaultId, _colToken); _cast(targets, datas); } function _cast(address[] memory targets, bytes[] memory datas) internal { // Instapool V2 / FlashLoan call - bytes memory castData = abi.encodeWithSelector( - AccountInterface.cast.selector, - targets, - datas, - msg.sender // msg.sender == GelatoCore - ); + bytes memory castData = + abi.encodeWithSelector( + AccountInterface.cast.selector, + targets, + datas, + msg.sender // msg.sender == GelatoCore + ); - (bool success, bytes memory returndata) = address(this).delegatecall( - castData - ); + (bool success, bytes memory returndata) = + address(this).delegatecall(castData); if (!success) { returndata.revertWithError( "ConnectGelatoDataFullRefinanceMaker._cast:" @@ -140,30 +133,30 @@ contract ConnectGelatoDataFullRefinanceMaker is ConnectorInterface { targets[0] = INSTA_POOL_V2; uint256 wDaiToBorrow = _getRealisedDebt(_getMakerVaultDebt(_vaultAId)); - uint256 wColToWithdrawFromMaker = _getMakerVaultCollateralBalance( - _vaultAId - ); + uint256 wColToWithdrawFromMaker = + _getMakerVaultCollateralBalance(_vaultAId); uint256 route = _getFlashLoanRoute(DAI, wDaiToBorrow); uint256 gasCost = _getGasCostMakerToMaker(_vaultBId == 0, route); uint256 gasFeesPaidFromCol = _getGelatoProviderFees(gasCost); - (address[] memory _targets, bytes[] memory _datas) = _vaultBId == 0 - ? _spellsMakerToNewMakerVault( - _vaultAId, - _colToken, - _colType, - wDaiToBorrow, - wColToWithdrawFromMaker, - gasFeesPaidFromCol - ) - : _spellsMakerToMaker( - _vaultAId, - _vaultBId, - _colToken, - wDaiToBorrow, - wColToWithdrawFromMaker, - gasFeesPaidFromCol - ); + (address[] memory _targets, bytes[] memory _datas) = + _vaultBId == 0 + ? _spellsMakerToNewMakerVault( + _vaultAId, + _colToken, + _colType, + wDaiToBorrow, + wColToWithdrawFromMaker, + gasFeesPaidFromCol + ) + : _spellsMakerToMaker( + _vaultAId, + _vaultBId, + _colToken, + wDaiToBorrow, + wColToWithdrawFromMaker, + gasFeesPaidFromCol + ); datas = new bytes[](1); datas[0] = abi.encodeWithSelector( @@ -256,9 +249,8 @@ contract ConnectGelatoDataFullRefinanceMaker is ConnectorInterface { targets[0] = INSTA_POOL_V2; uint256 wDaiToBorrow = _getRealisedDebt(_getMakerVaultDebt(_vaultId)); - uint256 wColToWithdrawFromMaker = _getMakerVaultCollateralBalance( - _vaultId - ); + uint256 wColToWithdrawFromMaker = + _getMakerVaultCollateralBalance(_vaultId); uint256 route = _getFlashLoanRoute(DAI, wDaiToBorrow); uint256 gasCost = _getGasCostMakerToCompound(route); uint256 gasFeesPaidFromCol = _getGelatoProviderFees(gasCost); diff --git a/contracts/contracts/connectors/ConnectGelatoDataPartialRefinanceMaker.sol b/contracts/contracts/connectors/ConnectGelatoDataPartialRefinanceMaker.sol index c8dc83e..f0b0af4 100644 --- a/contracts/contracts/connectors/ConnectGelatoDataPartialRefinanceMaker.sol +++ b/contracts/contracts/connectors/ConnectGelatoDataPartialRefinanceMaker.sol @@ -66,9 +66,8 @@ contract ConnectGelatoDataPartialRefinanceMaker is ConnectorInterface { } // solhint-disable const-name-snakecase - string - public constant - override name = "ConnectGelatoDataPartialRefinanceMaker-v1.0"; + string public constant override name = + "ConnectGelatoDataPartialRefinanceMaker-v1.0"; uint256 internal immutable _id; address internal immutable _connectGelatoProviderPayment; @@ -95,9 +94,8 @@ contract ConnectGelatoDataPartialRefinanceMaker is ConnectorInterface { function getDataAndCastMakerToMaker( PartialDebtBridgePayload calldata _payload ) external payable { - (address[] memory targets, bytes[] memory datas) = _dataMakerToMaker( - _payload - ); + (address[] memory targets, bytes[] memory datas) = + _dataMakerToMaker(_payload); _cast(targets, datas); } @@ -108,25 +106,24 @@ contract ConnectGelatoDataPartialRefinanceMaker is ConnectorInterface { function getDataAndCastMakerToCompound( PartialDebtBridgePayload calldata _payload ) external payable { - (address[] memory targets, bytes[] memory datas) = _dataMakerToCompound( - _payload - ); + (address[] memory targets, bytes[] memory datas) = + _dataMakerToCompound(_payload); _cast(targets, datas); } function _cast(address[] memory targets, bytes[] memory datas) internal { // Instapool V2 / FlashLoan call - bytes memory castData = abi.encodeWithSelector( - AccountInterface.cast.selector, - targets, - datas, - msg.sender // msg.sender == GelatoCore - ); + bytes memory castData = + abi.encodeWithSelector( + AccountInterface.cast.selector, + targets, + datas, + msg.sender // msg.sender == GelatoCore + ); - (bool success, bytes memory returndata) = address(this).delegatecall( - castData - ); + (bool success, bytes memory returndata) = + address(this).delegatecall(castData); if (!success) returndata.revertWithError( "ConnectGelatoDataPartialRefinanceMaker._cast:" @@ -147,13 +144,14 @@ contract ConnectGelatoDataPartialRefinanceMaker is ConnectorInterface { uint256 wDaiDebtToMove, uint256 wColToWithdrawFromMaker, uint256 gasFeesPaidFromCol - ) = computeDebtBridge( - _payload.vaultId, - _payload.wMinColRatioMaker, - _payload.wMinColRatioB, - _payload.priceOracle, - _payload.oraclePayload - ); + ) = + computeDebtBridge( + _payload.vaultId, + _payload.wMinColRatioMaker, + _payload.wMinColRatioB, + _payload.priceOracle, + _payload.oraclePayload + ); address[] memory _targets = new address[](7); _targets[0] = CONNECT_MAKER; // payback @@ -215,13 +213,14 @@ contract ConnectGelatoDataPartialRefinanceMaker is ConnectorInterface { uint256 wDaiDebtToMove, uint256 wColToWithdrawFromMaker, uint256 gasFeesPaidFromCol - ) = computeDebtBridge( - _payload.vaultId, - _payload.wMinColRatioMaker, - _payload.wMinColRatioB, - _payload.priceOracle, - _payload.oraclePayload - ); + ) = + computeDebtBridge( + _payload.vaultId, + _payload.wMinColRatioMaker, + _payload.wMinColRatioB, + _payload.priceOracle, + _payload.oraclePayload + ); address[] memory _targets = new address[](6); _targets[0] = CONNECT_MAKER; // payback @@ -301,9 +300,8 @@ contract ConnectGelatoDataPartialRefinanceMaker is ConnectorInterface { // Stack too deep { - (bool success, bytes memory returndata) = _priceOracle.staticcall( - _oraclePayload - ); + (bool success, bytes memory returndata) = + _priceOracle.staticcall(_oraclePayload); if (!success) { GelatoBytes.revertWithError( @@ -319,10 +317,14 @@ contract ConnectGelatoDataPartialRefinanceMaker is ConnectorInterface { // uint256 gasFeesPaidFromCol = _mul(GAS_COST, wmul(_getGelatoGasPrice(), latestPrice)); gasFeesPaidFromCol = _getGelatoProviderFees(GAS_COST); - uint256 wPricedCol = wmul( - sub(_getMakerVaultCollateralBalance(_vaultId), gasFeesPaidFromCol), - wColPrice - ); + uint256 wPricedCol = + wmul( + sub( + _getMakerVaultCollateralBalance(_vaultId), + gasFeesPaidFromCol + ), + wColPrice + ); uint256 wDaiDebtOnMaker = _getMakerVaultDebt(_vaultId); diff --git a/contracts/contracts/connectors/ConnectGelatoProviderPayment.sol b/contracts/contracts/connectors/ConnectGelatoProviderPayment.sol index 7592df1..c48ca43 100644 --- a/contracts/contracts/connectors/ConnectGelatoProviderPayment.sol +++ b/contracts/contracts/connectors/ConnectGelatoProviderPayment.sol @@ -29,9 +29,8 @@ contract ConnectGelatoProviderPayment is // solhint-disable-next-line const-name-snakecase string public constant override name = "ConnectGelatoProviderPayment-v1.0"; - address - public constant - override GELATO_CORE = 0x1d681d76ce96E4d70a88A00EBbcfc1E47808d0b8; + address public constant override GELATO_CORE = + 0x1d681d76ce96E4d70a88A00EBbcfc1E47808d0b8; address public override gelatoProvider; @@ -90,8 +89,8 @@ contract ConnectGelatoProviderPayment is uint256 _getId, uint256 _setId ) external payable override { - address provider = IConnectGelatoProviderPayment(_this) - .gelatoProvider(); + address provider = + IConnectGelatoProviderPayment(_this).gelatoProvider(); uint256 amt = _getUint(_getId, _amt); _setUint(_setId, amt); @@ -100,7 +99,7 @@ contract ConnectGelatoProviderPayment is // solhint-disable no-empty-blocks try IGelatoProviders(GELATO_CORE).provideFunds{value: amt}(provider) - {} catch Error(string memory error) { + {} catch Error(string memory error) { error.revertWithInfo( "ConnectGelatoProviderPayment.payProvider.provideFunds:" ); diff --git a/contracts/contracts/gelato/conditions/ConditionCompareUintsFromTwoSources.sol b/contracts/contracts/gelato/conditions/ConditionCompareUintsFromTwoSources.sol index 304b8be..2b0b221 100644 --- a/contracts/contracts/gelato/conditions/ConditionCompareUintsFromTwoSources.sol +++ b/contracts/contracts/gelato/conditions/ConditionCompareUintsFromTwoSources.sol @@ -49,10 +49,11 @@ contract ConditionCompareUintsFromTwoSources is GelatoConditionsStandard { bytes memory _sourceAData, bytes memory _sourceBData, uint256 _minSpread - ) = abi.decode( - _conditionData, - (address, address, bytes, bytes, uint256) - ); + ) = + abi.decode( + _conditionData, + (address, address, bytes, bytes, uint256) + ); return compare(_sourceA, _sourceB, _sourceAData, _sourceBData, _minSpread); } @@ -76,9 +77,8 @@ contract ConditionCompareUintsFromTwoSources is GelatoConditionsStandard { uint256 _minSpread ) public view virtual returns (string memory) { // Retrieve uint256 from sourceA - (bool success, bytes memory returndata) = _sourceA.staticcall( - _sourceAData - ); + (bool success, bytes memory returndata) = + _sourceA.staticcall(_sourceAData); if (!success) { return returndata.returnError( diff --git a/contracts/contracts/gelato/conditions/ConditionDebtBridgeIsAffordable.sol b/contracts/contracts/gelato/conditions/ConditionDebtBridgeIsAffordable.sol index 1b5a8b5..ed73193 100644 --- a/contracts/contracts/gelato/conditions/ConditionDebtBridgeIsAffordable.sol +++ b/contracts/contracts/gelato/conditions/ConditionDebtBridgeIsAffordable.sol @@ -50,10 +50,8 @@ contract ConditionDebtBridgeIsAffordable is GelatoConditionsStandard { bytes calldata _conditionData, uint256 ) public view virtual override returns (string memory) { - (uint256 _vaultID, uint256 _ratioLimit) = abi.decode( - _conditionData, - (uint256, uint256) - ); + (uint256 _vaultID, uint256 _ratioLimit) = + abi.decode(_conditionData, (uint256, uint256)); return isAffordable(_vaultID, _ratioLimit); } @@ -70,18 +68,18 @@ contract ConditionDebtBridgeIsAffordable is GelatoConditionsStandard { view returns (string memory) { - uint256 wColToWithdrawFromMaker = _getMakerVaultCollateralBalance( - _vaultId - ); - uint256 gasFeesPaidFromCol = _getGelatoProviderFees( - _getGasCostMakerToMaker( - true, - _getFlashLoanRoute( - DAI, - _getRealisedDebt(_getMakerVaultDebt(_vaultId)) + uint256 wColToWithdrawFromMaker = + _getMakerVaultCollateralBalance(_vaultId); + uint256 gasFeesPaidFromCol = + _getGelatoProviderFees( + _getGasCostMakerToMaker( + true, + _getFlashLoanRoute( + DAI, + _getRealisedDebt(_getMakerVaultDebt(_vaultId)) + ) ) - ) - ); + ); if (wdiv(gasFeesPaidFromCol, wColToWithdrawFromMaker) >= _ratioLimit) return "DebtBridgeNotAffordable"; return OK; diff --git a/contracts/contracts/gelato/conditions/ConditionMakerVaultUnsafe.sol b/contracts/contracts/gelato/conditions/ConditionMakerVaultUnsafe.sol index e309640..0b4de26 100644 --- a/contracts/contracts/gelato/conditions/ConditionMakerVaultUnsafe.sol +++ b/contracts/contracts/gelato/conditions/ConditionMakerVaultUnsafe.sol @@ -65,9 +65,8 @@ contract ConditionMakerVaultUnsafe is GelatoConditionsStandard { bytes memory _oraclePayload, uint256 _minColRatio ) public view virtual returns (string memory) { - (bool success, bytes memory returndata) = _priceOracle.staticcall( - _oraclePayload - ); + (bool success, bytes memory returndata) = + _priceOracle.staticcall(_oraclePayload); if (!success) { returndata.revertWithError( @@ -77,15 +76,12 @@ contract ConditionMakerVaultUnsafe is GelatoConditionsStandard { uint256 colPriceInWad = abi.decode(returndata, (uint256)); - IInstaMakerResolver.VaultData memory vault = IInstaMakerResolver( - 0x0A7008B38E7015F8C36A49eEbc32513ECA8801E5 - ) - .getVaultById(_vaultId); + IInstaMakerResolver.VaultData memory vault = + IInstaMakerResolver(0x0A7008B38E7015F8C36A49eEbc32513ECA8801E5) + .getVaultById(_vaultId); - uint256 colRatio = wdiv( - wmul(vault.collateral, colPriceInWad), - vault.debt - ); + uint256 colRatio = + wdiv(wmul(vault.collateral, colPriceInWad), vault.debt); return colRatio < _minColRatio ? OK : "MakerVaultNotUnsafe"; } diff --git a/contracts/contracts/resolvers/PriceOracleResolver.sol b/contracts/contracts/resolvers/PriceOracleResolver.sol index c028f85..0c910db 100644 --- a/contracts/contracts/resolvers/PriceOracleResolver.sol +++ b/contracts/contracts/resolvers/PriceOracleResolver.sol @@ -59,9 +59,8 @@ contract PriceOracleResolver is Ownable { address oracleAddr = oracle[_oracle]; if (oracleAddr == address(0)) revert("PriceOracleResolver.getPrice: no oracle"); - (bool success, bytes memory returndata) = oracleAddr.staticcall( - oraclePayload[_oracle] - ); + (bool success, bytes memory returndata) = + oracleAddr.staticcall(oraclePayload[_oracle]); if (!success) returndata.revertWithError("PriceOracleResolver.getPrice:"); return abi.decode(returndata, (uint256)); diff --git a/contracts/dependencies/InstaDapp/connectors/compound.sol b/contracts/dependencies/InstaDapp/connectors/compound.sol index 7a3dcab..c346e80 100644 --- a/contracts/dependencies/InstaDapp/connectors/compound.sol +++ b/contracts/dependencies/InstaDapp/connectors/compound.sol @@ -198,9 +198,8 @@ contract CompoundHelpers is Helpers { * @dev enter compound market */ function enterMarket(address cToken) internal { - ComptrollerInterface troller = ComptrollerInterface( - getComptrollerAddress() - ); + ComptrollerInterface troller = + ComptrollerInterface(getComptrollerAddress()); address[] memory markets = troller.getAssetsIn(address(this)); bool isEntered = false; for (uint256 i = 0; i < markets.length; i++) { @@ -276,16 +275,10 @@ contract BasicResolver is CompoundHelpers { setUint(setId, _amt); emit LogDeposit(token, cToken, _amt, getId, setId); - bytes32 _eventCode = keccak256( - "LogDeposit(address,address,uint256,uint256,uint256)" - ); - bytes memory _eventParam = abi.encode( - token, - cToken, - _amt, - getId, - setId - ); + bytes32 _eventCode = + keccak256("LogDeposit(address,address,uint256,uint256,uint256)"); + bytes memory _eventParam = + abi.encode(token, cToken, _amt, getId, setId); (uint256 _type, uint256 _id) = connectorID(); EventInterface(getEventAddr()).emitEvent( _type, @@ -313,18 +306,20 @@ contract BasicResolver is CompoundHelpers { CTokenInterface cTokenContract = CTokenInterface(cToken); if (_amt == uint256(-1)) { TokenInterface tokenContract = TokenInterface(token); - uint256 initialBal = token == getAddressETH() - ? address(this).balance - : tokenContract.balanceOf(address(this)); + uint256 initialBal = + token == getAddressETH() + ? address(this).balance + : tokenContract.balanceOf(address(this)); require( cTokenContract.redeem( cTokenContract.balanceOf(address(this)) ) == 0, "full-withdraw-failed" ); - uint256 finalBal = token == getAddressETH() - ? address(this).balance - : tokenContract.balanceOf(address(this)); + uint256 finalBal = + token == getAddressETH() + ? address(this).balance + : tokenContract.balanceOf(address(this)); _amt = finalBal - initialBal; } else { require( @@ -335,16 +330,10 @@ contract BasicResolver is CompoundHelpers { setUint(setId, _amt); emit LogWithdraw(token, cToken, _amt, getId, setId); - bytes32 _eventCode = keccak256( - "LogWithdraw(address,address,uint256,uint256,uint256)" - ); - bytes memory _eventParam = abi.encode( - token, - cToken, - _amt, - getId, - setId - ); + bytes32 _eventCode = + keccak256("LogWithdraw(address,address,uint256,uint256,uint256)"); + bytes memory _eventParam = + abi.encode(token, cToken, _amt, getId, setId); (uint256 _type, uint256 _id) = connectorID(); EventInterface(getEventAddr()).emitEvent( _type, @@ -374,16 +363,10 @@ contract BasicResolver is CompoundHelpers { setUint(setId, _amt); emit LogBorrow(token, cToken, _amt, getId, setId); - bytes32 _eventCode = keccak256( - "LogBorrow(address,address,uint256,uint256,uint256)" - ); - bytes memory _eventParam = abi.encode( - token, - cToken, - _amt, - getId, - setId - ); + bytes32 _eventCode = + keccak256("LogBorrow(address,address,uint256,uint256,uint256)"); + bytes memory _eventParam = + abi.encode(token, cToken, _amt, getId, setId); (uint256 _type, uint256 _id) = connectorID(); EventInterface(getEventAddr()).emitEvent( _type, @@ -428,16 +411,10 @@ contract BasicResolver is CompoundHelpers { setUint(setId, _amt); emit LogPayback(token, cToken, _amt, getId, setId); - bytes32 _eventCode = keccak256( - "LogPayback(address,address,uint256,uint256,uint256)" - ); - bytes memory _eventParam = abi.encode( - token, - cToken, - _amt, - getId, - setId - ); + bytes32 _eventCode = + keccak256("LogPayback(address,address,uint256,uint256,uint256)"); + bytes memory _eventParam = + abi.encode(token, cToken, _amt, getId, setId); (uint256 _type, uint256 _id) = connectorID(); EventInterface(getEventAddr()).emitEvent( _type, @@ -536,17 +513,12 @@ contract ExtraResolver is BasicResolver { setUint(setId, _cAmt); emit LogDepositCToken(token, cToken, _amt, _cAmt, getId, setId); - bytes32 _eventCode = keccak256( - "LogDepositCToken(address,address,uint256,uint256,uint256,uint256)" - ); - bytes memory _eventParam = abi.encode( - token, - cToken, - _amt, - _cAmt, - getId, - setId - ); + bytes32 _eventCode = + keccak256( + "LogDepositCToken(address,address,uint256,uint256,uint256,uint256)" + ); + bytes memory _eventParam = + abi.encode(token, cToken, _amt, _cAmt, getId, setId); (uint256 _type, uint256 _id) = connectorID(); EventInterface(getEventAddr()).emitEvent( _type, @@ -579,16 +551,12 @@ contract ExtraResolver is BasicResolver { setUint(setId, _amt); emit LogWithdrawCToken(token, cToken, _amt, getId, setId); - bytes32 _eventCode = keccak256( - "LogWithdrawCToken(address,address,uint256,uint256,uint256)" - ); - bytes memory _eventParam = abi.encode( - token, - cToken, - _amt, - getId, - setId - ); + bytes32 _eventCode = + keccak256( + "LogWithdrawCToken(address,address,uint256,uint256,uint256)" + ); + bytes memory _eventParam = + abi.encode(token, cToken, _amt, getId, setId); (uint256 _type, uint256 _id) = connectorID(); EventInterface(getEventAddr()).emitEvent( _type, @@ -616,16 +584,16 @@ contract ExtraResolver is BasicResolver { uint256 setId ) external payable { uint256 _amt = getUint(getId, amt); - address cTokenPay = InstaMapping(getMappingAddr()).cTokenMapping( - tokenToPay - ); - address cTokenColl = InstaMapping(getMappingAddr()).cTokenMapping( - tokenInReturn - ); + address cTokenPay = + InstaMapping(getMappingAddr()).cTokenMapping(tokenToPay); + address cTokenColl = + InstaMapping(getMappingAddr()).cTokenMapping(tokenInReturn); CTokenInterface cTokenContract = CTokenInterface(cTokenPay); - (, , uint256 shortfal) = ComptrollerInterface(getComptrollerAddress()) - .getAccountLiquidity(borrower); + (, , uint256 shortfal) = + ComptrollerInterface(getComptrollerAddress()).getAccountLiquidity( + borrower + ); require(shortfal != 0, "account-cannot-be-liquidated"); _amt = _amt == uint256(-1) @@ -659,17 +627,19 @@ contract ExtraResolver is BasicResolver { getId, setId ); - bytes32 _eventCode = keccak256( - "LogLiquidate(address,address,address,uint256,uint256,uint256)" - ); - bytes memory _eventParam = abi.encode( - address(this), - tokenToPay, - tokenInReturn, - _amt, - getId, - setId - ); + bytes32 _eventCode = + keccak256( + "LogLiquidate(address,address,address,uint256,uint256,uint256)" + ); + bytes memory _eventParam = + abi.encode( + address(this), + tokenToPay, + tokenInReturn, + _amt, + getId, + setId + ); (uint256 _type, uint256 _id) = connectorID(); EventInterface(getEventAddr()).emitEvent( _type, diff --git a/contracts/dependencies/InstaDapp/connectors/makerdao.sol b/contracts/dependencies/InstaDapp/connectors/makerdao.sol index 7159b8f..e9c5076 100644 --- a/contracts/dependencies/InstaDapp/connectors/makerdao.sol +++ b/contracts/dependencies/InstaDapp/connectors/makerdao.sol @@ -471,16 +471,10 @@ contract EventHelper is MakerHelpers { uint256 setId ) internal { emit LogDeposit(vault, ilk, tokenAmt, getId, setId); - bytes32 _eventCode = keccak256( - "LogDeposit(uint256,bytes32,uint256,uint256,uint256)" - ); - bytes memory _eventParam = abi.encode( - vault, - ilk, - tokenAmt, - getId, - setId - ); + bytes32 _eventCode = + keccak256("LogDeposit(uint256,bytes32,uint256,uint256,uint256)"); + bytes memory _eventParam = + abi.encode(vault, ilk, tokenAmt, getId, setId); (uint256 _type, uint256 _id) = connectorID(); EventInterface(getEventAddr()).emitEvent( _type, @@ -498,16 +492,10 @@ contract EventHelper is MakerHelpers { uint256 setId ) internal { emit LogBorrow(vault, ilk, tokenAmt, getId, setId); - bytes32 _eventCode = keccak256( - "LogBorrow(uint256,bytes32,uint256,uint256,uint256)" - ); - bytes memory _eventParam = abi.encode( - vault, - ilk, - tokenAmt, - getId, - setId - ); + bytes32 _eventCode = + keccak256("LogBorrow(uint256,bytes32,uint256,uint256,uint256)"); + bytes memory _eventParam = + abi.encode(vault, ilk, tokenAmt, getId, setId); (uint256 _type, uint256 _id) = connectorID(); EventInterface(getEventAddr()).emitEvent( _type, @@ -556,10 +544,8 @@ contract BasicResolver is EventHelper { uint256 _vault = getVault(managerContract, vault); (bytes32 ilk, address urn) = getVaultData(managerContract, _vault); - (uint256 ink, uint256 art) = VatLike(managerContract.vat()).urns( - ilk, - urn - ); + (uint256 ink, uint256 art) = + VatLike(managerContract.vat()).urns(ilk, urn); require(ink == 0 && art == 0, "vault-has-assets"); require(managerContract.owns(_vault) == address(this), "not-owner"); @@ -673,9 +659,8 @@ contract BasicResolver is EventHelper { setUint(setId, _amt); emit LogWithdraw(_vault, ilk, _amt, getId, setId); - bytes32 _eventCode = keccak256( - "LogWithdraw(uint256,bytes32,uint256,uint256,uint256)" - ); + bytes32 _eventCode = + keccak256("LogWithdraw(uint256,bytes32,uint256,uint256,uint256)"); bytes memory _eventParam = abi.encode(_vault, ilk, _amt, getId, setId); (uint256 _type, uint256 _id) = connectorID(); EventInterface(getEventAddr()).emitEvent( @@ -767,9 +752,8 @@ contract BasicResolver is EventHelper { setUint(setId, _amt); emit LogPayback(_vault, ilk, _amt, getId, setId); - bytes32 _eventCode = keccak256( - "LogPayback(uint256,bytes32,uint256,uint256,uint256)" - ); + bytes32 _eventCode = + keccak256("LogPayback(uint256,bytes32,uint256,uint256,uint256)"); bytes memory _eventParam = abi.encode(_vault, ilk, _amt, getId, setId); (uint256 _type, uint256 _id) = connectorID(); EventInterface(getEventAddr()).emitEvent( @@ -837,9 +821,10 @@ contract BasicExtraResolver is BasicResolver { setUint(setId, _amt); emit LogWithdrawLiquidated(vault, ilk, _amt, getId, setId); - bytes32 _eventCode = keccak256( - "LogWithdrawLiquidated(uint256,bytes32,uint256,uint256,uint256)" - ); + bytes32 _eventCode = + keccak256( + "LogWithdrawLiquidated(uint256,bytes32,uint256,uint256,uint256)" + ); bytes memory _eventParam = abi.encode(vault, ilk, _amt, getId, setId); (uint256 _type, uint256 _id) = connectorID(); EventInterface(getEventAddr()).emitEvent( @@ -884,10 +869,8 @@ contract BasicExtraResolver is BasicResolver { uint256 _amtBorrow = getUint(getIdBorrow, borrowAmt); makerData._vault = getVault(managerContract, vault); - (bytes32 ilk, address urn) = getVaultData( - managerContract, - makerData._vault - ); + (bytes32 ilk, address urn) = + getVaultData(managerContract, makerData._vault); makerData.colAddr = InstaMapping(getMappingAddr()).gemJoinMapping(ilk); makerData.tokenJoinContract = TokenJoinInterface(makerData.colAddr); @@ -994,9 +977,8 @@ contract BasicExtraResolver is BasicResolver { setUint(setId, _amt); emit LogExitDai(_vault, ilk, _amt, getId, setId); - bytes32 _eventCode = keccak256( - "LogExitDai(uint256,bytes32,uint256,uint256,uint256)" - ); + bytes32 _eventCode = + keccak256("LogExitDai(uint256,bytes32,uint256,uint256,uint256)"); bytes memory _eventParam = abi.encode(_vault, ilk, _amt, getId, setId); (uint256 _type, uint256 _id) = connectorID(); EventInterface(getEventAddr()).emitEvent( @@ -1047,9 +1029,8 @@ contract DsrResolver is BasicExtraResolver { setUint(setId, _amt); emit LogDepositDai(_amt, getId, setId); - bytes32 _eventCode = keccak256( - "LogDepositDai(uint256,uint256,uint256)" - ); + bytes32 _eventCode = + keccak256("LogDepositDai(uint256,uint256,uint256)"); bytes memory _eventParam = abi.encode(_amt, getId, setId); (uint256 _type, uint256 _id) = connectorID(); EventInterface(getEventAddr()).emitEvent( @@ -1102,9 +1083,8 @@ contract DsrResolver is BasicExtraResolver { setUint(setId, _amt); emit LogWithdrawDai(_amt, getId, setId); - bytes32 _eventCode = keccak256( - "LogWithdrawDai(uint256,uint256,uint256)" - ); + bytes32 _eventCode = + keccak256("LogWithdrawDai(uint256,uint256,uint256)"); bytes memory _eventParam = abi.encode(_amt, getId, setId); (uint256 _type, uint256 _id) = connectorID(); EventInterface(getEventAddr()).emitEvent( diff --git a/contracts/dependencies/InstaDapp/dsa-contracts/account.sol b/contracts/dependencies/InstaDapp/dsa-contracts/account.sol index 1475545..12d7014 100644 --- a/contracts/dependencies/InstaDapp/dsa-contracts/account.sol +++ b/contracts/dependencies/InstaDapp/dsa-contracts/account.sol @@ -42,8 +42,8 @@ contract Record { event LogSwitchShield(bool _shield); // InstaIndex Address. - address - public constant instaIndex = 0x0000000000000000000000000000000000000000; + address public constant instaIndex = + 0x0000000000000000000000000000000000000000; // The Account Module Version. uint256 public constant version = 1; // Auth Module(Address of Auth => bool). diff --git a/contracts/dependencies/InstaDapp/dsa-contracts/connectors.sol b/contracts/dependencies/InstaDapp/dsa-contracts/connectors.sol index 5b99417..b5f7ba6 100644 --- a/contracts/dependencies/InstaDapp/dsa-contracts/connectors.sol +++ b/contracts/dependencies/InstaDapp/dsa-contracts/connectors.sol @@ -30,8 +30,8 @@ contract Controllers is DSMath { event LogRemoveController(address indexed addr); // InstaIndex Address. - address - public constant instaIndex = 0x0000000000000000000000000000000000000000; + address public constant instaIndex = + 0x0000000000000000000000000000000000000000; // Enabled Chief(Address of Chief => bool). mapping(address => bool) public chief; diff --git a/contracts/dependencies/InstaDapp/dsa-contracts/list.sol b/contracts/dependencies/InstaDapp/dsa-contracts/list.sol index c556711..3109fa9 100644 --- a/contracts/dependencies/InstaDapp/dsa-contracts/list.sol +++ b/contracts/dependencies/InstaDapp/dsa-contracts/list.sol @@ -21,8 +21,8 @@ contract DSMath { contract Variables is DSMath { // InstaIndex Address. - address - public constant instaIndex = 0x0000000000000000000000000000000000000000; + address public constant instaIndex = + 0x0000000000000000000000000000000000000000; // Smart Account Count. uint64 public accounts; diff --git a/contracts/functions/gelato/FGelatoDebtBridge.sol b/contracts/functions/gelato/FGelatoDebtBridge.sol index a1c1c1e..7deefa3 100644 --- a/contracts/functions/gelato/FGelatoDebtBridge.sol +++ b/contracts/functions/gelato/FGelatoDebtBridge.sol @@ -61,10 +61,8 @@ function _getFlashLoanRoute(address _tokenA, uint256 _wTokenADebtToMove) view returns (uint256) { - IInstaPoolResolver.RouteData memory rData = IInstaPoolResolver( - INSTA_POOL_RESOLVER - ) - .getTokenLimit(_tokenA); + IInstaPoolResolver.RouteData memory rData = + IInstaPoolResolver(INSTA_POOL_RESOLVER).getTokenLimit(_tokenA); if (rData.dydx > _wTokenADebtToMove) return 0; if (rData.maker > _wTokenADebtToMove) return 1; diff --git a/deploy/connectors/ConnectGelatoDataForFullRefinance.deploy.js b/deploy/connectors/ConnectGelatoDataForFullRefinance.deploy.js index 51584c4..4a141ab 100644 --- a/deploy/connectors/ConnectGelatoDataForFullRefinance.deploy.js +++ b/deploy/connectors/ConnectGelatoDataForFullRefinance.deploy.js @@ -1,7 +1,7 @@ const hre = require("hardhat"); -const {ethers} = hre; +const { ethers } = hre; -const {sleep} = require("@gelatonetwork/core"); +const { sleep } = require("@gelatonetwork/core"); const InstaConnector = require("../../pre-compiles/InstaConnectors.json"); @@ -10,12 +10,12 @@ module.exports = async (hre) => { console.log( "Deploying ConnectGelatoDataFullRefinanceMaker to mainnet. Hit ctrl + c to abort" ); - await sleep(10000); + await sleep(2000); } - const {deployments} = hre; - const {deploy} = deployments; - const {deployer} = await hre.getNamedAccounts(); + const { deployments } = hre; + const { deploy } = deployments; + const { deployer } = await hre.getNamedAccounts(); const instaConnectors = await hre.ethers.getContractAt( InstaConnector.abi, diff --git a/deploy/connectors/ConnectGelatoDataForPartialRefinance.deploy.js b/deploy/connectors/ConnectGelatoDataForPartialRefinance.deploy.js index a31ff83..d8a4921 100644 --- a/deploy/connectors/ConnectGelatoDataForPartialRefinance.deploy.js +++ b/deploy/connectors/ConnectGelatoDataForPartialRefinance.deploy.js @@ -1,7 +1,7 @@ const hre = require("hardhat"); -const {ethers} = hre; +const { ethers } = hre; -const {sleep} = require("@gelatonetwork/core"); +const { sleep } = require("@gelatonetwork/core"); const InstaConnector = require("../../pre-compiles/InstaConnectors.json"); @@ -10,12 +10,12 @@ module.exports = async (hre) => { console.log( "Deploying ConnectGelatoDataPartialRefinanceMaker to mainnet. Hit ctrl + c to abort" ); - await sleep(10000); + await sleep(2000); } - const {deployments} = hre; - const {deploy} = deployments; - const {deployer} = await hre.getNamedAccounts(); + const { deployments } = hre; + const { deploy } = deployments; + const { deployer } = await hre.getNamedAccounts(); const instaConnectors = await hre.ethers.getContractAt( InstaConnector.abi, diff --git a/deploy/connectors/ConnectGelatoProviderPayment.deploy.js b/deploy/connectors/ConnectGelatoProviderPayment.deploy.js index bd9f3b7..aea1915 100644 --- a/deploy/connectors/ConnectGelatoProviderPayment.deploy.js +++ b/deploy/connectors/ConnectGelatoProviderPayment.deploy.js @@ -1,7 +1,7 @@ const hre = require("hardhat"); -const {ethers} = hre; +const { ethers } = hre; -const {sleep} = require("@gelatonetwork/core"); +const { sleep } = require("@gelatonetwork/core"); const InstaConnector = require("../../pre-compiles/InstaConnectors.json"); @@ -10,11 +10,11 @@ module.exports = async (hre) => { console.log( "Deploying ConnectGelatoProviderPayment to mainnet. Hit ctrl + c to abort" ); - await sleep(10000); + await sleep(2000); } - const {deployments} = hre; - const {deploy} = deployments; - const {deployer, gelatoProvider} = await hre.getNamedAccounts(); + const { deployments } = hre; + const { deploy } = deployments; + const { deployer, gelatoProvider } = await hre.getNamedAccounts(); const instaConnectors = await hre.ethers.getContractAt( InstaConnector.abi, diff --git a/deploy/gelato/conditions/ConditionCompareUintsFromTwoSources.deploy.js b/deploy/gelato/conditions/ConditionCompareUintsFromTwoSources.deploy.js index 7b82c88..6e6d9d0 100644 --- a/deploy/gelato/conditions/ConditionCompareUintsFromTwoSources.deploy.js +++ b/deploy/gelato/conditions/ConditionCompareUintsFromTwoSources.deploy.js @@ -1,16 +1,16 @@ -const {sleep} = require("@gelatonetwork/core"); +const { sleep } = require("@gelatonetwork/core"); module.exports = async (hre) => { if (hre.network.name === "mainnet") { console.log( "Deploying ConditionCompareUintsFromTwoSources to mainnet. Hit ctrl + c to abort" ); - await sleep(10000); + await sleep(2000); } - const {deployments} = hre; - const {deploy} = deployments; - const {deployer} = await hre.getNamedAccounts(); + const { deployments } = hre; + const { deploy } = deployments; + const { deployer } = await hre.getNamedAccounts(); // the following will only deploy "ConditionCompareUintsFromTwoSources" // if the contract was never deployed or if the code changed since last deployment diff --git a/deploy/gelato/conditions/ConditionDebtBridgeIsAffordable.deploy.js b/deploy/gelato/conditions/ConditionDebtBridgeIsAffordable.deploy.js index 713193e..4cfaa6d 100644 --- a/deploy/gelato/conditions/ConditionDebtBridgeIsAffordable.deploy.js +++ b/deploy/gelato/conditions/ConditionDebtBridgeIsAffordable.deploy.js @@ -1,16 +1,16 @@ -const {sleep} = require("@gelatonetwork/core"); +const { sleep } = require("@gelatonetwork/core"); module.exports = async (hre) => { if (hre.network.name === "mainnet") { console.log( "Deploying ConditionDebtBridgeIsAffordable to mainnet. Hit ctrl + c to abort" ); - await sleep(10000); + await sleep(2000); } - const {deployments} = hre; - const {deploy} = deployments; - const {deployer} = await hre.getNamedAccounts(); + const { deployments } = hre; + const { deploy } = deployments; + const { deployer } = await hre.getNamedAccounts(); // the following will only deploy "ConditionMakerVaultUnsafe" // if the contract was never deployed or if the code changed since last deployment diff --git a/deploy/gelato/conditions/ConditionMakerVaultUnsafe.deploy.js b/deploy/gelato/conditions/ConditionMakerVaultUnsafe.deploy.js index 0d3db29..2be7408 100644 --- a/deploy/gelato/conditions/ConditionMakerVaultUnsafe.deploy.js +++ b/deploy/gelato/conditions/ConditionMakerVaultUnsafe.deploy.js @@ -1,16 +1,16 @@ -const {sleep} = require("@gelatonetwork/core"); +const { sleep } = require("@gelatonetwork/core"); module.exports = async (hre) => { if (hre.network.name === "mainnet") { console.log( "Deploying ConditionMakerVaultUnsafe to mainnet. Hit ctrl + c to abort" ); - await sleep(10000); + await sleep(2000); } - const {deployments} = hre; - const {deploy} = deployments; - const {deployer} = await hre.getNamedAccounts(); + const { deployments } = hre; + const { deploy } = deployments; + const { deployer } = await hre.getNamedAccounts(); // the following will only deploy "ConditionMakerVaultUnsafe" // if the contract was never deployed or if the code changed since last deployment diff --git a/deploy/mocks/FGelatoDebtBridgeMock.deploy.js b/deploy/mocks/FGelatoDebtBridgeMock.deploy.js index 93a52b5..531fc48 100644 --- a/deploy/mocks/FGelatoDebtBridgeMock.deploy.js +++ b/deploy/mocks/FGelatoDebtBridgeMock.deploy.js @@ -1,16 +1,16 @@ -const {sleep} = require("@gelatonetwork/core"); +const { sleep } = require("@gelatonetwork/core"); module.exports = async (hre) => { if (hre.network.name === "mainnet") { console.log( "Deploying FGelatoDebtBridgeMock to mainnet. Hit ctrl + c to abort" ); - await sleep(10000); + await sleep(2000); } - const {deployments} = hre; - const {deploy} = deployments; - const {deployer} = await hre.getNamedAccounts(); + const { deployments } = hre; + const { deploy } = deployments; + const { deployer } = await hre.getNamedAccounts(); // the following will only deploy "FGelatoDebtBridgeMock" // if the contract was never deployed or if the code changed since last deployment diff --git a/deploy/mocks/FGelatoDebtBridgeMock.js b/deploy/mocks/FGelatoDebtBridgeMock.js index 93a52b5..531fc48 100644 --- a/deploy/mocks/FGelatoDebtBridgeMock.js +++ b/deploy/mocks/FGelatoDebtBridgeMock.js @@ -1,16 +1,16 @@ -const {sleep} = require("@gelatonetwork/core"); +const { sleep } = require("@gelatonetwork/core"); module.exports = async (hre) => { if (hre.network.name === "mainnet") { console.log( "Deploying FGelatoDebtBridgeMock to mainnet. Hit ctrl + c to abort" ); - await sleep(10000); + await sleep(2000); } - const {deployments} = hre; - const {deploy} = deployments; - const {deployer} = await hre.getNamedAccounts(); + const { deployments } = hre; + const { deploy } = deployments; + const { deployer } = await hre.getNamedAccounts(); // the following will only deploy "FGelatoDebtBridgeMock" // if the contract was never deployed or if the code changed since last deployment diff --git a/deploy/mocks/MockCDAI.deploy.js b/deploy/mocks/MockCDAI.deploy.js index 552ddb8..74ae29d 100644 --- a/deploy/mocks/MockCDAI.deploy.js +++ b/deploy/mocks/MockCDAI.deploy.js @@ -1,14 +1,14 @@ -const {sleep} = require("@gelatonetwork/core"); +const { sleep } = require("@gelatonetwork/core"); module.exports = async (hre) => { if (hre.network.name === "mainnet") { console.log("Deploying MockCDAI to mainnet. Hit ctrl + c to abort"); - await sleep(10000); + await sleep(2000); } - const {deployments} = hre; - const {deploy} = deployments; - const {deployer} = await hre.getNamedAccounts(); + const { deployments } = hre; + const { deploy } = deployments; + const { deployer } = await hre.getNamedAccounts(); const APY_2_PERCENT_IN_SECONDS = "1000000000627937192491029810"; diff --git a/deploy/mocks/MockDSR.deploy.js b/deploy/mocks/MockDSR.deploy.js index 2187d39..b933487 100644 --- a/deploy/mocks/MockDSR.deploy.js +++ b/deploy/mocks/MockDSR.deploy.js @@ -1,14 +1,14 @@ -const {sleep} = require("@gelatonetwork/core"); +const { sleep } = require("@gelatonetwork/core"); module.exports = async (hre) => { if (hre.network.name === "mainnet") { console.log("Deploying MockDSR to mainnet. Hit ctrl + c to abort"); - await sleep(10000); + await sleep(2000); } - const {deployments} = hre; - const {deploy} = deployments; - const {deployer} = await hre.getNamedAccounts(); + const { deployments } = hre; + const { deploy } = deployments; + const { deployer } = await hre.getNamedAccounts(); const APY_2_PERCENT_IN_SECONDS = "1000000000627937192491029810"; diff --git a/deploy/mocks/MockGelatoExecutor.deploy.js b/deploy/mocks/MockGelatoExecutor.deploy.js index 64e97d5..cfa79dc 100644 --- a/deploy/mocks/MockGelatoExecutor.deploy.js +++ b/deploy/mocks/MockGelatoExecutor.deploy.js @@ -1,6 +1,6 @@ -const {sleep} = require("@gelatonetwork/core"); +const { sleep } = require("@gelatonetwork/core"); const hre = require("hardhat"); -const {ethers} = hre; +const { ethers } = hre; const GelatoCoreLib = require("@gelatonetwork/core"); module.exports = async (hre) => { @@ -8,12 +8,12 @@ module.exports = async (hre) => { console.log( "Deploying MockGelatoExecutor to mainnet. Hit ctrl + c to abort" ); - await sleep(10000); + await sleep(2000); } - const {deployments} = hre; - const {deploy} = deployments; - const {deployer} = await hre.getNamedAccounts(); + const { deployments } = hre; + const { deploy } = deployments; + const { deployer } = await hre.getNamedAccounts(); const gelatoCore = await ethers.getContractAt( GelatoCoreLib.GelatoCore.abi, hre.network.config.GelatoCore diff --git a/deploy/resolvers/MakerResolver.deploy.js b/deploy/resolvers/MakerResolver.deploy.js index 097ff9a..ea1a042 100644 --- a/deploy/resolvers/MakerResolver.deploy.js +++ b/deploy/resolvers/MakerResolver.deploy.js @@ -1,14 +1,14 @@ -const {sleep} = require("@gelatonetwork/core"); +const { sleep } = require("@gelatonetwork/core"); module.exports = async (hre) => { if (hre.network.name === "mainnet") { console.log("Deploying MakerResolver to mainnet. Hit ctrl + c to abort"); - await sleep(10000); + await sleep(2000); } - const {deployments} = hre; - const {deploy} = deployments; - const {deployer} = await hre.getNamedAccounts(); + const { deployments } = hre; + const { deploy } = deployments; + const { deployer } = await hre.getNamedAccounts(); // the following will only deploy "MakerResolver" // if the contract was never deployed or if the code changed since last deployment diff --git a/deploy/resolvers/PriceOracleResolver.deploy.js b/deploy/resolvers/PriceOracleResolver.deploy.js index 8cc18e7..adc4107 100644 --- a/deploy/resolvers/PriceOracleResolver.deploy.js +++ b/deploy/resolvers/PriceOracleResolver.deploy.js @@ -1,16 +1,16 @@ -const {sleep} = require("@gelatonetwork/core"); +const { sleep } = require("@gelatonetwork/core"); module.exports = async (hre) => { if (hre.network.name === "mainnet") { console.log( "Deploying PriceOracleResolver to mainnet. Hit ctrl + c to abort" ); - await sleep(10000); + await sleep(5000); } - const {deployments} = hre; - const {deploy} = deployments; - const {deployer} = await hre.getNamedAccounts(); + const { deployments } = hre; + const { deploy } = deployments; + const { deployer } = await hre.getNamedAccounts(); // the following will only deploy "PriceOracleResolver" // if the contract was never deployed or if the code changed since last deployment diff --git a/deployments/mainnet/.chainId b/deployments/mainnet/.chainId new file mode 100644 index 0000000..56a6051 --- /dev/null +++ b/deployments/mainnet/.chainId @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/deployments/mainnet/ConditionCompareUintsFromTwoSources.json b/deployments/mainnet/ConditionCompareUintsFromTwoSources.json new file mode 100644 index 0000000..2014001 --- /dev/null +++ b/deployments/mainnet/ConditionCompareUintsFromTwoSources.json @@ -0,0 +1,178 @@ +{ + "address": "0xd5b02b70038a43263e4c1162ebf8fbe51fb12ba2", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_sourceA", + "type": "address" + }, + { + "internalType": "address", + "name": "_sourceB", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_sourceAData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "_sourceBData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "_minSpread", + "type": "uint256" + } + ], + "name": "compare", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_sourceA", + "type": "address" + }, + { + "internalType": "address", + "name": "_sourceB", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_sourceAData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "_sourceBData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "_minSpread", + "type": "uint256" + } + ], + "name": "getConditionData", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_conditionData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "ok", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x2f0118c2099548752bb69db80aea1c65f8b7e53c4d87b5a369b5d0e31cc10066", + "receipt": { + "to": null, + "from": "0xe1f076849b781b1395fd332dc1758dbc129be6ec", + "contractAddress": "0xd5b02b70038a43263e4c1162ebf8fbe51fb12ba2", + "transactionIndex": "0x5f", + "gasUsed": "0x9e35b", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x1fc5d3507341842d5beea07475194e27be60e152f44d4e9fa8d96a163a9df2d6", + "transactionHash": "0x2f0118c2099548752bb69db80aea1c65f8b7e53c4d87b5a369b5d0e31cc10066", + "logs": [], + "blockNumber": "0xabf76f", + "cumulativeGasUsed": "0x638b3c", + "status": "0x1" + }, + "args": [], + "solcInputHash": "89383a6e8e4256890d851f32690baa57", + "metadata": "{\"compiler\":{\"version\":\"0.7.4+commit.3f05b770\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_sourceA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_sourceB\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_sourceAData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"_sourceBData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_minSpread\",\"type\":\"uint256\"}],\"name\":\"compare\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_sourceA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_sourceB\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_sourceAData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"_sourceBData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_minSpread\",\"type\":\"uint256\"}],\"name\":\"getConditionData\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_conditionData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"ok\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"This contract only works if the refContracts fns returndata has a uint in the first 32-byte position.\",\"kind\":\"dev\",\"methods\":{\"compare(address,address,bytes,bytes,uint256)\":{\"details\":\"If you want to trigger when ContractA uint is greater than or equal to ContractB by _minSpread: (ContractA=_sourceA, ContractB=_sourceB) For the reverse (lower than/equal to): (ContractA=_sourceB, ContractB=_sourceA)\",\"params\":{\"_minSpread\":\"The minimum diff between sourceA and sourceB for the Condition to be relevant.\",\"_sourceA\":\"The first contract that returns a uint for comparison.\",\"_sourceAData\":\"Payload for retrieving the uint from _sourceA.\",\"_sourceB\":\"The second contract that returns a uint256 for comparison.\",\"_sourceBData\":\"Payload for retrieving the uint from _sourceB.\"},\"returns\":{\"_0\":\"OK if the Condition is fulfilled.\"}},\"ok(uint256,bytes,uint256)\":{\"details\":\"Every Gelato Condition must have this function selector as entry point.\",\"params\":{\"_conditionData\":\"The encoded data from getConditionData()\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"compare(address,address,bytes,bytes,uint256)\":{\"notice\":\"Compares 2 values from sourceA and sourceB to check if minSpread is there.\"},\"getConditionData(address,address,bytes,bytes,uint256)\":{\"notice\":\"Helper to encode the Condition.data field off-chain\"},\"ok(uint256,bytes,uint256)\":{\"notice\":\"Gelato Standard Condition function.\"}},\"notice\":\"A general contract for retrieving and comparing 2 uints from 2 contracts.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/contracts/gelato/conditions/ConditionCompareUintsFromTwoSources.sol\":\"ConditionCompareUintsFromTwoSources\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gelatonetwork/core/contracts/conditions/GelatoConditionsStandard.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity >=0.6.10;\\n\\nimport \\\"./IGelatoCondition.sol\\\";\\n\\nabstract contract GelatoConditionsStandard is IGelatoCondition {\\n string internal constant OK = \\\"OK\\\";\\n}\\n\",\"keccak256\":\"0xa3d9ee5c4398914bbc0fe75fe54e57b73b8a4367caf9a40d9e5fd1ba9d4adb89\",\"license\":\"UNLICENSED\"},\"@gelatonetwork/core/contracts/conditions/IGelatoCondition.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity >=0.6.10;\\npragma experimental ABIEncoderV2;\\n\\n/// @title IGelatoCondition - solidity interface of GelatoConditionsStandard\\n/// @notice all the APIs of GelatoConditionsStandard\\n/// @dev all the APIs are implemented inside GelatoConditionsStandard\\ninterface IGelatoCondition {\\n\\n /// @notice GelatoCore calls this to verify securely the specified Condition securely\\n /// @dev Be careful only to encode a Task's condition.data as is and not with the\\n /// \\\"ok\\\" selector or _taskReceiptId, since those two things are handled by GelatoCore.\\n /// @param _taskReceiptId This is passed by GelatoCore so we can rely on it as a secure\\n /// source of Task identification.\\n /// @param _conditionData This is the Condition.data field developers must encode their\\n /// Condition's specific parameters in.\\n /// @param _cycleId For Tasks that are executed as part of a cycle.\\n function ok(uint256 _taskReceiptId, bytes calldata _conditionData, uint256 _cycleId)\\n external\\n view\\n returns(string memory);\\n}\",\"keccak256\":\"0xd07607af93227ec5f8c2f5401289937b98c298f0d2398c1ba7410f82a6253964\",\"license\":\"UNLICENSED\"},\"@gelatonetwork/core/contracts/gelato_core/interfaces/IGelatoCore.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity >=0.6.10;\\npragma experimental ABIEncoderV2;\\n\\nimport {IGelatoProviderModule} from \\\"../../provider_modules/IGelatoProviderModule.sol\\\";\\nimport {IGelatoCondition} from \\\"../../conditions/IGelatoCondition.sol\\\";\\n\\nstruct Provider {\\n address addr; // if msg.sender == provider => self-Provider\\n IGelatoProviderModule module; // can be IGelatoProviderModule(0) for self-Providers\\n}\\n\\nstruct Condition {\\n IGelatoCondition inst; // can be AddressZero for self-conditional Actions\\n bytes data; // can be bytes32(0) for self-conditional Actions\\n}\\n\\nenum Operation { Call, Delegatecall }\\n\\nenum DataFlow { None, In, Out, InAndOut }\\n\\nstruct Action {\\n address addr;\\n bytes data;\\n Operation operation;\\n DataFlow dataFlow;\\n uint256 value;\\n bool termsOkCheck;\\n}\\n\\nstruct Task {\\n Condition[] conditions; // optional\\n Action[] actions;\\n uint256 selfProviderGasLimit; // optional: 0 defaults to gelatoMaxGas\\n uint256 selfProviderGasPriceCeil; // optional: 0 defaults to NO_CEIL\\n}\\n\\nstruct TaskReceipt {\\n uint256 id;\\n address userProxy;\\n Provider provider;\\n uint256 index;\\n Task[] tasks;\\n uint256 expiryDate;\\n uint256 cycleId; // auto-filled by GelatoCore. 0 for non-cyclic/chained tasks\\n uint256 submissionsLeft;\\n}\\n\\ninterface IGelatoCore {\\n event LogTaskSubmitted(\\n uint256 indexed taskReceiptId,\\n bytes32 indexed taskReceiptHash,\\n TaskReceipt taskReceipt\\n );\\n\\n event LogExecSuccess(\\n address indexed executor,\\n uint256 indexed taskReceiptId,\\n uint256 executorSuccessFee,\\n uint256 sysAdminSuccessFee\\n );\\n event LogCanExecFailed(\\n address indexed executor,\\n uint256 indexed taskReceiptId,\\n string reason\\n );\\n event LogExecReverted(\\n address indexed executor,\\n uint256 indexed taskReceiptId,\\n uint256 executorRefund,\\n string reason\\n );\\n\\n event LogTaskCancelled(uint256 indexed taskReceiptId, address indexed cancellor);\\n\\n /// @notice API to query whether Task can be submitted successfully.\\n /// @dev In submitTask the msg.sender must be the same as _userProxy here.\\n /// @param _provider Gelato Provider object: provider address and module.\\n /// @param _userProxy The userProxy from which the task will be submitted.\\n /// @param _task Selected provider, conditions, actions, expiry date of the task\\n function canSubmitTask(\\n address _userProxy,\\n Provider calldata _provider,\\n Task calldata _task,\\n uint256 _expiryDate\\n )\\n external\\n view\\n returns(string memory);\\n\\n /// @notice API to submit a single Task.\\n /// @dev You can let users submit multiple tasks at once by batching calls to this.\\n /// @param _provider Gelato Provider object: provider address and module.\\n /// @param _task A Gelato Task object: provider, conditions, actions.\\n /// @param _expiryDate From then on the task cannot be executed. 0 for infinity.\\n function submitTask(\\n Provider calldata _provider,\\n Task calldata _task,\\n uint256 _expiryDate\\n )\\n external;\\n\\n\\n /// @notice A Gelato Task Cycle consists of 1 or more Tasks that automatically submit\\n /// the next one, after they have been executed.\\n /// @param _provider Gelato Provider object: provider address and module.\\n /// @param _tasks This can be a single task or a sequence of tasks.\\n /// @param _expiryDate After this no task of the sequence can be executed any more.\\n /// @param _cycles How many full cycles will be submitted\\n function submitTaskCycle(\\n Provider calldata _provider,\\n Task[] calldata _tasks,\\n uint256 _expiryDate,\\n uint256 _cycles\\n )\\n external;\\n\\n\\n /// @notice A Gelato Task Cycle consists of 1 or more Tasks that automatically submit\\n /// the next one, after they have been executed.\\n /// @dev CAUTION: _sumOfRequestedTaskSubmits does not mean the number of cycles.\\n /// @dev If _sumOfRequestedTaskSubmits = 1 && _tasks.length = 2, only the first task\\n /// would be submitted, but not the second\\n /// @param _provider Gelato Provider object: provider address and module.\\n /// @param _tasks This can be a single task or a sequence of tasks.\\n /// @param _expiryDate After this no task of the sequence can be executed any more.\\n /// @param _sumOfRequestedTaskSubmits The TOTAL number of Task auto-submits\\n /// that should have occured once the cycle is complete:\\n /// _sumOfRequestedTaskSubmits = 0 => One Task will resubmit the next Task infinitly\\n /// _sumOfRequestedTaskSubmits = 1 => One Task will resubmit no other task\\n /// _sumOfRequestedTaskSubmits = 2 => One Task will resubmit 1 other task\\n /// ...\\n function submitTaskChain(\\n Provider calldata _provider,\\n Task[] calldata _tasks,\\n uint256 _expiryDate,\\n uint256 _sumOfRequestedTaskSubmits\\n )\\n external;\\n\\n // ================ Exec Suite =========================\\n /// @notice Off-chain API for executors to check, if a TaskReceipt is executable\\n /// @dev GelatoCore checks this during execution, in order to safeguard the Conditions\\n /// @param _TR TaskReceipt, consisting of user task, user proxy address and id\\n /// @param _gasLimit Task.selfProviderGasLimit is used for SelfProviders. All other\\n /// Providers must use gelatoMaxGas. If the _gasLimit is used by an Executor and the\\n /// tx reverts, a refund is paid by the Provider and the TaskReceipt is annulated.\\n /// @param _execTxGasPrice Must be used by Executors. Gas Price fed by gelatoCore's\\n /// Gas Price Oracle. Executors can query the current gelatoGasPrice from events.\\n function canExec(TaskReceipt calldata _TR, uint256 _gasLimit, uint256 _execTxGasPrice)\\n external\\n view\\n returns(string memory);\\n\\n /// @notice Executors call this when Conditions allow it to execute submitted Tasks.\\n /// @dev Executors get rewarded for successful Execution. The Task remains open until\\n /// successfully executed, or when the execution failed, despite of gelatoMaxGas usage.\\n /// In the latter case Executors are refunded by the Task Provider.\\n /// @param _TR TaskReceipt: id, userProxy, Task.\\n function exec(TaskReceipt calldata _TR) external;\\n\\n /// @notice Cancel task\\n /// @dev Callable only by userProxy or selected provider\\n /// @param _TR TaskReceipt: id, userProxy, Task.\\n function cancelTask(TaskReceipt calldata _TR) external;\\n\\n /// @notice Cancel multiple tasks at once\\n /// @dev Callable only by userProxy or selected provider\\n /// @param _taskReceipts TaskReceipts: id, userProxy, Task.\\n function multiCancelTasks(TaskReceipt[] calldata _taskReceipts) external;\\n\\n /// @notice Compute hash of task receipt\\n /// @param _TR TaskReceipt, consisting of user task, user proxy address and id\\n /// @return hash of taskReceipt\\n function hashTaskReceipt(TaskReceipt calldata _TR) external pure returns(bytes32);\\n\\n // ================ Getters =========================\\n /// @notice Returns the taskReceiptId of the last TaskReceipt submitted\\n /// @return currentId currentId, last TaskReceiptId submitted\\n function currentTaskReceiptId() external view returns(uint256);\\n\\n /// @notice Returns computed taskReceipt hash, used to check for taskReceipt validity\\n /// @param _taskReceiptId Id of taskReceipt emitted in submission event\\n /// @return hash of taskReceipt\\n function taskReceiptHash(uint256 _taskReceiptId) external view returns(bytes32);\\n}\\n\",\"keccak256\":\"0x93fdb67219b2d675621f935f3f7bc460b7283e797198741a95fabbafc7e33fee\",\"license\":\"UNLICENSED\"},\"@gelatonetwork/core/contracts/provider_modules/IGelatoProviderModule.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity >=0.6.10;\\npragma experimental ABIEncoderV2;\\n\\nimport {Action, Task} from \\\"../gelato_core/interfaces/IGelatoCore.sol\\\";\\n\\ninterface IGelatoProviderModule {\\n\\n /// @notice Check if provider agrees to pay for inputted task receipt\\n /// @dev Enables arbitrary checks by provider\\n /// @param _userProxy The smart contract account of the user who submitted the Task.\\n /// @param _provider The account of the Provider who uses the ProviderModule.\\n /// @param _task Gelato Task to be executed.\\n /// @return \\\"OK\\\" if provider agrees\\n function isProvided(address _userProxy, address _provider, Task calldata _task)\\n external\\n view\\n returns(string memory);\\n\\n /// @notice Convert action specific payload into proxy specific payload\\n /// @dev Encoded multiple actions into a multisend\\n /// @param _taskReceiptId Unique ID of Gelato Task to be executed.\\n /// @param _userProxy The smart contract account of the user who submitted the Task.\\n /// @param _provider The account of the Provider who uses the ProviderModule.\\n /// @param _task Gelato Task to be executed.\\n /// @param _cycleId For Tasks that form part of a cycle/chain.\\n /// @return Encoded payload that will be used for low-level .call on user proxy\\n /// @return checkReturndata if true, fwd returndata from userProxy.call to ProviderModule\\n function execPayload(\\n uint256 _taskReceiptId,\\n address _userProxy,\\n address _provider,\\n Task calldata _task,\\n uint256 _cycleId\\n )\\n external\\n view\\n returns(bytes memory, bool checkReturndata);\\n\\n /// @notice Called by GelatoCore.exec to verifiy that no revert happend on userProxy\\n /// @dev If a caught revert is detected, this fn should revert with the detected error\\n /// @param _proxyReturndata Data from GelatoCore._exec.userProxy.call(execPayload)\\n function execRevertCheck(bytes calldata _proxyReturndata) external pure;\\n}\\n\",\"keccak256\":\"0x8d08ceddbc4e686d070e916d2bcffc69c5a640b56866bc2cef0256b564eb14dc\",\"license\":\"UNLICENSED\"},\"contracts/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 \\\"../../../vendor/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 ) = 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) = _sourceA.staticcall(\\n _sourceAData\\n );\\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\",\"keccak256\":\"0xc014432de80f51bca1bdb9c4df1ff8dacd1075cd8ed06e0f6e5f9efdfa448024\",\"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/SafeMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.7.4;\\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}\",\"keccak256\":\"0x2df10d7e2f5eeffa2d90841eef4987593c4b67a0c81bca67ec774c2683a59b43\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610ac2806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063237dcf571461004657806345cea5b314610192578063a99891c5146102d6575b600080fd5b61011d600480360360a081101561005c57600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b81111561008f57600080fd5b8201836020820111156100a157600080fd5b803590602001918460018302840111600160201b831117156100c257600080fd5b919390929091602081019035600160201b8111156100df57600080fd5b8201836020820111156100f157600080fd5b803590602001918460018302840111600160201b8311171561011257600080fd5b91935091503561034b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015757818101518382015260200161013f565b50505050905090810190601f1680156101845780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61011d600480360360a08110156101a857600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b8111156101db57600080fd5b8201836020820111156101ed57600080fd5b803590602001918460018302840111600160201b8311171561020e57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561026057600080fd5b82018360208201111561027257600080fd5b803590602001918460018302840111600160201b8311171561029357600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955050913592506103fa915050565b61011d600480360360608110156102ec57600080fd5b81359190810190604081016020820135600160201b81111561030d57600080fd5b82018360208201111561031f57600080fd5b803590602001918460018302840111600160201b8311171561034057600080fd5b919350915035610662565b60608787878787878760405160200180886001600160a01b03168152602001876001600160a01b0316815260200180602001806020018481526020018381038352888882818152602001925080828437600083820152601f01601f19169091018481038352868152602001905086868082843760008382015260408051601f909201601f19908116909401828103909401825292909252509a5050505050505050505050979650505050505050565b606060006060876001600160a01b0316866040518082805190602001908083835b6020831061043a5780518252601f19909201916020918201910161041b565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d806000811461049a576040519150601f19603f3d011682016040523d82523d6000602084013e61049f565b606091505b5091509150816104d5576104cc6040518060600160405280602a8152602001610a63602a913982906107cd565b92505050610659565b60008180602001905160208110156104ec57600080fd5b505160405187519192506001600160a01b038a1691889190819060208401908083835b6020831061052e5780518252601f19909201916020918201910161050f565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d806000811461058e576040519150601f19603f3d011682016040523d82523d6000602084013e610593565b606091505b509093509150826105cb576105c16040518060600160405280602a8152602001610a39602a913983906107cd565b9350505050610659565b60008280602001905160208110156105e257600080fd5b505190506105f081876109d7565b821061061c57604051806040016040528060028152602001614f4b60f01b815250945050505050610659565b6040518060400160405280602081526020017f414e6f74477265617465724f72457175616c546f4262794d696e7370726561648152509450505050505b95945050505050565b60606000806060806000888860a081101561067c57600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b8111156106af57600080fd5b8201836020820111156106c157600080fd5b803590602001918460018302840111600160201b831117156106e257600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561073457600080fd5b82018360208201111561074657600080fd5b803590602001918460018302840111600160201b8311171561076757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250989d50969b5094995097503595506107bf9450899350889250879150869050856103fa565b9a9950505050505050505050565b606060208351816107da57fe5b066004141561094857602083015162461bcd60e51b6001600160e01b0319821614156108bf5760448401935082846040516020018083805190602001908083835b6020831061083a5780518252601f19909201916020918201910161081b565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106108825780518252601f199092019160209182019101610863565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529150506109d1565b826040516020018082805190602001908083835b602083106108f25780518252601f1990920191602091820191016108d3565b6001836020036101000a038019825116818451168082178552505050505050905001806e2737a2b93937b929b2b632b1ba37b960891b815250600f019150506040516020818303038152906040529150506109d1565b816040516020018082805190602001908083835b6020831061097b5780518252601f19909201916020918201910161095c565b6001836020036101000a0380198251168184511680821785525050505050509050018073556e657870656374656452657475726e6461746160601b81525060140191505060405160208183030381529060405290505b92915050565b600082820183811015610a31576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe436f6e646974696f6e436f6d7061726554776f55696e74732e636f6d706172652e5f736f75726365423a436f6e646974696f6e436f6d7061726554776f55696e74732e636f6d706172652e5f736f75726365413aa2646970667358221220bc20bddbc6f898f4d0317140645bc1f142b771ea041ffcc49e4e082c93f6084564736f6c63430007040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063237dcf571461004657806345cea5b314610192578063a99891c5146102d6575b600080fd5b61011d600480360360a081101561005c57600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b81111561008f57600080fd5b8201836020820111156100a157600080fd5b803590602001918460018302840111600160201b831117156100c257600080fd5b919390929091602081019035600160201b8111156100df57600080fd5b8201836020820111156100f157600080fd5b803590602001918460018302840111600160201b8311171561011257600080fd5b91935091503561034b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015757818101518382015260200161013f565b50505050905090810190601f1680156101845780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61011d600480360360a08110156101a857600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b8111156101db57600080fd5b8201836020820111156101ed57600080fd5b803590602001918460018302840111600160201b8311171561020e57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561026057600080fd5b82018360208201111561027257600080fd5b803590602001918460018302840111600160201b8311171561029357600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955050913592506103fa915050565b61011d600480360360608110156102ec57600080fd5b81359190810190604081016020820135600160201b81111561030d57600080fd5b82018360208201111561031f57600080fd5b803590602001918460018302840111600160201b8311171561034057600080fd5b919350915035610662565b60608787878787878760405160200180886001600160a01b03168152602001876001600160a01b0316815260200180602001806020018481526020018381038352888882818152602001925080828437600083820152601f01601f19169091018481038352868152602001905086868082843760008382015260408051601f909201601f19908116909401828103909401825292909252509a5050505050505050505050979650505050505050565b606060006060876001600160a01b0316866040518082805190602001908083835b6020831061043a5780518252601f19909201916020918201910161041b565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d806000811461049a576040519150601f19603f3d011682016040523d82523d6000602084013e61049f565b606091505b5091509150816104d5576104cc6040518060600160405280602a8152602001610a63602a913982906107cd565b92505050610659565b60008180602001905160208110156104ec57600080fd5b505160405187519192506001600160a01b038a1691889190819060208401908083835b6020831061052e5780518252601f19909201916020918201910161050f565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d806000811461058e576040519150601f19603f3d011682016040523d82523d6000602084013e610593565b606091505b509093509150826105cb576105c16040518060600160405280602a8152602001610a39602a913983906107cd565b9350505050610659565b60008280602001905160208110156105e257600080fd5b505190506105f081876109d7565b821061061c57604051806040016040528060028152602001614f4b60f01b815250945050505050610659565b6040518060400160405280602081526020017f414e6f74477265617465724f72457175616c546f4262794d696e7370726561648152509450505050505b95945050505050565b60606000806060806000888860a081101561067c57600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b8111156106af57600080fd5b8201836020820111156106c157600080fd5b803590602001918460018302840111600160201b831117156106e257600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561073457600080fd5b82018360208201111561074657600080fd5b803590602001918460018302840111600160201b8311171561076757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250989d50969b5094995097503595506107bf9450899350889250879150869050856103fa565b9a9950505050505050505050565b606060208351816107da57fe5b066004141561094857602083015162461bcd60e51b6001600160e01b0319821614156108bf5760448401935082846040516020018083805190602001908083835b6020831061083a5780518252601f19909201916020918201910161081b565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106108825780518252601f199092019160209182019101610863565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529150506109d1565b826040516020018082805190602001908083835b602083106108f25780518252601f1990920191602091820191016108d3565b6001836020036101000a038019825116818451168082178552505050505050905001806e2737a2b93937b929b2b632b1ba37b960891b815250600f019150506040516020818303038152906040529150506109d1565b816040516020018082805190602001908083835b6020831061097b5780518252601f19909201916020918201910161095c565b6001836020036101000a0380198251168184511680821785525050505050509050018073556e657870656374656452657475726e6461746160601b81525060140191505060405160208183030381529060405290505b92915050565b600082820183811015610a31576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe436f6e646974696f6e436f6d7061726554776f55696e74732e636f6d706172652e5f736f75726365423a436f6e646974696f6e436f6d7061726554776f55696e74732e636f6d706172652e5f736f75726365413aa2646970667358221220bc20bddbc6f898f4d0317140645bc1f142b771ea041ffcc49e4e082c93f6084564736f6c63430007040033", + "devdoc": { + "details": "This contract only works if the refContracts fns returndata has a uint in the first 32-byte position.", + "kind": "dev", + "methods": { + "compare(address,address,bytes,bytes,uint256)": { + "details": "If you want to trigger when ContractA uint is greater than or equal to ContractB by _minSpread: (ContractA=_sourceA, ContractB=_sourceB) For the reverse (lower than/equal to): (ContractA=_sourceB, ContractB=_sourceA)", + "params": { + "_minSpread": "The minimum diff between sourceA and sourceB for the Condition to be relevant.", + "_sourceA": "The first contract that returns a uint for comparison.", + "_sourceAData": "Payload for retrieving the uint from _sourceA.", + "_sourceB": "The second contract that returns a uint256 for comparison.", + "_sourceBData": "Payload for retrieving the uint from _sourceB." + }, + "returns": { + "_0": "OK if the Condition is fulfilled." + } + }, + "ok(uint256,bytes,uint256)": { + "details": "Every Gelato Condition must have this function selector as entry point.", + "params": { + "_conditionData": "The encoded data from getConditionData()" + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "compare(address,address,bytes,bytes,uint256)": { + "notice": "Compares 2 values from sourceA and sourceB to check if minSpread is there." + }, + "getConditionData(address,address,bytes,bytes,uint256)": { + "notice": "Helper to encode the Condition.data field off-chain" + }, + "ok(uint256,bytes,uint256)": { + "notice": "Gelato Standard Condition function." + } + }, + "notice": "A general contract for retrieving and comparing 2 uints from 2 contracts.", + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} diff --git a/deployments/mainnet/ConditionDebtBridgeIsAffordable.json b/deployments/mainnet/ConditionDebtBridgeIsAffordable.json new file mode 100644 index 0000000..7be58f2 --- /dev/null +++ b/deployments/mainnet/ConditionDebtBridgeIsAffordable.json @@ -0,0 +1,156 @@ +{ + "address": "0x9530ed1B1936677189561420EA8F80E1dd42b4F8", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "_vaultId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_ratioLimit", + "type": "uint256" + } + ], + "name": "getConditionData", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_vaultId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_ratioLimit", + "type": "uint256" + } + ], + "name": "isAffordable", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_conditionData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "ok", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xc1df126d030c89f9d44185765e83301a249e2c0226e9b26be72896697ba8ca54", + "receipt": { + "to": null, + "from": "0xe1F076849B781b1395Fd332dC1758Dbc129be6EC", + "contractAddress": "0x9530ed1B1936677189561420EA8F80E1dd42b4F8", + "transactionIndex": 99, + "gasUsed": "748172", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x34ce9ff4e7e5e1ab99667b03e0e24cbac1370a377a16e5934184c71dfd272dab", + "transactionHash": "0xc1df126d030c89f9d44185765e83301a249e2c0226e9b26be72896697ba8ca54", + "logs": [], + "blockNumber": 11270005, + "cumulativeGasUsed": "8009358", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "89383a6e8e4256890d851f32690baa57", + "metadata": "{\"compiler\":{\"version\":\"0.7.4+commit.3f05b770\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_vaultId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_ratioLimit\",\"type\":\"uint256\"}],\"name\":\"getConditionData\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_vaultId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_ratioLimit\",\"type\":\"uint256\"}],\"name\":\"isAffordable\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_conditionData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"ok\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Gelato Team\",\"kind\":\"dev\",\"methods\":{\"getConditionData(uint256,uint256)\":{\"details\":\"Use the return for your Task's Condition.data field off-chain.WARNING _ratioLimit should be in wad standard.\",\"returns\":{\"_0\":\"The encoded payload for your Task's Condition.data field.\"}},\"isAffordable(uint256,uint256)\":{\"details\":\"Check if the debt refinancing action is affordable.WARNING _ratioLimit should be in wad standard.\",\"params\":{\"_ratioLimit\":\"the maximum limit define by the user up on which the debt is too expensive for him\",\"_vaultId\":\"The id of the Maker vault\"},\"returns\":{\"_0\":\"OK if the Debt Bridge is affordable, otherwise some error message.\"}},\"ok(uint256,bytes,uint256)\":{\"details\":\"A standard interface for GelatoCore to read Conditions\",\"params\":{\"_conditionData\":\"The data you get from `getConditionData()`\"},\"returns\":{\"_0\":\"OK if the Condition is there, else some error message.\"}}},\"title\":\"ConditionDebtBridgeIsAffordable\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getConditionData(uint256,uint256)\":{\"notice\":\"Convenience function for off-chain _conditionData encoding\"},\"isAffordable(uint256,uint256)\":{\"notice\":\"Specific implementation of this Condition's ok function\"},\"ok(uint256,bytes,uint256)\":{\"notice\":\"Standard GelatoCore system function\"}},\"notice\":\"Condition checking if Debt Refinance is affordable.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/contracts/gelato/conditions/ConditionDebtBridgeIsAffordable.sol\":\"ConditionDebtBridgeIsAffordable\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gelatonetwork/core/contracts/conditions/GelatoConditionsStandard.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity >=0.6.10;\\n\\nimport \\\"./IGelatoCondition.sol\\\";\\n\\nabstract contract GelatoConditionsStandard is IGelatoCondition {\\n string internal constant OK = \\\"OK\\\";\\n}\\n\",\"keccak256\":\"0xa3d9ee5c4398914bbc0fe75fe54e57b73b8a4367caf9a40d9e5fd1ba9d4adb89\",\"license\":\"UNLICENSED\"},\"@gelatonetwork/core/contracts/conditions/IGelatoCondition.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity >=0.6.10;\\npragma experimental ABIEncoderV2;\\n\\n/// @title IGelatoCondition - solidity interface of GelatoConditionsStandard\\n/// @notice all the APIs of GelatoConditionsStandard\\n/// @dev all the APIs are implemented inside GelatoConditionsStandard\\ninterface IGelatoCondition {\\n\\n /// @notice GelatoCore calls this to verify securely the specified Condition securely\\n /// @dev Be careful only to encode a Task's condition.data as is and not with the\\n /// \\\"ok\\\" selector or _taskReceiptId, since those two things are handled by GelatoCore.\\n /// @param _taskReceiptId This is passed by GelatoCore so we can rely on it as a secure\\n /// source of Task identification.\\n /// @param _conditionData This is the Condition.data field developers must encode their\\n /// Condition's specific parameters in.\\n /// @param _cycleId For Tasks that are executed as part of a cycle.\\n function ok(uint256 _taskReceiptId, bytes calldata _conditionData, uint256 _cycleId)\\n external\\n view\\n returns(string memory);\\n}\",\"keccak256\":\"0xd07607af93227ec5f8c2f5401289937b98c298f0d2398c1ba7410f82a6253964\",\"license\":\"UNLICENSED\"},\"@gelatonetwork/core/contracts/gelato_core/interfaces/IGelatoCore.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity >=0.6.10;\\npragma experimental ABIEncoderV2;\\n\\nimport {IGelatoProviderModule} from \\\"../../provider_modules/IGelatoProviderModule.sol\\\";\\nimport {IGelatoCondition} from \\\"../../conditions/IGelatoCondition.sol\\\";\\n\\nstruct Provider {\\n address addr; // if msg.sender == provider => self-Provider\\n IGelatoProviderModule module; // can be IGelatoProviderModule(0) for self-Providers\\n}\\n\\nstruct Condition {\\n IGelatoCondition inst; // can be AddressZero for self-conditional Actions\\n bytes data; // can be bytes32(0) for self-conditional Actions\\n}\\n\\nenum Operation { Call, Delegatecall }\\n\\nenum DataFlow { None, In, Out, InAndOut }\\n\\nstruct Action {\\n address addr;\\n bytes data;\\n Operation operation;\\n DataFlow dataFlow;\\n uint256 value;\\n bool termsOkCheck;\\n}\\n\\nstruct Task {\\n Condition[] conditions; // optional\\n Action[] actions;\\n uint256 selfProviderGasLimit; // optional: 0 defaults to gelatoMaxGas\\n uint256 selfProviderGasPriceCeil; // optional: 0 defaults to NO_CEIL\\n}\\n\\nstruct TaskReceipt {\\n uint256 id;\\n address userProxy;\\n Provider provider;\\n uint256 index;\\n Task[] tasks;\\n uint256 expiryDate;\\n uint256 cycleId; // auto-filled by GelatoCore. 0 for non-cyclic/chained tasks\\n uint256 submissionsLeft;\\n}\\n\\ninterface IGelatoCore {\\n event LogTaskSubmitted(\\n uint256 indexed taskReceiptId,\\n bytes32 indexed taskReceiptHash,\\n TaskReceipt taskReceipt\\n );\\n\\n event LogExecSuccess(\\n address indexed executor,\\n uint256 indexed taskReceiptId,\\n uint256 executorSuccessFee,\\n uint256 sysAdminSuccessFee\\n );\\n event LogCanExecFailed(\\n address indexed executor,\\n uint256 indexed taskReceiptId,\\n string reason\\n );\\n event LogExecReverted(\\n address indexed executor,\\n uint256 indexed taskReceiptId,\\n uint256 executorRefund,\\n string reason\\n );\\n\\n event LogTaskCancelled(uint256 indexed taskReceiptId, address indexed cancellor);\\n\\n /// @notice API to query whether Task can be submitted successfully.\\n /// @dev In submitTask the msg.sender must be the same as _userProxy here.\\n /// @param _provider Gelato Provider object: provider address and module.\\n /// @param _userProxy The userProxy from which the task will be submitted.\\n /// @param _task Selected provider, conditions, actions, expiry date of the task\\n function canSubmitTask(\\n address _userProxy,\\n Provider calldata _provider,\\n Task calldata _task,\\n uint256 _expiryDate\\n )\\n external\\n view\\n returns(string memory);\\n\\n /// @notice API to submit a single Task.\\n /// @dev You can let users submit multiple tasks at once by batching calls to this.\\n /// @param _provider Gelato Provider object: provider address and module.\\n /// @param _task A Gelato Task object: provider, conditions, actions.\\n /// @param _expiryDate From then on the task cannot be executed. 0 for infinity.\\n function submitTask(\\n Provider calldata _provider,\\n Task calldata _task,\\n uint256 _expiryDate\\n )\\n external;\\n\\n\\n /// @notice A Gelato Task Cycle consists of 1 or more Tasks that automatically submit\\n /// the next one, after they have been executed.\\n /// @param _provider Gelato Provider object: provider address and module.\\n /// @param _tasks This can be a single task or a sequence of tasks.\\n /// @param _expiryDate After this no task of the sequence can be executed any more.\\n /// @param _cycles How many full cycles will be submitted\\n function submitTaskCycle(\\n Provider calldata _provider,\\n Task[] calldata _tasks,\\n uint256 _expiryDate,\\n uint256 _cycles\\n )\\n external;\\n\\n\\n /// @notice A Gelato Task Cycle consists of 1 or more Tasks that automatically submit\\n /// the next one, after they have been executed.\\n /// @dev CAUTION: _sumOfRequestedTaskSubmits does not mean the number of cycles.\\n /// @dev If _sumOfRequestedTaskSubmits = 1 && _tasks.length = 2, only the first task\\n /// would be submitted, but not the second\\n /// @param _provider Gelato Provider object: provider address and module.\\n /// @param _tasks This can be a single task or a sequence of tasks.\\n /// @param _expiryDate After this no task of the sequence can be executed any more.\\n /// @param _sumOfRequestedTaskSubmits The TOTAL number of Task auto-submits\\n /// that should have occured once the cycle is complete:\\n /// _sumOfRequestedTaskSubmits = 0 => One Task will resubmit the next Task infinitly\\n /// _sumOfRequestedTaskSubmits = 1 => One Task will resubmit no other task\\n /// _sumOfRequestedTaskSubmits = 2 => One Task will resubmit 1 other task\\n /// ...\\n function submitTaskChain(\\n Provider calldata _provider,\\n Task[] calldata _tasks,\\n uint256 _expiryDate,\\n uint256 _sumOfRequestedTaskSubmits\\n )\\n external;\\n\\n // ================ Exec Suite =========================\\n /// @notice Off-chain API for executors to check, if a TaskReceipt is executable\\n /// @dev GelatoCore checks this during execution, in order to safeguard the Conditions\\n /// @param _TR TaskReceipt, consisting of user task, user proxy address and id\\n /// @param _gasLimit Task.selfProviderGasLimit is used for SelfProviders. All other\\n /// Providers must use gelatoMaxGas. If the _gasLimit is used by an Executor and the\\n /// tx reverts, a refund is paid by the Provider and the TaskReceipt is annulated.\\n /// @param _execTxGasPrice Must be used by Executors. Gas Price fed by gelatoCore's\\n /// Gas Price Oracle. Executors can query the current gelatoGasPrice from events.\\n function canExec(TaskReceipt calldata _TR, uint256 _gasLimit, uint256 _execTxGasPrice)\\n external\\n view\\n returns(string memory);\\n\\n /// @notice Executors call this when Conditions allow it to execute submitted Tasks.\\n /// @dev Executors get rewarded for successful Execution. The Task remains open until\\n /// successfully executed, or when the execution failed, despite of gelatoMaxGas usage.\\n /// In the latter case Executors are refunded by the Task Provider.\\n /// @param _TR TaskReceipt: id, userProxy, Task.\\n function exec(TaskReceipt calldata _TR) external;\\n\\n /// @notice Cancel task\\n /// @dev Callable only by userProxy or selected provider\\n /// @param _TR TaskReceipt: id, userProxy, Task.\\n function cancelTask(TaskReceipt calldata _TR) external;\\n\\n /// @notice Cancel multiple tasks at once\\n /// @dev Callable only by userProxy or selected provider\\n /// @param _taskReceipts TaskReceipts: id, userProxy, Task.\\n function multiCancelTasks(TaskReceipt[] calldata _taskReceipts) external;\\n\\n /// @notice Compute hash of task receipt\\n /// @param _TR TaskReceipt, consisting of user task, user proxy address and id\\n /// @return hash of taskReceipt\\n function hashTaskReceipt(TaskReceipt calldata _TR) external pure returns(bytes32);\\n\\n // ================ Getters =========================\\n /// @notice Returns the taskReceiptId of the last TaskReceipt submitted\\n /// @return currentId currentId, last TaskReceiptId submitted\\n function currentTaskReceiptId() external view returns(uint256);\\n\\n /// @notice Returns computed taskReceipt hash, used to check for taskReceipt validity\\n /// @param _taskReceiptId Id of taskReceipt emitted in submission event\\n /// @return hash of taskReceipt\\n function taskReceiptHash(uint256 _taskReceiptId) external view returns(bytes32);\\n}\\n\",\"keccak256\":\"0x93fdb67219b2d675621f935f3f7bc460b7283e797198741a95fabbafc7e33fee\",\"license\":\"UNLICENSED\"},\"@gelatonetwork/core/contracts/provider_modules/IGelatoProviderModule.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity >=0.6.10;\\npragma experimental ABIEncoderV2;\\n\\nimport {Action, Task} from \\\"../gelato_core/interfaces/IGelatoCore.sol\\\";\\n\\ninterface IGelatoProviderModule {\\n\\n /// @notice Check if provider agrees to pay for inputted task receipt\\n /// @dev Enables arbitrary checks by provider\\n /// @param _userProxy The smart contract account of the user who submitted the Task.\\n /// @param _provider The account of the Provider who uses the ProviderModule.\\n /// @param _task Gelato Task to be executed.\\n /// @return \\\"OK\\\" if provider agrees\\n function isProvided(address _userProxy, address _provider, Task calldata _task)\\n external\\n view\\n returns(string memory);\\n\\n /// @notice Convert action specific payload into proxy specific payload\\n /// @dev Encoded multiple actions into a multisend\\n /// @param _taskReceiptId Unique ID of Gelato Task to be executed.\\n /// @param _userProxy The smart contract account of the user who submitted the Task.\\n /// @param _provider The account of the Provider who uses the ProviderModule.\\n /// @param _task Gelato Task to be executed.\\n /// @param _cycleId For Tasks that form part of a cycle/chain.\\n /// @return Encoded payload that will be used for low-level .call on user proxy\\n /// @return checkReturndata if true, fwd returndata from userProxy.call to ProviderModule\\n function execPayload(\\n uint256 _taskReceiptId,\\n address _userProxy,\\n address _provider,\\n Task calldata _task,\\n uint256 _cycleId\\n )\\n external\\n view\\n returns(bytes memory, bool checkReturndata);\\n\\n /// @notice Called by GelatoCore.exec to verifiy that no revert happend on userProxy\\n /// @dev If a caught revert is detected, this fn should revert with the detected error\\n /// @param _proxyReturndata Data from GelatoCore._exec.userProxy.call(execPayload)\\n function execRevertCheck(bytes calldata _proxyReturndata) external pure;\\n}\\n\",\"keccak256\":\"0x8d08ceddbc4e686d070e916d2bcffc69c5a640b56866bc2cef0256b564eb14dc\",\"license\":\"UNLICENSED\"},\"contracts/constants/CDebtBridge.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\nfunction GAS_COSTS_FOR_FULL_REFINANCE() pure returns(uint256[4] memory) {\\n return [uint256(2519000), 3140500, 3971000, 4345000];\\n}\",\"keccak256\":\"0x45db50ccf92463d58cf08eb3467d40f35df0199d53460510e7dfaa35186a0c75\",\"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 = 0x07F81230d73a78f63F0c2A3403AD281b067d28F8;\\naddress constant INSTA_POOL_V2 = 0x3150e5A805577366816A1ddc7330c6Ea17070c05;\\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;\",\"keccak256\":\"0x7067dfe63e031f3455fd53d1eab37ffa075f68b24f4f929c3506407af3f85550\",\"license\":\"UNLICENSED\"},\"contracts/constants/CMaker.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\naddress constant MCD_MANAGER = 0x5ef30b9986345249bc32d8928B7ee64DE9435E39;\",\"keccak256\":\"0x033c9d09b895b11a9edba77e891a7b3dbf1f360b5a141a40eb5c634be438dddd\",\"license\":\"UNLICENSED\"},\"contracts/contracts/gelato/conditions/ConditionDebtBridgeIsAffordable.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\npragma experimental ABIEncoderV2;\\n\\nimport {\\n GelatoConditionsStandard\\n} from \\\"@gelatonetwork/core/contracts/conditions/GelatoConditionsStandard.sol\\\";\\nimport {\\n IGelatoCore\\n} from \\\"@gelatonetwork/core/contracts/gelato_core/interfaces/IGelatoCore.sol\\\";\\nimport {GelatoBytes} from \\\"../../../lib/GelatoBytes.sol\\\";\\nimport {\\n _getMakerVaultDebt,\\n _getMakerVaultCollateralBalance\\n} from \\\"../../../functions/dapps/FMaker.sol\\\";\\nimport {\\n _getFlashLoanRoute,\\n _getGasCostMakerToMaker,\\n _getRealisedDebt\\n} from \\\"../../../functions/gelato/FGelatoDebtBridge.sol\\\";\\nimport {_getGelatoProviderFees} 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 abi.encode(_vaultId, _ratioLimit);\\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) = abi.decode(\\n _conditionData,\\n (uint256, uint256)\\n );\\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 = _getMakerVaultCollateralBalance(\\n _vaultId\\n );\\n uint256 gasFeesPaidFromCol = _getGelatoProviderFees(\\n _getGasCostMakerToMaker(\\n true,\\n _getFlashLoanRoute(\\n DAI,\\n _getRealisedDebt(_getMakerVaultDebt(_vaultId))\\n )\\n )\\n );\\n if (wdiv(gasFeesPaidFromCol, wColToWithdrawFromMaker) >= _ratioLimit)\\n return \\\"DebtBridgeNotAffordable\\\";\\n return OK;\\n }\\n}\\n\",\"keccak256\":\"0xa4e4dc60909318e2eebb01fa5353a2d080877f92ecb1299ac45337edfa28444f\",\"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 {IMcdManager} from \\\"../../interfaces/dapps/Maker/IMcdManager.sol\\\";\\nimport {IVat} from \\\"../../interfaces/dapps/Maker/IVat.sol\\\";\\nimport {RAY, sub, mul} from \\\"../../vendor/DSMath.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 _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\",\"keccak256\":\"0x916f03bd9a6b88bba93ae455dfecc525f78962b8a446d3151abca20876fe354e\",\"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 return uint256(GELATO_GAS_PRICE_ORACLE.latestAnswer());\\n}\\n\\nfunction _getGelatoProviderFees(uint256 _gas) view returns (uint256) {\\n return mul(_gas, _getGelatoGasPrice());\\n}\\n\",\"keccak256\":\"0x378a768c27c9c3d867e95cb9a2cf7cb032eafcbe0e8ff1f692ca2ed546213ac3\",\"license\":\"UNLICENSED\"},\"contracts/functions/gelato/FGelatoDebtBridge.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\npragma experimental ABIEncoderV2;\\n\\nimport {add, sub, wmul, wdiv} from \\\"../../vendor/DSMath.sol\\\";\\nimport {\\n INSTA_POOL_RESOLVER,\\n ROUTE_1_TOLERANCE\\n} from \\\"../../constants/CInstaDapp.sol\\\";\\nimport {GAS_COSTS_FOR_FULL_REFINANCE} 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 = IInstaPoolResolver(\\n INSTA_POOL_RESOLVER\\n )\\n .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 _newVault\\n ? add(GAS_COSTS_FOR_FULL_REFINANCE()[_route], 0)\\n : GAS_COSTS_FOR_FULL_REFINANCE()[_route];\\n}\\n\\nfunction _getGasCostMakerToCompound(uint256 _route) pure returns (uint256) {\\n _checkRouteIndex(_route);\\n return GAS_COSTS_FOR_FULL_REFINANCE()[_route];\\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\":\"0x9b4a5396d425273e618ffdcf6b10ffa24658fff4094bba1600ec8b6056be34f4\",\"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\",\"keccak256\":\"0x16e87079710830c27477ce17aeb5baa531868c81680fdb354a72c6ba9b54c799\",\"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/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(uint x, uint y) pure returns (uint z) {\\n require((z = x + y) >= x, \\\"ds-math-add-overflow\\\");\\n}\\nfunction sub(uint x, uint y) pure returns (uint z) {\\n require((z = x - y) <= x, \\\"ds-math-sub-underflow\\\");\\n}\\nfunction mul(uint x, uint y) pure returns (uint z) {\\n require(y == 0 || (z = x * y) / y == x, \\\"ds-math-mul-overflow\\\");\\n}\\n\\nfunction min(uint x, uint y) pure returns (uint z) {\\n return x <= y ? x : y;\\n}\\nfunction max(uint x, uint y) pure returns (uint z) {\\n return x >= y ? x : y;\\n}\\nfunction imin(int x, int y) pure returns (int z) {\\n return x <= y ? x : y;\\n}\\nfunction imax(int x, int y) pure returns (int z) {\\n return x >= y ? x : y;\\n}\\n\\nuint constant WAD = 10 ** 18;\\nuint constant RAY = 10 ** 27;\\n\\n//rounds to zero if x*y < WAD / 2\\nfunction wmul(uint x, uint y) pure returns (uint z) {\\n z = add(mul(x, y), WAD / 2) / WAD;\\n}\\n//rounds to zero if x*y < WAD / 2\\nfunction rmul(uint x, uint y) pure returns (uint z) {\\n z = add(mul(x, y), RAY / 2) / RAY;\\n}\\n//rounds to zero if x*y < WAD / 2\\nfunction wdiv(uint x, uint y) pure returns (uint z) {\\n z = add(mul(x, WAD), y / 2) / y;\\n}\\n//rounds to zero if x*y < RAY / 2\\nfunction rdiv(uint x, uint y) pure returns (uint 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(uint x, uint n) pure returns (uint 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\":\"0x78264c5d3029a613d0c7a875efa73b1826a9b22b296b608f831f5e8e69359c88\",\"license\":\"AGPL-3.0-or-later\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610c94806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063a99891c514610046578063be9eea981461006f578063c39db98314610082575b600080fd5b610059610054366004610a95565b610095565b6040516100669190610b92565b60405180910390f35b61005961007d366004610b12565b6100bf565b610059610090366004610b12565b610187565b60606000806100a685870187610b12565b915091506100b482826100bf565b979650505050505050565b606060006100cc846101b3565b9050600061011061010b6001610106736b175474e89094c44da98b954eedeac495271d0f6101016100fc8b6102d4565b610539565b61054d565b610659565b6106af565b90508361011d82846106c2565b10610161576040518060400160405280601781526020017f446562744272696467654e6f744166666f726461626c6500000000000000000081525092505050610181565b604051806040016040528060028152602001614f4b60f01b815250925050505b92915050565b6060828260405160200161019c929190610c50565b604051602081830303815290604052905092915050565b600080735ef30b9986345249bc32d8928b7ee64de9435e3990506000816001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b15801561020857600080fd5b505afa15801561021c573d6000803e3d6000fd5b505050506040513d602081101561023257600080fd5b5051905060008061024384876106f3565b915091506000836001600160a01b0316632424be5c84846040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050604080518083038186803b15801561029d57600080fd5b505afa1580156102b1573d6000803e3d6000fd5b505050506040513d60408110156102c757600080fd5b5051979650505050505050565b6000735ef30b9986345249bc32d8928b7ee64de9435e3981806102f783866106f3565b915091506000836001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b15801561033657600080fd5b505afa15801561034a573d6000803e3d6000fd5b505050506040513d602081101561036057600080fd5b505160408051636cb1c69b60e11b81526004810186905290519192506000916001600160a01b0384169163d9638d369160248083019260a0929190829003018186803b1580156103af57600080fd5b505afa1580156103c3573d6000803e3d6000fd5b505050506040513d60a08110156103d957600080fd5b5060200151604080516309092f9760e21b8152600481018790526001600160a01b038681166024830152825193945060009390861692632424be5c9260448082019391829003018186803b15801561043057600080fd5b505afa158015610444573d6000803e3d6000fd5b505050506040513d604081101561045a57600080fd5b5060209081015160408051633612d9a360e11b81526001600160a01b038881166004830152915192945060009391871692636c25b34692602480840193919291829003018186803b1580156104ae57600080fd5b505afa1580156104c2573d6000803e3d6000fd5b505050506040513d60208110156104d857600080fd5b5051905060006104f16104eb84866107e8565b8361084b565b90506b033b2e3c9fd0803ce8000000810498508061051b8a6b033b2e3c9fd0803ce80000006107e8565b10610526578861052b565b886001015b9a9950505050505050505050565b600061018182670df27a2cdf44800061089b565b60006105576109f0565b604051635a860c8760e01b815273a004a5afba04b74037e9e52ba1f7eb02b5e6150990635a860c879061058e908790600401610b7e565b60806040518083038186803b1580156105a657600080fd5b505afa1580156105ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105de9190610a36565b905082816000015111156105f6576000915050610181565b828160200151111561060c576001915050610181565b8281604001511115610622576002915050610181565b8281606001511115610638576003915050610181565b60405162461bcd60e51b815260040161065090610c02565b60405180910390fd5b6000610664826108c3565b82610686576106716108e7565b826004811061067c57fe5b60200201516106a8565b6106a86106916108e7565b836004811061069c57fe5b60200201516000610921565b9392505050565b6000610181826106bd610970565b6107e8565b6000816106e46106da85670de0b6b3a76400006107e8565b6002855b04610921565b816106eb57fe5b049392505050565b600080836001600160a01b0316632c2cb9fd846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561073a57600080fd5b505afa15801561074e573d6000803e3d6000fd5b505050506040513d602081101561076457600080fd5b505160408051632726b07360e01b81526004810186905290519193506001600160a01b03861691632726b07391602480820192602092909190829003018186803b1580156107b157600080fd5b505afa1580156107c5573d6000803e3d6000fd5b505050506040513d60208110156107db57600080fd5b5051919491935090915050565b60008115806108035750508082028282828161080057fe5b04145b610181576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b80820382811115610181576040805162461bcd60e51b815260206004820152601560248201527464732d6d6174682d7375622d756e646572666c6f7760581b604482015290519081900360640190fd5b6000670de0b6b3a76400006106e46108b385856107e8565b6002670de0b6b3a76400006106de565b60048111156108e45760405162461bcd60e51b815260040161065090610ba5565b50565b6108ef610a18565b604051806080016040528062266fd88152602001622feb948152602001623c97b8815260200162424ca8815250905090565b80820182811015610181576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6164642d6f766572666c6f7760601b604482015290519081900360640190fd5b600073169e633a2d1e6c10dd91238ba11c4a708dfef37c6001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156109bf57600080fd5b505afa1580156109d3573d6000803e3d6000fd5b505050506040513d60208110156109e957600080fd5b5051905090565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b60405180608001604052806004906020820280368337509192915050565b600060808284031215610a47578081fd5b6040516080810181811067ffffffffffffffff82111715610a6457fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b60008060008060608587031215610aaa578283fd5b84359350602085013567ffffffffffffffff80821115610ac8578485fd5b818701915087601f830112610adb578485fd5b813581811115610ae9578586fd5b886020828501011115610afa578586fd5b95986020929092019750949560400135945092505050565b60008060408385031215610b24578182fd5b50508035926020909101359150565b60008151808452815b81811015610b5857602081850181015186830182015201610b3c565b81811115610b695782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6000602082526106a86020830184610b33565b6020808252603e908201527f4647656c61746f446562744272696467652e5f676574476173436f73744d616b60408201527f6572546f4d616b65723a20696e76616c696420726f75746520696e6465780000606082015260800190565b6020808252602e908201527f4647656c61746f446562744272696467652e5f676574466c6173684c6f616e5260408201526d1bdd5d194e881a5b1b1a5c5d5a5960921b606082015260800190565b91825260208201526040019056fea2646970667358221220b2a44df8e26645f08a58d07a17074b3953598961f218ad1cf9dc7432bd6475c264736f6c63430007040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063a99891c514610046578063be9eea981461006f578063c39db98314610082575b600080fd5b610059610054366004610a95565b610095565b6040516100669190610b92565b60405180910390f35b61005961007d366004610b12565b6100bf565b610059610090366004610b12565b610187565b60606000806100a685870187610b12565b915091506100b482826100bf565b979650505050505050565b606060006100cc846101b3565b9050600061011061010b6001610106736b175474e89094c44da98b954eedeac495271d0f6101016100fc8b6102d4565b610539565b61054d565b610659565b6106af565b90508361011d82846106c2565b10610161576040518060400160405280601781526020017f446562744272696467654e6f744166666f726461626c6500000000000000000081525092505050610181565b604051806040016040528060028152602001614f4b60f01b815250925050505b92915050565b6060828260405160200161019c929190610c50565b604051602081830303815290604052905092915050565b600080735ef30b9986345249bc32d8928b7ee64de9435e3990506000816001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b15801561020857600080fd5b505afa15801561021c573d6000803e3d6000fd5b505050506040513d602081101561023257600080fd5b5051905060008061024384876106f3565b915091506000836001600160a01b0316632424be5c84846040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050604080518083038186803b15801561029d57600080fd5b505afa1580156102b1573d6000803e3d6000fd5b505050506040513d60408110156102c757600080fd5b5051979650505050505050565b6000735ef30b9986345249bc32d8928b7ee64de9435e3981806102f783866106f3565b915091506000836001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b15801561033657600080fd5b505afa15801561034a573d6000803e3d6000fd5b505050506040513d602081101561036057600080fd5b505160408051636cb1c69b60e11b81526004810186905290519192506000916001600160a01b0384169163d9638d369160248083019260a0929190829003018186803b1580156103af57600080fd5b505afa1580156103c3573d6000803e3d6000fd5b505050506040513d60a08110156103d957600080fd5b5060200151604080516309092f9760e21b8152600481018790526001600160a01b038681166024830152825193945060009390861692632424be5c9260448082019391829003018186803b15801561043057600080fd5b505afa158015610444573d6000803e3d6000fd5b505050506040513d604081101561045a57600080fd5b5060209081015160408051633612d9a360e11b81526001600160a01b038881166004830152915192945060009391871692636c25b34692602480840193919291829003018186803b1580156104ae57600080fd5b505afa1580156104c2573d6000803e3d6000fd5b505050506040513d60208110156104d857600080fd5b5051905060006104f16104eb84866107e8565b8361084b565b90506b033b2e3c9fd0803ce8000000810498508061051b8a6b033b2e3c9fd0803ce80000006107e8565b10610526578861052b565b886001015b9a9950505050505050505050565b600061018182670df27a2cdf44800061089b565b60006105576109f0565b604051635a860c8760e01b815273a004a5afba04b74037e9e52ba1f7eb02b5e6150990635a860c879061058e908790600401610b7e565b60806040518083038186803b1580156105a657600080fd5b505afa1580156105ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105de9190610a36565b905082816000015111156105f6576000915050610181565b828160200151111561060c576001915050610181565b8281604001511115610622576002915050610181565b8281606001511115610638576003915050610181565b60405162461bcd60e51b815260040161065090610c02565b60405180910390fd5b6000610664826108c3565b82610686576106716108e7565b826004811061067c57fe5b60200201516106a8565b6106a86106916108e7565b836004811061069c57fe5b60200201516000610921565b9392505050565b6000610181826106bd610970565b6107e8565b6000816106e46106da85670de0b6b3a76400006107e8565b6002855b04610921565b816106eb57fe5b049392505050565b600080836001600160a01b0316632c2cb9fd846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561073a57600080fd5b505afa15801561074e573d6000803e3d6000fd5b505050506040513d602081101561076457600080fd5b505160408051632726b07360e01b81526004810186905290519193506001600160a01b03861691632726b07391602480820192602092909190829003018186803b1580156107b157600080fd5b505afa1580156107c5573d6000803e3d6000fd5b505050506040513d60208110156107db57600080fd5b5051919491935090915050565b60008115806108035750508082028282828161080057fe5b04145b610181576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b80820382811115610181576040805162461bcd60e51b815260206004820152601560248201527464732d6d6174682d7375622d756e646572666c6f7760581b604482015290519081900360640190fd5b6000670de0b6b3a76400006106e46108b385856107e8565b6002670de0b6b3a76400006106de565b60048111156108e45760405162461bcd60e51b815260040161065090610ba5565b50565b6108ef610a18565b604051806080016040528062266fd88152602001622feb948152602001623c97b8815260200162424ca8815250905090565b80820182811015610181576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6164642d6f766572666c6f7760601b604482015290519081900360640190fd5b600073169e633a2d1e6c10dd91238ba11c4a708dfef37c6001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156109bf57600080fd5b505afa1580156109d3573d6000803e3d6000fd5b505050506040513d60208110156109e957600080fd5b5051905090565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b60405180608001604052806004906020820280368337509192915050565b600060808284031215610a47578081fd5b6040516080810181811067ffffffffffffffff82111715610a6457fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b60008060008060608587031215610aaa578283fd5b84359350602085013567ffffffffffffffff80821115610ac8578485fd5b818701915087601f830112610adb578485fd5b813581811115610ae9578586fd5b886020828501011115610afa578586fd5b95986020929092019750949560400135945092505050565b60008060408385031215610b24578182fd5b50508035926020909101359150565b60008151808452815b81811015610b5857602081850181015186830182015201610b3c565b81811115610b695782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6000602082526106a86020830184610b33565b6020808252603e908201527f4647656c61746f446562744272696467652e5f676574476173436f73744d616b60408201527f6572546f4d616b65723a20696e76616c696420726f75746520696e6465780000606082015260800190565b6020808252602e908201527f4647656c61746f446562744272696467652e5f676574466c6173684c6f616e5260408201526d1bdd5d194e881a5b1b1a5c5d5a5960921b606082015260800190565b91825260208201526040019056fea2646970667358221220b2a44df8e26645f08a58d07a17074b3953598961f218ad1cf9dc7432bd6475c264736f6c63430007040033", + "devdoc": { + "author": "Gelato Team", + "kind": "dev", + "methods": { + "getConditionData(uint256,uint256)": { + "details": "Use the return for your Task's Condition.data field off-chain.WARNING _ratioLimit should be in wad standard.", + "returns": { + "_0": "The encoded payload for your Task's Condition.data field." + } + }, + "isAffordable(uint256,uint256)": { + "details": "Check if the debt refinancing action is affordable.WARNING _ratioLimit should be in wad standard.", + "params": { + "_ratioLimit": "the maximum limit define by the user up on which the debt is too expensive for him", + "_vaultId": "The id of the Maker vault" + }, + "returns": { + "_0": "OK if the Debt Bridge is affordable, otherwise some error message." + } + }, + "ok(uint256,bytes,uint256)": { + "details": "A standard interface for GelatoCore to read Conditions", + "params": { + "_conditionData": "The data you get from `getConditionData()`" + }, + "returns": { + "_0": "OK if the Condition is there, else some error message." + } + } + }, + "title": "ConditionDebtBridgeIsAffordable", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "getConditionData(uint256,uint256)": { + "notice": "Convenience function for off-chain _conditionData encoding" + }, + "isAffordable(uint256,uint256)": { + "notice": "Specific implementation of this Condition's ok function" + }, + "ok(uint256,bytes,uint256)": { + "notice": "Standard GelatoCore system function" + } + }, + "notice": "Condition checking if Debt Refinance is affordable.", + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} diff --git a/deployments/mainnet/ConditionMakerVaultUnsafe.json b/deployments/mainnet/ConditionMakerVaultUnsafe.json new file mode 100644 index 0000000..65d1648 --- /dev/null +++ b/deployments/mainnet/ConditionMakerVaultUnsafe.json @@ -0,0 +1,178 @@ +{ + "address": "0x23c3017b7ff8a244E72F148e1714ABe16991c8ca", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "_vaultId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_priceOracle", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_oraclePayload", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "_minColRatio", + "type": "uint256" + } + ], + "name": "getConditionData", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_vaultId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_priceOracle", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_oraclePayload", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "_minColRatio", + "type": "uint256" + } + ], + "name": "isVaultUnsafe", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_conditionData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "ok", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xd96f97d2320896fa55fa2333bba9e93382dbf33d7a3b957bffb0700878b3b862", + "receipt": { + "to": null, + "from": "0xe1F076849B781b1395Fd332dC1758Dbc129be6EC", + "contractAddress": "0x23c3017b7ff8a244E72F148e1714ABe16991c8ca", + "transactionIndex": 155, + "gasUsed": "713689", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xb7288219beaefcbdc9bc40e1bbd9c186c047ee24bcac4acc73c57abd3878b6b6", + "transactionHash": "0xd96f97d2320896fa55fa2333bba9e93382dbf33d7a3b957bffb0700878b3b862", + "logs": [], + "blockNumber": 11270006, + "cumulativeGasUsed": "9716065", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "89383a6e8e4256890d851f32690baa57", + "metadata": "{\"compiler\":{\"version\":\"0.7.4+commit.3f05b770\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_vaultId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_priceOracle\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_oraclePayload\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_minColRatio\",\"type\":\"uint256\"}],\"name\":\"getConditionData\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_vaultId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_priceOracle\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_oraclePayload\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_minColRatio\",\"type\":\"uint256\"}],\"name\":\"isVaultUnsafe\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_conditionData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"ok\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Gelato Team\",\"kind\":\"dev\",\"methods\":{\"getConditionData(uint256,address,bytes,uint256)\":{\"details\":\"Use the return for your Task's Condition.data field off-chain.\",\"returns\":{\"_0\":\"The encoded payload for your Task's Condition.data field.\"}},\"isVaultUnsafe(uint256,address,bytes,uint256)\":{\"details\":\"The price oracle must return a uint256 WAD (10**18) value.\",\"params\":{\"_minColRatio\":\"The minimum collateral ratio measured in the price of the collateral as specified by the _priceOracle.\",\"_oraclePayload\":\"The data for making the staticcall to the oracle's read method e.g. the selector for MakerOracle's read fn.\",\"_priceOracle\":\"The price oracle contract to supply the collateral price e.g. Maker's ETH/USD oracle for ETH collateral pricing.\",\"_vaultId\":\"The id of the Maker vault\"},\"returns\":{\"_0\":\"OK if the Maker Vault is unsafe, otherwise some error message.\"}},\"ok(uint256,bytes,uint256)\":{\"details\":\"A standard interface for GelatoCore to read Conditions\",\"params\":{\"_conditionData\":\"The data you get from `getConditionData()`\"},\"returns\":{\"_0\":\"OK if the Condition is there, else some error message.\"}}},\"title\":\"ConditionMakerVaultUnsafe\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getConditionData(uint256,address,bytes,uint256)\":{\"notice\":\"Convenience function for off-chain _conditionData encoding\"},\"isVaultUnsafe(uint256,address,bytes,uint256)\":{\"notice\":\"Specific implementation of this Condition's ok function\"},\"ok(uint256,bytes,uint256)\":{\"notice\":\"Standard GelatoCore system function\"}},\"notice\":\"Condition tracking Maker vault collateralization safety requirements.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/contracts/gelato/conditions/ConditionMakerVaultUnsafe.sol\":\"ConditionMakerVaultUnsafe\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gelatonetwork/core/contracts/conditions/GelatoConditionsStandard.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity >=0.6.10;\\n\\nimport \\\"./IGelatoCondition.sol\\\";\\n\\nabstract contract GelatoConditionsStandard is IGelatoCondition {\\n string internal constant OK = \\\"OK\\\";\\n}\\n\",\"keccak256\":\"0xa3d9ee5c4398914bbc0fe75fe54e57b73b8a4367caf9a40d9e5fd1ba9d4adb89\",\"license\":\"UNLICENSED\"},\"@gelatonetwork/core/contracts/conditions/IGelatoCondition.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity >=0.6.10;\\npragma experimental ABIEncoderV2;\\n\\n/// @title IGelatoCondition - solidity interface of GelatoConditionsStandard\\n/// @notice all the APIs of GelatoConditionsStandard\\n/// @dev all the APIs are implemented inside GelatoConditionsStandard\\ninterface IGelatoCondition {\\n\\n /// @notice GelatoCore calls this to verify securely the specified Condition securely\\n /// @dev Be careful only to encode a Task's condition.data as is and not with the\\n /// \\\"ok\\\" selector or _taskReceiptId, since those two things are handled by GelatoCore.\\n /// @param _taskReceiptId This is passed by GelatoCore so we can rely on it as a secure\\n /// source of Task identification.\\n /// @param _conditionData This is the Condition.data field developers must encode their\\n /// Condition's specific parameters in.\\n /// @param _cycleId For Tasks that are executed as part of a cycle.\\n function ok(uint256 _taskReceiptId, bytes calldata _conditionData, uint256 _cycleId)\\n external\\n view\\n returns(string memory);\\n}\",\"keccak256\":\"0xd07607af93227ec5f8c2f5401289937b98c298f0d2398c1ba7410f82a6253964\",\"license\":\"UNLICENSED\"},\"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 abi.encode(_vaultId, _priceOracle, _oraclePayload, _minColRatio);\\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, (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) = _priceOracle.staticcall(\\n _oraclePayload\\n );\\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 = IInstaMakerResolver(\\n 0x0A7008B38E7015F8C36A49eEbc32513ECA8801E5\\n )\\n .getVaultById(_vaultId);\\n\\n uint256 colRatio = wdiv(\\n wmul(vault.collateral, colPriceInWad),\\n vault.debt\\n );\\n\\n return colRatio < _minColRatio ? OK : \\\"MakerVaultNotUnsafe\\\";\\n }\\n}\\n\",\"keccak256\":\"0x3073a42d6b970bbd71299ffbac1073d2442ea1e2dd5989bc357aab9605dd4c45\",\"license\":\"UNLICENSED\"},\"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\",\"keccak256\":\"0x9f5dfebe60dbddfcd90df75a023603c5220c28c21355ef20b1e5fb15f1f4f58d\",\"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/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(uint x, uint y) pure returns (uint z) {\\n require((z = x + y) >= x, \\\"ds-math-add-overflow\\\");\\n}\\nfunction sub(uint x, uint y) pure returns (uint z) {\\n require((z = x - y) <= x, \\\"ds-math-sub-underflow\\\");\\n}\\nfunction mul(uint x, uint y) pure returns (uint z) {\\n require(y == 0 || (z = x * y) / y == x, \\\"ds-math-mul-overflow\\\");\\n}\\n\\nfunction min(uint x, uint y) pure returns (uint z) {\\n return x <= y ? x : y;\\n}\\nfunction max(uint x, uint y) pure returns (uint z) {\\n return x >= y ? x : y;\\n}\\nfunction imin(int x, int y) pure returns (int z) {\\n return x <= y ? x : y;\\n}\\nfunction imax(int x, int y) pure returns (int z) {\\n return x >= y ? x : y;\\n}\\n\\nuint constant WAD = 10 ** 18;\\nuint constant RAY = 10 ** 27;\\n\\n//rounds to zero if x*y < WAD / 2\\nfunction wmul(uint x, uint y) pure returns (uint z) {\\n z = add(mul(x, y), WAD / 2) / WAD;\\n}\\n//rounds to zero if x*y < WAD / 2\\nfunction rmul(uint x, uint y) pure returns (uint z) {\\n z = add(mul(x, y), RAY / 2) / RAY;\\n}\\n//rounds to zero if x*y < WAD / 2\\nfunction wdiv(uint x, uint y) pure returns (uint z) {\\n z = add(mul(x, WAD), y / 2) / y;\\n}\\n//rounds to zero if x*y < RAY / 2\\nfunction rdiv(uint x, uint y) pure returns (uint 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(uint x, uint n) pure returns (uint 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\":\"0x78264c5d3029a613d0c7a875efa73b1826a9b22b296b608f831f5e8e69359c88\",\"license\":\"AGPL-3.0-or-later\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610bf3806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80635d392c301461004657806377301f811461006f578063a99891c514610082575b600080fd5b6100596100543660046109df565b610095565b6040516100669190610a8d565b60405180910390f35b61005961007d36600461097d565b61024e565b6100596100903660046109f4565b610283565b606060006060856001600160a01b0316856040516100b39190610a71565b600060405180830381855afa9150503d80600081146100ee576040519150601f19603f3d011682016040523d82523d6000602084013e6100f3565b606091505b509150915081610120576101206040518060600160405280602f8152602001610b8f602f913982906102b7565b6000818060200190518101906101369190610906565b90506101406106b7565b604051634a3843bb60e11b8152730a7008b38e7015f8c36a49eebc32513eca8801e590639470877690610177908c90600401610aa7565b60006040518083038186803b15801561018f57600080fd5b505afa1580156101a3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526101cb919081019061081a565b905060006101ea6101e08360600151856105a6565b8360a001516105df565b905086811061022457604051806040016040528060138152602001724d616b65725661756c744e6f74556e7361666560681b815250610240565b604051806040016040528060028152602001614f4b60f01b8152505b9a9950505050505050505050565b60608585858585604051602001610269959493929190610ab0565b604051602081830303815290604052905095945050505050565b606060008082816102968789018961091e565b93509350935093506102aa84848484610095565b9998505050505050505050565b60208251816102c257fe5b06600414156104df57602082015162461bcd60e51b6001600160e01b03198216141561041d5760448301925081836040516020018083805190602001908083835b602083106103225780518252601f199092019160209182019101610303565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b6020831061036a5780518252601f19909201916020918201910161034b565b51815160209384036101000a60001901801990921691161790526040805192909401828103601f190183529384905262461bcd60e51b84526004840181815282516024860152825192975095508594506044909301928601915080838360005b838110156103e25781810151838201526020016103ca565b50505050905090810190601f16801561040f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b816040516020018082805190602001908083835b602083106104505780518252601f199092019160209182019101610431565b51815160001960209485036101000a0190811690199091161790526e2737a2b93937b929b2b632b1ba37b960891b9390910192835260408051601019818603018152600f85019182905262461bcd60e51b9091526013840182815281516033860152815191965094508493605301925090850190808383600083156103e25781810151838201526020016103ca565b806040516020018082805190602001908083835b602083106105125780518252601f1990920191602091820191016104f3565b51815160001960209485036101000a01908116901990911617905273556e657870656374656452657475726e6461746160601b9390910192835260408051600b19818603018152601485019182905262461bcd60e51b9091526018840182815281516038860152815191965094508493605801925090850190808383600083156103e25781810151838201526020016103ca565b6000670de0b6b3a76400006105d06105be85856105ff565b6002670de0b6b3a76400005b04610668565b816105d757fe5b049392505050565b6000816105d06105f785670de0b6b3a76400006105ff565b6002856105ca565b600081158061061a5750508082028282828161061757fe5b04145b610662576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b92915050565b80820182811015610662576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6164642d6f766572666c6f7760601b604482015290519081900360640190fd5b6040518061016001604052806000815260200160006001600160a01b03168152602001606081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b805161072e81610b76565b919050565b60008083601f840112610744578182fd5b50813567ffffffffffffffff81111561075b578182fd5b60208301915083602082850101111561077357600080fd5b9250929050565b600082601f83011261078a578081fd5b813561079d61079882610b24565b610b00565b91508082528360208285010111156107b457600080fd5b8060208401602084013760009082016020015292915050565b600082601f8301126107dd578081fd5b81516107eb61079882610b24565b915080825283602082850101111561080257600080fd5b610813816020840160208601610b46565b5092915050565b60006020828403121561082b578081fd5b815167ffffffffffffffff80821115610842578283fd5b8184019150610160808387031215610858578384fd5b61086181610b00565b90508251815261087360208401610723565b6020820152604083015182811115610889578485fd5b610895878286016107cd565b604083015250606083015160608201526080830151608082015260a083015160a082015260c083015160c082015260e083015160e0820152610100915081830151828201526101209150818301518282015261014091506108f7828401610723565b91810191909152949350505050565b600060208284031215610917578081fd5b5051919050565b60008060008060808587031215610933578283fd5b84359350602085013561094581610b76565b9250604085013567ffffffffffffffff811115610960578283fd5b61096c8782880161077a565b949793965093946060013593505050565b600080600080600060808688031215610994578081fd5b8535945060208601356109a681610b76565b9350604086013567ffffffffffffffff8111156109c1578182fd5b6109cd88828901610733565b96999598509660600135949350505050565b60008060008060808587031215610933578384fd5b60008060008060608587031215610a09578384fd5b84359350602085013567ffffffffffffffff811115610a26578384fd5b610a3287828801610733565b9598909750949560400135949350505050565b60008151808452610a5d816020860160208601610b46565b601f01601f19169290920160200192915050565b60008251610a83818460208701610b46565b9190910192915050565b600060208252610aa06020830184610a45565b9392505050565b90815260200190565b8581526001600160a01b038516602082015260806040820181905281018390526000838560a08401378060a0858401015260a0601f19601f86011683010190508260608301529695505050505050565b60405181810167ffffffffffffffff81118282101715610b1c57fe5b604052919050565b600067ffffffffffffffff821115610b3857fe5b50601f01601f191660200190565b60005b83811015610b61578181015183820152602001610b49565b83811115610b70576000848401525b50505050565b6001600160a01b0381168114610b8b57600080fd5b5056fe436f6e646974696f6e4d616b65725661756c74556e736166652e69735661756c74556e736166653a6f7261636c653aa2646970667358221220dcc80027f56c59f0c80094024259cf27fe4a8558b9e3ff95779b619eddc4e2b464736f6c63430007040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80635d392c301461004657806377301f811461006f578063a99891c514610082575b600080fd5b6100596100543660046109df565b610095565b6040516100669190610a8d565b60405180910390f35b61005961007d36600461097d565b61024e565b6100596100903660046109f4565b610283565b606060006060856001600160a01b0316856040516100b39190610a71565b600060405180830381855afa9150503d80600081146100ee576040519150601f19603f3d011682016040523d82523d6000602084013e6100f3565b606091505b509150915081610120576101206040518060600160405280602f8152602001610b8f602f913982906102b7565b6000818060200190518101906101369190610906565b90506101406106b7565b604051634a3843bb60e11b8152730a7008b38e7015f8c36a49eebc32513eca8801e590639470877690610177908c90600401610aa7565b60006040518083038186803b15801561018f57600080fd5b505afa1580156101a3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526101cb919081019061081a565b905060006101ea6101e08360600151856105a6565b8360a001516105df565b905086811061022457604051806040016040528060138152602001724d616b65725661756c744e6f74556e7361666560681b815250610240565b604051806040016040528060028152602001614f4b60f01b8152505b9a9950505050505050505050565b60608585858585604051602001610269959493929190610ab0565b604051602081830303815290604052905095945050505050565b606060008082816102968789018961091e565b93509350935093506102aa84848484610095565b9998505050505050505050565b60208251816102c257fe5b06600414156104df57602082015162461bcd60e51b6001600160e01b03198216141561041d5760448301925081836040516020018083805190602001908083835b602083106103225780518252601f199092019160209182019101610303565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b6020831061036a5780518252601f19909201916020918201910161034b565b51815160209384036101000a60001901801990921691161790526040805192909401828103601f190183529384905262461bcd60e51b84526004840181815282516024860152825192975095508594506044909301928601915080838360005b838110156103e25781810151838201526020016103ca565b50505050905090810190601f16801561040f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b816040516020018082805190602001908083835b602083106104505780518252601f199092019160209182019101610431565b51815160001960209485036101000a0190811690199091161790526e2737a2b93937b929b2b632b1ba37b960891b9390910192835260408051601019818603018152600f85019182905262461bcd60e51b9091526013840182815281516033860152815191965094508493605301925090850190808383600083156103e25781810151838201526020016103ca565b806040516020018082805190602001908083835b602083106105125780518252601f1990920191602091820191016104f3565b51815160001960209485036101000a01908116901990911617905273556e657870656374656452657475726e6461746160601b9390910192835260408051600b19818603018152601485019182905262461bcd60e51b9091526018840182815281516038860152815191965094508493605801925090850190808383600083156103e25781810151838201526020016103ca565b6000670de0b6b3a76400006105d06105be85856105ff565b6002670de0b6b3a76400005b04610668565b816105d757fe5b049392505050565b6000816105d06105f785670de0b6b3a76400006105ff565b6002856105ca565b600081158061061a5750508082028282828161061757fe5b04145b610662576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b92915050565b80820182811015610662576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6164642d6f766572666c6f7760601b604482015290519081900360640190fd5b6040518061016001604052806000815260200160006001600160a01b03168152602001606081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b805161072e81610b76565b919050565b60008083601f840112610744578182fd5b50813567ffffffffffffffff81111561075b578182fd5b60208301915083602082850101111561077357600080fd5b9250929050565b600082601f83011261078a578081fd5b813561079d61079882610b24565b610b00565b91508082528360208285010111156107b457600080fd5b8060208401602084013760009082016020015292915050565b600082601f8301126107dd578081fd5b81516107eb61079882610b24565b915080825283602082850101111561080257600080fd5b610813816020840160208601610b46565b5092915050565b60006020828403121561082b578081fd5b815167ffffffffffffffff80821115610842578283fd5b8184019150610160808387031215610858578384fd5b61086181610b00565b90508251815261087360208401610723565b6020820152604083015182811115610889578485fd5b610895878286016107cd565b604083015250606083015160608201526080830151608082015260a083015160a082015260c083015160c082015260e083015160e0820152610100915081830151828201526101209150818301518282015261014091506108f7828401610723565b91810191909152949350505050565b600060208284031215610917578081fd5b5051919050565b60008060008060808587031215610933578283fd5b84359350602085013561094581610b76565b9250604085013567ffffffffffffffff811115610960578283fd5b61096c8782880161077a565b949793965093946060013593505050565b600080600080600060808688031215610994578081fd5b8535945060208601356109a681610b76565b9350604086013567ffffffffffffffff8111156109c1578182fd5b6109cd88828901610733565b96999598509660600135949350505050565b60008060008060808587031215610933578384fd5b60008060008060608587031215610a09578384fd5b84359350602085013567ffffffffffffffff811115610a26578384fd5b610a3287828801610733565b9598909750949560400135949350505050565b60008151808452610a5d816020860160208601610b46565b601f01601f19169290920160200192915050565b60008251610a83818460208701610b46565b9190910192915050565b600060208252610aa06020830184610a45565b9392505050565b90815260200190565b8581526001600160a01b038516602082015260806040820181905281018390526000838560a08401378060a0858401015260a0601f19601f86011683010190508260608301529695505050505050565b60405181810167ffffffffffffffff81118282101715610b1c57fe5b604052919050565b600067ffffffffffffffff821115610b3857fe5b50601f01601f191660200190565b60005b83811015610b61578181015183820152602001610b49565b83811115610b70576000848401525b50505050565b6001600160a01b0381168114610b8b57600080fd5b5056fe436f6e646974696f6e4d616b65725661756c74556e736166652e69735661756c74556e736166653a6f7261636c653aa2646970667358221220dcc80027f56c59f0c80094024259cf27fe4a8558b9e3ff95779b619eddc4e2b464736f6c63430007040033", + "devdoc": { + "author": "Gelato Team", + "kind": "dev", + "methods": { + "getConditionData(uint256,address,bytes,uint256)": { + "details": "Use the return for your Task's Condition.data field off-chain.", + "returns": { + "_0": "The encoded payload for your Task's Condition.data field." + } + }, + "isVaultUnsafe(uint256,address,bytes,uint256)": { + "details": "The price oracle must return a uint256 WAD (10**18) value.", + "params": { + "_minColRatio": "The minimum collateral ratio measured in the price of the collateral as specified by the _priceOracle.", + "_oraclePayload": "The data for making the staticcall to the oracle's read method e.g. the selector for MakerOracle's read fn.", + "_priceOracle": "The price oracle contract to supply the collateral price e.g. Maker's ETH/USD oracle for ETH collateral pricing.", + "_vaultId": "The id of the Maker vault" + }, + "returns": { + "_0": "OK if the Maker Vault is unsafe, otherwise some error message." + } + }, + "ok(uint256,bytes,uint256)": { + "details": "A standard interface for GelatoCore to read Conditions", + "params": { + "_conditionData": "The data you get from `getConditionData()`" + }, + "returns": { + "_0": "OK if the Condition is there, else some error message." + } + } + }, + "title": "ConditionMakerVaultUnsafe", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "getConditionData(uint256,address,bytes,uint256)": { + "notice": "Convenience function for off-chain _conditionData encoding" + }, + "isVaultUnsafe(uint256,address,bytes,uint256)": { + "notice": "Specific implementation of this Condition's ok function" + }, + "ok(uint256,bytes,uint256)": { + "notice": "Standard GelatoCore system function" + } + }, + "notice": "Condition tracking Maker vault collateralization safety requirements.", + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} diff --git a/deployments/mainnet/ConnectGelatoDataFullRefinanceMaker.json b/deployments/mainnet/ConnectGelatoDataFullRefinanceMaker.json new file mode 100644 index 0000000..937952d --- /dev/null +++ b/deployments/mainnet/ConnectGelatoDataFullRefinanceMaker.json @@ -0,0 +1,160 @@ +{ + "address": "0x18a52a0D750df11b3B0221dEf7A047dC456883C3", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "address", + "name": "connectGelatoProviderPayment", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "connectorID", + "outputs": [ + { + "internalType": "uint256", + "name": "_type", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_vaultId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_colToken", + "type": "address" + } + ], + "name": "getDataAndCastMakerToCompound", + "outputs": [], + "stateMutability": "payable", + "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" + } + ], + "transactionHash": "0x03b5bfeb7cc4daa4caeb7fd6c8db63d261101f85dcd8176bc413ee9cde08f7f8", + "receipt": { + "to": null, + "from": "0xe1F076849B781b1395Fd332dC1758Dbc129be6EC", + "contractAddress": "0x18a52a0D750df11b3B0221dEf7A047dC456883C3", + "transactionIndex": 87, + "gasUsed": "1951563", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xd2c7cda314f7891f427f272a544d113b1dc4cb595f315ce645a40585df4fe412", + "transactionHash": "0x03b5bfeb7cc4daa4caeb7fd6c8db63d261101f85dcd8176bc413ee9cde08f7f8", + "logs": [], + "blockNumber": 11269997, + "cumulativeGasUsed": "7936577", + "status": 1, + "byzantium": true + }, + "args": ["52", "0xD6d097EbEb8ffab4C5e27e1d5306c2023752A7DC"], + "solcInputHash": "89383a6e8e4256890d851f32690baa57", + "metadata": "{\"compiler\":{\"version\":\"0.7.4+commit.3f05b770\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"connectGelatoProviderPayment\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"connectorID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_type\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_vaultId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_colToken\",\"type\":\"address\"}],\"name\":\"getDataAndCastMakerToCompound\",\"outputs\":[],\"stateMutability\":\"payable\",\"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\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"connectorID()\":{\"details\":\"Connector Details\"},\"getDataAndCastMakerToCompound(uint256,address)\":{\"details\":\"payable to be compatible in conjunction with DSA.cast payable target\",\"params\":{\"_colToken\":\"vault's col token address .\",\"_vaultId\":\"Id of the unsafe vault of the client.\"}},\"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\":{\"getDataAndCastMakerToCompound(uint256,address)\":{\"notice\":\"Entry Point for DSA.cast DebtBridge from Maker to Compound\"},\"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/ConnectGelatoDataFullRefinanceMaker.sol\":\"ConnectGelatoDataFullRefinanceMaker\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"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}\",\"keccak256\":\"0x45db50ccf92463d58cf08eb3467d40f35df0199d53460510e7dfaa35186a0c75\",\"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 = 0x07F81230d73a78f63F0c2A3403AD281b067d28F8;\\naddress constant INSTA_POOL_V2 = 0x3150e5A805577366816A1ddc7330c6Ea17070c05;\\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;\",\"keccak256\":\"0x7067dfe63e031f3455fd53d1eab37ffa075f68b24f4f929c3506407af3f85550\",\"license\":\"UNLICENSED\"},\"contracts/constants/CMaker.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\naddress constant MCD_MANAGER = 0x5ef30b9986345249bc32d8928B7ee64DE9435E39;\",\"keccak256\":\"0x033c9d09b895b11a9edba77e891a7b3dbf1f360b5a141a40eb5c634be438dddd\",\"license\":\"UNLICENSED\"},\"contracts/contracts/connectors/ConnectGelatoDataFullRefinanceMaker.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} 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 _encodePayGelatoProvider\\n} from \\\"../../functions/InstaDapp/connectors/FConnectGelatoProviderPayment.sol\\\";\\nimport {\\n _encodeDepositCompound,\\n _encodeBorrowCompound\\n} from \\\"../../functions/InstaDapp/connectors/FConnectCompound.sol\\\";\\nimport {_getGelatoProviderFees} from \\\"../../functions/gelato/FGelato.sol\\\";\\nimport {\\n _getFlashLoanRoute,\\n _getGasCostMakerToMaker,\\n _getGasCostMakerToCompound,\\n _getRealisedDebt\\n} from \\\"../../functions/gelato/FGelatoDebtBridge.sol\\\";\\n\\ncontract ConnectGelatoDataFullRefinanceMaker is ConnectorInterface {\\n using GelatoBytes for bytes;\\n\\n // solhint-disable const-name-snakecase\\n string\\n public constant\\n override name = \\\"ConnectGelatoDataFullRefinanceMaker-v1.0\\\";\\n uint256 internal immutable _id;\\n address internal immutable _connectGelatoProviderPayment;\\n\\n constructor(uint256 id, address connectGelatoProviderPayment) {\\n _id = id;\\n _connectGelatoProviderPayment = connectGelatoProviderPayment;\\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 _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) = _dataMakerToMaker(\\n _vaultAId,\\n _vaultBId,\\n _colToken,\\n _colType\\n );\\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 _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) = _dataMakerToCompound(\\n _vaultId,\\n _colToken\\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 = abi.encodeWithSelector(\\n AccountInterface.cast.selector,\\n targets,\\n datas,\\n msg.sender // msg.sender == GelatoCore\\n );\\n\\n (bool success, bytes memory returndata) = address(this).delegatecall(\\n castData\\n );\\n if (!success) {\\n returndata.revertWithError(\\n \\\"ConnectGelatoDataFullRefinanceMaker._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 uint256 wDaiToBorrow = _getRealisedDebt(_getMakerVaultDebt(_vaultAId));\\n uint256 wColToWithdrawFromMaker = _getMakerVaultCollateralBalance(\\n _vaultAId\\n );\\n uint256 route = _getFlashLoanRoute(DAI, wDaiToBorrow);\\n uint256 gasCost = _getGasCostMakerToMaker(_vaultBId == 0, route);\\n uint256 gasFeesPaidFromCol = _getGelatoProviderFees(gasCost);\\n\\n (address[] memory _targets, bytes[] memory _datas) = _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] = _connectGelatoProviderPayment; // payProvider\\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] = _encodePayGelatoProvider(\\n _colToken,\\n _gasFeesPaidFromCol,\\n 0,\\n 0\\n );\\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] = _connectGelatoProviderPayment; // payProvider\\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] = _encodePayGelatoProvider(\\n _colToken,\\n _gasFeesPaidFromCol,\\n 0,\\n 0\\n );\\n datas[5] = _encodeFlashPayback(DAI, _wDaiToBorrow, 0, 0);\\n }\\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 = _getMakerVaultCollateralBalance(\\n _vaultId\\n );\\n uint256 route = _getFlashLoanRoute(DAI, wDaiToBorrow);\\n uint256 gasCost = _getGasCostMakerToCompound(route);\\n uint256 gasFeesPaidFromCol = _getGelatoProviderFees(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] = _connectGelatoProviderPayment; // payProvider\\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] = _encodePayGelatoProvider(\\n _colToken,\\n gasFeesPaidFromCol,\\n 0,\\n 0\\n );\\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\",\"keccak256\":\"0xaf95ac8b04dcc8d98c39271d70cbe30a219fc09334741104d0fba9ccb8917506\",\"license\":\"UNLICENSED\"},\"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\",\"keccak256\":\"0xd71789a60590449043d5fe89591854f618432cc33f05bd33a357175a8f015d37\",\"license\":\"UNLICENSED\"},\"contracts/functions/InstaDapp/connectors/FConnectGelatoProviderPayment.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\nimport {\\n IConnectGelatoProviderPayment\\n} from \\\"../../../interfaces/InstaDapp/connectors/IConnectGelatoProviderPayment.sol\\\";\\n\\nfunction _encodePayGelatoProvider(\\n address _token,\\n uint256 _amt,\\n uint256 _getId,\\n uint256 _setId\\n) pure returns (bytes memory) {\\n return\\n abi.encodeWithSelector(\\n IConnectGelatoProviderPayment.payProvider.selector,\\n _token,\\n _amt,\\n _getId,\\n _setId\\n );\\n}\\n\",\"keccak256\":\"0x2839ff2319f6aae7ea923c7048f088e89f71bb13b6a523fc82870e67e22a197e\",\"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 {IMcdManager} from \\\"../../interfaces/dapps/Maker/IMcdManager.sol\\\";\\nimport {IVat} from \\\"../../interfaces/dapps/Maker/IVat.sol\\\";\\nimport {RAY, sub, mul} from \\\"../../vendor/DSMath.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 _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\",\"keccak256\":\"0x916f03bd9a6b88bba93ae455dfecc525f78962b8a446d3151abca20876fe354e\",\"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 return uint256(GELATO_GAS_PRICE_ORACLE.latestAnswer());\\n}\\n\\nfunction _getGelatoProviderFees(uint256 _gas) view returns (uint256) {\\n return mul(_gas, _getGelatoGasPrice());\\n}\\n\",\"keccak256\":\"0x378a768c27c9c3d867e95cb9a2cf7cb032eafcbe0e8ff1f692ca2ed546213ac3\",\"license\":\"UNLICENSED\"},\"contracts/functions/gelato/FGelatoDebtBridge.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\npragma experimental ABIEncoderV2;\\n\\nimport {add, sub, wmul, wdiv} from \\\"../../vendor/DSMath.sol\\\";\\nimport {\\n INSTA_POOL_RESOLVER,\\n ROUTE_1_TOLERANCE\\n} from \\\"../../constants/CInstaDapp.sol\\\";\\nimport {GAS_COSTS_FOR_FULL_REFINANCE} 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 = IInstaPoolResolver(\\n INSTA_POOL_RESOLVER\\n )\\n .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 _newVault\\n ? add(GAS_COSTS_FOR_FULL_REFINANCE()[_route], 0)\\n : GAS_COSTS_FOR_FULL_REFINANCE()[_route];\\n}\\n\\nfunction _getGasCostMakerToCompound(uint256 _route) pure returns (uint256) {\\n _checkRouteIndex(_route);\\n return GAS_COSTS_FOR_FULL_REFINANCE()[_route];\\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\":\"0x9b4a5396d425273e618ffdcf6b10ffa24658fff4094bba1600ec8b6056be34f4\",\"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\",\"keccak256\":\"0x535bfd49d6813232ed96c2b8b4dae5f0659222091d1571e09e8bcbb32bc9dd92\",\"license\":\"UNLICENSED\"},\"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\",\"keccak256\":\"0x3e2079b26d77cf6a1826636aadee94042a6bc273b7109e792880ef8c5e731cd5\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/InstaDapp/connectors/IConnectGelatoProviderPayment.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\nimport {ConnectorInterface} from \\\"../IInstaDapp.sol\\\";\\n\\ninterface IConnectGelatoProviderPayment is ConnectorInterface {\\n function setProvider(address _provider) external;\\n\\n function payProvider(\\n address _token,\\n uint256 _amt,\\n uint256 _getId,\\n uint256 _setId\\n ) external payable;\\n\\n function gelatoProvider() external view returns (address);\\n\\n // solhint-disable-next-line func-name-mixedcase\\n function GELATO_CORE() external pure returns (address);\\n}\\n\",\"keccak256\":\"0x60ecfd91c4455a509d441b0ce208da1ec0289e4f5d9acc55220b3cc17c0f0adc\",\"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\",\"keccak256\":\"0x16e87079710830c27477ce17aeb5baa531868c81680fdb354a72c6ba9b54c799\",\"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/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(uint x, uint y) pure returns (uint z) {\\n require((z = x + y) >= x, \\\"ds-math-add-overflow\\\");\\n}\\nfunction sub(uint x, uint y) pure returns (uint z) {\\n require((z = x - y) <= x, \\\"ds-math-sub-underflow\\\");\\n}\\nfunction mul(uint x, uint y) pure returns (uint z) {\\n require(y == 0 || (z = x * y) / y == x, \\\"ds-math-mul-overflow\\\");\\n}\\n\\nfunction min(uint x, uint y) pure returns (uint z) {\\n return x <= y ? x : y;\\n}\\nfunction max(uint x, uint y) pure returns (uint z) {\\n return x >= y ? x : y;\\n}\\nfunction imin(int x, int y) pure returns (int z) {\\n return x <= y ? x : y;\\n}\\nfunction imax(int x, int y) pure returns (int z) {\\n return x >= y ? x : y;\\n}\\n\\nuint constant WAD = 10 ** 18;\\nuint constant RAY = 10 ** 27;\\n\\n//rounds to zero if x*y < WAD / 2\\nfunction wmul(uint x, uint y) pure returns (uint z) {\\n z = add(mul(x, y), WAD / 2) / WAD;\\n}\\n//rounds to zero if x*y < WAD / 2\\nfunction rmul(uint x, uint y) pure returns (uint z) {\\n z = add(mul(x, y), RAY / 2) / RAY;\\n}\\n//rounds to zero if x*y < WAD / 2\\nfunction wdiv(uint x, uint y) pure returns (uint z) {\\n z = add(mul(x, WAD), y / 2) / y;\\n}\\n//rounds to zero if x*y < RAY / 2\\nfunction rdiv(uint x, uint y) pure returns (uint 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(uint x, uint n) pure returns (uint 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\":\"0x78264c5d3029a613d0c7a875efa73b1826a9b22b296b608f831f5e8e69359c88\",\"license\":\"AGPL-3.0-or-later\"}},\"version\":1}", + "bytecode": "0x60c060405234801561001057600080fd5b5060405162002306380380620023068339810160408190526100319161004c565b60809190915260601b6001600160601b03191660a052610087565b6000806040838503121561005e578182fd5b825160208401519092506001600160a01b038116811461007c578182fd5b809150509250929050565b60805160a05160601c61224e620000b8600039806105e95280610edb528061120e525080610123525061224e6000f3fe60806040526004361061003f5760003560e01c806306fdde031461004457806345c4b9b51461006f578063e588576e14610084578063eb15f78114610097575b600080fd5b34801561005057600080fd5b506100596100ba565b60405161006691906120ce565b60405180910390f35b61008261007d366004611ea7565b6100d6565b005b610082610092366004611e7c565b6100fd565b3480156100a357600080fd5b506100ac61011e565b60405161006692919061218c565b6040518060600160405280602881526020016121c76028913981565b6060806100e68787878787610145565b915091506100f48282610316565b50505050505050565b60608061010a84846103fa565b915091506101188282610316565b50505050565b6001907f000000000000000000000000000000000000000000000000000000000000000090565b60408051600180825281830190925260609182919060208083019080368337019050509150733150e5a805577366816a1ddc7330c6ea17070c058260008151811061018c57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505060006101bf6101ba8961088e565b610af3565b905060006101cc89610b0f565b905060006101ee736b175474e89094c44da98b954eedeac495271d0f84610c30565b905060006101fd8a1583610d42565b9050600061020a82610d98565b90506060808c15610228576102238e8e8e8a8a88610dab565b610237565b6102378e8d8d8d8b8b8961109b565b604080516001808252818301909252929450909250816020015b6060815260200190600190039081610251579050509750638d0a9b1b60e01b736b175474e89094c44da98b954eedeac495271d0f8887858560405160200161029a929190612062565b60408051601f19818403018152908290526102ba9493929160240161202b565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050886000815181106102fa57fe5b6020026020010181905250505050505050509550959350505050565b606063e0e90acf60e01b83833360405160240161033593929190612090565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050905060006060306001600160a01b0316836040516103869190611ffb565b600060405180830381855af49150503d80600081146103c1576040519150601f19603f3d011682016040523d82523d6000602084013e6103c6565b606091505b5091509150816103f3576103f36040518060600160405280602a81526020016121ef602a91398290611420565b5050505050565b60408051600180825281830190925260609182919060208083019080368337019050509150733150e5a805577366816a1ddc7330c6ea17070c058260008151811061044157fe5b60200260200101906001600160a01b031690816001600160a01b031681525050600061046f6101ba8661088e565b9050600061047c86610b0f565b9050600061049e736b175474e89094c44da98b954eedeac495271d0f84610c30565b905060006104ab8261170f565b905060006104b882610d98565b60408051600680825260e08201909252919250606091906020820160c08036833701905050905073ac02030d8a8f49ed04b2f52c394d3f901a10f8a98160008151811061050157fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a98160018151811061054357fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507307f81230d73a78f63f0c2a3403ad281b067d28f88160028151811061058557fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507307f81230d73a78f63f0c2a3403ad281b067d28f8816003815181106105c757fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000000000000000000000000000000000000000000008160048151811061061557fe5b60200260200101906001600160a01b031690816001600160a01b031681525050733150e5a805577366816a1ddc7330c6ea17070c058160058151811061065757fe5b6001600160a01b03929092166020928302919091019091015260408051600680825260e08201909252606091816020015b60608152602001906001900390816106885790505090506106b08b6000196000610258611738565b816000815181106106bd57fe5b60200260200101819052506106d78b60001960008061178d565b816001815181106106e457fe5b60200260200101819052506107058a6106fd88866117e2565b600080611832565b8160028151811061071257fe5b6020026020010181905250610741736b175474e89094c44da98b954eedeac495271d0f6000610258600061188f565b8160038151811061074e57fe5b60200260200101819052506107668a846000806118ec565b8160048151811061077357fe5b602002602001018190525061079f736b175474e89094c44da98b954eedeac495271d0f88600080611949565b816005815181106107ac57fe5b602090810291909101015260408051600180825281830190925290816020015b60608152602001906001900390816107cc579050509750638d0a9b1b60e01b736b175474e89094c44da98b954eedeac495271d0f88878585604051602001610815929190612062565b60408051601f19818403018152908290526108359493929160240161202b565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b0383818316178352505050508860008151811061087557fe5b6020026020010181905250505050505050509250929050565b6000735ef30b9986345249bc32d8928b7ee64de9435e3981806108b183866119a6565b915091506000836001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b1580156108f057600080fd5b505afa158015610904573d6000803e3d6000fd5b505050506040513d602081101561091a57600080fd5b505160408051636cb1c69b60e11b81526004810186905290519192506000916001600160a01b0384169163d9638d369160248083019260a0929190829003018186803b15801561096957600080fd5b505afa15801561097d573d6000803e3d6000fd5b505050506040513d60a081101561099357600080fd5b5060200151604080516309092f9760e21b8152600481018790526001600160a01b038681166024830152825193945060009390861692632424be5c9260448082019391829003018186803b1580156109ea57600080fd5b505afa1580156109fe573d6000803e3d6000fd5b505050506040513d6040811015610a1457600080fd5b5060209081015160408051633612d9a360e11b81526001600160a01b038881166004830152915192945060009391871692636c25b34692602480840193919291829003018186803b158015610a6857600080fd5b505afa158015610a7c573d6000803e3d6000fd5b505050506040513d6020811015610a9257600080fd5b505190506000610aab610aa58486611a9b565b836117e2565b90506b033b2e3c9fd0803ce80000008104985080610ad58a6b033b2e3c9fd0803ce8000000611a9b565b10610ae05788610ae5565b886001015b9a9950505050505050505050565b6000610b0782670df27a2cdf448000611afe565b90505b919050565b600080735ef30b9986345249bc32d8928b7ee64de9435e3990506000816001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b158015610b6457600080fd5b505afa158015610b78573d6000803e3d6000fd5b505050506040513d6020811015610b8e57600080fd5b50519050600080610b9f84876119a6565b915091506000836001600160a01b0316632424be5c84846040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050604080518083038186803b158015610bf957600080fd5b505afa158015610c0d573d6000803e3d6000fd5b505050506040513d6040811015610c2357600080fd5b5051979650505050505050565b6000610c3a611dc0565b604051635a860c8760e01b815273a004a5afba04b74037e9e52ba1f7eb02b5e6150990635a860c8790610c71908790600401612017565b60806040518083038186803b158015610c8957600080fd5b505afa158015610c9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc19190611e1d565b90508281600001511115610cd9576000915050610d3c565b8281602001511115610cef576001915050610d3c565b8281604001511115610d05576002915050610d3c565b8281606001511115610d1b576003915050610d3c565b60405162461bcd60e51b8152600401610d339061213e565b60405180910390fd5b92915050565b6000610d4d82611b33565b82610d6f57610d5a611b57565b8260048110610d6557fe5b6020020151610d91565b610d91610d7a611b57565b8360048110610d8557fe5b60200201516000611b91565b9392505050565b6000610b0782610da6611be0565b611a9b565b60408051600680825260e082019092526060918291906020820160c08036833701905050915073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600081518110610df357fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600181518110610e3557fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600281518110610e7757fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600381518110610eb957fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f000000000000000000000000000000000000000000000000000000000000000082600481518110610f0757fe5b60200260200101906001600160a01b031690816001600160a01b031681525050733150e5a805577366816a1ddc7330c6ea17070c0582600581518110610f4957fe5b6001600160a01b039290921660209283029190910182015260408051600680825260e082019092529182015b6060815260200190600190039081610f75579050509050610f9d886000196000610258611738565b81600081518110610faa57fe5b6020026020010181905250610fc48860001960008061178d565b81600181518110610fd157fe5b6020026020010181905250610ff287610fea86866117e2565b600080611c60565b81600281518110610fff57fe5b602002602001018190525061101a8760006102586000611cb5565b8160038151811061102757fe5b602002602001018190525061103f86846000806118ec565b8160048151811061104c57fe5b6020026020010181905250611078736b175474e89094c44da98b954eedeac495271d0f86600080611949565b8160058151811061108557fe5b6020026020010181905250965096945050505050565b60408051600780825261010082019092526060918291906020820160e08036833701905050915073ac02030d8a8f49ed04b2f52c394d3f901a10f8a9826000815181106110e457fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a98260018151811061112657fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a98260028151811061116857fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a9826003815181106111aa57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a9826004815181106111ec57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000000000000000000000000000000000000000000008260058151811061123a57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050733150e5a805577366816a1ddc7330c6ea17070c058260068151811061127c57fe5b6001600160a01b039290921660209283029190910182015260408051600780825261010082019092529182015b60608152602001906001900390816112a95790505090506112d1896000196000610258611738565b816000815181106112de57fe5b60200260200101819052506112f88960001960008061178d565b8160018151811061130557fe5b602002602001018190525061134f87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611d0a92505050565b8160028151811061135c57fe5b60200260200101819052506113766000610fea86866117e2565b8160038151811061138357fe5b602002602001018190525061139e6000806102586000611cb5565b816004815181106113ab57fe5b60200260200101819052506113c388846000806118ec565b816005815181106113d057fe5b60200260200101819052506113fc736b175474e89094c44da98b954eedeac495271d0f86600080611949565b8160068151811061140957fe5b602002602001018190525097509795505050505050565b602082518161142b57fe5b066004141561164857602082015162461bcd60e51b6001600160e01b0319821614156115865760448301925081836040516020018083805190602001908083835b6020831061148b5780518252601f19909201916020918201910161146c565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106114d35780518252601f1990920191602091820191016114b4565b51815160209384036101000a60001901801990921691161790526040805192909401828103601f190183529384905262461bcd60e51b84526004840181815282516024860152825192975095508594506044909301928601915080838360005b8381101561154b578181015183820152602001611533565b50505050905090810190601f1680156115785780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b816040516020018082805190602001908083835b602083106115b95780518252601f19909201916020918201910161159a565b51815160001960209485036101000a0190811690199091161790526e2737a2b93937b929b2b632b1ba37b960891b9390910192835260408051601019818603018152600f85019182905262461bcd60e51b90915260138401828152815160338601528151919650945084936053019250908501908083836000831561154b578181015183820152602001611533565b806040516020018082805190602001908083835b6020831061167b5780518252601f19909201916020918201910161165c565b51815160001960209485036101000a01908116901990911617905273556e657870656374656452657475726e6461746160601b9390910192835260408051600b19818603018152601485019182905262461bcd60e51b90915260188401828152815160388601528151919650945084936058019250908501908083836000831561154b578181015183820152602001611533565b600061171a82611b33565b611722611b57565b826004811061172d57fe5b602002015192915050565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316636af06d1b60e11b179052949350505050565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b03166319d3ec6d60e21b179052949350505050565b80820382811115610d3c576040805162461bcd60e51b815260206004820152601560248201527464732d6d6174682d7375622d756e646572666c6f7760581b604482015290519081900360640190fd5b604080516001600160a01b0386166024820152604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b031663ce88b43960e01b179052949350505050565b604080516001600160a01b0386166024820152604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316631c5d526160e11b179052949350505050565b604080516001600160a01b0386166024820152604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316631b5dd97960e21b179052949350505050565b604080516001600160a01b0386166024820152604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316630427301d60e31b179052949350505050565b600080836001600160a01b0316632c2cb9fd846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156119ed57600080fd5b505afa158015611a01573d6000803e3d6000fd5b505050506040513d6020811015611a1757600080fd5b505160408051632726b07360e01b81526004810186905290519193506001600160a01b03861691632726b07391602480820192602092909190829003018186803b158015611a6457600080fd5b505afa158015611a78573d6000803e3d6000fd5b505050506040513d6020811015611a8e57600080fd5b5051919491935090915050565b6000811580611ab657505080820282828281611ab357fe5b04145b610d3c576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b6000670de0b6b3a7640000611b24611b168585611a9b565b6706f05b59d3b20000611b91565b81611b2b57fe5b049392505050565b6004811115611b545760405162461bcd60e51b8152600401610d33906120e1565b50565b611b5f611de8565b604051806080016040528062266fd88152602001622feb948152602001623c97b8815260200162424ca8815250905090565b80820182811015610d3c576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6164642d6f766572666c6f7760601b604482015290519081900360640190fd5b600073169e633a2d1e6c10dd91238ba11c4a708dfef37c6001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611c2f57600080fd5b505afa158015611c43573d6000803e3d6000fd5b505050506040513d6020811015611c5957600080fd5b5051905090565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316632505c3d960e01b179052949350505050565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b031663088eca4160e11b179052949350505050565b60405160206024820181815283516044840152835160609363e4dcb06b60e01b9386939283926064019185019080838360005b83811015611d55578181015183820152602001611d3d565b50505050905090810190601f168015611d825780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990961695909517909452509192505050919050565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b60405180608001604052806004906020820280368337509192915050565b80356001600160a01b0381168114610b0a57600080fd5b600060808284031215611e2e578081fd5b6040516080810181811067ffffffffffffffff82111715611e4b57fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b60008060408385031215611e8e578081fd5b82359150611e9e60208401611e06565b90509250929050565b600080600080600060808688031215611ebe578081fd5b8535945060208601359350611ed560408701611e06565b9250606086013567ffffffffffffffff80821115611ef1578283fd5b818801915088601f830112611f04578283fd5b813581811115611f12578384fd5b896020828501011115611f23578384fd5b9699959850939650602001949392505050565b6000815180845260208085019450808401835b83811015611f6e5781516001600160a01b031687529582019590820190600101611f49565b509495945050505050565b60008282518085526020808601955080818302840101818601855b84811015611fc257601f19868403018952611fb0838351611fcf565b98840198925090830190600101611f94565b5090979650505050505050565b60008151808452611fe781602086016020860161219a565b601f01601f19169290920160200192915050565b6000825161200d81846020870161219a565b9190910192915050565b6001600160a01b0391909116815260200190565b600060018060a01b0386168252846020830152836040830152608060608301526120586080830184611fcf565b9695505050505050565b6000604082526120756040830185611f36565b82810360208401526120878185611f79565b95945050505050565b6000606082526120a36060830186611f36565b82810360208401526120b58186611f79565b91505060018060a01b0383166040830152949350505050565b600060208252610d916020830184611fcf565b6020808252603e908201527f4647656c61746f446562744272696467652e5f676574476173436f73744d616b60408201527f6572546f4d616b65723a20696e76616c696420726f75746520696e6465780000606082015260800190565b6020808252602e908201527f4647656c61746f446562744272696467652e5f676574466c6173684c6f616e5260408201526d1bdd5d194e881a5b1b1a5c5d5a5960921b606082015260800190565b918252602082015260400190565b60005b838110156121b557818101518382015260200161219d565b83811115610118575050600091015256fe436f6e6e65637447656c61746f4461746146756c6c526566696e616e63654d616b65722d76312e30436f6e6e65637447656c61746f4461746146756c6c526566696e616e63654d616b65722e5f636173743aa2646970667358221220701109eae87a6ae6c93bd1065eb1ecce8ff375fbbbd6567eda8579f25d1e9e2e64736f6c63430007040033", + "deployedBytecode": "0x60806040526004361061003f5760003560e01c806306fdde031461004457806345c4b9b51461006f578063e588576e14610084578063eb15f78114610097575b600080fd5b34801561005057600080fd5b506100596100ba565b60405161006691906120ce565b60405180910390f35b61008261007d366004611ea7565b6100d6565b005b610082610092366004611e7c565b6100fd565b3480156100a357600080fd5b506100ac61011e565b60405161006692919061218c565b6040518060600160405280602881526020016121c76028913981565b6060806100e68787878787610145565b915091506100f48282610316565b50505050505050565b60608061010a84846103fa565b915091506101188282610316565b50505050565b6001907f000000000000000000000000000000000000000000000000000000000000000090565b60408051600180825281830190925260609182919060208083019080368337019050509150733150e5a805577366816a1ddc7330c6ea17070c058260008151811061018c57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505060006101bf6101ba8961088e565b610af3565b905060006101cc89610b0f565b905060006101ee736b175474e89094c44da98b954eedeac495271d0f84610c30565b905060006101fd8a1583610d42565b9050600061020a82610d98565b90506060808c15610228576102238e8e8e8a8a88610dab565b610237565b6102378e8d8d8d8b8b8961109b565b604080516001808252818301909252929450909250816020015b6060815260200190600190039081610251579050509750638d0a9b1b60e01b736b175474e89094c44da98b954eedeac495271d0f8887858560405160200161029a929190612062565b60408051601f19818403018152908290526102ba9493929160240161202b565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050886000815181106102fa57fe5b6020026020010181905250505050505050509550959350505050565b606063e0e90acf60e01b83833360405160240161033593929190612090565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050905060006060306001600160a01b0316836040516103869190611ffb565b600060405180830381855af49150503d80600081146103c1576040519150601f19603f3d011682016040523d82523d6000602084013e6103c6565b606091505b5091509150816103f3576103f36040518060600160405280602a81526020016121ef602a91398290611420565b5050505050565b60408051600180825281830190925260609182919060208083019080368337019050509150733150e5a805577366816a1ddc7330c6ea17070c058260008151811061044157fe5b60200260200101906001600160a01b031690816001600160a01b031681525050600061046f6101ba8661088e565b9050600061047c86610b0f565b9050600061049e736b175474e89094c44da98b954eedeac495271d0f84610c30565b905060006104ab8261170f565b905060006104b882610d98565b60408051600680825260e08201909252919250606091906020820160c08036833701905050905073ac02030d8a8f49ed04b2f52c394d3f901a10f8a98160008151811061050157fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a98160018151811061054357fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507307f81230d73a78f63f0c2a3403ad281b067d28f88160028151811061058557fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507307f81230d73a78f63f0c2a3403ad281b067d28f8816003815181106105c757fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000000000000000000000000000000000000000000008160048151811061061557fe5b60200260200101906001600160a01b031690816001600160a01b031681525050733150e5a805577366816a1ddc7330c6ea17070c058160058151811061065757fe5b6001600160a01b03929092166020928302919091019091015260408051600680825260e08201909252606091816020015b60608152602001906001900390816106885790505090506106b08b6000196000610258611738565b816000815181106106bd57fe5b60200260200101819052506106d78b60001960008061178d565b816001815181106106e457fe5b60200260200101819052506107058a6106fd88866117e2565b600080611832565b8160028151811061071257fe5b6020026020010181905250610741736b175474e89094c44da98b954eedeac495271d0f6000610258600061188f565b8160038151811061074e57fe5b60200260200101819052506107668a846000806118ec565b8160048151811061077357fe5b602002602001018190525061079f736b175474e89094c44da98b954eedeac495271d0f88600080611949565b816005815181106107ac57fe5b602090810291909101015260408051600180825281830190925290816020015b60608152602001906001900390816107cc579050509750638d0a9b1b60e01b736b175474e89094c44da98b954eedeac495271d0f88878585604051602001610815929190612062565b60408051601f19818403018152908290526108359493929160240161202b565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b0383818316178352505050508860008151811061087557fe5b6020026020010181905250505050505050509250929050565b6000735ef30b9986345249bc32d8928b7ee64de9435e3981806108b183866119a6565b915091506000836001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b1580156108f057600080fd5b505afa158015610904573d6000803e3d6000fd5b505050506040513d602081101561091a57600080fd5b505160408051636cb1c69b60e11b81526004810186905290519192506000916001600160a01b0384169163d9638d369160248083019260a0929190829003018186803b15801561096957600080fd5b505afa15801561097d573d6000803e3d6000fd5b505050506040513d60a081101561099357600080fd5b5060200151604080516309092f9760e21b8152600481018790526001600160a01b038681166024830152825193945060009390861692632424be5c9260448082019391829003018186803b1580156109ea57600080fd5b505afa1580156109fe573d6000803e3d6000fd5b505050506040513d6040811015610a1457600080fd5b5060209081015160408051633612d9a360e11b81526001600160a01b038881166004830152915192945060009391871692636c25b34692602480840193919291829003018186803b158015610a6857600080fd5b505afa158015610a7c573d6000803e3d6000fd5b505050506040513d6020811015610a9257600080fd5b505190506000610aab610aa58486611a9b565b836117e2565b90506b033b2e3c9fd0803ce80000008104985080610ad58a6b033b2e3c9fd0803ce8000000611a9b565b10610ae05788610ae5565b886001015b9a9950505050505050505050565b6000610b0782670df27a2cdf448000611afe565b90505b919050565b600080735ef30b9986345249bc32d8928b7ee64de9435e3990506000816001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b158015610b6457600080fd5b505afa158015610b78573d6000803e3d6000fd5b505050506040513d6020811015610b8e57600080fd5b50519050600080610b9f84876119a6565b915091506000836001600160a01b0316632424be5c84846040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050604080518083038186803b158015610bf957600080fd5b505afa158015610c0d573d6000803e3d6000fd5b505050506040513d6040811015610c2357600080fd5b5051979650505050505050565b6000610c3a611dc0565b604051635a860c8760e01b815273a004a5afba04b74037e9e52ba1f7eb02b5e6150990635a860c8790610c71908790600401612017565b60806040518083038186803b158015610c8957600080fd5b505afa158015610c9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc19190611e1d565b90508281600001511115610cd9576000915050610d3c565b8281602001511115610cef576001915050610d3c565b8281604001511115610d05576002915050610d3c565b8281606001511115610d1b576003915050610d3c565b60405162461bcd60e51b8152600401610d339061213e565b60405180910390fd5b92915050565b6000610d4d82611b33565b82610d6f57610d5a611b57565b8260048110610d6557fe5b6020020151610d91565b610d91610d7a611b57565b8360048110610d8557fe5b60200201516000611b91565b9392505050565b6000610b0782610da6611be0565b611a9b565b60408051600680825260e082019092526060918291906020820160c08036833701905050915073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600081518110610df357fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600181518110610e3557fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600281518110610e7757fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a982600381518110610eb957fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f000000000000000000000000000000000000000000000000000000000000000082600481518110610f0757fe5b60200260200101906001600160a01b031690816001600160a01b031681525050733150e5a805577366816a1ddc7330c6ea17070c0582600581518110610f4957fe5b6001600160a01b039290921660209283029190910182015260408051600680825260e082019092529182015b6060815260200190600190039081610f75579050509050610f9d886000196000610258611738565b81600081518110610faa57fe5b6020026020010181905250610fc48860001960008061178d565b81600181518110610fd157fe5b6020026020010181905250610ff287610fea86866117e2565b600080611c60565b81600281518110610fff57fe5b602002602001018190525061101a8760006102586000611cb5565b8160038151811061102757fe5b602002602001018190525061103f86846000806118ec565b8160048151811061104c57fe5b6020026020010181905250611078736b175474e89094c44da98b954eedeac495271d0f86600080611949565b8160058151811061108557fe5b6020026020010181905250965096945050505050565b60408051600780825261010082019092526060918291906020820160e08036833701905050915073ac02030d8a8f49ed04b2f52c394d3f901a10f8a9826000815181106110e457fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a98260018151811061112657fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a98260028151811061116857fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a9826003815181106111aa57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073ac02030d8a8f49ed04b2f52c394d3f901a10f8a9826004815181106111ec57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000000000000000000000000000000000000000000008260058151811061123a57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050733150e5a805577366816a1ddc7330c6ea17070c058260068151811061127c57fe5b6001600160a01b039290921660209283029190910182015260408051600780825261010082019092529182015b60608152602001906001900390816112a95790505090506112d1896000196000610258611738565b816000815181106112de57fe5b60200260200101819052506112f88960001960008061178d565b8160018151811061130557fe5b602002602001018190525061134f87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611d0a92505050565b8160028151811061135c57fe5b60200260200101819052506113766000610fea86866117e2565b8160038151811061138357fe5b602002602001018190525061139e6000806102586000611cb5565b816004815181106113ab57fe5b60200260200101819052506113c388846000806118ec565b816005815181106113d057fe5b60200260200101819052506113fc736b175474e89094c44da98b954eedeac495271d0f86600080611949565b8160068151811061140957fe5b602002602001018190525097509795505050505050565b602082518161142b57fe5b066004141561164857602082015162461bcd60e51b6001600160e01b0319821614156115865760448301925081836040516020018083805190602001908083835b6020831061148b5780518252601f19909201916020918201910161146c565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106114d35780518252601f1990920191602091820191016114b4565b51815160209384036101000a60001901801990921691161790526040805192909401828103601f190183529384905262461bcd60e51b84526004840181815282516024860152825192975095508594506044909301928601915080838360005b8381101561154b578181015183820152602001611533565b50505050905090810190601f1680156115785780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b816040516020018082805190602001908083835b602083106115b95780518252601f19909201916020918201910161159a565b51815160001960209485036101000a0190811690199091161790526e2737a2b93937b929b2b632b1ba37b960891b9390910192835260408051601019818603018152600f85019182905262461bcd60e51b90915260138401828152815160338601528151919650945084936053019250908501908083836000831561154b578181015183820152602001611533565b806040516020018082805190602001908083835b6020831061167b5780518252601f19909201916020918201910161165c565b51815160001960209485036101000a01908116901990911617905273556e657870656374656452657475726e6461746160601b9390910192835260408051600b19818603018152601485019182905262461bcd60e51b90915260188401828152815160388601528151919650945084936058019250908501908083836000831561154b578181015183820152602001611533565b600061171a82611b33565b611722611b57565b826004811061172d57fe5b602002015192915050565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316636af06d1b60e11b179052949350505050565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b03166319d3ec6d60e21b179052949350505050565b80820382811115610d3c576040805162461bcd60e51b815260206004820152601560248201527464732d6d6174682d7375622d756e646572666c6f7760581b604482015290519081900360640190fd5b604080516001600160a01b0386166024820152604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b031663ce88b43960e01b179052949350505050565b604080516001600160a01b0386166024820152604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316631c5d526160e11b179052949350505050565b604080516001600160a01b0386166024820152604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316631b5dd97960e21b179052949350505050565b604080516001600160a01b0386166024820152604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316630427301d60e31b179052949350505050565b600080836001600160a01b0316632c2cb9fd846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156119ed57600080fd5b505afa158015611a01573d6000803e3d6000fd5b505050506040513d6020811015611a1757600080fd5b505160408051632726b07360e01b81526004810186905290519193506001600160a01b03861691632726b07391602480820192602092909190829003018186803b158015611a6457600080fd5b505afa158015611a78573d6000803e3d6000fd5b505050506040513d6020811015611a8e57600080fd5b5051919491935090915050565b6000811580611ab657505080820282828281611ab357fe5b04145b610d3c576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b6000670de0b6b3a7640000611b24611b168585611a9b565b6706f05b59d3b20000611b91565b81611b2b57fe5b049392505050565b6004811115611b545760405162461bcd60e51b8152600401610d33906120e1565b50565b611b5f611de8565b604051806080016040528062266fd88152602001622feb948152602001623c97b8815260200162424ca8815250905090565b80820182811015610d3c576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6164642d6f766572666c6f7760601b604482015290519081900360640190fd5b600073169e633a2d1e6c10dd91238ba11c4a708dfef37c6001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611c2f57600080fd5b505afa158015611c43573d6000803e3d6000fd5b505050506040513d6020811015611c5957600080fd5b5051905090565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b0316632505c3d960e01b179052949350505050565b6040805160248101869052604481018590526064810184905260848082018490528251808303909101815260a49091019091526020810180516001600160e01b031663088eca4160e11b179052949350505050565b60405160206024820181815283516044840152835160609363e4dcb06b60e01b9386939283926064019185019080838360005b83811015611d55578181015183820152602001611d3d565b50505050905090810190601f168015611d825780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990961695909517909452509192505050919050565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b60405180608001604052806004906020820280368337509192915050565b80356001600160a01b0381168114610b0a57600080fd5b600060808284031215611e2e578081fd5b6040516080810181811067ffffffffffffffff82111715611e4b57fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b60008060408385031215611e8e578081fd5b82359150611e9e60208401611e06565b90509250929050565b600080600080600060808688031215611ebe578081fd5b8535945060208601359350611ed560408701611e06565b9250606086013567ffffffffffffffff80821115611ef1578283fd5b818801915088601f830112611f04578283fd5b813581811115611f12578384fd5b896020828501011115611f23578384fd5b9699959850939650602001949392505050565b6000815180845260208085019450808401835b83811015611f6e5781516001600160a01b031687529582019590820190600101611f49565b509495945050505050565b60008282518085526020808601955080818302840101818601855b84811015611fc257601f19868403018952611fb0838351611fcf565b98840198925090830190600101611f94565b5090979650505050505050565b60008151808452611fe781602086016020860161219a565b601f01601f19169290920160200192915050565b6000825161200d81846020870161219a565b9190910192915050565b6001600160a01b0391909116815260200190565b600060018060a01b0386168252846020830152836040830152608060608301526120586080830184611fcf565b9695505050505050565b6000604082526120756040830185611f36565b82810360208401526120878185611f79565b95945050505050565b6000606082526120a36060830186611f36565b82810360208401526120b58186611f79565b91505060018060a01b0383166040830152949350505050565b600060208252610d916020830184611fcf565b6020808252603e908201527f4647656c61746f446562744272696467652e5f676574476173436f73744d616b60408201527f6572546f4d616b65723a20696e76616c696420726f75746520696e6465780000606082015260800190565b6020808252602e908201527f4647656c61746f446562744272696467652e5f676574466c6173684c6f616e5260408201526d1bdd5d194e881a5b1b1a5c5d5a5960921b606082015260800190565b918252602082015260400190565b60005b838110156121b557818101518382015260200161219d565b83811115610118575050600091015256fe436f6e6e65637447656c61746f4461746146756c6c526566696e616e63654d616b65722d76312e30436f6e6e65637447656c61746f4461746146756c6c526566696e616e63654d616b65722e5f636173743aa2646970667358221220701109eae87a6ae6c93bd1065eb1ecce8ff375fbbbd6567eda8579f25d1e9e2e64736f6c63430007040033", + "devdoc": { + "kind": "dev", + "methods": { + "connectorID()": { + "details": "Connector Details" + }, + "getDataAndCastMakerToCompound(uint256,address)": { + "details": "payable to be compatible in conjunction with DSA.cast payable target", + "params": { + "_colToken": "vault's col token address .", + "_vaultId": "Id of the unsafe vault of the client." + } + }, + "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": { + "getDataAndCastMakerToCompound(uint256,address)": { + "notice": "Entry Point for DSA.cast DebtBridge from Maker to Compound" + }, + "getDataAndCastMakerToMaker(uint256,uint256,address,string)": { + "notice": "Entry Point for DSA.cast DebtBridge from e.g ETH-A to ETH-B" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} diff --git a/deployments/mainnet/ConnectGelatoProviderPayment.json b/deployments/mainnet/ConnectGelatoProviderPayment.json new file mode 100644 index 0000000..d72da8b --- /dev/null +++ b/deployments/mainnet/ConnectGelatoProviderPayment.json @@ -0,0 +1,292 @@ +{ + "address": "0xD6d097EbEb8ffab4C5e27e1d5306c2023752A7DC", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_gelatoProvider", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "GELATO_CORE", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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": [], + "name": "gelatoProvider", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_getId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_setId", + "type": "uint256" + } + ], + "name": "payProvider", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_gelatoProvider", + "type": "address" + } + ], + "name": "setProvider", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x3a6b401c0feb163383715e5e0dd274c81ae261668507dea1666565156301f27d", + "receipt": { + "to": null, + "from": "0xe1F076849B781b1395Fd332dC1758Dbc129be6EC", + "contractAddress": "0xD6d097EbEb8ffab4C5e27e1d5306c2023752A7DC", + "transactionIndex": 114, + "gasUsed": "908271", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000001000000000002000000000000000000000000020000000000000000000800000000000000000000000000000000400000000002000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000010020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xe17811c826327d0419762129cb5fd1ecec80d150481245600d5ff8c86f7e9c0f", + "transactionHash": "0x3a6b401c0feb163383715e5e0dd274c81ae261668507dea1666565156301f27d", + "logs": [ + { + "transactionIndex": 114, + "blockNumber": 11269994, + "transactionHash": "0x3a6b401c0feb163383715e5e0dd274c81ae261668507dea1666565156301f27d", + "address": "0xD6d097EbEb8ffab4C5e27e1d5306c2023752A7DC", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000e1f076849b781b1395fd332dc1758dbc129be6ec" + ], + "data": "0x", + "logIndex": 259, + "blockHash": "0xe17811c826327d0419762129cb5fd1ecec80d150481245600d5ff8c86f7e9c0f" + } + ], + "blockNumber": 11269994, + "cumulativeGasUsed": "10297738", + "status": 1, + "byzantium": true + }, + "args": ["52", "0xe1F076849B781b1395Fd332dC1758Dbc129be6EC"], + "solcInputHash": "89383a6e8e4256890d851f32690baa57", + "metadata": "{\"compiler\":{\"version\":\"0.7.4+commit.3f05b770\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_gelatoProvider\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"GELATO_CORE\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"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\":[],\"name\":\"gelatoProvider\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isOwner\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_getId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_setId\",\"type\":\"uint256\"}],\"name\":\"payProvider\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_gelatoProvider\",\"type\":\"address\"}],\"name\":\"setProvider\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Gelato Team\",\"kind\":\"dev\",\"methods\":{\"connectorID()\":{\"details\":\"Connector Details\"},\"isOwner()\":{\"details\":\"Returns true if the caller is the current owner.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"payProvider(address,uint256,uint256,uint256)\":{\"details\":\"Gelato Provider risks: - _getId does not match actual InstaMemory gelatoProvider payment slot - _token balance not in DSA - worthless _token risk payable to be compatible in conjunction with DSA.cast payable target\",\"params\":{\"_amt\":\"The amount of _token to pay the Gelato Provider.\",\"_getId\":\"The InstaMemory slot at which the payment amount was stored.\",\"_setId\":\"The InstaMemory slot to save the gelatoProvider payout amound in.\",\"_token\":\"The token used to pay the Provider.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"ConnectGelatoProviderPayment\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"payProvider(address,uint256,uint256,uint256)\":{\"notice\":\"Transfers automation gas fees to Gelato Provider\"},\"setProvider(address)\":{\"notice\":\"Set the gelatoProvider address that will be paid for executing a task\"}},\"notice\":\"InstaDapp Connector to compensate Gelato automation-gas Providers.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/contracts/connectors/ConnectGelatoProviderPayment.sol\":\"ConnectGelatoProviderPayment\"},\"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/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\",\"keccak256\":\"0x3082500f5c4878cc773313a5cf26c9cc5eaf3c37daae68bea991fcc406eca06e\",\"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/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 = 0x07F81230d73a78f63F0c2A3403AD281b067d28F8;\\naddress constant INSTA_POOL_V2 = 0x3150e5A805577366816A1ddc7330c6Ea17070c05;\\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;\",\"keccak256\":\"0x7067dfe63e031f3455fd53d1eab37ffa075f68b24f4f929c3506407af3f85550\",\"license\":\"UNLICENSED\"},\"contracts/contracts/connectors/ConnectGelatoProviderPayment.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\nimport {\\n IConnectGelatoProviderPayment\\n} from \\\"../../interfaces/InstaDapp/connectors/IConnectGelatoProviderPayment.sol\\\";\\nimport {Ownable} from \\\"../../vendor/Ownable.sol\\\";\\nimport {Address} from \\\"../../vendor/Address.sol\\\";\\nimport {GelatoString} from \\\"../../lib/GelatoString.sol\\\";\\nimport {IERC20} from \\\"../../vendor/IERC20.sol\\\";\\nimport {SafeERC20} from \\\"../../vendor/SafeERC20.sol\\\";\\nimport {_getUint, _setUint} from \\\"../../functions/InstaDapp/FInstaDapp.sol\\\";\\nimport {ETH} from \\\"../../constants/CInstaDapp.sol\\\";\\nimport {\\n IGelatoProviders\\n} from \\\"@gelatonetwork/core/contracts/gelato_core/interfaces/IGelatoProviders.sol\\\";\\n\\n/// @title ConnectGelatoProviderPayment\\n/// @notice InstaDapp Connector to compensate Gelato automation-gas Providers.\\n/// @author Gelato Team\\ncontract ConnectGelatoProviderPayment is\\n IConnectGelatoProviderPayment,\\n Ownable\\n{\\n using Address for address payable;\\n using GelatoString for string;\\n using SafeERC20 for IERC20;\\n\\n // solhint-disable-next-line const-name-snakecase\\n string public constant override name = \\\"ConnectGelatoProviderPayment-v1.0\\\";\\n\\n address\\n public constant\\n override GELATO_CORE = 0x1d681d76ce96E4d70a88A00EBbcfc1E47808d0b8;\\n\\n address public override gelatoProvider;\\n\\n uint256 internal immutable _id;\\n address internal immutable _this;\\n\\n constructor(uint256 id, address _gelatoProvider)\\n noAddressZeroProvider(_gelatoProvider)\\n {\\n _id = id;\\n _this = address(this);\\n gelatoProvider = _gelatoProvider;\\n }\\n\\n modifier noAddressZeroProvider(address _gelatoProvider) {\\n require(\\n _gelatoProvider != address(0x0),\\n \\\"ConnectGelatoProviderPayment.noAddressZeroProvider\\\"\\n );\\n _;\\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 Set the gelatoProvider address that will be paid for executing a task\\n function setProvider(address _gelatoProvider)\\n external\\n override\\n onlyOwner\\n noAddressZeroProvider(_gelatoProvider)\\n {\\n gelatoProvider = _gelatoProvider;\\n }\\n\\n /// @notice Transfers automation gas fees to Gelato Provider\\n /// @dev Gelato Provider risks:\\n /// - _getId does not match actual InstaMemory gelatoProvider 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 Provider.\\n /// @param _amt The amount of _token to pay the Gelato Provider.\\n /// @param _getId The InstaMemory slot at which the payment amount was stored.\\n /// @param _setId The InstaMemory slot to save the gelatoProvider payout amound in.\\n function payProvider(\\n address _token,\\n uint256 _amt,\\n uint256 _getId,\\n uint256 _setId\\n ) external payable override {\\n address provider = IConnectGelatoProviderPayment(_this)\\n .gelatoProvider();\\n\\n uint256 amt = _getUint(_getId, _amt);\\n _setUint(_setId, amt);\\n\\n if (_token == ETH) {\\n // solhint-disable no-empty-blocks\\n try\\n IGelatoProviders(GELATO_CORE).provideFunds{value: amt}(provider)\\n {} catch Error(string memory error) {\\n error.revertWithInfo(\\n \\\"ConnectGelatoProviderPayment.payProvider.provideFunds:\\\"\\n );\\n } catch {\\n revert(\\n \\\"ConnectGelatoProviderPayment.payProvider.provideFunds:undefined\\\"\\n );\\n }\\n } else {\\n IERC20(_token).safeTransfer(provider, amt);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfbfe4a907addd4fd6f4144325ccbdc75bc90318e166bb987e8544cf08f563f2a\",\"license\":\"UNLICENSED\"},\"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\",\"keccak256\":\"0xcee085ce34e210267ce4dc4154d7a8b9bbed1fe898ab394b50355a33fd269fd7\",\"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\",\"keccak256\":\"0x535bfd49d6813232ed96c2b8b4dae5f0659222091d1571e09e8bcbb32bc9dd92\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/InstaDapp/connectors/IConnectGelatoProviderPayment.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\nimport {ConnectorInterface} from \\\"../IInstaDapp.sol\\\";\\n\\ninterface IConnectGelatoProviderPayment is ConnectorInterface {\\n function setProvider(address _provider) external;\\n\\n function payProvider(\\n address _token,\\n uint256 _amt,\\n uint256 _getId,\\n uint256 _setId\\n ) external payable;\\n\\n function gelatoProvider() external view returns (address);\\n\\n // solhint-disable-next-line func-name-mixedcase\\n function GELATO_CORE() external pure returns (address);\\n}\\n\",\"keccak256\":\"0x60ecfd91c4455a509d441b0ce208da1ec0289e4f5d9acc55220b3cc17c0f0adc\",\"license\":\"UNLICENSED\"},\"contracts/lib/GelatoString.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\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 returnWithInfo(string memory _error, string memory _tracingInfo)\\n internal\\n pure\\n returns (string memory)\\n {\\n return string(abi.encodePacked(_tracingInfo, _error));\\n }\\n}\\n\",\"keccak256\":\"0x0f8a26ee572de6b792f0d31c1475817e08b1e43afceb02089595d5fb5ad27e1e\",\"license\":\"UNLICENSED\"},\"contracts/vendor/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.7.4;\\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 {\\n size := extcodesize(account)\\n }\\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(\\n address(this).balance >= amount,\\n \\\"Address: insufficient balance\\\"\\n );\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(\\n success,\\n \\\"Address: unable to send value, recipient may have reverted\\\"\\n );\\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)\\n internal\\n returns (bytes memory)\\n {\\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(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) 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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return\\n functionCallWithValue(\\n target,\\n data,\\n value,\\n \\\"Address: low-level call with value failed\\\"\\n );\\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(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(\\n address(this).balance >= value,\\n \\\"Address: insufficient balance for call\\\"\\n );\\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}(\\n data\\n );\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n function _verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) 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}\",\"keccak256\":\"0x6cfa1042350479d33d4af24d835c054ba938adfcd5b929edceedf7e300f18b43\",\"license\":\"MIT\"},\"contracts/vendor/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.7.4;\\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}\",\"keccak256\":\"0x708c87ce6f1a1f9e4c9612dbec078a43192aa8eb0d9142336e03910f22dc5894\",\"license\":\"MIT\"},\"contracts/vendor/Ownable.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: MIT\\\"\\npragma solidity 0.7.4;\\n\\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 * 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 {\\n address private _owner;\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _owner = msg.sender;\\n emit OwnershipTransferred(address(0), _owner);\\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(isOwner(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns true if the caller is the current owner.\\n */\\n function isOwner() public view returns (bool) {\\n return msg.sender == _owner;\\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 _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n require(\\n newOwner != address(0),\\n \\\"Ownable: new owner is the zero address\\\"\\n );\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xfb1bcba73ac1a8923c91f09e273fc38e5725390b37ed11df01b6d4735d621001\",\"license\":\"MIT\"},\"contracts/vendor/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.7.4;\\n\\nimport {IERC20} from \\\"./IERC20.sol\\\";\\nimport {SafeMath} from \\\"./SafeMath.sol\\\";\\nimport {Address} from \\\"./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}\",\"keccak256\":\"0x77e455017c957a30738ed1333253e63f11b036d04a6346715363b5f307878262\",\"license\":\"MIT\"},\"contracts/vendor/SafeMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.7.4;\\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}\",\"keccak256\":\"0x2df10d7e2f5eeffa2d90841eef4987593c4b67a0c81bca67ec774c2683a59b43\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c060405234801561001057600080fd5b50604051610fe1380380610fe18339818101604052604081101561003357600080fd5b508051602090910151600080546001600160a01b03191633178082556040516001600160a01b039190911691907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3806001600160a01b0381166100cb5760405162461bcd60e51b8152600401808060200182810382526032815260200180610faf6032913960400191505060405180910390fd5b50608082905230606081901b60a052600180546001600160a01b0319166001600160a01b0390931692909217909155610e98610117600039806102bf5250806106285250610e986000f3fe6080604052600436106100915760003560e01c80638f32d59b116100595780638f32d59b146101b5578063bdde7cb7146101de578063cfd8d6c0146101f3578063eb15f78114610226578063f2fde38b1461025457610091565b806306fdde03146100965780631d8ca214146101205780636d7765e414610151578063715018a61461018b5780638da5cb5b146101a0575b600080fd5b3480156100a257600080fd5b506100ab610287565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100e55781810151838201526020016100cd565b50505050905090810190601f1680156101125780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561012c57600080fd5b506101356102a3565b604080516001600160a01b039092168252519081900360200190f35b6101896004803603608081101561016757600080fd5b506001600160a01b0381351690602081013590604081013590606001356102bb565b005b34801561019757600080fd5b5061018961048e565b3480156101ac57600080fd5b50610135610531565b3480156101c157600080fd5b506101ca610541565b604080519115158252519081900360200190f35b3480156101ea57600080fd5b50610135610552565b3480156101ff57600080fd5b506101896004803603602081101561021657600080fd5b50356001600160a01b0316610561565b34801561023257600080fd5b5061023b610623565b6040805192835260208301919091528051918290030190f35b34801561026057600080fd5b506101896004803603602081101561027757600080fd5b50356001600160a01b031661064a565b604051806060016040528060218152602001610de66021913981565b731d681d76ce96e4d70a88a00ebbcfc1e47808d0b881565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663bdde7cb76040518163ffffffff1660e01b815260040160206040518083038186803b15801561031657600080fd5b505afa15801561032a573d6000803e3d6000fd5b505050506040513d602081101561034057600080fd5b50519050600061035084866106af565b905061035c838261074b565b6001600160a01b03861673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561047257731d681d76ce96e4d70a88a00ebbcfc1e47808d0b86001600160a01b03166328d0cad782846040518363ffffffff1660e01b815260040180826001600160a01b031681526020019150506000604051808303818588803b1580156103e457600080fd5b505af1935050505080156103f6575060015b61046d57610402610c7f565b8061040d5750610436565b610430604051806060016040528060368152602001610d4b6036913982906107c3565b5061046d565b60405162461bcd60e51b815260040180806020018281038252603f815260200180610da7603f913960400191505060405180910390fd5b610486565b6104866001600160a01b03871683836108f2565b505050505050565b610496610541565b6104e7576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03165b90565b6000546001600160a01b0316331490565b6001546001600160a01b031681565b610569610541565b6105ba576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b806001600160a01b0381166106005760405162461bcd60e51b8152600401808060200182810382526032815260200180610e316032913960400191505060405180910390fd5b50600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001907f000000000000000000000000000000000000000000000000000000000000000090565b610652610541565b6106a3576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6106ac81610949565b50565b6000821561074257738a5419cfc711b2343c17a6abf4b2bafabb06957f6001600160a01b031663a9c70eaa846040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b15801561071157600080fd5b505af1158015610725573d6000803e3d6000fd5b505050506040513d602081101561073b57600080fd5b5051610744565b815b9392505050565b81156107bf5760408051631878f25160e21b815260048101849052602481018390529051738a5419cfc711b2343c17a6abf4b2bafabb06957f916361e3c94491604480830192600092919082900301818387803b1580156107ab57600080fd5b505af1158015610486573d6000803e3d6000fd5b5050565b80826040516020018083805190602001908083835b602083106107f75780518252601f1990920191602091820191016107d8565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b6020831061083f5780518252601f199092019160209182019101610820565b51815160209384036101000a60001901801990921691161790526040805192909401828103601f190183529384905262461bcd60e51b84526004840181815282516024860152825192975095508594506044909301928601915080838360005b838110156108b757818101518382015260200161089f565b50505050905090810190601f1680156108e45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526109449084906109e9565b505050565b6001600160a01b03811661098e5760405162461bcd60e51b8152600401808060200182810382526026815260200180610d256026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6060610a3e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610a9a9092919063ffffffff16565b80519091501561094457808060200190516020811015610a5d57600080fd5b50516109445760405162461bcd60e51b815260040180806020018281038252602a815260200180610e07602a913960400191505060405180910390fd5b6060610aa98484600085610ab1565b949350505050565b606082471015610af25760405162461bcd60e51b8152600401808060200182810382526026815260200180610d816026913960400191505060405180910390fd5b610afb85610c0d565b610b4c576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310610b8b5780518252601f199092019160209182019101610b6c565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610bed576040519150601f19603f3d011682016040523d82523d6000602084013e610bf2565b606091505b5091509150610c02828286610c13565b979650505050505050565b3b151590565b60608315610c22575081610744565b825115610c325782518084602001fd5b60405162461bcd60e51b81526020600482018181528451602484015284518593919283926044019190850190808383600083156108b757818101518382015260200161089f565b60e01c90565b600060443d1015610c8f5761053e565b600481823e6308c379a0610ca38251610c79565b14610cad5761053e565b6040513d600319016004823e80513d67ffffffffffffffff8160248401118184111715610cdd575050505061053e565b82840192508251915080821115610cf7575050505061053e565b503d83016020828401011115610d0f5750505061053e565b601f01601f191681016020016040529150509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373436f6e6e65637447656c61746f50726f76696465725061796d656e742e70617950726f76696465722e70726f7669646546756e64733a416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c436f6e6e65637447656c61746f50726f76696465725061796d656e742e70617950726f76696465722e70726f7669646546756e64733a756e646566696e6564436f6e6e65637447656c61746f50726f76696465725061796d656e742d76312e305361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564436f6e6e65637447656c61746f50726f76696465725061796d656e742e6e6f416464726573735a65726f50726f7669646572a2646970667358221220a49b6f47ded940983cc9bfadd1497ea74821dd7f5030549c121ae2bac448bbc864736f6c63430007040033436f6e6e65637447656c61746f50726f76696465725061796d656e742e6e6f416464726573735a65726f50726f7669646572", + "deployedBytecode": "0x6080604052600436106100915760003560e01c80638f32d59b116100595780638f32d59b146101b5578063bdde7cb7146101de578063cfd8d6c0146101f3578063eb15f78114610226578063f2fde38b1461025457610091565b806306fdde03146100965780631d8ca214146101205780636d7765e414610151578063715018a61461018b5780638da5cb5b146101a0575b600080fd5b3480156100a257600080fd5b506100ab610287565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100e55781810151838201526020016100cd565b50505050905090810190601f1680156101125780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561012c57600080fd5b506101356102a3565b604080516001600160a01b039092168252519081900360200190f35b6101896004803603608081101561016757600080fd5b506001600160a01b0381351690602081013590604081013590606001356102bb565b005b34801561019757600080fd5b5061018961048e565b3480156101ac57600080fd5b50610135610531565b3480156101c157600080fd5b506101ca610541565b604080519115158252519081900360200190f35b3480156101ea57600080fd5b50610135610552565b3480156101ff57600080fd5b506101896004803603602081101561021657600080fd5b50356001600160a01b0316610561565b34801561023257600080fd5b5061023b610623565b6040805192835260208301919091528051918290030190f35b34801561026057600080fd5b506101896004803603602081101561027757600080fd5b50356001600160a01b031661064a565b604051806060016040528060218152602001610de66021913981565b731d681d76ce96e4d70a88a00ebbcfc1e47808d0b881565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663bdde7cb76040518163ffffffff1660e01b815260040160206040518083038186803b15801561031657600080fd5b505afa15801561032a573d6000803e3d6000fd5b505050506040513d602081101561034057600080fd5b50519050600061035084866106af565b905061035c838261074b565b6001600160a01b03861673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561047257731d681d76ce96e4d70a88a00ebbcfc1e47808d0b86001600160a01b03166328d0cad782846040518363ffffffff1660e01b815260040180826001600160a01b031681526020019150506000604051808303818588803b1580156103e457600080fd5b505af1935050505080156103f6575060015b61046d57610402610c7f565b8061040d5750610436565b610430604051806060016040528060368152602001610d4b6036913982906107c3565b5061046d565b60405162461bcd60e51b815260040180806020018281038252603f815260200180610da7603f913960400191505060405180910390fd5b610486565b6104866001600160a01b03871683836108f2565b505050505050565b610496610541565b6104e7576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03165b90565b6000546001600160a01b0316331490565b6001546001600160a01b031681565b610569610541565b6105ba576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b806001600160a01b0381166106005760405162461bcd60e51b8152600401808060200182810382526032815260200180610e316032913960400191505060405180910390fd5b50600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001907f000000000000000000000000000000000000000000000000000000000000000090565b610652610541565b6106a3576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6106ac81610949565b50565b6000821561074257738a5419cfc711b2343c17a6abf4b2bafabb06957f6001600160a01b031663a9c70eaa846040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b15801561071157600080fd5b505af1158015610725573d6000803e3d6000fd5b505050506040513d602081101561073b57600080fd5b5051610744565b815b9392505050565b81156107bf5760408051631878f25160e21b815260048101849052602481018390529051738a5419cfc711b2343c17a6abf4b2bafabb06957f916361e3c94491604480830192600092919082900301818387803b1580156107ab57600080fd5b505af1158015610486573d6000803e3d6000fd5b5050565b80826040516020018083805190602001908083835b602083106107f75780518252601f1990920191602091820191016107d8565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b6020831061083f5780518252601f199092019160209182019101610820565b51815160209384036101000a60001901801990921691161790526040805192909401828103601f190183529384905262461bcd60e51b84526004840181815282516024860152825192975095508594506044909301928601915080838360005b838110156108b757818101518382015260200161089f565b50505050905090810190601f1680156108e45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526109449084906109e9565b505050565b6001600160a01b03811661098e5760405162461bcd60e51b8152600401808060200182810382526026815260200180610d256026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6060610a3e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610a9a9092919063ffffffff16565b80519091501561094457808060200190516020811015610a5d57600080fd5b50516109445760405162461bcd60e51b815260040180806020018281038252602a815260200180610e07602a913960400191505060405180910390fd5b6060610aa98484600085610ab1565b949350505050565b606082471015610af25760405162461bcd60e51b8152600401808060200182810382526026815260200180610d816026913960400191505060405180910390fd5b610afb85610c0d565b610b4c576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310610b8b5780518252601f199092019160209182019101610b6c565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610bed576040519150601f19603f3d011682016040523d82523d6000602084013e610bf2565b606091505b5091509150610c02828286610c13565b979650505050505050565b3b151590565b60608315610c22575081610744565b825115610c325782518084602001fd5b60405162461bcd60e51b81526020600482018181528451602484015284518593919283926044019190850190808383600083156108b757818101518382015260200161089f565b60e01c90565b600060443d1015610c8f5761053e565b600481823e6308c379a0610ca38251610c79565b14610cad5761053e565b6040513d600319016004823e80513d67ffffffffffffffff8160248401118184111715610cdd575050505061053e565b82840192508251915080821115610cf7575050505061053e565b503d83016020828401011115610d0f5750505061053e565b601f01601f191681016020016040529150509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373436f6e6e65637447656c61746f50726f76696465725061796d656e742e70617950726f76696465722e70726f7669646546756e64733a416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c436f6e6e65637447656c61746f50726f76696465725061796d656e742e70617950726f76696465722e70726f7669646546756e64733a756e646566696e6564436f6e6e65637447656c61746f50726f76696465725061796d656e742d76312e305361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564436f6e6e65637447656c61746f50726f76696465725061796d656e742e6e6f416464726573735a65726f50726f7669646572a2646970667358221220a49b6f47ded940983cc9bfadd1497ea74821dd7f5030549c121ae2bac448bbc864736f6c63430007040033", + "devdoc": { + "author": "Gelato Team", + "kind": "dev", + "methods": { + "connectorID()": { + "details": "Connector Details" + }, + "isOwner()": { + "details": "Returns true if the caller is the current owner." + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "payProvider(address,uint256,uint256,uint256)": { + "details": "Gelato Provider risks: - _getId does not match actual InstaMemory gelatoProvider payment slot - _token balance not in DSA - worthless _token risk payable to be compatible in conjunction with DSA.cast payable target", + "params": { + "_amt": "The amount of _token to pay the Gelato Provider.", + "_getId": "The InstaMemory slot at which the payment amount was stored.", + "_setId": "The InstaMemory slot to save the gelatoProvider payout amound in.", + "_token": "The token used to pay the Provider." + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "title": "ConnectGelatoProviderPayment", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "payProvider(address,uint256,uint256,uint256)": { + "notice": "Transfers automation gas fees to Gelato Provider" + }, + "setProvider(address)": { + "notice": "Set the gelatoProvider address that will be paid for executing a task" + } + }, + "notice": "InstaDapp Connector to compensate Gelato automation-gas Providers.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 5577, + "contract": "contracts/contracts/connectors/ConnectGelatoProviderPayment.sol:ConnectGelatoProviderPayment", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 2610, + "contract": "contracts/contracts/connectors/ConnectGelatoProviderPayment.sol:ConnectGelatoProviderPayment", + "label": "gelatoProvider", + "offset": 0, + "slot": "1", + "type": "t_address" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + } + } + } +} diff --git a/deployments/mainnet/MakerResolver.json b/deployments/mainnet/MakerResolver.json new file mode 100644 index 0000000..2d1cb52 --- /dev/null +++ b/deployments/mainnet/MakerResolver.json @@ -0,0 +1,84 @@ +{ + "address": "0x23736df236bec6710683fc7200c55528d09c6901", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "_vaultId", + "type": "uint256" + } + ], + "name": "getMakerVaultCollateralBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_vaultId", + "type": "uint256" + } + ], + "name": "getMakerVaultDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xe0a65f2b96c346bbb6ac9210739d32e4d076f6cf5025dbed578153d004baefbd", + "receipt": { + "to": null, + "from": "0xe1f076849b781b1395fd332dc1758dbc129be6ec", + "contractAddress": "0x23736df236bec6710683fc7200c55528d09c6901", + "transactionIndex": "0x7f", + "gasUsed": "0x530f2", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xc74243b6a135cbf27bcc2246120ea5b2d00b4ba10e13d25ec8998f16a153bcdd", + "transactionHash": "0xe0a65f2b96c346bbb6ac9210739d32e4d076f6cf5025dbed578153d004baefbd", + "logs": [], + "blockNumber": "0xabf777", + "cumulativeGasUsed": "0x725864", + "status": "0x1" + }, + "args": [], + "solcInputHash": "89383a6e8e4256890d851f32690baa57", + "metadata": "{\"compiler\":{\"version\":\"0.7.4+commit.3f05b770\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_vaultId\",\"type\":\"uint256\"}],\"name\":\"getMakerVaultCollateralBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_vaultId\",\"type\":\"uint256\"}],\"name\":\"getMakerVaultDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"getMakerVaultCollateralBalance(uint256)\":{\"details\":\"Return Collateral in wad of the vault associated to the vaultId.\"},\"getMakerVaultDebt(uint256)\":{\"details\":\"Return Debt in wad of the vault associated to the vaultId.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/contracts/resolvers/MakerResolver.sol\":\"MakerResolver\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/constants/CMaker.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\naddress constant MCD_MANAGER = 0x5ef30b9986345249bc32d8928B7ee64DE9435E39;\",\"keccak256\":\"0x033c9d09b895b11a9edba77e891a7b3dbf1f360b5a141a40eb5c634be438dddd\",\"license\":\"UNLICENSED\"},\"contracts/contracts/resolvers/MakerResolver.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\nimport {\\n _getMakerRawVaultDebt,\\n _getMakerVaultCollateralBalance\\n} from \\\"../../functions/dapps/FMaker.sol\\\";\\n\\ncontract MakerResolver {\\n /// @dev Return Debt in wad of the vault associated to the vaultId.\\n function getMakerVaultDebt(uint256 _vaultId) public view returns (uint256) {\\n return _getMakerRawVaultDebt(_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\",\"keccak256\":\"0xda66b2541205ddfb19273aab20f4b2b652f687aa6ffbb5845c17bb9e4b7100b0\",\"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 {IMcdManager} from \\\"../../interfaces/dapps/Maker/IMcdManager.sol\\\";\\nimport {IVat} from \\\"../../interfaces/dapps/Maker/IVat.sol\\\";\\nimport {RAY, sub, mul} from \\\"../../vendor/DSMath.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 _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\",\"keccak256\":\"0x916f03bd9a6b88bba93ae455dfecc525f78962b8a446d3151abca20876fe354e\",\"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\",\"keccak256\":\"0x16e87079710830c27477ce17aeb5baa531868c81680fdb354a72c6ba9b54c799\",\"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/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(uint x, uint y) pure returns (uint z) {\\n require((z = x + y) >= x, \\\"ds-math-add-overflow\\\");\\n}\\nfunction sub(uint x, uint y) pure returns (uint z) {\\n require((z = x - y) <= x, \\\"ds-math-sub-underflow\\\");\\n}\\nfunction mul(uint x, uint y) pure returns (uint z) {\\n require(y == 0 || (z = x * y) / y == x, \\\"ds-math-mul-overflow\\\");\\n}\\n\\nfunction min(uint x, uint y) pure returns (uint z) {\\n return x <= y ? x : y;\\n}\\nfunction max(uint x, uint y) pure returns (uint z) {\\n return x >= y ? x : y;\\n}\\nfunction imin(int x, int y) pure returns (int z) {\\n return x <= y ? x : y;\\n}\\nfunction imax(int x, int y) pure returns (int z) {\\n return x >= y ? x : y;\\n}\\n\\nuint constant WAD = 10 ** 18;\\nuint constant RAY = 10 ** 27;\\n\\n//rounds to zero if x*y < WAD / 2\\nfunction wmul(uint x, uint y) pure returns (uint z) {\\n z = add(mul(x, y), WAD / 2) / WAD;\\n}\\n//rounds to zero if x*y < WAD / 2\\nfunction rmul(uint x, uint y) pure returns (uint z) {\\n z = add(mul(x, y), RAY / 2) / RAY;\\n}\\n//rounds to zero if x*y < WAD / 2\\nfunction wdiv(uint x, uint y) pure returns (uint z) {\\n z = add(mul(x, WAD), y / 2) / y;\\n}\\n//rounds to zero if x*y < RAY / 2\\nfunction rdiv(uint x, uint y) pure returns (uint 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(uint x, uint n) pure returns (uint 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\":\"0x78264c5d3029a613d0c7a875efa73b1826a9b22b296b608f831f5e8e69359c88\",\"license\":\"AGPL-3.0-or-later\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610532806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063bbc76fd61461003b578063ec91325d1461006a575b600080fd5b6100586004803603602081101561005157600080fd5b5035610087565b60408051918252519081900360200190f35b6100586004803603602081101561008057600080fd5b5035610098565b6000610092826100a3565b92915050565b6000610092826101c4565b600080735ef30b9986345249bc32d8928b7ee64de9435e3990506000816001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b1580156100f857600080fd5b505afa15801561010c573d6000803e3d6000fd5b505050506040513d602081101561012257600080fd5b5051905060008061013384876103a4565b915091506000836001600160a01b0316632424be5c84846040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050604080518083038186803b15801561018d57600080fd5b505afa1580156101a1573d6000803e3d6000fd5b505050506040513d60408110156101b757600080fd5b5051979650505050505050565b6000735ef30b9986345249bc32d8928b7ee64de9435e3981806101e783866103a4565b915091506000836001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b15801561022657600080fd5b505afa15801561023a573d6000803e3d6000fd5b505050506040513d602081101561025057600080fd5b505160408051636cb1c69b60e11b81526004810186905290519192506000916001600160a01b0384169163d9638d369160248083019260a0929190829003018186803b15801561029f57600080fd5b505afa1580156102b3573d6000803e3d6000fd5b505050506040513d60a08110156102c957600080fd5b5060200151604080516309092f9760e21b8152600481018790526001600160a01b038681166024830152825193945060009390861692632424be5c9260448082019391829003018186803b15801561032057600080fd5b505afa158015610334573d6000803e3d6000fd5b505050506040513d604081101561034a57600080fd5b50602001519050600061035d8284610499565b90506b033b2e3c9fd0803ce80000008104975080610387896b033b2e3c9fd0803ce8000000610499565b106103925787610397565b876001015b9998505050505050505050565b600080836001600160a01b0316632c2cb9fd846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156103eb57600080fd5b505afa1580156103ff573d6000803e3d6000fd5b505050506040513d602081101561041557600080fd5b505160408051632726b07360e01b81526004810186905290519193506001600160a01b03861691632726b07391602480820192602092909190829003018186803b15801561046257600080fd5b505afa158015610476573d6000803e3d6000fd5b505050506040513d602081101561048c57600080fd5b5051919491935090915050565b60008115806104b4575050808202828282816104b157fe5b04145b610092576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fdfea26469706673582212209e3ad68cca2f6d8b552c8d7beb7b4bb20f6b30b70c449cbeecd749d8d946c43d64736f6c63430007040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063bbc76fd61461003b578063ec91325d1461006a575b600080fd5b6100586004803603602081101561005157600080fd5b5035610087565b60408051918252519081900360200190f35b6100586004803603602081101561008057600080fd5b5035610098565b6000610092826100a3565b92915050565b6000610092826101c4565b600080735ef30b9986345249bc32d8928b7ee64de9435e3990506000816001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b1580156100f857600080fd5b505afa15801561010c573d6000803e3d6000fd5b505050506040513d602081101561012257600080fd5b5051905060008061013384876103a4565b915091506000836001600160a01b0316632424be5c84846040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050604080518083038186803b15801561018d57600080fd5b505afa1580156101a1573d6000803e3d6000fd5b505050506040513d60408110156101b757600080fd5b5051979650505050505050565b6000735ef30b9986345249bc32d8928b7ee64de9435e3981806101e783866103a4565b915091506000836001600160a01b03166336569e776040518163ffffffff1660e01b815260040160206040518083038186803b15801561022657600080fd5b505afa15801561023a573d6000803e3d6000fd5b505050506040513d602081101561025057600080fd5b505160408051636cb1c69b60e11b81526004810186905290519192506000916001600160a01b0384169163d9638d369160248083019260a0929190829003018186803b15801561029f57600080fd5b505afa1580156102b3573d6000803e3d6000fd5b505050506040513d60a08110156102c957600080fd5b5060200151604080516309092f9760e21b8152600481018790526001600160a01b038681166024830152825193945060009390861692632424be5c9260448082019391829003018186803b15801561032057600080fd5b505afa158015610334573d6000803e3d6000fd5b505050506040513d604081101561034a57600080fd5b50602001519050600061035d8284610499565b90506b033b2e3c9fd0803ce80000008104975080610387896b033b2e3c9fd0803ce8000000610499565b106103925787610397565b876001015b9998505050505050505050565b600080836001600160a01b0316632c2cb9fd846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156103eb57600080fd5b505afa1580156103ff573d6000803e3d6000fd5b505050506040513d602081101561041557600080fd5b505160408051632726b07360e01b81526004810186905290519193506001600160a01b03861691632726b07391602480820192602092909190829003018186803b15801561046257600080fd5b505afa158015610476573d6000803e3d6000fd5b505050506040513d602081101561048c57600080fd5b5051919491935090915050565b60008115806104b4575050808202828282816104b157fe5b04145b610092576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fdfea26469706673582212209e3ad68cca2f6d8b552c8d7beb7b4bb20f6b30b70c449cbeecd749d8d946c43d64736f6c63430007040033", + "devdoc": { + "kind": "dev", + "methods": { + "getMakerVaultCollateralBalance(uint256)": { + "details": "Return Collateral in wad of the vault associated to the vaultId." + }, + "getMakerVaultDebt(uint256)": { + "details": "Return Debt in wad of the vault associated to the vaultId." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} diff --git a/deployments/mainnet/PriceOracleResolver.json b/deployments/mainnet/PriceOracleResolver.json new file mode 100644 index 0000000..74d2d3f --- /dev/null +++ b/deployments/mainnet/PriceOracleResolver.json @@ -0,0 +1,387 @@ +{ + "address": "0x3F556E831FC7463aa0b716A454139f190882D477", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_oracle", + "type": "string" + }, + { + "internalType": "address", + "name": "_oracleAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_oraclePayload", + "type": "bytes" + } + ], + "name": "addOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_tester", + "type": "address" + } + ], + "name": "getMockPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_oracle", + "type": "string" + } + ], + "name": "getPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "mockPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "name": "oracle", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "name": "oraclePayload", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_mockPrice", + "type": "uint256" + } + ], + "name": "setMockPrice", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x0b155dac1767b64526f2a4807cd43fa343d637dc9879fb1d16584440ff07856e", + "receipt": { + "to": null, + "from": "0xe1F076849B781b1395Fd332dC1758Dbc129be6EC", + "contractAddress": "0x3F556E831FC7463aa0b716A454139f190882D477", + "transactionIndex": 73, + "gasUsed": "852374", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000020000000000000000000000020000000000000000010800000000000000000000000000000000400020000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000010020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x6ddb1431c5fe095b505f074b818ad2641112835e6b46efa7c8ffa189aeef8f35", + "transactionHash": "0x0b155dac1767b64526f2a4807cd43fa343d637dc9879fb1d16584440ff07856e", + "logs": [ + { + "transactionIndex": 73, + "blockNumber": 11270012, + "transactionHash": "0x0b155dac1767b64526f2a4807cd43fa343d637dc9879fb1d16584440ff07856e", + "address": "0x3F556E831FC7463aa0b716A454139f190882D477", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000e1f076849b781b1395fd332dc1758dbc129be6ec" + ], + "data": "0x", + "logIndex": 114, + "blockHash": "0x6ddb1431c5fe095b505f074b818ad2641112835e6b46efa7c8ffa189aeef8f35" + } + ], + "blockNumber": 11270012, + "cumulativeGasUsed": "5479445", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "89383a6e8e4256890d851f32690baa57", + "metadata": "{\"compiler\":{\"version\":\"0.7.4+commit.3f05b770\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_oracle\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_oracleAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_oraclePayload\",\"type\":\"bytes\"}],\"name\":\"addOracle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tester\",\"type\":\"address\"}],\"name\":\"getMockPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_oracle\",\"type\":\"string\"}],\"name\":\"getPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isOwner\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"mockPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"name\":\"oraclePayload\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_mockPrice\",\"type\":\"uint256\"}],\"name\":\"setMockPrice\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Can be used to: - Query oracle address for Gelato Condition payloads on frontend - Test Conditions by using `getMockPrice(address _test)` as `oraclePayload`\",\"kind\":\"dev\",\"methods\":{\"addOracle(string,address,bytes)\":{\"details\":\"Only owner can call this, but existing oracle entries are immutable\",\"params\":{\"_oracle\":\"The descriptor of the oracle e.g. ETH/USD-Maker-v1\",\"_oracleAddress\":\"The address of the oracle contract\",\"_oraclePayload\":\"The payload with function selector for the oracle request.\"}},\"getMockPrice(address)\":{\"details\":\"Encode oracle=PriceOracleResolver and oraclePayload=getMockPrice(tester) to test your Conditions or Actions that make dynamic calls to price oracles.\",\"params\":{\"_tester\":\"The msg.sender during setMockPrice.\"},\"returns\":{\"_0\":\"The tester's mockPrice.\"}},\"getPrice(string)\":{\"details\":\"The oracle returndata must be formatted as a single uint256.\",\"params\":{\"_oracle\":\"The descriptor of our oracle e.g. ETH/USD-Maker-v1\"},\"returns\":{\"_0\":\"The uint256 oracle price\"}},\"isOwner()\":{\"details\":\"Returns true if the caller is the current owner.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setMockPrice(uint256)\":{\"details\":\"Your mock prices cannot be overriden by someone else.\",\"params\":{\"_mockPrice\":\"The mock data you want to test against.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"PriceOracleResolver\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"addOracle(string,address,bytes)\":{\"notice\":\"Adds a new Oracle address\"},\"getMockPrice(address)\":{\"notice\":\"Use with setMockPrice for easy testing in production.\"},\"getPrice(string)\":{\"notice\":\"A generelized getter for a price supplied by an oracle contract.\"},\"setMockPrice(uint256)\":{\"notice\":\"Function that allows easy oracle data testing in production.\"}},\"notice\":\"Contract with convenience methods to retrieve oracle addresses or to mock test.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/contracts/resolvers/PriceOracleResolver.sol\":\"PriceOracleResolver\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/contracts/resolvers/PriceOracleResolver.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\npragma experimental ABIEncoderV2;\\n\\nimport {Ownable} from \\\"../../vendor/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) = oracleAddr.staticcall(\\n oraclePayload[_oracle]\\n );\\n if (!success)\\n returndata.revertWithError(\\\"PriceOracleResolver.getPrice:\\\");\\n return abi.decode(returndata, (uint256));\\n }\\n}\\n\",\"keccak256\":\"0x2a4d5d6a985f08cf5dfcc6d62d6a7bccca444662f1c113bcfeee22da2e019d3e\",\"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/Ownable.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: MIT\\\"\\npragma solidity 0.7.4;\\n\\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 * 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 {\\n address private _owner;\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _owner = msg.sender;\\n emit OwnershipTransferred(address(0), _owner);\\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(isOwner(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns true if the caller is the current owner.\\n */\\n function isOwner() public view returns (bool) {\\n return msg.sender == _owner;\\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 _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n require(\\n newOwner != address(0),\\n \\\"Ownable: new owner is the zero address\\\"\\n );\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xfb1bcba73ac1a8923c91f09e273fc38e5725390b37ed11df01b6d4735d621001\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50600080546001600160a01b03191633178082556040516001600160a01b039190911691907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3610e07806100696000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80638f32d59b116100715780638f32d59b1461011c5780639d5f7df914610131578063b7b0045914610144578063e102c99614610164578063f2fde38b14610177578063feca9cc01461018a576100a9565b8063524f3889146100ae57806370b781e5146100d7578063715018a6146100ec5780638361d0eb146100f45780638da5cb5b14610107575b600080fd5b6100c16100bc366004610b04565b61019d565b6040516100ce9190610d72565b60405180910390f35b6100ea6100e5366004610b3f565b6102cf565b005b6100ea6103ef565b6100c1610102366004610ae3565b610492565b61010f6104ad565b6040516100ce9190610c97565b6101246104bc565b6040516100ce9190610cab565b61010f61013f366004610b04565b6104cd565b610157610152366004610b04565b6104f3565b6040516100ce9190610cb6565b6100c1610172366004610ae3565b610599565b6100ea610185366004610ae3565b6105ab565b6100ea610198366004610bdb565b610610565b6000806001836040516101b09190610c7b565b908152604051908190036020019020546001600160a01b03169050806101f15760405162461bcd60e51b81526004016101e890610d2b565b60405180910390fd5b60006060826001600160a01b031660028660405161020f9190610c7b565b90815260405190819003602001812061022791610c0b565b600060405180830381855afa9150503d8060008114610262576040519150601f19603f3d011682016040523d82523d6000602084013e610267565b606091505b5091509150816102b05760408051808201909152601d81527f50726963654f7261636c655265736f6c7665722e67657450726963653a00000060208201526102b0908290610622565b808060200190518101906102c49190610bf3565b93505050505b919050565b6102d76104bc565b610328576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60006001600160a01b03166001856040516103439190610c7b565b908152604051908190036020019020546001600160a01b0316146103795760405162461bcd60e51b81526004016101e890610ce9565b8260018560405161038a9190610c7b565b908152602001604051809103902060006101000a8154816001600160a01b0302191690836001600160a01b0316021790555081816002866040516103ce9190610c7b565b9081526040519081900360200190206103e89290916109b1565b5050505050565b6103f76104bc565b610448576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6001600160a01b031660009081526003602052604090205490565b6000546001600160a01b031690565b6000546001600160a01b0316331490565b80516020818301810180516001825292820191909301209152546001600160a01b031681565b80516020818301810180516002808352938301948301949094209390528254604080516001831615610100026000190190921693909304601f81018390048302820183019093528281529291908301828280156105915780601f1061056657610100808354040283529160200191610591565b820191906000526020600020905b81548152906001019060200180831161057457829003601f168201915b505050505081565b60036020526000908152604090205481565b6105b36104bc565b610604576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b61060d81610911565b50565b33600090815260036020526040902055565b602082518161062d57fe5b066004141561084a57602082015162461bcd60e51b6001600160e01b0319821614156107885760448301925081836040516020018083805190602001908083835b6020831061068d5780518252601f19909201916020918201910161066e565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106106d55780518252601f1990920191602091820191016106b6565b51815160209384036101000a60001901801990921691161790526040805192909401828103601f190183529384905262461bcd60e51b84526004840181815282516024860152825192975095508594506044909301928601915080838360005b8381101561074d578181015183820152602001610735565b50505050905090810190601f16801561077a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b816040516020018082805190602001908083835b602083106107bb5780518252601f19909201916020918201910161079c565b51815160001960209485036101000a0190811690199091161790526e2737a2b93937b929b2b632b1ba37b960891b9390910192835260408051601019818603018152600f85019182905262461bcd60e51b90915260138401828152815160338601528151919650945084936053019250908501908083836000831561074d578181015183820152602001610735565b806040516020018082805190602001908083835b6020831061087d5780518252601f19909201916020918201910161085e565b51815160001960209485036101000a01908116901990911617905273556e657870656374656452657475726e6461746160601b9390910192835260408051600b19818603018152601485019182905262461bcd60e51b90915260188401828152815160388601528151919650945084936058019250908501908083836000831561074d578181015183820152602001610735565b6001600160a01b0381166109565760405162461bcd60e51b8152600401808060200182810382526026815260200180610dac6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826109e75760008555610a2d565b82601f10610a005782800160ff19823516178555610a2d565b82800160010185558215610a2d579182015b82811115610a2d578235825591602001919060010190610a12565b50610a39929150610a3d565b5090565b5b80821115610a395760008155600101610a3e565b80356001600160a01b03811681146102ca57600080fd5b600082601f830112610a79578081fd5b813567ffffffffffffffff80821115610a8e57fe5b604051601f8301601f191681016020018281118282101715610aac57fe5b604052828152925082848301602001861015610ac757600080fd5b8260208601602083013760006020848301015250505092915050565b600060208284031215610af4578081fd5b610afd82610a52565b9392505050565b600060208284031215610b15578081fd5b813567ffffffffffffffff811115610b2b578182fd5b610b3784828501610a69565b949350505050565b60008060008060608587031215610b54578283fd5b843567ffffffffffffffff80821115610b6b578485fd5b610b7788838901610a69565b9550610b8560208801610a52565b94506040870135915080821115610b9a578384fd5b818701915087601f830112610bad578384fd5b813581811115610bbb578485fd5b886020828501011115610bcc578485fd5b95989497505060200194505050565b600060208284031215610bec578081fd5b5035919050565b600060208284031215610c04578081fd5b5051919050565b6000808354600180821660008114610c2a5760018114610c4157610c70565b60ff198316865260028304607f1686019350610c70565b600283048786526020808720875b83811015610c685781548a820152908501908201610c4f565b505050860193505b509195945050505050565b60008251610c8d818460208701610d7b565b9190910192915050565b6001600160a01b0391909116815260200190565b901515815260200190565b6000602082528251806020840152610cd5816040850160208701610d7b565b601f01601f19169190910160400192915050565b60208082526022908201527f50726963654f7261636c655265736f6c7665722e6164644f7261636c653a2073604082015261195d60f21b606082015260800190565b60208082526027908201527f50726963654f7261636c655265736f6c7665722e67657450726963653a206e6f604082015266206f7261636c6560c81b606082015260800190565b90815260200190565b60005b83811015610d96578181015183820152602001610d7e565b83811115610da5576000848401525b5050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a264697066735822122044828f0928a0ddb612ff8245cf2d7c295ca1751d481949b3d59ae0f3b282e0d864736f6c63430007040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80638f32d59b116100715780638f32d59b1461011c5780639d5f7df914610131578063b7b0045914610144578063e102c99614610164578063f2fde38b14610177578063feca9cc01461018a576100a9565b8063524f3889146100ae57806370b781e5146100d7578063715018a6146100ec5780638361d0eb146100f45780638da5cb5b14610107575b600080fd5b6100c16100bc366004610b04565b61019d565b6040516100ce9190610d72565b60405180910390f35b6100ea6100e5366004610b3f565b6102cf565b005b6100ea6103ef565b6100c1610102366004610ae3565b610492565b61010f6104ad565b6040516100ce9190610c97565b6101246104bc565b6040516100ce9190610cab565b61010f61013f366004610b04565b6104cd565b610157610152366004610b04565b6104f3565b6040516100ce9190610cb6565b6100c1610172366004610ae3565b610599565b6100ea610185366004610ae3565b6105ab565b6100ea610198366004610bdb565b610610565b6000806001836040516101b09190610c7b565b908152604051908190036020019020546001600160a01b03169050806101f15760405162461bcd60e51b81526004016101e890610d2b565b60405180910390fd5b60006060826001600160a01b031660028660405161020f9190610c7b565b90815260405190819003602001812061022791610c0b565b600060405180830381855afa9150503d8060008114610262576040519150601f19603f3d011682016040523d82523d6000602084013e610267565b606091505b5091509150816102b05760408051808201909152601d81527f50726963654f7261636c655265736f6c7665722e67657450726963653a00000060208201526102b0908290610622565b808060200190518101906102c49190610bf3565b93505050505b919050565b6102d76104bc565b610328576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60006001600160a01b03166001856040516103439190610c7b565b908152604051908190036020019020546001600160a01b0316146103795760405162461bcd60e51b81526004016101e890610ce9565b8260018560405161038a9190610c7b565b908152602001604051809103902060006101000a8154816001600160a01b0302191690836001600160a01b0316021790555081816002866040516103ce9190610c7b565b9081526040519081900360200190206103e89290916109b1565b5050505050565b6103f76104bc565b610448576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6001600160a01b031660009081526003602052604090205490565b6000546001600160a01b031690565b6000546001600160a01b0316331490565b80516020818301810180516001825292820191909301209152546001600160a01b031681565b80516020818301810180516002808352938301948301949094209390528254604080516001831615610100026000190190921693909304601f81018390048302820183019093528281529291908301828280156105915780601f1061056657610100808354040283529160200191610591565b820191906000526020600020905b81548152906001019060200180831161057457829003601f168201915b505050505081565b60036020526000908152604090205481565b6105b36104bc565b610604576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b61060d81610911565b50565b33600090815260036020526040902055565b602082518161062d57fe5b066004141561084a57602082015162461bcd60e51b6001600160e01b0319821614156107885760448301925081836040516020018083805190602001908083835b6020831061068d5780518252601f19909201916020918201910161066e565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106106d55780518252601f1990920191602091820191016106b6565b51815160209384036101000a60001901801990921691161790526040805192909401828103601f190183529384905262461bcd60e51b84526004840181815282516024860152825192975095508594506044909301928601915080838360005b8381101561074d578181015183820152602001610735565b50505050905090810190601f16801561077a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b816040516020018082805190602001908083835b602083106107bb5780518252601f19909201916020918201910161079c565b51815160001960209485036101000a0190811690199091161790526e2737a2b93937b929b2b632b1ba37b960891b9390910192835260408051601019818603018152600f85019182905262461bcd60e51b90915260138401828152815160338601528151919650945084936053019250908501908083836000831561074d578181015183820152602001610735565b806040516020018082805190602001908083835b6020831061087d5780518252601f19909201916020918201910161085e565b51815160001960209485036101000a01908116901990911617905273556e657870656374656452657475726e6461746160601b9390910192835260408051600b19818603018152601485019182905262461bcd60e51b90915260188401828152815160388601528151919650945084936058019250908501908083836000831561074d578181015183820152602001610735565b6001600160a01b0381166109565760405162461bcd60e51b8152600401808060200182810382526026815260200180610dac6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826109e75760008555610a2d565b82601f10610a005782800160ff19823516178555610a2d565b82800160010185558215610a2d579182015b82811115610a2d578235825591602001919060010190610a12565b50610a39929150610a3d565b5090565b5b80821115610a395760008155600101610a3e565b80356001600160a01b03811681146102ca57600080fd5b600082601f830112610a79578081fd5b813567ffffffffffffffff80821115610a8e57fe5b604051601f8301601f191681016020018281118282101715610aac57fe5b604052828152925082848301602001861015610ac757600080fd5b8260208601602083013760006020848301015250505092915050565b600060208284031215610af4578081fd5b610afd82610a52565b9392505050565b600060208284031215610b15578081fd5b813567ffffffffffffffff811115610b2b578182fd5b610b3784828501610a69565b949350505050565b60008060008060608587031215610b54578283fd5b843567ffffffffffffffff80821115610b6b578485fd5b610b7788838901610a69565b9550610b8560208801610a52565b94506040870135915080821115610b9a578384fd5b818701915087601f830112610bad578384fd5b813581811115610bbb578485fd5b886020828501011115610bcc578485fd5b95989497505060200194505050565b600060208284031215610bec578081fd5b5035919050565b600060208284031215610c04578081fd5b5051919050565b6000808354600180821660008114610c2a5760018114610c4157610c70565b60ff198316865260028304607f1686019350610c70565b600283048786526020808720875b83811015610c685781548a820152908501908201610c4f565b505050860193505b509195945050505050565b60008251610c8d818460208701610d7b565b9190910192915050565b6001600160a01b0391909116815260200190565b901515815260200190565b6000602082528251806020840152610cd5816040850160208701610d7b565b601f01601f19169190910160400192915050565b60208082526022908201527f50726963654f7261636c655265736f6c7665722e6164644f7261636c653a2073604082015261195d60f21b606082015260800190565b60208082526027908201527f50726963654f7261636c655265736f6c7665722e67657450726963653a206e6f604082015266206f7261636c6560c81b606082015260800190565b90815260200190565b60005b83811015610d96578181015183820152602001610d7e565b83811115610da5576000848401525b5050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a264697066735822122044828f0928a0ddb612ff8245cf2d7c295ca1751d481949b3d59ae0f3b282e0d864736f6c63430007040033", + "devdoc": { + "details": "Can be used to: - Query oracle address for Gelato Condition payloads on frontend - Test Conditions by using `getMockPrice(address _test)` as `oraclePayload`", + "kind": "dev", + "methods": { + "addOracle(string,address,bytes)": { + "details": "Only owner can call this, but existing oracle entries are immutable", + "params": { + "_oracle": "The descriptor of the oracle e.g. ETH/USD-Maker-v1", + "_oracleAddress": "The address of the oracle contract", + "_oraclePayload": "The payload with function selector for the oracle request." + } + }, + "getMockPrice(address)": { + "details": "Encode oracle=PriceOracleResolver and oraclePayload=getMockPrice(tester) to test your Conditions or Actions that make dynamic calls to price oracles.", + "params": { + "_tester": "The msg.sender during setMockPrice." + }, + "returns": { + "_0": "The tester's mockPrice." + } + }, + "getPrice(string)": { + "details": "The oracle returndata must be formatted as a single uint256.", + "params": { + "_oracle": "The descriptor of our oracle e.g. ETH/USD-Maker-v1" + }, + "returns": { + "_0": "The uint256 oracle price" + } + }, + "isOwner()": { + "details": "Returns true if the caller is the current owner." + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "setMockPrice(uint256)": { + "details": "Your mock prices cannot be overriden by someone else.", + "params": { + "_mockPrice": "The mock data you want to test against." + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "title": "PriceOracleResolver", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "addOracle(string,address,bytes)": { + "notice": "Adds a new Oracle address" + }, + "getMockPrice(address)": { + "notice": "Use with setMockPrice for easy testing in production." + }, + "getPrice(string)": { + "notice": "A generelized getter for a price supplied by an oracle contract." + }, + "setMockPrice(uint256)": { + "notice": "Function that allows easy oracle data testing in production." + } + }, + "notice": "Contract with convenience methods to retrieve oracle addresses or to mock test.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 5577, + "contract": "contracts/contracts/resolvers/PriceOracleResolver.sol:PriceOracleResolver", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 3460, + "contract": "contracts/contracts/resolvers/PriceOracleResolver.sol:PriceOracleResolver", + "label": "oracle", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_string_memory_ptr,t_address)" + }, + { + "astId": 3464, + "contract": "contracts/contracts/resolvers/PriceOracleResolver.sol:PriceOracleResolver", + "label": "oraclePayload", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_string_memory_ptr,t_bytes_storage)" + }, + { + "astId": 3468, + "contract": "contracts/contracts/resolvers/PriceOracleResolver.sol:PriceOracleResolver", + "label": "mockPrice", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_address,t_uint256)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_string_memory_ptr,t_address)": { + "encoding": "mapping", + "key": "t_string_memory_ptr", + "label": "mapping(string => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_string_memory_ptr,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_string_memory_ptr", + "label": "mapping(string => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_string_memory_ptr": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/deployments/mainnet/solcInputs/89383a6e8e4256890d851f32690baa57.json b/deployments/mainnet/solcInputs/89383a6e8e4256890d851f32690baa57.json new file mode 100644 index 0000000..689db76 --- /dev/null +++ b/deployments/mainnet/solcInputs/89383a6e8e4256890d851f32690baa57.json @@ -0,0 +1,174 @@ +{ + "language": "Solidity", + "sources": { + "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}" + }, + "contracts/functions/gelato/FGelatoDebtBridge.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\npragma experimental ABIEncoderV2;\n\nimport {add, sub, wmul, wdiv} from \"../../vendor/DSMath.sol\";\nimport {\n INSTA_POOL_RESOLVER,\n ROUTE_1_TOLERANCE\n} from \"../../constants/CInstaDapp.sol\";\nimport {GAS_COSTS_FOR_FULL_REFINANCE} 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 = IInstaPoolResolver(\n INSTA_POOL_RESOLVER\n )\n .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 _newVault\n ? add(GAS_COSTS_FOR_FULL_REFINANCE()[_route], 0)\n : GAS_COSTS_FOR_FULL_REFINANCE()[_route];\n}\n\nfunction _getGasCostMakerToCompound(uint256 _route) pure returns (uint256) {\n _checkRouteIndex(_route);\n return GAS_COSTS_FOR_FULL_REFINANCE()[_route];\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/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(uint x, uint y) pure returns (uint z) {\n require((z = x + y) >= x, \"ds-math-add-overflow\");\n}\nfunction sub(uint x, uint y) pure returns (uint z) {\n require((z = x - y) <= x, \"ds-math-sub-underflow\");\n}\nfunction mul(uint x, uint y) pure returns (uint z) {\n require(y == 0 || (z = x * y) / y == x, \"ds-math-mul-overflow\");\n}\n\nfunction min(uint x, uint y) pure returns (uint z) {\n return x <= y ? x : y;\n}\nfunction max(uint x, uint y) pure returns (uint z) {\n return x >= y ? x : y;\n}\nfunction imin(int x, int y) pure returns (int z) {\n return x <= y ? x : y;\n}\nfunction imax(int x, int y) pure returns (int z) {\n return x >= y ? x : y;\n}\n\nuint constant WAD = 10 ** 18;\nuint constant RAY = 10 ** 27;\n\n//rounds to zero if x*y < WAD / 2\nfunction wmul(uint x, uint y) pure returns (uint z) {\n z = add(mul(x, y), WAD / 2) / WAD;\n}\n//rounds to zero if x*y < WAD / 2\nfunction rmul(uint x, uint y) pure returns (uint z) {\n z = add(mul(x, y), RAY / 2) / RAY;\n}\n//rounds to zero if x*y < WAD / 2\nfunction wdiv(uint x, uint y) pure returns (uint z) {\n z = add(mul(x, WAD), y / 2) / y;\n}\n//rounds to zero if x*y < RAY / 2\nfunction rdiv(uint x, uint y) pure returns (uint 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(uint x, uint n) pure returns (uint 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/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 = 0x07F81230d73a78f63F0c2A3403AD281b067d28F8;\naddress constant INSTA_POOL_V2 = 0x3150e5A805577366816A1ddc7330c6Ea17070c05;\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;" + }, + "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/contracts/mocks/FGelatoDebtBridgeMock.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" + }, + "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 {_getGelatoProviderFees} 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 abi.encode(_vaultId, _ratioLimit);\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) = abi.decode(\n _conditionData,\n (uint256, uint256)\n );\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 = _getMakerVaultCollateralBalance(\n _vaultId\n );\n uint256 gasFeesPaidFromCol = _getGelatoProviderFees(\n _getGasCostMakerToMaker(\n true,\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" + }, + "@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" + }, + "@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" + }, + "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/functions/dapps/FMaker.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\n\nimport {MCD_MANAGER} from \"../../constants/CMaker.sol\";\nimport {IMcdManager} from \"../../interfaces/dapps/Maker/IMcdManager.sol\";\nimport {IVat} from \"../../interfaces/dapps/Maker/IVat.sol\";\nimport {RAY, sub, mul} from \"../../vendor/DSMath.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 _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" + }, + "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 return uint256(GELATO_GAS_PRICE_ORACLE.latestAnswer());\n}\n\nfunction _getGelatoProviderFees(uint256 _gas) view returns (uint256) {\n return mul(_gas, _getGelatoGasPrice());\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/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" + }, + "contracts/constants/CMaker.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\n\naddress constant MCD_MANAGER = 0x5ef30b9986345249bc32d8928B7ee64DE9435E39;" + }, + "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" + }, + "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/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/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 abi.encode(_vaultId, _priceOracle, _oraclePayload, _minColRatio);\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, (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) = _priceOracle.staticcall(\n _oraclePayload\n );\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 = IInstaMakerResolver(\n 0x0A7008B38E7015F8C36A49eEbc32513ECA8801E5\n )\n .getVaultById(_vaultId);\n\n uint256 colRatio = wdiv(\n wmul(vault.collateral, colPriceInWad),\n vault.debt\n );\n\n return colRatio < _minColRatio ? OK : \"MakerVaultNotUnsafe\";\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 \"../../vendor/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) = oracleAddr.staticcall(\n oraclePayload[_oracle]\n );\n if (!success)\n returndata.revertWithError(\"PriceOracleResolver.getPrice:\");\n return abi.decode(returndata, (uint256));\n }\n}\n" + }, + "contracts/vendor/Ownable.sol": { + "content": "// \"SPDX-License-Identifier: MIT\"\npragma solidity 0.7.4;\n\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 * 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 {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _owner = msg.sender;\n emit OwnershipTransferred(address(0), _owner);\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(isOwner(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Returns true if the caller is the current owner.\n */\n function isOwner() public view returns (bool) {\n return msg.sender == _owner;\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 _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n */\n function _transferOwnership(address newOwner) internal virtual {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n}\n" + }, + "contracts/contracts/connectors/ConnectGelatoProviderPayment.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\n\nimport {\n IConnectGelatoProviderPayment\n} from \"../../interfaces/InstaDapp/connectors/IConnectGelatoProviderPayment.sol\";\nimport {Ownable} from \"../../vendor/Ownable.sol\";\nimport {Address} from \"../../vendor/Address.sol\";\nimport {GelatoString} from \"../../lib/GelatoString.sol\";\nimport {IERC20} from \"../../vendor/IERC20.sol\";\nimport {SafeERC20} from \"../../vendor/SafeERC20.sol\";\nimport {_getUint, _setUint} from \"../../functions/InstaDapp/FInstaDapp.sol\";\nimport {ETH} from \"../../constants/CInstaDapp.sol\";\nimport {\n IGelatoProviders\n} from \"@gelatonetwork/core/contracts/gelato_core/interfaces/IGelatoProviders.sol\";\n\n/// @title ConnectGelatoProviderPayment\n/// @notice InstaDapp Connector to compensate Gelato automation-gas Providers.\n/// @author Gelato Team\ncontract ConnectGelatoProviderPayment is\n IConnectGelatoProviderPayment,\n Ownable\n{\n using Address for address payable;\n using GelatoString for string;\n using SafeERC20 for IERC20;\n\n // solhint-disable-next-line const-name-snakecase\n string public constant override name = \"ConnectGelatoProviderPayment-v1.0\";\n\n address\n public constant\n override GELATO_CORE = 0x1d681d76ce96E4d70a88A00EBbcfc1E47808d0b8;\n\n address public override gelatoProvider;\n\n uint256 internal immutable _id;\n address internal immutable _this;\n\n constructor(uint256 id, address _gelatoProvider)\n noAddressZeroProvider(_gelatoProvider)\n {\n _id = id;\n _this = address(this);\n gelatoProvider = _gelatoProvider;\n }\n\n modifier noAddressZeroProvider(address _gelatoProvider) {\n require(\n _gelatoProvider != address(0x0),\n \"ConnectGelatoProviderPayment.noAddressZeroProvider\"\n );\n _;\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 Set the gelatoProvider address that will be paid for executing a task\n function setProvider(address _gelatoProvider)\n external\n override\n onlyOwner\n noAddressZeroProvider(_gelatoProvider)\n {\n gelatoProvider = _gelatoProvider;\n }\n\n /// @notice Transfers automation gas fees to Gelato Provider\n /// @dev Gelato Provider risks:\n /// - _getId does not match actual InstaMemory gelatoProvider 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 Provider.\n /// @param _amt The amount of _token to pay the Gelato Provider.\n /// @param _getId The InstaMemory slot at which the payment amount was stored.\n /// @param _setId The InstaMemory slot to save the gelatoProvider payout amound in.\n function payProvider(\n address _token,\n uint256 _amt,\n uint256 _getId,\n uint256 _setId\n ) external payable override {\n address provider = IConnectGelatoProviderPayment(_this)\n .gelatoProvider();\n\n uint256 amt = _getUint(_getId, _amt);\n _setUint(_setId, amt);\n\n if (_token == ETH) {\n // solhint-disable no-empty-blocks\n try\n IGelatoProviders(GELATO_CORE).provideFunds{value: amt}(provider)\n {} catch Error(string memory error) {\n error.revertWithInfo(\n \"ConnectGelatoProviderPayment.payProvider.provideFunds:\"\n );\n } catch {\n revert(\n \"ConnectGelatoProviderPayment.payProvider.provideFunds:undefined\"\n );\n }\n } else {\n IERC20(_token).safeTransfer(provider, amt);\n }\n }\n}\n" + }, + "contracts/interfaces/InstaDapp/connectors/IConnectGelatoProviderPayment.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\n\nimport {ConnectorInterface} from \"../IInstaDapp.sol\";\n\ninterface IConnectGelatoProviderPayment is ConnectorInterface {\n function setProvider(address _provider) external;\n\n function payProvider(\n address _token,\n uint256 _amt,\n uint256 _getId,\n uint256 _setId\n ) external payable;\n\n function gelatoProvider() external view returns (address);\n\n // solhint-disable-next-line func-name-mixedcase\n function GELATO_CORE() external pure returns (address);\n}\n" + }, + "contracts/vendor/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.7.4;\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 {\n size := extcodesize(account)\n }\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(\n address(this).balance >= amount,\n \"Address: insufficient balance\"\n );\n\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(\n success,\n \"Address: unable to send value, recipient may have reverted\"\n );\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)\n internal\n returns (bytes memory)\n {\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(\n address target,\n bytes memory data,\n string memory errorMessage\n ) 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(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return\n functionCallWithValue(\n target,\n data,\n value,\n \"Address: low-level call with value failed\"\n );\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(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(\n address(this).balance >= value,\n \"Address: insufficient balance for call\"\n );\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}(\n data\n );\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n function _verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) 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}" + }, + "contracts/lib/GelatoString.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\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 returnWithInfo(string memory _error, string memory _tracingInfo)\n internal\n pure\n returns (string memory)\n {\n return string(abi.encodePacked(_tracingInfo, _error));\n }\n}\n" + }, + "contracts/vendor/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.7.4;\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}" + }, + "contracts/vendor/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.7.4;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {SafeMath} from \"./SafeMath.sol\";\nimport {Address} from \"./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}" + }, + "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" + }, + "@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/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" + }, + "contracts/vendor/SafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.7.4;\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}" + }, + "@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" + }, + "contracts/contracts/mocks/MockGelatoExecutor.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\ncontract MockGelatoExecutor {\n using GelatoBytes for bytes;\n address public gelatoCore;\n\n constructor(address _gelatoCore) {\n gelatoCore = _gelatoCore;\n }\n\n // solhint-disable-next-line\n function exec(TaskReceipt memory _TR) external {\n // uint256 gasLeft = gasleft(); // Uncomment this line for using gasleft Method\n IGelatoCore(gelatoCore).exec(_TR);\n // solhint-disable-next-line\n // console.log(\"Gas Cost for Task Execution %s\", gasLeft - gasleft());// Uncomment this line for using gasleft Method\n }\n\n function stakeExecutor() external payable {\n IGelatoExecutors(gelatoCore).stakeExecutor{value: msg.value}();\n }\n\n function canExec(\n // solhint-disable-next-line\n TaskReceipt calldata _TR,\n uint256 _gasLimit,\n uint256 _execTxGasPrice\n ) external view returns (string memory) {\n return IGelatoCore(gelatoCore).canExec(_TR, _gasLimit, _execTxGasPrice);\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/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" + }, + "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 \"../../../vendor/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 ) = 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) = _sourceA.staticcall(\n _sourceAData\n );\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" + }, + "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 _encodePayGelatoProvider\n} from \"../../functions/InstaDapp/connectors/FConnectGelatoProviderPayment.sol\";\nimport {\n _encodeDepositCompound,\n _encodeBorrowCompound\n} from \"../../functions/InstaDapp/connectors/FConnectCompound.sol\";\nimport {_getGelatoProviderFees} 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\n public constant\n override name = \"ConnectGelatoDataPartialRefinanceMaker-v1.0\";\n uint256 internal immutable _id;\n address internal immutable _connectGelatoProviderPayment;\n\n uint256 public constant GAS_COST = 1850000;\n\n constructor(uint256 id, address connectGelatoProviderPayment) {\n _id = id;\n _connectGelatoProviderPayment = connectGelatoProviderPayment;\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) = _dataMakerToMaker(\n _payload\n );\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) = _dataMakerToCompound(\n _payload\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 = abi.encodeWithSelector(\n AccountInterface.cast.selector,\n targets,\n datas,\n msg.sender // msg.sender == GelatoCore\n );\n\n (bool success, bytes memory returndata) = address(this).delegatecall(\n castData\n );\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 ) = 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] = _connectGelatoProviderPayment; // payProvider\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] = _encodePayGelatoProvider(\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 ) = 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] = _connectGelatoProviderPayment; // payProvider\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] = _encodePayGelatoProvider(\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) = _priceOracle.staticcall(\n _oraclePayload\n );\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 = _getGelatoProviderFees(GAS_COST);\n\n uint256 wPricedCol = wmul(\n sub(_getMakerVaultCollateralBalance(_vaultId), gasFeesPaidFromCol),\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/FConnectGelatoProviderPayment.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\n\nimport {\n IConnectGelatoProviderPayment\n} from \"../../../interfaces/InstaDapp/connectors/IConnectGelatoProviderPayment.sol\";\n\nfunction _encodePayGelatoProvider(\n address _token,\n uint256 _amt,\n uint256 _getId,\n uint256 _setId\n) pure returns (bytes memory) {\n return\n abi.encodeWithSelector(\n IConnectGelatoProviderPayment.payProvider.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/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/ConnectGelatoDataFullRefinanceMaker.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} 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 _encodePayGelatoProvider\n} from \"../../functions/InstaDapp/connectors/FConnectGelatoProviderPayment.sol\";\nimport {\n _encodeDepositCompound,\n _encodeBorrowCompound\n} from \"../../functions/InstaDapp/connectors/FConnectCompound.sol\";\nimport {_getGelatoProviderFees} from \"../../functions/gelato/FGelato.sol\";\nimport {\n _getFlashLoanRoute,\n _getGasCostMakerToMaker,\n _getGasCostMakerToCompound,\n _getRealisedDebt\n} from \"../../functions/gelato/FGelatoDebtBridge.sol\";\n\ncontract ConnectGelatoDataFullRefinanceMaker is ConnectorInterface {\n using GelatoBytes for bytes;\n\n // solhint-disable const-name-snakecase\n string\n public constant\n override name = \"ConnectGelatoDataFullRefinanceMaker-v1.0\";\n uint256 internal immutable _id;\n address internal immutable _connectGelatoProviderPayment;\n\n constructor(uint256 id, address connectGelatoProviderPayment) {\n _id = id;\n _connectGelatoProviderPayment = connectGelatoProviderPayment;\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 _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) = _dataMakerToMaker(\n _vaultAId,\n _vaultBId,\n _colToken,\n _colType\n );\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 _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) = _dataMakerToCompound(\n _vaultId,\n _colToken\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 = abi.encodeWithSelector(\n AccountInterface.cast.selector,\n targets,\n datas,\n msg.sender // msg.sender == GelatoCore\n );\n\n (bool success, bytes memory returndata) = address(this).delegatecall(\n castData\n );\n if (!success) {\n returndata.revertWithError(\n \"ConnectGelatoDataFullRefinanceMaker._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 uint256 wDaiToBorrow = _getRealisedDebt(_getMakerVaultDebt(_vaultAId));\n uint256 wColToWithdrawFromMaker = _getMakerVaultCollateralBalance(\n _vaultAId\n );\n uint256 route = _getFlashLoanRoute(DAI, wDaiToBorrow);\n uint256 gasCost = _getGasCostMakerToMaker(_vaultBId == 0, route);\n uint256 gasFeesPaidFromCol = _getGelatoProviderFees(gasCost);\n\n (address[] memory _targets, bytes[] memory _datas) = _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] = _connectGelatoProviderPayment; // payProvider\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] = _encodePayGelatoProvider(\n _colToken,\n _gasFeesPaidFromCol,\n 0,\n 0\n );\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] = _connectGelatoProviderPayment; // payProvider\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] = _encodePayGelatoProvider(\n _colToken,\n _gasFeesPaidFromCol,\n 0,\n 0\n );\n datas[5] = _encodeFlashPayback(DAI, _wDaiToBorrow, 0, 0);\n }\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 = _getMakerVaultCollateralBalance(\n _vaultId\n );\n uint256 route = _getFlashLoanRoute(DAI, wDaiToBorrow);\n uint256 gasCost = _getGasCostMakerToCompound(route);\n uint256 gasFeesPaidFromCol = _getGelatoProviderFees(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] = _connectGelatoProviderPayment; // payProvider\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] = _encodePayGelatoProvider(\n _colToken,\n gasFeesPaidFromCol,\n 0,\n 0\n );\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/contracts/resolvers/MakerResolver.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.7.4;\n\nimport {\n _getMakerRawVaultDebt,\n _getMakerVaultCollateralBalance\n} from \"../../functions/dapps/FMaker.sol\";\n\ncontract MakerResolver {\n /// @dev Return Debt in wad of the vault associated to the vaultId.\n function getMakerVaultDebt(uint256 _vaultId) public view returns (uint256) {\n return _getMakerRawVaultDebt(_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" + } + }, + "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 7b39f28..b3d6554 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -1,5 +1,5 @@ // Buidler -const {task, types} = require("hardhat/config"); +const { task, types } = require("hardhat/config"); require("@nomiclabs/hardhat-ethers"); require("@nomiclabs/hardhat-waffle"); require("hardhat-deploy"); @@ -8,10 +8,12 @@ require("hardhat-gas-reporter"); // Libraries const assert = require("assert"); -const {utils} = require("ethers"); +const { utils } = require("ethers"); const GelatoCoreLib = require("@gelatonetwork/core"); +const mainnetDeployments = require("./hardhat/config/mainnet-deployments"); + // Process Env Variables require("dotenv").config(); // const INFURA_ID = process.env.INFURA_ID; @@ -22,8 +24,6 @@ assert.ok(ALCHEMY_ID, "no Alchemy ID in process.env"); const DEPLOYER = "0xe1F076849B781b1395Fd332dC1758Dbc129be6EC"; // Gelato-Luis const DEPLOYER_PK_MAINNET = process.env.DEPLOYER_PK_MAINNET; -const INSTA_MASTER = "0xb1DC62EC38E6E3857a887210C38418E4A17Da5B2"; - // ================================= CONFIG ========================================= module.exports = { defaultNetwork: "hardhat", @@ -58,36 +58,16 @@ module.exports = { blockNumber: 11189230, }, // Custom - GelatoCore: "0x1d681d76ce96E4d70a88A00EBbcfc1E47808d0b8", - GelatoGasPriceOracle: "0x169E633A2D1E6c10dD91238Ba11c4A708dfEF37C", - InstaMaster: INSTA_MASTER, - InstaIndex: "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723", - InstaList: "0x4c8a1BEb8a87765788946D6B19C6C6355194AbEb", - InstaConnectors: "0xD6A602C01a023B98Ecfb29Df02FBA380d3B21E0c", - InstaAccount: "0x939Daad09fC4A9B8f8A9352A485DAb2df4F4B3F8", - InstaMapping: "0xe81F70Cc7C0D46e12d70efc60607F16bbD617E88", - ConnectAuth: "0xd1aFf9f2aCf800C876c409100D6F39AEa93Fc3D9", - ConnectBasic: "0x6a31c5982C5Bc5533432913cf06a66b6D3333a95", - ConnectGelato: "0x37A7009d424951dd5D5F155fA588D9a03C455163", - ConnectMaker: "0xac02030d8a8F49eD04b2f52C394D3F901A10F8A9", - ConnectCompound: "0x07F81230d73a78f63F0c2A3403AD281b067d28F8", - ConnectInstaPool: "0xCeF5f3c402d4fef76A038e89a4357176963e1464", - MakerResolver: "0x0A7008B38E7015F8C36A49eEbc32513ECA8801E5", - CompoundResolver: "0x1f22D77365d8BFE3b901C33C83C01B584F946617", - InstaPoolResolver: "0xa004a5afBa04b74037E9E52bA1f7eb02b5E61509", - DAI: "0x6b175474e89094c44da98b954eedeac495271d0f", - DAI_UNISWAP: "0x2a1530C4C41db0B0b2bB646CB5Eb1A67b7158667", - CDAI: "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643", - CETH: "0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5", - DssCdpManager: "0x5ef30b9986345249bc32d8928B7ee64DE9435E39", - GetCdps: "0x36a724Bd100c39f0Ea4D3A20F7097eE01A8Ff573", - ProviderModuleDsa: "0x0C25452d20cdFeEd2983fa9b9b9Cf4E81D6f2fE2", + ...mainnetDeployments, }, mainnet: { accounts: DEPLOYER_PK_MAINNET ? [DEPLOYER_PK_MAINNET] : [], chainId: 1, url: `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_ID}`, - gasPrice: parseInt(utils.parseUnits("10", "gwei")), + gasPrice: parseInt(utils.parseUnits("90", "gwei")), + timeout: 150000, + // Custom + ...mainnetDeployments, }, }, solidity: { @@ -95,36 +75,16 @@ module.exports = { { version: "0.6.10", settings: { - optimizer: {enabled: process.env.DEBUG ? false : true}, + optimizer: { enabled: process.env.DEBUG ? false : true }, }, }, { version: "0.7.4", settings: { - optimizer: {enabled: process.env.DEBUG ? false : true}, + optimizer: { enabled: process.env.DEBUG ? false : true }, }, }, ], - // overrides: { - // "contracts/vendor/DependenciesSix.sol": { - // version: "0.6.10", - // settings: { - // optimizer: {enabled: process.env.DEBUG ? false : true}, - // }, - // }, - // "@gelatonetwork/core/contracts/gelato_core/GelatoCore.sol": { - // version: "0.6.10", - // settings: { - // optimizer: {enabled: process.env.DEBUG ? false : true}, - // }, - // }, - // "@gelatonetwork/core/contracts/external/Ownable.sol": { - // version: "0.6.10", - // settings: { - // optimizer: {enabled: process.env.DEBUG ? false : true}, - // }, - // }, - // }, }, }; diff --git a/hardhat/config/mainnet-deployments.js b/hardhat/config/mainnet-deployments.js new file mode 100644 index 0000000..d67c73d --- /dev/null +++ b/hardhat/config/mainnet-deployments.js @@ -0,0 +1,28 @@ +const INSTA_MASTER = "0xb1DC62EC38E6E3857a887210C38418E4A17Da5B2"; + +module.exports = { + GelatoCore: "0x1d681d76ce96E4d70a88A00EBbcfc1E47808d0b8", + GelatoGasPriceOracle: "0x169E633A2D1E6c10dD91238Ba11c4A708dfEF37C", + InstaMaster: INSTA_MASTER, + InstaIndex: "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723", + InstaList: "0x4c8a1BEb8a87765788946D6B19C6C6355194AbEb", + InstaConnectors: "0xD6A602C01a023B98Ecfb29Df02FBA380d3B21E0c", + InstaAccount: "0x939Daad09fC4A9B8f8A9352A485DAb2df4F4B3F8", + InstaMapping: "0xe81F70Cc7C0D46e12d70efc60607F16bbD617E88", + ConnectAuth: "0xd1aFf9f2aCf800C876c409100D6F39AEa93Fc3D9", + ConnectBasic: "0x6a31c5982C5Bc5533432913cf06a66b6D3333a95", + ConnectGelato: "0x37A7009d424951dd5D5F155fA588D9a03C455163", + ConnectMaker: "0xac02030d8a8F49eD04b2f52C394D3F901A10F8A9", + ConnectCompound: "0x07F81230d73a78f63F0c2A3403AD281b067d28F8", + ConnectInstaPool: "0xCeF5f3c402d4fef76A038e89a4357176963e1464", + MakerResolver: "0x0A7008B38E7015F8C36A49eEbc32513ECA8801E5", + CompoundResolver: "0x1f22D77365d8BFE3b901C33C83C01B584F946617", + InstaPoolResolver: "0xa004a5afBa04b74037E9E52bA1f7eb02b5E61509", + DAI: "0x6b175474e89094c44da98b954eedeac495271d0f", + DAI_UNISWAP: "0x2a1530C4C41db0B0b2bB646CB5Eb1A67b7158667", + CDAI: "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643", + CETH: "0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5", + DssCdpManager: "0x5ef30b9986345249bc32d8928B7ee64DE9435E39", + GetCdps: "0x36a724Bd100c39f0Ea4D3A20F7097eE01A8Ff573", + ProviderModuleDsa: "0x0C25452d20cdFeEd2983fa9b9b9Cf4E81D6f2fE2", +}; diff --git a/package.json b/package.json index 5fe2402..1fbb3da 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "scripts": { "rebase": "HUSKY_SKIP_HOOKS=1 git rebase", "compile": "npx hardhat compile", + "deploy:mainnet": "npx hardhat deploy --network mainnet", "format": "prettier --write .", "lint": "eslint --cache . && yarn lint:sol", "lint:sol": "solhint 'contracts/**/*.sol'", @@ -26,14 +27,14 @@ "eslint-config-prettier": "6.15.0", "ethereum-waffle": "3.2.0", "ethers": "5.0.19", - "hardhat": "2.0.2", + "hardhat": "2.0.3", "hardhat-deploy": "0.7.0-beta.28", "hardhat-deploy-ethers": "0.3.0-beta.5", "hardhat-gas-reporter": "1.0.1", "husky": ">=4", "lint-staged": "10.5.1", "prettier": "2.1.2", - "prettier-plugin-solidity": "1.0.0-alpha.59", + "prettier-plugin-solidity": "1.0.0-alpha.60", "solhint": "3.3.2", "solhint-plugin-prettier": "0.0.5" }, diff --git a/pre-compiles/ConnectGelato_ABI.json b/pre-compiles/ConnectGelato_ABI.json index 80aedc1..43a485e 100644 --- a/pre-compiles/ConnectGelato_ABI.json +++ b/pre-compiles/ConnectGelato_ABI.json @@ -4,18 +4,18 @@ "inputs": [ { "components": [ - {"internalType": "uint256", "name": "id", "type": "uint256"}, - {"internalType": "address", "name": "userProxy", "type": "address"}, + { "internalType": "uint256", "name": "id", "type": "uint256" }, + { "internalType": "address", "name": "userProxy", "type": "address" }, { "components": [ - {"internalType": "address", "name": "addr", "type": "address"}, - {"internalType": "address", "name": "module", "type": "address"} + { "internalType": "address", "name": "addr", "type": "address" }, + { "internalType": "address", "name": "module", "type": "address" } ], "internalType": "struct Provider", "name": "provider", "type": "tuple" }, - {"internalType": "uint256", "name": "index", "type": "uint256"}, + { "internalType": "uint256", "name": "index", "type": "uint256" }, { "components": [ { @@ -25,7 +25,7 @@ "name": "inst", "type": "address" }, - {"internalType": "bytes", "name": "data", "type": "bytes"} + { "internalType": "bytes", "name": "data", "type": "bytes" } ], "internalType": "struct Condition[]", "name": "conditions", @@ -38,7 +38,7 @@ "name": "addr", "type": "address" }, - {"internalType": "bytes", "name": "data", "type": "bytes"}, + { "internalType": "bytes", "name": "data", "type": "bytes" }, { "internalType": "enum Operation", "name": "operation", @@ -84,7 +84,7 @@ "name": "expiryDate", "type": "uint256" }, - {"internalType": "uint256", "name": "cycleId", "type": "uint256"}, + { "internalType": "uint256", "name": "cycleId", "type": "uint256" }, { "internalType": "uint256", "name": "submissionsLeft", @@ -130,8 +130,8 @@ }, { "components": [ - {"internalType": "address", "name": "addr", "type": "address"}, - {"internalType": "bytes", "name": "data", "type": "bytes"}, + { "internalType": "address", "name": "addr", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" }, { "internalType": "enum Operation", "name": "operation", @@ -142,8 +142,8 @@ "name": "dataFlow", "type": "uint8" }, - {"internalType": "uint256", "name": "value", "type": "uint256"}, - {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } ], "internalType": "struct Action[]", "name": "actions", @@ -200,8 +200,8 @@ }, { "components": [ - {"internalType": "address", "name": "addr", "type": "address"}, - {"internalType": "bytes", "name": "data", "type": "bytes"}, + { "internalType": "address", "name": "addr", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" }, { "internalType": "enum Operation", "name": "operation", @@ -212,8 +212,8 @@ "name": "dataFlow", "type": "uint8" }, - {"internalType": "uint256", "name": "value", "type": "uint256"}, - {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } ], "internalType": "struct Action[]", "name": "actions", @@ -263,8 +263,8 @@ "inputs": [ { "components": [ - {"internalType": "address", "name": "addr", "type": "address"}, - {"internalType": "address", "name": "module", "type": "address"} + { "internalType": "address", "name": "addr", "type": "address" }, + { "internalType": "address", "name": "module", "type": "address" } ], "indexed": true, "internalType": "struct Provider", @@ -275,8 +275,8 @@ "components": [ { "components": [ - {"internalType": "address", "name": "inst", "type": "address"}, - {"internalType": "bytes", "name": "data", "type": "bytes"} + { "internalType": "address", "name": "inst", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } ], "internalType": "struct Condition[]", "name": "conditions", @@ -284,8 +284,8 @@ }, { "components": [ - {"internalType": "address", "name": "addr", "type": "address"}, - {"internalType": "bytes", "name": "data", "type": "bytes"}, + { "internalType": "address", "name": "addr", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" }, { "internalType": "enum Operation", "name": "operation", @@ -296,8 +296,8 @@ "name": "dataFlow", "type": "uint8" }, - {"internalType": "uint256", "name": "value", "type": "uint256"}, - {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } ], "internalType": "struct Action[]", "name": "actions", @@ -346,8 +346,8 @@ "inputs": [ { "components": [ - {"internalType": "address", "name": "addr", "type": "address"}, - {"internalType": "address", "name": "module", "type": "address"} + { "internalType": "address", "name": "addr", "type": "address" }, + { "internalType": "address", "name": "module", "type": "address" } ], "indexed": true, "internalType": "struct Provider", @@ -358,8 +358,8 @@ "components": [ { "components": [ - {"internalType": "address", "name": "inst", "type": "address"}, - {"internalType": "bytes", "name": "data", "type": "bytes"} + { "internalType": "address", "name": "inst", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } ], "internalType": "struct Condition[]", "name": "conditions", @@ -367,8 +367,8 @@ }, { "components": [ - {"internalType": "address", "name": "addr", "type": "address"}, - {"internalType": "bytes", "name": "data", "type": "bytes"}, + { "internalType": "address", "name": "addr", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" }, { "internalType": "enum Operation", "name": "operation", @@ -379,8 +379,8 @@ "name": "dataFlow", "type": "uint8" }, - {"internalType": "uint256", "name": "value", "type": "uint256"}, - {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } ], "internalType": "struct Action[]", "name": "actions", @@ -429,8 +429,8 @@ "inputs": [ { "components": [ - {"internalType": "address", "name": "addr", "type": "address"}, - {"internalType": "address", "name": "module", "type": "address"} + { "internalType": "address", "name": "addr", "type": "address" }, + { "internalType": "address", "name": "module", "type": "address" } ], "indexed": true, "internalType": "struct Provider", @@ -441,8 +441,8 @@ "components": [ { "components": [ - {"internalType": "address", "name": "inst", "type": "address"}, - {"internalType": "bytes", "name": "data", "type": "bytes"} + { "internalType": "address", "name": "inst", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } ], "internalType": "struct Condition[]", "name": "conditions", @@ -450,8 +450,8 @@ }, { "components": [ - {"internalType": "address", "name": "addr", "type": "address"}, - {"internalType": "bytes", "name": "data", "type": "bytes"}, + { "internalType": "address", "name": "addr", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" }, { "internalType": "enum Operation", "name": "operation", @@ -462,8 +462,8 @@ "name": "dataFlow", "type": "uint8" }, - {"internalType": "uint256", "name": "value", "type": "uint256"}, - {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } ], "internalType": "struct Action[]", "name": "actions", @@ -511,8 +511,8 @@ "inputs": [], "name": "connectorID", "outputs": [ - {"internalType": "uint256", "name": "_type", "type": "uint256"}, - {"internalType": "uint256", "name": "_id", "type": "uint256"} + { "internalType": "uint256", "name": "_type", "type": "uint256" }, + { "internalType": "uint256", "name": "_id", "type": "uint256" } ], "stateMutability": "pure", "type": "function" @@ -521,18 +521,18 @@ "inputs": [ { "components": [ - {"internalType": "uint256", "name": "id", "type": "uint256"}, - {"internalType": "address", "name": "userProxy", "type": "address"}, + { "internalType": "uint256", "name": "id", "type": "uint256" }, + { "internalType": "address", "name": "userProxy", "type": "address" }, { "components": [ - {"internalType": "address", "name": "addr", "type": "address"}, - {"internalType": "address", "name": "module", "type": "address"} + { "internalType": "address", "name": "addr", "type": "address" }, + { "internalType": "address", "name": "module", "type": "address" } ], "internalType": "struct Provider", "name": "provider", "type": "tuple" }, - {"internalType": "uint256", "name": "index", "type": "uint256"}, + { "internalType": "uint256", "name": "index", "type": "uint256" }, { "components": [ { @@ -542,7 +542,7 @@ "name": "inst", "type": "address" }, - {"internalType": "bytes", "name": "data", "type": "bytes"} + { "internalType": "bytes", "name": "data", "type": "bytes" } ], "internalType": "struct Condition[]", "name": "conditions", @@ -555,7 +555,7 @@ "name": "addr", "type": "address" }, - {"internalType": "bytes", "name": "data", "type": "bytes"}, + { "internalType": "bytes", "name": "data", "type": "bytes" }, { "internalType": "enum Operation", "name": "operation", @@ -601,7 +601,7 @@ "name": "expiryDate", "type": "uint256" }, - {"internalType": "uint256", "name": "cycleId", "type": "uint256"}, + { "internalType": "uint256", "name": "cycleId", "type": "uint256" }, { "internalType": "uint256", "name": "submissionsLeft", @@ -620,7 +620,7 @@ }, { "inputs": [ - {"internalType": "address", "name": "_executor", "type": "address"}, + { "internalType": "address", "name": "_executor", "type": "address" }, { "components": [ { @@ -630,8 +630,8 @@ }, { "components": [ - {"internalType": "address", "name": "addr", "type": "address"}, - {"internalType": "bytes", "name": "data", "type": "bytes"}, + { "internalType": "address", "name": "addr", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" }, { "internalType": "enum Operation", "name": "operation", @@ -642,8 +642,8 @@ "name": "dataFlow", "type": "uint8" }, - {"internalType": "uint256", "name": "value", "type": "uint256"}, - {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } ], "internalType": "struct Action[]", "name": "actions", @@ -659,10 +659,10 @@ "name": "_taskSpecs", "type": "tuple[]" }, - {"internalType": "address[]", "name": "_modules", "type": "address[]"}, - {"internalType": "uint256", "name": "_ethToDeposit", "type": "uint256"}, - {"internalType": "uint256", "name": "_getId", "type": "uint256"}, - {"internalType": "uint256", "name": "_setId", "type": "uint256"} + { "internalType": "address[]", "name": "_modules", "type": "address[]" }, + { "internalType": "uint256", "name": "_ethToDeposit", "type": "uint256" }, + { "internalType": "uint256", "name": "_getId", "type": "uint256" }, + { "internalType": "uint256", "name": "_setId", "type": "uint256" } ], "name": "multiProvide", "outputs": [], @@ -685,8 +685,8 @@ }, { "components": [ - {"internalType": "address", "name": "addr", "type": "address"}, - {"internalType": "bytes", "name": "data", "type": "bytes"}, + { "internalType": "address", "name": "addr", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" }, { "internalType": "enum Operation", "name": "operation", @@ -697,8 +697,8 @@ "name": "dataFlow", "type": "uint8" }, - {"internalType": "uint256", "name": "value", "type": "uint256"}, - {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } ], "internalType": "struct Action[]", "name": "actions", @@ -714,9 +714,9 @@ "name": "_taskSpecs", "type": "tuple[]" }, - {"internalType": "address[]", "name": "_modules", "type": "address[]"}, - {"internalType": "uint256", "name": "_getId", "type": "uint256"}, - {"internalType": "uint256", "name": "_setId", "type": "uint256"} + { "internalType": "address[]", "name": "_modules", "type": "address[]" }, + { "internalType": "uint256", "name": "_getId", "type": "uint256" }, + { "internalType": "uint256", "name": "_setId", "type": "uint256" } ], "name": "multiUnprovide", "outputs": [], @@ -726,7 +726,7 @@ { "inputs": [], "name": "name", - "outputs": [{"internalType": "string", "name": "", "type": "string"}], + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, @@ -734,8 +734,8 @@ "inputs": [ { "components": [ - {"internalType": "address", "name": "addr", "type": "address"}, - {"internalType": "address", "name": "module", "type": "address"} + { "internalType": "address", "name": "addr", "type": "address" }, + { "internalType": "address", "name": "module", "type": "address" } ], "internalType": "struct Provider", "name": "_provider", @@ -745,8 +745,8 @@ "components": [ { "components": [ - {"internalType": "address", "name": "inst", "type": "address"}, - {"internalType": "bytes", "name": "data", "type": "bytes"} + { "internalType": "address", "name": "inst", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } ], "internalType": "struct Condition[]", "name": "conditions", @@ -754,8 +754,8 @@ }, { "components": [ - {"internalType": "address", "name": "addr", "type": "address"}, - {"internalType": "bytes", "name": "data", "type": "bytes"}, + { "internalType": "address", "name": "addr", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" }, { "internalType": "enum Operation", "name": "operation", @@ -766,8 +766,8 @@ "name": "dataFlow", "type": "uint8" }, - {"internalType": "uint256", "name": "value", "type": "uint256"}, - {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } ], "internalType": "struct Action[]", "name": "actions", @@ -788,7 +788,7 @@ "name": "_task", "type": "tuple" }, - {"internalType": "uint256", "name": "_expiryDate", "type": "uint256"} + { "internalType": "uint256", "name": "_expiryDate", "type": "uint256" } ], "name": "submitTask", "outputs": [], @@ -799,8 +799,8 @@ "inputs": [ { "components": [ - {"internalType": "address", "name": "addr", "type": "address"}, - {"internalType": "address", "name": "module", "type": "address"} + { "internalType": "address", "name": "addr", "type": "address" }, + { "internalType": "address", "name": "module", "type": "address" } ], "internalType": "struct Provider", "name": "_provider", @@ -810,8 +810,8 @@ "components": [ { "components": [ - {"internalType": "address", "name": "inst", "type": "address"}, - {"internalType": "bytes", "name": "data", "type": "bytes"} + { "internalType": "address", "name": "inst", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } ], "internalType": "struct Condition[]", "name": "conditions", @@ -819,8 +819,8 @@ }, { "components": [ - {"internalType": "address", "name": "addr", "type": "address"}, - {"internalType": "bytes", "name": "data", "type": "bytes"}, + { "internalType": "address", "name": "addr", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" }, { "internalType": "enum Operation", "name": "operation", @@ -831,8 +831,8 @@ "name": "dataFlow", "type": "uint8" }, - {"internalType": "uint256", "name": "value", "type": "uint256"}, - {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } ], "internalType": "struct Action[]", "name": "actions", @@ -853,7 +853,7 @@ "name": "_tasks", "type": "tuple[]" }, - {"internalType": "uint256", "name": "_expiryDate", "type": "uint256"}, + { "internalType": "uint256", "name": "_expiryDate", "type": "uint256" }, { "internalType": "uint256", "name": "_sumOfRequestedTaskSubmits", @@ -869,8 +869,8 @@ "inputs": [ { "components": [ - {"internalType": "address", "name": "addr", "type": "address"}, - {"internalType": "address", "name": "module", "type": "address"} + { "internalType": "address", "name": "addr", "type": "address" }, + { "internalType": "address", "name": "module", "type": "address" } ], "internalType": "struct Provider", "name": "_provider", @@ -880,8 +880,8 @@ "components": [ { "components": [ - {"internalType": "address", "name": "inst", "type": "address"}, - {"internalType": "bytes", "name": "data", "type": "bytes"} + { "internalType": "address", "name": "inst", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } ], "internalType": "struct Condition[]", "name": "conditions", @@ -889,8 +889,8 @@ }, { "components": [ - {"internalType": "address", "name": "addr", "type": "address"}, - {"internalType": "bytes", "name": "data", "type": "bytes"}, + { "internalType": "address", "name": "addr", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" }, { "internalType": "enum Operation", "name": "operation", @@ -901,8 +901,8 @@ "name": "dataFlow", "type": "uint8" }, - {"internalType": "uint256", "name": "value", "type": "uint256"}, - {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } ], "internalType": "struct Action[]", "name": "actions", @@ -923,8 +923,8 @@ "name": "_tasks", "type": "tuple[]" }, - {"internalType": "uint256", "name": "_expiryDate", "type": "uint256"}, - {"internalType": "uint256", "name": "_cycles", "type": "uint256"} + { "internalType": "uint256", "name": "_expiryDate", "type": "uint256" }, + { "internalType": "uint256", "name": "_cycles", "type": "uint256" } ], "name": "submitTaskCycle", "outputs": [], diff --git a/pre-compiles/InstaMapping.json b/pre-compiles/InstaMapping.json index d4b2a9d..4f168da 100644 --- a/pre-compiles/InstaMapping.json +++ b/pre-compiles/InstaMapping.json @@ -1,7 +1,7 @@ { "contractName": "ConnectAuth", "abi": [ - {"inputs": [], "stateMutability": "nonpayable", "type": "constructor"}, + { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ @@ -30,7 +30,7 @@ }, { "inputs": [ - {"internalType": "address[]", "name": "cTkn", "type": "address[]"} + { "internalType": "address[]", "name": "cTkn", "type": "address[]" } ], "name": "addCtknMapping", "outputs": [], @@ -39,7 +39,7 @@ }, { "inputs": [ - {"internalType": "address[]", "name": "gemJoins", "type": "address[]"} + { "internalType": "address[]", "name": "gemJoins", "type": "address[]" } ], "name": "addGemJoinMapping", "outputs": [], @@ -47,44 +47,44 @@ "type": "function" }, { - "inputs": [{"internalType": "address", "name": "", "type": "address"}], + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "cTokenMapping", - "outputs": [{"internalType": "address", "name": "", "type": "address"}], + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "connectors", - "outputs": [{"internalType": "address", "name": "", "type": "address"}], + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { - "inputs": [{"internalType": "bytes32", "name": "", "type": "bytes32"}], + "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "name": "gemJoinMapping", - "outputs": [{"internalType": "address", "name": "", "type": "address"}], + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "instaIndex", - "outputs": [{"internalType": "address", "name": "", "type": "address"}], + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "name", - "outputs": [{"internalType": "string", "name": "", "type": "string"}], + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "version", - "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" } diff --git a/pre-compiles/ProviderModuleDsa_ABI.json b/pre-compiles/ProviderModuleDsa_ABI.json index 3f5ae90..fbd2b8d 100644 --- a/pre-compiles/ProviderModuleDsa_ABI.json +++ b/pre-compiles/ProviderModuleDsa_ABI.json @@ -6,16 +6,16 @@ "name": "_index", "type": "address" }, - {"internalType": "address", "name": "_gelatoCore", "type": "address"} + { "internalType": "address", "name": "_gelatoCore", "type": "address" } ], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [ - {"internalType": "uint256", "name": "", "type": "uint256"}, - {"internalType": "address", "name": "", "type": "address"}, - {"internalType": "address", "name": "", "type": "address"}, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "address", "name": "", "type": "address" }, { "components": [ { @@ -25,7 +25,7 @@ "name": "inst", "type": "address" }, - {"internalType": "bytes", "name": "data", "type": "bytes"} + { "internalType": "bytes", "name": "data", "type": "bytes" } ], "internalType": "struct Condition[]", "name": "conditions", @@ -33,8 +33,8 @@ }, { "components": [ - {"internalType": "address", "name": "addr", "type": "address"}, - {"internalType": "bytes", "name": "data", "type": "bytes"}, + { "internalType": "address", "name": "addr", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" }, { "internalType": "enum Operation", "name": "operation", @@ -45,8 +45,8 @@ "name": "dataFlow", "type": "uint8" }, - {"internalType": "uint256", "name": "value", "type": "uint256"}, - {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } ], "internalType": "struct Action[]", "name": "actions", @@ -67,18 +67,18 @@ "name": "_task", "type": "tuple" }, - {"internalType": "uint256", "name": "", "type": "uint256"} + { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "execPayload", "outputs": [ - {"internalType": "bytes", "name": "payload", "type": "bytes"}, - {"internalType": "bool", "name": "", "type": "bool"} + { "internalType": "bytes", "name": "payload", "type": "bytes" }, + { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { - "inputs": [{"internalType": "bytes", "name": "", "type": "bytes"}], + "inputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], "name": "execRevertCheck", "outputs": [], "stateMutability": "pure", @@ -87,7 +87,7 @@ { "inputs": [], "name": "gelatoCore", - "outputs": [{"internalType": "address", "name": "", "type": "address"}], + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, @@ -106,8 +106,8 @@ }, { "inputs": [ - {"internalType": "address", "name": "_userProxy", "type": "address"}, - {"internalType": "address", "name": "", "type": "address"}, + { "internalType": "address", "name": "_userProxy", "type": "address" }, + { "internalType": "address", "name": "", "type": "address" }, { "components": [ { @@ -117,7 +117,7 @@ "name": "inst", "type": "address" }, - {"internalType": "bytes", "name": "data", "type": "bytes"} + { "internalType": "bytes", "name": "data", "type": "bytes" } ], "internalType": "struct Condition[]", "name": "conditions", @@ -125,8 +125,8 @@ }, { "components": [ - {"internalType": "address", "name": "addr", "type": "address"}, - {"internalType": "bytes", "name": "data", "type": "bytes"}, + { "internalType": "address", "name": "addr", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" }, { "internalType": "enum Operation", "name": "operation", @@ -137,8 +137,8 @@ "name": "dataFlow", "type": "uint8" }, - {"internalType": "uint256", "name": "value", "type": "uint256"}, - {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } ], "internalType": "struct Action[]", "name": "actions", @@ -161,7 +161,7 @@ } ], "name": "isProvided", - "outputs": [{"internalType": "string", "name": "", "type": "string"}], + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" } diff --git a/test/0_setup-DSA-Gelato.test.js b/test/0_setup-DSA-Gelato.test.js index 69cba7e..05d451e 100644 --- a/test/0_setup-DSA-Gelato.test.js +++ b/test/0_setup-DSA-Gelato.test.js @@ -1,8 +1,8 @@ // running `npx hardhat test` automatically makes use of hardhat-waffle plugin // => only dependency we need is "chai" -const {expect} = require("chai"); +const { expect } = require("chai"); const hre = require("hardhat"); -const {ethers} = hre; +const { ethers } = hre; const GelatoCoreLib = require("@gelatonetwork/core"); //const { sleep } = GelatoCoreLib; @@ -194,7 +194,7 @@ describe("DSA setup with Gelato Tests", function () { ); // We withdraw to otherWallet to ignore gasUsed during test - const {1: otherWallet} = await ethers.getSigners(); + const { 1: otherWallet } = await ethers.getSigners(); // Instantiate Gelato ConnectBasic.withdraw Task const withdrawFromDSATask = new GelatoCoreLib.Task({ diff --git a/test/1_mv-DAI-DSR-Compound.test.js b/test/1_mv-DAI-DSR-Compound.test.js index fa33398..bd38180 100644 --- a/test/1_mv-DAI-DSR-Compound.test.js +++ b/test/1_mv-DAI-DSR-Compound.test.js @@ -1,8 +1,8 @@ // running `npx hardhat test` automatically makes use of hardhat-waffle plugin // => only dependency we need is "chai" -const {expect} = require("chai"); +const { expect } = require("chai"); const hre = require("hardhat"); -const {deployments, ethers} = hre; +const { deployments, ethers } = hre; const GelatoCoreLib = require("@gelatonetwork/core"); //const { sleep } = GelatoCoreLib; diff --git a/test/2_Full-Debt-Bridge-Maker-Compound.test.js b/test/2_Full-Debt-Bridge-Maker-Compound.test.js index e9cede3..930aaf2 100644 --- a/test/2_Full-Debt-Bridge-Maker-Compound.test.js +++ b/test/2_Full-Debt-Bridge-Maker-Compound.test.js @@ -1,6 +1,6 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); const hre = require("hardhat"); -const {deployments, ethers} = hre; +const { deployments, ethers } = hre; const GelatoCoreLib = require("@gelatonetwork/core"); diff --git a/test/3_Full-Debt-Bridge-ETHA-ETHB-With-Vault-Creation.test.js b/test/3_Full-Debt-Bridge-ETHA-ETHB-With-Vault-Creation.test.js index b480ea0..e5d67e1 100644 --- a/test/3_Full-Debt-Bridge-ETHA-ETHB-With-Vault-Creation.test.js +++ b/test/3_Full-Debt-Bridge-ETHA-ETHB-With-Vault-Creation.test.js @@ -1,6 +1,6 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); const hre = require("hardhat"); -const {deployments, ethers} = hre; +const { deployments, ethers } = hre; const GelatoCoreLib = require("@gelatonetwork/core"); const setupFullRefinanceMakerToMaker = require("./helpers/setupFullRefinanceMakerToMaker"); diff --git a/test/4_Full-Debt-Bridge-ETHA-ETHB.test.js b/test/4_Full-Debt-Bridge-ETHA-ETHB.test.js index 2a2bbc0..591ea0e 100644 --- a/test/4_Full-Debt-Bridge-ETHA-ETHB.test.js +++ b/test/4_Full-Debt-Bridge-ETHA-ETHB.test.js @@ -1,6 +1,6 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); const hre = require("hardhat"); -const {deployments, ethers} = hre; +const { deployments, ethers } = hre; const GelatoCoreLib = require("@gelatonetwork/core"); const setupFullRefinanceMakerToMakerWithVaultBCreation = require("./helpers/setupFullRefinanceMakerToMakerWithVaultBCreation"); diff --git a/test/5_Full-Debt-Bridge-ETHA-ETHB-Gas-Cost-Mock.test.js b/test/5_Full-Debt-Bridge-ETHA-ETHB-Gas-Cost-Mock.test.js index c179516..26c9853 100644 --- a/test/5_Full-Debt-Bridge-ETHA-ETHB-Gas-Cost-Mock.test.js +++ b/test/5_Full-Debt-Bridge-ETHA-ETHB-Gas-Cost-Mock.test.js @@ -1,6 +1,6 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); const hre = require("hardhat"); -const {deployments, ethers} = hre; +const { deployments, ethers } = hre; const GelatoCoreLib = require("@gelatonetwork/core"); const setupFullRefinanceMakerToMakerWithVaultBCreationMock = require("./helpers/setupFullRefinanceMakerToMakerWithVaultBCreationMock"); diff --git a/test/helpers/services/addETHBGemJoinMapping.js b/test/helpers/services/addETHBGemJoinMapping.js index a71d5b1..00161fd 100644 --- a/test/helpers/services/addETHBGemJoinMapping.js +++ b/test/helpers/services/addETHBGemJoinMapping.js @@ -1,6 +1,6 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); const hre = require("hardhat"); -const {ethers} = hre; +const { ethers } = hre; async function addETHBGemJoinMapping(userWallet, instaMapping, instaMaster) { await userWallet.sendTransaction({ diff --git a/test/helpers/services/addProviderModuleDSA.js b/test/helpers/services/addProviderModuleDSA.js index d8d560f..cb6a230 100644 --- a/test/helpers/services/addProviderModuleDSA.js +++ b/test/helpers/services/addProviderModuleDSA.js @@ -1,4 +1,4 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); async function addProviderModuleDSA( gelatoProviderWallet, diff --git a/test/helpers/services/createDSA.js b/test/helpers/services/createDSA.js index 0e3b095..7f945e2 100644 --- a/test/helpers/services/createDSA.js +++ b/test/helpers/services/createDSA.js @@ -1,6 +1,6 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); const hre = require("hardhat"); -const {ethers} = hre; +const { ethers } = hre; const InstaAccount = require("../../../pre-compiles/InstaAccount.json"); diff --git a/test/helpers/services/createVaultForETHB.js b/test/helpers/services/createVaultForETHB.js index 9d54af1..4739f55 100644 --- a/test/helpers/services/createVaultForETHB.js +++ b/test/helpers/services/createVaultForETHB.js @@ -1,4 +1,4 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); const hre = require("hardhat"); const ConnectMaker = require("../../../pre-compiles/ConnectMaker.json"); diff --git a/test/helpers/services/enableGelatoConnectorsForFromMaker.js b/test/helpers/services/enableGelatoConnectorsForFromMaker.js index a01a6da..e92f9a4 100644 --- a/test/helpers/services/enableGelatoConnectorsForFromMaker.js +++ b/test/helpers/services/enableGelatoConnectorsForFromMaker.js @@ -1,6 +1,6 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); const hre = require("hardhat"); -const {ethers} = hre; +const { ethers } = hre; async function enableGelatoConnectorsForFromMaker( userWallet, diff --git a/test/helpers/services/getConstants.js b/test/helpers/services/getConstants.js index 035557c..4f7d2af 100644 --- a/test/helpers/services/getConstants.js +++ b/test/helpers/services/getConstants.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const {ethers} = hre; +const { ethers } = hre; const ETH = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"; const GAS_LIMIT = "5000000"; diff --git a/test/helpers/services/getContracts.js b/test/helpers/services/getContracts.js index b87cd38..197f1f4 100644 --- a/test/helpers/services/getContracts.js +++ b/test/helpers/services/getContracts.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const {ethers} = hre; +const { ethers } = hre; const GelatoCoreLib = require("@gelatonetwork/core"); const InstaIndex = require("../../../pre-compiles/InstaIndex.json"); diff --git a/test/helpers/services/getMockGelato.js b/test/helpers/services/getMockGelato.js index c3d7c15..72df7e1 100644 --- a/test/helpers/services/getMockGelato.js +++ b/test/helpers/services/getMockGelato.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const {ethers} = hre; +const { ethers } = hre; async function getMockGelato() { return await ethers.getContract("MockGelatoExecutor"); diff --git a/test/helpers/services/getWallets.js b/test/helpers/services/getWallets.js index 4e8705b..9e0baa4 100644 --- a/test/helpers/services/getWallets.js +++ b/test/helpers/services/getWallets.js @@ -1,6 +1,6 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); const hre = require("hardhat"); -const {ethers} = hre; +const { ethers } = hre; async function getWallets() { let userWallet; diff --git a/test/helpers/services/initializeMakerCdp.js b/test/helpers/services/initializeMakerCdp.js index cc292b9..931b390 100644 --- a/test/helpers/services/initializeMakerCdp.js +++ b/test/helpers/services/initializeMakerCdp.js @@ -1,4 +1,4 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); const hre = require("hardhat"); const ConnectMaker = require("../../../pre-compiles/ConnectMaker.json"); diff --git a/test/helpers/services/provideFunds.js b/test/helpers/services/provideFunds.js index 018ca25..6a905a5 100644 --- a/test/helpers/services/provideFunds.js +++ b/test/helpers/services/provideFunds.js @@ -1,4 +1,4 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); async function provideFunds( gelatoProviderWallet, diff --git a/test/helpers/services/providerAssignsExecutor.js b/test/helpers/services/providerAssignsExecutor.js index e4638fc..5730273 100644 --- a/test/helpers/services/providerAssignsExecutor.js +++ b/test/helpers/services/providerAssignsExecutor.js @@ -1,4 +1,4 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); async function providerAssignsExecutor( gelatoProviderWallet, diff --git a/test/helpers/services/providerWhiteListTaskForMakerETHAToMakerETHB.js b/test/helpers/services/providerWhiteListTaskForMakerETHAToMakerETHB.js index 43eab52..06cac34 100644 --- a/test/helpers/services/providerWhiteListTaskForMakerETHAToMakerETHB.js +++ b/test/helpers/services/providerWhiteListTaskForMakerETHAToMakerETHB.js @@ -1,6 +1,6 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); const hre = require("hardhat"); -const {deployments, ethers} = hre; +const { deployments, ethers } = hre; const GelatoCoreLib = require("@gelatonetwork/core"); // Instadapp UI should do the same implementation for submitting debt bridge task diff --git a/test/helpers/services/providerWhiteListTaskForMakerETHAToMakerETHBWithVaultB.js b/test/helpers/services/providerWhiteListTaskForMakerETHAToMakerETHBWithVaultB.js index 34d84ac..fea774c 100644 --- a/test/helpers/services/providerWhiteListTaskForMakerETHAToMakerETHBWithVaultB.js +++ b/test/helpers/services/providerWhiteListTaskForMakerETHAToMakerETHBWithVaultB.js @@ -1,6 +1,6 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); const hre = require("hardhat"); -const {deployments, ethers} = hre; +const { deployments, ethers } = hre; const GelatoCoreLib = require("@gelatonetwork/core"); // Instadapp UI should do the same implementation for submitting debt bridge task diff --git a/test/helpers/services/providerWhiteListTaskForMakerToCompound.js b/test/helpers/services/providerWhiteListTaskForMakerToCompound.js index 771eb8c..053bed4 100644 --- a/test/helpers/services/providerWhiteListTaskForMakerToCompound.js +++ b/test/helpers/services/providerWhiteListTaskForMakerToCompound.js @@ -1,6 +1,6 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); const hre = require("hardhat"); -const {ethers, deployments} = hre; +const { ethers, deployments } = hre; const GelatoCoreLib = require("@gelatonetwork/core"); // Instadapp UI should do the same implementation for submitting debt bridge task diff --git a/test/helpers/services/stakeExecutor.js b/test/helpers/services/stakeExecutor.js index 05d0905..ad95de5 100644 --- a/test/helpers/services/stakeExecutor.js +++ b/test/helpers/services/stakeExecutor.js @@ -1,4 +1,4 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); async function stakeExecutor(gelatoExecutorWallet, gelatoCore) { //#region Executor Stake on Gelato diff --git a/test/helpers/services/stakeExecutorMock.js b/test/helpers/services/stakeExecutorMock.js index 7393daf..8b374c1 100644 --- a/test/helpers/services/stakeExecutorMock.js +++ b/test/helpers/services/stakeExecutorMock.js @@ -1,4 +1,4 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); async function stakeExecutor( gelatoExecutorWallet, diff --git a/test/unit_tests/0_ConditionMakerVaultUnsafe.test.js b/test/unit_tests/0_ConditionMakerVaultUnsafe.test.js index a8fe122..86790ce 100644 --- a/test/unit_tests/0_ConditionMakerVaultUnsafe.test.js +++ b/test/unit_tests/0_ConditionMakerVaultUnsafe.test.js @@ -1,6 +1,6 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); const hre = require("hardhat"); -const {deployments, ethers} = hre; +const { deployments, ethers } = hre; // #region Contracts ABI diff --git a/test/unit_tests/1_ConnectGelatoProviderPayment.test.js b/test/unit_tests/1_ConnectGelatoProviderPayment.test.js index d528694..4d2a862 100644 --- a/test/unit_tests/1_ConnectGelatoProviderPayment.test.js +++ b/test/unit_tests/1_ConnectGelatoProviderPayment.test.js @@ -1,6 +1,6 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); const hre = require("hardhat"); -const {ethers, deployments} = hre; +const { ethers, deployments } = hre; const GelatoCoreLib = require("@gelatonetwork/core"); diff --git a/test/unit_tests/2_DebtRefinanceMath.test.js b/test/unit_tests/2_DebtRefinanceMath.test.js index ef1e3ee..6c40a30 100644 --- a/test/unit_tests/2_DebtRefinanceMath.test.js +++ b/test/unit_tests/2_DebtRefinanceMath.test.js @@ -1,6 +1,6 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); const hre = require("hardhat"); -const {deployments, ethers} = hre; +const { deployments, ethers } = hre; const WAD = ethers.utils.parseUnits("1", 18); diff --git a/test/unit_tests/3_PriceOracleResolver.test.js b/test/unit_tests/3_PriceOracleResolver.test.js index 55f71eb..1a9f014 100644 --- a/test/unit_tests/3_PriceOracleResolver.test.js +++ b/test/unit_tests/3_PriceOracleResolver.test.js @@ -1,6 +1,6 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); const hre = require("hardhat"); -const {deployments, ethers} = hre; +const { deployments, ethers } = hre; const ORACLE_MAKER_ETH_USD = "ETH/USD-Maker-v1"; const ORACLE_MAKER_ETH_USD_ADDR = "0x729D19f657BD0614b4985Cf1D82531c67569197B"; diff --git a/test/unit_tests/4_ConditionDebtBridgeIsAffordable.test.js b/test/unit_tests/4_ConditionDebtBridgeIsAffordable.test.js index 1cbe460..df1d3b6 100644 --- a/test/unit_tests/4_ConditionDebtBridgeIsAffordable.test.js +++ b/test/unit_tests/4_ConditionDebtBridgeIsAffordable.test.js @@ -1,6 +1,6 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); const hre = require("hardhat"); -const {deployments, ethers} = hre; +const { deployments, ethers } = hre; // #region Contracts ABI diff --git a/test/unit_tests/5_FGelatoDebtBridge.test.js b/test/unit_tests/5_FGelatoDebtBridge.test.js index ac33d27..c1082c3 100644 --- a/test/unit_tests/5_FGelatoDebtBridge.test.js +++ b/test/unit_tests/5_FGelatoDebtBridge.test.js @@ -1,6 +1,6 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); const hre = require("hardhat"); -const {deployments, ethers} = hre; +const { deployments, ethers } = hre; const InstaPoolResolver = require("../../artifacts/contracts/interfaces/InstaDapp/resolvers/IInstaPoolResolver.sol/IInstaPoolResolver.json"); const DAI = hre.network.config.DAI; diff --git a/test_temp/3_Partial-Refinance-External-Provider.test.js b/test_temp/3_Partial-Refinance-External-Provider.test.js index 258670a..0dfeccd 100644 --- a/test_temp/3_Partial-Refinance-External-Provider.test.js +++ b/test_temp/3_Partial-Refinance-External-Provider.test.js @@ -1,6 +1,6 @@ -const {expect} = require("chai"); +const { expect } = require("chai"); const hre = require("hardhat"); -const {deployments, ethers} = hre; +const { deployments, ethers } = hre; const GelatoCoreLib = require("@gelatonetwork/core"); // #region Contracts ABI and Constants diff --git a/yarn.lock b/yarn.lock index 37fdd31..3d7cafe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -709,10 +709,12 @@ resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.8.2.tgz#a6a5e93ac8dca6884a99a532f133beba59b87b69" integrity sha512-8LySx3qrNXPgB5JiULfG10O3V7QTxI/TLzSw5hFQhXWSkVxZBAv4rZQ0sYgLEbc8g3L2lmnujj1hKul38Eu5NQ== -"@solidity-parser/parser@^0.8.1": - version "0.8.1" - resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.8.1.tgz#1b606578af86b9ad10755409804a6ba83f9ce8a4" - integrity sha512-DF7H6T8I4lo2IZOE2NZwt3631T8j1gjpQLjmvY2xBNK50c4ltslR4XPKwT6RkeSd4+xCAK0GHC/k7sbRDBE4Yw== +"@solidity-parser/parser@^0.9.0": + version "0.9.0" + resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.9.0.tgz#1f9aedd25bf87983a02d95458c673c017a8857af" + integrity sha512-u1WzZgzOBFsGAcUhyj8DN/kop1SvrsaRT2ZVvDpVYnFI86YwbLrXCTGxefJzYGnA5Vajbbhi4aRtlxxFh69dfA== + dependencies: + antlr4 "^4.8.0" "@szmarczak/http-timer@^1.1.2": version "1.1.2" @@ -1028,6 +1030,11 @@ antlr4@4.7.1: resolved "https://registry.yarnpkg.com/antlr4/-/antlr4-4.7.1.tgz#69984014f096e9e775f53dd9744bf994d8959773" integrity sha512-haHyTW7Y9joE5MVs37P2lNYfU2RWBLfcRDD8OWldcdZm5TiCE91B5Xl1oWSwiDUSd4rlExpt2pu1fksYQjRBYQ== +antlr4@^4.8.0: + version "4.8.0" + resolved "https://registry.yarnpkg.com/antlr4/-/antlr4-4.8.0.tgz#f938ec171be7fc2855cd3a533e87647185b32b6a" + integrity sha512-en/MxQ4OkPgGJQ3wD/muzj1uDnFSzdFIhc2+c6bHZokWkuBb6RRvFjpWhPxWLbgQvaEzldJZ0GSQpfSAaE3hqg== + anymatch@~3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.1.tgz#c55ecf02185e2469259399310c173ce31233b142" @@ -4485,10 +4492,10 @@ hardhat-gas-reporter@1.0.1: dependencies: eth-gas-reporter "^0.2.19" -hardhat@2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.0.2.tgz#30c3c5a49f950aad2e39c479208b4132052dc735" - integrity sha512-P8SMYsWeC0OakmHUAgL9STalidQ1bAHFHFroPyvnfljei7EPHaIQpS6QursoZ+KVNkPTnKC+9m1Lky8nnKIjuw== +hardhat@2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.0.3.tgz#35e07060d9854d4182f201aeaa1c05316bd7e4d3" + integrity sha512-mDygAl+1qd5KBdXQBfc3R5XmC/rVdYYbEuOTSQY3rlncVu9gfockZVDsHtAMPw/FiBIRMApLcOceK7D1XQmHRw== dependencies: "@nomiclabs/ethereumjs-vm" "^4.1.1" "@sentry/node" "^5.18.1" @@ -6765,12 +6772,12 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier-plugin-solidity@1.0.0-alpha.59: - version "1.0.0-alpha.59" - resolved "https://registry.yarnpkg.com/prettier-plugin-solidity/-/prettier-plugin-solidity-1.0.0-alpha.59.tgz#b0cf82fb068537d152d0bc417588d08e952a56c6" - integrity sha512-6cE0SWaiYCBoJY4clCfsbWlEEOU4K42Ny6Tg4Jwprgts/q+AVfYnPQ5coRs7zIjYzc4RVspifYPeh+oAg8RpLw== +prettier-plugin-solidity@1.0.0-alpha.60: + version "1.0.0-alpha.60" + resolved "https://registry.yarnpkg.com/prettier-plugin-solidity/-/prettier-plugin-solidity-1.0.0-alpha.60.tgz#310a3af7e47d24fa1ef9e174523ff1f7b4d56c42" + integrity sha512-Dd6T0dVfw0kJrlEnLDFFE3mKRSP7zpT6zcIWvnSW+z4NBl+gmwJ7UJRZHD0CNDD6N48c+zb28xs3oF0ylDaYyg== dependencies: - "@solidity-parser/parser" "^0.8.1" + "@solidity-parser/parser" "^0.9.0" dir-to-object "^2.0.0" emoji-regex "^9.0.0" escape-string-regexp "^4.0.0"