Gelato-automations/contracts/vendor/Convert.sol

19 lines
475 B
Solidity
Raw Normal View History

// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.4;
import {RAY, add, sub, 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));
}