How to access Assembly variables after inline block (Solidity 0.6.0)

Hey! Quick question. So, I’ve been searching online for a few hours now, regarding an issue I’ve been having. Here is some code I’ve written:

assembly {
            pool := create2(0, add(bytecode, 32), mload(bytecode), salt)

But, I want to access pool outside of the assembly block. How do I do this? Uniswap does something similar, and, as far as I know, this has worked for them.

    assembly {
        pair := create2(0, add(bytecode, 32), mload(bytecode), salt)
    IUniswapV2Pair(pair).initialize(token0, token1);
    getPair[token0][token1] = pair;
    getPair[token1][token0] = pair; // populate mapping in the reverse direction
1 Like

Hi @JetDeveloping,

Welcome to the community forum :wave:

If you declare the variable outside the assembly block you should be able to use it afterwards.

See this example:

Hi @JetDeveloping,

Just wanted to check if you needed more information?