Gas-Free Flash Loans

SoftLink Gas-Free Flash Loans V0

Problem

Highly active and successful searchers are constantly executing complex strategies; however, the obvious issue with strategies involving more complexity is the gas cost associated with each strategy.

Additionally, strategies leveraging transactions that involve flash loans increase the total amount of gas required (given that flash loans must execute several operations in sequence successfully).

Solution

Inspired by the design of Executor Operators developed by engineers at Gelato Network, our protocol designed a fairly simple, but effective, system to offload the additional gas included in strategies leveraging flash loans through a proxy network.

Designed for high availability, scalability, and feasibility, the proxy network deploys stateless processes designed specifically to redirect requests to perform flash loans within the protocol’s network of reserves to minimize strategy gas costs.

Leveraging the Gelato Relay SDK, the engineers at Gelato Network guarantee that flash loan transactions are mined fast, reliably, and securely.

Proxy API Design

Base URL: TBA

In order for a searcher to interact with the proxy network, the following endpoint is publicly exposed and implements rate-limiting:

POST /v0/eth/flashloan/execute

Request Body Schema (JSON):

{
     "targetReserveAddress": String, // Hex String => ethers.js
     "receiver": String,
     "amount": Number,
     "decimals": Number?, // For ERC20 tokens
     "params": String, // Hex String
     "isNativeFlashLoan": Boolean
}

Response Body Schema (JSON):

{
     "gelatoData": {
         "taskId": String, // Hex String - Review Gelato Relay SDK notes)
         "message": String
     }
}

*Keep in mind that if the address given is not a valid CoreFlashLoanReceiver (such as in the example above), the execution will fail.

POST /v0/eth/flashloan/querytaskstatus

Request Body Schema (JSON):

{
    "taskId": String // Hex String - Returned from /api/v1/eth/flashloan/execute call above)
}

Request Body Schema (JSON):

Privacy: RPC Methods

Bypassing a public mempool is crucial for a lot of successful MEV searchers.

Therefore, SoftLink will use the Flashbots Protect RPC to create a private order flow for each and every transaction that is submitted through the proxy.

However, at the moment, since Flashbots Protect RPC is currently in Beta, please review their documentation regarding some of the current pitfalls associated with the RPC.

UPDATE: Failover strategies, such as issuing private raw transactions through Manifold Finance's OpenMev endpoint on Protect RPC failures, will be implemented to mitigate any issues arising with the Beta.

Security: TLS/SSL

Given that searchers care deeply about keeping strategies in the shadows to maximize total profitability, all requests are encrypted in transit via the wildly known protocol HTTPS.

The importance of implementing HTTPS lies in it’s ability to mitigate man-in-the-middle attacks where sophisticated attackers can intercept network packets in transit from the sender (client) to the receiver (server).

HTTPS implements public key cryptography which allow for messages to be encrypted; therefore, if attackers are successful in assuming control of a remote device in between the sent packets origin and destination, the message would be ultimately unreadable.

Transaction Gas Threshold

The protocol initially sets a transaction gas threshold, but this threshold is open to being updated if public proposals pass in governance.

The transaction gas upper bound is initially set at 0.21 GWEI (210,000,000) or 100x the minimum amount of gas an operation on Ethereum will use.

Last updated