Vault
Berachain0x4be03f781c497a489e3cb0287833452ca9b9e80b
Solidity v0.7.1+commit.f4a555be
概览
读取函数
Return the address of the WETH token used by the vault.✨ AI
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| — | address | The address of the wrapped Ether (WETH) token contract used by the vault.✨ AI |
Return the action ID associated with the given function selector.✨ AI
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| selector | bytes4 | The 4-byte function selector to query the action ID for.✨ AI |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| — | bytes32 | The action ID (bytes32) corresponding to the provided selector.✨ AI |
Returns the address of the contract's current authorizer.✨ AI
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| — | address | Address of the current authorizer (contract or account) that controls access rules.✨ AI |
Returns the EIP-712 domain separator used for signing and verifying typed data.✨ AI
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| — | bytes32 | The 32-byte EIP-712 domain separator (bytes32) for this contract instance.✨ AI |
Returns the user's internal token balances for the specified tokens.✨ AI
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| user | address | Address whose internal balances to return.✨ AI |
| tokens | address[] | Array of token addresses to query; returned balances follow this order.✨ AI |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| balances | uint256[] | Array of internal balances corresponding to each token in the input order, expressed in the token's smallest unit.✨ AI |
Return the next nonce the given user must use for on-chain operations.✨ AI
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| user | address | The address of the user whose next nonce is returned.✨ AI |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| — | uint256 | The next uint256 nonce that the user should use for their next transaction.✨ AI |
Returns the vault's paused status and the end timestamps for the pause window and buffer period.✨ AI
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| paused | bool | paused: true if vault actions are currently paused, false otherwise.✨ AI |
| pauseWindowEndTime | uint256 | pauseWindowEndTime: unix timestamp when the pause window ends; 0 if not set.✨ AI |
| bufferPeriodEndTime | uint256 | bufferPeriodEndTime: unix timestamp when the buffer period ends; 0 if not set.✨ AI |
Return the pool contract address and its configuration index for the specified pool ID.✨ AI
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| poolId | bytes32 | Keccak-256 identifier of the pool to query.✨ AI |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| — | address | Address of the pool contract associated with the given poolId.✨ AI |
| — | uint8 | Pool configuration index as a uint8 (e.g., fee tier or pool type).✨ AI |
Returns the cash, managed balance, last change block, and asset manager for a token in a pool.✨ AI
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| poolId | bytes32 | Identifier of the pool containing the token.✨ AI |
| token | address | Address of the token to query within the pool.✨ AI |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| cash | uint256 | cash: Amount of tokens currently held in the pool (not managed by an external manager).✨ AI |
| managed | uint256 | managed: Amount of tokens currently managed by the pool's asset manager.✨ AI |
| lastChangeBlock | uint256 | lastChangeBlock: Block number when cash or managed balances were last updated.✨ AI |
| assetManager | address | assetManager: Address authorized to manage this token's assets for the pool.✨ AI |
Returns the current token list, their balances, and the block number of the last change for the specified pool.✨ AI
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| poolId | bytes32 | Pool identifier (bytes32) to query.✨ AI |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| tokens | address[] | Array of token addresses registered in the pool.✨ AI |
| balances | uint256[] | Array of token balances matching the tokens array; values are in each token's smallest unit.✨ AI |
| lastChangeBlock | uint256 | Block number when the pool's token list or balances were last modified.✨ AI |
Returns the address that collects the protocol fees.✨ AI
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| — | address | The address of the protocol fees collector contract or account.✨ AI |
Checks whether a user has approved a relayer to act on their behalf.✨ AI
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| user | address | Address of the user who may have given approval.✨ AI |
| relayer | address | Address of the relayer to check for approval.✨ AI |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| — | bool | True if the relayer is approved by the user; otherwise false.✨ AI |
写入函数
Perform multiple swaps across pools in a single transaction and settle net asset changes.✨ AI
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| kind | uint8 | Swap kind flag (uint8): 0 = GIVEN_IN, 1 = GIVEN_OUT; determines whether amounts are inputs or outputs.✨ AI |
| swaps | tuple[] | Array of swap instructions; each includes pool id, input/output asset indexes, amount, and optional userData.✨ AI |
| assets | address[] | Ordered list of asset addresses referenced by swaps; swap tuples use indexes into this array.✨ AI |
| funds | tuple | Fund management settings (sender, recipient and internal-balance flags) that control sources and recipients of assets.✨ AI |
| limits | int256[] | Signed per-asset limits corresponding to assets array; positive = max to receive, negative = max to send.✨ AI |
| deadline | uint256 | Unix timestamp by which the swap must complete or the call will revert.✨ AI |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| assetDeltas | int256[] | Array of signed net asset deltas per asset in the same order as assets; positive = Vault sends to caller, negative = Vault receives.✨ AI |
Deregister one or more token addresses from the specified liquidity pool.✨ AI
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| poolId | bytes32 | Identifier of the pool from which tokens will be removed.✨ AI |
| tokens | address[] | Array of token contract addresses to deregister from the pool.✨ AI |
Exit a pool to withdraw tokens for the recipient according to the provided exit request.✨ AI
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| poolId | bytes32 | Identifier of the pool to exit.✨ AI |
| sender | address | Address that initiated the exit and provided pool tokens.✨ AI |
| recipient | address | Address that will receive the withdrawn tokens.✨ AI |
| request | tuple | Exit request struct: assets, minAmountsOut, userData, and toInternalBalance flag.✨ AI |
Send specified token amounts as a flash loan to recipient; funds must be returned within the same transaction.✨ AI
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| recipient | address | Address receiving the borrowed tokens and executing the flash loan callback.✨ AI |
| tokens | address[] | Array of token contract addresses to borrow (ERC-20).✨ AI |
| amounts | uint256[] | Array of amounts to borrow for each token; indices correspond to tokens.✨ AI |
| userData | bytes | Arbitrary data forwarded to the recipient's callback for custom logic.✨ AI |
Join a liquidity pool by depositing the specified tokens using a JoinPoolRequest.✨ AI
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| poolId | bytes32 | ID of the pool to join.✨ AI |
| sender | address | Address supplying tokens or whose internal balance funds the join.✨ AI |
| recipient | address | Address that will receive the pool tokens (BPT).✨ AI |
| request | tuple | JoinPoolRequest tuple: assets, maxAmountsIn, userData, fromInternalBalance.✨ AI |
Update multiple pool balances and perform asset transfers according to a list of operations.✨ AI
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| ops | tuple[] | Array of operations; each tuple encodes poolId, token, amount delta, recipient, and flags controlling execution.✨ AI |
Execute a batch of balance operations to update user balances, transfers, or deposits in the Vault.✨ AI
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| ops | tuple[] | Array of operation tuples specifying action type, user, token, amount, and optional metadata.✨ AI |
Estimate net token flows for a batch swap without executing it.✨ AI
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| kind | uint8 | Swap kind enum: 0 = GIVEN_IN, 1 = GIVEN_OUT.✨ AI |
| swaps | tuple[] | Array of swap steps (poolId, assetInIndex, assetOutIndex, amount, userData).✨ AI |
| assets | address[] | Ordered list of token addresses referenced by the swap steps.✨ AI |
| funds | tuple | Fund management tuple (sender, recipient, fromInternalBalance, toInternalBalance).✨ AI |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| — | int256[] | Array of net asset deltas for each asset in assets; positive = Vault receives, negative = Vault sends.✨ AI |
Registers a new pool with the specified specialization and returns the pool's identifier.✨ AI
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| specialization | uint8 | Numeric code selecting the pool specialization which configures pool behavior and hooks.✨ AI |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| — | bytes32 | A bytes32 value that uniquely identifies the newly registered pool (the Pool ID).✨ AI |
Register a set of tokens and their asset managers for the specified pool.✨ AI
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| poolId | bytes32 | Identifier of the liquidity pool to register tokens for.✨ AI |
| tokens | address[] | Addresses of tokens to register for the pool.✨ AI |
| assetManagers | address[] | Addresses of asset managers corresponding to each token.✨ AI |
Set the Vault's authorizer to a new address, updating which contract controls access permissions.✨ AI
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| newAuthorizer | address | Address of the new authorizer contract.✨ AI |
Set the contract's paused state to the provided boolean.✨ AI
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| paused | bool | When true, disable paused actions; when false, enable them.✨ AI |
Set approval for a relayer to act on behalf of a sender in the Vault.✨ AI
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| sender | address | Address of the account granting or revoking relayer permission.✨ AI |
| relayer | address | Address being approved or revoked to act for the sender.✨ AI |
| approved | bool | True to approve the relayer, false to revoke approval.✨ AI |
Execute a single token swap using provided swap details and fund permissions, returning the calculated amount.✨ AI
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| singleSwap | tuple | Struct describing the swap specifics: pool, assetIn, assetOut, amount, and any user data.✨ AI |
| funds | tuple | Struct specifying sender, recipient, and flags for internal balance usage and approvals.✨ AI |
| limit | uint256 | Slippage guard specifying the minimum (for exactIn) or maximum (for exactOut) acceptable amount.✨ AI |
| deadline | uint256 | Unix timestamp after which the call will revert if the swap has not been executed.✨ AI |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| amountCalculated | uint256 | amountCalculated: The final amount computed by the swap (output or input based on swap kind), in token base units.✨ AI |
事件
| 名称 | 类型 | 已索引 | 描述 |
|---|---|---|---|
| newAuthorizer | address | ✓ |
| 名称 | 类型 | 已索引 | 描述 |
|---|---|---|---|
| token | address | ✓ | |
| sender | address | ✓ | |
| recipient | address | ||
| amount | uint256 |
| 名称 | 类型 | 已索引 | 描述 |
|---|---|---|---|
| recipient | address | ✓ | |
| token | address | ✓ | |
| amount | uint256 | ||
| feeAmount | uint256 |
| 名称 | 类型 | 已索引 | 描述 |
|---|---|---|---|
| user | address | ✓ | |
| token | address | ✓ | |
| delta | int256 |
| 名称 | 类型 | 已索引 | 描述 |
|---|---|---|---|
| paused | bool |
| 名称 | 类型 | 已索引 | 描述 |
|---|---|---|---|
| poolId | bytes32 | ✓ | |
| liquidityProvider | address | ✓ | |
| tokens | address[] | ||
| deltas | int256[] | ||
| protocolFeeAmounts | uint256[] |
| 名称 | 类型 | 已索引 | 描述 |
|---|---|---|---|
| poolId | bytes32 | ✓ | |
| assetManager | address | ✓ | |
| token | address | ✓ | |
| cashDelta | int256 | ||
| managedDelta | int256 |
| 名称 | 类型 | 已索引 | 描述 |
|---|---|---|---|
| poolId | bytes32 | ✓ | |
| poolAddress | address | ✓ | |
| specialization | uint8 |
| 名称 | 类型 | 已索引 | 描述 |
|---|---|---|---|
| relayer | address | ✓ | |
| sender | address | ✓ | |
| approved | bool |
| 名称 | 类型 | 已索引 | 描述 |
|---|---|---|---|
| poolId | bytes32 | ✓ | |
| tokenIn | address | ✓ | |
| tokenOut | address | ✓ | |
| amountIn | uint256 | ||
| amountOut | uint256 |
| 名称 | 类型 | 已索引 | 描述 |
|---|---|---|---|
| poolId | bytes32 | ✓ | |
| tokens | address[] |
| 名称 | 类型 | 已索引 | 描述 |
|---|---|---|---|
| poolId | bytes32 | ✓ | |
| tokens | address[] | ||
| assetManagers | address[] |