Skip to content

Commit

Permalink
add missing info
Browse files Browse the repository at this point in the history
  • Loading branch information
liaoyuan committed Feb 13, 2024
1 parent c191fc8 commit 1d229cd
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion ERCS/erc-7620.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ Furthermore, there's potential to implement governance mechanisms, such as DAO g

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174.

Compliant contracts MUST implement the following interface:
### Interface

#### `IERC7620`

```solidity
pragma solidity ^0.8.20;
Expand Down Expand Up @@ -158,6 +160,42 @@ interface IERC7620 {
}
```

The `registerServiceProvider(address serviceProvider)` function `MUST` be implemented as public or external.

The `deregisterServiceProvider(address serviceProvider)` function `MUST` be implemented as public or external.

The `authorizeServiceProvider(address serviceProvider, uint256 amount)` function `MUST` be implemented as public or external.

The `revokeAuthorization(address serviceProvider)` function `MUST` be implemented as public or external.

The `deductAuthorizedFunds(address user, uint256 amount, string calldata referenceId)` function `MUST` be implemented as public or external.

The `authorizedAmount(address user, address serviceProvider)` function `MUST` be implemented as pure or view.

The `isServiceProviderRegistered(address serviceProvider)` function `MUST` be implemented as pure or view.

The `deposit(uint256 amount)` function `OPTIONAL` be implemented as public or external.

The `withdraw(uint256 amount)` function `OPTIONAL` be implemented as public or external.

The `remainingBalance(address user)` function `OPTIONAL` be implemented as pure or view.

The `ServiceProviderRegistered` event `MUST` be emitted when a service provider is registered.

The `ServiceProviderDeregistered` event `MUST` be emitted when a service provider is deregistered.

The `AuthorizationUpdated` event `MUST` be emitted when authorization amount is updated.

The `FundsDeducted` event `MUST` be emitted when funds are deducted.

The `AuthorizationRevoked` event `MUST` be emitted when authorization is revoked.

The `Deposited` event `OPTIONAL` be emitted when funds are deposited.

The `Withdrawal` event `OPTIONAL` be emitted when when funds are withdrawn.

The deposit and withdraw functions for users are `OPTIONAL` in implementation, as funds can be transferred directly from the user's account in real-time during the `authorizeServiceProvider` operation.

## Rationale

The primary motivation behind the Pre-Authorized Service Payment Protocol stems from the need for a more efficient and secure transaction mechanism between users and service providers within the Ethereum blockchain. While ERC-20's `approve` method provides a means to authorize fund usage, there's a recognition that the authorized funds could be put to better use.
Expand Down

0 comments on commit 1d229cd

Please sign in to comment.