diff --git a/contracts/contracts/gelato/conditions/ConditionDebtBridgeIsAffordable.sol b/contracts/contracts/gelato/conditions/ConditionDebtBridgeIsAffordable.sol index ed73193..9a280ce 100644 --- a/contracts/contracts/gelato/conditions/ConditionDebtBridgeIsAffordable.sol +++ b/contracts/contracts/gelato/conditions/ConditionDebtBridgeIsAffordable.sol @@ -38,7 +38,12 @@ contract ConditionDebtBridgeIsAffordable is GelatoConditionsStandard { virtual returns (bytes memory) { - return abi.encode(_vaultId, _ratioLimit); + return + abi.encodeWithSelector( + this.isAffordable.selector, + _vaultId, + _ratioLimit + ); } /// @notice Standard GelatoCore system function @@ -51,7 +56,7 @@ contract ConditionDebtBridgeIsAffordable is GelatoConditionsStandard { uint256 ) public view virtual override returns (string memory) { (uint256 _vaultID, uint256 _ratioLimit) = - abi.decode(_conditionData, (uint256, uint256)); + abi.decode(_conditionData[4:], (uint256, uint256)); return isAffordable(_vaultID, _ratioLimit); } diff --git a/contracts/contracts/gelato/conditions/ConditionDestVaultWillBeSafe.sol b/contracts/contracts/gelato/conditions/ConditionDestVaultWillBeSafe.sol index 3c99f20..e90b107 100644 --- a/contracts/contracts/gelato/conditions/ConditionDestVaultWillBeSafe.sol +++ b/contracts/contracts/gelato/conditions/ConditionDestVaultWillBeSafe.sol @@ -25,7 +25,13 @@ contract ConditionDestVaultWillBeSafe is GelatoConditionsStandard { uint256 _destVaultId, string calldata _destColType ) public pure virtual returns (bytes memory) { - return abi.encode(_fromVaultId, _destVaultId, _destColType); + return + abi.encodeWithSelector( + this.destVaultWillBeSafe.selector, + _fromVaultId, + _destVaultId, + _destColType + ); } function ok( @@ -37,7 +43,7 @@ contract ConditionDestVaultWillBeSafe is GelatoConditionsStandard { uint256 _fromVaultId, uint256 _destVaultId, string memory _destColType - ) = abi.decode(_conditionData, (uint256, uint256, string)); + ) = abi.decode(_conditionData[4:], (uint256, uint256, string)); return destVaultWillBeSafe(_fromVaultId, _destVaultId, _destColType); } diff --git a/contracts/contracts/gelato/conditions/ConditionMakerVaultUnsafe.sol b/contracts/contracts/gelato/conditions/ConditionMakerVaultUnsafe.sol index 0b4de26..6331df2 100644 --- a/contracts/contracts/gelato/conditions/ConditionMakerVaultUnsafe.sol +++ b/contracts/contracts/gelato/conditions/ConditionMakerVaultUnsafe.sol @@ -26,7 +26,14 @@ contract ConditionMakerVaultUnsafe is GelatoConditionsStandard { bytes calldata _oraclePayload, uint256 _minColRatio ) public pure virtual returns (bytes memory) { - return abi.encode(_vaultId, _priceOracle, _oraclePayload, _minColRatio); + return + abi.encodeWithSelector( + this.isVaultUnsafe.selector, + _vaultId, + _priceOracle, + _oraclePayload, + _minColRatio + ); } /// @notice Standard GelatoCore system function @@ -43,7 +50,7 @@ contract ConditionMakerVaultUnsafe is GelatoConditionsStandard { address _priceOracle, bytes memory _oraclePayload, uint256 _minColRatio - ) = abi.decode(_conditionData, (uint256, address, bytes, uint256)); + ) = abi.decode(_conditionData[4:], (uint256, address, bytes, uint256)); return isVaultUnsafe(_vaultID, _priceOracle, _oraclePayload, _minColRatio);