Skip to content

Commit

Permalink
chore: orchestration is capitalized now
Browse files Browse the repository at this point in the history
  • Loading branch information
amessbee committed Oct 7, 2024
1 parent ffbf6f9 commit 6b2a88c
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 80 deletions.
4 changes: 0 additions & 4 deletions main/.vitepress/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@ export default defineConfig({
text: 'Send Anywhere Example',
link: '/guides/orchestration/contract-walkthrough/send-anywhere',
},
{
text: 'Cross-Chain Swap Example',
link: '/guides/orchestration/contract-walkthrough/cross-chain-swap',
},
{
text: 'Cross-Chain Unbond Example',
link: '/guides/orchestration/contract-walkthrough/cross-chain-unbond',
Expand Down
4 changes: 0 additions & 4 deletions main/.vitepress/themeConfig/nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ export const nav = [
text: 'Send Anywhere Example',
link: '/guides/orchestration/contract-walkthrough/send-anywhere',
},
{
text: 'Cross-Chain Swap Example',
link: '/guides/orchestration/contract-walkthrough/cross-chain-swap',
},
{
text: 'Cross-Chain Unbond Example',
link: '/guides/orchestration/contract-walkthrough/cross-chain-unbond',
Expand Down
6 changes: 3 additions & 3 deletions main/guides/orchestration/how-orch-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Orchestration relies on protocols and mechanisms that allow blockchains to
communicate and transact with each other securely and efficiently. The primary
objectives of orchestration are:
objectives of Orchestration are:

- **Interoperability:** Enabling different blockchain networks to interact and
transact with one another.
Expand Down Expand Up @@ -124,10 +124,10 @@ asynchronous, makes it particularly well-suited for Interchain Accounts and
Interchain Queries. When contracts on Agoric interact, the system is designed
to handle cases where the other contract may reside on a remote machine or
another blockchain. This inherent architecture allows Agoric to seamlessly
control and manage Interchain Accounts, further enhancing the orchestration
control and manage Interchain Accounts, further enhancing the Orchestration
capabilities.

By leveraging ICA and ICQ, blockchain orchestration becomes more flexible and
By leveraging ICA and ICQ, Orchestration becomes more flexible and
powerful, enabling direct, programmable interactions between blockchains. This
unlocks a wide range of possibilities, from decentralized finance (DeFi) to
supply chain management and beyond.
2 changes: 1 addition & 1 deletion main/guides/orchestration/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The Orchestration API handles asynchronous tasks and complex workflows, includin

# Introduction to Orchestration API Flow

The following sequence diagram provides a comprehensive overview of the orchestration process within the Agoric platform. This example illustrates the interaction between various components, highlighting how the orchestration library (`OrchLib`) facilitates cross-chain operations. This is a good first example to understand the flow of the Orchestration API, showing the steps involved in creating and managing cross-chain transactions.
The following sequence diagram provides a comprehensive overview of the Orchestration process within the Agoric platform. This example illustrates the interaction between various components, highlighting how the Orchestration library (`OrchLib`) facilitates cross-chain operations. This is a good first example to understand the flow of the Orchestration API, showing the steps involved in creating and managing cross-chain transactions.

<br/>
<img src="/reference/assets/sequence-diagrams/orchestration-workflow-1.svg" width="100%" />
Expand Down
88 changes: 44 additions & 44 deletions main/guides/orchestration/orchestration-basics/contract.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Orca Contract Code Walkthrough

This section provides a walkthrough of the Orca contract code, explaining its structure, key components, and
functionality. The Orca contract is designed to manage orchestration accounts and fund them. It interacts with multiple
chains and provides functionality for creating accounts and funding them. The code for the contract logic is in two
This section provides a walkthrough of the Orca contract code, explaining its structure, key components, and
functionality. The Orca contract is designed to manage Orchestration accounts and fund them. It interacts with multiple
chains and provides functionality for creating accounts and funding them. The code for the contract logic is in two
files:

1. [`orca.contract.js`](https://github.com/Agoric/dapp-orchestration-basics/blob/main/contract/src/orca.contract.js)
2. [`orca.flows.js`](https://github.com/Agoric/dapp-orchestration-basics/blob/main/contract/src/orca.flows.js)

## Walkthrough: `orca.contract.js`

The `orca.contract.js` file brings in necessary dependencies and types from various Agoric packages. The `flows` import
The `orca.contract.js` file brings in necessary dependencies and types from various Agoric packages. The `flows` import
contains specific logic for the Orca contract offer handling operations.

```js
Expand All @@ -25,7 +25,7 @@ import * as flows from './orca.flows.js';

### Type Definitions and Shapes

The following definitions create shapes for validating the structure of `amount` and orchestration powers.
The following definitions create shapes for validating the structure of `amount` and Orchestration powers.

```js
const SingleAmountRecord = M.and(
Expand Down Expand Up @@ -76,18 +76,18 @@ for (const [name, info] of entries(chainDetails)) {
}
```

- **Creating Account and Funding Functions**: These functions are created using the `orchestrateAll` helper, which sets
up the necessary flow logic for account creation and funding but the logic is implemented in `orca.flows.js` file
([discussed below](#walkthrough-orcaflowsjs)).
- **Creating Account and Funding Functions**: These functions are created using the `orchestrateAll` helper, which sets
up the necessary flow logic for account creation and funding but the logic is implemented in `orca.flows.js` file
([discussed below](#walkthrough-orcaflowsjs)).

```js
const { makeAccount, makeCreateAndFund } = orchestrateAll(flows, {
localTransfer: zoeTools.localTransfer
});
```

- **Public Facet**: The public facet provides two methods: `makeAccountInvitation` creates an invitation to make an
orchestration account, and `makeCreateAndFundInvitation` creates an invitation to make an account and fund it.
- **Public Facet**: The public facet provides two methods: `makeAccountInvitation` creates an invitation to make an
Orchestration account, and `makeCreateAndFundInvitation` creates an invitation to make an account and fund it.

```js
const publicFacet = zone.exo(
Expand All @@ -114,7 +114,7 @@ const publicFacet = zone.exo(

### `start` Function

The start function is wrapped with `withOrchestration`, which provides additional orchestration setup and tools for the
The start function is wrapped with `withOrchestration`, which provides additional Orchestration setup and tools for the
contract.

```js
Expand All @@ -124,7 +124,7 @@ harden(start);

## Walkthrough `orca.flows.js`

This section provides a walkthrough of the `orca.flows.js` file, which contains flow functions for the Orca contract.
This section provides a walkthrough of the `orca.flows.js` file, which contains flow functions for the Orca contract.
The `orca.flows.js` file defines two main functions:

1. `makeAccount`: Creates an account on a Cosmos chain.
Expand All @@ -134,20 +134,20 @@ These functions are called by the Zoe vat when a user makes an offer using a cor

### `makeAccount` Function

This function creates an account on a specified Cosmos chain. This function not only creates the account but also
returns a continuing offer that allows the user to perform further actions like delegation, rewards withdrawl, and
This function creates an account on a specified Cosmos chain. This function not only creates the account but also
returns a continuing offer that allows the user to perform further actions like delegation, rewards withdrawl, and
transfers. Here are the parameters of this function:

- `orch`: An Orchestrator instance parameter represents an instance of the `Orchestrator`, a powerful abstraction that
manages interactions with the blockchain. It provides methods to interact with different chains, create accounts, and
fetch chain information.
- `orch`: An Orchestrator instance parameter represents an instance of the `Orchestrator`, a powerful abstraction that
manages interactions with the blockchain. It provides methods to interact with different chains, create accounts, and
fetch chain information.

- `_ctx`: Unused context object
- `seat`: A `ZCFSeat` instance. It holds a proposal object corresponding to the current offer.
- `offerArgs`: An object containing `chainName` (that identifies the chain the orchestration account should be created on) and `denom`.
- `offerArgs`: An object containing `chainName` (that identifies the chain the Orchestration account should be created on) and `denom`.

The function validates the `offerArgs` to ensure it contains a `chainName`, retrieves the specified chain using `orch`,
creates an account on the chain using `chain.makeAccount()`, and returns the account as a continuing offer. Below is the
The function validates the `offerArgs` to ensure it contains a `chainName`, retrieves the specified chain using `orch`,
creates an account on the chain using `chain.makeAccount()`, and returns the account as a continuing offer. Below is the
code of `makeAccount` after removing some debug information logging code.

```js
Expand All @@ -159,13 +159,13 @@ const chainAccount = await chain.makeAccount();
return chainAccount.asContinuingOffer();
```

Once the account is created, the function returns a continuing offer by calling `chainAccount.asContinuingOffer()`. This
allows the user to perform further actions on the account, such as delegating tokens or withdrawing rewards, through
Once the account is created, the function returns a continuing offer by calling `chainAccount.asContinuingOffer()`. This
allows the user to perform further actions on the account, such as delegating tokens or withdrawing rewards, through
subsequent offers.

### `makeCreateAndFund` Function

This function creates an account on a specified Cosmos chain and funds it. It accepts the same set of parameters as
This function creates an account on a specified Cosmos chain and funds it. It accepts the same set of parameters as
`make Account`. The function:

- Extracts the amount to be transferred from the seat's proposal, and retrieves both the Agoric chain and the specified target chain.
Expand All @@ -178,29 +178,29 @@ This function creates an account on a specified Cosmos chain and funds it. It ac
Below is the code of `makeCreateAndFund` after removing some debug information logging code.

```js
const { give } = seat.getProposal();
const [[_kw, amt]] = Object.entries(give);
const [agoric, chain] = await Promise.all([
orch.getChain('agoric'),
orch.getChain(chainName),
]);
const localAccount = await agoric.makeAccount();
const remoteAccount = await chain.makeAccount();
const remoteAddress = await remoteAccount.getAddress();
await localTransfer(seat, localAccount, give);
await localAccount.transfer(
{
denom: 'ubld',
value: amt.value / 2n,
},
remoteAddress,
);
seat.exit();
return remoteAccount.asContinuingOffer();
const { give } = seat.getProposal();
const [[_kw, amt]] = Object.entries(give);
const [agoric, chain] = await Promise.all([
orch.getChain('agoric'),
orch.getChain(chainName)
]);
const localAccount = await agoric.makeAccount();
const remoteAccount = await chain.makeAccount();
const remoteAddress = await remoteAccount.getAddress();
await localTransfer(seat, localAccount, give);
await localAccount.transfer(
{
denom: 'ubld',
value: amt.value / 2n
},
remoteAddress
);
seat.exit();
return remoteAccount.asContinuingOffer();
```

As in the previous case, the function returns a continuing offer by calling `remoteAccount.asContinuingOffer()` for
As in the previous case, the function returns a continuing offer by calling `remoteAccount.asContinuingOffer()` for
further actions on the account.

Apart from above mentioned logic, several trace calls are made to log the current state of the function. This is useful
Apart from above mentioned logic, several trace calls are made to log the current state of the function. This is useful
for debugging and ensuring that the function's inputs and intermediate states are correct.
2 changes: 1 addition & 1 deletion main/guides/orchestration/orchestration-basics/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
To get started with developing using the Orchestration API, developers can make use of our [dapp-orchestration-basics](https://github.com/Agoric/dapp-orchestration-basics) template.

Following the dApp pattern of our existing dapp templates, `dapp-orchestration-basics` also contains a `contract` and a `ui`
directory within a single yarn workspace. In this walkthrough, we learn about the installation process, the contract
directory within a single yarn workspace. In this walkthrough, we learn about the installation process, the contract
code, and UI components of `dapp-orchestration-basics`.

1. [Installation and Deployment](installation)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Installation and Deployment

The dApp implements a smart contract that can be installed and deployed on any Agoric testnet. Since, the contract
interacts with the remote chains, we need a multichain environment for testing it on local network. [Agoric Multichain-Testing](https://github.com/Agoric/agoric-sdk/tree/master/multichain-testing) provides such an environment to test orchestration based contracts.
The dApp implements a smart contract that can be installed and deployed on any Agoric testnet. Since, the contract
interacts with the remote chains, we need a multichain environment for testing it on local network. [Agoric Multichain-Testing](https://github.com/Agoric/agoric-sdk/tree/master/multichain-testing) provides such an environment to test Orchestration based contracts.
Follow the instructions in [dApp Readme](https://github.com/Agoric/dapp-orchestration-basics/blob/main/README.md) to install, deploy and interact with the dApp on your local machine.
42 changes: 21 additions & 21 deletions main/guides/orchestration/orchestration-basics/ui.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
# DApp User Interface
# DApp User Interface

Here, we will walkthrough the components making up the user interface for the dApp orchestration.
Here, we will walkthrough the components making up the user interface for the Orchestration dApp.

## Orchestration.tsx

The `Orchestration.tsx` component serves as the main controller for the orchestration dApp's user interface. It manages
the state and interactions required for users to create accounts, manage their balances, and perform various blockchain
The `Orchestration.tsx` component serves as the main controller for the Orchestration dApp's user interface. It manages
the state and interactions required for users to create accounts, manage their balances, and perform various blockchain
transactions such as deposits, withdrawals, staking, and unstaking.

## AccountList.tsx

The `AccountList.tsx` component is responsible for displaying the list of user accounts and their associated balances in
various native denoms. It presents account information in a structured and user-friendly format, allowing users to view
The `AccountList.tsx` component is responsible for displaying the list of user accounts and their associated balances in
various native denoms. It presents account information in a structured and user-friendly format, allowing users to view
and interact with their Orchestration Accounts directly.

## FetchBalances.tsx

The `FetchBalances.tsx` component is responsible for retrieving the balances of user accounts from different
blockchains. It interacts with the local RPC endpoints to fetch balance data for addresses on supported chains (for
The `FetchBalances.tsx` component is responsible for retrieving the balances of user accounts from different
blockchains. It interacts with the local RPC endpoints to fetch balance data for addresses on supported chains (for
Osmosis and Agoric).

## RpcEndpoints.tsx

The `RpcEndpoints.tsx` component provides a convenient place to manage RPC endpoints for different chains, including
your local agoric instance, to be used by different components. This component is used by other components, like
The `RpcEndpoints.tsx` component provides a convenient place to manage RPC endpoints for different chains, including
your local agoric instance, to be used by different components. This component is used by other components, like
`FetchBalances.tsx`, to interact with the correct blockchain network.

## ChainSelector.tsx

The `ChainSelector.tsx` component provides a basic UI element for users to select the Cosmos chain they want to interact
The `ChainSelector.tsx` component provides a basic UI element for users to select the Cosmos chain they want to interact
with. The selected chain is passed back to the parent component, `Orchestration.tsx`, and used in further interactions.

## `MakeAccount.tsx`

The `MakeAccount.tsx` component provides a user interface for managing interchain accounts on the Agoric blockchain. It
allows users to create new accounts on selected chains (like Osmosis or Agoric), fetch and display balances of these
accounts, and perform actions such as deposit. The component interacts with the Agoric wallet to make offers and uses
RPC endpoints to retrieve account balances, incorporating loading states and notifications to enhance the user
The `MakeAccount.tsx` component provides a user interface for managing interchain accounts on the Agoric blockchain. It
allows users to create new accounts on selected chains (like Osmosis or Agoric), fetch and display balances of these
accounts, and perform actions such as deposit. The component interacts with the Agoric wallet to make offers and uses
RPC endpoints to retrieve account balances, incorporating loading states and notifications to enhance the user
experience.

## `MakeOffer.tsx`

The `MakeOffer.tsx` component defines an asynchronous function `makeOffer` that facilitates making an offer through the
Agoric wallet. It first checks if a `selectedChain` is provided and retrieves the necessary contract instance
(specifically 'orca') and the `BLD` brand from the contract store. The function then constructs an offer where it gives
a deposit of `1000` units of `BLD`. It initiates the offer using the wallet's `makeOffer` method, providing callbacks to
handle various offer statuses such as 'error', 'accepted', 'refunded', and 'done'. Throughout the process, it updates
the loading state, toggles modals, sets status texts, and adds notifications to keep the user informed about the offer's
The `MakeOffer.tsx` component defines an asynchronous function `makeOffer` that facilitates making an offer through the
Agoric wallet. It first checks if a `selectedChain` is provided and retrieves the necessary contract instance
(specifically 'orca') and the `BLD` brand from the contract store. The function then constructs an offer where it gives
a deposit of `1000` units of `BLD`. It initiates the offer using the wallet's `makeOffer` method, providing callbacks to
handle various offer statuses such as 'error', 'accepted', 'refunded', and 'done'. Throughout the process, it updates
the loading state, toggles modals, sets status texts, and adds notifications to keep the user informed about the offer's
progress and outcome.

0 comments on commit 6b2a88c

Please sign in to comment.