Skip to main content

Solidity API

RelayPool

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

OriginSettings

Configuration for an authorized origin chain and bridge

Parameters

OriginParam

Parameters for adding a new origin

Parameters

UnauthorizedCaller

Error when caller is not authorized for the operation

Parameters

UnauthorizedSwap

Error when attempting to swap the pool’s underlying asset

Parameters

UnauthorizedOrigin

Error when message is from an unauthorized origin

Parameters

MessageAlreadyProcessed

Error when attempting to process an already processed message

Parameters

TooMuchDebtFromOrigin

Error when origin would exceed its maximum allowed debt

Parameters

FailedTransfer

Error when native currency transfer fails

Parameters

InsufficientFunds

Error when insufficient funds are available

Parameters

NotAWethPool

Error when native currency is sent to a non-WETH pool

MessageTooRecent

Error when message timestamp is too recent based on cooldown period

Parameters

SharePriceTooLow

Error when share price is below minimum acceptable threshold

Parameters

SharePriceTooHigh

Error when share price is above maximum acceptable threshold

Parameters

HYPERLANE_MAILBOX

The address of the Hyperlane mailbox Used to receive cross-chain messages

WETH

The address of the WETH contract (used for native pools) Set to WETH address for native currency pools, otherwise can be address(0)

FRACTIONAL_BPS_DENOMINATOR

Denominator for fractional basis points calculations (1 = 0.0000001 bps)

outstandingDebt

Keeping track of the outstanding debt for ERC4626 computations Represents funds that have been sent but not yet claimed from bridges

authorizedOrigins

Mapping of origins to their settings [chainId][bridgeAddress] => OriginSettings

messages

Mapping of messages by origin [chainId][bridgeAddress][nonce] => message data

yieldPool

The address of the yield pool where funds are deposited Must be an ERC4626 vault for the same underlying asset

tokenSwapAddress

UniswapV3 wrapper contract for token swaps

pendingBridgeFees

Keeping track of the total fees collected Fees are held in the yield pool until they finish streaming

totalAssetsToStream

All incoming assets are streamed (even though they are instantly deposited in the yield pool) Total amount of assets currently being streamed

lastAssetsCollectedAt

Timestamp when assets were last collected for streaming

endOfStream

Timestamp when current streaming period ends

streamingPeriod

Duration over which collected assets are streamed

LoanEmitted

Emitted when a loan is provided to a bridge recipient

Parameters

BridgeCompleted

Emitted when bridged funds are claimed and deposited

Parameters

OutstandingDebtChanged

Emitted when outstanding debt changes

Parameters

AssetsDepositedIntoYieldPool

Emitted when assets are deposited into the yield pool

Parameters

AssetsWithdrawnFromYieldPool

Emitted when assets are withdrawn from the yield pool

Parameters

TokenSwapChanged

Emitted when the token swap address is changed

Parameters

YieldPoolChanged

Emitted when the yield pool is changed

Parameters

StreamingPeriodChanged

Emitted when the streaming period is changed

Parameters

OriginAdded

Emitted when a new origin is added

Parameters

OriginDisabled

Emitted when an origin is disabled

Parameters

constructor

Initializes the RelayPool with core parameters Warning: the owner should always be a timelock with significant delay

Parameters

updateStreamingPeriod

Updates the streaming period for fee accrual Updates streamed assets before changing the period

Parameters

updateYieldPool

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

Parameters

addOrigin

Adds a new authorized origin for bridging Only callable by owner, typically a timelock contract

Parameters

disableOrigin

Disables an origin by setting its max debt to zero Only callable by the origin’s curator for emergency response

Parameters

increaseOutstandingDebt

Increases outstanding debt for an origin Updates both origin-specific and total outstanding debt

Parameters

decreaseOutstandingDebt

Decreases outstanding debt for an origin Updates both origin-specific and total outstanding debt

Parameters

maxDeposit

Returns the maximum assets that can be deposited Limited by the yield pool’s capacity

Parameters

Return Values

maxWithdraw

Returns the maximum assets that can be withdrawn by an owner Limited to the owner’s share balance converted to assets

Parameters

Return Values

maxMint

Returns the maximum shares that can be minted Limited by the yield pool’s deposit capacity

Parameters

Return Values

maxRedeem

Returns the maximum shares that can be redeemed by an owner Limited by the owner’s share balance and yield pool’s withdrawal capacity

Parameters

Return Values

totalAssets

Returns the total assets controlled by the pool Includes yield pool balance, outstanding debt, minus pending fees and streaming assets

Return Values

depositAssetsInYieldPool

Deposits assets into the yield pool Internal function that approves and deposits to yield pool

Parameters

withdrawAssetsFromYieldPool

Withdraws assets from the yield pool Internal function that withdraws from yield pool to recipient

Parameters

handle

Handles incoming cross-chain messages from Hyperlane Only callable by Hyperlane mailbox, provides instant liquidity to recipients

Parameters

remainsToStream

Calculates remaining assets to be streamed Returns zero if streaming period has ended

Return Values

updateStreamedAssets

Updates the streamed assets calculation Resets the streaming calculation to current timestamp

Return Values

addToStreamingAssets

Adds assets to be accounted for in a streaming fashion Adjusts streaming end time based on weighted average

Parameters

Return Values

claim

Claims funds from a bridge after they arrive Decreases outstanding debt and deposits funds into yield pool

Parameters

Return Values

sendFunds

Sends funds to a recipient Handles both ERC20 and native currency transfers

Parameters

setTokenSwap

Sets the token swap contract address Used for swapping non-asset tokens received by the pool

Parameters

swapAndDeposit

Swaps tokens and deposits resulting assets Swaps via Uniswap V3 through the token swap contract

Parameters

collectNonDepositedAssets

Collects any assets not yet deposited and starts streaming them Can be called by anyone to ensure timely asset collection

beforeWithdraw

Hook called before withdrawing assets from the vault Withdraws assets from yield pool before processing withdrawal

Parameters

afterDeposit

Hook called after depositing assets to the vault Deposits assets into yield pool after receiving them

Parameters

processFailedHandler

Processes failed Hyperlane messages manually Only callable by owner, typically after slow bridge resolution

Parameters

receive

Receives native currency Required for WETH unwrapping in native currency pools