Skip to content

Instantly share code, notes, and snippets.

@parnaa
Created August 6, 2019 16:27
Show Gist options
  • Save parnaa/b25c308683de502d7a8571b687a2aa37 to your computer and use it in GitHub Desktop.
Save parnaa/b25c308683de502d7a8571b687a2aa37 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.25+commit.59dbf8f1.js&optimize=false&gist=
pragma solidity 0.4.25;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on 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-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts 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;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
/**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an account access to this role
*/
function add(Role storage role, address account) internal {
require(account != address(0));
require(!has(role, account));
role.bearer[account] = true;
}
/**
* @dev remove an account's access to this role
*/
function remove(Role storage role, address account) internal {
require(account != address(0));
require(has(role, account));
role.bearer[account] = false;
}
/**
* @dev check if an account has this role
* @return bool
*/
function has(Role storage role, address account)
internal
view
returns (bool)
{
require(account != address(0));
return role.bearer[account];
}
}
/**
* @title owned
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Owned{
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @return the address of the owner.
*/
function owner() public view returns(address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner());
_;
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns(bool) {
return msg.sender == _owner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value)
external returns (bool);
function transferFrom(address from, address to, uint256 value)
external returns (bool);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
* Originally based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address owner,
address spender
)
public
view
returns (uint256)
{
return _allowed[owner][spender];
}
/**
* @dev Transfer token for a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* 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
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address from,
address to,
uint256 value
)
public
returns (bool)
{
require(value <= _allowed[from][msg.sender]);
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(
address spender,
uint256 addedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].add(addedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(
address spender,
uint256 subtractedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].sub(subtractedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(value <= _balances[from]);
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created.
*/
function _mint(address account, uint256 value) internal {
require(account != 0);
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burn(address account, uint256 value) internal {
require(account != 0);
require(value <= _balances[account]);
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burnFrom(address account, uint256 value) internal {
require(value <= _allowed[account][msg.sender]);
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
// this function needs to emit an event with the updated approval.
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(
value);
_burn(account, value);
}
}
contract PauserRole {
using Roles for Roles.Role;
event PauserAdded(address indexed account);
event PauserRemoved(address indexed account);
Roles.Role private pausers;
constructor() internal {
_addPauser(msg.sender);
}
modifier onlyPauser() {
require(isPauser(msg.sender));
_;
}
function isPauser(address account) public view returns (bool) {
return pausers.has(account);
}
function addPauser(address account) public onlyPauser {
_addPauser(account);
}
function renouncePauser() public {
_removePauser(msg.sender);
}
function _addPauser(address account) internal {
pausers.add(account);
emit PauserAdded(account);
}
function _removePauser(address account) internal {
pausers.remove(account);
emit PauserRemoved(account);
}
}
contract MinterRole {
using Roles for Roles.Role;
event MinterAdded(address indexed account);
event MinterRemoved(address indexed account);
Roles.Role private minters;
constructor() internal {
_addMinter(msg.sender);
}
modifier onlyMinter() {
require(isMinter(msg.sender));
_;
}
function isMinter(address account) public view returns (bool) {
return minters.has(account);
}
function addMinter(address account) public onlyMinter {
_addMinter(account);
}
function renounceMinter() public {
_removeMinter(msg.sender);
}
function _addMinter(address account) internal {
minters.add(account);
emit MinterAdded(account);
}
function _removeMinter(address account) internal {
minters.remove(account);
emit MinterRemoved(account);
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is PauserRole {
event Paused(address account);
event Unpaused(address account);
bool private _paused;
constructor() internal {
_paused = false;
}
/**
* @return true if the contract is paused, false otherwise.
*/
function paused() public view returns(bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!_paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(_paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() public onlyPauser whenNotPaused {
_paused = true;
emit Paused(msg.sender);
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyPauser whenPaused {
_paused = false;
emit Unpaused(msg.sender);
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract ERC20Burnable is ERC20, Owned {
/**
* @dev Burns a specific amount of tokens.
* @param value The amount of token to be burned.
*/
function burn(uint256 value) onlyOwner public {
_burn(msg.sender, value);
}
/**
* @dev Burns a specific amount of tokens from the target address and decrements allowance
* @param from address The address which you want to send tokens from
* @param value uint256 The amount of token to be burned
*/
function burnFrom(address from, uint256 value) onlyOwner public {
_burnFrom(from, value);
}
}
/**
* @title Pausable token
* @dev ERC20 modified with pausable transfers.
**/
contract ERC20Pausable is ERC20Burnable, Pausable {
function transfer(
address to,
uint256 value
)
public
whenNotPaused
returns (bool)
{
return super.transfer(to, value);
}
function transferFrom(
address from,
address to,
uint256 value
)
public
whenNotPaused
returns (bool)
{
return super.transferFrom(from, to, value);
}
function approve(
address spender,
uint256 value
)
public
whenNotPaused
returns (bool)
{
return super.approve(spender, value);
}
function increaseAllowance(
address spender,
uint addedValue
)
public
whenNotPaused
returns (bool success)
{
return super.increaseAllowance(spender, addedValue);
}
function decreaseAllowance(
address spender,
uint subtractedValue
)
public
whenNotPaused
returns (bool success)
{
return super.decreaseAllowance(spender, subtractedValue);
}
}
/**
* @title ERC20Mintable
* @dev ERC20 minting logic
*/
contract ERC20Mintable is ERC20Pausable, MinterRole {
/**
* @dev Function to mint tokens
* @param to The address that will receive the minted tokens.
* @param value The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address to,
uint256 value
)
public
onlyMinter
returns (bool)
{
_mint(to, value);
return true;
}
}
/**
* @title Capped token
* @dev Mintable token with a token cap.
*/
contract ERC20Capped is ERC20Mintable {
uint256 private _cap;
constructor(uint256 cap)
public
{
require(cap > 0);
_cap = cap;
}
/**
* @return the cap for the token minting.
*/
function cap() public view returns(uint256) {
return _cap;
}
function _mint(address account, uint256 value) internal {
require(totalSupply().add(value) <= _cap);
super._mint(account, value);
}
}
contract AfricaToken is ERC20Capped(41000000000){
string public name;
uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
string public symbol;
string public version;
constructor() public
{
super._mint(msg.sender,1500000000);
name = "AfricaToken";
decimals = 3;
symbol = "AFRICA";
version = "V1.0";
}
/* Get the contract constant _name */
function name() public view returns (string _name) {
return name;
}
/* Get the contract constant _symbol */
function symbol() public view returns (string _symbol) {
return symbol;
}
/* Get the contract constant _decimals */
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
/* Get the contract constant _version */
function version() public view returns (string _version) {
return version;
}
}
pragma solidity 0.4.25;
/**
* @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) {
require(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) {
require(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
}
contract Owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner , "Unauthorized Access");
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
interface ERC20Interface {
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) view external returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) external returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
function approve(address _spender, uint256 _value) external returns (bool success);
function disApprove(address _spender) external returns (bool success);
function increaseApproval(address _spender, uint _addedValue) external returns (bool success);
function decreaseApproval(address _spender, uint _subtractedValue) external returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant external returns (uint256 remaining);
function name() external view returns (string _name);
/* Get the contract constant _symbol */
function symbol() external view returns (string _symbol);
/* Get the contract constant _decimals */
function decimals() external view returns (uint8 _decimals);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
library SafeERC20{
function safeTransfer(ERC20Interface token, address to, uint256 value) internal {
assert(token.transfer(to, value));
}
function safeTransferFrom(ERC20Interface token, address from, address to, uint256 value) internal {
assert(token.transferFrom(from, to, value));
}
function safeApprove(ERC20Interface token, address spender, uint256 value) internal {
assert(token.approve(spender, value));
}
}
contract ERCStaking {
event Staked(address indexed user, uint256 amount, uint256 total, bytes data);
event Unstaked(address indexed user, uint256 amount, uint256 total, bytes data);
function stake(uint256 amount, bytes data) public;
function stakeFor(address user, uint256 amount, bytes data) public;
function withdrawStake(uint256 amount, bytes data) public;
function totalStakedFor(address addr) public view returns (uint256);
function totalStaked() public view returns (uint256);
function token() public view returns (address);
//Following the ERC900 EIP
/*
* @title ERC900 Simple Staking Interface basic implementation
* @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-900.md
*/
}
contract BasicStakeContract is ERCStaking {
using SafeMath for uint256;
using SafeERC20 for ERC20Interface;
// Token used for staking
ERC20Interface stakingToken;
// The default duration of stake lock-in (in seconds)
uint256 public defaultLockInDuration;
// To save on gas, rather than create a separate mapping for totalStakedFor & personalStakes,
// both data structures are stored in a single mapping for a given addresses.
//
// It's possible to have a non-existing personalStakes, but have tokens in totalStakedFor
// if other users are staking on behalf of a given address.
mapping (address => StakeContract) public stakeHolders;
// Struct for personal stakes (i.e., stakes made by this address)
// unlockedTimestamp - when the stake unlocks (in seconds since Unix epoch)
// actualAmount - the amount of tokens in the stake
// stakedFor - the address the stake was staked for
struct Stake {
uint256 unlockedTimestamp;
uint256 stakedAt; //Timestamp when staked
uint256 actualAmount;
address stakedFor;
}
// Struct for all stake metadata at a particular address
// totalStakedFor - the number of tokens staked for this address
// personalStakeIndex - the index in the personalStakes array.
// personalStakes - append only array of stakes made by this address
// exists - whether or not there are stakes that involve this address
struct StakeContract {
uint256 totalStakedFor;
uint256 personalStakeIndex;
Stake[] personalStakes;
bool exists;
}
/**
* @dev Modifier that checks that this contract can transfer tokens from the
* balance in the stakingToken contract for the given address.
* @dev This modifier also transfers the tokens.
* @param _address address to transfer tokens from
* @param _amount uint256 the number of tokens
*/
modifier canStake(address _address, uint256 _amount) {
require(
stakingToken.transferFrom(_address, this, _amount),
"Stake required");
_;
}
/**
* @dev Constructor function
* @param _stakingToken ERC20 The address of the token contract used for staking
*/
constructor(ERC20Interface _stakingToken) public {
stakingToken = _stakingToken;
}
/**
* @dev Returns the timestamps for when active personal stakes for an address will unlock
* @dev These accessors functions are needed until https://github.com/ethereum/web3.js/issues/1241 is solved
* @param _address address that created the stakes
* @return uint256[] array of timestamps
*/
function getPersonalStakeUnlockedTimestamps(address _address) external view returns (uint256[]) {
uint256[] memory timestamps;
(timestamps,,) = getPersonalStakes(_address);
return timestamps;
}
/**
* @dev Returns the stake actualAmount for active personal stakes for an address
* @dev These accessors functions are needed until https://github.com/ethereum/web3.js/issues/1241 is solved
* @param _address address that created the stakes
* @return uint256[] array of actualAmounts
*/
function getPersonalStakeActualAmounts(address _address) external view returns (uint256[]) {
uint256[] memory actualAmounts;
(,actualAmounts,) = getPersonalStakes(_address);
return actualAmounts;
}
/**
* @dev Returns the addresses that each personal stake was created for by an address
* @dev These accessors functions are needed until https://github.com/ethereum/web3.js/issues/1241 is solved
* @param _address address that created the stakes
* @return address[] array of amounts
*/
function getPersonalStakeForAddresses(address _address) external view returns (address[]) {
address[] memory stakedFor;
(,,stakedFor) = getPersonalStakes(_address);
return stakedFor;
}
/**
* @notice Stakes a certain amount of tokens, this MUST transfer the given amount from the user
* @notice MUST trigger Staked event
* @param _amount uint256 the amount of tokens to stake
* @param _data bytes optional data to include in the Stake event
*/
function stake(uint256 _amount, bytes _data) public {
createStake(
msg.sender,
_amount,
defaultLockInDuration,
_data);
}
/**
* @notice Stakes a certain amount of tokens, this MUST transfer the given amount from the caller
* @notice MUST trigger Staked event
* @param _user address the address the tokens are staked for
* @param _amount uint256 the amount of tokens to stake
* @param _data bytes optional data to include in the Stake event
*/
function stakeFor(address _user, uint256 _amount, bytes _data) public {
createStake(
_user,
_amount,
defaultLockInDuration,
_data);
}
/**
* @notice Unstakes a certain amount of tokens, this SHOULD return the given amount of tokens to the user, if unstaking is currently not possible the function MUST revert
* @notice MUST trigger Unstaked event
* @dev Unstaking tokens is an atomic operation—either all of the tokens in a stake, or none of the tokens.
* @dev Users can only unstake a single stake at a time, it is must be their oldest active stake. Upon releasing that stake, the tokens will be
* transferred back to their account, and their personalStakeIndex will increment to the next active stake.
* @param _amount uint256 the amount of tokens to unstake
* @param _data bytes optional data to include in the Unstake event
*/
function withdrawStake(uint256 _amount, bytes _data) public;
/**
* @notice Returns the current total of tokens staked for an address
* @param _address address The address to query
* @return uint256 The number of tokens staked for the given address
*/
function totalStakedFor(address _address) public view returns (uint256) {
return stakeHolders[_address].totalStakedFor;
}
/**
* @notice Returns the current total of tokens staked
* @return uint256 The number of tokens staked in the contract
*/
function totalStaked() public view returns (uint256) {
return stakingToken.balanceOf(this);
}
/**
* @notice Address of the token being used by the staking interface
* @return address The address of the ERC20 token used for staking
*/
function token() public view returns (address) {
return stakingToken;
}
/**
* @dev Helper function to get specific properties of all of the personal stakes created by an address
* @param _address address The address to query
* @return (uint256[], uint256[], address[])
* timestamps array, actualAmounts array, stakedFor array
*/
function getPersonalStakes(
address _address
)
view
public
returns(uint256[], uint256[], address[])
{
StakeContract storage stakeContract = stakeHolders[_address];
uint256 arraySize = stakeContract.personalStakes.length - stakeContract.personalStakeIndex;
uint256[] memory unlockedTimestamps = new uint256[](arraySize);
uint256[] memory actualAmounts = new uint256[](arraySize);
address[] memory stakedFor = new address[](arraySize);
for (uint256 i = stakeContract.personalStakeIndex; i < stakeContract.personalStakes.length; i++) {
uint256 index = i - stakeContract.personalStakeIndex;
unlockedTimestamps[index] = stakeContract.personalStakes[i].unlockedTimestamp;
actualAmounts[index] = stakeContract.personalStakes[i].actualAmount;
stakedFor[index] = stakeContract.personalStakes[i].stakedFor;
}
return (
unlockedTimestamps,
actualAmounts,
stakedFor
);
}
/**
* @dev Helper function to create stakes for a given address
* @param _address address The address the stake is being created for
* @param _amount uint256 The number of tokens being staked
* @param _lockInDuration uint256 The duration to lock the tokens for
* @param _data bytes optional data to include in the Stake event
*/
function createStake(
address _address,
uint256 _amount,
uint256 _lockInDuration,
bytes _data
)
internal
canStake(msg.sender, _amount)
{
if (!stakeHolders[msg.sender].exists) {
stakeHolders[msg.sender].exists = true;
}
stakeHolders[_address].totalStakedFor = stakeHolders[_address].totalStakedFor.add(_amount);
stakeHolders[msg.sender].personalStakes.push(
Stake(
block.timestamp.add(_lockInDuration),
block.timestamp,
_amount,
_address)
);
emit Staked(
_address,
_amount,
totalStakedFor(_address),
_data);
}
}
contract AfricaTokenStakeWithBonus is BasicStakeContract(ERC20Interface(0x4cc1ae0aFED85B02c2891039b4Fad212F64b1C33)), Owned{
uint256 constant public YEAR_IN_SECONDS = 31557600;
uint256 constant public HALF_YEAR_IN_SECONDS = 15778800;
uint256 public oneYearBonusRate; //In Percentage
uint256 public halfYearBonusRate; //In percentage
constructor() public
{
halfYearBonusRate = 7;
oneYearBonusRate = 15;
defaultLockInDuration = 15778800;
}
function setbonus(uint256 _halfyearRate, uint256 _oneyearRate) onlyOwner public {
halfYearBonusRate = _halfyearRate;
oneYearBonusRate = _oneyearRate;
}
function calculateBonus(uint256 _amount,uint256 _stakedAt) internal view returns(uint256){
if(block.timestamp.sub(_stakedAt) >= YEAR_IN_SECONDS)
return _amount.mul(oneYearBonusRate.div(100));
else{
if(block.timestamp.sub(_stakedAt) >= HALF_YEAR_IN_SECONDS)
return _amount.mul(halfYearBonusRate.div(100));
else
return 0;
}
}
function withdrawStake(uint256 _amount, bytes _data) public {
unstake(
_amount,
_data);
}
/**
* @dev Helper function to withdraw stakes for the msg.sender
* @param _amount uint256 The amount to withdraw. MUST match the stake amount for the
* stake at personalStakeIndex.
* @param _data bytes optional data to include in the Unstake event
*/
function unstake(
uint256 _amount,
bytes _data
)
internal
{
Stake storage personalStake = stakeHolders[msg.sender].personalStakes[stakeHolders[msg.sender].personalStakeIndex];
// Check that the current stake has unlocked & matches the unstake amount
require(
personalStake.unlockedTimestamp <= block.timestamp,
"The current stake hasn't unlocked yet");
require(
personalStake.actualAmount == _amount,
"The unstake amount does not match the current stake");
uint256 calculatedBonus = calculateBonus(_amount,personalStake.stakedAt);
// Transfer the staked tokens from this contract back to the sender
// Notice that we are using transfer instead of transferFrom here, so
// no approval is needed beforehand.
require(
stakingToken.transfer(msg.sender, _amount.add(calculatedBonus)),
"Unable to withdraw stake");
stakeHolders[personalStake.stakedFor].totalStakedFor = stakeHolders[personalStake.stakedFor]
.totalStakedFor.sub(personalStake.actualAmount);
personalStake.actualAmount = 0;
stakeHolders[msg.sender].personalStakeIndex++;
emit Unstaked(
personalStake.stakedFor,
_amount,
totalStakedFor(personalStake.stakedFor),
_data);
}
}
pragma solidity ^0.4.0;
contract Ballot {
struct Voter {
uint weight;
bool voted;
uint8 vote;
address delegate;
}
struct Proposal {
uint voteCount;
}
address chairperson;
mapping(address => Voter) voters;
Proposal[] proposals;
/// Create a new ballot with $(_numProposals) different proposals.
function Ballot(uint8 _numProposals) public {
chairperson = msg.sender;
voters[chairperson].weight = 1;
proposals.length = _numProposals;
}
/// Give $(toVoter) the right to vote on this ballot.
/// May only be called by $(chairperson).
function giveRightToVote(address toVoter) public {
if (msg.sender != chairperson || voters[toVoter].voted) return;
voters[toVoter].weight = 1;
}
/// Delegate your vote to the voter $(to).
function delegate(address to) public {
Voter storage sender = voters[msg.sender]; // assigns reference
if (sender.voted) return;
while (voters[to].delegate != address(0) && voters[to].delegate != msg.sender)
to = voters[to].delegate;
if (to == msg.sender) return;
sender.voted = true;
sender.delegate = to;
Voter storage delegateTo = voters[to];
if (delegateTo.voted)
proposals[delegateTo.vote].voteCount += sender.weight;
else
delegateTo.weight += sender.weight;
}
/// Give a single vote to proposal $(toProposal).
function vote(uint8 toProposal) public {
Voter storage sender = voters[msg.sender];
if (sender.voted || toProposal >= proposals.length) return;
sender.voted = true;
sender.vote = toProposal;
proposals[toProposal].voteCount += sender.weight;
}
function winningProposal() public constant returns (uint8 _winningProposal) {
uint256 winningVoteCount = 0;
for (uint8 prop = 0; prop < proposals.length; prop++)
if (proposals[prop].voteCount > winningVoteCount) {
winningVoteCount = proposals[prop].voteCount;
_winningProposal = prop;
}
}
}
pragma solidity 0.4.24;
/**
* @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;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner , "Unauthorized Access");
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is owned {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
interface ERC223Interface {
function balanceOf(address who) constant external returns (uint);
function transfer(address to, uint value) external returns (bool success); //erc20 compatible
function transfer(address to, uint value, bytes data) external returns (bool success);
event Transfer(address indexed from, address indexed to, uint value, bytes data);
event Transfer(address indexed _from, address indexed _to, uint256 _value); //erc20 compatible
}
/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) external;
}
/**
* @title Reference implementation of the ERC223 standard token.
*/
contract ERC223Token is ERC223Interface, Pausable {
using SafeMath for uint;
uint256 public _CAP;
mapping(address => uint256) balances; // List of user balances.
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint _value, bytes _data) whenNotPaused external returns (bool success){
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
require(balances[msg.sender] >= _value && _value > 0);
if(isContract(_to)){
return transferToContract(_to, _value, _data);
}
else
{
return transferToAddress(_to, _value, _data);
}
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
*/
function transfer(address _to, uint _value) whenNotPaused external returns (bool success){
require(balances[msg.sender] >= _value && _value > 0);
bytes memory empty;
if(isContract(_to)){
return transferToContract(_to, _value, empty);
}
else
{
return transferToAddress(_to, _value, empty);
}
//emit Transfer(msg.sender, _to, _value, empty);
}
//assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) internal view returns (bool is_contract) {
// retrieve the size of the code on target address, this needs assembly
uint length;
assembly { length := extcodesize(_addr) }
if (length > 0)
return true;
else
return false;
}
// function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private whenNotPaused returns (bool success) {
require(_to != address(0));
require(balances[msg.sender] >= _value && _value > 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
// function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private whenNotPaused returns (bool success) {
require(_to != address(0));
require(balances[msg.sender] >= _value && _value > 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
emit Transfer(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
/**
* @dev Returns balance of the `_owner`.
*
* @param _owner The address whose balance will be returned.
* @return balance Balance of the `_owner`.
*/
function balanceOf(address _owner) constant external returns (uint balance) {
return balances[_owner];
}
}
contract ERC20BackedERC223 is ERC223Token{
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size.add(4));
_;
}
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3 * 32) whenNotPaused external returns (bool success) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) whenNotPaused public returns (bool success) {
require((balances[msg.sender] >= _value) && ((_value == 0) || (allowed[msg.sender][_spender] == 0)));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function disApprove(address _spender) whenNotPaused public returns (bool success)
{
allowed[msg.sender][_spender] = 0;
assert(allowed[msg.sender][_spender] == 0);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function increaseApproval(address _spender, uint _addedValue) whenNotPaused public returns (bool success) {
require(balances[msg.sender] >= allowed[msg.sender][_spender].add(_addedValue), "Callers balance not enough");
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) whenNotPaused public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
require((_subtractedValue != 0) && (oldValue > _subtractedValue) , "The amount to be decreased is incorrect");
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining) {
return allowed[_owner][_spender];
}
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
mapping (address => mapping (address => uint256)) allowed;
}
contract burnableERC223 is ERC20BackedERC223{
// This notifies clients about the amount burnt
uint256 public _totalBurnedTokens = 0;
event Burn(address indexed from, uint256 value);
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balances[msg.sender] >= _value, "Sender doesn't have enough balance"); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
_CAP = _CAP.sub(_value); // Updates totalSupply
_totalBurnedTokens = _totalBurnedTokens.add(_value);
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
require(balances[_from] >= _value , "target balance is not enough"); // Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
_CAP = _CAP.sub(_value); // Update totalSupply
emit Burn(_from, _value);
emit Transfer(_from, address(0), _value);
return true;
}
}
contract mintableERC223 is burnableERC223{
uint256 public _totalMinedSupply;
uint256 public _initialSupply;
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
bytes memory empty;
uint256 availableMinedSupply;
availableMinedSupply = (_totalMinedSupply.sub(_totalBurnedTokens)).add(_amount);
require(_CAP >= availableMinedSupply , "All tokens minted, Cap reached");
_totalMinedSupply = _totalMinedSupply.add(_amount);
if(_CAP <= _totalMinedSupply.sub(_totalBurnedTokens))
mintingFinished = true;
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
emit Transfer(address(0), _to, _amount, empty);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
/// @return total amount of tokens
function maximumSupply() public view returns (uint256 supply){
return _CAP;
}
/// @return total amount of tokens
function totalMinedSupply() public view returns (uint256 supply){
return _totalMinedSupply;
}
/// @return total amount of tokens
function preMinedSupply() public view returns (uint256 supply){
return _initialSupply;
}
function totalBurnedTokens() public view returns (uint256 supply){
return _totalBurnedTokens;
}
function totalSupply() public view returns (uint256 supply){
return _totalMinedSupply.sub(_totalBurnedTokens);
}
}
contract CyBit is mintableERC223{
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public name; //fancy name: eg Simon Bucks
uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
string public symbol; //An identifier: eg SBX
string public version; //An Arbitrary versioning scheme.
uint256 private initialsupply;
uint256 private totalsupply;
constructor() public
{
decimals = 8;
name = "CyBit"; // Set the name for display purposes
symbol = "eCBT"; // Set the symbol for display purposes
version = "V1.0"; //Version.
initialsupply = 7000000000; //PreMined Tokens
totalsupply = 10000000000; //Total Tokens
_CAP = totalsupply.mul(10 ** uint256(decimals));
_initialSupply = initialsupply.mul(10 ** uint256(decimals));
_totalMinedSupply = _initialSupply;
balances[msg.sender] = _totalMinedSupply;
}
function() public {
//not payable fallback function
revert();
}
/* Get the contract constant _name */
function version() public view returns (string _v) {
return version;
}
function name() public view returns (string _name) {
return name;
}
/* Get the contract constant _symbol */
function symbol() public view returns (string _symbol) {
return symbol;
}
/* Get the contract constant _decimals */
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
}
pragma solidity ^0.4.18;
/**
* @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;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is owned {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
interface ERC20Token {
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant external returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) external returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
}
contract StandardToken is ERC20Token, Pausable {
using SafeMath for uint;
modifier onlyPayloadSize(uint size) {
assert(msg.data.length == size.add(4));
_;
}
function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
//Default assumes totalSupply can't be over max (2^256 - 1).
//If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
//Replace the if with this one instead.
//if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
} else { return false; }
}
function balanceOf(address _owner) constant external returns (uint256 balance) {
return balances[_owner];
}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) whenNotPaused public returns (bool success) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining) {
return allowed[_owner][_spender];
}
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint256 public _totalSupply;
}
//name this contract whatever you'd like
contract CryptoyaT is StandardToken{
using SafeMath for uint;
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public name; //fancy name: eg Simon Bucks
uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
string public symbol; //An identifier: eg SBX
string public version = 'V1.0'; //Version 0.1 standard. Just an arbitrary versioning scheme.
uint256 private fulltoken;
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
//
// CHANGE THESE VALUES FOR YOUR TOKEN
//
//make sure this function name matches the contract name above. ERC20Token
function CryptoyaT(
) public{
fulltoken = 500000000;
decimals = 18; // Amount of decimals for display purposes
_totalSupply = fulltoken.mul(10 ** uint256(decimals)); // Update total supply (100000 for example)
balances[msg.sender] = _totalSupply; // Give the creator all initial tokens (100000 for example)
name = "Cryptoya"; // Set the name for display purposes
symbol = "CRAT"; // Set the symbol for display purposes
}
function() public {
//not payable fallback function
revert();
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/// @return total amount of tokens
function totalSupply() constant public returns (uint256 supply){
return _totalSupply;
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balances[msg.sender] >= _value); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
_totalSupply = _totalSupply.sub(_value); // Updates totalSupply
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
require(balances[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
_totalSupply = _totalSupply.sub(_value); // Update totalSupply
emit Burn(_from, _value);
emit Transfer(_from, address(0), _value);
return true;
}
function onlyPayForFuel() public payable onlyOwner{
// Owner will pay in contract to bear the gas price if transactions made from contract
}
function withdrawEtherFromcontract(uint _amountineth) public onlyOwner{
uint _amountInwei = _amountineth.mul(10 ** 18);
require(balances[this] > _amountInwei);
require(msg.sender == owner);
owner.transfer(_amountInwei);
}
function withdrawTokensFromContract(uint _amountOfTokens) public onlyOwner{
require(balances[this] > _amountOfTokens);
require(msg.sender == owner);
balances[msg.sender] = balances[msg.sender].add(_amountOfTokens); // adds the amount to owner's balance
balances[this] = balances[this].sub(_amountOfTokens); // subtracts the amount from contract balance
emit Transfer(this, msg.sender, _amountOfTokens); // execute an event reflecting the change
}
}
pragma solidity ^0.4.18;
/**
* @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;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is owned {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
interface ERC20Token {
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant external returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) external returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
}
contract StandardToken is ERC20Token, Pausable {
using SafeMath for uint;
modifier onlyPayloadSize(uint size) {
assert(msg.data.length == size.add(4));
_;
}
function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
//Default assumes totalSupply can't be over max (2^256 - 1).
//If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
//Replace the if with this one instead.
//if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
spent[_from][msg.sender] = spent[_from][msg.sender].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
} else { return false; }
}
function balanceOf(address _owner) constant external returns (uint256 balance) {
return balances[_owner];
}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) whenNotPaused public returns (bool success) {
if(_value.sub(spent[msg.sender][_spender]) <= 0)
allowed[msg.sender][_spender] = 0;
else
allowed[msg.sender][_spender] = _value.sub(spent[msg.sender][_spender]);
Approval(msg.sender, _spender, _value);
return true;
}
// Already spent amount i.e. the total transferred amount a spender spent from owner's account
function spend(address _owner, address _spender) constant public returns (uint256 totalspent) {
return spent[_owner][_spender];
}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining) {
return allowed[_owner][_spender];
}
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => mapping (address => uint256)) spent;
uint256 public _totalSupply;
}
//name this contract whatever you'd like
contract CryptonaTest is StandardToken{
using SafeMath for uint;
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public name; //fancy name: eg Simon Bucks
uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
string public symbol; //An identifier: eg SBX
string public version = 'V1.0'; //Version 0.1 standard. Just an arbitrary versioning scheme.
uint256 private fulltoken;
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
//
// CHANGE THESE VALUES FOR YOUR TOKEN
//
//make sure this function name matches the contract name above. ERC20Token
function CryptonaTest(
) public{
fulltoken = 500000000;
decimals = 18; // Amount of decimals for display purposes
_totalSupply = fulltoken.mul(10 ** uint256(decimals)); // Update total supply (100000 for example)
balances[msg.sender] = _totalSupply; // Give the creator all initial tokens (100000 for example)
name = "CryptonaTest"; // Set the name for display purposes
symbol = "CRAT"; // Set the symbol for display purposes
}
function() public {
//not payable fallback function
revert();
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/// @return total amount of tokens
function totalSupply() constant public returns (uint256 supply){
return _totalSupply;
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balances[msg.sender] >= _value); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
_totalSupply = _totalSupply.sub(_value); // Updates totalSupply
Burn(msg.sender, _value);
Transfer(msg.sender, address(0), _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
require(balances[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
_totalSupply = _totalSupply.sub(_value); // Update totalSupply
Burn(_from, _value);
Transfer(_from, address(0), _value);
return true;
}
function onlyPayForFuel() public payable onlyOwner{
// Owner will pay in contract to bear the gas price if transactions made from contract
}
function withdrawEtherFromcontract(uint _amountineth) public onlyOwner{
uint _amountInwei = _amountineth.mul(10 ** 18);
require(this.balance > _amountInwei);
require(msg.sender == owner);
owner.transfer(_amountInwei);
}
function withdrawTokensFromContract(uint _amountOfTokens) public onlyOwner{
require(balances[this] > _amountOfTokens);
require(msg.sender == owner);
balances[msg.sender] = balances[msg.sender].add(_amountOfTokens); // adds the amount to owner's balance
balances[this] = balances[this].sub(_amountOfTokens); // subtracts the amount from contract balance
Transfer(this, msg.sender, _amountOfTokens); // execute an event reflecting the change
}
}
pragma solidity ^0.4.21;
/**
* @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) {
require(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) {
require(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is owned {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
interface ERC223Interface {
function balanceOf(address who) constant external returns (uint);
function transfer(address to, uint value) external;
function transfer(address to, uint value, bytes data) external;
event Transfer(address indexed from, address indexed to, uint value, bytes data);
}
/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) external;
}
/**
* @title Reference implementation of the ERC223 standard token.
*/
contract ERC223Token is ERC223Interface, Pausable {
using SafeMath for uint;
uint256 public _totalSupply;
mapping(address => uint) balances; // List of user balances.
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint _value, bytes _data) whenNotPaused external{
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
require(balances[msg.sender] >= _value && _value > 0);
if(isContract(_to)){
transferToContract(_to, _value, _data);
}
else
{
transferToAddress(_to, _value, _data);
}
emit Transfer(msg.sender, _to, _value, _data);
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
*/
function transfer(address _to, uint _value) whenNotPaused external{
require(balances[msg.sender] >= _value && _value > 0);
bytes memory empty;
if(isContract(_to)){
transferToContract(_to, _value, empty);
}
else
{
transferToAddress(_to, _value, empty);
}
emit Transfer(msg.sender, _to, _value, empty);
}
//assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) internal view returns (bool is_contract) {
// retrieve the size of the code on target address, this needs assembly
uint length;
assembly { length := extcodesize(_addr) }
return length > 0;
}
// function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private whenNotPaused returns (bool success) {
require(balances[msg.sender] >= _value && _value > 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
// function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private whenNotPaused returns (bool success) {
require(balances[msg.sender] >= _value && _value > 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
/**
* @dev Returns balance of the `_owner`.
*
* @param _owner The address whose balance will be returned.
* @return balance Balance of the `_owner`.
*/
function balanceOf(address _owner) constant external returns (uint balance) {
return balances[_owner];
}
}
contract ERC20BackedERC223 is ERC223Token{
event Transfer(address indexed _from, address indexed _to, uint256 _value);
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
} else { return false; }
}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) whenNotPaused public returns (bool success) {
require((balances[msg.sender] >= _value) && ((_value == 0) || (allowed[msg.sender][_spender] == 0)));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function disApprove(address _spender) whenNotPaused public returns (bool success)
{
allowed[msg.sender][_spender] = 0;
assert(allowed[msg.sender][_spender] == 0);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function increaseApproval(address _spender, uint _addedValue) whenNotPaused public returns (bool success) {
require(balances[msg.sender] >= allowed[msg.sender][_spender].add(_addedValue));
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) whenNotPaused public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
require((_subtractedValue != 0) && (oldValue > _subtractedValue));
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining) {
return allowed[_owner][_spender];
}
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
}
contract mintableERC223 is ERC20BackedERC223{
uint256 public _currentSupply;
uint256 public _initialSupply;
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
bytes memory empty;
_currentSupply = _currentSupply.add(_amount);
if(_totalSupply < _currentSupply)
mintingFinished = true;
require(_totalSupply >= _currentSupply);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount, empty);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
/// @return total amount of tokens
function totalSupply() public view returns (uint256 supply){
return _totalSupply;
}
/// @return total amount of tokens
function totalMinedSupply() public view returns (uint256 supply){
return _currentSupply;
}
/// @return total amount of tokens
function preMinedSupply() public view returns (uint256 supply){
return _initialSupply;
}
}
contract cybit is ERC20BackedERC223{
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public name; //fancy name: eg Simon Bucks
uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
string public symbol; //An identifier: eg SBX
string public version = 'Test-V1.0'; //Version 0.1 standard. Just an arbitrary versioning scheme.
uint256 private initialsupply;
uint256 private totalsupply;
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
function cybit() public
{
decimals = 8;
name = "Cybit"; // Set the name for display purposes
symbol = "CBT"; // Set the symbol for display purposes
initialsupply = 7000000000;
totalsupply = 10000000000;
_totalSupply = totalsupply.mul(10 ** uint256(decimals));
// _initialSupply = initialsupply.mul(10 ** uint256(decimals));
//_currentSupply = _initialSupply;
balances[msg.sender] = _totalSupply;
//emit Mint(msg.sender, _initialSupply);
//emit Transfer(address(0), msg.sender, _initialSupply, 0x5052454d494e454420746f204f776e6572);
}
function() public {
//not payable fallback function
revert();
}
function version() public view returns (string _v) {
require(bytes(_v).length > 0);
return version;
}
/* Get the contract constant _name */
function name() public view returns (string _name) {
require(bytes(_name).length > 0);
return name;
}
/* Get the contract constant _symbol */
function symbol() public view returns (string _symbol) {
require(bytes(_symbol).length > 0);
return symbol;
}
/* Get the contract constant _decimals */
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balances[msg.sender] >= _value); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
_totalSupply = _totalSupply.sub(_value); // Updates totalSupply
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
require(balances[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
_totalSupply = _totalSupply.sub(_value); // Update totalSupply
emit Burn(_from, _value);
emit Transfer(_from, address(0), _value);
return true;
}
}
pragma solidity 0.4.24;
/**
* @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;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner , "Unauthorized Access");
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is owned {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
interface ERC223Interface {
function balanceOf(address who) constant external returns (uint);
function transfer(address to, uint value) external returns (bool success); //erc20 compatible
function transfer(address to, uint value, bytes data) external returns (bool success);
event Transfer(address indexed from, address indexed to, uint value, bytes data);
event Transfer(address indexed _from, address indexed _to, uint256 _value); //erc20 compatible
}
/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) external;
}
/**
* @title Reference implementation of the ERC223 standard token.
*/
contract ERC223Token is ERC223Interface, Pausable {
using SafeMath for uint;
uint256 public _CAP;
mapping(address => uint256) balances; // List of user balances.
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint _value, bytes _data) whenNotPaused external returns (bool success){
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
require(balances[msg.sender] >= _value && _value > 0);
if(isContract(_to)){
return transferToContract(_to, _value, _data);
}
else
{
return transferToAddress(_to, _value, _data);
}
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
*/
function transfer(address _to, uint _value) whenNotPaused external returns (bool success){
require(balances[msg.sender] >= _value && _value > 0);
bytes memory empty;
if(isContract(_to)){
return transferToContract(_to, _value, empty);
}
else
{
return transferToAddress(_to, _value, empty);
}
//emit Transfer(msg.sender, _to, _value, empty);
}
//assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) internal view returns (bool is_contract) {
// retrieve the size of the code on target address, this needs assembly
uint length;
assembly { length := extcodesize(_addr) }
if (length > 0)
return true;
else
return false;
}
// function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private whenNotPaused returns (bool success) {
require(_to != address(0));
require(balances[msg.sender] >= _value && _value > 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
// function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private whenNotPaused returns (bool success) {
require(_to != address(0));
require(balances[msg.sender] >= _value && _value > 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
emit Transfer(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
/**
* @dev Returns balance of the `_owner`.
*
* @param _owner The address whose balance will be returned.
* @return balance Balance of the `_owner`.
*/
function balanceOf(address _owner) constant external returns (uint balance) {
return balances[_owner];
}
}
contract ERC20BackedERC223 is ERC223Token{
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size.add(4));
_;
}
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3 * 32) whenNotPaused external returns (bool success) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) whenNotPaused public returns (bool success) {
require((balances[msg.sender] >= _value) && ((_value == 0) || (allowed[msg.sender][_spender] == 0)));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function disApprove(address _spender) whenNotPaused public returns (bool success)
{
allowed[msg.sender][_spender] = 0;
assert(allowed[msg.sender][_spender] == 0);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function increaseApproval(address _spender, uint _addedValue) whenNotPaused public returns (bool success) {
require(balances[msg.sender] >= allowed[msg.sender][_spender].add(_addedValue), "Callers balance not enough");
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) whenNotPaused public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
require((_subtractedValue != 0) && (oldValue > _subtractedValue) , "The amount to be decreased is incorrect");
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining) {
return allowed[_owner][_spender];
}
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
mapping (address => mapping (address => uint256)) allowed;
}
contract burnableERC223 is ERC20BackedERC223{
// This notifies clients about the amount burnt
uint256 public _totalBurnedTokens = 0;
event Burn(address indexed from, uint256 value);
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balances[msg.sender] >= _value, "Sender doesn't have enough balance"); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
_CAP = _CAP.sub(_value); // Updates totalSupply
_totalBurnedTokens = _totalBurnedTokens.add(_value);
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
require(balances[_from] >= _value , "target balance is not enough"); // Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
_CAP = _CAP.sub(_value); // Update totalSupply
emit Burn(_from, _value);
emit Transfer(_from, address(0), _value);
return true;
}
}
contract mintableERC223 is burnableERC223{
uint256 public _totalMinedSupply;
uint256 public _initialSupply;
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
bytes memory empty;
uint256 availableMinedSupply;
availableMinedSupply = (_totalMinedSupply.sub(_totalBurnedTokens)).add(_amount);
require(_CAP >= availableMinedSupply , "All tokens minted, Cap reached");
_totalMinedSupply = _totalMinedSupply.add(_amount);
if(_CAP <= _totalMinedSupply.sub(_totalBurnedTokens))
mintingFinished = true;
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
emit Transfer(address(0), _to, _amount, empty);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
/// @return total amount of tokens
function maximumSupply() public view returns (uint256 supply){
return _CAP;
}
/// @return total amount of tokens
function totalMinedSupply() public view returns (uint256 supply){
return _totalMinedSupply;
}
/// @return total amount of tokens
function preMinedSupply() public view returns (uint256 supply){
return _initialSupply;
}
function totalBurnedTokens() public view returns (uint256 supply){
return _totalBurnedTokens;
}
function totalSupply() public view returns (uint256 supply){
return _totalMinedSupply.sub(_totalBurnedTokens);
}
}
contract CyBit is mintableERC223{
/* Public variables of the token */
/*
NOTE:
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public name; //Name Of Token
uint256 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
string public symbol; //An identifier: eg SBX
string public version; //An Arbitrary versioning scheme.
uint256 private initialsupply;
uint256 private totalsupply;
constructor() public
{
decimals = 8;
name = "CyBit"; // Set the name for display purposes
symbol = "eCBT"; // Set the symbol for display purposes
version = "V1.0"; //Version.
initialsupply = 7000000000; //PreMined Tokens
totalsupply = 10000000000; //Total Tokens
_CAP = totalsupply.mul(10 ** decimals);
_initialSupply = initialsupply.mul(10 ** decimals);
_totalMinedSupply = _initialSupply;
balances[msg.sender] = _initialSupply;
}
function() public {
//not payable fallback function
revert();
}
/* Get the contract constant _name */
function version() public view returns (string _v) {
return version;
}
function name() public view returns (string _name) {
return name;
}
/* Get the contract constant _symbol */
function symbol() public view returns (string _symbol) {
return symbol;
}
/* Get the contract constant _decimals */
function decimals() public view returns (uint256 _decimals) {
return decimals;
}
}
pragma solidity 0.4.24;
/**
* @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) {
require(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) {
require(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner , "Unauthorized Access");
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface ERC223Interface {
function balanceOf(address who) constant external returns (uint);
function transfer(address to, uint value) external returns (bool success);
function transfer(address to, uint value, bytes data) external returns (bool success);
event Transfer(address indexed from, address indexed to, uint value, bytes data);
}
/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) external;
}
contract ERC20BackedERC223 is ERC223Interface{
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function disApprove(address _spender) public returns (bool success);
function increaseApproval(address _spender, uint _addedValue) public returns (bool success);
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining);
function name() public view returns (string _name);
/* Get the contract constant _symbol */
function symbol() public view returns (string _symbol);
/* Get the contract constant _decimals */
function decimals() public view returns (uint8 _decimals);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
library SafeERC20BackedERC223 {
function safeTransfer(ERC20BackedERC223 token, address to, uint256 value, bytes data) internal {
assert(token.transfer(to, value, data));
}
function safeTransfer(ERC20BackedERC223 token, address to, uint256 value) internal {
assert(token.transfer(to, value));
}
function safeTransferFrom(ERC20BackedERC223 token, address from, address to, uint256 value) internal {
assert(token.transferFrom(from, to, value));
}
function safeApprove(ERC20BackedERC223 token, address spender, uint256 value) internal {
assert(token.approve(spender, value));
}
}
contract CybitICOTokenVault is ERC223ReceivingContract, owned{
using SafeERC20BackedERC223 for ERC20BackedERC223;
ERC20BackedERC223 CybitToken;
struct Investor {
string fName;
string lName;
}
mapping (address => Investor) public investors;
address[] public investorAccts;
uint256 public numberOFApprovedInvestorAccounts;
constructor() public
{
CybitToken = ERC20BackedERC223(0x2a08c4B5CB8eC0b84beEC790741Ae92Bd1f921E3);
}
function tokenFallback(address _from, uint _value, bytes _data) external{
/* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function
* if data of token transaction is a function execution
*/
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
}
function() public {
//not payable fallback function
revert();
}
function sendApprovedTokensToInvestor(address _benificiary,uint256 _approvedamount,string _fName, string _lName) public onlyOwner
{
require(CybitToken.balanceOf(address(this)) > _approvedamount);
investors[_benificiary] = Investor({
fName: _fName,
lName: _lName
});
investorAccts.push(_benificiary) -1;
numberOFApprovedInvestorAccounts = investorAccts.length;
CybitToken.safeTransfer(_benificiary , _approvedamount);
}
function onlyPayForFuel() public payable onlyOwner{
// Owner will pay in contract to bear the gas price if transactions made from contract
}
function withdrawEtherFromcontract(uint _amountInwei) public onlyOwner{
require(address(this).balance > _amountInwei);
require(msg.sender == owner);
owner.transfer(_amountInwei);
}
function withdrawTokenFromcontract(ERC20BackedERC223 _token, uint256 _tamount) public onlyOwner{
require(_token.balanceOf(address(this)) > _tamount);
_token.safeTransfer(owner, _tamount);
}
}
pragma solidity 0.4.24;
/**
* @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) {
require(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) {
require(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner , "Unauthorized Access");
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface ERC223Interface {
function balanceOf(address who) constant external returns (uint);
function transfer(address to, uint value) external returns (bool success);
function transfer(address to, uint value, bytes data) external returns (bool success);
event Transfer(address indexed from, address indexed to, uint value, bytes data);
}
/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) external;
}
contract ERC20BackedERC223 is ERC223Interface{
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function disApprove(address _spender) public returns (bool success);
function increaseApproval(address _spender, uint _addedValue) public returns (bool success);
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining);
function name() public view returns (string _name);
/* Get the contract constant _symbol */
function symbol() public view returns (string _symbol);
/* Get the contract constant _decimals */
function decimals() public view returns (uint8 _decimals);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
library SafeERC20BackedERC223 {
function safeTransfer(ERC20BackedERC223 token, address to, uint256 value, bytes data) internal {
assert(token.transfer(to, value, data));
}
function safeTransfer(ERC20BackedERC223 token, address to, uint256 value) internal {
assert(token.transfer(to, value));
}
function safeTransferFrom(ERC20BackedERC223 token, address from, address to, uint256 value) internal {
assert(token.transferFrom(from, to, value));
}
function safeApprove(ERC20BackedERC223 token, address spender, uint256 value) internal {
assert(token.approve(spender, value));
}
}
contract ICOTokenVault is ERC223ReceivingContract, owned{
using SafeERC20BackedERC223 for ERC20BackedERC223;
ERC20BackedERC223 CybitToken;
event TokenReceived(address indexed from, uint value, string token_name);
constructor() public
{
CybitToken = ERC20BackedERC223(0x2a08c4B5CB8eC0b84beEC790741Ae92Bd1f921E3);
}
function tokenFallback(address _from, uint _value, bytes _data) external{
/* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function
* if data of token transaction is a function execution
*/
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
//uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24);
//tkn.sig = bytes4(u);
//require( tkn.sender == owner , "Only Owner can send" );
emit TokenReceived(tkn.sender,tkn.value,CybitToken.name());
}
function() public {
//not payable fallback function
revert();
}
function onlyPayForFuel() public payable onlyOwner{
// Owner will pay in contract to bear the gas price if transactions made from contract
}
function withdrawEtherFromcontract(uint _amountInwei) public onlyOwner{
require(address(this).balance > _amountInwei);
require(msg.sender == owner);
owner.transfer(_amountInwei);
}
function withdrawTokenFromcontract(ERC20BackedERC223 _token, uint256 _tamount) public onlyOwner{
require(_token.balanceOf(address(this)) > _tamount);
_token.safeTransfer(owner, _tamount);
}
}
pragma solidity 0.4.24;
/**
* @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) {
require(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) {
require(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner , "Unauthorized Access");
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface ERC223Interface {
function balanceOf(address who) constant external returns (uint);
function transfer(address to, uint value) external returns (bool success);
function transfer(address to, uint value, bytes data) external returns (bool success);
event Transfer(address indexed from, address indexed to, uint value, bytes data);
}
/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) external;
}
contract ERC20BackedERC223 is ERC223Interface{
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function disApprove(address _spender) public returns (bool success);
function increaseApproval(address _spender, uint _addedValue) public returns (bool success);
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining);
function name() public view returns (string _name);
/* Get the contract constant _symbol */
function symbol() public view returns (string _symbol);
/* Get the contract constant _decimals */
function decimals() public view returns (uint8 _decimals);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
library SafeERC20BackedERC223 {
function safeTransfer(ERC20BackedERC223 token, address to, uint256 value, bytes data) internal {
assert(token.transfer(to, value, data));
}
function safeTransfer(ERC20BackedERC223 token, address to, uint256 value) internal {
assert(token.transfer(to, value));
}
function safeTransferFrom(ERC20BackedERC223 token, address from, address to, uint256 value) internal {
assert(token.transferFrom(from, to, value));
}
function safeApprove(ERC20BackedERC223 token, address spender, uint256 value) internal {
assert(token.approve(spender, value));
}
}
contract TokenVesting is ERC223ReceivingContract, owned {
using SafeMath for uint256;
using SafeERC20BackedERC223 for ERC20BackedERC223;
event Released(uint256 amount);
event Revoked();
// beneficiary of tokens after they are released
address public beneficiary;
uint256 public cliff;
uint256 public start;
uint256 public duration;
string public benificiaryName;
bytes private paramData;
bool public revocable;
mapping (address => uint256) public released;
mapping (address => bool) public revoked;
/**
* @dev Creates a vesting contract that vests its balance of any ERC20 token to the
* _beneficiary, gradually in a linear fashion until _start + _duration. By then all
* of the balance will have vested.
* @param _beneficiary address of the beneficiary to whom vested tokens are transferred
* @param _cliff duration in seconds of the cliff in which tokens will begin to vest
* @param _duration duration in seconds of the period in which the tokens will vest
* @param _revocable whether the vesting is revocable or not
*/
constructor(
address _beneficiary,
uint256 _start,
uint256 _cliff,
uint256 _duration,
bool _revocable,
string _benficiaryName
)
public
{
require(_beneficiary != address(0));
require(_cliff <= _duration);
beneficiary = _beneficiary;
revocable = _revocable;
duration = _duration;
cliff = _start.add(_cliff);
start = _start;
benificiaryName = _benficiaryName;
paramData = bytes32ToBytes(stringToBytes32(_benficiaryName));
}
function tokenFallback(address _from, uint _value, bytes _data) external{
/* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function
* if data of token transaction is a function execution
*/
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
}
function stringToBytes32(string memory source) internal pure returns (bytes32 result) {
bytes memory tempEmptyStringTest = bytes(source);
if (tempEmptyStringTest.length == 0) {
return 0x0;
}
assembly {
result := mload(add(source, 32))
}
}
function bytes32ToBytes(bytes32 data) internal pure returns (bytes) {
uint i = 0;
while (i < 32 && uint(data[i]) != 0) {
++i;
}
bytes memory result = new bytes(i);
i = 0;
while (i < 32 && data[i] != 0) {
result[i] = data[i];
++i;
}
return result;
}
/**
* @notice Transfers vested tokens to beneficiary.
* @param token ERC223 token which is being vested
*/
function release(ERC20BackedERC223 token) public {
uint256 unreleased = releasableAmount(token);
require(unreleased > 0);
released[token] = released[token].add(unreleased);
token.safeTransfer(beneficiary, unreleased, paramData);
emit Released(unreleased);
}
/**
* @notice Allows the owner to revoke the vesting. Tokens already vested
* remain in the contract, the rest are returned to the owner.
* @param token ERC20 token which is being vested
*/
function revoke(ERC20BackedERC223 token) public onlyOwner {
require(revocable);
require(!revoked[token]);
uint256 balance = token.balanceOf(this);
uint256 unreleased = releasableAmount(token);
uint256 refund = balance.sub(unreleased);
revoked[token] = true;
token.safeTransfer(owner, refund, paramData);
emit Revoked();
}
/**
* @dev Calculates the amount that has already vested but hasn't been released yet.
* @param token ERC20 token which is being vested
*/
function releasableAmount(ERC20BackedERC223 token) public view returns (uint256) {
return vestedAmount(token).sub(released[token]);
}
/**
* @dev Calculates the amount that has already vested.
* @param token ERC20 token which is being vested
*/
function vestedAmount(ERC20BackedERC223 token) public view returns (uint256) {
uint256 currentBalance = token.balanceOf(this);
uint256 totalBalance = currentBalance.add(released[token]);
if (block.timestamp < cliff) {
return 0;
} else if (block.timestamp >= start.add(duration) || revoked[token]) {
return totalBalance;
} else {
return totalBalance.mul(block.timestamp.sub(start)).div(duration);
}
}
}
contract CybitTokenVestingFactory is ERC223ReceivingContract, owned {
using SafeMath for uint256;
using SafeERC20BackedERC223 for ERC20BackedERC223;
ERC20BackedERC223 CybitToken = ERC20BackedERC223(0x2a08c4B5CB8eC0b84beEC790741Ae92Bd1f921E3); //the deployed token address
struct Trustee{
string trusteeName;
address benificiary;
TokenVesting vestingForThisTrustee;
uint256 totalGrantedAmount;
uint256 start;
uint256 cliff;
uint256 duration;
bool revokable;
}
// Grants holder.
mapping (address => Trustee) public TrusteeBoard;
address[] public trusteeAccts;
event Created(TokenVesting vesting);
function tokenFallback(address _from, uint _value, bytes _data) external{
/* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function
* if data of token transaction is a function execution
*/
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
}
function create(address _beneficiary, uint256 _start, uint256 _cliff, uint256 _duration, bool _revocable, string _benficiaryName) internal returns (TokenVesting) {
TokenVesting vesting = new TokenVesting(_beneficiary, _start, _cliff, _duration, _revocable, _benficiaryName );
emit Created(vesting);
return vesting;
}
function VestTokens(address _beneficiary, uint256 _start, uint256 _cliff, uint256 _duration, bool _revocable, string _benficiaryName, uint256 _grantedAmount) onlyOwner public
{
require(CybitToken.balanceOf(address(this)) >= _grantedAmount);
uint256 tokendecimals = CybitToken.decimals();
uint256 fullgrantedAmount = _grantedAmount.mul(10 ** uint256(tokendecimals));
TokenVesting vest = create(_beneficiary, _start, _cliff, _duration, _revocable, _benficiaryName);
TrusteeBoard[_beneficiary] = Trustee({
trusteeName: _benficiaryName,
benificiary: _beneficiary,
vestingForThisTrustee: vest,
totalGrantedAmount: fullgrantedAmount,
start: _start,
cliff: _cliff,
duration: _duration,
revokable: _revocable
});
trusteeAccts.push(_beneficiary) -1;
CybitToken.safeTransfer(vest,fullgrantedAmount);
}
function callRealeseVestedAmount(address _beneficiary,TokenVesting _vested) public {
require((TrusteeBoard[_beneficiary].benificiary == _beneficiary && TrusteeBoard[_beneficiary].vestingForThisTrustee == _vested),"Member Not Found");
_vested.release(CybitToken);
}
function optionalRevoke(address _beneficiary,TokenVesting _vested) public onlyOwner{
require((TrusteeBoard[_beneficiary].benificiary == _beneficiary && TrusteeBoard[_beneficiary].vestingForThisTrustee == _vested),"Member Not Found");
require(TrusteeBoard[_beneficiary].revokable ,"Revoke not allowed");
_vested.revoke(CybitToken);
}
function readReleasableAmountOf(address _beneficiary,TokenVesting _vested) public view returns(uint256 _ramount)
{
assert(TrusteeBoard[_beneficiary].benificiary == _beneficiary && TrusteeBoard[_beneficiary].vestingForThisTrustee == _vested);
return _vested.releasableAmount(CybitToken);
}
function readVestedAmountOf(address _beneficiary,TokenVesting _vested) public view returns(uint256 _ramount)
{
assert(TrusteeBoard[_beneficiary].benificiary == _beneficiary && TrusteeBoard[_beneficiary].vestingForThisTrustee == _vested);
return _vested.vestedAmount(CybitToken);
}
//function for withdrawal of extra tokens
function withdrawTokenFromcontract(ERC20BackedERC223 _token, uint256 _tamount) public onlyOwner{
require(_token.balanceOf(address(this)) > _tamount);
_token.safeTransfer(owner, _tamount);
}
}
pragma solidity ^0.4.21;
/**
* @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;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is owned {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
interface ERC20Token {
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant external returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) external returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
}
contract StandardToken is ERC20Token, Pausable {
using SafeMath for uint;
modifier onlyPayloadSize(uint size) {
assert(msg.data.length == size.add(4));
_;
}
function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
//Default assumes totalSupply can't be over max (2^256 - 1).
//If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
//Replace the if with this one instead.
//if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
} else { return false; }
}
function balanceOf(address _owner) constant external returns (uint256 balance) {
return balances[_owner];
}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) whenNotPaused public returns (bool success) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining) {
return allowed[_owner][_spender];
}
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint256 public _totalSupply;
}
//The Contract Name
contract Solarex is StandardToken{
using SafeMath for uint;
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public name; //fancy name: eg Simon Bucks
uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
string public symbol; //An identifier: eg SBX
string public version = 'V1.0'; //Version 0.1 standard. Just an arbitrary versioning scheme.
uint256 private fulltoken;
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
//
// CHANGE THESE VALUES FOR YOUR TOKEN
//
//make sure this function name matches the contract name above. ERC20Token
function Solarex(
) public{
fulltoken = 2400000000;
decimals = 6; // Amount of decimals for display purposes
_totalSupply = fulltoken.mul(10 ** uint256(decimals)); // Update total supply (100000 for example)
balances[msg.sender] = _totalSupply; // Give the creator all initial tokens (100000 for example)
name = "Solarex"; // Set the name for display purposes
symbol = "SRX"; // Set the symbol for display purposes
}
function() public {
//not payable fallback function
revert();
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/// @return total amount of tokens
function totalSupply() constant public returns (uint256 supply){
return _totalSupply;
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balances[msg.sender] >= _value); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
_totalSupply = _totalSupply.sub(_value); // Updates totalSupply
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
require(balances[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
_totalSupply = _totalSupply.sub(_value); // Update totalSupply
emit Burn(_from, _value);
emit Transfer(_from, address(0), _value);
return true;
}
function onlyPayForFuel() public payable onlyOwner{
// Owner will pay in contract to bear the gas price if transactions made from contract
}
function withdrawEtherFromcontract(uint _amountInwei) public onlyOwner{
require(address(this).balance > _amountInwei);
require(msg.sender == owner);
owner.transfer(_amountInwei);
}
function withdrawTokensFromContract(uint _amountOfTokens) public onlyOwner{
require(balances[this] >= _amountOfTokens);
require(msg.sender == owner);
balances[msg.sender] = balances[msg.sender].add(_amountOfTokens); // adds the amount to owner's balance
balances[this] = balances[this].sub(_amountOfTokens); // subtracts the amount from contract balance
emit Transfer(this, msg.sender, _amountOfTokens); // execute an event reflecting the change
}
}
pragma solidity ^0.4.21;
/**
* @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;
require(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
require(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) {
require(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is owned {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
interface ERC223Interface {
function balanceOf(address _owner) constant external returns (uint256 balance);
function transfer(address to, uint value) external;
function transfer(address to, uint value, bytes data) external;
event Transfer(address indexed from, address indexed to, uint value, bytes data);
}
/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223ReceivingInterface {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) external;
}
interface ERC20Token {
function totalSupply() constant external returns (uint256 supply);
function initialSupply() constant external returns (uint256 supply);
function currentSupply() constant external returns (uint256 supply);
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant external returns (uint256 balance);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
}
contract StandardToken is ERC20Token, Pausable {
using SafeMath for uint;
modifier onlyPayloadSize(uint size) {
require(msg.data.length == size.add(4));
_;
}
uint256 public _totalSupply;
uint256 public _preminedSupply;
uint256 public _currentSupply;
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
} else { return false; }
}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) whenNotPaused public returns (bool success) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/// @return total amount of tokens
function totalSupply() constant external returns (uint256 supply){
return _totalSupply;
}
/// @return initial or premined amount of tokens
function preminedSupply() constant external returns (uint256 supply){
return _preminedSupply;
}
/// @return current supply of tokens
function currentSupply() constant external returns (uint256 supply){
return _currentSupply;
}
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
}
/**
* @title Reference implementation of the ERC223 standard token.
*/
contract mintableERC223Token is ERC223Interface, StandardToken {
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint _value, bytes _data) whenNotPaused external{
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
uint codeLength;
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if(codeLength>0) {
ERC223ReceivingInterface receiver = ERC223ReceivingInterface(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
emit Transfer(msg.sender, _to, _value, _data);
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
*/
function transfer(address _to, uint _value) whenNotPaused external{
uint codeLength;
bytes memory empty;
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if(codeLength>0) {
ERC223ReceivingInterface receiver = ERC223ReceivingInterface(_to);
receiver.tokenFallback(msg.sender, _value, empty);
}
emit Transfer(msg.sender, _to, _value, empty);
}
/**
* @dev Returns balance of the `_owner`.
*
* @param _owner The address whose balance will be returned.
* @return balance Balance of the `_owner`.
*/
function balanceOf(address _owner) constant external returns (uint256 balance) {
return balances[_owner];
}
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
_currentSupply = _currentSupply.add(_amount);
require(_totalSupply >= _currentSupply);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
//The Contract Name
contract CybitDev is mintableERC223Token{
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public name; //fancy name: eg Simon Bucks
uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
string public symbol; //An identifier: eg SBX
string public version = 'Test-V1.0'; //Version 0.1 standard. Just an arbitrary versioning scheme.
uint256 private fulltoken;
uint256 private initial_supply;
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
//
// CHANGE THESE VALUES FOR YOUR TOKEN
//
//make sure this function name matches the contract name above. ERC223Token
function CybitDev(
) public{
fulltoken = 10000000000;
initial_supply = 7000000000;
decimals = 8; // Amount of decimals for display purposes
_preminedSupply = initial_supply.mul(10 ** uint256(decimals));
_currentSupply = _preminedSupply;
_totalSupply = fulltoken.mul(10 ** uint256(decimals)); // Update total supply (100000 for example)
balances[msg.sender] = initial_supply; // Give the creator all initial tokens (100000 for example)
name = "Cybit"; // Set the name for display purposes
symbol = "CBT"; // Set the symbol for display purposes
}
function() public {
//not payable fallback function
revert();
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balances[msg.sender] >= _value); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
_totalSupply = _totalSupply.sub(_value); // Updates totalSupply
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
require(balances[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
_totalSupply = _totalSupply.sub(_value); // Update totalSupply
emit Burn(_from, _value);
emit Transfer(_from, address(0), _value);
return true;
}
function onlyPayForFuel() public payable onlyOwner{
// Owner will pay in contract to bear the gas price if transactions made from contract
}
function withdrawEtherFromcontract(uint _amountineth) public onlyOwner{
uint _amountInwei = _amountineth.mul(10 ** 18);
require(balances[this] > _amountInwei);
require(msg.sender == owner);
owner.transfer(_amountInwei);
}
function withdrawTokensFromContract(uint _amountOfTokens) public onlyOwner{
require(balances[this] > _amountOfTokens);
require(msg.sender == owner);
balances[msg.sender] = balances[msg.sender].add(_amountOfTokens); // adds the amount to owner's balance
balances[this] = balances[this].sub(_amountOfTokens); // subtracts the amount from contract balance
emit Transfer(this, msg.sender, _amountOfTokens); // execute an event reflecting the change
}
}
pragma solidity 0.4.24;
/**
* @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;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner , "Unauthorized Access");
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is owned {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
interface ERC223Interface {
function balanceOf(address who) constant external returns (uint);
function transfer(address to, uint value) external returns (bool success); //erc20 compatible
function transfer(address to, uint value, bytes data) external returns (bool success);
event Transfer(address indexed from, address indexed to, uint value, bytes data);
event Transfer(address indexed _from, address indexed _to, uint256 _value); //erc20 compatible
}
/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) external;
}
/**
* @title Reference implementation of the ERC223 standard token.
*/
contract ERC223Token is ERC223Interface, Pausable {
using SafeMath for uint;
uint256 public _CAP;
mapping(address => uint256) balances; // List of user balances.
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint _value, bytes _data) whenNotPaused external returns (bool success){
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
require(balances[msg.sender] >= _value && _value > 0);
if(isContract(_to)){
return transferToContract(_to, _value, _data);
}
else
{
return transferToAddress(_to, _value, _data);
}
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
*/
function transfer(address _to, uint _value) whenNotPaused external returns (bool success){
require(balances[msg.sender] >= _value && _value > 0);
bytes memory empty;
if(isContract(_to)){
return transferToContract(_to, _value, empty);
}
else
{
return transferToAddress(_to, _value, empty);
}
//emit Transfer(msg.sender, _to, _value, empty);
}
//assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) internal view returns (bool is_contract) {
// retrieve the size of the code on target address, this needs assembly
uint length;
assembly { length := extcodesize(_addr) }
if (length > 0)
return true;
else
return false;
}
// function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private whenNotPaused returns (bool success) {
require(_to != address(0));
require(balances[msg.sender] >= _value && _value > 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
// function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private whenNotPaused returns (bool success) {
require(_to != address(0));
require(balances[msg.sender] >= _value && _value > 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
emit Transfer(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
/**
* @dev Returns balance of the `_owner`.
*
* @param _owner The address whose balance will be returned.
* @return balance Balance of the `_owner`.
*/
function balanceOf(address _owner) constant external returns (uint balance) {
return balances[_owner];
}
}
contract ERC20BackedERC223 is ERC223Token{
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size.add(4));
_;
}
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3 * 32) whenNotPaused external returns (bool success) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) whenNotPaused public returns (bool success) {
require((balances[msg.sender] >= _value) && ((_value == 0) || (allowed[msg.sender][_spender] == 0)));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function disApprove(address _spender) whenNotPaused public returns (bool success)
{
allowed[msg.sender][_spender] = 0;
assert(allowed[msg.sender][_spender] == 0);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function increaseApproval(address _spender, uint _addedValue) whenNotPaused public returns (bool success) {
require(balances[msg.sender] >= allowed[msg.sender][_spender].add(_addedValue), "Callers balance not enough");
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) whenNotPaused public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
require((_subtractedValue != 0) && (oldValue > _subtractedValue) , "The amount to be decreased is incorrect");
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining) {
return allowed[_owner][_spender];
}
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
mapping (address => mapping (address => uint256)) allowed;
}
contract burnableERC223 is ERC20BackedERC223{
// This notifies clients about the amount burnt
uint256 public _totalBurnedTokens = 0;
event Burn(address indexed from, uint256 value);
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balances[msg.sender] >= _value, "Sender doesn't have enough balance"); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
_CAP = _CAP.sub(_value); // Updates totalSupply
_totalBurnedTokens = _totalBurnedTokens.add(_value);
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
require(balances[_from] >= _value , "target balance is not enough"); // Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
_CAP = _CAP.sub(_value); // Update totalSupply
emit Burn(_from, _value);
emit Transfer(_from, address(0), _value);
return true;
}
}
contract mintableERC223 is burnableERC223{
uint256 public _totalMinedSupply;
uint256 public _initialSupply;
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
bytes memory empty;
uint256 availableMinedSupply;
availableMinedSupply = (_totalMinedSupply.sub(_totalBurnedTokens)).add(_amount);
require(_CAP >= availableMinedSupply , "All tokens minted, Cap reached");
_totalMinedSupply = _totalMinedSupply.add(_amount);
if(_CAP <= _totalMinedSupply.sub(_totalBurnedTokens))
mintingFinished = true;
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
emit Transfer(address(0), _to, _amount, empty);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
/// @return total amount of tokens
function maximumSupply() public view returns (uint256 supply){
return _CAP;
}
/// @return total amount of tokens
function totalMinedSupply() public view returns (uint256 supply){
return _totalMinedSupply;
}
/// @return total amount of tokens
function preMinedSupply() public view returns (uint256 supply){
return _initialSupply;
}
function totalBurnedTokens() public view returns (uint256 supply){
return _totalBurnedTokens;
}
function totalSupply() public view returns (uint256 supply){
return _totalMinedSupply.sub(_totalBurnedTokens);
}
}
contract FairDiamondMining is mintableERC223{
/* Public variables of the token */
string public name; //Name Of Token
uint256 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
string public symbol; //An identifier: eg SBX
string public version; //An Arbitrary versioning scheme.
constructor() public
{
decimals = 3;
name = "Fair Diamond Mining"; // Set the name for display purposes
symbol = "FDM"; // Set the symbol for display purposes
version = "V1.0"; //Version.
_CAP = 48000000;
_initialSupply = 48000000;
_totalMinedSupply = 48000000;
balances[msg.sender] = 48000000;
}
function() public {
//not payable fallback function
revert();
}
/* Get the contract constant _name */
function version() public view returns (string _v) {
return version;
}
function name() public view returns (string _name) {
return name;
}
/* Get the contract constant _symbol */
function symbol() public view returns (string _symbol) {
return symbol;
}
/* Get the contract constant _decimals */
function decimals() public view returns (uint256 _decimals) {
return decimals;
}
}
pragma solidity 0.4.24;
/**
* @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;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner , "Unauthorized Access");
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is owned {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
interface ERC223Interface {
function balanceOf(address who) external view returns (uint);
function transfer(address to, uint value) external returns (bool success); //erc20 compatible
function transfer(address to, uint value, bytes data) external returns (bool success);
event Transfer(address indexed from, address indexed to, uint value, bytes data);
event Transfer(address indexed _from, address indexed _to, uint256 _value); //erc20 compatible
}
/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) external;
}
/**
* @title Reference implementation of the ERC223 standard token.
*/
contract ERC223Token is ERC223Interface, Pausable {
using SafeMath for uint;
uint256 public _CAP;
mapping(address => uint256) balances; // List of user balances.
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint _value, bytes _data) whenNotPaused external returns (bool success){
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
require(balances[msg.sender] >= _value && _value > 0);
if(isContract(_to)){
return transferToContract(_to, _value, _data);
}
else
{
return transferToAddress(_to, _value, _data);
}
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
*/
function transfer(address _to, uint _value) whenNotPaused external returns (bool success){
require(balances[msg.sender] >= _value && _value > 0);
bytes memory empty;
if(isContract(_to)){
return transferToContract(_to, _value, empty);
}
else
{
return transferToAddress(_to, _value, empty);
}
//emit Transfer(msg.sender, _to, _value, empty);
}
//assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) internal view returns (bool is_contract) {
// retrieve the size of the code on target address, this needs assembly
uint length;
assembly { length := extcodesize(_addr) }
if (length > 0)
return true;
else
return false;
}
// function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private whenNotPaused returns (bool success) {
require(_to != address(0));
require(balances[msg.sender] >= _value && _value > 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
// function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private whenNotPaused returns (bool success) {
require(_to != address(0));
require(balances[msg.sender] >= _value && _value > 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
emit Transfer(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
/**
* @dev Returns balance of the `_owner`.
*
* @param _owner The address whose balance will be returned.
* @return balance Balance of the `_owner`.
*/
function balanceOf(address _owner) external view returns (uint balance) {
return balances[_owner];
}
}
contract ERC20BackedERC223 is ERC223Token{
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size.add(4));
_;
}
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3 * 32) whenNotPaused external returns (bool success) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) whenNotPaused public returns (bool success) {
require(_spender != address(0));
require((balances[msg.sender] >= _value) && ((_value == 0) || (allowed[msg.sender][_spender] == 0)));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function disApprove(address _spender) whenNotPaused public returns (bool success)
{
require(_spender != address(0));
allowed[msg.sender][_spender] = 0;
assert(allowed[msg.sender][_spender] == 0);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function increaseApproval(address _spender, uint _addedValue) whenNotPaused public returns (bool success) {
require(_spender != address(0));
require(balances[msg.sender] >= allowed[msg.sender][_spender].add(_addedValue), "Callers balance not enough");
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) whenNotPaused public returns (bool success) {
require(_spender != address(0));
uint oldValue = allowed[msg.sender][_spender];
require((_subtractedValue != 0) && (oldValue > _subtractedValue) , "The amount to be decreased is incorrect");
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
mapping (address => mapping (address => uint256)) allowed;
}
contract burnableERC223 is ERC20BackedERC223{
// This notifies clients about the amount burnt
uint256 public _totalBurnedTokens = 0;
event Burn(address indexed from, uint256 value);
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balances[msg.sender] >= _value, "Sender doesn't have enough balance"); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
_CAP = _CAP.sub(_value); // Updates totalSupply
_totalBurnedTokens = _totalBurnedTokens.add(_value);
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
require(_from!= address(0));
require(balances[_from] >= _value , "target balance is not enough"); // Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
_CAP = _CAP.sub(_value); // Update totalSupply
emit Burn(_from, _value);
emit Transfer(_from, address(0), _value);
return true;
}
}
contract mintableERC223 is burnableERC223{
uint256 public _totalMinedSupply;
uint256 public _initialSupply;
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
require(_to != address(0));
bytes memory empty;
uint256 availableMinedSupply;
availableMinedSupply = (_totalMinedSupply.sub(_totalBurnedTokens)).add(_amount);
require(_CAP >= availableMinedSupply , "All tokens minted, Cap reached");
_totalMinedSupply = _totalMinedSupply.add(_amount);
if(_CAP <= _totalMinedSupply.sub(_totalBurnedTokens))
mintingFinished = true;
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
emit Transfer(address(0), _to, _amount, empty);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
/// @return total amount of tokens
function maximumSupply() public view returns (uint256 supply){
return _CAP;
}
/// @return total amount of tokens
function totalMinedSupply() public view returns (uint256 supply){
return _totalMinedSupply;
}
/// @return total amount of tokens
function preMinedSupply() public view returns (uint256 supply){
return _initialSupply;
}
function totalBurnedTokens() public view returns (uint256 supply){
return _totalBurnedTokens;
}
function totalSupply() public view returns (uint256 supply){
return _totalMinedSupply.sub(_totalBurnedTokens);
}
}
contract FairDiamondMining is mintableERC223{
/* Public variables of the token */
string public name; //Name Of Token
uint256 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
string public symbol; //An identifier: eg SBX
string public version; //An Arbitrary versioning scheme.
constructor() public
{
decimals = 3;
name = "Fair Diamond Mining"; // Set the name for display purposes
symbol = "FDM"; // Set the symbol for display purposes
version = "V1.0"; //Version.
_CAP = 48000000;
_initialSupply = 48000000;
_totalMinedSupply = 48000000;
balances[msg.sender] = 48000000;
}
function() public {
//not payable fallback function
revert();
}
/* Get the contract constant _name */
function version() public view returns (string _v) {
return version;
}
function name() public view returns (string _name) {
return name;
}
/* Get the contract constant _symbol */
function symbol() public view returns (string _symbol) {
return symbol;
}
/* Get the contract constant _decimals */
function decimals() public view returns (uint256 _decimals) {
return decimals;
}
}
pragma solidity 0.4.24;
/**
* @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;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is owned {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
interface ERC20Token {
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) view external returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) external returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
}
contract StandardToken is ERC20Token, Pausable {
using SafeMath for uint;
/**
Mitigation for short address attack
*/
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size.add(4));
_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3 * 32) whenNotPaused external returns (bool success) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
function balanceOf(address _owner) view external returns (uint256 balance) {
return balances[_owner];
}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) whenNotPaused public returns (bool success) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
require(_value <= balances[msg.sender]);
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint256 _addedValue) whenNotPaused public returns (bool)
{
allowed[msg.sender][_spender] = (allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender,uint256 _subtractedValue) whenNotPaused public returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
mapping (address => uint256) public balances;
mapping (address => mapping (address => uint256)) public allowed;
uint256 public _totalSupply;
}
//The Contract Name
contract GFT is StandardToken{
using SafeMath for uint;
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public name; //fancy name: eg Simon Bucks
uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
string public symbol; //An identifier: eg SBX
string public version = 'V1.0'; //Version 0.1 standard. Just an arbitrary versioning scheme.
uint256 private fulltoken;
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
//
// CHANGE THESE VALUES FOR YOUR TOKEN
//
//make sure this function name matches the contract name above. ERC20Token
constructor(
) public{
fulltoken = 1500000000;
decimals = 3; // Amount of decimals for display purposes
_totalSupply = fulltoken.mul(10 ** uint256(decimals)); // Update total supply (100000 for example)
balances[msg.sender] = _totalSupply; // Give the creator all initial tokens (100000 for example)
name = "GFT"; // Set the name for display purposes
symbol = "GFT"; // Set the symbol for display purposes
}
function() public {
//not payable fallback function
revert();
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/// @return total amount of tokens
function totalSupply() public view returns (uint256 supply){
return _totalSupply;
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balances[msg.sender] >= _value); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
_totalSupply = _totalSupply.sub(_value); // Updates totalSupply
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
require(balances[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
_totalSupply = _totalSupply.sub(_value); // Update totalSupply
emit Burn(_from, _value);
emit Transfer(_from, address(0), _value);
return true;
}
function onlyPayForFuel() public payable onlyOwner{
// Owner will pay in contract to bear the gas price if transactions made from contract
}
function withdrawEtherFromcontract(uint _amountInwei) public onlyOwner{
require(address(this).balance > _amountInwei);
require(msg.sender == owner);
owner.transfer(_amountInwei);
}
function withdrawTokensFromContract(uint _amountOfTokens) public onlyOwner{
require(balances[this] >= _amountOfTokens);
require(msg.sender == owner);
balances[msg.sender] = balances[msg.sender].add(_amountOfTokens); // adds the amount to owner's balance
balances[this] = balances[this].sub(_amountOfTokens); // subtracts the amount from contract balance
emit Transfer(this, msg.sender, _amountOfTokens); // execute an event reflecting the change
}
/* Get the contract constant _name */
function name() public view returns (string _name) {
return name;
}
/* Get the contract constant _symbol */
function symbol() public view returns (string _symbol) {
return symbol;
}
/* Get the contract constant _decimals */
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
}
pragma solidity 0.4.24;
/**
* @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) {
require(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) {
require(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner , "Unauthorized Access");
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract ERC20Token {
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) view external returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) external returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function disApprove(address _spender) public returns (bool success);
function increaseApproval(address _spender, uint _addedValue) public returns (bool success);
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining);
function name() public view returns (string _name);
/* Get the contract constant _symbol */
function symbol() public view returns (string _symbol);
/* Get the contract constant _decimals */
function decimals() public view returns (uint8 _decimals);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
}
library SafeERC20{
function safeTransfer(ERC20Token token, address to, uint256 value) internal {
assert(token.transfer(to, value));
}
function safeTransferFrom(ERC20Token token, address from, address to, uint256 value) internal {
assert(token.transferFrom(from, to, value));
}
function safeApprove(ERC20Token token, address spender, uint256 value) internal {
assert(token.approve(spender, value));
}
}
contract TokenVesting is owned {
using SafeMath for uint256;
using SafeERC20 for ERC20Token;
event Released(uint256 amount);
event Revoked();
// beneficiary of tokens after they are released
address public beneficiary;
uint256 public cliff;
uint256 public start;
uint256 public duration;
string public benificiaryName;
bytes private paramData;
bool public revocable;
mapping (address => uint256) public released;
mapping (address => bool) public revoked;
/**
* @dev Creates a vesting contract that vests its balance of any ERC20 token to the
* _beneficiary, gradually in a linear fashion until _start + _duration. By then all
* of the balance will have vested.
* @param _beneficiary address of the beneficiary to whom vested tokens are transferred
* @param _cliff duration in seconds of the cliff in which tokens will begin to vest
* @param _duration duration in seconds of the period in which the tokens will vest
* @param _revocable whether the vesting is revocable or not
*/
constructor(
address _beneficiary,
uint256 _start,
uint256 _cliff,
uint256 _duration,
bool _revocable,
string _benficiaryName
)
public
{
require(_beneficiary != address(0));
require(_cliff <= _duration);
beneficiary = _beneficiary;
revocable = _revocable;
duration = _duration;
cliff = _start.add(_cliff);
start = _start;
benificiaryName = _benficiaryName;
}
function stringToBytes32(string memory source) internal pure returns (bytes32 result) {
bytes memory tempEmptyStringTest = bytes(source);
if (tempEmptyStringTest.length == 0) {
return 0x0;
}
assembly {
result := mload(add(source, 32))
}
}
function bytes32ToBytes(bytes32 data) internal pure returns (bytes) {
uint i = 0;
while (i < 32 && uint(data[i]) != 0) {
++i;
}
bytes memory result = new bytes(i);
i = 0;
while (i < 32 && data[i] != 0) {
result[i] = data[i];
++i;
}
return result;
}
/**
* @notice Transfers vested tokens to beneficiary.
* @param token ERC223 token which is being vested
*/
function release(ERC20Token token) public {
uint256 unreleased = releasableAmount(token);
require(unreleased > 0);
released[token] = released[token].add(unreleased);
token.safeTransfer(beneficiary, unreleased);
emit Released(unreleased);
}
/**
* @notice Allows the owner to revoke the vesting. Tokens already vested
* remain in the contract, the rest are returned to the owner.
* @param token ERC20 token which is being vested
*/
function revoke(ERC20Token token) public onlyOwner {
require(revocable);
require(!revoked[token]);
uint256 balance = token.balanceOf(this);
uint256 unreleased = releasableAmount(token);
uint256 refund = balance.sub(unreleased);
revoked[token] = true;
token.safeTransfer(owner, refund);
emit Revoked();
}
/**
* @dev Calculates the amount that has already vested but hasn't been released yet.
* @param token ERC20 token which is being vested
*/
function releasableAmount(ERC20Token token) public view returns (uint256) {
return vestedAmount(token).sub(released[token]);
}
/**
* @dev Calculates the amount that has already vested.
* @param token ERC20 token which is being vested
*/
function vestedAmount(ERC20Token token) public view returns (uint256) {
uint256 currentBalance = token.balanceOf(this);
uint256 totalBalance = currentBalance.add(released[token]);
if (block.timestamp < cliff) {
return 0;
} else if (block.timestamp >= start.add(duration) || revoked[token]) {
return totalBalance;
} else {
return totalBalance.mul(block.timestamp.sub(start)).div(duration);
}
}
}
contract GFTTokenVestingFactory is owned {
using SafeMath for uint256;
using SafeERC20 for ERC20Token;
ERC20Token GFTToken = ERC20Token(0x668C027f7dD117109CAf3D322765Bad9406e2020); //the deployed token address
struct Trustee{
string trusteeName;
address benificiary;
TokenVesting vestingForThisTrustee;
uint256 totalGrantedAmount;
uint256 start;
uint256 cliff;
uint256 duration;
bool revokable;
bool registered;
}
// Grants holder.
mapping (address => Trustee) public TrusteeBoard;
Trustee[] public trusteeAccts;
event Created(TokenVesting vesting);
function create(address _beneficiary, uint256 _start, uint256 _cliff, uint256 _duration, bool _revocable, string _benficiaryName) internal returns (TokenVesting) {
TokenVesting vesting = new TokenVesting(_beneficiary, _start, _cliff, _duration, _revocable, _benficiaryName );
emit Created(vesting);
return vesting;
}
function VestTokens(address _beneficiary, uint256 _start, uint256 _cliff, uint256 _duration, bool _revocable, string _benficiaryName, uint256 _grantedAmount) onlyOwner public
{
require(GFTToken.balanceOf(address(this)) >= _grantedAmount,"Factory balance exhausted");
require(!TrusteeBoard[_beneficiary].registered,"The benificiary wallet Address already exists");
uint256 tokendecimals = GFTToken.decimals();
uint256 fullgrantedAmount = _grantedAmount.mul(10 ** uint256(tokendecimals));
TokenVesting vest = create(_beneficiary, _start, _cliff, _duration, _revocable, _benficiaryName);
TrusteeBoard[_beneficiary] = Trustee({
trusteeName: _benficiaryName,
benificiary: _beneficiary,
vestingForThisTrustee: vest,
totalGrantedAmount: fullgrantedAmount,
start: _start,
cliff: _cliff,
duration: _duration,
revokable: _revocable,
registered: true
});
trusteeAccts.push(TrusteeBoard[_beneficiary]) -1;
GFTToken.safeTransfer(vest,fullgrantedAmount);
}
function numberOfVestedContracts() public view returns(uint256 n)
{
return trusteeAccts.length;
}
function callRealeseVestedAmount(address _beneficiary,TokenVesting _vested) public {
require((TrusteeBoard[_beneficiary].benificiary == _beneficiary && TrusteeBoard[_beneficiary].vestingForThisTrustee == _vested),"Member Not Found");
_vested.release(GFTToken);
}
function optionalRevoke(address _beneficiary,TokenVesting _vested) public onlyOwner{
require((TrusteeBoard[_beneficiary].benificiary == _beneficiary && TrusteeBoard[_beneficiary].vestingForThisTrustee == _vested),"Member Not Found");
require(TrusteeBoard[_beneficiary].revokable ,"Revoke not allowed");
_vested.revoke(GFTToken);
}
function readReleasableAmountOf(address _beneficiary,TokenVesting _vested) public view returns(uint256 _ramount)
{
assert(TrusteeBoard[_beneficiary].benificiary == _beneficiary && TrusteeBoard[_beneficiary].vestingForThisTrustee == _vested);
return _vested.releasableAmount(GFTToken);
}
function readVestedAmountOf(address _beneficiary,TokenVesting _vested) public view returns(uint256 _ramount)
{
assert(TrusteeBoard[_beneficiary].benificiary == _beneficiary && TrusteeBoard[_beneficiary].vestingForThisTrustee == _vested);
return _vested.vestedAmount(GFTToken);
}
//function for withdrawal of extra tokens
function withdrawTokenFromcontract(ERC20Token _token, uint256 _tamount) public onlyOwner{
require(_token.balanceOf(address(this)) > _tamount);
_token.safeTransfer(owner, _tamount);
}
}
pragma solidity ^0.4.21;
/**
* @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;
require(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
require(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) {
require(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is owned {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
interface ERC223Interface {
// uint public totalSupply;
function balanceOf(address who) constant external returns (uint);
function transfer(address to, uint value) external;
function transfer(address to, uint value, bytes data) external;
event Transfer(address indexed from, address indexed to, uint value, bytes data);
}
/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) external;
}
/**
* @title Reference implementation of the ERC223 standard token.
*/
contract ERC223Token is ERC223Interface, Pausable {
using SafeMath for uint;
uint256 public _totalSupply;
mapping(address => uint) balances; // List of user balances.
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint _value, bytes _data) whenNotPaused external{
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
require(balances[msg.sender] >= _value && _value > 0);
uint codeLength;
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if(codeLength>0) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
emit Transfer(msg.sender, _to, _value, _data);
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
*/
function transfer(address _to, uint _value) whenNotPaused external{
require(balances[msg.sender] >= _value && _value > 0);
uint codeLength;
bytes memory empty;
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if(codeLength>0) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, empty);
}
emit Transfer(msg.sender, _to, _value, empty);
}
/**
* @dev Returns balance of the `_owner`.
*
* @param _owner The address whose balance will be returned.
* @return balance Balance of the `_owner`.
*/
function balanceOf(address _owner) constant external returns (uint balance) {
return balances[_owner];
}
}
contract ERC20BackedERC223 is ERC223Token{
event Transfer(address indexed _from, address indexed _to, uint256 _value);
modifier onlyPayloadSize(uint size) {
require(msg.data.length == size.add(4));
_;
}
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
} else { return false; }
}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) whenNotPaused public returns (bool success) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining) {
return allowed[_owner][_spender];
}
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
}
contract mintableERC223 is ERC20BackedERC223{
uint256 public _currentSupply;
uint256 public _initialSupply;
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
bytes memory empty;
_currentSupply = _currentSupply.add(_amount);
require(_totalSupply >= _currentSupply);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount, empty);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
contract cybit is mintableERC223{
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public name; //fancy name: eg Simon Bucks
uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
string public symbol; //An identifier: eg SBX
string public version = 'Test-V1.0'; //Version 0.1 standard. Just an arbitrary versioning scheme.
uint256 initialsupply;
uint256 totalsupply;
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
function cybit() public
{
decimals = 8;
name = "Cybit"; // Set the name for display purposes
symbol = "CBT"; // Set the symbol for display purposes
initialsupply = 7000000000;
totalsupply = 10000000000;
_totalSupply = totalsupply.mul(10 ** uint256(decimals));
_initialSupply = initialsupply.mul(10 ** uint256(decimals));
_currentSupply = _initialSupply;
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balances[msg.sender] >= _value); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
_totalSupply = _totalSupply.sub(_value); // Updates totalSupply
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
require(balances[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
_totalSupply = _totalSupply.sub(_value); // Update totalSupply
emit Burn(_from, _value);
emit Transfer(_from, address(0), _value);
return true;
}
}
{
"accounts": {
"account{0}": "0xe82e62cbeede5636a40672edea7e0a5690b5a4e9"
},
"linkReferences": {},
"transactions": [
{
"timestamp": 1541393806662,
"record": {
"value": "0",
"parameters": [],
"abi": "0xcbfc9f3ace1802ac45478ea2849968b5f2a6895f1c4beea8e29085ec84a2fe43",
"contractName": "AfricaToken",
"bytecode": "60806040523480156200001157600080fd5b5064098bca5a0033600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3620000f0336200026d640100000000026401000000009004565b6000600560006101000a81548160ff0219169083151502179055506200012533620002d7640100000000026401000000009004565b6000811115156200013557600080fd5b806007819055505062000161336359682f006200034164010000000002620016ec176401000000009004565b6040805190810160405280600b81526020017f416672696361546f6b656e00000000000000000000000000000000000000000081525060089080519060200190620001ae92919062000694565b506003600960006101000a81548160ff021916908360ff1602179055506040805190810160405280600681526020017f4146524943410000000000000000000000000000000000000000000000000000815250600a90805190602001906200021892919062000694565b506040805190810160405280600481526020017f56312e3000000000000000000000000000000000000000000000000000000000815250600b90805190602001906200026692919062000694565b5062000743565b62000291816004620003b164010000000002620023e5179091906401000000009004565b8073ffffffffffffffffffffffffffffffffffffffff167f6719d08c1888103bea251a4ed56406bd0c3e69723c8a1686e017e7bbe159b6f860405160405180910390a250565b620002fb816006620003b164010000000002620023e5179091906401000000009004565b8073ffffffffffffffffffffffffffffffffffffffff167f6ae172837ea30b801fbfcdd4108aa1d5bf8ff775444fd70256b44e6bf3dfc3f660405160405180910390a250565b6007546200037f826200036262000474640100000000026401000000009004565b6200047e64010000000002620021d7179091906401000000009004565b111515156200038d57600080fd5b620003ad8282620004a064010000000002620021f8176401000000009004565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515620003ee57600080fd5b620004098282620005ff640100000000026401000000009004565b1515156200041657600080fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b6000600254905090565b60008082840190508381101515156200049657600080fd5b8091505092915050565b60008273ffffffffffffffffffffffffffffffffffffffff1614151515620004c757600080fd5b620004ec816002546200047e64010000000002620021d7179091906401000000009004565b60028190555062000553816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546200047e64010000000002620021d7179091906401000000009004565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515156200063d57600080fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620006d757805160ff191683800117855562000708565b8280016001018555821562000708579182015b8281111562000707578251825591602001919060010190620006ea565b5b5090506200071791906200071b565b5090565b6200074091905b808211156200073c57600081600090555060010162000722565b5090565b90565b6124c180620007536000396000f300608060405260043610610175576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461017a578063095ea7b31461020a57806318160ddd1461026f57806323b872dd1461029a578063313ce5671461031f578063355274ea14610350578063395093511461037b5780633f4ba83a146103e057806340c10f19146103f757806342966c681461045c57806346fbf68e1461048957806354fd4d50146104e45780635c975abb146105745780636ef8d66d146105a357806370a08231146105ba578063715018a61461061157806379cc67901461062857806382dc1ec4146106755780638456cb59146106b85780638da5cb5b146106cf5780638f32d59b1461072657806395d89b4114610755578063983b2d56146107e55780639865027514610828578063a457c2d71461083f578063a9059cbb146108a4578063aa271e1a14610909578063dd62ed3e14610964578063f2fde38b146109db575b600080fd5b34801561018657600080fd5b5061018f610a1e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101cf5780820151818401526020810190506101b4565b50505050905090810190601f1680156101fc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561021657600080fd5b50610255600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ac0565b604051808215151515815260200191505060405180910390f35b34801561027b57600080fd5b50610284610af0565b6040518082815260200191505060405180910390f35b3480156102a657600080fd5b50610305600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610afa565b604051808215151515815260200191505060405180910390f35b34801561032b57600080fd5b50610334610b2c565b604051808260ff1660ff16815260200191505060405180910390f35b34801561035c57600080fd5b50610365610b43565b6040518082815260200191505060405180910390f35b34801561038757600080fd5b506103c6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b4d565b604051808215151515815260200191505060405180910390f35b3480156103ec57600080fd5b506103f5610b7d565b005b34801561040357600080fd5b50610442600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c2c565b604051808215151515815260200191505060405180910390f35b34801561046857600080fd5b5061048760048036038101908080359060200190929190505050610c56565b005b34801561049557600080fd5b506104ca600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c76565b604051808215151515815260200191505060405180910390f35b3480156104f057600080fd5b506104f9610c93565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561053957808201518184015260208101905061051e565b50505050905090810190601f1680156105665780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561058057600080fd5b50610589610d35565b604051808215151515815260200191505060405180910390f35b3480156105af57600080fd5b506105b8610d4c565b005b3480156105c657600080fd5b506105fb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d57565b6040518082815260200191505060405180910390f35b34801561061d57600080fd5b50610626610d9f565b005b34801561063457600080fd5b50610673600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e73565b005b34801561068157600080fd5b506106b6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e94565b005b3480156106c457600080fd5b506106cd610eb4565b005b3480156106db57600080fd5b506106e4610f64565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561073257600080fd5b5061073b610f8e565b604051808215151515815260200191505060405180910390f35b34801561076157600080fd5b5061076a610fe6565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156107aa57808201518184015260208101905061078f565b50505050905090810190601f1680156107d75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156107f157600080fd5b50610826600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611088565b005b34801561083457600080fd5b5061083d6110a8565b005b34801561084b57600080fd5b5061088a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110b3565b604051808215151515815260200191505060405180910390f35b3480156108b057600080fd5b506108ef600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e3565b604051808215151515815260200191505060405180910390f35b34801561091557600080fd5b5061094a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611113565b604051808215151515815260200191505060405180910390f35b34801561097057600080fd5b506109c5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611130565b6040518082815260200191505060405180910390f35b3480156109e757600080fd5b50610a1c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111b7565b005b606060088054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ab65780601f10610a8b57610100808354040283529160200191610ab6565b820191906000526020600020905b815481529060010190602001808311610a9957829003601f168201915b5050505050905090565b6000600560009054906101000a900460ff16151515610ade57600080fd5b610ae883836111d6565b905092915050565b6000600254905090565b6000600560009054906101000a900460ff16151515610b1857600080fd5b610b23848484611303565b90509392505050565b6000600960009054906101000a900460ff16905090565b6000600754905090565b6000600560009054906101000a900460ff16151515610b6b57600080fd5b610b7583836114b5565b905092915050565b610b8633610c76565b1515610b9157600080fd5b600560009054906101000a900460ff161515610bac57600080fd5b6000600560006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b6000610c3733611113565b1515610c4257600080fd5b610c4c83836116ec565b6001905092915050565b610c5e610f8e565b1515610c6957600080fd5b610c733382611724565b50565b6000610c8c8260046118af90919063ffffffff16565b9050919050565b6060600b8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d2b5780601f10610d0057610100808354040283529160200191610d2b565b820191906000526020600020905b815481529060010190602001808311610d0e57829003601f168201915b5050505050905090565b6000600560009054906101000a900460ff16905090565b610d5533611943565b565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610da7610f8e565b1515610db257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610e7b610f8e565b1515610e8657600080fd5b610e90828261199d565b5050565b610e9d33610c76565b1515610ea857600080fd5b610eb181611b45565b50565b610ebd33610c76565b1515610ec857600080fd5b600560009054906101000a900460ff16151515610ee457600080fd5b6001600560006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b6060600a8054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561107e5780601f106110535761010080835404028352916020019161107e565b820191906000526020600020905b81548152906001019060200180831161106157829003601f168201915b5050505050905090565b61109133611113565b151561109c57600080fd5b6110a581611b9f565b50565b6110b133611bf9565b565b6000600560009054906101000a900460ff161515156110d157600080fd5b6110db8383611c53565b905092915050565b6000600560009054906101000a900460ff1615151561110157600080fd5b61110b8383611e8a565b905092915050565b60006111298260066118af90919063ffffffff16565b9050919050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6111bf610f8e565b15156111ca57600080fd5b6111d381611ea1565b50565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561121357600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561139057600080fd5b61141f82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f9d90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114aa848484611fbe565b600190509392505050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156114f257600080fd5b61158182600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121d790919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600754611709826116fb610af0565b6121d790919063ffffffff16565b1115151561171657600080fd5b61172082826121f8565b5050565b60008273ffffffffffffffffffffffffffffffffffffffff161415151561174a57600080fd5b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115151561179757600080fd5b6117ac81600254611f9d90919063ffffffff16565b600281905550611803816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f9d90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515156118ec57600080fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b61195781600461233690919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167fcd265ebaf09df2871cc7bd4133404a235ba12eff2041bb89d9c714a2621c7c7e60405160405180910390a250565b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515611a2857600080fd5b611ab781600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f9d90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b418282611724565b5050565b611b598160046123e590919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f6719d08c1888103bea251a4ed56406bd0c3e69723c8a1686e017e7bbe159b6f860405160405180910390a250565b611bb38160066123e590919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f6ae172837ea30b801fbfcdd4108aa1d5bf8ff775444fd70256b44e6bf3dfc3f660405160405180910390a250565b611c0d81600661233690919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167fe94479a9f7e1952cc78f2d6baab678adc1b772d936c6583def489e524cb6669260405160405180910390a250565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611c9057600080fd5b611d1f82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f9d90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000611e97338484611fbe565b6001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611edd57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080838311151515611faf57600080fd5b82840390508091505092915050565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115151561200b57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561204757600080fd5b612098816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f9d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061212b816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121d790919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60008082840190508381101515156121ee57600080fd5b8091505092915050565b60008273ffffffffffffffffffffffffffffffffffffffff161415151561221e57600080fd5b612233816002546121d790919063ffffffff16565b60028190555061228a816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121d790919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561237257600080fd5b61237c82826118af565b151561238757600080fd5b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561242157600080fd5b61242b82826118af565b15151561243757600080fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050505600a165627a7a72305820aa0cc5701dae8cc3e2bdca7d8797acb09f61cd2754fade98087eb41231ffe65a0029",
"linkReferences": {},
"name": "",
"inputs": "()",
"type": "constructor",
"from": "account{0}"
}
}
],
"abis": {
"0xcbfc9f3ace1802ac45478ea2849968b5f2a6895f1c4beea8e29085ec84a2fe43": [
{
"constant": false,
"inputs": [
{
"name": "account",
"type": "address"
}
],
"name": "addMinter",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "account",
"type": "address"
}
],
"name": "addPauser",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "spender",
"type": "address"
},
{
"name": "value",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "value",
"type": "uint256"
}
],
"name": "burn",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "from",
"type": "address"
},
{
"name": "value",
"type": "uint256"
}
],
"name": "burnFrom",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "spender",
"type": "address"
},
{
"name": "subtractedValue",
"type": "uint256"
}
],
"name": "decreaseAllowance",
"outputs": [
{
"name": "success",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "spender",
"type": "address"
},
{
"name": "addedValue",
"type": "uint256"
}
],
"name": "increaseAllowance",
"outputs": [
{
"name": "success",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "to",
"type": "address"
},
{
"name": "value",
"type": "uint256"
}
],
"name": "mint",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "pause",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "renounceMinter",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "renouncePauser",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "to",
"type": "address"
},
{
"name": "value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "from",
"type": "address"
},
{
"name": "to",
"type": "address"
},
{
"name": "value",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "unpause",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "account",
"type": "address"
}
],
"name": "MinterAdded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "account",
"type": "address"
}
],
"name": "MinterRemoved",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "account",
"type": "address"
}
],
"name": "Paused",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "account",
"type": "address"
}
],
"name": "Unpaused",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "account",
"type": "address"
}
],
"name": "PauserAdded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "account",
"type": "address"
}
],
"name": "PauserRemoved",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "from",
"type": "address"
},
{
"indexed": true,
"name": "to",
"type": "address"
},
{
"indexed": false,
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "owner",
"type": "address"
},
{
"indexed": true,
"name": "spender",
"type": "address"
},
{
"indexed": false,
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"constant": true,
"inputs": [
{
"name": "owner",
"type": "address"
},
{
"name": "spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "cap",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "decimals",
"outputs": [
{
"name": "_decimals",
"type": "uint8"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "account",
"type": "address"
}
],
"name": "isMinter",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "isOwner",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "account",
"type": "address"
}
],
"name": "isPauser",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"name": "_name",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "owner",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "paused",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [
{
"name": "_symbol",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "version",
"outputs": [
{
"name": "_version",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
]
}
}
pragma solidity ^0.4.23;
/**
* @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) {
require(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) {
require(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is owned {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
interface ERC223Interface {
function balanceOf(address who) constant external returns (uint);
function transfer(address to, uint value) external;
function transfer(address to, uint value, bytes data) external;
event Transfer(address indexed from, address indexed to, uint value, bytes data);
}
/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) external;
}
/**
* @title Reference implementation of the ERC223 standard token.
*/
contract ERC223Token is ERC223Interface, Pausable {
using SafeMath for uint;
uint256 public _totalSupply;
mapping(address => uint256) balances; // List of user balances.
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint _value, bytes _data) whenNotPaused external{
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
require(balances[msg.sender] >= _value && _value > 0);
if(isContract(_to)){
transferToContract(_to, _value, _data);
}
else
{
transferToAddress(_to, _value, _data);
}
emit Transfer(msg.sender, _to, _value, _data);
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
*/
function transfer(address _to, uint _value) whenNotPaused external{
require(balances[msg.sender] >= _value && _value > 0);
bytes memory empty;
if(isContract(_to)){
transferToContract(_to, _value, empty);
}
else
{
transferToAddress(_to, _value, empty);
}
emit Transfer(msg.sender, _to, _value, empty);
}
//assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) internal view returns (bool is_contract) {
// retrieve the size of the code on target address, this needs assembly
uint length;
assembly { length := extcodesize(_addr) }
if (length > 0)
return true;
}
// function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private whenNotPaused returns (bool success) {
require(balances[msg.sender] >= _value && _value > 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
// function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private whenNotPaused returns (bool success) {
require(balances[msg.sender] >= _value && _value > 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
/**
* @dev Returns balance of the `_owner`.
*
* @param _owner The address whose balance will be returned.
* @return balance Balance of the `_owner`.
*/
function balanceOf(address _owner) constant external returns (uint balance) {
return balances[_owner];
}
}
contract ERC20BackedERC223 is ERC223Token{
event Transfer(address indexed _from, address indexed _to, uint256 _value);
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
} else { return false; }
}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) whenNotPaused public returns (bool success) {
require((balances[msg.sender] >= _value) && ((_value == 0) || (allowed[msg.sender][_spender] == 0)));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function disApprove(address _spender) whenNotPaused public returns (bool success)
{
allowed[msg.sender][_spender] = 0;
assert(allowed[msg.sender][_spender] == 0);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function increaseApproval(address _spender, uint _addedValue) whenNotPaused public returns (bool success) {
require(balances[msg.sender] >= allowed[msg.sender][_spender].add(_addedValue));
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) whenNotPaused public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
require((_subtractedValue != 0) && (oldValue > _subtractedValue));
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining) {
return allowed[_owner][_spender];
}
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
mapping (address => mapping (address => uint256)) allowed;
}
contract burnableERC223 is ERC20BackedERC223{
// This notifies clients about the amount burnt
uint256 public _totalBurnedTokens = 0;
event Burn(address indexed from, uint256 value);
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balances[msg.sender] >= _value); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
_totalSupply = _totalSupply.sub(_value); // Updates totalSupply
_totalBurnedTokens = _totalBurnedTokens.add(_value);
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
require(balances[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
_totalSupply = _totalSupply.sub(_value); // Update totalSupply
emit Burn(_from, _value);
emit Transfer(_from, address(0), _value);
return true;
}
}
contract mintableERC223 is burnableERC223{
uint256 public _currentSupply;
uint256 public _initialSupply;
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
bytes memory empty;
require(_totalSupply >= _currentSupply.add(_amount));
_currentSupply = _currentSupply.add(_amount);
if(_totalSupply < _currentSupply)
mintingFinished = true;
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount, empty);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
/// @return total amount of tokens
function totalSupply() public view returns (uint256 supply){
return _totalSupply;
}
/// @return total amount of tokens
function totalMinedSupply() public view returns (uint256 supply){
return _currentSupply;
}
/// @return total amount of tokens
function preMinedSupply() public view returns (uint256 supply){
return _initialSupply;
}
}
contract cybit is mintableERC223{
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public name; //fancy name: eg Simon Bucks
uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
string public symbol; //An identifier: eg SBX
string public version = 'Test-V1.0'; //Version 0.1 standard. Just an arbitrary versioning scheme.
uint256 private initialsupply;
uint256 private totalsupply;
constructor() public
{
decimals = 8;
name = "Cybit"; // Set the name for display purposes
symbol = "CBT"; // Set the symbol for display purposes
initialsupply = 7000000000;
totalsupply = 10000000000;
_totalSupply = totalsupply.mul(10 ** uint256(decimals));
_initialSupply = initialsupply.mul(10 ** uint256(decimals));
_currentSupply = _initialSupply;
balances[msg.sender] = _currentSupply;
//emit Mint(msg.sender, _initialSupply);
}
function() public {
//not payable fallback function
revert();
}
function version() public view returns (string _v) {
return version;
}
/* Get the contract constant _name */
function name() public view returns (string _name) {
return name;
}
/* Get the contract constant _symbol */
function symbol() public view returns (string _symbol) {
return symbol;
}
/* Get the contract constant _decimals */
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
}
pragma solidity ^0.4.21;
/**
* @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;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is owned {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
interface ERC20Token {
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant external returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) external returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
}
contract StandardToken is ERC20Token, Pausable {
using SafeMath for uint;
modifier onlyPayloadSize(uint size) {
assert(msg.data.length == size.add(4));
_;
}
function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
//Default assumes totalSupply can't be over max (2^256 - 1).
//If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
//Replace the if with this one instead.
//if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
} else { return false; }
}
function balanceOf(address _owner) constant external returns (uint256 balance) {
return balances[_owner];
}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) whenNotPaused public returns (bool success) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining) {
return allowed[_owner][_spender];
}
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint256 public _totalSupply;
}
//The Contract Name
contract Solarex is StandardToken{
using SafeMath for uint;
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public name; //fancy name: eg Simon Bucks
uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
string public symbol; //An identifier: eg SBX
string public version = 'V1.0'; //Version 0.1 standard. Just an arbitrary versioning scheme.
uint256 private fulltoken;
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
//
// CHANGE THESE VALUES FOR YOUR TOKEN
//
//make sure this function name matches the contract name above. ERC20Token
function Solarex(
) public{
fulltoken = 2400000000;
decimals = 6; // Amount of decimals for display purposes
_totalSupply = fulltoken.mul(10 ** uint256(decimals)); // Update total supply (100000 for example)
balances[msg.sender] = _totalSupply; // Give the creator all initial tokens (100000 for example)
name = "Solarex"; // Set the name for display purposes
symbol = "SRX"; // Set the symbol for display purposes
}
function() public {
//not payable fallback function
revert();
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/// @return total amount of tokens
function totalSupply() constant public returns (uint256 supply){
return _totalSupply;
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balances[msg.sender] >= _value); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
_totalSupply = _totalSupply.sub(_value); // Updates totalSupply
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
require(balances[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
_totalSupply = _totalSupply.sub(_value); // Update totalSupply
emit Burn(_from, _value);
emit Transfer(_from, address(0), _value);
return true;
}
function onlyPayForFuel() public payable onlyOwner{
// Owner will pay in contract to bear the gas price if transactions made from contract
}
function withdrawEtherFromcontract(uint _amountInwei) public onlyOwner{
require(address(this).balance > _amountInwei);
require(msg.sender == owner);
owner.transfer(_amountInwei);
}
function withdrawTokensFromContract(uint _amountOfTokens) public onlyOwner{
require(balances[this] >= _amountOfTokens);
require(msg.sender == owner);
balances[msg.sender] = balances[msg.sender].add(_amountOfTokens); // adds the amount to owner's balance
balances[this] = balances[this].sub(_amountOfTokens); // subtracts the amount from contract balance
emit Transfer(this, msg.sender, _amountOfTokens); // execute an event reflecting the change
}
}
pragma solidity ^0.4.21;
/**
* @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;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is owned {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
contract ERC223Interface {
uint public totalSupply;
function balanceOf(address who) public constant returns (uint);
function transfer(address to, uint value) external;
function transfer(address to, uint value, bytes data) external;
event Transfer(address indexed from, address indexed to, uint value, bytes data);
}
/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) public;
}
interface ERC20Token {
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant external returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) external returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
}
contract StandardToken is ERC20Token, Pausable {
using SafeMath for uint;
modifier onlyPayloadSize(uint size) {
assert(msg.data.length == size.add(4));
_;
}
function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
//Default assumes totalSupply can't be over max (2^256 - 1).
//If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
//Replace the if with this one instead.
//if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
} else { return false; }
}
function balanceOf(address _owner) constant external returns (uint256 balance) {
return balances[_owner];
}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) whenNotPaused public returns (bool success) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining) {
return allowed[_owner][_spender];
}
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint256 public _totalSupply;
}
//The Contract Name
contract SreeERC is StandardToken{
using SafeMath for uint;
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public name; //fancy name: eg Simon Bucks
uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
string public symbol; //An identifier: eg SBX
string public version = 'V1.0'; //Version 0.1 standard. Just an arbitrary versioning scheme.
uint256 private fulltoken;
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
//
// CHANGE THESE VALUES FOR YOUR TOKEN
//
//make sure this function name matches the contract name above. ERC20Token
function SreeERC(
) public{
fulltoken = 100000000;
decimals = 8; // Amount of decimals for display purposes
_totalSupply = fulltoken.mul(10 ** uint256(decimals)); // Update total supply (100000 for example)
balances[msg.sender] = _totalSupply; // Give the creator all initial tokens (100000 for example)
name = "SreeERC"; // Set the name for display purposes
symbol = "SERC"; // Set the symbol for display purposes
}
function() public {
//not payable fallback function
revert();
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/// @return total amount of tokens
function totalSupply() constant public returns (uint256 supply){
return _totalSupply;
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balances[msg.sender] >= _value); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
_totalSupply = _totalSupply.sub(_value); // Updates totalSupply
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
require(balances[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
_totalSupply = _totalSupply.sub(_value); // Update totalSupply
emit Burn(_from, _value);
emit Transfer(_from, address(0), _value);
return true;
}
function onlyPayForFuel() public payable onlyOwner{
// Owner will pay in contract to bear the gas price if transactions made from contract
}
function withdrawEtherFromcontract(uint _amountineth) public onlyOwner{
uint _amountInwei = _amountineth.mul(10 ** 18);
require(balances[this] > _amountInwei);
require(msg.sender == owner);
owner.transfer(_amountInwei);
}
function withdrawTokensFromContract(uint _amountOfTokens) public onlyOwner{
require(balances[this] > _amountOfTokens);
require(msg.sender == owner);
balances[msg.sender] = balances[msg.sender].add(_amountOfTokens); // adds the amount to owner's balance
balances[this] = balances[this].sub(_amountOfTokens); // subtracts the amount from contract balance
emit Transfer(this, msg.sender, _amountOfTokens); // execute an event reflecting the change
}
}
pragma solidity ^0.4.18;
/**
* @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;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is owned {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
interface ERC20Token {
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant external returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) external returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
}
contract StandardToken is ERC20Token, Pausable {
using SafeMath for uint;
modifier onlyPayloadSize(uint size) {
assert(msg.data.length == size.add(4));
_;
}
function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
//Default assumes totalSupply can't be over max (2^256 - 1).
//If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
//Replace the if with this one instead.
//if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
} else { return false; }
}
function balanceOf(address _owner) constant external returns (uint256 balance) {
return balances[_owner];
}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) whenNotPaused public returns (bool success) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining) {
return allowed[_owner][_spender];
}
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint256 public _totalSupply;
}
contract TokenVault is owned{
using SafeMath for uint256;
// The token being sold
StandardToken public token;
//Tokens available for Distribution
uint256 public totalDistributionAmount;
function TokenVault(StandardToken _tokenaddress) public{
token = _tokenaddress;
totalDistributionAmount = 0;
}
function set_Distribution_Amount(uint256 _amount) public onlyOwner
{
totalDistributionAmount = _amount;
}
}
pragma solidity 0.4.25;
/**
* @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;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is owned {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
interface ERC20Token {
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) view external returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) external returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
}
contract StandardToken is ERC20Token, Pausable {
using SafeMath for uint;
/**
Mitigation for short address attack
*/
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size.add(4));
_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3 * 32) whenNotPaused external returns (bool success) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
function balanceOf(address _owner) view external returns (uint256 balance) {
return balances[_owner];
}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) whenNotPaused public returns (bool success) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
require(_value <= balances[msg.sender]);
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint256 _addedValue) whenNotPaused public returns (bool)
{
allowed[msg.sender][_spender] = (allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender,uint256 _subtractedValue) whenNotPaused public returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
mapping (address => uint256) public balances;
mapping (address => mapping (address => uint256)) public allowed;
uint256 public _totalSupply;
}
//The Contract Name
contract TansalCoin is StandardToken{
using SafeMath for uint;
/* Public variables of the token */
string public name;
uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
string public symbol;
string public version = 'V1.0'; //Version 0.1 standard. Just an arbitrary versioning scheme.
uint256 private fulltoken;
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
// ERC20Token
constructor(
) public{
fulltoken = 700000000;
decimals = 3; // Amount of decimals for display purposes
_totalSupply = fulltoken.mul(10 ** uint256(decimals)); // Update total supply (100000 for example)
balances[msg.sender] = _totalSupply; // Give the creator all initial tokens (100000 for example)
name = "Tansal Coin"; // Set the name for display purposes
symbol = "TANSAL"; // Set the symbol for display purposes
}
function() public {
//not payable fallback function
revert();
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/// @return total amount of tokens
function totalSupply() public view returns (uint256 supply){
return _totalSupply;
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balances[msg.sender] >= _value); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
_totalSupply = _totalSupply.sub(_value); // Updates totalSupply
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
require(balances[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
_totalSupply = _totalSupply.sub(_value); // Update totalSupply
emit Burn(_from, _value);
emit Transfer(_from, address(0), _value);
return true;
}
function onlyPayForFuel() public payable onlyOwner{
// Owner will pay in contract to bear the gas price if transactions made from contract
}
function withdrawEtherFromcontract(uint _amountInwei) public onlyOwner{
require(address(this).balance > _amountInwei);
require(msg.sender == owner);
owner.transfer(_amountInwei);
}
function withdrawTokensFromContract(uint _amountOfTokens) public onlyOwner{
require(balances[this] >= _amountOfTokens);
require(msg.sender == owner);
balances[msg.sender] = balances[msg.sender].add(_amountOfTokens); // adds the amount to owner's balance
balances[this] = balances[this].sub(_amountOfTokens); // subtracts the amount from contract balance
emit Transfer(this, msg.sender, _amountOfTokens); // execute an event reflecting the change
}
/* Get the contract constant _name */
function name() public view returns (string _name) {
return name;
}
/* Get the contract constant _symbol */
function symbol() public view returns (string _symbol) {
return symbol;
}
/* Get the contract constant _decimals */
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
}
pragma solidity 0.4.25;
/**
* @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) {
require(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) {
require(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner , "Unauthorized Access");
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
interface ERC20Interface {
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) view external returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) external returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
function approve(address _spender, uint256 _value) external returns (bool success);
function disApprove(address _spender) external returns (bool success);
function increaseApproval(address _spender, uint _addedValue) external returns (bool success);
function decreaseApproval(address _spender, uint _subtractedValue) external returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant external returns (uint256 remaining);
function name() external view returns (string _name);
/* Get the contract constant _symbol */
function symbol() external view returns (string _symbol);
/* Get the contract constant _decimals */
function decimals() external view returns (uint8 _decimals);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
library SafeERC20{
function safeTransfer(ERC20Interface token, address to, uint256 value) internal {
assert(token.transfer(to, value));
}
function safeTransferFrom(ERC20Interface token, address from, address to, uint256 value) internal {
assert(token.transferFrom(from, to, value));
}
function safeApprove(ERC20Interface token, address spender, uint256 value) internal {
assert(token.approve(spender, value));
}
}
contract TansalICOTokenVault is owned{
using SafeERC20 for ERC20Interface;
ERC20Interface TansalCoin;
struct Investor {
string fName;
string lName;
uint256 totalTokenWithdrawn;
bool exists;
}
mapping (address => Investor) public investors;
address[] public investorAccts;
uint256 public numberOFApprovedInvestorAccounts;
constructor() public
{
TansalCoin = ERC20Interface(0x0EF0183E9Db9069a7207543db99a4Ec4d06f11cB);
}
function() public {
//not payable fallback function
revert();
}
function sendApprovedTokensToInvestor(address _benificiary,uint256 _approvedamount,string _fName, string _lName) public onlyOwner
{
uint256 totalwithdrawnamount;
require(TansalCoin.balanceOf(address(this)) > _approvedamount);
if(investors[_benificiary].exists)
{
uint256 alreadywithdrawn = investors[_benificiary].totalTokenWithdrawn;
totalwithdrawnamount = alreadywithdrawn + _approvedamount;
}
else
{
totalwithdrawnamount = _approvedamount;
investorAccts.push(_benificiary) -1;
}
investors[_benificiary] = Investor({
fName: _fName,
lName: _lName,
totalTokenWithdrawn: totalwithdrawnamount,
exists: true
});
numberOFApprovedInvestorAccounts = investorAccts.length;
TansalCoin.safeTransfer(_benificiary , _approvedamount);
}
function onlyPayForFuel() public payable onlyOwner{
// Owner will pay in contract to bear the gas price if transactions made from contract
}
function withdrawEtherFromcontract(uint _amountInwei) public onlyOwner{
require(address(this).balance > _amountInwei);
require(msg.sender == owner);
owner.transfer(_amountInwei);
}
function withdrawTokenFromcontract(ERC20Interface _token, uint256 _tamount) public onlyOwner{
require(_token.balanceOf(address(this)) > _tamount);
_token.safeTransfer(owner, _tamount);
}
}
pragma solidity 0.4.24;
/**
* @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;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is owned {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
interface ERC20Token {
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) view external returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) external returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
}
contract StandardToken is ERC20Token, Pausable {
using SafeMath for uint;
/**
Mitigation for short address attack
*/
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size.add(4));
_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3 * 32) whenNotPaused external returns (bool success) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
function balanceOf(address _owner) view external returns (uint256 balance) {
return balances[_owner];
}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) whenNotPaused public returns (bool success) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
require(_value <= balances[msg.sender]);
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint256 _addedValue) whenNotPaused public returns (bool)
{
allowed[msg.sender][_spender] = (allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender,uint256 _subtractedValue) whenNotPaused public returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
mapping (address => uint256) public balances;
mapping (address => mapping (address => uint256)) public allowed;
uint256 public _totalSupply;
}
//The Contract Name
contract GFT is StandardToken{
using SafeMath for uint;
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public name; //fancy name: eg Simon Bucks
uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
string public symbol; //An identifier: eg SBX
string public version = 'V1.0'; //Version 0.1 standard. Just an arbitrary versioning scheme.
uint256 private fulltoken;
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
//
// CHANGE THESE VALUES FOR YOUR TOKEN
//
//make sure this function name matches the contract name above. ERC20Token
constructor(
) public{
fulltoken = 1500000000;
decimals = 3; // Amount of decimals for display purposes
_totalSupply = fulltoken.mul(10 ** uint256(decimals)); // Update total supply (100000 for example)
balances[msg.sender] = _totalSupply; // Give the creator all initial tokens (100000 for example)
name = "GFT"; // Set the name for display purposes
symbol = "GFT"; // Set the symbol for display purposes
}
function() public {
//not payable fallback function
revert();
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/// @return total amount of tokens
function totalSupply() public view returns (uint256 supply){
return _totalSupply;
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balances[msg.sender] >= _value); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
_totalSupply = _totalSupply.sub(_value); // Updates totalSupply
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
require(balances[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
_totalSupply = _totalSupply.sub(_value); // Update totalSupply
emit Burn(_from, _value);
emit Transfer(_from, address(0), _value);
return true;
}
function onlyPayForFuel() public payable onlyOwner{
// Owner will pay in contract to bear the gas price if transactions made from contract
}
function withdrawEtherFromcontract(uint _amountInwei) public onlyOwner{
require(address(this).balance > _amountInwei);
require(msg.sender == owner);
owner.transfer(_amountInwei);
}
function withdrawTokensFromContract(uint _amountOfTokens) public onlyOwner{
require(balances[this] >= _amountOfTokens);
require(msg.sender == owner);
balances[msg.sender] = balances[msg.sender].add(_amountOfTokens); // adds the amount to owner's balance
balances[this] = balances[this].sub(_amountOfTokens); // subtracts the amount from contract balance
emit Transfer(this, msg.sender, _amountOfTokens); // execute an event reflecting the change
}
/* Get the contract constant _name */
function name() public view returns (string _name) {
return name;
}
/* Get the contract constant _symbol */
function symbol() public view returns (string _symbol) {
return symbol;
}
/* Get the contract constant _decimals */
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
}
pragma solidity ^0.4.23;
/**
* @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) {
require(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) {
require(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is owned {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
interface ERC223Interface {
function balanceOf(address who) constant external returns (uint);
function transfer(address to, uint value) external;
function transfer(address to, uint value, bytes data) external;
event Transfer(address indexed from, address indexed to, uint value, bytes data);
}
/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) external;
}
/**
* @title Reference implementation of the ERC223 standard token.
*/
contract ERC223Token is ERC223Interface, Pausable {
using SafeMath for uint;
uint256 public _totalMaxSupply;
mapping(address => uint256) balances; // List of user balances.
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint _value, bytes _data) whenNotPaused external{
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
require(balances[msg.sender] >= _value && _value > 0);
if(isContract(_to)){
transferToContract(_to, _value, _data);
}
else
{
transferToAddress(_to, _value, _data);
}
emit Transfer(msg.sender, _to, _value, _data);
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
*/
function transfer(address _to, uint _value) whenNotPaused external{
require(balances[msg.sender] >= _value && _value > 0);
bytes memory empty;
if(isContract(_to)){
transferToContract(_to, _value, empty);
}
else
{
transferToAddress(_to, _value, empty);
}
emit Transfer(msg.sender, _to, _value, empty);
}
//assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) internal view returns (bool is_contract) {
// retrieve the size of the code on target address, this needs assembly
uint length;
assembly { length := extcodesize(_addr) }
if (length > 0)
return true;
}
// function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private whenNotPaused returns (bool success) {
require(balances[msg.sender] >= _value && _value > 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
// function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private whenNotPaused returns (bool success) {
require(balances[msg.sender] >= _value && _value > 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
/**
* @dev Returns balance of the `_owner`.
*
* @param _owner The address whose balance will be returned.
* @return balance Balance of the `_owner`.
*/
function balanceOf(address _owner) constant external returns (uint balance) {
return balances[_owner];
}
}
contract ERC20BackedERC223 is ERC223Token{
event Transfer(address indexed _from, address indexed _to, uint256 _value);
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
} else { return false; }
}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) whenNotPaused public returns (bool success) {
require((balances[msg.sender] >= _value) && ((_value == 0) || (allowed[msg.sender][_spender] == 0)));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function disApprove(address _spender) whenNotPaused public returns (bool success)
{
allowed[msg.sender][_spender] = 0;
assert(allowed[msg.sender][_spender] == 0);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function increaseApproval(address _spender, uint _addedValue) whenNotPaused public returns (bool success) {
require(balances[msg.sender] >= allowed[msg.sender][_spender].add(_addedValue));
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) whenNotPaused public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
require((_subtractedValue != 0) && (oldValue > _subtractedValue));
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining) {
return allowed[_owner][_spender];
}
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
mapping (address => mapping (address => uint256)) allowed;
}
contract burnableERC223 is ERC20BackedERC223{
// This notifies clients about the amount burnt
uint256 public _totalBurnedTokens = 0;
event Burn(address indexed from, uint256 value);
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balances[msg.sender] >= _value); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
_totalMaxSupply = _totalMaxSupply.sub(_value); // Updates totalSupply
_totalBurnedTokens = _totalBurnedTokens.add(_value);
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
require(balances[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
_totalMaxSupply = _totalMaxSupply.sub(_value); // Update totalSupply
emit Burn(_from, _value);
emit Transfer(_from, address(0), _value);
return true;
}
}
contract mintableERC223 is burnableERC223{
uint256 public _totalMinedSupply;
uint256 public _initialSupply;
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
bytes memory empty;
uint256 availableMinedSupply;
availableMinedSupply = (_totalMinedSupply.sub(_totalBurnedTokens)).add(_amount);
require(_totalMaxSupply >= availableMinedSupply);
_totalMinedSupply = _totalMinedSupply.add(_amount);
if(_totalMaxSupply <= _totalMinedSupply.sub(_totalBurnedTokens))
mintingFinished = true;
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount, empty);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
/// @return total amount of tokens
function maximumAvailableSupply() public view returns (uint256 supply){
return _totalMaxSupply;
}
/// @return total amount of tokens
function totalMinedSupply() public view returns (uint256 supply){
return _totalMinedSupply;
}
/// @return total amount of tokens
function preMinedSupply() public view returns (uint256 supply){
return _initialSupply;
}
function totalBurnedTokens() public view returns (uint256 supply){
return _totalBurnedTokens;
}
function totalSupply() public view returns (uint256 supply){
return _totalMinedSupply.sub(_totalBurnedTokens);
}
}
contract cybit is mintableERC223{
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public name; //fancy name: eg Simon Bucks
uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
string public symbol; //An identifier: eg SBX
string public version = 'Test-V1.0'; //Version 0.1 standard. Just an arbitrary versioning scheme.
uint256 private initialsupply;
uint256 private totalsupply;
constructor() public
{
decimals = 8;
name = "Cybit"; // Set the name for display purposes
symbol = "CBT"; // Set the symbol for display purposes
initialsupply = 7000000000;
totalsupply = 10000000000;
_totalMaxSupply = totalsupply.mul(10 ** uint256(decimals));
_initialSupply = initialsupply.mul(10 ** uint256(decimals));
_totalMinedSupply = _initialSupply;
balances[msg.sender] = _totalMinedSupply;
//emit Mint(msg.sender, _initialSupply);
}
function() public {
//not payable fallback function
revert();
}
function version() public view returns (string _v) {
return version;
}
/* Get the contract constant _name */
function name() public view returns (string _name) {
return name;
}
/* Get the contract constant _symbol */
function symbol() public view returns (string _symbol) {
return symbol;
}
/* Get the contract constant _decimals */
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
}
pragma solidity ^0.4.17;
/* ERC20 contract interface */
/* With ERC23/ERC223 Extensions */
/* Fully backward compatible with ERC20 */
/* Recommended implementation used at https://github.com/Dexaran/ERC223-token-standard/tree/Recommended */
contract ERC20 {
uint public totalSupply;
// ERC223 and ERC20 functions and events
function balanceOf(address who) public constant returns (uint);
function totalSupply() constant public returns (uint256 _supply);
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
function transfer(address to, uint value, bytes data, string customFallback) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
// ERC223 functions
function name() constant public returns (string _name);
function symbol() constant public returns (string _symbol);
function decimals() constant public returns (uint8 _decimals);
// ERC20 functions and events
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function approve(address _spender, uint256 _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
/**
* Include SafeMath Lib
*/
contract SafeMath {
uint256 constant public MAX_UINT256 =
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
function safeAdd(uint256 x, uint256 y) constant internal returns (uint256 z) {
if (x > MAX_UINT256 - y)
revert();
return x + y;
}
function safeSub(uint256 x, uint256 y) constant internal returns (uint256 z) {
if (x < y) {
revert();
}
return x - y;
}
function safeMul(uint256 x, uint256 y) constant internal returns (uint256 z) {
if (y == 0) {
return 0;
}
if (x > MAX_UINT256 / y) {
revert();
}
return x * y;
}
}
/*
* Contract that is working with ERC223 tokens
*/
contract ContractReceiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) public {
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24);
tkn.sig = bytes4(u);
/* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function
* if data of token transaction is a function execution
*/
}
}
/*
* EDOGE is an ERC20 token with ERC223 Extensions
*/
contract EDOGE is ERC20, SafeMath {
string public name = "eDogecoin";
string public symbol = "EDOGE";
uint8 public decimals = 8;
uint256 public totalSupply = 100000000000 * 10**8;
address public owner;
bool public unlocked = false;
bool public tokenCreated = false;
mapping(address => uint256) balances;
mapping(address => mapping (address => uint256)) allowed;
// Initialize to have owner have 100,000,000,000 EDOGE on contract creation
// Constructor is called only once and can not be called again (Ethereum Solidity specification)
function EDOGE() public {
// Security check in case EVM has future flaw or exploit to call constructor multiple times
// Ensure token gets created once only
require(tokenCreated == false);
tokenCreated = true;
owner = msg.sender;
balances[owner] = totalSupply;
// Final sanity check to ensure owner balance is greater than zero
require(balances[owner] > 0);
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
// Function to distribute tokens to list of addresses by the provided amount
// Verify and require that:
// - Balance of owner cannot be negative
// - All transfers can be fulfilled with remaining owner balance
// - No new tokens can ever be minted except originally created 100,000,000,000
function distributeAirdrop(address[] addresses, uint256 amount) onlyOwner public {
// Only allow undrop while token is locked
// After token is unlocked, this method becomes permanently disabled
require(!unlocked);
// Amount is in Wei, convert to EDOGE amount in 8 decimal places
uint256 normalizedAmount = amount * 10**8;
// Only proceed if there are enough tokens to be distributed to all addresses
// Never allow balance of owner to become negative
require(balances[owner] >= safeMul(addresses.length, normalizedAmount));
for (uint i = 0; i < addresses.length; i++) {
balances[owner] = safeSub(balanceOf(owner), normalizedAmount);
balances[addresses[i]] = safeAdd(balanceOf(addresses[i]), normalizedAmount);
Transfer(owner, addresses[i], normalizedAmount);
}
}
// Function to access name of token .sha
function name() constant public returns (string _name) {
return name;
}
// Function to access symbol of token .
function symbol() constant public returns (string _symbol) {
return symbol;
}
// Function to access decimals of token .
function decimals() constant public returns (uint8 _decimals) {
return decimals;
}
// Function to access total supply of tokens .
function totalSupply() constant public returns (uint256 _totalSupply) {
return totalSupply;
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) public returns (bool success) {
// Only allow transfer once unlocked
// Once it is unlocked, it is unlocked forever and no one can lock again
require(unlocked);
if (isContract(_to)) {
if (balanceOf(msg.sender) < _value) {
revert();
}
balances[msg.sender] = safeSub(balanceOf(msg.sender), _value);
balances[_to] = safeAdd(balanceOf(_to), _value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.call.value(0)(bytes4(sha3(_custom_fallback)), msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
return true;
} else {
return transferToAddress(_to, _value, _data);
}
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data) public returns (bool success) {
// Only allow transfer once unlocked
// Once it is unlocked, it is unlocked forever and no one can lock again
require(unlocked);
if (isContract(_to)) {
return transferToContract(_to, _value, _data);
} else {
return transferToAddress(_to, _value, _data);
}
}
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
function transfer(address _to, uint _value) public returns (bool success) {
// Only allow transfer once unlocked
// Once it is unlocked, it is unlocked forever and no one can lock again
require(unlocked);
//standard function transfer similar to ERC20 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if (isContract(_to)) {
return transferToContract(_to, _value, empty);
} else {
return transferToAddress(_to, _value, empty);
}
}
// assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length > 0);
}
// function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) {
revert();
}
balances[msg.sender] = safeSub(balanceOf(msg.sender), _value);
balances[_to] = safeAdd(balanceOf(_to), _value);
Transfer(msg.sender, _to, _value, _data);
return true;
}
// function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) {
revert();
}
balances[msg.sender] = safeSub(balanceOf(msg.sender), _value);
balances[_to] = safeAdd(balanceOf(_to), _value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
return true;
}
// Get balance of the address provided
function balanceOf(address _owner) constant public returns (uint256 balance) {
return balances[_owner];
}
// Creator/Owner can unlocked it once and it can never be locked again
// Use after airdrop is complete
function unlockForever() onlyOwner public {
unlocked = true;
}
// Allow transfers if the owner provided an allowance
// Prevent from any transfers if token is not yet unlocked
// Use SafeMath for the main logic
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
// Only allow transfer once unlocked
// Once it is unlocked, it is unlocked forever and no one can lock again
require(unlocked);
// Protect against wrapping uints.
require(balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]);
uint256 allowance = allowed[_from][msg.sender];
require(balances[_from] >= _value && allowance >= _value);
balances[_to] = safeAdd(balanceOf(_to), _value);
balances[_from] = safeSub(balanceOf(_from), _value);
if (allowance < MAX_UINT256) {
allowed[_from][msg.sender] = safeSub(allowed[_from][msg.sender], _value);
}
Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool success) {
// Only allow transfer once unlocked
// Once it is unlocked, it is unlocked forever and no one can lock again
require(unlocked);
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant public returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
pragma solidity 0.4.24;
/**
* @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;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is owned {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
interface ERC20Token {
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) view external returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) external returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
}
contract StandardToken is ERC20Token, Pausable {
using SafeMath for uint;
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size.add(4));
_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
function balanceOf(address _owner) view external returns (uint256 balance) {
return balances[_owner];
}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) whenNotPaused public returns (bool success) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
require(_value <= balances[msg.sender]);
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint256 _addedValue) whenNotPaused public returns (bool)
{
allowed[msg.sender][_spender] = (allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender,uint256 _subtractedValue) whenNotPaused public returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
mapping (address => uint256) public balances;
mapping (address => mapping (address => uint256)) public allowed;
uint256 public _totalSupply;
}
//The Contract Name
contract GFT is StandardToken{
using SafeMath for uint;
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public name; //fancy name: eg Simon Bucks
uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
string public symbol; //An identifier: eg SBX
string public version = 'V1.0'; //Version 0.1 standard. Just an arbitrary versioning scheme.
uint256 private fulltoken;
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
//
// CHANGE THESE VALUES FOR YOUR TOKEN
//
//make sure this function name matches the contract name above. ERC20Token
constructor(
) public{
fulltoken = 1500000000;
decimals = 3; // Amount of decimals for display purposes
_totalSupply = fulltoken.mul(10 ** uint256(decimals)); // Update total supply (100000 for example)
balances[msg.sender] = _totalSupply; // Give the creator all initial tokens (100000 for example)
name = "GFT"; // Set the name for display purposes
symbol = "GFT"; // Set the symbol for display purposes
}
function() public {
//not payable fallback function
revert();
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/// @return total amount of tokens
function totalSupply() public view returns (uint256 supply){
return _totalSupply;
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balances[msg.sender] >= _value); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
_totalSupply = _totalSupply.sub(_value); // Updates totalSupply
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
require(balances[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
_totalSupply = _totalSupply.sub(_value); // Update totalSupply
emit Burn(_from, _value);
emit Transfer(_from, address(0), _value);
return true;
}
function onlyPayForFuel() public payable onlyOwner{
// Owner will pay in contract to bear the gas price if transactions made from contract
}
function withdrawEtherFromcontract(uint _amountInwei) public onlyOwner{
require(address(this).balance > _amountInwei);
require(msg.sender == owner);
owner.transfer(_amountInwei);
}
function withdrawTokensFromContract(uint _amountOfTokens) public onlyOwner{
require(balances[this] >= _amountOfTokens);
require(msg.sender == owner);
balances[msg.sender] = balances[msg.sender].add(_amountOfTokens); // adds the amount to owner's balance
balances[this] = balances[this].sub(_amountOfTokens); // subtracts the amount from contract balance
emit Transfer(this, msg.sender, _amountOfTokens); // execute an event reflecting the change
}
}
+pragma solidity 0.4.24;
+/**
+ * @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;
+ }
+}
+contract owned {
+ address public owner;
+ event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
+
+ constructor() public {
+ owner = msg.sender;
+ }
+
+ modifier onlyOwner {
+ require(msg.sender == owner);
+ _;
+ }
+
+ function transferOwnership(address newOwner) onlyOwner public {
+ require(newOwner != address(0));
+ emit OwnershipTransferred(owner, newOwner);
+ owner = newOwner;
+ }
+}
+
+contract Pausable is owned {
+ event Pause();
+ event Unpause();
+
+ bool public paused = false;
+
+ /**
+ * @dev Modifier to make a function callable only when the contract is not paused.
+ */
+ modifier whenNotPaused() {
+ require(!paused);
+ _;
+ }
+
+ /**
+ * @dev Modifier to make a function callable only when the contract is paused.
+ */
+ modifier whenPaused() {
+ require(paused);
+ _;
+ }
+
+ /**
+ * @dev called by the owner to pause, triggers stopped state
+ */
+ function pause() onlyOwner whenNotPaused public {
+ paused = true;
+ emit Pause();
+ }
+
+ /**
+ * @dev called by the owner to unpause, returns to normal state
+ */
+ function unpause() onlyOwner whenPaused public {
+ paused = false;
+ emit Unpause();
+ }
+}
+
+interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
+interface ERC20Token {
+
+
+
+ /// @param _owner The address from which the balance will be retrieved
+ /// @return The balance
+ function balanceOf(address _owner) view external returns (uint256 balance);
+
+ /// @notice send `_value` token to `_to` from `msg.sender`
+ /// @param _to The address of the recipient
+ /// @param _value The amount of token to be transferred
+ /// @return Whether the transfer was successful or not
+ function transfer(address _to, uint256 _value) external returns (bool success);
+
+ /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
+ /// @param _from The address of the sender
+ /// @param _to The address of the recipient
+ /// @param _value The amount of token to be transferred
+ /// @return Whether the transfer was successful or not
+ function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
+
+
+
+ event Transfer(address indexed _from, address indexed _to, uint256 _value);
+
+}
+
+
+
+contract StandardToken is ERC20Token, Pausable {
+ using SafeMath for uint;
+
+ /**
+ Mitigation for short address attack
+ */
+ modifier onlyPayloadSize(uint size) {
+ assert(msg.data.length >= size.add(4));
+ _;
+ }
+
+/**
+ * @dev Transfer token for a specified address
+ * @param _to The address to transfer to.
+ * @param _value The amount to be transferred.
+ */
+
+ function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
+ require(_to != address(0));
+ require(_value <= balances[msg.sender]);
+
+ balances[msg.sender] = balances[msg.sender].sub(_value);
+ balances[_to] = balances[_to].add(_value);
+ emit Transfer(msg.sender, _to, _value);
+ return true;
+ }
+ /**
+ * @dev Transfer tokens from one address to another
+ * @param _from address The address which you want to send tokens from
+ * @param _to address The address which you want to transfer to
+ * @param _value uint256 the amount of tokens to be transferred
+ */
+ function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3 * 32) whenNotPaused external returns (bool success) {
+ require(_to != address(0));
+ require(_value <= balances[_from]);
+ require(_value <= allowed[_from][msg.sender]);
+
+ balances[_from] = balances[_from].sub(_value);
+ balances[_to] = balances[_to].add(_value);
+ allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
+ emit Transfer(_from, _to, _value);
+ return true;
+ }
+
+ function balanceOf(address _owner) view external returns (uint256 balance) {
+ return balances[_owner];
+ }
+
+ /// @notice `msg.sender` approves `_addr` to spend `_value` tokens
+ /// @param _spender The address of the account able to transfer the tokens
+ /// @param _value The amount of wei to be approved for transfer
+ /// @return Whether the approval was successful or not
+ function approve(address _spender, uint256 _value) whenNotPaused public returns (bool success) {
+ require((_value == 0) || (allowed[msg.sender][_spender] == 0));
+ require(_value <= balances[msg.sender]);
+ allowed[msg.sender][_spender] = _value;
+ emit Approval(msg.sender, _spender, _value);
+ return true;
+ }
+
+
+
+ /// @param _owner The address of the account owning tokens
+ /// @param _spender The address of the account able to transfer the tokens
+ /// @return Amount of remaining tokens allowed to spent
+ function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
+ return allowed[_owner][_spender];
+ }
+
+ /**
+ * @dev Increase the amount of tokens that an owner allowed to a spender.
+ * approve should be called when allowed[_spender] == 0. To increment
+ * allowed value is better to use this function to avoid 2 calls (and wait until
+ * the first transaction is mined)
+ * From MonolithDAO Token.sol
+ * @param _spender The address which will spend the funds.
+ * @param _addedValue The amount of tokens to increase the allowance by.
+ */
+ function increaseApproval(address _spender, uint256 _addedValue) whenNotPaused public returns (bool)
+ {
+ allowed[msg.sender][_spender] = (allowed[msg.sender][_spender].add(_addedValue));
+ emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
+ return true;
+ }
+
+ /**
+ * @dev Decrease the amount of tokens that an owner allowed to a spender.
+ * approve should be called when allowed[_spender] == 0. To decrement
+ * allowed value is better to use this function to avoid 2 calls (and wait until
+ * the first transaction is mined)
+ * From MonolithDAO Token.sol
+ * @param _spender The address which will spend the funds.
+ * @param _subtractedValue The amount of tokens to decrease the allowance by.
+ */
+ function decreaseApproval(address _spender,uint256 _subtractedValue) whenNotPaused public returns (bool)
+ {
+ uint256 oldValue = allowed[msg.sender][_spender];
+ if (_subtractedValue > oldValue) {
+ allowed[msg.sender][_spender] = 0;
+ } else {
+ allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
+ }
+ emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
+ return true;
+ }
+
+ event Approval(address indexed _owner, address indexed _spender, uint256 _value);
+ mapping (address => uint256) public balances;
+ mapping (address => mapping (address => uint256)) public allowed;
+ uint256 public _totalSupply;
+}
+
+
+//The Contract Name
+contract GFT is StandardToken{
+ using SafeMath for uint;
+
+
+ /* Public variables of the token */
+
+ /*
+ NOTE:
+ The following variables are OPTIONAL vanities. One does not have to include them.
+ They allow one to customise the token contract & in no way influences the core functionality.
+ Some wallets/interfaces might not even bother to look at this information.
+ */
+ string public name; //fancy name: eg Simon Bucks
+ uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
+ string public symbol; //An identifier: eg SBX
+ string public version = 'V1.0'; //Version 0.1 standard. Just an arbitrary versioning scheme.
+ uint256 private fulltoken;
+ // This notifies clients about the amount burnt
+ event Burn(address indexed from, uint256 value);
+
+//
+// CHANGE THESE VALUES FOR YOUR TOKEN
+//
+
+//make sure this function name matches the contract name above. ERC20Token
+
+ constructor(
+ ) public{
+ fulltoken = 1500000000;
+ decimals = 3; // Amount of decimals for display purposes
+ _totalSupply = fulltoken.mul(10 ** uint256(decimals)); // Update total supply (100000 for example)
+ balances[msg.sender] = _totalSupply; // Give the creator all initial tokens (100000 for example)
+ name = "GFT"; // Set the name for display purposes
+ symbol = "GFT"; // Set the symbol for display purposes
+ }
+ function() public {
+ //not payable fallback function
+ revert();
+ }
+ /**
+ * Set allowance for other address and notify
+ *
+ * Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
+ *
+ * @param _spender The address authorized to spend
+ * @param _value the max amount they can spend
+ * @param _extraData some extra information to send to the approved contract
+ */
+ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
+ tokenRecipient spender = tokenRecipient(_spender);
+ if (approve(_spender, _value)) {
+ spender.receiveApproval(msg.sender, _value, this, _extraData);
+ return true;
+ }
+ }
+
+ /// @return total amount of tokens
+ function totalSupply() public view returns (uint256 supply){
+
+ return _totalSupply;
+ }
+
+ /**
+ * Destroy tokens
+ *
+ * Remove `_value` tokens from the system irreversibly
+ *
+ * @param _value the amount of money to burn
+ */
+ function burn(uint256 _value) onlyOwner public returns (bool success) {
+ require(balances[msg.sender] >= _value); // Check if the sender has enough
+ balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
+ _totalSupply = _totalSupply.sub(_value); // Updates totalSupply
+ emit Burn(msg.sender, _value);
+ emit Transfer(msg.sender, address(0), _value);
+ return true;
+ }
+
+ /**
+ * Destroy tokens from other account
+ *
+ * Remove `_value` tokens from the system irreversibly on behalf of `_from`.
+ *
+ * @param _from the address of the sender
+ * @param _value the amount of money to burn
+ */
+ function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
+ require(balances[_from] >= _value); // Check if the targeted balance is enough
+ require(_value <= allowed[_from][msg.sender]); // Check allowance
+ balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
+ allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
+ _totalSupply = _totalSupply.sub(_value); // Update totalSupply
+ emit Burn(_from, _value);
+ emit Transfer(_from, address(0), _value);
+ return true;
+ }
+ function onlyPayForFuel() public payable onlyOwner{
+ // Owner will pay in contract to bear the gas price if transactions made from contract
+
+ }
+ function withdrawEtherFromcontract(uint _amountInwei) public onlyOwner{
+ require(address(this).balance > _amountInwei);
+ require(msg.sender == owner);
+ owner.transfer(_amountInwei);
+
+ }
+ function withdrawTokensFromContract(uint _amountOfTokens) public onlyOwner{
+ require(balances[this] >= _amountOfTokens);
+ require(msg.sender == owner);
+ balances[msg.sender] = balances[msg.sender].add(_amountOfTokens); // adds the amount to owner's balance
+ balances[this] = balances[this].sub(_amountOfTokens); // subtracts the amount from contract balance
+ emit Transfer(this, msg.sender, _amountOfTokens); // execute an event reflecting the change
+
+ }
+
+}
pragma solidity 0.4.24;
/**
* @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;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner , "Unauthorized Access");
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is owned {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
interface ERC223Interface {
function balanceOf(address who) constant external returns (uint);
function transfer(address to, uint value) external returns (bool success); //erc20 compatible
function transfer(address to, uint value, bytes data) external returns (bool success);
event Transfer(address indexed from, address indexed to, uint value, bytes data);
event Transfer(address indexed _from, address indexed _to, uint256 _value); //erc20 compatible
}
/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) external;
}
/**
* @title Reference implementation of the ERC223 standard token.
*/
contract ERC223Token is ERC223Interface, Pausable {
using SafeMath for uint;
uint256 public _CAP;
mapping(address => uint256) balances; // List of user balances.
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint _value, bytes _data) whenNotPaused external returns (bool success){
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
require(balances[msg.sender] >= _value && _value > 0);
if(isContract(_to)){
return transferToContract(_to, _value, _data);
}
else
{
return transferToAddress(_to, _value, _data);
}
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
*/
function transfer(address _to, uint _value) whenNotPaused external returns (bool success){
require(balances[msg.sender] >= _value && _value > 0);
bytes memory empty;
if(isContract(_to)){
return transferToContract(_to, _value, empty);
}
else
{
return transferToAddress(_to, _value, empty);
}
//emit Transfer(msg.sender, _to, _value, empty);
}
//assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) internal view returns (bool is_contract) {
// retrieve the size of the code on target address, this needs assembly
uint length;
assembly { length := extcodesize(_addr) }
if (length > 0)
return true;
else
return false;
}
// function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private whenNotPaused returns (bool success) {
require(_to != address(0));
require(balances[msg.sender] >= _value && _value > 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
// function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private whenNotPaused returns (bool success) {
require(_to != address(0));
require(balances[msg.sender] >= _value && _value > 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
emit Transfer(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
/**
* @dev Returns balance of the `_owner`.
*
* @param _owner The address whose balance will be returned.
* @return balance Balance of the `_owner`.
*/
function balanceOf(address _owner) constant external returns (uint balance) {
return balances[_owner];
}
}
contract ERC20BackedERC223 is ERC223Token{
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size.add(4));
_;
}
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3 * 32) whenNotPaused external returns (bool success) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) whenNotPaused public returns (bool success) {
require((balances[msg.sender] >= _value) && ((_value == 0) || (allowed[msg.sender][_spender] == 0)));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function disApprove(address _spender) whenNotPaused public returns (bool success)
{
allowed[msg.sender][_spender] = 0;
assert(allowed[msg.sender][_spender] == 0);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function increaseApproval(address _spender, uint _addedValue) whenNotPaused public returns (bool success) {
require(balances[msg.sender] >= allowed[msg.sender][_spender].add(_addedValue), "Callers balance not enough");
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) whenNotPaused public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
require((_subtractedValue != 0) && (oldValue > _subtractedValue) , "The amount to be decreased is incorrect");
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining) {
return allowed[_owner][_spender];
}
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
mapping (address => mapping (address => uint256)) allowed;
}
contract burnableERC223 is ERC20BackedERC223{
// This notifies clients about the amount burnt
uint256 public _totalBurnedTokens = 0;
event Burn(address indexed from, uint256 value);
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balances[msg.sender] >= _value, "Sender doesn't have enough balance"); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
_CAP = _CAP.sub(_value); // Updates totalSupply
_totalBurnedTokens = _totalBurnedTokens.add(_value);
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
require(balances[_from] >= _value , "target balance is not enough"); // Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
_CAP = _CAP.sub(_value); // Update totalSupply
emit Burn(_from, _value);
emit Transfer(_from, address(0), _value);
return true;
}
}
contract mintableERC223 is burnableERC223{
uint256 public _totalMinedSupply;
uint256 public _initialSupply;
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
bytes memory empty;
uint256 availableMinedSupply;
availableMinedSupply = (_totalMinedSupply.sub(_totalBurnedTokens)).add(_amount);
require(_CAP >= availableMinedSupply , "All tokens minted, Cap reached");
_totalMinedSupply = _totalMinedSupply.add(_amount);
if(_CAP <= _totalMinedSupply.sub(_totalBurnedTokens))
mintingFinished = true;
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
emit Transfer(address(0), _to, _amount, empty);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
/// @return total amount of tokens
function maximumSupply() public view returns (uint256 supply){
return _CAP;
}
/// @return total amount of tokens
function totalMinedSupply() public view returns (uint256 supply){
return _totalMinedSupply;
}
/// @return total amount of tokens
function preMinedSupply() public view returns (uint256 supply){
return _initialSupply;
}
function totalBurnedTokens() public view returns (uint256 supply){
return _totalBurnedTokens;
}
function totalSupply() public view returns (uint256 supply){
return _totalMinedSupply.sub(_totalBurnedTokens);
}
}
contract CyBitInternal is mintableERC223{
/* Public variables of the token */
/*
NOTE:
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public name; //Name Of Token
uint256 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
string public symbol; //An identifier: eg SBX
string public version; //An Arbitrary versioning scheme.
uint256 private totalsupply;
constructor() public
{
decimals = 8;
name = "CyBit-Internal-Token"; // Set the name for display purposes
symbol = "iCBT"; // Set the symbol for display purposes
version = "V1.0"; //Version.
totalsupply = 5000000000; //Total Tokens
_CAP = totalsupply.mul(10 ** decimals);
_initialSupply = totalsupply.mul(10 ** decimals);
_totalMinedSupply = _initialSupply;
balances[msg.sender] = _initialSupply;
}
function() public {
//not payable fallback function
revert();
}
/* Get the contract constant _name */
function version() public view returns (string _v) {
return version;
}
function name() public view returns (string _name) {
return name;
}
/* Get the contract constant _symbol */
function symbol() public view returns (string _symbol) {
return symbol;
}
/* Get the contract constant _decimals */
function decimals() public view returns (uint256 _decimals) {
return decimals;
}
}
pragma solidity ^0.4.18;
/**
* @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;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is owned {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
interface ERC20Token {
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant external returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) external returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
}
contract StandardToken is ERC20Token, Pausable {
using SafeMath for uint;
modifier onlyPayloadSize(uint size) {
assert(msg.data.length == size.add(4));
_;
}
function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
//Default assumes totalSupply can't be over max (2^256 - 1).
//If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
//Replace the if with this one instead.
//if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(2 * 32) whenNotPaused external returns (bool success) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
} else { return false; }
}
function balanceOf(address _owner) constant external returns (uint256 balance) {
return balances[_owner];
}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) whenNotPaused public returns (bool success) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining) {
return allowed[_owner][_spender];
}
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint256 public _totalSupply;
}
//The Contract Name
contract zelitex is StandardToken{
using SafeMath for uint;
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public name; //fancy name: eg Simon Bucks
uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
string public symbol; //An identifier: eg SBX
string public version = 'V1.0'; //Version 0.1 standard. Just an arbitrary versioning scheme.
uint256 private fulltoken;
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
//
// CHANGE THESE VALUES FOR YOUR TOKEN
//
//make sure this function name matches the contract name above. ERC20Token
function zelitex(
) public{
fulltoken = 100000000;
decimals = 2; // Amount of decimals for display purposes
_totalSupply = fulltoken.mul(10 ** uint256(decimals)); // Update total supply (100000 for example)
balances[msg.sender] = _totalSupply; // Give the creator all initial tokens (100000 for example)
name = "Zelitex"; // Set the name for display purposes
symbol = "ZLX"; // Set the symbol for display purposes
}
function() public {
//not payable fallback function
revert();
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/// @return total amount of tokens
function totalSupply() constant public returns (uint256 supply){
return _totalSupply;
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balances[msg.sender] >= _value); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
_totalSupply = _totalSupply.sub(_value); // Updates totalSupply
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
require(balances[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
_totalSupply = _totalSupply.sub(_value); // Update totalSupply
emit Burn(_from, _value);
emit Transfer(_from, address(0), _value);
return true;
}
function onlyPayForFuel() public payable onlyOwner{
// Owner will pay in contract to bear the gas price if transactions made from contract
}
function withdrawEtherFromcontract(uint _amountineth) public onlyOwner{
uint _amountInwei = _amountineth.mul(10 ** 18);
require(balances[this] > _amountInwei);
require(msg.sender == owner);
owner.transfer(_amountInwei);
}
function withdrawTokensFromContract(uint _amountOfTokens) public onlyOwner{
require(balances[this] > _amountOfTokens);
require(msg.sender == owner);
balances[msg.sender] = balances[msg.sender].add(_amountOfTokens); // adds the amount to owner's balance
balances[this] = balances[this].sub(_amountOfTokens); // subtracts the amount from contract balance
emit Transfer(this, msg.sender, _amountOfTokens); // execute an event reflecting the change
}
}
pragma solidity ^0.4.18;
/**
* @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;
}
}
contract owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
interface ERC20Token {
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant external returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) external returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant external returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract StandardToken is ERC20Token {
using SafeMath for uint;
modifier onlyPayloadSize(uint size) {
assert(msg.data.length == size.add(4));
_;
}
function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) external returns (bool success) {
//Default assumes totalSupply can't be over max (2^256 - 1).
//If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
//Replace the if with this one instead.
//if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(2 * 32) external returns (bool success) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
} else { return false; }
}
function balanceOf(address _owner) constant external returns (uint256 balance) {
return balances[_owner];
}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) public returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant external returns (uint256 remaining) {
return allowed[_owner][_spender];
}
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint256 public _totalSupply;
}
//Main Contract
contract Zelitex is StandardToken, owned {
using SafeMath for uint;
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public name; //NAME
uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
string public symbol; //An identifier: eg SBX
string public version = 'V1.0'; //Version 0.1 standard. Just an arbitrary versioning scheme.
uint256 private fulltoken;
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
//constructor
function Zelitex(
) public{
fulltoken = 100000000 ;
decimals = 2; // Amount of decimals for display purposes
_totalSupply = fulltoken.mul(10 ** uint256(decimals)); // Update total supply (100000 for example)
balances[msg.sender] = _totalSupply; // Give the creator all initial tokens (100000 for example)
name = "Zelitex"; // Set the name for display purposes
symbol = "ZLX"; // Set the symbol for display purposes
}
function() public {
//not payable fallback function
revert();
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/// @return total amount of tokens
function totalSupply() constant public returns (uint256 supply){
return _totalSupply;
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) onlyOwner public returns (bool success) {
require(balances[msg.sender] >= _value); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
_totalSupply = _totalSupply.sub(_value); // Updates totalSupply
Burn(msg.sender, _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
require(balances[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
_totalSupply = _totalSupply.sub(_value); // Update totalSupply
Burn(_from, _value);
return true;
}
function onlyPayForFuel() public payable onlyOwner{
// Owner will pay in contract to bear the gas price if transactions made from contract
}
function withdrawEtherFromcontract(uint _amountineth) public onlyOwner{
uint _amountInwei = _amountineth.mul(10 ** 18);
require(this.balance > _amountInwei);
require(msg.sender == owner);
owner.transfer(_amountInwei);
}
function withdrawTokensFromContract(uint _amountOfTokens) public onlyOwner{
require(balances[this] > _amountOfTokens);
require(msg.sender == owner);
balances[msg.sender] = balances[msg.sender].add(_amountOfTokens); // adds the amount to owner's balance
balances[this] = balances[this].sub(_amountOfTokens); // subtracts the amount from contract balance
Transfer(this, msg.sender, _amountOfTokens); // execute an event reflecting the change
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment