> ## Documentation Index
> Fetch the complete documentation index at: https://docs.boost.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Learn about the role the Registry plays in the SDK

<Warning>
  The One-Time Actions docs are under active development and will be subject to changes.
</Warning>

<CardGroup cols={3}>
  <Card title="Smart Contract" icon="file-contract" href="https://github.com/boostxyz/boost-protocol/blob/main/packages/evm/contracts/BoostRegistry.sol">
    Read the smart contracts
  </Card>

  <Card title="Typedoc" icon="file-lines" href="https://sdk.boost.xyz/classes/BoostRegistry.html">See technical documentation</Card>

  <Card title="SDK Implementation" icon="file-code" href="https://github.com/boostxyz/boost-protocol/blob/main/packages/sdk/src/BoostRegistry.ts">
    See the source
  </Card>
</CardGroup>

[//]: # "TODO: link these somewhere"

The Boost Registry contract is a key touchpoint within the protocol, allowing users to initialize components they intend to re-use across multiple Boosts, like Budgets or AllowLists.

<Tip>
  Unless you're an advanced user, you will likely never need to deploy your own and `registry` contract. The `SDK` comes preconfigured with the correct contract addresses for all deployed core implementations.
</Tip>

The registry aspect to the `Registry` is just that, a registry of valid `Action`, `AllowList`,
`Budget`, `Incentive` and `Validator` implementations that can be utilized and
extended by clients of the protocol.

<Tip>
  Going forward, the term `component` in reference to a Boost, refers to any `Action`, `AllowList`, `Budget`, `Incentive` or `Validator`.
</Tip>

As opposed to upgrading the source of the protocol contracts over time to add features, the Boost team will, as needed, register new implementations that adhere to `Action`, `AllowList`, `Budget`, `Incentive` or `Validator` interfaces that can then be leveraged in the creation of new Boosts.

In most cases, you'll be interacting with the registry to initialize budgets that you can then use and reuse in your Boosts. For example,

```ts theme={null}
import { BoostCore } from '@boostxyz/sdk/BoostCore'
import { BoostRegistry } from '@boostxyz/sdk/BoostRegistry'
import { ManagedBudget, Roles } from '@boostxyz/sdk'

const registry = new BoostRegistry({ config: wagmiConfig }),
  core = new BoostCore({ config: wagmiConfig })
const coreAddress = core.assertValidAddress()

// to create a new budget and grant the correct permissions to the protocol
const budget = await registry.initialize('MyNewBudget', core.ManagedBudget({
  owner: '0xME',
  authorized: ['0xME', coreAddress],
  roles: [Roles.ADMIN, Roles.MANAGER]
}))
// or use an existing one, ensuring the protocol has the correct level of access
budget = core.ManagedBudget('0xEXISTING_BUDGET_ADDRESS')
// if you've successfully used this budget with the protocol before, you won't need to do this
if ((await budget.isAuthorized(coreAddress)) === false) {
  await budget.grantRoles(coreAddress, Roles.MANAGER)
}
```

Ideally, you'll store a record of your budgets in some database, but the registry does contain some helpers to retrieve information about components you've initialized. For example, you can retrieve the address of the budget initialized above with the following flow.

```ts theme={null}
import { ManagedBudget, Roles } from '@boostxyz/sdk'
import { RegistryType } from '@boostxyz/sdk/BoostRegistry'

// get the initialized budget's unique identifier
const identifier = await registry.getCloneIdentifier(RegistryType.BUDGET, ManagedBudget.BASE, '0xME', "MyNewBudget")
// use the identifier to retrieve the deployed address
const budgetAddress = await registry.getClone(identifier)
// instantiate a `ManagedBudget` to access further SDK functionality
const budget = core.ManagedBudget(budgetAddress)
```

Any component you initialize through the registry can be retrieved this way as well by passing the address you used to interact with the registry.

```ts theme={null}
const identifiers = await registry.getClones('0xME')
const allCloneAddresses = await Promise.all(identifiers.map(identifier => registry.getClone(identifier)))
```

### What does it mean to `clone` a `base` implmentation?

Boost components aren't instantiated traditionally, with parameters supplied to the contract's constructor on deployment. Instead, to ensure each Boost component is compliant with a registered base implementation, and save on gas, components are either cloned from a deployed base contract and initialized ahead of time through registry before being referenced in Boost creation, or, for some components, initialized at time of Boost creation, like `Incentives`.

A base implementation is any deployed contract registered with the registry, thus valid for use with Boost creation, that satisfies the interfaces for either `Action`, `AllowList`, `Budget`, `Incentive` or `Validator`. For example, [ManagedBudget](https://github.com/boostxyz/boost-protocol/blob/main/packages/evm/contracts/budgets/ManagedBudget.sol) is a base implementation that satisfies the [Budget](https://github.com/boostxyz/boost-protocol/blob/main/packages/evm/contracts/budgets/ABudget.sol) interface.
