repo logo
agoric-sdk
Language
JavaScript
Created
11/01/2019
Last updated
08/27/2024
License
Apache License 2.0
autowiki
Software Version
u-0.0.1Basic
Generated from
Commit
d9700f
Generated on
08/27/2024

agoric-sdk
[Edit section]
[Copy link]

• • •
Architecture Diagram for agoric-sdk
Architecture Diagram for agoric-sdk

The Agoric SDK is a monorepo that provides a comprehensive platform for building secure and scalable decentralized applications (dApps) on top of the Agoric blockchain. At the core of the Agoric SDK is the Swingset runtime, which is responsible for executing smart contracts and managing the overall state of the Agoric platform.

The most important components of the Agoric SDK include:

  • Swingset Kernel: The central runtime and execution environment for the Agoric platform, handling tasks such as message passing, promise resolution, device management, and garbage collection. The kernel is implemented in the …/SwingSet directory.

  • Zoe Contract Framework: A secure and flexible platform for building and executing smart contracts, with a focus on offer safety, rights conservation, and contract upgradability. The Zoe framework is implemented in the …/zoe directory.

  • Cosmic Proto: The protocol buffer (protobuf) definitions and generated code for interacting with the Cosmos ecosystem, including modules for Amino, Cosmos, IBC, ICQ, and Tendermint. This is located in the …/cosmic-proto directory.

  • Inter-Protocol: The implementation of the Agoric Inter-Protocol system, which includes an auction system, price oracle, vault factory, and Parity Stability Module. This is found in the …/inter-protocol directory.

  • Swingset Runner: A tool for managing the execution of the Agoric Swingset, including state management, performance analysis, and benchmarking. This is located in the …/swingset-runner directory.

  • Vats: The core functionality for bootstrapping, managing, and upgrading various aspects of the Agoric platform, such as client provisioning, chain configuration, and IBC communication. This is implemented in the …/vats directory.

  • ERTP: The implementation of the Agoric ERTP (Electronic Rights Transfer Protocol) system for managing the transfer and representation of digital assets. This is found in the …/ERTP directory.

  • Orchestration: The core functionality for the orchestration system in the Agoric SDK, enabling the management of assets and services across different blockchain networks. This is located in the …/orchestration directory.

  • Smart Wallet: The implementation of the Agoric Smart Wallet system, including wallet state management, offer handling, and wallet factory upgrades. This is found in the …/smart-wallet directory.

The Agoric SDK relies on several key technologies and design choices, including:

  • Swingset Kernel: The Swingset kernel is responsible for managing the overall state of the Agoric platform, including message passing, promise resolution, and device management. It uses a vat-based architecture to isolate the execution of untrusted code. Swingset Kernel

  • Zoe Contract Framework: Zoe provides a secure and flexible platform for building and executing smart contracts, with a focus on offer safety, rights conservation, and contract upgradability. It uses a contract facet and contract support system to separate the core contract logic from the supporting functionality. Zoe Contract Framework

  • Cosmos Integration: The Agoric SDK integrates with the Cosmos ecosystem through the use of protocol buffers (protobuf) and the Cosmos SDK. This allows the Agoric platform to leverage the existing Cosmos infrastructure and interoperability features. Cosmic Proto

  • Inter-Protocol: The Inter-Protocol system provides a set of core financial primitives, such as an auction system, price oracle, and vault factory, that can be used to build decentralized finance (DeFi) applications on top of the Agoric platform. Inter-Protocol

  • Orchestration: The orchestration system in the Agoric SDK enables the management of assets and services across different blockchain networks, allowing for cross-chain interoperability and coordination. Orchestration

Swingset Kernel
[Edit section]
[Copy link]

References: packages/SwingSet

• • •
Architecture Diagram for Swingset Kernel
Architecture Diagram for Swingset Kernel

The Agoric SwingSet is the core runtime and execution environment for the Agoric platform. It provides a secure and extensible framework for building and running distributed applications. The SwingSet kernel is responsible for managing the lifecycle of isolated JavaScript environments called "vats", handling communication between vats, and providing access to external devices and resources.

Read more

Vat Loader
[Edit section]
[Copy link]

References: packages/SwingSet/src/kernel/vat-loader

• • •
Architecture Diagram for Vat Loader
Architecture Diagram for Vat Loader

The Vat Loader is responsible for instantiating new vats and loading test vats. It provides the makeVatLoader() function, which returns an object with two methods: create() and loadTestVat().

Read more

Kernel Syscall Handler
[Edit section]
[Copy link]

References: packages/SwingSet/src/kernel/kernelSyscall.js

The Kernel Syscall Handler provides core functionality for managing the kernel's system calls, including:

Read more

Kernel Queue
[Edit section]
[Copy link]

References: packages/SwingSet/src/kernel/kernelQueue.js

• • •
Architecture Diagram for Kernel Queue
Architecture Diagram for Kernel Queue

The Kernel Queue manages the kernel's message queue and promise resolution, including sending messages to kernel objects, subscribing to and resolving kernel promises, and queueing messages with configurable resolution policies.

Read more

Vat Translator
[Edit section]
[Copy link]

References: packages/SwingSet/src/kernel/vatTranslator.js

• • •
Architecture Diagram for Vat Translator
Architecture Diagram for Vat Translator

The Vat Translator provides functions for translating between kernel-centric and vat-centric representations of various objects and messages. It defines several translator functions that allow the kernel to communicate with individual vats in a consistent manner.

Read more

Device Manager
[Edit section]
[Copy link]

References: packages/SwingSet/src/kernel/deviceManager.js

• • •
Architecture Diagram for Device Manager
Architecture Diagram for Device Manager

The makeDeviceManager function in …/deviceManager.js sets up the device manager and provides the invoke function for interacting with devices.

Read more

Device Slots
[Edit section]
[Copy link]

References: packages/SwingSet/src/kernel/deviceSlots.js

• • •
Architecture Diagram for Device Slots
Architecture Diagram for Device Slots

The Device Slots sets up the necessary infrastructure for device code to interact with the SwingSet kernel. The main functionality is provided by the makeDeviceSlots function, which is responsible for creating the necessary components for device code to communicate with the SwingSet kernel.

Read more

Device Translator
[Edit section]
[Copy link]

References: packages/SwingSet/src/kernel/deviceTranslator.js

• • •
Architecture Diagram for Device Translator
Architecture Diagram for Device Translator

The Device Translator provides functions for translating between kernel-level and device-level invocations and syscalls. It defines several key functions that act as translators, converting between the different representations used by the kernel and the devices.

Read more

Garbage Collection
[Edit section]
[Copy link]

References: packages/SwingSet/src/kernel/gc-actions.js

• • •
Architecture Diagram for Garbage Collection
Architecture Diagram for Garbage Collection

The Garbage Collection module processes the set of Garbage Collection (GC) actions stored in the kernel keeper and determines which actions should be executed.

Read more

Vat Termination Notification
[Edit section]
[Copy link]

References: packages/SwingSet/src/kernel/notifyTermination.js

• • •
Architecture Diagram for Vat Termination Notification
Architecture Diagram for Vat Termination Notification

The Vat Termination Notification module is responsible for notifying the vatAdmin (a component responsible for managing vats, which are isolated JavaScript execution environments) when a vat has terminated. The main functionality is provided by the notifyTermination() function, which is defined in the …/notifyTermination.js file.

Read more

Metrics
[Edit section]
[Copy link]

References: packages/SwingSet/src/kernel/metrics.js

• • •
Architecture Diagram for Metrics
Architecture Diagram for Metrics

The Metrics module defines the metrics that the SwingSet kernel collects and reports. This module exports two arrays of metric definitions:

Read more

Logging
[Edit section]
[Copy link]

References: packages/SwingSet/src/kernel/slogger.js

• • •
Architecture Diagram for Logging
Architecture Diagram for Logging

The Logging module provides functionality for logging and tracking the execution of vats within the SwingSet kernel. The main components of this module are:

Read more

Vat Administration
[Edit section]
[Copy link]

References: packages/SwingSet/src/kernel/vat-admin-hooks.js

• • •
Architecture Diagram for Vat Administration
Architecture Diagram for Vat Administration

The Vat Administration module provides functions that allow for the creation, upgrade, and termination of "vats" (isolated JavaScript execution environments) within the Agoric platform.

Read more

Vat Warehouse
[Edit section]
[Copy link]

