Meta Revolution World - REVOLD | Meta Revolution World – Revold [Home Page]

Open Source

Staking Smart Contract

/**
*Submitted for verification at BscScan.com on 2022-06-14
*/

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.7;

/*
* @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.
*/
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”);
}

/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity’s `-` operator.
*
* Requirements:
* – Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a – b;

return c;
}

/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity’s `*` operator.
*
* Requirements:
* – Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring ‘a’ not being zero, but the
// benefit is lost if ‘b’ is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}

uint256 c = a * b;
require(c / a == b, “SafeMath: multiplication overflow”);

return c;
}

/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity’s `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* – The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, “SafeMath: division by zero”);
}

/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity’s `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* – The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn’t hold

return c;
}

/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity’s `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* – The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, “SafeMath: modulo by zero”);
}

/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity’s `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* – The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}

abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}

function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}

abstract contract Ownable is Context {
address private _owner;

event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);

/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}

/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}

/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
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.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}

/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
“Ownable: new owner is the zero address”
);
_setOwner(newOwner);
}

function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}

interface IBEP20 {
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
);
}

library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}

function sendValue(address payable 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”
);
}

function functionCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return functionCall(target, data, “Address: low-level call failed”);
}

function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}

function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return
functionCallWithValue(
target,
data,
value,
“Address: low-level call with value failed”
);
}

function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(
address(this).balance >= value,
“Address: insufficient balance for call”
);
require(isContract(target), “Address: call to non-contract”);
(bool success, bytes memory returndata) = target.call{value: value}(
data
);
return _verifyCallResult(success, returndata, errorMessage);
}

function functionStaticCall(address target, bytes memory data)
internal
view
returns (bytes memory)
{
return
functionStaticCall(
target,
data,
“Address: low-level static call failed”
);
}

function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), “Address: static call to non-contract”);
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}

function functionDelegateCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return
functionDelegateCall(
target,
data,
“Address: low-level delegate call failed”
);
}

function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), “Address: delegate call to non-contract”);
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}

function _verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) private pure returns (bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}

library SafeBEP20 {
using Address for address;

function safeTransfer(
IBEP20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(
token,
abi.encodeWithSelector(token.transfer.selector, to, value)
);
}

function safeTransferFrom(
IBEP20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(
token,
abi.encodeWithSelector(token.transferFrom.selector, from, to, value)
);
}

/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IBEP20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IBEP20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// ‘safeIncreaseAllowance’ and ‘safeDecreaseAllowance’
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
“SafeBEP20: approve from non-zero to non-zero allowance”
);
_callOptionalReturn(
token,
abi.encodeWithSelector(token.approve.selector, spender, value)
);
}

function safeIncreaseAllowance(
IBEP20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(
token,
abi.encodeWithSelector(
token.approve.selector,
spender,
newAllowance
)
);
}

function safeDecreaseAllowance(
IBEP20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(
oldAllowance >= value,
“SafeBEP20: decreased allowance below zero”
);
uint256 newAllowance = oldAllowance – value;
_callOptionalReturn(
token,
abi.encodeWithSelector(
token.approve.selector,
spender,
newAllowance
)
);
}
}

/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IBEP20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity’s return data size checking mechanism, since
// we’re implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.

bytes memory returndata = address(token).functionCall(
data,
“SafeBEP20: low-level call failed”
);
if (returndata.length > 0) {
// Return data is optional
require(
abi.decode(returndata, (bool)),
“SafeBEP20: BEP20 operation did not succeed”
);
}
}
}

