# Makina Docs
Documentation for the Makina Protocol
# Introduction
## What is Makina?
Makina is a protocol for **professionally managed, tokenized, cross-chain investment strategies**.
A strategy on Makina behaves like an onchain fund: users deposit a single asset and receive a fungible token (a *share*) that represents their proportional claim on everything the strategy holds. Behind that machine token, a professional manager, the **Operator**, puts the capital to work across DeFi: lending markets, liquidity pools, yield vaults, derivatives, and other protocols, on Ethereum and on other chains.
What makes Makina different from a traditional smart-contract vault is the **execution model**. Instead of hard-coding each integration into the vault, Makina gives the Operator a generalized, permissioned execution engine ([the MakinaVM](architecture/caliber/makina-vm)) that can interact with almost any external protocol, but only through actions that governance has reviewed and explicitly approved in advance. This combines the flexibility of an actively managed fund with the safety of a tightly scoped vault.
## What problem does it solve?
Onchain asset management today forces a hard trade-off:
* **Rigid vaults** are safe but inflexible. Every new protocol integration requires writing, auditing, and deploying a custom adapter, which is slow, expensive, and error-prone. The strategy can only ever do what was anticipated at deployment time.
* **Discretionary, manually managed strategies** are flexible but require users to fully trust a manager who can move funds anywhere, at any time, with no onchain guardrails.
Makina removes the trade-off. The Operator can pursue opportunities across the entire DeFi landscape and adapt as markets change, **without unilateral control over user funds**. Every action the Operator can take is bounded by an onchain risk policy and a pre-approved instruction set, and a separate **Security Council** can intervene if something goes wrong. Adding a new integration is a single governance-reviewed update, not a new contract deployment.
## How does it create value?
A Makina strategy creates value the way any fund does, by generating returns on the capital it manages:
* **Yield** from lending, staking, liquidity provision, and yield-bearing assets.
* **Price appreciation** of the assets it holds relative to the strategy's reference asset.
* **Active management**: the Operator continuously rebalances toward the best risk-adjusted opportunities, across chains, within the limits set by governance.
As the strategy's total value grows, so does the value of each share. Holders capture returns through the appreciation of their [machine token](architecture/machine/machine-token), which is fully composable and can itself be used as collateral, paired in liquidity pools, or held in treasury. Operators and the protocol are compensated through [fees](architecture/machine/fees), aligning their incentive with long-term share-price growth.
## Design principles
Makina is built to be **non-custodial, transparent, and trust-minimized**:
* **No unilateral control.** The Operator executes the strategy but cannot withdraw user funds, send assets to arbitrary destinations, or exceed the risk limits encoded onchain.
* **Pre-approved actions only.** Every protocol interaction must match an instruction that governance has reviewed and committed to onchain, subject to a timelock.
* **Defense in depth.** Loss caps, cooldowns, staleness checks, timelocks, a veto-holding Security Council, an emergency [Recovery Mode](security/recovery-mode), and an insurance [Security Module](security/security-module) each catch what the others miss.
* **Verifiable accounting.** [Share price](architecture/machine/share-price) is derived from the strategy's full, oracle-priced assets under management (including capital deployed on other chains), and is auditable by anyone at any time.
## The strategy mandate
When a strategy launches, its team publishes a **mandate**: a high-level description of the strategy's type, goal, risk profile, return expectations, and the opportunity segment it targets. The mandate is the human-readable charter that guides the [Risk Manager](governance/risk-manager) (who sets the onchain limits) and the [Operator](governance/operator) (who executes within them). It is the reference point against which a strategy's behavior can be judged.
## Who is this documentation for?
This Concepts section is the primary onboarding path for everyone encountering Makina:
* **Users** who want to understand how their deposits are managed and what protects them.
* **Operators** running strategies, who need to understand the system's limits and logic.
* **Partners, investors, and ecosystem participants** evaluating the protocol.
* **Integrators** building on top of Makina shares or strategies.
* **Solidity developers and auditors** who want a conceptual map before reading the contracts.
Operators can also refer to the [Operator docs](https://operator.makina.finance/docs) for guidance specific to running strategies.
:::tip[Where to go next]
New to Makina? Read [Architecture](architecture/overview) and [Asset Lifecycle](architecture/lifecycle) in order. Together they give you a complete mental model in a few minutes.
:::
# Architecture
This page builds the mental model you'll use for the rest of the documentation: the major components, how they fit together, and the vocabulary the protocol uses. Read it once and the deeper sections will slot neatly into place.
## The two core components
Every Makina strategy is built from two kinds of contract:
* **The [Machine](machine/overview)** is the *vault and accounting layer*. It lives on a single chain (the **Hub Chain**) and is the strategy's front door: it accepts deposits, issues the [machine token](machine/machine-token), computes the [share price](machine/share-price), charges [fees](machine/fees), and aggregates the value of everything the strategy holds (including capital on other chains) into one number, the **AUM** (assets under management).
* **The [Caliber](caliber/overview)** is the *execution layer*. A Caliber is where assets are actually deployed into external protocols. It opens and manages [positions](caliber/positions), [swaps](caliber/swaps) tokens, [harvests](caliber/harvests) rewards, and reports the value of everything it holds back to the Machine.
A strategy always has **one Machine**, and **one Caliber per chain** it operates on. The Caliber on the Hub Chain sits next to the Machine. Additional Calibers on other chains (**Spoke Chains**) extend the strategy across the multi-chain landscape.
```mermaid
flowchart TB
User([User]):::ext
subgraph Hub["Hub Chain"]
Machine["Machine
(vault & accounting)"]:::core
HubCaliber["Hub Caliber
(execution)"]:::core
HubProto[(External
protocols)]:::ext
end
subgraph Spoke["Spoke Chain"]
Mailbox["Caliber Mailbox
(Machine endpoint)"]:::core
SpokeCaliber["Spoke Caliber
(execution)"]:::core
SpokeProto[(External
protocols)]:::ext
end
User -- "deposit / redeem" --> Machine
Machine -- "shares" --> User
Machine <--> HubCaliber
HubCaliber <--> HubProto
Machine <-. "bridge liquidity" .-> Mailbox
Machine <-. "cross-chain accounting" .-> Mailbox
Mailbox <--> SpokeCaliber
SpokeCaliber <--> SpokeProto
classDef core fill:#1f6feb,stroke:#1f6feb,color:#fff;
classDef ext fill:#30363d,stroke:#6e7681,color:#fff;
```
## Core vs. periphery
The contracts are organized into two repositories, and the distinction is worth understanding early:
* **Core** ([makina-core](/contracts/core/summary)) is the trust-critical engine: the Machine, the Calibers, the cross-chain bridging and accounting plumbing, and the shared registries that price assets and resolve dependencies. Core contracts hold and move the funds.
* **Periphery** ([makina-periphery](/contracts/periphery/summary)) comprises the modular contracts that surround a Machine and can be swapped per strategy: the [Depositor](machine/deposits) (entry point), the [Redeemer](machine/redemptions) (exit queue), the [Fee Manager](machine/fees) (fee policy), and the [Security Module](../security/security-module) (insurance backstop).
The split matters because it is *how Makina stays flexible*. Different strategies need different deposit rules, redemption flows, and fee models. Rather than baking those into the Machine, the Machine delegates them to interchangeable periphery contracts. The Machine only knows "my depositor", "my redeemer", "my fee manager", and each can be a different implementation.
## Shared infrastructure
Alongside the per-strategy contracts, a set of **protocol-wide infrastructure** contracts are deployed once per chain and shared by every strategy:
* The **[Oracle Registry](pricing-oracles)** prices any token against the strategy's reference asset using Chainlink-compatible price feeds, the foundation of all accounting.
* The **[Token Registry](/contracts/core/registries/contract.TokenRegistry)** maps a token to its equivalent address on each foreign chain, so the protocol can reason about "the same token, on another chain."
* The **Swap Module** routes [swaps](caliber/swaps) through approved external aggregators.
* **Registries and factories** deploy new strategies and let the protocol resolve and upgrade shared dependencies. See [Protocol Upgrades](../governance/protocol-upgrades).
These are covered in [Pricing & Oracles](pricing-oracles) and the [Contracts](/contracts/core/architecture-overview) reference.
## How the pieces interact
Three flows tie the system together. Each has its own section, summarized in one paragraph here.
**Capital flow.** Users deposit the [accounting token](#glossary) through the [Depositor](machine/deposits) and receive shares. The [Operator](../governance/operator) moves idle capital from the Machine into Calibers (and across chains via [bridging](cross-chain/liquidity-bridging)), where it is deployed into [positions](caliber/positions). To exit, users request a redemption through the [Redeemer](machine/redemptions). The Operator frees up liquidity and the redemption is settled. See [Asset Lifecycle](lifecycle).
**Accounting flow.** Each Caliber values everything it holds in the accounting token. The Machine sums the value of its idle balance, the Hub Caliber, and every Spoke Caliber to produce the strategy's total AUM, from which the share price is derived. Because Spoke Calibers live on other chains, their values are relayed to the Machine through [Chainlink CRE](cross-chain/cross-chain-accounting). See [Share Price](machine/share-price).
**Control flow.** The Operator executes the strategy but only within bounds: a pre-approved [instruction set](caliber/makina-vm), per-position [risk caps](../governance/risk-manager), loss limits, and cooldowns. The [Risk Manager](../governance/risk-manager) sets those bounds (most changes pass through a timelock), and the [Security Council](../governance/security-council) can veto changes and trigger [Recovery Mode](../security/recovery-mode). See [Roles & Governance](../governance/overview).
## Glossary
| Term | Meaning |
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Machine** | The per-strategy vault on the Hub Chain. Handles deposits, redemptions, shares, fees, and total AUM. See [Machine](machine/overview). |
| **Caliber** | The per-chain execution engine that deploys assets into external protocols. See [Caliber](caliber/overview). |
| **Hub Chain** | The chain a strategy's Machine lives on, where users deposit and redeem. Each Makina instance has one hub chain. |
| **Spoke Chain** | Any additional chain a strategy operates on, hosting a Caliber and a Caliber Mailbox. |
| **Share / Machine Token** | The ERC-20 token representing a proportional claim on the strategy. Its value is the share price. See [Machine Token](machine/machine-token). |
| **Accounting Token** | The single asset a strategy is denominated in (e.g. USDC, WETH). The only token users deposit and redeem, and the unit in which all value is measured. |
| **Base Token** | A token a Caliber may hold directly and that is priceable against the accounting token. The "raw materials" positions are built from. See [Base Tokens](caliber/base-tokens). |
| **AUM** | Assets under management: the total value of everything a strategy controls, in accounting-token terms. |
| **Position** | A deployment of capital into an external protocol, tracked and valued by a Caliber. Can be an asset or a debt. See [Positions](caliber/positions). |
| **Instruction** | A pre-approved, governance-committed action the Operator may execute via the [MakinaVM](caliber/makina-vm). |
| **Operator** | The entity that executes the strategy day to day. *Onchain, this role is held by an address the contracts call the `mechanic`. The `operator()` getter returns that address normally, and the Security Council's address while [Recovery Mode](../security/recovery-mode) is active.* Throughout these docs we use the term **Operator**. See [Operator](../governance/operator). |
| **Risk Manager** | The entity that sets and adjusts a strategy's risk parameters and proposes new instructions, mostly through a timelock. See [Risk Manager](../governance/risk-manager). |
| **Security Council** | The emergency oversight body that can veto risk changes and trigger Recovery Mode. See [Security Council](../governance/security-council). |
| **Recovery Mode** | An emergency state that strips the Operator of normal powers and restricts the strategy to unwinding only. See [Recovery Mode](../security/recovery-mode). |
:::tip[Next]
Continue to [Asset Lifecycle](lifecycle) to follow a deposit through the entire system, from share minting to redemption.
:::
# Asset Lifecycle
This page follows capital through a Makina strategy end to end: how a deposit becomes shares, how those funds are deployed and rebalanced, how value is measured, and how a user eventually exits. Each step links to the section that covers it in depth.
## The big picture
```mermaid
flowchart LR
A["1.Deposit"] --> B["2.Allocate"]
B --> C["3.Deploy"]
C --> D["4.Rebalance
& Harvest"]
D --> E["5.Account"]
E --> D
D --> F["6.Redeem"]
E -.->|share price| A
E -.->|share price| F
classDef s fill:#1f6feb,stroke:#1f6feb,color:#fff;
class A,B,C,D,E,F s;
```
Steps 3–5 form a continuous loop: the Operator keeps the capital working and the protocol keeps the valuation fresh, for as long as the strategy runs. Deposits (1–2) and redemptions (6) happen around that loop.
## 1. Deposit: capital enters, shares are minted
A user deposits the strategy's [accounting token](overview#glossary) through the strategy's [Depositor](machine/deposits) contract. The Depositor forwards the assets to the [Machine](machine/overview), which mints [shares](machine/machine-token) to the user at the current [share price](machine/share-price).
```mermaid
sequenceDiagram
actor User
participant D as Depositor
participant M as Machine
User->>D: deposit(assets)
D->>M: forward assets
M->>M: shares = assets ÷ share price
M-->>User: mint shares
```
The number of shares minted is `assets / share price`, so a deposit never changes the share price. It only scales the strategy up proportionally. Depending on the strategy, the Depositor may enforce a [whitelist](machine/deposits#whitelisting) (e.g. for KYC-gated strategies). See [Deposits](machine/deposits).
:::note[Example implementation]
The atomic "forward and mint instantly" flow shown here is the **[DirectDepositor](/contracts/periphery/depositors/contract.DirectDepositor)**, one common depositor implementation. The Depositor is a swappable [periphery](overview#core-vs-periphery) contract: some deployed strategies use the DirectDepositor, while others run custom logic built for a particular integrator's needs. The constant is that the Machine accepts deposits only from its designated Depositor.
:::
*Before a strategy launches, deposits can be gathered through a [Pre-Deposit Vault](machine/pre-deposit), which lets a strategy bootstrap liquidity and seamlessly transition into the live Machine.*
## 2. Allocate: capital moves to where it will be deployed
Fresh deposits sit idle on the Machine's balance. To put them to work, the [Operator](../governance/operator) transfers capital to a Caliber:
* To the **Hub Caliber**, a direct transfer on the same chain.
* To a **Spoke Caliber**, a cross-chain [bridge transfer](cross-chain/liquidity-bridging): a deliberate, multi-step process routed through approved bridge adapters.
The Operator decides how much to keep idle as a withdrawal buffer and how much to deploy. This allocation is itself a strategy decision, bounded by the risk policy.
## 3. Deploy: positions are opened
Within a Caliber, the Operator deploys [base tokens](caliber/base-tokens) into external protocols by executing [Instructions](caliber/makina-vm) on the [MakinaVM](caliber/makina-vm). Each deployment becomes a tracked [position](caliber/positions): a supply on a lending market, an LP position on a DEX, a deposit into a yield vault, and so on. Positions can also represent **debt** (e.g. a borrow), which counts negatively toward AUM.
Crucially, the Operator can only execute Instructions that governance has **pre-approved** and committed onchain. The Caliber verifies every action against a Merkle root of the allowed instruction set before running it (see [`allowedInstrRoot`](/contracts/core/caliber/contract.Caliber#allowedinstrroot)), and applies a [loss check](caliber/positions#loss-checks) comparing value before and after to ensure the deployment didn't leak value beyond a configured tolerance.
## 4. Rebalance & harvest: the strategy is actively managed
This is where returns are generated. On an ongoing basis the Operator:
* **Rebalances**: resizes, closes, and opens positions as opportunities and risks shift, [swapping](caliber/swaps) between tokens through approved routers as needed.
* **Harvests**: claims reward tokens from protocols and realizes them, typically by swapping them into base tokens. See [Harvests](caliber/harvests).
* **Moves liquidity across chains**: bridges capital between the Hub and Spokes to chase the best opportunities.
Every one of these actions is bounded: pre-approved instructions only, swaps only into approved base tokens, per-action **loss caps** and **cooldowns**, and bridging only over approved routes within a max-loss limit. These bounds are what let an Operator be flexible *without* being trusted with unilateral control. See [Operator](../governance/operator) for the full list of restrictions.
## 5. Account: value is measured and fees are taken
For the share price to be correct, the protocol must continuously know what every position is worth.
```mermaid
flowchart TB
subgraph Spoke["Spoke Chains"]
SC["Spoke Caliber
values its positions"]:::core
end
subgraph Hub["Hub Chain"]
HC["Hub Caliber
values its positions"]:::core
M["Machine"]:::core
end
SC -- "Chainlink CRE
(accounting snapshot)" --> M
HC -- "direct call" --> M
M -- "idle + hub + spokes
+ in-flight bridges" --> AUM["Total AUM"]:::out
AUM --> SP["Share Price = AUM ÷ Shares"]:::out
classDef core fill:#1f6feb,stroke:#1f6feb,color:#fff;
classDef out fill:#238636,stroke:#238636,color:#fff;
```
* Each Caliber values its [positions](caliber/positions) and base-token balances in the accounting token. Position values must be kept fresh: stale positions cause accounting to fail, so they are re-accounted regularly, by anyone when accounting is open or by the Operator and designated agents when the strategy restricts it (a common configuration). See [Caliber Accounting](caliber/caliber-accounting).
* Spoke Caliber values are carried to the Machine through [Chainlink CRE](cross-chain/cross-chain-accounting), which relays each spoke's accounting snapshot to the Hub.
* The Machine sums **idle balance + Hub Caliber + all Spoke Calibers + in-flight bridge transfers** into total AUM, then derives the [share price](machine/share-price). In-flight bridges are counted so that value is never "lost" while crossing chains.
* When AUM is updated, [fees](machine/fees) are minted as new shares and distributed to the Operator, the protocol, and the [Security Module](../security/security-module), subject to per-strategy rate caps and a minimum interval.
Because fees only crystallize on a complete accounting cycle, the Operator is incentivized to keep valuations accurate and up to date.
## 6. Redeem: capital exits
Positions are generally not instantly liquid, so Makina does not promise atomic withdrawals. Instead, redemption is a **queue**:
```mermaid
sequenceDiagram
actor User
participant R as Redeemer (queue)
actor O as Operator
participant M as Machine
User->>R: requestRedeem(shares)
R-->>User: NFT
Note over O: frees up liquidity
(closes positions, bridges back)
O->>R: finalize requests (FIFO)
R->>M: redeem shares → accounting token
M-->>R: assets
User->>R: claim(NFT)
R-->>User: assets
```
1. The user locks their shares in the [Redeemer](machine/redemptions) and receives an NFT representing the request.
2. The Operator frees up the required accounting token (closing positions and bridging liquidity back to the Hub if needed) and settles requests in first-in-first-out order. The shares are burned and the corresponding assets are reserved.
3. The user claims their assets by surrendering the NFT, at any time after settlement.
This asynchronous design is what lets a strategy stay fully invested while still honoring exits in an orderly, fair sequence. See [Redemptions](machine/redemptions).
:::note[Example implementation]
The FIFO, NFT-based queue shown here is the **[AsyncRedeemer](/contracts/periphery/redeemers/contract.AsyncRedeemer)**, one common redeemer implementation. The Redeemer is a swappable [periphery](overview#core-vs-periphery) contract: some deployed strategies use the AsyncRedeemer, while others run custom logic built for a particular integrator's needs. What is fundamental is that the Machine can only pay out from its idle balance. A Redeemer could settle atomically when that idle balance is sufficient, but because most of the capital is usually deployed, redemptions are generally handled asynchronously.
:::
## When something goes wrong
If the Operator misbehaves, goes inactive, or the share price moves abnormally, the [Security Council](../governance/security-council) can trigger [Recovery Mode](../security/recovery-mode). The Operator's powers transfer to the Council, new deposits stop, and the strategy is restricted to *unwinding only*: positions can be reduced, swaps can only move toward the accounting token, and bridging can only bring funds home. If a genuine shortfall occurs, the [Security Module](../security/security-module) can be slashed to cover losses for share holders.
:::tip[Next]
You now have the full arc. Dive into any component: [Machine](machine/overview), [Caliber](caliber/overview), [Cross-Chain](cross-chain/hub-and-spoke), or [Roles & Governance](../governance/overview).
:::
# Machine
The **Machine** is a strategy's vault and accounting layer, the main touch point for users and the contract that ties the whole strategy together. There is exactly one Machine per strategy, and it always lives on the [Hub Chain](../cross-chain/hub-and-spoke).
The Machine has four jobs:
* **Custody the strategy's reserves and issue shares.** It holds idle capital, mints the [machine token](machine-token) to depositors, and burns it on redemption.
* **Account for the whole strategy.** It aggregates the value of its idle balance, the Hub [Caliber](../caliber/overview), and every Spoke Caliber into a single total AUM, and derives the [share price](share-price) from it.
* **Charge fees.** When AUM is updated, it mints and distributes [fees](fees) according to its [Fee Manager](fees).
* **Coordinate cross-chain liquidity.** It is the hub endpoint for [bridging](../cross-chain/liquidity-bridging) capital to and from Spoke Calibers.
## The accounting token
Each Machine defines a single **accounting token**, for example USDC, WETH, or WBTC. This token is special in several ways:
* It is the **only** token users can deposit and the only token they receive on redemption.
* It is the **unit of account**: AUM and share price are denominated in it.
* Every other asset the strategy holds is valued *relative to* the accounting token, through the [Oracle Registry](../pricing-oracles).
You can see the accounting token (and all other contracts) for each live strategy on the [Strategies](../../../strategies/deployments.mdx) page or in the [Makina app](https://makina.finance/explore).
## What a Machine is connected to
```mermaid
flowchart LR
subgraph Periphery["Periphery (swappable per strategy)"]
direction TB
Depositor["Depositor"]:::p
Redeemer["Redeemer"]:::p
FeeManager["Fee Manager"]:::p
SecurityModule["Security Module"]:::p
end
Machine(["Machine"]):::m
subgraph Execution["Execution (one Caliber per chain)"]
direction TB
HubCaliber["Hub Caliber"]:::c
Spokes["Spoke Calibers"]:::c
end
Depositor -->|deposits| Machine
Machine -->|redemptions| Redeemer
Machine ---|fee policy| FeeManager
FeeManager -.->|rewards| SecurityModule
Machine <-->|same chain| HubCaliber
Machine <-.->|cross-chain| Spokes
classDef c fill:#1f6feb,stroke:#1f6feb,color:#fff;
classDef p fill:#8957e5,stroke:#8957e5,color:#fff;
classDef m fill:#238636,stroke:#238636,color:#fff;
```
A Machine is linked to a set of **periphery** contracts, each of which can be a different implementation depending on the strategy's needs (see [Architecture → core vs. periphery](../overview#core-vs-periphery)):
* a [Depositor](deposits), the entry point for deposits;
* a [Redeemer](redemptions), the exit queue for redemptions;
* a [Fee Manager](fees), the fee policy;
* optionally a [Security Module](../../security/security-module), an insurance backstop.
It is also connected to the [Hub Caliber](../caliber/overview) on its own chain and, for multi-chain strategies, to [Spoke Calibers](../cross-chain/hub-and-spoke) on other chains.
## Flexibility
Because deposit rules, redemption flows, and fee models are delegated to swappable periphery contracts, and because asset deployment happens in [Calibers](../caliber/overview) through a generalized [execution engine](../caliber/makina-vm), a single Machine design supports a wide range of strategies, from yield aggregation and fixed income to volatile token indexes and hedged positions.
## Operational state
The Machine, like the Caliber, is *governable*: a set of per-strategy roles ([Operator](../../governance/operator), [Risk Manager](../../governance/risk-manager), [Security Council](../../governance/security-council)) can configure parameters and intervene, each within tightly scoped permissions. It can also be placed into [Recovery Mode](../../security/recovery-mode), an emergency state that disables deposits and restricts the strategy to unwinding. See [Roles & Governance](../../governance/overview).
:::info[Implementation]
Machine contract reference: [`Machine.sol`](/contracts/core/machine/contract.Machine).
:::
# Machine Token (Shares)
The **Machine Token** (also called the **share**) is the ERC-20 token that represents a holder's proportional claim on a strategy. Holding shares is equivalent to holding a slice of everything the strategy controls. As the strategy's [AUM](share-price) grows, the value of each share grows with it.
The machine token is a standard, fully composable ERC-20. It always uses **18 decimals**, regardless of the strategy's [accounting token](overview#the-accounting-token), which keeps share math precise even for low-decimal accounting tokens like USDC. See [`MachineShare.sol`](/contracts/core/machine/contract.MachineShare).
## How shares are acquired
* **By depositing** the accounting token through the strategy's [Depositor](deposits). The Machine mints shares at the current [share price](share-price): `shares = assets / share price`.
* **On secondary markets**, since the token is a normal ERC-20 and can be listed and traded like any other asset.
Shares are burned when a holder [redeems](redemptions) them back into the accounting token.
## Composability
Because the machine token is a plain ERC-20 whose value tracks a professionally managed, diversified strategy, it is useful well beyond simply holding:
* as **collateral** in lending markets;
* as one side of a **liquidity pool** on a DEX;
* held in **treasury** to earn the strategy's risk-adjusted return passively.
## Cross-chain transfer
The machine token is a standard ERC-20, so moving it to another chain relies on external bridging infrastructure such as [Wormhole NTT](https://ntt.wormhole.com/) rather than anything built into the token itself.
:::note
This is a separate, optional transport layer for the machine token. It is independent of the strategy's internal [cross-chain liquidity](../cross-chain/liquidity-bridging) and [accounting](../cross-chain/cross-chain-accounting) machinery, which move the *underlying* capital between the Machine and its Spoke Calibers.
:::
# Share Price & AUM
The **share price** is the value of one [share](machine-token) in [accounting-token](overview#the-accounting-token) terms. It is the single most important number a strategy produces: the Machine mints and redeems shares at it, and it is how holders measure their returns.
$\text{Share Price} = \dfrac{\text{AUM}}{\text{Share Supply}}$
Where **AUM** (assets under management) is the total value of everything the strategy controls. Successful execution by the [Operator](../../governance/operator), through earned yield or appreciation of held assets relative to the accounting token, raises AUM, and because the share supply doesn't change when value accrues, the share price rises. Deposits and redemptions, by contrast, change AUM and supply *proportionally*, so they leave the share price unchanged.
## What goes into AUM
AUM is assembled from four sources:
$\text{AUM} = \text{Idle balance} + \text{Hub Caliber} + \sum \text{Spoke Calibers} + \text{In-flight bridges}$
```mermaid
flowchart LR
Idle["Idle balance
on the Machine"]:::a --> AUM
Hub["Hub Caliber
net AUM"]:::a --> AUM
Spokes["Σ Spoke Caliber
net AUM"]:::a --> AUM
Bridge["In-flight
bridge transfers"]:::a --> AUM["Total AUM"]:::o
AUM --> SP["÷ Share Supply
= Share Price"]:::o
classDef a fill:#1f6feb,stroke:#1f6feb,color:#fff;
classDef o fill:#238636,stroke:#238636,color:#fff;
```
* **Idle balance**: the accounting token and any other priceable tokens sitting on the Machine itself (recent deposits not yet deployed, capital just bridged back, or a deliberate buffer kept for redemptions). Each is priced via the [Oracle Registry](../pricing-oracles).
* **Hub Caliber**: the [net AUM](../caliber/caliber-accounting) of the Caliber on the Hub Chain, read directly.
* **Spoke Calibers**: the net AUM of each enabled Caliber on other chains, carried to the Machine through the [Cross-Chain Accounting](../cross-chain/cross-chain-accounting) flow.
* **In-flight bridges**: capital that has left one chain but not yet arrived on the other. Bridging can take time, so the protocol explicitly tracks value *in transit* and counts it, ensuring no value appears to vanish mid-transfer. See [Liquidity Bridging](../cross-chain/liquidity-bridging).
A Caliber's "net" AUM already nets out [debt positions](../caliber/positions#debt-positions), so leveraged strategies are valued correctly.
## Keeping AUM fresh
AUM is not recomputed on every block. It is updated on demand, in a single operation that re-reads every source and then mints any due [fees](fees). The update can be set either permissionless, or restricted to the [Operator](../../governance/operator) and designated accounting agents (see [restricted accounting mode](../../governance/permissions-and-scopes#restricted-accounting-mode)). For the update to succeed, the inputs must be **fresh**.
Freshness is not a fixed value. It is measured against two configurable staleness thresholds:
* **Position staleness** (per-Caliber `positionStaleThreshold`). Every position records the time it was last accounted. A position is considered stale once the elapsed time since that accounting reaches the threshold, so all of a Caliber's positions must have been refreshed within that window for the Caliber's value to count.
* **Caliber staleness** (per-Machine `caliberStaleThreshold`). Spoke Caliber data arrives through [Cross-Chain Accounting](../cross-chain/cross-chain-accounting) carrying the timestamp of the chain it was read on. That data is stale once the elapsed time since its timestamp reaches the threshold. An incoming snapshot must also be strictly newer than the one already stored, so an older snapshot can never overwrite a more recent one. A spoke that has been [disabled](../cross-chain/cross-chain-accounting#disabling-a-spoke) is skipped entirely.
If any input is stale, the update reverts rather than producing a wrong price. An update is also rejected if it would move the share price faster than a governance-set **maximum change rate** over the elapsed time, a guard against a sudden, suspicious jump. (The [Security Council](../../governance/security-council) can update AUM bypassing that guard when legitimately needed.)
## Inflation protection
To prevent the classic "first depositor" share-inflation attack on empty or near-empty vaults, share-price and conversion math use **virtual offsets** (a virtual share supply and a virtual unit of AUM) rather than dividing by raw zero-or-tiny values. In normal operation, with a meaningful supply and AUM, this has no observable effect on the price. It simply makes the math safe at the boundaries.
:::info[Implementation]
See [`Machine.sol`](/contracts/core/machine/contract.Machine) and the [`MachineUtils`](/contracts/core/libraries/library.MachineUtils) library.
:::
# Deposits
Users never call the [Machine](overview) directly. Instead, each Machine is linked to a dedicated **Depositor** contract (the strategy's official entry point), and the Machine accepts deposits *only* from that contract. Routing deposits through a swappable periphery contract lets different strategies impose different deposit rules (for example, compliance gating) without changing the Machine itself.
```mermaid
sequenceDiagram
actor User
participant D as Depositor
participant M as Machine
User->>D: deposit(assets, minShares)
Note over D: sanctions and whitelist checks (if enabled)
D->>M: forward accounting token
M->>M: shares = assets ÷ share price
M-->>User: mint shares (≥ minShares, else revert)
```
A deposit is **atomic**: assets in, shares out, in a single transaction at the current [share price](share-price). The `minShares` parameter is a slippage guard: the call reverts if the share price moved unfavorably and the user would receive fewer shares than they accepted.
## Direct Depositor
The standard implementation, [`DirectDepositor`](/contracts/periphery/depositors/contract.DirectDepositor), does exactly the flow above: it pulls the accounting token from the user, forwards it to the Machine, and the Machine mints shares to the user immediately.
### Whitelisting
The DirectDepositor supports an optional **whitelist**. When enabled, only approved addresses may deposit, the mechanism strategies use to restrict participation to, e.g., KYC-verified users. When disabled, deposits are open to anyone. The whitelist is toggled and managed by the [Risk Manager](../../governance/risk-manager). The same whitelist primitive gates [redemptions](redemptions#whitelisting) and the [Pre-Deposit Vault](pre-deposit).
### Sanctions screening
Independently of the whitelist, the DirectDepositor can screen the caller of every deposit against the [Chainalysis sanctions oracle](https://go.chainalysis.com/chainalysis-oracle-docs.html) and reject sanctioned addresses. The check is optional and toggled by the [Risk Manager](../../governance/risk-manager). It is complementary to whitelisting: a strategy can enable either, both, or neither. The same screening is available on the [AsyncRedeemer](redemptions#whitelisting).
## Deposit limits
A Machine can enforce a **share supply cap** set by the [Risk Manager](../../governance/risk-manager): once the total share supply reaches the cap, further deposits are rejected. This lets a strategy control its size, which is useful when capacity for good opportunities is limited.
# Redemptions
To exit a strategy, a holder redeems [shares](machine-token) back into the [accounting token](overview#the-accounting-token). As with deposits, users never call the [Machine](overview) directly. Each Machine is linked to a dedicated **Redeemer** contract, and the Machine accepts redemptions only from it.
## Why redemptions are asynchronous
Most of a strategy's capital is deployed into [positions](../caliber/positions) that are not instantly liquid, and some of it may be on other chains. The Machine can only pay out from its **idle accounting-token balance**, which is usually a small buffer. A strategy therefore cannot promise instant, atomic withdrawals.
Redeemers are instead **queues**: the [Operator](../../governance/operator) must free up liquidity (closing positions and [bridging](../cross-chain/liquidity-bridging) funds back to the Hub) before redemption requests can be settled. This is a normal, expected part of running a strategy.
## Async Redeemer
The standard implementation, [`AsyncRedeemer`](/contracts/periphery/redeemers/contract.AsyncRedeemer), is a first-in-first-out queue built around an **ERC-721 receipt NFT**.
```mermaid
sequenceDiagram
actor User
participant R as Async Redeemer
participant O as Operator
participant M as Machine
User->>R: requestRedeem(shares)
R-->>User: mint request NFT (shares locked)
Note over O: closes positions,
bridges liquidity home
O->>R: finalize requests (FIFO, after delay)
R->>M: redeem locked shares
M-->>R: accounting token
User->>R: claim(NFT)
R-->>User: accounting token
```
1. **Request.** The user locks their shares in the queue and receives an NFT representing the request. A minimum request size may apply.
2. **Finalize.** After a minimum **finalization delay**, the Operator settles requests in order, up to a chosen point in the queue. The queue redeems the locked shares against the Machine: the shares are burned and the corresponding accounting token is pulled into the queue and reserved for the claimants. Each request is settled at no more than the value quoted when it was made.
3. **Claim.** The NFT holder surrenders the NFT to receive their accounting token. There is no deadline to claim once a request is finalized.
The NFT representation means a pending redemption is itself transferable.
### Redemption fees
A variant, [`AsyncRedeemerFee`](/contracts/periphery/redeemers/contract.AsyncRedeemerFee), applies a **redemption fee**: the assets a user receives are reduced by a configured rate. The withheld value remains in the strategy, accruing to the remaining share holders rather than going to a separate recipient. This can discourage churn or compensate the strategy for the cost of unwinding positions to honor exits.
### Whitelisting
Like the [DirectDepositor](deposits#whitelisting), the AsyncRedeemer supports an optional whitelist gating both *requesting* a redemption and *claiming* assets, used by strategies that restrict participation to approved addresses. It also supports the same optional [sanctions screening](deposits#sanctions-screening) as the DirectDepositor, applied to both requesting and claiming.
:::note
Settlement timing depends on the Operator freeing liquidity, and Makina does not force or guarantee a settlement schedule. The finalization delay and FIFO ordering ensure requests are handled fairly and in sequence.
:::
# Pre-Deposit
A strategy is more effective when it launches with capital already in hand: it can start diversified and allocate efficiently from day one rather than scaling up from zero. **Pre-deposits** let a strategy gather that baseline liquidity *before* its [Machine](overview) goes live.
The [`PreDepositVault`](/contracts/core/pre-deposit/contract.PreDepositVault) is a temporary vault that accepts a single **pre-deposit asset**, typically a yield-bearing token that:
* is **priceable** against the strategy's [accounting token](overview#the-accounting-token) through the [Oracle Registry](../pricing-oracles), and
* will later be enabled as a [base token](../caliber/base-tokens) of the strategy.
Depositors earn the pre-deposit asset's native yield during this phase: as the asset accrues value, the vault's share price rises with it.
## Seamless transition into the Machine
The key design choice is that the Pre-Deposit Vault mints the **shares of the future Machine**: the very same machine token the live strategy will use. This makes the launch transition trivial:
```mermaid
flowchart LR
subgraph Before["Pre-deposit phase"]
U1([Users]) -->|deposit asset| PDV["PreDepositVault
(mints future shares)"]:::p
end
subgraph After["At launch"]
PDV2["PreDepositVault"]:::p -->|transfer assets +
minting authority| M["Machine"]:::m
end
Before --> After
classDef p fill:#8957e5,stroke:#8957e5,color:#fff;
classDef m fill:#238636,stroke:#238636,color:#fff;
```
When the Machine is deployed, **no user balances need to be migrated**. The vault simply hands the accumulated assets to the Machine and transfers the machine token's minting authority to it. Holders keep the exact shares they already had, now backed by the live strategy. After migration the vault is closed to further deposits and redemptions.
Like the [Depositor](deposits#whitelisting), the Pre-Deposit Vault supports an optional whitelist and a share-supply cap, managed by the [Risk Manager](../../governance/risk-manager).

# Fees
Fees are how a strategy compensates the people who run and secure it: the [Operator](../../governance/operator), the Makina DAO, and the [Security Module](../../security/security-module) stakers. Each Machine delegates its fee policy to a swappable **Fee Manager** contract, so different strategies can use different fee models.
## How fees are charged: share dilution
Makina does not skim the accounting token. Instead, fees are charged by **minting new shares**:
* When [AUM is updated](share-price#keeping-aum-fresh), the Machine asks its Fee Manager how many shares are owed, mints them, and distributes them to the fee recipients.
* New shares without new AUM dilute the share price slightly, so the cost is **socialized across all share holders** in proportion to their holdings.
Fees are minted **atomically with each AUM update**, and only once a minimum interval (the *fee mint cooldown*) has elapsed since the last minting. The Machine also caps how fast fees can accrue, via governance-set **maximum fixed-fee and performance-fee accrual rates**, a backstop against a misconfigured or malicious fee manager.
## Two kinds of fee
* **Fixed fee**: accrues with time and strategy size, independent of performance. It is the equivalent of a management fee.
* **Performance fee**: accrues only when the strategy creates value, measured against a high-water mark.
## Watermark Fee Manager
The standard implementation is the [`WatermarkFeeManager`](/contracts/periphery/fee-managers/contract.WatermarkFeeManager).
### Fixed fee
The fixed fee grows with the share supply and the time elapsed since the last minting:
$\text{FixedFee} \approx \text{ShareSupply} \times \text{rate}_{\text{per second}} \times \Delta t$
It is split into two purposes: a **management** portion (supporting the Operator and the DAO) and a **Security Module** portion (rewarding [stakers](../../security/security-module) who provide the insurance backstop). If the strategy has a Security Module, its portion is carved out first and sent to it directly, and the remaining management portion is then divided among its recipients.
*Example: at a 2% annualized fixed rate, a 1,000,000-share supply accrues ≈ 54.8 shares per day.*
### Performance fee
The performance fee uses a **high-water mark**: it is charged only when the share price rises above the highest price previously recorded. This ensures holders are never charged twice for the same gains: if the price falls and recovers, no performance fee is taken until it exceeds the prior peak.
$\text{PerfFee} \approx \text{ShareSupply} \times \dfrac{\text{newPrice} - \text{watermark}}{\text{newPrice}} \times \text{rate}_{\text{perf}}$
After the fee is computed, the watermark is raised to the new price.
*Example: at a 10% performance rate, a 1,000,000-share supply whose price rises from 1.00 to 1.01 accrues ≈ 990 shares.*
### Configurable splits
Both the management fee and the performance fee are distributed to one or more recipients according to **configurable basis-point splits** (each set summing to 100%). This is how the protocol divides revenue between the Operator and the DAO, and it can be tuned per strategy by the fee-configuration role. The Security Module's cut, when present, is taken from the fixed fee before the management split.
:::info[Implementation]
Fee manager interface: [`IFeeManager`](/contracts/core/interfaces/interface.IFeeManager). Standard implementation: [`WatermarkFeeManager`](/contracts/periphery/fee-managers/contract.WatermarkFeeManager).
:::
# Caliber
A **Caliber** is a strategy's chain-local execution engine, the contract from which capital is actually deployed into external protocols. Where the [Machine](../machine/overview) is the vault and the accountant, the Caliber is the operator's workbench.
A strategy has **one Caliber per chain** it operates on. The Caliber on the [Hub Chain](../cross-chain/hub-and-spoke) sits beside the Machine, and additional Calibers on Spoke Chains extend the strategy elsewhere. Every transaction the [Operator](../../governance/operator) executes against an external protocol is sent *by* a Caliber, which is the on-chain identity that holds positions and interacts with DeFi.
## What a Caliber does
* Executes [Instructions](makina-vm) on its embedded [MakinaVM](makina-vm) to open, resize, and close [positions](positions) in external protocols.
* Holds and manages [base tokens](base-tokens): the priceable assets positions are built from.
* [Swaps](swaps) tokens through approved routers, [harvests](harvests) external rewards, and can take [flash loans](flash-loans) for temporary liquidity.
* Independently [accounts](caliber-accounting) for everything it holds, in accounting-token terms.
* On Spoke Chains, sends and receives capital to and from the Machine through its [Caliber Mailbox](../cross-chain/caliber-mailbox) using Makina's [cross-chain liquidity](../cross-chain/liquidity-bridging) infrastructure.
## Accounting token and base tokens
A Caliber works with a curated set of **[base tokens](base-tokens)**: the only tokens it may hold directly. Each base token must be **priceable** against the accounting token through the [Oracle Registry](../pricing-oracles), which is what lets the Caliber value everything it holds. Positions can only be built from, and unwound into, base tokens, and swaps can only produce base tokens. This guarantees every asset the Caliber touches can be valued, and therefore that loss checks and accounting always work.
The **accounting token** is a special base token: the unit the [Machine](../machine/overview) uses (or an asset 1:1 redeemable for it), in which the Caliber denominates all value. It is registered as a base token automatically and can never be removed.
## Bounded by design
A Caliber gives the Operator enormous reach (almost any protocol can be integrated), but every action is constrained:
* only [pre-approved instructions](makina-vm) may run;
* swaps may only output approved base tokens;
* each position-management action and swap is subject to a **loss cap** and a **cooldown**;
* in [Recovery Mode](../../security/recovery-mode), positions may only be reduced and swaps may only move toward the accounting token.
These guardrails are what make discretionary, cross-protocol management safe. The rest of this section covers each capability in turn.
:::info[Implementation]
Caliber contract reference: [`Caliber.sol`](/contracts/core/caliber/contract.Caliber).
:::
# MakinaVM & Instructions
The **MakinaVM** is Makina's central innovation and the reason a Caliber can be both flexible and safe.
Integrating a vault with an external protocol traditionally means writing, auditing, and deploying a custom adapter contract for each integration: slow, expensive, and a fresh attack surface every time. The MakinaVM replaces that model with a **scope-limited, generalized execution engine**: a single on-chain interpreter that can call almost any protocol, but only through actions that governance has reviewed and committed in advance.
## Instructions
The unit of action is an **Instruction**: a pre-approved, parameterized sequence of contract calls the Operator is allowed to execute. Instructions define and constrain exactly what the Operator can do in a given strategy. Adding a new integration means authoring its Instructions and committing them once, not deploying new code.
### Built on Weiroll
Instructions are expressed in [Enso Weiroll](https://github.com/EnsoBuild/enso-weiroll), an extended version of the [Weiroll](https://github.com/weiroll/weiroll) command-chaining framework. Weiroll enables **stateful multicalls**: a list of commands where the output of one call can be fed as input to the next. For instance, a single Instruction could chain together an approval, a deposit, and a balance read (across multiple protocols) into one atomic, composable operation. That is a simple case, and Instructions can encode far more elaborate sequences.
A Weiroll instruction has two parts:
* **commands**: the encoded sequence of calls (each fixing a target address, function selector, and how arguments and outputs are wired between steps);
* **state**: the array of values (token addresses, amounts, recipients, …) the commands read from and write to.
### Merkle-tree permissioning
The MakinaVM restricts *which* instructions can run using a **Merkle tree**. Every allowed instruction is hashed into a leaf, and only the tree's **root** is stored on-chain in the Caliber.
```mermaid
flowchart TB
subgraph Tree["Allowed instruction set (off-chain, public)"]
L1["Instr A → leaf"]:::l
L2["Instr B → leaf"]:::l
L3["Instr C → leaf"]:::l
L4["Instr D → leaf"]:::l
L1 & L2 --> H1["hash"]:::h
L3 & L4 --> H2["hash"]:::h
H1 & H2 --> Root["Merkle Root"]:::r
end
Root -->|only the root is stored| Caliber["Caliber storage"]:::c
Op([Operator]) -->|instruction + Merkle proof| Caliber
Caliber -->|recompute leaf, verify proof against root| Exec{"matches?"}:::h
Exec -->|yes| Run["execute via Weiroll"]:::r
Exec -->|no| Revert["revert"]:::x
classDef l fill:#30363d,stroke:#6e7681,color:#fff;
classDef h fill:#444c56,stroke:#6e7681,color:#fff;
classDef r fill:#238636,stroke:#238636,color:#fff;
classDef c fill:#1f6feb,stroke:#1f6feb,color:#fff;
classDef x fill:#da3633,stroke:#da3633,color:#fff;
```
To execute, the Operator submits the instruction plus a **Merkle proof**. The Caliber recomputes the leaf and checks it against the stored root. If it doesn't match, the call reverts. This design is:
* **Minimal on-chain**: only one 32-byte root is stored no matter how many instructions are allowed.
* **Cheap to update**: adding or removing instructions is a single root update.
* **Scalable**: proof size grows only logarithmically with the number of instructions.
* **Transparent**: anyone can rebuild the tree from the public instruction set and verify the on-chain root.
#### Fine-grained, down to the argument
A leaf hashes the instruction's full shape: its commands, its type, the target position, the affected tokens, and a **bitmap that marks which state values are fixed**. Values flagged as fixed (e.g. the protocol address or recipient) must match the approved instruction exactly, while values left unflagged (e.g. a token *amount*) are free to vary at execution time. This is what lets one approved instruction handle deposits of *any size* while still pinning down *where* and *how* the funds may go.
### The four instruction types
Instructions are categorized by role:
| Type | Purpose |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Accounting** | Reads and reports a position's current value, in base-token amounts. It is not intended to move funds, only to measure them. |
| **Management** | Changes a position's size (open, increase, decrease, close). Always paired with an Accounting instruction so the Caliber can measure the position before and after and apply a [loss check](positions#loss-checks). |
| **Harvest** | Claims external rewards into the Caliber. Receive-only, and cannot spend the Caliber's existing holdings. See [Harvests](harvests). |
| **Flashloan-Management** | A Management step executed *inside* a flash loan, nested within an outer Management instruction and only valid in that scope. See [Flash Loans](flash-loans). |
## Integrating a new protocol
```mermaid
flowchart LR
A["Author deploy /
close / account
instructions"] --> B["Review by Risk Team
+ Security Council"]
B --> C["Risk Manager schedules
root update (timelock)"]
C --> D["Guardians may veto
during timelock"]
D --> E["Root takes effect:
instructions executable"]
classDef s fill:#1f6feb,stroke:#1f6feb,color:#fff;
class A,B,C,D,E s;
```
Integrating a protocol requires only authoring its instructions and committing the new Merkle root through governance. There is no new contract to deploy. Updates pass through a **timelock** during which they can be vetoed, giving users time to react. Over time a shared, reusable library of instructions grows, and protocols seeking capital are expected to contribute their own, a model of self-integration.
The full update and veto process is described in [Root Update Lifecycle](../../governance/root-update-lifecycle).
:::info[Instruction sets]
The instruction sets live in the public [`makina-integrations`](https://github.com/MakinaHQ/makina-integrations) repository, where anyone can review them and contributors add new integrations.
:::
:::info[Implementation]
The instruction structures and verification live in [`Caliber.sol`](/contracts/core/caliber/contract.Caliber) and [`ICaliber`](/contracts/core/interfaces/interface.ICaliber). The Weiroll VM interface is [`IWeirollVM`](/contracts/core/interfaces/interface.IWeirollVM).
:::
# Base Tokens
**Base Tokens** are the curated set of ERC-20 tokens a [Caliber](overview) is allowed to hold directly. They are the raw materials of a strategy: positions are built by spending base tokens and unwound back into them, and swaps can only output base tokens.
## Pricing and valuation
Every base token must be **priceable against the [accounting token](overview#accounting-token-and-base-tokens)** through the [Oracle Registry](../pricing-oracles). A token cannot be registered as a base token without a valid pricing path. Its value is then read directly, by pricing the Caliber's balance against the accounting token, with no instruction required.
This pricing guarantee is the linchpin of the Caliber's safety model. Because every token the Caliber can hold is priceable, it can always value its entire balance, which is what makes [accounting](caliber-accounting) and the [loss checks](positions#loss-checks) on positions and swaps possible.
## Curation
Base tokens are added and removed by the [Risk Manager](../../governance/risk-manager) (through the timelocked path). A token can only be removed when the Caliber's balance of it is zero. In practice base tokens should be **liquid against the accounting token and relatively low risk**, since they are the assets the strategy parks value in between deployments. Some base tokens are bridged in from another chain, while others are obtained by swapping locally.
# Positions
A **Position** is a deployment of capital from a [Caliber](overview) into an external protocol: a supply on a lending market, an LP position on a DEX, a deposit into a yield vault, a borrow, and so on. Positions are how a strategy actually earns its return.
Each position has a unique **position ID** and is registered in the Caliber. A Caliber can hold many positions, across multiple protocols or several on the same protocol. Internally a position tracks its **current value** (in accounting-token terms), the **time it was last accounted**, and whether it is a **debt**.
## Opening, resizing, and closing
Positions are changed exclusively through **Management Instructions** (see [MakinaVM](makina-vm#the-four-instruction-types)) executed by the [Operator](../../governance/operator):
* a position is **opened or increased** by spending [base tokens](base-tokens),
* and **decreased or closed** by recovering base tokens.
Every Management instruction is paired with an **Accounting Instruction** that reports the position's value in base-token amounts. Because both the inputs/outputs (base tokens) and the position value are denominated in priceable assets, the Caliber can always express a position in accounting-token terms, which is what makes generalized loss checks possible.
## Loss checks
Whenever a position is managed, the Caliber measures the value of the affected base tokens **before and after** the operation, alongside the change in the position's accounted value, and verifies the move stays within a configured **maximum loss** tolerance (in basis points). Separate caps apply to position *increases* and *decreases*. If an operation would leak more value than allowed (for example, an interaction that returns far less than it should), it reverts. This bounds how much value the Operator can lose in any single action, whether through error, a bad route, or malice.
## Cooldowns
Position management is rate-limited by a **cooldown**. Repeating the *same* management action (the same position with the same command sequence and direction) before the cooldown has elapsed reverts. Combined with the per-action loss cap, the cooldown limits how much damage can be done over a short window, buying time for the [Security Council](../../governance/security-council) to react to anomalous behavior.
## Risk caps and exclusivity
Positions carry risk attributes defined in the strategy's risk policy, so the [Risk Manager](../../governance/risk-manager) can cap how large an individual position (or a group of related positions) may grow. Positions must also be **mutually exclusive** in the liquidity they account for: two positions cannot have accounting instructions that measure the same underlying liquidity, which prevents double-counting value.
## Debt positions
A position can also represent a **debt** (e.g. a borrow against collateral on a lending market). Debt positions are flagged as such and counted **negatively**: they are subtracted from the Caliber's total when computing [net AUM](caliber-accounting) and when evaluating risk-policy exposure. This lets a strategy express leverage and hedges correctly: the [share price](../machine/share-price) reflects assets *minus* liabilities. In every other respect a debt position behaves like a normal one.
# Swaps
A [Caliber](overview) frequently needs to convert one token into another: to assemble the [base tokens](base-tokens) a position requires, to realize [harvested](harvests) rewards, or to consolidate holdings. It does this through the **Swap Module**, a shared piece of [infrastructure](../pricing-oracles) that routes swaps through approved external routers and aggregators.
## What can be swapped, and into what
* The **output** of a swap must be a registered [base token](base-tokens) (the accounting token is one). The Caliber will not accept arbitrary tokens as the result of a swap, which is what keeps its holdings priceable.
* The **input** can be almost any token the Caliber holds: base tokens, or unregistered tokens such as reward, incentive, or airdrop tokens. The only exception is tokens that are part of an open position (those must be unwound through [position management](positions), not sold out from under the accounting).
Swapping an *unregistered* token into a base token can only **increase** the Caliber's measurable AUM, since the input wasn't being counted in the first place.
## Routing and slippage
The Swap Module forwards execution to a router selected by a `swapperId`, using calldata supplied by the Operator (typically generated off-chain by an aggregator). Makina does not need to understand the route, only to verify the outcome. Two layers of protection apply:
* a **minimum output amount** enforced by the Swap Module, and
* an independent **value-loss check** by the Caliber, which compares the accounting-token value held before and after the swap and reverts if the loss exceeds the configured tolerance.
This lets the Operator use any atomically executed route while guaranteeing the strategy can't be drained through a bad or malicious swap.
## Cooldowns
Like position management, swapping **base tokens** is subject to a **cooldown**: a base-token swap cannot be followed by another until the cooldown elapses. (Swaps whose input is *not* a base token, such as realizing a reward token, are not cooldown-limited.)
## Direct protocol swaps
Operations like mint/redeem or wrap/unwrap (e.g. converting a token to its yield-bearing wrapper) can also be performed through the Swap Module by registering the relevant contract as a router. This brings asset conversions that aren't classic DEX trades under the same approved-router-and-loss-check safety model.
## In Recovery Mode
During [Recovery Mode](../../security/recovery-mode), swaps are restricted to producing **only the accounting token**: the strategy can consolidate toward its safest asset but cannot rotate between base tokens.
:::info[Implementation]
Swap Module reference: [`SwapModule.sol`](/contracts/core/swap/contract.SwapModule).
:::
# Harvests
Many [positions](positions) earn **reward tokens**: emissions, incentives, or fees distributed by the underlying protocol through claim contracts. A [Caliber](overview) collects these with **Harvest Instructions** (see [MakinaVM](makina-vm#the-four-instruction-types)), which claim rewards and pull them onto the Caliber's balance. A Harvest instruction is receive-only: it can bring rewards *in*, but cannot spend the Caliber's existing holdings.
## Realizing harvested value
Claiming a reward token does **not** by itself increase the Caliber's [AUM](caliber-accounting). Only [base tokens](base-tokens) (which are priceable through the [Oracle Registry](../pricing-oracles)) count toward AUM, and a freshly claimed reward token usually isn't one. To turn rewards into measurable value, they must either be:
* **swapped** into a base token, or
* **registered** as a base token, provided an oracle price feed route is registered for them.
To make this efficient, harvested rewards can be **swapped immediately** within the same harvest call by attaching swap orders, claiming and realizing in one atomic operation.
## Why prompt harvesting matters
There is an incentive to harvest and realize rewards **frequently**. If unrealized rewards pile up, a gap opens between the strategy's *theoretical* value and its *accounted* AUM. Such gaps create free-riding opportunities (depositors and redeemers transacting at a stale price that doesn't yet reflect pending rewards), which ultimately degrades the strategy's performance, and therefore the [Operator's](../../governance/operator) [fees](../machine/fees). Keeping harvested value current keeps the [share price](../machine/share-price) honest for everyone.
# Flash Loans
Some position-management operations need more liquidity, momentarily, than the [Caliber](overview) holds: opening a leveraged or looped lending position, unwinding such a position in one shot, or rebalancing across a DEX pool. A **flash loan** supplies that temporary liquidity within a single transaction.
## How it fits the instruction model
A flash loan wraps a [Management instruction](makina-vm#the-four-instruction-types):
```mermaid
sequenceDiagram
participant C as Caliber
participant F as Flashloan Module
participant P as External protocol
C->>F: request flash loan (within a manage call)
F-->>C: borrowed liquidity
C->>P: execute Flashloan-Management instruction
C->>F: repay loan (+ fee)
Note over C: loss check applied to the
whole operation
```
The borrowed funds are made available before the inner instruction runs and must be repaid by the end of it. The inner step is a dedicated **Flashloan-Management** instruction type, which is only valid *inside* an outer Management instruction, and cannot be executed on its own.
The Caliber reaches flash-loan providers through an external **Flashloan Module** that adapts the differing callback interfaces of various lending protocols into one consistent entry point.
## Same guardrails apply
A flash loan doesn't bypass any of the Caliber's safety properties. The inner instruction must still match the approved [Merkle root](makina-vm#merkle-tree-permissioning), and the [loss check](positions#loss-checks) is applied to the operation as a whole, so the temporary liquidity cannot be used to move value outside the configured tolerance.
:::info[Implementation]
The flash-loan aggregation logic lives in the periphery [`FlashloanAggregator`](/contracts/periphery/flashloans/contract.FlashloanAggregator).
:::
# Caliber Accounting
Each [Caliber](overview) independently computes the value of everything it holds, denominated in the [accounting token](overview#accounting-token-and-base-tokens). This per-Caliber value is the building block the [Machine](../machine/overview) sums into the strategy's total [AUM](../machine/share-price) and, ultimately, the share price.
## What a Caliber's AUM contains
$\text{net AUM} = \big(\text{base-token balances} + \text{asset positions}\big) - \text{debt positions}$
* **Base-token balances** are valued directly: the Caliber reads each balance and prices it against the accounting token via the [Oracle Registry](../pricing-oracles). No instruction needed.
* **Positions** contribute their last accounted value ([asset positions](positions) add, [debt positions](positions#debt-positions) subtract), yielding a *net* figure that correctly reflects leverage and hedges.
## Freshness: positions must not be stale
A position's value is only meaningful if it's recent. Each position records when it was last accounted, and the Caliber enforces a **staleness threshold**: if any position is too old, an attempt to read the Caliber's AUM **fails** rather than returning a stale number. This is a deliberate safety property: a wrong AUM would corrupt the share price.
Positions are re-accounted:
* **automatically** every time they are managed, and
* **on demand**, by running the relevant [Accounting Instruction](makina-vm#the-four-instruction-types).
## Who can re-account
Whether re-accounting is **permissionless** or **restricted** is a configurable per-strategy setting. When permissionless, anyone can re-account a position. When **restricted accounting mode** is enabled, both position accounting and the Machine's [AUM update](../machine/share-price) are limited to the [Operator](../../governance/operator) and a set of designated accounting agents. Restricted mode is commonly used in practice. During [Recovery Mode](../../security/recovery-mode) the AUM update is restricted further, to the [Security Council](../../governance/security-council). See [Permissions & Scopes](../../governance/permissions-and-scopes#restricted-accounting-mode).
Whoever is allowed to do it, the [Operator](../../governance/operator) and the Makina DAO both have a direct incentive to keep values current: [fees](../machine/fees) only crystallize on a complete accounting cycle, and a stale Caliber blocks the Machine's AUM update entirely. In practice the Operator (or a keeper) re-accounts positions continuously.
## Feeding the Machine
The Caliber exposes its accounting as a **public view function**. On the Hub Chain the Machine reads it directly. On Spoke Chains the same data is read by a [Chainlink CRE](https://docs.chain.link/cre) workflow and delivered to the Machine as an accounting snapshot. See [Cross-Chain Accounting](../cross-chain/cross-chain-accounting).
# Hub-and-Spoke Model
Makina strategies are **cross-chain by design**. A single strategy can hold capital and run positions on many chains at once, while presenting users with one machine token, one share price, and one place to deposit and redeem. The architecture that makes this possible is **hub-and-spoke**.
## The topology
```mermaid
flowchart TB
subgraph Hub["Hub Chain"]
M["Machine
vault, shares, total AUM"]:::m
HC["Hub Caliber"]:::c
end
subgraph S1["Spoke Chain A"]
MB1["Caliber Mailbox"]:::mb
SC1["Spoke Caliber"]:::c
end
subgraph S2["Spoke Chain B"]
MB2["Caliber Mailbox"]:::mb
SC2["Spoke Caliber"]:::c
end
M <--> HC
M <-->|bridging + accounting| MB1 <--> SC1
M <-->|bridging + accounting| MB2 <--> SC2
classDef m fill:#238636,stroke:#238636,color:#fff;
classDef c fill:#1f6feb,stroke:#1f6feb,color:#fff;
classDef mb fill:#8957e5,stroke:#8957e5,color:#fff;
```
* The **Hub Chain** is the single home of the [Machine](../machine/overview). It is where users deposit and redeem, where shares are minted, and where the strategy's total AUM and share price are computed. It also hosts the strategy's **Hub Caliber**.
* Each **Spoke Chain** hosts a [Caliber](../caliber/overview) plus a [Caliber Mailbox](caliber-mailbox). The Caliber executes the strategy locally, and the Mailbox is its connection back to the Machine.
Any supported chain can serve as a hub. A hub together with its spoke chains forms a Makina **instance**, with its own core factory, registries and beacons, and several instances can run side by side. See the [Deployments](/contracts/core/deployments) page for the live instances and the chains they span.
## Why a Mailbox on each spoke
A Spoke Caliber works exactly like the Hub Caliber, except it can't talk to the Machine directly, because the Machine is on another chain. The **Caliber Mailbox** stands in as the Machine's local endpoint: from the Spoke Caliber's point of view, the Mailbox *is* the Machine. It handles the bridging and reporting that connect the Spoke back to the Hub, so the Caliber's logic is identical everywhere. See [Caliber Mailbox](caliber-mailbox).
## Two cross-chain problems to solve
Spanning chains creates two distinct challenges, each with its own mechanism:
1. **Moving value across chains.** Capital must travel between the Hub and the Spokes, and value must never appear lost while it's in transit. This is handled by [Liquidity Bridging](liquidity-bridging), a deliberate, multi-step process over approved bridge adapters, with in-flight transfers explicitly tracked in AUM.
2. **Knowing value across chains.** The Machine must learn what each Spoke Caliber is worth in order to compute total AUM, without trusting a single reporter. This is handled by [Cross-Chain Accounting](cross-chain-accounting), which relies on Chainlink CRE to relay each Spoke's accounting snapshot to the Hub.
The next pages cover each in turn.
## Shared cross-chain infrastructure
Reasoning about "the same token on another chain" requires a shared map, deployed once per chain: the **Token Registry** maps a local token to its equivalent address on each foreign chain. It is what lets bridging and accounting refer unambiguously to assets across the whole deployment.
# Cross-Chain Accounting
For the [share price](../machine/share-price) to be correct, the [Machine](../machine/overview) must know the value of **every** Caliber, including those on other chains. Reading the Hub Caliber is a local call. Reading a Spoke Caliber is the hard part, because it lives on a different chain. Cross-chain accounting is how that value is brought to the Hub **without letting the parties that run the strategy report it themselves**.
## Chainlink Runtime Environment (CRE)
Makina relies on the [Chainlink Runtime Environment (CRE)](https://docs.chain.link/cre), Chainlink's off-chain compute platform, to relay spoke accounting to the Hub:
```mermaid
sequenceDiagram
participant MB as Spoke Caliber Mailbox
participant W as CRE workflow (Chainlink network)
participant F as CRE forwarder (Hub)
participant M as Machine (Hub)
W->>MB: read getSpokeCaliberAccountingData()
MB-->>W: accounting snapshot
W->>F: report (one or more snapshots)
F->>M: onReport(metadata, report)
M->>M: check workflow ID, mailbox, freshness; store
```
1. Each [Caliber Mailbox](caliber-mailbox) exposes a **view function** returning its Caliber's accounting **snapshot**: net AUM, pending bridge amounts in both directions, and the context it was read in (chain ID, mailbox address, block number and timestamp).
2. A CRE **workflow** reads that view on the spoke chain and produces a report. The Chainlink network delivers it on the Hub through the CRE **forwarder** contract.
3. The forwarder calls the Machine, which checks that the report comes from the forwarder and carries an **authorized workflow ID**, that each snapshot targets a registered spoke and its expected Mailbox, and that the snapshot is **fresh**: strictly newer than the one already stored, within the configured staleness threshold, and not dated in the future. Only then is it stored.
Submission is therefore **not** permissionless: only the CRE forwarder, relaying an authorized workflow, can feed spoke data into the Machine. The set of authorized workflow IDs is managed by protocol governance (see [Permissions & Scopes](../../governance/permissions-and-scopes)).
:::info[Security Council fallback]
Should the CRE relaying path become unavailable, the [Security Council](../../governance/security-council) can call the same entry point directly and publish spoke snapshots itself, bypassing the forwarder and workflow checks. The mailbox and freshness checks still apply.
:::
## From spoke data to total AUM
Once the Machine holds fresh accounting for every enabled spoke, it can compute total AUM (see [Share Price](../machine/share-price)):
$\text{AUM} = \text{idle} + \text{Hub Caliber} + \sum \text{Spoke Calibers} + \text{in-flight bridges}$
If any enabled spoke's stored data is stale when an [AUM update](../machine/share-price#keeping-aum-fresh) is attempted, the update **reverts** rather than using outdated values, so the share price is never computed from stale cross-chain data.
### Disabling a spoke
A spoke that has been fully wound down can be **disabled**, so that its accounting no longer needs relaying. Disabling is only allowed once the spoke is empty by every measure the Machine has: its last reported net AUM is zero, and no bridge transfer is pending in either direction. A disabled spoke is skipped in the AUM sum and can no longer receive transfers from the Machine, though funds it sends back to the Hub are still accepted. It can be re-enabled at any time. Both actions are governance operations (see [Permissions & Scopes](../../governance/permissions-and-scopes)).
## Counting value in transit
The accounting data each Mailbox reports includes **pending bridge amounts**: capital that has left one side but not yet arrived on the other. The Machine tracks bridge transfers in both directions on both sides, and counts the in-flight difference toward AUM. This is what guarantees value isn't double-counted *or* dropped while a [bridge transfer](liquidity-bridging) is in progress, which can take anywhere from minutes to days.
:::info[Implementation]
The CRE report handling lives in [`SpokeSnapshotConsumer`](/contracts/core/utils/abstract.SpokeSnapshotConsumer), inherited by the Machine, and in [`MachineUtils`](/contracts/core/libraries/library.MachineUtils). The spoke-side view is on [`CaliberMailbox`](/contracts/core/caliber/contract.CaliberMailbox).
:::
# Liquidity Bridging
Liquidity bridging moves the strategy's **capital** between the [Machine](../machine/overview) on the Hub Chain and its [Calibers](../caliber/overview) on the Spoke Chains. It is how an [Operator](../../governance/operator) deploys fresh deposits to a spoke, and how funds are brought back to Hub to settle [redemptions](../machine/redemptions).
## Adapters abstract the bridges
Transfers ride on **external bridge protocols**. The protocol ships a dedicated **bridge adapter** for each supported bridge (Across, CCTP, and LayerZero). On the Hub side the adapters are managed by the Machine, and on a spoke by the [Caliber Mailbox](caliber-mailbox). Each adapter exposes a standardized interface, so the rest of the system doesn't need to know which bridge is in use. Which routes (chain + token + bridge) are allowed is governed configuration.
## A deliberate four-step transfer
Bridging is intentionally **not** a single fire-and-forget call. It is a four-step handshake, executed by the Operator, and it works the same in both directions (Hub → Spoke and Spoke → Hub):
```mermaid
sequenceDiagram
participant Sender as Sender side
participant Bridge as Bridge protocol
participant Recipient as Recipient side
Note over Sender: 1. Schedule out-transfer
→ produces a message hash
Note over Recipient: 2. Authorize in-transfer
(register the message hash)
Sender->>Bridge: 3. Send out-transfer
Bridge->>Recipient: funds arrive
Recipient->>Recipient: 4. Claim → finalize delivery
```
1. **Schedule** the outgoing transfer on the sender side, which produces a unique **message hash** committing to the transfer's details.
2. **Authorize** the incoming transfer on the recipient side by pre-registering that message hash. The recipient will only accept a transfer it has explicitly expected.
3. **Send** the funds through the bridge protocol.
4. **Claim** on the recipient side to finalize delivery into the Caliber or Machine.
Requiring the recipient to pre-authorize the exact message hash means it only ever accepts transfers it has explicitly expected. An incoming transfer that was not authorized in advance is rejected.
## Loss limits
Each transfer carries a **minimum output amount**, and bridging is bounded by a governance-set **maximum bridge loss** (in basis points): a scheduled transfer whose expected output falls outside the allowed band is rejected. This caps the value that bridge fees or slippage can consume, and the per-bridge **outgoing-transfer-enabled** switch lets governance pause a route entirely.
## In-flight value is never lost
Between *send* and *claim*, capital is in transit and belongs to neither side's balance. The protocol tracks these pending transfers and counts them in [AUM](../machine/share-price), so the [share price](../machine/share-price) stays correct even while funds are crossing chains. See [Cross-Chain Accounting](cross-chain-accounting).
For **Spoke → Hub** transfers there is an additional ordering rule: the spoke's [accounting snapshot](cross-chain-accounting) recording the outbound transfer must reach the Machine before the transfer can be claimed on the Hub. The Machine rejects the claim until the reported outbound amount covers it, so the value leaves the spoke side of the accounting view before it is added on the hub side, and is never counted on both at once.
:::warning[Token homology]
The protocol assumes the input and output tokens of a transfer are **homologous and share the same number of decimals**. This relies on the **Token Registry**, which maps each local token to its equivalent foreign address and must be configured correctly on every chain. Misconfiguration here would break the value equivalence that transfers and accounting both rely on.
:::
## In Recovery Mode
During [Recovery Mode](../../security/recovery-mode), bridging is restricted to the **Spoke → Hub** direction. The Hub can no longer send transfers out to spokes, and spokes can no longer authorize incoming transfers from the Hub, so an emergency can only pull capital to Hub, never push it out to a spoke.
:::info[Implementation]
See the [bridge adapters](/contracts/core/summary) and [`BridgeController`](/contracts/core/bridge/controller/abstract.BridgeController).
:::
# Caliber Mailbox
A **Caliber Mailbox** is deployed alongside every Spoke [Caliber](../caliber/overview). It is the **Machine's local endpoint on the spoke chain**: from the Caliber's perspective, the Mailbox stands in for the [Machine](../machine/overview), and it absorbs all the chain-specific logic so the Caliber behaves identically on every chain.

It plays three roles.
## 1. Liquidity gateway
The Mailbox controls the spoke side's set of [bridge adapters](liquidity-bridging) and is the contract through which capital is sent to and received from the Hub Machine. It is the spoke-side counterpart to the Machine's hub-side bridging, executing the same [four-step transfer](liquidity-bridging#a-deliberate-four-step-transfer) and tracking pending in- and out-bound amounts per token.
## 2. Governance endpoint
Mirroring the Machine on the Hub Chain, the Mailbox exposes the per-strategy [roles](../../governance/overview) (Operator, Risk Manager, Security Council, …) to its Caliber, so the same permission model (including [Recovery Mode](../../security/recovery-mode)) applies on the spoke. Recovery Mode is **per-chain**: it must be triggered on each spoke's Mailbox independently.
## 3. Accounting source
The Mailbox exposes the **view function** that the [Chainlink CRE workflow](cross-chain-accounting) reads to build the spoke's accounting snapshot: the Caliber's net AUM, pending bridge amounts, and the block context used for freshness checks. This is how the spoke's value reaches the Machine for total-AUM computation.
:::info[Implementation]
Caliber Mailbox reference: [`CaliberMailbox.sol`](/contracts/core/caliber/contract.CaliberMailbox).
:::
# Pricing & Oracles
Everything Makina does rests on one ability: **valuing any token in terms of the [accounting token](overview#glossary)**. Share price, AUM, loss checks, and risk caps are all denominated that way. The contract that provides this is the **Oracle Registry**, shared [infrastructure](overview#shared-infrastructure) deployed once per chain and used by every strategy on it.
## How pricing works
The Oracle Registry aggregates price feeds that conform to the [Chainlink `AggregatorV3` interface](https://docs.chain.link/data-feeds/price-feeds). These can be Chainlink's own feeds or any other oracle that exposes the same interface. The protocol depends on the interface, not on a specific feed provider. It prices each token against a common **reference currency** (e.g. USD) and then derives any token-to-token price by combining the two. A token reaches the reference currency through **one or two feed hops**:
* **One hop**: a direct feed exists (e.g. `TokenA → USD`).
* **Two hops**: no direct feed exists, so the token is priced through an intermediate (e.g. `TokenB → TokenC → USD`).
```mermaid
flowchart LR
A["Token A"] -->|feed| USD(("USD
reference")):::r
B["Token B"] -->|feed| C["Token C"] -->|feed| USD
USD -->|"price A ÷ price B"| Result["Price of A in B"]:::o
classDef r fill:#444c56,stroke:#6e7681,color:#fff;
classDef o fill:#238636,stroke:#238636,color:#fff;
```
To price **Token A in Token B**, the registry prices each against the reference currency (one or two hops each) and divides. The math normalizes for each feed's and each token's decimals, so callers get a clean, consistent price regardless of the tokens' native precision.
## Rejecting stale or invalid prices
Each feed in a route has a configured **staleness threshold**. When the registry reads a feed it rejects the price if it is **negative** or if the feed hasn't updated within its threshold, so a stalled or malfunctioning feed causes a clear revert rather than a silently wrong valuation. Combined with the Caliber's [loss checks](caliber/positions#loss-checks), this keeps a bad price from translating into a bad trade.
## Where it's used
The Oracle Registry is consulted whenever value must be measured:
* **Token balances**: valuing the [base tokens](caliber/base-tokens) and idle balances held by Machines and Calibers.
* **Position valuation**: converting a [position's](caliber/positions) reported base-token amounts into accounting-token value.
* **Loss checks**: verifying, after each [position management](caliber/positions#loss-checks) or [swap](caliber/swaps), that value loss stays within bounds.
Which feeds and routes are registered for which tokens is governed configuration, managed by the protocol's infrastructure-configuration role behind a [timelock](../governance/permissions-and-scopes). A token cannot become a [base token](caliber/base-tokens) until a valid route exists for it here.
:::info[Implementation]
Oracle Registry reference: [`OracleRegistry.sol`](/contracts/core/registries/contract.OracleRegistry).
:::
# Roles & Governance
Makina's safety doesn't come from trusting any single party. It comes from **separating powers** so that no one actor can both move funds and change the rules that bound them. This section explains who the actors are, what each can and cannot do, and the timelocks and vetoes that sit between intention and effect.
## Two layers of control
Permissions exist at two levels:
```mermaid
flowchart TB
subgraph PW["Protocol-wide (shared by all strategies)"]
AM["AccessManager
8 roles · timelocks · guardian"]:::g
end
subgraph PS["Per-strategy (one set per Machine/Caliber)"]
OP["Operator"]:::op
RM["Risk Manager"]:::rm
RMT["Risk Manager Timelock"]:::rm
SC["Security Council"]:::sc
RG["Root Guardians"]:::sc
end
AM -. "configures who holds
per-strategy roles" .-> PS
classDef g fill:#1f6feb,stroke:#1f6feb,color:#fff;
classDef op fill:#238636,stroke:#238636,color:#fff;
classDef rm fill:#9e6a03,stroke:#9e6a03,color:#fff;
classDef sc fill:#da3633,stroke:#da3633,color:#fff;
```
* **Protocol-wide permissions** are managed by a single **AccessManager** contract (one per chain), through a set of numbered roles. These govern shared infrastructure, strategy deployment, contract linking, and [upgrades](protocol-upgrades). Most roles act through **timelocks**, and a guardian can cancel scheduled actions. See [Permissions & Scopes](permissions-and-scopes).
* **Per-strategy permissions** are a set of addresses stored on each Machine and Caliber. These are the actors who run and oversee an individual strategy day to day.
## The per-strategy actors
| Actor | What they do | Key constraint |
| ---------------------------------------- | ---------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **[Operator](operator)** | Executes the strategy: manages positions, swaps, harvests, bridges liquidity. | Pre-approved instructions only, per-action loss caps and cooldowns, and no power to withdraw user funds. |
| **[Risk Manager](risk-manager)** | Proposes new instructions and sets the strategy's risk limits. | Schedules the [instruction-root update](root-update-lifecycle). A few low-risk settings are immediate, but most parameter changes go through the **Risk Manager Timelock**. |
| **Risk Manager Timelock** | The timelocked address through which the risk-sensitive parameter changes are actually applied. | Enforces a delay so changes can't be atomic or unilateral. |
| **[Security Council](security-council)** | Emergency oversight: vetoes pending changes and triggers [Recovery Mode](../security/recovery-mode). | Cannot execute strategy actions in normal operation, only veto and emergency intervention. In Recovery Mode it *becomes* the Operator. |
| **Root Guardians** | Hold veto power specifically over [instruction-root updates](root-update-lifecycle). | Veto only, cannot propose or execute. |
## Separation of powers
The roles are deliberately split so that the dangerous combinations are impossible:
* The **Operator** can act quickly but only within limits it cannot itself change.
* The **Risk Manager** sets those limits but cannot execute the strategy, and its changes are delayed by a timelock.
* The **Security Council** can stop bad changes and intervene in emergencies, but in normal operation cannot move funds or alter parameters on its own.
* **Protocol-wide governance** (the DAO, via the AccessManager) can upgrade and deploy, but only behind timelocks the Security Council can cancel.
Every consequential action is either bounded by limits it cannot exceed, or delayed by a timelock during which it can be vetoed, leaving time for monitoring and response before harm can occur. The pages that follow detail each actor, the [root-update lifecycle](root-update-lifecycle), the [permission roles](permissions-and-scopes), [protocol upgrades](protocol-upgrades), and the [multisig safeguards](safe-security-structure) that protect the keys behind these roles. For the emergency state itself, see [Recovery Mode](../security/recovery-mode).
# Operator
The **Operator** is the entity that runs a strategy day to day. It is the actor with discretion (the one making the active-management decisions that generate returns), but that discretion is tightly bounded by the strategy's risk policy and the [pre-approved instruction set](../architecture/caliber/makina-vm).
:::note
In the contracts this role is the `mechanic` address. The `operator()` getter returns it during normal operation, and the [Security Council](security-council) during [Recovery Mode](../security/recovery-mode). We call it the **Operator** throughout. See the [governance overview](overview#the-per-strategy-actors).
:::
## Responsibilities
* **Execute and maintain the strategy**: open, resize, and close [positions](../architecture/caliber/positions), [swap](../architecture/caliber/swaps) tokens, [harvest](../architecture/caliber/harvests) rewards, and [rebalance](../architecture/lifecycle#4-rebalance--harvest-the-strategy-is-actively-managed) across protocols and chains to deliver strong risk-adjusted returns.
* **Move liquidity**: allocate idle capital from the [Machine](../architecture/machine/overview) to Calibers and [bridge](../architecture/cross-chain/liquidity-bridging) it between the Hub and Spokes.
* **Settle redemptions**: free up accounting-token liquidity and [finalize the redemption queue](../architecture/machine/redemptions).
* **Keep accounting fresh**: re-account positions so the [share price](../architecture/machine/share-price) stays accurate.
* **Propose new opportunities**: author new instructions and submit [Root Updates](root-update-lifecycle) for the Risk Manager to publish.
The Operator works toward the strategy's published [mandate](../introduction#the-strategy-mandate), and is incentivized by [performance fees](../architecture/machine/fees) to maximize the long-term share price.
## Trust assumptions
Makina assumes Operators are competent and economically motivated to perform, but **does not assume they are infallible or honest**. An Operator's keys could be compromised, its software could have bugs, or it could act maliciously. The protocol is therefore designed so that even a fully hostile Operator cannot cause large or fast losses.
## What the Operator *cannot* do
The Operator never has custody in the ordinary sense. Its actions are constrained on every axis:
* **Execution** is limited to [pre-approved instructions](../architecture/caliber/makina-vm), and cannot call arbitrary contracts.
* **Swaps** may only output approved [base tokens](../architecture/caliber/base-tokens).
* **Bridging** is allowed only to approved chains over approved bridges, within a max-loss limit.
* **Loss caps and cooldowns** bound every position-management action and every swap.
* It **cannot** withdraw user funds, send assets to arbitrary destinations, change its own limits, or mint shares to itself outside the [fee](../architecture/machine/fees) mechanism.
```mermaid
flowchart LR
Op([Operator action]) --> Check{"approved instruction?
within loss cap?
cooldown elapsed?
approved route?"}:::q
Check -->|yes| Do["execute"]:::ok
Check -->|no| Stop["revert"]:::no
classDef q fill:#9e6a03,stroke:#9e6a03,color:#fff;
classDef ok fill:#238636,stroke:#238636,color:#fff;
classDef no fill:#da3633,stroke:#da3633,color:#fff;
```
Together these bounds mean an Operator cannot drain or wreck a strategy in a single transaction or a short burst. The damage rate is capped, which buys the [Security Council](security-council) time to detect anomalies, trigger [Recovery Mode](../security/recovery-mode), and strip the Operator of its powers. The Makina Foundation runs active monitoring across strategies to surface unusual behavior quickly.
# Risk Manager
If the [Operator](operator) decides *what* to do, the **Risk Manager** decides *within what limits*. It sets the boundaries the Operator must operate inside (the instruction set, the loss caps, the staleness thresholds), balancing enough flexibility to pursue the [mandate](../introduction#the-strategy-mandate) against tight enough control to protect user funds.
Crucially, the Risk Manager **cannot execute the strategy**. It defines rules, and the Operator acts under them. This separation means neither can do the other's job, and neither alone can both set a limit and exploit it.
## Responsibilities
* **Curate the instruction set.** Review instructions proposed by the Operator and **schedule** the [Merkle-root update](root-update-lifecycle) that authorizes them on a Caliber.
* **Set risk parameters** on Machines and Calibers: position loss caps, swap loss caps, cooldowns, accounting staleness thresholds, fee accrual-rate caps, share-price change-rate limits, bridge loss limits.
* **Curate [base tokens](../architecture/caliber/base-tokens)**: register and unregister the tokens each Caliber may hold.
* **Set the share supply cap** that limits new deposits.
* **Manage access screening**: the whitelists on the [Depositor](../architecture/machine/deposits#whitelisting), [Redeemer](../architecture/machine/redemptions#whitelisting), and [Pre-Deposit Vault](../architecture/machine/pre-deposit), and the [sanctions screening](../architecture/machine/deposits#sanctions-screening) toggle on the Depositor and Redeemer.
## Two speeds: immediate vs. timelocked
Not every change carries the same risk, so they don't all move at the same speed:
* A small number of **lower-risk settings** can be applied **immediately** by the Risk Manager, for example the share supply cap, the deposit/redemption whitelists, and sanctions screening.
* The **risk-sensitive parameters** are applied through a separate **Risk Manager Timelock** address. Changes routed through it are **delayed**, so they cannot be applied atomically or unilaterally, and the [instruction-root update](root-update-lifecycle) can be **vetoed** during its delay by the [Security Council](security-council) or the [Root Guardians](root-update-lifecycle#who-can-veto).
The net effect is trust minimization: the Risk Manager can keep a strategy adaptive, but every consequential change is delayed and observable, giving users time to exit and the Security Council time to veto if a change is unacceptable.
# Security Council
The **Security Council** is the strategy's emergency oversight body and its final line of defense. It holds no power to run the strategy in normal times: it cannot open positions or change parameters at will. Its job is to **watch, veto, and intervene** when something threatens user funds.
## Responsibilities
* **Veto pending changes.** The Council reviews timelocked changes scheduled by the [Risk Manager](risk-manager) (especially [instruction-root updates](root-update-lifecycle)) and can cancel any that introduce unacceptable risk before they take effect.
* **Trigger [Recovery Mode](../security/recovery-mode).** In response to a hack, Operator or Risk Manager misbehavior, abnormal share-price movement, or funds otherwise at risk, the Council can put the strategy into Recovery Mode. While active, the Council **assumes the Operator's role** and the strategy is restricted to unwinding only.
* **Initiate Security Module slashing.** When a genuine shortfall occurs, and where the strategy has a [Security Module](../security/security-module) configured, the Council can trigger its slashing to cover losses for share holders.
* **Bypass the share-price guard when legitimate.** The Council can force an [AUM update](../architecture/machine/share-price#keeping-aum-fresh) even when the share-price change exceeds the normal rate limit, useful when a large, legitimate move must be reflected.
* **Relay spoke accounting as a fallback.** If the Chainlink CRE path that normally delivers [spoke accounting snapshots](../architecture/cross-chain/cross-chain-accounting) is unavailable, the Council can publish them to the Machine directly.
Unlike the [Operator](operator) and [Risk Manager](risk-manager), whose powers are bounded by limits they cannot exceed, the Security Council is a **fully trusted** actor. Several of its powers are immediate, unilateral, and destructive if misused:
* During [Recovery Mode](../security/recovery-mode) it assumes the Operator's role (itself still bounded by the instruction set and loss caps).
* It can reset a token's [bridging state](../architecture/cross-chain/liquidity-bridging), force-withdrawing pending funds from the bridge adapters and clearing that token's in-flight accounting.
* As an always-authorized accounting source, it can force an [AUM update](../architecture/machine/share-price#keeping-aum-fresh) even when the change exceeds the share-price rate limit.
* It can publish spoke accounting snapshots directly, bypassing the CRE forwarder and workflow authorization (the mailbox and freshness checks still apply).
* Where a [Security Module](../security/security-module) is configured, it can trigger slashing, seizing staked funds (up to a configured cap) to cover a shortfall.
```mermaid
flowchart LR
RM["Risk Manager
schedules change"]:::rm --> TL["Timelock delay"]:::t
TL -->|Council/Guardian veto| X["cancelled"]:::no
TL -->|no veto| OK["takes effect"]:::ok
Threat["Detected threat"]:::no -->|Council triggers| REC["Recovery Mode
Council = Operator"]:::rec
classDef rm fill:#9e6a03,stroke:#9e6a03,color:#fff;
classDef t fill:#1f6feb,stroke:#1f6feb,color:#fff;
classDef ok fill:#238636,stroke:#238636,color:#fff;
classDef no fill:#da3633,stroke:#da3633,color:#fff;
classDef rec fill:#da3633,stroke:#da3633,color:#fff;
```
The Security Council is a multisig protected by the safeguards described in [Multisig Security](safe-security-structure), and at the protocol-wide level it holds the **Guardian role** that can cancel scheduled [upgrades](protocol-upgrades).
# Root Update Lifecycle
The set of actions an [Operator](operator) may take is defined by the [Merkle root](../architecture/caliber/makina-vm#merkle-tree-permissioning) of allowed instructions stored on each [Caliber](../architecture/caliber/overview). Changing that root is the single most security-critical governance action in a strategy: it expands or contracts what the Operator can do. It therefore follows a deliberate, multi-stage, vetoable process.
```mermaid
flowchart TB
A["1. Operator opens PR in
makina-integrations
(new root + instructions)"]:::op --> B["2. Reviewed by Security Council
+ Makina developers → merged"]:::rev
B --> C["3. Risk Manager schedules
the root update on the Caliber
(starts timelock)"]:::rm
C --> D{"4. Timelock window
(notifications sent)"}:::t
D -->|vetoed by guardian| X["cancelled"]:::no
D -->|delay elapses| E["5. New root active:
only matching proofs execute"]:::ok
classDef op fill:#238636,stroke:#238636,color:#fff;
classDef rev fill:#8957e5,stroke:#8957e5,color:#fff;
classDef rm fill:#9e6a03,stroke:#9e6a03,color:#fff;
classDef t fill:#1f6feb,stroke:#1f6feb,color:#fff;
classDef ok fill:#238636,stroke:#238636,color:#fff;
classDef no fill:#da3633,stroke:#da3633,color:#fff;
```
## The stages
1. **Propose.** The Operator opens a pull request in the public [`makina-integrations`](https://github.com/MakinaHQ/makina-integrations) repository containing the new root and the corresponding instructions. Because the instruction set is public, anyone can rebuild the tree and verify exactly what is being authorized.
2. **Review & merge.** The PR is reviewed by relevant parties before being merged.
3. **Schedule.** The [Risk Manager](risk-manager) takes the reviewed root and schedules the update on the relevant Caliber, which starts a **timelock**.
4. **Timelock window.** The scheduled update is visible on-chain, and notifications go out to the Security Council and community channels. Users who disagree with the upcoming change have time to [redeem](../architecture/machine/redemptions) before it takes effect.
5. **Activate.** If not vetoed, the new root takes effect when the timelock elapses. From then on, only instructions whose proofs match the new root are valid, and instructions removed by the update can no longer execute.
## Who can veto
During the timelock window, the scheduled update can be cancelled by:
* the **[Security Council](security-council)**,
* the **Root Guardians** (a configurable set of veto-holding addresses dedicated to this purpose), or
* the **Risk Manager** itself (withdrawing its own proposal).
This veto applies specifically to the instruction root, the heart of the Operator's permissions. The Operator's powers cannot be expanded if any of these parties objects.
:::info[Implementation]
The on-chain entry points for scheduling, vetoing, and activating a root update live in [`Caliber.sol`](/contracts/core/caliber/contract.Caliber).
:::
# Permissions & Scopes
Makina's permissions live at two levels: **protocol-wide roles** managed by a shared AccessManager, and **per-strategy entities** stored on each strategy's contracts. This page enumerates both.
## Protocol-wide roles
A single **AccessManager** contract per chain gates every protocol-wide restricted action. Each role can carry an **execution delay**, a timelock between scheduling an action and executing it, and a **guardian** that can cancel an action during that window. The table below lists each role, who holds it, and its delay in the production deployment.
| Role | id | Authorized to | Holder, execution delay |
| ---------------------------------- | --- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| `ADMIN_ROLE` | 0 | Super admin of the AccessManager: configure roles, delays, and guardians. Has **no guardian** (its actions can't be cancelled by anyone else). | Core Factory: no delay
DAO: 2-day delay |
| `INFRA_CONFIG_ROLE` | 1 | Configure shared core contracts (e.g. [oracle](../architecture/pricing-oracles) feed routes, cross-chain token mappings). | DAO: 1-day delay |
| `STRATEGY_DEPLOYMENT_ROLE` | 2 | Deploy new strategies. | DAO: no delay |
| `STRATEGY_COMPONENTS_LINKING_ROLE` | 3 | Link a strategy's contracts together (depositor, redeemer, fee manager, spoke calibers, bridge adapters), and disable or re-enable a spoke caliber. | DAO: 1-day delay on Hub Chain, no delay on Spoke chains |
| `STRATEGY_MANAGEMENT_CONFIG_ROLE` | 4 | Designate the per-strategy entities (Operator, Risk Manager, Security Council, …), manage accounting agents, and authorize the CRE workflow IDs allowed to relay [spoke accounting](../architecture/cross-chain/cross-chain-accounting). | DAO: 2-day delay |
| `STRATEGY_FEE_CONFIG_ROLE` | 5 | Configure [fee](../architecture/machine/fees) parameters in periphery contracts. | DAO: 2-day delay |
| `INFRA_UPGRADE_ROLE` | 6 | [Upgrade](protocol-upgrades) proxies and beacons, and repoint registry entries. | DAO: 2-day delay |
| `GUARDIAN_ROLE` | 7 | Cancel operations scheduled under any other role (it is the guardian of all roles except `ADMIN_ROLE`). | Security Council: no delay |
At deployment the **Core Factory** holds `ADMIN_ROLE` with no delay so it can wire up a new deployment, while the **DAO**'s own admin actions carry a 2-day delay. See [Protocol Upgrades](protocol-upgrades) for how the upgrade role, delays, and guardian interact in practice.
## Per-strategy entities
These are addresses stored on each Machine, Caliber, and Caliber Mailbox. They are set and changed by the `STRATEGY_MANAGEMENT_CONFIG_ROLE` (and the linking role for component wiring).
| Entity | Scope |
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **[Operator](operator)** | Day-to-day execution: position management, harvesting, swaps, and cross-chain transfers. Settles the [redemption queue](../architecture/machine/redemptions). *(On-chain: the `mechanic` address.)* |
| **[Risk Manager](risk-manager)** | Schedules [instruction-root updates](root-update-lifecycle), sets the share supply cap, and manages whitelists and sanctions screening. |
| **Risk Manager Timelock** | The timelocked address through which risk-sensitive parameter changes are applied: loss caps, cooldowns, staleness and fee-rate limits, bridge limits. |
| **[Security Council](security-council)** | Vetoes scheduled changes, triggers [Recovery Mode](../security/recovery-mode), initiates [Security Module](../security/security-module) slashing, can force AUM updates, and can publish [spoke accounting snapshots](../architecture/cross-chain/cross-chain-accounting) directly as a CRE fallback. Becomes the Operator during Recovery Mode. |
| **Root Guardians** | Veto power over [instruction-root updates](root-update-lifecycle) only. |
| **Accounting Agents** | Optional addresses permitted to update AUM / account for positions when *restricted accounting mode* is enabled. |
## Restricted accounting mode
Whether accounting is permissionless or restricted is a configurable per-strategy setting. When permissionless, anyone can re-[account](../architecture/caliber/caliber-accounting) positions and trigger an [AUM update](../architecture/machine/share-price#keeping-aum-fresh) (when fresh and within limits). When **restricted accounting mode** is enabled, those actions are limited to the Operator and designated **accounting agents** (and the Security Council). Restricted mode is commonly used in practice. During [Recovery Mode](../security/recovery-mode), AUM updates are restricted to the Security Council regardless.
# Protocol Upgrades
## 1. Upgrade primitives
Makina's upgrade and access-control infrastructure is built on the OpenZeppelin (OZ) contracts framework. All restricted entry points are gated by an `AccessManager` instance, and every upgradeable contract uses one of two OZ upgradeability patterns:
* **Transparent proxy** (`TransparentUpgradeableProxy` paired with a dedicated `ProxyAdmin`): one proxy points to a single implementation. Upgrading replaces the code behind that one proxy.
* **Upgradeable beacon** (`UpgradeableBeacon` paired with `BeaconProxy`): every proxy of a given class reads its implementation address from a shared beacon. Upgrading the beacon moves every proxy of that class to the new implementation in a single transaction.
These two patterns map onto two categories of Makina contracts, covered next.
### 1.1 Infrastructure contracts
Infrastructure contracts are the registries, factories, modules, and bridge configs that act as shared services for every strategy. They are deployed once per chain, and each one uses the transparent-proxy pattern: a `TransparentUpgradeableProxy` paired with its own `ProxyAdmin`. Upgrades are therefore scoped to a single contract at a time.
Infrastructure contracts present on **both hub and spokes**:
* `AccessManager`
* `OracleRegistry`, `TokenRegistry`
* `SwapModule`
* `AcrossV3BridgeConfig`, `LayerZeroV2BridgeConfig`, `CctpV2BridgeConfig`
Infrastructure contracts present **only on the hub chain**:
* `HubCoreRegistry`, `HubCoreFactory`
* `HubPeripheryRegistry`, `HubPeripheryFactory`
* `MachineShareOracleFactory`, `MetaMorphoOracleFactory`
Infrastructure contracts present **only on spokes**:
* `SpokeCoreRegistry`, `SpokeCoreFactory`
### 1.2 Strategy contracts
Strategy (per-instance) contracts are deployed once per strategy on a given chain. Each instance is a `BeaconProxy`, and all instances of a given class read their implementation address from one shared `UpgradeableBeacon`. Upgrading a class is therefore a one-transaction operation that propagates to every instance at once.
Strategy contract classes present on **both hub and spokes**:
* `Caliber`
* `AcrossV3BridgeAdapter`, `LayerZeroV2BridgeAdapter`, `CctpV2BridgeAdapter`
Strategy contract classes present **only on the hub**:
* `Machine`, `PreDepositVault`
* `DirectDepositor`, `AsyncRedeemer`
* `WatermarkFeeManager`, `SecurityModule`
* `MachineShareOracle`
Strategy contract classes present **only on spokes**:
* `CaliberMailbox`
***
## 2. Governance stack
The AccessManager is simultaneously (i) the owner of every proxy admin and every beacon, and (ii) the authority backing all restricted functions across Makina contracts.
Among the eight roles defined on the AccessManager (covering, among other things, configuration tuning, strategy linking, strategy management, fee parameters, and deployment of new strategy components), only **`INFRA_UPGRADE_ROLE`** is relevant to the upgrade path described here. The rest of this section focuses on the upgrade role only.
`INFRA_UPGRADE_ROLE` is held by the DAO with a **2-day execution delay**, and its guardian is the Security Council. It gates every action that changes which implementation a Makina contract runs against:
* upgrading a singleton infra contract (via its proxy admin),
* upgrading a replicated component class (via its beacon),
* **repointing a registry entry**: changing which module, factory, or beacon address the Core and Periphery registries resolve to.
Registry repointing is intentionally gated by the same role and the same 2-day delay as a code upgrade: swapping the address of a registered component is operationally equivalent to upgrading it, since every contract that resolves through the registry will pick up the new target on the next call.
Other roles in the protocol can be granted with different delays (typically 1-2 days), but none of them can change the implementation a Makina contract runs against.
***
## 3. Timelocks & challenge windows
The AccessManager queues every operation made under a role with a non-zero delay. A scheduled operation can be cancelled by the original proposer, or by the guardian of the scheduling role if one has been assigned.
In this deployment, `INFRA_UPGRADE_ROLE` (and every other non-admin role) has `GUARDIAN_ROLE`, held by the Security Council, set as its guardian. `ADMIN_ROLE` has no guardian, so admin operations are not cancellable by anyone other than the DAO itself.
For the upgrade flow this means every scheduled upgrade or registry repoint sits in a 2-day queue during which the Security Council can cancel with a single transaction.
The lifecycle of an upgrade or registry repoint is:
1. The DAO schedules the operation on the AccessManager, targeting the proxy admin, beacon, or registry to be modified.
2. A 2-day delay elapses. The scheduled operation is visible on-chain and inspectable by anyone.
3. Either the Security Council cancels (at which point the operation is dropped permanently) or the delay expires and the DAO executes, applying the change.
Non-upgrade actions follow the same scheduled/cancellable pattern with shorter or zero delays depending on the role.
### 3.1 Self-governance
The AccessManager is itself behind a transparent proxy whose proxy admin is owned by the AccessManager. Upgrading the AccessManager is itself an `INFRA_UPGRADE_ROLE` operation, subject to the same 2-day delay and the same Security Council cancellation as other upgrades.
### 3.2 Threat model
* **Compromised DAO.** A compromised DAO can schedule any operation it holds a role for, but every such operation goes through the role's delay (2 days for upgrades, registry repoints, and admin actions, and 1-2 days for the other roles). Upgrades, registry repoints, and operations gated by the other non-admin roles can be cancelled by the Security Council during the delay window, so no malicious implementation reaches a live contract. Admin operations have no guardian and therefore cannot be cancelled on-chain. The 2-day delay is the only barrier, leaving time for an off-chain response before the attacker can gain additional privileges through role grants or target reconfiguration.
* **Compromised Security Council.** The Security Council has no upgrade powers. Its only involvement in the upgrade process is cancellation. A compromised Security Council can therefore *grief* the DAO by cancelling every scheduled upgrade or registry repoint, but cannot push code itself. Because `ADMIN_ROLE` cannot have a guardian assigned, the DAO can still revoke `GUARDIAN_ROLE` from the compromised multisig via a 2-day admin operation that nobody else can cancel. Recovery is bounded by that 2-day window.
* **Both multisigs compromised simultaneously.** No on-chain mitigation. The 2-day delay still gives 48 hours for an off-chain response (community fork, social coordination).
* **Cross-chain.** Each chain runs its own AccessManager (same address, independent state). Upgrades and registry repoints do not propagate. The DAO must schedule and execute on each chain separately, and the Security Council guards each chain's queue independently. A live upgrade campaign must therefore be tracked per chain.
***
## 4. Appendix - Key addresses
The three addresses below are identical on all supported chains.
| Role | Address |
| ------------------------- | -------------------------------------------- |
| AccessManager | `0x0fCEfa3f1047F35521A49cD8B06faBd588665d7F` |
| DAO multisig | `0x62244C74e1d09b3D86EF7342d354b5D7770bDE10` |
| Security Council multisig | `0x89faa3b02EF5aB185b8ACE489Af62748ACB50Afc` |
# Multisig Security
The per-strategy roles ([Operator](operator), [Risk Manager](risk-manager), [Security Council](security-council)) and the protocol-wide governance roles are ultimately held by multisig wallets. Those wallets are themselves a part of the security model, and are protected by standardized safeguards.
All Multisigs within the protocol will adhere to standardized security safeguards:
* Timelock in owner changes (min: 24h)
* As a precautionary measure, the Safe implementation will be non-upgradable. This means that once deployed with a specific version (e.g., 1.4.1), it will remain on that version indefinitely.
* Transactions will not be permissionless. Execution will be strictly enforced and limited to the Safe owners.
In addition to these checks and balances, each owner can utilize an independent simulation engine to simulate transaction payloads in a separate communication channel of their choice (e.g., Telegram, Discord). This ensures independent validation and also enables verification of any root updates, which are critical at the protocol level.
An additional security layer for the Multisigs will be provided by our security partner's product, Hypernative Guardian. During the transaction lifecycle, it can detect malicious activity in the pre-transaction stage and block specific payloads once they reach the blockchain. The Guardian also enables each Multisig to define custom policies, allowing them to block transaction types that fall outside their intended role within the protocol.
This Multisig architecture is designed to prevent sudden ownership changes, allow a sufficient review period, safeguard against unauthorized or malicious implementation upgrades, and restricts the execution of targeted payloads to authorized owners. Given recent incidents related to access control, these measures significantly reduce the attack surface.
# Trust Model & Risk
This page sets out Makina's trust model: which actors and external systems the protocol relies on, the level of trust each is granted, and what could go wrong if one of them is compromised or fails. It consolidates the safeguards described throughout these docs into a single risk picture, and aligns with the trust model published in the protocol's [security audits](/contracts/security).
## Trust levels
Each role is classified into one of three levels:
* **Fully trusted.** Held by the protocol's governance multisigs. Their authority is broad enough to reach all user funds, so the system relies on the integrity of their keys and processes, protected by timelocks and [multisig safeguards](../governance/safe-security-structure).
* **Partially trusted.** Assumed to act honestly for the system to operate, but constrained by the contracts so they cannot withdraw user funds. Their influence is bounded to a limited loss or a temporary operational disruption.
* **Untrusted.** Granted no special privileges. The system is designed to remain safe against arbitrary behavior from them.
## Asset assumptions
Tokens used anywhere in the system ([base tokens](../architecture/caliber/base-tokens), [accounting tokens](../architecture/overview#glossary), and deposit tokens) are assumed to be standard ERC20 tokens with **at most 18 decimals** and **no non-standard behavior**: no rebasing, no transfer hooks (reentrancy), and no fees on transfer. Whitelisting a token that violates these assumptions can break accounting, and is a governance responsibility.
## Role trust model
| Role | Trust level | Scope and limits |
| ----------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **[Governance](../governance/permissions-and-scopes)** (the scoped AccessManager roles) | Fully trusted | Holds the protocol's highest authority: it configures every restricted function and controls contract [upgrades](../governance/protocol-upgrades). This authority is split into scoped roles (infra config, deployment, linking, management, fees, upgrades, guardian), each fully trusted within its own scope and exercised behind timelocks. |
| **[Security Council](../governance/security-council)** | Fully trusted | Holds the protocol's emergency authority: it vetoes [instruction-root updates](../governance/root-update-lifecycle), triggers [Recovery Mode](recovery-mode) (stepping into the Operator's role to unwind), resets bridging state, and can refresh AUM outside the share-price change guard. Because these powers reach accounting and the [share price](../architecture/machine/share-price), it is a high-threshold multisig. It holds no power to withdraw user funds. |
| **[Operator](../governance/operator)** (the `mechanic`) | Partially trusted | Executes routine strategy actions within [pre-approved instructions](../architecture/caliber/makina-vm). It cannot withdraw funds, set a position's withdrawal addresses, or change parameters, so its influence is bounded by the [loss caps](../architecture/caliber/positions#loss-checks) the Risk Manager configures. The role is actively monitored and replaceable. |
| **[Risk Manager](../governance/risk-manager)** & Risk Manager Timelock | Partially trusted | Adjust system parameters: the Risk Manager changes the share supply cap immediately, the Timelock changes risk-sensitive parameters (staleness thresholds, bridge-loss limits) after a delay. Neither can move funds. Their reach is operational, such as pausing deposits via the supply cap, and any new instruction is vetoable by the Security Council or the Root Guardians. |
| **Root Guardians** | Partially trusted | Hold veto power over queued instruction-root updates. Their role is purely to block: a single veto stops an update, and they cannot move funds or propose changes of their own. |
| **Accounting Agents** | Partially trusted | When [restricted accounting mode](../governance/permissions-and-scopes#restricted-accounting-mode) is enabled, only these addresses (plus the Operator and Security Council, which always qualify) may perform accounting. They cannot move funds, and their effect on the share price is bounded per update by the change-rate guard. |
| **[Depositor](../architecture/machine/deposits), [Redeemer](../architecture/machine/redemptions), [Fee Manager](../architecture/machine/fees)** | Partially trusted | Smart contracts that handle the deposit, redemption, and fee flows respectively. Each is scoped to the funds passing through its own flow and holds no authority over the rest of the system. The Fee Manager can mint at most the maximum configured fee. |
| **End users** | Untrusted | Hold and transfer machine tokens only. They have no execution rights in the core contracts, and interact through the Depositor and Redeemer rather than the Machine directly. |
In normal operation the principle is **separation of powers**: the [Operator](../governance/operator) can *act* but cannot change the *rules* it works under, and the [Risk Manager](../governance/risk-manager) sets those rules but cannot *act*. The [Security Council](../governance/security-council) sits outside this split, by design, as the emergency backstop that can both veto rule changes and step in as the Operator. That dual power is precisely why it is fully trusted. Consequential rule changes are delayed and vetoable. See [Roles & Governance](../governance/overview).
## Upgradeability
The core contracts (Machine, Caliber, and Caliber Mailbox) are **upgradeable**. Whoever controls the upgrade mechanism (the `INFRA_UPGRADE_ROLE`, part of Governance) can change the entire logic of the system, and in the worst case all deposited funds could be stolen. This power sits behind a **2-day timelock** that the Security Council can cancel. See [Protocol Upgrades](../governance/protocol-upgrades).
## External dependencies
Makina's security also depends on external systems that lie outside its own contracts:
* **Oracles.** Asset valuation and AUM rely on the price feeds registered in the [Oracle Registry](../architecture/pricing-oracles), which conform to the Chainlink `AggregatorV3` interface. They are assumed to provide accurate, timely prices. A manipulated or lagging feed could materially mis-calculate the share price. The protocol mitigates this with staleness and sanity checks and with per-action loss checks, but cannot eliminate it.
* **Bridge protocols.** The [bridge adapters](../architecture/cross-chain/liquidity-bridging) integrate third-party bridges (Across, CCTP, and LayerZero). A vulnerability in an underlying bridge could permanently lose funds in transit.
* **Chainlink CRE.** [Cross-chain AUM](../architecture/cross-chain/cross-chain-accounting) is relayed from spokes by Chainlink Runtime Environment workflows and delivered through the Chainlink forwarder. The system trusts the Chainlink network to run the authorized workflow faithfully and to deliver untampered snapshots; the Machine itself only checks the forwarder, the workflow ID, the target Mailbox, and freshness. The Security Council can publish snapshots directly as a fallback.
* **L2 and spoke infrastructure.** For every spoke chain, the system implicitly trusts that network's sequencer and data-availability layer. A faulty or malicious sequencer could censor or reorder transactions, affecting AUM or causing a denial of service.
## Defense in depth
No single control is relied upon. The protocol layers independent safeguards so that a failure of one is caught by others:
```mermaid
flowchart TB
A["Pre-approved instructions
(Merkle root)"]:::d --> Loss
Loss["Per-action loss caps
+ cooldowns"]:::d --> Stale
Stale["Accounting freshness
+ share-price change limit"]:::d --> TL
TL["Timelocks + vetoes
on rule changes"]:::d --> Rec
Rec["Recovery Mode
(emergency unwind)"]:::d --> SM
SM["Security Module
(loss backstop)"]:::d
classDef d fill:#1f6feb,stroke:#1f6feb,color:#fff;
```
* **Action-level:** instructions, loss caps, cooldowns, and swap/bridge restrictions cap how much value can move wrongly in any single step or short window.
* **Accounting-level:** [staleness checks](../architecture/caliber/caliber-accounting) and the [share-price change-rate limit](../architecture/machine/share-price#keeping-aum-fresh) stop a wrong or manipulated valuation from propagating into the price.
* **Governance-level:** [timelocks](../governance/root-update-lifecycle) and vetoes ensure rule changes are slow, visible, and stoppable.
* **Emergency-level:** [Recovery Mode](recovery-mode) freezes normal operation and restricts the strategy to unwinding.
* **Loss-absorption:** where a strategy configures one, the [Security Module](security-module) can be slashed to cover a genuine shortfall for share holders.
## Residual risks
Bounding risk is not eliminating it. Users should understand that:
* **Strategy / market risk** is real. A strategy can lose value through market moves, even when every safeguard works exactly as intended. The protocol caps *misbehavior*, not market exposure. The strategy's [mandate](../introduction#the-strategy-mandate) describes its intended risk profile.
* **Smart-contract risk** exists in any protocol. Makina has undergone [multiple independent audits](/contracts/security) and runs a bug bounty, but no audit guarantees the absence of bugs.
* **Key-compromise risk**: the fully and partially trusted roles are multisigs with [safeguards](../governance/safe-security-structure), but multisig compromise remains a tail risk, which is why timelocks and the Security Council exist as backstops.
## Where to read more
* [Recovery Mode](recovery-mode): the emergency state and exactly what it restricts.
* [Security Module](security-module): how losses are absorbed.
* [Roles & Governance](../governance/overview): who controls what.
* [Security & Audits](/contracts/security): audit reports, bug bounty, and SEAL Safe Harbor.
# Recovery Mode
**Recovery Mode** is the protocol's emergency state. When triggered, it strips the [Operator](../governance/operator) of its normal powers and restricts the strategy to **unwinding only**: the goal shifts from generating returns to protecting and consolidating what remains.
## When it is triggered
Only the [Security Council](../governance/security-council) can enter or exit Recovery Mode, at its discretion, in situations such as:
* the Operator has been **inactive** for an extended period;
* the **share price behaves abnormally** (a sudden spike or drop);
* **suspicious activity** suggests Operator deviation, a hack, or funds otherwise at risk.
## What it does
Entering Recovery Mode **transfers the Operator's role to the Security Council**: the `operator()` getter now returns the Security Council, so all operator-gated actions require the Council, and the normal Operator is locked out. On top of that handover, the permitted actions are narrowed to those that only ever *reduce* risk:
```mermaid
flowchart LR
subgraph Normal
N1["open / increase positions"]
N2["swap between base tokens"]
N3["bridge Hub → Spoke"]
N4["deposits"]
end
subgraph Recovery["Recovery Mode (unwind only)"]
R1["decrease / close positions"]
R2["swap → accounting token only"]
R3["bridge Spoke → Hub only"]
R4["deposits disabled"]
end
Normal -.->|Security Council triggers| Recovery
```
**On each [Caliber](../architecture/caliber/overview):**
* Positions can only be **decreased or closed**. Opening or increasing a position is blocked.
* [Swaps](../architecture/caliber/swaps) may only convert **toward the accounting token**.
**On the [Machine](../architecture/machine/overview):**
* New **deposits are disabled**.
* Outbound **Hub → Spoke** [bridge transfers](../architecture/cross-chain/liquidity-bridging) are blocked.
* **AUM updates are restricted to the Security Council** (rather than the parties that handle accounting in normal operation): accounting continues, but only under Council control. This lets the Council keep the valuation current without an open accounting surface during the emergency.
## Scope and exit
Recovery Mode is **per-chain**. The Machine and Hub Caliber are governed on the Hub Chain, and **each Spoke Caliber must have Recovery Mode activated independently** on its own [Caliber Mailbox](../architecture/cross-chain/caliber-mailbox). A live incident may therefore need to be addressed on several chains.
Exiting is likewise at the Security Council's discretion, once the strategy's state is judged stable and secure. If a genuine shortfall is realized while unwinding and the Machine has a [Security Module](security-module) configured, the Council can also trigger its slashing to cover the loss for share holders.
# Security Module
The **Security Module** is a strategy's **optional** insurance backstop. A strategy may run without one, but where it is configured it holds a reserve that can be **slashed to cover losses** if the strategy suffers a shortfall: from a hack, bad debt, a depeg, or any event that leaves AUM short of what share holders are owed. It is the protocol's last line of *loss absorption*, complementing [Recovery Mode](recovery-mode)'s last line of *loss prevention*.
## How it works: staking shares for protection
```mermaid
flowchart LR
Holder([Share holder]) -->|lock shares| SM["Security Module"]:::sm
SM -->|mint security tokens| Holder
Fees["Fee Manager"]:::p -->|share of fixed fee| SM
SM -.->|on shortfall:
burn locked shares| Cover["losses covered"]:::no
classDef sm fill:#8957e5,stroke:#8957e5,color:#fff;
classDef p fill:#1f6feb,stroke:#1f6feb,color:#fff;
classDef no fill:#da3633,stroke:#da3633,color:#fff;
```
Holders of the [Machine Token](../architecture/machine/machine-token) can **lock** their shares in the Security Module and receive **security tokens** in return, a share-based claim on the locked pool (more locked value per security token over time as rewards accrue). In exchange for accepting slashing risk, stakers earn an **enhanced yield**: a dedicated portion of the strategy's minted [fee](../architecture/machine/fees) shares (the *Security Module fee*) flows to the module, raising the value of the locked pool.
If the [Security Council](../governance/security-council) determines a shortfall has occurred, it can **slash** the module: locked shares are burned, reducing the share supply and thereby lifting the [share price](../architecture/machine/share-price) back toward solvency for the remaining holders. Stakers bear the loss first, in return for the yield they earned.
## Unstake cooldown
Unstaking is not instant. To withdraw, a staker starts a **cooldown**:
1. They surrender their security tokens and receive a **receipt NFT** recording the pending amount and a maturity time.
2. After the cooldown matures, they redeem the NFT for the underlying shares.
3. Before maturity, the cooldown can be **cancelled**, returning the security tokens.
The cooldown exists to prevent **front-running a slash**: without it, a staker who saw a loss coming could collect the boosted yield and exit just before slashing, leaving honest stakers to absorb the hit. The Security Council sets the duration, with a **minimum of 7 days** recommended.
## Slashing limits
Slashing is capped so it can never wipe out the entire reserve unexpectedly. Two parameters bound it:
* a **maximum percentage** of the module's balance that may be slashed, and
* a **minimum balance that must remain** after a slash.
The **more restrictive** of the two applies. This guarantees a predictable ceiling on how much a single slashing event can burn.
:::info[Implementation]
Security Module reference: [`SecurityModule.sol`](/contracts/periphery/security-module/contract.SecurityModule). The fee that funds it is configured on the [`WatermarkFeeManager`](../architecture/machine/fees).
:::
# Strategies
The following strategies are live on the Makina Protocol. Each strategy is anchored by a Machine on its hub chain and runs Calibers on the spoke chains it operates on. Expand a strategy to see its contracts on every network.
:::info
For protocol-wide contracts, see the [Core](../contracts/core/deployments) and [Periphery](../contracts/periphery/deployments) deployments pages.
:::
## Ethereum hub
Dialectic BTC
DBIT
WBTC · Ethereum · Base · Arbitrum · Monad
| Contract | Address |
| --------------------------- | ------- |
| Machine | [`0xFCbE132452B6CAA32AdDd4768Db8fA02aF73d841`](https://etherscan.io/address/0xFCbE132452B6CAA32AdDd4768Db8fA02aF73d841) |
| Machine Token (DBIT) | [`0x972966bCC17f7d818De4F27Dc146Ef539c231BdF`](https://etherscan.io/address/0x972966bCC17f7d818De4F27Dc146Ef539c231BdF) |
| Accounting Token (WBTC) | [`0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599`](https://etherscan.io/address/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599) |
| Hub Caliber | [`0xD1A3c20488899C038B7DAae1EDE0C6DA6C36c326`](https://etherscan.io/address/0xD1A3c20488899C038B7DAae1EDE0C6DA6C36c326) |
| Depositor | [`0xb0475F38393E98c851F8e0377002fD45E2201E4D`](https://etherscan.io/address/0xb0475F38393E98c851F8e0377002fD45E2201E4D) |
| Redeemer | [`0x75dbeE73b92bCDE1D6aCe60Bf29293b1587828E5`](https://etherscan.io/address/0x75dbeE73b92bCDE1D6aCe60Bf29293b1587828E5) |
| Fee Manager | [`0x98072B0c7b0a618b277e62a0D2F52da249819C13`](https://etherscan.io/address/0x98072B0c7b0a618b277e62a0D2F52da249819C13) |
| Security Module | [`0x1d1E4Dc88BC3a56cac0495aAa298CDe3fCEBf1b5`](https://etherscan.io/address/0x1d1E4Dc88BC3a56cac0495aAa298CDe3fCEBf1b5) |
| Share Price Oracle | [`0x8B04bf6A374C40887F03B1928871c96f006Bb2fc`](https://etherscan.io/address/0x8B04bf6A374C40887F03B1928871c96f006Bb2fc) |
| Pre-Deposit Vault | [`0x49Af2649eEfbc7E3847b41100fddCF91134A549E`](https://etherscan.io/address/0x49Af2649eEfbc7E3847b41100fddCF91134A549E) |
| Pre-Deposit Token (gtWBTCc) | [`0x443df5eEE3196e9b2Dd77CaBd3eA76C3dee8f9b2`](https://etherscan.io/address/0x443df5eEE3196e9b2Dd77CaBd3eA76C3dee8f9b2) |
| Across Bridge Adapter | [`0xb428F0ad708778Ca6318C51340509430e63ea346`](https://etherscan.io/address/0xb428F0ad708778Ca6318C51340509430e63ea346) |
| LayerZero Bridge Adapter | [`0xd735b26273D1be5Bc4bCBC3D4B23dfa8568F05d6`](https://etherscan.io/address/0xd735b26273D1be5Bc4bCBC3D4B23dfa8568F05d6) |
| Contract | Address |
| --------------------- | ------- |
| Caliber | [`0xD1A3c20488899C038B7DAae1EDE0C6DA6C36c326`](https://basescan.org/address/0xD1A3c20488899C038B7DAae1EDE0C6DA6C36c326) |
| Caliber Mailbox | [`0xb5F39c345b52512c89608B2cd1Bbdc893641d27A`](https://basescan.org/address/0xb5F39c345b52512c89608B2cd1Bbdc893641d27A) |
| Across Bridge Adapter | [`0xb428F0ad708778Ca6318C51340509430e63ea346`](https://basescan.org/address/0xb428F0ad708778Ca6318C51340509430e63ea346) |
| Contract | Address |
| --------------------- | ------- |
| Caliber | [`0xD1A3c20488899C038B7DAae1EDE0C6DA6C36c326`](https://arbiscan.io/address/0xD1A3c20488899C038B7DAae1EDE0C6DA6C36c326) |
| Caliber Mailbox | [`0xb5F39c345b52512c89608B2cd1Bbdc893641d27A`](https://arbiscan.io/address/0xb5F39c345b52512c89608B2cd1Bbdc893641d27A) |
| Across Bridge Adapter | [`0xb428F0ad708778Ca6318C51340509430e63ea346`](https://arbiscan.io/address/0xb428F0ad708778Ca6318C51340509430e63ea346) |
| Contract | Address |
| ------------------------ | ------- |
| Caliber | [`0xD1A3c20488899C038B7DAae1EDE0C6DA6C36c326`](https://monadscan.com/address/0xD1A3c20488899C038B7DAae1EDE0C6DA6C36c326) |
| Caliber Mailbox | [`0xb5F39c345b52512c89608B2cd1Bbdc893641d27A`](https://monadscan.com/address/0xb5F39c345b52512c89608B2cd1Bbdc893641d27A) |
| LayerZero Bridge Adapter | [`0xd735b26273D1be5Bc4bCBC3D4B23dfa8568F05d6`](https://monadscan.com/address/0xd735b26273D1be5Bc4bCBC3D4B23dfa8568F05d6) |
Dialectic ETH
DETH
WETH · Ethereum · Base · Arbitrum · Monad
| Contract | Address |
| -------------------------- | ------- |
| Machine | [`0x0447D0aD7FD6a3409B48Ecbb9DDB075C1e11D735`](https://etherscan.io/address/0x0447D0aD7FD6a3409B48Ecbb9DDB075C1e11D735) |
| Machine Token (DETH) | [`0x871aB8E36CaE9AF35c6A3488B049965233DeB7ed`](https://etherscan.io/address/0x871aB8E36CaE9AF35c6A3488B049965233DeB7ed) |
| Accounting Token (WETH) | [`0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`](https://etherscan.io/address/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2) |
| Hub Caliber | [`0xD1A2d9DF5db842DA2Ee81075Fa441602B2352915`](https://etherscan.io/address/0xD1A2d9DF5db842DA2Ee81075Fa441602B2352915) |
| Depositor | [`0x9662d85fdBc68F2218974aabdcdE5e61B59132B0`](https://etherscan.io/address/0x9662d85fdBc68F2218974aabdcdE5e61B59132B0) |
| Redeemer | [`0xE44b62dD3F6379D6d14c38081fe1499D1a56250F`](https://etherscan.io/address/0xE44b62dD3F6379D6d14c38081fe1499D1a56250F) |
| Fee Manager | [`0xA28a77Ed5b51F232C2658B28c4F7998559174e7C`](https://etherscan.io/address/0xA28a77Ed5b51F232C2658B28c4F7998559174e7C) |
| Security Module | [`0x3147675eF8cCA992184CaF2D6c6ecFBd81c39347`](https://etherscan.io/address/0x3147675eF8cCA992184CaF2D6c6ecFBd81c39347) |
| Share Price Oracle | [`0x49fba73738461835fefB19351b161Bde4BcD6b5A`](https://etherscan.io/address/0x49fba73738461835fefB19351b161Bde4BcD6b5A) |
| Pre-Deposit Vault | [`0xEFc8E0fCE12c164eAFcB588915c6F0ca7Ca41A53`](https://etherscan.io/address/0xEFc8E0fCE12c164eAFcB588915c6F0ca7Ca41A53) |
| Pre-Deposit Token (MCwETH) | [`0x9a8bC3B04b7f3D87cfC09ba407dCED575f2d61D8`](https://etherscan.io/address/0x9a8bC3B04b7f3D87cfC09ba407dCED575f2d61D8) |
| Across Bridge Adapter | [`0x01Db41947a55B360333E6182D454fA57c2D112E0`](https://etherscan.io/address/0x01Db41947a55B360333E6182D454fA57c2D112E0) |
| LayerZero Bridge Adapter | [`0xC0060dD77F222A420daA4893B49Bb89983a379D6`](https://etherscan.io/address/0xC0060dD77F222A420daA4893B49Bb89983a379D6) |
| CCTP Bridge Adapter | [`0x2D0Ec3De60a42919B2820ECD3775A5eF55B77D45`](https://etherscan.io/address/0x2D0Ec3De60a42919B2820ECD3775A5eF55B77D45) |
| Contract | Address |
| --------------------- | ------- |
| Caliber | [`0xD1A2d9DF5db842DA2Ee81075Fa441602B2352915`](https://basescan.org/address/0xD1A2d9DF5db842DA2Ee81075Fa441602B2352915) |
| Caliber Mailbox | [`0x7964a2C6f5e5396D2360A761Fc9A811Ea3AfC536`](https://basescan.org/address/0x7964a2C6f5e5396D2360A761Fc9A811Ea3AfC536) |
| Across Bridge Adapter | [`0x01Db41947a55B360333E6182D454fA57c2D112E0`](https://basescan.org/address/0x01Db41947a55B360333E6182D454fA57c2D112E0) |
| Contract | Address |
| --------------------- | ------- |
| Caliber | [`0xD1A2d9DF5db842DA2Ee81075Fa441602B2352915`](https://arbiscan.io/address/0xD1A2d9DF5db842DA2Ee81075Fa441602B2352915) |
| Caliber Mailbox | [`0x7964a2C6f5e5396D2360A761Fc9A811Ea3AfC536`](https://arbiscan.io/address/0x7964a2C6f5e5396D2360A761Fc9A811Ea3AfC536) |
| Across Bridge Adapter | [`0x01Db41947a55B360333E6182D454fA57c2D112E0`](https://arbiscan.io/address/0x01Db41947a55B360333E6182D454fA57c2D112E0) |
| Contract | Address |
| ------------------------ | ------- |
| Caliber | [`0xD1A2d9DF5db842DA2Ee81075Fa441602B2352915`](https://monadscan.com/address/0xD1A2d9DF5db842DA2Ee81075Fa441602B2352915) |
| Caliber Mailbox | [`0x7964a2C6f5e5396D2360A761Fc9A811Ea3AfC536`](https://monadscan.com/address/0x7964a2C6f5e5396D2360A761Fc9A811Ea3AfC536) |
| LayerZero Bridge Adapter | [`0xC0060dD77F222A420daA4893B49Bb89983a379D6`](https://monadscan.com/address/0xC0060dD77F222A420daA4893B49Bb89983a379D6) |
| CCTP Bridge Adapter | [`0x2D0Ec3De60a42919B2820ECD3775A5eF55B77D45`](https://monadscan.com/address/0x2D0Ec3De60a42919B2820ECD3775A5eF55B77D45) |
Dialectic USD
DUSD
USDC · Ethereum · Base · Arbitrum · Monad
| Contract | Address |
| ----------------------------- | ------- |
| Machine | [`0x6b006870C83b1Cd49E766Ac9209f8d68763Df721`](https://etherscan.io/address/0x6b006870C83b1Cd49E766Ac9209f8d68763Df721) |
| Machine Token (DUSD) | [`0x1e33E98aF620F1D563fcD3cfd3C75acE841204ef`](https://etherscan.io/address/0x1e33E98aF620F1D563fcD3cfd3C75acE841204ef) |
| Accounting Token (USDC) | [`0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`](https://etherscan.io/address/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48) |
| Hub Caliber | [`0xD1A1C248B253f1fc60eACd90777B9A63F8c8c1BC`](https://etherscan.io/address/0xD1A1C248B253f1fc60eACd90777B9A63F8c8c1BC) |
| Depositor | [`0x94B1828F91c150C5E6776198e170aCa4304903d7`](https://etherscan.io/address/0x94B1828F91c150C5E6776198e170aCa4304903d7) |
| Redeemer | [`0x1303c26cFE06bac5bfEE29907f37919643DEF75c`](https://etherscan.io/address/0x1303c26cFE06bac5bfEE29907f37919643DEF75c) |
| Fee Manager | [`0xa7f0121375dc52028e333F02715183a1d1a690a7`](https://etherscan.io/address/0xa7f0121375dc52028e333F02715183a1d1a690a7) |
| Security Module | [`0xb8431779dd9d5753b5a7F66afa3C65ABFD8c3fe1`](https://etherscan.io/address/0xb8431779dd9d5753b5a7F66afa3C65ABFD8c3fe1) |
| Share Price Oracle | [`0xFFCBc7A7eEF2796C277095C66067aC749f4cA078`](https://etherscan.io/address/0xFFCBc7A7eEF2796C277095C66067aC749f4cA078) |
| Pre-Deposit Vault | [`0x5dF4CB0AaaE0FCc9dE3F41E72348609e30A49C44`](https://etherscan.io/address/0x5dF4CB0AaaE0FCc9dE3F41E72348609e30A49C44) |
| Pre-Deposit Token (steakUSDC) | [`0xBEEF01735c132Ada46AA9aA4c54623cAA92A64CB`](https://etherscan.io/address/0xBEEF01735c132Ada46AA9aA4c54623cAA92A64CB) |
| Across Bridge Adapter | [`0x4BbfA8FD3407D1C4F3db65B6dC096809f5fA3d99`](https://etherscan.io/address/0x4BbfA8FD3407D1C4F3db65B6dC096809f5fA3d99) |
| LayerZero Bridge Adapter | [`0xB823a5Fd93732563Bf79f83b3DF133A5953Cf7E6`](https://etherscan.io/address/0xB823a5Fd93732563Bf79f83b3DF133A5953Cf7E6) |
| CCTP Bridge Adapter | [`0xa3814497031f81EC932E5196f8D69C284CCFA95D`](https://etherscan.io/address/0xa3814497031f81EC932E5196f8D69C284CCFA95D) |
| Contract | Address |
| --------------------- | ------- |
| Caliber | [`0xD1A1C248B253f1fc60eACd90777B9A63F8c8c1BC`](https://basescan.org/address/0xD1A1C248B253f1fc60eACd90777B9A63F8c8c1BC) |
| Caliber Mailbox | [`0x2e28698A78e852276E94C6558cdBf429557C5904`](https://basescan.org/address/0x2e28698A78e852276E94C6558cdBf429557C5904) |
| Across Bridge Adapter | [`0x4BbfA8FD3407D1C4F3db65B6dC096809f5fA3d99`](https://basescan.org/address/0x4BbfA8FD3407D1C4F3db65B6dC096809f5fA3d99) |
| CCTP Bridge Adapter | [`0xa3814497031f81EC932E5196f8D69C284CCFA95D`](https://basescan.org/address/0xa3814497031f81EC932E5196f8D69C284CCFA95D) |
| Contract | Address |
| --------------------- | ------- |
| Caliber | [`0xD1A1C248B253f1fc60eACd90777B9A63F8c8c1BC`](https://arbiscan.io/address/0xD1A1C248B253f1fc60eACd90777B9A63F8c8c1BC) |
| Caliber Mailbox | [`0x2e28698A78e852276E94C6558cdBf429557C5904`](https://arbiscan.io/address/0x2e28698A78e852276E94C6558cdBf429557C5904) |
| Across Bridge Adapter | [`0x4BbfA8FD3407D1C4F3db65B6dC096809f5fA3d99`](https://arbiscan.io/address/0x4BbfA8FD3407D1C4F3db65B6dC096809f5fA3d99) |
| CCTP Bridge Adapter | [`0xa3814497031f81EC932E5196f8D69C284CCFA95D`](https://arbiscan.io/address/0xa3814497031f81EC932E5196f8D69C284CCFA95D) |
| Contract | Address |
| ------------------------ | ------- |
| Caliber | [`0xD1A1C248B253f1fc60eACd90777B9A63F8c8c1BC`](https://monadscan.com/address/0xD1A1C248B253f1fc60eACd90777B9A63F8c8c1BC) |
| Caliber Mailbox | [`0x2e28698A78e852276E94C6558cdBf429557C5904`](https://monadscan.com/address/0x2e28698A78e852276E94C6558cdBf429557C5904) |
| LayerZero Bridge Adapter | [`0xB823a5Fd93732563Bf79f83b3DF133A5953Cf7E6`](https://monadscan.com/address/0xB823a5Fd93732563Bf79f83b3DF133A5953Cf7E6) |
| CCTP Bridge Adapter | [`0xa3814497031f81EC932E5196f8D69C284CCFA95D`](https://monadscan.com/address/0xa3814497031f81EC932E5196f8D69C284CCFA95D) |
Steakhouse Prop Machine
propSHFmk
USDC · Ethereum · Base · Arbitrum
| Contract | Address |
| ------------------------- | ------- |
| Machine | [`0x2acC8aA53EC354634d0206Aa86F6fe1150b6c46B`](https://etherscan.io/address/0x2acC8aA53EC354634d0206Aa86F6fe1150b6c46B) |
| Machine Token (propSHFmk) | [`0x5dC8304d585B5Fc7831E90c458Bd959Bb41ba373`](https://etherscan.io/address/0x5dC8304d585B5Fc7831E90c458Bd959Bb41ba373) |
| Accounting Token (USDC) | [`0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`](https://etherscan.io/address/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48) |
| Hub Caliber | [`0xbeef112D4F6402502467242278b870bbf292f304`](https://etherscan.io/address/0xbeef112D4F6402502467242278b870bbf292f304) |
| Depositor | [`0x8B7C1dD56eE390ee85036bdfC926b47fdc5E00e8`](https://etherscan.io/address/0x8B7C1dD56eE390ee85036bdfC926b47fdc5E00e8) |
| Redeemer | [`0xfe58c31E54a282524cDE4e0E13459724eD5C9c68`](https://etherscan.io/address/0xfe58c31E54a282524cDE4e0E13459724eD5C9c68) |
| Fee Manager | [`0x31B4a14e51174c50A451bdc7FB680384aD88D70E`](https://etherscan.io/address/0x31B4a14e51174c50A451bdc7FB680384aD88D70E) |
| Across Bridge Adapter | [`0xE63704068b5a68d0Be7B692c8d6ec49a50A3656D`](https://etherscan.io/address/0xE63704068b5a68d0Be7B692c8d6ec49a50A3656D) |
| Contract | Address |
| --------------------- | ------- |
| Caliber | [`0xbeef112D4F6402502467242278b870bbf292f304`](https://basescan.org/address/0xbeef112D4F6402502467242278b870bbf292f304) |
| Caliber Mailbox | [`0x1BA9722b75836E9d8e874cb993c2F1A942e43054`](https://basescan.org/address/0x1BA9722b75836E9d8e874cb993c2F1A942e43054) |
| Across Bridge Adapter | [`0xE63704068b5a68d0Be7B692c8d6ec49a50A3656D`](https://basescan.org/address/0xE63704068b5a68d0Be7B692c8d6ec49a50A3656D) |
| Contract | Address |
| --------------------- | ------- |
| Caliber | [`0xbeef112D4F6402502467242278b870bbf292f304`](https://arbiscan.io/address/0xbeef112D4F6402502467242278b870bbf292f304) |
| Caliber Mailbox | [`0x1BA9722b75836E9d8e874cb993c2F1A942e43054`](https://arbiscan.io/address/0x1BA9722b75836E9d8e874cb993c2F1A942e43054) |
| Across Bridge Adapter | [`0xE63704068b5a68d0Be7B692c8d6ec49a50A3656D`](https://arbiscan.io/address/0xE63704068b5a68d0Be7B692c8d6ec49a50A3656D) |
Steakhouse USD Machine
usdSHFmk
USDC · Ethereum · Base · Arbitrum · Monad
| Contract | Address |
| ------------------------ | ------- |
| Machine | [`0x733aBb32544f4D3053a58eD747538c060f559108`](https://etherscan.io/address/0x733aBb32544f4D3053a58eD747538c060f559108) |
| Machine Token (usdSHFmk) | [`0xaC499adf00A54044b988a59B19016655C3494b06`](https://etherscan.io/address/0xaC499adf00A54044b988a59B19016655C3494b06) |
| Accounting Token (USDC) | [`0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`](https://etherscan.io/address/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48) |
| Hub Caliber | [`0xbeef123217647014429B7670329782e210884E89`](https://etherscan.io/address/0xbeef123217647014429B7670329782e210884E89) |
| Depositor | [`0x45409dE1e21dFD4698bfE8769Ee3F22c60911727`](https://etherscan.io/address/0x45409dE1e21dFD4698bfE8769Ee3F22c60911727) |
| Redeemer | [`0x28713b9102A9a6e3e557276386b450bC8adB1bE3`](https://etherscan.io/address/0x28713b9102A9a6e3e557276386b450bC8adB1bE3) |
| Fee Manager | [`0x459785eAc33B1A52e4c3Da0a2f0102d94b80e14d`](https://etherscan.io/address/0x459785eAc33B1A52e4c3Da0a2f0102d94b80e14d) |
| Across Bridge Adapter | [`0x3a184f550f39187049B70e1800A83F391709db68`](https://etherscan.io/address/0x3a184f550f39187049B70e1800A83F391709db68) |
| LayerZero Bridge Adapter | [`0x0acA3Df87CBa076a32cA3a7369e008EA802CdAb1`](https://etherscan.io/address/0x0acA3Df87CBa076a32cA3a7369e008EA802CdAb1) |
| CCTP Bridge Adapter | [`0x090F062AE90De284bD06eF31bD419f3950459f1b`](https://etherscan.io/address/0x090F062AE90De284bD06eF31bD419f3950459f1b) |
| Contract | Address |
| --------------------- | ------- |
| Caliber | [`0xbeef123217647014429B7670329782e210884E89`](https://basescan.org/address/0xbeef123217647014429B7670329782e210884E89) |
| Caliber Mailbox | [`0x022459cfAf26a865d1fD0cF401c3EfAfB7Ca82fc`](https://basescan.org/address/0x022459cfAf26a865d1fD0cF401c3EfAfB7Ca82fc) |
| Across Bridge Adapter | [`0x3a184f550f39187049B70e1800A83F391709db68`](https://basescan.org/address/0x3a184f550f39187049B70e1800A83F391709db68) |
| CCTP Bridge Adapter | [`0x090F062AE90De284bD06eF31bD419f3950459f1b`](https://basescan.org/address/0x090F062AE90De284bD06eF31bD419f3950459f1b) |
| Contract | Address |
| ------------------------ | ------- |
| Caliber | [`0xbeef123217647014429B7670329782e210884E89`](https://arbiscan.io/address/0xbeef123217647014429B7670329782e210884E89) |
| Caliber Mailbox | [`0x022459cfAf26a865d1fD0cF401c3EfAfB7Ca82fc`](https://arbiscan.io/address/0x022459cfAf26a865d1fD0cF401c3EfAfB7Ca82fc) |
| Across Bridge Adapter | [`0x3a184f550f39187049B70e1800A83F391709db68`](https://arbiscan.io/address/0x3a184f550f39187049B70e1800A83F391709db68) |
| LayerZero Bridge Adapter | [`0x0acA3Df87CBa076a32cA3a7369e008EA802CdAb1`](https://arbiscan.io/address/0x0acA3Df87CBa076a32cA3a7369e008EA802CdAb1) |
| CCTP Bridge Adapter | [`0x090F062AE90De284bD06eF31bD419f3950459f1b`](https://arbiscan.io/address/0x090F062AE90De284bD06eF31bD419f3950459f1b) |
| Contract | Address |
| ------------------------ | ------- |
| Caliber | [`0xbeef123217647014429B7670329782e210884E89`](https://monadscan.com/address/0xbeef123217647014429B7670329782e210884E89) |
| Caliber Mailbox | [`0x022459cfAf26a865d1fD0cF401c3EfAfB7Ca82fc`](https://monadscan.com/address/0x022459cfAf26a865d1fD0cF401c3EfAfB7Ca82fc) |
| LayerZero Bridge Adapter | [`0x0acA3Df87CBa076a32cA3a7369e008EA802CdAb1`](https://monadscan.com/address/0x0acA3Df87CBa076a32cA3a7369e008EA802CdAb1) |
| CCTP Bridge Adapter | [`0x090F062AE90De284bD06eF31bD419f3950459f1b`](https://monadscan.com/address/0x090F062AE90De284bD06eF31bD419f3950459f1b) |
Steakhouse Turbo Machine
turboSHFmk
USDC · Ethereum · Base · Arbitrum
| Contract | Address |
| -------------------------- | ------- |
| Machine | [`0x7a3A49042aE1A2020c69552d49BF5E11B666BfBF`](https://etherscan.io/address/0x7a3A49042aE1A2020c69552d49BF5E11B666BfBF) |
| Machine Token (turboSHFmk) | [`0xA910AC0Ef5D6a1b1E114eb42683031e7B07d0F5D`](https://etherscan.io/address/0xA910AC0Ef5D6a1b1E114eb42683031e7B07d0F5D) |
| Accounting Token (USDC) | [`0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`](https://etherscan.io/address/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48) |
| Hub Caliber | [`0xbeef3ccD0473F70D7e8e09997E1b270EAE197C44`](https://etherscan.io/address/0xbeef3ccD0473F70D7e8e09997E1b270EAE197C44) |
| Depositor | [`0x04481DdeC162AB8E933B586a36df8488a21570F5`](https://etherscan.io/address/0x04481DdeC162AB8E933B586a36df8488a21570F5) |
| Redeemer | [`0x3CF3ab64CFD5748E6a550B8e0DF8BE6cEFDC0Dd8`](https://etherscan.io/address/0x3CF3ab64CFD5748E6a550B8e0DF8BE6cEFDC0Dd8) |
| Fee Manager | [`0x4D3179D0bB78754C1C6908434950b005bA7d58c0`](https://etherscan.io/address/0x4D3179D0bB78754C1C6908434950b005bA7d58c0) |
| Across Bridge Adapter | [`0xF356CfBeD8F3598Ec528454ca929ddb5345794CA`](https://etherscan.io/address/0xF356CfBeD8F3598Ec528454ca929ddb5345794CA) |
| Contract | Address |
| --------------------- | ------- |
| Caliber | [`0xbeef3ccD0473F70D7e8e09997E1b270EAE197C44`](https://basescan.org/address/0xbeef3ccD0473F70D7e8e09997E1b270EAE197C44) |
| Caliber Mailbox | [`0x273a245b36462A733395307F21234feB9aA23C09`](https://basescan.org/address/0x273a245b36462A733395307F21234feB9aA23C09) |
| Across Bridge Adapter | [`0xF356CfBeD8F3598Ec528454ca929ddb5345794CA`](https://basescan.org/address/0xF356CfBeD8F3598Ec528454ca929ddb5345794CA) |
| Contract | Address |
| --------------------- | ------- |
| Caliber | [`0xbeef3ccD0473F70D7e8e09997E1b270EAE197C44`](https://arbiscan.io/address/0xbeef3ccD0473F70D7e8e09997E1b270EAE197C44) |
| Caliber Mailbox | [`0x273a245b36462A733395307F21234feB9aA23C09`](https://arbiscan.io/address/0x273a245b36462A733395307F21234feB9aA23C09) |
| Across Bridge Adapter | [`0xF356CfBeD8F3598Ec528454ca929ddb5345794CA`](https://arbiscan.io/address/0xF356CfBeD8F3598Ec528454ca929ddb5345794CA) |
Internal Makina Royco wstETH
intMkroywstETH
wstETH · Ethereum
| Contract | Address |
| ------------------------------ | ------- |
| Machine | [`0x0FDF9F1920e160ea8Ae267BdE13e725DeF81E5Ee`](https://etherscan.io/address/0x0FDF9F1920e160ea8Ae267BdE13e725DeF81E5Ee) |
| Machine Token (intMkroywstETH) | [`0xa102533523b23a448969808Dd2D32f0AAea4257a`](https://etherscan.io/address/0xa102533523b23a448969808Dd2D32f0AAea4257a) |
| Accounting Token (wstETH) | [`0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0`](https://etherscan.io/address/0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0) |
| Hub Caliber | [`0x3d8E2497497a3e29Ad5391c08dB2a1b3C32598c0`](https://etherscan.io/address/0x3d8E2497497a3e29Ad5391c08dB2a1b3C32598c0) |
| Depositor & Redeemer | [`0x185313DBb1f3AA2b3fCc603f0EE4cbA753Ef1DD7`](https://etherscan.io/address/0x185313DBb1f3AA2b3fCc603f0EE4cbA753Ef1DD7) |
| Fee Manager | [`0x99A95AC349e44e4747b7e97B699679e4D7E0965D`](https://etherscan.io/address/0x99A95AC349e44e4747b7e97B699679e4D7E0965D) |
Internal Makina Staked Royco wstETH
intMksroywstETH
roywstETH · Ethereum
| Contract | Address |
| ------------------------------- | ------- |
| Machine | [`0x6BE5ea969E18BF4c9DE0A00EC4F226055f46aA7D`](https://etherscan.io/address/0x6BE5ea969E18BF4c9DE0A00EC4F226055f46aA7D) |
| Machine Token (intMksroywstETH) | [`0x7E625188CE3168C515b454B806215474e6A2d73a`](https://etherscan.io/address/0x7E625188CE3168C515b454B806215474e6A2d73a) |
| Accounting Token (roywstETH) | [`0x41Ce72E04D349Eb957bdc373baA9c69207032c56`](https://etherscan.io/address/0x41Ce72E04D349Eb957bdc373baA9c69207032c56) |
| Hub Caliber | [`0x50378ED21f1eCccE89d474c7560C0d62D93ee13c`](https://etherscan.io/address/0x50378ED21f1eCccE89d474c7560C0d62D93ee13c) |
| Depositor & Redeemer | [`0x43c30666baB795Bf567A142e9dD67c59083B86D2`](https://etherscan.io/address/0x43c30666baB795Bf567A142e9dD67c59083B86D2) |
| Fee Manager | [`0xFEaBef3D61b8Db98E5Fa2C46D73B0F5a98909f2d`](https://etherscan.io/address/0xFEaBef3D61b8Db98E5Fa2C46D73B0F5a98909f2d) |
Internal Makina Senior Royco USDC
intMkSrRoyUSDC
USDC · Ethereum · Arbitrum · Base
| Contract | Address |
| ------------------------------ | ------- |
| Machine | [`0xFa097420f0e2C72456B361a1eD85172B9ccd8c38`](https://etherscan.io/address/0xFa097420f0e2C72456B361a1eD85172B9ccd8c38) |
| Machine Token (intMkSrRoyUSDC) | [`0x1004D230aCA4b781d0049AFD6D0b1ee8ed3A6787`](https://etherscan.io/address/0x1004D230aCA4b781d0049AFD6D0b1ee8ed3A6787) |
| Accounting Token (USDC) | [`0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`](https://etherscan.io/address/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48) |
| Hub Caliber | [`0x5476F4E23dAA093Ce6700e1026013c55F7AF9083`](https://etherscan.io/address/0x5476F4E23dAA093Ce6700e1026013c55F7AF9083) |
| Depositor & Redeemer | [`0xc5FeF644d59415cec65049e0653CA10eD9Cba778`](https://etherscan.io/address/0xc5FeF644d59415cec65049e0653CA10eD9Cba778) |
| Fee Manager | [`0xA3401297B6fD2Dd533ceB27f562b4a4602452EC4`](https://etherscan.io/address/0xA3401297B6fD2Dd533ceB27f562b4a4602452EC4) |
| Across Bridge Adapter | [`0xc94d75Dd8e134E4761Ce917fdD0fD1585F0e12a5`](https://etherscan.io/address/0xc94d75Dd8e134E4761Ce917fdD0fD1585F0e12a5) |
| LayerZero Bridge Adapter | [`0x082F71d21fE3A15A888c1De0c95f78071c1A9e04`](https://etherscan.io/address/0x082F71d21fE3A15A888c1De0c95f78071c1A9e04) |
| CCTP Bridge Adapter | [`0x0fdcCe86105aC4DcB9cF30666a35F3Cc1D3fF9B7`](https://etherscan.io/address/0x0fdcCe86105aC4DcB9cF30666a35F3Cc1D3fF9B7) |
| Contract | Address |
| ------------------------ | ------- |
| Caliber | [`0x5476F4E23dAA093Ce6700e1026013c55F7AF9083`](https://arbiscan.io/address/0x5476F4E23dAA093Ce6700e1026013c55F7AF9083) |
| Caliber Mailbox | [`0x81Efb959957B0735A1B25dCF929d4b89579495c6`](https://arbiscan.io/address/0x81Efb959957B0735A1B25dCF929d4b89579495c6) |
| Across Bridge Adapter | [`0xc94d75Dd8e134E4761Ce917fdD0fD1585F0e12a5`](https://arbiscan.io/address/0xc94d75Dd8e134E4761Ce917fdD0fD1585F0e12a5) |
| LayerZero Bridge Adapter | [`0x082F71d21fE3A15A888c1De0c95f78071c1A9e04`](https://arbiscan.io/address/0x082F71d21fE3A15A888c1De0c95f78071c1A9e04) |
| Contract | Address |
| ------------------------ | ------- |
| Caliber | [`0x5476F4E23dAA093Ce6700e1026013c55F7AF9083`](https://basescan.org/address/0x5476F4E23dAA093Ce6700e1026013c55F7AF9083) |
| Caliber Mailbox | [`0x81Efb959957B0735A1B25dCF929d4b89579495c6`](https://basescan.org/address/0x81Efb959957B0735A1B25dCF929d4b89579495c6) |
| Across Bridge Adapter | [`0xc94d75Dd8e134E4761Ce917fdD0fD1585F0e12a5`](https://basescan.org/address/0xc94d75Dd8e134E4761Ce917fdD0fD1585F0e12a5) |
| LayerZero Bridge Adapter | [`0x082F71d21fE3A15A888c1De0c95f78071c1A9e04`](https://basescan.org/address/0x082F71d21fE3A15A888c1De0c95f78071c1A9e04) |
| CCTP Bridge Adapter | [`0x0fdcCe86105aC4DcB9cF30666a35F3Cc1D3fF9B7`](https://basescan.org/address/0x0fdcCe86105aC4DcB9cF30666a35F3Cc1D3fF9B7) |
Dialectic mGLOBAL
DMG
USDC · Ethereum · Base
| Contract | Address |
| ----------------------- | ------- |
| Machine | [`0xC4fFab8540AC27E40D4e2930517aA711e9C00c5b`](https://etherscan.io/address/0xC4fFab8540AC27E40D4e2930517aA711e9C00c5b) |
| Machine Token (DMG) | [`0x761C3B16a5Afdd7A1869C4B979cFF3383d5Fe98B`](https://etherscan.io/address/0x761C3B16a5Afdd7A1869C4B979cFF3383d5Fe98B) |
| Accounting Token (USDC) | [`0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`](https://etherscan.io/address/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48) |
| Hub Caliber | [`0xD36f095556d5717fd9231a2091e8e98bEb7cB621`](https://etherscan.io/address/0xD36f095556d5717fd9231a2091e8e98bEb7cB621) |
| Depositor | [`0xc07b6B56561Ef8E842f36f74a04842284E94BF92`](https://etherscan.io/address/0xc07b6B56561Ef8E842f36f74a04842284E94BF92) |
| Redeemer | [`0xc4ecAf359a6174f9651C5Fcd7b6Fe9ae6b682Ca5`](https://etherscan.io/address/0xc4ecAf359a6174f9651C5Fcd7b6Fe9ae6b682Ca5) |
| Fee Manager | [`0xcBDFcF0c669D7D21A9A5c8657A02Ee3b627fb89d`](https://etherscan.io/address/0xcBDFcF0c669D7D21A9A5c8657A02Ee3b627fb89d) |
| Across Bridge Adapter | [`0x5b63717a01cf6F0dc090F8F61167BCf6e1C6dff6`](https://etherscan.io/address/0x5b63717a01cf6F0dc090F8F61167BCf6e1C6dff6) |
| CCTP Bridge Adapter | [`0x466d89A0bDDDc23BAE82F7909991F5A96A00A8c6`](https://etherscan.io/address/0x466d89A0bDDDc23BAE82F7909991F5A96A00A8c6) |
| Contract | Address |
| --------------------- | ------- |
| Caliber | [`0xD36f095556d5717fd9231a2091e8e98bEb7cB621`](https://basescan.org/address/0xD36f095556d5717fd9231a2091e8e98bEb7cB621) |
| Caliber Mailbox | [`0x8fDdE8207e2F3dbC48C6f3449116B2965304E02A`](https://basescan.org/address/0x8fDdE8207e2F3dbC48C6f3449116B2965304E02A) |
| Across Bridge Adapter | [`0x5b63717a01cf6F0dc090F8F61167BCf6e1C6dff6`](https://basescan.org/address/0x5b63717a01cf6F0dc090F8F61167BCf6e1C6dff6) |
| CCTP Bridge Adapter | [`0x466d89A0bDDDc23BAE82F7909991F5A96A00A8c6`](https://basescan.org/address/0x466d89A0bDDDc23BAE82F7909991F5A96A00A8c6) |
Dialectic Queue Arbitrage eEth
DQAeETH
WETH · Ethereum
| Contract | Address |
| ----------------------- | ------- |
| Machine | [`0x165afd0b156355D9D51e9E6Ab317a96787Fb6271`](https://etherscan.io/address/0x165afd0b156355D9D51e9E6Ab317a96787Fb6271) |
| Machine Token (DQAeETH) | [`0x2b24dFcE3a6AEF36E147C692Fa32d484ec538FC1`](https://etherscan.io/address/0x2b24dFcE3a6AEF36E147C692Fa32d484ec538FC1) |
| Accounting Token (WETH) | [`0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`](https://etherscan.io/address/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2) |
| Hub Caliber | [`0xD1A557Fe9d49D047A2318c05a13523e4B9E56e09`](https://etherscan.io/address/0xD1A557Fe9d49D047A2318c05a13523e4B9E56e09) |
| Depositor | [`0x51ffd9806E72822d786AE63455c0f4FdDe49A7B0`](https://etherscan.io/address/0x51ffd9806E72822d786AE63455c0f4FdDe49A7B0) |
| Redeemer | [`0x2237919da69562e47fd2917e933330c87634E61E`](https://etherscan.io/address/0x2237919da69562e47fd2917e933330c87634E61E) |
| Fee Manager | [`0xF72Ea512890a006bb67179083a3CEb9401a48Ae8`](https://etherscan.io/address/0xF72Ea512890a006bb67179083a3CEb9401a48Ae8) |
Dialectic mWIN
DMW
USDC · Ethereum
| Contract | Address |
| ----------------------- | ------- |
| Machine | [`0x2FEEf245d510A31B242705ff627447Aa9db661E3`](https://etherscan.io/address/0x2FEEf245d510A31B242705ff627447Aa9db661E3) |
| Machine Token (DMW) | [`0x0DD85BBe17e96f2E96eBa90A8c6Fef89dd9501A1`](https://etherscan.io/address/0x0DD85BBe17e96f2E96eBa90A8c6Fef89dd9501A1) |
| Accounting Token (USDC) | [`0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`](https://etherscan.io/address/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48) |
| Hub Caliber | [`0xa58CF14f5980c5f8726E10C5596EC1d91AD44efa`](https://etherscan.io/address/0xa58CF14f5980c5f8726E10C5596EC1d91AD44efa) |
| Depositor | [`0xce205b5430Cd4bB207C28A2f161e97142153F127`](https://etherscan.io/address/0xce205b5430Cd4bB207C28A2f161e97142153F127) |
| Redeemer | [`0xCC0F0983A96Afe7e6Ae5195D5BF59a108adC9553`](https://etherscan.io/address/0xCC0F0983A96Afe7e6Ae5195D5BF59a108adC9553) |
| Fee Manager | [`0x68540768f56B813291921C1AE5DF57f9bF92a7e3`](https://etherscan.io/address/0x68540768f56B813291921C1AE5DF57f9bF92a7e3) |
Dialectic Carry Machine
DCM
USDC · Ethereum
| Contract | Address |
| ------------------------ | ------- |
| Machine | [`0xd2f644d0418126fFCc8F16840ed5D52aa62fd4EB`](https://etherscan.io/address/0xd2f644d0418126fFCc8F16840ed5D52aa62fd4EB) |
| Machine Token (DCM) | [`0xBEf11279fA6dB9fA284cbE7f0fA9799E06B2dcd7`](https://etherscan.io/address/0xBEf11279fA6dB9fA284cbE7f0fA9799E06B2dcd7) |
| Accounting Token (USDC) | [`0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`](https://etherscan.io/address/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48) |
| Hub Caliber | [`0xdc385C31C322351DAc9Ff4D7dED24E29B5D94768`](https://etherscan.io/address/0xdc385C31C322351DAc9Ff4D7dED24E29B5D94768) |
| Depositor | [`0x06738e4E6C948529B0dD9958475502d7814ff234`](https://etherscan.io/address/0x06738e4E6C948529B0dD9958475502d7814ff234) |
| Redeemer | [`0xCE110A8C41be513B8b2e787f3d6CF5685a863b3E`](https://etherscan.io/address/0xCE110A8C41be513B8b2e787f3d6CF5685a863b3E) |
| Fee Manager | [`0x02dC0f38A6E26D06ce954Dc1ceB2828dB4f6ba3a`](https://etherscan.io/address/0x02dC0f38A6E26D06ce954Dc1ceB2828dB4f6ba3a) |
| Across Bridge Adapter | [`0xa6E2e6c43c993680415bb6de4D45B1150A078dAe`](https://etherscan.io/address/0xa6E2e6c43c993680415bb6de4D45B1150A078dAe) |
| LayerZero Bridge Adapter | [`0x18a4c81340a001A7Ca0Daa2B7A5D9Bc81460b46a`](https://etherscan.io/address/0x18a4c81340a001A7Ca0Daa2B7A5D9Bc81460b46a) |
| CCTP Bridge Adapter | [`0xf2cA0A5666818625D82d5eBd09d057e784753963`](https://etherscan.io/address/0xf2cA0A5666818625D82d5eBd09d057e784753963) |
## Base hub
Dialectic Yielding SPCXc
ySPCXc
SPCXc · Base
| Contract | Address |
| ------------------------ | ------- |
| Machine | [`0x47b574313Bf529098e1e55F397bC9D160ba3089c`](https://basescan.org/address/0x47b574313Bf529098e1e55F397bC9D160ba3089c) |
| Machine Token (ySPCXc) | [`0x413f2dcE726b3dc55F309DF92E9B2b34960FFEb8`](https://basescan.org/address/0x413f2dcE726b3dc55F309DF92E9B2b34960FFEb8) |
| Accounting Token (SPCXc) | [`0xb2000000000000000000007b9fcbd005511aCBd5`](https://basescan.org/address/0xb2000000000000000000007b9fcbd005511aCBd5) |
| Hub Caliber | [`0x57A25af7F054Cd8C4f7899f4cbbE4A0D455A57A2`](https://basescan.org/address/0x57A25af7F054Cd8C4f7899f4cbbE4A0D455A57A2) |
| Depositor | [`0x7f290f701F985A49291897B4cce3D757cBc54C80`](https://basescan.org/address/0x7f290f701F985A49291897B4cce3D757cBc54C80) |
| Redeemer | [`0x493837337Db477d2850888b6cdFcdE1133Ad3725`](https://basescan.org/address/0x493837337Db477d2850888b6cdFcdE1133Ad3725) |
| Fee Manager | [`0xbd07c374bD1779d0c792FB21fF3d76096AC9b08f`](https://basescan.org/address/0xbd07c374bD1779d0c792FB21fF3d76096AC9b08f) |
Dialectic Yielding AAPLc
yAAPLc
AAPLc · Base
| Contract | Address |
| ------------------------ | ------- |
| Machine | [`0x2ad7de46614FefEE6702b626dACa480538132510`](https://basescan.org/address/0x2ad7de46614FefEE6702b626dACa480538132510) |
| Machine Token (yAAPLc) | [`0x91Faa9a75aED4CcF3e96f84C50BB9C2A5f3E6d1d`](https://basescan.org/address/0x91Faa9a75aED4CcF3e96f84C50BB9C2A5f3E6d1d) |
| Accounting Token (AAPLc) | [`0xb200000000000000000000C2e324d24d7eEcd1fb`](https://basescan.org/address/0xb200000000000000000000C2e324d24d7eEcd1fb) |
| Hub Caliber | [`0x777678FB8cDA63ebFB98E08d3ed20eF0c29DB94f`](https://basescan.org/address/0x777678FB8cDA63ebFB98E08d3ed20eF0c29DB94f) |
| Depositor | [`0x26Bdb065602dA3525B3a98B2c598650b97C8AB60`](https://basescan.org/address/0x26Bdb065602dA3525B3a98B2c598650b97C8AB60) |
| Redeemer | [`0x2A996c09fc5cd48e0688a234F41177875e0b6C51`](https://basescan.org/address/0x2A996c09fc5cd48e0688a234F41177875e0b6C51) |
| Fee Manager | [`0x865470be73E30bd8C9Ce75a593981961b259cE0e`](https://basescan.org/address/0x865470be73E30bd8C9Ce75a593981961b259cE0e) |
Dialectic Yielding AMZNc
yAMZNc
AMZNc · Base
| Contract | Address |
| ------------------------ | ------- |
| Machine | [`0x55f1B3CB53d2bfbC67F7cb01D3D84d240Af7c2c4`](https://basescan.org/address/0x55f1B3CB53d2bfbC67F7cb01D3D84d240Af7c2c4) |
| Machine Token (yAMZNc) | [`0x2864E4da1e818aAE5982C2D9B7634e459c4e2E86`](https://basescan.org/address/0x2864E4da1e818aAE5982C2D9B7634e459c4e2E86) |
| Accounting Token (AMZNc) | [`0xb200000000000000000000d9192b6B456483C2E8`](https://basescan.org/address/0xb200000000000000000000d9192b6B456483C2E8) |
| Hub Caliber | [`0x7771Bb36365Cc151Db950481D5681C7Ab5Cc8648`](https://basescan.org/address/0x7771Bb36365Cc151Db950481D5681C7Ab5Cc8648) |
| Depositor | [`0xD91E7e63DCA7899c72646a6d0FB145C167cdd18B`](https://basescan.org/address/0xD91E7e63DCA7899c72646a6d0FB145C167cdd18B) |
| Redeemer | [`0x21d6569a214646c3267d089D806d570f2168Eb50`](https://basescan.org/address/0x21d6569a214646c3267d089D806d570f2168Eb50) |
| Fee Manager | [`0x8dc2B7Ef226F108B894E589b9d90dEa89CE5E534`](https://basescan.org/address/0x8dc2B7Ef226F108B894E589b9d90dEa89CE5E534) |
Dialectic Yielding GOOGLc
yGOOGLc
GOOGLc · Base
| Contract | Address |
| ------------------------- | ------- |
| Machine | [`0x82FC5772a6fd76D308444963359c796954Ff3651`](https://basescan.org/address/0x82FC5772a6fd76D308444963359c796954Ff3651) |
| Machine Token (yGOOGLc) | [`0x4fAce8A423fc7C99E10c0dfe92fBd9633aA863fD`](https://basescan.org/address/0x4fAce8A423fc7C99E10c0dfe92fBd9633aA863fD) |
| Accounting Token (GOOGLc) | [`0xb2000000000000000000002D0BA3164cc74f58B7`](https://basescan.org/address/0xb2000000000000000000002D0BA3164cc74f58B7) |
| Hub Caliber | [`0x7773845AdD6ab5921E1D8CF0EA6df23310b069fe`](https://basescan.org/address/0x7773845AdD6ab5921E1D8CF0EA6df23310b069fe) |
| Depositor | [`0x26B50023Bd7e3618020a18bC7F9C6d2A777418AD`](https://basescan.org/address/0x26B50023Bd7e3618020a18bC7F9C6d2A777418AD) |
| Redeemer | [`0x2c42830Da2eF0c240CE599381d5D5483aE1327A6`](https://basescan.org/address/0x2c42830Da2eF0c240CE599381d5D5483aE1327A6) |
| Fee Manager | [`0x2F665a724EaA7d759Fd2cfabe93077D4Fd2C1616`](https://basescan.org/address/0x2F665a724EaA7d759Fd2cfabe93077D4Fd2C1616) |
Dialectic Yielding METAc
yMETAc
METAc · Base
| Contract | Address |
| ------------------------ | ------- |
| Machine | [`0xc4aD7A9146bFEC1E0ce71345199172CA8824A220`](https://basescan.org/address/0xc4aD7A9146bFEC1E0ce71345199172CA8824A220) |
| Machine Token (yMETAc) | [`0x34Ee32b53E8F167240a16b771B54F4D96d454ACD`](https://basescan.org/address/0x34Ee32b53E8F167240a16b771B54F4D96d454ACD) |
| Accounting Token (METAc) | [`0xb2000000000000000000008bC8786B856E61707C`](https://basescan.org/address/0xb2000000000000000000008bC8786B856E61707C) |
| Hub Caliber | [`0x7772edCcC6cbC297917421B6B13963E48f357f66`](https://basescan.org/address/0x7772edCcC6cbC297917421B6B13963E48f357f66) |
| Depositor | [`0x06cC7569b7708D3557B9af9A5E752Decb1AE7bf0`](https://basescan.org/address/0x06cC7569b7708D3557B9af9A5E752Decb1AE7bf0) |
| Redeemer | [`0xac2c363D5bbD9B3C00a3aF013Db89aa1C8322F8C`](https://basescan.org/address/0xac2c363D5bbD9B3C00a3aF013Db89aa1C8322F8C) |
| Fee Manager | [`0xd0b70ec27e7F805d5a3679E5e9C622EBAfA26BB6`](https://basescan.org/address/0xd0b70ec27e7F805d5a3679E5e9C622EBAfA26BB6) |
Dialectic Yielding MSFTc
yMSFTc
MSFTc · Base
| Contract | Address |
| ------------------------ | ------- |
| Machine | [`0x073d562A17815e0266be74CAF15FbBD9D0f9B9a1`](https://basescan.org/address/0x073d562A17815e0266be74CAF15FbBD9D0f9B9a1) |
| Machine Token (yMSFTc) | [`0xAA27E79974EFa53276A866697FFF626f1cd0C7B4`](https://basescan.org/address/0xAA27E79974EFa53276A866697FFF626f1cd0C7B4) |
| Accounting Token (MSFTc) | [`0xB200000000000000000000Ab99cFa739E253872B`](https://basescan.org/address/0xB200000000000000000000Ab99cFa739E253872B) |
| Hub Caliber | [`0x777702e6a7bA5BfFa7bBe033c1444f3FFd208c37`](https://basescan.org/address/0x777702e6a7bA5BfFa7bBe033c1444f3FFd208c37) |
| Depositor | [`0xD72DB733a9D4b90Cf71060a45C2b87aB61400B04`](https://basescan.org/address/0xD72DB733a9D4b90Cf71060a45C2b87aB61400B04) |
| Redeemer | [`0xe547f9F14af41f25C2Cb705404ADCE1a8061f3Ba`](https://basescan.org/address/0xe547f9F14af41f25C2Cb705404ADCE1a8061f3Ba) |
| Fee Manager | [`0xB415Ba8d5A807b07F31c027C3E95403376a38819`](https://basescan.org/address/0xB415Ba8d5A807b07F31c027C3E95403376a38819) |
Dialectic Yielding NVDAc
yNVDAc
NVDAc · Base
| Contract | Address |
| ------------------------ | ------- |
| Machine | [`0x473aD980F67487C03A8cf2A50C2a501C488bF9a3`](https://basescan.org/address/0x473aD980F67487C03A8cf2A50C2a501C488bF9a3) |
| Machine Token (yNVDAc) | [`0xB862067aa005bE1530cB0CEDFdF33658f9Bb1E01`](https://basescan.org/address/0xB862067aa005bE1530cB0CEDFdF33658f9Bb1E01) |
| Accounting Token (NVDAc) | [`0xb20000000000000000000078ee7ce2fE4908108C`](https://basescan.org/address/0xb20000000000000000000078ee7ce2fE4908108C) |
| Hub Caliber | [`0x7775D6DBfC5Cd57E9F78EBcE070EeD11e63640A5`](https://basescan.org/address/0x7775D6DBfC5Cd57E9F78EBcE070EeD11e63640A5) |
| Depositor | [`0xC35dc5e4a2BeF3295E8C7d7b62Be12306000a3f8`](https://basescan.org/address/0xC35dc5e4a2BeF3295E8C7d7b62Be12306000a3f8) |
| Redeemer | [`0x4026E6fBaB698F338046ef86007aE5936aDDa1a7`](https://basescan.org/address/0x4026E6fBaB698F338046ef86007aE5936aDDa1a7) |
| Fee Manager | [`0xF2d34f17599d1FAe163FE9190B854F29c6BbBc49`](https://basescan.org/address/0xF2d34f17599d1FAe163FE9190B854F29c6BbBc49) |
Dialectic Yielding TSLAc
yTSLAc
TSLAc · Base
| Contract | Address |
| ------------------------ | ------- |
| Machine | [`0x584BEC800e3C0AE5B12FC329C9bCb30fD424f758`](https://basescan.org/address/0x584BEC800e3C0AE5B12FC329C9bCb30fD424f758) |
| Machine Token (yTSLAc) | [`0x0dE17a4Ec93e389A501925139E5FeEF30BE3d368`](https://basescan.org/address/0x0dE17a4Ec93e389A501925139E5FeEF30BE3d368) |
| Accounting Token (TSLAc) | [`0xb2000000000000000000001e800a7f5189430cD0`](https://basescan.org/address/0xb2000000000000000000001e800a7f5189430cD0) |
| Hub Caliber | [`0x77741552161B1451214231Af85d3F65d354fDC30`](https://basescan.org/address/0x77741552161B1451214231Af85d3F65d354fDC30) |
| Depositor | [`0x5611666e40798cf7046Adf01D7A60F89299Aaf57`](https://basescan.org/address/0x5611666e40798cf7046Adf01D7A60F89299Aaf57) |
| Redeemer | [`0x3F5666d4d73A4d300bf85aA52c51Aa2243511E0B`](https://basescan.org/address/0x3F5666d4d73A4d300bf85aA52c51Aa2243511E0B) |
| Fee Manager | [`0x5d5eb4d4f139C362e1B56b645fDd727a34e5F4C0`](https://basescan.org/address/0x5d5eb4d4f139C362e1B56b645fDd727a34e5F4C0) |
Base Feeder DCM
bFeederDCM
USDC · Base · Ethereum
| Contract | Address |
| -------------------------- | ------- |
| Machine | [`0x91582e8f7684cB41261BB136C691D82b4EcEDe8A`](https://basescan.org/address/0x91582e8f7684cB41261BB136C691D82b4EcEDe8A) |
| Machine Token (bFeederDCM) | [`0x7244fE8a06848f0F2BDF77CA109C455472175FBF`](https://basescan.org/address/0x7244fE8a06848f0F2BDF77CA109C455472175FBF) |
| Accounting Token (USDC) | [`0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`](https://basescan.org/address/0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913) |
| Hub Caliber | [`0xbfdc3cc9C8916300f546D7b31667731F5f6536e0`](https://basescan.org/address/0xbfdc3cc9C8916300f546D7b31667731F5f6536e0) |
| Depositor | [`0xB9BAFd4ceF6D6D875cF62D9847A703C134f0d57c`](https://basescan.org/address/0xB9BAFd4ceF6D6D875cF62D9847A703C134f0d57c) |
| Redeemer | [`0x236300916876B7bc96Ff7670a44f8937ce1f8aE6`](https://basescan.org/address/0x236300916876B7bc96Ff7670a44f8937ce1f8aE6) |
| Fee Manager | [`0x31Ee9f72c2A3eb67DBbf3200D1b38aBed6312ED0`](https://basescan.org/address/0x31Ee9f72c2A3eb67DBbf3200D1b38aBed6312ED0) |
| Across Bridge Adapter | [`0x1b464132EE72c889D815BbBB7Ce4d9F932b858cb`](https://basescan.org/address/0x1b464132EE72c889D815BbBB7Ce4d9F932b858cb) |
| LayerZero Bridge Adapter | [`0x5E409EA7c87E2e50e920e686228b3AF4f0dDe5eB`](https://basescan.org/address/0x5E409EA7c87E2e50e920e686228b3AF4f0dDe5eB) |
| CCTP Bridge Adapter | [`0xa62160bed3Cb395abbB55Fe9D8032C4b17180420`](https://basescan.org/address/0xa62160bed3Cb395abbB55Fe9D8032C4b17180420) |
| Contract | Address |
| ------------------------ | ------- |
| Caliber | [`0xbfdc3cc9C8916300f546D7b31667731F5f6536e0`](https://etherscan.io/address/0xbfdc3cc9C8916300f546D7b31667731F5f6536e0) |
| Caliber Mailbox | [`0x940259Be771112843981E8D4740c8d84c0b54810`](https://etherscan.io/address/0x940259Be771112843981E8D4740c8d84c0b54810) |
| Across Bridge Adapter | [`0x1b464132EE72c889D815BbBB7Ce4d9F932b858cb`](https://etherscan.io/address/0x1b464132EE72c889D815BbBB7Ce4d9F932b858cb) |
| LayerZero Bridge Adapter | [`0x5E409EA7c87E2e50e920e686228b3AF4f0dDe5eB`](https://etherscan.io/address/0x5E409EA7c87E2e50e920e686228b3AF4f0dDe5eB) |
| CCTP Bridge Adapter | [`0xa62160bed3Cb395abbB55Fe9D8032C4b17180420`](https://etherscan.io/address/0xa62160bed3Cb395abbB55Fe9D8032C4b17180420) |
# Architecture Overview
This section provides a technical overview of Makina's core smart contracts. The diagram below illustrates the core contract interactions on a hub chain and on a spoke chain, distinguishing between protocol-wide contracts shared across all strategies and per-strategy contracts.
```mermaid
flowchart LR
subgraph Hub["Hub chain"]
direction TB
HR["HubCoreRegistry"]:::infra
HF["HubCoreFactory"]:::infra
OR1["OracleRegistry"]:::infra
TR1["TokenRegistry"]:::infra
SW1["SwapModule"]:::infra
M["Machine"]:::strat
MS["MachineShare"]:::strat
PDV["PreDepositVault"]:::strat
HC["Hub Caliber"]:::strat
HBA["Bridge Adapter"]:::strat
HR -.-> HF
HF -- deploys --> M
HF -- deploys --> MS
HF -- deploys --> PDV
HF -- deploys --> HC
HF -- deploys --> HBA
M -.-> OR1
M -.-> TR1
HC -.-> OR1
HC -.-> SW1
M <== funds ==> HC
M <== funds ==> HBA
HC -. accounting .-> M
end
subgraph Spoke["Spoke chain"]
direction TB
SR["SpokeCoreRegistry"]:::infra
SF["SpokeCoreFactory"]:::infra
OR2["OracleRegistry"]:::infra
TR2["TokenRegistry"]:::infra
SW2["SwapModule"]:::infra
MB["Caliber Mailbox"]:::strat
SC["Spoke Caliber"]:::strat
SBA["Bridge Adapter"]:::strat
SR -.-> SF
SF -- deploys --> MB
SF -- deploys --> SC
SF -- deploys --> SBA
MB -.-> TR2
SC -.-> OR2
SC -.-> SW2
MB <== funds ==> SC
MB <== funds ==> SBA
SC -. accounting .-> MB
end
subgraph Off["Off-chain and external"]
direction TB
LB["Liquidity bridge protocol"]:::ext
CRE["Chainlink CRE workflow"]:::ext
FWD["CRE forwarder"]:::ext
end
HBA <== funds ==> LB
LB <== funds ==> SBA
MB -. "accounting snapshot" .-> CRE
CRE -. report .-> FWD
FWD -. "onReport()" .-> M
classDef infra fill:#1f6feb,stroke:#1f6feb,color:#fff;
classDef strat fill:#238636,stroke:#238636,color:#fff;
classDef ext fill:#8957e5,stroke:#8957e5,color:#fff;
```
* **Blue** nodes are protocol-wide contracts, deployed once per chain for an instance; **green** nodes are per-strategy contracts created by the factories; **purple** nodes are external systems.
* Thick arrows are fund transfers, solid arrows are deployments, and dotted arrows are data flows (registry lookups, pricing, swaps, accounting).
* `OracleRegistry` and `TokenRegistry` are shared by every instance present on a chain; the registries, factories, `SwapModule` and beacons are specific to one instance.
# Deployments
Makina runs as **instances**: a hub chain that hosts Machines, plus the spoke chains its Calibers can expand to. Each instance has its own core registry, factory, beacons and swap module. Chain-scoped infrastructure (AccessManager, OracleRegistry, TokenRegistry and the bridge configs) is deployed once per chain and shared by every instance present on that chain.
:::info
For strategy-specific contracts, see the [Strategies](../../strategies/deployments) page.
:::
## Shared infrastructure
Deployed once per chain and used by every instance on that chain. Addresses are identical on all chains.
| Contract | Address |
| ----------------------- | ------- |
| AccessManager | [`0x0fCEfa3f1047F35521A49cD8B06faBd588665d7F`](https://etherscan.io/address/0x0fCEfa3f1047F35521A49cD8B06faBd588665d7F) |
| OracleRegistry | [`0xC388B72AB90Be82B230D919F9C05c87F9397f485`](https://etherscan.io/address/0xC388B72AB90Be82B230D919F9C05c87F9397f485) |
| TokenRegistry | [`0xd9310A41d085c0DC1E40F691e8647080862A5fd4`](https://etherscan.io/address/0xd9310A41d085c0DC1E40F691e8647080862A5fd4) |
| AcrossV3BridgeConfig | [`0xDdE7FD6f25c9a58c5ec3E278d31e8584f236da86`](https://etherscan.io/address/0xDdE7FD6f25c9a58c5ec3E278d31e8584f236da86) |
| LayerZeroV2BridgeConfig | [`0x1B064336D9C4999C942Ecc36e36d48a411343771`](https://etherscan.io/address/0x1B064336D9C4999C942Ecc36e36d48a411343771) |
| CctpV2BridgeConfig | [`0x09baC7B5a8e5CEeEe21A33642Bc817cF41e80E3D`](https://etherscan.io/address/0x09baC7B5a8e5CEeEe21A33642Bc817cF41e80E3D) |
| Contract | Address |
| ----------------------- | ------- |
| AccessManager | [`0x0fCEfa3f1047F35521A49cD8B06faBd588665d7F`](https://basescan.org/address/0x0fCEfa3f1047F35521A49cD8B06faBd588665d7F) |
| OracleRegistry | [`0xC388B72AB90Be82B230D919F9C05c87F9397f485`](https://basescan.org/address/0xC388B72AB90Be82B230D919F9C05c87F9397f485) |
| TokenRegistry | [`0xd9310A41d085c0DC1E40F691e8647080862A5fd4`](https://basescan.org/address/0xd9310A41d085c0DC1E40F691e8647080862A5fd4) |
| AcrossV3BridgeConfig | [`0xDdE7FD6f25c9a58c5ec3E278d31e8584f236da86`](https://basescan.org/address/0xDdE7FD6f25c9a58c5ec3E278d31e8584f236da86) |
| LayerZeroV2BridgeConfig | [`0x1B064336D9C4999C942Ecc36e36d48a411343771`](https://basescan.org/address/0x1B064336D9C4999C942Ecc36e36d48a411343771) |
| CctpV2BridgeConfig | [`0x09baC7B5a8e5CEeEe21A33642Bc817cF41e80E3D`](https://basescan.org/address/0x09baC7B5a8e5CEeEe21A33642Bc817cF41e80E3D) |
| Contract | Address |
| ----------------------- | ------- |
| AccessManager | [`0x0fCEfa3f1047F35521A49cD8B06faBd588665d7F`](https://arbiscan.io/address/0x0fCEfa3f1047F35521A49cD8B06faBd588665d7F) |
| OracleRegistry | [`0xC388B72AB90Be82B230D919F9C05c87F9397f485`](https://arbiscan.io/address/0xC388B72AB90Be82B230D919F9C05c87F9397f485) |
| TokenRegistry | [`0xd9310A41d085c0DC1E40F691e8647080862A5fd4`](https://arbiscan.io/address/0xd9310A41d085c0DC1E40F691e8647080862A5fd4) |
| AcrossV3BridgeConfig | [`0xDdE7FD6f25c9a58c5ec3E278d31e8584f236da86`](https://arbiscan.io/address/0xDdE7FD6f25c9a58c5ec3E278d31e8584f236da86) |
| LayerZeroV2BridgeConfig | [`0x1B064336D9C4999C942Ecc36e36d48a411343771`](https://arbiscan.io/address/0x1B064336D9C4999C942Ecc36e36d48a411343771) |
| CctpV2BridgeConfig | [`0x09baC7B5a8e5CEeEe21A33642Bc817cF41e80E3D`](https://arbiscan.io/address/0x09baC7B5a8e5CEeEe21A33642Bc817cF41e80E3D) |
| Contract | Address |
| ----------------------- | ------- |
| AccessManager | [`0x0fCEfa3f1047F35521A49cD8B06faBd588665d7F`](https://optimistic.etherscan.io/address/0x0fCEfa3f1047F35521A49cD8B06faBd588665d7F) |
| OracleRegistry | [`0xC388B72AB90Be82B230D919F9C05c87F9397f485`](https://optimistic.etherscan.io/address/0xC388B72AB90Be82B230D919F9C05c87F9397f485) |
| TokenRegistry | [`0xd9310A41d085c0DC1E40F691e8647080862A5fd4`](https://optimistic.etherscan.io/address/0xd9310A41d085c0DC1E40F691e8647080862A5fd4) |
| AcrossV3BridgeConfig | [`0xDdE7FD6f25c9a58c5ec3E278d31e8584f236da86`](https://optimistic.etherscan.io/address/0xDdE7FD6f25c9a58c5ec3E278d31e8584f236da86) |
| LayerZeroV2BridgeConfig | [`0x1B064336D9C4999C942Ecc36e36d48a411343771`](https://optimistic.etherscan.io/address/0x1B064336D9C4999C942Ecc36e36d48a411343771) |
| CctpV2BridgeConfig | [`0x09baC7B5a8e5CEeEe21A33642Bc817cF41e80E3D`](https://optimistic.etherscan.io/address/0x09baC7B5a8e5CEeEe21A33642Bc817cF41e80E3D) |
| Contract | Address |
| ----------------------- | ------- |
| AccessManager | [`0x0fCEfa3f1047F35521A49cD8B06faBd588665d7F`](https://explorer.inkonchain.com/address/0x0fCEfa3f1047F35521A49cD8B06faBd588665d7F) |
| OracleRegistry | [`0xC388B72AB90Be82B230D919F9C05c87F9397f485`](https://explorer.inkonchain.com/address/0xC388B72AB90Be82B230D919F9C05c87F9397f485) |
| TokenRegistry | [`0xd9310A41d085c0DC1E40F691e8647080862A5fd4`](https://explorer.inkonchain.com/address/0xd9310A41d085c0DC1E40F691e8647080862A5fd4) |
| AcrossV3BridgeConfig | [`0xDdE7FD6f25c9a58c5ec3E278d31e8584f236da86`](https://explorer.inkonchain.com/address/0xDdE7FD6f25c9a58c5ec3E278d31e8584f236da86) |
| LayerZeroV2BridgeConfig | [`0x1B064336D9C4999C942Ecc36e36d48a411343771`](https://explorer.inkonchain.com/address/0x1B064336D9C4999C942Ecc36e36d48a411343771) |
| CctpV2BridgeConfig | [`0x09baC7B5a8e5CEeEe21A33642Bc817cF41e80E3D`](https://explorer.inkonchain.com/address/0x09baC7B5a8e5CEeEe21A33642Bc817cF41e80E3D) |
| Contract | Address |
| ----------------------- | ------- |
| AccessManager | [`0x0fCEfa3f1047F35521A49cD8B06faBd588665d7F`](https://monadscan.com/address/0x0fCEfa3f1047F35521A49cD8B06faBd588665d7F) |
| OracleRegistry | [`0xC388B72AB90Be82B230D919F9C05c87F9397f485`](https://monadscan.com/address/0xC388B72AB90Be82B230D919F9C05c87F9397f485) |
| TokenRegistry | [`0xd9310A41d085c0DC1E40F691e8647080862A5fd4`](https://monadscan.com/address/0xd9310A41d085c0DC1E40F691e8647080862A5fd4) |
| AcrossV3BridgeConfig | [`0xDdE7FD6f25c9a58c5ec3E278d31e8584f236da86`](https://monadscan.com/address/0xDdE7FD6f25c9a58c5ec3E278d31e8584f236da86) |
| LayerZeroV2BridgeConfig | [`0x1B064336D9C4999C942Ecc36e36d48a411343771`](https://monadscan.com/address/0x1B064336D9C4999C942Ecc36e36d48a411343771) |
| CctpV2BridgeConfig | [`0x09baC7B5a8e5CEeEe21A33642Bc817cF41e80E3D`](https://monadscan.com/address/0x09baC7B5a8e5CEeEe21A33642Bc817cF41e80E3D) |
## Ethereum hub instance
Hub on Ethereum, spokes on Base, Arbitrum, Optimism, Ink, Monad.
| Contract | Address |
| ------------------------------ | ------- |
| HubCoreRegistry | [`0x0FAEeCEab0BCb63bE2Fe984Ea8c77778989d53eA`](https://etherscan.io/address/0x0FAEeCEab0BCb63bE2Fe984Ea8c77778989d53eA) |
| HubCoreFactory | [`0x8d28A69328561eF9F171c58996fEcB9F494e070c`](https://etherscan.io/address/0x8d28A69328561eF9F171c58996fEcB9F494e070c) |
| SwapModule | [`0x923c98b22F9c367A109E93f7dfBaCa28b20C17C3`](https://etherscan.io/address/0x923c98b22F9c367A109E93f7dfBaCa28b20C17C3) |
| MachineBeacon | [`0x5C680EC39bafE8524F3C2fa9d5F6D65F09Bd7333`](https://etherscan.io/address/0x5C680EC39bafE8524F3C2fa9d5F6D65F09Bd7333) |
| CaliberBeacon | [`0x3f5A881DB86D6f495823028A1e892E7b2CD7e162`](https://etherscan.io/address/0x3f5A881DB86D6f495823028A1e892E7b2CD7e162) |
| PreDepositVaultBeacon | [`0x3793c81F3e0BA4BCf66C88baf266C039f14A54c1`](https://etherscan.io/address/0x3793c81F3e0BA4BCf66C88baf266C039f14A54c1) |
| AcrossV3BridgeAdapterBeacon | [`0x511C3F33417275d060932458DD987bd47c9ca678`](https://etherscan.io/address/0x511C3F33417275d060932458DD987bd47c9ca678) |
| LayerZeroV2BridgeAdapterBeacon | [`0x1108204c18FCB5e0b2b38Cbd3B783b2A56B42467`](https://etherscan.io/address/0x1108204c18FCB5e0b2b38Cbd3B783b2A56B42467) |
| CctpV2BridgeAdapterBeacon | [`0xFD58f8e3569197677CEEB6AaFEb8147b715513CC`](https://etherscan.io/address/0xFD58f8e3569197677CEEB6AaFEb8147b715513CC) |
| Contract | Address |
| ------------------------------ | ------- |
| SpokeCoreRegistry | [`0x0FAEeCEab0BCb63bE2Fe984Ea8c77778989d53eA`](https://basescan.org/address/0x0FAEeCEab0BCb63bE2Fe984Ea8c77778989d53eA) |
| SpokeCoreFactory | [`0x8d28A69328561eF9F171c58996fEcB9F494e070c`](https://basescan.org/address/0x8d28A69328561eF9F171c58996fEcB9F494e070c) |
| SwapModule | [`0x923c98b22F9c367A109E93f7dfBaCa28b20C17C3`](https://basescan.org/address/0x923c98b22F9c367A109E93f7dfBaCa28b20C17C3) |
| CaliberBeacon | [`0x3f5A881DB86D6f495823028A1e892E7b2CD7e162`](https://basescan.org/address/0x3f5A881DB86D6f495823028A1e892E7b2CD7e162) |
| CaliberMailboxBeacon | [`0x2f7101C2EFfa4a2d48A95958F594e3306717a0A0`](https://basescan.org/address/0x2f7101C2EFfa4a2d48A95958F594e3306717a0A0) |
| AcrossV3BridgeAdapterBeacon | [`0x511C3F33417275d060932458DD987bd47c9ca678`](https://basescan.org/address/0x511C3F33417275d060932458DD987bd47c9ca678) |
| LayerZeroV2BridgeAdapterBeacon | [`0x1108204c18FCB5e0b2b38Cbd3B783b2A56B42467`](https://basescan.org/address/0x1108204c18FCB5e0b2b38Cbd3B783b2A56B42467) |
| CctpV2BridgeAdapterBeacon | [`0xFD58f8e3569197677CEEB6AaFEb8147b715513CC`](https://basescan.org/address/0xFD58f8e3569197677CEEB6AaFEb8147b715513CC) |
| Contract | Address |
| ------------------------------ | ------- |
| SpokeCoreRegistry | [`0x0FAEeCEab0BCb63bE2Fe984Ea8c77778989d53eA`](https://arbiscan.io/address/0x0FAEeCEab0BCb63bE2Fe984Ea8c77778989d53eA) |
| SpokeCoreFactory | [`0x8d28A69328561eF9F171c58996fEcB9F494e070c`](https://arbiscan.io/address/0x8d28A69328561eF9F171c58996fEcB9F494e070c) |
| SwapModule | [`0x923c98b22F9c367A109E93f7dfBaCa28b20C17C3`](https://arbiscan.io/address/0x923c98b22F9c367A109E93f7dfBaCa28b20C17C3) |
| CaliberBeacon | [`0x3f5A881DB86D6f495823028A1e892E7b2CD7e162`](https://arbiscan.io/address/0x3f5A881DB86D6f495823028A1e892E7b2CD7e162) |
| CaliberMailboxBeacon | [`0x2f7101C2EFfa4a2d48A95958F594e3306717a0A0`](https://arbiscan.io/address/0x2f7101C2EFfa4a2d48A95958F594e3306717a0A0) |
| AcrossV3BridgeAdapterBeacon | [`0x511C3F33417275d060932458DD987bd47c9ca678`](https://arbiscan.io/address/0x511C3F33417275d060932458DD987bd47c9ca678) |
| LayerZeroV2BridgeAdapterBeacon | [`0x1108204c18FCB5e0b2b38Cbd3B783b2A56B42467`](https://arbiscan.io/address/0x1108204c18FCB5e0b2b38Cbd3B783b2A56B42467) |
| CctpV2BridgeAdapterBeacon | [`0xFD58f8e3569197677CEEB6AaFEb8147b715513CC`](https://arbiscan.io/address/0xFD58f8e3569197677CEEB6AaFEb8147b715513CC) |
| Contract | Address |
| ------------------------------ | ------- |
| SpokeCoreRegistry | [`0x0FAEeCEab0BCb63bE2Fe984Ea8c77778989d53eA`](https://optimistic.etherscan.io/address/0x0FAEeCEab0BCb63bE2Fe984Ea8c77778989d53eA) |
| SpokeCoreFactory | [`0x8d28A69328561eF9F171c58996fEcB9F494e070c`](https://optimistic.etherscan.io/address/0x8d28A69328561eF9F171c58996fEcB9F494e070c) |
| SwapModule | [`0x923c98b22F9c367A109E93f7dfBaCa28b20C17C3`](https://optimistic.etherscan.io/address/0x923c98b22F9c367A109E93f7dfBaCa28b20C17C3) |
| CaliberBeacon | [`0x3f5A881DB86D6f495823028A1e892E7b2CD7e162`](https://optimistic.etherscan.io/address/0x3f5A881DB86D6f495823028A1e892E7b2CD7e162) |
| CaliberMailboxBeacon | [`0x2f7101C2EFfa4a2d48A95958F594e3306717a0A0`](https://optimistic.etherscan.io/address/0x2f7101C2EFfa4a2d48A95958F594e3306717a0A0) |
| AcrossV3BridgeAdapterBeacon | [`0x511C3F33417275d060932458DD987bd47c9ca678`](https://optimistic.etherscan.io/address/0x511C3F33417275d060932458DD987bd47c9ca678) |
| LayerZeroV2BridgeAdapterBeacon | [`0x1108204c18FCB5e0b2b38Cbd3B783b2A56B42467`](https://optimistic.etherscan.io/address/0x1108204c18FCB5e0b2b38Cbd3B783b2A56B42467) |
| CctpV2BridgeAdapterBeacon | [`0xFD58f8e3569197677CEEB6AaFEb8147b715513CC`](https://optimistic.etherscan.io/address/0xFD58f8e3569197677CEEB6AaFEb8147b715513CC) |
| Contract | Address |
| ------------------------------ | ------- |
| SpokeCoreRegistry | [`0x0FAEeCEab0BCb63bE2Fe984Ea8c77778989d53eA`](https://explorer.inkonchain.com/address/0x0FAEeCEab0BCb63bE2Fe984Ea8c77778989d53eA) |
| SpokeCoreFactory | [`0x8d28A69328561eF9F171c58996fEcB9F494e070c`](https://explorer.inkonchain.com/address/0x8d28A69328561eF9F171c58996fEcB9F494e070c) |
| SwapModule | [`0x923c98b22F9c367A109E93f7dfBaCa28b20C17C3`](https://explorer.inkonchain.com/address/0x923c98b22F9c367A109E93f7dfBaCa28b20C17C3) |
| CaliberBeacon | [`0x3f5A881DB86D6f495823028A1e892E7b2CD7e162`](https://explorer.inkonchain.com/address/0x3f5A881DB86D6f495823028A1e892E7b2CD7e162) |
| CaliberMailboxBeacon | [`0x2f7101C2EFfa4a2d48A95958F594e3306717a0A0`](https://explorer.inkonchain.com/address/0x2f7101C2EFfa4a2d48A95958F594e3306717a0A0) |
| AcrossV3BridgeAdapterBeacon | [`0x511C3F33417275d060932458DD987bd47c9ca678`](https://explorer.inkonchain.com/address/0x511C3F33417275d060932458DD987bd47c9ca678) |
| LayerZeroV2BridgeAdapterBeacon | [`0x1108204c18FCB5e0b2b38Cbd3B783b2A56B42467`](https://explorer.inkonchain.com/address/0x1108204c18FCB5e0b2b38Cbd3B783b2A56B42467) |
| CctpV2BridgeAdapterBeacon | [`0xFD58f8e3569197677CEEB6AaFEb8147b715513CC`](https://explorer.inkonchain.com/address/0xFD58f8e3569197677CEEB6AaFEb8147b715513CC) |
| Contract | Address |
| ------------------------------ | ------- |
| SpokeCoreRegistry | [`0x0FAEeCEab0BCb63bE2Fe984Ea8c77778989d53eA`](https://monadscan.com/address/0x0FAEeCEab0BCb63bE2Fe984Ea8c77778989d53eA) |
| SpokeCoreFactory | [`0x8d28A69328561eF9F171c58996fEcB9F494e070c`](https://monadscan.com/address/0x8d28A69328561eF9F171c58996fEcB9F494e070c) |
| SwapModule | [`0x923c98b22F9c367A109E93f7dfBaCa28b20C17C3`](https://monadscan.com/address/0x923c98b22F9c367A109E93f7dfBaCa28b20C17C3) |
| CaliberBeacon | [`0x3f5A881DB86D6f495823028A1e892E7b2CD7e162`](https://monadscan.com/address/0x3f5A881DB86D6f495823028A1e892E7b2CD7e162) |
| CaliberMailboxBeacon | [`0x2f7101C2EFfa4a2d48A95958F594e3306717a0A0`](https://monadscan.com/address/0x2f7101C2EFfa4a2d48A95958F594e3306717a0A0) |
| AcrossV3BridgeAdapterBeacon | [`0x511C3F33417275d060932458DD987bd47c9ca678`](https://monadscan.com/address/0x511C3F33417275d060932458DD987bd47c9ca678) |
| LayerZeroV2BridgeAdapterBeacon | [`0x1108204c18FCB5e0b2b38Cbd3B783b2A56B42467`](https://monadscan.com/address/0x1108204c18FCB5e0b2b38Cbd3B783b2A56B42467) |
| CctpV2BridgeAdapterBeacon | [`0xFD58f8e3569197677CEEB6AaFEb8147b715513CC`](https://monadscan.com/address/0xFD58f8e3569197677CEEB6AaFEb8147b715513CC) |
## Base hub instance
Hub on Base, spokes on Ethereum.
| Contract | Address |
| ------------------------------ | ------- |
| HubCoreRegistry | [`0xCFd878e9A9E17D79f04B4176E624e82fFF78b2cf`](https://basescan.org/address/0xCFd878e9A9E17D79f04B4176E624e82fFF78b2cf) |
| HubCoreFactory | [`0x1E1fa6F5f258b744881634216bDBc612B09C3C30`](https://basescan.org/address/0x1E1fa6F5f258b744881634216bDBc612B09C3C30) |
| SwapModule | [`0xE87596d490f1118DFE64a75498C82B997e539d4b`](https://basescan.org/address/0xE87596d490f1118DFE64a75498C82B997e539d4b) |
| MachineBeacon | [`0x27637175E624938ADbA174c1d88F10B880938382`](https://basescan.org/address/0x27637175E624938ADbA174c1d88F10B880938382) |
| CaliberBeacon | [`0x298158181f0D5B7843C0890F441e7E83a011F582`](https://basescan.org/address/0x298158181f0D5B7843C0890F441e7E83a011F582) |
| PreDepositVaultBeacon | [`0x68df92eCf39758281f36B02806e27Fe6DDeea060`](https://basescan.org/address/0x68df92eCf39758281f36B02806e27Fe6DDeea060) |
| AcrossV3BridgeAdapterBeacon | [`0xD24BD1A6C088e7Ae829A19e9A027A3cdDeb09049`](https://basescan.org/address/0xD24BD1A6C088e7Ae829A19e9A027A3cdDeb09049) |
| LayerZeroV2BridgeAdapterBeacon | [`0x8A07f5cB8185c317314d398a8cC6Ebf497aA5b9b`](https://basescan.org/address/0x8A07f5cB8185c317314d398a8cC6Ebf497aA5b9b) |
| CctpV2BridgeAdapterBeacon | [`0x8d1DcF812cCEDE1B41dfB1e4C25696988F458b8E`](https://basescan.org/address/0x8d1DcF812cCEDE1B41dfB1e4C25696988F458b8E) |
| Contract | Address |
| ------------------------------ | ------- |
| SpokeCoreRegistry | [`0xCFd878e9A9E17D79f04B4176E624e82fFF78b2cf`](https://etherscan.io/address/0xCFd878e9A9E17D79f04B4176E624e82fFF78b2cf) |
| SpokeCoreFactory | [`0x1E1fa6F5f258b744881634216bDBc612B09C3C30`](https://etherscan.io/address/0x1E1fa6F5f258b744881634216bDBc612B09C3C30) |
| SwapModule | [`0xE87596d490f1118DFE64a75498C82B997e539d4b`](https://etherscan.io/address/0xE87596d490f1118DFE64a75498C82B997e539d4b) |
| CaliberBeacon | [`0x298158181f0D5B7843C0890F441e7E83a011F582`](https://etherscan.io/address/0x298158181f0D5B7843C0890F441e7E83a011F582) |
| CaliberMailboxBeacon | [`0x6EB4117d22b7DbD18C97D264bc1B0Ec918c83998`](https://etherscan.io/address/0x6EB4117d22b7DbD18C97D264bc1B0Ec918c83998) |
| AcrossV3BridgeAdapterBeacon | [`0xD24BD1A6C088e7Ae829A19e9A027A3cdDeb09049`](https://etherscan.io/address/0xD24BD1A6C088e7Ae829A19e9A027A3cdDeb09049) |
| LayerZeroV2BridgeAdapterBeacon | [`0x8A07f5cB8185c317314d398a8cC6Ebf497aA5b9b`](https://etherscan.io/address/0x8A07f5cB8185c317314d398a8cC6Ebf497aA5b9b) |
| CctpV2BridgeAdapterBeacon | [`0x8d1DcF812cCEDE1B41dfB1e4C25696988F458b8E`](https://etherscan.io/address/0x8d1DcF812cCEDE1B41dfB1e4C25696988F458b8E) |
# CoreRegistry
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/registries/CoreRegistry.sol)
**Inherits:** AccessManagedUpgradeable, [ICoreRegistry](/contracts/core/interfaces/interface.ICoreRegistry)
## Constants
### CoreRegistryStorageLocation
```solidity
bytes32 private constant CoreRegistryStorageLocation =
0x12dc8e8f7173ac8c2e47b3781b91f41f03f310bb59e154cde6d484a5b5f20300;
```
## Functions
### \_getCoreRegistryStorage
```solidity
function _getCoreRegistryStorage() private pure returns (CoreRegistryStorage storage $);
```
**Returns**
| Name | Type | Description |
| ---- | --------------------- | ----------- |
| \$ | `CoreRegistryStorage` | |
### \_\_CoreRegistry\_init
```solidity
function __CoreRegistry_init(address _oracleRegistry, address _tokenRegistry, address initialAuthority)
internal
onlyInitializing;
```
**Parameters**
| Name | Type | Description |
| ---------------- | --------- | ----------- |
| \_oracleRegistry | `address` | |
| \_tokenRegistry | `address` | |
| initialAuthority | `address` | |
### coreFactory
Address of the core factory.
```solidity
function coreFactory() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### oracleRegistry
Address of the oracle registry.
```solidity
function oracleRegistry() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### tokenRegistry
Address of the token registry.
```solidity
function tokenRegistry() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### swapModule
Address of the swap module.
```solidity
function swapModule() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### flashLoanModule
Address of the flash loan module.
```solidity
function flashLoanModule() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### caliberBeacon
Address of the caliber beacon contract.
```solidity
function caliberBeacon() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### bridgeAdapterBeacon
Bridge ID => Address of the bridge adapter beacon contract.
```solidity
function bridgeAdapterBeacon(uint16 bridgeId) external view override returns (address);
```
**Parameters**
| Name | Type | Description |
| -------- | -------- | ----------- |
| bridgeId | `uint16` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### bridgeConfig
Bridge ID => Address of the bridge config contract.
```solidity
function bridgeConfig(uint16 bridgeId) external view override returns (address);
```
**Parameters**
| Name | Type | Description |
| -------- | -------- | ----------- |
| bridgeId | `uint16` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### setCoreFactory
Sets the core factory address.
```solidity
function setCoreFactory(address _coreFactory) external override restricted;
```
**Parameters**
| Name | Type | Description |
| ------------- | --------- | ------------------------- |
| \_coreFactory | `address` | The core factory address. |
### setOracleRegistry
Sets the oracle registry address.
```solidity
function setOracleRegistry(address _oracleRegistry) external override restricted;
```
**Parameters**
| Name | Type | Description |
| ---------------- | --------- | ---------------------------- |
| \_oracleRegistry | `address` | The oracle registry address. |
### setTokenRegistry
Sets the token registry address.
```solidity
function setTokenRegistry(address _tokenRegistry) external override restricted;
```
**Parameters**
| Name | Type | Description |
| --------------- | --------- | --------------------------- |
| \_tokenRegistry | `address` | The token registry address. |
### setSwapModule
Sets the swap module address.
```solidity
function setSwapModule(address _swapModule) external override restricted;
```
**Parameters**
| Name | Type | Description |
| ------------ | --------- | ------------------------ |
| \_swapModule | `address` | The swap module address. |
### setFlashLoanModule
Sets the flash loan module address.
```solidity
function setFlashLoanModule(address _flashLoanModule) external override restricted;
```
**Parameters**
| Name | Type | Description |
| ----------------- | --------- | ------------------------------ |
| \_flashLoanModule | `address` | The flash loan module address. |
### setCaliberBeacon
Sets the caliber beacon address.
```solidity
function setCaliberBeacon(address _caliberBeacon) external override restricted;
```
**Parameters**
| Name | Type | Description |
| --------------- | --------- | --------------------------- |
| \_caliberBeacon | `address` | The caliber beacon address. |
### setBridgeAdapterBeacon
Sets the bridge adapter beacon address.
```solidity
function setBridgeAdapterBeacon(uint16 bridgeId, address _bridgeAdapterBeacon) external override restricted;
```
**Parameters**
| Name | Type | Description |
| --------------------- | --------- | ---------------------------------- |
| bridgeId | `uint16` | The bridge ID. |
| \_bridgeAdapterBeacon | `address` | The bridge adapter beacon address. |
### setBridgeConfig
Sets the bridge config address.
```solidity
function setBridgeConfig(uint16 bridgeId, address _bridgeConfig) external override restricted;
```
**Parameters**
| Name | Type | Description |
| -------------- | --------- | -------------------------- |
| bridgeId | `uint16` | The bridge ID. |
| \_bridgeConfig | `address` | The bridge config address. |
## Structs
### CoreRegistryStorage
**Note:**
* **storage-location:** erc7201:makina.storage.CoreRegistry
```solidity
struct CoreRegistryStorage {
address _coreFactory;
address _oracleRegistry;
address _tokenRegistry;
address _swapModule;
address _flashLoanModule;
address _caliberBeacon;
mapping(uint16 => address) _bridgeAdapterBeacons;
mapping(uint16 => address) _bridgeConfigs;
}
```
**Properties**
| Name | Type | Description |
| ---------------------- | ---------------------------- | ----------- |
| \_coreFactory | `address` | |
| \_oracleRegistry | `address` | |
| \_tokenRegistry | `address` | |
| \_swapModule | `address` | |
| \_flashLoanModule | `address` | |
| \_caliberBeacon | `address` | |
| \_bridgeAdapterBeacons | `mapping(uint16 => address)` | |
| \_bridgeConfigs | `mapping(uint16 => address)` | |
# HubCoreRegistry
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/registries/HubCoreRegistry.sol)
**Inherits:** [CoreRegistry](/contracts/core/registries/abstract.CoreRegistry), [IHubCoreRegistry](/contracts/core/interfaces/interface.IHubCoreRegistry)
## Constants
### HubCoreRegistryStorageLocation
```solidity
bytes32 private constant HubCoreRegistryStorageLocation =
0x662caa641f82b896df85da03edbf3b36c0e08aa64db68d7994394899aadc4700;
```
## Functions
### \_getHubCoreRegistryStorage
```solidity
function _getHubCoreRegistryStorage() private pure returns (HubCoreRegistryStorage storage $);
```
**Returns**
| Name | Type | Description |
| ---- | ------------------------ | ----------- |
| \$ | `HubCoreRegistryStorage` | |
### constructor
```solidity
constructor();
```
### initialize
```solidity
function initialize(address _oracleRegistry, address _tokenRegistry, address initialAuthority)
external
initializer;
```
**Parameters**
| Name | Type | Description |
| ---------------- | --------- | ----------- |
| \_oracleRegistry | `address` | |
| \_tokenRegistry | `address` | |
| initialAuthority | `address` | |
### machineBeacon
Address of the machine beacon contract.
```solidity
function machineBeacon() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### preDepositVaultBeacon
Address of the pre-deposit vault beacon contract.
```solidity
function preDepositVaultBeacon() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### setMachineBeacon
Sets the machine beacon address.
```solidity
function setMachineBeacon(address _machineBeacon) external override restricted;
```
**Parameters**
| Name | Type | Description |
| --------------- | --------- | --------------------------- |
| \_machineBeacon | `address` | The machine beacon address. |
### setPreDepositVaultBeacon
Sets the pre-deposit vault beacon address.
```solidity
function setPreDepositVaultBeacon(address _preDepositVaultBeacon) external override restricted;
```
**Parameters**
| Name | Type | Description |
| ----------------------- | --------- | ------------------------------------- |
| \_preDepositVaultBeacon | `address` | The pre-deposit vault beacon address. |
## Structs
### HubCoreRegistryStorage
**Note:**
* **storage-location:** erc7201:makina.storage.HubCoreRegistry
```solidity
struct HubCoreRegistryStorage {
address _deprecated_0;
address _machineBeacon;
address _preDepositVaultBeacon;
}
```
**Properties**
| Name | Type | Description |
| ----------------------- | --------- | ----------- |
| \_deprecated\_0 | `address` | |
| \_machineBeacon | `address` | |
| \_preDepositVaultBeacon | `address` | |
# OracleRegistry
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/registries/OracleRegistry.sol)
**Inherits:** AccessManagedUpgradeable, [IOracleRegistry](/contracts/core/interfaces/interface.IOracleRegistry)
## Constants
### OracleRegistryStorageLocation
```solidity
bytes32 private constant OracleRegistryStorageLocation =
0x49c7e86ce354ebbf25fac336f41752d815bcb13797a06a09b85fd6c0c68ea000;
```
## Functions
### \_getOracleRegistryStorage
```solidity
function _getOracleRegistryStorage() private pure returns (OracleRegistryStorage storage $);
```
**Returns**
| Name | Type | Description |
| ---- | ----------------------- | ----------- |
| \$ | `OracleRegistryStorage` | |
### constructor
```solidity
constructor();
```
### initialize
```solidity
function initialize(address initialAuthority) external initializer;
```
**Parameters**
| Name | Type | Description |
| ---------------- | --------- | ----------- |
| initialAuthority | `address` | |
### getFeedStaleThreshold
Feed => Staleness threshold in seconds
```solidity
function getFeedStaleThreshold(address feed) external view override returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ---- | --------- | ----------- |
| feed | `address` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### isFeedRouteRegistered
Token => Is feed route registered for the token
```solidity
function isFeedRouteRegistered(address token) external view override returns (bool);
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ----------- |
| token | `address` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### getFeedRoute
Gets the price feed route for a given token.
```solidity
function getFeedRoute(address token) external view override returns (address, address);
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | --------------------------------------------------------------------- |
| token | `address` | The address of the token for which the price feed route is requested. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ---------------------------------------------------- |
| \ | `address` | feed1 The address of the first price feed. |
| \ | `address` | feed2 The address of the optional second price feed. |
### getPrice
Returns the price of one unit of baseToken in terms of quoteToken.
```solidity
function getPrice(address baseToken, address quoteToken) external view override returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ---------------------------------------------------------- |
| baseToken | `address` | The address of the token for which the price is requested. |
| quoteToken | `address` | The address of the token in which the price is quoted. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ------------------------------------------------------------------------------------------ |
| \ | `uint256` | price The price of baseToken denominated in quoteToken (expressed in quoteToken decimals). |
### setFeedRoute
Sets the price feed route for a given token.
Both feeds, if set, must be Chainlink-interface-compliant.
The combination of feed1 and feed2 must be able to price the token in the reference currency.
If feed2 is set to address(0), the token price in the reference currency is assumed to be returned by feed1.
```solidity
function setFeedRoute(
address token,
address feed1,
uint256 stalenessThreshold1,
address feed2,
uint256 stalenessThreshold2
) external override restricted;
```
**Parameters**
| Name | Type | Description |
| ------------------- | --------- | ---------------------------------------------------------------------------------- |
| token | `address` | The address of the token for which the price feed route is set. |
| feed1 | `address` | The address of the first price feed. |
| stalenessThreshold1 | `uint256` | The staleness threshold for the first price feed. |
| feed2 | `address` | The address of the second price feed. Can be set to address(0). |
| stalenessThreshold2 | `uint256` | The staleness threshold for the second price feed. Ignored if feed2 is address(0). |
### clearFeedRoute
Clears the price feed route for a given token.
Staleness thresholds for the route's feeds are preserved, as the feeds may be used by other routes.
```solidity
function clearFeedRoute(address token) external override restricted;
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ------------------------------------------------------------------- |
| token | `address` | The address of the token for which the price feed route is cleared. |
### setFeedStaleThreshold
Sets the price staleness threshold for a given feed.
```solidity
function setFeedStaleThreshold(address feed, uint256 newThreshold) external override restricted;
```
**Parameters**
| Name | Type | Description |
| ------------ | --------- | --------------------------------------- |
| feed | `address` | The address of the price feed. |
| newThreshold | `uint256` | The new staleness threshold in seconds. |
### \_getFeedPrice
Returns the last price of the feed.
Reverts if the feed is stale or the price is negative.
```solidity
function _getFeedPrice(address feed) private view returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ---- | --------- | ----------- |
| feed | `address` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### \_getFeedDecimals
Returns the number of decimals of the feed.
Returns 0 if the feed is not set.
```solidity
function _getFeedDecimals(address feed) private view returns (uint8);
```
**Parameters**
| Name | Type | Description |
| ---- | --------- | ----------- |
| feed | `address` | |
**Returns**
| Name | Type | Description |
| ------------ | ------- | ----------- |
| \ | `uint8` | |
## Structs
### OracleRegistryStorage
**Note:**
* **storage-location:** erc7201:makina.storage.OracleRegistry
```solidity
struct OracleRegistryStorage {
mapping(address token => FeedRoute feedRoute) _feedRoutes;
mapping(address feed => uint256 stalenessThreshold) _feedStaleThresholds;
}
```
**Properties**
| Name | Type | Description |
| --------------------- | ----------------------------------------------------- | ----------- |
| \_feedRoutes | `mapping(address token => FeedRoute feedRoute)` | |
| \_feedStaleThresholds | `mapping(address feed => uint256 stalenessThreshold)` | |
# SpokeCoreRegistry
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/registries/SpokeCoreRegistry.sol)
**Inherits:** [CoreRegistry](/contracts/core/registries/abstract.CoreRegistry), [ISpokeCoreRegistry](/contracts/core/interfaces/interface.ISpokeCoreRegistry)
## Constants
### SpokeCoreRegistryStorageLocation
```solidity
bytes32 private constant SpokeCoreRegistryStorageLocation =
0xbb04d69665b59d5499b254d643357a8f35f2bcb1c74ee39b02b1345680315500;
```
## Functions
### \_getSpokeCoreRegistryStorage
```solidity
function _getSpokeCoreRegistryStorage() private pure returns (SpokeCoreRegistryStorage storage $);
```
**Returns**
| Name | Type | Description |
| ---- | -------------------------- | ----------- |
| \$ | `SpokeCoreRegistryStorage` | |
### constructor
```solidity
constructor();
```
### initialize
```solidity
function initialize(address _oracleRegistry, address _tokenRegistry, address initialAuthority)
external
initializer;
```
**Parameters**
| Name | Type | Description |
| ---------------- | --------- | ----------- |
| \_oracleRegistry | `address` | |
| \_tokenRegistry | `address` | |
| initialAuthority | `address` | |
### caliberMailboxBeacon
Address of the caliber mailbox beacon.
```solidity
function caliberMailboxBeacon() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### setCaliberMailboxBeacon
Sets the caliber mailbox beacon address.
```solidity
function setCaliberMailboxBeacon(address _caliberMailboxBeacon) external override restricted;
```
**Parameters**
| Name | Type | Description |
| ---------------------- | --------- | ----------------------------------- |
| \_caliberMailboxBeacon | `address` | The caliber mailbox beacon address. |
## Structs
### SpokeCoreRegistryStorage
**Note:**
* **storage-location:** erc7201:makina.storage.SpokeCoreRegistry
```solidity
struct SpokeCoreRegistryStorage {
address _caliberMailboxBeacon;
}
```
**Properties**
| Name | Type | Description |
| ---------------------- | --------- | ----------- |
| \_caliberMailboxBeacon | `address` | |
# TokenRegistry
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/registries/TokenRegistry.sol)
**Inherits:** AccessManagedUpgradeable, [ITokenRegistry](/contracts/core/interfaces/interface.ITokenRegistry)
## Constants
### TokenRegistryStorageLocation
```solidity
bytes32 private constant TokenRegistryStorageLocation =
0x1aeafc547075d7f69f86c9a87aafb3edc5a48d01acbbe220b9a330d69702ed00;
```
## Functions
### \_getTokenRegistryStorage
```solidity
function _getTokenRegistryStorage() private pure returns (TokenRegistryStorage storage $);
```
**Returns**
| Name | Type | Description |
| ---- | ---------------------- | ----------- |
| \$ | `TokenRegistryStorage` | |
### constructor
```solidity
constructor();
```
### initialize
```solidity
function initialize(address initialAuthority) external initializer;
```
**Parameters**
| Name | Type | Description |
| ---------------- | --------- | ----------- |
| initialAuthority | `address` | |
### getForeignToken
Local token address => Foreign EVM chain ID => Foreign Token address
```solidity
function getForeignToken(address localToken, uint256 foreignEvmChainId) external view override returns (address);
```
**Parameters**
| Name | Type | Description |
| ----------------- | --------- | ----------- |
| localToken | `address` | |
| foreignEvmChainId | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### getLocalToken
Foreign token address => Foreign EVM chain ID => Local Token address
```solidity
function getLocalToken(address foreignToken, uint256 foreignEvmChainId) external view override returns (address);
```
**Parameters**
| Name | Type | Description |
| ----------------- | --------- | ----------- |
| foreignToken | `address` | |
| foreignEvmChainId | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### setToken
Associates a local and a foreign token address.
```solidity
function setToken(address localToken, uint256 foreignEvmChainId, address foreignToken)
external
override
restricted;
```
**Parameters**
| Name | Type | Description |
| ----------------- | --------- | -------------------------- |
| localToken | `address` | The local token address. |
| foreignEvmChainId | `uint256` | The foreign EVM chain ID. |
| foreignToken | `address` | The foreign token address. |
## Structs
### TokenRegistryStorage
**Note:**
* **storage-location:** erc7201:makina.storage.TokenRegistry
```solidity
struct TokenRegistryStorage {
mapping(address localToken => mapping(uint256 foreignEvmChainId => address foreignToken)) _localToForeignTokens;
mapping(address foreignToken => mapping(uint256 foreignEvmChainId => address localToken)) _foreignToLocalTokens;
}
```
**Properties**
| Name | Type | Description |
| ---------------------- | ------------------------------------------------------------------------------------------- | ----------- |
| \_localToForeignTokens | `mapping(address localToken => mapping(uint256 foreignEvmChainId => address foreignToken))` | |
| \_foreignToLocalTokens | `mapping(address foreignToken => mapping(uint256 foreignEvmChainId => address localToken))` | |
# BridgeAdapterFactory
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/factories/BridgeAdapterFactory.sol)
**Inherits:** [Create3Factory](/contracts/core/factories/abstract.Create3Factory), [MakinaContext](/contracts/core/utils/abstract.MakinaContext), [IBridgeAdapterFactory](/contracts/core/interfaces/interface.IBridgeAdapterFactory)
## Constants
### BridgeAdapterSaltDomain
```solidity
bytes32 private constant BridgeAdapterSaltDomain =
0xabde28237b51fa1256b2a1c49d990c305c6556881cd721a86b97a8ef9073992c;
```
### BridgeAdapterFactoryStorageLocation
```solidity
bytes32 private constant BridgeAdapterFactoryStorageLocation =
0xe2760819b7b5a09214c04233e2d29582188ee1a80d8fe8c82676ab96abf81c00;
```
## Functions
### \_getBridgeAdapterFactoryStorage
```solidity
function _getBridgeAdapterFactoryStorage() internal pure returns (BridgeAdapterFactoryStorage storage $);
```
**Returns**
| Name | Type | Description |
| ---- | ----------------------------- | ----------- |
| \$ | `BridgeAdapterFactoryStorage` | |
### isBridgeAdapter
Address => Whether this is a BridgeAdapter instance deployed by this factory.
```solidity
function isBridgeAdapter(address adapter) external view override returns (bool);
```
**Parameters**
| Name | Type | Description |
| ------- | --------- | ----------- |
| adapter | `address` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### \_createBridgeAdapter
Internal logic for bridge adapter deployment via create3 and assignment to a bridge controller.
```solidity
function _createBridgeAdapter(address controller, BridgeAdapterInitParams calldata baParams, bytes32 salt)
internal
returns (address);
```
**Parameters**
| Name | Type | Description |
| ---------- | ------------------------- | ----------- |
| controller | `address` | |
| baParams | `BridgeAdapterInitParams` | |
| salt | `bytes32` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
## Structs
### BridgeAdapterFactoryStorage
**Note:**
* **storage-location:** erc7201:makina.storage.BridgeAdapterFactory
```solidity
struct BridgeAdapterFactoryStorage {
mapping(address adapter => bool isBridgeAdapter) _isBridgeAdapter;
}
```
**Properties**
| Name | Type | Description |
| ----------------- | -------------------------------------------------- | ----------- |
| \_isBridgeAdapter | `mapping(address adapter => bool isBridgeAdapter)` | |
# CaliberFactory
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/factories/CaliberFactory.sol)
**Inherits:** [Create3Factory](/contracts/core/factories/abstract.Create3Factory), [MakinaContext](/contracts/core/utils/abstract.MakinaContext), [ICaliberFactory](/contracts/core/interfaces/interface.ICaliberFactory)
## Constants
### CaliberSaltDomain
```solidity
bytes32 private constant CaliberSaltDomain = 0x53f0f8ad4fe517b9d8040b0fb31dfde7b5d276d4ebc6abb801ed7f52ea0563a8;
```
### CaliberFactoryStorageLocation
```solidity
bytes32 private constant CaliberFactoryStorageLocation =
0x092f83b0a9c245bf0116fc4aaf5564ab048ff47d6596f1c61801f18d9dfbea00;
```
## Functions
### \_getCaliberFactoryStorage
```solidity
function _getCaliberFactoryStorage() internal pure returns (CaliberFactoryStorage storage $);
```
**Returns**
| Name | Type | Description |
| ---- | ----------------------- | ----------- |
| \$ | `CaliberFactoryStorage` | |
### isCaliber
Address => Whether this is a Caliber instance deployed by this factory.
```solidity
function isCaliber(address caliber) external view override returns (bool);
```
**Parameters**
| Name | Type | Description |
| ------- | --------- | ----------- |
| caliber | `address` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### \_createCaliber
Internal logic for caliber deployment via create3.
```solidity
function _createCaliber(
ICaliber.CaliberInitParams calldata cParams,
address accountingToken,
address machineEndpoint,
bytes32 salt
) internal returns (address);
```
**Parameters**
| Name | Type | Description |
| --------------- | ---------------------------- | ----------- |
| cParams | `ICaliber.CaliberInitParams` | |
| accountingToken | `address` | |
| machineEndpoint | `address` | |
| salt | `bytes32` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### \_setupCaliberAMFunctionRoles
Sets function roles in associated access manager for a deployed caliber instance.
```solidity
function _setupCaliberAMFunctionRoles(address _authority, address _caliber) internal;
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | ----------- |
| \_authority | `address` | |
| \_caliber | `address` | |
## Structs
### CaliberFactoryStorage
**Note:**
* **storage-location:** erc7201:makina.storage.CaliberFactory
```solidity
struct CaliberFactoryStorage {
mapping(address caliber => bool isCaliber) _isCaliber;
}
```
**Properties**
| Name | Type | Description |
| ----------- | -------------------------------------------- | ----------- |
| \_isCaliber | `mapping(address caliber => bool isCaliber)` | |
# Create3Factory
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/factories/Create3Factory.sol)
Forked from 0xSequence (https://github.com/0xSequence/create3/blob/master/contracts/Create3.sol)
## Constants
### PROXY\_BYTECODE
The bytecode for a contract that proxies the creation of another contract.
If this code is deployed using CREATE2 it can be used to decouple `creationCode` from the child contract address.
The proxy bytecode constant encodes two parts:
1. **Init code** (first table): runs once at deployment, writes the runtime code to memory, and returns it.
2. **Runtime code** (second table): becomes the code stored on-chain; when executed, it forwards calldata and value into a CREATE.
Initcode (runs once at deployment, writes runtime code to memory and returns it):
┌────────────┬───────────────────────┬──────────────────┬──────────────────────┐
│ Opcode │ Opcode + Arguments │ Mnemonic │ Stack View │
├────────────┼───────────────────────┼──────────────────┼──────────────────────┤
│ 0x67 │ 0x67XXXXXXXXXXXXXXXX │ PUSH8 bytecode │ bytecode │
│ 0x3d │ 0x3d │ RETURNDATASIZE │ 0 bytecode │
│ 0x52 │ 0x52 │ MSTORE │ │
│ 0x60 │ 0x6008 │ PUSH1 08 │ 0x08 │
│ 0x60 │ 0x6018 │ PUSH1 18 │ 0x18 0x08 │
│ 0xf3 │ 0xf3 │ RETURN │ │
└────────────┴───────────────────────┴──────────────────┴──────────────────────┘
Runtime code (becomes the code stored on-chain, forwards calldata and value into CREATE):
┌────────────┬───────────────────────┬──────────────────┬──────────────────────┐
│ Opcode │ Opcode + Arguments │ Mnemonic │ Stack │
├────────────┼───────────────────────┼──────────────────┼──────────────────────┤
│ 0x36 │ 0x36 │ CALLDATASIZE │ cds │
│ 0x3d │ 0x3d │ RETURNDATASIZE │ 0 cds │
│ 0x3d │ 0x3d │ RETURNDATASIZE │ 0 0 cds │
│ 0x37 │ 0x37 │ CALLDATACOPY │ │
│ 0x36 │ 0x36 │ CALLDATASIZE │ cds │
│ 0x3d │ 0x3d │ RETURNDATASIZE │ 0 cds │
│ 0x34 │ 0x34 │ CALLVALUE │ value 0 cds │
│ 0xf0 │ 0xf0 │ CREATE │ newContract │
└────────────┴───────────────────────┴──────────────────┴──────────────────────┘
```solidity
bytes internal constant PROXY_BYTECODE = hex"67363d3d37363d34f03d5260086018f3";
```
### PROXY\_BYTECODE\_HASH
keccak256 hash of `PROXY_BYTECODE`.
```solidity
bytes32 internal constant PROXY_BYTECODE_HASH = 0x21c35dbe1b344a2488cf3321d6ce542f8e9f305544ff09e4993a62319a497c1f;
```
## Functions
### \_create3
Creates a new contract using CREATE3.
```solidity
function _create3(bytes32 _saltDomain, bytes32 _salt, bytes memory _initCode) internal returns (address);
```
**Parameters**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \_saltDomain | `bytes32` | |
| \_salt | `bytes32` | |
| \_initCode | `bytes` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### \_computeAddress
Computes the resulting address of a contract deployed via CREATE3 from this factory, using address(this) and the given salt
The address creation formula is: keccak256(rlp(\[keccak256(0xff ++ address(this) ++ \_salt ++ keccak256(initCode))\[12:], 0x01]))
```solidity
function _computeAddress(bytes32 _namespacedSalt) internal view returns (address);
```
**Parameters**
| Name | Type | Description |
| ---------------- | --------- | ----------- |
| \_namespacedSalt | `bytes32` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### \_computeNamespacedSalt
Computes a namespaced salt from a domain and user-provided salt.
```solidity
function _computeNamespacedSalt(bytes32 domain, bytes32 userSalt) internal pure returns (bytes32);
```
**Parameters**
| Name | Type | Description |
| -------- | --------- | ----------- |
| domain | `bytes32` | |
| userSalt | `bytes32` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `bytes32` | |
# HubCoreFactory
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/factories/HubCoreFactory.sol)
**Inherits:** AccessManagedUpgradeable, [CaliberFactory](/contracts/core/factories/abstract.CaliberFactory), [BridgeAdapterFactory](/contracts/core/factories/abstract.BridgeAdapterFactory), [IHubCoreFactory](/contracts/core/interfaces/interface.IHubCoreFactory)
## Constants
### HubCoreFactoryStorageLocation
```solidity
bytes32 private constant HubCoreFactoryStorageLocation =
0xa73526acc519facb543e3fac63cbe361155292db6c01a81eec358613ec9ee100;
```
## Functions
### \_getHubCoreFactoryStorage
```solidity
function _getHubCoreFactoryStorage() internal pure returns (HubCoreFactoryStorage storage $);
```
**Returns**
| Name | Type | Description |
| ---- | ----------------------- | ----------- |
| \$ | `HubCoreFactoryStorage` | |
### constructor
```solidity
constructor(address _registry) MakinaContext(_registry);
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| \_registry | `address` | |
### initialize
```solidity
function initialize(address initialAuthority) external initializer;
```
**Parameters**
| Name | Type | Description |
| ---------------- | --------- | ----------- |
| initialAuthority | `address` | |
### isMachine
Address => Whether this is a Machine instance deployed by this factory.
```solidity
function isMachine(address machine) external view override returns (bool);
```
**Parameters**
| Name | Type | Description |
| ------- | --------- | ----------- |
| machine | `address` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### isPreDepositVault
Address => Whether this is a PreDepositVault instance deployed by this factory.
```solidity
function isPreDepositVault(address preDepositVault) external view override returns (bool);
```
**Parameters**
| Name | Type | Description |
| --------------- | --------- | ----------- |
| preDepositVault | `address` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### createPreDepositVault
Deploys a new PreDepositVault instance.
```solidity
function createPreDepositVault(
IPreDepositVault.PreDepositVaultInitParams calldata params,
address depositToken,
address accountingToken,
string memory tokenName,
string memory tokenSymbol,
bool setupAMFunctionRoles
) external override restricted returns (address);
```
**Parameters**
| Name | Type | Description |
| -------------------- | -------------------------------------------- | ----------------------------------------------------------------------- |
| params | `IPreDepositVault.PreDepositVaultInitParams` | The initialization parameters. |
| depositToken | `address` | The address of the deposit token. |
| accountingToken | `address` | The address of the accounting token. |
| tokenName | `string` | The name of the share token. |
| tokenSymbol | `string` | The symbol of the share token. |
| setupAMFunctionRoles | `bool` | Whether to set roles for restricted functions on the deployed instance. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------------------------------------------------- |
| \ | `address` | The address of the deployed PreDepositVault instance. |
### createMachineFromPreDeposit
Deploys a new Machine instance and migrates an existing PreDepositVault instance to it.
```solidity
function createMachineFromPreDeposit(
IMachine.MachineInitParams calldata mParams,
ICaliber.CaliberInitParams calldata cParams,
IMakinaGovernable.MakinaGovernableInitParams calldata mgParams,
ISpokeSnapshotConsumer.SpokeSnapshotConsumerInitParams calldata sscParams,
BridgeAdapterInitParams[] calldata baParams,
address preDepositVault,
bytes32 salt,
bool setupAMFunctionRoles
) external override restricted returns (address);
```
**Parameters**
| Name | Type | Description |
| -------------------- | -------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| mParams | `IMachine.MachineInitParams` | The machine initialization parameters. |
| cParams | `ICaliber.CaliberInitParams` | The caliber initialization parameters. |
| mgParams | `IMakinaGovernable.MakinaGovernableInitParams` | The makina governable initialization parameters. |
| sscParams | `ISpokeSnapshotConsumer.SpokeSnapshotConsumerInitParams` | The spoke snapshot consumer initialization parameters. |
| baParams | `BridgeAdapterInitParams[]` | The list of bridge adapter initialization parameters and controller configuration. |
| preDepositVault | `address` | The address of the PreDepositVault instance to migrate. |
| salt | `bytes32` | The salt used to deploy the hub caliber deterministically. |
| setupAMFunctionRoles | `bool` | Whether to set roles for restricted functions on the deployed instance. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | --------------------------------------------- |
| \ | `address` | The address of the deployed Machine instance. |
### createMachine
Deploys a new Machine instance.
```solidity
function createMachine(
IMachine.MachineInitParams calldata mParams,
ICaliber.CaliberInitParams calldata cParams,
IMakinaGovernable.MakinaGovernableInitParams calldata mgParams,
ISpokeSnapshotConsumer.SpokeSnapshotConsumerInitParams calldata sscParams,
BridgeAdapterInitParams[] calldata baParams,
address accountingToken,
string memory tokenName,
string memory tokenSymbol,
bytes32 salt,
bool setupAMFunctionRoles
) external override restricted returns (address);
```
**Parameters**
| Name | Type | Description |
| -------------------- | -------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| mParams | `IMachine.MachineInitParams` | The machine initialization parameters. |
| cParams | `ICaliber.CaliberInitParams` | The caliber initialization parameters. |
| mgParams | `IMakinaGovernable.MakinaGovernableInitParams` | The makina governable initialization parameters. |
| sscParams | `ISpokeSnapshotConsumer.SpokeSnapshotConsumerInitParams` | The spoke snapshot consumer initialization parameters. |
| baParams | `BridgeAdapterInitParams[]` | The list of bridge adapter initialization parameters and controller configuration. |
| accountingToken | `address` | The address of the accounting token. |
| tokenName | `string` | The name of the share token. |
| tokenSymbol | `string` | The symbol of the share token. |
| salt | `bytes32` | The salt used to deploy the hub caliber deterministically. |
| setupAMFunctionRoles | `bool` | Whether to set roles for restricted functions on the deployed instance. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | --------------------------------------------- |
| \ | `address` | The address of the deployed Machine instance. |
### createBridgeAdapter
Deploys a bridge adapter instance.
```solidity
function createBridgeAdapter(address controller, BridgeAdapterInitParams calldata baParams)
external
override
restricted
returns (address);
```
**Parameters**
| Name | Type | Description |
| ---------- | ------------------------- | -------------------------------------------------------------------------- |
| controller | `address` | The address of the bridge controller for which to deploy the adapter. |
| baParams | `BridgeAdapterInitParams` | The bridge adapter initialization parameters and controller configuration. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ------------------------------------------- |
| \ | `address` | The address of the deployed bridge adapter. |
### \_createShareToken
Deploys a machine share token.
```solidity
function _createShareToken(string memory name, string memory symbol, address initialOwner)
internal
returns (address);
```
**Parameters**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| name | `string` | |
| symbol | `string` | |
| initialOwner | `address` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### \_setupPreDepositVaultAMFunctionRoles
Sets function roles for a deployed pre-deposit vault instance in the provided authority.
```solidity
function _setupPreDepositVaultAMFunctionRoles(address _authority, address _preDepositVault) internal;
```
**Parameters**
| Name | Type | Description |
| ----------------- | --------- | ----------- |
| \_authority | `address` | |
| \_preDepositVault | `address` | |
### \_setupMachineBundleAMFunctionRoles
Sets function roles for a deployed machine instance, its hub caliber, and its initial fee manager if applicable, in the provided authority.
```solidity
function _setupMachineBundleAMFunctionRoles(
address _authority,
address _machine,
address _caliber,
address _initialFeeManager
) internal;
```
**Parameters**
| Name | Type | Description |
| ------------------- | --------- | ----------- |
| \_authority | `address` | |
| \_machine | `address` | |
| \_caliber | `address` | |
| \_initialFeeManager | `address` | |
### \_setupMachineAMFunctionRoles
Sets function roles for a deployed machine instance.
```solidity
function _setupMachineAMFunctionRoles(address _authority, address _machine) internal;
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | ----------- |
| \_authority | `address` | |
| \_machine | `address` | |
### \_setupInitialFeeManagerAMFunctionRoles
Sets function roles for the initial fee manager of a deployed machine instance if applicable.
```solidity
function _setupInitialFeeManagerAMFunctionRoles(address _authority, address _feeManager) internal;
```
**Parameters**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \_authority | `address` | |
| \_feeManager | `address` | |
### \_checkAuthority
Checks that the provided authority matches the current authority.
```solidity
function _checkAuthority(address _authority) internal view;
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | ----------- |
| \_authority | `address` | |
## Structs
### HubCoreFactoryStorage
**Note:**
* **storage-location:** erc7201:makina.storage.HubCoreFactory
```solidity
struct HubCoreFactoryStorage {
mapping(address preDepositVault => bool isPreDepositVault) _isPreDepositVault;
mapping(address machine => bool isMachine) _isMachine;
mapping(address machine => bytes32 salt) _instanceSalts;
}
```
**Properties**
| Name | Type | Description |
| ------------------- | ------------------------------------------------------------ | ----------- |
| \_isPreDepositVault | `mapping(address preDepositVault => bool isPreDepositVault)` | |
| \_isMachine | `mapping(address machine => bool isMachine)` | |
| \_instanceSalts | `mapping(address machine => bytes32 salt)` | |
# SpokeCoreFactory
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/factories/SpokeCoreFactory.sol)
**Inherits:** AccessManagedUpgradeable, [CaliberFactory](/contracts/core/factories/abstract.CaliberFactory), [BridgeAdapterFactory](/contracts/core/factories/abstract.BridgeAdapterFactory), [ISpokeCoreFactory](/contracts/core/interfaces/interface.ISpokeCoreFactory)
## Constants
### CaliberMailboxSaltDomain
```solidity
bytes32 private constant CaliberMailboxSaltDomain =
0x4b3676c1328bb93bf4cdb2e4a60e8517fd898e78bd01e7956950c3ff62d3872f;
```
### SpokeCoreFactoryStorageLocation
```solidity
bytes32 private constant SpokeCoreFactoryStorageLocation =
0xcb1a6cd67f0aa55e138668b826a3a98a6a6ef973cbafe7a0845e7a69c97a6000;
```
## Functions
### \_getSpokeCoreFactoryStorage
```solidity
function _getSpokeCoreFactoryStorage() internal pure returns (SpokeCoreFactoryStorage storage $);
```
**Returns**
| Name | Type | Description |
| ---- | ------------------------- | ----------- |
| \$ | `SpokeCoreFactoryStorage` | |
### constructor
```solidity
constructor(address _registry) MakinaContext(_registry);
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| \_registry | `address` | |
### initialize
```solidity
function initialize(address initialAuthority) external initializer;
```
**Parameters**
| Name | Type | Description |
| ---------------- | --------- | ----------- |
| initialAuthority | `address` | |
### isCaliberMailbox
Address => Whether this is a CaliberMailbox instance deployed by this factory.
```solidity
function isCaliberMailbox(address caliberMailbox) external view override returns (bool);
```
**Parameters**
| Name | Type | Description |
| -------------- | --------- | ----------- |
| caliberMailbox | `address` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### createCaliber
Deploys a new Caliber instance with an associated CaliberMailbox.
```solidity
function createCaliber(
ICaliber.CaliberInitParams calldata cParams,
IMakinaGovernable.MakinaGovernableInitParams calldata mgParams,
BridgeAdapterInitParams[] calldata baParams,
address accountingToken,
bytes32 salt,
bool setupAMFunctionRoles
) external override restricted returns (address);
```
**Parameters**
| Name | Type | Description |
| -------------------- | ---------------------------------------------- | ---------------------------------------------------------------------------------- |
| cParams | `ICaliber.CaliberInitParams` | The caliber initialization parameters. |
| mgParams | `IMakinaGovernable.MakinaGovernableInitParams` | The makina governable initialization parameters. |
| baParams | `BridgeAdapterInitParams[]` | The list of bridge adapter initialization parameters and controller configuration. |
| accountingToken | `address` | The address of the accounting token. |
| salt | `bytes32` | The salt used to deploy the Caliber deterministically. |
| setupAMFunctionRoles | `bool` | Whether to set roles for restricted functions on the deployed instance. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | --------------------------------------------- |
| \ | `address` | The address of the deployed Caliber instance. |
### createBridgeAdapter
Deploys a bridge adapter instance.
```solidity
function createBridgeAdapter(address controller, BridgeAdapterInitParams calldata baParams)
external
override
restricted
returns (address);
```
**Parameters**
| Name | Type | Description |
| ---------- | ------------------------- | -------------------------------------------------------------------------- |
| controller | `address` | The address of the bridge controller for which to deploy the adapter. |
| baParams | `BridgeAdapterInitParams` | The bridge adapter initialization parameters and controller configuration. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ------------------------------------------- |
| \ | `address` | The address of the deployed bridge adapter. |
### \_createCaliberMailbox
Internal logic for caliber mailbox deployment via create3.
This function only performs the deployment. It does not update factory storage nor emit an event.
```solidity
function _createCaliberMailbox(
IMakinaGovernable.MakinaGovernableInitParams calldata mgParams,
uint256 initialCooldownDuration,
bytes32 salt
) internal returns (address);
```
**Parameters**
| Name | Type | Description |
| ----------------------- | ---------------------------------------------- | ----------- |
| mgParams | `IMakinaGovernable.MakinaGovernableInitParams` | |
| initialCooldownDuration | `uint256` | |
| salt | `bytes32` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### \_setupSpokeCaliberBundleAMFunctionRoles
Sets function roles for a deployed caliber mailbox instance and its associated caliber in the provided authority.
```solidity
function _setupSpokeCaliberBundleAMFunctionRoles(address _authority, address _mailbox, address _caliber) internal;
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | ----------- |
| \_authority | `address` | |
| \_mailbox | `address` | |
| \_caliber | `address` | |
### \_setupCaliberMailboxAMFunctionRoles
Sets function roles in associated access manager for a deployed caliber mailbox instance.
```solidity
function _setupCaliberMailboxAMFunctionRoles(address _authority, address _mailbox) internal;
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | ----------- |
| \_authority | `address` | |
| \_mailbox | `address` | |
### \_checkAuthority
Checks that the provided authority matches the current authority.
```solidity
function _checkAuthority(address _authority) internal view;
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | ----------- |
| \_authority | `address` | |
## Structs
### SpokeCoreFactoryStorage
**Note:**
* **storage-location:** erc7201:makina.storage.SpokeCoreFactory
```solidity
struct SpokeCoreFactoryStorage {
mapping(address mailbox => bool isMailbox) _isCaliberMailbox;
mapping(address mailbox => bytes32 salt) _instanceSalts;
}
```
**Properties**
| Name | Type | Description |
| ------------------ | -------------------------------------------- | ----------- |
| \_isCaliberMailbox | `mapping(address mailbox => bool isMailbox)` | |
| \_instanceSalts | `mapping(address mailbox => bytes32 salt)` | |
# Machine
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/machine/Machine.sol)
**Inherits:** [MakinaGovernable](/contracts/core/utils/abstract.MakinaGovernable), [BridgeController](/contracts/core/bridge/controller/abstract.BridgeController), [SpokeSnapshotConsumer](/contracts/core/utils/abstract.SpokeSnapshotConsumer), ReentrancyGuard, [IMachine](/contracts/core/interfaces/interface.IMachine)
## Constants
### MachineStorageLocation
```solidity
bytes32 private constant MachineStorageLocation =
0x55fe2a17e400bcd0e2125123a7fc955478e727b29a4c522f4f2bd95d961bd900;
```
## Functions
### \_getMachineStorage
```solidity
function _getMachineStorage() private pure returns (MachineStorage storage $);
```
**Returns**
| Name | Type | Description |
| ---- | ---------------- | ----------- |
| \$ | `MachineStorage` | |
### constructor
```solidity
constructor(address _registry, address _creForwarder)
MakinaContext(_registry)
SpokeSnapshotConsumer(_creForwarder);
```
**Parameters**
| Name | Type | Description |
| -------------- | --------- | ----------- |
| \_registry | `address` | |
| \_creForwarder | `address` | |
### initialize
Initializer of the contract.
```solidity
function initialize(
MachineInitParams calldata mParams,
MakinaGovernableInitParams calldata mgParams,
SpokeSnapshotConsumerInitParams calldata sscParams,
address _preDepositVault,
address _shareToken,
address _accountingToken,
address _hubCaliber
) external override initializer;
```
**Parameters**
| Name | Type | Description |
| ----------------- | --------------------------------- | ------------------------------------------------------ |
| mParams | `MachineInitParams` | The machine initialization parameters. |
| mgParams | `MakinaGovernableInitParams` | The makina governable initialization parameters. |
| sscParams | `SpokeSnapshotConsumerInitParams` | The spoke snapshot consumer initialization parameters. |
| \_preDepositVault | `address` | The address of the pre-deposit vault. |
| \_shareToken | `address` | The address of the share token. |
| \_accountingToken | `address` | The address of the accounting token. |
| \_hubCaliber | `address` | The address of the hub caliber. |
### depositor
Address of the depositor.
```solidity
function depositor() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### redeemer
Address of the redeemer.
```solidity
function redeemer() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### shareToken
Address of the share token.
```solidity
function shareToken() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### accountingToken
Address of the accounting token.
```solidity
function accountingToken() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### hubCaliber
Address of the hub caliber.
```solidity
function hubCaliber() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### feeManager
Address of the fee manager.
```solidity
function feeManager() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### caliberStaleThreshold
Maximum duration a caliber can remain unaccounted for before it is considered stale.
```solidity
function caliberStaleThreshold() external view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### maxFixedFeeAccrualRate
Maximum fixed fee accrual rate per second used to compute an upper bound on shares to be minted, 1e18 = 100%.
```solidity
function maxFixedFeeAccrualRate() external view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### maxPerfFeeAccrualRate
Maximum performance fee accrual rate per second used to compute an upper bound on shares to be minted, 1e18 = 100%.
```solidity
function maxPerfFeeAccrualRate() external view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### feeMintCooldown
Minimum time that must elapse between two fee minting events.
```solidity
function feeMintCooldown() external view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### shareLimit
Share token supply limit that cannot be exceeded by new deposits.
```solidity
function shareLimit() external view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### maxSharePriceChangeRate
Maximum relative share price change rate per second during total AUM updates, 1e18 = 100%.
```solidity
function maxSharePriceChangeRate() external view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### maxMint
Maximum amount of shares that can currently be minted through asset deposits.
```solidity
function maxMint() public view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### maxWithdraw
Maximum amount of accounting tokens that can currently be withdrawn through share redemptions.
```solidity
function maxWithdraw() public view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### lastTotalAum
Last total machine AUM.
```solidity
function lastTotalAum() external view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### lastGlobalAccountingTime
Timestamp of the last global machine accounting.
```solidity
function lastGlobalAccountingTime() external view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### getSpokeCalibersLength
Number of calibers associated with the machine.
```solidity
function getSpokeCalibersLength() external view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### getSpokeChainId
Spoke caliber index => Spoke chain ID.
```solidity
function getSpokeChainId(uint256 idx) external view override returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ---- | --------- | ----------- |
| idx | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### getSpokeCaliberNetAum
Spoke chain ID => Spoke caliber's net AUM and accounting timestamp.
```solidity
function getSpokeCaliberNetAum(uint256 chainId) external view override returns (uint256, uint256);
```
**Parameters**
| Name | Type | Description |
| ------- | --------- | ----------- |
| chainId | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
| \ | `uint256` | |
### getSpokeCaliberMailbox
Spoke chain ID => Spoke caliber mailbox address.
```solidity
function getSpokeCaliberMailbox(uint256 chainId) external view override returns (address);
```
**Parameters**
| Name | Type | Description |
| ------- | --------- | ----------- |
| chainId | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### isSpokeCaliberEnabled
Spoke chain ID => Whether the spoke caliber is enabled.
```solidity
function isSpokeCaliberEnabled(uint256 chainId) external view override returns (bool);
```
**Parameters**
| Name | Type | Description |
| ------- | --------- | ----------- |
| chainId | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### getSpokeBridgeAdapter
Spoke chain ID => Spoke bridge ID => Spoke bridge adapter.
```solidity
function getSpokeBridgeAdapter(uint256 chainId, uint16 bridgeId) external view override returns (address);
```
**Parameters**
| Name | Type | Description |
| -------- | --------- | ----------- |
| chainId | `uint256` | |
| bridgeId | `uint16` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### isIdleToken
Token => Is the token registered as an idle token in this machine.
```solidity
function isIdleToken(address token) external view override returns (bool);
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ----------- |
| token | `address` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### getIdleTokensLength
Length of the idle tokens list.
```solidity
function getIdleTokensLength() external view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### getIdleToken
Idle token index => Idle token address.
There are no guarantees on the ordering of values inside the idle tokens list,
and it may change when values are added or removed.
```solidity
function getIdleToken(uint256 idx) external view override returns (address);
```
**Parameters**
| Name | Type | Description |
| ---- | --------- | ----------- |
| idx | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### convertToShares
Returns the amount of shares that the machine would exchange for the amount of accounting tokens provided.
```solidity
function convertToShares(uint256 assets) public view override returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ------ | --------- | -------------------------------- |
| assets | `uint256` | The amount of accounting tokens. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ---------------------------- |
| \ | `uint256` | shares The amount of shares. |
### convertToAssets
Returns the amount of accounting tokens that the machine would exchange for the amount of shares provided.
```solidity
function convertToAssets(uint256 shares) public view override returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ------ | --------- | --------------------- |
| shares | `uint256` | The amount of shares. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | --------------------------------------- |
| \ | `uint256` | assets The amount of accounting tokens. |
### manageTransfer
Manages the transfer of tokens between a machine and a caliber. The transfer direction depends on the caller.
```solidity
function manageTransfer(address token, uint256 amount, bytes calldata data) external override nonReentrant;
```
**Parameters**
| Name | Type | Description |
| ------ | --------- | -------------------------------------------------------------------------------------------------------------------------- |
| token | `address` | The address of the token. |
| amount | `uint256` | The amount of tokens to transfer. |
| data | `bytes` | ABI-encoded parameters required for bridge-related transfers. Ignored for transfers between a machine and its hub caliber. |
### transferToHubCaliber
Initiates a token transfer to the hub caliber.
```solidity
function transferToHubCaliber(address token, uint256 amount) external override notRecoveryMode onlyMechanic;
```
**Parameters**
| Name | Type | Description |
| ------ | --------- | ------------------------------------- |
| token | `address` | The address of the token to transfer. |
| amount | `uint256` | The amount of token to transfer. |
### transferToSpokeCaliber
Initiates a token transfer to the spoke caliber.
```solidity
function transferToSpokeCaliber(
uint16 bridgeId,
uint256 chainId,
address token,
uint256 amount,
uint256 minOutputAmount
) external override nonReentrant notRecoveryMode onlyMechanic;
```
**Parameters**
| Name | Type | Description |
| --------------- | --------- | ----------------------------------------------------- |
| bridgeId | `uint16` | The ID of the bridge to use for the transfer. |
| chainId | `uint256` | The chain ID of the spoke caliber. |
| token | `address` | The address of the token to transfer. |
| amount | `uint256` | The amount of token to transfer. |
| minOutputAmount | `uint256` | The minimum output amount expected from the transfer. |
### sendOutBridgeTransfer
Executes a scheduled outgoing bridge transfer.
```solidity
function sendOutBridgeTransfer(uint16 bridgeId, uint256 transferId, bytes calldata data)
external
override
notRecoveryMode
onlyMechanic;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ------------------------------------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
| transferId | `uint256` | The ID of the transfer to execute. |
| data | `bytes` | The optional data needed to execute the transfer. |
### authorizeInBridgeTransfer
Registers a message hash as authorized for an incoming bridge transfer.
```solidity
function authorizeInBridgeTransfer(uint16 bridgeId, bytes32 messageHash) external override onlyOperator;
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | ------------------------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
| messageHash | `bytes32` | The hash of the message to authorize. |
### claimInBridgeTransfer
Transfers a received bridge transfer out of the corresponding bridge adapter.
```solidity
function claimInBridgeTransfer(uint16 bridgeId, uint256 transferId) external override onlyOperator;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | -------------------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
| transferId | `uint256` | The ID of the transfer to claim. |
### cancelOutBridgeTransfer
Cancels an outgoing bridge transfer.
```solidity
function cancelOutBridgeTransfer(uint16 bridgeId, uint256 transferId) external override onlyOperator;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | --------------------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
| transferId | `uint256` | The ID of the transfer to cancel. |
### updateTotalAum
Updates the total AUM of the machine.
```solidity
function updateTotalAum() external override nonReentrant onlyAccountingAuthorized returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ------------------------------- |
| \ | `uint256` | totalAum The updated total AUM. |
### deposit
Deposits accounting tokens into the machine and mints shares to the receiver.
```solidity
function deposit(uint256 assets, address receiver, uint256 minShares, bytes32 referralKey)
external
override
nonReentrant
notRecoveryMode
returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | -------------------------------------------------------- |
| assets | `uint256` | The amount of accounting tokens to deposit. |
| receiver | `address` | The receiver of minted shares. |
| minShares | `uint256` | The minimum amount of shares to be minted. |
| referralKey | `bytes32` | The optional identifier used to track a referral source. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------------------------------- |
| \ | `uint256` | shares The amount of shares minted. |
### redeem
Redeems shares from the machine and transfers accounting tokens to the receiver.
```solidity
function redeem(uint256 shares, address receiver, uint256 minAssets)
external
override
nonReentrant
notRecoveryMode
returns (uint256);
```
**Parameters**
| Name | Type | Description |
| --------- | --------- | ---------------------------------------------------------- |
| shares | `uint256` | The amount of shares to redeem. |
| receiver | `address` | The receiver of the accounting tokens. |
| minAssets | `uint256` | The minimum amount of accounting tokens to be transferred. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | --------------------------------------------------- |
| \ | `uint256` | assets The amount of accounting tokens transferred. |
### onReport
```solidity
function onReport(bytes calldata metadata, bytes calldata report) external override nonReentrant;
```
**Parameters**
| Name | Type | Description |
| -------- | ------- | ----------- |
| metadata | `bytes` | |
| report | `bytes` | |
### setSpokeCaliber
Registers a spoke caliber mailbox and related bridge adapters.
```solidity
function setSpokeCaliber(
uint256 chainId,
address spokeCaliberMailbox,
uint16[] calldata bridges,
address[] calldata adapters
) external override nonReentrant restricted;
```
**Parameters**
| Name | Type | Description |
| ------------------- | ----------- | ----------------------------------------------------------------------------------------------- |
| chainId | `uint256` | The chain ID of the spoke caliber. |
| spokeCaliberMailbox | `address` | The address of the spoke caliber mailbox. |
| bridges | `uint16[]` | The list of bridges supported with the spoke caliber mailbox. |
| adapters | `address[]` | The list of corresponding spoke adapters for each bridge. Must be the same length as `bridges`. |
### disableSpokeCaliber
Disables a spoke caliber.
```solidity
function disableSpokeCaliber(uint256 chainId) external override nonReentrant restricted;
```
**Parameters**
| Name | Type | Description |
| ------- | --------- | --------------------------------------------- |
| chainId | `uint256` | The chain ID of the spoke caliber to disable. |
### enableSpokeCaliber
Re-enables a spoke caliber.
```solidity
function enableSpokeCaliber(uint256 chainId) external override nonReentrant restricted;
```
**Parameters**
| Name | Type | Description |
| ------- | --------- | -------------------------------------------- |
| chainId | `uint256` | The chain ID of the spoke caliber to enable. |
### setSpokeBridgeAdapter
Registers a spoke bridge adapter.
```solidity
function setSpokeBridgeAdapter(uint256 chainId, uint16 bridgeId, address adapter)
external
override
nonReentrant
restricted;
```
**Parameters**
| Name | Type | Description |
| -------- | --------- | ----------------------------------------- |
| chainId | `uint256` | The chain ID of the spoke bridge adapter. |
| bridgeId | `uint16` | The ID of the bridge. |
| adapter | `address` | The address of the spoke bridge adapter. |
### setDepositor
Sets the depositor address.
```solidity
function setDepositor(address newDepositor) external override restricted;
```
**Parameters**
| Name | Type | Description |
| ------------ | --------- | --------------------------------- |
| newDepositor | `address` | The address of the new depositor. |
### setRedeemer
Sets the redeemer address.
```solidity
function setRedeemer(address newRedeemer) external override restricted;
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | -------------------------------- |
| newRedeemer | `address` | The address of the new redeemer. |
### setFeeManager
Sets the fee manager address.
```solidity
function setFeeManager(address newFeeManager) external override restricted;
```
**Parameters**
| Name | Type | Description |
| ------------- | --------- | ----------------------------------- |
| newFeeManager | `address` | The address of the new fee manager. |
### setCaliberStaleThreshold
Sets the caliber accounting staleness threshold.
```solidity
function setCaliberStaleThreshold(uint256 newCaliberStaleThreshold) external override onlyRiskManagerTimelock;
```
**Parameters**
| Name | Type | Description |
| ------------------------ | --------- | ----------------------------- |
| newCaliberStaleThreshold | `uint256` | The new threshold in seconds. |
### setMaxFixedFeeAccrualRate
Sets the maximum fixed fee accrual rate.
```solidity
function setMaxFixedFeeAccrualRate(uint256 newMaxAccrualRate) external override onlyRiskManagerTimelock;
```
**Parameters**
| Name | Type | Description |
| ----------------- | --------- | --------------------------------------------------------------- |
| newMaxAccrualRate | `uint256` | The new maximum fixed fee accrual rate per second, 1e18 = 100%. |
### setMaxPerfFeeAccrualRate
Sets the maximum performance fee accrual rate.
```solidity
function setMaxPerfFeeAccrualRate(uint256 newMaxAccrualRate) external override onlyRiskManagerTimelock;
```
**Parameters**
| Name | Type | Description |
| ----------------- | --------- | --------------------------------------------------------------------- |
| newMaxAccrualRate | `uint256` | The new maximum performance fee accrual rate per second, 1e18 = 100%. |
### setFeeMintCooldown
Sets the minimum time to be elapsed between two fee minting events.
```solidity
function setFeeMintCooldown(uint256 newFeeMintCooldown) external override onlyRiskManagerTimelock;
```
**Parameters**
| Name | Type | Description |
| ------------------ | --------- | ---------------------------- |
| newFeeMintCooldown | `uint256` | The new cooldown in seconds. |
### setShareLimit
Sets the new share token supply limit that cannot be exceeded by new deposits.
```solidity
function setShareLimit(uint256 newShareLimit) external override onlyRiskManager;
```
**Parameters**
| Name | Type | Description |
| ------------- | --------- | -------------------- |
| newShareLimit | `uint256` | The new share limit. |
### setMaxSharePriceChangeRate
Sets the new maximum relative share price change rate per second during total AUM updates, 1e18 = 100%.
```solidity
function setMaxSharePriceChangeRate(uint256 newMaxSharePriceChangeRate) external override onlyRiskManagerTimelock;
```
**Parameters**
| Name | Type | Description |
| -------------------------- | --------- | ------------------------------------------------- |
| newMaxSharePriceChangeRate | `uint256` | The new maximum relative share price change rate. |
### disableOutTransfer
Disables outgoing transfers for a bridge.
```solidity
function disableOutTransfer(uint16 bridgeId) external override onlyRiskManagerTimelock;
```
**Parameters**
| Name | Type | Description |
| -------- | -------- | --------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
### enableOutTransfer
Enables outgoing transfers for a bridge.
```solidity
function enableOutTransfer(uint16 bridgeId) external override onlyRiskManagerTimelock;
```
**Parameters**
| Name | Type | Description |
| -------- | -------- | --------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
### setMaxBridgeLossBps
Sets the maximum allowed value loss in basis points for transfers via this bridge.
```solidity
function setMaxBridgeLossBps(uint16 bridgeId, uint256 maxBridgeLossBps) external override onlyRiskManagerTimelock;
```
**Parameters**
| Name | Type | Description |
| ---------------- | --------- | ----------------------------------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
| maxBridgeLossBps | `uint256` | The maximum allowed value loss in basis points. |
### resetBridgingState
Resets internal bridge counters for a given token, and withdraws token balances held by all bridge adapters.
This function is intended to be used by the DAO to realign bridge accounting state and maintain protocol consistency,
typically in response to operator deviations, external bridge discrepancies, or unbounded counter growth.
```solidity
function resetBridgingState(address token) external override nonReentrant onlySecurityCouncil;
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ------------------------- |
| token | `address` | The address of the token. |
### \_setSpokeBridgeAdapter
Sets the spoke bridge adapter for a given chain ID and bridge ID.
```solidity
function _setSpokeBridgeAdapter(uint256 chainId, uint16 bridgeId, address adapter) internal;
```
**Parameters**
| Name | Type | Description |
| -------- | --------- | ----------- |
| chainId | `uint256` | |
| bridgeId | `uint16` | |
| adapter | `address` | |
### \_notifyIdleToken
Checks token balance, and registers token if needed.
```solidity
function _notifyIdleToken(address token) internal;
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ----------- |
| token | `address` | |
## Structs
### MachineStorage
**Note:**
* **storage-location:** erc7201:makina.storage.Machine
```solidity
struct MachineStorage {
address _shareToken;
address _accountingToken;
address _depositor;
address _redeemer;
address _feeManager;
uint256 _caliberStaleThreshold;
uint256 _lastTotalAum;
uint256 _lastGlobalAccountingTime;
uint256 _lastMintedFeesTime;
uint256 _lastMintedFeesSharePrice;
uint256 _maxFixedFeeAccrualRate;
uint256 _maxPerfFeeAccrualRate;
uint256 _feeMintCooldown;
uint256 _shareTokenDecimalsOffset;
uint256 _shareLimit;
uint256 _hubChainId;
address _hubCaliber;
uint256[] _spokeChainIds;
mapping(uint256 chainId => SpokeCaliberData data) _spokeCalibersData;
EnumerableSet.AddressSet _idleTokens;
uint256 _maxSharePriceChangeRate;
}
```
**Properties**
| Name | Type | Description |
| -------------------------- | --------------------------------------------------- | ----------- |
| \_shareToken | `address` | |
| \_accountingToken | `address` | |
| \_depositor | `address` | |
| \_redeemer | `address` | |
| \_feeManager | `address` | |
| \_caliberStaleThreshold | `uint256` | |
| \_lastTotalAum | `uint256` | |
| \_lastGlobalAccountingTime | `uint256` | |
| \_lastMintedFeesTime | `uint256` | |
| \_lastMintedFeesSharePrice | `uint256` | |
| \_maxFixedFeeAccrualRate | `uint256` | |
| \_maxPerfFeeAccrualRate | `uint256` | |
| \_feeMintCooldown | `uint256` | |
| \_shareTokenDecimalsOffset | `uint256` | |
| \_shareLimit | `uint256` | |
| \_hubChainId | `uint256` | |
| \_hubCaliber | `address` | |
| \_spokeChainIds | `uint256[]` | |
| \_spokeCalibersData | `mapping(uint256 chainId => SpokeCaliberData data)` | |
| \_idleTokens | `EnumerableSet.AddressSet` | |
| \_maxSharePriceChangeRate | `uint256` | |
# MachineShare
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/machine/MachineShare.sol)
**Inherits:** ERC20, Ownable2Step, [IMachineShare](/contracts/core/interfaces/interface.IMachineShare)
## Functions
### constructor
```solidity
constructor(string memory _name, string memory _symbol, address _initialMinter)
ERC20(_name, _symbol)
Ownable(_initialMinter);
```
**Parameters**
| Name | Type | Description |
| --------------- | --------- | ----------- |
| \_name | `string` | |
| \_symbol | `string` | |
| \_initialMinter | `address` | |
### decimals
Returns the decimals places of the token.
```solidity
function decimals() public pure override(ERC20, IERC20Metadata) returns (uint8);
```
**Returns**
| Name | Type | Description |
| ------------ | ------- | ----------- |
| \ | `uint8` | |
### minter
Address of the authorized minter and burner.
```solidity
function minter() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### mint
Mints new shares to the specified address.
```solidity
function mint(address to, uint256 amount) external override onlyOwner;
```
**Parameters**
| Name | Type | Description |
| ------ | --------- | ----------------------------------- |
| to | `address` | The recipient of the minted shares. |
| amount | `uint256` | The amount of shares to mint. |
### burn
Burns shares from the specified address.
```solidity
function burn(address from, uint256 amount) external override;
```
**Parameters**
| Name | Type | Description |
| ------ | --------- | -------------------------------- |
| from | `address` | The owner of the shares to burn. |
| amount | `uint256` | The amount of shares to burn. |
# PreDepositVault
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/pre-deposit/PreDepositVault.sol)
**Inherits:** AccessManagedUpgradeable, ReentrancyGuard, [MakinaContext](/contracts/core/utils/abstract.MakinaContext), [IPreDepositVault](/contracts/core/interfaces/interface.IPreDepositVault)
## Constants
### PreDepositVaultStorageLocation
```solidity
bytes32 private constant PreDepositVaultStorageLocation =
0x88ccda4670a9221204e56c6b7ced9d52994799751a70ced770588fb180e5dd00;
```
## Functions
### \_getPreDepositVaultStorage
```solidity
function _getPreDepositVaultStorage() private pure returns (PreDepositVaultStorage storage $);
```
**Returns**
| Name | Type | Description |
| ---- | ------------------------ | ----------- |
| \$ | `PreDepositVaultStorage` | |
### constructor
```solidity
constructor(address _registry) MakinaContext(_registry);
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| \_registry | `address` | |
### initialize
Initializer of the contract.
```solidity
function initialize(
PreDepositVaultInitParams calldata params,
address _shareToken,
address _depositToken,
address _accountingToken
) external override initializer;
```
**Parameters**
| Name | Type | Description |
| ----------------- | --------------------------- | ------------------------------------ |
| params | `PreDepositVaultInitParams` | The initialization parameters. |
| \_shareToken | `address` | The address of the share token. |
| \_depositToken | `address` | The address of the deposit token. |
| \_accountingToken | `address` | The address of the accounting token. |
### onlyRiskManager
```solidity
modifier onlyRiskManager();
```
### notMigrated
```solidity
modifier notMigrated();
```
### migrated
True if the vault has migrated to a machine instance, false otherwise.
```solidity
function migrated() external view override returns (bool);
```
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### machine
Address of the machine, set during migration.
```solidity
function machine() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### riskManager
Address of the risk manager.
```solidity
function riskManager() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### whitelistMode
True if the vault is in whitelist mode, false otherwise.
```solidity
function whitelistMode() external view override returns (bool);
```
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### isWhitelistedUser
User => Whitelisting status.
```solidity
function isWhitelistedUser(address user) external view override returns (bool);
```
**Parameters**
| Name | Type | Description |
| ---- | --------- | ----------- |
| user | `address` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### depositToken
Address of the deposit token.
```solidity
function depositToken() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### accountingToken
Address of the accounting token.
```solidity
function accountingToken() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### shareToken
Address of the share token.
```solidity
function shareToken() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### shareLimit
Share token supply limit that cannot be exceeded by new deposits.
```solidity
function shareLimit() external view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### maxDeposit
Maximum amount of deposit tokens that can currently be deposited in the vault.
```solidity
function maxDeposit() public view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### totalAssets
Total amount of deposit tokens managed by the vault.
```solidity
function totalAssets() external view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### previewDeposit
Amount of shares minted against a given amount of deposit tokens.
```solidity
function previewDeposit(uint256 assets) public view override notMigrated returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ------ | --------- | --------------------------------------------- |
| assets | `uint256` | The amount of deposit tokens to be deposited. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### previewRedeem
Amount of deposit tokens that can be withdrawn against a given amount of shares.
```solidity
function previewRedeem(uint256 shares) public view override notMigrated returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ------ | --------- | ------------------------------------ |
| shares | `uint256` | The amount of shares to be redeemed. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### deposit
Deposits a given amount of deposit tokens and mints shares to the receiver.
```solidity
function deposit(uint256 assets, address receiver, uint256 minShares, bytes32 referralKey)
external
override
nonReentrant
notMigrated
returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | -------------------------------------------------------- |
| assets | `uint256` | The amount of deposit tokens to be deposited. |
| receiver | `address` | The receiver of the shares. |
| minShares | `uint256` | The minimum amount of shares to be minted. |
| referralKey | `bytes32` | The optional identifier used to track a referral source. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------------------------------- |
| \ | `uint256` | shares The amount of shares minted. |
### redeem
Burns exactly shares from caller and transfers the corresponding amount of deposit tokens to the receiver.
```solidity
function redeem(uint256 shares, address receiver, uint256 minAssets)
external
override
nonReentrant
notMigrated
returns (uint256);
```
**Parameters**
| Name | Type | Description |
| --------- | --------- | ------------------------------------------------------- |
| shares | `uint256` | The amount of shares to be redeemed. |
| receiver | `address` | The receiver of withdrawn deposit tokens. |
| minAssets | `uint256` | The minimum amount of deposit tokens to be transferred. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ------------------------------------------------ |
| \ | `uint256` | assets The amount of deposit tokens transferred. |
### migrateToMachine
Migrates the pre-deposit vault to the machine.
```solidity
function migrateToMachine() external override notMigrated;
```
### setPendingMachine
Sets the machine address to migrate to.
```solidity
function setPendingMachine(address _machine) external override notMigrated;
```
**Parameters**
| Name | Type | Description |
| --------- | --------- | --------------------------- |
| \_machine | `address` | The address of the machine. |
### setShareLimit
Sets the new share token supply limit that cannot be exceeded by new deposits.
```solidity
function setShareLimit(uint256 newShareLimit) external override onlyRiskManager notMigrated;
```
**Parameters**
| Name | Type | Description |
| ------------- | --------- | -------------------- |
| newShareLimit | `uint256` | The new share limit. |
### setRiskManager
Sets the risk manager address.
```solidity
function setRiskManager(address newRiskManager) external override restricted notMigrated;
```
**Parameters**
| Name | Type | Description |
| -------------- | --------- | ------------------------------------ |
| newRiskManager | `address` | The address of the new risk manager. |
### setWhitelistedUsers
Whitelist or unwhitelist a list of users.
```solidity
function setWhitelistedUsers(address[] calldata users, bool whitelisted)
external
override
onlyRiskManager
notMigrated;
```
**Parameters**
| Name | Type | Description |
| ----------- | ----------- | -------------------------------------------------- |
| users | `address[]` | The addresses of the users to update. |
| whitelisted | `bool` | True to whitelist the users, false to unwhitelist. |
### setWhitelistMode
Sets the whitelist mode for the vault.
In whitelist mode, only whitelisted users can deposit.
```solidity
function setWhitelistMode(bool enabled) external override onlyRiskManager notMigrated;
```
**Parameters**
| Name | Type | Description |
| ------- | ------ | ------------------------------------------------ |
| enabled | `bool` | True to enable whitelist mode, false to disable. |
## Structs
### PreDepositVaultStorage
**Note:**
* **storage-location:** erc7201:makina.storage.PreDepositVault
```solidity
struct PreDepositVaultStorage {
address _depositToken;
address _accountingToken;
address _shareToken;
uint256 _shareTokenDecimalsOffset;
uint256 _shareLimit;
address _riskManager;
address _machine;
bool _migrated;
bool _whitelistMode;
mapping(address => bool) _isWhitelistedUser;
}
```
**Properties**
| Name | Type | Description |
| -------------------------- | -------------------------- | ----------- |
| \_depositToken | `address` | |
| \_accountingToken | `address` | |
| \_shareToken | `address` | |
| \_shareTokenDecimalsOffset | `uint256` | |
| \_shareLimit | `uint256` | |
| \_riskManager | `address` | |
| \_machine | `address` | |
| \_migrated | `bool` | |
| \_whitelistMode | `bool` | |
| \_isWhitelistedUser | `mapping(address => bool)` | |
# Caliber
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/caliber/Caliber.sol)
**Inherits:** [MakinaContext](/contracts/core/utils/abstract.MakinaContext), AccessManagedUpgradeable, ReentrancyGuard, ERC721Holder, ERC1155Holder, [ICaliber](/contracts/core/interfaces/interface.ICaliber)
## Constants
### MAX\_BPS
Full scale value in basis points.
```solidity
uint256 private constant MAX_BPS = 10_000;
```
### ACCOUNTING\_OUTPUT\_STATE\_END
Flag to indicate end of values in the accounting output state.
```solidity
bytes32 private constant ACCOUNTING_OUTPUT_STATE_END = bytes32(type(uint256).max);
```
### weirollVm
Address of the Weiroll VM.
```solidity
address public immutable weirollVm;
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### CaliberStorageLocation
```solidity
bytes32 private constant CaliberStorageLocation =
0x32461bf02c7aa4aa351cd04411b6c7b9348073fbccf471c7b347bdaada044b00;
```
## Functions
### \_getCaliberStorage
```solidity
function _getCaliberStorage() private pure returns (CaliberStorage storage $);
```
**Returns**
| Name | Type | Description |
| ---- | ---------------- | ----------- |
| \$ | `CaliberStorage` | |
### constructor
```solidity
constructor(address _registry, address _weirollVm) MakinaContext(_registry);
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | ----------- |
| \_registry | `address` | |
| \_weirollVm | `address` | |
### initialize
Initializer of the contract.
```solidity
function initialize(CaliberInitParams calldata cParams, address _accountingToken, address _hubMachineEndpoint)
external
override
initializer;
```
**Parameters**
| Name | Type | Description |
| -------------------- | ------------------- | ---------------------------------------- |
| cParams | `CaliberInitParams` | The caliber initialization parameters. |
| \_accountingToken | `address` | The address of the accounting token. |
| \_hubMachineEndpoint | `address` | The address of the hub machine endpoint. |
### onlyOperator
```solidity
modifier onlyOperator();
```
### onlyRiskManager
```solidity
modifier onlyRiskManager();
```
### onlyRiskManagerTimelock
```solidity
modifier onlyRiskManagerTimelock();
```
### onlyAccountingAuthorized
```solidity
modifier onlyAccountingAuthorized();
```
### authority
Returns the current authority.
```solidity
function authority() public view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### hubMachineEndpoint
Address of the hub machine endpoint.
```solidity
function hubMachineEndpoint() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### accountingToken
Address of the accounting token.
```solidity
function accountingToken() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### positionStaleThreshold
Maximum duration a position can remain unaccounted for before it is considered stale.
```solidity
function positionStaleThreshold() external view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### allowedInstrRoot
Root of the Merkle tree containing allowed instructions.
```solidity
function allowedInstrRoot() public view override returns (bytes32);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `bytes32` | |
### timelockDuration
Duration of the allowedInstrRoot update timelock.
```solidity
function timelockDuration() external view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### pendingAllowedInstrRoot
Value of the pending allowedInstrRoot, if any.
```solidity
function pendingAllowedInstrRoot() public view override returns (bytes32);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `bytes32` | |
### pendingTimelockExpiry
Effective time of the last scheduled allowedInstrRoot update.
```solidity
function pendingTimelockExpiry() public view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### maxPositionIncreaseLossBps
Max allowed value loss (in basis points) when increasing a position.
```solidity
function maxPositionIncreaseLossBps() external view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### maxPositionDecreaseLossBps
Max allowed value loss (in basis points) when decreasing a position.
```solidity
function maxPositionDecreaseLossBps() external view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### maxSwapLossBps
Max allowed value loss (in basis points) for base token swaps.
```solidity
function maxSwapLossBps() external view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### cooldownDuration
Duration of the cooldown period for swaps and position management.
```solidity
function cooldownDuration() external view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### getPositionsLength
Length of the position IDs list.
```solidity
function getPositionsLength() external view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### getPositionId
Position index => Position ID
There are no guarantees on the ordering of values inside the Position ID list,
and it may change when values are added or removed.
```solidity
function getPositionId(uint256 idx) external view override returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ---- | --------- | ----------- |
| idx | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### getPosition
Position ID => Position data
```solidity
function getPosition(uint256 posId) external view override returns (Position memory);
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ----------- |
| posId | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | ---------- | ----------- |
| \ | `Position` | |
### isBaseToken
Token => Registered as base token in this caliber
```solidity
function isBaseToken(address token) external view override returns (bool);
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ----------- |
| token | `address` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### getBaseTokensLength
Length of the base tokens list.
```solidity
function getBaseTokensLength() external view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### getBaseToken
Base token index => Base token address
There are no guarantees on the ordering of values inside the base tokens list,
and it may change when values are added or removed.
```solidity
function getBaseToken(uint256 idx) external view override returns (address);
```
**Parameters**
| Name | Type | Description |
| ---- | --------- | ----------- |
| idx | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### isInstrRootGuardian
User => Whether the user is a root guardian
Guardians have veto power over updates of the Merkle root.
```solidity
function isInstrRootGuardian(address user) external view override returns (bool);
```
**Parameters**
| Name | Type | Description |
| ---- | --------- | ----------- |
| user | `address` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### isAccountingFresh
Checks if the accounting age of each position is below the position staleness threshold.
```solidity
function isAccountingFresh() external view override returns (bool);
```
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### getNetAum
Returns the caliber's net AUM denominated in the accounting token.
Reverts if any position's accounting is stale.
```solidity
function getNetAum() external view override nonReentrantView returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### getDetailedAum
Returns the caliber's net AUM along with detailed position and base token breakdowns.
Does not revert on stale positions. Staleness is surfaced per position via the isStale flag instead.
```solidity
function getDetailedAum()
external
view
override
nonReentrantView
returns (uint256, bytes[] memory, bytes[] memory);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ------------------------------------------------------------------------------------- |
| \ | `uint256` | The total value of all base token balances and positive positions, minus total debts. |
| \ | `bytes[]` | The array of encoded tuples of the form (positionId, value, isDebt, isStale). |
| \ | `bytes[]` | The array of encoded tuples of the form (token, value). |
### addBaseToken
Adds a new base token.
```solidity
function addBaseToken(address token) external override onlyRiskManagerTimelock;
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ------------------------------ |
| token | `address` | The address of the base token. |
### removeBaseToken
Removes a base token.
```solidity
function removeBaseToken(address token) external override onlyRiskManagerTimelock;
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ------------------------------ |
| token | `address` | The address of the base token. |
### accountForPosition
Accounts for a position.
If the position value goes to zero, it is closed.
```solidity
function accountForPosition(Instruction calldata instruction)
external
override
nonReentrant
onlyAccountingAuthorized
returns (uint256, int256);
```
**Parameters**
| Name | Type | Description |
| ----------- | ------------- | --------------------------- |
| instruction | `Instruction` | The accounting instruction. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | --------------------------------- |
| \ | `uint256` | The new position value. |
| \ | `int256` | The change in the position value. |
### accountForPositionBatch
Accounts for a batch of positions.
```solidity
function accountForPositionBatch(Instruction[] calldata instructions, uint256[] calldata groupIds)
external
override
nonReentrant
onlyAccountingAuthorized
returns (uint256[] memory, int256[] memory);
```
**Parameters**
| Name | Type | Description |
| ------------ | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| instructions | `Instruction[]` | The array of accounting instructions. |
| groupIds | `uint256[]` | The array of position group IDs.
An accounting instruction must be provided for every open position in each specified group.
If an instruction's groupId corresponds to a group of open positions of size greater than 1,
the group ID must be included in this array. |
**Returns**
| Name | Type | Description |
| ------------ | ----------- | ----------------------------------- |
| \ | `uint256[]` | The new position values. |
| \ | `int256[]` | The changes in the position values. |
### managePosition
Manages a position's state through paired management and accounting instructions.
The matrix evaluates three factors to determine required validations:
* Base Tokens flow - Whether the contract globally spent or received base tokens during operation
* Debt Position - Whether position represents protocol liability (true) vs asset (false)
* Position Δ direction - Direction of position value change (increase/decrease/null)
┌──────────────────┬───────────────┬──────────────────────┬───────────────────────────┐
│ Base Tokens flow │ Debt Position │ Position Δ direction │ Action │
├──────────────────┼───────────────┼──────────────────────┼───────────────────────────┤
│ Outflow │ No │ Decrease │ Revert: Invalid direction │
│ Outflow │ Yes │ Increase │ Revert: Invalid direction │
│ Outflow │ No │ Increase / Null │ Minimum Δ Check │
│ Outflow │ Yes │ Decrease / Null │ Minimum Δ Check │
│ Inflow / Null │ No │ Decrease │ Maximum Δ Check │
│ Inflow / Null │ Yes │ Increase │ Maximum Δ Check │
│ Inflow / Null │ No │ Increase / Null │ No check (favorable move) │
│ Inflow / Null │ Yes │ Decrease / Null │ No check (favorable move) │
└──────────────────┴───────────────┴──────────────────────┴───────────────────────────┘
Performs accounting updates and modifies contract storage by:
* Adding new positions to storage when created.
* Removing positions from storage when value reaches zero.
Applies value preservation checks using a validation matrix to prevent
economic inconsistencies between position changes and token flows.
```solidity
function managePosition(Instruction calldata mgmtInstruction, Instruction calldata acctInstruction)
external
override
nonReentrant
onlyOperator
returns (uint256, int256);
```
**Parameters**
| Name | Type | Description |
| --------------- | ------------- | --------------------------- |
| mgmtInstruction | `Instruction` | The management instruction. |
| acctInstruction | `Instruction` | The accounting instruction. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | -------------------------------- |
| \ | `uint256` | The new position value. |
| \ | `int256` | The signed position value delta. |
### managePositionBatch
Manages a batch of positions.
Convenience function to manage multiple positions in a single transaction.
```solidity
function managePositionBatch(Instruction[] calldata mgmtInstructions, Instruction[] calldata acctInstructions)
external
override
nonReentrant
onlyOperator
returns (uint256[] memory, int256[] memory);
```
**Parameters**
| Name | Type | Description |
| ---------------- | --------------- | ------------------------------------- |
| mgmtInstructions | `Instruction[]` | The array of management instructions. |
| acctInstructions | `Instruction[]` | The array of accounting instructions. |
**Returns**
| Name | Type | Description |
| ------------ | ----------- | ----------------------------------- |
| \ | `uint256[]` | The new position values. |
| \ | `int256[]` | The changes in the position values. |
### manageFlashLoan
Manages flash loan funds.
```solidity
function manageFlashLoan(Instruction calldata instruction, address token, uint256 amount) external override;
```
**Parameters**
| Name | Type | Description |
| ----------- | ------------- | -------------------------------------- |
| instruction | `Instruction` | The flash loan management instruction. |
| token | `address` | The loan token. |
| amount | `uint256` | The loan amount. |
### harvest
Harvests one or multiple positions.
```solidity
function harvest(Instruction calldata instruction, ISwapModule.SwapOrder[] calldata swapOrders)
external
override
nonReentrant
onlyOperator;
```
**Parameters**
| Name | Type | Description |
| ----------- | ------------------------- | ---------------------------------------------------------- |
| instruction | `Instruction` | The harvest instruction. |
| swapOrders | `ISwapModule.SwapOrder[]` | The array of swap orders to be executed after the harvest. |
### swap
Performs a swap via the swap module.
```solidity
function swap(ISwapModule.SwapOrder calldata order) external override nonReentrant onlyOperator;
```
**Parameters**
| Name | Type | Description |
| ----- | ----------------------- | -------------------------- |
| order | `ISwapModule.SwapOrder` | The swap order parameters. |
### transferToHubMachine
Initiates a token transfer to the hub machine.
```solidity
function transferToHubMachine(address token, uint256 amount, bytes calldata data) external override onlyOperator;
```
**Parameters**
| Name | Type | Description |
| ------ | --------- | ----------------------------------------------------------------------------------------------------- |
| token | `address` | The address of the token to transfer. |
| amount | `uint256` | The amount of tokens to transfer. |
| data | `bytes` | ABI-encoded parameters required for bridge-related transfers. Ignored when called from a hub caliber. |
### notifyIncomingTransfer
Instructs the Caliber to pull the specified token amount from the calling hub machine endpoint.
```solidity
function notifyIncomingTransfer(address token, uint256 amount) external override nonReentrant;
```
**Parameters**
| Name | Type | Description |
| ------ | --------- | ------------------------------------------- |
| token | `address` | The address of the token being transferred. |
| amount | `uint256` | The amount of tokens being transferred. |
### setPositionStaleThreshold
Sets the position accounting staleness threshold.
```solidity
function setPositionStaleThreshold(uint256 newPositionStaleThreshold) external override onlyRiskManagerTimelock;
```
**Parameters**
| Name | Type | Description |
| ------------------------- | --------- | ----------------------------- |
| newPositionStaleThreshold | `uint256` | The new threshold in seconds. |
### setTimelockDuration
Sets the duration of the allowedInstrRoot update timelock.
```solidity
function setTimelockDuration(uint256 newTimelockDuration) external override onlyRiskManagerTimelock;
```
**Parameters**
| Name | Type | Description |
| ------------------- | --------- | ---------------------------- |
| newTimelockDuration | `uint256` | The new duration in seconds. |
### scheduleAllowedInstrRootUpdate
Schedules an update of the root of the Merkle tree containing allowed instructions.
The update will take effect after the timelock duration stored in the contract
at the time of the call.
```solidity
function scheduleAllowedInstrRootUpdate(bytes32 newAllowedInstrRoot) external override onlyRiskManager;
```
**Parameters**
| Name | Type | Description |
| ------------------- | --------- | -------------------- |
| newAllowedInstrRoot | `bytes32` | The new Merkle root. |
### cancelAllowedInstrRootUpdate
Cancels a scheduled update of the root of the Merkle tree containing allowed instructions.
Reverts if no pending update exists or if the timelock has expired.
```solidity
function cancelAllowedInstrRootUpdate() external override;
```
### setMaxPositionIncreaseLossBps
Sets the max allowed value loss for position increases.
```solidity
function setMaxPositionIncreaseLossBps(uint256 newMaxPositionIncreaseLossBps)
external
override
onlyRiskManagerTimelock;
```
**Parameters**
| Name | Type | Description |
| ----------------------------- | --------- | --------------------------------------- |
| newMaxPositionIncreaseLossBps | `uint256` | The new max value loss in basis points. |
### setMaxPositionDecreaseLossBps
Sets the max allowed value loss for position decreases.
```solidity
function setMaxPositionDecreaseLossBps(uint256 newMaxPositionDecreaseLossBps)
external
override
onlyRiskManagerTimelock;
```
**Parameters**
| Name | Type | Description |
| ----------------------------- | --------- | --------------------------------------- |
| newMaxPositionDecreaseLossBps | `uint256` | The new max value loss in basis points. |
### setMaxSwapLossBps
Sets the max allowed value loss for base token swaps.
```solidity
function setMaxSwapLossBps(uint256 newMaxSwapLossBps) external override onlyRiskManagerTimelock;
```
**Parameters**
| Name | Type | Description |
| ----------------- | --------- | --------------------------------------- |
| newMaxSwapLossBps | `uint256` | The new max value loss in basis points. |
### setCooldownDuration
Sets the duration of the cooldown period for swaps and position management.
```solidity
function setCooldownDuration(uint256 newCooldownDuration) external override onlyRiskManagerTimelock;
```
**Parameters**
| Name | Type | Description |
| ------------------- | --------- | ---------------------------- |
| newCooldownDuration | `uint256` | The new duration in seconds. |
### addInstrRootGuardian
Adds a new guardian for the Merkle tree containing allowed instructions.
```solidity
function addInstrRootGuardian(address newGuardian) external override restricted;
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | -------------------------------- |
| newGuardian | `address` | The address of the new guardian. |
### removeInstrRootGuardian
Removes a guardian for the Merkle tree containing allowed instructions.
```solidity
function removeInstrRootGuardian(address guardian) external override restricted;
```
**Parameters**
| Name | Type | Description |
| -------- | --------- | -------------------------------------- |
| guardian | `address` | The address of the guardian to remove. |
### \_getAum
Computes the net AUM by summing the value of all positions and base token balances, and subtracting total debt.
Optionally returns the detail of each position and base token values.
```solidity
function _getAum(bool posDetails) internal view returns (uint256, bytes[] memory, bytes[] memory);
```
**Parameters**
| Name | Type | Description |
| ---------- | ------ | ----------- |
| posDetails | `bool` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
| \ | `bytes[]` | |
| \ | `bytes[]` | |
### \_addBaseToken
Adds a new base token to storage.
```solidity
function _addBaseToken(address token) internal;
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ----------- |
| token | `address` | |
### \_managePosition
Manages and accounts for a position by executing the provided instructions.
```solidity
function _managePosition(Instruction calldata mgmtInstruction, Instruction calldata acctInstruction)
internal
returns (uint256, int256);
```
**Parameters**
| Name | Type | Description |
| --------------- | ------------- | ----------- |
| mgmtInstruction | `Instruction` | |
| acctInstruction | `Instruction` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
| \ | `int256` | |
### \_accountForPosition
Computes the accounting value of a position. Depending on last and current value, the
position is then either created, closed or simply updated in storage.
```solidity
function _accountForPosition(Instruction calldata instruction, bool checks) internal returns (uint256, int256);
```
**Parameters**
| Name | Type | Description |
| ----------- | ------------- | ----------- |
| instruction | `Instruction` | |
| checks | `bool` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
| \ | `int256` | |
### \_decodeAccountingOutputState
Decodes the output state of an accounting instruction into an array of amounts.
```solidity
function _decodeAccountingOutputState(bytes[] memory state) internal pure returns (uint256[] memory);
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ----------- |
| state | `bytes[]` | |
**Returns**
| Name | Type | Description |
| ------------ | ----------- | ----------- |
| \ | `uint256[]` | |
### \_invalidateGroupedPositions
Marks all positions in a given group as stale, except for the position currently being managed.
```solidity
function _invalidateGroupedPositions(uint256 groupId) internal;
```
**Parameters**
| Name | Type | Description |
| ------- | --------- | ----------- |
| groupId | `uint256` | |
### \_includesGroupId
Checks if a given group ID is included in the provided array of group IDs.
```solidity
function _includesGroupId(uint256[] calldata groupIds, uint256 groupId) internal pure returns (bool);
```
**Parameters**
| Name | Type | Description |
| -------- | ----------- | ----------- |
| groupIds | `uint256[]` | |
| groupId | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### \_accountingValueOf
Computes the accounting value of a given token amount.
```solidity
function _accountingValueOf(address token, uint256 amount) internal view returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ------ | --------- | ----------- |
| token | `address` | |
| amount | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### \_checkPositionMinDelta
Checks that absolute position value change is greater than minimum value relative to affected token balance changes and loss tolerance.
```solidity
function _checkPositionMinDelta(uint256 positionValChange, uint256 affectedTokensValChange, uint256 maxLossBps)
internal
pure;
```
**Parameters**
| Name | Type | Description |
| ----------------------- | --------- | ----------- |
| positionValChange | `uint256` | |
| affectedTokensValChange | `uint256` | |
| maxLossBps | `uint256` | |
### \_checkPositionMaxDelta
Checks that absolute position value change is less than maximum value relative to affected token balance changes and loss tolerance.
```solidity
function _checkPositionMaxDelta(uint256 positionValChange, uint256 affectedTokensValChange, uint256 maxLossBps)
internal
pure;
```
**Parameters**
| Name | Type | Description |
| ----------------------- | --------- | ----------- |
| positionValChange | `uint256` | |
| affectedTokensValChange | `uint256` | |
| maxLossBps | `uint256` | |
### \_checkInstructionIsAllowed
Checks if the given instruction is allowed by verifying its Merkle proof against the allowed instructions root.
```solidity
function _checkInstructionIsAllowed(Instruction calldata instruction) internal;
```
**Parameters**
| Name | Type | Description |
| ----------- | ------------- | ------------------------- |
| instruction | `Instruction` | The instruction to check. |
### \_getStateHash
Computes a hash of the state array, selectively including elements as specified by a bitmap.
This enables a weiroll script to have both fixed and variable parameters.
```solidity
function _getStateHash(bytes[] calldata state, uint128 bitmap) internal pure returns (bytes32);
```
**Parameters**
| Name | Type | Description |
| ------ | --------- | ------------------------------------------------------------------------------------------------------------------------------- |
| state | `bytes[]` | The state array to hash. |
| bitmap | `uint128` | The bitmap where each bit determines whether the corresponding element in state is included or ignored in the hash computation. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | --------------------------------- |
| \ | `bytes32` | hash The hash of the state array. |
### \_updateAllowedInstrRoot
Updates the allowed instructions root if a pending update is scheduled and the timelock has expired.
```solidity
function _updateAllowedInstrRoot() internal returns (bytes32);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | -------------------------------------------------- |
| \ | `bytes32` | currentRoot The current allowed instructions root. |
### \_swap
```solidity
function _swap(ISwapModule.SwapOrder calldata order) internal;
```
**Parameters**
| Name | Type | Description |
| ----- | ----------------------- | ----------- |
| order | `ISwapModule.SwapOrder` | |
### \_execute
Executes a set of commands on the Weiroll VM, via a delegatecall.
```solidity
function _execute(bytes32[] calldata commands, bytes[] memory state) internal returns (bytes[] memory);
```
**Parameters**
| Name | Type | Description |
| -------- | ----------- | ---------------------------- |
| commands | `bytes32[]` | The commands to execute. |
| state | `bytes[]` | The state to pass to the VM. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ---------------------------------------------------- |
| \ | `bytes[]` | outState The new state after executing the commands. |
## Structs
### CaliberStorage
**Note:**
* **storage-location:** erc7201:makina.storage.Caliber
```solidity
struct CaliberStorage {
address _hubMachineEndpoint;
address _accountingToken;
uint256 _positionStaleThreshold;
bytes32 _allowedInstrRoot;
uint256 _timelockDuration;
bytes32 _pendingAllowedInstrRoot;
uint256 _pendingTimelockExpiry;
uint256 _maxPositionIncreaseLossBps;
uint256 _maxPositionDecreaseLossBps;
uint256 _maxSwapLossBps;
uint256 _managedPositionId;
bool _isManagedPositionDebt;
bool _isManagingFlashLoan;
uint256 _cooldownDuration;
uint256 _lastBTSwapTimestamp;
mapping(bytes32 executionHash => uint256 timestamp) _lastExecTimestamps;
mapping(uint256 posId => Position pos) _positionById;
mapping(uint256 groupId => EnumerableSet.UintSet positionIds) _positionIdsByGroup;
EnumerableSet.UintSet _positionIds;
EnumerableSet.AddressSet _baseTokens;
EnumerableSet.AddressSet _instrRootGuardians;
EnumerableSet.AddressSet _positionTokens;
}
```
**Properties**
| Name | Type | Description |
| ---------------------------- | --------------------------------------------------------------- | ----------- |
| \_hubMachineEndpoint | `address` | |
| \_accountingToken | `address` | |
| \_positionStaleThreshold | `uint256` | |
| \_allowedInstrRoot | `bytes32` | |
| \_timelockDuration | `uint256` | |
| \_pendingAllowedInstrRoot | `bytes32` | |
| \_pendingTimelockExpiry | `uint256` | |
| \_maxPositionIncreaseLossBps | `uint256` | |
| \_maxPositionDecreaseLossBps | `uint256` | |
| \_maxSwapLossBps | `uint256` | |
| \_managedPositionId | `uint256` | |
| \_isManagedPositionDebt | `bool` | |
| \_isManagingFlashLoan | `bool` | |
| \_cooldownDuration | `uint256` | |
| \_lastBTSwapTimestamp | `uint256` | |
| \_lastExecTimestamps | `mapping(bytes32 executionHash => uint256 timestamp)` | |
| \_positionById | `mapping(uint256 posId => Position pos)` | |
| \_positionIdsByGroup | `mapping(uint256 groupId => EnumerableSet.UintSet positionIds)` | |
| \_positionIds | `EnumerableSet.UintSet` | |
| \_baseTokens | `EnumerableSet.AddressSet` | |
| \_instrRootGuardians | `EnumerableSet.AddressSet` | |
| \_positionTokens | `EnumerableSet.AddressSet` | |
# CaliberMailbox
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/caliber/CaliberMailbox.sol)
**Inherits:** [MakinaGovernable](/contracts/core/utils/abstract.MakinaGovernable), ReentrancyGuard, [BridgeController](/contracts/core/bridge/controller/abstract.BridgeController), [ICaliberMailbox](/contracts/core/interfaces/interface.ICaliberMailbox)
## Constants
### hubChainId
Chain ID of the hub.
```solidity
uint256 public immutable hubChainId;
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### CaliberMailboxStorageLocation
```solidity
bytes32 private constant CaliberMailboxStorageLocation =
0xc8f2c10c9147366283b13eb82b7eca93d88636f13eec15d81ed4c6aa5006aa00;
```
## Functions
### \_getCaliberMailboxStorage
```solidity
function _getCaliberMailboxStorage() private pure returns (CaliberMailboxStorage storage $);
```
**Returns**
| Name | Type | Description |
| ---- | ----------------------- | ----------- |
| \$ | `CaliberMailboxStorage` | |
### constructor
```solidity
constructor(address _registry, uint256 _hubChainId) MakinaContext(_registry);
```
**Parameters**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \_registry | `address` | |
| \_hubChainId | `uint256` | |
### initialize
Initializer of the contract.
```solidity
function initialize(IMakinaGovernable.MakinaGovernableInitParams calldata mgParams, uint256 initialCooldownDuration)
external
override
initializer;
```
**Parameters**
| Name | Type | Description |
| ----------------------- | ---------------------------------------------- | ------------------------------------------------------------------ |
| mgParams | `IMakinaGovernable.MakinaGovernableInitParams` | The makina governable initialization parameters. |
| initialCooldownDuration | `uint256` | The duration of the cooldown period for outgoing bridge transfers. |
### caliber
Address of the associated caliber.
```solidity
function caliber() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### cooldownDuration
Duration of the cooldown period for outgoing bridge transfers.
```solidity
function cooldownDuration() external view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### getHubBridgeAdapter
Returns the address of the hub bridge adapter for a given bridge ID.
```solidity
function getHubBridgeAdapter(uint16 bridgeId) external view override returns (address);
```
**Parameters**
| Name | Type | Description |
| -------- | -------- | --------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### getSpokeCaliberAccountingData
Returns the accounting data of the associated caliber.
```solidity
function getSpokeCaliberAccountingData() external view override returns (SpokeCaliberAccountingData memory data);
```
**Returns**
| Name | Type | Description |
| ---- | ---------------------------- | ------------------------- |
| data | `SpokeCaliberAccountingData` | data The accounting data. |
### manageTransfer
Manages the transfer of tokens between a machine and a caliber. The transfer direction depends on the caller.
```solidity
function manageTransfer(address token, uint256 amount, bytes calldata data) external override nonReentrant;
```
**Parameters**
| Name | Type | Description |
| ------ | --------- | -------------------------------------------------------------------------------------------------------------------------- |
| token | `address` | The address of the token. |
| amount | `uint256` | The amount of tokens to transfer. |
| data | `bytes` | ABI-encoded parameters required for bridge-related transfers. Ignored for transfers between a machine and its hub caliber. |
### sendOutBridgeTransfer
Executes a scheduled outgoing bridge transfer.
```solidity
function sendOutBridgeTransfer(uint16 bridgeId, uint256 transferId, bytes calldata data)
external
override
onlyOperator;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ------------------------------------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
| transferId | `uint256` | The ID of the transfer to execute. |
| data | `bytes` | The optional data needed to execute the transfer. |
### authorizeInBridgeTransfer
Registers a message hash as authorized for an incoming bridge transfer.
```solidity
function authorizeInBridgeTransfer(uint16 bridgeId, bytes32 messageHash)
external
override
notRecoveryMode
onlyMechanic;
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | ------------------------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
| messageHash | `bytes32` | The hash of the message to authorize. |
### claimInBridgeTransfer
Transfers a received bridge transfer out of the corresponding bridge adapter.
```solidity
function claimInBridgeTransfer(uint16 bridgeId, uint256 transferId) external override onlyOperator;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | -------------------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
| transferId | `uint256` | The ID of the transfer to claim. |
### cancelOutBridgeTransfer
Cancels an outgoing bridge transfer.
```solidity
function cancelOutBridgeTransfer(uint16 bridgeId, uint256 transferId) external override onlyOperator;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | --------------------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
| transferId | `uint256` | The ID of the transfer to cancel. |
### setCaliber
Sets the associated caliber address.
```solidity
function setCaliber(address _caliber) external override onlyFactory;
```
**Parameters**
| Name | Type | Description |
| --------- | --------- | -------------------------------------- |
| \_caliber | `address` | The address of the associated caliber. |
### setHubBridgeAdapter
Registers a hub bridge adapter.
```solidity
function setHubBridgeAdapter(uint16 bridgeId, address adapter) external override restricted;
```
**Parameters**
| Name | Type | Description |
| -------- | --------- | -------------------------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
| adapter | `address` | The address of the hub bridge adapter. |
### setCooldownDuration
Sets the duration of the cooldown period for outgoing bridge transfers.
```solidity
function setCooldownDuration(uint256 newCooldownDuration) external override onlyRiskManagerTimelock;
```
**Parameters**
| Name | Type | Description |
| ------------------- | --------- | ---------------------------- |
| newCooldownDuration | `uint256` | The new duration in seconds. |
### disableOutTransfer
Disables outgoing transfers for a bridge.
```solidity
function disableOutTransfer(uint16 bridgeId) external override onlyRiskManagerTimelock;
```
**Parameters**
| Name | Type | Description |
| -------- | -------- | --------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
### enableOutTransfer
Enables outgoing transfers for a bridge.
```solidity
function enableOutTransfer(uint16 bridgeId) external override onlyRiskManagerTimelock;
```
**Parameters**
| Name | Type | Description |
| -------- | -------- | --------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
### setMaxBridgeLossBps
Sets the maximum allowed value loss in basis points for transfers via this bridge.
```solidity
function setMaxBridgeLossBps(uint16 bridgeId, uint256 maxBridgeLossBps) external override onlyRiskManagerTimelock;
```
**Parameters**
| Name | Type | Description |
| ---------------- | --------- | ----------------------------------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
| maxBridgeLossBps | `uint256` | The maximum allowed value loss in basis points. |
### resetBridgingState
Resets internal bridge counters for a given token, and withdraws token balances held by all bridge adapters.
This function is intended to be used by the DAO to realign bridge accounting state and maintain protocol consistency,
typically in response to operator deviations, external bridge discrepancies, or unbounded counter growth.
```solidity
function resetBridgingState(address token) external override onlySecurityCouncil;
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ------------------------- |
| token | `address` | The address of the token. |
### \_getBridgeCounters
Returns the current bridge counters for both incoming and outgoing transfers.
```solidity
function _getBridgeCounters() internal view returns (bytes[] memory bridgesIn, bytes[] memory bridgesOut);
```
**Returns**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| bridgesIn | `bytes[]` | |
| bridgesOut | `bytes[]` | |
### \_getSnapshotContext
Constructs the snapshot context for the current state.
```solidity
function _getSnapshotContext() internal view returns (SpokeSnapshotContext memory);
```
**Returns**
| Name | Type | Description |
| ------------ | ---------------------- | ----------- |
| \ | `SpokeSnapshotContext` | |
## Structs
### CaliberMailboxStorage
**Note:**
* **storage-location:** erc7201:makina.storage.CaliberMailbox
```solidity
struct CaliberMailboxStorage {
address _deprecated_0;
address _caliber;
mapping(uint16 bridgeId => address adapter) _hubBridgeAdapters;
EnumerableMap.AddressToUintMap _bridgesIn;
EnumerableMap.AddressToUintMap _bridgesOut;
uint256 _cooldownDuration;
mapping(uint16 bridgeId => uint256 timestamp) _lastBridgeOutTimestamp;
}
```
**Properties**
| Name | Type | Description |
| ------------------------ | ----------------------------------------------- | ----------- |
| \_deprecated\_0 | `address` | |
| \_caliber | `address` | |
| \_hubBridgeAdapters | `mapping(uint16 bridgeId => address adapter)` | |
| \_bridgesIn | `EnumerableMap.AddressToUintMap` | |
| \_bridgesOut | `EnumerableMap.AddressToUintMap` | |
| \_cooldownDuration | `uint256` | |
| \_lastBridgeOutTimestamp | `mapping(uint16 bridgeId => uint256 timestamp)` | |
# AcrossV3BridgeAdapter
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/bridge/adapters/AcrossV3BridgeAdapter.sol)
**Inherits:** [BridgeAdapter](/contracts/core/bridge/adapters/abstract.BridgeAdapter), [IAcrossV3MessageHandler](/contracts/core/interfaces/interface.IAcrossV3MessageHandler)
## Constants
### ACROSS\_V3\_BRIDGE\_ID
```solidity
uint16 private constant ACROSS_V3_BRIDGE_ID = 1;
```
## Functions
### constructor
```solidity
constructor(address _registry, address _acrossV3SpokePool)
BridgeAdapter(_registry, _acrossV3SpokePool, _acrossV3SpokePool, _acrossV3SpokePool);
```
**Parameters**
| Name | Type | Description |
| ------------------- | --------- | ----------- |
| \_registry | `address` | |
| \_acrossV3SpokePool | `address` | |
### initialize
Initializer of the contract.
```solidity
function initialize(address _controller, bytes calldata) external override initializer;
```
**Parameters**
| Name | Type | Description |
| ------------ | --------- | --------------------------------- |
| \_controller | `address` | The bridge controller contract. |
| \_ | `bytes` | The optional initialization data. |
### handleV3AcrossMessage
```solidity
function handleV3AcrossMessage(address tokenSent, uint256 amount, address, bytes memory encodedMessage)
external
override;
```
**Parameters**
| Name | Type | Description |
| -------------- | --------- | ----------- |
| tokenSent | `address` | |
| amount | `uint256` | |
| \_ | `address` | |
| encodedMessage | `bytes` | |
### \_outBridgeTransferCancelDefault
Internal logic for outgoing bridge transfer cancellation default.
```solidity
function _outBridgeTransferCancelDefault(uint256 transferId) internal view override returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| transferId | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### \_checkOutBridgeTransferIsCancellable
Checks if an outgoing bridge transfer is in a cancellable state.
```solidity
function _checkOutBridgeTransferIsCancellable(uint256 transferId) internal override;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| transferId | `uint256` | |
### \_sendOutBridgeTransfer
Handles logic specific to the external bridge protocol for sending out a bridge transfer.
```solidity
function _sendOutBridgeTransfer(uint256 transferId, bytes calldata data) internal override;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| transferId | `uint256` | |
| data | `bytes` | |
# BridgeAdapter
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/bridge/adapters/BridgeAdapter.sol)
**Inherits:** Initializable, ReentrancyGuard, [MakinaContext](/contracts/core/utils/abstract.MakinaContext), [IBridgeAdapter](/contracts/core/interfaces/interface.IBridgeAdapter)
## Constants
### MAX\_BPS
Full scale value in basis points
```solidity
uint256 private constant MAX_BPS = 10_000;
```
### approvalTarget
Address of the external bridge approval target contract.
```solidity
address public immutable override approvalTarget;
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### executionTarget
Address of the external bridge execution target contract.
```solidity
address public immutable override executionTarget;
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### receiveSource
Address of the external bridge contract responsible for sending output funds.
```solidity
address public immutable override receiveSource;
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### BridgeAdapterStorageLocation
```solidity
bytes32 private constant BridgeAdapterStorageLocation =
0xe24ea70efbf545f0256b406d064fa196624401f48d56c665b3e8bc995282c700;
```
## Functions
### \_getBridgeAdapterStorage
```solidity
function _getBridgeAdapterStorage() internal pure returns (BridgeAdapterStorage storage $);
```
**Returns**
| Name | Type | Description |
| ---- | ---------------------- | ----------- |
| \$ | `BridgeAdapterStorage` | |
### constructor
```solidity
constructor(address _registry, address _approvalTarget, address _executionTarget, address _receiveSource)
MakinaContext(_registry);
```
**Parameters**
| Name | Type | Description |
| ----------------- | --------- | ----------- |
| \_registry | `address` | |
| \_approvalTarget | `address` | |
| \_executionTarget | `address` | |
| \_receiveSource | `address` | |
### \_\_BridgeAdapter\_init
```solidity
function __BridgeAdapter_init(address _controller, uint16 _bridgeId) internal onlyInitializing;
```
**Parameters**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \_controller | `address` | |
| \_bridgeId | `uint16` | |
### onlyController
```solidity
modifier onlyController();
```
### controller
Address of the bridge controller contract.
```solidity
function controller() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### bridgeId
ID of the adapted external bridge.
```solidity
function bridgeId() external view override returns (uint16);
```
**Returns**
| Name | Type | Description |
| ------------ | -------- | ----------- |
| \ | `uint16` | |
### nextOutTransferId
ID of the next outgoing transfer.
```solidity
function nextOutTransferId() external view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### nextInTransferId
ID of the next incoming transfer.
```solidity
function nextInTransferId() external view override returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### outBridgeTransferCancelDefault
Returns the default amount that must be transferred to the adapter to cancel an outgoing bridge transfer.
If the transfer has not yet been sent, or if the full amount was refunded to this contract by the external bridge, returns 0.
If the bridge retains a fee upon cancellation and only a partial refund was received, the returned value reflects that fee.
In all other cases (e.g. including pending refunds or successful bridge transfers), returns the full amount of the transfer.
```solidity
function outBridgeTransferCancelDefault(uint256 transferId) external view override returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | -------------------------------- |
| transferId | `uint256` | The ID of the transfer to check. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ------------------------------------------- |
| \ | `uint256` | The amount required to cancel the transfer. |
### scheduleOutBridgeTransfer
Schedules an outgoing bridge transfer and returns the message hash.
Emits an event containing the id of the transfer and the hash of the bridge transfer message.
```solidity
function scheduleOutBridgeTransfer(
uint256 destinationChainId,
address recipient,
address inputToken,
uint256 inputAmount,
address outputToken,
uint256 minOutputAmount
) external override nonReentrant onlyController;
```
**Parameters**
| Name | Type | Description |
| ------------------ | --------- | --------------------------------------------------------- |
| destinationChainId | `uint256` | The ID of the destination chain. |
| recipient | `address` | The address of the recipient on the destination chain. |
| inputToken | `address` | The address of the input token. |
| inputAmount | `uint256` | The amount of the input token to transfer. |
| outputToken | `address` | The address of the output token on the destination chain. |
| minOutputAmount | `uint256` | The minimum amount of the output token to receive. |
### authorizeInBridgeTransfer
Registers a message hash as authorized for an incoming bridge transfer.
```solidity
function authorizeInBridgeTransfer(bytes32 messageHash) external override onlyController;
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | ------------------------------------- |
| messageHash | `bytes32` | The hash of the message to authorize. |
### sendOutBridgeTransfer
Executes a scheduled outgoing bridge transfer.
```solidity
function sendOutBridgeTransfer(uint256 transferId, bytes calldata data)
external
override
nonReentrant
onlyController;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ------------------------------------------------- |
| transferId | `uint256` | The ID of the transfer to execute. |
| data | `bytes` | The optional data needed to execute the transfer. |
### cancelOutBridgeTransfer
Cancels an outgoing bridge transfer.
```solidity
function cancelOutBridgeTransfer(uint256 transferId) external override nonReentrant onlyController;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | --------------------------------- |
| transferId | `uint256` | The ID of the transfer to cancel. |
### claimInBridgeTransfer
Transfers a received bridge transfer out of the adapter.
```solidity
function claimInBridgeTransfer(uint256 transferId) external override nonReentrant onlyController;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | -------------------------------- |
| transferId | `uint256` | The ID of the transfer to claim. |
### withdrawPendingFunds
Resets internal state for a given token address, and transfers token balance to associated controller.
This function is intended to be used by the DAO to unlock funds stuck in the adapter, typically
in response to operator deviations or external bridge discrepancies.
```solidity
function withdrawPendingFunds(address token) external override nonReentrant onlyController;
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ------------------------- |
| token | `address` | The address of the token. |
### \_receiveInBridgeTransfer
Updates contract state when receiving an incoming bridge transfer.
```solidity
function _receiveInBridgeTransfer(bytes memory encodedMessage, address receivedToken, uint256 receivedAmount)
internal
virtual;
```
**Parameters**
| Name | Type | Description |
| -------------- | --------- | ----------- |
| encodedMessage | `bytes` | |
| receivedToken | `address` | |
| receivedAmount | `uint256` | |
### \_getSet
Returns a reference to the current active set for this versioned set.
```solidity
function _getSet(VersionedUintSet storage self) internal view returns (EnumerableSet.UintSet storage);
```
**Parameters**
| Name | Type | Description |
| ---- | ------------------ | ----------- |
| self | `VersionedUintSet` | |
**Returns**
| Name | Type | Description |
| ------------ | ----------------------- | ----------- |
| \ | `EnumerableSet.UintSet` | |
### \_clearSet
Virtually clears the set by incrementing the version.
All future operations will apply to a fresh, empty set.
Previous versions remain in storage and are not deleted.
```solidity
function _clearSet(VersionedUintSet storage self) internal;
```
**Parameters**
| Name | Type | Description |
| ---- | ------------------ | ----------- |
| self | `VersionedUintSet` | |
### \_checkOutBridgeTransferRouteIsSupported
Checks if an outgoing bridge transfer route is supported.
```solidity
function _checkOutBridgeTransferRouteIsSupported(
uint256 destinationChainId,
address inputToken,
uint256, /*inputAmount*/
address outputToken
) internal view virtual;
```
**Parameters**
| Name | Type | Description |
| ------------------ | --------- | ----------- |
| destinationChainId | `uint256` | |
| inputToken | `address` | |
| \_ | `uint256` | |
| outputToken | `address` | |
### \_getConfig
Returns the address of the config contract associated with this bridge adapter.
```solidity
function _getConfig() internal view returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### \_checkOutBridgeTransferIsCancellable
Checks if an outgoing bridge transfer is in a cancellable state.
```solidity
function _checkOutBridgeTransferIsCancellable(uint256 transferId) internal virtual;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| transferId | `uint256` | |
### \_sendOutBridgeTransfer
Handles logic specific to the external bridge protocol for sending out a bridge transfer.
```solidity
function _sendOutBridgeTransfer(uint256 transferId, bytes calldata data) internal virtual;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| transferId | `uint256` | |
| data | `bytes` | |
### \_outBridgeTransferCancelDefault
Internal logic for outgoing bridge transfer cancellation default.
```solidity
function _outBridgeTransferCancelDefault(uint256 transferId) internal view virtual returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| transferId | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
## Structs
### VersionedUintSet
EnumerableSet wrapper supporting efficient clearing by switching to a new version.
```solidity
struct VersionedUintSet {
mapping(uint256 => EnumerableSet.UintSet) _sets;
uint256 _currentVersion;
}
```
**Properties**
| Name | Type | Description |
| ---------------- | ------------------------------------------- | ----------- |
| \_sets | `mapping(uint256 => EnumerableSet.UintSet)` | |
| \_currentVersion | `uint256` | |
### BridgeAdapterStorage
**Note:**
* **storage-location:** erc7201:makina.storage.BridgeAdapter
```solidity
struct BridgeAdapterStorage {
address _controller;
uint16 _bridgeId;
uint256 _nextOutTransferId;
uint256 _nextInTransferId;
mapping(uint256 outTransferId => OutBridgeTransfer transfer) _outgoingTransfers;
mapping(uint256 inTransferId => InBridgeTransfer transfer) _incomingTransfers;
mapping(address token => VersionedUintSet) _pendingOutTransferIds;
mapping(address token => VersionedUintSet) _sentOutTransferIds;
mapping(address token => VersionedUintSet) _pendingInTransferIds;
mapping(bytes32 messageHash => bool isExpected) _expectedInMessages;
mapping(address token => uint256 amount) _reservedBalances;
}
```
**Properties**
| Name | Type | Description |
| ----------------------- | -------------------------------------------------------------- | ----------- |
| \_controller | `address` | |
| \_bridgeId | `uint16` | |
| \_nextOutTransferId | `uint256` | |
| \_nextInTransferId | `uint256` | |
| \_outgoingTransfers | `mapping(uint256 outTransferId => OutBridgeTransfer transfer)` | |
| \_incomingTransfers | `mapping(uint256 inTransferId => InBridgeTransfer transfer)` | |
| \_pendingOutTransferIds | `mapping(address token => VersionedUintSet)` | |
| \_sentOutTransferIds | `mapping(address token => VersionedUintSet)` | |
| \_pendingInTransferIds | `mapping(address token => VersionedUintSet)` | |
| \_expectedInMessages | `mapping(bytes32 messageHash => bool isExpected)` | |
| \_reservedBalances | `mapping(address token => uint256 amount)` | |
# CctpV2BridgeAdapter
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/bridge/adapters/CctpV2BridgeAdapter.sol)
**Inherits:** [BridgeAdapter](/contracts/core/bridge/adapters/abstract.BridgeAdapter), [ICctpV2DestinationCaller](/contracts/core/interfaces/interface.ICctpV2DestinationCaller)
## Constants
### CCTP\_V2\_BRIDGE\_ID
```solidity
uint16 private constant CCTP_V2_BRIDGE_ID = 3;
```
## Functions
### constructor
```solidity
constructor(address _registry, address _tokenMessenger, address _messageTransmitter)
BridgeAdapter(_registry, _tokenMessenger, _tokenMessenger, _messageTransmitter);
```
**Parameters**
| Name | Type | Description |
| -------------------- | --------- | ----------- |
| \_registry | `address` | |
| \_tokenMessenger | `address` | |
| \_messageTransmitter | `address` | |
### initialize
Initializer of the contract.
```solidity
function initialize(address _controller, bytes calldata) external override initializer;
```
**Parameters**
| Name | Type | Description |
| ------------ | --------- | --------------------------------- |
| \_controller | `address` | The bridge controller contract. |
| \_ | `bytes` | The optional initialization data. |
### receiveCctpV2Message
Handles reception of a CCTP V2 message and signature.
```solidity
function receiveCctpV2Message(bytes calldata message, bytes calldata attestation) external override nonReentrant;
```
**Parameters**
| Name | Type | Description |
| ----------- | ------- | ------------------------------ |
| message | `bytes` | The CCTP V2 message raw bytes. |
| attestation | `bytes` | The message signature. |
### \_outBridgeTransferCancelDefault
Internal logic for outgoing bridge transfer cancellation default.
```solidity
function _outBridgeTransferCancelDefault(uint256 transferId) internal view override returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| transferId | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### \_checkOutBridgeTransferIsCancellable
Checks if an outgoing bridge transfer is in a cancellable state.
```solidity
function _checkOutBridgeTransferIsCancellable(uint256 transferId) internal override;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| transferId | `uint256` | |
### \_sendOutBridgeTransfer
Handles logic specific to the external bridge protocol for sending out a bridge transfer.
```solidity
function _sendOutBridgeTransfer(uint256 transferId, bytes calldata data) internal override;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| transferId | `uint256` | |
| data | `bytes` | |
# LayerZeroV2BridgeAdapter
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/bridge/adapters/LayerZeroV2BridgeAdapter.sol)
**Inherits:** [BridgeAdapter](/contracts/core/bridge/adapters/abstract.BridgeAdapter), [ILayerZeroComposer](/contracts/core/interfaces/interface.ILayerZeroComposer)
## Constants
### LAYER\_ZERO\_V2\_BRIDGE\_ID
```solidity
uint16 private constant LAYER_ZERO_V2_BRIDGE_ID = 2;
```
## Functions
### constructor
```solidity
constructor(address _registry, address _layerZeroV2Endpoint)
BridgeAdapter(_registry, address(0), address(0), _layerZeroV2Endpoint);
```
**Parameters**
| Name | Type | Description |
| --------------------- | --------- | ----------- |
| \_registry | `address` | |
| \_layerZeroV2Endpoint | `address` | |
### initialize
Initializer of the contract.
```solidity
function initialize(address _controller, bytes calldata) external override initializer;
```
**Parameters**
| Name | Type | Description |
| ------------ | --------- | --------------------------------- |
| \_controller | `address` | The bridge controller contract. |
| \_ | `bytes` | The optional initialization data. |
### receive
Allows the contract to receive Ether.
```solidity
receive() external payable;
```
### lzCompose
Composes a LayerZero message from an OApp.
```solidity
function lzCompose(
address _from,
bytes32, /*_guid*/
bytes calldata _message,
address, /*_executor*/
bytes calldata /*_extraData*/
)
external
payable
override;
```
**Parameters**
| Name | Type | Description |
| --------- | --------- | --------------------------------------------------------------------------------------------- |
| \_from | `address` | The address initiating the composition, typically the OApp where the lzReceive was called. |
| \_ | `bytes32` | The unique identifier for the corresponding LayerZero src/dst tx. |
| \_message | `bytes` | The composed message payload in bytes. NOT necessarily the same payload passed via lzReceive. |
| \_ | `address` | The address of the executor for the composed message. |
| \_ | `bytes` | Additional arbitrary data in bytes passed by the entity who executes the lzCompose. |
### \_outBridgeTransferCancelDefault
Internal logic for outgoing bridge transfer cancellation default.
```solidity
function _outBridgeTransferCancelDefault(uint256 transferId) internal view override returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| transferId | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### \_checkOutBridgeTransferIsCancellable
Checks if an outgoing bridge transfer is in a cancellable state.
```solidity
function _checkOutBridgeTransferIsCancellable(uint256 transferId) internal override;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| transferId | `uint256` | |
### \_sendOutBridgeTransfer
Handles logic specific to the external bridge protocol for sending out a bridge transfer.
```solidity
function _sendOutBridgeTransfer(uint256 transferId, bytes calldata data) internal override;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| transferId | `uint256` | |
| data | `bytes` | |
## Events
### LzGuidCreated
```solidity
event LzGuidCreated(bytes32 indexed guid, uint256 indexed transferId);
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| guid | `bytes32` | |
| transferId | `uint256` | |
# AcrossV3BridgeConfig
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/bridge/configs/AcrossV3BridgeConfig.sol)
**Inherits:** AccessManagedUpgradeable, [IAcrossV3BridgeConfig](/contracts/core/interfaces/interface.IAcrossV3BridgeConfig)
## Constants
### AcrossV3BridgeConfigStorageLocation
```solidity
bytes32 private constant AcrossV3BridgeConfigStorageLocation =
0x55c9f27624440face9d60f824f50119631f5ca1c165e4b047f325c445d2b2500;
```
## Functions
### \_getAcrossV3BridgeConfigStorage
```solidity
function _getAcrossV3BridgeConfigStorage() private pure returns (AcrossV3BridgeConfigStorage storage $);
```
**Returns**
| Name | Type | Description |
| ---- | ----------------------------- | ----------- |
| \$ | `AcrossV3BridgeConfigStorage` | |
### constructor
```solidity
constructor();
```
### initialize
```solidity
function initialize(address initialAuthority) external initializer;
```
**Parameters**
| Name | Type | Description |
| ---------------- | --------- | ----------- |
| initialAuthority | `address` | |
### isRouteSupported
Returns whether a bridge transfer route is supported for the associated bridge.
```solidity
function isRouteSupported(address, uint256 foreignChainId, address) external view override returns (bool);
```
**Parameters**
| Name | Type | Description |
| -------------- | --------- | -------------------------------------------------- |
| \_ | `address` | The token being sent from the source chain. |
| foreignChainId | `uint256` | The destination chain ID. |
| \_ | `address` | The token being received on the destination chain. |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ------------------------------------------------ |
| \ | `bool` | True if the route is supported, false otherwise. |
### isForeignChainSupported
Foreign Chain ID => Whether the chain is supported.
```solidity
function isForeignChainSupported(uint256 foreignChainId) public view override returns (bool);
```
**Parameters**
| Name | Type | Description |
| -------------- | --------- | ----------- |
| foreignChainId | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### setForeignChainSupported
Sets whether a foreign chain is supported.
```solidity
function setForeignChainSupported(uint256 foreignChainId, bool supported) external override restricted;
```
**Parameters**
| Name | Type | Description |
| -------------- | --------- | ------------------------------------------------ |
| foreignChainId | `uint256` | The foreign chain ID. |
| supported | `bool` | True if the chain is supported, false otherwise. |
## Structs
### AcrossV3BridgeConfigStorage
**Note:**
* **storage-location:** erc7201:makina.storage.AcrossV3BridgeConfig
```solidity
struct AcrossV3BridgeConfigStorage {
mapping(uint256 evmChainId => bool isSupported) _isForeignChainSupported;
}
```
**Properties**
| Name | Type | Description |
| ------------------------- | ------------------------------------------------- | ----------- |
| \_isForeignChainSupported | `mapping(uint256 evmChainId => bool isSupported)` | |
# CctpV2BridgeConfig
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/bridge/configs/CctpV2BridgeConfig.sol)
**Inherits:** AccessManagedUpgradeable, [ICctpV2BridgeConfig](/contracts/core/interfaces/interface.ICctpV2BridgeConfig)
## Constants
### MAINNET\_CHAIN\_ID
```solidity
uint256 private constant MAINNET_CHAIN_ID = 1;
```
### MAINNET\_CCTP\_DOMAIN
```solidity
uint32 private constant MAINNET_CCTP_DOMAIN = 0;
```
### CctpV2BridgeConfigStorageLocation
```solidity
bytes32 private constant CctpV2BridgeConfigStorageLocation =
0xfddff817c79375fc2894a034cbd193828d9a03a3c9ab698ec061f44863e21100;
```
## Functions
### \_getCctpV2BridgeConfigStorage
```solidity
function _getCctpV2BridgeConfigStorage() private pure returns (CctpV2BridgeConfigStorage storage $);
```
**Returns**
| Name | Type | Description |
| ---- | --------------------------- | ----------- |
| \$ | `CctpV2BridgeConfigStorage` | |
### constructor
```solidity
constructor();
```
### initialize
```solidity
function initialize(address initialAuthority) external initializer;
```
**Parameters**
| Name | Type | Description |
| ---------------- | --------- | ----------- |
| initialAuthority | `address` | |
### isRouteSupported
Returns whether a bridge transfer route is supported for the associated bridge.
```solidity
function isRouteSupported(address inputToken, uint256 foreignChainId, address outputToken)
external
view
override
returns (bool);
```
**Parameters**
| Name | Type | Description |
| -------------- | --------- | -------------------------------------------------- |
| inputToken | `address` | The token being sent from the source chain. |
| foreignChainId | `uint256` | The destination chain ID. |
| outputToken | `address` | The token being received on the destination chain. |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ------------------------------------------------ |
| \ | `bool` | True if the route is supported, false otherwise. |
### getCctpDomain
EVM chain ID => CCTP domain
```solidity
function getCctpDomain(uint256 evmChainId) external view override returns (uint32);
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| evmChainId | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | -------- | ----------- |
| \ | `uint32` | |
### getForeignToken
Local token address => Foreign EVM chain ID => Foreign Token address
```solidity
function getForeignToken(address localToken, uint256 foreignEvmChainId) external view override returns (address);
```
**Parameters**
| Name | Type | Description |
| ----------------- | --------- | ----------- |
| localToken | `address` | |
| foreignEvmChainId | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### setCctpDomain
Associates an EVM chain ID with a CCTP domain in the contract storage.
```solidity
function setCctpDomain(uint256 evmChainId, uint32 cctpDomain) external override restricted;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------------- |
| evmChainId | `uint256` | The EVM chain ID. |
| cctpDomain | `uint32` | The CCTP domain. |
### setForeignToken
Associates a local token with its foreign counterpart used in CCTP bridging.
```solidity
function setForeignToken(address localToken, uint256 foreignEvmChainId, address foreignToken)
external
override
restricted;
```
**Parameters**
| Name | Type | Description |
| ----------------- | --------- | -------------------------- |
| localToken | `address` | The local token address. |
| foreignEvmChainId | `uint256` | The foreign EVM chain ID. |
| foreignToken | `address` | The foreign token address. |
## Structs
### CctpV2BridgeConfigStorage
**Note:**
* **storage-location:** erc7201:makina.storage.CctpV2BridgeConfig
```solidity
struct CctpV2BridgeConfigStorage {
mapping(uint256 evmChainId => uint32 cctpDomain) _evmToCctpId;
mapping(uint32 cctpDomain => uint256 evmChainId) _cctpToEvmId;
mapping(address localToken => mapping(uint256 foreignEvmChainId => address foreignToken)) _localToForeignToken;
mapping(address foreignToken => mapping(uint256 foreignEvmChainId => address localToken)) _foreignToLocalToken;
}
```
**Properties**
| Name | Type | Description |
| --------------------- | ------------------------------------------------------------------------------------------- | ----------- |
| \_evmToCctpId | `mapping(uint256 evmChainId => uint32 cctpDomain)` | |
| \_cctpToEvmId | `mapping(uint32 cctpDomain => uint256 evmChainId)` | |
| \_localToForeignToken | `mapping(address localToken => mapping(uint256 foreignEvmChainId => address foreignToken))` | |
| \_foreignToLocalToken | `mapping(address foreignToken => mapping(uint256 foreignEvmChainId => address localToken))` | |
# LayerZeroV2BridgeConfig
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/bridge/configs/LayerZeroV2BridgeConfig.sol)
**Inherits:** AccessManagedUpgradeable, [ILayerZeroV2BridgeConfig](/contracts/core/interfaces/interface.ILayerZeroV2BridgeConfig)
## Constants
### LayerZeroV2BridgeConfigStorageLocation
```solidity
bytes32 private constant LayerZeroV2BridgeConfigStorageLocation =
0x9968c8893e7d72567bf0ce47e55989cd61e749404314ded743fba239bde60b00;
```
## Functions
### \_getLayerZeroV2BridgeConfigStorage
```solidity
function _getLayerZeroV2BridgeConfigStorage() private pure returns (LayerZeroV2BridgeConfigStorage storage $);
```
**Returns**
| Name | Type | Description |
| ---- | -------------------------------- | ----------- |
| \$ | `LayerZeroV2BridgeConfigStorage` | |
### constructor
```solidity
constructor();
```
### initialize
```solidity
function initialize(address initialAuthority) external initializer;
```
**Parameters**
| Name | Type | Description |
| ---------------- | --------- | ----------- |
| initialAuthority | `address` | |
### isRouteSupported
Returns whether a bridge transfer route is supported for the associated bridge.
```solidity
function isRouteSupported(address inputToken, uint256 foreignChainId, address outputToken)
external
view
override
returns (bool);
```
**Parameters**
| Name | Type | Description |
| -------------- | --------- | -------------------------------------------------- |
| inputToken | `address` | The token being sent from the source chain. |
| foreignChainId | `uint256` | The destination chain ID. |
| outputToken | `address` | The token being received on the destination chain. |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ------------------------------------------------ |
| \ | `bool` | True if the route is supported, false otherwise. |
### getLzEndpointId
EVM chain ID => LayerZero endpoint ID
```solidity
function getLzEndpointId(uint256 evmChainId) external view override returns (uint32);
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| evmChainId | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | -------- | ----------- |
| \ | `uint32` | |
### getOft
Local token address => LayerZero OFT address
```solidity
function getOft(address localToken) external view override returns (address);
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| localToken | `address` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### getForeignToken
Local token address => Foreign EVM chain ID => Foreign Token address
```solidity
function getForeignToken(address localToken, uint256 foreignEvmChainId) external view override returns (address);
```
**Parameters**
| Name | Type | Description |
| ----------------- | --------- | ----------- |
| localToken | `address` | |
| foreignEvmChainId | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### setLzEndpointId
Associates an EVM chain ID with a LayerZero endpoint ID in the contract storage.
```solidity
function setLzEndpointId(uint256 evmChainId, uint32 lzEndpointId) external override restricted;
```
**Parameters**
| Name | Type | Description |
| ------------ | --------- | -------------------------- |
| evmChainId | `uint256` | The EVM chain ID. |
| lzEndpointId | `uint32` | The LayerZero endpoint ID. |
### setOft
Registers a LayerZero OFT for its associated token.
Assumes that an OFT's associated token is immutable.
Overwrites any previously registered OFT for the provided OFT's associated token.
```solidity
function setOft(address oft) external override restricted;
```
**Parameters**
| Name | Type | Description |
| ---- | --------- | --------------------------------- |
| oft | `address` | The address of the LayerZero OFT. |
### setForeignToken
Associates a local token with its foreign counterpart used in LayerZero bridging.
```solidity
function setForeignToken(address localToken, uint256 foreignEvmChainId, address foreignToken)
external
override
restricted;
```
**Parameters**
| Name | Type | Description |
| ----------------- | --------- | -------------------------- |
| localToken | `address` | The local token address. |
| foreignEvmChainId | `uint256` | The foreign EVM chain ID. |
| foreignToken | `address` | The foreign token address. |
## Structs
### LayerZeroV2BridgeConfigStorage
**Note:**
* **storage-location:** erc7201:makina.storage.LayerZeroV2BridgeConfig
```solidity
struct LayerZeroV2BridgeConfigStorage {
mapping(uint256 evmChainId => uint32 lzEndpointId) _evmToLzId;
mapping(uint32 lzEndpointId => uint256 evmChainId) _lzToEvmId;
mapping(address localToken => address oft) _localTokenToOft;
mapping(address localToken => mapping(uint256 foreignEvmChainId => address foreignToken)) _localToForeignToken;
mapping(address foreignToken => mapping(uint256 foreignEvmChainId => address localToken)) _foreignToLocalToken;
}
```
**Properties**
| Name | Type | Description |
| --------------------- | ------------------------------------------------------------------------------------------- | ----------- |
| \_evmToLzId | `mapping(uint256 evmChainId => uint32 lzEndpointId)` | |
| \_lzToEvmId | `mapping(uint32 lzEndpointId => uint256 evmChainId)` | |
| \_localTokenToOft | `mapping(address localToken => address oft)` | |
| \_localToForeignToken | `mapping(address localToken => mapping(uint256 foreignEvmChainId => address foreignToken))` | |
| \_foreignToLocalToken | `mapping(address foreignToken => mapping(uint256 foreignEvmChainId => address localToken))` | |
# BridgeController
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/bridge/controller/BridgeController.sol)
**Inherits:** [MakinaContext](/contracts/core/utils/abstract.MakinaContext), [IBridgeController](/contracts/core/interfaces/interface.IBridgeController)
## Constants
### MAX\_BPS
Full scale value in basis points
```solidity
uint256 private constant MAX_BPS = 10_000;
```
### BridgeControllerStorageLocation
```solidity
bytes32 private constant BridgeControllerStorageLocation =
0x7363d524082cdf545f1ac33985598b84d2470b8b4fbcc6cb47698cc1b2a03500;
```
## Functions
### \_getBridgeControllerStorage
```solidity
function _getBridgeControllerStorage() internal pure returns (BridgeControllerStorage storage $);
```
**Returns**
| Name | Type | Description |
| ---- | ------------------------- | ----------- |
| \$ | `BridgeControllerStorage` | |
### onlyFactory
```solidity
modifier onlyFactory();
```
### isBridgeSupported
Bridge ID => Is bridge adapter deployed.
```solidity
function isBridgeSupported(uint16 bridgeId) external view override returns (bool);
```
**Parameters**
| Name | Type | Description |
| -------- | -------- | ----------- |
| bridgeId | `uint16` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### isOutTransferEnabled
Bridge ID => Is outgoing transfer enabled.
```solidity
function isOutTransferEnabled(uint16 bridgeId) external view override returns (bool);
```
**Parameters**
| Name | Type | Description |
| -------- | -------- | ----------- |
| bridgeId | `uint16` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### getBridgeAdapter
Bridge ID => Address of the associated bridge adapter.
```solidity
function getBridgeAdapter(uint16 bridgeId) public view override returns (address);
```
**Parameters**
| Name | Type | Description |
| -------- | -------- | ----------- |
| bridgeId | `uint16` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### getMaxBridgeLossBps
Bridge ID => Max allowed value loss in basis points for transfers via this bridge.
```solidity
function getMaxBridgeLossBps(uint16 bridgeId) external view override returns (uint256);
```
**Parameters**
| Name | Type | Description |
| -------- | -------- | ----------- |
| bridgeId | `uint16` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### setBridgeAdapter
Sets a bridge adapter instance for a given bridge ID.
```solidity
function setBridgeAdapter(uint16 bridgeId, address bridgeAdapter, uint256 initialMaxBridgeLossBps)
external
override
onlyFactory;
```
**Parameters**
| Name | Type | Description |
| ----------------------- | --------- | ------------------------------------------------------------------------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
| bridgeAdapter | `address` | The address of the new bridge adapter instance. |
| initialMaxBridgeLossBps | `uint256` | The initial maximum allowed value loss in basis points for transfers via this bridge. |
### \_disableOutTransfer
Internal logic to disable outgoing transfers for a given bridge.
```solidity
function _disableOutTransfer(uint16 bridgeId) internal;
```
**Parameters**
| Name | Type | Description |
| -------- | -------- | ----------- |
| bridgeId | `uint16` | |
### \_enableOutTransfer
Internal logic to enable outgoing transfers for a given bridge.
```solidity
function _enableOutTransfer(uint16 bridgeId) internal;
```
**Parameters**
| Name | Type | Description |
| -------- | -------- | ----------- |
| bridgeId | `uint16` | |
### \_setMaxBridgeLossBps
Internal logic to set the max allowed value loss in basis points for transfers via a given bridge.
```solidity
function _setMaxBridgeLossBps(uint16 bridgeId, uint256 maxBridgeLossBps) internal;
```
**Parameters**
| Name | Type | Description |
| ---------------- | --------- | ----------- |
| bridgeId | `uint16` | |
| maxBridgeLossBps | `uint256` | |
### \_isBridgeAdapter
Returns whether the given address is a registered bridge adapter.
```solidity
function _isBridgeAdapter(address adapter) internal view returns (bool);
```
**Parameters**
| Name | Type | Description |
| ------- | --------- | ----------- |
| adapter | `address` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### \_scheduleOutBridgeTransfer
Internal logic to schedule an outgoing bridge transfer.
```solidity
function _scheduleOutBridgeTransfer(
uint16 bridgeId,
uint256 destinationChainId,
address recipient,
address inputToken,
uint256 inputAmount,
uint256 minOutputAmount
) internal;
```
**Parameters**
| Name | Type | Description |
| ------------------ | --------- | ----------- |
| bridgeId | `uint16` | |
| destinationChainId | `uint256` | |
| recipient | `address` | |
| inputToken | `address` | |
| inputAmount | `uint256` | |
| minOutputAmount | `uint256` | |
### \_sendOutBridgeTransfer
Internal logic to execute a scheduled outgoing bridge transfer.
```solidity
function _sendOutBridgeTransfer(uint16 bridgeId, uint256 transferId, bytes calldata data) internal;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| bridgeId | `uint16` | |
| transferId | `uint256` | |
| data | `bytes` | |
### \_authorizeInBridgeTransfer
Internal logic to register a message hash as authorized for an incoming bridge transfer.
```solidity
function _authorizeInBridgeTransfer(uint16 bridgeId, bytes32 messageHash) internal;
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | ----------- |
| bridgeId | `uint16` | |
| messageHash | `bytes32` | |
### \_claimInBridgeTransfer
Internal logic to transfer a received bridge transfer out of the corresponding bridge adapter.
```solidity
function _claimInBridgeTransfer(uint16 bridgeId, uint256 transferId) internal;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| bridgeId | `uint16` | |
| transferId | `uint256` | |
### \_cancelOutBridgeTransfer
Internal logic to cancel an outgoing bridge transfer.
```solidity
function _cancelOutBridgeTransfer(uint16 bridgeId, uint256 transferId) internal;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| bridgeId | `uint16` | |
| transferId | `uint256` | |
## Structs
### BridgeControllerStorage
**Note:**
* **storage-location:** erc7201:makina.storage.BridgeController
```solidity
struct BridgeControllerStorage {
uint16[] _supportedBridges;
mapping(uint16 bridgeId => address adapter) _bridgeAdapters;
mapping(uint16 bridgeId => uint256 maxBridgeLossBps) _maxBridgeLossBps;
mapping(uint16 bridgeId => bool isOutTransferEnabled) _isOutTransferEnabled;
mapping(address addr => bool isAdapter) _isBridgeAdapter;
}
```
**Properties**
| Name | Type | Description |
| ---------------------- | ------------------------------------------------------- | ----------- |
| \_supportedBridges | `uint16[]` | |
| \_bridgeAdapters | `mapping(uint16 bridgeId => address adapter)` | |
| \_maxBridgeLossBps | `mapping(uint16 bridgeId => uint256 maxBridgeLossBps)` | |
| \_isOutTransferEnabled | `mapping(uint16 bridgeId => bool isOutTransferEnabled)` | |
| \_isBridgeAdapter | `mapping(address addr => bool isAdapter)` | |
# SwapModule
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/swap/SwapModule.sol)
**Inherits:** AccessManagedUpgradeable, [MakinaContext](/contracts/core/utils/abstract.MakinaContext), [ISwapModule](/contracts/core/interfaces/interface.ISwapModule)
## Constants
### SwapModuleStorageLocation
```solidity
bytes32 private constant SwapModuleStorageLocation =
0x2964c0594a3da0414db90b8d5f6c112accd22109f0399a98ea4b239ff3f7a200;
```
## Functions
### \_getSwapModuleStorage
```solidity
function _getSwapModuleStorage() private pure returns (SwapModuleStorage storage $);
```
**Returns**
| Name | Type | Description |
| ---- | ------------------- | ----------- |
| \$ | `SwapModuleStorage` | |
### constructor
```solidity
constructor(address _registry) MakinaContext(_registry);
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| \_registry | `address` | |
### initialize
```solidity
function initialize(address initialAuthority) external initializer;
```
**Parameters**
| Name | Type | Description |
| ---------------- | --------- | ----------- |
| initialAuthority | `address` | |
### getSwapperTargets
Returns approval and execution targets for a given swapper ID.
```solidity
function getSwapperTargets(uint16 swapperId)
external
view
override
returns (address approvalTarget, address executionTarget);
```
**Parameters**
| Name | Type | Description |
| --------- | -------- | --------------- |
| swapperId | `uint16` | The swapper ID. |
**Returns**
| Name | Type | Description |
| --------------- | --------- | --------------------- |
| approvalTarget | `address` | The approval target. |
| executionTarget | `address` | The execution target. |
### swap
Swaps tokens using a given swapper.
```solidity
function swap(SwapOrder calldata order) external override returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ----- | ----------- | ---------------------- |
| order | `SwapOrder` | The swap order object. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### setSwapperTargets
Sets approval and execution targets for a given swapper ID.
```solidity
function setSwapperTargets(uint16 swapperId, address approvalTarget, address executionTarget)
external
override
restricted;
```
**Parameters**
| Name | Type | Description |
| --------------- | --------- | --------------------- |
| swapperId | `uint16` | The swapper ID. |
| approvalTarget | `address` | The approval target. |
| executionTarget | `address` | The execution target. |
## Structs
### SwapModuleStorage
**Note:**
* **storage-location:** erc7201:makina.storage.SwapModule
```solidity
struct SwapModuleStorage {
mapping(uint16 swapperId => SwapperTargets targets) _swapperTargets;
}
```
**Properties**
| Name | Type | Description |
| ---------------- | ----------------------------------------------------- | ----------- |
| \_swapperTargets | `mapping(uint16 swapperId => SwapperTargets targets)` | |
# CctpV2Message
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/libraries/CctpV2Message.sol)
## Constants
### MESSAGE\_SOURCE\_DOMAIN\_INDEX
Indexes in message
```solidity
uint256 private constant MESSAGE_SOURCE_DOMAIN_INDEX = 4;
```
### MESSAGE\_RECIPIENT\_INDEX
```solidity
uint256 private constant MESSAGE_RECIPIENT_INDEX = 76;
```
### MESSAGE\_BODY\_INDEX
```solidity
uint256 private constant MESSAGE_BODY_INDEX = 148;
```
### BODY\_BURN\_TOKEN\_INDEX
Indexes in message body
```solidity
uint256 private constant BODY_BURN_TOKEN_INDEX = 4;
```
### BODY\_MINT\_RECIPIENT\_INDEX
```solidity
uint256 private constant BODY_MINT_RECIPIENT_INDEX = 36;
```
### BODY\_HOOK\_DATA\_INDEX
```solidity
uint256 private constant BODY_HOOK_DATA_INDEX = 228;
```
## Functions
### checkMessageLength
Checks that `message` has the minimum length required for parsing.
Must be called before parsing.
```solidity
function checkMessageLength(bytes calldata message) internal pure;
```
**Parameters**
| Name | Type | Description |
| ------- | ------- | ----------- |
| message | `bytes` | |
### getSourceDomain
Returns the source domain.
```solidity
function getSourceDomain(bytes calldata message) internal pure returns (uint32);
```
**Parameters**
| Name | Type | Description |
| ------- | ------- | ----------- |
| message | `bytes` | |
**Returns**
| Name | Type | Description |
| ------------ | -------- | ----------- |
| \ | `uint32` | |
### getRecipient
Returns the recipient.
```solidity
function getRecipient(bytes calldata message) internal pure returns (address);
```
**Parameters**
| Name | Type | Description |
| ------- | ------- | ----------- |
| message | `bytes` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### getBurnToken
Returns the burn token from the message body.
```solidity
function getBurnToken(bytes calldata message) internal pure returns (bytes32);
```
**Parameters**
| Name | Type | Description |
| ------- | ------- | ----------- |
| message | `bytes` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `bytes32` | |
### getMintRecipient
Returns the mint recipient from the message body.
```solidity
function getMintRecipient(bytes calldata message) internal pure returns (address);
```
**Parameters**
| Name | Type | Description |
| ------- | ------- | ----------- |
| message | `bytes` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### getHookData
Returns the hook data from the message body.
```solidity
function getHookData(bytes calldata message) internal pure returns (bytes memory);
```
**Parameters**
| Name | Type | Description |
| ------- | ------- | ----------- |
| message | `bytes` | |
**Returns**
| Name | Type | Description |
| ------------ | ------- | ----------- |
| \ | `bytes` | |
### addressToBytes32
Converts an address to bytes32.
```solidity
function addressToBytes32(address addr) internal pure returns (bytes32);
```
**Parameters**
| Name | Type | Description |
| ---- | --------- | ----------- |
| addr | `address` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `bytes32` | |
### bytes32ToAddress
Converts a bytes32 to address.
```solidity
function bytes32ToAddress(bytes32 b) internal pure returns (address);
```
**Parameters**
| Name | Type | Description |
| ---- | --------- | ----------- |
| b | `bytes32` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
# DecimalsUtils
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/libraries/DecimalsUtils.sol)
## Constants
### MIN\_DECIMALS
Supported decimals range for assets
```solidity
uint8 private constant MIN_DECIMALS = 6;
```
### MAX\_DECIMALS
```solidity
uint8 private constant MAX_DECIMALS = 18;
```
### SHARE\_TOKEN\_DECIMALS
Decimals and unit for machine share token.
```solidity
uint8 internal constant SHARE_TOKEN_DECIMALS = 18;
```
### SHARE\_TOKEN\_UNIT
```solidity
uint256 internal constant SHARE_TOKEN_UNIT = 10 ** SHARE_TOKEN_DECIMALS;
```
## Functions
### \_checkDecimals
Checks that asset exposes decimals() and that it is within the supported range.
```solidity
function _checkDecimals(address asset) internal view;
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ----------- |
| asset | `address` | |
# Errors
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/libraries/Errors.sol)
## Errors
### AccountingToken
```solidity
error AccountingToken();
```
### ActiveUpdatePending
```solidity
error ActiveUpdatePending();
```
### AlreadyAccountingAgent
```solidity
error AlreadyAccountingAgent();
```
### AlreadyBaseToken
```solidity
error AlreadyBaseToken();
```
### AlreadyDisabled
```solidity
error AlreadyDisabled();
```
### AlreadyEnabled
```solidity
error AlreadyEnabled();
```
### AlreadyPositionToken
```solidity
error AlreadyPositionToken();
```
### AlreadyRootGuardian
```solidity
error AlreadyRootGuardian();
```
### AmountOutTooLow
```solidity
error AmountOutTooLow();
```
### BridgeAdapterAlreadySet
```solidity
error BridgeAdapterAlreadySet();
```
### BridgeConfigNotSet
```solidity
error BridgeConfigNotSet();
```
### BridgeStateMismatch
```solidity
error BridgeStateMismatch();
```
### CaliberAccountingStale
```solidity
error CaliberAccountingStale(uint256 caliberChainId);
```
**Parameters**
| Name | Type | Description |
| -------------- | --------- | ----------- |
| caliberChainId | `uint256` | |
### CaliberAlreadySet
```solidity
error CaliberAlreadySet();
```
### CaliberNotEmpty
```solidity
error CaliberNotEmpty();
```
### CctpDomainNotRegistered
```solidity
error CctpDomainNotRegistered();
```
### CctpForeignTokenNotRegistered
```solidity
error CctpForeignTokenNotRegistered();
```
### CctpMessageReceptionFailed
```solidity
error CctpMessageReceptionFailed();
```
### Create3ContractDeploymentFailed
```solidity
error Create3ContractDeploymentFailed();
```
### Create3ProxyDeploymentFailed
```solidity
error Create3ProxyDeploymentFailed();
```
### CreWorkflowIdAlreadyAuthorized
```solidity
error CreWorkflowIdAlreadyAuthorized();
```
### CreWorkflowIdNotAuthorized
```solidity
error CreWorkflowIdNotAuthorized();
```
### DirectManageFlashLoanCall
```solidity
error DirectManageFlashLoanCall();
```
### ExceededMaxDeposit
```solidity
error ExceededMaxDeposit();
```
### ExceededMaxFee
```solidity
error ExceededMaxFee(uint256 fee, uint256 max);
```
**Parameters**
| Name | Type | Description |
| ---- | --------- | ----------- |
| fee | `uint256` | |
| max | `uint256` | |
### ExceededMaxMint
```solidity
error ExceededMaxMint(uint256 shares, uint256 max);
```
**Parameters**
| Name | Type | Description |
| ------ | --------- | ----------- |
| shares | `uint256` | |
| max | `uint256` | |
### ExceededMaxWithdraw
```solidity
error ExceededMaxWithdraw(uint256 assets, uint256 max);
```
**Parameters**
| Name | Type | Description |
| ------ | --------- | ----------- |
| assets | `uint256` | |
| max | `uint256` | |
### ForeignTokenNotRegistered
```solidity
error ForeignTokenNotRegistered(address token, uint256 foreignEvmChainId);
```
**Parameters**
| Name | Type | Description |
| ----------------- | --------- | ----------- |
| token | `address` | |
| foreignEvmChainId | `uint256` | |
### FutureSnapshot
```solidity
error FutureSnapshot();
```
### GroupIdNotProvided
```solidity
error GroupIdNotProvided();
```
### HubBridgeAdapterAlreadySet
```solidity
error HubBridgeAdapterAlreadySet();
```
### HubBridgeAdapterNotSet
```solidity
error HubBridgeAdapterNotSet();
```
### InstructionsMismatch
```solidity
error InstructionsMismatch();
```
### InsufficientBalance
```solidity
error InsufficientBalance();
```
### InvalidAccounting
```solidity
error InvalidAccounting();
```
### InvalidAffectedToken
```solidity
error InvalidAffectedToken();
```
### InvalidBridgeController
```solidity
error InvalidBridgeController();
```
### InvalidBridgeId
```solidity
error InvalidBridgeId();
```
### InvalidBridgeTransferRoute
```solidity
error InvalidBridgeTransferRoute();
```
### InvalidCctpMessage
```solidity
error InvalidCctpMessage();
```
### InvalidChainId
```solidity
error InvalidChainId();
```
### InvalidCreMetadataLength
```solidity
error InvalidCreMetadataLength();
```
### InvalidCreWorkflowId
```solidity
error InvalidCreWorkflowId();
```
### InvalidDebtFlag
```solidity
error InvalidDebtFlag();
```
### InvalidDecimals
```solidity
error InvalidDecimals();
```
### InvalidFeedRoute
```solidity
error InvalidFeedRoute();
```
### InvalidInputAmount
```solidity
error InvalidInputAmount();
```
### InvalidInputToken
```solidity
error InvalidInputToken();
```
### InvalidInstructionProof
```solidity
error InvalidInstructionProof();
```
### InvalidInstructionType
```solidity
error InvalidInstructionType();
```
### InvalidLzSentAmount
```solidity
error InvalidLzSentAmount();
```
### InvalidOft
```solidity
error InvalidOft();
```
### InvalidOutputToken
```solidity
error InvalidOutputToken();
```
### InvalidPositionChangeDirection
```solidity
error InvalidPositionChangeDirection();
```
### InvalidRecipientChainId
```solidity
error InvalidRecipientChainId();
```
### InvalidSpokeCaliberMailbox
```solidity
error InvalidSpokeCaliberMailbox();
```
### InvalidTransferStatus
```solidity
error InvalidTransferStatus();
```
### LocalTokenNotRegistered
```solidity
error LocalTokenNotRegistered(address token, uint256 foreignEvmChainId);
```
**Parameters**
| Name | Type | Description |
| ----------------- | --------- | ----------- |
| token | `address` | |
| foreignEvmChainId | `uint256` | |
### LzEndpointIdNotRegistered
```solidity
error LzEndpointIdNotRegistered();
```
### LzForeignTokenNotRegistered
```solidity
error LzForeignTokenNotRegistered();
```
### ManageFlashLoanReentrantCall
```solidity
error ManageFlashLoanReentrantCall();
```
### MaxAuthorizedPriceChangeExceeded
```solidity
error MaxAuthorizedPriceChangeExceeded();
```
### MaxValueLossExceeded
```solidity
error MaxValueLossExceeded();
```
### MessageAlreadyAuthorized
```solidity
error MessageAlreadyAuthorized();
```
### Migrated
```solidity
error Migrated();
```
### MinOutputAmountExceedsInputAmount
```solidity
error MinOutputAmountExceedsInputAmount();
```
### MismatchedLengths
```solidity
error MismatchedLengths();
```
### MissingInstructionForGroup
```solidity
error MissingInstructionForGroup(uint256 groupId);
```
**Parameters**
| Name | Type | Description |
| ------- | --------- | ----------- |
| groupId | `uint256` | |
### NegativeTokenPrice
```solidity
error NegativeTokenPrice(address priceFeed);
```
**Parameters**
| Name | Type | Description |
| --------- | --------- | ----------- |
| priceFeed | `address` | |
### NonZeroBalance
```solidity
error NonZeroBalance();
```
### NoPendingUpdate
```solidity
error NoPendingUpdate();
```
### NotAccountingAgent
```solidity
error NotAccountingAgent();
```
### NotBaseToken
```solidity
error NotBaseToken();
```
### NotCaliber
```solidity
error NotCaliber();
```
### NotController
```solidity
error NotController();
```
### NotFactory
```solidity
error NotFactory();
```
### NotFactoryAuthority
```solidity
error NotFactoryAuthority();
```
### NotFlashLoanModule
```solidity
error NotFlashLoanModule();
```
### NotMachineEndpoint
```solidity
error NotMachineEndpoint();
```
### NotMigrated
```solidity
error NotMigrated();
```
### NotPendingMachine
```solidity
error NotPendingMachine();
```
### NotPreDepositVault
```solidity
error NotPreDepositVault();
```
### NotRootGuardian
```solidity
error NotRootGuardian();
```
### OftNotRegistered
```solidity
error OftNotRegistered();
```
### OngoingCooldown
```solidity
error OngoingCooldown();
```
### OutTransferNotEnabled
```solidity
error OutTransferNotEnabled();
```
### PendingBridgeTransfer
```solidity
error PendingBridgeTransfer();
```
### PositionAccountingStale
```solidity
error PositionAccountingStale(uint256 posId);
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ----------- |
| posId | `uint256` | |
### PositionDoesNotExist
```solidity
error PositionDoesNotExist();
```
### PositionIsGrouped
```solidity
error PositionIsGrouped();
```
### PositionToken
```solidity
error PositionToken();
```
### PositionTokenIsBaseToken
```solidity
error PositionTokenIsBaseToken();
```
### PriceFeedRouteNotRegistered
```solidity
error PriceFeedRouteNotRegistered(address token);
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ----------- |
| token | `address` | |
### PriceFeedStale
```solidity
error PriceFeedStale(address priceFeed, uint256 updatedAt);
```
**Parameters**
| Name | Type | Description |
| --------- | --------- | ----------- |
| priceFeed | `address` | |
| updatedAt | `uint256` | |
### ProtectedAccountingAgent
```solidity
error ProtectedAccountingAgent();
```
### ProtectedCctpDomain
```solidity
error ProtectedCctpDomain();
```
### ProtectedChainId
```solidity
error ProtectedChainId();
```
### ProtectedRootGuardian
```solidity
error ProtectedRootGuardian();
```
### RecoveryMode
```solidity
error RecoveryMode();
```
### SameRoot
```solidity
error SameRoot();
```
### SlippageProtection
```solidity
error SlippageProtection();
```
### SpokeBridgeAdapterAlreadySet
```solidity
error SpokeBridgeAdapterAlreadySet();
```
### SpokeBridgeAdapterNotSet
```solidity
error SpokeBridgeAdapterNotSet();
```
### SpokeCaliberAlreadySet
```solidity
error SpokeCaliberAlreadySet();
```
### SpokeCaliberNotEnabled
```solidity
error SpokeCaliberNotEnabled();
```
### StaleSnapshot
```solidity
error StaleSnapshot();
```
### SwapFailed
```solidity
error SwapFailed();
```
### SwapperTargetsNotSet
```solidity
error SwapperTargetsNotSet();
```
### TargetAlreadyExists
```solidity
error TargetAlreadyExists();
```
### UnauthorizedCaller
```solidity
error UnauthorizedCaller();
```
### UnauthorizedSource
```solidity
error UnauthorizedSource();
```
### UnexpectedMessage
```solidity
error UnexpectedMessage();
```
### ZeroBridgeAdapterAddress
```solidity
error ZeroBridgeAdapterAddress();
```
### ZeroChainId
```solidity
error ZeroChainId();
```
### ZeroGroupId
```solidity
error ZeroGroupId();
```
### ZeroLzEndpointId
```solidity
error ZeroLzEndpointId();
```
### ZeroOftAddress
```solidity
error ZeroOftAddress();
```
### ZeroPositionId
```solidity
error ZeroPositionId();
```
### ZeroSalt
```solidity
error ZeroSalt();
```
### ZeroSpokeCaliberMailboxAddress
```solidity
error ZeroSpokeCaliberMailboxAddress();
```
### ZeroTokenAddress
```solidity
error ZeroTokenAddress();
```
# LzOptionsBuilder
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/libraries/LzOptionsBuilder.sol)
**Title:** LzOptionsBuilder
Library for building and encoding various LayerZero V2 message options.
Forked and simplified from layerzerolabs/oapp-evm/contracts/oapp/libs/OptionsBuilder.sol
## Constants
### TYPE\_3
```solidity
uint16 internal constant TYPE_3 = 3;
```
## Functions
### newOptions
```solidity
function newOptions() internal pure returns (bytes memory);
```
**Returns**
| Name | Type | Description |
| ------------ | ------- | ----------- |
| \ | `bytes` | |
### addExecutorLzReceiveOption
```solidity
function addExecutorLzReceiveOption(bytes memory _options, uint128 _gas) internal pure returns (bytes memory);
```
**Parameters**
| Name | Type | Description |
| --------- | --------- | ----------- |
| \_options | `bytes` | |
| \_gas | `uint128` | |
**Returns**
| Name | Type | Description |
| ------------ | ------- | ----------- |
| \ | `bytes` | |
### addExecutorLzComposeOption
```solidity
function addExecutorLzComposeOption(bytes memory _options, uint16 _index, uint128 _gas)
internal
pure
returns (bytes memory);
```
**Parameters**
| Name | Type | Description |
| --------- | --------- | ----------- |
| \_options | `bytes` | |
| \_index | `uint16` | |
| \_gas | `uint128` | |
**Returns**
| Name | Type | Description |
| ------------ | ------- | ----------- |
| \ | `bytes` | |
### addExecutorOption
```solidity
function addExecutorOption(bytes memory _options, uint8 _optionType, bytes memory _option)
internal
pure
returns (bytes memory);
```
**Parameters**
| Name | Type | Description |
| ------------ | ------- | ----------- |
| \_options | `bytes` | |
| \_optionType | `uint8` | |
| \_option | `bytes` | |
**Returns**
| Name | Type | Description |
| ------------ | ------- | ----------- |
| \ | `bytes` | |
# MachineUtils
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/libraries/MachineUtils.sol)
## Constants
### RATE\_SCALE
```solidity
uint256 private constant RATE_SCALE = 1e18;
```
### MAX\_SNAPSHOT\_FUTURE\_TOLERANCE
Max seconds a snapshot timestamp may be ahead of the current hub block timestamp and still be accepted, to absorb cross-chain clock skew.
```solidity
uint256 private constant MAX_SNAPSHOT_FUTURE_TOLERANCE = 60;
```
## Functions
### updateTotalAum
Updates the total AUM of the machine and performs share price change check.
```solidity
function updateTotalAum(Machine.MachineStorage storage $, address oracleRegistry, bool sharePriceChangeCheck)
external
returns (uint256);
```
**Parameters**
| Name | Type | Description |
| --------------------- | ------------------------ | ------------------------------------------------------------- |
| \$ | `Machine.MachineStorage` | The machine storage struct. |
| oracleRegistry | `address` | The address of the oracle registry. |
| sharePriceChangeCheck | `bool` | True to perform share price change check, false to bypass it. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ---------------------- |
| \ | `uint256` | The updated total AUM. |
### manageFees
Manages the fee minting process, including calculating and minting fixed and performance fees.
```solidity
function manageFees(Machine.MachineStorage storage $) external returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ---- | ------------------------ | --------------------------- |
| \$ | `Machine.MachineStorage` | The machine storage struct. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | -------------------------------- |
| \ | `uint256` | The fees minted in share tokens. |
### reportSpokeAccountingSnapshots
Reports spoke caliber accounting snapshots by decoding the report payload and updating the machine storage accordingly.
```solidity
function reportSpokeAccountingSnapshots(
Machine.MachineStorage storage $,
address tokenRegistry,
bytes calldata report
) external;
```
**Parameters**
| Name | Type | Description |
| ------------- | ------------------------ | -------------------------------------------------- |
| \$ | `Machine.MachineStorage` | The machine storage struct. |
| tokenRegistry | `address` | The address of the token registry. |
| report | `bytes` | The report payload containing the accounting data. |
### migrateFromPreDeposit
Manages the migration from a pre-deposit vault to a machine, and initializes the machine's AUM.
```solidity
function migrateFromPreDeposit(Machine.MachineStorage storage $, address preDepositVault, address oracleRegistry)
external;
```
**Parameters**
| Name | Type | Description |
| --------------- | ------------------------ | ------------------------------------- |
| \$ | `Machine.MachineStorage` | The machine storage struct. |
| preDepositVault | `address` | The address of the pre-deposit vault. |
| oracleRegistry | `address` | The address of the oracle registry. |
### checkBridgeTransfersSettled
Checks that there are no pending bridge transfers between the machine and a spoke caliber.
```solidity
function checkBridgeTransfersSettled(IMachine.SpokeCaliberData storage spokeCaliberData) external view;
```
**Parameters**
| Name | Type | Description |
| ---------------- | --------------------------- | --------------------------------------------------------------------- |
| spokeCaliberData | `IMachine.SpokeCaliberData` | The spoke caliber data struct containing the bridge transfer records. |
### getSharePrice
Calculates the share price based on given AUM, share supply and share token decimals offset.
```solidity
function getSharePrice(uint256 aum, uint256 supply, uint256 shareTokenDecimalsOffset)
public
pure
returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ------------------------ | --------- | ------------------------------------------------------------- |
| aum | `uint256` | The AUM of the machine. |
| supply | `uint256` | The supply of the share token. |
| shareTokenDecimalsOffset | `uint256` | The decimals offset between share token and accounting token. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | --------------------------- |
| \ | `uint256` | The calculated share price. |
### \_handlePerChainSnapshot
Handles an accounting snapshot received from a spoke chain and updates the corresponding accounting state stored in the machine.
```solidity
function _handlePerChainSnapshot(
Machine.MachineStorage storage $,
address tokenRegistry,
ICaliberMailbox.SpokeCaliberAccountingData memory snapshot
) private;
```
**Parameters**
| Name | Type | Description |
| ------------- | -------------------------------------------- | ---------------------------------- |
| \$ | `Machine.MachineStorage` | The machine storage struct. |
| tokenRegistry | `address` | The address of the token registry. |
| snapshot | `ICaliberMailbox.SpokeCaliberAccountingData` | The accounting snapshot data. |
### \_decodeAndMapBridgeAmounts
Decodes (foreignToken, amount) pairs, resolves local tokens, and stores amounts in the map.
```solidity
function _decodeAndMapBridgeAmounts(
uint256 chainId,
bytes[] memory data,
EnumerableMap.AddressToUintMap storage map,
address tokenRegistry
) private;
```
**Parameters**
| Name | Type | Description |
| ------------- | -------------------------------- | ----------- |
| chainId | `uint256` | |
| data | `bytes[]` | |
| map | `EnumerableMap.AddressToUintMap` | |
| tokenRegistry | `address` | |
### \_getTotalAum
Computes the total AUM of the machine.
```solidity
function _getTotalAum(Machine.MachineStorage storage $, address oracleRegistry) private view returns (uint256);
```
**Parameters**
| Name | Type | Description |
| -------------- | ------------------------ | ----------------------------------- |
| \$ | `Machine.MachineStorage` | The machine storage struct. |
| oracleRegistry | `address` | The address of the oracle registry. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### \_checkBridgeState
Checks if the bridge state is consistent between the machine and spoke caliber.
```solidity
function _checkBridgeState(
EnumerableMap.AddressToUintMap storage insMap,
EnumerableMap.AddressToUintMap storage outsMap
) private view;
```
**Parameters**
| Name | Type | Description |
| ------- | -------------------------------- | ----------- |
| insMap | `EnumerableMap.AddressToUintMap` | |
| outsMap | `EnumerableMap.AddressToUintMap` | |
### \_accountingValueOf
Computes the accounting value of a given token amount.
```solidity
function _accountingValueOf(address oracleRegistry, address accountingToken, address token, uint256 amount)
private
view
returns (uint256);
```
**Parameters**
| Name | Type | Description |
| --------------- | --------- | ----------- |
| oracleRegistry | `address` | |
| accountingToken | `address` | |
| token | `address` | |
| amount | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### \_checkMaxRelativeChange
Checks that the relative change between two values does not exceed the maximum allowed rate over elapsed time.
```solidity
function _checkMaxRelativeChange(
uint256 previousValue,
uint256 newValue,
uint256 maxPercentDeltaPerSecond,
uint256 elapsedTime
) private pure;
```
**Parameters**
| Name | Type | Description |
| ------------------------ | --------- | ----------- |
| previousValue | `uint256` | |
| newValue | `uint256` | |
| maxPercentDeltaPerSecond | `uint256` | |
| elapsedTime | `uint256` | |
# Roles
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/libraries/Roles.sol)
## Constants
### INFRA\_CONFIG\_ROLE
```solidity
uint64 public constant INFRA_CONFIG_ROLE = 1;
```
### STRATEGY\_DEPLOYMENT\_ROLE
```solidity
uint64 public constant STRATEGY_DEPLOYMENT_ROLE = 2;
```
### STRATEGY\_COMPONENTS\_LINKING\_ROLE
```solidity
uint64 public constant STRATEGY_COMPONENTS_LINKING_ROLE = 3;
```
### STRATEGY\_MANAGEMENT\_CONFIG\_ROLE
```solidity
uint64 public constant STRATEGY_MANAGEMENT_CONFIG_ROLE = 4;
```
### STRATEGY\_FEE\_CONFIG\_ROLE
```solidity
uint64 public constant STRATEGY_FEE_CONFIG_ROLE = 5;
```
### INFRA\_UPGRADE\_ROLE
```solidity
uint64 public constant INFRA_UPGRADE_ROLE = 6;
```
### GUARDIAN\_ROLE
```solidity
uint64 public constant GUARDIAN_ROLE = 7;
```
# MakinaContext
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/utils/MakinaContext.sol)
**Inherits:** [IMakinaContext](/contracts/core/interfaces/interface.IMakinaContext)
## Constants
### registry
Address of the registry.
```solidity
address public immutable override registry;
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
## Functions
### constructor
```solidity
constructor(address _registry);
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| \_registry | `address` | |
# MakinaGovernable
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/utils/MakinaGovernable.sol)
**Inherits:** AccessManagedUpgradeable, [IMakinaGovernable](/contracts/core/interfaces/interface.IMakinaGovernable)
## Constants
### MakinaGovernableStorageLocation
```solidity
bytes32 private constant MakinaGovernableStorageLocation =
0x7e702089668346e906996be6de3dfc0cb2b0c125fc09b3c0391871825913e000;
```
## Functions
### \_getMakinaGovernableStorage
```solidity
function _getMakinaGovernableStorage() internal pure returns (MakinaGovernableStorage storage $);
```
**Returns**
| Name | Type | Description |
| ---- | ------------------------- | ----------- |
| \$ | `MakinaGovernableStorage` | |
### constructor
```solidity
constructor();
```
### \_\_MakinaGovernable\_init
```solidity
function __MakinaGovernable_init(MakinaGovernableInitParams calldata params) internal onlyInitializing;
```
**Parameters**
| Name | Type | Description |
| ------ | ---------------------------- | ----------- |
| params | `MakinaGovernableInitParams` | |
### onlyOperator
```solidity
modifier onlyOperator();
```
### onlyMechanic
```solidity
modifier onlyMechanic();
```
### onlySecurityCouncil
```solidity
modifier onlySecurityCouncil();
```
### onlyRiskManager
```solidity
modifier onlyRiskManager();
```
### onlyRiskManagerTimelock
```solidity
modifier onlyRiskManagerTimelock();
```
### notRecoveryMode
```solidity
modifier notRecoveryMode();
```
### onlyAccountingAuthorized
```solidity
modifier onlyAccountingAuthorized();
```
### operator
Address of the current operator (mechanic or security council).
```solidity
function operator() public view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### mechanic
Address of the mechanic.
```solidity
function mechanic() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### securityCouncil
Address of the security council.
```solidity
function securityCouncil() public view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### riskManager
Address of the risk manager.
```solidity
function riskManager() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### riskManagerTimelock
Address of the risk manager timelock.
```solidity
function riskManagerTimelock() external view override returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### recoveryMode
True if the contract is in recovery mode, false otherwise.
```solidity
function recoveryMode() external view override returns (bool);
```
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### restrictedAccountingMode
True if the contract is in restricted accounting mode, false otherwise.
```solidity
function restrictedAccountingMode() external view override returns (bool);
```
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### isAccountingAgent
User => Whether the user is an accounting agent
```solidity
function isAccountingAgent(address user) external view override returns (bool);
```
**Parameters**
| Name | Type | Description |
| ---- | --------- | ----------- |
| user | `address` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### isAccountingAuthorized
User => Whether the user is authorized to perform accounting operations under current settings
```solidity
function isAccountingAuthorized(address user) public view override returns (bool);
```
**Parameters**
| Name | Type | Description |
| ---- | --------- | ----------- |
| user | `address` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### setMechanic
Sets a new mechanic.
```solidity
function setMechanic(address newMechanic) external override restricted;
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | -------------------------------- |
| newMechanic | `address` | The address of the new mechanic. |
### setSecurityCouncil
Sets a new security council.
```solidity
function setSecurityCouncil(address newSecurityCouncil) external override restricted;
```
**Parameters**
| Name | Type | Description |
| ------------------ | --------- | ---------------------------------------- |
| newSecurityCouncil | `address` | The address of the new security council. |
### setRiskManager
Sets a new risk manager.
```solidity
function setRiskManager(address newRiskManager) external override restricted;
```
**Parameters**
| Name | Type | Description |
| -------------- | --------- | ------------------------------------ |
| newRiskManager | `address` | The address of the new risk manager. |
### setRiskManagerTimelock
Sets a new risk manager timelock.
```solidity
function setRiskManagerTimelock(address newRiskManagerTimelock) external override restricted;
```
**Parameters**
| Name | Type | Description |
| ---------------------- | --------- | --------------------------------------------- |
| newRiskManagerTimelock | `address` | The address of the new risk manager timelock. |
### setRecoveryMode
Sets the recovery mode.
```solidity
function setRecoveryMode(bool enabled) external override onlySecurityCouncil;
```
**Parameters**
| Name | Type | Description |
| ------- | ------ | -------------------------------------------------- |
| enabled | `bool` | True to enable recovery mode, false to disable it. |
### setRestrictedAccountingMode
Sets the restricted accounting mode.
```solidity
function setRestrictedAccountingMode(bool enabled) external override restricted;
```
**Parameters**
| Name | Type | Description |
| ------- | ------ | --------------------------------------------------------------- |
| enabled | `bool` | True to enable restricted accounting mode, false to disable it. |
### addAccountingAgent
Adds a new accounting agent.
```solidity
function addAccountingAgent(address newAgent) external override restricted;
```
**Parameters**
| Name | Type | Description |
| -------- | --------- | ---------------------------------------- |
| newAgent | `address` | The address of the new accounting agent. |
### removeAccountingAgent
Removes an accounting agent.
```solidity
function removeAccountingAgent(address agent) external override restricted;
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ---------------------------------------------- |
| agent | `address` | The address of the accounting agent to remove. |
### \_addAccountingAgent
Internal logic for adding an accounting agent.
```solidity
function _addAccountingAgent(address newAgent) internal;
```
**Parameters**
| Name | Type | Description |
| -------- | --------- | ----------- |
| newAgent | `address` | |
### \_removeAccountingAgent
Internal logic for removing an accounting agent.
```solidity
function _removeAccountingAgent(address agent) internal;
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ----------- |
| agent | `address` | |
## Structs
### MakinaGovernableStorage
**Note:**
* **storage-location:** erc7201:makina.storage.MakinaGovernable
```solidity
struct MakinaGovernableStorage {
address _mechanic;
address _securityCouncil;
address _riskManager;
address _riskManagerTimelock;
bool _recoveryMode;
bool _restrictedAccountingMode;
mapping(address user => bool isAccountingAgent) _isAccountingAgent;
}
```
**Properties**
| Name | Type | Description |
| -------------------------- | ------------------------------------------------- | ----------- |
| \_mechanic | `address` | |
| \_securityCouncil | `address` | |
| \_riskManager | `address` | |
| \_riskManagerTimelock | `address` | |
| \_recoveryMode | `bool` | |
| \_restrictedAccountingMode | `bool` | |
| \_isAccountingAgent | `mapping(address user => bool isAccountingAgent)` | |
# SpokeSnapshotConsumer
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/utils/SpokeSnapshotConsumer.sol)
**Inherits:** AccessManagedUpgradeable, ERC165, [ISpokeSnapshotConsumer](/contracts/core/interfaces/interface.ISpokeSnapshotConsumer)
## Constants
### creForwarder
Address of the Chainlink CRE forwarder.
```solidity
address public immutable override creForwarder;
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### CRE\_METADATA\_LENGTH
```solidity
uint256 private constant CRE_METADATA_LENGTH = 64;
```
### SpokeSnapshotConsumerStorageLocation
```solidity
bytes32 private constant SpokeSnapshotConsumerStorageLocation =
0xb63b6c1855ef12c3ce1467dc59d74e167a3a4f63f2ecef0203e34e2727af1300;
```
## Functions
### \_getSpokeSnapshotConsumerStorage
```solidity
function _getSpokeSnapshotConsumerStorage() private pure returns (SpokeSnapshotConsumerStorage storage $);
```
**Returns**
| Name | Type | Description |
| ---- | ------------------------------ | ----------- |
| \$ | `SpokeSnapshotConsumerStorage` | |
### constructor
```solidity
constructor(address _creForwarder);
```
**Parameters**
| Name | Type | Description |
| -------------- | --------- | ----------- |
| \_creForwarder | `address` | |
### \_\_SpokeSnapshotConsumer\_init
```solidity
function __SpokeSnapshotConsumer_init(SpokeSnapshotConsumerInitParams calldata sscParams)
internal
onlyInitializing;
```
**Parameters**
| Name | Type | Description |
| --------- | --------------------------------- | ----------- |
| sscParams | `SpokeSnapshotConsumerInitParams` | |
### isCreWorkflowIdAuthorized
CRE workflow ID => Whether the ID is authorized.
```solidity
function isCreWorkflowIdAuthorized(bytes32 creWorkflowId) external view override returns (bool);
```
**Parameters**
| Name | Type | Description |
| ------------- | --------- | ----------- |
| creWorkflowId | `bytes32` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### supportsInterface
Returns true if this contract implements the interface defined by
`interfaceId`. See the corresponding
https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified\[ERC section]
to learn more about how these ids are created.
This function call must use less than 30 000 gas.
```solidity
function supportsInterface(bytes4 interfaceId) public view override(ERC165, IERC165) returns (bool);
```
**Parameters**
| Name | Type | Description |
| ----------- | -------- | ----------- |
| interfaceId | `bytes4` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### addCreWorkflowId
Authorizes a CRE workflow ID.
```solidity
function addCreWorkflowId(bytes32 newCreWorkflowId) external override restricted;
```
**Parameters**
| Name | Type | Description |
| ---------------- | --------- | --------------------------------- |
| newCreWorkflowId | `bytes32` | The CRE workflow ID to authorize. |
### removeCreWorkflowId
Deauthorizes a CRE workflow ID.
```solidity
function removeCreWorkflowId(bytes32 creWorkflowId) external override restricted;
```
**Parameters**
| Name | Type | Description |
| ------------- | --------- | ----------------------------------- |
| creWorkflowId | `bytes32` | The CRE workflow ID to deauthorize. |
### \_addCreWorkflowId
Internal logic for adding a CRE workflow ID.
```solidity
function _addCreWorkflowId(bytes32 newCreWorkflowId) internal;
```
**Parameters**
| Name | Type | Description |
| ---------------- | --------- | ----------- |
| newCreWorkflowId | `bytes32` | |
### \_removeCreWorkflowId
Internal logic for removing a CRE workflow ID.
```solidity
function _removeCreWorkflowId(bytes32 creWorkflowId) internal;
```
**Parameters**
| Name | Type | Description |
| ------------- | --------- | ----------- |
| creWorkflowId | `bytes32` | |
### \_validateMetadata
Extracts fields from a CRE report metadata and validates them against stored values if any are set.
```solidity
function _validateMetadata(bytes calldata metadata) internal view;
```
**Parameters**
| Name | Type | Description |
| -------- | ------- | ----------- |
| metadata | `bytes` | |
## Structs
### SpokeSnapshotConsumerStorage
**Note:**
* **storage-location:** erc7201:makina.storage.SpokeSnapshotConsumer
```solidity
struct SpokeSnapshotConsumerStorage {
EnumerableSet.Bytes32Set _creWorkflowIds;
}
```
**Properties**
| Name | Type | Description |
| ---------------- | -------------------------- | ----------- |
| \_creWorkflowIds | `EnumerableSet.Bytes32Set` | |
# AggregatorV2V3Interface
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/interfaces/AggregatorV2V3Interface.sol)
This interface is a combination of Chainlink's AggregatorInterface.sol
and AggregatorV3Interface.sol.
## Functions
### latestAnswer
```solidity
function latestAnswer() external view returns (int256);
```
**Returns**
| Name | Type | Description |
| ------------ | -------- | ----------- |
| \ | `int256` | |
### latestTimestamp
```solidity
function latestTimestamp() external view returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### latestRound
```solidity
function latestRound() external view returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### getAnswer
```solidity
function getAnswer(uint256 roundId) external view returns (int256);
```
**Parameters**
| Name | Type | Description |
| ------- | --------- | ----------- |
| roundId | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | -------- | ----------- |
| \ | `int256` | |
### getTimestamp
```solidity
function getTimestamp(uint256 roundId) external view returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ------- | --------- | ----------- |
| roundId | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### decimals
```solidity
function decimals() external view returns (uint8);
```
**Returns**
| Name | Type | Description |
| ------------ | ------- | ----------- |
| \ | `uint8` | |
### description
```solidity
function description() external view returns (string memory);
```
**Returns**
| Name | Type | Description |
| ------------ | -------- | ----------- |
| \ | `string` | |
### version
```solidity
function version() external view returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### getRoundData
```solidity
function getRoundData(uint80 _roundId)
external
view
returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
```
**Parameters**
| Name | Type | Description |
| --------- | -------- | ----------- |
| \_roundId | `uint80` | |
**Returns**
| Name | Type | Description |
| --------------- | --------- | ----------- |
| roundId | `uint80` | |
| answer | `int256` | |
| startedAt | `uint256` | |
| updatedAt | `uint256` | |
| answeredInRound | `uint80` | |
### latestRoundData
```solidity
function latestRoundData()
external
view
returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
```
**Returns**
| Name | Type | Description |
| --------------- | --------- | ----------- |
| roundId | `uint80` | |
| answer | `int256` | |
| startedAt | `uint256` | |
| updatedAt | `uint256` | |
| answeredInRound | `uint80` | |
## Events
### AnswerUpdated
```solidity
event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 timestamp);
```
**Parameters**
| Name | Type | Description |
| --------- | --------- | ----------- |
| current | `int256` | |
| roundId | `uint256` | |
| timestamp | `uint256` | |
### NewRound
```solidity
event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt);
```
**Parameters**
| Name | Type | Description |
| --------- | --------- | ----------- |
| roundId | `uint256` | |
| startedBy | `address` | |
| startedAt | `uint256` | |
# IAcrossV3BridgeConfig
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/interfaces/IAcrossV3BridgeConfig.sol)
**Inherits:** [IBridgeConfig](/contracts/core/interfaces/interface.IBridgeConfig)
## Functions
### isForeignChainSupported
Foreign Chain ID => Whether the chain is supported.
```solidity
function isForeignChainSupported(uint256 foreignChainId) external view returns (bool);
```
**Parameters**
| Name | Type | Description |
| -------------- | --------- | ----------- |
| foreignChainId | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### setForeignChainSupported
Sets whether a foreign chain is supported.
```solidity
function setForeignChainSupported(uint256 foreignChainId, bool supported) external;
```
**Parameters**
| Name | Type | Description |
| -------------- | --------- | ------------------------------------------------ |
| foreignChainId | `uint256` | The foreign chain ID. |
| supported | `bool` | True if the chain is supported, false otherwise. |
## Events
### ForeignChainSupportUpdated
```solidity
event ForeignChainSupportUpdated(uint256 indexed foreignChainId, bool indexed supported);
```
**Parameters**
| Name | Type | Description |
| -------------- | --------- | ----------- |
| foreignChainId | `uint256` | |
| supported | `bool` | |
# IAcrossV3MessageHandler
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/interfaces/IAcrossV3MessageHandler.sol)
## Functions
### handleV3AcrossMessage
```solidity
function handleV3AcrossMessage(address tokenSent, uint256 amount, address relayer, bytes memory message) external;
```
**Parameters**
| Name | Type | Description |
| --------- | --------- | ----------- |
| tokenSent | `address` | |
| amount | `uint256` | |
| relayer | `address` | |
| message | `bytes` | |
# IAcrossV3SpokePool
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/interfaces/IAcrossV3SpokePool.sol)
## Functions
### depositV3Now
```solidity
function depositV3Now(
address depositor,
address recipient,
address inputToken,
address outputToken,
uint256 inputAmount,
uint256 outputAmount,
uint256 destinationChainId,
address exclusiveRelayer,
uint32 fillDeadlineOffset,
uint32 exclusivityParameter,
bytes calldata message
) external payable;
```
**Parameters**
| Name | Type | Description |
| -------------------- | --------- | ----------- |
| depositor | `address` | |
| recipient | `address` | |
| inputToken | `address` | |
| outputToken | `address` | |
| inputAmount | `uint256` | |
| outputAmount | `uint256` | |
| destinationChainId | `uint256` | |
| exclusiveRelayer | `address` | |
| fillDeadlineOffset | `uint32` | |
| exclusivityParameter | `uint32` | |
| message | `bytes` | |
# IBridgeAdapter
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/interfaces/IBridgeAdapter.sol)
## Functions
### initialize
Initializer of the contract.
```solidity
function initialize(address _controller, bytes calldata initData) external;
```
**Parameters**
| Name | Type | Description |
| ------------ | --------- | --------------------------------- |
| \_controller | `address` | The bridge controller contract. |
| initData | `bytes` | The optional initialization data. |
### controller
Address of the bridge controller contract.
```solidity
function controller() external view returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### bridgeId
ID of the adapted external bridge.
```solidity
function bridgeId() external view returns (uint16);
```
**Returns**
| Name | Type | Description |
| ------------ | -------- | ----------- |
| \ | `uint16` | |
### approvalTarget
Address of the external bridge approval target contract.
```solidity
function approvalTarget() external view returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### executionTarget
Address of the external bridge execution target contract.
```solidity
function executionTarget() external view returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### receiveSource
Address of the external bridge contract responsible for sending output funds.
```solidity
function receiveSource() external view returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### nextOutTransferId
ID of the next outgoing transfer.
```solidity
function nextOutTransferId() external view returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### nextInTransferId
ID of the next incoming transfer.
```solidity
function nextInTransferId() external view returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### scheduleOutBridgeTransfer
Schedules an outgoing bridge transfer and returns the message hash.
Emits an event containing the id of the transfer and the hash of the bridge transfer message.
```solidity
function scheduleOutBridgeTransfer(
uint256 destinationChainId,
address recipient,
address inputToken,
uint256 inputAmount,
address outputToken,
uint256 minOutputAmount
) external;
```
**Parameters**
| Name | Type | Description |
| ------------------ | --------- | --------------------------------------------------------- |
| destinationChainId | `uint256` | The ID of the destination chain. |
| recipient | `address` | The address of the recipient on the destination chain. |
| inputToken | `address` | The address of the input token. |
| inputAmount | `uint256` | The amount of the input token to transfer. |
| outputToken | `address` | The address of the output token on the destination chain. |
| minOutputAmount | `uint256` | The minimum amount of the output token to receive. |
### sendOutBridgeTransfer
Executes a scheduled outgoing bridge transfer.
```solidity
function sendOutBridgeTransfer(uint256 transferId, bytes calldata data) external;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ------------------------------------------------- |
| transferId | `uint256` | The ID of the transfer to execute. |
| data | `bytes` | The optional data needed to execute the transfer. |
### outBridgeTransferCancelDefault
Returns the default amount that must be transferred to the adapter to cancel an outgoing bridge transfer.
If the transfer has not yet been sent, or if the full amount was refunded to this contract by the external bridge, returns 0.
If the bridge retains a fee upon cancellation and only a partial refund was received, the returned value reflects that fee.
In all other cases (e.g. including pending refunds or successful bridge transfers), returns the full amount of the transfer.
```solidity
function outBridgeTransferCancelDefault(uint256 transferId) external view returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | -------------------------------- |
| transferId | `uint256` | The ID of the transfer to check. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ------------------------------------------- |
| \ | `uint256` | The amount required to cancel the transfer. |
### cancelOutBridgeTransfer
Cancels an outgoing bridge transfer.
```solidity
function cancelOutBridgeTransfer(uint256 transferId) external;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | --------------------------------- |
| transferId | `uint256` | The ID of the transfer to cancel. |
### authorizeInBridgeTransfer
Registers a message hash as authorized for an incoming bridge transfer.
```solidity
function authorizeInBridgeTransfer(bytes32 messageHash) external;
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | ------------------------------------- |
| messageHash | `bytes32` | The hash of the message to authorize. |
### claimInBridgeTransfer
Transfers a received bridge transfer out of the adapter.
```solidity
function claimInBridgeTransfer(uint256 transferId) external;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | -------------------------------- |
| transferId | `uint256` | The ID of the transfer to claim. |
### withdrawPendingFunds
Resets internal state for a given token address, and transfers token balance to associated controller.
This function is intended to be used by the DAO to unlock funds stuck in the adapter, typically
in response to operator deviations or external bridge discrepancies.
```solidity
function withdrawPendingFunds(address token) external;
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ------------------------- |
| token | `address` | The address of the token. |
## Events
### InBridgeTransferAuthorized
```solidity
event InBridgeTransferAuthorized(bytes32 indexed messageHash);
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | ----------- |
| messageHash | `bytes32` | |
### OutBridgeTransferCancelled
```solidity
event OutBridgeTransferCancelled(uint256 indexed transferId);
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| transferId | `uint256` | |
### InBridgeTransferClaimed
```solidity
event InBridgeTransferClaimed(uint256 indexed transferId);
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| transferId | `uint256` | |
### InBridgeTransferReceived
```solidity
event InBridgeTransferReceived(uint256 indexed transferId);
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| transferId | `uint256` | |
### OutBridgeTransferSent
```solidity
event OutBridgeTransferSent(uint256 indexed transferId);
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| transferId | `uint256` | |
### OutBridgeTransferScheduled
```solidity
event OutBridgeTransferScheduled(uint256 indexed transferId, bytes32 indexed messageHash);
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | ----------- |
| transferId | `uint256` | |
| messageHash | `bytes32` | |
### PendingFundsWithdrawn
```solidity
event PendingFundsWithdrawn(address indexed token, uint256 amount);
```
**Parameters**
| Name | Type | Description |
| ------ | --------- | ----------- |
| token | `address` | |
| amount | `uint256` | |
## Structs
### OutBridgeTransfer
```solidity
struct OutBridgeTransfer {
address recipient;
uint256 destinationChainId;
address inputToken;
uint256 inputAmount;
address outputToken;
uint256 minOutputAmount;
bytes encodedMessage;
}
```
**Properties**
| Name | Type | Description |
| ------------------ | --------- | ----------- |
| recipient | `address` | |
| destinationChainId | `uint256` | |
| inputToken | `address` | |
| inputAmount | `uint256` | |
| outputToken | `address` | |
| minOutputAmount | `uint256` | |
| encodedMessage | `bytes` | |
### InBridgeTransfer
```solidity
struct InBridgeTransfer {
address sender;
uint256 originChainId;
address inputToken;
uint256 inputAmount;
address outputToken;
uint256 outputAmount;
}
```
**Properties**
| Name | Type | Description |
| ------------- | --------- | ----------- |
| sender | `address` | |
| originChainId | `uint256` | |
| inputToken | `address` | |
| inputAmount | `uint256` | |
| outputToken | `address` | |
| outputAmount | `uint256` | |
### BridgeMessage
```solidity
struct BridgeMessage {
uint256 outTransferId;
address sender;
address recipient;
uint256 originChainId;
uint256 destinationChainId;
address inputToken;
uint256 inputAmount;
address outputToken;
uint256 minOutputAmount;
}
```
**Properties**
| Name | Type | Description |
| ------------------ | --------- | ----------- |
| outTransferId | `uint256` | |
| sender | `address` | |
| recipient | `address` | |
| originChainId | `uint256` | |
| destinationChainId | `uint256` | |
| inputToken | `address` | |
| inputAmount | `uint256` | |
| outputToken | `address` | |
| minOutputAmount | `uint256` | |
# IBridgeAdapterFactory
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/interfaces/IBridgeAdapterFactory.sol)
## Functions
### isBridgeAdapter
Address => Whether this is a BridgeAdapter instance deployed by this factory.
```solidity
function isBridgeAdapter(address adapter) external view returns (bool);
```
**Parameters**
| Name | Type | Description |
| ------- | --------- | ----------- |
| adapter | `address` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### createBridgeAdapter
Deploys a bridge adapter instance.
```solidity
function createBridgeAdapter(address controller, BridgeAdapterInitParams calldata baParams)
external
returns (address adapter);
```
**Parameters**
| Name | Type | Description |
| ---------- | ------------------------- | -------------------------------------------------------------------------- |
| controller | `address` | The address of the bridge controller for which to deploy the adapter. |
| baParams | `BridgeAdapterInitParams` | The bridge adapter initialization parameters and controller configuration. |
**Returns**
| Name | Type | Description |
| ------- | --------- | ------------------------------------------- |
| adapter | `address` | The address of the deployed bridge adapter. |
## Events
### BridgeAdapterCreated
```solidity
event BridgeAdapterCreated(address indexed controller, uint256 indexed bridgeId, address indexed adapter);
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| controller | `address` | |
| bridgeId | `uint256` | |
| adapter | `address` | |
## Structs
### BridgeAdapterInitParams
Bridge adapter initialization parameters and controller configuration.
```solidity
struct BridgeAdapterInitParams {
uint16 bridgeId;
bytes initData;
uint256 initialMaxBridgeLossBps;
}
```
**Properties**
| Name | Type | Description |
| ----------------------- | --------- | ---------------------------------------------------------------------------------- |
| bridgeId | `uint16` | The ID of the bridge for which the adapter is being created. |
| initData | `bytes` | The optional initialization data for the bridge adapter. |
| initialMaxBridgeLossBps | `uint256` | The initial maximum bridge loss in basis points for this bridge ID and controller. |
# IBridgeConfig
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/interfaces/IBridgeConfig.sol)
## Functions
### isRouteSupported
Returns whether a bridge transfer route is supported for the associated bridge.
```solidity
function isRouteSupported(address inputToken, uint256 foreignChainId, address outputToken)
external
view
returns (bool);
```
**Parameters**
| Name | Type | Description |
| -------------- | --------- | -------------------------------------------------- |
| inputToken | `address` | The token being sent from the source chain. |
| foreignChainId | `uint256` | The destination chain ID. |
| outputToken | `address` | The token being received on the destination chain. |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ------------------------------------------------ |
| \ | `bool` | True if the route is supported, false otherwise. |
# IBridgeController
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/interfaces/IBridgeController.sol)
## Functions
### isBridgeSupported
Bridge ID => Is bridge adapter deployed.
```solidity
function isBridgeSupported(uint16 bridgeId) external view returns (bool);
```
**Parameters**
| Name | Type | Description |
| -------- | -------- | ----------- |
| bridgeId | `uint16` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### isOutTransferEnabled
Bridge ID => Is outgoing transfer enabled.
```solidity
function isOutTransferEnabled(uint16 bridgeId) external view returns (bool);
```
**Parameters**
| Name | Type | Description |
| -------- | -------- | ----------- |
| bridgeId | `uint16` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### getBridgeAdapter
Bridge ID => Address of the associated bridge adapter.
```solidity
function getBridgeAdapter(uint16 bridgeId) external view returns (address);
```
**Parameters**
| Name | Type | Description |
| -------- | -------- | ----------- |
| bridgeId | `uint16` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### getMaxBridgeLossBps
Bridge ID => Max allowed value loss in basis points for transfers via this bridge.
```solidity
function getMaxBridgeLossBps(uint16 bridgeId) external view returns (uint256);
```
**Parameters**
| Name | Type | Description |
| -------- | -------- | ----------- |
| bridgeId | `uint16` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### setBridgeAdapter
Sets a bridge adapter instance for a given bridge ID.
```solidity
function setBridgeAdapter(uint16 bridgeId, address bridgeAdapter, uint256 initialMaxBridgeLossBps) external;
```
**Parameters**
| Name | Type | Description |
| ----------------------- | --------- | ------------------------------------------------------------------------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
| bridgeAdapter | `address` | The address of the new bridge adapter instance. |
| initialMaxBridgeLossBps | `uint256` | The initial maximum allowed value loss in basis points for transfers via this bridge. |
### setMaxBridgeLossBps
Sets the maximum allowed value loss in basis points for transfers via this bridge.
```solidity
function setMaxBridgeLossBps(uint16 bridgeId, uint256 maxBridgeLossBps) external;
```
**Parameters**
| Name | Type | Description |
| ---------------- | --------- | ----------------------------------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
| maxBridgeLossBps | `uint256` | The maximum allowed value loss in basis points. |
### disableOutTransfer
Disables outgoing transfers for a bridge.
```solidity
function disableOutTransfer(uint16 bridgeId) external;
```
**Parameters**
| Name | Type | Description |
| -------- | -------- | --------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
### enableOutTransfer
Enables outgoing transfers for a bridge.
```solidity
function enableOutTransfer(uint16 bridgeId) external;
```
**Parameters**
| Name | Type | Description |
| -------- | -------- | --------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
### sendOutBridgeTransfer
Executes a scheduled outgoing bridge transfer.
```solidity
function sendOutBridgeTransfer(uint16 bridgeId, uint256 transferId, bytes calldata data) external;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ------------------------------------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
| transferId | `uint256` | The ID of the transfer to execute. |
| data | `bytes` | The optional data needed to execute the transfer. |
### authorizeInBridgeTransfer
Registers a message hash as authorized for an incoming bridge transfer.
```solidity
function authorizeInBridgeTransfer(uint16 bridgeId, bytes32 messageHash) external;
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | ------------------------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
| messageHash | `bytes32` | The hash of the message to authorize. |
### claimInBridgeTransfer
Transfers a received bridge transfer out of the corresponding bridge adapter.
```solidity
function claimInBridgeTransfer(uint16 bridgeId, uint256 transferId) external;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | -------------------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
| transferId | `uint256` | The ID of the transfer to claim. |
### cancelOutBridgeTransfer
Cancels an outgoing bridge transfer.
```solidity
function cancelOutBridgeTransfer(uint16 bridgeId, uint256 transferId) external;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | --------------------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
| transferId | `uint256` | The ID of the transfer to cancel. |
### resetBridgingState
Resets internal bridge counters for a given token, and withdraws token balances held by all bridge adapters.
This function is intended to be used by the DAO to realign bridge accounting state and maintain protocol consistency,
typically in response to operator deviations, external bridge discrepancies, or unbounded counter growth.
```solidity
function resetBridgingState(address token) external;
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ------------------------- |
| token | `address` | The address of the token. |
## Events
### BridgeAdapterSet
```solidity
event BridgeAdapterSet(uint16 indexed bridgeId, address indexed adapter);
```
**Parameters**
| Name | Type | Description |
| -------- | --------- | ----------- |
| bridgeId | `uint16` | |
| adapter | `address` | |
### MaxBridgeLossBpsChanged
```solidity
event MaxBridgeLossBpsChanged(
uint16 indexed bridgeId, uint256 indexed oldMaxBridgeLossBps, uint256 indexed newMaxBridgeLossBps
);
```
**Parameters**
| Name | Type | Description |
| ------------------- | --------- | ----------- |
| bridgeId | `uint16` | |
| oldMaxBridgeLossBps | `uint256` | |
| newMaxBridgeLossBps | `uint256` | |
### BridgingStateReset
```solidity
event BridgingStateReset(address indexed token);
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ----------- |
| token | `address` | |
### OutTransferDisabled
```solidity
event OutTransferDisabled(uint16 indexed bridgeId);
```
**Parameters**
| Name | Type | Description |
| -------- | -------- | ----------- |
| bridgeId | `uint16` | |
### OutTransferEnabled
```solidity
event OutTransferEnabled(uint16 indexed bridgeId);
```
**Parameters**
| Name | Type | Description |
| -------- | -------- | ----------- |
| bridgeId | `uint16` | |
# ICaliber
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/interfaces/ICaliber.sol)
## Functions
### initialize
Initializer of the contract.
```solidity
function initialize(CaliberInitParams calldata cParams, address _accountingToken, address _hubMachineEndpoint)
external;
```
**Parameters**
| Name | Type | Description |
| -------------------- | ------------------- | ---------------------------------------- |
| cParams | `CaliberInitParams` | The caliber initialization parameters. |
| \_accountingToken | `address` | The address of the accounting token. |
| \_hubMachineEndpoint | `address` | The address of the hub machine endpoint. |
### weirollVm
Address of the Weiroll VM.
```solidity
function weirollVm() external view returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### hubMachineEndpoint
Address of the hub machine endpoint.
```solidity
function hubMachineEndpoint() external view returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### accountingToken
Address of the accounting token.
```solidity
function accountingToken() external view returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### positionStaleThreshold
Maximum duration a position can remain unaccounted for before it is considered stale.
```solidity
function positionStaleThreshold() external view returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### allowedInstrRoot
Root of the Merkle tree containing allowed instructions.
```solidity
function allowedInstrRoot() external view returns (bytes32);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `bytes32` | |
### timelockDuration
Duration of the allowedInstrRoot update timelock.
```solidity
function timelockDuration() external view returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### pendingAllowedInstrRoot
Value of the pending allowedInstrRoot, if any.
```solidity
function pendingAllowedInstrRoot() external view returns (bytes32);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `bytes32` | |
### pendingTimelockExpiry
Effective time of the last scheduled allowedInstrRoot update.
```solidity
function pendingTimelockExpiry() external view returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### maxPositionIncreaseLossBps
Max allowed value loss (in basis points) when increasing a position.
```solidity
function maxPositionIncreaseLossBps() external view returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### maxPositionDecreaseLossBps
Max allowed value loss (in basis points) when decreasing a position.
```solidity
function maxPositionDecreaseLossBps() external view returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### maxSwapLossBps
Max allowed value loss (in basis points) for base token swaps.
```solidity
function maxSwapLossBps() external view returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### cooldownDuration
Duration of the cooldown period for swaps and position management.
```solidity
function cooldownDuration() external view returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### getPositionsLength
Length of the position IDs list.
```solidity
function getPositionsLength() external view returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### getPositionId
Position index => Position ID
There are no guarantees on the ordering of values inside the Position ID list,
and it may change when values are added or removed.
```solidity
function getPositionId(uint256 idx) external view returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ---- | --------- | ----------- |
| idx | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### getPosition
Position ID => Position data
```solidity
function getPosition(uint256 posId) external view returns (Position memory);
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ----------- |
| posId | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | ---------- | ----------- |
| \ | `Position` | |
### isBaseToken
Token => Registered as base token in this caliber
```solidity
function isBaseToken(address token) external view returns (bool);
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ----------- |
| token | `address` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### getBaseTokensLength
Length of the base tokens list.
```solidity
function getBaseTokensLength() external view returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### getBaseToken
Base token index => Base token address
There are no guarantees on the ordering of values inside the base tokens list,
and it may change when values are added or removed.
```solidity
function getBaseToken(uint256 idx) external view returns (address);
```
**Parameters**
| Name | Type | Description |
| ---- | --------- | ----------- |
| idx | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### isInstrRootGuardian
User => Whether the user is a root guardian
Guardians have veto power over updates of the Merkle root.
```solidity
function isInstrRootGuardian(address user) external view returns (bool);
```
**Parameters**
| Name | Type | Description |
| ---- | --------- | ----------- |
| user | `address` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### isAccountingFresh
Checks if the accounting age of each position is below the position staleness threshold.
```solidity
function isAccountingFresh() external view returns (bool);
```
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
### getNetAum
Returns the caliber's net AUM denominated in the accounting token.
Reverts if any position's accounting is stale.
```solidity
function getNetAum() external view returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### getDetailedAum
Returns the caliber's net AUM along with detailed position and base token breakdowns.
Does not revert on stale positions. Staleness is surfaced per position via the isStale flag instead.
```solidity
function getDetailedAum()
external
view
returns (uint256 netAum, bytes[] memory positions, bytes[] memory baseTokens);
```
**Returns**
| Name | Type | Description |
| ---------- | --------- | ------------------------------------------------------------------------------------- |
| netAum | `uint256` | The total value of all base token balances and positive positions, minus total debts. |
| positions | `bytes[]` | The array of encoded tuples of the form (positionId, value, isDebt, isStale). |
| baseTokens | `bytes[]` | The array of encoded tuples of the form (token, value). |
### addBaseToken
Adds a new base token.
```solidity
function addBaseToken(address token) external;
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ------------------------------ |
| token | `address` | The address of the base token. |
### removeBaseToken
Removes a base token.
```solidity
function removeBaseToken(address token) external;
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ------------------------------ |
| token | `address` | The address of the base token. |
### accountForPosition
Accounts for a position.
If the position value goes to zero, it is closed.
```solidity
function accountForPosition(Instruction calldata instruction) external returns (uint256 value, int256 change);
```
**Parameters**
| Name | Type | Description |
| ----------- | ------------- | --------------------------- |
| instruction | `Instruction` | The accounting instruction. |
**Returns**
| Name | Type | Description |
| ------ | --------- | --------------------------------- |
| value | `uint256` | The new position value. |
| change | `int256` | The change in the position value. |
### accountForPositionBatch
Accounts for a batch of positions.
```solidity
function accountForPositionBatch(Instruction[] calldata instructions, uint256[] calldata groupIds)
external
returns (uint256[] memory values, int256[] memory changes);
```
**Parameters**
| Name | Type | Description |
| ------------ | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| instructions | `Instruction[]` | The array of accounting instructions. |
| groupIds | `uint256[]` | The array of position group IDs.
An accounting instruction must be provided for every open position in each specified group.
If an instruction's groupId corresponds to a group of open positions of size greater than 1,
the group ID must be included in this array. |
**Returns**
| Name | Type | Description |
| ------- | ----------- | ----------------------------------- |
| values | `uint256[]` | The new position values. |
| changes | `int256[]` | The changes in the position values. |
### managePosition
Manages a position's state through paired management and accounting instructions.
Performs accounting updates and modifies contract storage by:
* Adding new positions to storage when created.
* Removing positions from storage when value reaches zero.
Applies value preservation checks using a validation matrix to prevent
economic inconsistencies between position changes and token flows.
The matrix evaluates three factors to determine required validations:
* Base Tokens flow - Whether the contract globally spent or received base tokens during operation
* Debt Position - Whether position represents protocol liability (true) vs asset (false)
* Position Δ direction - Direction of position value change (increase/decrease/null)
┌──────────────────┬───────────────┬──────────────────────┬───────────────────────────┐
│ Base Tokens flow │ Debt Position │ Position Δ direction │ Action │
├──────────────────┼───────────────┼──────────────────────┼───────────────────────────┤
│ Outflow │ No │ Decrease │ Revert: Invalid direction │
│ Outflow │ Yes │ Increase │ Revert: Invalid direction │
│ Outflow │ No │ Increase / Null │ Minimum Δ Check │
│ Outflow │ Yes │ Decrease / Null │ Minimum Δ Check │
│ Inflow / Null │ No │ Decrease │ Maximum Δ Check │
│ Inflow / Null │ Yes │ Increase │ Maximum Δ Check │
│ Inflow / Null │ No │ Increase / Null │ No check (favorable move) │
│ Inflow / Null │ Yes │ Decrease / Null │ No check (favorable move) │
└──────────────────┴───────────────┴──────────────────────┴───────────────────────────┘
```solidity
function managePosition(Instruction calldata mgmtInstruction, Instruction calldata acctInstruction)
external
returns (uint256 value, int256 change);
```
**Parameters**
| Name | Type | Description |
| --------------- | ------------- | --------------------------- |
| mgmtInstruction | `Instruction` | The management instruction. |
| acctInstruction | `Instruction` | The accounting instruction. |
**Returns**
| Name | Type | Description |
| ------ | --------- | -------------------------------- |
| value | `uint256` | The new position value. |
| change | `int256` | The signed position value delta. |
### managePositionBatch
Manages a batch of positions.
Convenience function to manage multiple positions in a single transaction.
```solidity
function managePositionBatch(Instruction[] calldata mgmtInstructions, Instruction[] calldata acctInstructions)
external
returns (uint256[] memory values, int256[] memory changes);
```
**Parameters**
| Name | Type | Description |
| ---------------- | --------------- | ------------------------------------- |
| mgmtInstructions | `Instruction[]` | The array of management instructions. |
| acctInstructions | `Instruction[]` | The array of accounting instructions. |
**Returns**
| Name | Type | Description |
| ------- | ----------- | ----------------------------------- |
| values | `uint256[]` | The new position values. |
| changes | `int256[]` | The changes in the position values. |
### manageFlashLoan
Manages flash loan funds.
```solidity
function manageFlashLoan(Instruction calldata instruction, address token, uint256 amount) external;
```
**Parameters**
| Name | Type | Description |
| ----------- | ------------- | -------------------------------------- |
| instruction | `Instruction` | The flash loan management instruction. |
| token | `address` | The loan token. |
| amount | `uint256` | The loan amount. |
### harvest
Harvests one or multiple positions.
```solidity
function harvest(Instruction calldata instruction, ISwapModule.SwapOrder[] calldata swapOrders) external;
```
**Parameters**
| Name | Type | Description |
| ----------- | ------------------------- | ---------------------------------------------------------- |
| instruction | `Instruction` | The harvest instruction. |
| swapOrders | `ISwapModule.SwapOrder[]` | The array of swap orders to be executed after the harvest. |
### swap
Performs a swap via the swap module.
```solidity
function swap(ISwapModule.SwapOrder calldata order) external;
```
**Parameters**
| Name | Type | Description |
| ----- | ----------------------- | -------------------------- |
| order | `ISwapModule.SwapOrder` | The swap order parameters. |
### transferToHubMachine
Initiates a token transfer to the hub machine.
```solidity
function transferToHubMachine(address token, uint256 amount, bytes calldata data) external;
```
**Parameters**
| Name | Type | Description |
| ------ | --------- | ----------------------------------------------------------------------------------------------------- |
| token | `address` | The address of the token to transfer. |
| amount | `uint256` | The amount of tokens to transfer. |
| data | `bytes` | ABI-encoded parameters required for bridge-related transfers. Ignored when called from a hub caliber. |
### notifyIncomingTransfer
Instructs the Caliber to pull the specified token amount from the calling hub machine endpoint.
```solidity
function notifyIncomingTransfer(address token, uint256 amount) external;
```
**Parameters**
| Name | Type | Description |
| ------ | --------- | ------------------------------------------- |
| token | `address` | The address of the token being transferred. |
| amount | `uint256` | The amount of tokens being transferred. |
### setPositionStaleThreshold
Sets the position accounting staleness threshold.
```solidity
function setPositionStaleThreshold(uint256 newPositionStaleThreshold) external;
```
**Parameters**
| Name | Type | Description |
| ------------------------- | --------- | ----------------------------- |
| newPositionStaleThreshold | `uint256` | The new threshold in seconds. |
### setTimelockDuration
Sets the duration of the allowedInstrRoot update timelock.
```solidity
function setTimelockDuration(uint256 newTimelockDuration) external;
```
**Parameters**
| Name | Type | Description |
| ------------------- | --------- | ---------------------------- |
| newTimelockDuration | `uint256` | The new duration in seconds. |
### scheduleAllowedInstrRootUpdate
Schedules an update of the root of the Merkle tree containing allowed instructions.
The update will take effect after the timelock duration stored in the contract
at the time of the call.
```solidity
function scheduleAllowedInstrRootUpdate(bytes32 newAllowedInstrRoot) external;
```
**Parameters**
| Name | Type | Description |
| ------------------- | --------- | -------------------- |
| newAllowedInstrRoot | `bytes32` | The new Merkle root. |
### cancelAllowedInstrRootUpdate
Cancels a scheduled update of the root of the Merkle tree containing allowed instructions.
Reverts if no pending update exists or if the timelock has expired.
```solidity
function cancelAllowedInstrRootUpdate() external;
```
### setMaxPositionIncreaseLossBps
Sets the max allowed value loss for position increases.
```solidity
function setMaxPositionIncreaseLossBps(uint256 newMaxPositionIncreaseLossBps) external;
```
**Parameters**
| Name | Type | Description |
| ----------------------------- | --------- | --------------------------------------- |
| newMaxPositionIncreaseLossBps | `uint256` | The new max value loss in basis points. |
### setMaxPositionDecreaseLossBps
Sets the max allowed value loss for position decreases.
```solidity
function setMaxPositionDecreaseLossBps(uint256 newMaxPositionDecreaseLossBps) external;
```
**Parameters**
| Name | Type | Description |
| ----------------------------- | --------- | --------------------------------------- |
| newMaxPositionDecreaseLossBps | `uint256` | The new max value loss in basis points. |
### setMaxSwapLossBps
Sets the max allowed value loss for base token swaps.
```solidity
function setMaxSwapLossBps(uint256 newMaxSwapLossBps) external;
```
**Parameters**
| Name | Type | Description |
| ----------------- | --------- | --------------------------------------- |
| newMaxSwapLossBps | `uint256` | The new max value loss in basis points. |
### setCooldownDuration
Sets the duration of the cooldown period for swaps and position management.
```solidity
function setCooldownDuration(uint256 newCooldownDuration) external;
```
**Parameters**
| Name | Type | Description |
| ------------------- | --------- | ---------------------------- |
| newCooldownDuration | `uint256` | The new duration in seconds. |
### addInstrRootGuardian
Adds a new guardian for the Merkle tree containing allowed instructions.
```solidity
function addInstrRootGuardian(address newGuardian) external;
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | -------------------------------- |
| newGuardian | `address` | The address of the new guardian. |
### removeInstrRootGuardian
Removes a guardian for the Merkle tree containing allowed instructions.
```solidity
function removeInstrRootGuardian(address guardian) external;
```
**Parameters**
| Name | Type | Description |
| -------- | --------- | -------------------------------------- |
| guardian | `address` | The address of the guardian to remove. |
## Events
### AllowedInstrRootSet
```solidity
event AllowedInstrRootSet(bytes32 indexed newAllowedInstrRoot);
```
**Parameters**
| Name | Type | Description |
| ------------------- | --------- | ----------- |
| newAllowedInstrRoot | `bytes32` | |
### BaseTokenAdded
```solidity
event BaseTokenAdded(address indexed token);
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ----------- |
| token | `address` | |
### BaseTokenRemoved
```solidity
event BaseTokenRemoved(address indexed token);
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ----------- |
| token | `address` | |
### CooldownDurationChanged
```solidity
event CooldownDurationChanged(uint256 indexed oldDuration, uint256 indexed newDuration);
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | ----------- |
| oldDuration | `uint256` | |
| newDuration | `uint256` | |
### IncomingTransfer
```solidity
event IncomingTransfer(address indexed token, uint256 amount);
```
**Parameters**
| Name | Type | Description |
| ------ | --------- | ----------- |
| token | `address` | |
| amount | `uint256` | |
### InstrRootGuardianAdded
```solidity
event InstrRootGuardianAdded(address indexed newGuardian);
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | ----------- |
| newGuardian | `address` | |
### InstrRootGuardianRemoved
```solidity
event InstrRootGuardianRemoved(address indexed guardian);
```
**Parameters**
| Name | Type | Description |
| -------- | --------- | ----------- |
| guardian | `address` | |
### MaxPositionDecreaseLossBpsChanged
```solidity
event MaxPositionDecreaseLossBpsChanged(
uint256 indexed oldMaxPositionDecreaseLossBps, uint256 indexed newMaxPositionDecreaseLossBps
);
```
**Parameters**
| Name | Type | Description |
| ----------------------------- | --------- | ----------- |
| oldMaxPositionDecreaseLossBps | `uint256` | |
| newMaxPositionDecreaseLossBps | `uint256` | |
### MaxPositionIncreaseLossBpsChanged
```solidity
event MaxPositionIncreaseLossBpsChanged(
uint256 indexed oldMaxPositionIncreaseLossBps, uint256 indexed newMaxPositionIncreaseLossBps
);
```
**Parameters**
| Name | Type | Description |
| ----------------------------- | --------- | ----------- |
| oldMaxPositionIncreaseLossBps | `uint256` | |
| newMaxPositionIncreaseLossBps | `uint256` | |
### MaxSwapLossBpsChanged
```solidity
event MaxSwapLossBpsChanged(uint256 indexed oldMaxSwapLossBps, uint256 indexed newMaxSwapLossBps);
```
**Parameters**
| Name | Type | Description |
| ----------------- | --------- | ----------- |
| oldMaxSwapLossBps | `uint256` | |
| newMaxSwapLossBps | `uint256` | |
### NewAllowedInstrRootCancelled
```solidity
event NewAllowedInstrRootCancelled(bytes32 indexed cancelledMerkleRoot);
```
**Parameters**
| Name | Type | Description |
| ------------------- | --------- | ----------- |
| cancelledMerkleRoot | `bytes32` | |
### NewAllowedInstrRootScheduled
```solidity
event NewAllowedInstrRootScheduled(bytes32 indexed newMerkleRoot, uint256 indexed effectiveTime);
```
**Parameters**
| Name | Type | Description |
| ------------- | --------- | ----------- |
| newMerkleRoot | `bytes32` | |
| effectiveTime | `uint256` | |
### PositionClosed
```solidity
event PositionClosed(uint256 indexed id);
```
**Parameters**
| Name | Type | Description |
| ---- | --------- | ----------- |
| id | `uint256` | |
### PositionCreated
```solidity
event PositionCreated(uint256 indexed id, uint256 value);
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ----------- |
| id | `uint256` | |
| value | `uint256` | |
### PositionUpdated
```solidity
event PositionUpdated(uint256 indexed id, uint256 value);
```
**Parameters**
| Name | Type | Description |
| ----- | --------- | ----------- |
| id | `uint256` | |
| value | `uint256` | |
### PositionStaleThresholdChanged
```solidity
event PositionStaleThresholdChanged(uint256 indexed oldThreshold, uint256 indexed newThreshold);
```
**Parameters**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| oldThreshold | `uint256` | |
| newThreshold | `uint256` | |
### TimelockDurationChanged
```solidity
event TimelockDurationChanged(uint256 indexed oldDuration, uint256 indexed newDuration);
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | ----------- |
| oldDuration | `uint256` | |
| newDuration | `uint256` | |
### TransferToHubMachine
```solidity
event TransferToHubMachine(address indexed token, uint256 amount);
```
**Parameters**
| Name | Type | Description |
| ------ | --------- | ----------- |
| token | `address` | |
| amount | `uint256` | |
## Structs
### CaliberInitParams
Initialization parameters.
```solidity
struct CaliberInitParams {
uint256 initialPositionStaleThreshold;
bytes32 initialAllowedInstrRoot;
uint256 initialTimelockDuration;
uint256 initialMaxPositionIncreaseLossBps;
uint256 initialMaxPositionDecreaseLossBps;
uint256 initialMaxSwapLossBps;
uint256 initialCooldownDuration;
address[] initialBaseTokens;
}
```
**Properties**
| Name | Type | Description |
| --------------------------------- | ----------- | ---------------------------------------------------------------------- |
| initialPositionStaleThreshold | `uint256` | The position accounting staleness threshold in seconds. |
| initialAllowedInstrRoot | `bytes32` | The root of the Merkle tree containing allowed instructions. |
| initialTimelockDuration | `uint256` | The duration of the allowedInstrRoot update timelock. |
| initialMaxPositionIncreaseLossBps | `uint256` | The max allowed value loss (in basis points) for position increases. |
| initialMaxPositionDecreaseLossBps | `uint256` | The max allowed value loss (in basis points) for position decreases. |
| initialMaxSwapLossBps | `uint256` | The max allowed value loss (in basis points) for base token swaps. |
| initialCooldownDuration | `uint256` | The duration of the cooldown period for swaps and position management. |
| initialBaseTokens | `address[]` | The array of initial base tokens. |
### Instruction
Instruction parameters.
```solidity
struct Instruction {
uint256 positionId;
bool isDebt;
uint256 groupId;
InstructionType instructionType;
address[] affectedTokens;
address[] positionTokens;
bytes32[] commands;
bytes[] state;
uint128 stateBitmap;
bytes32[] merkleProof;
}
```
**Properties**
| Name | Type | Description |
| --------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| positionId | `uint256` | The ID of the involved position. |
| isDebt | `bool` | Whether the position is a debt. |
| groupId | `uint256` | The ID of the position accounting group.
Set to 0 if the instruction is not of type ACCOUNTING, or if the involved position is ungrouped. |
| instructionType | `InstructionType` | The type of the instruction. |
| affectedTokens | `address[]` | The array of affected tokens. |
| positionTokens | `address[]` | The array of position tokens. |
| commands | `bytes32[]` | The array of commands. |
| state | `bytes[]` | The array of state. |
| stateBitmap | `uint128` | The state bitmap. |
| merkleProof | `bytes32[]` | The array of Merkle proof elements. |
### Position
Position data.
```solidity
struct Position {
uint256 lastAccountingTime;
uint256 value;
bool isDebt;
}
```
**Properties**
| Name | Type | Description |
| ------------------ | --------- | ------------------------------------------------------------- |
| lastAccountingTime | `uint256` | The last block timestamp when the position was accounted for. |
| value | `uint256` | The value of the position denominated in accounting token. |
| isDebt | `bool` | Whether the position is a debt. |
## Enums
### InstructionType
```solidity
enum InstructionType {
MANAGEMENT,
ACCOUNTING,
HARVEST,
FLASHLOAN_MANAGEMENT
}
```
**Variants**
| Name | Description |
| -------------------- | ----------- |
| MANAGEMENT | |
| ACCOUNTING | |
| HARVEST | |
| FLASHLOAN\_MANAGEMENT | |
# ICaliberFactory
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/interfaces/ICaliberFactory.sol)
## Functions
### isCaliber
Address => Whether this is a Caliber instance deployed by this factory.
```solidity
function isCaliber(address caliber) external view returns (bool);
```
**Parameters**
| Name | Type | Description |
| ------- | --------- | ----------- |
| caliber | `address` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
## Events
### CaliberCreated
```solidity
event CaliberCreated(address indexed caliber, address indexed machineEndpoint);
```
**Parameters**
| Name | Type | Description |
| --------------- | --------- | ----------- |
| caliber | `address` | |
| machineEndpoint | `address` | |
# ICaliberMailbox
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/interfaces/ICaliberMailbox.sol)
**Inherits:** [IMachineEndpoint](/contracts/core/interfaces/interface.IMachineEndpoint)
## Functions
### initialize
Initializer of the contract.
```solidity
function initialize(IMakinaGovernable.MakinaGovernableInitParams calldata mgParams, uint256 initialCooldownDuration)
external;
```
**Parameters**
| Name | Type | Description |
| ----------------------- | ---------------------------------------------- | ------------------------------------------------------------------ |
| mgParams | `IMakinaGovernable.MakinaGovernableInitParams` | The makina governable initialization parameters. |
| initialCooldownDuration | `uint256` | The duration of the cooldown period for outgoing bridge transfers. |
### caliber
Address of the associated caliber.
```solidity
function caliber() external view returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### cooldownDuration
Duration of the cooldown period for outgoing bridge transfers.
```solidity
function cooldownDuration() external view returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### getHubBridgeAdapter
Returns the address of the hub bridge adapter for a given bridge ID.
```solidity
function getHubBridgeAdapter(uint16 bridgeId) external view returns (address);
```
**Parameters**
| Name | Type | Description |
| -------- | -------- | --------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### hubChainId
Chain ID of the hub.
```solidity
function hubChainId() external view returns (uint256);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### getSpokeCaliberAccountingData
Returns the accounting data of the associated caliber.
```solidity
function getSpokeCaliberAccountingData() external view returns (SpokeCaliberAccountingData memory);
```
**Returns**
| Name | Type | Description |
| ------------ | ---------------------------- | ------------------------- |
| \ | `SpokeCaliberAccountingData` | data The accounting data. |
### setCaliber
Sets the associated caliber address.
```solidity
function setCaliber(address _caliber) external;
```
**Parameters**
| Name | Type | Description |
| --------- | --------- | -------------------------------------- |
| \_caliber | `address` | The address of the associated caliber. |
### setCooldownDuration
Sets the duration of the cooldown period for outgoing bridge transfers.
```solidity
function setCooldownDuration(uint256 newCooldownDuration) external;
```
**Parameters**
| Name | Type | Description |
| ------------------- | --------- | ---------------------------- |
| newCooldownDuration | `uint256` | The new duration in seconds. |
### setHubBridgeAdapter
Registers a hub bridge adapter.
```solidity
function setHubBridgeAdapter(uint16 bridgeId, address adapter) external;
```
**Parameters**
| Name | Type | Description |
| -------- | --------- | -------------------------------------- |
| bridgeId | `uint16` | The ID of the bridge. |
| adapter | `address` | The address of the hub bridge adapter. |
## Events
### CaliberSet
```solidity
event CaliberSet(address indexed caliber);
```
**Parameters**
| Name | Type | Description |
| ------- | --------- | ----------- |
| caliber | `address` | |
### CooldownDurationChanged
```solidity
event CooldownDurationChanged(uint256 oldDuration, uint256 newDuration);
```
**Parameters**
| Name | Type | Description |
| ----------- | --------- | ----------- |
| oldDuration | `uint256` | |
| newDuration | `uint256` | |
### HubBridgeAdapterSet
```solidity
event HubBridgeAdapterSet(uint256 indexed bridgeId, address indexed adapter);
```
**Parameters**
| Name | Type | Description |
| -------- | --------- | ----------- |
| bridgeId | `uint256` | |
| adapter | `address` | |
## Structs
### SpokeSnapshotContext
Spoke caliber accounting snapshot context.
```solidity
struct SpokeSnapshotContext {
uint256 chainId;
address mailbox;
uint256 blockNum;
uint256 blockTime;
}
```
**Properties**
| Name | Type | Description |
| --------- | --------- | --------------------------------------------------------- |
| chainId | `uint256` | The chain ID of the spoke caliber. |
| mailbox | `address` | The address of the spoke caliber mailbox. |
| blockNum | `uint256` | The block number used as the snapshot reference point. |
| blockTime | `uint256` | The block timestamp used as the snapshot reference point. |
### SpokeCaliberAccountingData
Spoke caliber accounting snapshot data.
```solidity
struct SpokeCaliberAccountingData {
uint256 netAum;
bytes[] bridgesIn;
bytes[] bridgesOut;
SpokeSnapshotContext context;
}
```
**Properties**
| Name | Type | Description |
| ---------- | ---------------------- | ------------------------------------------------------------------------------- |
| netAum | `uint256` | The net AUM denominated in the caliber accounting token. |
| bridgesIn | `bytes[]` | The list of incoming bridge amounts, each encoded as abi.encode(token, amount). |
| bridgesOut | `bytes[]` | The list of outgoing bridge amounts, each encoded as abi.encode(token, amount). |
| context | `SpokeSnapshotContext` | The snapshot context. |
# ICctpV2BridgeConfig
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/interfaces/ICctpV2BridgeConfig.sol)
**Inherits:** [IBridgeConfig](/contracts/core/interfaces/interface.IBridgeConfig)
## Functions
### getCctpDomain
EVM chain ID => CCTP domain
```solidity
function getCctpDomain(uint256 evmChainId) external view returns (uint32);
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| evmChainId | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | -------- | ----------- |
| \ | `uint32` | |
### getForeignToken
Local token address => Foreign EVM chain ID => Foreign Token address
```solidity
function getForeignToken(address localToken, uint256 foreignEvmChainId) external view returns (address);
```
**Parameters**
| Name | Type | Description |
| ----------------- | --------- | ----------- |
| localToken | `address` | |
| foreignEvmChainId | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### setCctpDomain
Associates an EVM chain ID with a CCTP domain in the contract storage.
```solidity
function setCctpDomain(uint256 evmChainId, uint32 cctpDomain) external;
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------------- |
| evmChainId | `uint256` | The EVM chain ID. |
| cctpDomain | `uint32` | The CCTP domain. |
### setForeignToken
Associates a local token with its foreign counterpart used in CCTP bridging.
```solidity
function setForeignToken(address localToken, uint256 foreignEvmChainId, address foreignToken) external;
```
**Parameters**
| Name | Type | Description |
| ----------------- | --------- | -------------------------- |
| localToken | `address` | The local token address. |
| foreignEvmChainId | `uint256` | The foreign EVM chain ID. |
| foreignToken | `address` | The foreign token address. |
## Events
### ForeignTokenRegistered
```solidity
event ForeignTokenRegistered(address indexed localToken, uint256 indexed evmChainId, address indexed foreignToken);
```
**Parameters**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| localToken | `address` | |
| evmChainId | `uint256` | |
| foreignToken | `address` | |
### CctpDomainRegistered
```solidity
event CctpDomainRegistered(uint256 indexed evmChainId, uint32 indexed cctpDomain);
```
**Parameters**
| Name | Type | Description |
| ---------- | --------- | ----------- |
| evmChainId | `uint256` | |
| cctpDomain | `uint32` | |
# ICctpV2DestinationCaller
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/interfaces/ICctpV2DestinationCaller.sol)
## Functions
### receiveCctpV2Message
Handles reception of a CCTP V2 message and signature.
```solidity
function receiveCctpV2Message(bytes calldata message, bytes calldata attestation) external;
```
**Parameters**
| Name | Type | Description |
| ----------- | ------- | ------------------------------ |
| message | `bytes` | The CCTP V2 message raw bytes. |
| attestation | `bytes` | The message signature. |
# ICctpV2MessageTransmitter
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/interfaces/ICctpV2MessageTransmitter.sol)
## Functions
### receiveMessage
```solidity
function receiveMessage(bytes calldata message, bytes calldata attestation) external returns (bool);
```
**Parameters**
| Name | Type | Description |
| ----------- | ------- | ----------- |
| message | `bytes` | |
| attestation | `bytes` | |
**Returns**
| Name | Type | Description |
| ------------ | ------ | ----------- |
| \ | `bool` | |
# ICctpV2TokenMessenger
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/interfaces/ICctpV2TokenMessenger.sol)
## Functions
### localMinter
```solidity
function localMinter() external view returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### getMinFeeAmount
```solidity
function getMinFeeAmount(uint256 amount) external view returns (uint256);
```
**Parameters**
| Name | Type | Description |
| ------ | --------- | ----------- |
| amount | `uint256` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `uint256` | |
### depositForBurnWithHook
```solidity
function depositForBurnWithHook(
uint256 amount,
uint32 destinationDomain,
bytes32 mintRecipient,
address burnToken,
bytes32 destinationCaller,
uint256 maxFee,
uint32 minFinalityThreshold,
bytes calldata hookData
) external;
```
**Parameters**
| Name | Type | Description |
| -------------------- | --------- | ----------- |
| amount | `uint256` | |
| destinationDomain | `uint32` | |
| mintRecipient | `bytes32` | |
| burnToken | `address` | |
| destinationCaller | `bytes32` | |
| maxFee | `uint256` | |
| minFinalityThreshold | `uint32` | |
| hookData | `bytes` | |
# ICctpV2TokenMinter
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/interfaces/ICctpV2TokenMinter.sol)
## Functions
### getLocalToken
```solidity
function getLocalToken(uint32 remoteDomain, bytes32 remoteToken) external view returns (address);
```
**Parameters**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| remoteDomain | `uint32` | |
| remoteToken | `bytes32` | |
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
# ICoreRegistry
[Git Source](https://github.com/MakinaHQ/makina-core/blob/eb9a2fea6cac9f88783f9c769927ed7e5c2b7fd5/src/interfaces/ICoreRegistry.sol)
## Functions
### coreFactory
Address of the core factory.
```solidity
function coreFactory() external view returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### oracleRegistry
Address of the oracle registry.
```solidity
function oracleRegistry() external view returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |
### tokenRegistry
Address of the token registry.
```solidity
function tokenRegistry() external view returns (address);
```
**Returns**
| Name | Type | Description |
| ------------ | --------- | ----------- |
| \ | `address` | |