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 2 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
2 changes: 2 additions & 0 deletions contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@
},
"dependencies": {
"@agoric/ertp": "^0.16.3-u12.0",
"@agoric/vat-data": "0.5.3-u16.1",
amessbee marked this conversation as resolved.
Show resolved Hide resolved
"@agoric/zoe": "^0.26.3-u12.0",
"@agoric/zone": "^0.3.0-u16.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What impact does this have on the contract bundle size? Does it introduce duplicate dependencies?

Other dependencies in this dapp (zoe, ertp) look like they're from u12. IME, mixing u12 and u16 is asking for trouble.

I know dapp-agoric-basics uses u14: Agoric/dapp-agoric-basics@817bc8a

Are you familiar with the fragility of dependency versions?

It looks like @Jovonni managed to use u16 in dapp-orchestration-basics, though it took some troubleshooting. See item 9 in particular.

"@endo/far": "^0.2.22",
"@endo/marshal": "^0.8.9",
"@endo/patterns": "^0.2.5"
Expand Down
18 changes: 15 additions & 3 deletions contract/src/offer-up.contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
*/
// @ts-check

import { Far } from '@endo/far';
// 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 '@agoric/zoe/exported.js';

import { makeDurableZone } from '@agoric/zone/durable.js';
amessbee marked this conversation as resolved.
Show resolved Hide resolved
const { Fail, quote: q } = assert;
import { makeScalarBigMapStore } from '@agoric/vat-data';
amessbee marked this conversation as resolved.
Show resolved Hide resolved

// #region bag utilities
/** @type { (xs: bigint[]) => bigint } */
Expand Down Expand Up @@ -72,6 +73,16 @@ export const customTermsShape = meta.customTermsShape;
export const start = async zcf => {
const { tradePrice, maxItems = 3n } = zcf.getTerms();

/**
* TODO: below is somewhat fake way of generating a zone. This should be fixed by passing it as a parameter.
* RN I don't know how to do it.
*/
const baggage = makeScalarBigMapStore('baggage', {
keyShape: M.string(),
durable: true,
});
const zone = makeDurableZone(baggage);

amessbee marked this conversation as resolved.
Show resolved Hide resolved
/**
* a new ERTP mint for items, accessed thru the Zoe Contract Facet.
* Note: `makeZCFMint` makes the associated brand and issuer available
Expand Down Expand Up @@ -133,7 +144,8 @@ export const start = async zcf => {
zcf.makeInvitation(tradeHandler, 'buy items', undefined, proposalShape);

// Mark the publicFacet Far, i.e. reachable from outside the contract
amessbee marked this conversation as resolved.
Show resolved Hide resolved
const publicFacet = Far('Items Public Facet', {
// const myexo = makeExo('Items Public Facet', undefined);
amessbee marked this conversation as resolved.
Show resolved Hide resolved
const publicFacet = zone.exo('Items Public Facet', undefined, {
makeTradeInvitation,
});
return harden({ publicFacet });
Expand Down
Loading