umbra-protocol
umbra-protocol copied to clipboard
Add batch send functionality
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:
- UI shows user a table which they populate, similar to the one below
- App generates the required random numbers, ephemeral pubkeys, ciphertext, etc. for each row in the table
- User approves the
UmbraRouterto send tokens as required - 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

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