Skip to content

Instantly share code, notes, and snippets.

@snaketh4x0r
Last active April 25, 2020 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snaketh4x0r/78e673a3c865ac5240aad49d4751d8dc to your computer and use it in GitHub Desktop.
Save snaketh4x0r/78e673a3c865ac5240aad49d4751d8dc to your computer and use it in GitHub Desktop.
1.First deploy NFT test contract
2.then mint test NFT token ->Token id keeps incrementing on succesful mint function call
3.then deploy NFT marketplace contract with mock ERC20 token address,NFT contract address created in previous step,currentprice
note:currentprice is in wei ,use https://eth-converter.com/ for appropriate calculations
4.then first call approve function of NFT contract with to as NFTmarketplace contract address and token id which you have previously minted
5.then call depositToken of NFT marketplace with token id which you have minted
6.now your NFT token is transferred to contract
7.call purchaseETH or purchaseMana with right arguments
Note:looks like metamask can't estimate Ether amount in purchaseETH function,so call getCurrentprice to get price and send appropriate amount of ether = current price
8.call approve function of mana token with NFTmarkerplace address and amount=current price as arguments
8.call purchaseMana with appropriate tokenid and amount of ERC20 Mana tokens previously approved
use my ether wallet for testing if developing from web
truffle console if developing from cli
or have amount: argument specified in frontend code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment