mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-12-15 16:48:58 -05:00
* poc: monero receive pool with multiple redeem addresses for bob with given ratios * fix: use new monero_receive_pool arg for buy_xmr * update sweep/sweep_multi to return TxReceipt instead of String containing txid * fix test (generate 1 block before checking balance after transfer) * add move distribute function to rust, add property tests * use rust distribute * update sqlx cache/tempdb * sqlx fix * feat: update ui to display the monero address pool * fix: remove unused functions, set dispatcher for tracing in wallet threads, use new subtract_fee wallet2 functionality * Add patch system * add wallet2_api_allow_subtract_from_fee patch * apply git patches * split monero-sys patches into chunks * refactor * .sqlx needs to be commited, revert unbound issue * display pool on XmrRedeemInMempoolPage.tsx page, commit .sqlx folder * fmt * refactor * assert MoneroAddressPool is on correct network, differntiate between stagenet and mainnet donaiton address * looks ok * re-add retry logic, database errors, ... * add test * add tests * fmt comments, changelog --------- Co-authored-by: Binarybaron <binarybaron@protonmail.com>
29 lines
No EOL
1.2 KiB
SQL
29 lines
No EOL
1.2 KiB
SQL
-- The user can now have multiple monero receive addresses
|
|
-- for a single swap
|
|
-- Each address has a percentage (0 to 1) of the amount they'll receive of the total of the swap amount
|
|
-- The sum of the percentages must for a single swap MUST be 1
|
|
-- Add percentage column with default value of 1.0
|
|
ALTER TABLE monero_addresses ADD COLUMN percentage REAL NOT NULL DEFAULT 1.0;
|
|
|
|
-- SQLite doesn't support dropping PRIMARY KEY constraint directly
|
|
-- We need to recreate the table without the PRIMARY KEY on swap_id
|
|
CREATE TABLE monero_addresses_temp
|
|
(
|
|
swap_id TEXT NOT NULL,
|
|
address TEXT NOT NULL,
|
|
percentage REAL NOT NULL DEFAULT 1.0,
|
|
label TEXT NOT NULL DEFAULT 'user address'
|
|
);
|
|
|
|
-- Copy data from the original table
|
|
INSERT INTO monero_addresses_temp (swap_id, address, percentage)
|
|
SELECT swap_id, address, percentage FROM monero_addresses;
|
|
|
|
-- Drop the original table
|
|
DROP TABLE monero_addresses;
|
|
|
|
-- Rename the temporary table
|
|
ALTER TABLE monero_addresses_temp RENAME TO monero_addresses;
|
|
|
|
-- Create an index on swap_id for performance
|
|
CREATE INDEX idx_monero_addresses_swap_id ON monero_addresses(swap_id); |