References: packages/SwingSet/src/kernel/vat-warehouse.js

• • •
Architecture Diagram for Vat Warehouse
Architecture Diagram for Vat Warehouse

The Vat Warehouse manages the lifecycle of vats, including creating, starting, stopping, and evicting vats, as well as managing their transcripts and snapshots.

Read more

Zoe Contract Facet
[Edit section]
[Copy link]

References: packages/zoe/src/contractFacet

• • •
Architecture Diagram for Zoe Contract Facet
Architecture Diagram for Zoe Contract Facet

The Zoe Contract Facet (ZCF) is the core component responsible for managing the lifecycle of Zoe contract instances, including offer processing, asset allocation, and other contract-specific logic. The primary functionality is provided by the makeZCFZygote function, which sets up the necessary infrastructure and returns a ZCFZygote object that can be used to start and restart contract instances.

Read more

Zoe Contract Support
[Edit section]
[Copy link]

References: packages/zoe/src/contractSupport

• • •
Architecture Diagram for Zoe Contract Support
Architecture Diagram for Zoe Contract Support

The …/contractSupport directory provides a rich set of utility functions and modules that support the development of Zoe contracts. These utilities cover a wide range of functionalities, including:

Read more

Zoe Contract Implementations
[Edit section]
[Copy link]

References: packages/zoe/src/contracts

The …/contracts directory in the Agoric SDK contains a variety of smart contract implementations that leverage the Zoe contract framework. These contracts provide a wide range of functionality, including:

Read more

Zoe Service
[Edit section]
[Copy link]

References: packages/zoe/src/zoeService

• • •
Architecture Diagram for Zoe Service
Architecture Diagram for Zoe Service

The core functionality of the Zoe Service is to manage the execution of Zoe contracts, including handling offers, creating and managing invitations, and providing storage and access to various components used by the Zoe service.

Read more

Swingset Core
[Edit section]
[Copy link]

References: packages/cosmic-proto/src/codegen/agoric/swingset

• • •
Architecture Diagram for Swingset Core
Architecture Diagram for Swingset Core

The Swingset Core provides the fundamental functionality of the Agoric SwingSet, which is a key component of the Agoric blockchain platform. This subsection covers the core data structures, message types, query methods, and genesis state of the SwingSet.

Read more

Virtual Bank (VBank)
[Edit section]
[Copy link]

References: packages/cosmic-proto/src/codegen/agoric/vbank

• • •
Architecture Diagram for Virtual Bank (VBank)
Architecture Diagram for Virtual Bank (VBank)

The Agoric Virtual Bank (VBank) module is responsible for managing the reward pool and distribution of rewards to the fee collector module on a per-block basis. The key functionality of this module is defined in the following files:

Read more

Virtual Storage (vStorage)
[Edit section]
[Copy link]

References: packages/cosmic-proto/src/codegen/agoric/vstorage

• • •
Architecture Diagram for Virtual Storage (vStorage)
Architecture Diagram for Virtual Storage (vStorage)

The Agoric Virtual Storage (vStorage) system is a core component of the Agoric SDK, responsible for managing the persistent storage of data within the Agoric blockchain platform. The vStorage system is defined in the …/vstorage directory, which contains the following key components:

Read more

Cosmos Authentication
[Edit section]
[Copy link]

References: packages/cosmic-proto/src/codegen/cosmos/auth

• • •
Architecture Diagram for Cosmos Authentication
Architecture Diagram for Cosmos Authentication

The Cosmos SDK's authentication module is responsible for managing user accounts and their associated data, such as public keys, account numbers, and sequence numbers. The key components of this module are:

Read more

Cosmos Bank
[Edit section]
[Copy link]

References: packages/cosmic-proto/src/codegen/cosmos/bank

• • •
Architecture Diagram for Cosmos Bank
Architecture Diagram for Cosmos Bank

The Cosmos SDK's bank module is responsible for managing the token balances and total supply of the network. The key functionality provided by this module includes:

Read more

Cosmos Base
[Edit section]
[Copy link]

References: packages/cosmic-proto/src/codegen/cosmos/base

• • •
Architecture Diagram for Cosmos Base
Architecture Diagram for Cosmos Base

The Cosmos SDK's base components provide core functionality for building blockchain applications, including:

Read more

Cosmos Cryptography
[Edit section]
[Copy link]

References: packages/cosmic-proto/src/codegen/cosmos/crypto

• • •
Architecture Diagram for Cosmos Cryptography
Architecture Diagram for Cosmos Cryptography

The Cosmos SDK ecosystem utilizes several cryptographic primitives, including ed25519, secp256k1, secp256r1, and multi-signature keys, as well as hierarchical deterministic (HD) wallet parameters.

Read more

Cosmos Distribution
[Edit section]
[Copy link]

References: packages/cosmic-proto/src/codegen/cosmos/distribution

• • •
Architecture Diagram for Cosmos Distribution
Architecture Diagram for Cosmos Distribution

The Cosmos SDK's distribution module is responsible for handling the distribution of rewards and fees within the Cosmos ecosystem. This module provides functionality for managing various aspects of the distribution process, including:

Read more

Cosmos Governance
[Edit section]
[Copy link]

References: packages/cosmic-proto/src/codegen/cosmos/gov

• • •
Architecture Diagram for Cosmos Governance
Architecture Diagram for Cosmos Governance

The Cosmos SDK's governance module provides functionality for managing proposals, votes, and deposits within the Cosmos ecosystem. This subsection will cover the key components and design choices of this module.

Read more

Cosmos Minting
[Edit section]
[Copy link]

References: packages/cosmic-proto/src/codegen/cosmos/mint

• • •
Architecture Diagram for Cosmos Minting
Architecture Diagram for Cosmos Minting

The Cosmos SDK's mint module is responsible for managing the minting of new tokens and the inflation rate. The main functionality of this module is defined in the following files and types:

Read more

Cosmos Parameters
[Edit section]
[Copy link]

References: packages/cosmic-proto/src/codegen/cosmos/params

• • •
Architecture Diagram for Cosmos Parameters
Architecture Diagram for Cosmos Parameters

The Cosmos SDK's parameter management system is defined in the …/v1beta1 directory. This subsection covers the functionality related to defining parameter change proposals and querying parameter values.

Read more

Cosmos Staking
[Edit section]
[Copy link]

References: packages/cosmic-proto/src/codegen/cosmos/staking

• • •
Architecture Diagram for Cosmos Staking
Architecture Diagram for Cosmos Staking

The Cosmos SDK's staking module is responsible for managing validators, delegations, unbonding delegations, and redelegations within the Cosmos ecosystem. The core functionality of this module is defined in the following files and directories:

Read more

Cosmos Transactions
[Edit section]
[Copy link]

References: packages/cosmic-proto/src/codegen/cosmos/tx

• • •
Architecture Diagram for Cosmos Transactions
Architecture Diagram for Cosmos Transactions

The …/v1beta1 directory contains the core data structures and functionality related to Cosmos SDK transactions. This includes the definition of the standard transaction type (Tx), the raw transaction type (TxRaw), and various supporting types for signing, authorization, and fee information.

Read more

Cosmos Upgrades
[Edit section]
[Copy link]

References: packages/cosmic-proto/src/codegen/cosmos/upgrade

• • •
Architecture Diagram for Cosmos Upgrades
Architecture Diagram for Cosmos Upgrades

The Cosmos SDK's software upgrade functionality is managed through the …/v1beta1 directory. This subsection covers the key components and their responsibilities:

Read more

Cosmos Vesting
[Edit section]
[Copy link]

References: packages/cosmic-proto/src/codegen/cosmos/vesting

• • •
Architecture Diagram for Cosmos Vesting
Architecture Diagram for Cosmos Vesting

The Cosmos SDK provides various types of vesting accounts to manage the gradual release of tokens over time, with different vesting schedules and locking mechanisms. These vesting account types are defined in the …/vesting.ts file.

Read more

IBC Applications: Interchain Accounts
[Edit section]
[Copy link]

References: packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts

• • •
Architecture Diagram for IBC Applications: Interchain Accounts
Architecture Diagram for IBC Applications: Interchain Accounts

The Interchain Accounts (ICA) application in the Cosmos SDK is responsible for managing the communication and execution of transactions between a controller chain and its associated host chains. The implementation of this application is divided into two main submodules: the ICA Controller and the ICA Host.

Read more

IBC Applications: Token Transfer
[Edit section]
[Copy link]

References: packages/cosmic-proto/src/codegen/ibc/applications/transfer

• • •
Architecture Diagram for IBC Applications: Token Transfer
Architecture Diagram for IBC Applications: Token Transfer

The IBC token transfer application allows for the transfer of fungible tokens between ICS20-enabled chains. The core functionality is implemented in the …/transfer directory.

Read more

IBC Core: Channels
[Edit section]
[Copy link]

References: packages/cosmic-proto/src/codegen/ibc/core/channel

• • •
Architecture Diagram for IBC Core: Channels
Architecture Diagram for IBC Core: Channels

The …/v1 directory contains the definitions and functionality related to the Inter-Blockchain Communication (IBC) channel protocol. The key components in this directory are:

Read more

IBC Core: Clients
[Edit section]
[Copy link]

References: packages/cosmic-proto/src/codegen/ibc/core/client

• • •
Architecture Diagram for IBC Core: Clients
Architecture Diagram for IBC Core: Clients

The …/v1 directory contains the core functionality related to the IBC (Inter-Blockchain Communication) client in the Cosmos SDK. It defines the data structures and utility functions for managing IBC clients, including their client states, consensus states, and various governance proposals for updating and upgrading clients.

Read more

IBC Core: Commitment
[Edit section]
[Copy link]

References: packages/cosmic-proto/src/codegen/ibc/core/commitment

• • •
Architecture Diagram for IBC Core: Commitment
Architecture Diagram for IBC Core: Commitment

The …/v1 directory contains code related to Merkle proofs and commitment roots in the context of the Interblockchain Communication (IBC) protocol. The main components defined in this directory are:

Read more

IBC Core: Connections
[Edit section]
[Copy link]

References: packages/cosmic-proto/src/codegen/ibc/core/connection

• • •
Architecture Diagram for IBC Core: Connections
Architecture Diagram for IBC Core: Connections

The IBC (Inter-Blockchain Communication) connection layer is responsible for managing the lifecycle of connections between two blockchains. The core functionality is implemented in the …/connection directory.

Read more

Auction System
[Edit section]
[Copy link]

References: packages/inter-protocol/src/auction

• • •
Architecture Diagram for Auction System
Architecture Diagram for Auction System

The Auction System in the Agoric Inter-Protocol is a critical component that manages the collateral-specific state of ongoing auctions. It consists of the following key elements:

Read more

Vault Factory
[Edit section]
[Copy link]

References: packages/inter-protocol/src/vaultFactory

• • •
Architecture Diagram for Vault Factory
Architecture Diagram for Vault Factory

The core functionality of the Vault Factory is to allow users to deposit collateral and borrow "Minted" tokens. The main components and functionality are:

Read more

Parity Stability Module (PSM)
[Edit section]
[Copy link]

References: packages/inter-protocol/src/psm

The Parity Stability Module (PSM) is a component within the Agoric SDK's inter-protocol package that supports efficiently minting and burning a stable token at a fixed ratio to a reference stable token. The key functionality and design choices in the implementation are:

Read more

Proposals
[Edit section]
[Copy link]

References: packages/inter-protocol/src/proposals

The …/proposals directory contains various scripts and utilities related to proposals and governance in the Agoric SDK. These scripts are used to manage the deployment and configuration of key components of the Inter Protocol, such as the Vault Factory, Auctioneer, Reserve, and Economic Committee.

Read more

Client Support
[Edit section]
[Copy link]

References: packages/inter-protocol/src/clientSupport.js

• • •
Architecture Diagram for Client Support
Architecture Diagram for Client Support

The clientSupport.js file located at …/clientSupport.js provides utility functions and data structures for creating and managing various types of offers in the Agoric platform.

Read more

Fee Distributor
[Edit section]
[Copy link]

References: packages/inter-protocol/src/feeDistributor.js

• • •
Architecture Diagram for Fee Distributor
Architecture Diagram for Fee Distributor

The …/feeDistributor.js file implements the core functionality of the Fee Distributor contract in the Agoric platform. The Fee Distributor is responsible for collecting and distributing fees within the Agoric ecosystem.

Read more

Interest Calculations
[Edit section]
[Copy link]

References: packages/inter-protocol/src/interest-math.js, packages/inter-protocol/src/interest.js

• • •
Architecture Diagram for Interest Calculations
Architecture Diagram for Interest Calculations

The interest.js file located at …/interest.js provides the core functionality for calculating and applying interest on debt within the Agoric platform.

Read more

Provision Pool
[Edit section]
[Copy link]

References: packages/inter-protocol/src/provisionPool.js, packages/inter-protocol/src/provisionPoolKit.js

• • •
Architecture Diagram for Provision Pool
Architecture Diagram for Provision Pool

The important functionality in the file …/provisionPool.js can be summarized as follows:

Read more

Tokens
[Edit section]
[Copy link]

References: packages/inter-protocol/src/tokens.js

• • •
Architecture Diagram for Tokens
Architecture Diagram for Tokens

The tokens.js file in the …/tokens.js directory exports two named exports: Stable and Stake. These appear to be references to functionality related to tokens, but the file itself does not contain any additional implementation details.

Read more

Swingset Runner Execution and Management
[Edit section]
[Copy link]

References: packages/swingset-runner/src/main.js, packages/swingset-runner/src/runner-debug-entrypoint.js, packages/swingset-runner/src/runner-entrypoint.js

• • •
Architecture Diagram for Swingset Runner Execution and Management
Architecture Diagram for Swingset Runner Execution and Management

The Swingset Runner is the primary tool for managing the execution of the Agoric Swingset, the core runtime and execution environment for the Agoric platform. The Swingset Runner provides the following key functionality:

Read more

Swingset State Management
[Edit section]
[Copy link]

References: packages/swingset-runner/src/auditstore.js, packages/swingset-runner/src/dumpstore.js

• • •
Architecture Diagram for Swingset State Management
Architecture Diagram for Swingset State Management

The auditRefCounts() function in …/auditstore.js is responsible for auditing the reference counts of objects stored in the persistent store. This function performs the following key tasks:

Read more

Swingset Performance Analysis
[Edit section]
[Copy link]

References: packages/swingset-runner/src/dataGraphApp.js, packages/swingset-runner/src/graphDisk.js, packages/swingset-runner/src/graphMem.js, packages/swingset-runner/src/graphStats.js, packages/swingset-runner/src/graphTime.js

• • •
Architecture Diagram for Swingset Performance Analysis
Architecture Diagram for Swingset Performance Analysis

This subsection covers the tools and functionality for generating data graphs and visualizations to analyze the performance of the Swingset, including metrics related to disk usage, memory usage, and block statistics.

Read more

Swingset Logging and Debugging
[Edit section]
[Copy link]

References: packages/swingset-runner/src/slogulator.js, packages/swingset-runner/src/slogulator-debug-entrypoint.js, packages/swingset-runner/src/slogulator-entrypoint.js

• • •
Architecture Diagram for Swingset Logging and Debugging
Architecture Diagram for Swingset Logging and Debugging

The Slogulator is a powerful tool in the Agoric SDK that processes and analyzes the logs (referred to as "slogs") generated by the Agoric Swingset runtime. The Slogulator provides valuable insights and debugging capabilities, helping developers understand the execution of the Swingset and identify potential issues.

Read more

Swingset Utilities
[Edit section]
[Copy link]

References: packages/swingset-runner/src/chain.js, packages/swingset-runner/src/printStats.js

• • •
Architecture Diagram for Swingset Utilities
Architecture Diagram for Swingset Utilities

The chain.js file provides utility functions for managing the chain storage in the Swingset Runner. The exportStorage function exports and clears data from the chain storage, while the initEmulatedChain function initializes the emulated chain.

Read more

Bootstrapping and Management
[Edit section]
[Copy link]

References: packages/vats/src/core

• • •
Architecture Diagram for Bootstrapping and Management
Architecture Diagram for Bootstrapping and Management

The core functionality for bootstrapping the Agoric platform is primarily implemented in the …/core directory. This directory contains several key files that work together to set up the initial state, manage client bundles and provisioning, and configure the chain storage and communication.

Read more

Upgrading and Proposals
[Edit section]
[Copy link]

References: packages/vats/src/proposals

• • •
Architecture Diagram for Upgrading and Proposals
Architecture Diagram for Upgrading and Proposals

The …/proposals directory contains functionality for managing and upgrading different components of the Agoric platform. This includes repairing and reviving subscriptions, managing the local blockchain, upgrading the provisioning vat, and more.

Read more

Utilities and Testing
[Edit section]
[Copy link]

References: packages/vats/test, packages/vats/tools

• • •
Architecture Diagram for Utilities and Testing
Architecture Diagram for Utilities and Testing

The …/test directory contains a collection of utility functions and mocks that can be used to facilitate testing and development of the Agoric platform, particularly for working with the bank, board, and IBC components.

Read more

Mathematical Helpers
[Edit section]
[Copy link]

References: packages/ERTP/src/mathHelpers

• • •
Architecture Diagram for Mathematical Helpers
Architecture Diagram for Mathematical Helpers

The …/mathHelpers directory contains a set of utility functions and data structures that support the management of digital assets within the Agoric ERTP (Electronic Rights Transfer Protocol) system.

Read more

Amount Management
[Edit section]
[Copy link]

References: packages/ERTP/src/amountMath.js, packages/ERTP/src/amountStore.js

• • •
Architecture Diagram for Amount Management
Architecture Diagram for Amount Management

The amountMath.js file in the …/amountMath.js provides a comprehensive set of utilities and functions for working with digital assets represented as "amounts". The AmountMath module defines the AssetKind constants, which represent the different types of assets supported, and provides functions for creating, coercing, and performing operations on these asset amounts.

Read more

Issuer Kits
[Edit section]
[Copy link]

References: packages/ERTP/src/issuerKit.js

• • •
Architecture Diagram for Issuer Kits
Architecture Diagram for Issuer Kits

The main functionality in the file …/issuerKit.js is as follows:

Read more

Payments and Purses
[Edit section]
[Copy link]

References: packages/ERTP/src/payment.js, packages/ERTP/src/purse.js

• • •
Architecture Diagram for Payments and Purses
Architecture Diagram for Payments and Purses

The preparePaymentKind() function in the …/payment.js file is responsible for creating a new Payment object, which is a type of AssetKind used in the Agoric platform to represent digital assets in transit.

Read more

Transient Notifiers
[Edit section]
[Copy link]

References: packages/ERTP/src/transientNotifier.js

• • •
Architecture Diagram for Transient Notifiers
Architecture Diagram for Transient Notifiers

The makeTransientNotifierKit() function creates notifiers that can be associated with specific keys (e.g., Purse instances) and updated as needed. This function is part of the …/transientNotifier.js file.

Read more

Type Guards
[Edit section]
[Copy link]

References: packages/ERTP/src/typeGuards.js

• • •
Architecture Diagram for Type Guards
Architecture Diagram for Type Guards

The typeGuards.js file in the …/typeGuards.js directory defines a set of type guards and interface definitions that ensure type safety and consistency throughout the ERTP (Electronic Rights Transfer Protocol) codebase.

Read more

Orchestration Accounts
[Edit section]
[Copy link]

References: packages/orchestration/src/exos

• • •
Architecture Diagram for Orchestration Accounts
Architecture Diagram for Orchestration Accounts

The IcaAccountKit in the …/ica-account-kit.js file provides the core functionality for managing Inter-Chain Accounts (ICAs), which are accounts on a remote chain. This kit is crucial for enabling cross-chain interactions within the Agoric SDK's orchestration system.

Read more

Orchestration Flows
[Edit section]
[Copy link]

References: packages/orchestration/src/examples

• • •
Architecture Diagram for Orchestration Flows
Architecture Diagram for Orchestration Flows

The …/examples directory contains several example contracts and utilities that demonstrate the use of the Orchestration API in the Agoric SDK. These examples cover a range of functionality, including:

Read more

Orchestration Setup and Management
[Edit section]
[Copy link]

References: packages/orchestration/src/proposals

• • •
Architecture Diagram for Orchestration Setup and Management
Architecture Diagram for Orchestration Setup and Management

The …/proposals directory contains the core functionality for setting up and managing the various components of the Agoric SDK's orchestration system.

Read more

Orchestration Utilities
[Edit section]
[Copy link]

References: packages/orchestration/src/utils

The …/utils directory provides a rich set of utility functions and helpers that support the orchestration functionality in the Agoric SDK. These utilities cover various aspects such as:

Read more

Wallet State Management
[Edit section]
[Copy link]

References: packages/smart-wallet/src/smartWallet.js, packages/smart-wallet/src/utils.js

The SmartWallet class, located in …/smartWallet.js, is responsible for managing the state of a user's digital wallet. This includes handling deposits, withdrawals, and balance updates.

Read more

Offer Handling
[Edit section]
[Copy link]

References: packages/smart-wallet/src/offers.js, packages/smart-wallet/src/offerWatcher.js, packages/smart-wallet/src/invitations.js

• • •
Architecture Diagram for Offer Handling
Architecture Diagram for Offer Handling

The core functionality for creating, executing, and monitoring offers made by users within the Agoric smart wallet system is located in the following files:

Read more

Wallet Factory Upgrades
[Edit section]
[Copy link]

References: packages/smart-wallet/src/walletFactory.js, packages/smart-wallet/src/proposals/upgrade-wallet-factory2-proposal.js, packages/smart-wallet/src/proposals/upgrade-walletFactory-proposal.js

• • •
Architecture Diagram for Wallet Factory Upgrades
Architecture Diagram for Wallet Factory Upgrades

The walletFactory.js file in the …/src directory provides the core functionality for creating and managing smart wallets in the Agoric platform. A key aspect of this file is the handling of upgrades from the first incarnation of the smart wallet to the second incarnation.

Read more

Ansible Roles
[Edit section]
[Copy link]

References: packages/deployment/ansible/roles

• • •
Architecture Diagram for Ansible Roles
Architecture Diagram for Ansible Roles

The …/roles directory contains Ansible roles and related files for deploying and configuring a Cosmos-based blockchain network. The main functionality provided by this directory includes:

Read more

Docker Deployment
[Edit section]
[Copy link]

References: packages/deployment/docker

• • •
Architecture Diagram for Docker Deployment
Architecture Diagram for Docker Deployment

The …/docker directory contains scripts and configuration files for setting up and running Docker-based deployments of the Agoric SDK. The main functionality includes:

Read more

Terraform Configurations
[Edit section]
[Copy link]

References: packages/deployment/terraform

• • •
Architecture Diagram for Terraform Configurations
Architecture Diagram for Terraform Configurations

The Terraform configuration files for deploying the Agoric platform on various cloud providers are located in the …/terraform directory. These configurations provide a flexible and customizable way to deploy the Agoric platform on different cloud platforms, including DigitalOcean, Docker, and Heroku.

Read more

Deployment Scripts
[Edit section]
[Copy link]

References: packages/deployment/scripts

• • •
Architecture Diagram for Deployment Scripts
Architecture Diagram for Deployment Scripts

The …/scripts directory contains a collection of scripts that are used to manage the deployment and integration testing of the Agoric SDK. These scripts handle various tasks, such as capturing integration test results, generating Docker deployment configurations, installing dependencies, running integration tests, and testing the Docker build process.

Read more

Deployment Source Code
[Edit section]
[Copy link]

References: packages/deployment/src

• • •
Architecture Diagram for Deployment Source Code
Architecture Diagram for Deployment Source Code

The …/src directory contains the source code for the Agoric deployment tool, which is responsible for setting up and managing the deployment of an Agoric Cosmos chain. The main functionality of this directory includes:

Read more

Big Dipper Deployment
[Edit section]
[Copy link]

References: packages/deployment/bigdipper

• • •
Architecture Diagram for Big Dipper Deployment
Architecture Diagram for Big Dipper Deployment

The …/bigdipper directory contains the setup guide and deployment script for the Agoric Big Dipper, a tool used in the Agoric blockchain ecosystem.

Read more

Changelogs
[Edit section]
[Copy link]

References: packages/deployment/changelogs

• • •
Architecture Diagram for Changelogs
Architecture Diagram for Changelogs

The …/changelogs directory contains files that provide instructions and configurations for setting up Prometheus monitoring on Agoric testnet nodes, as well as guidelines for maintaining changelogs for the Agoric SDK project.

Read more

CLI Commands
[Edit section]
[Copy link]

References: packages/agoric-cli/src/commands

• • •
Architecture Diagram for CLI Commands
Architecture Diagram for CLI Commands

