Skip to content

HyperStrategy

Source: src/strategies/HyperStrategy.sol

The HyperStrategy is deployed on the source chain (e.g., Ethereum) to bridge capital to the HyperEVM network using CCTP V2.

Public And External Functions

Function Access Description
receiver() public view Returns source-chain vault receiver.
asset() public view Returns source-chain asset.
hyperevmAllocator() public view Returns configured HyperEVM allocator.
lastUpdateTime() public view Returns timestamp of latest accepted remote state.
lastStateNonce() public view Returns latest accepted remote state nonce.
totalAssets() public view Returns remoteAssets + processingAssets + local asset balance.
remoteAssets() public view Returns tracked HyperEVM assets.
totalSupply() public view Returns tracked HyperEVM internal share supply.
processingAssets() public view Returns CCTP invest assets in flight.
processingShares() public view Returns CCTP redeem shares in flight.
setHyperevmAllocator(address) Admin Sets allocator once. Reverts if already set.
setCctpMaxFee(uint256 maxFee) Keeper Sets max CCTP fee for bridge calls.
invest(uint256 amount) Keeper Burns source-chain asset through CCTP to allocator.
divest(uint256 amount) Keeper Converts amount to remote shares and sends RedeemMessage to allocator. Returns 0 because redemption is async.
replenish(uint256) pure Unsupported; always reverts FunctionNotSupported().
exit(bool) Keeper Transfers local source-chain asset balance to receiver. Does not unwind remote HyperEVM assets.
harvest(IERC20 asset_) Keeper Sweeps non-primary tokens to receiver.
updateRemoteState(bytes message, bytes attestation) Keeper Relays finalized CCTP state update.
completeInvest(bytes message, bytes attestation) Keeper Relays finalized CCTP invest response.
completeDivest(bytes message, bytes attestation) Keeper Relays finalized CCTP divest response, updates state from hook, transfers local asset to receiver.
handleReceiveFinalizedMessage(...) CCTP MessageTransmitter only Handles finalized UpdatedStateMessage.
handleReceiveUnfinalizedMessage(...) external pure Accepts unfinalized message path and returns true.

Internal Functions

Function Description
_validateSource(...) Ensures source CCTP domain and sender match expected allocator.
_updateRemoteState(UpdatedStateMessage) Applies processed asset/share deltas and updates remote totals if nonce is fresh.
_addressToBytes32(address) Converts address to CCTP bytes32 format.
_bytes32ToAddress(bytes32) Converts CCTP bytes32 sender to address.