# 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.
Steps
- Ensure
Sender
is module admin - Ensure
msg.Config.OnchainConfig.LinkDenom
is module param'sLinkDenom
- Set
OnchainConfig.ChainId
fromctx.ChainID
- Ensure
FeedConfig
with sameFeedId
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
andmsg.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
isfeedAdmin
orbillingAdmin
- 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
, - 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.
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
andfeedId
- Reset payee for
feedId
andtransmitter
- Delete pending payeeship transfer for
transmitter
offeedId