The Agoric CLI tool provides a wide range of command-line interface (CLI) commands for interacting with the Agoric blockchain and ecosystem. These commands cover various functionalities, including:

Read more

Utility Functions
[Edit section]
[Copy link]

References: packages/agoric-cli/src/lib

The …/lib directory contains several key modules that provide utility functions for interacting with the Agoric blockchain, virtual storage, and other components.

Read more

CLI Entry Point
[Edit section]
[Copy link]

References: packages/agoric-cli/src/bin-agops.js

• • •
Architecture Diagram for CLI Entry Point
Architecture Diagram for CLI Entry Point

The bin-agops.js file serves as the entry point for the Agoric CLI (Command-Line Interface) tool. It sets up the command-line interface using the commander library and configures various sub-commands that handle different aspects of the Agoric ecosystem.

Read more

Deployment and Publishing
[Edit section]
[Copy link]

References: packages/agoric-cli/src/deploy.js, packages/agoric-cli/src/main-publish.js, packages/agoric-cli/src/publish.js

• • •
Architecture Diagram for Deployment and Publishing
Architecture Diagram for Deployment and Publishing

The Agoric CLI provides functionality for deploying scripts and publishing bundles to the Agoric network, as well as publishing bundles to Cosmos SDK-based chains.

Read more

Script Loading and Execution
[Edit section]
[Copy link]

References: packages/agoric-cli/src/scripts.js

• • •
Architecture Diagram for Script Loading and Execution
Architecture Diagram for Script Loading and Execution

The makeLookup function in …/scripts.js is a higher-order function that takes a bootstrap promise (bootP) as an argument and returns a lookup function. This lookup function allows you to recursively look up names in the context of the bootstrap promise.

Read more

Configuration Management
[Edit section]
[Copy link]

References: packages/agoric-cli/src/chain-config.js, packages/agoric-cli/src/cosmos.js

• • •
Architecture Diagram for Configuration Management
Architecture Diagram for Configuration Management

The …/chain-config.js file contains various constants and functions related to the configuration of the Agoric blockchain. This includes:

Read more

Wallet and Offer Management
[Edit section]
[Copy link]

References: packages/agoric-cli/src/open.js

• • •
Architecture Diagram for Wallet and Offer Management
Architecture Diagram for Wallet and Offer Management

The walletMain() function in …/open.js is responsible for interacting with the Agoric wallet. It performs the following key tasks:

Read more

Project Initialization and Installation
[Edit section]
[Copy link]

References: packages/agoric-cli/src/init.js, packages/agoric-cli/src/install.js

• • •
Architecture Diagram for Project Initialization and Installation
Architecture Diagram for Project Initialization and Installation

The main functionality for initializing new Agoric dapp projects and installing dependencies is provided in the …/init.js and …/install.js files.

Read more

Development Environment Management
[Edit section]
[Copy link]

References: packages/agoric-cli/src/start.js

• • •
Architecture Diagram for Development Environment Management
Architecture Diagram for Development Environment Management

The startMain() function in …/start.js serves as the entry point for the Agoric CLI's start command, which is responsible for managing various Agoric development environments.

Read more

Heap Zone
[Edit section]
[Copy link]

References: packages/base-zone/src/heap.js

• • •
Architecture Diagram for Heap Zone
Architecture Diagram for Heap Zone

The core functionality for creating and managing "heap zones" in the Agoric SDK is provided by the makeHeapZone() function in the …/heap.js file. Heap zones are in-memory execution environments that provide a secure and isolated environment for running Agoric SDK components.

Read more

Detached Heap Stores
[Edit section]
[Copy link]

References: packages/base-zone/src/heap.js

• • •
Architecture Diagram for Detached Heap Stores
Architecture Diagram for Detached Heap Stores

The base zone provides a set of default store implementations (set, map, weak map, weak set) that can be used within the zone. These detached heap stores are defined in the detachedHeapStores object within the …/heap.js file.

Read more

Subzone Creation
[Edit section]
[Copy link]

References: packages/base-zone/src/heap.js

• • •
Architecture Diagram for Subzone Creation
Architecture Diagram for Subzone Creation

The base zone provides functionality for creating new "subzones" that are isolated from the parent zone. This is achieved through the subZone property of the makeHeapZone() function, which allows creating new subzones within the heap zone.

Read more

XSnap Runtime
[Edit section]
[Copy link]

References: packages/xsnap/src

• • •
Architecture Diagram for XSnap Runtime
Architecture Diagram for XSnap Runtime

The XSnap (Extensible Secure Snapshots) runtime is a secure JavaScript runtime that allows for the execution and testing of Agoric SDK components in a sandboxed environment. The core functionality of the XSnap runtime is provided by the xsnap() function, which is responsible for managing the lifecycle of an XSnap worker process.

Read more

XSnap Testing Framework
[Edit section]
[Copy link]

References: packages/xsnap/test

The XSnap Testing Framework is a comprehensive suite of tests that verify the functionality and behavior of the XSnap runtime, which is a key component of the Agoric SDK. The tests cover a wide range of aspects, including:

Read more

XSnap Utility Scripts
[Edit section]
[Copy link]

References: packages/xsnap/scripts

• • •
Architecture Diagram for XSnap Utility Scripts
Architecture Diagram for XSnap Utility Scripts

The …/scripts directory contains two Bash scripts that are used to manage and test the xsnap package in the Agoric SDK:

Read more

XSnap Documentation
[Edit section]
[Copy link]

References: packages/xsnap/doc

• • •
Architecture Diagram for XSnap Documentation
Architecture Diagram for XSnap Documentation

The additional documentation for the XS Metering and XS Snapshots features of the Agoric SDK is provided in the following files:

Read more

Launching and Initializing the Agoric Swingset
[Edit section]
[Copy link]

References: packages/cosmic-swingset/src/chain-main.js, packages/cosmic-swingset/src/launch-chain.js

• • •
Architecture Diagram for Launching and Initializing the Agoric Swingset
Architecture Diagram for Launching and Initializing the Agoric Swingset

The core functionality for launching and initializing the Agoric Swingset is implemented in the …/launch-chain.js file. This file is responsible for setting up the necessary components and storage layers to execute the Swingset kernel.

Read more

State Synchronization
[Edit section]
[Copy link]

References: packages/cosmic-swingset/src/export-kernel-db.js, packages/cosmic-swingset/src/import-kernel-db.js

• • •
Architecture Diagram for State Synchronization
Architecture Diagram for State Synchronization

The export-kernel-db.js file provides functionality for exporting the state of the Agoric Swingset kernel. The main entry point is the initiateSwingStoreExport function, which takes various options such as the state directory, export directory, block height, artifact mode, and export data mode, and returns an object that can be used to control the export process.

Read more

Logging and Metrics
[Edit section]
[Copy link]

References: packages/cosmic-swingset/src/anylogger-agoric.js, packages/cosmic-swingset/src/kernel-stats.js

• • •
Architecture Diagram for Logging and Metrics
Architecture Diagram for Logging and Metrics

The anylogger-agoric.js file is responsible for configuring and customizing the behavior of the anylogger library, which is used for logging in the Agoric SDK. The file sets up the logging levels based on the DEBUG environment variable, and provides a custom extension to the anylogger library that adds additional functionality, such as prefixing log messages with timestamps and controlling the logging output based on the selected logging level and the name of the logger.

Read more

Simulating the Agoric Cosmos Chain
[Edit section]
[Copy link]

References: packages/cosmic-swingset/src/sim-chain.js, packages/cosmic-swingset/src/sim-params.js

• • •
Architecture Diagram for Simulating the Agoric Cosmos Chain
Architecture Diagram for Simulating the Agoric Cosmos Chain

The main functionality in the file …/sim-chain.js can be summarized as follows:

Read more

Zoe Contract Framework
[Edit section]
[Copy link]

References: packages/zoe

• • •
Architecture Diagram for Zoe Contract Framework
Architecture Diagram for Zoe Contract Framework

The Zoe contract framework is a secure and flexible platform for building and executing smart contracts within the Agoric SDK. The core functionality of the Zoe contract framework is provided in the …/src directory, which includes the following key components:

Read more

Contract Facet API
[Edit section]
[Copy link]

References: packages/zoe/src/contractFacet/types-ambient.d.ts

The Zoe Contract Facet API, accessed via the ZCF interface, is the primary means for smart contract developers to interact with the Zoe state specific to their contract instance. It provides a suite of methods and types that facilitate the creation, management, and execution of smart contracts on the Agoric platform.