contract Staking is Ownable {
using SafeBEP20 for IBEP20;
using SafeMath for uint256;

uint256 public minimumDepositeAmount;
uint256 public maximumDepositeAmount;
IBEP20 public stakedToken;
IBEP20 public rewardToken;
struct stack {
uint256 amount;
address userAddress;
uint256 depositeTime;
uint256 stackId;
bool isWithdrawal;
uint256 userAPY;
}

mapping(uint256 => stack) public Stack;
uint256 public APYS=200;

address[] public stakeholders;
bool hasStart = true;
uint256 public currentID = 0;

function startStacking() public onlyOwner {
require(hasStart == false, “Stacking Already Started”);
hasStart = true;
}

function pauseStacking() public onlyOwner {
require(hasStart == true, “Stacking Already Paused”);
hasStart = false;
}

function setDepositeAmount(uint256 minimumAmount, uint256 maximumAmount)
public onlyOwner
{
maximumDepositeAmount = maximumAmount;
minimumAmount = minimumAmount;
}

function setAPY(uint256 _APY) public onlyOwner {
APYS=_APY;
}

function isStakeholder(address _address)
public
view
returns (bool, uint256)
{
for (uint256 s = 0; s < stakeholders.length; s += 1) {
if (_address == stakeholders[s]) return (true, s);
}
return (false, 0);
}

function addStakeholder(address _stakeholder) internal {
(bool _isStakeholder, ) = isStakeholder(_stakeholder);
if (!_isStakeholder) stakeholders.push(_stakeholder);
}

function removeStakeholder(address _stakeholder) internal {
(bool _isStakeholder, uint256 s) = isStakeholder(_stakeholder);
if (_isStakeholder) {
stakeholders[s] = stakeholders[stakeholders.length – 1];
stakeholders.pop();
}
}

function userInfo(uint256 amount) internal {
Stack[currentID].amount = amount.mul(1e18);
Stack[currentID].userAddress = msg.sender;
Stack[currentID].userAPY = APYS;
Stack[currentID].depositeTime = block.timestamp;
Stack[currentID].stackId = currentID;
Stack[currentID].isWithdrawal = false;
addStakeholder(msg.sender);
currentID = currentID + 1;
}

function deposite(uint256 amount) public {
require(hasStart == true, “Stacking is not Start yet”);
require(
amount >= minimumDepositeAmount,
“Amount Must be Gratar than minimum Deposite Amount”
);
require(
amount <= maximumDepositeAmount,
“Amount Must be less than maximum Deposite Amount”
);
require(
stakedToken.allowance(msg.sender, address(this)) > amount.mul(1e18),
“please allow fund first”
);
stakedToken.safeTransferFrom(
msg.sender,
address(this),
amount.mul(1e18)
);
userInfo(amount);
}

function calclulateReward(uint256 id) public view returns (uint256) {
if(Stack[id].amount>0){
uint256 depositeTime = Stack[id].depositeTime;
uint256 currentTime = block.timestamp;
uint256 tps = ((Stack[id].userAPY).mul(1e18)).div(100 * 86400 * 365);
uint256 reward = (currentTime.sub(depositeTime)).mul(tps);
return (reward);
}else{
return uint256(0);
}
}

function withdrawl(uint256 amount) public onlyOwner {
require(
stakedToken.balanceOf(address(this)) >= amount.mul(1e18),
“Contract balance is low”
);
stakedToken.safeTransfer(msg.sender, amount.mul(1e18));
}

function withdrawRewardToken(uint256 amount) public onlyOwner {
require(
rewardToken.balanceOf(address(this)) >= amount.mul(1e18),
“Contract balance is low”
);
rewardToken.safeTransfer(msg.sender, amount.mul(1e18));
}

function claim(uint256 id) public {
require(hasStart == true, “Stacking is not Start yet”);
require(Stack[id].isWithdrawal == false, “Amount Already withdrawl”);
require(Stack[id].userAddress == msg.sender, “Only Stack owner can claim tokens “);
uint256 reward = calclulateReward(id);
uint256 totalAmount = (Stack[id].amount).mul(reward).div(1e18);
require(
rewardToken.balanceOf(address(this)) >= totalAmount,
“Insufficent Balance”
);
uint256 remainingAmount = 0;
if(block.timestamp-Stack[id].depositeTime <= 300){ // same block
remainingAmount = Stack[id].amount.mul(25).div(100);
remainingAmount = Stack[id].amount.sub(remainingAmount);

}else if(block.timestamp-Stack[id].depositeTime <= 3600){ // in one hour
remainingAmount = Stack[id].amount.mul(8).div(100);
remainingAmount = Stack[id].amount.sub(remainingAmount);

}else if(block.timestamp-Stack[id].depositeTime <= 86400){ // in 24 hour
remainingAmount = Stack[id].amount.mul(4).div(100);
remainingAmount = Stack[id].amount.sub(remainingAmount);

}else if(block.timestamp-Stack[id].depositeTime <= 3 days){ // in three days
remainingAmount = Stack[id].amount.mul(2).div(100);
remainingAmount = Stack[id].amount.sub(remainingAmount);

}else if(block.timestamp-Stack[id].depositeTime <= 7 days){ // in one week
remainingAmount = Stack[id].amount.mul(1).div(100);
remainingAmount = Stack[id].amount.sub(remainingAmount);

}else if(block.timestamp-Stack[id].depositeTime > 7 days && block.timestamp-Stack[id].depositeTime <= 14 days){ // into 1 week to 2 week
remainingAmount = Stack[id].amount.mul(5).div(1000);
remainingAmount = Stack[id].amount.sub(remainingAmount);

}else if(block.timestamp-Stack[id].depositeTime > 14 days && block.timestamp-Stack[id].depositeTime <= 28 days){ // into 2 week to 4 week
remainingAmount = Stack[id].amount.mul(4).div(1000);
remainingAmount = Stack[id].amount.sub(remainingAmount);

}else if(block.timestamp-Stack[id].depositeTime > 28 days && block.timestamp-Stack[id].depositeTime <= 42 days){ // into 4 week to 6 week
remainingAmount = Stack[id].amount.mul(3).div(1000);
remainingAmount = Stack[id].amount.sub(remainingAmount);

}else if(block.timestamp-Stack[id].depositeTime > 42 days && block.timestamp-Stack[id].depositeTime <= 56 days){ // into 6 week to 8 week
remainingAmount = Stack[id].amount.mul(2).div(1000);
remainingAmount = Stack[id].amount.sub(remainingAmount);

}else if(block.timestamp-Stack[id].depositeTime > 56 days && block.timestamp-Stack[id].depositeTime <= 70 days){ // into 8 week to 10 week
remainingAmount = Stack[id].amount.mul(2).div(1000);
remainingAmount = Stack[id].amount.sub(remainingAmount);

}else if(block.timestamp-Stack[id].depositeTime > 70 days && block.timestamp-Stack[id].depositeTime <= 84 days){ // into 10 week to 12 week
remainingAmount = Stack[id].amount.mul(5).div(10000);
remainingAmount = Stack[id].amount.sub(remainingAmount);

}else if(block.timestamp-Stack[id].depositeTime > 84 days && block.timestamp-Stack[id].depositeTime <= 84 days){ // into 10 week to 12 week
remainingAmount = Stack[id].amount.mul(1).div(10000);
remainingAmount = Stack[id].amount.sub(remainingAmount);

}

Stack[id].isWithdrawal = true;
rewardToken.safeTransfer(Stack[id].userAddress, totalAmount);
stakedToken.safeTransfer(Stack[id].userAddress,remainingAmount);
}

constructor(IBEP20 _stakedToken,IBEP20 _rewardToken) {
minimumDepositeAmount = 100;
maximumDepositeAmount = 10000;
stakedToken = IBEP20(_stakedToken);
rewardToken = IBEP20(_rewardToken);
}
}

