// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, 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 increaseAllowance(address spender, uint256 addedValue) external returns (bool);
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ReflectionToken is IERC20 {
string public name = "Reflection Token";
string public symbol = "RFT";
uint8 public decimals = 18;
uint256 private constant MAX = ~uint256(0);
uint256 private constant INITIAL_SUPPLY = 1_000_000_000 * 10**18; // 1 billion tokens
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint256 private _reflectionTotal;
mapping (address => uint256) private _reflectionBalance;
mapping (address => bool) private _isExcludedFromReflection;
uint256 public taxRate = 5; // 5% tax rate on each transaction
uint256 private _reflectionTaxRate = 5; // 5% reflection tax rate on each transaction
uint256 private constant _MAX_TAX_RATE = 100; // Maximum tax rate
constructor() {
_totalSupply = INITIAL_SUPPLY;
_balances[msg.sender] = _totalSupply;
_reflectionTotal = (MAX - (MAX % _totalSupply));
_reflectionBalance[msg.sender] = _reflectionTotal;
emit Transfer(address(0), msg.sender, _totalSupply);
}
function totalSupply() external view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) external view override returns (uint256) {
if (_isExcludedFromReflection[account]) {
return _balances[account];
}
return tokenFromReflection(_reflectionBalance[account]);
}
function transfer(address recipient, uint256 amount) external override returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) external override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][msg.sender];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, msg.sender, currentAllowance - amount);
return true;
}
function allowance(address owner, address spender) external view override returns (uint256) {
return _allowances[owner][spender];
}
Jun 26, 2023, 5:50 AM
just wrote on chatgpt
Jun 26, 2023, 5:50 AM
Think he is looking for something battle tested, that for sure works
Jun 26, 2023, 7:34 AM
salt will be public but impossible to verify without the original text from who hashed the message
Jun 26, 2023, 12:55 PM
think you mixed up the conversation tread 😁 answer was to a rfi token question and chatGTP
Jun 26, 2023, 1:09 PM
oh... yep :o
Jun 26, 2023, 1:34 PM