error
contracts/Zoe_cash_UpgradableV1.sol:151:7: ParserError: Expected pragma, import directive or contract/interface/library/struct/enum/constant/function definition.
constructor(address _stakingAddress, address _PRIVATE_OFFER_ADDRESS) public {
^---------^
Error HH600: Compilation failed
…/code
// SPDX-License-Identifier: UNLICENSED
// Contrato actualizable creado por Fidubit S.A.S
// Contrato de trabajo y prestamos para freelancers
// https://zoe.cash
// Zoe cash es un token creado en español, con el fin de proveer servicios fintech y de trabajo Part-time a emigrantes de origen Hispanohablante
// Freelancers + prestamos rapidos para freelancers ++ Unico Token en el mundo donde podrás pagar un prestamo con trabajo remunerado, sin colaterales para stakers y Freelancers nivel 2
//este contrato no tiene presales, su distribucion inicial es por medio de Airdrop
pragma solidity ^0.7.6;
import "./IERC20Upgradeable.sol";
import "./IERC20MetadataUpgradeable.sol";
import "./utils/ContextUpgradeable.sol";
import "./proxy/Initializable.sol";
import "./Zoe_cash_staking.sol";
import "./BaseRelayRecipient.sol";
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function ceil(uint a, uint m) internal pure returns (uint r) {
return (a + m - 1) / m * m;
}
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address payable public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner, "Only allowed by owner");
_;
}
function transferOwnership(address payable _newOwner) external onlyOwner {
require(_newOwner != address(0),"Invalid address passed");
owner = _newOwner;
emit OwnershipTransferred(msg.sender, _newOwner);
}
}
//
//** Zoe cash token detalles de contrato mercado deflacionario */
// Fidubit S.A.S - Colombia
// ----------------------------------------------------------------------------
// 'ZOE CASH Deflactionary Defi work Token' token contract
// Symbol : ZOE
// Name : Zoe Cash
// Total supply: 100,000,000 (100 Millions)
// Decimals : 6
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable,zoe_cash_staking,EIP712MetaTransaction,BaseRelayRecipient {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
string public constant symbol ="ZOE";
string public constant name = "ZOE CASH";
uint256 public constant Decimals = 18;
uint256 private _totalSupply =100000000 * 10 ** (decimals);
uint256 public tax = 1;
// definir direcciones de staking, oferta privada, impuestos sobre la transaccion.
address public STAKING_ADDRESS;
address public PRIVATE_OFFER_ADDRESS;
address public Taxreceiver; // 1% de cada transaccion serán transferidos a wallet privada
address public AIRDROP_ADDRESS;
mapping(address => mapping(address => uint256)) private allowed;
event TaxChanged(uint256 newTax, address changedBy);
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
// forward order para reducir los fees del contrato
/**
* Set the trustedForwarder address either in constructor or
* in other init function in your contract
*/
constructor(address _trustedForwarder) public {
trustedForwarder = _trustedForwarder;
}
function versionRecipient() external view override returns (string memory) {
return "1";
}
}
//Constructor direcciones para Disribuir tokens
constructor(address _stakingAddress, address _PRIVATE_OFFER_ADDRESS) public {
taxReceiver = 0x8D74DaBe71b1b95b4e4c90E5A97850FEB9C20855; // Genosis safe proxy Wallet multisig for Secure contract and tokens recovery 6-2 multisig wallet
owner = 0x0aBbA6A9fBe9AD8492866023924aACE1393D413b; // Genosis safe proxy Wallet multisig for Secure contract and tokens recovery 6-2 multisig wallet
STAKING_ADDRESS= _stakingAddress;
PRIVATE_OFFER_ADDRESS = _PRIVATE_OFFER_ADDRESS;
Airdrop_Address = _Airdrop_Address;
Listing&Marketing_Address =_Listing&MarketingAddress;
MainnetFreelancersLaunchAddress = _MainnetFreelancersLaunchAddress;
CapitalforLoans&DebitcardAddress = _CapitalforLoans&DebitcardAddress;
Ecosystem = _EcosystemAddress;
airdrop = _AirdropAddress;
CEO_Address =_CEO_Address;
}
//distribuir los montos de manera inicial
STAKING_ADDRESS = 100000000 * 10 ** (decimals); //se usa ether para remplazar la funcion *10 **(decimals) // Tokens for provide rewards to stakeholders
PRIVATE_OFFER_ADDRESS =20000000 ether; // 50.000.000 de tokens sera distribuidor para venta privada // 50,000,000 will be private sales
AIRDROP_ADDRESS = 10000000 ether; // 10.000.000 de tokens para airdrops gratuitos // Free Airdrops
Listing&MarketingAddress = 10000000 ether; // 10.000.000 para pagar los costos de publicidad,marketing,listings, SEO- SEM // listings feee, Marketing
MainnetFreelancersLaunchAddress = 5000000 ether // 5.000.000 Costo de nuevos desarrollos, sostener cadenas de bloques, servidores, Mainnet // Mainnet support cost
CapitalforLoans&DebitcardAddress = 5000000 ether // 5.000.000 Capital de respaldo para Trocas de posicion y prestamos rapidos a Freelancers / Flash loans for freelancers
EcosystemAddress = 20000000 ether // 20.000.000 para ecosystem Zoe CASH
Developers_Address = 5000000 ether; //5.000.000 de tokens para pagar
CEO_Address = 5000000 ether; // tokens de reserva enviados al CEO del token
balances[owner] = totalSupply();
emit Transfer(address(0), owner, totalSupply());
}
// definir impuestos para reducir total supply
function ChangeTax(uint256 _newTax) external onlyOwner{
require(_newTax <= 5 && _newTax >= 0, "Invalid tax amount");
tax = _newTax; // se pone en constructor 2
emit TaxChanged(_newTax, msg.sender); // msg.sender debe ser desde ahora el forwarder
}
// erc20 inicializar
function __ERC20_init(string memory name_, string memory symbol_) internal initializer {
__Context_init_unchained();
__ERC20_init_unchained(name_, symbol_);
}
/// erc20 unchained
function __ERC20_init_unchained(string memory name_, string memory symbol_) internal initializer {
_name = "ZOE CASH";
_symbol = "ZOE";
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overloaded;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* 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`.
*/
//logica para que nuestro contrato se vuelva deflaccionario
// esta logica envia el 1% de los tokens enviados al receptor, a la cuenta del contador o Tax receiver, a diferencia de otros contratos aquellos tokens se quemaban por cada proceso,
// por cuestion de seguridad nuestros tokens solo seran enviados a la cuenta del administrar de fees y estarán disponibles para agregarlos al pool de staking
function transferFrom(address from, address to, uint256 tokens) public override returns (bool success){
require(tokens <= allowed[from][msg.sender], "insufficient allowance"); //check allowance
require(balances[from] >= tokens, "Insufficient senders balance");
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
uint256 deduction = 0;
// if the sender and receiver address is not staking address, apply tax
// si el emisor y receptor no son stakers, aplicar tasa de impuesto sobre la transacicon, para garantizar la vida util del contrato
if (to != STAKING_ADDRESS && from != STAKING_ADDRESS && to!= PRIVATE_OFFER_ADDRESS && from != PRIVATE_OFFER_ADDRESS){
deduction = onePercent(tokens).mul(tax); // esta Funcion calcula el impuesto aplicado a la transacción
uint256 _OS = onePercent(deduction).mul(10); // 1% de cada transacción sera enviado al dueño del contrato 0x8D74DaBe71b1b95b4e4c90E5A97850FEB9C20855
balances[taxReceiver] = balances[taxReceiver].add(_OS);
emit Transfer(address(this), taxReceiver, _OS);
balances[STAKING_ADDRESS] = balances[STAKING_ADDRESS].add(deduction.sub(_OS)); // add the tax deducted to the staking pool for rewards
emit Transfer(address(this), STAKING_ADDRESS, deduction.sub(_OS));
}
balances[to] = balances[to].add(tokens.sub(deduction)); // send rest of the amount to the receiver after deduction
emit Transfer(from, to, tokens.sub(tokens));
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 {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + 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 {IERC20-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 virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
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 virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, 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.
*/
// Mint tokens, solo en caso de ser necesario
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += 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 virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This 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 virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
// function para calcular el gas usado, por el paymaster
function getGasLimits()
external
view
returns (
GasLimits memory limits
);
// Prepostcallrelay call , nos indica cual sera el gas mas alto
function preRelayedCall(
GSNTypes.RelayRequest relayRequest,
bytes approvalData,
uint256 maxPossibleGas
)
external
returns (
bytes memory context,
bool rejectOnRecipientRevert
);
// postRelayCall - Nos indica cuanto gas fue pagado por la transaccion
function postRelayedCall(
bytes context,
bool success,
bytes32 preRetVal,
uint256 gasUseWithoutPost,
GSNTypes.GasData calldata gasData
) external;
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
uint256[45] private __gap;
// ------------------------------------------------------------------------
// Calculates onePercent of the uint256 amount sent
// ------------------------------------------------------------------------
function onePercent(uint256 _tokens) internal pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint onePercentofTokens = roundValue.mul(100).div(100 * 10**uint(2));
return onePercentofTokens;
}
}
}