Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OurBank

Own your bank, DIY, powered by blockchain

OurBank is a simple bank smartcontract written in solidity. Own your finance, own your bank !

Features

  • Enroll user
  • Deposit Eth
  • Withdraw Eth
  • Check balance
  • Tests included

Tech

OurBank uses a number of open source projects to work properly:

  • truffle - The most popular development framework for Ethereum with a mission to make your life a whole lot easier !
  • web3.js - web3.js is a collection of libraries that allow you to interact with a local or remote ethereum node using HTTP, IPC or WebSocket.
  • ganache - Quickly fire up a personal Ethereum blockchain which you can use to run tests, execute commands, and inspect state while controlling how the chain operates.
  • solidity - Solidity is an object-oriented, high-level language for implementing smart contracts.
  • mochajs - Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple and fun.
  • chai - Chai is a BDD / TDD assertion library for node and the browser that can be delightfully paired with any javascript testing framework.
  • Openzeppelin Test Environment - Blazing fast smart contract testing. One-line setup for an awesome testing experience.
  • Openzeppelin Test Helpers - Assertion library for Ethereum smart contract testing. Make sure your contracts behave as expected!

Installation

OurBank requires Node.js v10+ to run.

Install the dependencies and devDependencies and start the server.

npm i

Compile the project

In order to compile the project, open your terminal and run the following command :

truffle compile

Run tests

In order to run the tests, open your terminal and run the following command :

npm test

NB : make sure to compile before

Useful testing snippets

  • Test files headers
const { accounts, contract } = require('@openzeppelin/test-environment');
const Web3 = require('web3');
const { assert } = require('chai');
const { expectRevert, expectEvent, balance } = require('@openzeppelin/test-helpers');
const OurBank = contract.fromArtifact('OurBank'); // Loads a compiled contract

const ether = 10 ** 18; // 1 ether = 1000000000000000000 wei
const [owner, alice, bob] = accounts;
const OurBank = contract.fromArtifact('OurBank'); // Loads a compiled contract
  • Empty test body
describe("OurBank", () => {
    it("should check something", async () => {
    });
});
  • Deploy an instance of our contract
//const OurBank = contract.fromArtifact('OurBank');
describe("OurBank", () => {
    it("should check something", async () => {
        const bank = OurBank.new({from: owner});
    });
});

Deploy on Ganache-CLI

  1. run a ganache-cli instance :
ganache-cli -p 8545
  1. Migrate :
truffle migrate --network development
  1. Open the truffle console :
truffle console

License

MIT

Free Software, Hell Yeah!

Join our community :

About

Project created for the solidity masterclass

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages