Injective | Documentation
InjectiveGithub
Injective | 中文文档
Injective | 中文文档
  • 关于 Injective
  • 快速入门
    • 钱包
      • 创建钱包
      • 账户
      • 质押
      • 治理
      • 拍卖
    • 代币标准
      • INJ 代币
      • Token Factory
      • CW20 标准
    • 交易
      • Gas 和 Fees
  • 指南
    • 创建钱包
    • 桥接
      • From Ethereum
      • Using Wormhole
      • Using IBC
      • From Solana
    • 发布代币
    • 发布市场
    • Denom 元数据
    • 获取INJ
  • 工具包
    • injectived
      • 安装 injectived
      • 使用 injectived
      • 指令
    • Injective TS SDK
    • Injective Go SDK
    • Injective Python SDK
    • Injective CW SDK
    • The Graph
  • 参考
  • 术语表
  • 开发者
    • 快速入门
      • 指南
        • 测试网提案
        • 转换地址
        • 计算
          • 最低价格刻度
          • 最低数量刻度
    • 交易所开发者
      • 构建 DEX
      • 预言机提供方
    • Cosmwasm 开发者
      • 您的首个智能合约
      • 指南
        • 本地开发
        • 主网开发
        • 给部署地址白名单
        • 创建您的 Swap 合约
        • 创建 UIs
      • CW20 适配器
      • Injective Test Tube
    • 模块
      • Injective
        • 拍卖(Auction)
          • State
          • 消息
          • EndBlock
          • 事件
          • 参数
        • 交易所(Exchange)
          • 衍生品市场概念
          • 现货市场概念
          • 二元期权市场概念
          • 其他概念
          • 状态
          • 状态转换
          • 消息
          • 提案
          • BeginBlock
          • EndBlock
          • 事件
          • 参数
          • MsgPrivilegedExecuteContract
        • 保险(Insurance)
          • 状态
          • 状态转换
          • 消息
          • EndBlock
          • 事件
          • 参数
          • 改进
        • OCR
          • 概念
          • 状态
          • 消息
          • 提案
          • BeginBlock
          • 钩子(Hooks)
          • 事件
          • 参数
        • 预言机(Oracle)
          • 状态
          • Keeper
          • 消息
          • 提案
          • 事件
          • 改进
        • Peggy
          • 定义
          • 工作流
          • 状态
          • 消息
          • 处罚
          • EndBlock
          • 事件
          • 参数
          • 中继语义
          • 改进
        • 权限(Permissions)
          • 概念
          • 状态
          • 状态转换
        • 代币工厂(TokenFactory)
          • 概念
          • 状态
          • 消息
          • 事件
          • 参数
        • WasmX
          • 概念
          • 数据
          • 提案
          • 消息
          • 参数
      • 核心
        • Auth
        • AuthZ
        • 银行(Bank)
        • 共识(Consensus)
        • 危机(Crisis)
        • 分发(Distribution)
        • 证据(Evidence)
        • 费用授权(Feegrant)
        • 治理(Gov)
        • 群组(Group)
        • 铸造(Mint)
        • NFT
        • 参数(Params)
        • 惩罚(Slashing)
        • 质押(Staking)
        • 升级(Upgrade)
        • Circuit
        • Genutils
    • dApps 开发文档
  • 节点
    • 快速入门
      • 和节点交互
      • 运行节点
        • 设置密钥环
        • 加入网络
        • Cosmovisor
        • 升级您的节点
    • 验证者
      • 主网
        • Peggo
        • 规范链升级
          • Upgrade to 10002-rc1
          • Upgrade to 10002-rc2
          • Upgrade to 10003-rc1
          • Upgrade to 10004-rc1
          • Upgrade to 10004-rc1-patch
          • Upgrade to 10005-rc1
          • Upgrade to 10006-rc1
          • Upgrade to 10007-rc1
          • Upgrade to 10008 - Camelot
          • Upgrade to 10009
          • Upgrade to v1.10
          • Upgrade to v1.11
          • Upgrade to v1.12.0 - Volan
          • Upgrade to v1.12.1
          • Upgrade to v1.13.0 - Altaris
          • Upgrade to v1.13.2
          • Upgrade to v1.13.3
          • Upgrade to v1.14.0
          • Upgrade to v1.14.1
      • 测试网
        • 测试网 Peggo
    • 公共端点
    • 高级端点
    • Injective 索引器设置
  • 交易员
    • 快速入门
    • 文档
    • API 参考
  • 常用链接
    • Injective 101
    • Injective Hub
    • Injective 浏览器
    • Chain API Reference
    • Indexer API Reference
    • 测试网水龙头
