What is FreeWei?
FreeWei is a new service exclusive to VarenX on Polygon that enables users to execute cross-chain swaps with free gas
At VarenX we put user experience front and center. Removing friction is a key pillar of this strategy. This is why we developed a new feature called FreeWei, which enables gasless cross-chain swaps with VarenX on Polygon.
In this post we’d like to go through the main questions you might have about this new feature.
FreeWei is a new service exclusive to VarenX on Polygon that enables users to execute gasless cross-chain swaps.
The concept of “gasless” transactions centers around the idea to mitigate the need to pay for network fees (e.g. ETH on Ethereum, MATIC on Polygon…) to execute a transaction.
FreeWei is automatically activated when you execute any transaction including a “mint” coming from a wallet on Polygon. Transactions including a “mint” are:
- mint (e.g.: BTC → renBTC)
- mint and swap (e.g.: BTC → MATIC)
- mint, swap and burn (e.g.: BTC → LUNA)
This feature might ring a bell if you’re familiar with Gas-as-a-Service (GaaS). But where GaaS subtracts the gas cost from the incoming asset on the user-side, with FreeWei VarenX fronts the gas costs instead of charging users. This makes cross-chain swaps with VarenX on Polygon free in terms of network transaction costs to the user experience.
These are the steps FreeWei takes:
1. The user starts a Mint
2. As soon as the Mint reaches 100% of the needed confirmations, the mint information is posted to the wallet funder
3. The funder checks if the mint is legit by validating the received mint information via RenJS
4. If the mint is legit it checks if it is signed by the renVM
5. If the mint is legit and signed, it checks if the mint was funded already by checking for the existence of the transaction hash inside the local wallet funder database
6. If the mint is legit and signed and not in the database, the funder will send 0.05 MATIC to the recipient of the mint (found in the mintInfo) and saves the txHash in the local wallet funder database so it is marked as funded in the future
7. The funder informs sends the funding transaction hash to the VarenX frontend which fetches it and enables the swap button as soon as the funding transaction is confirmed by the Polygon network
- If steps 1, 2, 3, or 4 fails the funder “dies silently” and does nothing
- If step 5 fails the funder sends the VarenX frontend the stored transaction hash of the funding transaction and continues fetching it until it is confirmed by the Polygon network
- If the mint is not a Polygon mint, the swap button gets unlocked immediately and FreeWei will not be executed
There are two points that prevent abuse of this new feature: validation and disincentivization.
In order to receive MATIC via the FreeWei service you need to execute a mint. As soon as the mint has enough confirmations to execute, FreeWei chimes in and validates your mint. As partners of Ren protocol, we’re using the RenVM for a two-way validation of the mint. First we make sure that the mint is a valid RenJS object. Then we make sure that the mint was actually confirmed by RenVM.
After the validation it sends the MATIC to the wallet you used to generate the gateway address.
Disincentivization follows simply because the fee structure of VarenX disincentivizes abuse as follows:
- To execute mints you have to send a minimum amount of the Ren-supported L1 assets to cover the RenVM and miner fee
- The VarenX fee (which is substracted after Ren fees) of the above minimum is always worth more than the amount of MATIC FreeWei sends you to cover gas fees
Technically it can, but as we said it isn’t profitable to do so. We replenish the wallet up to a max of 200 MATIC. At current gas fees, it would take 40,000 unexecuted mint txs to drain it fully. To cover all the VarenX fees it will cost about $2 million to do that, and the used assets will remain stuck in the Gateway as well. As soon as the mints get executed to “unstuck” them, the VarenX fees would outweigh the MATIC that was “drained”.
FreeWei is only executed after mints have been confirmed. A confirmed mint, can’t be cancelled. You are however free to execute any swap after receiving the MATIC, even outside of VarenX. But keep in mind, if you don’t execute your mint, your assets remain in the gateway address. And those assets will by default be worth more than 0.05 MATIC.