Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
2 changes: 1 addition & 1 deletion agoric/contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
},
"devDependencies": {
"@agoric/eslint-config": "agoric-upgrade-11",
"@endo/eslint-plugin": "^0.4.4",
"@agoric/swingset-vat": "^0.32.2",
"@endo/eslint-plugin": "^0.4.4",
"@endo/promise-kit": "^0.2.59",
"@jessie.js/eslint-plugin": "^0.4.0",
"ava": "^4.3.1",
Expand Down
2 changes: 2 additions & 0 deletions agoric/contract/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ export const prepare = async (zcf, privateArgs, baggage) => {
zcf,
privateArgs.initialPoserInvitation,
{},
powers.storageNode,
powers.marshaller,
);

const { governorFacet } = makeDurableGovernorFacet(
Expand Down
11 changes: 9 additions & 2 deletions agoric/contract/src/kreadKit.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { assert } from '@agoric/assert';
import { AmountMath, BrandShape } from '@agoric/ertp';
import { prepareExoClassKit, M } from '@agoric/vat-data';
import { makeDurableZone } from '@agoric/zone/durable.js';
import { subscribeLatest } from '@agoric/notifier/subscribe.js';

import { E } from '@endo/eventual-send';
import { errors } from './errors.js';
Expand Down Expand Up @@ -1016,7 +1017,10 @@ export const prepareKreadKit = (
const characterLevel = characterFacet.calculateLevel(asset.name);

const subscriber = E(seat).getSubscriber();
void E.when(E(subscriber).getUpdateSince(), () => {
const asyncIterableP = subscribeLatest(subscriber);
const asyncIteratorP = E(asyncIterableP)[Symbol.asyncIterator]();

E.when(E(asyncIteratorP).next(), () => {
marketFacet.updateMetrics('character', {
marketplaceAverageLevel: {
type: 'remove',
Expand All @@ -1036,7 +1040,10 @@ export const prepareKreadKit = (
const { seat, asset, id, recorderKit } = entry;

const subscriber = E(seat).getSubscriber();
E.when(E(subscriber).getUpdateSince(), () => {
const asyncIterableP = subscribeLatest(subscriber);
const asyncIteratorP = E(asyncIterableP)[Symbol.asyncIterator]();

E.when(E(asyncIteratorP).next(), () => {
marketFacet.updateMetrics('item', {
marketplaceAverageLevel: {
type: 'remove',
Expand Down
1 change: 0 additions & 1 deletion agoric/contract/src/proposal/start-kread-proposal.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
marketplaceListingsLegendary,
} from './base-inventory.js';

import '@agoric/governance/src/types-ambient.js';
import { AmountMath } from '@agoric/ertp/src/amountMath.js';

const KREAD_LABEL = 'KREAd';
Expand Down
14 changes: 7 additions & 7 deletions agoric/contract/src/type-guards.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export const PublicI = M.interface('public', {
makeBuyItemInvitation: M.call().returns(M.promise()),
// Getters
getCharacters: M.call().returns(M.array()),
getCharacterInventory: M.call().returns(M.splitRecord({ items: M.array() })),
getCharacterInventory: M.call(M.string()).returns(M.splitRecord({ items: M.array() })),
getCharactersForSale: M.call().returns(M.array()),
getItemsForSale: M.call().returns(M.array()),
getMarketMetrics: M.call().returns(M.record()),
Expand All @@ -131,7 +131,7 @@ export const CreatorI = M.interface('creator', {
M.arrayOf(ItemGuard),
).returns(),
initializeCharacterNamesEntries: M.call().returns(),
publishItemCollection: M.call().returns(M.promise()),
publishItemCollection: M.call(M.record(), M.array()).returns(M.promise()),
});

export const CharacterI = M.interface('character', {
Expand All @@ -140,7 +140,7 @@ export const CharacterI = M.interface('character', {
unequip: M.call().returns(M.promise()),
unequipAll: M.call().returns(M.promise()),
swap: M.call().returns(M.promise()),
validateInventoryState: M.call().returns(M.boolean()),
validateInventoryState: M.call(M.array()).returns(M.boolean()),
isNameUnique: M.call(M.string()).returns(M.boolean()),
getRandomBaseIndex: M.call().returns(M.any()),
calculateLevel: M.call(M.string()).returns(M.gte(0)),
Expand All @@ -154,8 +154,8 @@ export const CharacterI = M.interface('character', {

export const ItemI = M.interface('item', {
mint: M.call().returns(M.promise()),
mintDefaultBatch: M.call().returns(M.promise(M.string())),
mintBatch: M.call().returns(M.promise(M.string())),
mintDefaultBatch: M.call(M.remotable()).returns(M.promise(M.string())),
mintBatch: M.call(M.remotable(), M.array()).returns(M.promise(M.string())),
initializeBaseItems: M.call(M.arrayOf(ItemGuard)).returns(),
});

Expand Down Expand Up @@ -203,8 +203,8 @@ export const MarketEntryGuard = M.splitRecord({
export const MarketI = M.interface('market', {
sellItem: M.call().returns(M.promise()),
buyItem: M.call().returns(M.promise()),
buyFirstSaleItem: M.call().returns(M.promise()),
buySecondarySaleItem: M.call().returns(M.promise()),
buyFirstSaleItem: M.call(M.remotable(), M.remotable(), M.record()).returns(M.promise()),
buySecondarySaleItem: M.call(M.remotable(), M.remotable(), M.record()).returns(M.promise()),
handleExitItem: M.call(MarketEntryGuard).returns(),
handleExitCharacter: M.call(MarketEntryGuard).returns(),
makeMarketItemRecorderKit: M.call(M.number()).returns(M.promise()),
Expand Down
5 changes: 5 additions & 0 deletions agoric/contract/test/test-market.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { makeCopyBag } from '@agoric/store';
import { errors } from '../src/errors.js';
import { defaultItems } from './items.js';
import { multiplyBy } from '@agoric/zoe/src/contractSupport/ratio.js';
import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js';

test.before(async (t) => {
const bootstrap = await bootstrapContext();
Expand Down Expand Up @@ -277,6 +278,8 @@ test.serial('---| MARKET - Buy character', async (t) => {
bob.depositPayment(bobsPayout);
t.deepEqual(bob.getPaymentBalance(), 40n, 'Bob received payout');

await eventLoopIteration();

charactersForSale = await E(publicFacet).getCharactersForSale();
t.deepEqual(
charactersForSale.length,
Expand Down Expand Up @@ -649,6 +652,8 @@ test.serial(
'Alice received payout',
);

await eventLoopIteration();

charactersForSale = await E(publicFacet).getCharactersForSale();
t.deepEqual(
charactersForSale.length,
Expand Down
28 changes: 28 additions & 0 deletions agoric/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,34 @@
"dependencies": {
"agoric": "agoric-upgrade-11"
},
"resolutions": {
"@agoric/assert": "dev",
"@agoric/cosmic-proto": "dev",
"@agoric/deploy-script-support": "dev",
"@agoric/ertp": "dev",
"@agoric/governance": "dev",
"@agoric/internal": "dev",
"@agoric/notifier": "dev",
"@agoric/store": "dev",
"@agoric/time": "dev",
"@agoric/vat-data": "dev",
"@agoric/vats": "dev",
"@agoric/zoe": "dev",
"@agoric/zone": "dev",
"@cosmjs/crypto": "^0.32.1",
"@cosmjs/encoding": "^0.32.1",
"@cosmjs/math": "^0.32.1",
"@cosmjs/proto-signing": "^0.32.1",
"@cosmjs/stargate": "^0.31.1",
"@endo/bundle-source": "^3.4.2",
"@endo/eventual-send": "^1.2.7",
"@endo/far": "^1.1.5",
"@endo/init": "^1.1.4",
"@endo/marshal": "^1.6.1",
"@endo/patterns": "^1.4.6",
"@endo/ses-ava": "^1.2.7",
"import-meta-resolve": "^2.2.1"
},
"scripts": {
"lint": "yarn workspaces run lint-fix",
"lint-check": "yarn workspaces run lint-check",
Expand Down
Loading