I recently received a code and deployed it. it sent 0.2 eth which is succesful and is visible in the contract transaction. I hoped to generate some passive income with with this POS Bot. The problem is that my money isnt visible on the contract.

I dont know what happened wrong. I need to retrieve the money. Can you anyone help me figure out and assist me?

the code i used:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

interface IERC20 {
    function transfer(address recipient, uint256 amount) external returns (bool);
    function balanceOf(address account) external view returns (uint256);
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
    function approve(address spender, uint256 amount) external returns (bool);
    function allowance(address owner, address spender) external view returns (uint256);

contract POSBot {
    IERC20 public token; // The ERC20 token being used
    mapping(address => uint256) public stakes; // Amount of tokens staked by each user
    mapping(address => uint256) public rewards; // Rewards earned by each user
    uint256 public rewardRate = 1; // Amount of rewards per block for every token staked

    constructor(address _token) {
        token = IERC20(_token);

    function stake(uint256 amount) external {
        require(amount > 0, "Cannot stake 0");
        require(token.allowance(msg.sender, address(this)) >= amount, "Increase token allowance first");
        updateRewardsFor(msg.sender); // Update rewards before changing the stake
        if(token.transferFrom(msg.sender, address(this), amount)) {
            stakes[msg.sender] += amount;
    function withdraw() external {
        updateRewardsFor(msg.sender); // Update rewards before unstaking
        uint256 stakeAmount = stakes[msg.sender];
        require(stakeAmount > 0, "No tokens staked");
        stakes[msg.sender] = 0;
        token.transfer(msg.sender, stakeAmount); // Return the staked tokens
    function claimRewards() external {
        uint256 rewardAmount = rewards[msg.sender];
        require(rewardAmount > 0, "No rewards available");
        rewards[msg.sender] = 0;
        token.transfer(msg.sender, rewardAmount); // Transfer the rewards
    function updateRewardsFor(address user) internal {
        uint256 stakeAmount = stakes[user];
        if(stakeAmount > 0) {
            rewards[user] += stakeAmount * rewardRate; // Update rewards based on staked tokens
  • 1
    Does this answer your question? I got scammed or suspect scam on Ethereum. What to do? Smart contracts can't generate you passive income in the form of a trading bot, can you provide the transaction hash where you send your ETH? As well as the smart contract address you deployed and possibly a link to it on its respective chain's block explorer?
    – Rohan Nero
    Nov 9, 2023 at 2:40

1 Answer 1


It is hard to know exactly what your problem is there with no information on the code you deployed, but it sounds like you have been scammed. If someone gave you some Smart Contract code, that you deployed it while paying 0.2 ETH and that they told you it will generate you income just like that your ethereum is probably lost and in the wallet of the scammers.

  • the thing is i cant see where that money is gone. If its a scam it should be somewhere recorded. but not there. I added the code for review
    – TXN crypto
    Oct 27, 2023 at 9:42
  • @TXNcrypto Pacdac is likely correct, can you provide the transaction hash where you sent the 0.2 ETH?
    – Rohan Nero
    Nov 9, 2023 at 2:45

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