Revolutionize Your Business with Xamer's Smart Audit Services
On-chain smart contract security monitoring
Audits
Onboarded Date
13/Dec/2022
Contracts
0x0df...14d78
Website
We talked about a project on linkedin.
Create new project Buildng product
Adding a new event with attachments
added a new member to velzon dashboard
These customers can rest assured their order has been placed.
They all have something to say beyond the words on the page. They can come across as casual or neutral, exotic or graphic.
2 days left notification to submit the monthly sales report. Reports Builder
User Erica245 submitted a ticket.
Team Leader & HR
Projects
Tasks
Full Stack Developer
Project Manager
UI/UX Designer
Team Leader & Web Developer
Backend Developer
Front-End Developer
Web Designer
Wed Developer
Showing 1 to 10 of 12 entries
All Findings
Acknowledge
Partially
Resolved
0x0dfcb45eae...14d78
Token Standard
Functions
Verified Contract
/** *Submitted for verification at BscScan.com on 2022-01-29*//** *Submitted for verification at BscScan.com on 2022-01-27*/// SPDX-License-Identifier: MITpragma solidity ^0.7.4;library SafeMathInt { int256 private constant MIN_INT256 = int256(1) << 255; int256 private constant MAX_INT256 = ~(int256(1) << 255); function mul(int256 a, int256 b) internal pure returns (int256) { int256 c = a * b; require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256)); require((b == 0) || (c / b == a)); return c; } function div(int256 a, int256 b) internal pure returns (int256) { require(b != -1 || a != MIN_INT256); return a / b; } function sub(int256 a, int256 b) internal pure returns (int256) { int256 c = a - b; require((b >= 0 && c <= a) || (b < 0 && c > a)); return c; } function add(int256 a, int256 b) internal pure returns (int256) { int256 c = a + b; require((b >= 0 && c >= a) || (b < 0 && c < a)); return c; } function abs(int256 a) internal pure returns (int256) { require(a != MIN_INT256); return a < 0 ? -a : a; }}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);}library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; }}interface InterfaceLP { function sync() external;}library Roles { struct Role { mapping (address => bool) bearer; } function add(Role storage role, address account) internal { require(!has(role, account), "Roles: account already has role"); role.bearer[account] = true; } function remove(Role storage role, address account) internal { require(has(role, account), "Roles: account does not have role"); role.bearer[account] = false; } function has(Role storage role, address account) internal view returns (bool) { require(account != address(0), "Roles: account is the zero address"); return role.bearer[account]; }}abstract contract ERC20Detailed is IERC20 { string private _name; string private _symbol; uint8 private _decimals; constructor( string memory _tokenName, string memory _tokenSymbol, uint8 _tokenDecimals ) { _name = _tokenName; _symbol = _tokenSymbol; _decimals = _tokenDecimals; } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view returns (uint8) { return _decimals; }}interface IDEXRouter { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns ( uint256 amountA, uint256 amountB, uint256 liquidity ); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external;}interface IDEXFactory { function createPair(address tokenA, address tokenB) external returns (address pair);}contract Ownable { address private _owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); constructor() { _owner = msg.sender; } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(msg.sender == _owner, "Not owner"); _; } function renounceOwnership() public onlyOwner { emit OwnershipRenounced(_owner); _owner = address(0); } function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } function _transferOwnership(address newOwner) internal { require(newOwner != address(0)); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }}contract LiberoToken is ERC20Detailed, Ownable { using SafeMath for uint256; using SafeMathInt for int256; bool public initialDistributionFinished = false; bool public swapEnabled = true; bool public autoRebase = false; bool public feesOnNormalTransfers = false; bool public isLiquidityInBnb = true; uint256 public rewardYield = 4208333; uint256 public rewardYieldDenominator = 10000000000; uint256 public maxSellTransactionAmount = 2500000 * 10 ** 18; uint256 public rebaseFrequency = 1800; uint256 public nextRebase = block.timestamp + 31536000; mapping(address => bool) _isFeeExempt; address[] public _markerPairs; mapping (address => bool) public automatedMarketMakerPairs; uint256 public constant MAX_FEE_RATE = 20; uint256 private constant MAX_REBASE_FREQUENCY = 1800; uint256 private constant DECIMALS = 18; uint256 private constant MAX_UINT256 = ~uint256(0); uint256 private constant INITIAL_FRAGMENTS_SUPPLY = 5 * 10**9 * 10**DECIMALS; uint256 private constant TOTAL_GONS = MAX_UINT256 - (MAX_UINT256 % INITIAL_FRAGMENTS_SUPPLY); uint256 private constant MAX_SUPPLY = ~uint128(0); address DEAD = 0x000000000000000000000000000000000000dEaD; address ZERO = 0x0000000000000000000000000000000000000000; address public liquidityReceiver = 0x5A50173A8c02464ba737B669fadAe2fdAd293157; address public treasuryReceiver = 0x9CCE932283183F637e4870a63bDf1e6C348DbB64; address public riskFreeValueReceiver = 0x94DC0b13E66ABa9450b3Cc44c2643BBb4C264BC7; address public busdToken = 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56; IDEXRouter public router; address public pair; uint256 public liquidityFee = 5; uint256 public treasuryFee = 3; uint256 public buyFeeRFV = 5; uint256 public sellFeeTreasuryAdded = 2; uint256 public sellFeeRFVAdded = 5; uint256 public totalBuyFee = liquidityFee.add(treasuryFee).add(buyFeeRFV); uint256 public totalSellFee = totalBuyFee.add(sellFeeTreasuryAdded).add(sellFeeRFVAdded); uint256 public feeDenominator = 100; uint256 targetLiquidity = 50; uint256 targetLiquidityDenominator = 100; bool inSwap; modifier swapping() { inSwap = true; _; inSwap = false; } modifier validRecipient(address to) { require(to != address(0x0)); _; } uint256 private _totalSupply; uint256 private _gonsPerFragment; uint256 private gonSwapThreshold = (TOTAL_GONS * 10) / 10000; mapping(address => uint256) private _gonBalances; mapping(address => mapping(address => uint256)) private _allowedFragments; constructor() ERC20Detailed("Libero Financial Freedom", "LIBERO", uint8(DECIMALS)) { router = IDEXRouter(0x10ED43C718714eb63d5aA57B78B54704E256024E); pair = IDEXFactory(router.factory()).createPair(address(this), router.WETH()); address pairBusd = IDEXFactory(router.factory()).createPair(address(this), busdToken); _allowedFragments[address(this)][address(router)] = uint256(-1); _allowedFragments[address(this)][pair] = uint256(-1); _allowedFragments[address(this)][address(this)] = uint256(-1); _allowedFragments[address(this)][pairBusd] = uint256(-1); setAutomatedMarketMakerPair(pair, true); setAutomatedMarketMakerPair(pairBusd, true); _totalSupply = INITIAL_FRAGMENTS_SUPPLY; _gonBalances[msg.sender] = TOTAL_GONS; _gonsPerFragment = TOTAL_GONS.div(_totalSupply); _isFeeExempt[treasuryReceiver] = true; _isFeeExempt[riskFreeValueReceiver] = true; _isFeeExempt[address(this)] = true; _isFeeExempt[msg.sender] = true; IERC20(busdToken).approve(address(router), uint256(-1)); IERC20(busdToken).approve(address(pairBusd), uint256(-1)); IERC20(busdToken).approve(address(this), uint256(-1)); emit Transfer(address(0x0), msg.sender, _totalSupply); } receive() external payable {} function totalSupply() external view override returns (uint256) { return _totalSupply; } function allowance(address owner_, address spender) external view override returns (uint256){ return _allowedFragments[owner_][spender]; } function balanceOf(address who) public view override returns (uint256) { return _gonBalances[who].div(_gonsPerFragment); } function checkFeeExempt(address _addr) external view returns (bool) { return _isFeeExempt[_addr]; } function checkSwapThreshold() external view returns (uint256) { return gonSwapThreshold.div(_gonsPerFragment); } function shouldRebase() internal view returns (bool) { return nextRebase <= block.timestamp; } function shouldTakeFee(address from, address to) internal view returns (bool) { if(_isFeeExempt[from] || _isFeeExempt[to]){ return false; }else if (feesOnNormalTransfers){ return true; }else{ return (automatedMarketMakerPairs[from] || automatedMarketMakerPairs[to]); } } function shouldSwapBack() internal view returns (bool) { return !automatedMarketMakerPairs[msg.sender] && !inSwap && swapEnabled && totalBuyFee.add(totalSellFee) > 0 && _gonBalances[address(this)] >= gonSwapThreshold; } function getCirculatingSupply() public view returns (uint256) { return (TOTAL_GONS.sub(_gonBalances[DEAD]).sub(_gonBalances[ZERO])).div(_gonsPerFragment); } function getLiquidityBacking(uint256 accuracy) public view returns (uint256){ uint256 liquidityBalance = 0; for(uint i = 0; i < _markerPairs.length; i++){ liquidityBalance.add(balanceOf(_markerPairs[i]).div(10 ** 9)); } return accuracy.mul(liquidityBalance.mul(2)).div(getCirculatingSupply().div(10 ** 9)); } function isOverLiquified(uint256 target, uint256 accuracy) public view returns (bool){ return getLiquidityBacking(accuracy) > target; } function manualSync() public { for(uint i = 0; i < _markerPairs.length; i++){ InterfaceLP(_markerPairs[i]).sync(); } } function transfer(address to, uint256 value) external override validRecipient(to) returns (bool){ _transferFrom(msg.sender, to, value); return true; } function _basicTransfer(address from, address to, uint256 amount) internal returns (bool) { uint256 gonAmount = amount.mul(_gonsPerFragment); _gonBalances[from] = _gonBalances[from].sub(gonAmount); _gonBalances[to] = _gonBalances[to].add(gonAmount); emit Transfer(from, to, amount); return true; } function _transferFrom(address sender, address recipient, uint256 amount) internal returns (bool) { bool excludedAccount = _isFeeExempt[sender] || _isFeeExempt[recipient]; require(initialDistributionFinished || excludedAccount, "Trading not started"); if ( automatedMarketMakerPairs[recipient] && !excludedAccount ) { require(amount <= maxSellTransactionAmount, "Error amount"); } if (inSwap) { return _basicTransfer(sender, recipient, amount); } uint256 gonAmount = amount.mul(_gonsPerFragment); if (shouldSwapBack()) { swapBack(); } _gonBalances[sender] = _gonBalances[sender].sub(gonAmount); uint256 gonAmountReceived = shouldTakeFee(sender, recipient) ? takeFee(sender, recipient, gonAmount) : gonAmount; _gonBalances[recipient] = _gonBalances[recipient].add(gonAmountReceived); emit Transfer( sender, recipient, gonAmountReceived.div(_gonsPerFragment) ); if(shouldRebase() && autoRebase) { _rebase(); if(!automatedMarketMakerPairs[sender] && !automatedMarketMakerPairs[recipient]){ manualSync(); } } return true; } function transferFrom(address from, address to, uint256 value) external override validRecipient(to) returns (bool) { if (_allowedFragments[from][msg.sender] != uint256(-1)) { _allowedFragments[from][msg.sender] = _allowedFragments[from][ msg.sender ].sub(value, "Insufficient Allowance"); } _transferFrom(from, to, value); return true; } function _swapAndLiquify(uint256 contractTokenBalance) private { uint256 half = contractTokenBalance.div(2); uint256 otherHalf = contractTokenBalance.sub(half); if(isLiquidityInBnb){ uint256 initialBalance = address(this).balance; _swapTokensForBNB(half, address(this)); uint256 newBalance = address(this).balance.sub(initialBalance); _addLiquidity(otherHalf, newBalance); emit SwapAndLiquify(half, newBalance, otherHalf); }else{ uint256 initialBalance = IERC20(busdToken).balanceOf(address(this)); _swapTokensForBusd(half, address(this)); uint256 newBalance = IERC20(busdToken).balanceOf(address(this)).sub(initialBalance); _addLiquidityBusd(otherHalf, newBalance); emit SwapAndLiquifyBusd(half, newBalance, otherHalf); } } function _addLiquidity(uint256 tokenAmount, uint256 bnbAmount) private { router.addLiquidityETH{value: bnbAmount}( address(this), tokenAmount, 0, 0, liquidityReceiver, block.timestamp ); } function _addLiquidityBusd(uint256 tokenAmount, uint256 busdAmount) private { router.addLiquidity( address(this), busdToken, tokenAmount, busdAmount, 0, 0, liquidityReceiver, block.timestamp ); } function _swapTokensForBNB(uint256 tokenAmount, address receiver) private { address[] memory path = new address[](2); path[0] = address(this); path[1] = router.WETH(); router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, receiver, block.timestamp ); } function _swapTokensForBusd(uint256 tokenAmount, address receiver) private { address[] memory path = new address[](3); path[0] = address(this); path[1] = router.WETH(); path[2] = busdToken; router.swapExactTokensForTokensSupportingFeeOnTransferTokens( tokenAmount, 0, path, receiver, block.timestamp ); } function swapBack() internal swapping { uint256 realTotalFee = totalBuyFee.add(totalSellFee); uint256 dynamicLiquidityFee = isOverLiquified(targetLiquidity, targetLiquidityDenominator) ? 0 : liquidityFee; uint256 contractTokenBalance = _gonBalances[address(this)].div(_gonsPerFragment); uint256 amountToLiquify = contractTokenBalance.mul(dynamicLiquidityFee.mul(2)).div(realTotalFee); uint256 amountToRFV = contractTokenBalance.mul(buyFeeRFV.mul(2).add(sellFeeRFVAdded)).div(realTotalFee); uint256 amountToTreasury = contractTokenBalance.sub(amountToLiquify).sub(amountToRFV); if(amountToLiquify > 0){ _swapAndLiquify(amountToLiquify); } if(amountToRFV > 0){ _swapTokensForBusd(amountToRFV, riskFreeValueReceiver); } if(amountToTreasury > 0){ _swapTokensForBNB(amountToTreasury, treasuryReceiver); } emit SwapBack(contractTokenBalance, amountToLiquify, amountToRFV, amountToTreasury); } function takeFee(address sender, address recipient, uint256 gonAmount) internal returns (uint256){ uint256 _realFee = totalBuyFee; if(automatedMarketMakerPairs[recipient]) _realFee = totalSellFee; uint256 feeAmount = gonAmount.mul(_realFee).div(feeDenominator); _gonBalances[address(this)] = _gonBalances[address(this)].add(feeAmount); emit Transfer(sender, address(this), feeAmount.div(_gonsPerFragment)); return gonAmount.sub(feeAmount); } function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool){ uint256 oldValue = _allowedFragments[msg.sender][spender]; if (subtractedValue >= oldValue) { _allowedFragments[msg.sender][spender] = 0; } else { _allowedFragments[msg.sender][spender] = oldValue.sub( subtractedValue ); } emit Approval( msg.sender, spender, _allowedFragments[msg.sender][spender] ); return true; } function increaseAllowance(address spender, uint256 addedValue) external returns (bool){ _allowedFragments[msg.sender][spender] = _allowedFragments[msg.sender][ spender ].add(addedValue); emit Approval( msg.sender, spender, _allowedFragments[msg.sender][spender] ); return true; } function approve(address spender, uint256 value) external override returns (bool){ _allowedFragments[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } function _rebase() private { if(!inSwap) { uint256 circulatingSupply = getCirculatingSupply(); int256 supplyDelta = int256(circulatingSupply.mul(rewardYield).div(rewardYieldDenominator)); coreRebase(supplyDelta); } } function coreRebase(int256 supplyDelta) private returns (uint256) { uint256 epoch = block.timestamp; if (supplyDelta == 0) { emit LogRebase(epoch, _totalSupply); return _totalSupply; } if (supplyDelta < 0) { _totalSupply = _totalSupply.sub(uint256(-supplyDelta)); } else { _totalSupply = _totalSupply.add(uint256(supplyDelta)); } if (_totalSupply > MAX_SUPPLY) { _totalSupply = MAX_SUPPLY; } _gonsPerFragment = TOTAL_GONS.div(_totalSupply); nextRebase = epoch + rebaseFrequency; emit LogRebase(epoch, _totalSupply); return _totalSupply; } function manualRebase() external onlyOwner{ require(!inSwap, "Try again"); require(nextRebase <= block.timestamp, "Not in time"); uint256 circulatingSupply = getCirculatingSupply(); int256 supplyDelta = int256(circulatingSupply.mul(rewardYield).div(rewardYieldDenominator)); coreRebase(supplyDelta); manualSync(); } function setAutomatedMarketMakerPair(address _pair, bool _value) public onlyOwner { require(automatedMarketMakerPairs[_pair] != _value, "Value already set"); automatedMarketMakerPairs[_pair] = _value; if(_value){ _markerPairs.push(_pair); }else{ require(_markerPairs.length > 1, "Required 1 pair"); for (uint256 i = 0; i < _markerPairs.length; i++) { if (_markerPairs[i] == _pair) { _markerPairs[i] = _markerPairs[_markerPairs.length - 1]; _markerPairs.pop(); break; } } } emit SetAutomatedMarketMakerPair(_pair, _value); } function setInitialDistributionFinished(bool _value) external onlyOwner { require(initialDistributionFinished != _value, "Not changed"); initialDistributionFinished = _value; } function setFeeExempt(address _addr, bool _value) external onlyOwner { require(_isFeeExempt[_addr] != _value, "Not changed"); _isFeeExempt[_addr] = _value; } function setTargetLiquidity(uint256 target, uint256 accuracy) external onlyOwner { targetLiquidity = target; targetLiquidityDenominator = accuracy; } function setSwapBackSettings(bool _enabled, uint256 _num, uint256 _denom) external onlyOwner { swapEnabled = _enabled; gonSwapThreshold = TOTAL_GONS.div(_denom).mul(_num); } function setFeeReceivers(address _liquidityReceiver, address _treasuryReceiver, address _riskFreeValueReceiver) external onlyOwner { liquidityReceiver = _liquidityReceiver; treasuryReceiver = _treasuryReceiver; riskFreeValueReceiver = _riskFreeValueReceiver; } function setFees(uint256 _liquidityFee, uint256 _riskFreeValue, uint256 _treasuryFee, uint256 _sellFeeTreasuryAdded, uint256 _sellFeeRFVAdded, uint256 _feeDenominator) external onlyOwner { require( _liquidityFee <= MAX_FEE_RATE && _riskFreeValue <= MAX_FEE_RATE && _treasuryFee <= MAX_FEE_RATE && _sellFeeTreasuryAdded <= MAX_FEE_RATE && _sellFeeRFVAdded <= MAX_FEE_RATE, "wrong" ); liquidityFee = _liquidityFee; buyFeeRFV = _riskFreeValue; treasuryFee = _treasuryFee; sellFeeTreasuryAdded = _sellFeeTreasuryAdded; sellFeeRFVAdded = _sellFeeRFVAdded; totalBuyFee = liquidityFee.add(treasuryFee).add(buyFeeRFV); totalSellFee = totalBuyFee.add(sellFeeTreasuryAdded).add(sellFeeRFVAdded); feeDenominator = _feeDenominator; require(totalBuyFee < feeDenominator / 4); } function clearStuckBalance(address _receiver) external onlyOwner { uint256 balance = address(this).balance; payable(_receiver).transfer(balance); } function rescueToken(address tokenAddress, uint256 tokens) external onlyOwner returns (bool success){ return ERC20Detailed(tokenAddress).transfer(msg.sender, tokens); } function setAutoRebase(bool _autoRebase) external onlyOwner { require(autoRebase != _autoRebase, "Not changed"); autoRebase = _autoRebase; } function setRebaseFrequency(uint256 _rebaseFrequency) external onlyOwner { require(_rebaseFrequency <= MAX_REBASE_FREQUENCY, "Too high"); rebaseFrequency = _rebaseFrequency; } function setRewardYield(uint256 _rewardYield, uint256 _rewardYieldDenominator) external onlyOwner { rewardYield = _rewardYield; rewardYieldDenominator = _rewardYieldDenominator; } function setFeesOnNormalTransfers(bool _enabled) external onlyOwner { require(feesOnNormalTransfers != _enabled, "Not changed"); feesOnNormalTransfers = _enabled; } function setIsLiquidityInBnb(bool _value) external onlyOwner { require(isLiquidityInBnb != _value, "Not changed"); isLiquidityInBnb = _value; } function setNextRebase(uint256 _nextRebase) external onlyOwner { nextRebase = _nextRebase; } function setMaxSellTransaction(uint256 _maxTxn) external onlyOwner { maxSellTransactionAmount = _maxTxn; } event SwapBack(uint256 contractTokenBalance,uint256 amountToLiquify,uint256 amountToRFV,uint256 amountToTreasury); event SwapAndLiquify(uint256 tokensSwapped, uint256 bnbReceived, uint256 tokensIntoLiqudity); event SwapAndLiquifyBusd(uint256 tokensSwapped, uint256 busdReceived, uint256 tokensIntoLiqudity); event LogRebase(uint256 indexed epoch, uint256 totalSupply); event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);}
/**
*Submitted for verification at BscScan.com on 2022-01-29
*/
*Submitted for verification at BscScan.com on 2022-01-27
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
library SafeMathInt {
int256 private constant MIN_INT256 = int256(1) << 255;
int256 private constant MAX_INT256 = ~(int256(1) << 255);
function mul(int256 a, int256 b) internal pure returns (int256) {
int256 c = a * b;
require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256));
require((b == 0) || (c / b == a));
return c;
}
function div(int256 a, int256 b) internal pure returns (int256) {
require(b != -1 || a != MIN_INT256);
return a / b;
function sub(int256 a, int256 b) internal pure returns (int256) {
int256 c = a - b;
require((b >= 0 && c <= a) || (b < 0 && c > a));
function add(int256 a, int256 b) internal pure returns (int256) {
int256 c = a + b;
require((b >= 0 && c >= a) || (b < 0 && c < a));
function abs(int256 a) internal pure returns (int256) {
require(a != MIN_INT256);
return a < 0 ? -a : a;
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);
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
function div(
require(b > 0, errorMessage);
uint256 c = a / b;
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
interface InterfaceLP {
function sync() external;
library Roles {
struct Role {
mapping (address => bool) bearer;
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
abstract contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor(
string memory _tokenName,
string memory _tokenSymbol,
uint8 _tokenDecimals
) {
_name = _tokenName;
_symbol = _tokenSymbol;
_decimals = _tokenDecimals;
function name() public view returns (string memory) {
return _name;
function symbol() public view returns (string memory) {
return _symbol;
function decimals() public view returns (uint8) {
return _decimals;
interface IDEXRouter {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
payable
uint256 amountToken,
uint256 amountETH,
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
interface IDEXFactory {
function createPair(address tokenA, address tokenB)
returns (address pair);
contract Ownable {
address private _owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
constructor() {
_owner = msg.sender;
function owner() public view returns (address) {
return _owner;
modifier onlyOwner() {
require(msg.sender == _owner, "Not owner");
_;
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(_owner);
_owner = address(0);
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
contract LiberoToken is ERC20Detailed, Ownable {
using SafeMath for uint256;
using SafeMathInt for int256;
bool public initialDistributionFinished = false;
bool public swapEnabled = true;
bool public autoRebase = false;
bool public feesOnNormalTransfers = false;
bool public isLiquidityInBnb = true;
uint256 public rewardYield = 4208333;
uint256 public rewardYieldDenominator = 10000000000;
uint256 public maxSellTransactionAmount = 2500000 * 10 ** 18;
uint256 public rebaseFrequency = 1800;
uint256 public nextRebase = block.timestamp + 31536000;
mapping(address => bool) _isFeeExempt;
address[] public _markerPairs;
mapping (address => bool) public automatedMarketMakerPairs;
uint256 public constant MAX_FEE_RATE = 20;
uint256 private constant MAX_REBASE_FREQUENCY = 1800;
uint256 private constant DECIMALS = 18;
uint256 private constant MAX_UINT256 = ~uint256(0);
uint256 private constant INITIAL_FRAGMENTS_SUPPLY = 5 * 10**9 * 10**DECIMALS;
uint256 private constant TOTAL_GONS = MAX_UINT256 - (MAX_UINT256 % INITIAL_FRAGMENTS_SUPPLY);
uint256 private constant MAX_SUPPLY = ~uint128(0);
address DEAD = 0x000000000000000000000000000000000000dEaD;
address ZERO = 0x0000000000000000000000000000000000000000;
address public liquidityReceiver = 0x5A50173A8c02464ba737B669fadAe2fdAd293157;
address public treasuryReceiver = 0x9CCE932283183F637e4870a63bDf1e6C348DbB64;
address public riskFreeValueReceiver = 0x94DC0b13E66ABa9450b3Cc44c2643BBb4C264BC7;
address public busdToken = 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56;
IDEXRouter public router;
address public pair;
uint256 public liquidityFee = 5;
uint256 public treasuryFee = 3;
uint256 public buyFeeRFV = 5;
uint256 public sellFeeTreasuryAdded = 2;
uint256 public sellFeeRFVAdded = 5;
uint256 public totalBuyFee = liquidityFee.add(treasuryFee).add(buyFeeRFV);
uint256 public totalSellFee = totalBuyFee.add(sellFeeTreasuryAdded).add(sellFeeRFVAdded);
uint256 public feeDenominator = 100;
uint256 targetLiquidity = 50;
uint256 targetLiquidityDenominator = 100;
bool inSwap;
modifier swapping() {
inSwap = true;
inSwap = false;
modifier validRecipient(address to) {
require(to != address(0x0));
uint256 private _totalSupply;
uint256 private _gonsPerFragment;
uint256 private gonSwapThreshold = (TOTAL_GONS * 10) / 10000;
mapping(address => uint256) private _gonBalances;
mapping(address => mapping(address => uint256)) private _allowedFragments;
constructor() ERC20Detailed("Libero Financial Freedom", "LIBERO", uint8(DECIMALS)) {
router = IDEXRouter(0x10ED43C718714eb63d5aA57B78B54704E256024E);
pair = IDEXFactory(router.factory()).createPair(address(this), router.WETH());
address pairBusd = IDEXFactory(router.factory()).createPair(address(this), busdToken);
_allowedFragments[address(this)][address(router)] = uint256(-1);
_allowedFragments[address(this)][pair] = uint256(-1);
_allowedFragments[address(this)][address(this)] = uint256(-1);
_allowedFragments[address(this)][pairBusd] = uint256(-1);
setAutomatedMarketMakerPair(pair, true);
setAutomatedMarketMakerPair(pairBusd, true);
_totalSupply = INITIAL_FRAGMENTS_SUPPLY;
_gonBalances[msg.sender] = TOTAL_GONS;
_gonsPerFragment = TOTAL_GONS.div(_totalSupply);
_isFeeExempt[treasuryReceiver] = true;
_isFeeExempt[riskFreeValueReceiver] = true;
_isFeeExempt[address(this)] = true;
_isFeeExempt[msg.sender] = true;
IERC20(busdToken).approve(address(router), uint256(-1));
IERC20(busdToken).approve(address(pairBusd), uint256(-1));
IERC20(busdToken).approve(address(this), uint256(-1));
emit Transfer(address(0x0), msg.sender, _totalSupply);
receive() external payable {}
function totalSupply() external view override returns (uint256) {
return _totalSupply;
function allowance(address owner_, address spender) external view override returns (uint256){
return _allowedFragments[owner_][spender];
function balanceOf(address who) public view override returns (uint256) {
return _gonBalances[who].div(_gonsPerFragment);
function checkFeeExempt(address _addr) external view returns (bool) {
return _isFeeExempt[_addr];
function checkSwapThreshold() external view returns (uint256) {
return gonSwapThreshold.div(_gonsPerFragment);
function shouldRebase() internal view returns (bool) {
return nextRebase <= block.timestamp;
function shouldTakeFee(address from, address to) internal view returns (bool) {
if(_isFeeExempt[from] || _isFeeExempt[to]){
return false;
}else if (feesOnNormalTransfers){
return true;
}else{
return (automatedMarketMakerPairs[from] || automatedMarketMakerPairs[to]);
function shouldSwapBack() internal view returns (bool) {
return
!automatedMarketMakerPairs[msg.sender] &&
!inSwap &&
swapEnabled &&
totalBuyFee.add(totalSellFee) > 0 &&
_gonBalances[address(this)] >= gonSwapThreshold;
function getCirculatingSupply() public view returns (uint256) {
return (TOTAL_GONS.sub(_gonBalances[DEAD]).sub(_gonBalances[ZERO])).div(_gonsPerFragment);
function getLiquidityBacking(uint256 accuracy) public view returns (uint256){
uint256 liquidityBalance = 0;
for(uint i = 0; i < _markerPairs.length; i++){
liquidityBalance.add(balanceOf(_markerPairs[i]).div(10 ** 9));
return accuracy.mul(liquidityBalance.mul(2)).div(getCirculatingSupply().div(10 ** 9));
function isOverLiquified(uint256 target, uint256 accuracy) public view returns (bool){
return getLiquidityBacking(accuracy) > target;
function manualSync() public {
InterfaceLP(_markerPairs[i]).sync();
function transfer(address to, uint256 value) external override validRecipient(to) returns (bool){
_transferFrom(msg.sender, to, value);
function _basicTransfer(address from, address to, uint256 amount) internal returns (bool) {
uint256 gonAmount = amount.mul(_gonsPerFragment);
_gonBalances[from] = _gonBalances[from].sub(gonAmount);
_gonBalances[to] = _gonBalances[to].add(gonAmount);
emit Transfer(from, to, amount);
function _transferFrom(address sender, address recipient, uint256 amount) internal returns (bool) {
bool excludedAccount = _isFeeExempt[sender] || _isFeeExempt[recipient];
require(initialDistributionFinished || excludedAccount, "Trading not started");
if (
automatedMarketMakerPairs[recipient] &&
!excludedAccount
require(amount <= maxSellTransactionAmount, "Error amount");
if (inSwap) {
return _basicTransfer(sender, recipient, amount);
if (shouldSwapBack()) {
swapBack();
_gonBalances[sender] = _gonBalances[sender].sub(gonAmount);
uint256 gonAmountReceived = shouldTakeFee(sender, recipient) ? takeFee(sender, recipient, gonAmount) : gonAmount;
_gonBalances[recipient] = _gonBalances[recipient].add(gonAmountReceived);
emit Transfer(
sender,
recipient,
gonAmountReceived.div(_gonsPerFragment)
if(shouldRebase() && autoRebase) {
_rebase();
if(!automatedMarketMakerPairs[sender] && !automatedMarketMakerPairs[recipient]){
manualSync();
function transferFrom(address from, address to, uint256 value) external override validRecipient(to) returns (bool) {
if (_allowedFragments[from][msg.sender] != uint256(-1)) {
_allowedFragments[from][msg.sender] = _allowedFragments[from][
msg.sender
].sub(value, "Insufficient Allowance");
_transferFrom(from, to, value);
function _swapAndLiquify(uint256 contractTokenBalance) private {
uint256 half = contractTokenBalance.div(2);
uint256 otherHalf = contractTokenBalance.sub(half);
if(isLiquidityInBnb){
uint256 initialBalance = address(this).balance;
_swapTokensForBNB(half, address(this));
uint256 newBalance = address(this).balance.sub(initialBalance);
_addLiquidity(otherHalf, newBalance);
emit SwapAndLiquify(half, newBalance, otherHalf);
uint256 initialBalance = IERC20(busdToken).balanceOf(address(this));
_swapTokensForBusd(half, address(this));
uint256 newBalance = IERC20(busdToken).balanceOf(address(this)).sub(initialBalance);
_addLiquidityBusd(otherHalf, newBalance);
emit SwapAndLiquifyBusd(half, newBalance, otherHalf);
function _addLiquidity(uint256 tokenAmount, uint256 bnbAmount) private {
router.addLiquidityETH{value: bnbAmount}(
address(this),
tokenAmount,
0,
liquidityReceiver,
block.timestamp
function _addLiquidityBusd(uint256 tokenAmount, uint256 busdAmount) private {
router.addLiquidity(
busdToken,
busdAmount,
function _swapTokensForBNB(uint256 tokenAmount, address receiver) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
path,
receiver,
function _swapTokensForBusd(uint256 tokenAmount, address receiver) private {
address[] memory path = new address[](3);
path[2] = busdToken;
router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
function swapBack() internal swapping {
uint256 realTotalFee = totalBuyFee.add(totalSellFee);
uint256 dynamicLiquidityFee = isOverLiquified(targetLiquidity, targetLiquidityDenominator) ? 0 : liquidityFee;
uint256 contractTokenBalance = _gonBalances[address(this)].div(_gonsPerFragment);
uint256 amountToLiquify = contractTokenBalance.mul(dynamicLiquidityFee.mul(2)).div(realTotalFee);
uint256 amountToRFV = contractTokenBalance.mul(buyFeeRFV.mul(2).add(sellFeeRFVAdded)).div(realTotalFee);
uint256 amountToTreasury = contractTokenBalance.sub(amountToLiquify).sub(amountToRFV);
if(amountToLiquify > 0){
_swapAndLiquify(amountToLiquify);
if(amountToRFV > 0){
_swapTokensForBusd(amountToRFV, riskFreeValueReceiver);
if(amountToTreasury > 0){
_swapTokensForBNB(amountToTreasury, treasuryReceiver);
emit SwapBack(contractTokenBalance, amountToLiquify, amountToRFV, amountToTreasury);
function takeFee(address sender, address recipient, uint256 gonAmount) internal returns (uint256){
uint256 _realFee = totalBuyFee;
if(automatedMarketMakerPairs[recipient]) _realFee = totalSellFee;
uint256 feeAmount = gonAmount.mul(_realFee).div(feeDenominator);
_gonBalances[address(this)] = _gonBalances[address(this)].add(feeAmount);
emit Transfer(sender, address(this), feeAmount.div(_gonsPerFragment));
return gonAmount.sub(feeAmount);
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool){
uint256 oldValue = _allowedFragments[msg.sender][spender];
if (subtractedValue >= oldValue) {
_allowedFragments[msg.sender][spender] = 0;
} else {
_allowedFragments[msg.sender][spender] = oldValue.sub(
subtractedValue
emit Approval(
msg.sender,
spender,
_allowedFragments[msg.sender][spender]
function increaseAllowance(address spender, uint256 addedValue) external returns (bool){
_allowedFragments[msg.sender][spender] = _allowedFragments[msg.sender][
spender
].add(addedValue);
function approve(address spender, uint256 value) external override returns (bool){
_allowedFragments[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
function _rebase() private {
if(!inSwap) {
uint256 circulatingSupply = getCirculatingSupply();
int256 supplyDelta = int256(circulatingSupply.mul(rewardYield).div(rewardYieldDenominator));
coreRebase(supplyDelta);
function coreRebase(int256 supplyDelta) private returns (uint256) {
uint256 epoch = block.timestamp;
if (supplyDelta == 0) {
emit LogRebase(epoch, _totalSupply);
if (supplyDelta < 0) {
_totalSupply = _totalSupply.sub(uint256(-supplyDelta));
_totalSupply = _totalSupply.add(uint256(supplyDelta));
if (_totalSupply > MAX_SUPPLY) {
_totalSupply = MAX_SUPPLY;
nextRebase = epoch + rebaseFrequency;
function manualRebase() external onlyOwner{
require(!inSwap, "Try again");
require(nextRebase <= block.timestamp, "Not in time");
function setAutomatedMarketMakerPair(address _pair, bool _value) public onlyOwner {
require(automatedMarketMakerPairs[_pair] != _value, "Value already set");
automatedMarketMakerPairs[_pair] = _value;
if(_value){
_markerPairs.push(_pair);
require(_markerPairs.length > 1, "Required 1 pair");
for (uint256 i = 0; i < _markerPairs.length; i++) {
if (_markerPairs[i] == _pair) {
_markerPairs[i] = _markerPairs[_markerPairs.length - 1];
_markerPairs.pop();
break;
emit SetAutomatedMarketMakerPair(_pair, _value);
function setInitialDistributionFinished(bool _value) external onlyOwner {
require(initialDistributionFinished != _value, "Not changed");
initialDistributionFinished = _value;
function setFeeExempt(address _addr, bool _value) external onlyOwner {
require(_isFeeExempt[_addr] != _value, "Not changed");
_isFeeExempt[_addr] = _value;
function setTargetLiquidity(uint256 target, uint256 accuracy) external onlyOwner {
targetLiquidity = target;
targetLiquidityDenominator = accuracy;
function setSwapBackSettings(bool _enabled, uint256 _num, uint256 _denom) external onlyOwner {
swapEnabled = _enabled;
gonSwapThreshold = TOTAL_GONS.div(_denom).mul(_num);
function setFeeReceivers(address _liquidityReceiver, address _treasuryReceiver, address _riskFreeValueReceiver) external onlyOwner {
liquidityReceiver = _liquidityReceiver;
treasuryReceiver = _treasuryReceiver;
riskFreeValueReceiver = _riskFreeValueReceiver;
function setFees(uint256 _liquidityFee, uint256 _riskFreeValue, uint256 _treasuryFee, uint256 _sellFeeTreasuryAdded, uint256 _sellFeeRFVAdded, uint256 _feeDenominator) external onlyOwner {
require(
_liquidityFee <= MAX_FEE_RATE &&
_riskFreeValue <= MAX_FEE_RATE &&
_treasuryFee <= MAX_FEE_RATE &&
_sellFeeTreasuryAdded <= MAX_FEE_RATE &&
_sellFeeRFVAdded <= MAX_FEE_RATE,
"wrong"
liquidityFee = _liquidityFee;
buyFeeRFV = _riskFreeValue;
treasuryFee = _treasuryFee;
sellFeeTreasuryAdded = _sellFeeTreasuryAdded;
sellFeeRFVAdded = _sellFeeRFVAdded;
totalBuyFee = liquidityFee.add(treasuryFee).add(buyFeeRFV);
totalSellFee = totalBuyFee.add(sellFeeTreasuryAdded).add(sellFeeRFVAdded);
feeDenominator = _feeDenominator;
require(totalBuyFee < feeDenominator / 4);
function clearStuckBalance(address _receiver) external onlyOwner {
uint256 balance = address(this).balance;
payable(_receiver).transfer(balance);
function rescueToken(address tokenAddress, uint256 tokens) external onlyOwner returns (bool success){
return ERC20Detailed(tokenAddress).transfer(msg.sender, tokens);
function setAutoRebase(bool _autoRebase) external onlyOwner {
require(autoRebase != _autoRebase, "Not changed");
autoRebase = _autoRebase;
function setRebaseFrequency(uint256 _rebaseFrequency) external onlyOwner {
require(_rebaseFrequency <= MAX_REBASE_FREQUENCY, "Too high");
rebaseFrequency = _rebaseFrequency;
function setRewardYield(uint256 _rewardYield, uint256 _rewardYieldDenominator) external onlyOwner {
rewardYield = _rewardYield;
rewardYieldDenominator = _rewardYieldDenominator;
function setFeesOnNormalTransfers(bool _enabled) external onlyOwner {
require(feesOnNormalTransfers != _enabled, "Not changed");
feesOnNormalTransfers = _enabled;
function setIsLiquidityInBnb(bool _value) external onlyOwner {
require(isLiquidityInBnb != _value, "Not changed");
isLiquidityInBnb = _value;
function setNextRebase(uint256 _nextRebase) external onlyOwner {
nextRebase = _nextRebase;
function setMaxSellTransaction(uint256 _maxTxn) external onlyOwner {
maxSellTransactionAmount = _maxTxn;
event SwapBack(uint256 contractTokenBalance,uint256 amountToLiquify,uint256 amountToRFV,uint256 amountToTreasury);
event SwapAndLiquify(uint256 tokensSwapped, uint256 bnbReceived, uint256 tokensIntoLiqudity);
event SwapAndLiquifyBusd(uint256 tokensSwapped, uint256 busdReceived, uint256 tokensIntoLiqudity);
event LogRebase(uint256 indexed epoch, uint256 totalSupply);
event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);
The provided Solidity code represents the Libero token, an ERC-20 token on the Binance Smart Chain (BSC). The contract includes essential features such as automatic and manual rebasing, fee mechanisms for transfers (liquidity, treasury, risk-free value), liquidity provision using PancakeSwap, token swap functionality, and ownership controls.
It leverages SafeMath for secure arithmetic operations and implements various interfaces and libraries for standard token functionalities. The code showcases a complex tokenomics structure with rebase mechanisms and fee distribution, making it important for users to carefully review and understand the code before deployment or interaction.
The provided Solidity code defines several privileged roles in the Libero token contract:Owner: The owner has administrative control over the contract, enabling functions such as renouncing ownership, transferring ownership, setting parameters, and performing actions exclusive to the owner.Automated Market Maker Pairs Manager: The contract allows the owner to set and manage automated market maker (AMM) pairs. These pairs are crucial for liquidity and trading functionality. The manager can designate specific pairs as AMM pairs or remove them.These roles are designated through the "onlyOwner" modifier, ensuring that only the owner can execute certain critical functions, providing a level of control and security over the contract's behavior and parameters.
Location in code: Inside the modifier onlyOwner() {Line Number: 471-477Description: While access control is implemented, additional checks and validations within the modifier may be needed to prevent specific attacks like reentrancy.
Location in code: Inside the function _transferOwnership(address newOwner) internal { Line Numbers: 496-504Description: The _transferOwnership function and other relevant functions need a comprehensive review to ensure protection against reentrancy attacks.
Location in code: Inside the function transfer(address to, uint256 value)Line Numbers: 809-815Description: Verify that the ERC-20 functions adhere to the standard, especially in terms of security and accuracy.
function setAutoRebase(bool _autoRebase) external onlyOwner { require(autoRebase != _autoRebase, "Not changed"); autoRebase = _autoRebase; }//1430 function setRebaseFrequency(uint256 _rebaseFrequency) external onlyOwner { require(_rebaseFrequency <= MAX_REBASE_FREQUENCY, "Too high"); rebaseFrequency = _rebaseFrequency; }//1439
Location in code: Inside the setAutoRebase and setRebaseFrequency functionLine number: 1430 and 1439Description: Some functions, such as setAutoRebase and setRebaseFrequency, do not specify visibility (public, external, internal, private). It's recommended to explicitly define function visibility for clarity.
function shouldRebase() internal view returns (bool) { return nextRebase <= block.timestamp; }
Location in code: Inside the function shouldRebase() internal view returns (bool)Line number: 726-730Description: The shouldRebase function relies on block.timestamp, which can be manipulated by miners. Consider using a more secure approach, such as an external oracle or Chainlink VRF, to prevent potential exploits.
Our industry-leading audit methodology and tooling includes a review of your code’s logic, with a mathematical approach to ensure your program works as intended.