White Whale Releases Details on Flash Loan Architecture

Let’s break it down. Flash loans are, simply put, loans that are opened quickly and close in very little time. It is also opened and closed within the same transaction. The flash loan is used for execution of atomic trades. These transactions either capitalize on market inefficiencies or provide other functionality to the borrower. Atomic trades can only be completed in one transaction. This includes almost all of the on-chain arbitrage. We are sure you now realize the power of this financial tool. This power also comes with responsibility.

White Whale was said to be one of the first to offer Terra flash loans (and all Cosmos!However, it is already offered by several protocols on Ethereum. A number of Ethereum exploits have led to the negative association with flash loans. In these cases, hackers used this tool for so-called “re-entrancy” attacks.  This kind of attack is prevented by CosmWasm, the smart contract language from Terra. When comparing CosmWasm to Ethereum’s smart contract language the developers state:

“A big difference is that we avoid all reentrancy attacks by design. This point deserves an article by itself, but in short, a large class of exploits in Ethereum is based on this trick .”


“Cosmwasm avoids this completely by preventing any contract from calling another one directly.”

White Whale can provide this service with these precautions without worrying about any other protocols being used.

To really understand how all this works, let’s look at, and briefly unpack the White Whale flagship vault. In one step, users can deposit UST directly into the vault. With a variety of arbitrage strategies in place, the UST vault acts as a pool that can be used for general purposes. This first strategy is about keeping the peg. Other strategies are in development, including exploiting price differences among different exchanges and automated liquidations of Mars or Levana. These strategies improve the stability and efficiency of the ecosystem and all of them use liquidity from the UST vault.

These strategies lead us to flash loans. When one of our bots finds a profitable opportunity to arbitrage, the smart contractual linked to the strategy will request a flash loan to the UST vault. After the arbitrage is completed, the UST vault will withdraw the UST from Anchor protocol. It’s yielding a comfortable 19.5% during idle time. The vault receives all the funds after arbitrage. We plan to offer Anchor+ yields this way.

A question that has been raised, is this – what if the trade didn’t make a profit? Or what if the borrower just doesn’t repay the loan? Various mechanisms have been put in place, to ensure depositors don’t get rugged. White Whale will first keep the vault’s entire value in reserve when you request a flash loan. Next, funds are sent to the borrower (i.e. For them to complete the trade, the funds are sent out to the borrower (i.e. The program now includes a callback that cannot be changed and can execute as promised.

The callback will be executed after the borrower executes the trade. Step two is the callback. The callback is basically step two. It calculates the vault’s value and then compares that with the original value prior to the loan. It throws an error if the amount exceeds the original amount and it reverts all transactions, also known as the flash loan. The transaction then fails and it’s like nothing ever happened. The flash loan can only be approved if the transaction is profitable. If it fails, it will default to cancelling itself.

The community will have a long-term whitelisting process to allow them to create bots that can be onboarded through on-chain governance. They also get to use the White Whale Flash Loan Architecture. It will be up to the community to determine which bots are best suited to secure and benefit the ecosystem, and to vote for them to be whitelisted. A small fee will apply (the loan’s borrowing cost) and will be distributed automatically to all depositors.

White Whale already has scheduled audits with some the best auditors in industry to make sure that this unique and intricate architecture is secure. The foundation has already been built,  and now the focus is about getting the tools into the hands of our community, empowering them to protect the peg and stabilize the ecosystem.


Get more Crypto News at CFX Magazine