Skip to content

Commit

Permalink
Merge pull request #1152 from Agoric/rs-orch-concepts
Browse files Browse the repository at this point in the history
Improvements in Orch Docs on Key Concepts Page
  • Loading branch information
rabi-siddique authored Jul 11, 2024
2 parents 524ba6e + 8212c34 commit d40b03e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 24 deletions.
4 changes: 2 additions & 2 deletions main/glossary/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ The Inter-Blockchain Communication protocol, used by blockchains to communicate
For more details, see [What developers need to know about inter-blockchain communication](https://www.computerweekly.com/blog/Open-Source-Insider/What-developers-need-to-know-about-inter-blockchain-communication).


## Intercahin Account (ICA)
## Interchain Account (ICA)
Interchain Accounts are an [IBC](#ibc) feature used in Agoric's [Orchestration API](#orchestration) to enable an Agoric smart contract to control an account on another blockchain within the Cosmos ecosystem. This feature leverages the [Inter-Blockchain Communication (IBC)](#ibc) protocol to facilitate interactions and transactions across different blockchains seamlessly.

## Invitation
Expand Down Expand Up @@ -487,7 +487,7 @@ Orchestration API is a tool to help developers build seamless applications out o
This composability allows for the development of user-centric applications
that leverage the unique strengths of different blockchain ecosystems.
Orchestration integrates with existing Agoric components ([SwingSet](/guides/platform/#swingset), Cosmos modules) and introduces
vat-orchestration. This [vat](/glossary/#vat) manages [Inter-Chain Account (ICA)](#intercahin-account-ica) identities and connections to host
vat-orchestration. This [vat](/glossary/#vat) manages [Inter-Chain Account (ICA)](#interchain-account-ica) identities and connections to host
chains, ensuring proper transaction authorization.
For more information, see the [Orchestration API](/guides/orchestration/).

Expand Down
2 changes: 1 addition & 1 deletion main/guides/orchestration/getting-started/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const chain = await orchestrator.getChain('chainName');
```

### makeLocalAccount
Creates a new `LocalchainAccount`.
Creates a new LocalChainAccount.

```javascript
const localAccount = await orchestrator.makeLocalAccount();
Expand Down
43 changes: 22 additions & 21 deletions main/guides/orchestration/getting-started/key-concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,22 @@

Here, we overview the fundamental concepts involved with building orchestration smart contracts.


### Interchain Account (ICA)

[Interchain Accounts](/glossary/#interchain-account-ica) (ICAs) are an IBC feature used in Agoric’s orchestration API. They enable an Agoric smart contract to control an account on another blockchain within the Cosmos ecosystem, facilitated by Agoric [Orchestration](#orchestration) API. This feature leverages the [Inter-Blockchain Communication (IBC)](#ibc) protocol to facilitate interactions and transactions across different blockchains seamlessly.

[Interchain Accounts](/glossary/#interchain-account-ica) (ICAs) are an IBC feature used in Agoric’s Orchestration API. They enable an Agoric smart contract to control an account on another blockchain within the Cosmos ecosystem, facilitated by Agoric [Orchestration](/glossary/#orchestration) API. This feature leverages the [Inter-Blockchain Communication (IBC)](/glossary/#ibc) protocol to facilitate interactions and transactions across different blockchains seamlessly.

<br/>
<img src="../assets/icaoverview.png" width="100%" />
<br/>

Photo credit: [cosmos.network documentation](https://tutorials.cosmos.network/academy/3-ibc/8-ica.html)

A key advantage of ICAs is that they make accounts on other chains look like any other (remotable) object. When a contract creates an ICA, it has sole access to and control over the account but can delegate certain forms of access to its clients.
A key advantage of ICAs is that they make accounts on other chains look like any other (remotable) object. When a contract creates an ICA, it has sole access to and control over the account but can delegate certain forms of access to its clients.

For a detailed explanation of these access control rules, see [Access Control with Objects](/guides/zoe/contract-access-control).



### Example ICA Usage from a Smart Contract

This sample is taken from one of the [example contracts](https://github.com/Agoric/agoric-sdk/blob/master/packages/orchestration/src/examples/swapExample.contract.js)

```javascript
Expand Down Expand Up @@ -49,12 +46,12 @@ const stackAndSwapFn = async (orch, ...) => {
};
```




### ChainHub

The `makeChainHub` utility manages the connections and metadata for various blockchain networks. It simplifies accessing and interacting with multiple chains, providing a unified interface for the orchestration logic to manage cross-chain operations effectively. ChainHub also allows for dynamic registration and usage of chains.
The `makeChainHub` utility manages the connections and metadata for various blockchain networks. It creates a new `ChainHub` instance implementing the [`ChainHubI`](https://github.com/Agoric/agoric-sdk/blob/000693442f821c1fcea007a2df740733b1f75ebe/packages/orchestration/src/exos/chain-hub.js#L70-L80C4) interface.

It simplifies accessing and interacting with multiple chains, providing a unified interface for the orchestration logic to manage cross-chain operations effectively.
ChainHub also allows dynamic registration and use of chain and connection information.

```javascript
const chainHub = makeChainHub(remotePowers.agoricNames);
Expand All @@ -70,31 +67,35 @@ chainHub.registerConnection(
);
```

In this example, chainHub is used to register a new chain and establish a connection between the Agoric chain and the newly registered chain.

In this example, `chainHub` is used to register a new chain and establish a connection between the Agoric chain and the newly registered chain.

### Orchestration Account

Orchestration accounts are a key concept in the Agoric Orchestration API, represented by the OrchestrationAccountI interface. These accounts provide high-level operations for managing accounts on remote chains, allowing seamless interaction and management of interchain accounts. The orchestration accounts abstract the complexity of interchain interactions, providing a unified and simplified interface for developers.
Orchestration accounts are a key concept in the Agoric Orchestration API, represented by the [`OrchestrationAccountI`](https://agoric-sdk.pages.dev/interfaces/_agoric_orchestration.OrchestrationAccountI) interface. These accounts provide high-level operations for managing accounts on remote chains, allowing seamless interaction and management of interchain accounts. The orchestration accounts abstract the complexity of interchain interactions, providing a unified and simplified interface for developers.

**1. Address Management**

- `getAddress` retrieves the address of the account on the remote chain.

1. Address Management
```javascript
const address = await orchestrationAccount.getAddress();
```

2. Balance Management
- getBalances returns an array of amounts for every balance in the account.
- getBalance retrieves the balance of a specific denom for the account.
**2. Balance Management**

- `getBalances` returns an array of amounts for every balance in the account.
- `getBalance` retrieves the balance of a specific denom for the account.

```javascript
const balances = await orchestrationAccount.getBalances();
const balance = await orchestrationAccount.getBalance('uatom');
```

3. Funds Transfer
- send transfers an amount to another account on the same chain.
- transfer transfers an amount to another account, typically on another chain.
- transferSteps transfers an amount in multiple steps, handling complex transfer paths.
**3. Funds Transfer**

- `send` transfers an amount to another account on the same chain.
- `transfer` transfers an amount to another account, typically on another chain.
- `transferSteps` transfers an amount in multiple steps, handling complex transfer paths.

```javascript
await orchestrationAccount.send(receiverAddress, amount);
Expand Down

0 comments on commit d40b03e

Please sign in to comment.