Files
m2pool_payment/public/eth.sql
2025-11-13 17:59:13 +08:00

45 lines
1.5 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

CREATE TABLE IF NOT EXISTS ETH_wallets (
address TEXT PRIMARY KEY NOT NULL,
queue_id TEXT NOT NULL,
timestamp INTEGER NOT NULL,
sign TEXT NOT NULL,
status INTEGER DEFAULT 0 -- 0未在监听 1正在监听
);
CREATE TABLE IF NOT EXISTS ETH_balances (
address TEXT NOT NULL,
symbol TEXT DEFAULT "ETH",
used_gas TEXT DEFAULT "0",
balance TEXT DEFAULT "0",
success_tx_hash TEXT DEFAULT NULL, --使用,隔开
failed_tx_hash TEXT DEFAULT NULL, --使用,隔开
PRIMARY KEY (address), -- 钱包地址唯一
FOREIGN KEY (address) REFERENCES eth_wallets (address) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS USDT_balances (
address TEXT NOT NULL,
symbol TEXT DEFAULT "USDT",
freeze_num TEXT DEFAULT "0",
balance TEXT DEFAULT "0",
success_tx_hash TEXT DEFAULT NULL, --使用,隔开
failed_tx_hash TEXT DEFAULT NULL, --使用,隔开
PRIMARY KEY (address), -- 钱包地址唯一
FOREIGN KEY (address) REFERENCES eth_wallets (address) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS eth_unconfirmed_tx (
queue_id TEXT NOT NULL, -- 关联的msg queue_id
tx_type INTEGER NOT NULL, --0充值1提现2支付
chain TEXT DEFALUT "ETH",
symbol TEXT,
from_addr TEXT,
to_addr TEXT,
tx_hash TEXT,
height INTEGER,
amount TEXT,
status INTEGER DEFAULT 2, --0充值失败1充值成功2充值待确认
PRIMARY KEY (tx_hash),
FOREIGN KEY (queue_id) REFERENCES eth_wallets (queue_id) ON DELETE CASCADE
);