Giter VIP home page Giter VIP logo

dapp-token-ico's Introduction

Welcome to dapp-token-ico ๐Ÿ‘‹

Version License: MIT Twitter: jellydn

Opinionated Dapp Starter Template

๐Ÿ  Homepage

โœจ Demo

Blockchain - DApp 101 - ICO Smart Contract

One click deployment

Deploy on Railway

Screenshot

./screenshot.png

Connect to MetaMask

https://gyazo.com/73e88806e52c1b70211dd4911bf5a4af.gif

Buy tokens

Place an order https://gyazo.com/d6361cc2a18ca3140f2aa9b09fc385ca.gif Buy with MetaMask and wait for confirmation. https://gyazo.com/924565f84487b15f6c391f7a6378de57.gif

Features

  • โšก๏ธ React TypeScript template with Vite 2
  • ๐Ÿ“ฆ Hardhat - Ethereum development environment for professionals
  • ๐Ÿฆพ TypeChain Hardhat plugin - Automatically generate TypeScript bindings for smartcontracts while using Hardhat.
  • ๐Ÿ”ฅ web3-react - A simple, maximally extensible, dependency minimized framework for building modern Ethereum dApps
  • ๐ŸŽจ daisyUI Tailwind CSS Components - clean HTML with component classes
  • ๐ŸŽจ OpenZeppelin - standard for secure blockchain applications

Install

yarn install

Usage

yarn dev

Run tests

yarn test

ICO Token

Create .env from .env.example from root directory. Remember to fill the value for deployed addresses.

ETHERSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
ROPSTEN_PROVIDER_URL=https://eth-ropsten.alchemyapi.io/v2/<YOUR ALCHEMY KEY>
PRIVATE_KEY=<YOUR PRIVATE KEY>
VITE_CROWDSALE_ADDRESS=<YOUR DEPLOYED SMART CONTRACT ADDRESS>
VITE_PROVIDER_URL=https://eth-ropsten.alchemyapi.io/v2/<YOUR ALCHEMY KEY>

Then deploy to specific network, e.g: Ropsten

npx hardhat run scripts/deploy_itmantokencrowdsale.js --network ropsten

Output:

Generating typings for: 0 artifacts in dir: src/types for target: ethers-v5
Successfully generated 3 typings!
Successfully generated 3 typings for external artifacts!
ITManToken deployed to: 0x58f0A11F8B2bD7c5D9251b620dcF502D3A40FCF2
Name ITManToken
Symbol ITM
Decimals 18
Total Supply BigNumber { _hex: '0xd3c21bcecceda1000000', _isBigNumber: true }
Owner 0x096cd10D7BEF8D5923b18b18E9f79CA230ee2285
openingTime 1630780077
closeTime 1631384877
ITManTokenCrowdsale deployed to: 0x304c476c4521B6d352E76a950581A59Fe2032437

Next step is verifying the IT Man Token

npx hardhat verify --network ropsten 0x58f0A11F8B2bD7c5D9251b620dcF502D3A40FCF2

Output:

Nothing to compile
Generating typings for: 0 artifacts in dir: src/types for target: ethers-v5
Successfully generated 3 typings!
Successfully generated 3 typings for external artifacts!
Compiling 1 file with 0.8.4
Successfully submitted source code for contract
contracts/ITManToken.sol:ITManToken at 0x58f0A11F8B2bD7c5D9251b620dcF502D3A40FCF2
for verification on Etherscan. Waiting for verification result...

Successfully verified contract ITManToken on Etherscan.
https://ropsten.etherscan.io/address/0x58f0A11F8B2bD7c5D9251b620dcF502D3A40FCF2#code

Finally, verify the IT Man Token Crowdsale

npx hardhat verify --network ropsten 0x304c476c4521B6d352E76a950581A59Fe2032437 500 0x096cd10D7BEF8D5923b18b18E9f79CA230ee2285 0x58f0A11F8B2bD7c5D9251b620dcF502D3A40FCF2 0x096cd10D7BEF8D5923b18b18E9f79CA230ee2285 1630780077 1631384877

Output:

Nothing to compile
Generating typings for: 0 artifacts in dir: src/types for target: ethers-v5
Successfully generated 3 typings!
Successfully generated 3 typings for external artifacts!
Compiling 1 file with 0.8.4

... some warnings

Successfully submitted source code for contract
contracts/ITManTokenCrowdsale.sol:ITManTokenCrowdsale at 0x304c476c4521B6d352E76a950581A59Fe2032437
for verification on Etherscan. Waiting for verification result...

Successfully verified contract ITManTokenCrowdsale on Etherscan.
https://ropsten.etherscan.io/address/0x304c476c4521B6d352E76a950581A59Fe2032437#code

Hardhat guideline