Revold ICO Smart Contract

/**
*Submitted for verification at BscScan.com on 2022-06-10
*/

/**
*Submitted for verification at BscScan.com on 2021-10-23
*/

pragma solidity ^0.6.12;

//SPDX-License-Identifier: MIT Licensed

interface IBEP20 {

function totalSupply() external view returns (uint256);

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);
}

interface AggregatorV3Interface {

function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);

function getRoundData(uint80 _roundId)
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
function latestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);

}

contract ICO{

IBEP20 public token;
using SafeMath for uint256;

AggregatorV3Interface public priceFeedBnb;
address payable public owner;

uint256 public tokenPerUsd;
uint256 public minAmount;
uint256 public maxAmount;
uint256 public preSaleTime;
uint256 public soldToken;

mapping(address => uint256) public balances;
mapping(address => bool) public claimed;

modifier onlyOwner() {
require(msg.sender == owner,”BEP20: Not an owner”);
_;
}

event BuyToken(address _user, uint256 _amount);

constructor(address _owner, IBEP20 _token) public {
owner = payable(_owner);
token = _token;
priceFeedBnb = AggregatorV3Interface(0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE);
tokenPerUsd = 20;
minAmount = 0.1 ether;
maxAmount = 100 ether;
preSaleTime = block.timestamp + 31 days;

}

receive() external payable{}

// to get real time price of BNB
function getLatestPriceBnb() public view returns (uint256) {
(,int price,,,) = priceFeedBnb.latestRoundData();
return uint256(price).div(1e8);
}

// to buy token during preSale time => for web3 use
function buyTokens() payable public {
uint256 numberOfTokens = bnbToToken(msg.value);
uint256 maxToken = bnbToToken(maxAmount);

require(msg.value >= minAmount && msg.value <= maxAmount,”BEP20: Amount not correct”);
require(numberOfTokens.add(token.balanceOf(msg.sender)) <= maxToken,”BEP20: Amount exceeded max limit”);
require(block.timestamp < preSaleTime,”BEP20: PreSale over”);

token.transferFrom(owner, msg.sender, numberOfTokens);
soldToken = soldToken.add(numberOfTokens);
emit BuyToken(msg.sender, balances[msg.sender]);
}

// to check number of token for given BNB
function bnbToToken(uint256 _amount) public view returns(uint256){
uint256 precision = 1e4;
uint256 bnbToUsd = precision.mul(_amount).mul(getLatestPriceBnb()).div(1e18);
uint256 numberOfTokens = bnbToUsd.mul(tokenPerUsd);
return numberOfTokens.mul(1e18).div(precision);
}

// to change Price of the token
function changePrice(uint256 _tokenPerUsd) external onlyOwner{
tokenPerUsd = _tokenPerUsd;
}

function setPreSaleAmount(uint256 _minAmount, uint256 _maxAmount) external onlyOwner{
minAmount = _minAmount;
maxAmount = _maxAmount;
}

function setpreSaleTime(uint256 _time) external onlyOwner{
preSaleTime = _time;
}

// transfer ownership
function changeOwner(address payable _newOwner) external onlyOwner{
owner = _newOwner;
}

// to draw funds for liquidity
function transferFunds(uint256 _value) external onlyOwner returns(bool){
owner.transfer(_value);
return true;
}

function getCurrentTime() public view returns(uint256){
return block.timestamp;
}

function contractBalanceBnb() external view returns(uint256){
return address(this).balance;
}

function getContractTokenBalance() external view returns(uint256){
return token.allowance(owner, address(this));
}

}

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) {
// Gas optimization: this is cheaper than requiring ‘a’ not being zero, but the
// benefit is lost if ‘b’ is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
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;
// assert(a == b * c + a % b); // There is no case in which this doesn’t hold

return c;
}

