Look carefully at the contract's code below.

You will beat this level if

  1. you claim ownership of the contract
  2. you reduce its balance to 0

Things that might help


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

contract Fallback {

  mapping(address => uint) public contributions;
  address public owner;

  constructor() {
    owner = msg.sender;
    contributions[msg.sender] = 1000 * (1 ether);
  }

  modifier onlyOwner {
    require(
      msg.sender == owner,
      "caller is not the owner"
    );
    _;
  }

  function contribute() public payable {
    require(msg.value < 0.001 ether);
    contributions[msg.sender] += msg.value;
    if(contributions[msg.sender] > contributions[owner]) {
      owner = msg.sender;
    }
  }

  function getContribution() public view returns (uint) {
    return contributions[msg.sender];
  }

  function withdraw() public onlyOwner {
    payable(owner).transfer(address(this).balance);
  }

  receive() external payable {
    require(msg.value > 0 && contributions[msg.sender] > 0);
    owner = msg.sender;
  }
}

This code represents the Fallback contract, which includes the logic for contributions, ownership management, and handling incoming Ether transactions.

Open remix.ethereum.org and copy paste the contract Basic steps on how to use remix here:

added soon

The steps:

Step 1: Deploying the Contract I began by deploying the Fallback contract onto the blockchain. The contract initializes with the contract deployer as the owner and an initial contribution of 1000 ether assigned to the owner.


// Contract deployment
constructor() {
    owner = msg.sender;
    contributions[msg.sender] = 1000 * (1 ether);
}

Step 2: Making a Small Contribution To initiate the process, I made a small contribution of 1 wei using the contract's contribute function.


// Contribute function
function contribute() public payable {
    require(msg.value < 0.001 ether);  // Check contribution amount
    contributions[msg.sender] += msg.value;  // Increase contribution balance
    if(contributions[msg.sender] > contributions[owner]) {
        owner = msg.sender;  // Update owner if contribution is higher
    }
}

Step 3: Initiating the receive() Function After making the initial contribution, I triggered the receive() function by sending a transaction with a small amount of Ether (more than 0 wei). This satisfied the conditions to execute the function.