Skip to content

gab0071/ICO-BACKEND

Repository files navigation

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.