ERC20
This contract is an ERC20 token.
Name
FoodCoin
Symbol
FOOD
Decimals
8
Total Supply
400,903,136 FOOD
About
Stats
Public Functions
32
Event Types
6
Code Size
24,820 bytes
Events (6) keyboard_arrow_up
State Variables (41) keyboard_arrow_up
verificationAddressHoldersListNumberMap Variable
mapping(address => mapping(uint256 => address)) help
Internal Variable
Functions
ownerOn keyboard_arrow_up
Modifiers help
isOwner checks for the following:
Requirements help
Source Code
function ownerOn(address _onOwnerAddress)
external
isOwner
returns (bool retrnVal)
{
// Check if it's a non-zero address
require(_onOwnerAddress != address(0));
// If the owner is already exist
if (ownerAddressNumberMap[_onOwnerAddress] > 0) {
// If the owner is disablead, activate him again
if (!ownerAddressMap[_onOwnerAddress]) {
ownerAddressMap[_onOwnerAddress] = true;
retrnVal = true;
} else {
retrnVal = false;
}
}
// If the owner is not exist
else {
ownerAddressMap[_onOwnerAddress] = true;
ownerAddressNumberMap[_onOwnerAddress] = ownerCountInt;
ownerListMap[ownerCountInt] = _onOwnerAddress;
ownerCountInt++;
retrnVal = true;
}
}
ownerOff keyboard_arrow_up
Modifiers help
isOwner checks for the following:
Source Code
function ownerOff(address _offOwnerAddress)
external
isOwner
returns (bool retrnVal)
{
// If owner exist and he is not 0 and active
// 0 owner can`t be off
if (
ownerAddressNumberMap[_offOwnerAddress] > 0 &&
ownerAddressMap[_offOwnerAddress]
) {
ownerAddressMap[_offOwnerAddress] = false;
retrnVal = true;
} else {
retrnVal = false;
}
}
contractNameUpdate keyboard_arrow_up
Modifiers help
isOwner checks for the following:
Source Code
function contractNameUpdate(string _newName, bool updateConfirmation)
external
isOwner
returns (bool retrnVal)
{
if (updateConfirmation) {
name = _newName;
retrnVal = true;
} else {
retrnVal = false;
}
}
contractSymbolUpdate keyboard_arrow_up
Modifiers help
isOwner checks for the following:
Source Code
function contractSymbolUpdate(string _newSymbol, bool updateConfirmation)
external
isOwner
returns (bool retrnVal)
{
if (updateConfirmation) {
symbol = _newSymbol;
retrnVal = true;
} else {
retrnVal = false;
}
}
contractDecimalsUpdate keyboard_arrow_up
Modifiers help
isOwner checks for the following:
Source Code
function contractDecimalsUpdate(uint256 _newDecimals, bool updateConfirmation)
external
isOwner
returns (bool retrnVal)
{
if (updateConfirmation && _newDecimals != decimals) {
decimals = _newDecimals;
retrnVal = true;
} else {
retrnVal = false;
}
}
emissionAddressUpdate keyboard_arrow_up
Modifiers help
isOwner checks for the following:
Source Code
function emissionAddressUpdate(address _newEmissionAddress) external isOwner {
emissionAddress = _newEmissionAddress;
}
withdrawAddressUpdate keyboard_arrow_up
Modifiers help
isOwner checks for the following:
Source Code
function withdrawAddressUpdate(address _newWithdrawAddress) external isOwner {
withdrawAddress = _newWithdrawAddress;
}
specialManagerOn keyboard_arrow_up
Modifiers help
isOwner checks for the following:
Requirements help
Source Code
function specialManagerOn(address _onSpecialManagerAddress)
external
isOwner
returns (bool retrnVal)
{
// Check if it's a non-zero address
require(_onSpecialManagerAddress != address(0));
// If this special manager already exists
if (specialManagerAddressNumberMap[_onSpecialManagerAddress] > 0) {
// If this special manager disabled, activate him again
if (!specialManagerAddressMap[_onSpecialManagerAddress]) {
specialManagerAddressMap[_onSpecialManagerAddress] = true;
retrnVal = true;
} else {
retrnVal = false;
}
}
// If this special manager doesn`t exist
else {
specialManagerAddressMap[_onSpecialManagerAddress] = true;
specialManagerAddressNumberMap[
_onSpecialManagerAddress
] = specialManagerCountInt;
specialManagerListMap[specialManagerCountInt] = _onSpecialManagerAddress;
specialManagerCountInt++;
retrnVal = true;
}
}
specialManagerOff keyboard_arrow_up
Modifiers help
isOwner checks for the following:
Source Code
function specialManagerOff(address _offSpecialManagerAddress)
external
isOwner
returns (bool retrnVal)
{
// If this special manager exists and he is non-zero and also active
// 0-number manager can`t be disactivated
if (
specialManagerAddressNumberMap[_offSpecialManagerAddress] > 0 &&
specialManagerAddressMap[_offSpecialManagerAddress]
) {
specialManagerAddressMap[_offSpecialManagerAddress] = false;
retrnVal = true;
} else {
retrnVal = false;
}
}
managerOn keyboard_arrow_up
Modifiers help
isOwner checks for the following:
Requirements help
Source Code
function managerOn(address _onManagerAddress)
external
isOwner
returns (bool retrnVal)
{
// Check if it's a non-zero address
require(_onManagerAddress != address(0));
// If this special manager exists
if (managerAddressNumberMap[_onManagerAddress] > 0) {
// If this special manager disabled, activate him again
if (!managerAddressMap[_onManagerAddress]) {
managerAddressMap[_onManagerAddress] = true;
retrnVal = true;
} else {
retrnVal = false;
}
}
// If this special manager doesn`t exist
else {
managerAddressMap[_onManagerAddress] = true;
managerAddressNumberMap[_onManagerAddress] = managerCountInt;
managerListMap[managerCountInt] = _onManagerAddress;
managerCountInt++;
retrnVal = true;
}
}
managerOff keyboard_arrow_up
Modifiers help
isOwner checks for the following:
Source Code
function managerOff(address _offManagerAddress)
external
isOwner
returns (bool retrnVal)
{
// if it's a non-zero manager and already exists and active
// 0-number manager can`t be disactivated
if (
managerAddressNumberMap[_offManagerAddress] > 0 &&
managerAddressMap[_offManagerAddress]
) {
managerAddressMap[_offManagerAddress] = false;
retrnVal = true;
} else {
retrnVal = false;
}
}
transactionsOnNowVal keyboard_arrow_up
Source Code
function transactionsOnNowVal(address addressFrom) public view returns (bool) {
return
(transactionsOnForHolder[addressFrom] == 0 && transactionsOn) ||
transactionsOnForHolder[addressFrom] == 2;
}
transactionsOnForHolderUpdate keyboard_arrow_up
Modifiers help
isOwner checks for the following:
Source Code
function transactionsOnForHolderUpdate(address _to, uint256 _newValue)
external
isOwner
{
if (transactionsOnForHolder[_to] != _newValue) {
transactionsOnForHolder[_to] = _newValue;
}
}
transactionsStatusUpdate keyboard_arrow_up
Modifiers help
isOwner checks for the following:
Source Code
function transactionsStatusUpdate(bool _on) external isOwner {
transactionsOn = _on;
}
emissionStatusUpdate keyboard_arrow_up
Modifiers help
isOwner checks for the following:
Source Code
function emissionStatusUpdate(bool _on) external isOwner {
emissionOn = _on;
}
tokenCreationCapUpdate keyboard_arrow_up
Modifiers help
isOwner checks for the following:
Source Code
function tokenCreationCapUpdate(uint256 _newVal) external isOwner {
tokenCreationCap = _newVal;
}
balanceOfOnUpdate keyboard_arrow_up
Modifiers help
isOwner checks for the following:
Source Code
function balanceOfOnUpdate(bool _on) external isOwner {
balanceOfOn = _on;
}
balanceOfOnForHolderUpdate keyboard_arrow_up
Modifiers help
isOwner checks for the following:
Source Code
function balanceOfOnForHolderUpdate(address _to, uint256 _newValue)
external
isOwner
{
if (balanceOfOnForHolder[_to] != _newValue) {
balanceOfOnForHolder[_to] = _newValue;
}
}
verificationAddressOn keyboard_arrow_up
Modifiers help
isOwner checks for the following:
Requirements help
Source Code
function verificationAddressOn(address _onVerificationAddress)
external
isOwner
returns (bool retrnVal)
{
// Check if it's a non-zero address
require(_onVerificationAddress != address(0));
// If this address is already exists
if (verificationAddressNumberMap[_onVerificationAddress] > 0) {
// If address off, activate it again
if (!verificationAddressMap[_onVerificationAddress]) {
verificationAddressMap[_onVerificationAddress] = true;
retrnVal = true;
} else {
retrnVal = false;
}
}
// If this address doesn`t exist
else {
verificationAddressMap[_onVerificationAddress] = true;
verificationAddressNumberMap[_onVerificationAddress] = verificationCountInt;
verificationListMap[verificationCountInt] = _onVerificationAddress;
verificationCountInt++;
retrnVal = true;
}
}
verificationOff keyboard_arrow_up
Modifiers help
isOwner checks for the following:
Source Code
function verificationOff(address _offVerificationAddress)
external
isOwner
returns (bool retrnVal)
{
// If this verification address exists and disabled
if (
verificationAddressNumberMap[_offVerificationAddress] > 0 &&
verificationAddressMap[_offVerificationAddress]
) {
verificationAddressMap[_offVerificationAddress] = false;
retrnVal = true;
} else {
retrnVal = false;
}
}
descriptionUpdate keyboard_arrow_up
Modifiers help
isOwner checks for the following:
Source Code
function descriptionUpdate(string _newVal) external isOwner {
description = _newVal;
DescriptionPublished(_newVal, msg.sender);
}
balanceOf keyboard_arrow_up
Source Code
function balanceOf(address _owner) external view returns (uint256) {
// If allows to display balance for all or definit holder
if (
(balanceOfOnForHolder[_owner] == 0 && balanceOfOn) ||
balanceOfOnForHolder[_owner] == 2
) {
return balances[_owner];
} else {
return 0;
}
}
balanceOfReal keyboard_arrow_up
allowance keyboard_arrow_up
balancesQuantity keyboard_arrow_up
transfer keyboard_arrow_up
Source Code
function transfer(address _to, uint256 _value) external returns (bool success) {
// If it is transfer to verification address
if (verificationAddressNumberMap[_to] > 0) {
_verification(msg.sender, _to, _value);
}
// Regular transfer
else {
// Call function transfer.
return _transfer(msg.sender, _to, _value);
}
}
transferFrom keyboard_arrow_up
Modifiers help
isTransactionsOn checks for the following:
null
Requirements help
Source Code
function transferFrom(
address _from,
address _to,
uint256 _value
) external isTransactionsOn(_from) returns (bool success) {
// Regular transfer. Not to verification address
require(verificationAddressNumberMap[_to] == 0);
// Check if the transfer initiator has permissions to move funds from the sender's account
if (allowed[_from][msg.sender] >= _value) {
// If yes - perform transfer
if (_transfer(_from, _to, _value)) {
// Decrease the total amount that initiator has permissions to access
allowed[_from][msg.sender] = safeSubtract(
allowed[_from][msg.sender],
_value
);
return true;
} else {
return false;
}
} else {
return false;
}
}
approve keyboard_arrow_up
Modifiers help
isTransactionsOn checks for the following:
null
Source Code
function approve(address _initiator, uint256 _value)
external
isTransactionsOn(msg.sender)
returns (bool success)
{
// Grant the rights for a certain amount of tokens only
allowed[msg.sender][_initiator] = _value;
// Initiate the Approval event
Approval(msg.sender, _initiator, _value);
return true;
}
tokenEmission keyboard_arrow_up
Modifiers help
isManagerOrOwner checks for the following:
One or more of the following:
-
ownerAddressMap for the sender's address
must be equal to
true
- OR
managerAddressMap for the sender's address
must be equal to
true
isEmissionOn checks for the following:
emissionOn must be true
Source Code
function tokenEmission(address _reciever, uint256 _amount)
external
isManagerOrOwner
isEmissionOn
returns (bool returnVal)
{
// Check if it's a non-zero address
require(_reciever != address(0));
// emission in process
returnVal = _emission(_reciever, _amount);
}
tokenEmission5 keyboard_arrow_up
Parameters help
Modifiers help
isManagerOrOwner checks for the following:
One or more of the following:
-
ownerAddressMap for the sender's address
must be equal to
true
- OR
managerAddressMap for the sender's address
must be equal to
true
isEmissionOn checks for the following:
emissionOn must be true
Source Code
function tokenEmission5(
address _reciever_0,
uint256 _amount_0,
address _reciever_1,
uint256 _amount_1,
address _reciever_2,
uint256 _amount_2,
address _reciever_3,
uint256 _amount_3,
address _reciever_4,
uint256 _amount_4
) external isManagerOrOwner isEmissionOn {
_emission(_reciever_0, _amount_0);
_emission(_reciever_1, _amount_1);
_emission(_reciever_2, _amount_2);
_emission(_reciever_3, _amount_3);
_emission(_reciever_4, _amount_4);
}
withdraw keyboard_arrow_up
Modifiers help
isSpecialManagerOrOwner checks for the following:
One or more of the following:
-
ownerAddressMap for the sender's address
must be equal to
true
- OR
specialManagerAddressMap for the sender's address
must be equal to
true
Source Code
function withdraw(address _to, uint256 _amount)
external
isSpecialManagerOrOwner
returns (
bool returnVal,
uint256 withdrawValue,
uint256 newBalancesValue
)
{
// check if this is a valid account
if (balances[_to] > 0) {
// Withdraw amount
uint256 amountTmp = _amount;
// It is impossible to withdraw more than available on balance
if (balances[_to] < _amount) {
amountTmp = balances[_to];
}
// Withdraw in process
balances[_to] = safeSubtract(balances[_to], amountTmp);
// Changing of current tokens amount
totalSupply = safeSubtract(totalSupply, amountTmp);
// Return reply
returnVal = true;
withdrawValue = amountTmp;
newBalancesValue = balances[_to];
FoodWithdrawEvent(msg.sender, _to, true, _amount, amountTmp, balances[_to]);
// Event "Token transfer"
Transfer(_to, withdrawAddress, amountTmp);
} else {
returnVal = false;
withdrawValue = 0;
newBalancesValue = 0;
FoodWithdrawEvent(msg.sender, _to, false, _amount, 0, balances[_to]);
}
}
balancesAddressDescriptionUpdate keyboard_arrow_up
Source Code
function balancesAddressDescriptionUpdate(string _newDescription)
external
returns (bool returnVal)
{
// If this address or contrat`s owher exists
if (
balancesListNumberMap[msg.sender] > 0 || ownerAddressMap[msg.sender] == true
) {
balancesAddressDescription[msg.sender] = _newDescription;
returnVal = true;
} else {
returnVal = false;
}
}
Internal Functions
Internal functions are parts of the contract that can't be used directly, but instead are used by the public functions listed above.
internal FoodcoinEcosystem._addClientAddress keyboard_arrow_up
Source Code
function _addClientAddress(address _balancesAddress, uint256 _amount) internal {
// check if this address is not on the list yet
if (balancesListNumberMap[_balancesAddress] == 0) {
// add it to the list
balancesListAddressMap[balancesCountInt] = _balancesAddress;
balancesListNumberMap[_balancesAddress] = balancesCountInt;
// increment account counter
balancesCountInt++;
}
// add tokens to the account
balances[_balancesAddress] = safeAdd(balances[_balancesAddress], _amount);
}
internal FoodcoinEcosystem._transfer keyboard_arrow_up
Modifiers help
isTransactionsOn checks for the following:
null
Source Code
function _transfer(
address _from,
address _to,
uint256 _value
) internal isTransactionsOn(_from) returns (bool success) {
// If the amount to transfer is greater than 0, and sender has funds available
if (_value > 0 && balances[_from] >= _value) {
// Subtract from sender account
balances[_from] -= _value;
// Add to receiver's account
_addClientAddress(_to, _value);
// Perform the transfer
Transfer(_from, _to, _value);
FoodTransferEvent(
_from,
_to,
_value,
msg.sender,
balances[_from],
balances[_to]
);
// Successfully completed transfer
return true;
}
// Return false if there are problems
else {
return false;
}
}
internal FoodcoinEcosystem._emission keyboard_arrow_up
Modifiers help
isManagerOrOwner checks for the following:
One or more of the following:
-
ownerAddressMap for the sender's address
must be equal to
true
- OR
managerAddressMap for the sender's address
must be equal to
true
isEmissionOn checks for the following:
emissionOn must be true
Source Code
function _emission(address _reciever, uint256 _amount)
internal
isManagerOrOwner
isEmissionOn
returns (bool returnVal)
{
// if non-zero address
if (_reciever != address(0)) {
// Calculate number of tokens after generation
uint256 checkedSupply = safeAdd(totalSupply, _amount);
// Emission amount
uint256 amountTmp = _amount;
// If emission cap settled additional emission is impossible
if (tokenCreationCap > 0 && tokenCreationCap < checkedSupply) {
amountTmp = 0;
}
// if try to add more than 0 tokens
if (amountTmp > 0) {
// If no error, add generated tokens to a given address
_addClientAddress(_reciever, amountTmp);
// increase total supply of tokens
totalSupply = checkedSupply;
// event "token transfer"
Transfer(emissionAddress, _reciever, amountTmp);
// event "emission successfull"
FoodTokenEmissionEvent(
msg.sender,
_reciever,
_amount,
true,
balances[_reciever]
);
} else {
returnVal = false;
// event "emission failed"
FoodTokenEmissionEvent(
msg.sender,
_reciever,
_amount,
false,
balances[_reciever]
);
}
}
}
internal FoodcoinEcosystem._verification keyboard_arrow_up
Source Code
function _verification(
address _from,
address _verificationAddress,
uint256 _value
) internal {
// If verification address is active
require(verificationAddressMap[_verificationAddress]);
// If it is updating of already verificated address
if (verificationHoldersVerifierAddressMap[_from] == _verificationAddress) {
// Verification Address Holders List Count
uint256 tmpNumberVerification = verificationAddressHoldersListCountMap[
_verificationAddress
];
verificationAddressHoldersListCountMap[_verificationAddress]++;
// Verification Address Holders List Number
verificationAddressHoldersListNumberMap[_verificationAddress][
tmpNumberVerification
] = _from;
}
// Verification Holders Timestamp
verificationHoldersTimestampMap[_from] = now;
// Verification Value
verificationHoldersValueMap[_from] = _value;
// Verification Holders Verifier Address
verificationHoldersVerifierAddressMap[_from] = _verificationAddress;
}
internal SafeMath.safeAdd keyboard_arrow_up
internal SafeMath.safeSubtract keyboard_arrow_up
Source Code
function safeSubtract(uint256 x, uint256 y) internal pure returns (uint256) {
assert(x >= y);
uint256 z = x - y;
return z;
}
internal SafeMath.safeMult keyboard_arrow_up
Requirements help
One or more of the following:
Source Code
function safeMult(uint256 x, uint256 y) internal pure returns (uint256) {
uint256 z = x * y;
assert((x == 0) || (z / x == y));
return z;
}
internal SafeMath.safeDiv keyboard_arrow_up
Source Code
function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b > 0);
uint256 c = a / b;
assert(a == b * c + (a % b));
return c;
}