Coder Social home page Coder Social logo

gab0071 / ico-backend Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 161 KB

ICO Project!

License: MIT License

JavaScript 56.89% Solidity 43.11%
ethereum-contract etherscan-api goerli-network ico metamask-wallet openzeppelin-contracts solidity-contracts

ico-backend's Introduction

ICO (Initial Coin Offering) BACKEND ๐Ÿ‘ทโ€โ™‚๏ธโ›“

Badge showing project license type Badge showing the solidity version Badge showing the hardhat version Author

This contract is an ERC20 token contract that allows users to mint (create and add to circulation) new tokens by sending a certain amount of Ether to the contract. It also has a function that allows users to claim tokens based on the number of non-fungible tokens (NFTs) they own.

When a user calls the following functions the contract will do:

  • claim: the contract checks the number of NFTs the user owns and mints a certain number of tokens for each NFT.

  • Ownable: means it has an owner variable that stores the address of the contract owner and functions that allow the owner to transfer ownership or withdraw any Ether that has been sent to the contract.

  • maxTotalSupply: variable that limits the total number of tokens that can be minted to 10000.

  • mint: the contract checks that the total number of tokens in circulation plus the number of tokens being minted does not exceed the maxTotalSupply. If it does, the transaction is reverted.

  • tokenPrice: variable that specifies the price of one token in Ether. When a user calls the mint function, the contract checks that the value of Ether sent with the transaction is equal to or greater than the tokenPrice multiplied by the number of tokens being minted. If it is not, the transaction is reverted.

  • mapping: that is used to keep track of which NFT token IDs have been claimed for tokens. This mapping is used in the claim function to ensure that a user cannot claim tokens for the same NFT more than once.

It was a fun and very interesting project because we connected two contracts through the ICryptoDvs.sol (this allowed us to save gas and only access the function that we required for this project) and we developed more logic to work with NFTs.

The frontend code you can find it here.


Installing / Getting started

# Clone this project
$ git clone https://github.com/gab0071/ICO-BACKEND

# Access
$ cd ICO-BACKEND

# Install dependencies
$ npm install

Commands

  • $ npx hardhat compile
  • $ npx hardhat run scripts/deploy.js
  • $ npx hardhat verify --constructor-args args.js DEPLOYED_CONTRACT_ADDRESS --network goerli

Technologies / Built With

License

This project is under license from MIT. For more details, see the LICENSE file.

Contributing

Contributions are always welcome! Open a PR or an issue!


Made with โค๏ธ by catellaTech.

ico-backend's People

Contributors

gab0071 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

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.