Last active
January 14, 2022 18:04
-
-
Save ColinPlatt/33d94d3c203c59ae6d7708d661bee816 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.10+commit.fc410830.js&optimize=false&runs=200&gist=
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.10; | |
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | |
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | |
interface IUniswapV2Router { | |
function swapExactTokensForTokensSupportingFeeOnTransferTokens( | |
uint amountIn, | |
uint amountOutMin, | |
address[] calldata path, | |
address to, | |
uint deadline | |
) external; | |
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) | |
external | |
payable | |
returns (uint[] memory amounts); | |
function swapExactTokensForETHSupportingFeeOnTransferTokens( | |
uint amountIn, | |
uint amountOutMin, | |
address[] calldata path, | |
address to, | |
uint deadline | |
) external; | |
function addLiquidity( | |
address tokenA, | |
address tokenB, | |
uint amountADesired, | |
uint amountBDesired, | |
uint amountAMin, | |
uint amountBMin, | |
address to, | |
uint deadline | |
) | |
external | |
returns ( | |
uint amountA, | |
uint amountB, | |
uint liquidity | |
); | |
} | |
contract ClownsWTF is ERC20 ("ClownsWTF", unicode"🤡") { | |
address private constant WTF = 0xb4353294112aefBa97ABF6a3488746fC6e430422; // mainnet 0xA68Dd8cB83097765263AdAD881Af6eeD479c4a33; | |
address private constant WETH = 0xc778417E063141139Fce010982780140Aa0cD5Ab; // mainnet 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 | |
address private constant UNISWAP_V2_ROUTER = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; | |
constructor(){ | |
_approve(address(this), UNISWAP_V2_ROUTER, type(uint256).max); | |
} | |
receive() external payable{} | |
// !by doing this you understand you will not be able to retrieve your $WTF. You understand, don't you anon? | |
function mintAClown() public { | |
uint256 wtfBalance = IERC20(WTF).balanceOf(msg.sender); | |
IERC20(WTF).transferFrom(msg.sender, address(this), wtfBalance); | |
_mint(msg.sender, wtfBalance * 69); | |
} | |
// anyone holding 🤡 token can dump $WTF tokens, why not? | |
function dumpAWTF(uint256 amountWTF) external { | |
require(this.balanceOf(msg.sender) > 0, unicode"🤡"); | |
IERC20(WTF).approve(UNISWAP_V2_ROUTER, amountWTF); | |
address[] memory path; | |
path = new address[](2); | |
path[0] = WTF; | |
path[1] = WETH; | |
IUniswapV2Router(UNISWAP_V2_ROUTER).swapExactTokensForETHSupportingFeeOnTransferTokens( | |
amountWTF, | |
1, | |
path, | |
address(this), | |
block.timestamp | |
); | |
} | |
// sometimes you need to approve some more stuff | |
function approveAClown() external { | |
_approve(address(this), UNISWAP_V2_ROUTER, type(uint256).max); | |
} | |
// Add liquidity from the WETH and 🤡 here | |
function drownAClown(uint256 amountWETH, uint256 amountClown) external returns (uint256 _amountWETH, uint256 _amountClown, uint256 _litquidity) { | |
require(this.balanceOf(msg.sender) > 0, unicode"🤡"); | |
require(this.balanceOf(address(this)) >= amountClown && IERC20(WETH).balanceOf(address(this)) >= amountClown, unicode"🤡"); | |
IERC20(WETH).approve(UNISWAP_V2_ROUTER, amountWETH); | |
(_amountWETH, _amountClown, _litquidity) = IUniswapV2Router(UNISWAP_V2_ROUTER) | |
.addLiquidity( | |
WETH, | |
address(this), | |
amountWETH, | |
amountClown, | |
1, | |
1, | |
address(this), | |
block.timestamp | |
); | |
} | |
// anyone holding 🤡 can buy and burn some 🤡 tokens, why not? | |
function buyAClown(uint256 amountETH) external { | |
require(this.balanceOf(msg.sender) > 0, unicode"🤡"); | |
require(address(this).balance > amountETH, unicode"🤡"); | |
address[] memory path; | |
path = new address[](2); | |
path[0] = WETH; | |
path[1] = address(this); | |
IUniswapV2Router(UNISWAP_V2_ROUTER).swapExactETHForTokens{value: amountETH}( | |
1, | |
path, | |
address(0), | |
block.timestamp | |
); | |
} | |
// none of the above enough for you? mint your 🤡 and swap all this WTF here for more 🤡 ! | |
function OkSeriouslyThoughFuckTheseClowns() external { | |
require(IERC20(WTF).balanceOf(msg.sender) > 0, unicode"🤡"); | |
mintAClown(); | |
IERC20(WETH).approve(UNISWAP_V2_ROUTER, IERC20(WETH).balanceOf(address(this))); | |
IERC20(WTF).approve(UNISWAP_V2_ROUTER, IERC20(WTF).balanceOf(address(this))); | |
address[] memory path; | |
path = new address[](2); | |
path[0] = WTF; | |
path[1] = WETH; | |
path[2] = address(this); | |
IUniswapV2Router(UNISWAP_V2_ROUTER).swapExactTokensForTokensSupportingFeeOnTransferTokens( | |
IERC20(WTF).balanceOf(address(this)), | |
1, | |
path, | |
address(0), | |
block.timestamp | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment