LogoLogo
  • Introduction to the Muse DAO
  • Developer Vision
  • DAPPS
    • Fast Dapp
      • Tutorials
        • Getting started
          • Make an ERC20 transfer app
      • Components
        • Contract Read
        • Contract Write
        • APICall
        • Events
        • Address Display
        • Block Number
        • Ethereum Balance
        • PleaseConnect (Request user connection)
        • Token Balance (ERC20)
        • WatchEvents
        • AirStack
        • Sweep NFT floor
        • Token amount (ERC20)
        • Token name (ERC20)
        • Uniswap tradebox
        • Moment (display date/time)
      • Variables
        • userAddress
        • ABIs
        • connectedChain
        • Passing arbitrary data in query URL parameters
        • location
        • Toast
      • Templates
        • ERC20 Token transfer
        • Nouns Auction
        • AAVE V3
        • Lido Staking page
        • DAI Saving Rate
        • ERC6551
        • Popular NFT collections buy button
        • Non Fungible Message
        • No Shit Sherlock
      • Style
    • Launch
      • How to Launch a project
      • How to buy from a Launch
      • How to sell into a Launch
      • FAQ
    • NFT20
      • Use Cases
      • Liquidity Incentives
      • Guides
        • Adding a project
          • Create Pool
      • Contracts
        • NFT20Factory
          • Source
        • NFT20Pair
          • Source
      • API
      • Fees
    • ETHCMD
    • RolodETH
    • The Very Nifty Gallery
    • CUDL Game
      • Pets
      • $CUDL
      • MILK
      • Bazaar
      • Battles and weapons
    • Feather NFT
    • Dreams of EVM NFT
    • Sudoswap,js
    • The Quest (Sword & Shield)
    • Royal Game
    • Space Goo
    • NFT API
    • Pepesea NFT Marketplace
  • Tokenomics
    • $MUSE
    • Treasury
  • Other resources
    • Governance
    • Links
Powered by GitBook
On this page
  • General Deposit Behavior
  • Methods
  • withdraw()
  • multi721Deposit()
  • swap721()
  • swap1155()
  • View Methods
  • factory()
  • nftAddress()
  • nftType()
  • nftValue()
  1. DAPPS
  2. NFT20
  3. Contracts

NFT20Pair

PreviousSourceNextSource

Last updated 3 years ago

is an ERC20 token contract representing a pool of ERC721/ERC1155 NFT tokens. It allows users to deposit their ERC721/ERC1155 tokens in exchange for corresponding ERC20 tokens, and vice versa. Users may also use this contract to trade their ERC721/ERC1155 tokens for other tokens in the pool.

The currently deployed base () contract can be found at 0x7824948612d5F6d3dBC54d1c1173715B997403a1 on mainnet Ethereum.

When creating new pairs will instantiate a new instance of this contract (via a ) to represent the pair.

You should never interact with this base contract directly, and should instead use to find the deployed contract for the pair you wish to use.

General Deposit Behavior

Sending ERC721/ERC1155 tokens directly to a pair address will result in the transfer of the corresponding ERC20 pair tokens to the sender upon receipt.

In general, you must approve the pair contract address to transfer the relevant tokens on your behalf before calling these methods.

Methods

withdraw()

function withdraw(uint256[] calldata _tokenIds,uint256[] calldata amounts,address receipient) external

Burns ERC20 tokens to redeem ERC721/ERC1155 tokens from the pool.

Parameters

Parameter Name
Type
Description

_tokenIds

uint256[]

An array of tokenIds to withdraw.

amounts

uint256[]

The amount of each token in _tokenIds to withdraw.

receipient

address

Address where ERC721/ERC1155 tokens should be transfered to.

multi721Deposit()

function multi721Deposit(uint256[] memory _ids, address _referral) public;

Deposits multiple ERC721 tokens in exchange for the pair’s ERC20 token in one transaction.

Parameters

Parameter Name
Type
Description

_ids

uint256[]

An array of tokenIds to deposit.

_referral

address

swap721()

function swap721(uint256 _in, uint256 _out) external;

Swaps an ERC721 token for a different ERC721 token in the pool.

Parameters

Parameter Name
Type
Description

_in

uint256

tokenId to deposit.

_out

uint256

tokenId to withdraw.

swap1155()

function swap1155(uint256[] calldata in_ids,uint256[] calldata in_amounts,uint256[] calldata out_ids,uint256[] calldata out_amounts) external;

Swaps ERC1155 token(s) for different ERC115 token(s) in the pool.

Parameters

Parameter Name
Type
Description

_in_ids

uint256[]

An array of tokenIds to deposit.

_in_amounts

uint256[]

An array of amounts of tokens to deposit.

_out_ids

uint256[]

An array of tokenIds to withdraw.

_out_amounts

uint256[]

An array of amounts of tokens to withdraw.

View Methods

factory()

address public factory;

Return values

Type
Description

address

nftAddress()

address public nftAddress;

Returns the address of the ERC721/ERC1155 token held in this pair.

Return values

Type
Description

address

ERC721/ERC1155 contract address.

nftType()

uint256 public nftType;

Returns the type of NFT held in this pair, 721 for ERC721 or 1155 for ERC1155.

Return values

Type
Description

uint256

721 for ERC721 or 1155 for ERC1155.

nftValue()

uint256 public nftValue;

Returns the amount of ERC20 tokens to be issued per ERC721/ERC1155 deposit.

Return values

Type
Description

uint256

amount of ERC20 tokens issued on deposit

This contract conforms to and in order to mint pair tokens in exchange for ERC721/ERC1155 NFTs.

Referring address to recieve 40% of the .

Returns the contract that created this pair.

contract address.

NFT20Pair
logic
NFT20Factory
BeaconProxy
NFT20Factory.nftToToken()
General Deposit Behavior
Methods
withdraw()
multi721Deposit()
swap721()
swap1155()
View Methods
factory()
nftAddress()
nftType()
nftValue()
IERC721Receiver
IERC1155Receiver
ERC20
factory
fee
Factory