This project demonstrates an advanced Hardhat use case, integrating other tools commonly used alongside Hardhat in the ecosystem.

The project comes with a sample contract, a test for that contract, a sample script that deploys that contract, and an example of a task implementation, which simply lists the available accounts. It also comes with a variety of other tools, preconfigured to work with the project code.

Try running some of the following tasks:

npx hardhat accounts
npx hardhat compile --network localhost
npx hardhat clean
npx hardhat test
npx hardhat node
npx hardhat help
REPORT_GAS=true npx hardhat test
npx hardhat coverage
npx hardhat run scripts/deploy_greeter.js --network localhost
node scripts/deploy.js
npx eslint '**/*.js'
npx eslint '**/*.js' --fix
npx prettier '**/*.{json,sol,md}' --check
npx prettier '**/*.{json,sol,md}' --write
npx solhint 'contracts/**/*.sol'
npx solhint 'contracts/**/*.sol' --fix

Etherscan verification

To try out Etherscan verification, you first need to deploy a contract to an Ethereum network that's supported by Etherscan, such as Ropsten.

In this project, copy the .env.example file to a file named .env, and then edit it to fill in the details. Enter your Etherscan API key, your Ropsten node URL (eg from Alchemy), and the private key of the account which will send the deployment transaction. With a valid .env file in place, first deploy your contract:

npx hardhat run --network ropsten scripts/deploy_greeter.js

Then, copy the deployment address and paste it in to replace DEPLOYED_CONTRACT_ADDRESS in this command:

npx hardhat verify --network ropsten DEPLOYED_CONTRACT_ADDRESS "Hello, Hardhat!"

Contract upgrade

OpenZeppelin provides tooling for deploying and securing upgradeable smart contracts.

Smart contracts deployed using OpenZeppelin Upgrades Plugins can be upgraded to modify their code, while preserving their address, state, and balance. This allows you to iteratively add new features to your project, or fix any bugs you may find in production.

In this project, there are a 2 versions of contract: Box and BoxV2 which is improvement of Box. First deploy your contract:

npx hardhat run --network localhost scripts/deploy_upgradeable_box.js

Then, deploy the upgrade smart contract

npx hardhat run --network localhost scripts/upgrade_box.js

Examples

  • Simple Store App: counter-like smart contract, read/write value and listen to event from smart contract.

Author

๐Ÿ‘ค Dung Huynh

Stargazers ๐ŸŒŸ

Stargazers repo roster for jellydn/dapp-token-ico

Show your support

kofi paypal buymeacoffee

Give a โญ๏ธ if this project helped you!

dapp-token-ico's People

Contributors

jellydn avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dapp-token-ico's Issues

Cannot upload on vercel or netift

Describe the bug

I have deployed the contracts on mainnet but cannot be used on thr app. i cant upload the web on vercel or netify, its crashing on build

Reproduction

Deployment

System Info

Error

Used Package Manager

yarn

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Sales with no token

Hello, I follow your project for a while trying to understand the case and implicit assumptions, since there is not much documentation about the possible types of token funding sale events. There are a few training organizations but everyone solves an specific case and does not mention other possibilities.

In particular, I see that your case assumes both, a token and an icotoken, exists. This line in your icotoken requires an existing token https://github.com/jellydn/dapp-token-ico/blob/main/contracts/ITManTokenCrowdsale.sol#L19
also I think your project is designed to be run on mainnet.

However, in theory there is a previous case where the company wants to run a sale event but they do not have a token yet. This case of sale event would be run in a testnet (eg ropsten), funds would be send to the icotoken and after transferred to a wallet and balances will be added by default when the token is after created. I find this token sale case useful when the company has the idea but has not the resources to materialize the idea in a concrete token. I see a big risk creating a token expecting to last for years without change when you do not even have the company funded.

2 examples of the case I refer to:
https://github.com/ValladolidBlockchain/Token-ICO/blob/master/contracts/tokenVallCoin.sol
https://github.com/Vibes-INS/ico-hardhat/blob/master/contracts/Ico.sol
as you can see there is not token inside the icotoken and the only purpose is to transfer to the promoters wallet.

So, where do you thing this case of token sales with not token fit? Is this case covered in your work?

Thanks for sharing you work.

Installation errors

Errors:

