Skip to content

Commit

Permalink
chore(default-params): Copy add-STARS.js to inter-protocol then bui…
Browse files Browse the repository at this point in the history
…ld proposal

Refs: #12
  • Loading branch information
anilhelvaci committed May 7, 2024
1 parent 7646a5c commit 494c0c5
Show file tree
Hide file tree
Showing 6 changed files with 6,353 additions and 0 deletions.
43 changes: 43 additions & 0 deletions proposals/b:default-params/add-STARS.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { makeHelpers } from '@agoric/deploy-script-support';
import { defaultProposalBuilder as vaultProposalBuilder } from './add-collateral-core.js';
import { defaultProposalBuilder as oraclesProposalBuilder } from './price-feed-core.js';

/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */
export const starsVaultProposalBuilder = async powers => {
return vaultProposalBuilder(powers, {
interchainAssetOptions: {
// Values for the Stargaze token on Osmosis
denom:
'ibc/987C17B11ABC2B20019178ACE62929FE9840202CE79498E29FE8E5CB02B7C0A4',
decimalPlaces: 6,
keyword: 'STARS',
oracleBrand: 'STARS',
proposedName: 'STARS',
},
});
};

/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */
export const starsOraclesProposalBuilder = async powers => {
return oraclesProposalBuilder(powers, {
AGORIC_INSTANCE_NAME: `STARS-USD price feed`,
IN_BRAND_LOOKUP: ['agoricNames', 'oracleBrand', 'STARS'],
IN_BRAND_DECIMALS: 6,
OUT_BRAND_LOOKUP: ['agoricNames', 'oracleBrand', 'USD'],
OUT_BRAND_DECIMALS: 4,
oracleAddresses: [
// copied from decentral-main-vaults-config.json
'agoric1krunjcqfrf7la48zrvdfeeqtls5r00ep68mzkr',
'agoric19uscwxdac6cf6z7d5e26e0jm0lgwstc47cpll8',
'agoric144rrhh4m09mh7aaffhm6xy223ym76gve2x7y78',
'agoric19d6gnr9fyp6hev4tlrg87zjrzsd5gzr5qlfq2p',
'agoric1n4fcxsnkxe4gj6e24naec99hzmc4pjfdccy5nj',
],
});
};

export default async (homeP, endowments) => {
const { writeCoreProposal } = await makeHelpers(homeP, endowments);
await writeCoreProposal('add-STARS', starsVaultProposalBuilder);
await writeCoreProposal('add-STARS-oracles', starsOraclesProposalBuilder);
};
11 changes: 11 additions & 0 deletions proposals/b:default-params/eval.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Exit when any command fails
set -e

source /usr/src/upgrade-test-scripts/env_setup.sh

ls -al

# XXX using Ava serial to script the core-eval
yarn ava add-collateral.test.js
27 changes: 27 additions & 0 deletions proposals/b:default-params/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "test-a3p-anil",
"agoricProposal": {
"type": "/agoric.swingset.CoreEvalProposal"
},
"type": "module",
"license": "Apache-2.0",
"dependencies": {
"@agoric/deploy-script-support": "^0.10.4-u15.0",
"@agoric/inter-protocol": "^0.14.1-dev-fb2c249.0",
"@agoric/synthetic-chain": "^0.1.0",
"@agoric/time": "^0.3.3-u14.0",
"@agoric/vats": "^0.15.2-u15.0",
"@endo/zip": "^0.2.35",
"ava": "^5.3.1",
"better-sqlite3": "^8.5.1",
"execa": "^7.2.0",
"tmp": "^0.2.1"
},
"scripts": {
"agops": "yarn --cwd /usr/src/agoric-sdk/ --silent agops"
},
"ava": {
"timeout": "30s"
},
"packageManager": "[email protected]"
}
38 changes: 38 additions & 0 deletions proposals/b:default-params/test-defaultParams.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import test from 'ava';
import {
// executeCommand,
// makeFileRW,
// makeWebCache,
// makeWebRd,
// bundleDetail,
proposalBuilder,
// readBundles,
// passCoreEvalProposal,
} from '@agoric/synthetic-chain';
import * as fsp from 'fs/promises';
// import { existsSync } from 'fs';
// import { tmpName } from 'tmp';
// import * as path from 'path';

const config = {
script: './add-STARS.js',
dest: '/usr/src/agoric-sdk/packages/inter-protocol/scripts/add-STARS.js',
};

test.serial('copy add-STARS.js to @agoric/inter-protocol/scripts', async t => {
await fsp.cp(config.script, config.dest);
t.pass();1
});

test.serial.only('build prop', async t => {
const {
evals,
bundles
} = await proposalBuilder(config.dest);
t.log({
evals,
bundles
});

t.pass();
})
4 changes: 4 additions & 0 deletions proposals/b:default-params/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# TODO stATOM-USD price feed instance in agoricNames
# TODO manager in vstorage
# TODO price feed in vstorage - after setting prices
# TODO create a vault as dapp-inter does
Loading

0 comments on commit 494c0c5

Please sign in to comment.