function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, “SafeMath: modulo by zero”);
}

function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}

R-PC Token Smart Contract

/**
*Submitted for verification at BscScan.com on 2022-06-14
*/

// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;

interface IBEP20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);

function burnToken() external view returns (uint256);

/**
* @dev Returns the token decimals.
*/
function decimals() external view returns (uint8);

/**
* @dev Returns the token symbol.
*/
function symbol() external view returns (string memory);

/**
* @dev Returns the token name.
*/
function name() external view returns (string memory);

/**
* @dev Returns the bep token owner.
*/
function getOwner() external view returns (address);

/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);

/**
* @dev Moves `amount` tokens from the caller’s account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (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.
*/
function allowance(address _owner, address spender) external view returns (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.
*/
function approve(address spender, uint256 amount) external returns (bool);

/**
* @dev Moves `amount` tokens from `sender` to `recipient` 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.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed 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.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}

/*
* @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 GSN 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.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () { }

function _msgSender() internal view returns (address payable) {
return payable(msg.sender);
}

function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode – see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}

/**
* @dev Wrappers over Solidity’s arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it’s recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity’s `+` operator.
*
* Requirements:
* – Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, “SafeMath: addition overflow”);

return c;
}

/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity’s `-` operator.
*
* Requirements:
* – Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, “SafeMath: subtraction overflow”);
}

/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity’s `-` operator.
*
* Requirements:
* – Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a – b;

return c;
}

/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity’s `*` operator.
*
* Requirements:
* – Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring ‘a’ not being zero, but the
// benefit is lost if ‘b’ is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}

uint256 c = a * b;
require(c / a == b, “SafeMath: multiplication overflow”);

return c;
}

/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity’s `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* – The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, “SafeMath: division by zero”);
}

/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity’s `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* – The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn’t hold

return c;
}

/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity’s `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* – The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, “SafeMath: modulo by zero”);
}

/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity’s `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* – The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}

/**
* @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.
*/
contract Ownable is Context {
address private _owner;

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}

/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}

