// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
contract TensetPayments {
address public destination;
uint256 public id;
event PaymentReceived(address indexed account, string refId, uint256 id, uint256 amount);
/**
@param destination_ - wallet address which pays out rewards
*/
constructor(address destination_) {
destination = destination_;
}
/**
@param refId reference to item for which payment is made
*/
function pay(string memory refId) public payable {
require(msg.value > 0, "Amount must be greater than zero");
require(msg.sender != address(0), "Transfer account the zero address");
(bool sent, ) = payable(destination).call{ value: msg.value }("");
require(sent, "Failed to transfer payment");
uint256 id_ = ++id;
emit PaymentReceived(msg.sender, refId, id_, msg.value);
}
}
{
"compilationTarget": {
"contracts/TensetPayments.sol": "TensetPayments"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"destination_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"string","name":"refId","type":"string"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentReceived","type":"event"},{"inputs":[],"name":"destination","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"id","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"refId","type":"string"}],"name":"pay","outputs":[],"stateMutability":"payable","type":"function"}]