polytope-labs / hyperbridge

Hyperbridge is a hyperscalable coprocessor for verifiable, cross-chain interoperability
https://docs.hyperbridge.network/
Apache License 2.0
107 stars 33 forks source link

EvmHost: Support native tokens #266

Closed seunlanlege closed 1 month ago

seunlanlege commented 1 month ago

Allow the EvmHost to accept the native token as payment for outgoing messages, so long as it can be swapped for the feeToken required to dispatch messages. This functionality has also been extended to fundRequest and fundResponse. Relayer fees are still refunded using feeToken.

This should make Hyperbridge's UX/DX more seamless, and it looks something like:

IDispatcher(_hostAddr).dispatch{value: cost}(DispatchPost({}));

This is achieved by swapping the native token for the feeToken using a local IUniswapV2Router02 instance. The address for this instance is tracked in the HostParams

Wizdave97 commented 1 month ago

PR looks good to me.