Read more

Contract Support Tools
[Edit section]
[Copy link]

References: packages/zoe/src/contractSupport/ratio.js, packages/zoe/src/contractSupport/topics.js

• • •
Architecture Diagram for Contract Support Tools
Architecture Diagram for Contract Support Tools

Zoe provides a set of tools within …/contractSupport to assist developers in creating robust smart contracts. One such utility is the manipulation of ratios, which are essential in financial calculations such as scaling amounts or determining exchange rates. Ratios are handled through a Ratio type, which is a record with numerator and denominator fields. Developers can create and validate ratios using makeRatio() and assertIsRatio(), respectively. Operations on ratios include multiplication and division with different rounding modes (floorMultiplyBy(), ceilDivideBy(), etc.), inversion (invertRatio()), and comparison (ratioGTE()).

Read more

Zoe Service Utilities
[Edit section]
[Copy link]

References: packages/zoe/src/zoeService/utils.d.ts, packages/zoe/src/zoeService/utils.test-d.ts

• • •
Architecture Diagram for Zoe Service Utilities
Architecture Diagram for Zoe Service Utilities

Within the Zoe Service, developers have access to a suite of utility functions and types that streamline the administrative management of smart contracts. These utilities facilitate the upgrade and restart of contract instances, ensuring that developers can maintain and improve their contracts over time.

Read more

Contract Upgradability
[Edit section]
[Copy link]

References: packages/zoe/src/contractFacet/types-ambient.d.ts

• • •
Architecture Diagram for Contract Upgradability
Architecture Diagram for Contract Upgradability

Smart contract developers on the Agoric platform can specify and manage upgrade paths for their contracts using the ContractMeta type defined in …/types-ambient.d.ts. This type includes metadata about a contract, such as the shapes of custom terms and private arguments, as well as an upgradability flag. The upgradability feature is crucial for maintaining and improving smart contracts over time without disrupting the contract's operation or the user's experience.

Read more

Ratio Math Operations
[Edit section]
[Copy link]

References: packages/zoe/src/contractSupport/ratio.js, packages/zoe/test/unitTests/contractSupport/ratio.test.js

• • •
Architecture Diagram for Ratio Math Operations
Architecture Diagram for Ratio Math Operations

In the Agoric SDK, ratios are fundamental to financial operations, allowing for the scaling of amounts and representation of exchange rates. The file …/ratio.js introduces the Ratio type, which consists of a numerator and denominator, both of which are Amount objects. Ratios are used extensively to perform arithmetic operations that involve scaling or exchanging digital assets.

Read more

Remote Subscriptions
[Edit section]
[Copy link]

References: packages/zoe/src/contractSupport/topics.js

• • •
Architecture Diagram for Remote Subscriptions
Architecture Diagram for Remote Subscriptions

In Zoe contracts, the management of data streams and event subscriptions is facilitated through the use of topics, which are handled by utilities provided in …/topics.js. Topics allow contracts to manage subscriptions in a way that supports remote participation, enabling subscribers to receive updates or notifications about specific events or state changes within the contract.

Read more

Cosmic Proto
[Edit section]
[Copy link]

References: packages/cosmic-proto

• • •
Architecture Diagram for Cosmic Proto
Architecture Diagram for Cosmic Proto

The …/cosmic-proto directory provides protocol buffer (protobuf) definitions and generated code for interacting with the Cosmos ecosystem and its various modules.

Read more

Signer Creation and Management
[Edit section]
[Copy link]

References: packages/cosmic-proto/src

• • •
Architecture Diagram for Signer Creation and Management
Architecture Diagram for Signer Creation and Management

In the Agoric SDK, the creation and management of signers are crucial for enabling transaction signing within the Cosmos ecosystem. Signers are entities that hold the cryptographic keys necessary to authorize and validate transactions. The …/src directory plays a pivotal role in this process by providing the necessary tools and utilities to handle Protobuf data, which is a serialization format widely used in the Cosmos network for encoding structured data.

Read more

Broadcasting Messages
[Edit section]
[Copy link]

References: packages/cosmic-proto/src

• • •
Architecture Diagram for Broadcasting Messages
Architecture Diagram for Broadcasting Messages

To broadcast messages to the Cosmos network, the Agoric SDK leverages the cosmic-proto package, specifically located within …/src. This package includes a suite of tools and utilities designed to facilitate the serialization and transmission of messages in the Cosmos ecosystem, adhering to the Protobuf standards.

Read more

Advanced Usage
[Edit section]
[Copy link]

References: packages/cosmic-proto/src

• • •
Architecture Diagram for Advanced Usage
Architecture Diagram for Advanced Usage

For developers seeking to leverage the Agoric SDK for more specialized use cases, the Cosmic Proto library offers advanced usage patterns that include the manual construction of a Stargate client with custom proto and amino configurations. This allows for a tailored approach to interacting with the Cosmos ecosystem, providing the flexibility to integrate with custom or non-standard blockchain functionalities.

Read more

Inter-Protocol
[Edit section]
[Copy link]

References: packages/inter-protocol

• • •
Architecture Diagram for Inter-Protocol
Architecture Diagram for Inter-Protocol

The …/inter-protocol directory contains the core implementation of the Agoric Inter-Protocol system, which includes the following key components:

Read more

Auction System
[Edit section]
[Copy link]

References: packages/inter-protocol/src/auction, packages/inter-protocol/test/auction

• • •
Architecture Diagram for Auction System
Architecture Diagram for Auction System

The auction process within the Agoric SDK's Inter-Protocol system is managed by a collection of components that handle offer settlement and auction upgrades. The AuctionBook class, located at …/auctionBook.js, is central to managing the state of ongoing auctions. It is responsible for:

Read more

Vault Factory
[Edit section]
[Copy link]

References: packages/inter-protocol/src/vaultFactory, packages/inter-protocol/test/vaultFactory, packages/inter-protocol/test/vaultFactory/director-allMgrsDo.test.js

• • •
Architecture Diagram for Vault Factory
Architecture Diagram for Vault Factory

The VaultFactory contract, established through the vaultFactory.js file, orchestrates the creation and management of vaults which are pivotal for borrowing and repaying the minted currency using collateral assets. The contract leverages a VaultDirector class, defined in vaultDirector.js, to oversee the addition of new vault types and the coordination of various vault managers. The VaultDirector is equipped with a machine interface that facilitates the creation of vaults, collection of fees, and scheduling of tasks like liquidation and price locking.

Read more

Contract Support
[Edit section]
[Copy link]

References: packages/inter-protocol/src/contractSupport.js

In the Agoric Inter-Protocol system, developers are equipped with a suite of utility functions found in …/contractSupport.js that streamline the development and operation of smart contracts. These utilities address common contract-related tasks, ensuring that developers can focus on the unique aspects of their smart contract logic.

Read more

Interest Calculation
[Edit section]
[Copy link]

References: packages/inter-protocol/src/interest.js, packages/inter-protocol/src/vaultFactory/vaultManager.js

• • •
Architecture Diagram for Interest Calculation
Architecture Diagram for Interest Calculation

Within the vault system of the Agoric SDK, interest on loans and debt is managed through a set of functions and methods designed to calculate and accrue interest over time. The primary utility for these calculations is found in …/interest.js, which includes the makeInterestCalculator function. This function is pivotal in setting up the interest calculation mechanism, allowing for the determination of new debt and interest amounts based on defined charging and reporting periods.

Read more

Testing and Simulation
[Edit section]
[Copy link]

References: packages/inter-protocol/test

• • •
Architecture Diagram for Testing and Simulation
Architecture Diagram for Testing and Simulation

In the Agoric SDK, the auction system is tested through a series of scenarios that validate the auction logic, ensuring that bids are sorted and settled correctly. Key functions like amountsToSettle are scrutinized to confirm accurate calculations of proceeds and collateral targets under various auction conditions. These tests are located in …/auctionMath.test.js and …/sortedOffers.test.js.

Read more

Swingset Runner
[Edit section]
[Copy link]

References: packages/swingset-runner

The …/swingset-runner directory contains the implementation of the Swingset Runner, a key component of the Agoric SDK. The Swingset Runner is responsible for managing the execution of the Agoric Swingset, which is the core runtime for the Agoric platform. The directory includes various files that handle different aspects of the Swingset Runner, such as:

Read more

