Skip to content

Commit

Permalink
Merge branch 'master' into iomekam-es-lint-2
Browse files Browse the repository at this point in the history
  • Loading branch information
iomekam authored Jan 15, 2025
2 parents 9eebf36 + 9f46b37 commit 3ee26ee
Show file tree
Hide file tree
Showing 34 changed files with 520 additions and 5,753 deletions.
1 change: 1 addition & 0 deletions a3p-integration/proposals/f:fast-usdc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add-operators
9 changes: 2 additions & 7 deletions a3p-integration/proposals/f:fast-usdc/deploy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@
/* eslint-env node */
import test from 'ava';
import '@endo/init/legacy.js'; // axios compat
import { makeSmartWalletKit } from '@agoric/client-utils';
import { LOCAL_CONFIG, makeSmartWalletKit } from '@agoric/client-utils';

const io = {
delay: ms => new Promise(resolve => setTimeout(() => resolve(undefined), ms)),
fetch: global.fetch,
};
const networkConfig = {
rpcAddrs: ['http://0.0.0.0:26657'],
chainName: 'agoriclocal',
};

test('fastUsdc is in agoricNames.instance', async t => {
const { agoricNames } = await makeSmartWalletKit(io, networkConfig);
const { agoricNames } = await makeSmartWalletKit(io, LOCAL_CONFIG);

t.log('agoricNames.instance keys', Object.keys(agoricNames.instance));
t.truthy(agoricNames.instance.fastUsdc);
Expand Down
78 changes: 78 additions & 0 deletions a3p-integration/proposals/f:fast-usdc/operators.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/* eslint-env node */
import unknownTest from 'ava';

import '@endo/init/legacy.js'; // axios compat

import { LOCAL_CONFIG, makeVstorageKit } from '@agoric/client-utils';
import { evalBundles, waitForBlock } from '@agoric/synthetic-chain';

// XXX ~copied to not take a dependency on Zoe
/**
* @typedef {object} InvitationDetails
* @property {unknown} installation
* @property {unknown} instance
* @property {InvitationHandle} handle
* @property {string} description
* @property {Record<string, any>} [customDetails]
*/

/**
* @import {VstorageKit} from '@agoric/client-utils';
*/

const test = /** @type {import('ava').TestFn<{ vstorageKit: VstorageKit}>} */ (
unknownTest
);

const ADD_OPERATORS_DIR = 'add-operators';

/**
* @typedef {import('@agoric/ertp').NatAmount} NatAmount
* @typedef {{
* allocations: { Fee: NatAmount, USD_LEMONS: NatAmount },
* }} ReserveAllocations
*/

test.before(async t => {
const vstorageKit = makeVstorageKit({ fetch }, LOCAL_CONFIG);

t.context = {
vstorageKit,
};
});

test.serial('add operators', async t => {
const { vstorageKit } = t.context;

const walletPath =
// account mem3 in test of crabble-start proposal (64)
// This must match the oracleNew value in the add-operators builder argument
'wallet.agoric1hmdue96vs0p6zj42aa26x6zrqlythpxnvgsgpr.current';

const readInvitationsPurseBalance = async () => {
const curr = await vstorageKit.readPublished(walletPath);
return /** @type {InvitationDetails[]} */ (curr.purses[0].balance.value);
};

let numInvitationsBefore = 0;
{
const invBalance = await readInvitationsPurseBalance();
numInvitationsBefore = invBalance.length;
t.false(
invBalance.some(inv => inv.description === 'oracle operator invitation'),
);
}

await evalBundles(ADD_OPERATORS_DIR);
// give time for the invitations to be deposited
await waitForBlock(5);

{
const invBalance = await readInvitationsPurseBalance();
console.log('after', invBalance);
t.is(invBalance.length, numInvitationsBefore + 1);
t.true(
invBalance.some(inv => inv.description === 'oracle operator invitation'),
);
}
});
3 changes: 2 additions & 1 deletion a3p-integration/proposals/f:fast-usdc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"agoricProposal": {
"source": "subdir",
"sdk-generate": [
"fast-usdc/init-fast-usdc.js submission --net A3P_INTEGRATION --noNoble"
"fast-usdc/start-fast-usdc.build.js submission --net A3P_INTEGRATION --noNoble",
"fast-usdc/add-operators.build.js add-operators --oracle oracleNew:agoric1hmdue96vs0p6zj42aa26x6zrqlythpxnvgsgpr"
],
"type": "/agoric.swingset.CoreEvalProposal"
},
Expand Down
3 changes: 3 additions & 0 deletions a3p-integration/proposals/f:fast-usdc/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash
set -euo pipefail

echo AVAILABLE WALLETs
agd query vstorage children published.wallet

yarn ava

./test-cli.sh
1 change: 0 additions & 1 deletion a3p-integration/proposals/s:stake-bld/.yarnrc.yml

This file was deleted.

6 changes: 0 additions & 6 deletions a3p-integration/proposals/s:stake-bld/README.md

This file was deleted.

81 changes: 0 additions & 81 deletions a3p-integration/proposals/s:stake-bld/package.json

This file was deleted.

24 changes: 0 additions & 24 deletions a3p-integration/proposals/s:stake-bld/test-lib/index.js

This file was deleted.

39 changes: 0 additions & 39 deletions a3p-integration/proposals/s:stake-bld/test-lib/wallet.js

This file was deleted.

10 changes: 0 additions & 10 deletions a3p-integration/proposals/s:stake-bld/test.sh

This file was deleted.

16 changes: 0 additions & 16 deletions a3p-integration/proposals/s:stake-bld/tsconfig.json

This file was deleted.

Loading

0 comments on commit 3ee26ee

Please sign in to comment.