Skip to content

Commit

Permalink
Merge pull request #7417 from Agoric/clean-up-swingset-runner-bitrot
Browse files Browse the repository at this point in the history
chore: clean up bitrot in swingset-runner
  • Loading branch information
mergify[bot] authored Apr 14, 2023
2 parents 357bae8 + 07dd902 commit 5d158b2
Show file tree
Hide file tree
Showing 13 changed files with 215 additions and 139 deletions.
12 changes: 9 additions & 3 deletions packages/swingset-runner/demo/exchangeBenchmark/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ export function buildRootObject(_vatPowers, vatParameters) {
);
const zoe = await E(vats.zoe).buildZoe(vatAdminSvc);

const exchange = await E(zoe).install(exchangeBundle.bundle);
const exchange = await E(zoe).install(
exchangeBundle.bundle,
'exchangeTestContract',
);

const grubStake = [
[3, 0], // Alice: 3 moola, no simoleans
[0, 3], // Bob: no moola, 3 simoleans
[3n, 0n], // Alice: 3 moola, no simoleans
[0n, 3n], // Bob: no moola, 3 simoleans
];

const all = [makeIssuerKit('moola'), makeIssuerKit('simoleans')];
Expand All @@ -55,6 +58,9 @@ export function buildRootObject(_vatPowers, vatParameters) {
const { publicFacet } = await E(zoe).startInstance(
exchange,
issuerKeywordRecord,
undefined,
undefined,
'contractInstance',
);

alice = E(vats.alice).build(zoe, issuers, alicePayments, publicFacet);
Expand Down
14 changes: 7 additions & 7 deletions packages/swingset-runner/demo/exchangeBenchmark/exchanger.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ async function build(name, zoe, issuers, payments, publicFacet) {
const buyOrderInvitation = await E(publicFacet).makeInvitation();

const mySellOrderProposal = harden({
give: { Asset: moola(1) },
want: { Price: simoleans(1) },
give: { Asset: moola(1n) },
want: { Price: simoleans(1n) },
exit: { onDemand: null },
});
const paymentKeywordRecord = {
Asset: await E(moolaPurseP).withdraw(moola(1)),
Asset: await E(moolaPurseP).withdraw(moola(1n)),
};
const seat = await E(zoe).offer(
buyOrderInvitation,
Expand All @@ -86,12 +86,12 @@ async function build(name, zoe, issuers, payments, publicFacet) {
);

const myBuyOrderProposal = harden({
want: { Asset: moola(1) },
give: { Price: simoleans(1) },
want: { Asset: moola(1n) },
give: { Price: simoleans(1n) },
exit: { onDemand: null },
});
const paymentKeywordRecord = {
Price: await E(simoleanPurseP).withdraw(simoleans(1)),
Price: await E(simoleanPurseP).withdraw(simoleans(1n)),
};

const seatP = await E(zoe).offer(
Expand All @@ -105,7 +105,7 @@ async function build(name, zoe, issuers, payments, publicFacet) {
await postReport(quiet);
}

return harden({
return Far('exchanger', {
initiateTrade,
respondToTrade,
});
Expand Down
4 changes: 2 additions & 2 deletions packages/swingset-runner/demo/swapBenchmark/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ export function buildRootObject(_vatPowers, vatParameters) {
};

const startingValues = [
[3, 0], // Alice: 3 moola, no simoleans
[0, 3], // Bob: no moola, 3 simoleans
[3n, 0n], // Alice: 3 moola, no simoleans
[0n, 3n], // Bob: no moola, 3 simoleans
];

({ alice, bob } = makeVats(vats, zoe, installations, startingValues));
Expand Down
12 changes: 6 additions & 6 deletions packages/swingset-runner/demo/swapBenchmark/exchanger.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ async function build(name, zoe, issuers, payments, installations) {
);

const sellProposal = harden({
give: { Asset: moola(1) },
want: { Price: simoleans(1) },
give: { Asset: moola(1n) },
want: { Price: simoleans(1n) },
exit: { onDemand: null },
});
const paymentKeywordRecord = {
Asset: await E(moolaPurseP).withdraw(moola(1)),
Asset: await E(moolaPurseP).withdraw(moola(1n)),
};

const seatP = E(zoe).offer(invitation, sellProposal, paymentKeywordRecord);
Expand All @@ -86,12 +86,12 @@ async function build(name, zoe, issuers, payments, installations) {
);

const buyProposal = harden({
want: { Asset: moola(1) },
give: { Price: simoleans(1) },
want: { Asset: moola(1n) },
give: { Price: simoleans(1n) },
exit: { onDemand: null },
});
const paymentKeywordRecord = {
Price: await E(simoleanPurseP).withdraw(simoleans(1)),
Price: await E(simoleanPurseP).withdraw(simoleans(1n)),
};

const seatP = await E(zoe).offer(
Expand Down
2 changes: 1 addition & 1 deletion packages/swingset-runner/demo/zoeTests/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const makeVats = (log, vats, zoe, installations, startingValues) => {
const { mints, issuers, brands } = setupBasicMints();
const makePayments = values =>
mints.map((mint, i) =>
mint.mintPayment(AmountMath.make(brands[i], values[i])),
mint.mintPayment(AmountMath.make(brands[i], BigInt(values[i]))),
);
const [aliceValues, bobValues, carolValues, daveValues] = startingValues;

Expand Down
4 changes: 2 additions & 2 deletions packages/swingset-runner/demo/zoeTests/prepareContracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const CONTRACT_FILES = [
'autoswap',
'coveredCall',
{
contractPath: 'auction/secondPriceAuction',
contractPath: 'auction/index',
bundleName: 'secondPriceAuction',
},
'atomicSwap',
Expand All @@ -31,7 +31,7 @@ const generateBundlesP = Promise.all(
({ bundleName, contractPath } = settings);
}
const sourceUrl = await importMetaResolve(
`@agoric/zoe/src/contracts/${contractPath}`,
`@agoric/zoe/src/contracts/${contractPath}.js`,
import.meta.url,
);
const sourcePath = new URL(sourceUrl).pathname;
Expand Down
4 changes: 1 addition & 3 deletions packages/swingset-runner/demo/zoeTests/sampleArgs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ coveredCallOk
swapForOptionOk
secondPriceAuctionOk
atomicSwapOk
simpleExchangeOk
simpleExchangeNotifier
autoswapOk
sellTicketsOk
otcDeskOk
badTimer
4 changes: 4 additions & 0 deletions packages/swingset-runner/demo/zoeTests/swingset.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
"otcDeskOk": [
[10000, 10000, 10000],
[10000, 10000, 10000]
],
"badTimer": [
[3, 0, 0],
[0, 0, 0]
]
}
}
Expand Down
Loading

0 comments on commit 5d158b2

Please sign in to comment.