Skip to content

Commit

Permalink
rename EasyPay => Easy2Pay
Browse files Browse the repository at this point in the history
reverting from previous renaming
  • Loading branch information
swellander committed Dec 31, 2023
1 parent a207d02 commit e251888
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 💸 EasyPay 💸
# 💸 Easy2Pay 💸

💸 dApp for requesting payments in a currency (like USD, ETH and BTC), and accept different type of valid tokens that share a common value using [Chainlink Price Feeds](https://docs.chain.link/data-feeds/price-feeds).

Expand All @@ -9,15 +9,15 @@

## Quickstart

To get started with EasyPay, follow the steps below:
To get started with Easy2Pay, follow the steps below:

1. Make sure you have the [foundry toolkit installed](https://book.getfoundry.sh/getting-started/installation).

2. Clone this repo & install dependencies

```
git clone https://github.com/luloxi/EasyPay.git
cd EasyPay
git clone https://github.com/luloxi/Easy2Pay.git
cd Easy2Pay
yarn install
```

Expand Down Expand Up @@ -47,7 +47,7 @@ Visit your app on: `http://localhost:3000`. You can interact with your smart con

Run smart contract test with `yarn hardhat:test`

- Edit your smart contract `EasyPay.sol` in `packages/hardhat/contracts`
- Edit your smart contract `Easy2Pay.sol` in `packages/hardhat/contracts`
- Edit your frontend in `packages/nextjs/pages`
- Edit your deployment scripts in `packages/hardhat/deploy`

Expand All @@ -65,7 +65,7 @@ Run smart contract test with `yarn hardhat:test`

## Contents

- [💸 EasyPay 💸](#-easypay-)
- [💸 Easy2Pay 💸](#-easypay-)
- [Quickstart](#quickstart)
- [🏗 About Scaffold-ETH 2](#-about-scaffold-eth-2)
- [Contents](#contents)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct PayRequest {
bool completed;
}

contract EasyPay {
contract Easy2Pay {
address public owner;

/**
Expand All @@ -21,17 +21,17 @@ contract EasyPay {
mapping(address receiver => PayRequest[]) public payRequests;

// Custom errors
error EasyPay__RequestDoesNotExist();
error EasyPay__InsufficientEther(
error Easy2Pay__RequestDoesNotExist();
error Easy2Pay__InsufficientEther(
uint256 requestedAmount,
uint256 actualAmount
);
error EasyPay__PaymentAlreadyCompleted();
error EasyPay__FailedToSendEther();
error EasyPay__UnauthorizedAccess();
error Easy2Pay__PaymentAlreadyCompleted();
error Easy2Pay__FailedToSendEther();
error Easy2Pay__UnauthorizedAccess();

modifier onlyOwner() {
if (msg.sender != owner) revert EasyPay__UnauthorizedAccess();
if (msg.sender != owner) revert Easy2Pay__UnauthorizedAccess();
_;
}

Expand All @@ -52,30 +52,30 @@ contract EasyPay {
PayRequest storage request = payRequests[receiver][_requestId];

if (receiver == address(0))
revert EasyPay__RequestDoesNotExist();
revert Easy2Pay__RequestDoesNotExist();

if (request.amount > msg.value)
revert EasyPay__InsufficientEther(request.amount, msg.value);
revert Easy2Pay__InsufficientEther(request.amount, msg.value);

if (request.completed) revert EasyPay__PaymentAlreadyCompleted();
if (request.completed) revert Easy2Pay__PaymentAlreadyCompleted();

request.completed = true;

// Call returns a boolean value indicating success or failure.
// This is the current recommended method to use to transfer ETH.
(bool sent, ) = receiver.call{value: msg.value}("");

if (!sent) revert EasyPay__FailedToSendEther();
if (!sent) revert Easy2Pay__FailedToSendEther();
}

// Function in case a payment is received where msg.data must be empty
receive() external payable {
if (msg.sender != address(0)) revert EasyPay__FailedToSendEther();
if (msg.sender != address(0)) revert Easy2Pay__FailedToSendEther();
}

// Fallback function is called when msg.data is not empty
fallback() external payable {
if (msg.sender != address(0)) revert EasyPay__FailedToSendEther();
if (msg.sender != address(0)) revert Easy2Pay__FailedToSendEther();
}

function setOwner(address _newOwner) public onlyOwner {
Expand Down
6 changes: 3 additions & 3 deletions packages/foundry/script/Deploy.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "../contracts/EasyPay.sol";
import "../contracts/Easy2Pay.sol";
import "./DeployHelpers.s.sol";

contract DeployScript is ScaffoldETHDeploy {
Expand All @@ -15,10 +15,10 @@ contract DeployScript is ScaffoldETHDeploy {
);
}
vm.startBroadcast(deployerPrivateKey);
EasyPay easyPay = new EasyPay();
Easy2Pay easyPay = new Easy2Pay();
console.logString(
string.concat(
"EasyPay deployed at: ",
"Easy2Pay deployed at: ",
vm.toString(address(easyPay))
)
);
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/pages/makePayment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const Requests: NextPage = () => {
const amount = searchParams.get("amount") || undefined;
const requestId = searchParams.get("requestId") || undefined;
const { writeAsync: sendPaymentTx, isLoading } = useScaffoldContractWrite({
contractName: "EasyPay",
contractName: "Easy2Pay",
functionName: "pay",
args: [recipient, BigInt(requestId || "0")],
// for payable functions, expressed in eth
Expand Down
4 changes: 2 additions & 2 deletions packages/nextjs/pages/requests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const Requests: NextPage = () => {
);

const { data: paymentRequests } = useScaffoldContractRead({
contractName: "EasyPay",
contractName: "Easy2Pay",
functionName: "getRequests",
args: [address],
});
Expand Down Expand Up @@ -62,7 +62,7 @@ const Requests: NextPage = () => {

return (
<>
<MetaHeader title="Payment Requests | EasyPay" description="List all payment requests" />
<MetaHeader title="Payment Requests | Easy2Pay" description="List all payment requests" />
<div className="flex items-center flex-col flex-grow pt-10">
<div className="px-5">
<h1 className="text-center mb-3">
Expand Down

0 comments on commit e251888

Please sign in to comment.