Yes, we can do it. Thanks to dai’s permit function.
What is the problem?
This is how gitcoin grant works now.
- Approve BulkCheckout contract to approve your DAI(or any ERC20 token).
- Call donate function of BulkCheckout contract which transfers your token to multiple addresses.
This approve and call pattern is very common but it is not a good user experience and developers are trying to fix that in various ways.
What is the solution?
Use DAI’s permit function to save a transaction. I have updated BulkCheckout contract to include the permit in the contract call itself. Checkout the contract here.
In this pattern user first signs a EIP712 Type signature data which contract can submit.
Using this pattern gitcoin grant can be made gasless. (I have made use of EIP-2585 Minimal Meta Transaction Forwarder and Biconomy’s relayer network to do so).
This “permit and transfer” pattern can be really useful and make user experience a bit better. The reason it is not used as much it should is that only a handful of ERC20 tokens has permit function.
Most of the gitcoin grants are donated in DAI and this pattern can help make donating a bit easier.
Checkout the project on github : https://github.com/yashnaman/bundler
Demo Video : https://www.youtube.com/watch?v=bhZ3jWyqNvY&t=155s
This hack was hacked for the Hack The Hourglass hackathon.