Truffle Migrations 目录及 Migration 文件详解

1. 基本介绍

目录功能:存放用于将合约(批量)部署上链的 js 脚本代码
命名习惯:Id_FileName_migration.js
执行顺序:按文件名 Id 由小到大依次执行

2. js 脚本解析

Case 1 : 合约构造函数无需传参


//Case1.1:独立合约 不import其他合约文件 也不继承其他合约


// 导入部署合约
const contractName = artifacts.require(“./contractName”);

//Exports a function that accepts an object called deployer as a parameter. 
//This object acts as an interface between you (the developer) and Truffle's deployment engine
module

猜你喜欢

转载自blog.csdn.net/weixin_45267471/article/details/124944074