ERC4626 vault that enables cross-chain asset bridging and yield generation
Receives bridged assets via Hyperlane, provides instant liquidity, and deposits idle funds into yield pools
Configuration for an authorized origin chain and bridge
Name | Type | Description |
---|
Parameters for adding a new origin
Name | Type | Description |
---|
Error when caller is not authorized for the operation
Name | Type | Description |
---|---|---|
sender | address | The address that attempted the unauthorized call |
Error when attempting to swap the pool’s underlying asset
Name | Type | Description |
---|---|---|
token | address | The token address that was attempted to be swapped |
Error when message is from an unauthorized origin
Name | Type | Description |
---|---|---|
chainId | uint32 | The chain ID of the unauthorized origin |
bridge | address | The bridge address of the unauthorized origin |
Error when attempting to process an already processed message
Name | Type | Description |
---|---|---|
chainId | uint32 | The chain ID of the message origin |
bridge | address | The bridge address of the message origin |
nonce | uint256 | The nonce of the already processed message |
Error when origin would exceed its maximum allowed debt
Name | Type | Description |
---|---|---|
chainId | uint32 | The chain ID of the origin |
bridge | address | The bridge address of the origin |
maxDebt | uint256 | The maximum allowed debt for this origin |
nonce | uint256 | The nonce of the rejected transaction |
recipient | address | The intended recipient of the funds |
amount | uint256 | The amount that would exceed the debt limit |
Error when native currency transfer fails
Name | Type | Description |
---|---|---|
recipient | address | The intended recipient of the transfer |
amount | uint256 | The amount that failed to transfer |
Error when insufficient funds are available
Name | Type | Description |
---|---|---|
amount | uint256 | The amount available |
balance | uint256 | The balance required |
Error when native currency is sent to a non-WETH pool
Error when message timestamp is too recent based on cooldown period
Name | Type | Description |
---|---|---|
chainId | uint32 | The chain ID of the message origin |
bridge | address | The bridge address of the message origin |
nonce | uint256 | The nonce of the message |
timestamp | uint256 | The timestamp of the message |
coolDown | uint32 | The required cooldown period |
Error when share price is below minimum acceptable threshold
Name | Type | Description |
---|---|---|
actualPrice | uint256 | The actual share price |
minPrice | uint256 | The minimum acceptable share price |
Error when share price is above maximum acceptable threshold
Name | Type | Description |
---|---|---|
actualPrice | uint256 | The actual share price |
maxPrice | uint256 | The maximum acceptable share price |
The address of the Hyperlane mailbox
Used to receive cross-chain messages
The address of the WETH contract (used for native pools)
Set to WETH address for native currency pools, otherwise can be address(0)
Denominator for fractional basis points calculations (1 = 0.0000001 bps)
Keeping track of the outstanding debt for ERC4626 computations
Represents funds that have been sent but not yet claimed from bridges
Mapping of origins to their settings
[chainId][bridgeAddress] => OriginSettings
Mapping of messages by origin
[chainId][bridgeAddress][nonce] => message data
The address of the yield pool where funds are deposited
Must be an ERC4626 vault for the same underlying asset
UniswapV3 wrapper contract for token swaps
Keeping track of the total fees collected
Fees are held in the yield pool until they finish streaming
All incoming assets are streamed (even though they are instantly deposited in the yield pool)
Total amount of assets currently being streamed
Timestamp when assets were last collected for streaming
Timestamp when current streaming period ends
Duration over which collected assets are streamed
Emitted when a loan is provided to a bridge recipient
Name | Type | Description |
---|---|---|
nonce | uint256 | The unique identifier of the transaction |
recipient | address | The address receiving the funds |
asset | contract ERC20 | The asset being transferred |
amount | uint256 | The total amount including fees |
origin | struct RelayPool.OriginSettings | The origin settings for this bridge |
fees | uint256 | The fee amount collected |
Emitted when bridged funds are claimed and deposited
Name | Type | Description |
---|---|---|
chainId | uint32 | The chain ID of the bridge origin |
bridge | address | The bridge address on the origin chain |
amount | uint256 | The total amount claimed |
fees | uint256 | The fee amount collected |
Emitted when outstanding debt changes
Name | Type | Description |
---|---|---|
oldDebt | uint256 | Previous total outstanding debt |
newDebt | uint256 | New total outstanding debt |
origin | struct RelayPool.OriginSettings | The origin settings involved |
oldOriginDebt | uint256 | Previous outstanding debt for the origin |
newOriginDebt | uint256 | New outstanding debt for the origin |
Emitted when assets are deposited into the yield pool
Name | Type | Description |
---|---|---|
amount | uint256 | The amount deposited |
yieldPool | address | The yield pool address |
Emitted when assets are withdrawn from the yield pool
Name | Type | Description |
---|---|---|
amount | uint256 | The amount withdrawn |
yieldPool | address | The yield pool address |
Emitted when the token swap address is changed
Name | Type | Description |
---|---|---|
prevAddress | address | The previous swap contract address |
newAddress | address | The new swap contract address |
Emitted when the yield pool is changed
Name | Type | Description |
---|---|---|
oldPool | address | The previous yield pool address |
newPool | address | The new yield pool address |
Emitted when the streaming period is changed
Name | Type | Description |
---|---|---|
oldPeriod | uint256 | The previous streaming period |
newPeriod | uint256 | The new streaming period |
Emitted when a new origin is added
Name | Type | Description |
---|---|---|
origin | struct RelayPool.OriginParam | The origin parameters |
Emitted when an origin is disabled
Name | Type | Description |
---|---|---|
chainId | uint32 | The chain ID of the disabled origin |
bridge | address | The bridge address of the disabled origin |
maxDebt | uint256 | The previous maximum debt limit |
outstandingDebt | uint256 | The outstanding debt at time of disabling |
proxyBridge | address | The proxy bridge address |
Initializes the RelayPool with core parameters
Warning: the owner should always be a timelock with significant delay
Name | Type | Description |
---|---|---|
hyperlaneMailbox | address | The Hyperlane mailbox contract address |
asset | contract ERC20 | The underlying asset for this vault |
name | string | The name of the vault token |
symbol | string | The symbol of the vault token |
baseYieldPool | address | The initial yield pool for depositing assets |
weth | address | The WETH contract address (for native currency pools) |
curator | address | The address that will own the pool after deployment |
Updates the streaming period for fee accrual
Updates streamed assets before changing the period
Name | Type | Description |
---|---|---|
newPeriod | uint256 | The new streaming period in seconds |
Updates the yield pool, moving all assets from the old pool to the new one
Implements share price-based slippage protection to ensure fair value transfer
Name | Type | Description |
---|---|---|
newPool | address | The address of the new yield pool |
minSharePriceFromOldPool | uint256 | The minimum acceptable share price when withdrawing from the old pool |
maxSharePricePriceFromNewPool | uint256 | The maximum acceptable share price when depositing into the new pool |
Adds a new authorized origin for bridging
Only callable by owner, typically a timelock contract
Name | Type | Description |
---|---|---|
origin | struct RelayPool.OriginParam | The origin parameters including chain ID, addresses, and limits |
Disables an origin by setting its max debt to zero
Only callable by the origin’s curator for emergency response
Name | Type | Description |
---|---|---|
chainId | uint32 | The chain ID of the origin to disable |
bridge | address | The bridge address of the origin to disable |
Increases outstanding debt for an origin
Updates both origin-specific and total outstanding debt
Name | Type | Description |
---|---|---|
amount | uint256 | The amount to increase debt by |
origin | struct RelayPool.OriginSettings | The origin settings to update |
Decreases outstanding debt for an origin
Updates both origin-specific and total outstanding debt
Name | Type | Description |
---|---|---|
amount | uint256 | The amount to decrease debt by |
origin | struct RelayPool.OriginSettings | The origin settings to update |
Returns the maximum assets that can be deposited
Limited by the yield pool’s capacity
Name | Type | Description |
---|---|---|
address |
Name | Type | Description |
---|---|---|
maxAssets | uint256 | The maximum amount of assets that can be deposited |
Returns the maximum assets that can be withdrawn by an owner
Limited to the owner’s share balance converted to assets
Name | Type | Description |
---|---|---|
owner | address | The address to check withdrawal capacity for |
Name | Type | Description |
---|---|---|
maxAssets | uint256 | The maximum amount of assets that can be withdrawn |
Returns the maximum shares that can be minted
Limited by the yield pool’s deposit capacity
Name | Type | Description |
---|---|---|
receiver | address | The address that would receive the shares |
Name | Type | Description |
---|---|---|
maxShares | uint256 | The maximum amount of shares that can be minted |
Returns the maximum shares that can be redeemed by an owner
Limited by the owner’s share balance and yield pool’s withdrawal capacity
Name | Type | Description |
---|---|---|
owner | address | The address to check redemption capacity for |
Name | Type | Description |
---|---|---|
maxShares | uint256 | The maximum amount of shares that can be redeemed |
Returns the total assets controlled by the pool
Includes yield pool balance, outstanding debt, minus pending fees and streaming assets
Name | Type | Description |
---|---|---|
[0] | uint256 | The total assets under management |
Deposits assets into the yield pool
Internal function that approves and deposits to yield pool
Name | Type | Description |
---|---|---|
amount | uint256 | The amount of assets to deposit |
Withdraws assets from the yield pool
Internal function that withdraws from yield pool to recipient
Name | Type | Description |
---|---|---|
amount | uint256 | The amount of assets to withdraw |
recipient | address | The address to receive the withdrawn assets |
Handles incoming cross-chain messages from Hyperlane
Only callable by Hyperlane mailbox, provides instant liquidity to recipients
Name | Type | Description |
---|---|---|
chainId | uint32 | The origin chain ID |
bridgeAddress | bytes32 | The origin bridge address (as bytes32) |
data | bytes | The encoded message data |
Calculates remaining assets to be streamed
Returns zero if streaming period has ended
Name | Type | Description |
---|---|---|
[0] | uint256 | The amount of assets remaining to be streamed |
Updates the streamed assets calculation
Resets the streaming calculation to current timestamp
Name | Type | Description |
---|---|---|
[0] | uint256 | The new total assets to stream |
Adds assets to be accounted for in a streaming fashion
Adjusts streaming end time based on weighted average
Name | Type | Description |
---|---|---|
amount | uint256 | The amount of assets to add to streaming |
Name | Type | Description |
---|---|---|
[0] | uint256 | The new total assets to stream |
Claims funds from a bridge after they arrive
Decreases outstanding debt and deposits funds into yield pool
Name | Type | Description |
---|---|---|
chainId | uint32 | The origin chain ID |
bridge | address | The origin bridge address |
Name | Type | Description |
---|---|---|
amount | uint256 | The amount of assets claimed |
Sends funds to a recipient
Handles both ERC20 and native currency transfers
Name | Type | Description |
---|---|---|
amount | uint256 | The amount to send |
recipient | address | The address to receive the funds |
Sets the token swap contract address
Used for swapping non-asset tokens received by the pool
Name | Type | Description |
---|---|---|
newTokenSwapAddress | address | The new token swap contract address |
Swaps tokens and deposits resulting assets
Swaps via Uniswap V3 through the token swap contract
Name | Type | Description |
---|---|---|
token | address | The token to swap from |
amount | uint256 | The amount of tokens to swap |
uniswapWethPoolFeeToken | uint24 | The fee tier for token-WETH pool |
uniswapWethPoolFeeAsset | uint24 | The fee tier for WETH-asset pool |
deadline | uint48 | The deadline for the swap |
amountOutMinimum | uint256 | The minimum amount of assets to receive |
Collects any assets not yet deposited and starts streaming them
Can be called by anyone to ensure timely asset collection
Hook called before withdrawing assets from the vault
Withdraws assets from yield pool before processing withdrawal
Name | Type | Description |
---|---|---|
assets | uint256 | The amount of assets to withdraw |
uint256 |
Hook called after depositing assets to the vault
Deposits assets into yield pool after receiving them
Name | Type | Description |
---|---|---|
assets | uint256 | The amount of assets deposited |
uint256 |
Processes failed Hyperlane messages manually
Only callable by owner, typically after slow bridge resolution
Name | Type | Description |
---|---|---|
chainId | uint32 | The origin chain ID |
bridge | address | The origin bridge address |
data | bytes | The encoded message data |
Receives native currency
Required for WETH unwrapping in native currency pools
ERC4626 vault that enables cross-chain asset bridging and yield generation
Receives bridged assets via Hyperlane, provides instant liquidity, and deposits idle funds into yield pools
Configuration for an authorized origin chain and bridge
Name | Type | Description |
---|
Parameters for adding a new origin
Name | Type | Description |
---|
Error when caller is not authorized for the operation
Name | Type | Description |
---|---|---|
sender | address | The address that attempted the unauthorized call |
Error when attempting to swap the pool’s underlying asset
Name | Type | Description |
---|---|---|
token | address | The token address that was attempted to be swapped |
Error when message is from an unauthorized origin
Name | Type | Description |
---|---|---|
chainId | uint32 | The chain ID of the unauthorized origin |
bridge | address | The bridge address of the unauthorized origin |
Error when attempting to process an already processed message
Name | Type | Description |
---|---|---|
chainId | uint32 | The chain ID of the message origin |
bridge | address | The bridge address of the message origin |
nonce | uint256 | The nonce of the already processed message |
Error when origin would exceed its maximum allowed debt
Name | Type | Description |
---|---|---|
chainId | uint32 | The chain ID of the origin |
bridge | address | The bridge address of the origin |
maxDebt | uint256 | The maximum allowed debt for this origin |
nonce | uint256 | The nonce of the rejected transaction |
recipient | address | The intended recipient of the funds |
amount | uint256 | The amount that would exceed the debt limit |
Error when native currency transfer fails
Name | Type | Description |
---|---|---|
recipient | address | The intended recipient of the transfer |
amount | uint256 | The amount that failed to transfer |
Error when insufficient funds are available
Name | Type | Description |
---|---|---|
amount | uint256 | The amount available |
balance | uint256 | The balance required |
Error when native currency is sent to a non-WETH pool
Error when message timestamp is too recent based on cooldown period
Name | Type | Description |
---|---|---|
chainId | uint32 | The chain ID of the message origin |
bridge | address | The bridge address of the message origin |
nonce | uint256 | The nonce of the message |
timestamp | uint256 | The timestamp of the message |
coolDown | uint32 | The required cooldown period |
Error when share price is below minimum acceptable threshold
Name | Type | Description |
---|---|---|
actualPrice | uint256 | The actual share price |
minPrice | uint256 | The minimum acceptable share price |
Error when share price is above maximum acceptable threshold
Name | Type | Description |
---|---|---|
actualPrice | uint256 | The actual share price |
maxPrice | uint256 | The maximum acceptable share price |
The address of the Hyperlane mailbox
Used to receive cross-chain messages
The address of the WETH contract (used for native pools)
Set to WETH address for native currency pools, otherwise can be address(0)
Denominator for fractional basis points calculations (1 = 0.0000001 bps)
Keeping track of the outstanding debt for ERC4626 computations
Represents funds that have been sent but not yet claimed from bridges
Mapping of origins to their settings
[chainId][bridgeAddress] => OriginSettings
Mapping of messages by origin
[chainId][bridgeAddress][nonce] => message data
The address of the yield pool where funds are deposited
Must be an ERC4626 vault for the same underlying asset
UniswapV3 wrapper contract for token swaps
Keeping track of the total fees collected
Fees are held in the yield pool until they finish streaming
All incoming assets are streamed (even though they are instantly deposited in the yield pool)
Total amount of assets currently being streamed
Timestamp when assets were last collected for streaming
Timestamp when current streaming period ends
Duration over which collected assets are streamed
Emitted when a loan is provided to a bridge recipient
Name | Type | Description |
---|---|---|
nonce | uint256 | The unique identifier of the transaction |
recipient | address | The address receiving the funds |
asset | contract ERC20 | The asset being transferred |
amount | uint256 | The total amount including fees |
origin | struct RelayPool.OriginSettings | The origin settings for this bridge |
fees | uint256 | The fee amount collected |
Emitted when bridged funds are claimed and deposited
Name | Type | Description |
---|---|---|
chainId | uint32 | The chain ID of the bridge origin |
bridge | address | The bridge address on the origin chain |
amount | uint256 | The total amount claimed |
fees | uint256 | The fee amount collected |
Emitted when outstanding debt changes
Name | Type | Description |
---|---|---|
oldDebt | uint256 | Previous total outstanding debt |
newDebt | uint256 | New total outstanding debt |
origin | struct RelayPool.OriginSettings | The origin settings involved |
oldOriginDebt | uint256 | Previous outstanding debt for the origin |
newOriginDebt | uint256 | New outstanding debt for the origin |
Emitted when assets are deposited into the yield pool
Name | Type | Description |
---|---|---|
amount | uint256 | The amount deposited |
yieldPool | address | The yield pool address |
Emitted when assets are withdrawn from the yield pool
Name | Type | Description |
---|---|---|
amount | uint256 | The amount withdrawn |
yieldPool | address | The yield pool address |
Emitted when the token swap address is changed
Name | Type | Description |
---|---|---|
prevAddress | address | The previous swap contract address |
newAddress | address | The new swap contract address |
Emitted when the yield pool is changed
Name | Type | Description |
---|---|---|
oldPool | address | The previous yield pool address |
newPool | address | The new yield pool address |
Emitted when the streaming period is changed
Name | Type | Description |
---|---|---|
oldPeriod | uint256 | The previous streaming period |
newPeriod | uint256 | The new streaming period |
Emitted when a new origin is added
Name | Type | Description |
---|---|---|
origin | struct RelayPool.OriginParam | The origin parameters |
Emitted when an origin is disabled
Name | Type | Description |
---|---|---|
chainId | uint32 | The chain ID of the disabled origin |
bridge | address | The bridge address of the disabled origin |
maxDebt | uint256 | The previous maximum debt limit |
outstandingDebt | uint256 | The outstanding debt at time of disabling |
proxyBridge | address | The proxy bridge address |
Initializes the RelayPool with core parameters
Warning: the owner should always be a timelock with significant delay
Name | Type | Description |
---|---|---|
hyperlaneMailbox | address | The Hyperlane mailbox contract address |
asset | contract ERC20 | The underlying asset for this vault |
name | string | The name of the vault token |
symbol | string | The symbol of the vault token |
baseYieldPool | address | The initial yield pool for depositing assets |
weth | address | The WETH contract address (for native currency pools) |
curator | address | The address that will own the pool after deployment |
Updates the streaming period for fee accrual
Updates streamed assets before changing the period
Name | Type | Description |
---|---|---|
newPeriod | uint256 | The new streaming period in seconds |
Updates the yield pool, moving all assets from the old pool to the new one
Implements share price-based slippage protection to ensure fair value transfer
Name | Type | Description |
---|---|---|
newPool | address | The address of the new yield pool |
minSharePriceFromOldPool | uint256 | The minimum acceptable share price when withdrawing from the old pool |
maxSharePricePriceFromNewPool | uint256 | The maximum acceptable share price when depositing into the new pool |
Adds a new authorized origin for bridging
Only callable by owner, typically a timelock contract
Name | Type | Description |
---|---|---|
origin | struct RelayPool.OriginParam | The origin parameters including chain ID, addresses, and limits |
Disables an origin by setting its max debt to zero
Only callable by the origin’s curator for emergency response
Name | Type | Description |
---|---|---|
chainId | uint32 | The chain ID of the origin to disable |
bridge | address | The bridge address of the origin to disable |
Increases outstanding debt for an origin
Updates both origin-specific and total outstanding debt
Name | Type | Description |
---|---|---|
amount | uint256 | The amount to increase debt by |
origin | struct RelayPool.OriginSettings | The origin settings to update |
Decreases outstanding debt for an origin
Updates both origin-specific and total outstanding debt
Name | Type | Description |
---|---|---|
amount | uint256 | The amount to decrease debt by |
origin | struct RelayPool.OriginSettings | The origin settings to update |
Returns the maximum assets that can be deposited
Limited by the yield pool’s capacity
Name | Type | Description |
---|---|---|
address |
Name | Type | Description |
---|---|---|
maxAssets | uint256 | The maximum amount of assets that can be deposited |
Returns the maximum assets that can be withdrawn by an owner
Limited to the owner’s share balance converted to assets
Name | Type | Description |
---|---|---|
owner | address | The address to check withdrawal capacity for |
Name | Type | Description |
---|---|---|
maxAssets | uint256 | The maximum amount of assets that can be withdrawn |
Returns the maximum shares that can be minted
Limited by the yield pool’s deposit capacity
Name | Type | Description |
---|---|---|
receiver | address | The address that would receive the shares |
Name | Type | Description |
---|---|---|
maxShares | uint256 | The maximum amount of shares that can be minted |
Returns the maximum shares that can be redeemed by an owner
Limited by the owner’s share balance and yield pool’s withdrawal capacity
Name | Type | Description |
---|---|---|
owner | address | The address to check redemption capacity for |
Name | Type | Description |
---|---|---|
maxShares | uint256 | The maximum amount of shares that can be redeemed |
Returns the total assets controlled by the pool
Includes yield pool balance, outstanding debt, minus pending fees and streaming assets
Name | Type | Description |
---|---|---|
[0] | uint256 | The total assets under management |
Deposits assets into the yield pool
Internal function that approves and deposits to yield pool
Name | Type | Description |
---|---|---|
amount | uint256 | The amount of assets to deposit |
Withdraws assets from the yield pool
Internal function that withdraws from yield pool to recipient
Name | Type | Description |
---|---|---|
amount | uint256 | The amount of assets to withdraw |
recipient | address | The address to receive the withdrawn assets |
Handles incoming cross-chain messages from Hyperlane
Only callable by Hyperlane mailbox, provides instant liquidity to recipients
Name | Type | Description |
---|---|---|
chainId | uint32 | The origin chain ID |
bridgeAddress | bytes32 | The origin bridge address (as bytes32) |
data | bytes | The encoded message data |
Calculates remaining assets to be streamed
Returns zero if streaming period has ended
Name | Type | Description |
---|---|---|
[0] | uint256 | The amount of assets remaining to be streamed |
Updates the streamed assets calculation
Resets the streaming calculation to current timestamp
Name | Type | Description |
---|---|---|
[0] | uint256 | The new total assets to stream |
Adds assets to be accounted for in a streaming fashion
Adjusts streaming end time based on weighted average
Name | Type | Description |
---|---|---|
amount | uint256 | The amount of assets to add to streaming |
Name | Type | Description |
---|---|---|
[0] | uint256 | The new total assets to stream |
Claims funds from a bridge after they arrive
Decreases outstanding debt and deposits funds into yield pool
Name | Type | Description |
---|---|---|
chainId | uint32 | The origin chain ID |
bridge | address | The origin bridge address |
Name | Type | Description |
---|---|---|
amount | uint256 | The amount of assets claimed |
Sends funds to a recipient
Handles both ERC20 and native currency transfers
Name | Type | Description |
---|---|---|
amount | uint256 | The amount to send |
recipient | address | The address to receive the funds |
Sets the token swap contract address
Used for swapping non-asset tokens received by the pool
Name | Type | Description |
---|---|---|
newTokenSwapAddress | address | The new token swap contract address |
Swaps tokens and deposits resulting assets
Swaps via Uniswap V3 through the token swap contract
Name | Type | Description |
---|---|---|
token | address | The token to swap from |
amount | uint256 | The amount of tokens to swap |
uniswapWethPoolFeeToken | uint24 | The fee tier for token-WETH pool |
uniswapWethPoolFeeAsset | uint24 | The fee tier for WETH-asset pool |
deadline | uint48 | The deadline for the swap |
amountOutMinimum | uint256 | The minimum amount of assets to receive |
Collects any assets not yet deposited and starts streaming them
Can be called by anyone to ensure timely asset collection
Hook called before withdrawing assets from the vault
Withdraws assets from yield pool before processing withdrawal
Name | Type | Description |
---|---|---|
assets | uint256 | The amount of assets to withdraw |
uint256 |
Hook called after depositing assets to the vault
Deposits assets into yield pool after receiving them
Name | Type | Description |
---|---|---|
assets | uint256 | The amount of assets deposited |
uint256 |
Processes failed Hyperlane messages manually
Only callable by owner, typically after slow bridge resolution
Name | Type | Description |
---|---|---|
chainId | uint32 | The origin chain ID |
bridge | address | The origin bridge address |
data | bytes | The encoded message data |
Receives native currency
Required for WETH unwrapping in native currency pools