-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: MASDXI <[email protected]>
- Loading branch information
Showing
3 changed files
with
23 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,6 @@ pragma solidity >=0.8.0 <0.9.0; | |
* @author Sirawit Techavanitch ([email protected]) | ||
*/ | ||
|
||
// @TODO merging Tx (allowing only same root). | ||
|
||
library Forest { | ||
/** | ||
* @dev Structure representing a transaction. | ||
|
@@ -139,4 +137,11 @@ library Forest { | |
|
||
emit TransactionSpent(id, value); | ||
} | ||
|
||
/** | ||
* @notice not suitable for use in production. | ||
*/ | ||
function mergeTx(DAG storage self, bytes32 [] memory ids) internal { | ||
// @TODO | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,13 +4,16 @@ pragma solidity >=0.8.0 <0.9.0; | |
/** | ||
* @title Unspent Transaction Output Model (UTXO) | ||
* @notice This library implements the UTXO model for managing transactions on the blockchain. | ||
* inspired from: | ||
* https://gist.github.com/alex-miller-0/a5f4de3f811872b7272e66a3697f88de | ||
* https://github.com/ProjectWyvern/wyvern-ethereum/blob/master/contracts/token/UTXORedeemableToken.sol | ||
* https://github.com/olegfomenko/utxo | ||
* @author Sirawit Techavanitch ([email protected]) | ||
*/ | ||
|
||
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; | ||
import "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; | ||
|
||
// @TODO merging UTXO. | ||
|
||
library UnspentTransactionOutput { | ||
using ECDSA for bytes32; | ||
using MessageHashUtils for bytes32; | ||
|
@@ -188,6 +191,15 @@ library UnspentTransactionOutput { | |
emit TransactionConsumed(id); | ||
} | ||
|
||
/** | ||
* @notice merge multiple transaction into single transaction. | ||
* @param self The UTXO storage. | ||
* @param ids The array of the identifiers of the transaction to merge. | ||
*/ | ||
function mergeTx(UTXO storage self, bytes32 [] memory ids) internal { | ||
// @TODO | ||
} | ||
|
||
/** | ||
* @notice Retrieves the details of a transaction from the UTXO. | ||
* @param self The UTXO storage. | ||
|