General overview
For the call-execution routes described here, solvers use Vectorized’s Multicaller contract. The multicall isolates execution from the solver’s wallet. One exception is a simple bridge transaction with emptydata. A solver can execute that transfer directly to avoid Multicaller gas overhead.
Sender Attribution
Because transactions execute through a solver or Multicaller, you can’t assumemsg.sender identifies the user. There are a couple of ways around this:
Unauthenticated Delegation
The simplest solution is if your contract allows one user to take an action on behalf of another user. This works great for actions that don’t require authentication, because they are purely net beneficial to the user:- buying an NFT
- depositing into a vault
- placing an auction bid
- selling the NFT
- withdrawing from the vault
- canceling the bid, etc.
msg.sender, you could mint via a router contract then have it forwarded the NFT to the user.
Authenticated Delegation
For authenticated actions, you can do those by passing in proof that the user authenticated the action. Currently, you need to build custom signature authentication into your contract, however, in the near future we will be adding support for more standardized flows, such as:- Selling tokens with permit signatures
- MulticallerWithSigner
- ERC2771 Trusted Forwarder
Just-In-Time Gas
Alternatively, you can simply bridge a small amount of gas and have the user execute the transaction themselves. This is viable because of how fast and cheap Relay is, and is backwards compatible with any contract. We will soon add functionality to our SDK to handle this flow completely automatically, but until then, you can do it manually like this:- Estimate the cost of the transaction on destination
- Get a quote to bridge enough gas (small buffer recommended to handle fluctuation)
- User executes the bridge of gas money from Origin to Destination
- User executes the action on Destination
- (Optional) If selling an asset, User could potentially bridge the proceeds back to Origin