1

I am beginner in solidity.I need these code with total setup.

  1. Type: ERC20/BEP20
  2. SUPPLY: FIXED
  3. TOKEN NAME & SYMBOL: my token (MYT)
  4. Total supply: 15B
  5. Token distribution a. 5% Dev wallet (0xdwxxxxxxxxxxxxxxx) b. 5% Marketing wallet (0xmwxxxxxxxx)
  6. Decimal: 18
  7. Fees: 3% 1% buy fee: It will go to marketing Wallet as ETH 2% sell fee: it will go to LP as ETH
  8. Limit: a. Maximum buy Limit per transaction: 0.05% b. Maximum holding amount per wallet: 0.05%
  9. Renounce ownership: No….
  10. Liquidity: Auto generator token from sell fees
  11. Trading pair: USDT USDC WBNB
3
  • Is this a free lance project? Commented Jun 9, 2023 at 14:42
  • 1
    Im trying to learn step by step....
    – EAGLE
    Commented Jun 9, 2023 at 15:50
  • Okay, that's great Commented Jun 10, 2023 at 5:46

1 Answer 1

1

You should do a basic implementation of an ERC20 token with the specified requirements using Solidity and the OpenZeppelin library.

To set up your development environment:

  • Install Node.js: Download and install Node.js from https://nodejs.org/.
  • Install Hardhat: Open a terminal and run the following command to install Hardhat globally:

npm install -g hardhat

  • Create a new Hardhat project:

mkdir my-token && cd my-token npx hardhat

  • Install OpenZeppelin Contracts:

npm install @openzeppelin/contracts

Now, you can create your custom token contract: Create a new file named MyToken.sol in the contracts folder:

// contracts/MyToken.sol

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract MyToken is ERC20, Ownable {
    address public marketingWallet;
    address public devWallet;

    constructor(address _marketingWallet, address _devWallet) ERC20("My Token", "MYT") {
        require(_marketingWallet != address(0) && _devWallet != address(0), "Invalid wallet addresses");

        marketingWallet = _marketingWallet;
        devWallet = _devWallet;

        uint256 totalSupply = 15 * 10**9 * 10**18; // 15 billion tokens with 18 decimals
        uint256 devTokens = (totalSupply * 5) / 100; // 5% for dev wallet
        uint256 marketingTokens = (totalSupply * 5) / 100; // 5% for marketing wallet

        _mint(devWallet, devTokens);
        _mint(marketingWallet, marketingTokens);
        _mint(msg.sender, totalSupply - devTokens - marketingTokens);
    }

    function _transfer(address sender, address recipient, uint256 amount) internal override {
        // Implement your custom fees and limits logic here

        super._transfer(sender, recipient, amount);
    }
}

This is a basic implementation of your token. You'll need to add the custom fees and limits logic in the _transfer function. You can also add the auto liquidity generation and trading pair features as needed.

  • Compile the contract:

npx hardhat compile

  • Deploy the contract: Create a new file named deploy.js in the scripts folder:

// scripts/deploy.js

async function main() {
    const [deployer] = await ethers.getSigners();

    console.log("Deploying contracts with the account:", deployer.address);

    const MyToken = await ethers.getContractFactory("MyToken");
    const myToken = await MyToken.deploy("0xMarketingWalletAddress", "0xDevWalletAddress");

    console.log("MyToken address:", myToken.address);
}

main()
    .then(() => process.exit(0))
    .catch((error) => {
        console.error(error);
        process.exit(1);
    });

Replace 0xMarketingWalletAddress and 0xDevWalletAddress with the actual wallet addresses.

  • Add a local network to your hardhat.config.js:

    module.exports = { networks: { hardhat: { chainId: 1337, }, }, solidity: "0.8.4", };

  • Run a local Hardhat node:

    npx hardhat node

  • Deploy the contract to the local network:

    npx hardhat run --network hardhat scripts/deploy.js

This will give you a basic implementation of your token. You can further customize it by adding the required fees, limits, and other features as needed.

2
  • lots of thanks for reply , may I have your Telegram ID or email address....?
    – EAGLE
    Commented Jun 9, 2023 at 15:48
  • if you satisfy with my answer, would you mind to vote this answer? and my email address is [email protected] , telegram id: shinji_eth thanks Commented Jun 10, 2023 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.