Skip to content

Commit

Permalink
docs: rename HEAD to main in urls in md files (#771)
Browse files Browse the repository at this point in the history
  • Loading branch information
erights authored Jan 28, 2023
1 parent 571b397 commit 35b9cf7
Show file tree
Hide file tree
Showing 24 changed files with 115 additions and 125 deletions.
97 changes: 48 additions & 49 deletions CONTRIBUTING.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion main/guides/js-programming/hardened-js.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ or not:
- `require` (Use `import` module syntax instead.)
- `localStorage`
- [SwingSet](../platform/#swingset) orthogonal persistence means state lives indefinitely in ordinary variables and data structures and need not be explicitly written to storage.
- For high cardinality data, see [the `@agoric/store` package](https://github.com/Agoric/agoric-sdk/tree/HEAD/packages/store).
- For high cardinality data, see [the `@agoric/store` package](https://github.com/Agoric/agoric-sdk/tree/master/packages/store).
- `global` (Use `globalThis` instead.)
- authority-free but host-defined:
- `Buffer`
Expand Down
18 changes: 9 additions & 9 deletions main/guides/zoe/contract-requirements.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Contract Requirements
# Contract Requirements

<Zoe-Version/>

When writing a smart contract to run on Zoe, you need
to know the proper format and other expectations.
to know the proper format and other expectations.

A Zoe smart contract is a JavaScript module that exports a `start` function
and may import other code, including:
Expand All @@ -23,10 +23,10 @@ A Zoe contract will be bundled up, so you should feel free to divide
your contract into multiple files (perhaps putting helper functions in a
separate file, for example) and import them.

A Zoe contract needs to be able to run under [Agoric's SES shim for Hardened JavaScript](https://github.com/endojs/endo/tree/HEAD/packages/ses). Some legacy
A Zoe contract needs to be able to run under [Agoric's SES shim for Hardened JavaScript](https://github.com/endojs/endo/tree/master/packages/ses). Some legacy
JavaScript code is incompatible with Hardened JavaScript, because Lockdown freezes the
JavaScript objects you start out with (the primordials, such as `Object`), and some legacy code tries to
mutate these.
mutate these.

If you add this type annotation, TypeScript-aware tools
(IDEs like vsCode and WebStorm) will inform the developer about parameters
Expand Down Expand Up @@ -60,12 +60,12 @@ The contract must return a record with any (or none) of the following:
that calls `E(zoe).startInstance()`; i.e. the party that was the creator of the current
contract `instance`. It might create `invitations` for other parties, or take actions that
are unrelated to making offers.
- **creatorInvitation**: A Zoe `invitation` only given to the entity that
calls `E(zoe).startInstance()`; i.e. the party that was the creator of the current
contract `instance`. This is usually used when a party has to make an offer first,
- **creatorInvitation**: A Zoe `invitation` only given to the entity that
calls `E(zoe).startInstance()`; i.e. the party that was the creator of the current
contract `instance`. This is usually used when a party has to make an offer first,
such as escrowing the underlying good for sale in an auction or covered call.
- **publicFacet**: An object available through Zoe to anyone who knows the contract `instance`.
Use the `publicFacet` for general queries and actions, such as getting the current price
- **publicFacet**: An object available through Zoe to anyone who knows the contract `instance`.
Use the `publicFacet` for general queries and actions, such as getting the current price
or creating public `invitations`.

The contract can contain arbitrary JavaScript code, but there are a few things you'll want
Expand Down
22 changes: 11 additions & 11 deletions main/guides/zoe/contracts/atomic-swap.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@


##### [View the code on Github](https://github.com/Agoric/agoric-sdk/blob/f29591519809dbadf19db0a26f38704d87429b89/packages/zoe/src/contracts/atomicSwap.js) (Last updated: Sep 12, 2020)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/HEAD/packages/zoe/src/contracts)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/master/packages/zoe/src/contracts)

If I want to trade one kind of asset for another kind, I could send
you the asset and ask you to send the other kind back. But, you
could behave opportunistically by receiving my asset and giving
nothing back.
nothing back.

To solve this problem, Zoe-based swap contracts let users
securely trade one kind of digital asset for another kind.
By using Zoe for escrow and offer safety, they insure no
To solve this problem, Zoe-based swap contracts let users
securely trade one kind of digital asset for another kind.
By using Zoe for escrow and offer safety, they insure no
user can ever behave opportunistically.

In our `atomicSwap` contract, anyone can securely swap with a counterparty.
Expand All @@ -37,8 +37,8 @@ const { creatorInvitation } =
Then Alice escrows her offer with Zoe. She passes in two
things; the actual ERTP payments of her offer, and a
`proposal`. Zoe uses the proposal to protect Alice from the
smart contract (which may have been written by someone else)
and other participants.
smart contract (which may have been written by someone else)
and other participants.

A proposal has three parts:
- `give`: What this party will give to the swap. Used by Zoe to enforce offer safety (Alice will get back what she gave or what she wanted).
Expand All @@ -59,7 +59,7 @@ const aliceProposal = harden({
const alicePayment = await E(aliceMoolaPurse).withdraw(threeMoola);
```

For Alice to escrow with Zoe, she needs to use her invitation.
For Alice to escrow with Zoe, she needs to use her invitation.
Then she makes her offer and receives a `seat`. The `seat`
gives her access to the offer's result and her payouts.

Expand Down Expand Up @@ -100,8 +100,8 @@ assert(AmountMath.isEqual(bobInvitationValue.price, simoleans(7)), details`wrong
```

Bob decides to exercise the invitation, and to escrow his payments. He then
uses his invitation to make an offer, the same way that Alice used hers.
But Bob has written his proposal to match Alice's (notice that the `give`
uses his invitation to make an offer, the same way that Alice used hers.
But Bob has written his proposal to match Alice's (notice that the `give`
and `want` clauses are reversed from Alice's proposal):

```js secondary style2
Expand Down Expand Up @@ -133,7 +133,7 @@ const moolaRefundAmount = aliceMoolaPurse.deposit(aliceAssetPayout);
const simoleanGainAmount = aliceSimoleansPurse.deposit(alicePricePayout);
```

Bob's payout is also available. Since he already knows what Alice's offer was,
Bob's payout is also available. Since he already knows what Alice's offer was,
he doesn't need to look for a simolean refund.

```js secondary style2
Expand Down
2 changes: 1 addition & 1 deletion main/guides/zoe/contracts/automatic-refund.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Zoe-Version/>

##### [View the code on Github](https://github.com/Agoric/agoric-sdk/blob/4e0aece631d8310c7ab8ef3f46fad8981f64d208/packages/zoe/src/contracts/automaticRefund.js) (Last updated: Jan 31, 2022)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/HEAD/packages/zoe/src/contracts)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/master/packages/zoe/src/contracts)

This is a very trivial contract to explain and test Zoe.
AutomaticRefund just gives you back what you put in. AutomaticRefund
Expand Down
4 changes: 2 additions & 2 deletions main/guides/zoe/contracts/barter-exchange.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Zoe-Version/>

##### [View the code on Github](https://github.com/Agoric/agoric-sdk/blob/a564c6081976d7b66b3cdf54e0ba8903c8f1ee6d/packages/zoe/src/contracts/barterExchange.js) (Last updated: Sep 14, 2020)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/HEAD/packages/zoe/src/contracts)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/master/packages/zoe/src/contracts)

Barter Exchange takes offers for trading arbitrary goods for one another.

Expand All @@ -16,7 +16,7 @@ registration of issuers, it can handle trades between goods of any
type. It's like conventional "barter" in that there's no common
currency. "I have cantaloupes and am looking for pillow cases." It
keeps an order book, and each time it receives a new offer, it looks
for matches throughout the order book.
for matches throughout the order book.

The Barter Exchange only accepts offers that look like
`{ give: { In: amount }, want: { Out: amount}` }
Expand Down
4 changes: 2 additions & 2 deletions main/guides/zoe/contracts/constantProductAMM.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Zoe-Version/>

##### [View the code on Github](https://github.com/Agoric/agoric-sdk/blob/7d141a47b311363f099f496d4ed9b4d0f28c8fff/packages/inter-protocol/src/vpool-xyk-amm/multipoolMarketMaker.js) (Last updated: Aug 15, 2022)
##### [View contracts on Github](https://github.com/Agoric/agoric-sdk/tree/HEAD/packages/zoe/src/contracts)
##### [View contracts on Github](https://github.com/Agoric/agoric-sdk/tree/master/packages/zoe/src/contracts)


The Constant Product AMM is an automated market maker (AMM) that supports multiple
Expand Down Expand Up @@ -71,7 +71,7 @@ const quote = E(publicFacet).getOutputPrice(
AmountMath.makeEmpty(ATMBrand),
);
```

Let's assume the quote says she needs to provide 216 ATM. Sara believes the
price is somewhat volatile, and she doesn't want to make repeated calls, so she pads
her offer. If the appropriate pools don't exist, she'll get an error (`brands were
Expand Down
4 changes: 2 additions & 2 deletions main/guides/zoe/contracts/covered-call.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Zoe-Version/>

##### [View the code on Github](https://github.com/Agoric/agoric-sdk/blob/f29591519809dbadf19db0a26f38704d87429b89/packages/zoe/src/contracts/coveredCall.js) (Last updated: Sep 12, 2020)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/HEAD/packages/zoe/src/contracts)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/master/packages/zoe/src/contracts)

The owner of an asset can use a covered call to give someone else the right
to buy the asset at a certain price, called the strike price. That right
Expand Down Expand Up @@ -148,7 +148,7 @@ const swapIssuerKeywordRecord = harden({
const bobSwapSeat =
await E(zoe).startInstance(swapInstallation, swapIssuerKeywordRecord);
```

Bob specifies that he wants to swap the invitation for 1 buck, and escrows
the covered call invitation. In exchange, he gets a swap invitation he can
share.
Expand Down
2 changes: 1 addition & 1 deletion main/guides/zoe/contracts/escrow-to-vote.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Zoe-Version/>

##### [View the code on Github](https://github.com/Agoric/agoric-sdk/blob/4e0aece631d8310c7ab8ef3f46fad8981f64d208/packages/zoe/test/unitTests/contracts/escrowToVote.js) (Last updated: Jan 31, 2022)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/HEAD/packages/zoe/src/contracts)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/master/packages/zoe/src/contracts)

This contract implements coin voting. There are two roles: the
Secretary, who can determine the question (a string), make voting
Expand Down
2 changes: 1 addition & 1 deletion main/guides/zoe/contracts/fundedCallSpread.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Zoe-Version/>

##### [View the code on Github](https://github.com/Agoric/agoric-sdk/blob/4e0aece631d8310c7ab8ef3f46fad8981f64d208/packages/zoe/src/contracts/callSpread/fundedCallSpread.js) (Last updated: Feb 20, 2022)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/HEAD/packages/zoe/src/contracts)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/master/packages/zoe/src/contracts)

This contract implements a fully collateralized call spread. You can use a call spread as a
[financial building block](https://youtu.be/m5Pf2d1tHCs) to create futures, puts, calls, and event
Expand Down
11 changes: 5 additions & 6 deletions main/guides/zoe/contracts/loan.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Zoe-Version/>

##### [View the code on Github](https://github.com/Agoric/agoric-sdk/blob/4e0aece631d8310c7ab8ef3f46fad8981f64d208/packages/zoe/src/contracts/loan/index.js) (Last updated: Nov 23, 2021)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/HEAD/packages/zoe/src/contracts)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/master/packages/zoe/src/contracts)

The basic loan contract has two parties, a *lender* and a *borrower*.
It lets the borrower add collateral of a particular brand and get a
Expand All @@ -16,7 +16,7 @@ The loan does not have a distinct end time. Rather, if the
value of the collateral changes such that insufficient margin is
provided, the collateral is liquidated, and the loan is closed. At any
time, the borrower can add collateral or repay the loan with interest,
closing the loan.
closing the loan.

Note that all collateral must be of the same brand and all of the
loaned amount and interest must be of the same (separate) brand.
Expand All @@ -28,7 +28,7 @@ loaned amount and interest must be of the same (separate) brand.
drops below `mmr`, liquidation can occur.
* [`priceAuthority`](/guides/zoe/price-authority.md) - used for getting the current value of
collateral and setting liquidation triggers.
* `autoswapInstance` - The running contract instance for
* `autoswapInstance` - The running contract instance for
[AMM](./constantProductAMM.md) installation. The `publicFacet`
of the instance is used to make an invitation to sell the
collateral on liquidation.
Expand Down Expand Up @@ -104,7 +104,7 @@ The contract shuts down under any one of 3 conditions:
3. An error occurs when trying to use the priceAuthority.
* The lender gets the collateral, and the borrower keeps their loan.

## Debt and Interest Calculation
## Debt and Interest Calculation

Interest is calculated and compounded when the
`periodNotifier` pushes a new value. The interest rate per period
Expand All @@ -120,7 +120,7 @@ recalculated: (`E(borrowFacet).getLastCalculationTimestamp()`).

Liquidation is scheduled using the `priceAuthority` parameter.
Specifically, the contract gets a promise resolved when the value of the
collateral falls below a trigger value defined by the `mmr` parameter:
collateral falls below a trigger value defined by the `mmr` parameter:

<<< @/snippets/zoe/contracts/test-loan.js#liquidate

Expand All @@ -138,4 +138,3 @@ Actual liquidation is done through an AMM
regardless of its current price.
Even if the price is worse or better than what our `priceAuthority`
quoted, we still liquidate.

2 changes: 1 addition & 1 deletion main/guides/zoe/contracts/mint-and-sell-nfts.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Zoe-Version/>

##### [View the code on Github](https://github.com/Agoric/agoric-sdk/blob/4e0aece631d8310c7ab8ef3f46fad8981f64d208/packages/zoe/src/contracts/mintAndSellNFT.js) (Last updated: Jan 31, 2022)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/HEAD/packages/zoe/src/contracts)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/master/packages/zoe/src/contracts)

This contract mints non-fungible tokens and creates a selling contract
instance to sell the tokens in exchange for some sort of money.
Expand Down
2 changes: 1 addition & 1 deletion main/guides/zoe/contracts/mint-payments.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Zoe-Version/>

##### [View the code on Github](https://github.com/Agoric/agoric-sdk/blob/4e0aece631d8310c7ab8ef3f46fad8981f64d208/packages/zoe/src/contracts/mintPayments.js) (Last updated: Jan 31, 2022)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/HEAD/packages/zoe/src/contracts)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/master/packages/zoe/src/contracts)

This very simple contract shows how to create a new issuer kit and
mint payments from it. The contract pays out new tokens to anyone who
Expand Down
8 changes: 3 additions & 5 deletions main/guides/zoe/contracts/oracle.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Zoe-Version/>

##### [View the code on Github](https://github.com/Agoric/agoric-sdk/blob/4c4da6a7ae76aebbff2af48613008978eb04462b/packages/zoe/src/contracts/oracle.js) (Last updated: Jan 31, 2022)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/HEAD/packages/zoe/src/contracts)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/master/packages/zoe/src/contracts)

**NOTE: You almost certainly do not want to use this contract directly.
Instead, please read the [Chainlink integration
Expand All @@ -26,7 +26,7 @@ documentation](/guides/chainlink-integration.md).
## Making a Free Query

To make a free query, obtain the `publicFacet` for the oracle contract
instance.
instance.

<<< @/snippets/zoe/contracts/test-oracle.js#freeQuery

Expand Down Expand Up @@ -57,7 +57,7 @@ a `creatorFacet`.
You will need to use the creatorFacet to initialize an
`oracleHandler`. The `oracleHandler` is what will actually be queried,
so we do not want to put it in the contract terms, which are publicly
accessible.
accessible.

<<< @/snippets/zoe/contracts/test-oracle.js#initialize

Expand All @@ -66,5 +66,3 @@ accessible.
The contract expects all `oracleHandlers` to offer the following API:

<<< @/snippets/zoe/contracts/test-oracle.js#API


4 changes: 2 additions & 2 deletions main/guides/zoe/contracts/otc-desk.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<Zoe-Version/>

##### [View the code on Github](https://github.com/Agoric/agoric-sdk/blob/4e0aece631d8310c7ab8ef3f46fad8981f64d208/packages/zoe/src/contracts/otcDesk.js) (Last updated: Mar 1, 2022)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/HEAD/packages/zoe/src/contracts)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/master/packages/zoe/src/contracts)

![Building a Composable DeFi Contract](./assets/title.jpg)

This is the OTC Desk contract from the ["Building a
Composable DeFi Contract" episode of Cosmos Code With
Composable DeFi Contract" episode of Cosmos Code With
Us](https://cosmos.network/series/code-with-us/building-a-composable-defi-contract).

[Watch the replay of the
Expand Down
2 changes: 1 addition & 1 deletion main/guides/zoe/contracts/pricedCallSpread.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Zoe-Version/>

##### [View the code on Github](https://github.com/Agoric/agoric-sdk/blob/4e0aece631d8310c7ab8ef3f46fad8981f64d208/packages/zoe/src/contracts/callSpread/pricedCallSpread.js) (Last updated: Feb 20, 2022)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/HEAD/packages/zoe/src/contracts)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/master/packages/zoe/src/contracts)

This contract implements a fully collateralized call spread. You can use a call spread as a
[financial building block](https://youtu.be/m5Pf2d1tHCs) to create futures, puts, calls, and event
Expand Down
2 changes: 1 addition & 1 deletion main/guides/zoe/contracts/second-price-auction.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Zoe-Version/>

##### [View the code on Github](https://github.com/Agoric/agoric-sdk/blob/a564c6081976d7b66b3cdf54e0ba8903c8f1ee6d/packages/zoe/src/contracts/auction/secondPriceAuction.js) (Last updated: Sep 14, 2020)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/HEAD/packages/zoe/src/contracts)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/master/packages/zoe/src/contracts)

In a second-price auction, the winner is the participant with the highest bid, but
the winner only pays the price corresponding to the second highest
Expand Down
2 changes: 1 addition & 1 deletion main/guides/zoe/contracts/sell-items.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Zoe-Version/>

##### [View the code on Github](https://github.com/Agoric/agoric-sdk/blob/4e0aece631d8310c7ab8ef3f46fad8981f64d208/packages/zoe/src/contracts/sellItems.js) (Last updated: Feb 4, 2022)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/HEAD/packages/zoe/src/contracts)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/master/packages/zoe/src/contracts)

Sell items in exchange for money. Items may be fungible or
non-fungible and multiple items may be bought at once. Money must be
Expand Down
6 changes: 3 additions & 3 deletions main/guides/zoe/contracts/simple-exchange.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Zoe-Version/>

##### [View the code on Github](https://github.com/Agoric/agoric-sdk/blob/f29591519809dbadf19db0a26f38704d87429b89/packages/zoe/src/contracts/simpleExchange.js) (Last updated: Sep 12, 2020)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/HEAD/packages/zoe/src/contracts)
##### [View all contracts on Github](https://github.com/Agoric/agoric-sdk/tree/master/packages/zoe/src/contracts)

The "simple exchange" is a very basic, un-optimized exchange. It
has an order book for one asset, priced in a second asset. The order
Expand All @@ -24,8 +24,8 @@ accepted in either direction.
{ give: { Asset: simoleans(5) }, want: { Price: quatloos(3) } }
{ give: { Price: quatloos(8) }, want: { Asset: simoleans(3) } }
```
Note: Here we used a shorthand for assets whose values are 5 simoleons, 3
quatloos, 8 quatloos, and 3 simoleons. Elsewhere this might have been done
Note: Here we used a shorthand for assets whose values are 5 simoleons, 3
quatloos, 8 quatloos, and 3 simoleons. Elsewhere this might have been done
by creating `amounts` inline (i.e. `AmountMath.make(quatloosBrand, 8n)`). Or by
creating `amounts` outside the proposal and assigning them to variables.
For example, `const quatloos8 = AmountMath.make(quatloosBrand, 8n);` and then using
Expand Down
Loading

0 comments on commit 35b9cf7

Please sign in to comment.