Configuration Options
[Edit section]
[Copy link]

References: packages/swingset-runner/src/main.js

• • •
Architecture Diagram for Configuration Options
Architecture Diagram for Configuration Options

The swingset-runner provides a set of flags that modify its behavior, enabling developers to tailor the execution environment to their needs. Key flags include:

Read more

Vats
[Edit section]
[Copy link]

References: packages/vats

• • •
Architecture Diagram for Vats
Architecture Diagram for Vats

The …/vats directory contains the core functionality for bootstrapping, managing, and upgrading various aspects of the Agoric platform. This includes the setup of the bootstrap vat, the management of client bundles and provisioning, the configuration of the chain storage and communication, and the implementation of various utility functions and data structures used throughout the platform.

Read more

Core Vat Functionality
[Edit section]
[Copy link]

References: packages/vats/src/core

The Agoric SDK's vat system is architected to support the creation, management, and execution of vats, which are secure, isolated virtual machines within the Agoric environment. The bootstrapping process is a critical phase where the system's initial state is set up, and the vat infrastructure is wired together to ensure proper communication and operation.

Read more

Local Chain Interface
[Edit section]
[Copy link]

References: packages/vats/src/localchain.js

Interacting with a local chain in the Agoric SDK is facilitated through two primary interfaces: LocalChainAccountI and LocalChainI, which are instantiated using the prepareLocalChainTools factory function. These interfaces provide developers with a set of methods to manage accounts and perform queries on the local chain.

Read more

Virtual Purse
[Edit section]
[Copy link]

References: packages/vats/src/virtual-purse.js

• • •
Architecture Diagram for Virtual Purse
Architecture Diagram for Virtual Purse

The makeVirtualPurseKitIKit() function is pivotal in establishing the interfaces for a virtual purse within the Agoric SDK, defining the expected behavior and capabilities of a virtual purse. It outlines methods for retrieving the brand of the assets, current balance, and a notifier for balance updates. Additionally, it specifies interfaces for depositing and withdrawing assets, as well as for recovery operations.

Read more

Proposal Management
[Edit section]
[Copy link]

References: packages/vats/src/proposals/upgrade-provisionPool-proposal.js

• • •
Architecture Diagram for Proposal Management
Architecture Diagram for Proposal Management

In the Agoric SDK, the management of upgrade proposals is handled through a structured approach, focusing on the careful handling of private arguments and the systematic processing of proposal data. The …/upgrade-provisionPool-proposal.js file encapsulates this functionality, primarily through the upgradeProvisionPool function.

Read more

Testing and Simulation Tools
[Edit section]
[Copy link]

References: packages/vats/tools/fake-bridge.js

In the Agoric SDK, the …/fake-bridge.js plays a crucial role in the testing and simulation of bridge functionalities, which are pivotal for interactions with various blockchain protocols and services. The tool provides a suite of fake bridge managers that mimic the behavior of actual bridges in a controlled environment, enabling developers to validate logic and workflows without the need for a live blockchain connection.

Read more

IBC Functionality
[Edit section]
[Copy link]

References: packages/vats/src/types.d.ts

• • •
Architecture Diagram for IBC Functionality
Architecture Diagram for IBC Functionality

Inter-Blockchain Communication (IBC) is a critical protocol within the Agoric SDK, enabling secure and efficient cross-chain interactions. The …/types.d.ts file outlines the types and interfaces that facilitate the handling of IBC-related functionality.

Read more

Network and Vow Utilities
[Edit section]
[Copy link]

References: packages/vats/src/vat-network.js, packages/vats/test/network.test.js

Within the Agoric SDK, the management of network-related functionality is centralized through the buildRootObject function located in …/vat-network.js. This function orchestrates the initialization of network powers and vow tools, which are essential for enabling secure and efficient communication within the Agoric platform. Here's an overview of the key components and their roles:

Read more

ERTP
[Edit section]
[Copy link]

References: packages/ERTP

• • •
Architecture Diagram for ERTP
Architecture Diagram for ERTP

The Agoric ERTP (Electronic Rights Transfer Protocol) system is responsible for managing the transfer and representation of digital assets in the Agoric platform. The core functionality of the ERTP system is implemented in the …/ERTP directory.

Read more

Type Guards and Validation
[Edit section]
[Copy link]

References: packages/ERTP/src/typeGuards.js

• • •
Architecture Diagram for Type Guards and Validation
Architecture Diagram for Type Guards and Validation

In the Agoric SDK, the …/typeGuards.js file plays a crucial role in maintaining the integrity of digital assets by providing a suite of type guards and shape definitions. These tools are essential for validating the structure and consistency of various ERTP-related objects, ensuring that they conform to expected patterns before they are processed or manipulated within the system.

Read more

Amount Patterns
[Edit section]
[Copy link]

References: packages/ERTP/src/typeGuards.js

• • •
Architecture Diagram for Amount Patterns
Architecture Diagram for Amount Patterns

In the ERTP system, asset amounts are represented using structured patterns that enable matching and validation during various operations. The …/typeGuards.js file plays a crucial role in this process by providing shapes and type guard functions that ensure the integrity of asset amounts.

Read more

Orchestration
[Edit section]
[Copy link]

References: packages/orchestration

The …/orchestration directory provides the core functionality for the orchestration system in the Agoric SDK, enabling the management of assets and services across different blockchain networks.

Read more

Chain and Asset Management
[Edit section]
[Copy link]

References: packages/orchestration/src/chain-info.js, packages/orchestration/src/exos/chain-hub.js, packages/orchestration/test/assets.fixture.ts

• • •
Architecture Diagram for Chain and Asset Management
Architecture Diagram for Chain and Asset Management

The orchestration system within the Agoric SDK provides a structured approach to managing chain and asset information, crucial for the operation of Cosmos-based assets and the facilitation of IBC token transfers. The system utilizes components such as ChainHub and NameHub to enhance asset management capabilities across different blockchain networks.

Read more

Contract Orchestration and Setup
[Edit section]
[Copy link]

References: packages/orchestration/src/examples/auto-stake-it.flows.js, packages/orchestration/src/examples/basic-flows.flows.js

• • •
Architecture Diagram for Contract Orchestration and Setup
Architecture Diagram for Contract Orchestration and Setup

In the orchestration of contracts within the Agoric SDK, the makeAccounts function plays a pivotal role, particularly in the context of automatic staking scenarios. This function is designed to streamline the setup of accounts and portfolio holders across multiple chains. It is utilized in …/auto-stake-it.flows.js to create a local account on the Agoric chain and a corresponding staking account on a remote chain. The function is configured to automatically delegate any incoming tokens to a pre-specified validator through the MakeStakingTap.

Read more

Interchain Communication
[Edit section]
[Copy link]

References: packages/orchestration/src/exos/ibc-packet.js, packages/orchestration/src/exos/packet-tools.js

Interchain communication within the Agoric SDK leverages the Inter-Blockchain Communication (IBC) protocol to manage packet transfers and acknowledgments across different blockchain networks. The orchestration layer provides developers with tools to monitor packet transfers, match packets to specific patterns, and handle acknowledgments efficiently.

Read more

Orchestration Account Functionality
[Edit section]
[Copy link]

References: packages/orchestration/src/exos/cosmos-orchestration-account.js, packages/orchestration/test/exos/cosmos-orchestration-account.test.ts

• • •
Architecture Diagram for Orchestration Account Functionality
Architecture Diagram for Orchestration Account Functionality

The CosmosOrchestrationAccount class in …/cosmos-orchestration-account.js serves as a comprehensive interface for managing Cosmos-based staking accounts. It encapsulates a variety of staking operations such as delegation, redelegation, and reward withdrawal, as well as the ability to send tokens and initiate IBC transfers. The class provides methods like delegate(), redelegate(), withdrawReward(), withdrawRewards(), and undelegate() to interact with the staking process directly. Additionally, it includes send() and transfer() methods for token transactions within and across chains, respectively.

Read more

Orchestration Utilities and Tools
[Edit section]
[Copy link]

References: packages/orchestration/src/utils/time.js, packages/orchestration/src/utils/zoe-tools.js, packages/orchestration/src/utils/address.js

In the orchestration system of the Agoric SDK, a set of utilities and tools are provided to facilitate various operations such as time management, asset transfers, and address handling. The …/time.js file includes a makeTimestampHelper function that leverages a TimerService to calculate future timestamps in nanoseconds, which are crucial for setting timeouts in message transfers and other time-sensitive tasks.

