Skip to content

Commit

Permalink
test: step: provision a smartWallet for an oracle operator
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc committed Nov 21, 2023
1 parent d91a925 commit 5bf1757
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion packages/vats/test/bootstrapTests/test-wallet-upgrade.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// @ts-check
import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js';
import { eventLoopIteration } from '@agoric/notifier/tools/testSupports.js';
import { makeAgoricNamesRemotesFromFakeStorage } from '../../tools/board-utils.js';
import { makeWalletFactoryDriver } from './drivers.js';
import { makeSwingsetTestKit } from './supports.js';

const { Fail } = assert;

/**
* @type {import('ava').TestFn<
Expand All @@ -8,12 +14,49 @@ import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js';
*/
const test = anyTest;

const makeTestContext = async t => ({});
// main/production config doesn't have initialPrice, upon which 'open vaults' depends
const PLATFORM_CONFIG = '@agoric/vats/decentral-itest-vaults-config.json';

const makeTestContext = async t => {
const swingsetTestKit = await makeSwingsetTestKit(t, 'bundles/wallet', {
configSpecifier: PLATFORM_CONFIG,
});

const { runUtils, storage } = swingsetTestKit;
console.timeLog('DefaultTestContext', 'swingsetTestKit');
const { EV } = runUtils;

// vaultFactoryKit is one of the last things produced in bootstrap.
await EV.vat('bootstrap').consumeItem('vaultFactoryKit');

await eventLoopIteration();
// wait for bootstrap to settle before looking in storage for brands etc.
const agoricNamesRemotes = makeAgoricNamesRemotesFromFakeStorage(
swingsetTestKit.storage,
);
agoricNamesRemotes.brand.ATOM || Fail`ATOM brand not yet defined`;

const walletFactoryDriver = await makeWalletFactoryDriver(
runUtils,
storage,
agoricNamesRemotes,
);

return {
walletFactoryDriver,
};
};

test.before(async t => (t.context = await makeTestContext(t)));

test('update purse balance across upgrade', async t => {
const oraAddr = 'agoric1oracle-operator';
const { walletFactoryDriver } = t.context;
t.log('provision a smartWallet for an oracle operator');
const oraWallet = await walletFactoryDriver.provideSmartWallet(oraAddr);
t.log(oraWallet);
t.truthy(oraWallet);

t.log('upgrade zoe');
t.log(
'start a new fluxAggregator for something like stATOM, using the address from 1 as one of the oracleAddresses',
Expand Down

0 comments on commit 5bf1757

Please sign in to comment.