Gelato-automations/contracts/lib/GelatoString.sol
2020-11-10 14:39:26 +01:00

29 lines
740 B
Solidity

// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.4;
library GelatoString {
function startsWithOK(string memory _str) internal pure returns (bool) {
if (
bytes(_str).length >= 2 &&
bytes(_str)[0] == "O" &&
bytes(_str)[1] == "K"
) return true;
return false;
}
function revertWithInfo(string memory _error, string memory _tracingInfo)
internal
pure
{
revert(string(abi.encodePacked(_tracingInfo, _error)));
}
function returnWithInfo(string memory _error, string memory _tracingInfo)
internal
pure
returns (string memory)
{
return string(abi.encodePacked(_tracingInfo, _error));
}
}