Challenge: Create a Contract That Accepts Payments

Test your understanding of payments in smart contracts.

Problem statement

In this challenge, complete the following tasks:

  • Create a contract named Challenge that logs Payment Accepted when deployed and can accept payments.

  • Write a main function for a Hardhat run script that sends 5000 Wei to the address of a contract called Challenge from a Hardhat generated address.

  • Display the address and amount of the receiver.


This challenge doesn’t need any input.


This challenge will print the address and amount of the receiver when deployed.

Try it yourself

Write the code for the contract in the contracts/contract.sol file and the run script in the scripts/run.js file. Click the “Run” button in the code widget below to test your solution:

Get hands-on with 1200+ tech skills courses.