Skip to content

Commit

Permalink
fix(builders): use proper oracleBrand subkey case
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig authored and mhofman committed Jun 26, 2024
1 parent 5cc190d commit 52f02b7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 22 deletions.
35 changes: 15 additions & 20 deletions golang/cosmos/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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",
}
}

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/builders/scripts/vats/updateStAtomPriceFeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
};

Expand Down
2 changes: 1 addition & 1 deletion packages/builders/scripts/vats/updateStkAtomPriceFeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
};

Expand Down

0 comments on commit 52f02b7

Please sign in to comment.