# LibCommon

It contains an enum and structs that define the data structures for passing arguments and information related to bridge operations, including bridge types, payload data, recipient network IDs, amounts, asset addresses, and transfer keys. The purpose of these data structures is to provide a standardized format for handling bridge operations and their associated parameters in the contract or system that uses them.

### BridgeType

This is an enumeration that defines two values: `Wormhole` and `Stargate`. It is used to represent different bridge types.

```solidity
enum BridgeType {
    Wormhole,
    Stargate,
    Celer
}
```

### BridgeArgs

```solidity
struct BridgeArgs {
    BridgeType bridgeType;
    bytes payload;
}
```

<table><thead><tr><th>Field</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><pre><code>bridgeType
</code></pre></td><td><pre><code>BridgeType
</code></pre></td><td>An instance of the <code>BridgeType</code> enum that specifies the type of the bridge.</td></tr><tr><td><pre><code>payload
</code></pre></td><td><pre><code>bytes
</code></pre></td><td>A <code>bytes</code> field that contains additional payload data for the bridge operation.</td></tr></tbody></table>

### BridgeInArgs

```solidity
struct BridgeInArgs {
    uint16 recipientNetworkId;
    BridgeArgs bridgeArgs;
    uint256 amount;
    address toAssetAddress;
    TransferKey transferKey;
}
```

<table><thead><tr><th>Field</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><pre><code>recipientNetworkId
</code></pre></td><td><pre><code>uint16
</code></pre></td><td>An unsigned 16-bit integer that represents the ID of the recipient network.</td></tr><tr><td><pre><code>bridgeArgs
</code></pre></td><td><pre><code>BridgeArgs
</code></pre></td><td>An instance of the <code>BridgeArgs</code> struct that contains the bridge arguments.</td></tr><tr><td><pre><code>amount
</code></pre></td><td><pre><code>uint256
</code></pre></td><td>A <code>uint256</code> value that represents the amount being bridged.</td></tr><tr><td><pre><code>toAssetAddress
</code></pre></td><td><pre><code>address
</code></pre></td><td>An <code>address</code> that specifies the address of the asset on the recipient network.</td></tr><tr><td><pre><code>transferKey
</code></pre></td><td><pre><code>TransferKey
</code></pre></td><td>An instance of the <code>TransferKey</code> struct that represents a transfer key for the bridge operation.</td></tr></tbody></table>

### BridgeOutArgs

```solidity
struct BridgeOutArgs {
    BridgeArgs bridgeArgs;
    Transaction transaction;
    TransferKey transferKey;
}
```

<table><thead><tr><th>Field</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><pre><code>bridgeArgs
</code></pre></td><td><pre><code>BridgeArgs
</code></pre></td><td>An instance of the <code>BridgeArgs</code> struct that contains the bridge arguments.</td></tr><tr><td><pre><code>transaction
</code></pre></td><td><pre><code>Transaction
</code></pre></td><td>An instance of the <code>Transaction</code> struct that represents the transaction for the bridge-out operation.</td></tr><tr><td><pre><code>transferKey
</code></pre></td><td><pre><code>TransferKey
</code></pre></td><td>An instance of the <code>TransferKey</code> struct that represents a transfer key for the bridge operation.</td></tr></tbody></table>

### RefundArgs

```solidity
struct RefundArgs {
    uint16 recipientNetworkId;
    uint256 amount;
    address toAssetAddress;
    TransferKey transferKey;
    BridgeArgs bridgeArgs;
    bytes payload;
}
```

<table><thead><tr><th>Field</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><p></p><pre class="language-solidity"><code class="lang-solidity">recipientNetworkId
</code></pre></td><td><p></p><pre class="language-solidity"><code class="lang-solidity">uint16
</code></pre></td><td>An unsigned 16-bit integer that represents the ID of the recipient network.</td></tr><tr><td><p></p><pre class="language-solidity"><code class="lang-solidity">amount
</code></pre></td><td><p></p><pre class="language-solidity"><code class="lang-solidity">uint256
</code></pre></td><td>A <code>uint256</code> value that represents the amount being refunded.</td></tr><tr><td><p></p><pre class="language-solidity"><code class="lang-solidity">toAssetAddress
</code></pre></td><td><p></p><pre class="language-solidity"><code class="lang-solidity">address
</code></pre></td><td>An <code>address</code> that specifies the address of the asset on the recipient network.</td></tr><tr><td><p></p><pre class="language-solidity"><code class="lang-solidity">transferKey
</code></pre></td><td><p></p><pre class="language-solidity"><code class="lang-solidity">TransferKey
</code></pre></td><td>An instance of the <code>TransferKey</code> struct that represents a transfer key for the bridge operation.</td></tr><tr><td><p></p><pre class="language-solidity"><code class="lang-solidity">bridgeArgs
</code></pre></td><td><p></p><pre class="language-solidity"><code class="lang-solidity">BridgeArgs
</code></pre></td><td>An instance of the <code>BridgeArgs</code> struct that contains the bridge arguments.</td></tr><tr><td><p></p><pre class="language-solidity"><code class="lang-solidity">payload
</code></pre></td><td><p></p><pre class="language-solidity"><code class="lang-solidity">bytes
</code></pre></td><td>The bytes that contain some message which are required while bridging.</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fly.trade/flycn/developers/deprecated-magpie-contracts/magpieaggregator-diamond-proxy/bridge/libcommon.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
