user1042: Flash loans attacks are current in DeFi space and we saw several ones these last weeks on the Binance smart chain. (Pancake Bunny and Burger swaps)
Mr. Hoskinson said numerous times that if it took years for Cardano to implement smart contracts and DeFi, it was to avoid such attacks and to have a more secure plateform.
My question would therefore be :
Will projects on Cardano be flash-loans-attacksless? If yes how? If not, can we find a way to secure it?
Thanks in advance

user12: Flash loans generally exploit financial protocol vulnerabilities to manipulate the prices and exploit the system. For example, In the 2020 attack on Fulcrum built using bZx protocol, attackers used borrowed Ether to manipulate the price of sUSD( a stable coin); naturally, the price of the stable coin should have remained stable to prevent the attack. Smart contract writers should have anticipated the instability of stable coin prices under unusual market conditions. Formal verification methods would have identified this hidden issue.
Theoretically, these higher protocols are influenced by the underlying blockchain technology, which results in unreliable smart contract state estimation.
Cardano has brought the "Formal Methods" paradigm in creating smart contracts, enabling precise estimation of smart contracts behaviors provably. Moreover, Plutus is designed with such care to enable this technology. The potential of this mathematical precision has not yet been realized in the current ETH-dominated DeFi. In short, Cardano will prevent this type of protocol attacks by enabling smart contract writers to predict what can go wrong in which setting.

user4107: EDIT nov-02-2021: I misspoke earlier, details at the bottom.
Cardano is not intrinsically flashloan-attackless. Functional programming and formal verification help you a lot with the distance between spec and implementation, but do not give you anything with the distance between reality and spec. Reality (edge cases, attackers, things you failed to foresee) will be what gets you if your devs didn't let a simple bug through. Any proof engineer will tell you that false sense of security is a risk introduced by formal verification
It's tricky because we only use one word: "exploit" - when what we mean is either exploits at the software implementation level or exploits at the mechanism design level, but not both. The literature is infused with ambiguity, one must read diligently if they want to disambiguate this.
If you make progress on this, charge someone a lot of money.
EDIT: Cardano is in fact intrinsically flashloan-attackless at this time, but it is not because of "formal verification", it's because there are no multi-step yet atomic transactions. Flashloans, by definition, are an atomic transaction where an uncollateralized loan happens in the first step and it gets repaid in the last step. No multi-step yet atomic transactions, no flashloans, no flashloan attacks.

user4651: While flash loans will exist on Cardano, flash loan attacks will not.
To understand why, let's examine that PancakeBunny attack, https://www.coindesk.com/markets/2021/05/20/flash-loan-attack-causes-defi-token-bunny-to-crash-over-95/

Hacker used PancakeSwap to borrow a large amount of BNB
Hacker used these funds to to manipulate the price of USDT/BNB as well as BUNNY/BNB
Hacker received a large amount of BUNNY tokens
Hacker dumped BUNNY tokens onto the market, causing BUNNY price to crash
Hacker paid back BNB back to PancakeSwap, closing the flash loan

https://twitter.com/PancakeBunnyFin/status/1395173389208334342
This pattern is a common vector for flash loan attacks.  Key to the success of this attack is the ability to chain the execution of multiple smart contracts in series within a single blockchain transaction.
On Cardano, this simply won't be possible by design.

A single blockchain transaction represents activity that occurs simultaneously, not in series
And while Cardano does support chaining smart contracts, they must be chained over a series of transactions not a single transaction

So how would flash loans on Cardano work?  One option would be to write a validator script that implements the following rule: allow this UTXO to be spent so long as it is spent back into the same script address plus interest.
By design, the number of cases where this will be useful will be far more limited than on some other blockchains.

