umbra-protocol icon indicating copy to clipboard operation
umbra-protocol copied to clipboard

Add batch send functionality

Open mds1 opened this issue 3 years ago • 1 comments

Similar to zkSync checkout or https://disperse.app/, show users a table and allow them to enter multiple addresses, tokens, and amounts, then batch them all up into a single transaction

We can support this in the UI with a toggle for showing a mode similar to the one below. Then we'd write an UmbraRouter contract which has a method with a signature of send(SendParams[] _params) where the SendParams struct contains everything needed to call Umbra.sendEth and/or Umbra.sendToken in a loop. The flow would be:

  1. UI shows user a table which they populate, similar to the one below
  2. App generates the required random numbers, ephemeral pubkeys, ciphertext, etc. for each row in the table
  3. User approves the UmbraRouter to send tokens as required
  4. Use calls UmbraRouter.send() with all required calldata. This method then pulls the tokens from the user to the router, and in a loop calls the appropriate Umbra send method

Also need to decide on the best way for the router to handle approvals. Should there be an admin-only/public method to add new approvals? Or just do the approves as-required in the router? The former is cheaper for users, but ideally we don't need an admin and we'd need to ensure a public method is ok. The latter is more expensive for users, but results in a simpler contract with less attack surface

image

mds1 avatar Feb 28 '22 16:02 mds1

Remaining tasks:

  • [x] Complete contract gas optimization
  • [x] Write contract deploy script
  • [x] Deploy contracts across relevant networks
  • [x] Create frontend interface for BatchSend

garyghayrat avatar Jul 06 '22 20:07 garyghayrat