Detailed explanation of Truffle Migrations directory and Migration files

1. Basic introduction

Directory function: Stores js script code used to deploy contracts (batch) on the chain.
Naming habits: Id_FileName_migration.js
Execution order: Execute in order from small to large according to the file name ID.

2. js script analysis

Case 1: The contract constructor does not need to pass parameters


//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

Guess you like

Origin blog.csdn.net/weixin_45267471/article/details/124944074
Recommended