Skip to main content
18 votes
Accepted

Explain "griefing" attack on Aave flash loan

Developer @ Aave here, good questions. It depends on your contract. But a simple one would be: Contract A has funds and the executeOperation() Contract B calls flashloan(), passing in Contract A as ...
David T's user avatar
  • 316
8 votes

Flash loan security considerations and attacks

As we work on flash loan attack debriefs, we can gather a lot of information about what could have been taken as preventative measures. It's important to understand how these flash loans work before ...
Patrick Collins's user avatar
6 votes
Accepted

Double Flash Loan

You can actually do a double flashloan, but the success will depend on the total amount of gas consumed in the transaction. In fact, you don't need to have two contracts and you can request the two ...
Sergi Juanati's user avatar
4 votes

What time Ethereum gas fee is calculated?

When you create a transaction you set two parameters: gas: Maximum amount of gas to be used gasPrice: Price to pay for each gas unit To execute the transaction your account needs to have at least ...
Ismael's user avatar
  • 30.3k
4 votes
Accepted

How to Tranfer Remaining NFTs And/Or Tokens Out of A Hacked Ethereum Wallet

You are in the correct path. MEV can do this for you. You can use MEV to submit two transactions with the following properties: Either both or none of them go through They should be executed in the ...
Lauri Peltonen's user avatar
4 votes
Accepted

How does flashloan guarantee the borrowed ether/token will be paid back?

