Building a Dapp Store

From rbachwiki
Jump to navigation Jump to search

Setting up truffle with a boilerplate instead of init also called a box

truffle unbox chainskills/chainskills-box

This download the template from gethub Chainlist.sol

pragma  solidity ^0.4.18;

contract ChainList {
    address seller;
    string name;
    string description;
    uint256 price;

    function sellArticle(string _name, string _description, uint256 _price) public {

        seller = msg.sender;
        name = _name;
        description = _description;
        price = _price;
    }

    function getArticle() public view returns (address _seller, string _name, string _description, uint256 _price) {
        return(seller, name, description, price);

    }

}

A file must be created in the migrations folder to deploy the contract 2_deploy_contracts.js

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

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

Back To Top- Home - Category