Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Report: Type Conversion from uint256 to address #28

Open
lidd77 opened this issue Jul 1, 2022 · 1 comment
Open

Bug Report: Type Conversion from uint256 to address #28

lidd77 opened this issue Jul 1, 2022 · 1 comment

Comments

@lidd77
Copy link

lidd77 commented Jul 1, 2022

hey,

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
            ))));
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@lidd77 and others