Set the mapping outside of the function and not within the function. mapping(address => uint) public balances; function invest() external payable{ //track address to amount of ether if(msg.value < 1 ether){ revert(); } balances[msg.sender] += msg.value; } function balanceOf() external view returns(uint){ return address(this).balance; }
Julian How do you send money from your Wallet when deploying a Smart Contract or using a Function without using the Remix Value Box which you show around 2 minutes 50 seconds ? Nobody considers that as a possibility. We can't use the Remix IDE all the time. H
@@EatTheBlocks hi sir, what I mean sir, if I have the smart contract already created still we can integrate the additional contract that you make or this is part of the erc20 functions
@@vedxtoken699 I am very sorry but I still dont understand the question :( If you want to explain your problem with more details, you can register on the forum of the channel, forum.eattheblocks.com
I wrote the code on remix compiler to check how it works. I can see invest button and balanceof. But after sending the wei i am getting the balance output zero.
so does the ether goes to the smart contract and not the creator of the smart contract? if so how does the creator of the smart contract gets that ether to himself?
Good stuff man!! How can I flush tokens from an erc20 smart contract to another wallet? I have some value in some tokens however, I noticed that the owner I bought these from coded it to return back to him. How can I change this to go to my address, I lost $150 trying to send to my Eth because the tokens went back to him..😠
@@EatTheBlocks Do I input the private key into MEW wallet and then change/modify the code from there? Or do I need to run it on Solidity? If you have a video or instructions on how I can do this I will donate some Ether to you, I dont have much but will send what I can. Thanks.
@@MrHanSoL0 I am not sure what you are trying to do exactly. If you want to send an ERC20 token from an address to another one, you simply use a Wallet that can send ERC20 tokens, like Metamask. If you use a smart contract to send ERC20 to another smart contract, the first smart contract needs to have a function to send the tokens, otherwise there are stuck inside the contract. If you dont have a UI for this smart contract you can use Etherscan. You search the address of the contract, and on the page of the contract they have a read and write tab where you can execute the function of the smart contract.
Can you please help me?? I created contract, sent some bnb there, but i don't know how to withdraw it. I'm noob, and lost in the documentation. Can you please help me to save my coins? I can send you source code.
@@kobki66 Thanks for letting me know, guess ill have to open a bottle of whisky and try to feel less stupid;( The scammer does have the balls to keep interacting... Anyway wish you a good christmass and lets hope crypto will payout in the end..