-- 为 assets 表添加部署区块字段
-- Add deployment block fields to assets table

-- 1. 添加部署区块字段
ALTER TABLE `assets`
ADD COLUMN `deploy_block_arb` BIGINT UNSIGNED DEFAULT NULL COMMENT 'Arbitrum 部署区块号',
ADD COLUMN `deploy_block_bsc` BIGINT UNSIGNED DEFAULT NULL COMMENT 'BSC 部署区块号';

-- 2. 更新已知的部署区块号
UPDATE `assets` SET `deploy_block_arb` = 83949096 WHERE `asset_code` = 'YT-A';
UPDATE `assets` SET `deploy_block_arb` = 83949087 WHERE `asset_code` = 'YT-B';
-- UPDATE `assets` SET `deploy_block_arb` = 83949000 WHERE `asset_code` = 'YT-C';  -- 请替换为实际区块号

-- 3. 为 alp_pools 表添加部署区块字段
ALTER TABLE `alp_pools`
ADD COLUMN `deploy_block_arb` BIGINT UNSIGNED DEFAULT NULL COMMENT 'Arbitrum 部署区块号',
ADD COLUMN `deploy_block_bsc` BIGINT UNSIGNED DEFAULT NULL COMMENT 'BSC 部署区块号';

-- 更新 ytLP 部署区块（如果知道的话）
-- UPDATE `alp_pools` SET `deploy_block_arb` = 83949000 WHERE `pool_name` = 'ytLP' AND `is_active` = 1;

-- 4. 为 lending_markets 表添加部署区块字段
ALTER TABLE `lending_markets`
ADD COLUMN `deploy_block_arb` BIGINT UNSIGNED DEFAULT NULL COMMENT 'Arbitrum 部署区块号',
ADD COLUMN `deploy_block_bsc` BIGINT UNSIGNED DEFAULT NULL COMMENT 'BSC 部署区块号';

-- 更新 Lending 部署区块（如果知道的话）
-- UPDATE `lending_markets` SET `deploy_block_arb` = 83949000 WHERE `is_active` = 1;

-- 5. 查看更新结果
SELECT asset_code, contract_address_arb, deploy_block_arb FROM `assets` WHERE asset_code IN ('YT-A', 'YT-B', 'YT-C');