Powered by GitBook
On this page
  • Msg/CreateFeed
  • Msg/UpdateFeed
  • Msg/Transmit
  • Msg/FundFeedRewardPool
  • Msg/WithdrawFeedRewardPool
  • Msg/SetPayees
  • Msg/TransferPayeeship
  • Msg/AcceptPayeeship
Export as PDF
  1. 开发者
  2. 模块
  3. Injective
  4. OCR

消息

在本节中,我们描述了 OCR 消息的处理过程及其对状态的相应更新。

Msg/CreateFeed

MsgCreateFeed 是用于创建 Feed 配置的消息,它是一个受限制的消息,仅能由模块管理员执行。

message MsgCreateFeed {
  option (gogoproto.equal) = false;
  option (gogoproto.goproto_getters) = false;
  string sender = 1;
  FeedConfig config = 2;
}

步骤:

  1. 确保发送者是模块管理员。

  2. 确保 msg.Config.OnchainConfig.LinkDenom 与模块参数中的 LinkDenom 匹配。

  3. 从 ctx.ChainID 设置 OnchainConfig.ChainId。

  4. 确保相同 FeedId 的 FeedConfig 不存在。

  5. 将最新的 EpochAndRound 设置为 (0, 0)。

  6. 设置给定 FeedId 的 Feed 配置。

  7. 将 Feed 传输计数和观测计数设置为 1。

Msg/UpdateFeed

MsgCreateFeed 是用于更新 Feed 配置的消息,它是一个受限制的消息,仅能由 Feed 管理员或 Feed 计费管理员执行。

message MsgUpdateFeed {
  option (gogoproto.equal) = false;
  option (gogoproto.goproto_getters) = false;
  string sender = 1;
  // feed_id is an unique ID for the target of this config
  string feed_id = 2;
  // signers ith element is address ith oracle uses to sign a report
  repeated string signers = 3;
  // transmitters ith element is address ith oracle uses to transmit a report via the transmit method
  repeated string transmitters = 4;
  // Fixed LINK reward for each observer
  string link_per_observation = 5[
    (gogoproto.customtype) = "cosmossdk.io/math.Int",
    (gogoproto.nullable) = true
  ];
  // Fixed LINK reward for transmitter
  string link_per_transmission = 6[
    (gogoproto.customtype) = "cosmossdk.io/math.Int",
    (gogoproto.nullable) = true
  ];
  // Native denom for LINK coin in the bank keeper
  string link_denom = 7;
  // feed administrator
  string feed_admin = 8;
  // feed billing administrator
  string billing_admin = 9;
}

步骤:

  1. 根据 FeedId 获取之前的 Feed 配置,并确保其存在。

  2. 确保发送者是 Feed 管理员或 Feed 计费管理员。

  3. 确保计费管理员未更改签名者、传输者和 Feed 管理员。

  4. 处理之前的 Feed 配置的奖励支付。

  5. 删除之前的 Feed 传输和观测计数。

  6. 将最新的 EpochAndRound 设置为 (0, 0)。

  7. 如果设置了,则更新签名者、传输者、LinkPerObservation、LinkPerTransmission、LinkDenom、FeedAdmin 和 BillingAdmin。

Msg/Transmit

MsgTransmit 是用于传输特定 Feed 的报告的消息。在广播该消息时,必须有足够的观察者签名才能被接受。

message MsgTransmit {
  option (gogoproto.equal) = false;
  option (gogoproto.goproto_getters) = false;
  // Address of the transmitter
  string transmitter = 1;
  bytes config_digest = 2;
  string feed_id = 3;
  uint64 epoch = 4;
  uint64 round = 5;
  bytes extra_hash = 6;
  Report report = 7;
  repeated bytes signatures = 8;
}

