V2Tax
0x4f3cb9dc7116bc2168d851bfc11e655c7ce4a289
Verification
Verified
0.8.24+commit.e11b9ed9
Type
Contract
5,614 bytes
ABI entries
28
14 read · 9 write
License
none
Contract information
- Address
- 0x4f3cb9dc7116bc2168d851bfc11e655c7ce4a289
- Chain
- Robinhood Chain (4663)
- Compiler
- 0.8.24+commit.e11b9ed9
- Optimization
- Enabled
- Creator
- 0x555c4aB829…995f5b42D2
- Creation tx
- 0x0062e3af6c…273529ff36
Token
- Name
- d2rli
- Symbol
- 2Y7UD
- Decimals
- 18
- Holders
- 3
- Market
- View token page →
Read contract (14)
allowance(address, address) → uint256
balanceOf(address) → uint256
buyTax() → uint256
decimals() → uint8
name() → string
owner() → address
pair() → address
sellTax() → uint256
swapEnabled() → bool
symbol() → string
taxSwapThreshold() → uint256
taxWallet() → address
totalSupply() → uint256
tradingOpen() → bool
Events (3)
ApprovalOwnershipTransferredTransfer
ABI
[
{
"inputs": [
{
"internalType": "string",
"name": "n",
"type": "string"
},
{
"internalType": "string",
"name": "s",
"type": "string"
},
{
"internalType": "address",
"name": "taxWallet_",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "o",
"type": "address"
},
{
"internalType": "address",
"name": "s",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "s",
"type": "address"
},
{
"internalType": "uint256",
"name": "v",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "a",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "buyTax",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "decimals",
"outputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "a",
"type": "address"
},
{
"internalType": "bool",
"name": "e",
"type": "bool"
}
],
"name": "excludeFromFee",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "manualSwap",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "openTrading",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pair",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "sellTax",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "w",
"type": "address"
}
],
"name": "setTaxWallet",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "b",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "s",
"type": "uint256"
}
],
"name": "setTaxes",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "swapEnabled",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "taxSwapThreshold",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "taxWallet",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "tradingOpen",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "v",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "f",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "v",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
]Source code
// SPDX-License-Identifier: MIT
// Adapted from BALVI (verified mainnet 5/5 tax token) for the Robinhood L2 Uniswap V2.
pragma solidity 0.8.24;
abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } }
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address a) external view returns (uint256);
function transfer(address to, uint256 v) external returns (bool);
function allowance(address o, address s) external view returns (uint256);
function approve(address s, uint256 v) external returns (bool);
function transferFrom(address f, address t, uint256 v) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () { _owner = _msgSender(); emit OwnershipTransferred(address(0), _owner); }
function owner() public view returns (address) { return _owner; }
modifier onlyOwner() { require(_owner == _msgSender(), "!owner"); _; }
function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); }
}
interface IUniswapV2Factory { function createPair(address a, address b) external returns (address pair); }
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline) external payable returns (uint, uint, uint);
}
contract V2Tax is Context, IERC20, Ownable {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
address payable private _taxWallet;
uint256 public buyTax = 5;
uint256 public sellTax = 5;
uint8 private constant _decimals = 18;
uint256 private constant _tTotal = 1_000_000_000 * 10 ** _decimals;
string private _name; string private _symbol;
uint256 public taxSwapThreshold = _tTotal / 1000; // 0.1% — once the clog crosses this, the next sell drains ALL of it
IUniswapV2Router02 private router;
address private constant ROUTER_ADDRESS = 0x89e5DB8B5aA49aA85AC63f691524311AEB649eba;
address private constant DEAD = 0x000000000000000000000000000000000000dEaD;
address public pair;
bool public tradingOpen; bool private inSwap; bool public swapEnabled;
modifier lockTheSwap { inSwap = true; _; inSwap = false; }
constructor (string memory n, string memory s, address taxWallet_) {
_name = n; _symbol = s; _taxWallet = payable(taxWallet_);
router = IUniswapV2Router02(ROUTER_ADDRESS);
_balances[address(this)] = _tTotal; // all supply into the contract; openTrading() burns 65% then LPs the rest
_isExcludedFromFee[msg.sender] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public view returns (string memory) { return _name; }
function symbol() public view returns (string memory) { return _symbol; }
function decimals() public pure returns (uint8) { return _decimals; }
function totalSupply() public pure override returns (uint256) { return _tTotal; }
function balanceOf(address a) public view override returns (uint256) { return _balances[a]; }
function allowance(address o, address s) public view override returns (uint256) { return _allowances[o][s]; }
function approve(address s, uint256 v) public override returns (bool) { _approve(_msgSender(), s, v); return true; }
function transfer(address to, uint256 v) public override returns (bool) { _transfer(_msgSender(), to, v); return true; }
function transferFrom(address f, address to, uint256 v) public override returns (bool) {
_transfer(f, to, v);
uint256 a = _allowances[f][_msgSender()]; require(a >= v, "allowance");
if (a != type(uint256).max) _approve(f, _msgSender(), a - v);
return true;
}
function _approve(address o, address s, uint256 v) private { require(o != address(0) && s != address(0), "zero"); _allowances[o][s] = v; emit Approval(o, s, v); }
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0) && to != address(0), "zero");
require(amount > 0, "amount 0");
uint256 taxAmount = 0;
bool isBuy = (from == pair && to != address(router));
bool isSell = (to == pair && from != address(this));
if (isBuy && !_isExcludedFromFee[to]) taxAmount = amount * buyTax / 100;
if (isSell && !_isExcludedFromFee[from]) taxAmount = amount * sellTax / 100;
if (isSell) {
uint256 contractBal = _balances[address(this)];
if (!inSwap && swapEnabled && contractBal > taxSwapThreshold) {
swapTokensForEth(contractBal); // dump the ENTIRE clog -> ETH, no per-sell cap
uint256 ethBal = address(this).balance;
if (ethBal > 0) { (bool ok,) = _taxWallet.call{value: ethBal}(""); require(ok, "eth"); }
}
}
if (taxAmount > 0) { _balances[address(this)] += taxAmount; emit Transfer(from, address(this), taxAmount); }
_balances[from] -= amount;
_balances[to] += (amount - taxAmount);
emit Transfer(from, to, amount - taxAmount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this); path[1] = router.WETH();
_approve(address(this), address(router), tokenAmount);
router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
}
// One-shot launch: burns 65% to dead, creates the V2 pair, LPs the remaining 35% with the ETH you send, and turns tax on.
function openTrading() external payable onlyOwner {
require(!tradingOpen, "open");
uint256 burnAmount = _tTotal * 65 / 100; // 65% to dead, before the pool exists
_balances[address(this)] -= burnAmount;
_balances[DEAD] += burnAmount;
emit Transfer(address(this), DEAD, burnAmount);
_approve(address(this), address(router), _tTotal);
pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
router.addLiquidityETH{value: address(this).balance}(address(this), balanceOf(address(this)), 0, 0, owner(), block.timestamp);
swapEnabled = true; tradingOpen = true;
}
// Keeper drain: your 5-min bot (owner or tax wallet) calls this to force the whole clog -> ETH -> dev, independent of sell flow.
function manualSwap() external {
require(_msgSender() == owner() || _msgSender() == _taxWallet, "!auth");
uint256 bal = _balances[address(this)];
if (bal > 0) swapTokensForEth(bal);
uint256 ethBal = address(this).balance;
if (ethBal > 0) { (bool ok,) = _taxWallet.call{value: ethBal}(""); require(ok, "eth"); }
}
function excludeFromFee(address a, bool e) external onlyOwner { _isExcludedFromFee[a] = e; }
function setTaxes(uint256 b, uint256 s) external onlyOwner { require(b <= 20 && s <= 20, "cap"); buyTax = b; sellTax = s; }
function setTaxWallet(address w) external onlyOwner { _taxWallet = payable(w); _isExcludedFromFee[w] = true; }
function taxWallet() external view returns (address) { return _taxWallet; }
receive() external payable {}
}
Chain explorer3974msChain node82ms