Problem Description
As a developer of a 3rd party (external to a birdge) fast withdrawal solution I would like to have a way to connect an original withdrawal requester from an l2 to l1 message payload. Additionally, I would like to embed even more details about the withdrawal request (fees etc).
Solution
Add extraData field to iOVM_L1TokenGateway's finalizeWithdrawal. This adds more context to cross-chain messages and allows to build 3rd party fast withdrawal solutions OUTSIDE of the token bridge.
extraData can contain a hash of a message containing the address of an original requester, info about fees etc.
Additional context
FW solution flow possible after this change:
- Alice calls
withdrawTo on L2DepositedToken with an address of a smartcontract coordinating FW let's call it Coordinator.
- A liqudity provider Bob validates that withdrawal is correct.
- Bob sends Alice funds on L1 by letting
Coordinator to send his funds to Alice and record this fact. Alice can enjoy their token on L1.
- When Alice's withdrawal settles, Bob claims it as he can proof that he already sent Alice funds.
If (3) never happened, after withdrawal settles, Alice proofs that she initiated the original withdraw and she claims tokens. Without the change described in this PR a cross-chain message only contains address of a Coordinator SC (to field) and hence Alice can not prove that she originated the withdrawal.
PoC of such solution was implemented by @gakonst in: https://github.com/gakonst/optimistic-fast-withdrawals/blob/feat/fast-withdrawals/contracts/MarketMaker.sol
Alice and Bob can negotiate additional fees in a state channel and they don't have to be part of the cross-chain message.
Original discussion: #349