// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)pragmasolidity ^0.8.1;/**
* @dev Collection of functions related to the address type
*/libraryAddress{
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/functionisContract(address account) internalviewreturns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0// for contracts in construction, since the code is only stored at the end// of the constructor execution.return account.code.length>0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/functionsendValue(addresspayable 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");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/functionfunctionCall(address target, bytesmemory data) internalreturns (bytesmemory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/functionfunctionCall(address target,
bytesmemory data,
stringmemory errorMessage
) internalreturns (bytesmemory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/functionfunctionCallWithValue(address target,
bytesmemory data,
uint256 value
) internalreturns (bytesmemory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/functionfunctionCallWithValue(address target,
bytesmemory data,
uint256 value,
stringmemory errorMessage
) internalreturns (bytesmemory) {
require(address(this).balance>= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytesmemory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/functionfunctionStaticCall(address target, bytesmemory data) internalviewreturns (bytesmemory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/functionfunctionStaticCall(address target,
bytesmemory data,
stringmemory errorMessage
) internalviewreturns (bytesmemory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytesmemory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/functionfunctionDelegateCall(address target, bytesmemory data) internalreturns (bytesmemory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/functionfunctionDelegateCall(address target,
bytesmemory data,
stringmemory errorMessage
) internalreturns (bytesmemory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytesmemory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/functionverifyCallResult(bool success,
bytesmemory returndata,
stringmemory errorMessage
) internalpurereturns (bytesmemory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if presentif (returndata.length>0) {
// The easiest way to bubble the revert reason is using memory via assemblyassembly {
let returndata_size :=mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Contract Source Code
File 2 of 8: Context.sol
// SPDX-License-Identifier: MIT// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)pragmasolidity ^0.8.0;/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/abstractcontractContext{
function_msgSender() internalviewvirtualreturns (address) {
returnmsg.sender;
}
function_msgData() internalviewvirtualreturns (bytescalldata) {
returnmsg.data;
}
}
Contract Source Code
File 3 of 8: FXISportsToken.sol
//SPDX-License-Identifier: Nonepragmasolidity ^0.8.19;import"@openzeppelin/contracts/access/Ownable.sol";
import"@openzeppelin/contracts/utils/Address.sol";
import"./interfaces/IUniswapV2Factory.sol";
import"./interfaces/IUniswapV2Router02.sol";
import"./interfaces/IFXISportsToken.sol";
/// @title FXI Sports Token/// @title https://fx1.io//// @title https://t.me/fx1_sports_portal/// @author https://PROOFplatform.io/// @author https://5thWeb.iocontractFXISportsTokenisOwnable, IFXISportsToken{
/// @notice Maps an address to its token balancemapping(address=>uint256) private _balances;
/// @notice Maps addresses to allowances granted by token holdersmapping(address=>mapping(address=>uint256)) private _allowances;
/// @notice Maps addresses to indicate whether they are excluded from transaction feesmapping(address=>bool) public excludedFromFees;
/// @notice Maps addresses to indicate whether they are excluded from maximum wallet balance limitsmapping(address=>bool) public excludedFromMaxWallet;
/// @notice Maps addresses to indicate whether they are whitelistedmapping(address=>bool) public whitelists;
/// @notice Total supply of the FX1 Sports Tokenuint256private _totalSupply =300_000_000*10** _decimals;
/// @notice Timestamp of the token contract launchuint256public launchTime;
/// @notice Period during which addresses can be added to the whitelistuint256public whitelistPeriod;
/// @notice Minimum amount of tokens required to trigger an automatic swap for liquidityuint256public swapThreshold;
/// @notice Maximum amount of tokens that a wallet can holduint256public maxWalletAmount;
/// @notice Accumulated amount of tokens reserved for liquidityuint256private accLiquidityAmount;
/// @notice Accumulated amount of tokens reserved for marketing purposesuint256private accMarketingAmount;
/// @notice The cumulative fee rate applied to buy transactionsuint256public totalBuyFeeRate;
/// @notice The cumulative fee rate applied to sale transactionsuint256public totalSellFeeRate;
/// @notice Address for receiving marketing-related tax paymentsaddresspublic marketingTaxRecv;
/// @notice Address of the generated token pairaddresspublic pair;
/// @notice Address representing a dead walletaddressconstant DEAD =0x000000000000000000000000000000000000dEaD;
/// @notice Variable indicates whether a liquidity swap is in progressboolprivate inSwapLiquidity;
/// @notice Name of the FX1 Sports Tokenstringprivate _name ="FXI Sports";
/// @notice Symbol of the FX1 Sports Tokenstringprivate _symbol ="FXI";
/// @notice Fixed-point multiplier used for calculationsuint256publicimmutable FIXED_POINT =1000;
/// @notice The maximum allowable fee rateuint16publicconstant MAX_FEE =100;
/// @notice Number of decimal places for token valuesuint8privateconstant _decimals =18;
/// @notice Router for interacting with the Uniswap decentralized exchange
IUniswapV2Router02 public dexRouter;
/// @notice Fee rates for buying transactions
FeeRate public buyfeeRate;
/// @notice Fee rates for selling transactions
FeeRate public sellfeeRate;
/// @notice Constructs the FX1SportsToken contract/// @param _param A struct containing various parameters required for the token's configurationconstructor(
FeeRate memory _buyfeeRate,
FeeRate memory _sellfeeRate,
Param memory _param
) checkFeeRates(_buyfeeRate) checkFeeRates(_sellfeeRate) {
require(
_param.marketingTaxRecv !=address(0),
"Invalid MarketingTaxRecv address"
);
require(_param.dexRouter !=address(0), "Invalid dexRouter adddress");
require(_param.whitelistPeriod >0, "Invalid whitelistPeriod");
address sender =msg.sender;
marketingTaxRecv = _param.marketingTaxRecv;
dexRouter = IUniswapV2Router02(_param.dexRouter);
whitelistPeriod = _param.whitelistPeriod;
buyfeeRate.liquidityFeeRate = _buyfeeRate.liquidityFeeRate;
buyfeeRate.marketingFeeRate = _buyfeeRate.marketingFeeRate;
totalBuyFeeRate =
_buyfeeRate.liquidityFeeRate +
_buyfeeRate.marketingFeeRate;
sellfeeRate.liquidityFeeRate = _sellfeeRate.liquidityFeeRate;
sellfeeRate.marketingFeeRate = _sellfeeRate.marketingFeeRate;
totalSellFeeRate =
_sellfeeRate.liquidityFeeRate +
_sellfeeRate.marketingFeeRate;
excludedFromFees[sender] =true;
excludedFromMaxWallet[sender] =true;
excludedFromMaxWallet[address(this)] =true;
excludedFromMaxWallet[marketingTaxRecv] =true;
whitelists[sender] =true;
whitelists[address(this)] =true;
_balances[sender] += _totalSupply;
emit Transfer(address(0), sender, _totalSupply);
swapThreshold = _totalSupply /10000; // 0.01%
}
receive() externalpayable{}
/**
* @notice A modifier to check and enforce the maximum fee rates for marketing and liquidity
* @param _fees The structure containing marketing and liquidity fee rates
*/modifiercheckFeeRates(FeeRate memory _fees) {
require(
_fees.marketingFeeRate + _fees.liquidityFeeRate <= MAX_FEE,
"Max Rate exceeded, please lower value"
);
_;
}
/// ================================ Functions for ERC20 token ================================ ///functionname() externalviewreturns (stringmemory) {
return _name;
}
functionsymbol() externalviewreturns (stringmemory) {
return _symbol;
}
functiondecimals() externalpurereturns (uint8) {
return _decimals;
}
functiontotalSupply() externalviewreturns (uint256) {
return _totalSupply;
}
functionbalanceOf(address account) publicviewreturns (uint256) {
return _balances[account];
}
functiontransfer(address _recipient,
uint256 _amount
) externaloverridereturns (bool) {
_transfer(msg.sender, _recipient, _amount);
returntrue;
}
functionallowance(address _owner,
address _spender
) externalviewoverridereturns (uint256) {
return _allowances[_owner][_spender];
}
functionapprove(address _spender,
uint256 _amount
) externaloverridereturns (bool) {
_approve(msg.sender, _spender, _amount);
returntrue;
}
functiontransferFrom(address _sender,
address _recipient,
uint256 _amount
) externaloverridereturns (bool) {
uint256 currentAllowance = _allowances[_sender][msg.sender];
require(currentAllowance >= _amount, "Transfer > allowance");
_approve(_sender, msg.sender, currentAllowance - _amount);
_transfer(_sender, _recipient, _amount);
returntrue;
}
/// ================================ External functions ================================ ////**
* @notice Updates the address of the Uniswap router
* @param _newRouter The new address of the Uniswap router
*/functionupdateDexRouter(address _newRouter) externalonlyOwner{
require(Address.isContract(_newRouter), "Address is not a contract");
dexRouter = IUniswapV2Router02(_newRouter);
}
/**
* @notice External function update the Uniswap pair address and adjust exemption settings
* @param _pair The new Uniswap pair address
*/functionupdatePair(address _pair) externalonlyOwner{
require(_pair !=address(0), "Invalid pair address");
if (pair !=address(0)) {
excludedFromMaxWallet[pair] =false;
whitelists[pair] =false;
}
pair = _pair;
excludedFromMaxWallet[_pair] =true;
whitelists[_pair] =true;
}
/**
* @notice External function update the whitelist period
* @param _newWhiteListPeriod The new duration of the whitelist period in seconds
*/functionsetWhiteListPeriod(uint256 _newWhiteListPeriod
) externalonlyOwner{
require(_newWhiteListPeriod >0, "Invalid whitelistPeriod");
whitelistPeriod = _newWhiteListPeriod;
}
/**
* @notice External function for allows the contract owner to send FX1SportsToken amounts of tokens to multiple recipients
* @param _recipients An array of recipient addresses to send tokens to
* @param _amounts An array of corresponding token amounts to be sent to each recipient
*/functionmultiSender(address[] memory _recipients,
uint256[] memory _amounts
) externalonlyOwner{
require(_recipients.length== _amounts.length, "Invalid arrays length");
uint256 totalAmountToSend =0;
for (uint256 i =0; i < _recipients.length; ) {
require(_recipients[i] !=address(0), "Invalid recipient address");
totalAmountToSend += _amounts[i];
unchecked {
i++;
}
}
require(
_balances[msg.sender] >= totalAmountToSend,
"Not enough balance to send"
);
for (uint256 i =0; i < _recipients.length; ) {
_transfer(msg.sender, _recipients[i], _amounts[i]);
unchecked {
i++;
}
}
}
/**
* @notice External function allows the contract owner to set the launch time of the token
*/functionsetLaunchBegin() externaloverrideonlyOwner{
require(launchTime ==0, "Already launched");
launchTime =block.timestamp;
}
/**
* @notice External function allows the contract owner to add or remove multiple addresses from the whitelists
* @param _accounts An array of addresses to be added or removed from the whitelists
* @param _add A boolean indicating whether to add or remove the addresses from the whitelists
*/functionupdateWhitelists(address[] memory _accounts,
bool _add
) externaloverrideonlyOwner{
uint256 length = _accounts.length;
require(length >0, "Invalid accounts length");
for (uint256 i =0; i < length; ) {
whitelists[_accounts[i]] = _add;
unchecked {
i++;
}
}
}
/**
* @notice External function allows the contract owner to exclude or include multiple addresses from the list of addresses exempted from maximum wallet balance limits
* @param _accounts An array of addresses to be excluded or included in the list
* @param _add A boolean indicating whether to exclude or include the addresses in the list
*/functionexcludeWalletsFromMaxWallets(address[] memory _accounts,
bool _add
) externaloverrideonlyOwner{
uint256 length = _accounts.length;
require(length >0, "Invalid length array");
for (uint256 i =0; i < length; ) {
excludedFromMaxWallet[_accounts[i]] = _add;
unchecked {
i++;
}
}
}
/**
* @notice External function allows the contract owner to exclude or include multiple addresses from the list of addresses exempted from transaction fees
* @param _accounts An array of addresses to be excluded or included in the list
* @param _add A boolean indicating whether to exclude or include the addresses in the list
*/functionexcludeWalletsFromFees(address[] memory _accounts,
bool _add
) externaloverrideonlyOwner{
uint256 length = _accounts.length;
require(length >0, "Invalid length array");
for (uint256 i =0; i < length; ) {
excludedFromFees[_accounts[i]] = _add;
unchecked {
i++;
}
}
}
/**
* @notice External function allows the contract owner to set a new maximum wallet balance limit
* @param newLimit The new maximum transfer amount limit to be set
*/functionsetMaxWalletAmount(uint256 newLimit) externaloverrideonlyOwner{
require(newLimit >= (_totalSupply *10) /1000, "Min 1% limit");
maxWalletAmount = newLimit;
}
/**
* @notice External function allows the contract owner to set a new address for the marketing tax wallet
* @param _marketingTaxWallet The new address to be set as the marketing tax wallet
*/functionsetMarketingTaxWallet(address _marketingTaxWallet
) externaloverrideonlyOwner{
require(
_marketingTaxWallet !=address(0),
"Invalid marketingTaxWallet address"
);
marketingTaxRecv = _marketingTaxWallet;
}
/**
* @notice This function allows the contract owner to update the fee rates for buy operations
* @param _marketingBuyFeeRate New marketing fee rate for buy operations
* @param _liquidityBuyFeeRate New liquidity fee rate for buy operations
*/functionupdateBuyFeeRate(uint16 _marketingBuyFeeRate,
uint16 _liquidityBuyFeeRate
) externaloverrideonlyOwner{
require(
_marketingBuyFeeRate + _liquidityBuyFeeRate <= MAX_FEE,
"Max Rate exceeded, please lower value"
);
buyfeeRate.marketingFeeRate = _marketingBuyFeeRate;
buyfeeRate.liquidityFeeRate = _liquidityBuyFeeRate;
totalBuyFeeRate = _marketingBuyFeeRate + _liquidityBuyFeeRate;
}
/**
* @notice This function allows the contract owner to update the fee rates for sell operations
* @param _marketingSellFeeRate New marketing fee rate for sell operations
* @param _liquiditySellFeeRate New liquidity fee rate for sell operations
*/functionupdateSellFeeRate(uint16 _marketingSellFeeRate,
uint16 _liquiditySellFeeRate
) externaloverrideonlyOwner{
require(
_marketingSellFeeRate + _liquiditySellFeeRate <= MAX_FEE,
"Max Rate exceeded, please lower value"
);
sellfeeRate.marketingFeeRate = _marketingSellFeeRate;
sellfeeRate.liquidityFeeRate = _liquiditySellFeeRate;
totalSellFeeRate = _marketingSellFeeRate + _liquiditySellFeeRate;
}
/**
* @notice External function allows the contract owner to set a new swap threshold value
* @param _swapThreshold The new swap threshold value to be set
*/functionsetSwapThreshold(uint256 _swapThreshold
) externaloverrideonlyOwner{
require(_swapThreshold >0, "Invalid swapThreshold");
swapThreshold = _swapThreshold;
}
/// ================================ Internal functions ================================ ////**
* @notice Internal function to perform token transfer between two addresses, subject to various checks and conditions
* @param _sender The address from which tokens are being transferred
* @param _recipient The address to which tokens are being transferred
* @param _amount The amount of tokens being transferred
*/function_transfer(address _sender,
address _recipient,
uint256 _amount
) internal{
require(_sender !=address(0), "Transfer from zero address");
require(_recipient !=address(0), "Transfer to zero address");
require(_amount >0, "Zero amount");
require(_balances[_sender] >= _amount, "Not enough amount to transfer");
require(_sender == owner() || launchTime !=0, "Not launched yet");
if (block.timestamp< launchTime + whitelistPeriod) {
require(whitelists[_recipient], "only whitelist");
}
if (maxWalletAmount >0) {
require(
excludedFromMaxWallet[_recipient] ||
_balances[_recipient] + _amount <= maxWalletAmount,
"Exceeds to maxWalletAmount"
);
}
if (
inSwapLiquidity ||
excludedFromFees[_recipient] ||
excludedFromFees[_sender]
) {
_basicTransfer(_sender, _recipient, _amount);
emit Transfer(_sender, _recipient, _amount);
return;
}
if (pair !=address(0)) {
if (_sender == pair) {
// buy
_taxonBuyTransfer(_sender, _recipient, _amount);
} else {
_swapBack();
if (_recipient == pair) {
// sell
_taxonSellTransfer(_sender, _recipient, _amount);
} else {
_basicTransfer(_sender, _recipient, _amount);
}
}
}
emit Transfer(_sender, _recipient, _amount);
}
/**
* @notice Internal function to swap excess tokens in the contract back to ETH and manage liquidity and fees
*/function_swapBack() internal{
uint256 accTotalAmount = accLiquidityAmount + accMarketingAmount;
if (accTotalAmount <= swapThreshold) {
return;
}
inSwapLiquidity =true;
uint256 swapAmountForLiquidity = accLiquidityAmount /2;
uint256 swapAmount = accTotalAmount - swapAmountForLiquidity;
address[] memory path =newaddress[](2);
path[0] =address(this);
path[1] = dexRouter.WETH();
_approve(address(this), address(dexRouter), swapAmount);
dexRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(
swapAmount,
0,
path,
address(this),
block.timestamp+30minutes
);
uint256 swappedETHAmount =address(this).balance;
require(swappedETHAmount >0, "Too small token for swapBack");
uint256 ethForLiquidity = (swappedETHAmount * swapAmountForLiquidity) /
swapAmount;
if (ethForLiquidity >0) {
uint256 amountForLiquidity = accLiquidityAmount -
swapAmountForLiquidity;
_approve(address(this), address(dexRouter), amountForLiquidity);
dexRouter.addLiquidityETH{value: ethForLiquidity}(
address(this),
amountForLiquidity,
0,
0,
0x000000000000000000000000000000000000dEaD,
block.timestamp+30minutes
);
swappedETHAmount -= ethForLiquidity;
}
_transferETH(marketingTaxRecv, swappedETHAmount);
accLiquidityAmount =0;
accMarketingAmount =0;
inSwapLiquidity =false;
}
/**
* @notice Internal function to handle transfers when tokens are being sold
* @param _sender The address of the sender (seller)
* @param _recipient The address of the recipient (buyer)
* @param _amount The amount of tokens being transferred
*/function_taxonSellTransfer(address _sender,
address _recipient,
uint256 _amount
) internal{
(
uint256 marketingFeeRate,
uint256 liquidityFeeRate
) = _getSellFeeRate();
uint256 marketingFeeAmount = (_amount * marketingFeeRate) / FIXED_POINT;
uint256 liquidityFeeAmount = (_amount * liquidityFeeRate) / FIXED_POINT;
uint256 recvAmount = _amount -
(marketingFeeAmount + liquidityFeeAmount);
_balances[_sender] -= _amount;
_balances[_recipient] += recvAmount;
_balances[address(this)] += (marketingFeeAmount + liquidityFeeAmount);
accLiquidityAmount += liquidityFeeAmount;
accMarketingAmount += marketingFeeAmount;
}
/**
* @notice Internal function to handle transfers when tokens are being bought
* @param _sender The address of the sender (buyer)
* @param _recipient The address of the recipient (seller)
* @param _amount The amount of tokens being transferred
*/function_taxonBuyTransfer(address _sender,
address _recipient,
uint256 _amount
) internal{
(uint256 marketingFeeRate, uint256 liquidityFeeRate) = _getBuyFeeRate();
uint256 marketingFeeAmount = (_amount * marketingFeeRate) / FIXED_POINT;
uint256 liquidityFeeAmount = (_amount * liquidityFeeRate) / FIXED_POINT;
uint256 recvAmount = _amount -
(marketingFeeAmount + liquidityFeeAmount);
_balances[_sender] -= _amount;
_balances[_recipient] += recvAmount;
_balances[address(this)] += (marketingFeeAmount + liquidityFeeAmount);
accLiquidityAmount += liquidityFeeAmount;
accMarketingAmount += marketingFeeAmount;
}
/**
* @notice Internal function to perform a basic transfer of tokens between two addresses
* @param _sender The address of the sender
* @param _recipient The address of the recipient
* @param _amount The amount of tokens to transfer
*/function_basicTransfer(address _sender,
address _recipient,
uint256 _amount
) internal{
_balances[_sender] -= _amount;
_balances[_recipient] += _amount;
}
/**
* @notice Internal function to get the fee rates for selling tokens based on the current time period after launch
*/function_getSellFeeRate()
internalviewreturns (uint256 _marketingFeeRate, uint256 _liquidityFeeRate)
{
return (sellfeeRate.marketingFeeRate, sellfeeRate.liquidityFeeRate);
}
/**
* @notice Internal function to get the fee rates for buying tokens based on the current time period after launch
*/function_getBuyFeeRate()
internalviewreturns (uint256 _marketingFeeRate, uint256 _liquidityFeeRate)
{
return (buyfeeRate.marketingFeeRate, buyfeeRate.liquidityFeeRate);
}
/**
* @notice Internal function to transfer ETH to a specified recipient
* @param _recipient The address of the recipient to which ETH should be transferred
* @param _amount The amount of ETH to transfer
*/function_transferETH(address _recipient, uint256 _amount) internal{
if (_amount ==0) return;
(bool sent, ) = _recipient.call{value: _amount}("");
require(sent, "Sending ETH failed");
}
/// ================================ Private functions ================================ ////**
* @notice Private function to set the allowance amount that `_spender` can spend on behalf of `_owner`
* @param _owner The address that approves spending
* @param _spender The address that is allowed to spend
* @param _amount The amount of tokens that `_spender` is allowed to spend
*/function_approve(address _owner,
address _spender,
uint256 _amount
) private{
require(_owner !=address(0), "Approve from zero");
require(_spender !=address(0), "Approve to zero");
_allowances[_owner][_spender] = _amount;
emit Approval(_owner, _spender, _amount);
}
}
Contract Source Code
File 4 of 8: IERC20.sol
// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)pragmasolidity ^0.8.0;/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/interfaceIERC20{
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/eventTransfer(addressindexedfrom, addressindexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/eventApproval(addressindexed owner, addressindexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/functiontotalSupply() externalviewreturns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/functionbalanceOf(address account) externalviewreturns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/functiontransfer(address to, uint256 amount) externalreturns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/functionallowance(address owner, address spender) externalviewreturns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/functionapprove(address spender, uint256 amount) externalreturns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/functiontransferFrom(addressfrom,
address to,
uint256 amount
) externalreturns (bool);
}
Contract Source Code
File 5 of 8: IFXISportsToken.sol
//SPDX-License-Identifier: Nonepragmasolidity ^0.8.19;import"@openzeppelin/contracts/token/ERC20/IERC20.sol";
/// @title FXI Sports Token/// @title https://fx1.io//// @title https://t.me/fx1_sports_portal/// @author https://PROOFplatform.io/// @author https://5thWeb.iointerfaceIFXISportsTokenisIERC20{
structParam {
address marketingTaxRecv;
address dexRouter;
uint256 whitelistPeriod;
}
structFeeRate {
uint256 marketingFeeRate;
uint256 liquidityFeeRate;
}
/// @notice Locks trading until called. Cannont be called twice./// @dev Only owner can call this function.functionsetLaunchBegin() external;
/// @notice Add/Remove whitelists./// @dev Only owner can call this function./// @param _accounts The address of whitelists./// @param _add True/False = Add/RemovefunctionupdateWhitelists(address[] memory _accounts, bool _add) external;
/// @notice Add/Remove wallets to excludedMaxWallet./// @dev Only owner can call this function./// @param _accounts The address of accounts./// @param _add True/False = Add/RemovefunctionexcludeWalletsFromMaxWallets(address[] memory _accounts,
bool _add
) external;
/// @notice Add/Remove wallets to excludedFromFees./// @dev Only owner can call this function./// @param _accounts The address of accounts./// @param _add True/False = Add/RemovefunctionexcludeWalletsFromFees(address[] memory _accounts,
bool _add
) external;
/// @notice Set maxWalletAmount./// @dev Only owner can call this function./// @param _maxWalletAmount New maxWalletAmount.functionsetMaxWalletAmount(uint256 _maxWalletAmount) external;
/// @notice Set marketingTaxRecipient wallet address./// @dev Only owner can call this function./// @param _marketingTaxWallet The address of marketingTaxRecipient wallet.functionsetMarketingTaxWallet(address _marketingTaxWallet) external;
/// @notice UpdateBuyFeeRate./// @dev Only owner can call this function./// @dev Max Rate of 100(10%) 10 = 1%/// @param _marketingBuyFeeRate New MarketingBuyFeeRate./// @param _liquidityBuyFeeRate New LiquidityBuyFeeRate.functionupdateBuyFeeRate(uint16 _marketingBuyFeeRate,
uint16 _liquidityBuyFeeRate
) external;
/// @notice UpdateSellFeeRate./// @dev Only owner can call this function./// @dev Max Rate of 100(10%) 10 = 1%/// @param _marketingSellFeeRate New MarketingSellFeeRate./// @param _liquiditySellFeeRate New LiquiditySellFeeRate.functionupdateSellFeeRate(uint16 _marketingSellFeeRate,
uint16 _liquiditySellFeeRate
) external;
/// @notice Set swapThreshold./// @dev Only owner can call this function./// @param _swapThreshold New swapThreshold amount.functionsetSwapThreshold(uint256 _swapThreshold) external;
}
// SPDX-License-Identifier: MIT// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)pragmasolidity ^0.8.0;import"../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/abstractcontractOwnableisContext{
addressprivate _owner;
eventOwnershipTransferred(addressindexed previousOwner, addressindexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/functionowner() publicviewvirtualreturns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/modifieronlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/functionrenounceOwnership() publicvirtualonlyOwner{
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/functiontransferOwnership(address newOwner) publicvirtualonlyOwner{
require(newOwner !=address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/function_transferOwnership(address newOwner) internalvirtual{
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}