flashloanusecases's People
Forkers
amadeobrands eoi-digital-hongkong-manila ggviana dappcenter pieter365 thaddeus19 digitalmusetech ebadiere niuran78 mul1sh julianaxxx kontersturm donalddominko rfkinline web3dopamine facumartinarguello baidis blockdevsasia selfbanking gusonaj billytaylor the-peso-g alexintosh neokanopheus mkblockchain art-0x seaify valaia jairtannus codenamejason vikramarun sajuuk31 cryptokcmo whoami2323 skysunlimited alvarobrg dours-d tobykreiselmaier d0minicw0ng fdoperezi w1r2p1 oneworldcoder samanoff hippermoloo cryptopossum ajsihota richizo massam78 0xhema mahdisama777 crypto-dodiks fliks9999 wenhsh albertocevallos chief-r0cka geetanshu-bharatpe irfanp056 pedrojok01 pedrobergamini antonga23 dgongor gearhart26 h2zzhou arbokdok colin4k nftxcoin andreluisalvarenga waiterzen oprekersejati smisomazibuko gacwr dr3wrightnow jacevezh1 ccamateur yanrising lucianomonteiroo hungdoansy zhang303 ahmedsakrr lgs vinayprolitus fakemonkgin bonnai2112 ymm135 ashspider phongle12300 ozazel joe-nanoflashloanusecases's Issues
makeArbitrage() call fails 1000000000000000000
Gas Estimation Failed
with this error:
Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
The execution failed due to an exception. Reverted
Warning while compiling contracts.
Hello,
When I go to compile contracts/sample/flashloan.sol I get the following warning. How do I solve this error? (I tried using pragma solidity >=0.5.0 <0.6.0;
, However it does not work)
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/utils/Address.sol:1:1: SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+commit.1d4f565a.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version pragma solidity ^0.5.5; ^---------------------^
Error and warning when compiling 'myfirstflashloan.sol'
Hi, when I try to compile the code I get the below...
https://github.com/mrdavey/ez-flashloan/blob/remix/contracts/aave/FlashLoanReceiverBase.sol:33:13: Warning: Return value of low-level calls not used.
_destination.call.value(_amount)("");
^----------------------------------^
and
https://github.com/mrdavey/ez-flashloan/blob/remix/contracts/aave/FlashLoanReceiverBase.sol:33:13: Warning: Return value of low-level calls not used.
_destination.call.value(_amount)("");
^----------------------------------^
Can you please give some advice how to proceed?
Thank
Failed transaction on Etherscan - applicable for Post byzantium blocks only
My steps:
Send 3000 DAI to the contract
Executed the contract
Actual result: When executed contract, Remix shows "Gas Estimation Error" and if proceed with and sumbit the transaction, on etherescan im getting Falied transaction and TX was reverted
NOTE: I believe this is not a fee issue, it is related to ethereum hard fork (byzantium blocks), but still I dont quite understand why its failing
can i get some assistance?
hello.. i am new at the academy of Ivan.. but so far i found everything very confusing.. maybe because i am not a programmer and i am not really interested in code and programming.. I AM A TRADER... for the last 10 years i was trading all types of instruments.. so of course i got interested when i saw Ivan speaking on his videos about arbitrage..
So the thing is that you prepared all this stuff of DEFI 201 and arbitrage, more in a "programmer way" and you forgot about traders... but in fact.. if you think about it.. arbitrage is a trading concept and not a programming concept.. so you should made the course dedicated to traders! because really.. i have already spent many hours trying to get this working and i just cannot..
For couple seconds i ask you to stand on the shoes of a trader who never in his life wrote a line of code and who doesnt understand most of the terms that you are mentioning in the course.. and you know? any trader who comes to your courses looking for the arbitrage.. when he starts to listen all those terms and to see the coding and that.. he will just run away.. same as i wanted just to close the browser and go to my charts to continue doing my work as usually
So please guys.. as Amadeo said in every of his videos.. if we have a request, we could submit it here.. then my request and i guess, talking from all traders interested on this... PLEASE, make a little document, slide, video or whatever.. specifying each steps, one by one, to do this of arbitrage.... but do it for traders.. not for programmers..
this means that for example.. is not necessary that you try to explain all the terms, functions and that.. would be easier if you just make a little document like...
Step 1. Get metamask wallet
Step 2. Go to Remix Ethereum
Step 3. copy and paste your wallet address in this exact line of code..
Step 4.....
in fact, all the videos that you made, you could resume it a little document with each step.. and then any TRADER could get into this without complications...
I hope you can do this and post it here or in the DEFI 201 files.. otherwise i really think that hardly any trader will be even interested on it
Where can I see the 1B Dai of the flashloan ?
Arbitrage contract error
Hi, I need a little help with arbitrage contract I keep getting this error when I try to call "makeArbitrage":
status | false Transaction mined but execution failed |
---|---|
transaction hash | 0x89483cebae54a2943700ef10ce531f9bc6e50f661b4304f57d328e0dd794421b |
from | 0xf783c77b3282E86DF0Eda02972281E0768F5df31 |
to | Arbitrage.makeArbitrage(uint256) 0x7a8f0c81bA8e6CcF06Ea95D108f4E9c3aD32Ef56 |
gas | 3000000 gas |
transaction cost | 321070 gas |
hash | 0x89483cebae54a2943700ef10ce531f9bc6e50f661b4304f57d328e0dd794421b |
input | 0x3dd...00000 |
decoded input | { "uint256 amount": { "_hex": "0x056bc75e2d63100000" } } |
decoded output | - |
logs | [] |
value | 0 wei |
Lost Contract
Today and thank you for a course with brilliant content.
I would like to know how I can access an already deployed contract. After deploying the contract and transferring funds to it run successfully. I then closed the remix window. How would I communicate with the contract again? I have copied the address that I sent the funds to from my metamask history and pasted that into the at address field in the run and deploy section of remix. But alas doesn't resolve the deployed contract.
In this case, it's not the end of the world since this is just a test net but if this was a real world I would have certainly wanted to be able to access my contract again.
Problem with arbitrage flash loan between 4 tokens
Hi Amadeo
I need your help with a question, because if I try to do more than one swap between several tokens, it won't allow me. I put the token addresses but it only makes the switch between Dai and Bat. I attach the code. Thank you
pragma solidity ^0.5.0;
import "https://github.com/mrdavey/ez-flashloan/blob/remix/contracts/aave/FlashLoanReceiverBase.sol";
import "https://github.com/mrdavey/ez-flashloan/blob/remix/contracts/aave/ILendingPool.sol";
import "https://github.com/Robsonsjre/FlashloanUsecases/blob/master/contracts/interfaces/IUniswap.sol";
//1 DAI = 1000000000000000000 (18 decimals)
/*
-
Arbitrageur is a contract to simulate the usage of flashloans
-
to make profit out of a market inbalacement
-
For this example we deployed 2 Uniswap instances which we'll
-
call by ExchangeA and ExchangeB
-
The steps happens as following:
-
- Borrow DAI from Aave
-
- Buy BAT with DAI on ExchangeA
-
- Sell BAT for DAI on ExchangeB
-
- Buy MKR with DAI on ExchangeC
-
- Sell MKR for DAI on ExchangeD
-
- Buy SNX with DAI on ExchangeE
-
- Sell SNX for DAI on ExchangeF
-
- Repay Aave loan
-
- Keep the profits
*/
contract Arbitrageur is
FlashLoanReceiverBase(address(0x506B0B2CF20FAA8f38a4E2B524EE43e1f4458Cc5)){ //primer paso declarar las direcciones de los contratos del token y de los exchange
address public constant SNX_ADDRESS = 0x7FDb81B0b8a010dd4FFc57C3fecbf145BA8Bd947;
address public constant MKR_ADDRESS = 0x61e4CAE3DA7FD189e52a4879C7B8067D7C2Cc0FA;
address public constant DAI_ADDRESS = 0xFf795577d9AC8bD7D90Ee22b6C1703490b6512FD;
address public constant BAT_ADDRESS = 0x2d12186Fbb9f9a8C28B3FfdD4c42920f8539D738;
address public constant UNISWAP_FACTORY_A = 0xECc6C0542710a0EF07966D7d1B10fA38bbb86523;
address public constant UNISWAP_FACTORY_B = 0x54Ac34e5cE84C501165674782582ADce2FDdc8F4;
address public constant UNISWAP_FACTORY_C = 0xECc6C0542710a0EF07966D7d1B10fA38bbb86523;
address public constant UNISWAP_FACTORY_D = 0x54Ac34e5cE84C501165674782582ADce2FDdc8F4;
address public constant UNISWAP_FACTORY_E = 0x54Ac34e5cE84C501165674782582ADce2FDdc8F4;
address public constant UNISWAP_FACTORY_F = 0xECc6C0542710a0EF07966D7d1B10fA38bbb86523;ILendingPool public lendingPool;
IUniswapExchange public exchangeA;
IUniswapExchange public exchangeB;
IUniswapFactory public uniswapFactoryA;
IUniswapFactory public uniswapFactoryB;
IUniswapExchange public exchangeC;
IUniswapExchange public exchangeD;
IUniswapFactory public uniswapFactoryC;
IUniswapFactory public uniswapFactoryD;
IUniswapExchange public exchangeE;
IUniswapExchange public exchangeF;
IUniswapFactory public uniswapFactoryE;
IUniswapFactory public uniswapFactoryF;constructor() public {
// Instantiate Uniswap Factory A
uniswapFactoryA = IUniswapFactory(UNISWAP_FACTORY_A);
// get Exchange A Address
address exchangeA_address = uniswapFactoryA.getExchange(DAI_ADDRESS);
// Instantiate Exchange A
exchangeA = IUniswapExchange(exchangeA_address);//Instantiate Uniswap Factory B uniswapFactoryB = IUniswapFactory(UNISWAP_FACTORY_B); // get Exchange B Address address exchangeB_address = uniswapFactoryB.getExchange(BAT_ADDRESS); //Instantiate Exchange B exchangeB = IUniswapExchange(exchangeB_address); // Instantiate Uniswap Factory C uniswapFactoryC = IUniswapFactory(UNISWAP_FACTORY_C); // get Exchange C Address address exchangeC_address = uniswapFactoryC.getExchange(DAI_ADDRESS); // Instantiate Exchange C exchangeC = IUniswapExchange(exchangeC_address); //Instantiate Uniswap Factory D uniswapFactoryD = IUniswapFactory(UNISWAP_FACTORY_D); // get Exchange D Address address exchangeD_address = uniswapFactoryD.getExchange(MKR_ADDRESS); //Instantiate Exchange D exchangeD = IUniswapExchange(exchangeD_address); // Instantiate Uniswap Factory E uniswapFactoryE = IUniswapFactory(UNISWAP_FACTORY_E); // get Exchange E Address address exchangeE_address = uniswapFactoryE.getExchange(DAI_ADDRESS); // Instantiate Exchange E exchangeA = IUniswapExchange(exchangeE_address); //Instantiate Uniswap Factory F uniswapFactoryF = IUniswapFactory(UNISWAP_FACTORY_F); // get Exchange F Address address exchangeF_address = uniswapFactoryF.getExchange(SNX_ADDRESS); //Instantiate Exchange F exchangeF = IUniswapExchange(exchangeF_address); // get lendingPoolAddress address lendingPoolAddress = addressesProvider.getLendingPool(); //Instantiate Aaave Lending Pool B lendingPool = ILendingPool(lendingPoolAddress);
}
event loanProfit(uint256 revenue, uint256 totalDebt, uint256 dairevenue); //declaro el evento y las informacion que voy a enviar a traves de él
/*
-
Start the arbitrage
*/
function makeArbitrage(uint256 amount) public onlyOwner {
bytes memory data = "";ERC20 dai = ERC20(DAI_ADDRESS);
lendingPool.flashLoan(address(this), DAI_ADDRESS, amount, data);// Any left amount of DAI is considered profit
uint256 profit = dai.balanceOf(address(this));// Sending back the profits
require(
dai.transfer(msg.sender, profit),
"Could not transfer back the profit"
);
}
function executeOperation(
address _reserve,
uint256 _amount,
uint256 _fee,
bytes calldata _params
) external {
// If transactions are not mined until deadline the transaction is reverted
uint256 deadline = getDeadline();ERC20 dai = ERC20(DAI_ADDRESS); ERC20 bat = ERC20(BAT_ADDRESS); ERC20 mkr = ERC20(MKR_ADDRESS); ERC20 snx = ERC20(SNX_ADDRESS); // Buying BAT at Exchange A require( dai.approve(address(exchangeA), _amount), "Could not approve DAI sell" ); uint256 tokenBought = exchangeA.tokenToTokenSwapInput( _amount, 1, 1, deadline, BAT_ADDRESS ); require( bat.approve(address(exchangeB), tokenBought), "Could not approve DAI sell" ); // Selling BAT at Exchange B uint256 daiBought = exchangeB.tokenToTokenSwapInput( tokenBought, 1, 1, deadline, DAI_ADDRESS ); // Buying MKR at Exchange C require( dai.approve(address(exchangeC), daiBought), "Could not approve DAI sell" ); uint256 buymkr = exchangeC.tokenToTokenSwapInput( daiBought, 1, 1, deadline, MKR_ADDRESS ); require( mkr.approve(address(exchangeD), buymkr), "Could not approve DAI sell" ); // Selling MKR at Exchange D uint256 sellmkr = exchangeD.tokenToTokenSwapInput( buymkr, 1, 1, deadline, DAI_ADDRESS ); // Buying SNX at Exchange E require( dai.approve(address(exchangeE), sellmkr), "Could not approve DAI sell" ); uint256 buysnx = exchangeE.tokenToTokenSwapInput( sellmkr, 1, 1, deadline, SNX_ADDRESS ); require( snx.approve(address(exchangeF), buysnx), "Could not approve DAI sell" ); // Selling SNX at Exchange F uint256 dairevenue = exchangeF.tokenToTokenSwapInput( buysnx, 1, 1, deadline, DAI_ADDRESS ); // Repay loan uint256 totalDebt = _amount.add(_fee); uint256 revenue = dairevenue - totalDebt; require(dairevenue > totalDebt, "Did not profit"); transferFundsBackToPoolInternal(_reserve, totalDebt); //withdrawAll; emit loanProfit(revenue, totalDebt, dairevenue); //hago que el evento envie la informacion que necesitamos
}
function getDeadline() internal view returns (uint256) {
return now + 3000;
}function withdrawAll () public onlyOwner returns (uint){
ERC20 dai = ERC20(DAI_ADDRESS);uint256 gain = dai.balanceOf(address(this)); uint toTransfer = gain; gain =0; msg.sender.transfer(toTransfer); //si esta accion falla hace un revert de la operacion return toTransfer; }
- Keep the profits
}
BitCryptoHub
Problem deploying it to Mainnet
Hi, so i want to deploy my code using the mainnet.
I put in the right adresses. Now i understand I need to choose : "Web3 provider" right? (not the injected web3)
Im using a mac and how do I enable this code? geth --rpc --rpccorsdomain https://remix.ethereum.org
where do i type it in, basically How do I get this started correctly? :)
all the best!
Getting funds back to wallet
So, I completed the flashloan but how do I get back the earning back from the smart contract to my wallet?
Bag Gateway & No AAve Faucet
Hey,
- https://faucet.kovan.network/ gives Bad Gateway now. ive requested on glitter but still waiting. Can you please send me Kovan Test ETH to
0x53CD3F17F2723bA185e67989A73a5aAFb5fAca2f
- the aave things has been resolved. stil need the KETH please,
thank you
faucet.kovan.network - 502 Bad Gateway
I'm getting an error when trying to access KETH on faucet.kovan.network . Please advise on what to do here.
Using Main Net
Hi Guys,
Please help me get the correct address for these parts:
address public constant UNISWAP_FACTORY_A = 0xECc6C0542710a0EF07966D7d1B10fA38bbb86523;
address public constant UNISWAP_FACTORY_B = 0x54Ac34e5cE84C501165674782582ADce2FDdc8F4;
I already researched the part for FlashLoanReceiverBase, DAI_ADDRESS, & BAT_ADDRESS.
FlashLoanReceiverBase(address(0x506B0B2CF20FAA8f38a4E2B524EE43e1f4458Cc5))
// main net: 0x24a42fD28C976A61Df5D00D0599C34c4f90748c8
// test net - kovan: 0x506B0B2CF20FAA8f38a4E2B524EE43e1f4458Cc5
address public constant DAI_ADDRESS = 0xFf795577d9AC8bD7D90Ee22b6C1703490b6512FD;
// Main net DAI_ADDRESS = 0x6B175474E89094C44Da98b954EedeAC495271d0F
address public constant BAT_ADDRESS = 0x2d12186Fbb9f9a8C28B3FfdD4c42920f8539D738;
// Main net BAT_ADDRESS = 0x0D8775F648430679A709E98d2b0Cb6250d2887EF
How to do this in the mainnet ?
I understand that this applies to the Kovan network. Now how to build a flashloan in the MainNetwork using this code?
where is video?
Mainnetwork problem
Hey so...this pops up and I cannot deploy my contract...whats the matter?
What i did:
got 25$ worth of DAI in my metamask and 0.4 eth
1.copy + paste the code from git hub
2. added the right addresses...please check for me is :
UNISWAP 1 factory this? : 0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95
UNISWAP 2 factory this? : 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f
3. then added the token addresses
saved it deployed and this comes up... what to do and what does this mean?
Robson!
Robson, boa noite!
Tudo bem?
Muito legal a aula sobre o flashloan, queria dizer que, apesar de algumas dificuldades - não sou programador -, consegui executar a tarefa proposta. Fiquei muito contente.
O que você está fazendo atualmente em SP? Está trabalhando com DeFi?
Abraços,
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.