步骤:

  1. 获取 feedId 的 epoch 和 round。

  2. 通过检查 msg.Epoch 和 msg.Round 确保报告不是过期的。

  3. 从 feedId 获取 Feed 配置和配置信息。

  4. 检查 msg.ConfigDigest 是否等于 Feed 配置信息的最新配置摘要。

  5. 检查传输者是否是 FeedConfig 中配置的有效传输者。

  6. 保存传输者的报告。

  7. 触发传输事件。

  8. 验证签名及签名数量。

  9. 增加 Feed 的观测和传输计数。

Msg/FundFeedRewardPool

MsgFundFeedRewardPool 是一条消息,用于向 Feed 奖励池中添加资金,这些资金将分配给传输者和观察者。

message MsgFundFeedRewardPool {
  option (gogoproto.equal) = false;
  option (gogoproto.goproto_getters) = false;

  string sender = 1;
  string feed_id = 2;
  cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false];
}

步骤:

  1. 获取 feedId 的之前奖励池金额。

  2. 如果之前的金额为空,则将池金额初始化为零。

  3. 确保之前的金额 denom 与存款 denom 相同(如果存在)。

  4. 从账户向模块账户(OCR 模块)发送币。

  5. 使用金额字段增加更新奖励池金额。

  6. 如果设置了钩子,则调用 AfterFundFeedRewardPool 钩子。

Msg/WithdrawFeedRewardPool

MsgFundFeedRewardPool 是一条消息,用于从 Feed 奖励池中提取资金,仅限 Feed 管理员或计费管理员执行。

message MsgWithdrawFeedRewardPool {
  option (gogoproto.equal) = false;
  option (gogoproto.goproto_getters) = false;

  string sender = 1;
  string feed_id = 2;
  cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false];
}

步骤:

  1. 获取 feedId 的 Feed 配置。

  2. 确保 msg.Sender 是 Feed 管理员或计费管理员。

  3. 为 Feed 处理奖励。

  4. 从模块账户中提取指定金额 msg.Amount。

Msg/SetPayees

MsgSetPayees 是一条消息,用于为传输者设置支付方,仅限 Feed 管理员执行。一旦设置,只有支付方才能更改。

message MsgSetPayees {
  option (gogoproto.equal) = false;
  option (gogoproto.goproto_getters) = false;

  string sender = 1;
  string feed_id = 2;
  // addresses oracles use to transmit the reports
  repeated string transmitters = 3;
  // addresses of payees corresponding to list of transmitters
  repeated string payees = 4;
}

步骤:

  1. 获取 feedId 的 Feed 配置,并确保 Feed 配置存在。

  2. 确保 msg.Sender 是 Feed 管理员。

  3. 遍历 msg.Transmitters,

    1. 确保传输者已经设置了支付方。

    2. 为传输者设置支付方。

Msg/TransferPayeeship

MsgTransferPayeeship 是一条消息,用于转移特定传输者的 Feed 支付权。在执行后,将创建一个待处理的支付权对象。

message MsgTransferPayeeship {
  option (gogoproto.equal) = false;
  option (gogoproto.goproto_getters) = false;

  // transmitter address of oracle whose payee is changing
  string sender = 1;
  string transmitter = 2;
  string feed_id = 3;
  // new payee address
  string proposed = 4;
}

步骤:

  1. 获取 feedId 的 Feed 配置,并确保 Feed 配置存在。

  2. 确保 msg.Sender 是当前的支付方。

  3. 检查之前的待处理支付权转移记录,确保之前的支付权转移不会冲突。

  4. 设置支付权转移记录。

Msg/AcceptPayeeship

MsgTransferPayeeship 是一条消息,用于接受特定传输者的 Feed 支付权。

message MsgAcceptPayeeship {
  option (gogoproto.equal) = false;
  option (gogoproto.goproto_getters) = false;
  // new payee address
  string payee = 1;
  // transmitter address of oracle whose payee is changing
  string transmitter = 2;
  string feed_id = 3;
}

步骤:

  1. 获取 feedId 的 Feed 配置,并确保 Feed 配置存在。

  2. 获取 msg.Transmitter 和 feedId 的待处理支付权转移记录。

  3. 重置 feedId 和传输者的支付方。

Previous状态Next提案

Last updated 2 months ago