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

Zoe release 0.7.0 #1143

Merged
merged 28 commits into from
Jun 30, 2020
Merged

Zoe release 0.7.0 #1143

merged 28 commits into from
Jun 30, 2020

Conversation

katelynsills
Copy link
Contributor

@katelynsills katelynsills commented May 29, 2020

Release v0.7.0 (29-June-2020)

Zoe Service changes:

  • Instead of zoe.makeInstance returning an invite only, it now
    returns a record of { invite, instanceRecord } such that
    information like the instanceHandle can be obtained directly from
    the instanceRecord.
  • installationHandle, the identifier for the code that is used to
    create a new running contract instance, is added to the extent of
    invites for contracts so that interested parties can easily check
    whether their invite is using the code they expect.
  • brandKeywordRecord is added as a property of instanceRecord
    alongside issuerKeywordRecord. brandKeywordRecord is an object
    with keyword keys and brand values.
  • zoe.install now only accepts a single argument (bundle) and
    the old module format will error.

Zoe Contract Facet (zcf) changes:

  • zcf.reallocate no longer accepts a third argument sparseKeywords
    and no longer expects the keywords for different offers to be the
    same. Within reallocate, the offer safety check compares the user's
    proposal to the user's allocation, and the rights conservation check
    adds up the amounts by brand to ensure the totals are the same.
    Neither of these checks requires that the keywords for the
    allocations be the same for different offers.
  • zcf.getCurrentAllocation and zcf.getCurrentAllocations no longer
    take sparseKeywords as a parameter. Instead, brandKeywordRecord is
    an optional parameter. If omitted, amounts are returned only for
    brands for which an allocation currently exists.
  • zcf.getInstanceRecord() no longer takes a parameter
  • brandKeywordRecord is added as a property of instanceRecord
    alongside issuerKeywordRecord. brandKeywordRecord is an object
    with keyword keys and brand values.
  • zcf.getAmountMaths has been subsumed by zcf.getAmountMath which
    takes a single brand parameter.
  • zcf.getBrandForIssuer has been added. It synchronously returns the
    brand for a given issuer already known to Zoe.
  • zoe.getInstance, which was deprecated earlier, has been removed.
  • cancelObj and cancelObj.cancel(), which were deprecated earlier,
    have been removed.

Changes for Zoe contract developers:

  • Zoe contracts are now expected to return only an invite as the
    result of makeContract. If the contracts want to have a
    publicAPI, they can do so through zcf.initPublicAPI.
  • Contracts can allow different offers to use different keywords for
    the same issuers. For example, publicAuction, the second price
    auction contract, uses 'Asset' and 'Ask'
    for the seller keywords and 'Asset' and 'Bid' for the buyer
    keywords.

Built-in Zoe contract changes:

  • We added more comments to the start of the built-in Zoe contracts.
  • The operaTickets contract has been split into two contracts: a
    generic sellItems contract that sells fungible or nonfungible
    items at a set price for money, and a generic mintAndSellNFT
    contract that mints NFT tokens and then immediately creates a new
    sellItems instance to sell them. The original operaTicket tests
    are able to use these contracts.
  • The getCurrentPrice helper in bondingCurves.js has been renamed
    to getInputPrice and now only returns the outputExtent.
  • A new built-in contract was added: barter-exchange.js. Barter
    Exchange takes offers for trading arbitrary goods for one another.
  • Autoswap now has different keywords for different actions that can
    be taken. For example, a swap should have the keywords 'In' and
    'Out'.
  • Multipool Autoswap has new keywords for different actions that can
    be taken as well. For example, adding liquidity has the keywords:
    'SecondaryToken' and 'CentralToken' and returns a payout with
    keyword Liquidity.
  • In Public Auction, the seller keywords are 'Asset' and 'Ask' and the
    buyer keywords are 'Asset' and 'Bid'.

ZoeHelpers changes:

Some helpers were removed, and others were added. The built-in Zoe contracts were rewritten to
take advantage of these new helpers.

  • satisfies was added. It checks whether an allocation would satisfy
    a single offer's wants if that was the allocation passed to
    reallocate.
  • isOfferSafe was added. It checks whether an
    allocation for a particular offer would satisfy offer safety. Any
    allocation that returns true under satisfy will also return true
    under isOfferSafe. (isOfferSafe is equivalent of satisfies ||
    gives a refund).
  • trade was added. Trade performs a trade between
    two offers given a declarative description of what each side loses
    and gains.
  • Swap remains but has slightly different behavior: any
    surplus in a trade remains with the original offer
  • canTradeWith
    was removed and subsumed by satisfies.
  • inviteAnOffer was already
    deprecated and was removed.
  • assertNatMathHelpers was added, which
    checks whether a particular keyword is associated with an issuer
    with natMathHelpers.

ERTP changes:

  • purse.deposit() now returns the amount of the deposit, rather than
    the purse's new balance.
  • A deposit-only facet was added to purses, and can be created by
    calling makeDepositFacet on any purse.

#dapp-encouragement-branch: zoe-release-0.7.0

