Code Monkey home page Code Monkey logo

degentoken's Introduction

DegenToken

DegenToken is a Solidity smart contract that implements an ERC20 token called "Degen" (symbol: "DGN"). The contract provides functionality for minting new tokens, transferring tokens, redeeming tokens for in-game store items, checking token balance, and burning tokens.

Features

  1. Minting new tokens: The mint function allows the contract owner to create new tokens and distribute them to players as rewards. Only the contract owner can call this function.

  2. Transferring tokens: The transferTokens function enables players to transfer their tokens to other addresses. The function requires the sender to have a sufficient balance of Degen tokens to complete the transfer.

  3. Redeeming tokens: The redeemTokens function allows players to redeem their tokens for items in the in-game store. Players can choose from three available options: an official Degen NFT, a Degen T-Shirt, or OG status in the Degen Discord. The function verifies that the sender has enough tokens for the selected item before initiating the transfer to the contract owner.

  4. Checking token balance: The getBalance function allows players to check their token balance at any time. It returns the token balance of the caller.

  5. Burning tokens: The burnTokens function enables anyone to burn their own tokens that are no longer needed. This permanently removes the tokens from circulation.

Usage

  1. Deploy the DegenToken contract on the Avalanche Fuji network.

  2. Call the mint function as the contract owner to create new tokens and distribute them to players as rewards.

  3. Players can transfer their tokens to others by calling the transferTokens function and providing the receiver's address and the amount of tokens to transfer.

  4. To redeem tokens for items in the in-game store, players should call the redeemTokens function and provide the selection number of the desired item. The function verifies the token balance and initiates the transfer to the contract owner if the requirements are met.

  5. To check the token balance, players can call the getBalance function, which returns the token balance of the caller.

  6. If players no longer need their tokens, they can burn them by calling the burnTokens function. This permanently removes the tokens from circulation.

Note: Ensure that the necessary dependencies are imported into the project. This code imports contracts from the OpenZeppelin library (ERC20.sol, Ownable.sol, ERC20Burnable.sol).

License

This code is licensed under the MIT License.

degentoken's People

Contributors

crgold avatar

Watchers

 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.