Skip to content

Add Contracts

Remove the existing SimpleStorage Smart Contract but leave the "Migrations.sol" file:

Add in our Files:

Then modify the "migration" file in the migrations/ folder:

var ItemManager = artifacts.require("./ItemManager.sol");

module.exports = function(deployer) {
    deployer.deploy(ItemManager);
};

Modify the truffle-config.js file to lock in a specific compiler version:

const path = require("path");

module.exports = {
    // See <http://truffleframework.com/docs/advanced/configuration>
    // to customize your Truffle configuration!
    contracts_build_directory: path.join(__dirname, "client/src/contracts"),
    networks: {
        develop: {
        port: 8545
        }
    },
    compilers: {
        solc: {
        version: "^0.6.0"
        }
    }
};

Compiler Versions

You can choose the version to be an exact version like "0.6.4", or you could add the "^" to specify all versions above greater or equal to 0.6.0, which means, it will download the latest 0.6.x version.

Run the truffle develop console to check if everything is alright and can be migrated. On the terminal/powershell run

truffle develop

and then simply type in

migrate


Last update: April 29, 2022