Fujicracy / fuji-v2

Cross-chain money market aggregator
https://fuji-v2-frontend.vercel.app
15 stars 10 forks source link

Permissioned transfer to receiver on dest chain #250

Closed brozorec closed 1 year ago

brozorec commented 1 year ago

The affected flow is: deposit+borrow on chain A and transfer the borrowed amount to chain B.

We call xTransfer action on the router of chain A that sets the end user address as a receiver, not the router's address of chain B as it's the case in xTransferWithCalldata. https://github.com/Fujicracy/fuji-v2/blob/566a32e5c2b391e86c79be8a765dff33c70c6a1a/packages/protocol/src/routers/ConnextRouter.sol#L150-L159

The effect of it is that Connext passes the transfer through the fast path and deducts 0.05% as a fee. This creates 2 problems:

  1. Inconsistency with all Connext inbound calls to the destination chain that are permissioned
  2. User can't control and choose what path to take
0xdcota commented 1 year ago

@brozorec from a quick glance it seems to me that you can encode in the arguments whichever address you want receiver to be. This can be the router on chain B or an arbitrary address. However, if you are trying to call the router in Chain B, then you are intending most likely intending to add calldata to do something else. Which means, you should instead use xTransferWithCalldata.

If we are looking to just create a "Dispatcher", that will authenticate just to make "xCall" the slow path, then that should probably be its own contract in my opinion.

brozorec commented 1 year ago

This becomes irrelevant after #285 gets resolved.