# Zoe Contract Facet

Zoe v0.3.0. Last updated 3/24/2020.

# zcf.reallocate(offerHandles, reallocation)

Instruct Zoe to try reallocating for the given offerHandles. Reallocation is an array of AmountKeywordRecords, which are objects where the keys are keywords and the values are amounts. The amount to be paid to the player who made the offer at the same index in the offerHandles array. The reallocation will only happen if 'offer safety' and conservation of rights are true, as enforced by Zoe.

import harden from '@agoric/harden';

// reallocate by switching the amount of the firstOffer and matchingOffer
  harden([firstOfferHandle, matchingOfferHandle]),
  harden([matchingOfferAmount, firstOfferAmount]),

# zcf.complete(offerHandles)

  • offerHandles {Array <Object>}

Eject the offer, taking the current allocation for that offer and creating payments to be returned to the user. No 'offer safety' checks are done here because any previous reallocation performed those checks.

import harden from '@agoric/harden';


# zcf.addNewIssuer(issuer, keyword)

  • issuers {Issuer}
  • keyword {String}
  • Returns: {Promise}

Inform Zoe about a new issuer. Returns a promise for acknowledging when the issuer is added and ready.

zoe.addNewIssuer(liquidityIssuer, 'Liquidity').then(() => {
  //do stuff

# zcf.getZoeService()

  • Returns: {ZoeService}

Expose the user-facing Zoe Service API to the contracts as well.

# zcf.makeInvite(seat, customProperties)

  • seat {Object}
  • customProperties {Object}
  • Returns: {Payment}

Create an invite using the Zoe inviteMint.

const { invite, inviteHandle } = zoe.makeInvite(
  { seatDesc: 'bid', auctionedAssets: tickets3, minimumBid: simoleans100 }

# zcf.getInviteIssuer()

  • Returns: {Issuer}

Get the Zoe inviteIssuer.

const inviteIssuer = await E(zoe).getInviteIssuer();

# zcf.getAmountMath(issuerKeywordRecord)

Pass in an issuerKeywordRecord and get an amountMathKeywordRecord in return.

const amountMathKeywordRecord = zoe.getAmountMaths(issuerKeywordRecord);

# zcf.isOfferActive(offerHandle)

  • offerHandles {Object}
  • Returns: `{Boolean}``

Check if the offer is still active. This method does not throw if the offer is inactive.

const isActive = zoe.isOfferActive(someOfferHandle);

# zcf.getOfferStatuses(offerHandles)

  • offerHandles {Array <Object>}
  • Returns: {OfferStatusesRecord}

Divide the offerHandles into 'active' and 'inactive' lists

const { active: activeBidHandles } = zoe.getOfferStatuses(

# zcf.getOffers(offerHandles)

Get a list of offer records.

const offers = offerTable.getOffers(listOfOfferHandles);

# zcf.getOffer(offerHandle)

Get the offer record.

const { payoutRules } = zoe.getOffer(inviteHandle);

# zcf.getInstanceRecord()

Get the instance record. This allows the contracts to get access to their keywords, issuers and other "instanceRecord" information from Zoe.

const { issuerKeywordRecord, keywords, terms } = zoe.getInstanceRecord()