zl程序教程

您现在的位置是:首页 >  其他

当前栏目

NFT铸造分红交易平台开发部署方案

部署开发 方案 NFT 分红 交易平台 铸造
2023-06-13 09:14:42 时间

Web3 社区对于非同质化带币(NFT)充满了期待。尽管还没有杀手级应用的出现,但是这项技术已经重塑了数字资产所有权,身份体系,创新范式和社区运作方式。因为 NFT 是可以被买卖交易的数字资产,而 NFT 交易所收集了 NFT 的信息并且撮合了买家和卖家,所以 NFT 交易所是生态中一个必不可少的部分

如果你现在不想部署在测试网或者主网上,那就复制下面的配置文件。我后面将会将这个文件称作“Hardhat Config”,别忘了 export 这个对象(module.exports = {defaultNetwork: {...} } )。这个对象有项目的配置信息,能够定义默认,hardhat 和本地网络。

require("@nomiclabs/hardhat-waffle");
require("@nomiclabs/hardhat-etherscan");
require("hardhat-deploy");
require("solidity-coverage");
require("hardhat-contract-sizer");
require("dotenv").config();

module.exports = {
  defaultNetwork: "hardhat",
  networks: {
    hardhat: {
      chainId: 31337,
    },
    localhost: {
      chainId: 31337,
    },
  },
  namedAccounts: {
    deployer: {
      default: 0, // here this will by default take the first account as deployer
      1: 0, // similarly on mainnet (network 1) it will take the first
//account as deployer. Note though that depending on how hardhat network are 
//configured, the account 0 on one network can be different than on another
    },
  },
  solidity: {
    compilers: [
      {
        version: "0.8.7",
      },
      {
        version: "0.4.24",
      },
    ],
  },
  mocha: {
    timeout: 200000, // 200 seconds max for running tests
  },
};

现在,你的项目会有以下文件夹:

  1. Contracts 文件夹,这里有我们 NFT 交易所的逻辑和 NFT 样例合约。
  2. deploy 文件夹,这里有 hardhat-deploy plugin 和部署脚本,它们可以编译智能合约并且部署在 Hardhat 提供的本地区块链中。
  3. scripts 文件夹,这里有一些脚本文件,用来和部署在本地的 Hardhat 开发环境中的智能合约交互。