Skip to content
This repository has been archived by the owner on Sep 22, 2023. It is now read-only.

fix: set oracle admin explicitly in feedconfig oracles #102

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion fm-demo/feedSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ async function registerFeedCreatorIfNeeded(api, aliceAccount, operatorAccount) {
}
async function createFeed(api, sender) {
console.log(`Creating feed with config: ${JSON.stringify(feedConfig, null, 4)}`);

// make the pallet admin also the oracle admin
const palletAdmin = await api.query.chainlinkFeed.palletAdmin();
feedConfig.oracles = feedConfig.oracles.map(oracle => [oracle, palletAdmin]);
Comment on lines +44 to +46
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattsse let's make the oracle admin same as the oracle, same as the original intention

Suggested change
// make the pallet admin also the oracle admin
const palletAdmin = await api.query.chainlinkFeed.palletAdmin();
feedConfig.oracles = feedConfig.oracles.map(oracle => [oracle, palletAdmin]);
feedConfig.oracles = feedConfig.oracles.map(oracle => [oracle, oracle]);


return new Promise(async (resolve) => {
await api.tx.chainlinkFeed.createFeed(feedConfig.payment, feedConfig.timeout, feedConfig.submissionValueBounds, feedConfig.minSubmissions, feedConfig.decimals, feedConfig.description, feedConfig.restartDelay, feedConfig.oracles,feedConfig.pruningWindow,feedConfig.maxDebt).signAndSend(sender, ({ status, events }) => {
await api.tx.chainlinkFeed.createFeed(feedConfig.payment, feedConfig.timeout, feedConfig.submissionValueBounds, feedConfig.minSubmissions, feedConfig.decimals, feedConfig.description, feedConfig.restartDelay,feedConfig.oracles,feedConfig.pruningWindow,feedConfig.maxDebt).signAndSend(sender, ({ status, events }) => {
if (status.isInBlock || status.isFinalized) {
events
// find/filter for failed events
Expand Down
4 changes: 3 additions & 1 deletion substrate-node-example/types.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,7 @@
"answered_in_round": "RoundId"
},
"RoundDataOf": "RoundData",
"SubmissionBounds": "(u32, u32)"
"SubmissionBounds": "(u32, u32)",
"BlockNumberFor": "BlockNumber",
"FeedValueFor": "Value"
}