it's all done in one function, so you can revert if the money isn't paid back. (e.g. I send you 100 bucks, you do what you want with it, but the txn reverts if it's not back in my hand by the end of ...
thefett's user avatar
  • 3,920
3 votes
Accepted

Why I need smart contract for arbitrage

I think reasons are multiple: if you sign the transaction to interact with the exchanges contracts directly with an EOA you must know the exact best amounts to optimise your gain since the beginning. ...
Andrea Ciceri's user avatar
3 votes

How to Tranfer Remaining NFTs And/Or Tokens Out of A Hacked Ethereum Wallet

I was in the same situation - my credentials were stolen when i connected metamask to scam website that looked like legit one. ETH scavenger was eating all my ETH in wallet and my NFTs were stuck in ...
EddGarcia's user avatar
3 votes

How to conduct a flash loan on PancakeSwap?

PancakeSwap is a fork of Uniswap V2, which allows flashswaps. An example of flashswap using Uniswap V2 can be found here: https://github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/examples/...
Alexander Barry's user avatar
3 votes

Flash loan security considerations and attacks

Flash loans violate two common intuitive assumptions. 1. "Nobody has that much ETH" Problems can arise when for example: Your contract uses a non-linear formula with an ETH amount as ...
Jesbus's user avatar
  • 10.5k
3 votes

Flash loan security considerations and attacks

Generally speaking, if your system gives the users different terms under different scenarios, then you need to remember that a user can issue a flash-load attack on it. For example, if your pool gives ...
goodvibration's user avatar
3 votes

Can i use the data returned from 1inch's api swap, to perform a swap from a smart contract? (i.e for flashloans)

Sure. There are a couple examples in the wild but my favorite example is the swapProxy by smye To get the data from the API disableEstimate=true is a required parameter. Make sure the fromAddress is ...
Belac's user avatar
  • 31
3 votes

Cannot estimate gas; transaction may fail

Ok I solved it. I tested my smart contract with hardhat and to check the states I used console.log. For sure that does not work on mainnet (Or even testnet), but on a hardhat forked mainnet it does. ...
Dani's user avatar
  • 83
2 votes

Explain "griefing" attack on Aave flash loan

I think the things is: anyone can call the function in contract A means anyone can utilize the funds inside the contract. This can finally used up the funds and it is called a griefing attack.
w zz's user avatar
  • 21
2 votes
Accepted

Member "concat" not found or not visible after argument-dependent lookup

It fails because the compiler is looking for the concat function as a member of bytes type. You can use concat as a regular function return string(concat(bytes(api0xUrl), concat(...
Ismael's user avatar
  • 30.3k
2 votes
Accepted

Failing to borrow from Aave's Lending Pool

The AAVE v2 USDC and USDT tokens use 6 decimals rather than 18. My guess is that you are trying to borrow a trillion million dollars rather than just a million. This line: aaveUSDCloan = 1000000 * 10 *...
Daniel Von Fange's user avatar
2 votes

Flashloan error `reverted with reason string 'SafeERC20: low-level call failed'`

You will need to have tokens of the target assets in the smart contract in order to pay for the premiums
user1657862's user avatar
2 votes

Abitrage with dydx flash loan always reverted

i am trying to make a flash loan too. i saw some codes on how to buy on kyber and sell on uniswap https://github.com/jklepatch/eattheblocks/tree/master/profitable-flashloans/24-buy-kyber-sell-uniswap ...
franklin forson's user avatar
2 votes
Accepted

Is this smart contract code malicious?

TL;DR Yes, it's a scam. The functions used are hidden in the Manager object imported with this line import "ipfs://Qmf5Ua79ZT8ERFa9q32fQtGuWkqk1eZXxnzRdeTi6wvzUy". I cannot see that code, ...
Undead8's user avatar
  • 3,630
2 votes
Accepted

Can a flash loan used to flash attack a smart contract?

Yes, it is possible. Moreover that technique was already used against MakerDao, read https://forum.makerdao.com/t/urgent-flash-loans-and-securing-the-maker-protocol/4901. It can be fixed by requiring ...
Ismael's user avatar
  • 30.3k
2 votes
Accepted

Getting a compile error every time I try to compile a contract with Brownie that includes an import statement from the web

In order to import directly from github, you need to add the dependencies to your brownie-config.yaml file. ie if you're trying to import from https://github.com/aave/protocol-v2/blob/master/contracts/...
Patrick Collins's user avatar
2 votes

Approving tokens after flash loan

Yikes. Turns out this was happening since I wasn't paying back my flashloan. 🤦
kingfish's user avatar
2 votes

Flash loan basics

This tutorial shows you how to deploy a smart contract to receive and use a flashloan from Aave V3. Aave V3 flash loan with Hardhat This one is a step-by-step guide on how to develop and deploy the ...
Dave Dev Advocate Chainstack's user avatar
2 votes

Flash Loan Arbitrage Bot

in general, your app needs to have two parts: A program that finds arbitrage opportunities. A program that gets the flashloan and uses it to act on the arbitrage opportunity. This tutorial shows you ...
Dave Dev Advocate Chainstack's user avatar
2 votes
Accepted

Can a sandwich attack be designed using 1 flashloans and no outside capital? attacker tx, victim tx, attacker tx bundled with 1 flash loan?

Flashloans lifecycle is limited to a single transaction, and cannot be used in a sandwich attack.
Mikko Ohtamaa's user avatar
1 vote

BSC Flashloan getting Pancake:Locked

Looking at the tenderly trace the swap function in PancakePair is being called within another call to swap in the same PancakePair. If you look at the swap function definition function swap(uint ...
Ismael's user avatar
  • 30.3k
1 vote

How haven't flash loans completly destabilized the ethereum blockchain?

You are only partially correct. Flash loans need to be paid back within the same transaction. And transactions don't typically depend on each other - if one transaction in a block reverts, the next ...
Lauri Peltonen's user avatar
1 vote

Solidity Expected '(' but got identifier

You have unnecessary "," in your function parameters. Change to this function startArbitrage( address token0, address token1, uint amount0, uint amount1
Kenzo Agada's user avatar
  • 1,256
1 vote

How are UniSwap V2 flash swaps recorded

Yes, a flash swap will trigger the same events as a normal swap. The only difference is that in a flash swap, the contract that called the swap can perform some arbitrary code between the moment it ...
Undead8's user avatar
  • 3,630
1 vote
Accepted

Struct on delegatecall

Solution: Have to pass a tuple instead to abi.encodeWithSignature, according to the docs: https://docs.soliditylang.org/en/v0.8.6/abi-spec.html#mapping-solidity-to-abi-types So it would be: execute(...
dNyrM's user avatar
  • 948

Only top scored, non community-wiki answers of a minimum length are eligible