Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using/Teaching zone.exo instead of Far #89

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft
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
12 changes: 8 additions & 4 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,24 @@ on:
jobs:
unit:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Use Node.js 18.8.x
- name: Use Node.js LTS versions
uses: actions/setup-node@v3
with:
# use node 18.8.x until Agoric/agoric-sdk#8636
node-version: "18.8.x"
node-version: ${{ matrix.node-version }}
- name: yarn install
run: yarn
- name: yarn lint
run: yarn lint
- name: yarn build
run: yarn build
- name: yarn test
run: yarn test --exclude "**/e2e/**"
integration:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -71,4 +75,4 @@ jobs:
path: |
ui/test/e2e/videos
ui/test/e2e/screenshots
continue-on-error: true
continue-on-error: true
3 changes: 2 additions & 1 deletion contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"typescript": "~5.2.2"
},
"dependencies": {
"@agoric/zone": "0.2.3-u12.0",
"@agoric/ertp": "^0.16.3-u12.0",
"@agoric/zoe": "^0.26.3-u12.0",
"@endo/far": "^0.2.22",
Expand Down Expand Up @@ -83,4 +84,4 @@
"arrowParens": "avoid",
"singleQuote": true
}
}
}
12 changes: 8 additions & 4 deletions contract/src/offer-up.contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
*/
// @ts-check

import { Far } from '@endo/far';
import { M, getCopyBagEntries } from '@endo/patterns';
import { AssetKind } from '@agoric/ertp/src/amountMath.js';
import { AmountShape } from '@agoric/ertp/src/typeGuards.js';
import { atomicRearrange } from '@agoric/zoe/src/contractSupport/atomicTransfer.js';
import { makeDurableZone } from '@agoric/zone/durable.js';
amessbee marked this conversation as resolved.
Show resolved Hide resolved
import '@agoric/zoe/exported.js';

const { Fail, quote: q } = assert;


// #region bag utilities
/** @type { (xs: bigint[]) => bigint } */
const sum = xs => xs.reduce((acc, x) => acc + x, 0n);
Expand Down Expand Up @@ -68,9 +69,12 @@ export const customTermsShape = meta.customTermsShape;
* - handles offers to buy up to `maxItems` items at a time.
*
* @param {ZCF<OfferUpTerms>} zcf
* @param {*} _privateArgs
* @param {import('@agoric/ertp').Baggage} baggage
*/
export const start = async zcf => {
export const start = async (zcf, _privateArgs, baggage) => {
const { tradePrice, maxItems = 3n } = zcf.getTerms();
const zone = makeDurableZone(baggage);

/**
* a new ERTP mint for items, accessed thru the Zoe Contract Facet.
Expand Down Expand Up @@ -132,8 +136,8 @@ export const start = async zcf => {
const makeTradeInvitation = () =>
zcf.makeInvitation(tradeHandler, 'buy items', undefined, proposalShape);

// Mark the publicFacet Far, i.e. reachable from outside the contract
const publicFacet = Far('Items Public Facet', {
// Use zone.exo to make a publicFacet suitable for use by remote callers.
const publicFacet = zone.exo('Items Public Facet', undefined, {
makeTradeInvitation,
});
return harden({ publicFacet });
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@
],
"resolutions-note": "work-around for https://github.com/Agoric/agoric-sdk/issues/8621",
"resolutions": {
"ses": "1.3.0",
"ses": "1.7.0",
"@endo/bundle-source": "2.5.2-upstream-rollup",
"@endo/captp": "3.1.1",
"@endo/compartment-mapper": "0.8.4",
"@endo/far": "0.2.18",
"@endo/init": "0.5.56",
"@endo/marshal": "0.8.5",
"@endo/marshal": "1.5.2",
"@endo/nat": "4.1.27",
"@endo/promise-kit": "0.2.56",
"@endo/lockdown": "0.1.28",
"@endo/import-bundle": "0.3.4",
"@endo/base64": "0.2.31",
"@endo/zip": "0.2.31",
"@endo/eventual-send": "0.17.2",
"@endo/patterns": "0.2.2",
"@endo/eventual-send": "1.2.4",
"@endo/patterns": "1.4.2",
"@endo/stream": "0.3.25",
"@endo/exo": "0.2.2",
"@endo/pass-style": "0.1.3",
"@endo/exo": "1.5.2",
"@endo/pass-style": "1.4.2",
"@endo/check-bundle": "0.2.18",
"@endo/ses-ava": "0.2.40",
"@endo/netstring": "0.3.26",
Expand Down Expand Up @@ -59,4 +59,4 @@
"serve": "^14.2.1"
},
"dependencies": {}
}
}
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@
"arrowParens": "avoid",
"singleQuote": true
}
}
}
Loading
Loading