Sei中文文档(Sei Docs CHN)-by Chainguys
  • 导览(INTRODUCTION)
    • 版权声明(Copyright Notice)
    • 概览 (Overview)
    • Sei 设计空间 (Sei Design Space)
    • DEX 优化 (DEX Optimizations)
    • Sei 生态系统 (Sei Ecosystem)
  • 智能合约和本地开发 (Smart contracts & local development)
    • Sei工具指南 (Sei Tool Guide)
    • 设置一个本地节点 (Set up a local network)
    • 本地 Sei 脚本部署 (Local Sei script deployment)
    • Sei.go
    • CosmWasm合约测试 (CosmWasm Contract Testing)
    • 部署通用合约 (Deploy a generic contract)
    • 部署交易合约 (Deploy an exchange contract)
    • 非完整节点下部署和开发 (Deploy & develop without Full Node)
    • Dex 模块教程 (Dex Module Tutorial)
    • 代币工厂模块教程 (Tokenfactory Module Tutorial)
    • IBC转账 (IBC Transfers)
  • 订单匹配(order match)
    • 并行性 (Parallelism)
    • 资格 (Eligibility)
    • DEX 合约间依赖 (DEX Inter—Contract Dependencies)
    • 白名单商店 (Whitelisted Store)
  • 节点&验证者 (NODES&VALIDATORS)
    • 加入测试网 (Joining Testnets)
    • 更新 (Upgrades)
    • Seinami激励测试网 (Seinami Incentivized Testnet)
      • 加入激励测试网 (Joining Incentivized Testnet)
      • 所有测试任务 (All Testnet Missions)
      • 行为准则 (Code of Conduct)
      • 奖励发放详情 (Rewards Distribution Details)
  • 基础API端点 (Basic API Endpoints)
  • 模块化端点 (Module Endpoints)
  • 状态同步 (Statesync)
  • 恢复操作(Recovery Operations)
  • 治理(GOVERNANCE)
    • 创建提案 (Creating Proposals)
    • 管理质押 (Managing Staking)
    • 对提案投票表决 (Voting on Proposals)
  • 预言机(ORACLE)
    • 预言机参与 (Oracle Participation)
  • 钱包(WALLETS)
    • 钱包集成(Wallet Integration)
    • 转账 (Transfers)
  • 更多(More)
    • 推特(Twitter)
由 GitBook 提供支持
在本页
  1. 订单匹配(order match)

DEX 合约间依赖 (DEX Inter—Contract Dependencies)

To ensure deterministic outcome, we ask contract developers to explicitly specify what other contract dependencies their contract has, during registration with the DEX module. Contract A is considered to depend on contract B if the response of any of contract A's sudo calls may contain order placement/cancellation messages to contract B. For example, a perp contract might need to place orders on a spot contract during its own order placement process to support features like multi-collateral. In that case, the perp contract will need to specify its dependency on the spot contract. The CLI syntax to register a contract with dependencies is as follow:

为了保证确定性的结果,我们要求合约开发人员在向 DEX 模块注册期间明确指定他们的合约具有哪些其他合约依赖项。 如果合约A的任何响应 sudo 调用可能包含对合约B的下单/取消消息,则合约A被视为依赖于合约B。例如,永续合约可能需要在其自己的下单过程中对现货合约下订单,以支持多抵押等功能。在这种情况下,永久合约将需要指定其对现货合约的依赖。使用依赖项注册合约的 CLI 语法如下:

seid tx dex register-contract [contract address] [code id] \
    [need hook] [need order matching] [dependency1,dependency2,...]

In the above perp-spot example, assuming perp's address is sei14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sh9m79m and spot's address is sei1fzm6gzyccl8jvdv3qq6hp9vs6ylaruervs4m06c7k0ntzn2f8faq8un0p6, the CLI to register perp would be:

在上面的 perp-spot 示例中,假设永续合约的地址是 sei14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sh9m79m 并且现货的地址是 sei1fzm6gzyccl8jvdv3qq6hp9vs6ylaruervs4m06c7k0ntzn2f8fapq8un06,CLI 将注册:

seid tx dex register-contract sei14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sh9m79m \
    1 true true sei1fzm6gzyccl8jvdv3qq6hp9vs6ylaruervs4m06c7k0ntzn2f8faq8un0p6

Note that the registration is an upsert operation, so registering the same contract multiple times will update its registration information.

注意注册是一个合并(upsert)操作,所以多次注册同一个合约会更新它的注册信息。

循环依赖 (Circular Dependency)

Circular dependency is not allowed and will be rejected if detected upon contract registration. For example, if contract A is already registered to depend on contract B, then a registration of contract B that specifies contract A as a dependency will fail.

不允许循环依赖,如果在合约注册时检测到,将被拒绝。例如,如果合约A已经注册为依赖于合约B,那么将合约A指定为依赖项的合约B的注册将失败。

上一页资格 (Eligibility)下一页白名单商店 (Whitelisted Store)

最后更新于2年前