Bank Negara Dapp

Features

General

  • Contract address used as bank.
  • Tests for all contract functions.
  • Strict checks using modifiers.
  • Strict checks in web interface.
  • Different interface for admin and regular customers.
  • Up to date exchange rate via coinbase API.
  • Sample mobile interface built using flutter.

Admin

  • Set Transaction Threshold.
  • Receive alert when transaction is above threshold.
  • Receive alert when the bank has a balance of more than 50 ethers (a case of money laundering).

Users

  • Deposit.
  • Withdraw.

Requirements

Development

  • Compile code via truffle compile
  • Deploy to ganache using truffle migrate --reset
  • truffle console to interact with the deployed contract

Contract Tests

  • Tests are located in the test folder
  • To run tests run truffle test

tests

Deployment

The contract is already deployed to the ropstan test network using infura, to redeploy you need to use the first account from the accounts generated by the seed phrase in truffle-config.json.

more information on how to deploy and interact with contracts on infura in this guide.

  • Deployed contract address: ropstan.
  • Run truffle migrate --network ropstan to deploy to ropstan test network

Web Interface development

There are 2 user interfaces, one for the customer and another for the admin/regulator, which one is loaded depends on the account selected in metamask, if its the first account in ganache then its the admin, o add accounts from ganache to metamask follow this guide.

  • Start the server using npm run dev

Some Notes

  • Refresh the page after changing account in metamask.
  • tailwind.config.js enables tailwind IntelliSense in vscode with the tailwind extension.

Web Interface Preview

Customer

customer

customer2

Admin

admin

Mobile Interface Preview

1
2

Credits

  • Dapp-university for the helpful tutorials and Javascript boilerplate.
  • Google and StackOverflow for always answering my questions.

View Source Code

You might also like

init.nvim

init.nvim

An Opinionated Neovim Config for the Minimalists