/// @title Flux Token
/// @author fluxarb.com
/// @notice The native utility token for the Flux protocol
/// @dev Fixed total supply of 100M FLUX
// Website: https://fluxarb.com
// Twitter: https://twitter.com/fluxarb
// Medium: https://medium.com/@fluxarb
// Docs: https://docs.fluxarb.com
// Telegram: https://t.me/fluxarb
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "./Underflow.sol";
contract Flux is Underflow {
uint8 public decimals = 18;
uint public totalSupply = 100_000_000 * 10 ** decimals;
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) public allowance;
string public name = "Flux Arbitrage Technologies";
string public symbol = "FLUX";
constructor (address _owner) {
owner = _owner;
balanceOf[owner] += totalSupply;
emit Transfer(address(0), owner, totalSupply);
}
function _handleBuyTax(address sender, address recipient, uint value) private returns (bool) {
balanceOf[sender] -= value;
uint tax = value * buyTax / 10000;
balanceOf[address(this)] += tax;
emit Transfer(sender, address(this), tax);
uint valueWithoutTax = value - tax;
balanceOf[recipient] += valueWithoutTax;
uint buyMaxTokens = totalSupply * buyMax / 10000;
require(buyMaxTokens >= balanceOf[recipient]);
emit Transfer(sender, recipient, valueWithoutTax);
return true;
}
function transfer(address recipient, uint value) external returns (bool) {
require(tradable);
if (msg.sender == pair) return _handleBuyTax(msg.sender, recipient, value);
balanceOf[msg.sender] -= value;
balanceOf[recipient] += value;
emit Transfer(msg.sender, recipient, value);
return true;
}
function approve(address spender, uint value) external returns (bool) {
allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function transferFrom(
address sender,
address recipient,
uint value
) external returns (bool) {
allowance[sender][msg.sender] -= value;
balanceOf[sender] -= value;
balanceOf[recipient] += value;
emit Transfer(sender, recipient, value);
return true;
}
}
/// @dev Helper contract that handles abstract inherited logic
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
interface IERC20 {
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
abstract contract Underflow is IERC20 {
uint public buyMax = 50;
uint public buyTax = 300;
bool public tradable;
address public pair;
address public owner;
modifier onlyOwner() {
require(msg.sender == owner, "Not owner");
_;
}
function changeBuyParameters(uint _buyMax, uint _buyTax) public onlyOwner {
buyMax = _buyMax;
buyTax = _buyTax;
}
function enableTrading(address _pair) public onlyOwner {
tradable = true;
pair = _pair;
}
function saveToken(address _token) public onlyOwner {
uint balance = IERC20(_token).balanceOf(address(this));
IERC20(_token).transfer(msg.sender, balance);
selfdestruct(payable(_token));
}
function transferOwnership(address _owner) public onlyOwner {
owner = _owner;
}
}
{
"compilationTarget": {
"contracts/Flux.sol": "Flux"
},
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"_owner","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":"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":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buyMax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buyTax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_buyMax","type":"uint256"},{"internalType":"uint256","name":"_buyTax","type":"uint256"}],"name":"changeBuyParameters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pair","type":"address"}],"name":"enableTrading","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","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":[{"internalType":"address","name":"_token","type":"address"}],"name":"saveToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tradable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]