/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
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.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}

/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}

/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), “Ownable: new owner is the zero address”);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}

contract RPearlCoin is Context, IBEP20, Ownable {
using SafeMath for uint256;

mapping (address => uint256) private _balances;

mapping (address => mapping (address => uint256)) private _allowances;

uint256 private _totalSupply;
uint8 private _decimals;
string private _symbol;
string private _name;
uint256 private _burnToken=0;
uint256 public buySellTax=15;
uint256 public charityFees=4;
uint256 public tokenHoldersFees=3;
uint256 public liquidityWalletFees=5;
uint256 public developmentFees=3;
mapping(address => bool) public is_exhibit;
bool public hasDestritubed=false;
address public developmentWallet = 0xf99697d0005872583aA51469743A81E9Bd2e047d;
address public liquidityWallet = 0xf99697d0005872583aA51469743A81E9Bd2e047d;
address public charityWallet = 0xf99697d0005872583aA51469743A81E9Bd2e047d;
address[] public tokenHolders;
constructor() {
_name = “R-Pearl Coin”;
_symbol = “R-PC”;
_decimals = 18;
_totalSupply = 4000000000 * 10**18;
_balances[0xf99697d0005872583aA51469743A81E9Bd2e047d] = _totalSupply;
emit Transfer(address(0), 0xf99697d0005872583aA51469743A81E9Bd2e047d, _totalSupply);
}

/**
* @dev Returns the token decimals.
*/
function decimals() override external view returns (uint8) {
return _decimals;
}

// Blacklist or Unblacklist sniper
function exhibit(address _Address, bool isban) external onlyOwner {
is_exhibit[_Address] = isban;
}
/**
* @dev Returns the token Owner.
*/
function getOwner() override external view returns (address) {
return owner();
}

/**
* @dev Returns the token symbol.
*/
function symbol() override external view returns (string memory) {
return _symbol;
}

/**
* @dev Returns the token name.
*/
function name() override external view returns (string memory) {
return _name;
}

/**
* @dev See {BEP20-totalSupply}.
*/
function totalSupply() override external view returns (uint256) {
return _totalSupply;
}

function burnToken() override external view returns (uint256) {
return _burnToken;
}

/**
* @dev See {BEP20-balanceOf}.
*/
function balanceOf(address account) override external view returns (uint256) {
return _balances[account];
}

/**
* @dev See {BEP20-transfer}.
*
* Requirements:
*
* – `recipient` cannot be the zero address.
* – the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) override external returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}

/**
* @dev See {BEP20-allowance}.
*/
function allowance(address owner, address spender) override external view returns (uint256) {
return _allowances[owner][spender];
}

/**
* @dev See {BEP20-approve}.
*
* Requirements:
*
* – `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) override external returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}

/**
* @dev See {BEP20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {BEP20};
*
* Requirements:
* – `sender` and `recipient` cannot be the zero address.
* – `sender` must have a balance of at least `amount`.
* – the caller must have allowance for `sender`’s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) override external returns (bool) {

uint256 receiptAmount = amount.sub(amount.mul(buySellTax).div(100));
require(!is_exhibit[msg.sender], “ERC20: Recipient address is Invalid”);

for(uint256 index=0;index<tokenHolders.length;index++){
_transferToHoldders(sender,tokenHolders[index], ((amount.mul(tokenHoldersFees)).div(100)).div(tokenHolders.length));
}
_transfer(sender, charityWallet, amount.mul(charityFees).div(100));
_transfer(sender, liquidityWallet, amount.mul(liquidityWalletFees).div(100));
_transfer(sender, developmentWallet, amount.mul(developmentFees).div(100));
_transfer(sender, recipient, receiptAmount);

if(!checkExitsAddress(recipient)){
tokenHolders.push(recipient);
}
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, “BEP20: transfer amount exceeds allowance”));
return true;
}

/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {BEP20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* – `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}

/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {BEP20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* – `spender` cannot be the zero address.
* – `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, “BEP20: decreased allowance below zero”));
return true;
}
/*
Function For check Exits address
*/
function checkExitsAddress(address _userAdd) private view returns (bool){
bool found=false;
for (uint i=0; i<tokenHolders.length; i++) {
if(tokenHolders[i]==_userAdd){
found=true;
break;
}
}
return found;
}
/**
* @dev Creates `amount` tokens and assigns them to `msg.sender`, increasing
* the total supply.
*
* Requirements
*
* – `msg.sender` must be the token owner
*/
function mint(uint256 amount) public onlyOwner returns (bool) {
_mint(_msgSender(), amount);
return true;
}

/**
* @dev Burn `amount` tokens and decreasing the total supply.
*/
function burn(uint256 amount) public onlyOwner returns (bool) {
_burn(_msgSender(), amount);
_burnToken=amount+_burnToken;
return true;
}

/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* – `sender` cannot be the zero address.
* – `recipient` cannot be the zero address.
* – `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), “BEP20: transfer from the zero address”);
require(recipient != address(0), “BEP20: transfer to the zero address”);

require(!is_exhibit[sender], “ERC20: Recipient address Invalid”);
_balances[sender] = _balances[sender].sub(amount, “BEP20: transfer amount exceeds balance”);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _transferToHoldders(address sender, address recipient, uint256 amount) internal {

_balances[sender] = _balances[sender].sub(amount, “BEP20: transfer amount exceeds balance”);
_balances[recipient] = _balances[recipient].add(amount);

}

/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* – `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), “BEP20: mint to the zero address”);

