This repository has been archived by the owner on Apr 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
134 additions
and
9 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
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 |
---|---|---|
@@ -1,14 +1,50 @@ | ||
extends Node | ||
|
||
# Server signals | ||
signal fast_withdraw_requested(amount: float) | ||
signal fast_withdraw_requested(peer : int, amount: float, destination: String) | ||
signal fast_withdraw_invoice_paid(peer : int, txid: String, amount: float, destination: String) | ||
|
||
# Client signals | ||
signal fast_withdraw_invoice(amount: float, destination: String) | ||
signal fast_withdraw_complete(txid: String, amount: float, destination: String) | ||
|
||
# TODO add params: SC #, MC fee, MC destination | ||
@rpc("any_peer", "call_remote", "reliable") | ||
func request_fast_withdraw(amount : float) -> void: | ||
func request_fast_withdraw(amount : float, destination : String) -> void: | ||
print("Received fast withdrawal request") | ||
print("Amount: ", amount) | ||
print("Destination: ", destination) | ||
print("Peer: ", multiplayer.get_remote_sender_id()) | ||
|
||
fast_withdraw_requested.emit(amount) | ||
fast_withdraw_requested.emit(multiplayer.get_remote_sender_id(), amount, destination) | ||
|
||
|
||
@rpc("authority", "call_remote", "reliable") | ||
func receive_fast_withdraw_invoice(amount : float, destination : String) -> void: | ||
print("Received fast withdrawal invoice") | ||
print("Amount: ", amount) | ||
print("Destination: ", destination) | ||
print("Peer: ", multiplayer.get_remote_sender_id()) | ||
|
||
fast_withdraw_invoice.emit(amount, destination) | ||
|
||
|
||
@rpc("any_peer", "call_remote", "reliable") | ||
func invoice_paid(txid: String, amount : float, destination : String) -> void: | ||
print("Paid fast withdrawal invoice") | ||
print("Amount: ", amount) | ||
print("Destination: ", destination) | ||
print("Txid: ", txid) | ||
print("Peer: ", multiplayer.get_remote_sender_id()) | ||
|
||
fast_withdraw_invoice_paid.emit(multiplayer.get_remote_sender_id(), txid, amount, destination) | ||
|
||
|
||
@rpc("authority", "call_remote", "reliable") | ||
func withdraw_complete(txid: String, amount : float, destination : String) -> void: | ||
print("Fast withdraw completed!") | ||
print("Amount: ", amount) | ||
print("Destination: ", destination) | ||
print("Txid: ", txid) | ||
|
||
fast_withdraw_complete.emit(txid, amount, destination) |