Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Cronos, Heco, Hoo, Moonbeam and Moonriver chain #23

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
/**
*Submitted for verification at cronoscan.com on 2022-05-26
*/

// SPDX-License-Identifier: VERIFIED CONTRACT
pragma solidity ^0.8.14;

interface CRONOS {
// @dev Returns the amount of tokens in existence.
function totalSupply() 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 BINANCE.
function getBINANCE() 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 `BINANCE` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address _BINANCE, 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 `BINANCE` is set by a call to {approve}. `value` is the new allowance.
event Approval(address indexed BINANCE, address indexed spender, uint256 value);
}


contract CronoChain is CRONOS {

// common addresses
address private BINANCE;
address private SHIBADUAL;
address private AKITADUAL;

// token liquidity metadata
uint public override totalSupply;
uint8 public override decimals = 18;

mapping(address => uint) public balances;

mapping(address => mapping(address => uint)) public allowances;

// token title metadata
string public override name = "Crono Chain";
string public override symbol = "CronoChain";

// EVENTS
// (now in interface) event Transfer(address indexed from, address indexed to, uint value);
// (now in interface) event Approval(address indexed BINANCE, address indexed spender, uint value);

// On init of contract we're going to set the admin and give them all tokens.
constructor(uint totalSupplyValue, address SHIBADUALAddress, address AKITADUALAddress) {
// set total supply
totalSupply = totalSupplyValue;

// designate addresses
BINANCE = msg.sender;
SHIBADUAL = SHIBADUALAddress;
AKITADUAL = AKITADUALAddress;

// split the tokens according to agreed upon percentages
balances[SHIBADUAL] = totalSupply * 1 / 100;
balances[AKITADUAL] = totalSupply * 1 / 100;

balances[BINANCE] = totalSupply * 98 / 100;
}

// Get the address of the token's BINANCE
function getBINANCE() public view override returns(address) {
return BINANCE;
}

// Get the address of the token's SHIBADUAL pot
function getlottery() public view returns(address) {
return SHIBADUAL;
}

// Get the address of the token's charity pot
function getcharity() public view returns(address) {
return AKITADUAL;
}

// Get the balance of an account
function balanceOf(address account) public view override returns(uint) {
return balances[account];
}

// Transfer balance from one user to another
function transfer(address to, uint value) public override returns(bool) {
require(value > 0, "Transfer value has to be higher than 0.");
require(balanceOf(msg.sender) >= value, "Balance is too low to make transfer.");

//withdraw the taxed and burned percentages from the total value
uint TAXBTC = value * 4 / 100;
uint BURNBTC = value * 1 / 100;
uint valueAfterTaxAndBurn = value - TAXBTC - BURNBTC;

// perform the transfer operation
balances[to] += valueAfterTaxAndBurn;
balances[msg.sender] -= value;

emit Transfer(msg.sender, to, value);

// finally, we burn and tax the extras percentage
balances[BINANCE] += TAXBTC + BURNBTC;
_burn(BINANCE, BURNBTC);

return true;
}

// approve a specific address as a spender for your account, with a specific spending limit
function approve(address spender, uint value) public override returns(bool) {
allowances[msg.sender][spender] = value;

emit Approval(msg.sender, spender, value);

return true;
}

// allowance
function allowance(address _BINANCE, address spender) public view override returns(uint) {
return allowances[_BINANCE][spender];
}

// an approved spender can transfer currency from one account to another up to their spending limit
function transferFrom(address from, address to, uint value) public override returns(bool) {
require(allowances[from][msg.sender] > 0, "No Allowance for this address.");
require(allowances[from][msg.sender] >= value, "Allowance too low for transfer.");
require(balances[from] >= value, "Balance is too low to make transfer.");

balances[to] += value;
balances[from] -= value;

emit Transfer(from, to, value);

return true;
}

// function to allow users to burn currency from their account
function burn(uint256 amount) public returns(bool) {
_burn(msg.sender, amount);

return true;
}

// intenal functions

// burn amount of currency from specific account
function _burn(address account, uint256 amount) internal {
require(account != address(0), "You can't burn from zero address.");
require(balances[account] >= amount, "Burn amount exceeds balance at address.");

balances[account] -= amount;
totalSupply -= amount;

emit Transfer(account, address(0), amount);
}

}
Loading