2009年,一个叫 BTC 的年轻人,因为不满权力机构对世界的黑暗控制,决定重新定义游戏规则。
他告诉追随者:我要创造一个人人平等、没有集权、公开透明的世界。公平!公平!还是 TM 的公平!
很快,他聚集了一大帮信徒。他们不再向过去的社团和帮派低头,满心以为自己终于进入了一个自由、平等、可信的乐园。
没过多久,BTC 迎来了得力的二当家 ETH。在平等、透明的基础上,ETH 给每个人都配了一个叫「智能合约」的助手。帮会业务迅速壮大,甚至喊出了重塑整个金融体系的口号。
这帮泥腿子的疯狂发展,终于引起了原来帮会老大「大漂亮」的警觉。
于是,「大漂亮」派出手下的得力干将 Apple、Google、NVIDIA 等,利用新帮会里大多数老成员对旧世界的向往,悄悄制造分身、收编势力,成功策反。
曾经高喊着去中心化、人人平等的新世界,开始出现了熟悉的面孔和熟悉的权力游戏。
故事,好像才刚刚开始。
1
21
从2022年的熊市开始,crypto 圈一天就充斥着各种宏观经济分析,渐渐少了很多To The Moon的声音。什么非农数据,美国通胀,国债收益率... 到现如今的美股代币化市场。
各大交易所的主力交易对除了BTC ETH SOL UNI 这样的高共识Token,基本都被美股代币占据。
Crypto从一个独立市场,感觉慢慢被正规军队给收编了,市场的波动和美股高度共振了。
以后的Crypto 或许就是美股的一个细分市场区域而已。就像科创板之于大A.
1
27
最近美国中期选举之后,民主党胜出,以及美国各地对 AI 数据中心建设的限制,让我有了一些新的思考。
首先,科技巨头们的 AI 军备竞赛,可能遇到了一个现实问题:投入巨大,但价值还没有真正释放出来。
数千亿美元投入数据中心和 GPU,但 AI 带来的技术进步,并没有让普通民众明显感觉到生活变好了,或者更有钱、更便捷了。
反而是电费上涨、资源消耗、就业冲击等问题越来越现实。
当收益没有得到广泛分配,成本却由普通人承担时,不满自然会出现。这和欧洲的一些社会矛盾有相似的逻辑:没有新的增长叙事,也没有分享到增长红利,最终就会出现对现有发展模式的反弹。
其次,中国在这场算力竞赛中可能具有天然优势。
无论是电力、土地还是基础设施建设,中国的资源协调和调度能力都更强。但这也带来另一个问题:能够快速建成数据中心,不代表这些投入最终都能产生商业价值。
更值得思考的是,疯狂堆算力这条路本身,会不会就存在问题?
过去的逻辑是更大的模型需要更多 GPU,更多算力带来更强的模型能力,最终创造更大的商业价值。
但模型能力的提升,真的能够覆盖基础设施投入的增长吗?
如果不能,AI 会不会出现新的发展形态?比如更高效的小模型、边缘计算、分布式算力,以及真正能够替人完成工作的 Agent。
未来的竞争,可能不再是比谁拥有更多 GPU,而是比谁能用更少的算力创造更多价值。
最后,这件事对 Crypto 也可能带来新的机会。
一方面,资本对 AI 科技巨头的预期可能降温,市场需要寻找新的增长叙事。
另一方面,AI 越来越自主之后,身份、权限、资产、支付、结算和执行验证等问题会逐渐凸显。这些恰恰是区块链可能发挥作用的地方。
区块链本身就是一种自动运行的信任体系,在AI的高效运行下,必然需要区块链的信任作为基石
13
[Day16] 业务时序设计 -- 爆仓
爆仓意味着,用户持有的仓位NFT,价值归零,这个时候合约需要记录相应的状态,并修正协议持仓。
1️⃣ 所以爆仓行为是有协议运营方进行调用,并进行链上标记,当然也可以由用户调用,唯一需要客观的就是IndexPrice的价格来源;
2️⃣ 合约入口为 AitoEx 合约,和开平仓业务保证统一对外接口合约;
3️⃣ 链上标记仓位NFT的价值归零,并修正协议仓位,使得总仓位量是一个平衡值;
4️⃣ 为了控制链上时间延迟的问题,爆仓依然具有风险准备金率的设计。单独设计风险准备金账户,对于强平仓位剩余保证金的积累,如果出现穿仓,做出相应补偿,稳定协议;
36
[Day15] 业务时序设计 -- 平仓
平仓即用户将手里的仓位NFT卖给协议的过程
1️⃣ 开仓的合约入口为 AitoEx 合约,该合约向用户开放接口,任何人都可以进行调用;
2️⃣ keeper 和 chainlink 外部服务和合约的接入,提供一个高效和可验证的 Index price价格保证体系;
3️⃣ MarginVault 、向LiquidityPool 和用户地址进行资金流出,事实结算;
用户盈利: 获得保障金+PNL
用户亏损: 获得保障金-|PNL|
4️⃣ 协议仓位按照独仓模式,用户仓位的反向进行对协议仓位的加减操作;
协议减仓,发生MarginVault-->LiquidityPool的资金流动
38
[Day14] 业务时序设计 -- 开仓
1️⃣ 开仓的合约入口为 AitoEx 合约,该合约向用户开放接口,任何人都可以进行调用;
2️⃣ keeper 和 chainlink 外部服务和合约的接入,提供一个高效和可验证的 Index price价格保证体系;
3️⃣ Risak AMM 合约作为整个业务处理的核心代码模块。除了给用户Mint相应仓位以外,同时更新协议仓位,并完成相关结算工作;
4️⃣ MarginVault 、LiquidityPool 和用户资金,清晰的展示USDT的资金流向。
1
23
Aito-dex | Position as Asset retweeted
Announcing Ethlabs: a non-profit R&D lab for Ethereum and ETH
Our mission is to make Ethereum the settlement layer of the global economy.
The internet became global because shared protocols created a common language between networks. Private systems remained useful, but bounded. Finance is approaching a similar moment. As value, assets, and markets become digital, the world needs shared settlement infrastructure.
Ethereum is uniquely positioned to become that shared base layer, the neutral foundation on which users, institutions, and agents can transact without intermediation.
What we believe:
• We believe credible neutrality matters. Ten years of uptime and the lowest counterparty risk. Ground that cannot be pulled away by any one country, institution, company, or person.
• We believe ETH matters. The most valuable, programmable store of value. A decade of broad distribution, deep liquidity in onchain markets, and maximally trustless asset on Ethereum.
• We believe DeFi matters. Markets, liquidity, credit, exchange, and coordination, open to anyone.
• We believe adoption matters. Principles do not change the world until people benefit from them.
We sit between two worlds: real usage from the builders at the frontier, and the protocol that has to support it. We work with users, applications, wallets, L2s, infrastructure teams, institutions, ETH holders, core devs and researchers, then turn what they actually need into protocol work, shared standards, infrastructure, and shipped products.
Ethlabs is independent but Ethereum is a shared project. We are one node in a much larger network of stewards. This is the multi-node future.
We have spent the better part of the past decade contributing to Ethereum core research and development.
We are opinionated and transparent. We move with urgency, learn in public, and course-correct when we’re wrong.
We are building a lean, talent-dense team for people who want to do the most important work of their careers: [email protected]
Aito-dex | Position as Asset retweeted
刚看完以太坊新组织Ethlabs的方向,又看到以太坊基金会执行董事Aerugo长文,很值得一看,说得很清楚,比Vitalik之前说的更直白明了。
他说的重点只有一个:以太坊基金会到底该干什么和不该干什么?
以太坊要成为真正的去中心化的基础设施,要成为“数字世界的公共基础”,而不是一个被大公司或大型组织控制的金融系统。
因此,
以太坊基金会不该干什么?
• 不要为了让以太坊基金会自己显得重要、受欢迎而做事。
• 不要讨好短期炒币的人、投机者。
• 不要帮大机构站台、不要为了机构采用而妥协原则。
• 不要为了生态热度、营销、或者让某个人/项目好看而花钱。
以太坊基金会该干什么?
一是,修补以太坊的弱点(最重要)
• MEV 问题:这是目前最大的隐患之一。交易排序、打包如果被少数人控制,就会变成“表面去中心化、实际被中间商收租”。EF 要把这个作为重点攻克,不能让 MEV 变成新的中心化力量。
• 隐私:以太坊现在是公开账本,没有默认隐私就等于默认监控。必须把强隐私做成默认选项,而不是让用户自己拼一堆工具。
• Staking 中心化:如果质押、流动性质押集中在少数几家,那以太坊的安全层就可能被间接控制。要防止这个。
• 访问层和工具:钱包、接口、用户入口这些地方,不能为了好用就牺牲主权。以太坊基金会要推动真正自托管、用户真正掌控的方案。
以太坊基金会自己也要多用以太坊原生工具(比如工资多发 ETH),不能只让别人用,自己却活在传统金融体系里。
二是,抓住长期机会
• 提前做好抗量子的加密迁移(别等威胁来了再手忙脚乱)。
• 推动完全自托管的栈(钱包 + 个人 AI Agent,用户自己拥有模型和数据)。
• 让 ETH 真正成为可隐私使用的数字现金。
• 支持能在不牺牲主权的前提下规模化使用的方案(尤其是机构级应用)。
此外,关于人员离职
最近 EF 有人离职,也有一些项目要从 EF 拆出去:
• 不会在 Twitter 上公开撕逼个人恩怨。
• 拆出去的项目要看是不是符合 EF的新使命,不是所有项目都该继续拿 EF的钱。
• EF 的钱和背书是有限的,要花在真正符合使命的事上,而不是友情资助或惯性延续。
总结一下:
这篇长文在给以太坊基金会在重新画边界:
不做“让以太坊更受欢迎、更好卖”的工作,只做让以太坊保持(或恢复)其 cypherpunk 本质的工作——抗捕获、抗 MEV 剥削、保护隐私、减少对中间商的依赖。
仅个人看法:这才是以太坊执行董事应该达到的水平,还是之前的那句话,有人离开以太坊基金会对于以太坊来说不是坏事。
此外,对于以太坊基金会该干什么方面,其他没有意见,但有一点没有提到,非常非常重要:如何尽快解决L1和L2割裂的问题,如果把L2的排序权回归到L1,这对于实现以太坊的长远目标非常非常重要,期待@VitalikButerin @aerugoettinea 和基金会能重视起来。
1. Intro
Vitalik recently wrote about where the EF should go; Aya added a note to explain how we got here, and why. I’ll write about the execution.
We now have enough clarity to stop treating “what is the EF for?” as an open-ended question. Our mandate is clear: The EF exists to ensure Ethereum is, becomes, and remains real permissionless infrastructure for self-sovereignty: censorship (and capture) resistant, free and open source, private, and secure; and capable of supporting sovereignty-preserving coordination at scales where trusted institutions hitherto have been unavoidable.
The following are my thoughts on some of the points that follow from the mandate and how we are translating it to action. But first, a short reminder about
2. What the EF is not for
We are not here to optimize for EF importance, corpo/pol appeal, or ecosystem popularity. We are also not here to please short-term speculators, prop up TBTF neo-SIFIs, market every app on Ethereum, help anyone look good to their crypto or investor friends, or provide on-demand entertainment for dinner parties and private retreats.
3. What the EF is for: Eliminating weaknesses
We are here to defensively strengthen places where Ethereum is, or can still become, extractive, totalizing, or vulnerable to cartel or state capture, or authoritarian tools of surveillance or coercion.
We will base our actions on a full examination of what Ethereum is and can be at the protocol layer (what is actually running as “Ethereum”), the access layer (what users use to interact with the protocol), the user layer (the end-users who need and will need Ethereum), and the institutional layer (the intermediated paths that scale self-sovereign usage).
The EF exists to harden every surface of Ethereum, including those where Ethereum can remain formally permissionless while becoming practically captured. Some obvious surfaces are the transaction pipeline, staking and network security, access layer standards and interfaces, self-sovereignty norms, privacy expectations, institutional adoption patterns, and social layer governance processes. The primary concerns are similar across most of them: does the status quo and its future trajectory minimize trusted dependencies, minimize points of leverage and capture vectors, make user privacy the default, preserve exit, and make trust assumptions legible?
The work starts with the EF itself. We are moving compensation and major financial relationships toward ETH and mandate-compliant Ethereum-native stables, with exceptions where positive law or unavoidable operational constraints require exceptions. Rather than a purity ritual or instruction for people to take unmanaged personal risk, it is robustness, alignment, and product pressure. If the EF’s work is to make Ethereum usable as infrastructure for self-sovereignty, everyone at the EF will increasingly live inside the constraints of the system the EF exists to improve: wallet UX, volatility, accounting, privacy gaps, payment friction, stablecoin trust assumptions, recovery, dependency risk, etc. If we can’t use these tools ourselves, it is unrealistic to expect others to. Ethereum is already mature; those who do not depend on the user-facing stack have no business trying to shape its future, at any layer.
The transaction pipeline is next. Preventing toxic MEV capture is core EF work, not a peripheral market-structure concern. Transaction supply, ordering, inclusion, block construction, propagation, and settlement are part of Ethereum’s neutrality boundary. Some MEV may persist as an adversarial phenomenon the protocol contains, but it must be absolutely minimized and, for that to be possible, we must guard against the acquisition of unwarranted influence by its beneficiaries.
If credibly neutral execution is subverted by privileged orderflow, cartelized builders, trusted relays, opaque routing, or validators outsourcing into a narrow supply chain, Ethereum will look permissionless while users experience it as intermediated at the moment value moves. EF protocol work will therefore prioritize lower barriers to block building and validation, stronger inclusion guarantees, reduced extraction opacity, competitive transaction pipelines, user-facing legibility of trust assumptions, and more aggressively exploring the open orderflow solution space.
None of this is simple. A good solution in one place can aggravate problems elsewhere. FOCIL is good for censorship resistance, but it may introduce more cross-block MEV. While ePBS solves the relayer trust problem, we must make sure that its implementation does not inadvertently obstruct long-term solutions to even larger problems. It would be unacceptable, for example, if ePBS enshrining the builder economy ends up making it harder to reduce reliance on the private orderflow that has emptied out the public mempool. Encrypted mempools may not only reduce pre-execution transparency and pending orderflow visibility, but also shift competitive advantage to new privileged actors, including specialized hardware operators in some designs, while adding protocol complexity.
In order to avoid wasting time playing whack-a-mole, we must commit to solving the extraction problem at a whole system scale. Doing so will require creativity, courage, and the understanding that failure to solve this problem is unacceptable. If we fail, we will have left in place an unnecessary barrier to institutional adoption, but, more importantly, we will also have surrendered a core part of the promise of Ethereum - the replacement of extractive middlemen with permissionless, credibly neutral infrastructure and competitive markets. That must not happen.
MEV is likely to be the next major front in the cypherpunk war. We must set ourselves up to win here.
Privacy is just as fundamental. A public ledger without serious privacy defaults is a surveillance substrate with settlement guarantees. That is not an acceptable end state for the world computer. Unconditional privacy will be readily available across Ethereum, with programmability on top for selective disclosure, proofs, auditability, compliance logic, reputation, governance, identity, and other constraints chosen by users and their communities. The temporal order matters: unconditional privacy must exist first, opt-in constraints come second.
It is also important to avoid forcing users to assemble a fragile stack of special wallets, RPCs, bridges, apps, compliance providers, and operational habits to attain privacy. Deep privacy must be more secure than this. Privacy is a condition for Ethereum’s viability as freedom-respecting coordination infrastructure and as such must be robust.
Staking must be treated as protocol infrastructure risk. Staking is not merely a yield product, and liquid staking is not merely an app-layer market. If stake, liquidity, validator access, DeFi collateral, and governance influence concentrate around a small set of issuers or operators, Ethereum’s security layer becomes vulnerable to capture through capture of the economic layer around it. EF will support research, specifications, and designs that keep staking permissionless, private where possible, plural in operation, and resistant to intermediaries becoming permanent control points.
The access interfaces are where users access either the protocol directly or through intermediated defaults. The primary problem to solve here is not getting Ethereum into more rooms directly, but making its users, both end users and institutions, more self-sovereign and less susceptible to coercion, and avoiding normalization of soft coercion in exchange for reach. EF will not help Ethereum become more acceptable by sanding off the properties that make it uniquely valuable. Ethereum does not need to become another permissioned settlement backend with better branding. It needs to show, in production, that self-sovereign coordination at scale is possible.
Across Ethereum, the EF’s defensive work seeks to ensure that Ethereum is infrastructure people can still use when counterparties fail, platforms censor, governments overreach, intermediaries extract, and coordination problems become infeasible for trusted systems to handle. A core part of that is to make that infrastructure secure and robust against capture at every layer wherever capture opportunities can hide.
4. What the EF is also for: Seizing opportunities
Shoring up the fundamentals is not enough. Ethereum’s potential is still largely unrealized, but that does not mean that the path ahead is going to be straight. Opportunities must be seized when the time is right. At this moment in time, a number are visible, including:
* Ethereum becoming the first quantum-resistant global infrastructure. Ethereum researchers will lead the post-quantum cryptographic migration before the threat becomes urgent, not after it becomes a governance emergency. That means hardening Ethereum’s cryptographic foundations while there is still time to design carefully. The same applies to other long-horizon risks, where waiting for market demand means waiting until the window for principled design has already closed.
* Verifiably self-sovereign stack, from soup to nuts, whether local or remote, with no censorship or extraction openings: browsers, wallets, intents, broadcasts, orderflow, inclusion, block construction, proposal, proving, exit, and recovery. Minimal MEV, and zero toxic MEV entrenchment, either in or around the protocol. No execution layer that is formally permissionless but practically gatekept by privileged supply chains. If there’s a funnel towards an extractive private lane, there’s other options that keep the game live. The goal is not only to prevent extraction or capture, but to make credibly neutral execution competitive enough that serious users prefer it.
* Making ETH normal digital cash: a private, dignity-respecting, debasement-resistant and surveillance-resistant medium of exchange and store of value, as well as the native asset of private computation and private coordination for both humans and their agents. If Ethereum can make private economic life and private institutional life possible without routing users back through the friction and potential abuse of custodians, surveillance vendors, or permissioned ledgers with softer branding, as well as provide a venue for secure and competitive machine economics, the value unlocks will be immense.
* Personal wallets with personal AI agents that users can actually own and run on their own personal computers. Not your keys, not your coins; not your model, not your mind. As agents become interfaces for more economic and social action, the question of who owns the wallet, the model, the memory, the policy, and the signing authority becomes an existential question about sovereignty instead of UX details - we are all users above any other roles, and no one at EF will forget this.
* Institutional and enterprise use cases where Ethereum wins by not disappearing into an invisible backend, gatekept by intermediaries or terrible UX, and by not compromising into a compliant fintech rail with web3 branding. Rather, we will win through proving that credibly neutral infrastructure can handle disintermediated coordination so competitively that trusted intermediaries have to meet Ethereum users on Ethereum’s terms.
* Security-preserving scaling. L2s and related infrastructure will be able to meet institutional-level needs without accepting dependencies on closed operators, opaque sequencing, custodial UX, or upgrade committees that users cannot realistically exit. Scale is not throughput alone. Scale is the guaranteed availability of self-sovereignty under real load.
We are ensuring Ethereum remains the hardest bedrock for settlement, local and worldwide; and beyond that, a civilizational ledger and execution substrate to stand the test of time. When future civilizations speak of the infrastructure they inherited from the Antiquity of the Information Age, their first example should be Ethereum.
Ethereum will outlast all of us. More than enough people watching understand this. Many wondered why it needed saying at all, but it did. If you don't believe us or don't get it, we don't have time to try to convince you, sorry.
5. Addressing departures
There has been a lot of online speculation about departures from EF, both before and after the mandate. Some people resigned, others were terminated. Some departures were about strategy, some about role fit, some about normal institutional change, and some simply about people deciding that their best work for Ethereum should happen somewhere else. We will not litigate individual personnel matters on Twitter. That is the default because it is better for EF, better for the people involved, and better for Ethereum. People who contributed through EF deserve dignity on the way out. They do not deserve to have their employment history turned into factional content.
Where possible, we have let people describe their departures in their own words as a matter of courtesy, and not concession. If public claims materially mislead people about EF’s direction, decision-making, or mandate, we may correct the record at the level of policy, process, and institutional facts. We still will not turn personal files into public spectacle.
Ethereum is permissionless. People may disagree, criticize, compete, fork, and build elsewhere. We intend to keep exits dignified and expect others to do the same. It will suffice to say that we are thankful for what all contributors have built; we will continue to do work Ethereum needs.
6. Addressing EF spinouts
Some work should and will leave the EF in the months to come. We hope and expect this process to result in some excellent work being done in service of scaling self-sovereign adoption, but we also must take care lest it becomes an abdication of responsibility or an excuse for undisciplined spending. Some work is not mandate-compatible and should not be carried forward with EF funds or EF endorsement, either inside or outside the Foundation.
The efforts carried out by the spinouts will vary widely. Some efforts will leave EF because another org would be a better home for them; others will leave because markets should decide on their worth. Some will leave because they are not compatible with the direction set out in the mandate; others because they are useful but not EF work.
Just as a spinout is not automatically good because it reduces EF headcount, former EF affiliation is not a claim on EF funding. The question we ask when deciding on funding is not “did this come from the EF?” But, rather the questions that should be asked about all external funding:
“Is this work mandate-critical? Would the EF do this work internally if it had the organizational and financial capacity? Is there no better natural home? Can the external party execute without increasing capture risk, private extraction, opacity, or dependence? Does supporting it reduce Ethereum’s dependence on the EF over time, without prematurely transferring resources and legitimacy to new organizations and thereby risking operational failure or mission drift?”
EF funding for work being done externally can be appropriate when it is a capacity solution for mandate work - work the EF should responsibly want done; work that protects CROPS; work that advances self-sovereignty and scales it; essential work that no actor can or will reliably do without EF funding; and work that can be scoped, reviewed, and held accountable without creating a permanent dependency.
Such funding is not appropriate when it is a lazy continuity payment, a friendship payment, a reputational hedge, a way to avoid making a hard decision, or a way to support work that is not compatible with the mandate.
EF has finite funds, finite legitimacy, and a specific mandate. We will spend all three as if they matter. When we say “EF is one of many nodes”, we mean that we intend to be one of many nodes working to keep self-sovereignty and its scaling the North Star, and working to keep CROPS the undisplaceable first-class properties of the network. We don’t mean that we will support orgs or projects with different priorities. Diversity that leads to ecosystem resilience, coordination cost right-sizing, and better decision-making is good. Diversity that leads to mission drift is not.
We are not neutral on the direction Ethereum takes. CROPS are not just things we “believe in”, they are characteristics we understand must be thoughtfully prioritized at every fork for Ethereum to realize its potential. We are partisans for and builders of something of such incredible neutrality that it will fundamentally reshape the world we live in; we wish to work with everyone committed to this shared purpose.
在crypto 创新匮乏的当下,我希望这是艰难而正确的道路
[Day 0] 十年一梦,我决定回火星
10年,从“信徒”到“裁缝”
今天是 2026 年 4 月 15 日。从 2017 年入行以来这是第10个年头了。 作为一个区块链开发,我写过现货、撸过合约、切过 Swap;在 CEX 的高并发里熬过夜,也在 DEX 的流动性里踩过坑。我几乎涉猎了交易系统的每一个零件。
但最近,我感到了前所未有的失望。
那些曾经让我们热血沸腾的词:去中心化、分布式账本、平权信任模型……在如今的圈子里,似乎成了一个尴尬的冷笑话。
“谁还关心你是不是去中心化?”
当我提出想做一个完全以智能合约为载体、以纯粹数学公式为做市基础的产品——Aito-Dex 时,没有一个大佬和自己一样的觉得这才是区块链该有的样子。
“现在没人关心底层的理想。只要流量和资源,谁管你是不是去中心化?”
可是区块链本身不就是对现有规则的挑战吗?
AI 给出的最后一张入场券
面对质疑,最好的回击就是“把它做出来”。
幸运的是,2026 年 AI 的爆发式进化,给了我这个独立开发者一丝光亮。它成了我的杠杆,让一个人的大脑能撬动曾经需要整个团队才能完成的工程。
接下来的每天,我将记录 Aito-Dex 从0-1的全过程。
1
1
23
【Day 13】RiskAMM — 风险定价引擎
定位:协议仓位的完整负责人。负责协议净头寸状态维护(Qp、P_avg、A)、报价报量,以及协议加仓/减仓对应的资金划转(LP ↔ MarginVault)。用户侧资金由 AitoEx 处理,RiskAMM 只管协议侧。
核心职责:
♦️R 系数实时计算:根据 A(当期累计做市 PnL,周期性风险指标)、B(当前浮动 PnL,非对称处理)、C(敞口风险预留)和 LP TVL 实时计算风险系数 R,供 AitoEx 判断熔断和前端展示。
❤️报价(内部):根据交易方向(多/空)和当前 R 计算含点差的 entryPrice,不依赖用户 size。退出价始终等于 indexPrice,无点差。
❤️报量(内部 Q_max 函数):根据当前 LP TVL、Qp、indexPrice 动态计算协议可接受的单笔最大成交量;高 R 时 Q_max 收窄。本质是当前协议状态的函数,而非固定上限。
✅对外接口(getQuote):将报价与报量合并为单一外部方法,AitoEx 一次调用获得 entryPrice、maxSize(Q_max)和当前 R,节约跨合约调用开销。
⭕️净头寸更新(updateState):AitoEx 对开仓、平仓、爆仓均调用此方法,传入交易方向(isLong)和 size。RiskAMM 不区分用户行为,只根据方向参数更新协议净头寸 Qp 和均价 P_avg;协议仓位收缩时计算 protocolSettlement 并更新 A 值;穿越零点时分段处理(先结算旧仓,再以当前价建反向新仓)。内部直接驱动协议侧资金流:协议加仓时调用 LiquidityPool.provideMargin(LP → MarginVault),协议减仓时调用 MarginVault.protocolSettle(MarginVault → LP)。AitoEx 无需感知协议资金方向,亦不参与协议侧资金划转。
#perpdex #perp #defi
2
26
【Day 12】合约设计——AitoEx主交易入口
1️⃣价格验证三重保护:
🔸Keeper 签名验证
🔸seq 防重放 / 防选优攻击
🔸Chainlink 价格锚点比对
2️⃣开仓(openPosition):
👉接收用户 USDT 保证金,调用 RiskAMM获取 entryPrice、maxSize 和 R;
👉检查熔断、滑点保护、成交量上限;
👉转入用户保证金;
👉协议内部取反作为协议方向(用户开多 → 协议加空,用户开空 → 协议加多),更新 Qp、P_avg 并自动完成协议侧资金划转(LP ↔ MarginVault);
❤️铸造 PositionNFT 给用户。
3️⃣平仓(closePosition):
👉验证 NFT 所有权,验证签名有效期、seq 防重放、Chainlink 价格偏差 ;
👉前置检查:若 indexPrice 已达爆仓价,revert(不允许平仓,等待 Keeper 爆仓);
👉协议内部取反后执行协议减仓(协议减空 或 协议减多),并自动完成协议侧资金划转(LP ↔ MarginVault);
👉用户侧由 AitoEx 独立处理:用签名 exitPrice 与 NFT 记录的 entryPrice 计算用户 PnL,调用 MarginVault.release 向用户返还资金;
👉销毁 NFT。
4️⃣爆仓(liquidatePosition):
仅限 riskManager 角色(Keeper)调用;
👉协议取反后执行协议减仓,并完成协议侧资金划转(LP ↔ MarginVault);
👉用户侧结算仅涉及 MarginVault 与 InsuranceFund 的双向转换:
正常爆仓(有保证金残值)时 A将残值转入 Insuranc;
穿仓时 Insuranc填补缺口(出金)
👉销毁 NFT。
#perpdex #perp #DEFI
3
50












