Skip to content

Challenge 01

You will learn how to call a function with and without the payable modifier.

Task

Your task is to open the 4 locks.

Contract deployed to goerli network at 0xf697f207bdd1f1bf47e086c9c87be7e96ac52f29.

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.0;

contract Payable {

    mapping(address => bool) public openLock1;
    mapping(address => bool) public openLock2;
    mapping(address => bool) public openLock3;
    mapping(address => bool) public openLock4;

    function unlock1() external {
        openLock1[msg.sender] = true;
    }

    function unlock2() external payable {
        openLock2[msg.sender] = true;
    }

    function unlock3() external payable {
        require(msg.value == 0.001 ether, "wrong amount of ETH sent");
        openLock3[msg.sender] = true;
    }

    function unlock4() external payable {
        require(msg.value == 0, "wrong amount of ETH sent");
        openLock4[msg.sender] = true;
    }

    // code for withdrawing ETH and challenge state is hidden
}

Danger

Make sure you are using the goerli testnet.

Verify completion

Connected Wallet:

Challenge state:

Finishing

After completing this challenge you can receive back all the ETH you have transferred.

Your have ??? ETH to withdraw.