maxgfaraday / babydex

Learning Solidity Through Mini Dex Project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

To setup an Ethereum smart contract project:


Tools you will need:

Install node

  • %> brew install node (This will give you the npm command)

Install the project tools for Ethereum development

%> npm install truffle -g
%> npm install -g ganache-cli

Regarding Ganache for a nicer UI install the tool from the Ganache site


Now, set up your project (Here are the commands….)

%> mkdir <project>
%> cd <project>
%> cp ~/.gitignore_truffle ./.gitignore
%> cp ~/.header_6thcolumn ./.header
%> git init
%> npm init
%> truffle init
%> npm install @openzeppelin/contracts
%> emacs truffle-config (change “solc:” stanza “version” to “0.8.0”)
%> git add .
%> git commit -am “initial commit”

(note: we are ignoring all the openzeppelin code under node_modules)

Now you are ready to start writing your smart contract!

Edit/create the appropriate migrations file(s), compile and run:

%> truffle compile
%> truffle develop

The last command will launch a local faux Ethereum node and give you an interactive prompt to hold context for the locally deployed contract. At the prompt you can run "migrate" to build and (re)deploy your contract (Use the --reset flag with migrate when you want to force a clean rebuild)

In the interactive environment you can run migrate and then get a handle to the deployed contract and make calls against it

let instance myContract = await MyContract.deployed();
myContract.foo();

Remember that you can't let more than once.


We will write our own DEX!

Final Project

Notes:

About

Learning Solidity Through Mini Dex Project


Languages

Language:JavaScript 67.4%Language:Solidity 32.6%