0

Is it feasible to use Uniswap for buying and selling NFT's (ERC-721) or Semi-NFT's (ERC-1155) tokens? It would seem to me that it could be an easy way to implement a DEX for unique digital assets with very little overhead.

Or is there something I am missing?

Could I just call the factory function:

function createPair(address tokenA, address tokenB) external returns (address pair) {
        require(tokenA != tokenB, 'UniswapV2: IDENTICAL_ADDRESSES');
        (address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
        require(token0 != address(0), 'UniswapV2: ZERO_ADDRESS');
        require(getPair[token0][token1] == address(0), 'UniswapV2: PAIR_EXISTS'); // single check is sufficient
        bytes memory bytecode = type(UniswapV2Pair).creationCode;
        bytes32 salt = keccak256(abi.encodePacked(token0, token1));
        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
        allPairs.push(pair);
        emit PairCreated(token0, token1, pair, allPairs.length);
    }

and then a bidder would be able to purchase the ERC721 or 1 or more ERC1155 tokens? I know that the concept of Uniswap is the liquidity pool but what would happen if there was just 1 buyer and 1 seller?

Could that work?

Thanks for your help!

1
  • trading ERC721 tokens on Uniswap? hmmm, but how can you trade something unique on Uniswap ? Non-fungible token is a unique thing, and therefore it can't change in price very often. Have you checked how Uniswap works? – Nulik Jan 31 at 3:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.