
我是如何抓住200倍的金土狗 二舅币的
开始事情的起因是昨天早上我起床的时候看关注的微博,发现了一条二舅币跑路的微博。看到这条微博,我突然就来了精神,因为之前二舅在中文社区的热度太高了,而且之前也有过多次归零的币,比如泰坦币、鱿鱼币、luna暴跌以后上微博热搜,上了热搜有了热度就拉几十几百倍。 当然经过我以前多次冲土狗归0的经历,我决定还是慎重一点。然后我就从图片里找到了这个土狗项目的推特(twitter.com/SecondUncle_Dao ),一般有推特的土狗项目算是比较良心。 从推特里我找到了项目的合约地 0x6e7ad49f67a9FA80D50F9659C3FC938296d68B58,找到合约地址以后,我去 avedex.cc/market 这个土狗专用查询网站搜索了一下这个代币的具体信息,发现当时总市值6000u左右,持币地址200人不到,从最高点跌了90%左右,感觉还可以还没被人炒过。 然后去 honeypot.is 根据合约地址查了下是不是蜜罐合约,是不是有明显的漏洞,查了一下虽然不是蜜罐地址,但是买入10%的交易税,卖出11%的交易税还是让我有点担心。然后我查询了一下年初的万倍币dogeking也...
Web 3 音乐项目 Melos 盲盒指南
Melos Studio是基于Web 3.0的音乐NFT社交平台,使用NFT技术将音乐灵感保存下来并可以进行进一步的创作,平台致力于为音乐艺人的生态发展助力,发掘更多富有激情和创作潜力的音乐艺人。Melos以音乐创作为主旋律助力WEB 3.0时代,丰富内容创作者经济生态,打造最适合音乐爱好者的音乐社交平台与音乐元宇宙。 官网公开的投资机构有Binance Labs, Dapper Labs, Multichain Capital, Innovation和NGC Ventures。 Melos 最近增加了盲盒的新功能,以下盲盒操作都是基于测试版,可能和正式版有所区别。购买首先进入盲盒购买页面,可以看到正在进行活动的盲盒项目。如果项目已经结束或者卖完,会显示Sold Out.盲盒列表点击一个具体的盲盒项目进入,下面是盲盒的详细页面。你可以看到盲盒的详细情况,包含了盲盒名称、盲盒剩余数量、盲盒所在的区块链、盲盒的基本介绍、盲盒价格、盲盒活动剩余时间、盲盒制作艺术家介绍、盲盒具体描述、盲盒规则介绍和盲盒系列具体内容。 在Series Content里,可以看到用户最关心的盲盒稀有度介绍和...
如何骨折价领取Link3的WEST
欢迎关注我的推特(twitter.com/SoullessL)和Link3(link3.to/caishen)获取最新的Web3信息分享 这个应该是BNB48的补贴,不确定何时取消,现在币安已经在跟他们讨论让他们取消这个优惠,所以大家注意风险,可以领完把Koge卖了。使用下面的方法只需要消耗原来 20%的gas费就能claim一个Link West token. 1.在Pancake 购买 1Koge 花费8.7u ,Koge 合约地址如下bscscan.com/token/0xe6df05ce8c8301223373cf5b969afcb1498c5528 购买链接🥞 PancakeSwap - Everyone's Favorite DEXTrade, earn, and own crypto on the all-in-one multichain DEXhttps://pancakeswap.finance2.添加 BNB48的RPC到MetamaskBNB Smart Chain Mainnet RPC and Chain settings | ChainL...



