Skip to content

Commit

Permalink
stkAtom price feed (#9394)
Browse files Browse the repository at this point in the history
closes: #9393

## Description

Add a new priceFeed for StkATOM.

### Security Considerations

None

### Scaling Considerations

None

### Documentation Considerations

None

### Testing Considerations

[**Edited**]: added verification to an existing test in A3P.

### Upgrade Considerations

This completes the sustainability upgrade by replacing the only
priceFeed that wasn't handled in the A3P tests.
  • Loading branch information
mergify[bot] committed May 28, 2024
2 parents bb3d92f + 5a5630a commit 08f8549
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const checkPriceFeedVatsUpdated = async t => {
checkForOracle(t, 'stATOM'),
checkForOracle(t, 'stTIA'),
checkForOracle(t, 'stOSMO'),
checkForOracle(t, 'stkATOM'),
]);
};

Expand All @@ -51,12 +52,14 @@ const tryPushPrices = async t => {
await addOraclesForBrand('stATOM', oraclesByBrand);
await addOraclesForBrand('stTIA', oraclesByBrand);
await addOraclesForBrand('stOSMO', oraclesByBrand);
await addOraclesForBrand('stkATOM', oraclesByBrand);

t.log('pushing new prices');
await pushPrices(11.2, 'ATOM', oraclesByBrand);
await pushPrices(11.3, 'stTIA', oraclesByBrand);
await pushPrices(11.4, 'stATOM', oraclesByBrand);
await pushPrices(11.5, 'stOSMO', oraclesByBrand);
await pushPrices(11.6, 'stkATOM', oraclesByBrand);

t.log('awaiting new quotes');
const atomOut = await getPriceQuote('ATOM');
Expand All @@ -67,6 +70,8 @@ const tryPushPrices = async t => {
t.is(stAtomOut, '+11400000');
const osmoOut = await getPriceQuote('stOSMO');
t.is(osmoOut, '+11500000');
const stkAtomOut = await getPriceQuote('stkATOM');
t.is(stkAtomOut, '+11600000');
};

const createNewBid = async t => {
Expand Down
1 change: 1 addition & 0 deletions golang/cosmos/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,7 @@ func unreleasedUpgradeHandler(app *GaiaApp, targetUpgrade string) func(sdk.Conte
"@agoric/builders/scripts/vats/updateStAtomPriceFeed.js",
"@agoric/builders/scripts/vats/updateStOsmoPriceFeed.js",
"@agoric/builders/scripts/vats/updateStTiaPriceFeed.js",
"@agoric/builders/scripts/vats/updateStkAtomPriceFeed.js",
),
// Add new auction contract. The old one will be retired shortly.
vm.CoreProposalStepForModules( "@agoric/builders/scripts/vats/add-auction.js"),
Expand Down
21 changes: 21 additions & 0 deletions packages/builders/scripts/vats/updateStkAtomPriceFeed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { makeHelpers } from '@agoric/deploy-script-support';
import { priceFeedProposalBuilder } from './priceFeedSupport.js';

const OPTIONS = {
AGORIC_INSTANCE_NAME: 'stkATOM-USD price feed',
IN_BRAND_LOOKUP: ['agoricNames', 'oracleBrand', 'stkAtom'],
OUT_BRAND_LOOKUP: ['agoricNames', 'oracleBrand', 'USD'],
};

/**
* @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder}
*/
export const defaultProposalBuilder = async ({ publishRef, install }) => {
return priceFeedProposalBuilder({ publishRef, install }, OPTIONS);
};

export default async (homeP, endowments) => {
const { writeCoreProposal } = await makeHelpers(homeP, endowments);

await writeCoreProposal('stkATOMPriceFeed', defaultProposalBuilder);
};

0 comments on commit 08f8549

Please sign in to comment.