1042: <p>Flash loans attacks are current in DeFi space and we saw several ones these last weeks on the Binance smart chain. (Pancake Bunny and Burger swaps)</p>
<p>Mr. Hoskinson said numerous times that if it took years for Cardano to implement smart contracts and DeFi, it was to avoid such attacks and to have a more secure plateform.</p>
<p>My question would therefore be :
Will projects on Cardano be flash-loans-attacksless? If yes how? If not, can we find a way to secure it?</p>
<p>Thanks in advance</p>
 12: <p>Flash loans generally exploit financial protocol vulnerabilities to manipulate the prices and exploit the system. For example, In the 2020 attack on Fulcrum built using bZx protocol, attackers used borrowed Ether to manipulate the price of sUSD( a stable coin); naturally, the price of the stable coin should have remained stable to prevent the attack. Smart contract writers should have anticipated the instability of stable coin prices under unusual market conditions. Formal verification methods would have identified this hidden issue.</p>
<p>Theoretically, these higher protocols are influenced by the underlying blockchain technology, which results in unreliable smart contract state estimation.</p>
<p>Cardano has brought the &quot;Formal Methods&quot; paradigm in creating smart contracts, enabling precise estimation of smart contracts behaviors provably. Moreover, Plutus is designed with such care to enable this technology. The potential of this mathematical precision has not yet been realized in the current ETH-dominated DeFi. In short, Cardano will prevent this type of protocol attacks by enabling smart contract writers to predict what can go wrong in which setting.</p>
 4107: <p><strong>EDIT nov-02-2021: I misspoke earlier, details at the bottom.</strong></p>
<p>Cardano is not intrinsically flashloan-attackless. Functional programming and formal verification help you a lot with the distance between spec and implementation, but do not give you anything with the distance between reality and spec. Reality (edge cases, attackers, things you failed to foresee) will be what gets you if your devs didn't let a simple bug through. Any proof engineer will tell you that <strong>false sense of security</strong> is a risk <em>introduced by</em> formal verification</p>
<p>It's tricky because we only use one word: &quot;exploit&quot; - when what we mean is either exploits at the software implementation level or exploits at the mechanism design level, but not both. The literature is infused with ambiguity, one must read diligently if they want to disambiguate this.</p>
<p>If you make progress on this, charge someone a lot of money.</p>
<p>EDIT: Cardano is in fact intrinsically flashloan-attackless at this time, but it is not because of &quot;formal verification&quot;, it's because there are no <strong>multi-step yet atomic transactions</strong>. Flashloans, by definition, are an atomic transaction where an uncollateralized loan happens in the first step and it gets repaid in the last step. No multi-step yet atomic transactions, no flashloans, no flashloan attacks.</p>
 4651: <p>While flash loans will exist on Cardano, flash loan attacks will not.</p>
<p>To understand why, let's examine that PancakeBunny attack, <a href="https://www.coindesk.com/markets/2021/05/20/flash-loan-attack-causes-defi-token-bunny-to-crash-over-95/" rel="nofollow noreferrer">https://www.coindesk.com/markets/2021/05/20/flash-loan-attack-causes-defi-token-bunny-to-crash-over-95/</a></p>
<ol>
<li>Hacker used PancakeSwap to borrow a large amount of BNB</li>
<li>Hacker used these funds to to manipulate the price of USDT/BNB as well as BUNNY/BNB</li>
<li>Hacker received a large amount of BUNNY tokens</li>
<li>Hacker dumped BUNNY tokens onto the market, causing BUNNY price to crash</li>
<li>Hacker paid back BNB back to PancakeSwap, closing the flash loan</li>
</ol>
<p><a href="https://twitter.com/PancakeBunnyFin/status/1395173389208334342" rel="nofollow noreferrer">https://twitter.com/PancakeBunnyFin/status/1395173389208334342</a></p>
<p>This pattern is a common vector for flash loan attacks.  Key to the success of this attack is the ability to chain the execution of multiple smart contracts in series within a single blockchain transaction.</p>
<p>On Cardano, this simply won't be possible by design.</p>
<ul>
<li>A single blockchain transaction represents activity that occurs simultaneously, not in series</li>
<li>And while Cardano does support chaining smart contracts, they must be chained over a series of transactions not a single transaction</li>
</ul>
<p>So how would flash loans on Cardano work?  One option would be to write a validator script that implements the following rule: allow this UTXO to be spent so long as it is spent back into the same script address plus interest.</p>
<p>By design, the number of cases where this will be useful will be far more limited than on some other blockchains.</p>
