Comment on page
How our integrations leverage Bundlers and Paymasters.
One of the main advantages to using Rainmaker is our bundled, sponsored transactions to make DeFi simple. In this section we'll dive into how deposits and withdrawals work for specific strategies and the status of our integrations.
Before we go into bundling we must review how paymaster work and how Rainmaker leverages them to sponsor gas for users.
Paymasters are smart contracts that enable flexible gas policies like allowing decentralized applications to sponsor operations for their users (i.e.pay gas fees in the blockchain’s native currency), or accept gas fee payments in an ERC-20 token (e.g. USDC) in place of the blockchain’s native currency.
Whenever a user transacts on Rainmaker they DO NOT have to pay gas, because we sponsor the transactions they send.
If you've used Rainmaker you're probably aware that you can enter any strategy in a single tap, where using a traditional wallet like MetaMask may take several transaction signings across multiple apps. Let's look at how this works for deposits and withdrawals into strategies
One great advantage of smart contract wallets is the ability to execute transactions in batches. That is, you can execute multiple transactions as if it's a single transaction, so you get to save on confirmation time and gas costs. It's also safer because these transactions either all execute or all revert, no in-between, which is a property known as "atomicity."
To illustrate the power of this, let's take leverage a simple example of depositing into Stargate's USDC bridge liquidity pool given that you have DOGE.
First, without using Rainmaker.
- 1.Top up wallet with gas token on the given network by swapping or from CEX.
- 2.Search for the cheapest DEX / aggregator and approve the DOGE swap.
- 3.Convert DOGE to USDC.
- 4.Head to the Stargate "Pool" tab, choose your network and approve adding USDC.
- 5.Submit the "add" USDC (for S*USDC LP Token).
- 6.Head to the farming tab and approve deposit of your LP Token.
- 7.Submit the "deposit" of the LP token in the farm.
Now with Rainmaker we can consolidate and even skip steps. Note that we don't need to get any gas as our paymasters will take care of transaction costs.
- 1.Go to the Stargate integration screen and select DOGE as the deposit token + amount.
- 2.Click Deposit.
In the first example there are 6 transactions happening. In the second there is only a single transaction. But how?
When you tell Raimaker that you want to deposit X,XXX DOGE into Stargate we can generate the entire list of transactions that are needed to do the above step WITHOUT actually executing them. We do this by assembling un-signed "calls". We then take these calls and send them to the bundler which executes a multi-call function and this is what atomically writes them on-chain as one transaction.
If you're curious a list of calls looks like this:
to: "0x1234...", // where the txn is going
data: "0x...", // the unsigned txn data let's say "approve DOGE spend"
value: "0" // depends on if this is payable or not
data: "0x...", // let's say "swap DOGE for USDC"
All Rainmaker native integrations leverage this to drastically simplify the user experience.
Want to learn more? Join our Discord and follow us on Twitter (X)! We love to chat.