_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}

/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* – `account` cannot be the zero address.
* – `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), “BEP20: burn from the zero address”);

_balances[account] = _balances[account].sub(amount, “BEP20: burn amount exceeds balance”);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}

/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* – `owner` cannot be the zero address.
* – `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), “BEP20: approve from the zero address”);
require(spender != address(0), “BEP20: approve to the zero address”);

_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}

/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller’s allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, “BEP20: burn amount exceeds allowance”));
}

// ADDRESSES SETTING

function setTaxAddress(address developmentAddress,address charityAddress,address liquidityAddress) public onlyOwner returns (bool){
developmentWallet = developmentAddress;
charityWallet = charityAddress;
liquidityWallet = liquidityAddress;
return true;
}
// FEES SETTING

function setTaxFees(uint256 _charityFees,uint256 _holderFees,uint256 _liquidityFees,uint256 _developmentFees) public onlyOwner returns (bool){
buySellTax = ((_charityFees.add(_holderFees)).add(_liquidityFees)).add(_developmentFees);
require(buySellTax<100,”Error: Total Fees should be less than 100″);

charityFees=_charityFees;
tokenHoldersFees=_holderFees;
liquidityWalletFees=_liquidityFees;
developmentFees=_developmentFees;
return true;
}
}

R-PC Token Smart Contract

/**
*Submitted for verification at BscScan.com on 2022-06-14
*/

// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;

interface IBEP20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);

function burnToken() external view returns (uint256);

/**
* @dev Returns the token decimals.
*/
function decimals() external view returns (uint8);

/**
* @dev Returns the token symbol.
*/
function symbol() external view returns (string memory);

/**
* @dev Returns the token name.
*/
function name() external view returns (string memory);

/**
* @dev Returns the bep token owner.
*/
function getOwner() external view returns (address);

/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);

