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.
- Ensure
Senderis module admin - Ensure
msg.Config.OnchainConfig.LinkDenomis module param’sLinkDenom - Set
OnchainConfig.ChainIdfromctx.ChainID - Ensure
FeedConfigwith sameFeedIddoes not exist - Set latest
EpochAndRoundto(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.
- Get previous feed config by
feedIdand ensure it exists - Ensure
Senderis 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
EpochAndRoundto(0, 0) - Update signers, transmitters,
LinkPerObservation,LinkPerTransmission,LinkDenom,FeedAdmin,BillingAdminif 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.
- Get epoch and round for
feedId - Ensure that the report is not staled one by checking
msg.Epochandmsg.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.
- 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 (
ocrmodule) - Update reward pool amount with
amountfield addition - Call
AfterFundFeedRewardPoolhook 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.
- Get feed config from
feedId - Ensure
msg.SenderisfeedAdminorbillingAdmin - Process reward for the feed
- Withdraw specified amount
msg.Amountfrom 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.
- Get feed config from
feedIdand ensure that feed config exists - Ensure
msg.Senderis feed admin - Iterating
msg.Transmitters, -
- Ensure payee is set already for the transmitter
-
- 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.
- Get feed config from
feedIdand 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.
- Get feed config from
feedIdand ensure that feed config exists - Get pending payeeship transfer record for
msg.TransmitterandfeedId - Reset payee for
feedIdandtransmitter - Delete pending payeeship transfer for
transmitteroffeedId
