编译器
0.8.21+commit.d9974bed
文件 1 的 8:Auth.sol
pragma solidity ^0.8.17;
abstract contract Auth {
address internal owner;
mapping(address => bool) internal authorizations;
constructor(address _owner) {
owner = _owner;
authorizations[_owner] = true;
}
modifier onlyOwner() {
require(isOwner(msg.sender), "!OWNER");
_;
}
modifier authorized() {
require(isAuthorized(msg.sender), "!AUTHORIZED");
_;
}
function authorize(address adr) public onlyOwner {
authorizations[adr] = true;
}
function unauthorize(address adr) public onlyOwner {
authorizations[adr] = false;
}
function isOwner(address account) public view returns (bool) {
return account == owner;
}
function isAuthorized(address adr) public view returns (bool) {
return authorizations[adr];
}
function transferOwnership(address payable adr) public onlyOwner {
owner = adr;
authorizations[adr] = true;
emit OwnershipTransferred(adr);
}
event OwnershipTransferred(address owner);
}
文件 2 的 8:IDEXFactory.sol
pragma solidity ^0.8.17;
interface IDEXFactory {
function createPair(
address tokenA,
address tokenB
) external returns (address pair);
}
文件 3 的 8:IDEXRouter.sol
pragma solidity ^0.8.17;
interface IDEXRouter {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
)
external
payable
returns (uint amountToken, uint amountETH, uint liquidity);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
文件 4 的 8:IERC20.sol
pragma solidity ^0.8.17;
interface IERC20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
function getOwner() external view returns (address);
function balanceOf(address account) external view returns (uint256);
function transfer(
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 transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
文件 5 的 8:OperaLendingPool.sol
pragma solidity ^0.8.17;
import "Auth.sol";
import "IERC20.sol";
contract OperaPool is Auth {
uint256 public totalEthLent;
uint256 public totalAvailableEth;
uint256 public numberOfLenders;
uint256 public borrowLimit = 3;
uint256 public _tokenDecimals = 1 * 10 ** 18;
bool public borrowingEnable = true;
mapping(address => uint256) public usersCurrentLentAmount;
mapping(uint256 => address) public lenderIdToAddress;
mapping(address => uint256) public lenderAddressToId;
mapping(address => bool) public authorizedFactoryAddresses;
event ethMoved(
address account,
uint256 amount,
uint256 code,
uint256 blocktime
);
event factoryStatusChange(address factoryAddress, bool status);
constructor() Auth(msg.sender) {}
modifier onlyFactoryAuthorized() {
require(
authorizedFactoryAddresses[msg.sender],
"only factory contracts can borrow eth"
);
_;
}
function updateFactoryAuthorization(
address addy,
bool status
) external onlyOwner {
authorizedFactoryAddresses[addy] = status;
emit factoryStatusChange(addy, status);
}
function updateBorrowLimit(uint256 limit) external onlyOwner {
borrowLimit = limit;
}
function updateBorrowingEnabled(bool status) external onlyOwner {
borrowingEnable = status;
}
function lendForAddress(address addy) external payable returns (bool) {
require(
msg.value > 0 && msg.value % _tokenDecimals == 0,
"Only send full ether."
);
if (lenderAddressToId[addy] == 0) {
lenderAddressToId[addy] = numberOfLenders + 1;
lenderIdToAddress[numberOfLenders + 1] = addy;
numberOfLenders += 1;
}
uint256 amountReceived = msg.value / _tokenDecimals;
emit ethMoved(addy, amountReceived, 1, block.timestamp);
totalEthLent += amountReceived;
usersCurrentLentAmount[addy] += amountReceived;
totalAvailableEth += amountReceived;
return true;
}
receive() external payable {}
function lendEth() external payable returns (bool) {
require(
msg.value > 0 && msg.value % _tokenDecimals == 0,
"Only send full ether."
);
if (lenderAddressToId[msg.sender] == 0) {
lenderAddressToId[msg.sender] = numberOfLenders + 1;
lenderIdToAddress[numberOfLenders + 1] = msg.sender;
numberOfLenders += 1;
}
uint256 amountReceived = msg.value / _tokenDecimals;
emit ethMoved(msg.sender, amountReceived, 1, block.timestamp);
totalEthLent += amountReceived;
usersCurrentLentAmount[msg.sender] += amountReceived;
totalAvailableEth += amountReceived;
return true;
}
function borrowEth(uint256 _amount) external onlyFactoryAuthorized {
require(_amount <= totalAvailableEth, "Not Enough eth to borrow");
require(_amount > 0, "Cannot borrow 0");
require(borrowingEnable, "Borrowing is not enabled.");
require(_amount <= borrowLimit, "Can't borrow that much.");
totalAvailableEth -= _amount;
payable(msg.sender).transfer(_amount * _tokenDecimals);
emit ethMoved(msg.sender, _amount, 2, block.timestamp);
}
function returnLentEth(uint256 amountEth) external payable returns (bool) {
require(
(amountEth * _tokenDecimals) - msg.value == 0,
"Did not send enough eth."
);
emit ethMoved(msg.sender, amountEth, 3, block.timestamp);
totalAvailableEth += amountEth;
return true;
}
function withdrawLentEth(uint256 _amountEther) external payable {
require(
usersCurrentLentAmount[msg.sender] >= _amountEther,
"You Did not lend that much."
);
require(_amountEther > 0, "Cant withdraw 0.");
require(_amountEther <= totalAvailableEth, "Not enough eth available.");
if (usersCurrentLentAmount[msg.sender] == _amountEther) {
uint256 tempIdOfUser = lenderAddressToId[msg.sender];
address addressOfLastUser = lenderIdToAddress[numberOfLenders];
if (addressOfLastUser != msg.sender) {
delete lenderAddressToId[msg.sender];
lenderAddressToId[addressOfLastUser] = tempIdOfUser;
lenderIdToAddress[tempIdOfUser] = addressOfLastUser;
delete lenderIdToAddress[numberOfLenders];
numberOfLenders -= 1;
} else {
delete lenderAddressToId[msg.sender];
delete lenderIdToAddress[tempIdOfUser];
numberOfLenders -= 1;
}
}
usersCurrentLentAmount[msg.sender] -= _amountEther;
totalAvailableEth -= _amountEther;
totalEthLent -= _amountEther;
payable(msg.sender).transfer(_amountEther * _tokenDecimals);
emit ethMoved(msg.sender, _amountEther, 4, block.timestamp);
}
function withdraw(uint256 amount) external onlyOwner {
payable(owner).transfer(amount);
}
function rescueToken(address token, uint256 amount) external onlyOwner {
IERC20 tokenToRescue = IERC20(token);
tokenToRescue.transfer(owner, amount);
}
function removeExcess() external payable onlyOwner {
require(
address(this).balance > totalAvailableEth * _tokenDecimals,
"There is no excess eth"
);
uint256 excessAmount = address(this).balance -
(totalAvailableEth * _tokenDecimals);
payable(owner).transfer(excessAmount);
}
}
文件 6 的 8:OperaRevenue.sol
pragma solidity ^0.8.17;
import "OperaToken.sol";
import "OperaLendingPool.sol";
import "IERC20.sol";
contract OperaRevenue {
address public owner;
address public teamAlpha;
address public teamBeta = 0xB0241BD37223F8c55096A2e15A13534A57938716;
uint256 public revenueShareAmount;
uint256 public lendersCut;
uint256 public teamsCut;
uint256 public revShareCut;
mapping(address => uint256) public claimableRewardsForAddress;
address public lendingPoolAddress;
event rewardsMoved(
address account,
uint256 amount,
uint256 blocktime,
bool incoming
);
event rewardsAwarded(address user, uint256 amount, uint256 blocktime);
constructor(address _lendingPool) {
owner = msg.sender;
teamAlpha = msg.sender;
lendingPoolAddress = _lendingPool;
}
modifier onlyOwner() {
require(owner == msg.sender, "only owner");
_;
}
function withdraw() external onlyOwner {
payable(owner).transfer(address(this).balance);
}
function requestReward() external {
uint256 usersRewardAmount = claimableRewardsForAddress[msg.sender];
require(usersRewardAmount > 0, "You have no rewards.");
claimableRewardsForAddress[msg.sender] = 0;
payable(msg.sender).transfer(usersRewardAmount);
emit rewardsMoved(
msg.sender,
usersRewardAmount,
block.timestamp,
false
);
}
function setLendingPoolAddress(address addy) external onlyOwner {
lendingPoolAddress = addy;
}
function setBetaAddress(address addy) external onlyOwner {
teamBeta = addy;
}
function setAlphaAddress(address addy) external onlyOwner {
teamAlpha = addy;
}
function getAddressBalance(address _address) public view returns (uint256) {
return _address.balance;
}
function removeRevenueShare() external onlyOwner {
uint256 amount = revenueShareAmount;
revenueShareAmount = 0;
payable(owner).transfer(amount);
}
function awardRevenue(address user) external payable onlyOwner {
claimableRewardsForAddress[user] += msg.value;
}
function changeFees(
uint256 lenders,
uint256 team,
uint256 revShare
) external payable onlyOwner {
lendersCut = lenders;
teamsCut = team;
revShareCut = revShare;
require(
100 == lendersCut + teamsCut + teamsCut + revShareCut,
"Fees have to equal 100%"
);
}
receive() external payable {}
function recieveRewards() external payable {
OperaPool lender = OperaPool(payable(lendingPoolAddress));
uint256 totalEthLent = lender.totalEthLent();
if (totalEthLent == 0) {
uint256 getTeamFee = (msg.value * 50) / 100;
claimableRewardsForAddress[teamAlpha] += getTeamFee;
claimableRewardsForAddress[teamBeta] += getTeamFee;
} else {
uint256 numberOfLenders = lender.numberOfLenders();
uint256 getLenderFee = (msg.value * 60) / 100;
uint256 getTeamFee = (msg.value * 10) / 100;
uint256 getRevenueFee = (msg.value * 20) / 100;
uint256 rewardsPerShare = getLenderFee / totalEthLent;
address tempAddress;
uint256 tempLentAmount;
claimableRewardsForAddress[teamAlpha] += getTeamFee;
claimableRewardsForAddress[teamBeta] += getTeamFee;
revenueShareAmount += getRevenueFee;
for (uint256 i = 0; i < numberOfLenders; i++) {
tempAddress = lender.lenderIdToAddress(i + 1);
tempLentAmount = lender.usersCurrentLentAmount(tempAddress);
claimableRewardsForAddress[tempAddress] +=
tempLentAmount *
rewardsPerShare;
emit rewardsAwarded(
tempAddress,
tempLentAmount * rewardsPerShare,
block.timestamp
);
}
}
emit rewardsMoved(msg.sender, msg.value, block.timestamp, true);
}
}
文件 7 的 8:OperaToken.sol
pragma solidity ^0.8.17;
import "IERC20.sol";
import "Auth.sol";
import "SafeMath.sol";
import "IDEXRouter.sol";
import "IDEXFactory.sol";
import "OperaRevenue.sol";
contract OperaToken is IERC20, Auth {
using SafeMath for uint256;
string _name;
string _symbol;
string _telegram;
string _website;
uint8 constant _decimals = 9;
uint256 public _totalSupply;
uint256 public _maxWalletToken;
uint256 public _swapThreshold;
uint256 public _operaTax;
uint256 public _marketingBuyTax;
uint256 public _marketingSellTax;
uint256 public _devBuyTax;
uint256 public _devSellTax;
uint256 public _liquidityBuyTax;
uint256 public _liquiditySellTax;
mapping(address => uint256) _balances;
mapping(address => mapping(address => uint256)) _allowances;
mapping(address => bool) isFeeExempt;
address public pair;
address public routerAddress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address public _devAddress;
address public _marketingAddress;
address public OperaRevenueAddress;
address public OperaFactoryAddress;
address public WETHAddress = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
IDEXRouter public router;
bool inSwap;
bool public taxable;
bool public borrowedLP;
modifier swapping() {
inSwap = true;
_;
inSwap = false;
}
event AutoLiquify(uint256 amountETH, uint256 amountCoin);
constructor(
string[] memory _stringData,
address[] memory _addressData,
uint256[] memory _intData,
address rewardsAddress
) Auth(msg.sender) {
require(_stringData.length == 4, "String List needs 4 string inputs");
require(
_addressData.length == 2,
"Address List needs 2 address inputs"
);
require(_intData.length == 11, "Int List needs 11 int inputs");
if (_intData[9] == 1) {
taxable = true;
}
if (_intData[10] == 1 && _intData[9] == 1) {
borrowedLP = true;
}
OperaRevenueAddress = rewardsAddress;
OperaFactoryAddress = msg.sender;
router = IDEXRouter(routerAddress);
pair = IDEXFactory(router.factory()).createPair(
router.WETH(),
address(this)
);
authorizations[routerAddress] = true;
_name = _stringData[0];
_symbol = _stringData[1];
_telegram = _stringData[2];
_website = _stringData[3];
require(_intData[0] > 0 && _intData[0] < 999999999999999999);
_totalSupply = _intData[0] * 10 ** _decimals;
_balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
_maxWalletToken = (_totalSupply * _intData[1]) / 1000;
if (taxable) {
_devAddress = _addressData[0];
_marketingAddress = _addressData[1];
_swapThreshold = (_totalSupply * _intData[2]) / 1000;
_marketingBuyTax = _intData[3];
_marketingSellTax = _intData[4];
_devBuyTax = _intData[5];
_devSellTax = _intData[6];
_liquidityBuyTax = _intData[7];
_liquiditySellTax = _intData[8];
if (borrowedLP) {
if (getTotalTax() > 192) {
_operaTax = 20;
} else {
_operaTax = 4;
}
} else {
_operaTax = 2;
}
require(
_swapThreshold <= (_totalSupply / 20) &&
_swapThreshold >= (_totalSupply / 500),
"Swap Threshold must be less than 5% of total supply, or greater than 0.2%."
);
require(getSellTax() <= 500, "Sell tax can't be greater than 50%.");
require(getBuyTax() <= 500, "Buy tax can't be greater than 50%.");
require(
_devAddress != address(0) && _marketingAddress != address(0),
"Reciever wallets can't be Zero address."
);
}
_allowances[address(this)][address(router)] = _totalSupply;
require(
_maxWalletToken >= (_totalSupply / 500),
"Max Wallet must be greater than 0.2%."
);
}
receive() external payable {}
function totalSupply() external view override returns (uint256) {
return _totalSupply;
}
function decimals() external pure override returns (uint8) {
return _decimals;
}
function symbol() external view override returns (string memory) {
return _symbol;
}
function name() external view override returns (string memory) {
return _name;
}
function getOwner() external view override returns (address) {
return owner;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function allowance(
address holder,
address spender
) external view override returns (uint256) {
return _allowances[holder][spender];
}
function approve(
address spender,
uint256 amount
) public override returns (bool) {
_allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function approveMax(address spender) external returns (bool) {
return approve(spender, _totalSupply);
}
function transfer(
address recipient,
uint256 amount
) external override returns (bool) {
if (owner == msg.sender) {
return _basicTransfer(msg.sender, recipient, amount);
} else {
return _transferFrom(msg.sender, recipient, amount);
}
}
function _basicTransfer(
address sender,
address recipient,
uint256 amount
) internal returns (bool) {
_balances[sender] = _balances[sender].sub(
amount,
"Insufficient Balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) external override returns (bool) {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if (_allowances[sender][msg.sender] != _totalSupply) {
_allowances[sender][msg.sender] = _allowances[sender][msg.sender]
.sub(amount, "Insufficient Allowance");
}
return _transferFrom(sender, recipient, amount);
}
function _transferFrom(
address sender,
address recipient,
uint256 amount
) internal returns (bool) {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if (authorizations[sender] || authorizations[recipient]) {
return _basicTransfer(sender, recipient, amount);
}
if (inSwap) {
return _basicTransfer(sender, recipient, amount);
}
checkLimits(sender, recipient, amount);
if (shouldTokenSwap(recipient)) {
tokenSwap();
}
_balances[sender] = _balances[sender].sub(
amount,
"Insufficient Balance"
);
uint256 amountReceived = (taxable &&
(recipient == pair || sender == pair))
? takeFee(sender, recipient, amount)
: amount;
_balances[recipient] = _balances[recipient].add(amountReceived);
emit Transfer(sender, recipient, amountReceived);
return true;
}
function takeFee(
address sender,
address recipient,
uint256 amount
) internal returns (uint256) {
if (isFeeExempt[sender] || isFeeExempt[recipient]) {
return amount;
}
if (recipient == OperaFactoryAddress) {
return amount;
}
uint256 _totalFee;
_totalFee = (recipient == pair) ? getSellTax() : getBuyTax();
uint256 feeAmount = amount.mul(_totalFee).div(1000);
_balances[address(this)] = _balances[address(this)].add(feeAmount);
emit Transfer(sender, address(this), feeAmount);
return amount.sub(feeAmount);
}
function getBuyTax() public view returns (uint) {
return _liquidityBuyTax + _devBuyTax + _marketingBuyTax + _operaTax;
}
function getSellTax() public view returns (uint) {
return _liquiditySellTax + _devSellTax + _marketingSellTax + _operaTax;
}
function getTotalTax() public view returns (uint) {
return getSellTax() + getBuyTax();
}
function setTaxes(
uint256 _marketingBuyPercent,
uint256 _marketingSellPercent,
uint256 _devBuyPercent,
uint256 _devSellPercent,
uint256 _liquidityBuyPercent,
uint256 _liquiditySellPercent
) external onlyOwner {
require(inSwap == false, "Cannot call when in swap");
require(taxable, "This token has no taxes.");
uint256 amount = _balances[address(this)];
if (_operaTax == 20) {
if (amount > 0) {
tokenSwap();
}
_operaTax = 4;
}
_marketingBuyTax = _marketingBuyPercent;
_liquidityBuyTax = _liquidityBuyPercent;
_devBuyTax = _devBuyPercent;
_marketingSellTax = _marketingSellPercent;
_liquiditySellTax = _liquiditySellPercent;
_devSellTax = _devSellPercent;
require(
getBuyTax() <= (borrowedLP ? 100 : 500),
"Buy tax can't be greater than 10% if borrowed lp and 50% if not."
);
require(
getSellTax() <= (borrowedLP ? 100 : 500),
"Sell tax can't be greater than 10% if borrowed lp and 50% if not."
);
}
function tokenSwap() internal swapping {
uint256 amount = _balances[address(this)];
uint256 amountToLiquify = (_liquidityBuyTax + _liquiditySellTax > 0)
? amount
.mul(_liquidityBuyTax + _liquiditySellTax)
.div(getTotalTax())
.div(2)
: 0;
uint256 amountToSwap = amount.sub(amountToLiquify);
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = WETHAddress;
uint256 balanceBefore = address(this).balance;
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
amountToSwap,
0,
path,
address(this),
block.timestamp
);
bool tmpSuccess;
uint256 amountETH = address(this).balance.sub(balanceBefore);
uint256 totalETHFee = (_liquidityBuyTax + _liquiditySellTax > 0)
? getTotalTax().sub((_liquidityBuyTax + _liquiditySellTax).div(2))
: getTotalTax();
uint256 amountETHLiquidity = amountETH
.mul(_liquidityBuyTax + _liquiditySellTax)
.div(totalETHFee)
.div(2);
if (_devBuyTax + _devSellTax > 0) {
uint256 amountETHDev = amountETH.mul(_devBuyTax + _devSellTax).div(
totalETHFee
);
(tmpSuccess, ) = payable(_devAddress).call{
value: amountETHDev,
gas: 100000
}("");
tmpSuccess = false;
}
if (_marketingBuyTax + _marketingSellTax > 0) {
uint256 amountETHMarketing = amountETH
.mul(_marketingBuyTax + _marketingSellTax)
.div(totalETHFee);
(tmpSuccess, ) = payable(_marketingAddress).call{
value: amountETHMarketing,
gas: 100000
}("");
tmpSuccess = false;
}
if (amountToLiquify > 0) {
address liqAddress = borrowedLP
? OperaFactoryAddress
: _marketingAddress;
router.addLiquidityETH{value: amountETHLiquidity}(
address(this),
amountToLiquify,
0,
0,
liqAddress,
block.timestamp
);
emit AutoLiquify(amountETHLiquidity, amountToLiquify);
}
uint256 operaFee = amountETH.mul(_operaTax.mul(2)).div(totalETHFee);
OperaRevenue rewardContract = OperaRevenue(
payable(OperaRevenueAddress)
);
rewardContract.recieveRewards{value: operaFee}();
}
function shouldTokenSwap(address recipient) internal view returns (bool) {
return ((recipient == pair) &&
taxable &&
!inSwap &&
_balances[address(this)] >= _swapThreshold);
}
function checkLimits(
address sender,
address recipient,
uint256 amount
) internal view {
if (
!authorizations[sender] &&
!authorizations[recipient] &&
recipient != address(this) &&
sender != address(this) &&
recipient != 0x000000000000000000000000000000000000dEaD &&
recipient != pair &&
recipient != _marketingAddress &&
recipient != _devAddress &&
recipient != OperaFactoryAddress
) {
uint256 heldTokens = balanceOf(recipient);
require(
(heldTokens + amount) <= _maxWalletToken,
"Total Holding is currently limited, you can not buy that much."
);
}
}
function setMaxWallet(uint256 percent) external onlyOwner {
require(inSwap == false, "Cannot call when in swap");
_maxWalletToken = (_totalSupply * percent) / 1000;
require(
_maxWalletToken >= (_totalSupply / 500),
"Max Wallet must be greater than 0.2%."
);
}
function setTokenSwapSettings(uint256 percent) external onlyOwner {
require(inSwap == false, "Cannot call when in swap");
require(taxable, "This token has no taxes.");
_swapThreshold = (_totalSupply * percent) / 1000;
require(
_swapThreshold <= (_totalSupply / 20) &&
_swapThreshold >= (_totalSupply / 500),
"Swap Threshold must be less than 5% of total supply, or greater than 0.2%."
);
}
function aboutMe() external view returns (string memory, string memory) {
return (_telegram, _website);
}
function updateAboutMe(
string memory telegram,
string memory website
) external onlyOwner {
_telegram = telegram;
_website = website;
}
function setAddresses(
address marketingAddress,
address devAddress
) external onlyOwner {
require(inSwap == false, "Cannot call when in swap");
require(taxable, "This token has no taxes.");
if (marketingAddress != address(0)) {
_marketingAddress = marketingAddress;
}
if (devAddress != address(0)) {
_devAddress = devAddress;
}
require(
_devAddress != address(0) && _marketingAddress != address(0),
"Reciever wallets can't be Zero address."
);
}
function setFeeExemption(address user, bool status) external onlyOwner {
isFeeExempt[user] = status;
}
function clearStuckBalance() external onlyOwner {
require(inSwap == false, "Cannot call when in swap");
payable(msg.sender).transfer(address(this).balance);
}
}
文件 8 的 8:SafeMath.sol
pragma solidity ^0.8.17;
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;
}
}
{
"compilationTarget": {
"OperaToken.sol": "OperaToken"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"string[]","name":"_stringData","type":"string[]"},{"internalType":"address[]","name":"_addressData","type":"address[]"},{"internalType":"uint256[]","name":"_intData","type":"uint256[]"},{"internalType":"address","name":"rewardsAddress","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":false,"internalType":"uint256","name":"amountETH","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountCoin","type":"uint256"}],"name":"AutoLiquify","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"}],"name":"OwnershipTransferred","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":[],"name":"OperaFactoryAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OperaRevenueAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETHAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_devAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_devBuyTax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_devSellTax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_liquidityBuyTax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_liquiditySellTax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_marketingAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_marketingBuyTax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_marketingSellTax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_maxWalletToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_operaTax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_swapThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"aboutMe","outputs":[{"internalType":"string","name":"","type":"string"},{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"approveMax","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"adr","type":"address"}],"name":"authorize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"borrowedLP","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"clearStuckBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getBuyTax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSellTax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalTax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"adr","type":"address"}],"name":"isAuthorized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"contract IDEXRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"routerAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"marketingAddress","type":"address"},{"internalType":"address","name":"devAddress","type":"address"}],"name":"setAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"bool","name":"status","type":"bool"}],"name":"setFeeExemption","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"percent","type":"uint256"}],"name":"setMaxWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_marketingBuyPercent","type":"uint256"},{"internalType":"uint256","name":"_marketingSellPercent","type":"uint256"},{"internalType":"uint256","name":"_devBuyPercent","type":"uint256"},{"internalType":"uint256","name":"_devSellPercent","type":"uint256"},{"internalType":"uint256","name":"_liquidityBuyPercent","type":"uint256"},{"internalType":"uint256","name":"_liquiditySellPercent","type":"uint256"}],"name":"setTaxes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"percent","type":"uint256"}],"name":"setTokenSwapSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"taxable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","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":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"adr","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"adr","type":"address"}],"name":"unauthorize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"telegram","type":"string"},{"internalType":"string","name":"website","type":"string"}],"name":"updateAboutMe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]