This repository contains an ERC-20 SafeBay token
and crowdsale Dapp (ICO
) for investing in tokens.
ERC-20 SafeBay token is our utility token that allows users to interact with our web app https://stark-cliffs-51978.herokuapp.com/home
In order to invest in ICO, investor must first register on the landing page, after which they will have to go through the KYC and AML process. Once KYC is completed and their address has been whitelisted, they can invest in the ICO by purchasing the tokens, either on the web app of by dirrecly sending the funds to the crowdsale smart contract address. In the meantime, they may check the KYC process on the status page, until admins whitelist them from the admin page.
Described Dapp is implemented with ReactJS, with Material-UI on top. For working with ethereum blockchain, Truffle was used with React Truffle Box boilerplate and MetaMask for interacting with Dapp. OppenZeppelin was used as a reference for smart conract implementation and Firebase for hosting the database.
-
Investor registers for the ICO on the Landing Page by specifying necessary details, including his/her address which will be used to transfer the funds to invest in the tokens.
He/she is redirected on the Status page, where they can check the KYC process. Once the process is completed, they would be able to purchase the tokens.
-
After that the token issuance team will go through KYC/AML process for each investor request and and approve/disapprove investors to participate in crowdsale.
From Admin Dashboard they will whitelist/revoke investor addresses on the KYC contract. Crowdsale contract communicates with KYC contract to know which addresses are approved to purchase the tokens.
-
One the KYC process is completed, and investor's address has been whitelisted, ivestor will able to purchase the SafeBay tokens either by directly sendign funds to the crowdsale cotract or from the web app.
In this repository you may find:
truffle-config.js
file - contains solidity compiler version and different networks to migrate the contracts to.contracts
directory - contains smart contracts for Dapp:Crowdsale.sol
- Crowdsale contract from the OpenZeppelin.SafeBayToken
- Contract extending ERC20 contract from the OpenZeppelin.SafeBayTokenSale.sol
- Contract extending the Crowdsale contract.KYCContract.sol
- KCY contract to store approved addresses.Migrations.sol
- Migrations contract.
test
directory - contains unit tests for the smart contracts.migrations
directory - contains migration files for smart contracts.client
directory - contains ReactJS app.
NodeJS version: v10.15.0
.
Solidity compiler version: v0.6.6
.
Truffle: v5.1.40
.
Setting up and running the application :
- Install truffle:
npm install truffle -g
- Install npm moduls:
npm install
in the root directory (for truffle and unit tests)cd client
&npm install
(for ReactJS app)
- Start
Ganache
and update truffle-config file if necessary with the network parameters. - Compile and migrate smart contracts to the local blockchain (from truffle console):
truffle migrate --network "development/ganache-local" --reset
. - Start react app:
cd client
&npm start
.
To test the smart contracts:
- In the root directory:
truffle test
.