Challenge: Create a Contract That Accepts Payments
Test your understanding of payments in smart contracts.
We'll cover the following
Problem statement
In this challenge, complete the following tasks:
Create a contract named
Challenge
that logsPayment Accepted
when deployed and can accept payments.Write a
main
function for a Hardhatrun
script that sends 5000 Wei to theaddress
of a contract calledChallenge
from a Hardhat generated address.Display the
address
andamount
of the receiver.
Input
This challenge doesn’t need any input.
Output
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 1400+ tech skills courses.