I set up a contract using remix, followed all the steps but when I sent funds to the contract them aren't showing I can see the transfer from my wallet on etherscan but can't see them on the contract Please help
- Can you provide your transaction hash?Canard Coca– Canard Coca2023-11-01 05:28:30 +00:00Commented Nov 1, 2023 at 5:28
- If you were following a front running bot from a YT guide it is very likely you were scammed.Ismael– Ismael ♦2024-05-01 06:03:45 +00:00Commented May 1, 2024 at 6:03
2 Answers
interplanetary traveler!
So you're experiencing a little hiccup with your Remix contract.
First off, it's important to remember that the ethers you're sending aren't showing up in the contract because the contract likely doesn't have a function to receive them.
In Solidity, you need something called a payable function to receive ether. Something like this should do the trick:
receive() external payable {} Pop that into your contract and you should start seeing your ethers landing safely. Always remember, code is law in Ethereum's world, so make it work for you!
Good luck on your journey.
A few things: You may be able to see the contract balance by making another contract and then getting the address(insertAddressToCheckBalanceHere).balance of the contract in a getter function, but also setup a receive() function (like Ari recommends) and fallback() function to receive Ether on the original contract and track it. Both need to be external and payable to receive the Ether.
Is this on mainnet or a testnet?