bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 38쪽 중 25쪽
ed, the withdrawal is canceled. If no challenge is submitted, the
transaction is finalized and the tokens are released to the user on Initia L1.
### Oracle Updates
The executor process is, when enabled on the rollup, also responsible for
relaying the latest [Connect](https://github.com/skip-mev/connect) oracle data
to the rollup. When relayed, the bot submits a `MsgUpdateOracle` to the L2 node.
```mermaid theme={null}
sequenceDiagram
participant SO as Connect Oracle
participant ORM as Oracle Module (L1)
participant IL1 as Initia L1
participant OPB as OPinit Bot
participant OPC as OPchild Module
participant R as Rollup
loop Continuous update cycle
SO->>ORM: Update oracle data
ORM->>IL1: Store updated data
IL1->>OPB: Emit oracle update event
OPB->>ORM: Read new oracle data
OPB->>OPC: Relay oracle data
OPC->>R: Update L2 oracle state
end
```
### DA Batch Submission
Lastly, the Executor is responsible for batching and submitting transaction data
to Celestia.
```mermaid theme={null}
sequenceDiagram
participant R as Rollup
participant OPC as OPchild Module
participant OPB as OPinit Bot
participant DA as Data Availability Layer
participant IL1 as Initia L1
loop For each L2 block
R->>OPC: Generate block
OPC->>OPB: Provide block data
OPB->>OPB: Compress and batch data
OPB->>DA: Submit batched data
DA->>DA: Store data and generate proof
OPB->>IL1: Submit DA proof (if required)
end
```
# Introduction
Source: https://docs.initia.xyz/home/core-concepts/interwoven-stack/opinit-framework/components/introduction
The OPinit Framework consists of three main components: the OPinit Bridge, the
Executor, and the Challenger.
## OPinit Bridge
The
[OPinit Bridge](/home/core-concepts/interwoven-stack/opinit-framework/components/opinit-bridge)
is a set of Cosmos SDK modules that enable the transfer of INIT and other tokens
between the Initia L1 and rollup L2 using an optimistic bridge model.
## OPinit Bots
The OPinit Bots are a set of processes responsible for executing and monitoring
the various actions necessary to operate and secure the rollup. Currently, there
are two bots in this system: the Executor and the Challenger.
### Executor
The
[Executor](/home/core-concepts/interwoven-stack/opinit-framework/components/executor)
is a set of processes responsible for executing the various actions necessary to
operate and secure the rollup. These include:
* **Token Transfers**: The Executor handles the OPinit Bridge token deposits and
withdrawals between Initia L1 and the various rollups.
* **Output Submission**: The Executor submits the rollup's transaction outputs
to the Initia L1 to finalize the rollup's state.
* **DA Batch Submission**: The Executor submits the rollup's transaction batches
to the Celestia DA layer.
* **Oracle Data**: The Executor can be configured to relay the Connect oracle
price data on the Initia L1 to the rollup L2 for its applications to use.
### Challenger
The
[Challenger](/home/core-concepts/interwoven-stack/opinit-framework/components/challenger)
is a process separate from the Executor, responsible for monitoring the
Executor's output proposals and challenging any invalid proposals. This helps
maintain the integrity of the rollup's state and ensure that the Executor is not
acting maliciously.
# OPinit Bridge
Source: https://docs.initia.xyz/home/core-concepts/interwoven-stack/opinit-framework/components/opinit-bridge
## Overview
The OPinit Bridge is an implementation of the optimistic rollup bridge,
implemented as two Cosmos SDK modules; the **OPchild Module** and the **OPhost
Module**.
## OPhost Module
The OPhost Module is integrated into the Initia L1 chain. This module is
responsible for:
* **Bridge Management:** Creating, updating, and managing bridges between Initia
L1 and rollups.
* **Output Proposal Handling:** Managing and finalizing L2 output proposals.
## OPchild Module
The OPchild Module acts as a counter-party to the OPhost Module and is
integrated into all Interwoven Rollup implementations. This module is
responsible for:
* **Operator Management:** Adding, removing, and managing operators for a given
rollup.
* **Bridge Message Execution:** Processing messages received from the Initia L1.
* **Oracle Updates:** Managing oracle price feed updates relayed by the OPinit
Executor.
The
[OPinit Bot Executor](/home/core-concepts/interwoven-stack/opinit-framework/components/executor)
normally handles actions related to both of these modules.
# Minitswap Architecture
Source: https://docs.initia.xyz/home/core-concepts/minitswap/architecture
## Goals
* **Manipulation Resistance**: The architecture of the rollup and related
systems themselves already has safeguards in place to prevent various forms of
manipulation from malicious actors. The Minitswap DEX is further designed to
ensure that, in unforeseen events, any subsequent damages are minimized.
* **Capital Efficiency**: As the number of rollups continues to increase,
naively, the same number of DEX pairs must also exist. This results in
liquidity fragmentation, high slippage and volatility, and subpar user
experience.
## Design
Minitswap itself is designed as a virtual pool DEX between
<Tooltip>INIT</Tooltip> and the various
<Tooltip>IbcOpINIT</Tooltip> tokens for each of the rollups. The
[StableSwap](https://docs.curve.finance/stableswap-exchange/overview/) formula
determines the exchange rates on each swap.
To achieve the above goals, Minitswap makes two main improvements to the base
StableSwap pool design:
* **Rate Limiting**: To protect against manipulation, the net amount of
IbcOpINIT tokens that can be swapped back into INIT tokens is limited. This
means that even if a malicious actor acquires or creates a large amount of
IbcOpINIT tokens on their rollup, the number of tokens that can be swapped
back into regular INIT tokens remains restricted.
* **Single INIT Token Pool**: To minimize liquidity fragmentation, there is a
single INIT token pool that can be paired with multiple IbcOpINIT token pools,
instead of having separate INIT token pools for each rollup.
## Swap Mechanisms
### Initia L1 to Rollups
<Frame>
<img alt="Initia L1 to Rollups Minitswap Flow" />
</Frame>
In this scenario, a user wants to efficiently bridge their $INIT$ tokens on the
Initia L1 to a rollup $m$ and ends up with the $OpINIT_m$ token for that rollup.
And while bridging from Initia L1 to a rollup is instantaneous, users may
occasionally be able to obtain a more favorable rate by utilizing Minitswap as
part of the bridging process as shown below.
1. **Initiate Swap on Minitswap DEX**: The user sends a transaction to the
Minitswap DEX to swap their $INIT$ tokens into $IbcOpINIT_m$ tokens.
2. **Simulate Swap**: The DEX simulates swapping the user’s $INIT$ tokens into
$IbcOpINIT_m$ tokens.
3. **Compare Swap and Direct Bridging**: The DEX compares the simulated amount
of $IbcOpINIT_m$ tokens with the amount the user would receive if they
bridged directly through the OP Bridge.
4. **Perform Optimal Action**
* If the amount of $IbcOpINIT_m$ tokens from the swap is greater, the DEX
performs the swap. The output $IbcOpINIT_m$ tokens are then bridged to the
destination L2 through IBC.
* If the direct bridging through the OP bridge provides a better amount, the
DEX initiates a direct transfer to the destination rollup $m$ for the user
using the OP bridge.
5. **Minitswap Swap Process**
* **Calculate $IbcOpINIT_m$ Received**: Minitswap calculates how much
$IbcOpINIT_m$ the user will receive based on the current Virtual Pool
state, updating the state in the process.
* **Fee Deduction**: Minitswap deducts a fee based on a predefined value and
an additional fee from any extra $IbcOpINIT_m$ that the user receives.
* **Peg Keeper Swap Check**: Once the user’s swap action and fee calculation
are complete, Minitswap checks if a [Peg Keeper Swap](#peg-keeper-swaps)
should be performed based on the latest Virtual Pool state.
* **Internal Rebalancing Check**: After completing the Peg Keeper Swap,
Minitswap checks if [Internal Rebalancing](#internal-rebalancing) is
possible based on the Peg Keeper’s $IbcOpINIT$ balance. If balancing is
possible, it is initiated.
6. **Final Outcome**: In both cases, once the OP Bridge or IBC transfer is
complete, the user receives the most amount of $OpINIT_m$ tokens in their
wallet on the destination rollup possible.
### Rollup to Initia L1
<Frame>
<img alt="Rollup to Initia L1 Minitswap Flow" />
</Frame>
When bridging from a rollup to Initia L1, the user is currently holding
$OpINIT_m$ tokens on a rollup $m$ and would like to bridge it back to $INIT$
tokens on the Initia L1.
In this scenario, utilizing Minitswap will enable them to bridge their INIT back
to the Initia L1 instantaneously without waiting for the challenge period to
expire.
1. **Transfer to Initia L1 via IBC**: The user begins by transferring their
$OpINIT_m$ tokens on the rollup $m$ back to Initia L1 using IBC. As a result,
they receive $IbcOpINIT_m$ tokens on the Initia L1.
2. **Swap on Minitswap DEX**: Once the IBC transfer is complete and the user has
$IbcOpINIT_m$ tokens on Initia L1, they initiate a swap transaction on the
Minitswap DEX to convert their $IbcOpINIT_m$ tokens into $INIT$ tokens.
3. **Minitswap Swap Process**
* **Peg Keeper Swap Check**: Minitswap first checks if a Peg Keeper Swap can
be performed. If this is possible, the swap is executed directly through
the Peg Keeper.
* **Calculate $INIT$ Received**: If the Peg Keeper Swap is not applicable,
Minitswap calculates the amount of $INIT$ the user will receive based on
the updated state of the Virtual Pool.
* **Fee Deduction**: Minitswap deducts a predefined fee amount from the
transaction.
* **Internal Rebalancing Check**: After completing the user’s swap
transaction, Minitswap checks if
[Internal Rebalancing](#internal-rebalancing) is possible based on the Peg
Keeper’s $IbcOpINIT$ balance. If balancing is possible, it is executed to
maintain market stability.
4. **Final Outcome**: If the swap is successful, the user receives $INIT$ tokens
in their wallet on Initia L1.
### Direct Swap
In addition to the standard directional swap explained above, Minitswap also
offers a unique **Direct Swap** option. As more
[Peg Keeper Swaps](#peg-keeper-swaps) are performed, the Peg Keeper's $INIT$
balance decreases. The Direct Swap aims to incentivize users to help replenish
the Peg Keeper's $INIT$ token balance, which gets depleted over time. This
serves as an additional method of replenishing the Peg Keeper's $INIT$ balance
alongside the [Internal Rebalancing](#internal-rebalancing).
The Direct Swap allows any user to directly exchange their $INIT$ tokens for the
Peg Keeper’s $IbcOpINIT$ tokens. This exchange occurs at the average price at
which the Peg Keeper purchased $INIT$ tokens. This price could sometimes be
lower than what you would get through the traditional swap process. Initially,
the Direct Swap might not seem attractive due to the Target Ratio being close to
0.5. However, as the Peg Keeper’s balance of OP-bridged tokens increases, the
Direct Swap option becomes more appealing to users.
## Swap Logic
### Parameters
* **Max Ratio**: The Max Ratio, $R_{max}$, is an Initia L1 governance-controlled
parameter that dictates the maximum pool ratio between IbcOpINIT and regular
INIT.
* **Fully Recovered Ratio**: The Fully Recovered Ratio, $R_{fr}$, then uses the
Max Ratio and the Flexibility to calculate the final target IbcOpINIT:INIT
ratio for the pool. The ratio is calculated as follows:
$$
R_{fr}=0.5+(R_{max}-0.5) \cdot \frac{(fI)^3}{(1+|fI|^3)}
$$
### Mechanisms
#### Peg Keeper Swaps
<Frame>
<img alt="Peg Keeper Swaps" />
</Frame>
The Peg Keeper Swap is a mechanism designed to keep the exchange rate between
$INIT$ and $IbcOpINIT$ close to 1:1. This ensures that users always receive the
best swap rates.
When users move their INIT tokens from a rollup back to Initia L1 using
Minitswap, they are essentially selling their $IbcOpINIT$ tokens for $INIT$
tokens. As more users do this, the supply of $IbcOpINIT$ increases relative to
$INIT$, which raises the price of future rollup -> Initia L1 swaps.
To address this, the Peg Keeper Swap executes a ($INIT$ -> $IbcOpINIT$) swap to
balance the effect. When a user makes a swap, Minitswap checks the Fully
Recovered Ratio against the current pool ratio. If the current ratio exceeds the
Fully Recovered Ratio, a Peg Keeper Swap is triggered to restore balance.
When run, the Peg Keeper swap follows this procedure:
1. Calculate the current $R_{fr}$ and the `max_recover_amount`, which defines
the maximum size of the Peg Keeper Swap that can be performed in this swap.
This is to prevent a huge Peg Keeper Swap from happening.
2. Check if another Peg Keeper Swap has been run in the same block. Continue if
no swaps have been run.
3. Calculate the $INIT$ amount the Peg Keeper needs to reach $R_{fr}$. Let's
call this `swap_amount_to_reach_fr`.
4. Check if `swap_amount_to_reach_fr > max_recover_amount`
* If true, swap only `max_recover_amount`.
* If false, swap `swap_amount_to_reach_fr`
Note that the Peg Keeper Swap check is done
* *before* an L2 -> L1 swap to make sure the user gets the best rate possible
* *after* an L1 -> L2 swap to make sure the user's swap rate doesn't get
affected by the Peg Keeper Swap
#### Internal Rebalancing
<Frame>
<img alt="Internal Rebalancing" />
</Frame>
As more Peg Keeper Swaps are performed, the $INIT$ balance of the Peg Keeper
gradually decreases. To replenish its $INIT$ balance, the system has an internal
rebalancing procedure that converts the Peg Keeper's $IbcOpINIT$ back into
$INIT$ using IBC and OP Bridge.
The rebalancing process follows these steps:
1. Bridge the Peg Keeper's $IbcOpINIT_m$ back to the rollup $m$ using IBC,
converting it into $OpINIT_m$.
2. Use the OP Bridge to convert $OpINIT_m$ back into $INIT$.
This process, combined with the [Direct Swap](#direct-swap), ensures that the
Peg Keeper's $INIT$ balance is replenished, allowing it to continue performing
Peg Keeper Swaps.
# Minitswap Introduction
Source: https://docs.initia.xyz/home/core-concepts/minitswap/introduction
Minitswap is Initia's proprietary solution to address the user experience
challenges posed by the lengthy withdrawal
[challenge periods](https://docs.optimism.io/builders/app-developers/bridging/messaging#understanding-the-challenge-period)
of
[optimistic bridges](https://medium.com/connext/optimistic-bridges-fb800dc7b0e0).
Furthermore, while a longer challenge period increases the duration in which a
challenge can be made, it simultaneously increases the wait time required for
withdrawals.
## Motivation
While optimistic token bridges between a Layer 1 (L1) and a Layer 2 (L2) chain
provide a secure way of transferring assets between chains, it comes with
various downsides.
* **Long Withdrawal Times**: Transferring tokens from L1 to L2 is usually
instantaneous, but the reverse direction involves long wait times, often days,
before receiving assets on L1.
* **Single Sequencer Risks**: Creating a DEX pair between the original token on
L1 and the bridged tokens can mitigate long withdrawal times. However, most
L2s currently operate with a single sequencer, raising security, reliability,
and centralization concerns for liquidity providers.
* **Lack of Liquidity**: The sequencer risk issues can result in insufficient
liquidity in the token pool, leading to unfavorable swap prices, high
volatility, and significant
[slippage](https://www.coinbase.com/learn/crypto-glossary/what-is-slippage-in-crypto-and-how-to-minimize-its-impact#:~:text=Understanding%20Slippage%20in%20Crypto\&text=It%20refers%20to%20the%20difference,placed%20and%20when%20it's%20executed.)
for users bridging tokens back to L1.
## Solution
The Minitswap DEX is designed to let you freely, quickly, and efficiently bridge
tokens between Initia L1 and rollups. If you want to bridge back to Initia L1
from a rollup, you can use Minitswap (along with IBC) to swap your tokens back
to INIT without waiting for the challenge period to expire.
The full architecture, design decisions, and how the above risks are mitigated
are detailed in the following section.
# Minitswap Terminology
Source: https://docs.initia.xyz/home/core-concepts/minitswap/terminology
## INIT Token Variants
| Term | Definition |
| ----------- | ---------- |
| $INIT$ | |
| $m$ | |
| $OpINIT$ | |
| $IbcOpINIT$ | |
## Bridges
| Term | Description |
| ------------- | ----------- |
| IBC Bridge | |
| OPINIT Bridge | |
## Actors
| **Term** | **Description** |
| ---------------------- | --------------- |
| **Virtual Pool** | |
| **Liquidity Provider** | |
| **Peg Keeper** | |
| **User** | |
## Parameters
| Symbol | Term | Description |
| --------- | -------------------------------------- | ----------- |
| $V$ | Virtual Pool size | |
| $B$ | Peg Keeper's $IbcOpINIT$ token balance | |
| $I$ | Virtual Pool imbalance | |
| $R_{fr}$ | Fully Recovered Ratio | |
| $R_{max}$ | Max Ratio | |
| $f$ | Flexibility | |
# VIP Architecture
Source: https://docs.initia.xyz/home/core-concepts/vip/architecture
At genesis, the protocol sets aside a portion of the total INIT token supply as
rewards for the VIP program, distributing them over several years. Let's call
this portion of the supply $R$. These rewards are given out at regular
intervals, or **stage** $t$, throughout the distribution period.
The system first distributes total rewards to each rollup, then subsequently to
the rollup's users and operators.
<Note>
Before a rollup can qualify for VIP rewards, it must first achieve a minimum
INIT TVL and then be whitelisted by the Initia L1 governance through an
on-chain proposal. See the [VIP
Eligibility](/home/core-concepts/vip/eligibility) page for more details.
</Note>
<Note>
For details on the specific VIP parameters such as stage and cycle duration,
see the [VIP Parameters](/resources/developer/initia-l1#vip-parameters)
section.
</Note>
## Rewards Distribution
At each rewards distribution stage $t$, the total VIP rewards for that stage
$R_t$ are distributed amongst each rollup ecosystem. The distribution is split
into multiple steps:
1. Splitting the total rewards allocated for that stage, $R_t$, between all
whitelisted rollups.
2. Distributing the rewards to each rollup's users.
3. Distributing the rewards to each rollup's operators.
### Rewards Split Between Rollups
At each stage $t$, the total VIP rewards for that stage $R_t$ are distributed
amongst each rollup ecosystem. The total rewards are then split into two pools:
the **Balance Pool $R_B$** and the **Weight Pool $R_W$**.
<Frame>
<img alt="VIP Rewards Distribution" />
</Frame>
These two pools aim to incentivize and reward different aspects of rollup
operations. The ratio between $R_B$ and $R_W$, called `poolSplitRatio`, is set
by the Initia L1 governance and can be changed through on-chain proposals. The
sum follows the equation:
$$
R_t = R_B + R_W
$$
The rewards for each rollup $m$ are then calculated as follows:
$$
R_{m,t} = R_{B,m,t} + R_{W,m,t}
$$
Where:
* $R_{B,m,t}$ represents the portion of rewards from the Balance Pool $R_B$
allocated to rollup $m$ at stage $t$.
* $R_{W,m,t}$ represents the portion of rewards from the Weight Pool $R_W$
allocated to rollup $m$ at stage $t$.
#### Balance Pool
The Balance Pool aims to encourage rollups to find new and interesting uses for
the INIT token by distributing rewards based on the proportion of INIT supply on
the rollup. Specifically, at each stage $t$, the rewards are allocated according
to the amount of INIT locked on each rollup's OPinit bridge address $m$ relative
to the total amount locked across all rollups.
$$
R_{B,m,t} = R_{B,t} \frac{I_{m,t}}{\sum_{i=1}^{N,t} I_{i,t}}
$$
Where:
* $R_{B,t}$ is the total rewards from the Balance Pool for the stage.
* $I_{m,t}$ is t프로젝트로 돌아가기