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
Senderis module adminEnsure
msg.Config.OnchainConfig.LinkDenomis module param'sLinkDenomSet
OnchainConfig.ChainIdfromctx.ChainIDEnsure
FeedConfigwith sameFeedIddoes not existSet latest
EpochAndRoundto(0, 0)Set feed config for
feedIdSet 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.
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;
}Steps
Get previous feed config by
feedIdand ensure it existsEnsure
Senderis feed admin or feed billing adminEnsure 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.
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;
}Steps
Get epoch and round for
feedIdEnsure that the report is not staled one by checking
msg.Epochandmsg.RoundGet feed config and config info from
feedIdCheck msg.ConfigDigest equals to feed config info's latest config digest
Check if transmitter is valid transmitter configured in
feedConfigSave 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.
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];
}Steps
Get previous reward pool amount from
feedIdIf 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 additionCall
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.
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];
}Steps
Get feed config from
feedIdEnsure
msg.SenderisfeedAdminorbillingAdminProcess 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.
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;
}Steps
Get feed config from
feedIdand ensure that feed config existsEnsure
msg.Senderis feed adminIterating
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.
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;
}Steps
Get feed config from
feedIdand ensure that feed config existsEnsure 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.
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;
}Steps
Get feed config from
feedIdand ensure that feed config existsGet pending payeeship transfer record for
msg.TransmitterandfeedIdReset payee for
feedIdandtransmitterDelete pending payeeship transfer for
transmitteroffeedId
Last updated