Welcome to this brand new course about blockchain. In this course, and in the upcoming ones, we will make you familiar with everything you need to know about blockchain. We will also teach you some of the latest blockchain coding skills so that you can enter the fascinating world of decentralized applications.
In this video, we will learn about simple payment smart contract. The Payment Contract is a smart contract designed to facilitate payments between two parties on the Ethereum blockchain. It includes variables to store the addresses of the payer and payee, as well as the payment amount. Upon deployment, the constructor initializes the payer as the address of the deploying account and the payee and payment amount are provided as arguments. The contract provides a function called makePayment() which can be called by the payer to initiate the payment. It ensures that only the payer can make the payment and checks if the contract has sufficient balance to fulfill the payment. If the conditions are met, the contract transfers the specified amount to the payee using the call function. Any failure in the payment process will result in an error message. This smart contract provides a secure and transparent way to execute payments, ensuring that funds are transferred only by the authorized payer and within the contract’s available balance.
Github Repository:
https://github.com/arashtad/Arashtad-Smart-Conrtacts