@katelynsills katelynsills force-pushed the zoe-release-0.7.0 branch 2 times, most recently from 815cddc to 949589c Compare June 3, 2020 20:31
@Chris-Hibbert Chris-Hibbert force-pushed the zoe-release-0.7.0 branch 2 times, most recently from 4ac8b55 to 2222eb6 Compare June 10, 2020 21:27
@katelynsills katelynsills force-pushed the zoe-release-0.7.0 branch 2 times, most recently from 730a66f to 218fc61 Compare June 23, 2020 23:55
Copy link
Member

@warner warner left a comment

Choose a reason for hiding this comment

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

It looks like this won't be too hard to merge with the new-SES branch (which might be my responsibility, or yours, depending on which one manages to land first). I've called out the places that will need to be changed to match the API changes on the new-SES branch, but of course don't make those changes yet.

@katelynsills
Copy link
Contributor Author

It looks like this won't be too hard to merge with the new-SES branch (which might be my responsibility, or yours, depending on which one manages to land first). I've called out the places that will need to be changed to match the API changes on the new-SES branch, but of course don't make those changes yet.

Thanks for the detailed analysis! this will be very helpful

@katelynsills katelynsills marked this pull request as ready for review June 29, 2020 23:23
@katelynsills katelynsills changed the title [WIP] Zoe release 0.7.0 Zoe release 0.7.0 Jun 30, 2020
@katelynsills katelynsills force-pushed the zoe-release-0.7.0 branch 2 times, most recently from cba7bff to 77e9b0f Compare June 30, 2020 03:29
katelynsills and others added 13 commits June 30, 2020 10:40
…ntract and a contract for minting items (#1110)

* chore: split opera ticket contract into an item minting contract and a generalized selling contract.
Add new method: `zcf.initPublicAPI` and remove publicAPI from the return values of makeContract (#1035)

* feat: add zcf.initPublicAPI method, makeContract should only return invite

* fix: update mintAndSellNFT and sellItems contracts as well
zoe.makeInstance() add instanceRecord to the invite previously being
returned.

Many calls on getInstanceRecord() were able to be removed, and the
code simplified.
* feat: add installationHandle to invite extent

* chore: address PR comments
…tsConserved (#1155)

* refactor: remove the use of keywords from `areRightsConserved`, meaning sparseKeywords can be removed from reallocate
* fix: canTradeWith should use the current allocations, not give

* chore: add test to show difference in give and allocation
…hat keywords match (#1129)

* refactor: Zoe facet parameters

deposit by brand and IssuerTable by brand have been extracted

* refactor: more getAmountMath by brand

convert assertNatMathHelpers() to be by brand
add assertNatMathHelpersKeyword() temporarily
move more code to get amountMath by brand

sellItems gets amountMaths by brand

* refactor: reinstate changes for deposit and issuerTable by brand

* refactor: get rid of getAmountMaths [WIP]

* refactor: make multipoolAutoswap use In & Out keywords for swap()

* refactor: remove objective keywords for clients of multipoolAutoswap

The contract still has to deal with consistent keywords across all the
liquidity pools

* refactor: Simplify barterExchange and multipoolAutoswap

Make use of facet parameters to clean up some contracts.

clean up canTradeWith alternatives:
  * drop canTradeWithIgnoreKeywords
  * improve canTradeWithMapKeywords
convert barterExchange to consistent keywords
in multipoolAutoswap cleanup names, and use user Math for user amounts

* chore: review changes

Build mockZcf using a builder in test-zoeHelper

Co-authored-by: Kate Sills <kate@agoric.com>
* fix: canTradeWith should use the current allocations, not give

* chore: add test to show difference in give and allocation
…hat keywords match (#1129)

* refactor: Zoe facet parameters

deposit by brand and IssuerTable by brand have been extracted

* refactor: more getAmountMath by brand

convert assertNatMathHelpers() to be by brand
add assertNatMathHelpersKeyword() temporarily
move more code to get amountMath by brand

sellItems gets amountMaths by brand

* refactor: reinstate changes for deposit and issuerTable by brand

* refactor: get rid of getAmountMaths [WIP]

* refactor: make multipoolAutoswap use In & Out keywords for swap()

* refactor: remove objective keywords for clients of multipoolAutoswap

The contract still has to deal with consistent keywords across all the
liquidity pools

* refactor: Simplify barterExchange and multipoolAutoswap

Make use of facet parameters to clean up some contracts.

clean up canTradeWith alternatives:
  * drop canTradeWithIgnoreKeywords
  * improve canTradeWithMapKeywords
convert barterExchange to consistent keywords
in multipoolAutoswap cleanup names, and use user Math for user amounts

* chore: review changes

Build mockZcf using a builder in test-zoeHelper

Co-authored-by: Kate Sills <kate@agoric.com>
closes #1104
Also fixes test to test deposit on a non-empty purse.
dtribble and others added 15 commits June 30, 2020 10:40
closes #1104
Also fixes test to test deposit on a non-empty purse.
I was going to touch every contract in order to change the way that
zcf is declared for typescript, so I fixed all the documentation as well.
switch makeContract declaration and export to a simpler format
…of both sides (#1147)

* refactor(Zoe): add new Zoe helpers - trade, satisfies, isOfferSafe. Remove canTradeWith, canTradeWithMapKeywords

* chore: address PR comments

* refactor: calcNewAllocation is now functional

* chore: address PR comments

* chore: address PR comments
Co-authored-by: Dean Tribble <tribble@agoric.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants