Search⌘ K

Solution: Create a Contract That Accepts Payments

Explore how to create and deploy a Solidity smart contract that accepts payments. Learn to use the payable keyword to enable contract payments, write a run script to send Wei, and log important transaction details.

Flowchart of a possible solution

For this challenge, you needed to create a contract that logs Payment Accepted when deployed as well as create a main function that sends 5000 Wei to a Hardhat generated address.

The image above shows how we can complete this challenge. We need to set the payable attribute in ...