Messages

In this section we describe the processing of the ocr messages and the corresponding updates to the state.

Msg/CreateFeed

MsgCreateFeed is a message to create feed config and it is restricted message that is executable by module admin.

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

Steps

  • Ensure Sender is module admin

  • Ensure msg.Config.OnchainConfig.LinkDenom is module param's LinkDenom

  • Set OnchainConfig.ChainId from ctx.ChainID

  • Ensure FeedConfig with same FeedId does not exist

  • Set latest EpochAndRound to (0, 0)

  • Set feed config for feedId

  • Set feed trasmissions count and observations count to 1

Msg/UpdateFeed

MsgCreateFeed is a message to update feed config and it is restricted message that is executable by feed admin or feed billing admin.

Steps

  • Get previous feed config by feedId and ensure it exists

  • Ensure Sender is feed admin or feed billing admin

  • Ensure billing admin is not changing Signers, Transmitters and feed admin

  • Process rewards payout for previous feed config

  • Delete previous feed transmission and observation counts

  • Set latest EpochAndRound to (0, 0)

  • Update signers, transmitters, LinkPerObservation, LinkPerTransmission, LinkDenom, FeedAdmin, BillingAdmin if set.

Msg/Transmit

MsgTransmit is a message to transmit a report for specific feed. When broadcasting the message, there should be enough amount of signatures from observers to be accepted.

Steps

  • Get epoch and round for feedId

  • Ensure that the report is not staled one by checking msg.Epoch and msg.Round

  • Get feed config and config info from feedId

  • Check msg.ConfigDigest equals to feed config info's latest config digest

  • Check if transmitter is valid transmitter configured in feedConfig

  • Save transmitter report

  • Emit event for trasmission

  • Validate signatures and the number of signatures

  • Increment feed observation and transmission counts

Msg/FundFeedRewardPool

MsgFundFeedRewardPool is a message to add funds to feed reward pool to be given to transmitters and observers.

Steps

  • Get previous reward pool amount from feedId

  • If previous amount is empty, initiate the pool amount with zero integer

  • Ensure previous amount denom is not different from deposit denom if exist

  • Send coins from account to the module account (ocr module)

  • Update reward pool amount with amount field addition

  • Call AfterFundFeedRewardPool hook if hooks is set

Msg/WithdrawFeedRewardPool

MsgFundFeedRewardPool is a message to withdraw funds from feed reward pool and is restricted to feed admin or billing admin.

Steps

  • Get feed config from feedId

  • Ensure msg.Sender is feedAdmin or billingAdmin

  • Process reward for the feed

  • Withdraw specified amount msg.Amount from module account

Msg/SetPayees

MsgSetPayees is a message to set payee for transmitters - it is restricted to feed admin. Once it's set, it should be changed only by payee.

Steps

  • Get feed config from feedId and ensure that feed config exists

  • Ensure msg.Sender is feed admin

  • Iterating msg.Transmitters,

    1. Ensure payee is set already for the transmitter

    1. Set payee for the transmitter

Msg/TransferPayeeship

MsgTransferPayeeship is a message to transfer payeeship for a specific transmitter of feed. After execution, pending payeeship object is created.

Steps

  • Get feed config from feedId and ensure that feed config exists

  • Ensure msg.Sender is current payee

  • Check previous pending payeeship transfer record and ensure previous payeeship transfer does not conflict

  • Set payeeship transfer record

Msg/AcceptPayeeship

MsgTransferPayeeship is a message to accept payeeship for a specific transmitter of feed.

Steps

  • Get feed config from feedId and ensure that feed config exists

  • Get pending payeeship transfer record for msg.Transmitter and feedId

  • Reset payee for feedId and transmitter

  • Delete pending payeeship transfer for transmitter of feedId

Last updated