From 52f02b75b6706ee455a32ff83617dd5afb7342a7 Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Mon, 24 Jun 2024 21:20:03 -0600 Subject: [PATCH] fix(builders): use proper `oracleBrand` subkey case --- golang/cosmos/app/app.go | 35 ++++++++----------- .../scripts/vats/updateStAtomPriceFeed.js | 2 +- .../scripts/vats/updateStkAtomPriceFeed.js | 2 +- 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/golang/cosmos/app/app.go b/golang/cosmos/app/app.go index 8cc7d52d0e9..ba400e763e8 100644 --- a/golang/cosmos/app/app.go +++ b/golang/cosmos/app/app.go @@ -927,11 +927,6 @@ func isFirstTimeUpgradeOfThisVersion(app *GaiaApp, ctx sdk.Context) bool { return true } -type BrandInfo struct { - Name string - Oracle string -} - // upgradePriceFeedCoreProposalSteps returns the core proposal steps for the // price feed upgrade and associated changes to scaledPriceAuthority and // vaultManager. @@ -988,21 +983,21 @@ func upgradePriceFeedCoreProposalSteps(upgradeName string) ([]vm.CoreProposalSte return nil, err } - var inBrands []BrandInfo + var inBrandNames []string switch upgradeName { case "UNRELEASED_A3P_INTEGRATION", "UNRELEASED_main": - inBrands = []BrandInfo{ - {"ATOM", "ATOM"}, - {"stATOM", "stAtom"}, - {"stOSMO", "stOSMO"}, - {"stTIA", "stTIA"}, - {"stkATOM", "stkAtom"}, + inBrandNames = []string{ + "ATOM", + "stATOM", + "stOSMO", + "stTIA", + "stkATOM", } case "UNRELEASED_devnet": - inBrands = []BrandInfo{ - {"ATOM", "ATOM"}, - {"stTIA", "stTIA"}, - {"stkATOM", "stkAtom"}, + inBrandNames = []string{ + "ATOM", + "stTIA", + "stkATOM", } } @@ -1011,14 +1006,14 @@ func upgradePriceFeedCoreProposalSteps(upgradeName string) ([]vm.CoreProposalSte return nil, err } - proposals := make(vm.CoreProposalStep, 0, len(inBrands)) - for _, inBrand := range inBrands { - instanceName := inBrand.Name + "-USD price feed" + proposals := make(vm.CoreProposalStep, 0, len(inBrandNames)) + for _, inBrandName := range inBrandNames { + instanceName := inBrandName + "-USD price feed" instanceNameJson, err := json.Marshal(instanceName) if err != nil { return nil, err } - inBrandLookup := []string{"agoricNames", "oracleBrand", inBrand.Oracle} + inBrandLookup := []string{"agoricNames", "oracleBrand", inBrandName} inBrandLookupJson, err := json.Marshal(inBrandLookup) if err != nil { return nil, err diff --git a/packages/builders/scripts/vats/updateStAtomPriceFeed.js b/packages/builders/scripts/vats/updateStAtomPriceFeed.js index 6d3c226b30e..456c1b73fff 100644 --- a/packages/builders/scripts/vats/updateStAtomPriceFeed.js +++ b/packages/builders/scripts/vats/updateStAtomPriceFeed.js @@ -3,7 +3,7 @@ import { priceFeedProposalBuilder } from './priceFeedSupport.js'; const OPTIONS = { AGORIC_INSTANCE_NAME: 'stATOM-USD price feed', - IN_BRAND_LOOKUP: ['agoricNames', 'oracleBrand', 'stAtom'], + IN_BRAND_LOOKUP: ['agoricNames', 'oracleBrand', 'stATOM'], OUT_BRAND_LOOKUP: ['agoricNames', 'oracleBrand', 'USD'], }; diff --git a/packages/builders/scripts/vats/updateStkAtomPriceFeed.js b/packages/builders/scripts/vats/updateStkAtomPriceFeed.js index 2fd2a671f1e..1226b7e201f 100644 --- a/packages/builders/scripts/vats/updateStkAtomPriceFeed.js +++ b/packages/builders/scripts/vats/updateStkAtomPriceFeed.js @@ -3,7 +3,7 @@ import { priceFeedProposalBuilder } from './priceFeedSupport.js'; const OPTIONS = { AGORIC_INSTANCE_NAME: 'stkATOM-USD price feed', - IN_BRAND_LOOKUP: ['agoricNames', 'oracleBrand', 'stkAtom'], + IN_BRAND_LOOKUP: ['agoricNames', 'oracleBrand', 'stkATOM'], OUT_BRAND_LOOKUP: ['agoricNames', 'oracleBrand', 'USD'], };