Gelato-automations/contracts/vendor/Convert.sol

16 lines
418 B
Solidity
Raw Normal View History

// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.4;
import {mul as _mul} from "./DSMath.sol";
function _stringToBytes32(string memory str) pure returns (bytes32 result) {
require(bytes(str).length != 0, "string-empty");
assembly {
result := mload(add(str, 32))
}
}
function _convertTo18(uint256 _dec, uint256 _amt) pure returns (uint256 amt) {
amt = _mul(_amt, 10**(18 - _dec));
}