🍉Bridge

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

interface IBridge {
    function withdraw(address ferc20Address, uint256 amount) external returns (bool);
    function batchDeposit(address inscriptionAddress, uint[] memory ids) external;
    function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);
    function nftTokenIds(address ferc721Address) external returns (uint256);
    function ferc20Addresses(address ferc721Address) external returns (address);
    function ferc721Addresses(address ferc20Address) external returns (address);
    function factoryContractAddress() external returns (address);
}

When some send Ferc721 NFT to this contract(the onERC721Received function will be called) or call batchDeposit function, the bridge contract will keep the NFT and mint Ferc20 tokens.

When some one call withdraw function (he must have Ferc20 balance), the bridge contract will burn the Ferc20 tokens and send back Ferc721 NFT to the sender.

nftTokenIds keep all deposited Ferc721 NFTs' tokenIds.

ferc20Addresses is mapping from Ferc721 NFT addresses to Ferc20 token addresses.

ferc721Addresses is mapping from Ferc20 token addresses to Ferc721 NFTaddresses.

Last updated