commit b5b29485797d294662ed5dff31b5a0d23a8cfd6a
parent 528c512283a5754f0eb79ced3d60d2d34bab7ae1
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Sat, 16 Dec 2023 00:08:51 -0500
keep track of transfer fee
Diffstat:
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/cmd/dkf/migrations/153.sql b/cmd/dkf/migrations/153.sql
@@ -0,0 +1,4 @@
+-- +migrate Up
+ALTER TABLE poker_xmr_transactions ADD COLUMN fee INTEGER NOT NULL DEFAULT 0;
+
+-- +migrate Down
diff --git a/pkg/database/tablePokerXmrTransactions.go b/pkg/database/tablePokerXmrTransactions.go
@@ -12,6 +12,7 @@ type PokerXmrTransaction struct {
UserID UserID
Address string
Amount Piconero
+ Fee Piconero
Confirmations uint64
Height uint64
IsIn bool
@@ -53,6 +54,7 @@ func (d *DkfDB) GetOrCreatePokerXmrTransaction(userID UserID, transfer *wallet.T
Address: transfer.Address,
Height: transfer.Height,
Amount: Piconero(transfer.Amount),
+ Fee: Piconero(transfer.Fee),
Confirmations: transfer.Confirmations,
IsIn: true,
}
@@ -62,7 +64,7 @@ func (d *DkfDB) GetOrCreatePokerXmrTransaction(userID UserID, transfer *wallet.T
}
func (d *DkfDB) CreatePokerXmrTransaction(userID UserID, transfer *wallet.ResponseTransfer) (out PokerXmrTransaction, err error) {
- err = d.db.Create(&PokerXmrTransaction{UserID: userID, Amount: Piconero(transfer.Amount), IsIn: false}).Error
+ err = d.db.Create(&PokerXmrTransaction{UserID: userID, Amount: Piconero(transfer.Amount), Fee: Piconero(transfer.Fee), IsIn: false}).Error
return
}