codedamn

Invest in ICO

Created by Kshitij about a year ago

0

No description provided

4 Comments

    0

    Hello, Thank you for the tutorial. I have a quick question, Since invest function is payable, people can still transfer the amount even if ICO is not in running state. As a precaution should we transfer the amount back to the sender if state is not running. Am I missing something? Example:

       if (currentState != State.running){
            payable(msg.sender).transfer(msg.value);
            return false;
        }
    
    @durgadutt

    durga dutt

    @durgadutt

    0

    I'm inheriting this ICO contract from openzeppelin see: https://ibb.co/kG0HrJc

    I got error in your contract line no. 138. where you store tokens in balances[msg.sender]. But in my case it is problematic also I don't have created any founder variable, I'm just inheritting ERC20 from openzeppelin so what is founder variable in my case?

    see this picture: https://ibb.co/pZzh1KV

    @muhamm643c5e3b

    Muhammad Umair

    @muhamm643c5e3b

    0

    Hello Sir I need help, Please help me in my "Invest Function" that I describe you below

    @muhamm643c5e3b

    Muhammad Umair

    @muhamm643c5e3b

    0

    Yes, I can elaborate. Okay So, Sir Kshitij made this ICO token from their custom ERC20 token and that ERC20 token he made himself. But in my case, I inherited the ERC20 token from Oppenzeppelin's iLibrary (see:

    https://user-images.githubusercontent.com/91899494/241201866-ee96e917-4ffd-4eff-94f1-ed2f79e39959.png

    Then I start making ICO tokens from the inherited ERC20 token.

    Now, when I'm making the Invest Function, I get an error when I add (+) tokens to "balances[msg.sender]" and subtract (-) tokens from the "balances[founder]" variable. see:

    https://user-images.githubusercontent.com/91899494/241201901-0a38e32b-d96e-4479-913e-89abfdf9975c.png

    And when Sir Kshitij makes an ERC20 token, he makes this "balances[founder]" variable. But in my case, I don't touch the ERC20 token and just inherit it from Oppezeppelin.

    @muhamm643c5e3b

    Muhammad Umair

    @muhamm643c5e3b

Your comment