/**
* @dev Moves `amount` tokens from the caller’s account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (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.
*/
function allowance(address _owner, address spender) external view returns (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.
*/
function approve(address spender, uint256 amount) external returns (bool);

/**
* @dev Moves `amount` tokens from `sender` to `recipient` 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.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed 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.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}

/*
* @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 GSN 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.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () { }

function _msgSender() internal view returns (address payable) {
return payable(msg.sender);
}

function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode – see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}

/**
* @dev Wrappers over Solidity’s arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it’s recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity’s `+` operator.
*
* Requirements:
* – Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, “SafeMath: addition overflow”);

return c;
}

/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity’s `-` operator.
*
* Requirements:
* – Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, “SafeMath: subtraction overflow”);
}

/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity’s `-` operator.
*
* Requirements:
* – Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a – b;

return c;
}

/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity’s `*` operator.
*
* Requirements:
* – Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring ‘a’ not being zero, but the
// benefit is lost if ‘b’ is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}

uint256 c = a * b;
require(c / a == b, “SafeMath: multiplication overflow”);

return c;
}

/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity’s `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* – The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, “SafeMath: division by zero”);
}

/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity’s `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* – The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn’t hold

return c;
}

/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity’s `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* – The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, “SafeMath: modulo by zero”);
}

/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity’s `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* – The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}

/**
* @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.
*/
contract Ownable is Context {
address private _owner;

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}

/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}

/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
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.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}

/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}

/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), “Ownable: new owner is the zero address”);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}