Read more

Inter-Chain Account Management
[Edit section]
[Copy link]

References: packages/orchestration/src/exos/ica-account-kit.js, packages/orchestration/src/cosmos-api.ts

• • •
Architecture Diagram for Inter-Chain Account Management
Architecture Diagram for Inter-Chain Account Management

Inter-Chain Account Management within the Agoric SDK is facilitated by the IcaAccountKit class, which is part of the orchestration package located at …/ica-account-kit.js. This class provides a set of functionalities crucial for the operation of Inter-Chain Accounts (ICAs), which are accounts that exist on a remote blockchain and can be controlled from a different chain.

Read more

Cosmos Interchain Service
[Edit section]
[Copy link]

References: packages/orchestration/test/cosmos-interchain-service.test.ts

• • •
Architecture Diagram for Cosmos Interchain Service
Architecture Diagram for Cosmos Interchain Service

The CosmosInterchainService module manages Interchain Queries (ICQ) and Interchain Accounts (ICA) connections. Key functionalities include:

Read more

Smart Wallet
[Edit section]
[Copy link]

References: packages/smart-wallet

• • •
Architecture Diagram for Smart Wallet
Architecture Diagram for Smart Wallet

The Agoric Smart Wallet system is a core component of the Agoric platform, responsible for managing user wallets, handling offers and invitations, and providing a durable and reliable interface for interacting with the Agoric ecosystem.

Read more

Deployment
[Edit section]
[Copy link]

References: packages/deployment

• • •
Architecture Diagram for Deployment
Architecture Diagram for Deployment

The …/deployment directory contains the necessary scripts, configurations, and tools for deploying and managing the Agoric blockchain network. The key functionality includes:

Read more

Agoric CLI
[Edit section]
[Copy link]

References: packages/agoric-cli

• • •
Architecture Diagram for Agoric CLI
Architecture Diagram for Agoric CLI

The Agoric CLI is the main command-line interface tool for interacting with the Agoric blockchain and ecosystem. It provides a wide range of functionality, including:

Read more

Command-Line Interface Utilities
[Edit section]
[Copy link]

References: packages/agoric-cli/src/init.js, packages/agoric-cli/src/helpers.js

• • •
Architecture Diagram for Command-Line Interface Utilities
Architecture Diagram for Command-Line Interface Utilities

The Agoric CLI provides a suite of utilities designed to streamline the process of initializing and managing Agoric dapp projects. A key utility is the initMain() function from …/init.js, which automates the setup of a new dapp by cloning a template repository, re-initializing Git history, and preparing the project for development. This function simplifies the process of starting a new dapp project by handling the intricacies of repository setup and configuration.

Read more

Getting Started with Agoric
[Edit section]
[Copy link]

References: packages/agoric-cli/tools/getting-started.js

• • •
Architecture Diagram for Getting Started with Agoric
Architecture Diagram for Getting Started with Agoric

To begin Agoric development, the Agoric CLI provides a streamlined process that guides developers through setting up a new project, installing dependencies, and running a local test environment. The entry point for this workflow is the gettingStartedWorkflowTest() function, which automates the setup and testing of a new Agoric dapp.

Read more

Base Zone
[Edit section]
[Copy link]

References: packages/base-zone

• • •
Architecture Diagram for Base Zone
Architecture Diagram for Base Zone

The @agoric/base-zone library provides the core functionality for creating and managing "Zones" in the Agoric SDK. Zones are isolated execution environments that can be used to safely execute untrusted code.

Read more

XSnap
[Edit section]
[Copy link]

References: packages/xsnap

• • •
Architecture Diagram for XSnap
Architecture Diagram for XSnap

The XSnap (Extensible Secure Snapshots) package in the Agoric SDK provides a secure JavaScript runtime and a comprehensive testing framework for Agoric SDK components. The key functionality of the XSnap package includes:

Read more

XSnap API
[Edit section]
[Copy link]

References: packages/xsnap/api.js

• • •
Architecture Diagram for XSnap API
Architecture Diagram for XSnap API

Interacting with the XSnap virtual machine is facilitated by the XSnap API, which is crucial for script execution within a secure and isolated environment. The API is designed to manage computational resource metering and handle snapshots for maintaining persistent state across sessions.

Read more

XSnap Runtime
[Edit section]
[Copy link]

References: packages/xsnap/src/xsnap.js

• • •
Architecture Diagram for XSnap Runtime
Architecture Diagram for XSnap Runtime

The xsnap() function serves as the gateway to the XSnap virtual machine, enabling the execution of scripts and interaction with the worker process. It accepts an XSnapOptions object, which configures the environment and behavior of the XSnap instance. Upon invocation, xsnap() returns an interface with methods tailored for communication and control of the XSnap worker.

Read more

XSnap REPL
[Edit section]
[Copy link]

References: packages/xsnap/src/xsrepl.js

• • •
Architecture Diagram for XSnap REPL
Architecture Diagram for XSnap REPL

The XSnap provides an interactive environment through its REPL, allowing users to execute XS code in real-time. This feature is particularly useful for developers who need to test and debug their code in a controlled setting. The REPL is powered by the xsnap() function, which initializes the XS virtual machine instance, ensuring that each session starts with a clean slate.

Read more

XSnap Test Suite
[Edit section]
[Copy link]

References: packages/xsnap/test/xs-limits.test.js

• • •
Architecture Diagram for XSnap Test Suite
Architecture Diagram for XSnap Test Suite

The xsnap module is equipped with a test suite located in …/xs-limits.test.js, which is designed to validate the virtual machine's behavior under various resource limit conditions. The suite includes tests that simulate scenarios where the system resources are pushed to their limits, ensuring that xsnap responds appropriately.

Read more

Cosmic Swingset
[Edit section]
[Copy link]

References: packages/cosmic-swingset

• • •
Architecture Diagram for Cosmic Swingset
Architecture Diagram for Cosmic Swingset

The …/cosmic-swingset directory contains the core implementation of the Agoric Cosmos Swingset, which is the central component of the Agoric blockchain platform. The key functionality in this directory includes:

Read more

Swingset Launch Process
[Edit section]
[Copy link]

References: packages/cosmic-swingset/src/launch-chain.js

• • •
Architecture Diagram for Swingset Launch Process
Architecture Diagram for Swingset Launch Process

Launching a new Agoric swingset instance begins with the buildSwingset() function, which sets up the initial conditions for the SwingSet kernel. This includes the creation of essential devices such as mailbox, timer, and bridge, and initializing the SwingSet configuration. The function also prepares the system for upgrades by handling core proposals, which are crucial for the evolution of the SwingSet.

Read more

Swingset Device Endowments
[Edit section]
[Copy link]

References: packages/cosmic-swingset/src/launch-chain.js

• • •
Architecture Diagram for Swingset Device Endowments
Architecture Diagram for Swingset Device Endowments

Within the SwingSet environment of the Agoric blockchain platform, device endowments play a crucial role in the system's operation. The launch-chain.js file, specifically within the buildSwingset() function, sets up these device endowments, which include essential devices like the mailbox, timer, and notably, the bridgeDevice.

Read more

Swingset Export Callback
[Edit section]
[Copy link]

References: packages/cosmic-swingset/src/launch-chain.js

• • •
Architecture Diagram for Swingset Export Callback
Architecture Diagram for Swingset Export Callback

In the …/launch-chain.js, the state of the Agoric SwingSet is managed to ensure consistency and integrity during the export process. The swingStoreExportCallback function plays a pivotal role in this process. It is invoked to handle the export of the kernel's state, which is crucial for maintaining a consistent blockchain state across restarts or upgrades. The callback function is designed to work in conjunction with flags that signal the appropriate times to capture the state, such as before a block commit.

Read more

Swingset Bridge Outbound
[Edit section]
[Copy link]

References: packages/cosmic-swingset/src/launch-chain.js

• • •
Architecture Diagram for Swingset Bridge Outbound
Architecture Diagram for Swingset Bridge Outbound

The buildSwingset function within …/launch-chain.js is integral to the setup of the Agoric SwingSet kernel. One of its parameters, bridgeOutbound, serves as a crucial link for outbound communication from the SwingSet to the external world, particularly the Cosmos blockchain. This parameter is a function that is called whenever the SwingSet kernel needs to send a message to the outside, such as to other Cosmos zones or to off-chain components.

Read more