web3arbitrage's People
web3arbitrage's Issues
suggition for more progitable
hi i learnt alot from ur repo finally ran after 1 one month got an idea but i cont implement in my research lot bots excuting 80% oppurtunity only .
i think this is possible and we can reduce failure transactions cause in one month my highest sucussfull transaction is $0.04 all remianing 2000 transactions are failure because of (Fail with error 'ArbitrageExecutor: Initial check failed!')
how to increase intial amount
hi thanks for ur greater response i have one final doubt how to increase intial amount is thare any chance
'r': Percent of the amount after fees (float)
hi how can change it when change transaction fail with 'uniswapv2 K'
hi still waiting for ur tips for speed up this bot
hi iam waiting for ur tips for speed up this bot from the past two month pls it is very usefull to me pls
hi wonderfull work
the best bot ever i seen everything fine but how can made it more fast any suggitions?
hi what is exact solidity compiler version for contracts
hi really greate work learn a lot from ur work thank and i have 2 doubts please help me
1: what is exact solidity version for contract deployment
- what is the status in logs.txt example below
STATUS
WMATIC : 0.000000000000000000
WETH : 0.000000000000000000
USDC : 0.000000000000000000
DAI : 0.000000000000000000
ETH : 17.807890175440267200
Time: 15-03-2022 at 21:48:58
about Web3Arbitrage
hi this is krishna from india iam your github follower and iam trying your web3arbitrage from the first i tried from own node also i cant generate profit more than $0.02 i just trying to make profit greater than transaction cost can pls help me cause iam very bad situation please please help me you can contract telegrame : @pamarthisaiwhatsapp : 917569592417and email : [email protected]
hi tried below line to reduce failure transactions but solidity errorDeclarationError: Undeclared identifier.
hi tried below line to reduce failure transactions but solidity errorDeclarationError: Undeclared identifier.
can u help me how to edit this code in excecutor solidity contract line 80
require(finalAmount >= initialAmount + minAmount, "ArbitrageExecutor: Initial check failed!");
or is it possible profit= grater than or less than
i replace minAmount instead of profit can u pls guide me how do this
@tudor199 hi did get any profit above 1 usd
@tudor199 hi did u get any profit above 1 usd
from whare getting prices?
from whare getting prices?
How does the profit calculation logic work?
I'm trying to implement the profit calculation to keep the transaction fee discounted from the profit ... how does the profit calculation work
can u pls help me with below error
hi i leant a lot from finally i wrote my own flash swap solidity contract code but when 1 transaction fail for from text transaction iam getiing uniswap V2 locked error i mentioned below my code can u pls help me what mistake i did
// SPDX-License-Identifier: Apache
pragma solidity ^0.8.0;
import "../interfaces/IUniswapV2Router02.sol";
import "../interfaces/IUniswapV2Pair.sol";
import "../interfaces/IUniswapV2Factory.sol";
import "../interfaces/IUniswapV2Callee.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
struct ArbData {
address[] tokenAddresses;
address[] factoryAddresses;
address[] routerAddresses;
uint256 amountTkn1ToBorrow;
uint8 buyDexIndex;
uint8 sellDexIndex;
bool[] orderReversions;
uint256 buyDexFee;
}
contract BotSmartContract is Ownable, IUniswapV2Callee {
IERC20[2] public tokens;
IUniswapV2Factory[2] public factories;
IUniswapV2Router02[2] public routers;
IUniswapV2Pair[2] public pairTkns;
// For debugging purposes: currently not in use
event LogBalancesAndDebts(
uint256 indexed contractBalToken0,
uint256 indexed ownerBalToken0,
uint256 indexed actualAmountTkn0ToReturn
);
function requestFlashLoanAndAct(ArbData memory _data) public {
/*** Main function of the contract.
- The bot is supposed to call this when it detects an
arbitrage opportunity
- It first encodes the _data structure since UniswapV2Pair
will send it back when calling uniswapV2Call.
- Then it updates the state variables of the contract.
- Then it requests the flashloan to the corresponding LP.
- The function ``continues'' with uniswapV2Call, which is
called by the LP.
*/
bytes memory params = abi.encode(_data);
updateCurrentContracts(_data);
swap(_data, params);
}
function updateCurrentContracts(ArbData memory _data) internal {
for (uint8 i = 0; i < 2; i++) {
tokens[i] = IERC20(_data.tokenAddresses[i]);
factories[i] = IUniswapV2Factory(_data.factoryAddresses[i]);
routers[i] = IUniswapV2Router02(_data.routerAddresses[0]);
pairTkns[i] = IUniswapV2Pair(
IUniswapV2Factory(_data.factoryAddresses[i]).getPair(
_data.tokenAddresses[0],
_data.tokenAddresses[1]
)
);
}
}
function swap(ArbData memory _data, bytes memory params) internal {
// The parameters of the flashloan change depending on wether the
// token0 and token1 in the LP match our naming convention or it
// is switched
_data.orderReversions[_data.buyDexIndex]
? actWithOrderReversed(
_data.amountTkn1ToBorrow,
_data.buyDexIndex,
params
)
: actWithExpectedOrder(
_data.amountTkn1ToBorrow,
_data.buyDexIndex,
params
);
}
function actWithExpectedOrder(
uint256 _amountTkn1ToBorrow,
uint256 _buyDexIndex,
bytes memory _params
) internal {
// Request flashloan
pairTkns[_buyDexIndex].swap(
0, // amount0Out
_amountTkn1ToBorrow, // amount1Out
address(this), // sender
_params
);
}
function actWithOrderReversed(
uint256 _amountTkn1ToBorrow,
uint256 _buyDexIndex,
bytes memory _params
) internal {
// Request flashloan
pairTkns[_buyDexIndex].swap(
_amountTkn1ToBorrow, // amount0Out
0, // amount1Out
address(this), // sender
_params
);
}
/** ----------------------------------------------------------------
The next functions are called by the LP once it has sent the requested funds.
*/
function pancakeCall(
// The name of the function called by the LP is not the same on every dex.
// Originally the name is uniswapV2Call, so we reroute other function names
// such as pancakeCall to uniswapV2Call
address _sender,
uint256 _amount0,
uint256 _amount1,
bytes calldata _data
) public {
uniswapV2Call(_sender, _amount0, _amount1, _data);
}
function uniswapV2Call(
address _sender,
uint256 _amount0,
uint256 _amount1,
bytes calldata _data
) public {
/** Function called by the LP pair once it has sent the requested funds to this contract
- First it decodes the encoded struct ArbData and it arranges the received funds to
match our naming conventions.
- Then it swaps tokens normally in the selling Dex.
- Then it computes the amount of token0 owned to the LP and sends such amount to the LP.
*/
ArbData memory data = abi.decode(_data, (ArbData));
(_amount0, _amount1) = arrangeAmounts(data, _amount0, _amount1);
// Avoid these checks for gas savings
// uniswapV2CallCheckPreRequisites(_sender, data);
normalSwap(_amount1, data);
uint256 actualAmountTkn0ToReturn = computeActualAmountTkn0ToReturn(
data.amountTkn1ToBorrow,
data
);
emit LogBalancesAndDebts(
tokens[0].balanceOf(address(this)),
tokens[0].balanceOf(address(msg.sender)),
actualAmountTkn0ToReturn
);
// Avoid these checks for gas savings
// uniswapV2CallCheckPostRequisites(actualAmountTkn0ToReturn);
returnFundsToPair(actualAmountTkn0ToReturn, data.buyDexIndex);
emit LogBalancesAndDebts(
tokens[0].balanceOf(address(this)),
tokens[0].balanceOf(address(msg.sender)),
actualAmountTkn0ToReturn
);
}
function normalSwap(uint256 _amountBorrowed, ArbData memory _data) public {
// Swap the received token1's by token0's on the selling Dex
tokens[1].approve(
address(routers[_data.sellDexIndex]),
_amountBorrowed
);
address[] memory path = new address[](2);
path[0] = _data.tokenAddresses[1];
path[1] = _data.tokenAddresses[0];
uint256[] memory amounts = routers[_data.sellDexIndex]
.swapExactTokensForTokens(
_amountBorrowed,
uint256(0),
path,
address(this),
block.timestamp
);
}
function computeActualAmountTkn0ToReturn(
uint256 _amountTkn1Borrwed,
ArbData memory _data
) internal view returns (uint256) {
(uint256 reserveTkn0, uint256 reserveTkn1) = getOrderedReserves(
pairTkns[_data.buyDexIndex],
_data.orderReversions[_data.buyDexIndex]
);
return
getAmountIn(
_amountTkn1Borrwed, //amountOut
reserveTkn0, // reserve0
reserveTkn1, // reserve1
_data.buyDexFee
);
}
// copied from UniswapV2Library
function getAmountIn(
uint256 amountOut,
uint256 reserve0,
uint256 reserve1,
/// @notice Explain to an end user what this does
/// @dev Explain to a developer any extra details
/// @param Documents a parameter just like in doxygen (must be followed by parameter name),
uint256 fee
) internal pure returns (uint256 amountIn) {
require(amountOut > 0, "UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT");
require(
reserve0 > 0 && reserve1 > 0,
"UniswapV2Library: INSUFFICIENT_LIQUIDITY"
);
uint256 numerator = reserve0 * amountOut * 1000;
uint256 denominator = (reserve1 - amountOut) * fee;
amountIn = (numerator / denominator) + 1;
}
function returnFundsToPair(
uint256 expectedAmountTkn0ToReturn,
uint8 _buyDexIndex
) internal {
tokens[0].transfer(
address(pairTkns[_buyDexIndex]),
expectedAmountTkn0ToReturn + 1
);
}
function sendAllFundsToOwner() public onlyOwner {
tokens[0].transfer(msg.sender, tokens[0].balanceOf(address(this)));
}
function getOrderedReserves(IUniswapV2Pair _pair, bool _orderReversed)
internal
view
returns (uint256, uint256)
{
// The method getReserves() from UniswapPairs need not return the desired order of reserves
(uint256 reserveTkn0, uint256 reserveTkn1, ) = _pair.getReserves();
return
_orderReversed
? (reserveTkn1, reserveTkn0)
: (reserveTkn0, reserveTkn1);
}
function arrangeAmounts(
ArbData memory _data,
uint256 _amount0,
uint256 _amount1
) internal pure returns (uint256, uint256) {
// Helper to match the correct naming of token0 and token1 in the LP
bool reversedOrder = _data.orderReversions[_data.buyDexIndex];
return reversedOrder ? (_amount1, _amount0) : (_amount0, _amount1);
}
function uniswapV2CallCheckPostRequisites(uint256 actualAmountTkn0ToReturn)
public
view
{
// Currently not in use: checks that we have enough token0's to return to the
// LP pair at the end of the UniswapV2Call function.
require(
tokens[0].balanceOf(address(this)) > actualAmountTkn0ToReturn,
"Not enough token0s to return"
);
}
}
can u suggest me is it possible to convert flashswap to flash loan
can u suggest me is it possible to convert flashswap to flash loan
Fail with error 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT' and Fail with error 'UniswapV2: TRANSFER_FAILED'
hi i hot errors
Fail with error 'UniswapV2: TRANSFER_FAILED'
UniswapV2: INSUFFICIENT_INPUT_AMOUNT
why i got fail transaction with above errors is thare any solutions
hi is thare any chance to increase nonce?
hi is thare any chance to increase nonce?
because lot of transaction faild due to low nonce is it possible to increase error example below
ARBITRAGE_FOUND at 16-03-2022 at 11:16:28: USDT/WETH on QuickSwap -> SushiSwap
Amounts: 3.1642182822149536 -> 3.18070036805238
Profit: 0.016482085837426688 WETH
EXCEPTION in Worker: {'code': -32000, 'message': 'nonce too low'}!
Traceback (most recent call last):
File "C:\Users\vkart\Desktop\bot\alchemy\alchemy\manager\worker.py", line 57, in start
self.web3.eth.sendRawTransaction(signedTransaction.rawTransaction)
File "C:\Users\vkart\AppData\Local\Programs\Python\Python39\lib\site-packages\web3\eth.py", line 788, in send_raw_transaction
return self._send_raw_transaction(transaction)
File "C:\Users\vkart\AppData\Local\Programs\Python\Python39\lib\site-packages\web3\module.py", line 57, in caller
result = w3.manager.request_blocking(method_str,
File "C:\Users\vkart\AppData\Local\Programs\Python\Python39\lib\site-packages\web3\manager.py", line 198, in request_blocking
return self.formatted_response(response,
File "C:\Users\vkart\AppData\Local\Programs\Python\Python39\lib\site-packages\web3\manager.py", line 171, in formatted_response
raise ValueError(response["error"])
ValueError: {'code': -32000, 'message': 'nonce too low'}
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.