Skip to content

Commit 16429e8

Browse files
committed
chore: update README.md
Signed-off-by: MASDXI <sirawitt42@gmail.com>
1 parent 0a3f1e2 commit 16429e8

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

README.md

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The present-day Central Bank Digital Currency concept aims to utilize the advant
2020

2121
## Specification
2222

23-
The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.
23+
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.
2424

2525
``` Solidity
2626
// SPDX-License-Identifier: Apache-2.0
@@ -31,31 +31,26 @@ pragma solidity >=0.8.0 <0.9.0;
3131
*/
3232
3333
interface IForest {
34-
3534
// events
35+
event TransactionCreated(bytes32 indexed root, bytes32 id, address indexed from);
36+
event TransactionSpent(bytes32 indexed id, uint256 value);
3637
3738
// errors
39+
error TransactionNotExist();
40+
error TransactionInsufficient(uint256 value, uint256 spend);
41+
error TransactionZeroValue();
3842
3943
// functions
4044
function hierarchyOfGraph(bytes32 tokenId) external view returns (uint256);
41-
4245
function levelOfToken(bytes32 tokenId) external view returns (uint256);
43-
4446
function ownerOfToken(bytes32 tokenId) external view returns (address);
45-
4647
function parentOfToken(bytes32 tokenId) external view returns (bytes32);
47-
4848
function rootOfToken(bytes32 tokenId) external view returns (bytes32);
49-
5049
function tokenExists(bytes32 tokenId) external view returns (bool);
51-
5250
function valueOfToken(bytes32 tokenId) external view returns (uint256);
53-
5451
function transfer(address to, bytes32 tokenId, uint256 value) external returns (bool);
55-
5652
function transferFrom(address from, address to, bytes32 tokenId, uint256 value) external returns (bool);
5753
}
58-
5954
```
6055

6156
### Function Behavior
@@ -66,29 +61,28 @@ interface IForest {
6661
- The new transaction **MUST** include the correct parent field:
6762
If the transaction is derived (e.g., created by spender), the `parent` field **MUST** reference the `id` of the original transaction.
6863
If the transaction is a `root` transaction, the parent field **MAY** be set to `0x0`.
64+
- The events `TransactionCreated` **MUST** emit when created new transaction.
6965

7066
#### Spend Transaction
7167
- The spending action **MUST** verify that the transaction with the given `id` exists. If not function **SHOULD** return `false` or revert.
7268
- The `value` to be spent **MUST NOT** exceed the `value` of the transaction. If it does, the function **MUST** revert.
7369
- The `hierarchy` of the transaction's `root` **MUST** be incremented if the new transaction's level exceeds the current `hierarchy`.
70+
- The events `TransactionSpent` **MUST** emit when spending transaction.
7471

7572
### Diagrams
7673

7774
<div align="center">
7875
<img src="./docs/assets/diagrams/Forest.svg" width="800"/>
79-
80-
<i>figure 1: transaction graph</i>
76+
<i>Figure 1: Transaction Graph</i>
8177
</div>
8278

8379
<!-- TODO explain -->
8480

8581
<div align="center">
8682
<img src="./docs/assets/diagrams/Forest_Sort.svg" width="400"/>
87-
88-
<i>figure 2: Reverse Topological Sort </i>
83+
<i>Figure 2: Reverse Topological Sort </i>
8984
</div>
9085

91-
9286
<!-- TODO explain -->
9387

9488
## Rationale
@@ -102,7 +96,6 @@ If the transaction is a `root` transaction, the parent field **MAY** be set to `
10296
| Freeze the specifics `tokenId` or `TxId` that relevant to the root. |||||
10397
| Freeze all `tokenId` or `TxId` before or after specifics hierarchy level. |||||
10498

105-
10699
- `ERC-20` provide events and keep tracking each `Transfer`,
107100
but the problem is the `ERC-20` model can't separate `clean money` from `dirty money`,
108101
due to the `ERC-20` not have `tokenId` to keep tracking each token when it's move.

0 commit comments

Comments
 (0)