我是如何抓住200倍的金土狗 二舅币的
开始事情的起因是昨天早上我起床的时候看关注的微博,发现了一条二舅币跑路的微博。看到这条微博,我突然就来了精神,因为之前二舅在中文社区的热度太高了,而且之前也有过多次归零的币,比如泰坦币、鱿鱼币、luna暴跌以后上微博热搜,上了热搜有了热度就拉几十几百倍。 当然经过我以前多次冲土狗归0的经历,我决定还是慎重一点。然后我就从图片里找到了这个土狗项目的推特(twitter.com/SecondUncle_Dao ),一般有推特的土狗项目算是比较良心。 从推特里我找到了项目的合约地 0x6e7ad49f67a9FA80D50F9659C3FC938296d68B58,找到合约地址以后,我去 avedex.cc/market 这个土狗专用查询网站搜索了一下这个代币的具体信息,发现当时总市值6000u左右,持币地址200人不到,从最高点跌了90%左右,感觉还可以还没被人炒过。 然后去 honeypot.is 根据合约地址查了下是不是蜜罐合约,是不是有明显的漏洞,查了一下虽然不是蜜罐地址,但是买入10%的交易税,卖出11%的交易税还是让我有点担心。然后我查询了一下年初的万倍币dogeking也...
Web 3 音乐项目 Melos 盲盒指南
Melos Studio是基于Web 3.0的音乐NFT社交平台,使用NFT技术将音乐灵感保存下来并可以进行进一步的创作,平台致力于为音乐艺人的生态发展助力,发掘更多富有激情和创作潜力的音乐艺人。Melos以音乐创作为主旋律助力WEB 3.0时代,丰富内容创作者经济生态,打造最适合音乐爱好者的音乐社交平台与音乐元宇宙。 官网公开的投资机构有Binance Labs, Dapper Labs, Multichain Capital, Innovation和NGC Ventures。 Melos 最近增加了盲盒的新功能,以下盲盒操作都是基于测试版,可能和正式版有所区别。购买首先进入盲盒购买页面,可以看到正在进行活动的盲盒项目。如果项目已经结束或者卖完,会显示Sold Out.盲盒列表点击一个具体的盲盒项目进入,下面是盲盒的详细页面。你可以看到盲盒的详细情况,包含了盲盒名称、盲盒剩余数量、盲盒所在的区块链、盲盒的基本介绍、盲盒价格、盲盒活动剩余时间、盲盒制作艺术家介绍、盲盒具体描述、盲盒规则介绍和盲盒系列具体内容。 在Series Content里,可以看到用户最关心的盲盒稀有度介绍和...
如何骨折价领取Link3的WEST
欢迎关注我的推特(twitter.com/SoullessL)和Link3(link3.to/caishen)获取最新的Web3信息分享 这个应该是BNB48的补贴,不确定何时取消,现在币安已经在跟他们讨论让他们取消这个优惠,所以大家注意风险,可以领完把Koge卖了。使用下面的方法只需要消耗原来 20%的gas费就能claim一个Link West token. 1.在Pancake 购买 1Koge 花费8.7u ,Koge 合约地址如下bscscan.com/token/0xe6df05ce8c8301223373cf5b969afcb1498c5528 购买链接🥞 PancakeSwap - Everyone's Favorite DEXTrade, earn, and own crypto on the all-in-one multichain DEXhttps://pancakeswap.finance2.添加 BNB48的RPC到MetamaskBNB Smart Chain Mainnet RPC and Chain settings | ChainL...
Share Dialog
Share Dialog

Subscribe to SoullessL

Subscribe to SoullessL
<100 subscribers
<100 subscribers
原文地址 :https://docs.alchemy.com/docs/how-to-build-an-nft-marketplace-from-scratch
请大家关注我的推特(twitter.com/SoullessL)和Link3(link3.to/caishen),获取最新的Alchemy小白教程。教程汇总链接(jayjiang.gitbook.io/web3book/alchemy-road-to-web3)。
大部分人应该已经添加过了,如果已经添加可以忽略
测试网络信息如下
Network Name: Goerli Test Network
RPC base URL: https://eth-goerli.alchemyapi.io/v2/{INSERT YOUR API KEY}
Chain ID: 5
Block Explorer URL: https://goerli.etherscan.io/
Symbol (Optional): ETH

登录(www.alchemy.com)其中{INSERT YOUR API KEY}需要修改为你的Api Key,如截图所示。


