Difference between revisions of "Building a Dapp Store"
Jump to navigation
Jump to search
(One intermediate revision by the same user not shown) | |||
Line 3: | Line 3: | ||
truffle unbox chainskills/chainskills-box | truffle unbox chainskills/chainskills-box | ||
This download the template from gethub | This download the template from gethub | ||
Chainlist.sol | |||
<pre> | |||
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); | |||
} | |||
} | |||
</pre> | |||
A file must be created in the migrations folder to deploy the contract | |||
2_deploy_contracts.js | |||
<pre> | |||
var ChainList = artifacts.require("./ChainList.sol"); | |||
module.exports = function(deployer){ | |||
deployer.deploy(ChainList); | |||
} | |||
</pre> | |||
==[[#top|Back To Top]]-[[Main_Page| Home]] - [[Solidity_ethereum_Language|Category]]== | ==[[#top|Back To Top]]-[[Main_Page| Home]] - [[Solidity_ethereum_Language|Category]]== |
Latest revision as of 00:33, 16 March 2018
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); }