-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtransfer.sol
More file actions
29 lines (23 loc) · 838 Bytes
/
transfer.sol
File metadata and controls
29 lines (23 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.21;
contract Transfer {
address public payer;
address public payee;
uint256 public amount;
event PaymentMethod(address indexed _payer, address indexed _payee, uint256 _amount);
constructor (address _payer, address _payee, uint256 _amount) {
payer = _payer;
payee = _payee;
amount = _amount;
}
modifier onlyOwner() {
require(msg.sender == payer, "Only owner can call this function");
_;
}
function makePayment() public payable {
require(msg.sender == payer, "Only payer can make pyment");
require(msg.value == amount, "Incorrect payment amount");
payable(payee).transfer(msg.value);
emit PaymentMethod(payer, payee, amount);
}
}