when use address to convert uint , it prompts that "Cannot convert uint256 into address".
uint means uint256, address means bytes20, so this conversion in the pancakeSwap source codes should
not work , but as I know , this code works for PancakeSwap .
what happened ? its for solidity compiler version?
// calculates the CREATE2 address for a pair without making any external calls
function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = sortTokens(tokenA, tokenB);
pair = address(uint(keccak256(abi.encodePacked(
hex'ff',
factory,
keccak256(abi.encodePacked(token0, token1)),
hex'd0d4c4cd0848c93cb4fd1f498d7013ee6bfb25783ea21593d5834f5d250ece66' // init code hash
))));
}
hey,
when use
address
to convertuint
, it prompts that "Cannot convert uint256 into address".uint means uint256, address means bytes20, so this conversion in the pancakeSwap source codes should not work , but as I know , this code works for PancakeSwap .
what happened ? its for solidity compiler version?