# NFT Marketplace (& nftrade reverse enginnering)
### Abstract
- NFTrade has 4 main parts: **Marketplace**, **Swaps**, **Farms** and **Create** (Swaps and Farms not needed in MVP)
- Multichain support (ETH, BSC & POLYGON)
- Using 0x protocol (smart contracts + npm modules) to fullfill orders
- mongoDB to store sign orders
- CDN (store and update metadata of nft created on platform)
### Homepage
- Create (will deploy erc721 direclty from frontend & ethers using FormData)
- Marketplace (elaborate below)
### Marketplace
- Left corner
- Price (sort by price, price between A to B)
- Collection (All collections, search by collection name)
- Blockchain (available blockchains, choice(sort) by selected blockchain)
- top search bar (search string and it matches collection, name & description) - not priority
- top right
- connect wallet (if connected then wallet info) - DROPDOWN
- my account (Activity, Trade offer received, Trade offer made)
- my nfts (1) list of all owned nft on connected chain id, while clicked on nft, it opens nft page 2) Avatar, address, etc 3) Search bar )
- preferences (name, email, profile pic)
- connected chain logo & notification
### NFT view page
https://app.nftrade.com/assets/polygon/0x6418d019aec4409e4830bc5c063b180d976a609f/4309
https:// domain / assets / chain / nft-contract-address / tokenID
(dynamic react router + fetch data from backend)
If connected user(address) is owner/seller of NFT:
- Highest offer/ Accept Offer
- Cancel Listing
else (buyer):
- Place an Offer (sign order and save it into db)
- Buy Now (Call fill order directly)
History
- Fetch last 5 ... & first transaction from etherscan & decode it
Name,Description, Collection details, Blockchain details, Properties of NFT
- from metadata
### Reverse Engineering (Contracts)
Native currencies used for buying/selling: WETH, WMATIC, WBNB
```
curl ETH_RPC -X POST -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "id": 123, "method": "eth_call", "params":[{"to":"0xefc70a1b18c432bdc64b596838b4d138f6bc6cad", "data":"0xae25532e"}, "latest"]}'
```
```json
{"jsonrpc":"2.0","id":123,"result":"0x0257179200000000000000000000000000000000000000000000000000000000"}
```
is equal to:
```
curl https://polygon-rpc.com/ -X POST -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "id": 123, "method": "eth_call", "params":[{"to":"0x2559be60a7040d645d263ca54c936320f90be74b", "data":"0xae25532e"}, "latest"]}'
```
```json
{"jsonrpc":"2.0","id":123,"result":"0x0257179200000000000000000000000000000000000000000000000000000000"}
```
https://0x.org/docs/guides/v3-specification#erc20---erc721
**ETHEREUM (Original 0x deployments):**
ERC721 Proxy : https://etherscan.io/address/0xefc70a1b18c432bdc64b596838b4d138f6bc6cad
ERC20 Proxy : https://etherscan.io/address/0x95e6f48254609a6ee006f7d493c8e5fb97094cef
Exchange Proxy (V4) : https://etherscan.io/address/0xdef1c0ded9bec7f1a1670819833240f027b25eff
Exchange (V3) : https://etherscan.io/address/0x61935cbdd02287b511119ddb11aeb42f1593b7ef
**POLYGON (Replicas by nftrade):**
ERC721 Proxy : https://polygonscan.com/address/0x2559be60a7040d645d263ca54c936320f90be74b
ERC20 Proxy : https://polygonscan.com/address/0xe05d2baa855c3dba7b4762d2f02e9012fb5f3867
Exchange (V3) : https://polygonscan.com/address/0xcFB6Ee27d82beb1B0f3aD501B968F01CD7Cc5961
**Sample FillOrder payload:**
chainId:137
exchangeAddress:0xcFB6Ee27d82beb1B0f3aD501B968F01CD7Cc5961
makerAddress:0x5cc377d9c84136e708c612b00a2617df635f83ae
takerAddress:0x0000000000000000000000000000000000000000
senderAddress:0x0000000000000000000000000000000000000000
feeRecipientAddress:0x0000000000000000000000000000000000000000
expirationTimeSeconds:1631373910246
salt:78750234459640998865016815489519516660629433408101040420245639594979146590177
makerAssetAmount:100000000000000000
takerAssetAmount:1
makerAssetData:0xf47261b00000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270
takerAssetData:0x0257179200000000000000000000000077a0b33052c4969e865bbc27147cc769e3e815080000000000000000000000000000000000000000000000000000000000000002
makerFeeAssetData:0x
takerFeeAssetData:0x
makerFee:0
takerFee:0