Reading Assignment: Truffle Migrations

  1. Javascript files which are helping to deploy contracts at Ethereum network.

  2. Interacting with the contracts.

  3. It sets the owner of the contracts being migrated, provides ,methods used by truffle to upgrade a previously deployed contract.

  4. deployer.deploy

1 Like
  1. Migrations are javascript files that help deploy contracts to the Ethereum network

  2. artifacts.require() tells Truffle which contracts to interact with in the deployment script

  3. Migrations.sol keeps track of migrations with the last_completed_migration variable

  4. The deployer.deploy function deploys the contract

1 Like
  1. What are migrations?
    Migrations are javascript files that help you to deploy contracts to the Ethereum blockchain.

  2. What does the function artifacts.require() do?
    It loads in our contract so that we can use it and the data in our project.

  3. Take a look at the Migrations.sol contract, what does it do?
    It make sure that the address of the owner is the same as the address of the sender, and makes sure that the last completed migration was actually completed.

  4. What function should we run when we want to deploy a contract from inside the migrations file?
    deployer.deploy(Migrations);

1 Like

1. What are migrations?
JS files that define the details of deployment.

2. What does the function artifacts.require() do?
This method returns a contract abstraction that can be used during migration.

3. Take a look at the Migrations.sol contract, what does it do?
It keeps track of the last completed migration, which is important when upgrades are performed.

4. What function should we run when we want to deploy a contract from inside the migrations file?
deployer.deploy()

2 Likes
  1. Migrations are JavaScript files that help you deploy contracts to the Ethereum network.
  2. At the beginning of the migration, we tell Truffle which contracts we’d like to interact with via the artifacts.require() method.
  3. It allows migrations to be set and upgraded by the owner of the contract while keeping record of the last completed migration.
  4. deployer.deploy(A);
2 Likes

1. What are migrations?
Migrations are JavaScript files that helps deploying contracts to the Ethereum network. These files stage the deployment tasks that a person wants to do.

2. What does the function artifacts.require() do?
with artifacts.require() you specify which contracts you want to use. Not the filename because you can have more than one contract in the same file and this messes up the process.

3. Take a look at the Migrations.sol contract, what does it do?
the Migrations.sol contract sets the owner of the contracts being migrated, sets restrictions so only the owner can upgrade and it sets the signature of the last completed migration.

4. What function should we run when we want to deploy a contract from inside the migrations file?

deployer.deploy(contract, args..., options)
1 Like
  1. Migrations are javascript programs that deploy smart contracts.

  2. It returns an abstraction of the contract that we can use in the deployment script.

  3. It tracks the last completed migration and provides a modifier that makes only the deployer address able to use a function.

4. deployer.deploy(contract);

1. What are migrations?
JavaScript that help deploy contracts to the Ethereum network. 
2. What does the function artifacts.require() do?
A function that returns a contract abstraction that we can use within the rest of our deployment script. 
3. Take a look at the Migrations.sol contract, what does it do?
It’s a contract that allows developers to access Migration features. This contract always contains:
	a. last_completed_migration
	b. setCompleted
	c. upgrade
It tells us when  last completed migration,  tells when the migration is complete and,  allows the owner of the contract to edit. 
4. What function should we run when we want to deploy a contract from inside the migrations file?
Deployer 
Example:
// Deploy A, then deploy B, passing in A's newly deployed address

deployer.deploy(A).then(function() {
return deployer.deploy(B, A.address);
});

1 Like

pls @filip why should I be having a error message while migrating saying “ContractName” – Invalid number of parameters for " undefined". Got 0 expected 3!..below is the screenshot of the console 1624127623084461701059717960654

I’ll appreciate quick response pls…

Hey @Phaxsam, hope you are ok.

Based on your screenshot, you might have forgot to add the parameters in the “weGrow” function in your test or contract (maybe another function call it and does not contain the proper parameters). Would be nice to review the code also :face_with_monocle:

Carlos Z

thanks bro…resolved

1 Like

1- Migrations are JavaScript files that help you deploy contracts to the Ethereum network.

2- It points out the contract we would like to deploy.

3- It stores the last_completed_migration number, so that we can deploy our contract step by step.

4- deployer.deploy(A);

1 Like

1. What are migrations?
Migrations are a set of managed deployment scripts.

*2. What does the function artifacts.require() do? **
artifacts.require() is a function that returns a contract abstraction that can be used withing the deployement script.

