npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nwnwdecibel

v1.1.0

Published

![alt text](https://pica.zhimg.com/v2-2e936c29baf6ecffbeeb88f9cd086cea_1440w.jpg?source=32738c0c)

Readme

Nw 老鸟量化 [email protected] 量化合作 联系微信 wkc19891

alt text

在 Decibel 中,Builder Codes 是其核心的开发者开放层(Developer Layer),本质是一套标准化、可组合的智能合约接口与工具集,允许开发者/机构直接与 Decibel 全链上订单簿(CLOB)交互,无需依赖链下 API 或中间商,从零构建自定义交易策略、结构化金融产品、自动化金库等。

简单来说:Decibel 把交易所的核心能力(挂单/撮合/清算/风控)封装成可调用的链上模块,Builder Codes 就是开发者调用这些模块的“工具箱”,且所有操作都能在 Aptos 单笔原子交易中完成,兼具 CEX 的功能性和 DeFi 的可组合性。


一、Builder Codes 核心能力与应用场景

1. 构建自定义交易策略(高频/量化/套利)

传统 DEX 仅支持基础挂单,而 Builder Codes 允许开发者基于全链上订单簿,编写自动化、原子化的复杂交易逻辑,且所有策略执行都在链上透明可验证:

  • 高频做市策略:编写合约自动在订单簿挂双向单,根据市场深度动态调整价差/挂单量,赚取手续费;
  • 跨市场套利:原子化完成 Decibel ↔ Aptos 其他 DEX(如 Pontem)↔ 跨链桥的价差套利,利用 Decibel 亚秒级终局性减少滑点;
  • 条件触发交易:设置价格/时间/波动率等触发条件,比如“当 BTC 价格突破 60000 USDCbl 时自动开 10 倍永续多仓”,无需中心化机器人;
  • 网格交易/定投策略:自动在指定价格区间挂网格单,或按固定时间间隔定投,策略逻辑全上链,无停机/审查风险。

示例代码逻辑(Move 伪代码)

// Builder Codes 核心接口调用:触发条件+挂单
public fun place_conditional_order(
  ctx: &mut TxContext,
  market_id: u64,       // BTC/USDCbl 永续市场
  side: Side,           // 做多/做空
  size: u128,           // 仓位大小
  trigger_price: u64,   // 触发价格 60000
  leverage: u8,         // 10倍杠杆
) {
  // 1. 读取链上实时价格(Decibel 订单簿喂价)
  let current_price = decibel::oracle::get_price(market_id);
  // 2. 触发条件判断
  assert!(current_price >= trigger_price, E_TRIGGER_NOT_MET);
  // 3. 调用 Builder Codes 挂单接口(原子化开仓)
  decibel::builder_codes::place_order(
    ctx, 
    market_id, 
    side, 
    size, 
    leverage, 
    UnifiedMargin::get_collateral(ctx.sender()) // 统一保证金扣减
  );
}

2. 发行结构化金融产品

Builder Codes 允许开发者基于 Decibel 的现货/永续订单簿,封装自定义结构化产品,面向普通用户发行,核心是“把复杂交易逻辑包装成简单产品”:

  • 收益增强型产品:比如“USDCbl 生息金库”——用户存入 USDCbl,合约自动在 Decibel 做低风险网格交易,收益返还给用户,本金有保证金风控保护;
  • 保本型衍生品:结合 Decibel 永续合约与期权(未来拓展),设计“保本看涨/看跌”产品,比如“存入 1000 USDCbl,到期保底拿回 950 USDCbl,若 BTC 涨 10% 额外赚 8%”;
  • 杠杆代币:发行“3倍 BTC 做多代币”,合约自动在 Decibel 维持固定杠杆仓位,用户无需手动调仓,代币可在 Aptos 生态自由交易;
  • 跨链结构化产品:利用 Decibel 跨链账户能力,发行“ETH(以太坊)抵押 → Aptos 永续合约套利”的跨链产品,资金在多链间原子化流转。

3. 搭建自动化风控/清算工具

Decibel 开放了链上风险引擎的接口(与 Gauntlet 合作),开发者可通过 Builder Codes 构建自定义风控工具

  • 第三方清算机器人:监控链上仓位的保证金率,当低于阈值时自动触发清算(赚取清算奖励),补充官方清算能力;
  • 自定义风险参数:机构可基于自身风险偏好,编写合约设置个性化保证金率、强平线,比如“对大额仓位额外加收 5% 保证金”;
  • 仓位监控仪表盘:通过 Builder Codes 读取链上所有仓位数据,搭建去中心化的仓位监控/预警工具,无数据黑箱。

4. 集成到其他 DeFi 协议(原子可组合性)

Builder Codes 最核心的价值是原子可组合性——Decibel 的交易行为可作为其他 DeFi 协议单笔交易的一部分,打破“DEX 与其他 DeFi 割裂”的问题:

  • 借贷协议 + Decibel:用户从 Aptos 借贷协议(如 Aave Aptos 版)借出 USDCbl,在同一笔交易中调用 Builder Codes 开永续仓位,还款时自动平仓还款,无清算风险;
  • 稳定币协议 + Decibel:原生稳定币 USDCbl 发行协议可调用 Builder Codes,自动在订单簿对冲敞口,维持币价稳定;
  • NFT 金融 + Decibel:NFT 抵押借贷后,借贷合约可自动用抵押资金在 Decibel 做低风险交易,提升资金效率。

二、Builder Codes 核心优势(对比其他 DEX 开发者工具)

| 特性 | Decibel Builder Codes | Hyperliquid 开发者 API | Lighter 开发者工具 | Backpack 开放接口 | |---------------------|-----------------------------|------------------------|--------------------|------------------| | 交互方式 | 全链上智能合约调用 | 链下 API + 链上验证 | ZK 电路封装 | 链下 API 为主 | | 原子可组合性 | 支持单笔交易多操作(借贷+交易) | 不支持原子组合 | 有限支持 | 不支持 | | 自定义风控 | 开放风险引擎接口 | 仅官方风控 | 封闭 ZK 风控 | 有限开放 | | 跨链能力 | 支持 Aptos/Eth/Sol 跨链调用 | 仅限 Hyper 专用链 | 仅限 ZK‑L2 | 仅限 Solana | | 透明度 | 全链上可审计 | 半链下,部分不可查 | ZK 黑箱 | 半链下 |


三、典型用户:谁会用 Builder Codes?

  1. 量化交易团队:构建高频、低延迟的链上量化策略,利用 Decibel 亚秒终局性和无 MEV 优势;
  2. DeFi 协议开发者:将 Decibel 交易能力集成到自有协议(如借贷、稳定币、金库),提升协议收益;
  3. 机构交易者:搭建自定义风控/清算工具,满足合规/风险偏好要求;
  4. 普通开发者/DAO:发行简单的结构化产品(如网格金库),面向社区用户募资。

总结

  1. Builder Codes 核心是“全链上交易所能力开放”:把 Decibel 的挂单、撮合、风控、清算等核心功能封装成可调用的链上接口,无需链下依赖;
  2. 核心价值是“原子可组合性 + 自定义”:支持单笔交易完成多步复杂操作,且能基于订单簿构建任意自定义策略/产品;
  3. 无审查/无停机风险:所有逻辑跑在 Aptos 链上,无需中心化服务器,抗审查且永不宕机。

简单来说,Builder Codes 让 Decibel 不再只是一个“交易所”,而是一个可无限拓展的全链上交易基础设施——开发者可以基于它,搭建任何想象中的链上交易产品,且兼具 CEX 的性能和 DEX 的透明。