warning Error running install script for optional dependency: "/var/www/html/node_modules/node-hid: Command failed. Exit code: 1 Command: prebuild-install || node-gyp rebuild Arguments: Directory: /var/www/html/node_modules/node-hid Output: prebuild-install WARN install No prebuilt binaries found (target=14.19.1 runtime=node arch=x64 libc= platform=linux) gyp info it worked if it ends with ok gyp info using [email protected] gyp info using [email protected] | linux | x64 gyp info find Python using Python version 3.8.10 found at \"/usr/bin/python3\" gyp http GET https://nodejs.org/download/release/v14.19.1/node-v14.19.1-headers.tar.gz gyp http 200 https://nodejs.org/download/release/v14.19.1/node-v14.19.1-headers.tar.gz gyp http GET https://nodejs.org/download/release/v14.19.1/SHASUMS256.txt gyp http 200 https://nodejs.org/download/release/v14.19.1/SHASUMS256.txt gyp info spawn /usr/bin/python3 gyp info spawn args [ gyp info spawn args '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py', gyp info spawn args 'binding.gyp', gyp info spawn args '-f', gyp info spawn args 'make', gyp info spawn args '-I', gyp info spawn args '/var/www/html/node_modules/node-hid/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/root/.cache/node-gyp/14.19.1/include/node/common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/14.19.1', gyp info spawn args '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp', gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/14.19.1/<(target_arch)/node.lib', gyp info spawn args '-Dmodule_root_dir=/var/www/html/node_modules/node-hid', gyp info spawn args '-Dnode_engine=v8', gyp info spawn args '--depth=.', gyp info spawn args '--no-parallel', gyp info spawn args '--generator-output', gyp info spawn args 'build', gyp info spawn args '-Goutput_dir=.' gyp info spawn args ] gyp info spawn make gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ] ../hidapi/linux/hid.c:44:10: fatal error: libudev.h: No such file or directory 44 | #include <libudev.h> | ^~~~~~~~~~~ compilation terminated. make: *** [hidapi-linux-hidraw.target.mk:111: Release/obj.target/hidapi-linux-hidraw/hidapi/linux/hid.o] Error 1 gyp ERR! build error gyp ERR! stack Error: makefailed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23) gyp ERR! stack at ChildProcess.emit (events.js:400:28) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:282:12) gyp ERR! System Linux 5.4.0-29-generic gyp ERR! command \"/usr/bin/node\" \"/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"rebuild\" gyp ERR! cwd /var/www/html/node_modules/node-hid gyp ERR! node -v v14.19.1 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok $ husky install husky - Git hooks installed Done in 402.43s.

Node JS v14.19.1

Please

Hi, sorry for writing here.
Please write the instructions in more detail how to run this app
Thnx

Buy button rate more than 2500

Hi sir

thanks for your job, if you increase the rate to more than 2500 wei in the script the buy button didnt work in the dapp. i tried with 4000 value.

Altough the contract could get directly BNB and make the exchange rate of token in the correct way.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

npm
package.json
  • @tailwindcss/typography 0.5.10
  • @web3-react/core 6.1.9
  • @web3-react/injected-connector 6.0.7
  • @web3-react/network-connector 6.2.9
  • @web3-react/walletconnect-connector 6.2.13
  • daisyui 4.6.0
  • loglevel 1.8.1
  • react 18.2.0
  • react-dom 18.2.0
  • react-hot-toast 2.4.1
  • react-query 4.0.0-beta.23
  • web3-react 5.0.5
  • @nomicfoundation/hardhat-ethers 3.0.5
  • @nomicfoundation/hardhat-verify 2.0.3
  • @nomiclabs/hardhat-ethers 2.2.3
  • @nomiclabs/hardhat-etherscan 3.1.8
  • @nomiclabs/hardhat-waffle 2.0.6
  • @openzeppelin/contracts 4.9.6
  • @openzeppelin/contracts-upgradeable 4.9.5
  • @openzeppelin/hardhat-upgrades 1.28.0
  • @trivago/prettier-plugin-sort-imports 4.3.0
  • @typechain/ethers-v5 11.1.2
  • @typechain/hardhat 9.1.0
  • @types/mocha 10.0.6
  • @types/react 18.2.47
  • @types/react-dom 18.2.18
  • @typescript-eslint/eslint-plugin 6.18.1
  • @typescript-eslint/parser 6.18.1
  • @vitejs/plugin-react-refresh 1.3.6
  • autoprefixer 10.4.16
  • chai 4.4.1
  • dotenv 16.3.1
  • eslint 8.56.0
  • eslint-config-productsway 1.3.1
  • ethereum-waffle 4.0.10
  • ethers 5.7.2
  • hardhat 2.19.4
  • hardhat-gas-reporter 1.0.9
  • husky 8.0.3
  • lint-staged 15.2.0
  • postcss 8.4.33
  • prettier 3.2.2
  • prettier-plugin-solidity 1.3.1
  • rustywind 0.21.0
  • solgraph 1.0.2
  • solhint 4.1.1
  • solidity-coverage 0.8.5
  • sort-package-json 2.6.0
  • tailwindcss 3.4.1
  • typechain 8.3.2
  • typescript 5.3.3
  • vite 5.0.13
  • node >=18.12.0
  • yarn 1.22.21
nvm
.nvmrc

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.