OurBank is a simple bank smartcontract written in solidity. Own your finance, own your bank !
- Enroll user
- Deposit Eth
- Withdraw Eth
- Check balance
- Tests included
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!
OurBank requires Node.js v10+ to run.
Install the dependencies and devDependencies and start the server.
npm i
In order to compile the project, open your terminal and run the following command :
truffle compile
In order to run the tests, open your terminal and run the following command :
npm test
NB : make sure to compile before
- 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});
});
});
- run a ganache-cli instance :
ganache-cli -p 8545
- Migrate :
truffle migrate --network development
- Open the truffle console :
truffle console
MIT
Free Software, Hell Yeah!
Join our community :