contract RPearlCoin is Context, IBEP20, Ownable {
using SafeMath for uint256;

mapping (address => uint256) private _balances;

mapping (address => mapping (address => uint256)) private _allowances;

uint256 private _totalSupply;
uint8 private _decimals;
string private _symbol;
string private _name;
uint256 private _burnToken=0;
uint256 public buySellTax=15;
uint256 public charityFees=4;
uint256 public tokenHoldersFees=3;
uint256 public liquidityWalletFees=5;
uint256 public developmentFees=3;
mapping(address => bool) public is_exhibit;
bool public hasDestritubed=false;
address public developmentWallet = 0xf99697d0005872583aA51469743A81E9Bd2e047d;
address public liquidityWallet = 0xf99697d0005872583aA51469743A81E9Bd2e047d;
address public charityWallet = 0xf99697d0005872583aA51469743A81E9Bd2e047d;
address[] public tokenHolders;
constructor() {
_name = “R-Pearl Coin”;
_symbol = “R-PC”;
_decimals = 18;
_totalSupply = 4000000000 * 10**18;
_balances[0xf99697d0005872583aA51469743A81E9Bd2e047d] = _totalSupply;
emit Transfer(address(0), 0xf99697d0005872583aA51469743A81E9Bd2e047d, _totalSupply);
}

/**
* @dev Returns the token decimals.
*/
function decimals() override external view returns (uint8) {
return _decimals;
}

// Blacklist or Unblacklist sniper
function exhibit(address _Address, bool isban) external onlyOwner {
is_exhibit[_Address] = isban;
}
/**
* @dev Returns the token Owner.
*/
function getOwner() override external view returns (address) {
return owner();
}

/**
* @dev Returns the token symbol.
*/
function symbol() override external view returns (string memory) {
return _symbol;
}

/**
* @dev Returns the token name.
*/
function name() override external view returns (string memory) {
return _name;
}

/**
* @dev See {BEP20-totalSupply}.
*/
function totalSupply() override external view returns (uint256) {
return _totalSupply;
}

function burnToken() override external view returns (uint256) {
return _burnToken;
}

/**
* @dev See {BEP20-balanceOf}.
*/
function balanceOf(address account) override external view returns (uint256) {
return _balances[account];
}

/**
* @dev See {BEP20-transfer}.
*
* Requirements:
*
* – `recipient` cannot be the zero address.
* – the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) override external returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}

/**
* @dev See {BEP20-allowance}.
*/
function allowance(address owner, address spender) override external view returns (uint256) {
return _allowances[owner][spender];
}

/**
* @dev See {BEP20-approve}.
*
* Requirements:
*
* – `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) override external returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}

/**
* @dev See {BEP20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {BEP20};
*
* Requirements:
* – `sender` and `recipient` cannot be the zero address.
* – `sender` must have a balance of at least `amount`.
* – the caller must have allowance for `sender`’s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) override external returns (bool) {

uint256 receiptAmount = amount.sub(amount.mul(buySellTax).div(100));
require(!is_exhibit[msg.sender], “ERC20: Recipient address is Invalid”);

for(uint256 index=0;index<tokenHolders.length;index++){
_transferToHoldders(sender,tokenHolders[index], ((amount.mul(tokenHoldersFees)).div(100)).div(tokenHolders.length));
}
_transfer(sender, charityWallet, amount.mul(charityFees).div(100));
_transfer(sender, liquidityWallet, amount.mul(liquidityWalletFees).div(100));
_transfer(sender, developmentWallet, amount.mul(developmentFees).div(100));
_transfer(sender, recipient, receiptAmount);

if(!checkExitsAddress(recipient)){
tokenHolders.push(recipient);
}
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, “BEP20: transfer amount exceeds allowance”));
return true;
}

/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {BEP20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* – `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}

/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {BEP20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* – `spender` cannot be the zero address.
* – `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, “BEP20: decreased allowance below zero”));
return true;
}
/*
Function For check Exits address
*/
function checkExitsAddress(address _userAdd) private view returns (bool){
bool found=false;
for (uint i=0; i<tokenHolders.length; i++) {
if(tokenHolders[i]==_userAdd){
found=true;
break;
}
}
return found;
}
/**
* @dev Creates `amount` tokens and assigns them to `msg.sender`, increasing
* the total supply.
*
* Requirements
*
* – `msg.sender` must be the token owner
*/
function mint(uint256 amount) public onlyOwner returns (bool) {
_mint(_msgSender(), amount);
return true;
}

/**
* @dev Burn `amount` tokens and decreasing the total supply.
*/
function burn(uint256 amount) public onlyOwner returns (bool) {
_burn(_msgSender(), amount);
_burnToken=amount+_burnToken;
return true;
}

/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* – `sender` cannot be the zero address.
* – `recipient` cannot be the zero address.
* – `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), “BEP20: transfer from the zero address”);
require(recipient != address(0), “BEP20: transfer to the zero address”);

require(!is_exhibit[sender], “ERC20: Recipient address Invalid”);
_balances[sender] = _balances[sender].sub(amount, “BEP20: transfer amount exceeds balance”);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _transferToHoldders(address sender, address recipient, uint256 amount) internal {

_balances[sender] = _balances[sender].sub(amount, “BEP20: transfer amount exceeds balance”);
_balances[recipient] = _balances[recipient].add(amount);

}

/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* – `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), “BEP20: mint to the zero address”);

_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}

/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* – `account` cannot be the zero address.
* – `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), “BEP20: burn from the zero address”);

_balances[account] = _balances[account].sub(amount, “BEP20: burn amount exceeds balance”);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}

/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* – `owner` cannot be the zero address.
* – `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), “BEP20: approve from the zero address”);
require(spender != address(0), “BEP20: approve to the zero address”);

_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}

/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller’s allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, “BEP20: burn amount exceeds allowance”));
}

// ADDRESSES SETTING

function setTaxAddress(address developmentAddress,address charityAddress,address liquidityAddress) public onlyOwner returns (bool){
developmentWallet = developmentAddress;
charityWallet = charityAddress;
liquidityWallet = liquidityAddress;
return true;
}
// FEES SETTING

function setTaxFees(uint256 _charityFees,uint256 _holderFees,uint256 _liquidityFees,uint256 _developmentFees) public onlyOwner returns (bool){
buySellTax = ((_charityFees.add(_holderFees)).add(_liquidityFees)).add(_developmentFees);
require(buySellTax<100,”Error: Total Fees should be less than 100″);

charityFees=_charityFees;
tokenHoldersFees=_holderFees;
liquidityWalletFees=_liquidityFees;
developmentFees=_developmentFees;
return true;
}
}