进入Alchemy官方的Github地址(https://github.com/OMGWINNING/NFT-Marketplace-Tutorial),点击Fork按钮,把官方的代码复制到你的Github里。

然后系统就会自动转跳到你的Github页面,像截图里的地方会是你的github名字,我们记录下自己项目的GitHub浏览器地址。
然后通过Gitpod打开项目,在浏览器输入 https://gitpod.io/#https://github.com/你的github名字/NFT-Marketplace-Tutorial 开打项目。

然后等待出现下面的窗口,你可以点击这个Open Browser,来预览我们项目。

然后会出来这样一个窗口,就说明我们的项目加载好了,我图里的图片还没完全加载完,可以忽略。

然后我们回到我们的Terminal窗口,同时按住Ctrl+C,取消程序的运行。

然后我们输入命令 npm install dotenv --save 安装一下dotenv环境

然后在Explorer窗体的空白处点击鼠标右键,弹出一个窗口,选择New File。



文件名字为.env,里面的内容为
REACT_APP_ALCHEMY_API_URL="" REACT_APP_PRIVATE_KEY="" 请记得把””替换成Achemy的Goerli网络的Https部分,而””需要替换成你的Metamask账号的的私钥(这边最好使用一个新的账号,防止私钥泄密,这边使用的账号可以和你领取NFT的账号不一样,所以完全可以使用新的好账号,记得转点测试的ETH到新账号当手续费就行。用完最后记得把你的私钥删除,更安全一点)。 然后我们进入 https://pinata.cloud 注册一个新的账号,然后进入https//app.pinata.cloud/keys,点击New Key,勾选Admin,输入Key name,点击Create Key,创建一个新的Key。在弹出的窗口里,记录对应的 API Key 和 API Secret。 REACT_APP_PINATA_KEY="<YOUR_PINATA_KEY>" REACT_APP_PINATA_SECRET="<YOUR_PINATA_SECRET>" 然后把pinata对应的KEY和SECRET替换""和"",并添加到.env文件里。 最终.env文件如上图所示,但是对应的Key都是你自己的。 贴上整体的.env文件内容,方便大家替换。 REACT_APP_ALCHEMY_API_URL="<YOUR_API_URL>" REACT_APP_PRIVATE_KEY="<YOUR_PRIVATE_KEY>" REACT_APP_PINATA_KEY="<YOUR_PINATA_KEY>" REACT_APP_PINATA_SECRET="<YOUR_PINATA_SECRET>" 然后我们找到hardhat.config.js文件,把里的内容替换为 require("@nomiclabs/hardhat-waffle"); require("@nomiclabs/hardhat-ethers"); const fs = require('fs'); // const infuraId = fs.readFileSync(".infuraid").toString().trim() || ""; require('dotenv').config(); task("accounts", "Prints the list of accounts", async (taskArgs, hre) => { const accounts = await hre.ethers.getSigners(); for (const account of accounts) { console.log(account.address); } }); module.exports = { networks: { goerli: { url: process.env.REACT_APP_ALCHEMY_API_URL, accounts: [process.env.REACT_APP_PRIVATE_KEY] } }, solidity: { version: "0.8.4", settings: { optimizer: { enabled: true, runs: 200 } } } }; 打开Contracts文件夹下面的NFTMarketplace.sol 文件,替换全部内容为 //SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "hardhat/console.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; contract NFTMarketplace is ERC721URIStorage { using Counters for Counters.Counter; //_tokenIds variable has the most recent minted tokenId Counters.Counter private _tokenIds; //Keeps track of the number of items sold on the marketplace Counters.Counter private _itemsSold; //owner is the contract address that created the smart contract address payable owner; //The fee charged by the marketplace to be allowed to list an NFT uint256 listPrice = 0.01 ether; //The structure to store info about a listed token struct ListedToken { uint256 tokenId; address payable owner; address payable seller; uint256 price; bool currentlyListed; } //the event emitted when a token is successfully listed event TokenListedSuccess ( uint256 indexed tokenId, address owner, address seller, uint256 price, bool currentlyListed ); //This mapping maps tokenId to token info and is helpful when retrieving details about a tokenId mapping(uint256 => ListedToken) private idToListedToken; constructor() ERC721("NFTMarketplace", "NFTM") { owner = payable(msg.sender); } function updateListPrice(uint256 _listPrice) public payable { require(owner == msg.sender, "Only owner can update listing price"); listPrice = _listPrice; } function getListPrice() public view returns (uint256) { return listPrice; } function getLatestIdToListedToken() public view returns (ListedToken memory) { uint256 currentTokenId = _tokenIds.current(); return idToListedToken[currentTokenId]; } function getListedTokenForId(uint256 tokenId) public view returns (ListedToken memory) { return idToListedToken[tokenId]; } function getCurrentToken() public view returns (uint256) { return _tokenIds.current(); } //The first time a token is created, it is listed here function createToken(string memory tokenURI, uint256 price) public payable returns (uint) { //Increment the tokenId counter, which is keeping track of the number of minted NFTs _tokenIds.increment(); uint256 newTokenId = _tokenIds.current(); //Mint the NFT with tokenId newTokenId to the address who called createToken _safeMint(msg.sender, newTokenId); //Map the tokenId to the tokenURI (which is an IPFS URL with the NFT metadata) _setTokenURI(newTokenId, tokenURI); //Helper function to update Global variables and emit an event createListedToken(newTokenId, price); return newTokenId; } function createListedToken(uint256 tokenId, uint256 price) private { //Make sure the sender sent enough ETH to pay for listing require(msg.value == listPrice, "Hopefully sending the correct price"); //Just sanity check require(price > 0, "Make sure the price isn't negative"); //Update the mapping of tokenId's to Token details, useful for retrieval functions idToListedToken[tokenId] = ListedToken( tokenId, payable(address(this)), payable(msg.sender), price, true ); _transfer(msg.sender, address(this), tokenId); //Emit the event for successful transfer. The frontend parses this message and updates the end user emit TokenListedSuccess( tokenId, address(this), msg.sender, price, true ); } //This will return all the NFTs currently listed to be sold on the marketplace function getAllNFTs() public view returns (ListedToken[] memory) { uint nftCount = _tokenIds.current(); ListedToken[] memory tokens = new ListedTokenUnsupported embed; uint currentIndex = 0; //at the moment currentlyListed is true for all, if it becomes false in the future we will //filter out currentlyListed == false over here for(uint i=0;i<nftCount;i++) { uint currentId = i + 1; ListedToken storage currentItem = idToListedToken[currentId]; tokens[currentIndex] = currentItem; currentIndex += 1; } //the array 'tokens' has the list of all NFTs in the marketplace return tokens; } //Returns all the NFTs that the current user is owner or seller in function getMyNFTs() public view returns (ListedToken[] memory) { uint totalItemCount = _tokenIds.current(); uint itemCount = 0; uint currentIndex = 0; //Important to get a count of all the NFTs that belong to the user before we can make an array for them for(uint i=0; i < totalItemCount; i++) { if(idToListedToken[i+1].owner == msg.sender || idToListedToken[i+1].seller == msg.sender){ itemCount += 1; } } //Once you have the count of relevant NFTs, create an array then store all the NFTs in it ListedToken[] memory items = new ListedTokenUnsupported embed; for(uint i=0; i < totalItemCount; i++) { if(idToListedToken[i+1].owner == msg.sender || idToListedToken[i+1].seller == msg.sender) { uint currentId = i+1; ListedToken storage currentItem = idToListedToken[currentId]; items[currentIndex] = currentItem; currentIndex += 1; } } return items; } function executeSale(uint256 tokenId) public payable { uint price = idToListedToken[tokenId].price; address seller = idToListedToken[tokenId].seller; require(msg.value == price, "Please submit the asking price in order to complete the purchase"); //update the details of the token idToListedToken[tokenId].currentlyListed = true; idToListedToken[tokenId].seller = payable(msg.sender); _itemsSold.increment(); //Actually transfer the token to the new owner _transfer(address(this), msg.sender, tokenId); //approve the marketplace to sell NFTs on your behalf approve(address(this), tokenId); //Transfer the listing fee to the marketplace creator payable(owner).transfer(listPrice); //Transfer the proceeds from the sale to the seller of the NFT payable(seller).transfer(msg.value); } //We might add a resell token function in the future //In that case, tokens won't be listed by default but users can send a request to actually list a token //Currently NFTs are listed by default } 然后我们打开Terminal,在里面输入 npx hardhat run scripts/deploy.js --network goerli 来部署我们的智能合约到goerli 测试网。 然后我们可以到src文件夹下找到Marketplace.json文件,里面的address就是我们部署的合约地址。然后我们可以通过
原文地址 :https://docs.alchemy.com/docs/how-to-build-an-nft-marketplace-from-scratch
请大家关注我的推特(twitter.com/SoullessL)和Link3(link3.to/caishen),获取最新的Alchemy小白教程。教程汇总链接(jayjiang.gitbook.io/web3book/alchemy-road-to-web3)。
大部分人应该已经添加过了,如果已经添加可以忽略
测试网络信息如下
Network Name: Goerli Test Network
RPC base URL: https://eth-goerli.alchemyapi.io/v2/{INSERT YOUR API KEY}
Chain ID: 5
Block Explorer URL: https://goerli.etherscan.io/
Symbol (Optional): ETH

登录(www.alchemy.com)其中{INSERT YOUR API KEY}需要修改为你的Api Key,如截图所示。


进入Alchemy官方的Github地址(https://github.com/OMGWINNING/NFT-Marketplace-Tutorial),点击Fork按钮,把官方的代码复制到你的Github里。

然后系统就会自动转跳到你的Github页面,像截图里的地方会是你的github名字,我们记录下自己项目的GitHub浏览器地址。
然后通过Gitpod打开项目,在浏览器输入 https://gitpod.io/#https://github.com/你的github名字/NFT-Marketplace-Tutorial 开打项目。

然后等待出现下面的窗口,你可以点击这个Open Browser,来预览我们项目。

然后会出来这样一个窗口,就说明我们的项目加载好了,我图里的图片还没完全加载完,可以忽略。

然后我们回到我们的Terminal窗口,同时按住Ctrl+C,取消程序的运行。

然后我们输入命令 npm install dotenv --save 安装一下dotenv环境

然后在Explorer窗体的空白处点击鼠标右键,弹出一个窗口,选择New File。



文件名字为.env,里面的内容为
REACT_APP_ALCHEMY_API_URL="" REACT_APP_PRIVATE_KEY="" 请记得把””替换成Achemy的Goerli网络的Https部分,而””需要替换成你的Metamask账号的的私钥(这边最好使用一个新的账号,防止私钥泄密,这边使用的账号可以和你领取NFT的账号不一样,所以完全可以使用新的好账号,记得转点测试的ETH到新账号当手续费就行。用完最后记得把你的私钥删除,更安全一点)。 然后我们进入 https://pinata.cloud 注册一个新的账号,然后进入https//app.pinata.cloud/keys,点击New Key,勾选Admin,输入Key name,点击Create Key,创建一个新的Key。在弹出的窗口里,记录对应的 API Key 和 API Secret。 REACT_APP_PINATA_KEY="<YOUR_PINATA_KEY>" REACT_APP_PINATA_SECRET="<YOUR_PINATA_SECRET>" 然后把pinata对应的KEY和SECRET替换""和"",并添加到.env文件里。 最终.env文件如上图所示,但是对应的Key都是你自己的。 贴上整体的.env文件内容,方便大家替换。 REACT_APP_ALCHEMY_API_URL="<YOUR_API_URL>" REACT_APP_PRIVATE_KEY="<YOUR_PRIVATE_KEY>" REACT_APP_PINATA_KEY="<YOUR_PINATA_KEY>" REACT_APP_PINATA_SECRET="<YOUR_PINATA_SECRET>" 然后我们找到hardhat.config.js文件,把里的内容替换为 require("@nomiclabs/hardhat-waffle"); require("@nomiclabs/hardhat-ethers"); const fs = require('fs'); // const infuraId = fs.readFileSync(".infuraid").toString().trim() || ""; require('dotenv').config(); task("accounts", "Prints the list of accounts", async (taskArgs, hre) => { const accounts = await hre.ethers.getSigners(); for (const account of accounts) { console.log(account.address); } }); module.exports = { networks: { goerli: { url: process.env.REACT_APP_ALCHEMY_API_URL, accounts: [process.env.REACT_APP_PRIVATE_KEY] } }, solidity: { version: "0.8.4", settings: { optimizer: { enabled: true, runs: 200 } } } }; 打开Contracts文件夹下面的NFTMarketplace.sol 文件,替换全部内容为 //SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "hardhat/console.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; contract NFTMarketplace is ERC721URIStorage { using Counters for Counters.Counter; //_tokenIds variable has the most recent minted tokenId Counters.Counter private _tokenIds; //Keeps track of the number of items sold on the marketplace Counters.Counter private _itemsSold; //owner is the contract address that created the smart contract address payable owner; //The fee charged by the marketplace to be allowed to list an NFT uint256 listPrice = 0.01 ether; //The structure to store info about a listed token struct ListedToken { uint256 tokenId; address payable owner; address payable seller; uint256 price; bool currentlyListed; } //the event emitted when a token is successfully listed event TokenListedSuccess ( uint256 indexed tokenId, address owner, address seller, uint256 price, bool currentlyListed ); //This mapping maps tokenId to token info and is helpful when retrieving details about a tokenId mapping(uint256 => ListedToken) private idToListedToken; constructor() ERC721("NFTMarketplace", "NFTM") { owner = payable(msg.sender); } function updateListPrice(uint256 _listPrice) public payable { require(owner == msg.sender, "Only owner can update listing price"); listPrice = _listPrice; } function getListPrice() public view returns (uint256) { return listPrice; } function getLatestIdToListedToken() public view returns (ListedToken memory) { uint256 currentTokenId = _tokenIds.current(); return idToListedToken[currentTokenId]; } function getListedTokenForId(uint256 tokenId) public view returns (ListedToken memory) { return idToListedToken[tokenId]; } function getCurrentToken() public view returns (uint256) { return _tokenIds.current(); } //The first time a token is created, it is listed here function createToken(string memory tokenURI, uint256 price) public payable returns (uint) { //Increment the tokenId counter, which is keeping track of the number of minted NFTs _tokenIds.increment(); uint256 newTokenId = _tokenIds.current(); //Mint the NFT with tokenId newTokenId to the address who called createToken _safeMint(msg.sender, newTokenId); //Map the tokenId to the tokenURI (which is an IPFS URL with the NFT metadata) _setTokenURI(newTokenId, tokenURI); //Helper function to update Global variables and emit an event createListedToken(newTokenId, price); return newTokenId; } function createListedToken(uint256 tokenId, uint256 price) private { //Make sure the sender sent enough ETH to pay for listing require(msg.value == listPrice, "Hopefully sending the correct price"); //Just sanity check require(price > 0, "Make sure the price isn't negative"); //Update the mapping of tokenId's to Token details, useful for retrieval functions idToListedToken[tokenId] = ListedToken( tokenId, payable(address(this)), payable(msg.sender), price, true ); _transfer(msg.sender, address(this), tokenId); //Emit the event for successful transfer. The frontend parses this message and updates the end user emit TokenListedSuccess( tokenId, address(this), msg.sender, price, true ); } //This will return all the NFTs currently listed to be sold on the marketplace function getAllNFTs() public view returns (ListedToken[] memory) { uint nftCount = _tokenIds.current(); ListedToken[] memory tokens = new ListedTokenUnsupported embed; uint currentIndex = 0; //at the moment currentlyListed is true for all, if it becomes false in the future we will //filter out currentlyListed == false over here for(uint i=0;i<nftCount;i++) { uint currentId = i + 1; ListedToken storage currentItem = idToListedToken[currentId]; tokens[currentIndex] = currentItem; currentIndex += 1; } //the array 'tokens' has the list of all NFTs in the marketplace return tokens; } //Returns all the NFTs that the current user is owner or seller in function getMyNFTs() public view returns (ListedToken[] memory) { uint totalItemCount = _tokenIds.current(); uint itemCount = 0; uint currentIndex = 0; //Important to get a count of all the NFTs that belong to the user before we can make an array for them for(uint i=0; i < totalItemCount; i++) { if(idToListedToken[i+1].owner == msg.sender || idToListedToken[i+1].seller == msg.sender){ itemCount += 1; } } //Once you have the count of relevant NFTs, create an array then store all the NFTs in it ListedToken[] memory items = new ListedTokenUnsupported embed; for(uint i=0; i < totalItemCount; i++) { if(idToListedToken[i+1].owner == msg.sender || idToListedToken[i+1].seller == msg.sender) { uint currentId = i+1; ListedToken storage currentItem = idToListedToken[currentId]; items[currentIndex] = currentItem; currentIndex += 1; } } return items; } function executeSale(uint256 tokenId) public payable { uint price = idToListedToken[tokenId].price; address seller = idToListedToken[tokenId].seller; require(msg.value == price, "Please submit the asking price in order to complete the purchase"); //update the details of the token idToListedToken[tokenId].currentlyListed = true; idToListedToken[tokenId].seller = payable(msg.sender); _itemsSold.increment(); //Actually transfer the token to the new owner _transfer(address(this), msg.sender, tokenId); //approve the marketplace to sell NFTs on your behalf approve(address(this), tokenId); //Transfer the listing fee to the marketplace creator payable(owner).transfer(listPrice); //Transfer the proceeds from the sale to the seller of the NFT payable(seller).transfer(msg.value); } //We might add a resell token function in the future //In that case, tokens won't be listed by default but users can send a request to actually list a token //Currently NFTs are listed by default } 然后我们打开Terminal,在里面输入 npx hardhat run scripts/deploy.js --network goerli 来部署我们的智能合约到goerli 测试网。 然后我们可以到src文件夹下找到Marketplace.json文件,里面的address就是我们部署的合约地址。然后我们可以通过
No activity yet