总 PR
96
HIGH
0
MEDIUM
1
Stage2
1
Model: none Back

交叉验证

两边确认76
仅分析映射20
仅 Release Notes0
MEDIUM 更新 (1)
#1402 Implement add_liquidity and remove_liquidity MERGED feature
在 `primitives/swap/src/lib.rs` 中为 V3 交换池实现 `add_liquidity` 和 `remove_liquidity` 功能,并重构交换数据操作 trait 以支持账户级操作。
判级:属于核心交换逻辑的关键功能实现,但因未接入运行时(pallet 不存在或未引用),暂不影响网络运行。
关键改动
  • primitives/swap/src/lib.rs: 为 `SwapDataOperations` trait 增加泛型参数 `AccountIdType`,新增 `remove_tick_by_index`、`get_max_positions`、`get_position_count`、`get_position`、`create_position`、`update_position`、`remove_position`、`withdraw_balances(account_id, ...)`、`deposit_balances(account_id, ...)` 等方法,使操作支持按账户隔离。
  • primitives/swap/src/lib.rs: 将 `Swap` 结构体改为泛型 `Swap<AccountIdType, Ops>`,增加 `PhantomData<AccountIdType>` 字段。
  • primitives/swap/src/lib.rs: 实现 `add_liquidity` 方法(参数新增 `account_id`),包含:检查用户最大仓位上限、向上下两个 tick 添加流动性、更新当前 tick 流动性、从用户余额扣除对应 tao/alpha、更新池子储备、创建并存储 Position、返回新增流动性。
  • primitives/swap/src/lib.rs: 实现 `remove_liquidity` 方法(通过 `account_id` + `position_id` 识别仓位),包含:查找仓位、收集累计费用(`collect_fees` 暂为 `todo!()`)、获取应退还的 tao/alpha 数量、从上下 tick 移除流动性、更新当前 tick 流动性、删除用户仓位、更新池子储备、返回 `RemoveLiquidityResult`。
  • primitives/swap/src/lib.rs: 新增 `RemoveLiquidityResult` 结构体,包含 `tao`、`alpha`、`fee_tao`、`fee_alpha` 四个 u64 字段。
  • primitives/swap/src/lib.rs: 新增 `remove_liquidity_at_index` 私有方法,更新 tick 的 `liquidity_net` 和 `liquidity_gross`,若 `liquidity_gross` 归零则完全移除该 tick。
  • primitives/swap/src/lib.rs: 新增 `collect_fees` 方法(暂为 `todo!()`),预留收集仓位的累计手续费逻辑。
  • primitives/swap/src/lib.rs: 多处代码清理:移除残留的 Python/NumPy 风格伪代码、修正 Rust 语法问题(如 `if let` 结尾缺少 `;`、变量作用域、`neg` 需加标准库引用等,当前代码存在编译错误)。