3. Take a look at the Migrations.sol contract, what does it do?
It establishes the owner, provides info about the migration completion and the last_completed_migration.

4. What function should we run when we want to deploy a contract from inside the migrations file?
deployer.deploy()

1 Like

:one: What are migrations?

Migration files exist to help a developer deploy contracts to a network, and can be modified accordingly.
Migrations are essentially a set of JavaScript files which run through multiple workflows and can contain conditional statements such as,

if (network == mainnet) {
  // Do Mainnet Stuff
} else {
  // Do Testnet Stuff
}

They can work asynchronously by deploying a contract to a network, waiting for a response (such as a contract address) and using output to effect following migrations of contracts which depend on prior migrations.

:two: What does the function artifacts.require() do?

artifacts.require() import a contract from the workspace and assign it to a variable so that the instance of the import can be easily accessed in the module.exports where the deployment of the contracts generally take place.

:three: Take a look at the Migrations.sol contract, what does it do?

The Migrations.sol contract comes loaded into Truffle to assist with the management of all the JavaScript migrations files in the migrations folder.

This contract must be migrated first in order to use the overall migrations feature of Truffle.
The Migrations contract can be modified in certain circumstances, however modifications of this contract are generally unnecessary.

:four: What function should we run when we want to deploy a contract from inside the migrations file?

The main function a developer will use to deploy a contract from the migrations file is deployer.deploy(ContractName);.

This base function can take several variations, such as deploying asynchronously, like: await deployer.deploy(ContractName);,

Or including arguments in the deployment for a constructor, like:
await deployer.deploy(ContractName, "TokenName", "Symbol");

1 Like
  1. migrations are jsfiless that are used to deploy a data to a server or local network

  2. artifacts . require is apart of the asyn multithread process. It determines what file is to be associated with the package thats about to be served

  3. a migrations contract sets a contract to a variable so that the deploy function can send it somewher

  4. the function that deploys a contrsct is deployer

4

1 Like
  1. Migrations are deployment instructions written in Javascript.

  2. artifacts.require() imports the artifacts file (implementation of a contract).

  3. Migrations.sol help manage the migrations feature.

  4. When you want to deploy the contract, you run the deployer.deploy() command inside the migrations file.

1 Like
  1. What are migrations?
    -Migrations are Javascript Files that helps you deploy smart contracts
  2. What does the function artifacts.require() do?
    At the beginning of the migration we would like to decide which contract we want to interact with artifacts.require. Then it returns a contract abstraction of our deployment script.
  3. Take a look at the Migrations.sol contract, what does it do?
  • This contract will be deployed initially as the first migration and won’t be updated again. You will also receive this contract by default when creating a new project with truffle init .
  1. What function should we run when we want to deploy a contract from inside the migrations file?
    -deployer.deploy()
1 Like
  1. What are migrations?
    Migrations are javascript files that helps you deploy contracts.
  2. What does the function artifacts.require() do?
    This function returns a contract “abstraction” that we can use with our development script code.
  3. Take a look at the Migrations.sol contract, what does it do?
    It helps to use the migrations for the feature of truffle.
  4. What function should we run when we want to deploy a contract from inside the migrations file?
    deployer.deploy()
1 Like

1. What are migrations?
Migrations are js files that help to deploy contracts to the Ethereum network.

2. What does the function artifacts.require() do?
We tell truffle which contract we want to interact with via artifacts.require(). It takes the contract name as a parameter and returns contract abstraction.

3. Take a look at the Migrations.sol contract, what does it do?
It allows the contract owner to keep track of the last completed migration.

4. What function should we run when we want to deploy a contract from inside the migrations file?
We need a deployer object to stage the deployment task. And the function we need is deploy.
deployer.deploy().

1 Like
  1. What are migrations?
    Javascript files that help us deploy contracts to Ethereum. They are responsible for staging deployment tasks.
  2. What does the function artifacts.require() do?
    Tells Truffle which contracts to interact with, as some contract files may contain more than one contract.
  3. Take a look at the Migrations.sol contract, what does it do?
    Tracks the last completed migration, and creates a modifier that restricts access to the function that tracks the migration.
  4. What function should we run when we want to deploy a contract from inside the migrations file?
    await deployer.deploy(CONTRACT, CONSTRUCTORARGS);
1 Like