未分析 (95)
#1406 Implement sqrt_price_to_tick_index and FixedExt MERGED
#1409 Implement tick math MERGED
#1413 Feat/uniswapv3 lp greg MERGED
#1419 Fix conversion and Fixed::checked_pow issues MERGED
#1425 Refactor swap, add errors MERGED
#1440 Tests and fixes for add_liquidity and remove_liquidity MERGED
#1441 Move swap into pallet MERGED
#1446 Implement pallet-subtensor-swap MERGED
#1460 Feat/uniswapv3 lp greg MERGED
#1467 Sasha/feat/uniswapv3 lp MERGED
#1468 Sasha/feat/uniswapv3 lp MERGED
#1475 Encapsulate Swap into module MERGED
#1478 Sasha/feat/uniswapv3 lp MERGED
#1495 Simplify Pallet::swap MERGED
#1497 Setup default fee rate MERGED
#1504 Fix swap_step for basic buy and sell MERGED
#1506 Test swap within a single provided position MERGED
#1516 Feat/uniswapv3 lp greg2 MERGED
#1521 Sasha/feat/uniswapv3 lp MERGED
#1529 Adapt stake_into_subnet to swap v3 MERGED
#1531 Add modify_position method to swap MERGED
#1535 Sasha/feat/uniswapv3 lp MERGED
#1540 Sasha/feat/uniswapv3 lp MERGED
#1542 Fix balance updates for add/remove liquidity MERGED
#1550 Sasha/feat/uniswapv3 lp MERGED
#1559 Hotkey splitting MERGED
#1597 Address review comments MERGED
#1599 Fix paid fee calculation MERGED
#1613 Add modify_position extrinsic, fix active ticks management MERGED
#1614 RPC to get validators MERGED
#1616 Fix more tests MERGED
#1621 Fix tick index math rounding MERGED
#1623 Fix get_total_stake_for_hotkey MERGED
#1631 docs (REAME.md): fixl link to NPoS overview page MERGED
#1636 Rewrite covnert_deltas with safe math MERGED
#1637 Fix swap step action calculation MERGED
#1639 Expose all extrinsic and storage to EVM MERGED
#1645 Move swap-related extrinsics to swap pallet MERGED
#1647 Feat/uniswapv3 lp cleanup MERGED
#1650 Setup benchmarks and use non-panic arithmetics MERGED
#1654 Feat/uniswapv3 lp cleanup MERGED
#1659 Add RPC for current alpha price and small clean ups MERGED
#1674 Add manual switch for V3 swap MERGED
#1681 change the default registration to 0.1 TAO MERGED
#1682 Allow axon ip as 0 MERGED
#1686 alpha precompiles MERGED
#1691 Feat/uniswapv3 lp cleanup MERGED
#1693 update to rust 1.87 MERGED
#1696 Fix `drand` and `commitments` for localnet MERGED
#1697 Fix test_swap_fees_tao_correctness and test_current_liquidity_updates MERGED
#1698 Merge with devnet-ready MERGED
#1700 Fix migration weights MERGED
#1701 Remove swap_inner side effects MERGED
#1702 Add sr25519 precompiled pallet MERGED
#1703 Enable liquidity providers MERGED
#1704 Fix benchmarks MERGED
#1705 Feat/uniswapv3 lp remove swap inner side effects MERGED
#1707 Merge with devnet-ready MERGED
#1710 Sasha/feat/uniswapv3 lp MERGED
#1711 Use integer tick index comparisons instead of price MERGED
#1712 Handle the case when a sell swap starts on the edge MERGED
#1715 Fix typing issues MERGED
#1716 Add changes from Max and Dr. Nick MERGED
#1718 fix docker compose MERGED
#1722 Use prices in determine_action MERGED
#1723 Upgrade Polkadot SDK to stable2412-6 MERGED
#1724 Remove obsolete code MERGED
#1726 Feat/uniswapv3 lp greg MERGED
#1727 Add `sudo_set_bonds_reset_enabled` MERGED
#1729 Fix alpha_low, alpha_high min value checks MERGED
#1733 Make subnet ID's type-safe MERGED
#1734 backprop hotfixes 6/10/2025 MERGED
#1736 Feat/SubnetHyperparamsV2 MERGED
#1738 Update doc toggle transfer MERGED
#1740 fix build due to set bond reset ext missing NetUid MERGED
#1742 enable workflows to run on forks MERGED
#1743 fix the error from code merge MERGED
#1745 Add new remove_stake_full_limit extrinsic. MERGED
#1746 Fix NetUid metadata issue MERGED
#1750 Add logo_url to subnet identities MERGED
#1758 sigmoid steepness adjustment MERGED
#1761 backprop hotfixes 6/16/2025 MERGED
#1762 Improve logic to start and skip bittensor tests MERGED
#1764 use hotkey to associate uid in evm MERGED
#1768 devnet deploy 6/18/2025 MERGED
#1776 Add liquidity modified event, fix coinbase injection into protocol li… MERGED
#1778 devnet deploy 6/23/2025 MERGED
#1779 testnet merge 6/23/2025 MERGED
#1780 Remove stake full limit precompile MERGED
#1781 Fix root subnet tao mismatch MERGED
#1782 Fix balancing of total alpha MERGED
#1784 fix: only remove delta when modifying a position MERGED
#1788 Test for tick updates in modify position MERGED
#1793 Update docker compose file MERGED
#1795 Mainnet merge 6/30/2025 MERGED