Blockwell

Banker Token

ERC20

This contract is an ERC20 token.

Name Banker Token
Symbol BNK
Decimals 8
Total Supply 25,000,000,000 BNK

About link

Bankera (BNK) is a cryptocurrency and operates on the Ethereum platform. Bankera has a current supply of 25,000,000,000 with 24,798,912,107.742558 in circulation. The last known price of Bankera is 0.00054319 USD and is up 0.02 over the last 24 hours. It is currently trading on 4 active market(s) with $5,019.84 traded over the last 24 hours. More information can be found at https://bankera.com/.

Stats

Public Functions 34
Event Types 3
Code Size 22,670 bytes

Events (3) keyboard_arrow_up

Approval Event

Parameters help
_owner
address help
_spender
address help
_value
uint256 help

Transfer Event

Parameters help
_from
address help
_to
address help
_value
uint256 help

Transfer Event

Parameters help
_from
address help
_to
address help
_value
uint256 help
_data
bytes help

Reward Struct

Members
roundNumber
uint64 help
rewardInWei
uint256 help
rewardRate
uint256 help
isConfigured
bool help

AddressBalanceInfoStructure Struct

Members
addressBalance
uint256 help
roundBalanceMap
mapping(uint256 => uint256) help
wasModifiedInRoundMap
mapping(uint64 => bool) help
mapKeys
uint64[] help
claimedRewardTillRound
uint64 help
totalClaimedReward
uint256 help

name Constant

string help
Banker Token

symbol Constant

string help
BNK

decimals Constant

uint8 help
8

currentRound Variable

uint64 help

paused Variable

bool help

blocksPerRound Variable

uint256 help

lastBlockNumberInRound Variable

uint256 help

issuedTokensInRound Variable

mapping(uint64 => uint256) help

issued Variable

uint256 help
Internal Variable

totalTokens Variable

uint256 help
Internal Variable

contractOwner Variable

address help
Internal Variable

rewardManager Variable

address help
Internal Variable

roundManager Variable

address help
Internal Variable

issueManager Variable

address help
Internal Variable

reward Variable

mapping(uint64 => Reward) help
Internal Variable

accountBalances Variable

mapping(address => AddressBalanceInfoStructure) help
Internal Variable

allowed Variable

mapping(address => mapping(address => uint256)) help
Internal Variable

Functions Expand All Collapse All

safeMul keyboard_arrow_up

Parameters help

Name Type
a
uint256 help
b
uint256 help

Properties

Visibility help public
Mutability help pure
Source Code
function safeMul(uint256 a, uint256 b) public pure returns (uint256) {
  uint256 c = a * b;
  assert(a == 0 || c / a == b);
  return c;
}

safeDiv keyboard_arrow_up

Parameters help

Name Type
a
uint256 help
b
uint256 help

Properties

Visibility help public
Mutability help pure
Source Code
function safeDiv(uint256 a, uint256 b) public pure returns (uint256) {
  //assert(a > 0);// Solidity automatically throws when dividing by 0
  //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 a / b;
}

safeSub keyboard_arrow_up

Parameters help

Name Type
a
uint256 help
b
uint256 help

Properties

Visibility help public
Mutability help pure

Requirements help

Source Code
function safeSub(uint256 a, uint256 b) public pure returns (uint256) {
  assert(b <= a);
  return a - b;
}

safeAdd keyboard_arrow_up

Parameters help

Name Type
a
uint256 help
b
uint256 help

Properties

Visibility help public
Mutability help pure
Source Code
function safeAdd(uint256 a, uint256 b) public pure returns (uint256) {
  uint256 c = a + b;
  assert(c >= a && c >= b);
  return c;
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help constant
Source Code
function totalSupply() public constant returns (uint256) {
  return totalTokens;
}

Parameters help

Name Type
_owner
address help

Properties

Visibility help public
Mutability help constant
Source Code
function balanceOf(address _owner) public constant returns (uint256 balance) {
  return accountBalances[_owner].addressBalance;
}

Parameters help

Name Type
_to
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function transfer(address _to, uint256 _value)
  public
  notSelf(_to)
  whenNotPaused
  returns (bool success)
{
  require(_to != address(0));
  //added due to backwards compatibility reasons
  bytes memory empty;
  if (isContract(_to)) {
    return transferToContract(msg.sender, _to, _value, empty);
  } else {
    return transferToAddress(msg.sender, _to, _value, empty);
  }
}

Parameters help

Name Type
_from
address help
_to
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function transferFrom(
  address _from,
  address _to,
  uint256 _value
) public whenNotPaused returns (bool) {
  require(_to != address(0));
  require(_value <= allowed[_from][msg.sender]);

  //added due to backwards compatibility reasons
  bytes memory empty;
  if (isContract(_to)) {
    require(transferToContract(_from, _to, _value, empty));
  } else {
    require(transferToAddress(_from, _to, _value, empty));
  }
  allowed[_from][msg.sender] = safeSub(allowed[_from][msg.sender], _value);
  return true;
}

Parameters help

Name Type
_spender
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function approve(address _spender, uint256 _value)
  public
  whenNotPaused
  returns (bool)
{
  allowed[msg.sender][_spender] = _value;
  Approval(msg.sender, _spender, _value);
  return true;
}

Parameters help

Name Type
_owner
address help
_spender
address help

Properties

Visibility help public
Mutability help view

Modifiers help

Source Code
function allowance(address _owner, address _spender)
  public
  view
  whenNotPaused
  returns (uint256)
{
  return allowed[_owner][_spender];
}

Parameters help

Name Type
_to
address help
_value
uint256 help
_data
bytes help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function transfer(
  address _to,
  uint256 _value,
  bytes _data
) public whenNotPaused notSelf(_to) returns (bool success) {
  require(_to != address(0));
  if (isContract(_to)) {
    return transferToContract(msg.sender, _to, _value, _data);
  } else {
    return transferToAddress(msg.sender, _to, _value, _data);
  }
}

Parameters help

Name Type
_to
address help
_value
uint256 help
_data
bytes help
_custom_fallback
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function transfer(
  address _to,
  uint256 _value,
  bytes _data,
  string _custom_fallback
) public whenNotPaused notSelf(_to) returns (bool success) {
  require(_to != address(0));
  if (isContract(_to)) {
    if (accountBalances[msg.sender].addressBalance < _value) {
      // Check if the sender has enough
      revert();
    }
    if (
      safeAdd(accountBalances[_to].addressBalance, _value) <
      accountBalances[_to].addressBalance
    ) {
      // Check for overflows
      revert();
    }

    isNewRound();
    subFromAddressBalancesInfo(msg.sender, _value); // Subtract from the sender
    addToAddressBalancesInfo(_to, _value); // Add the same to the recipient

    assert(
      _to.call.value(0)(
        bytes4(keccak256(_custom_fallback)),
        msg.sender,
        _value,
        _data
      )
    );

    /* Notify anyone listening that this transfer took place */
    Transfer(msg.sender, _to, _value, _data);
    Transfer(msg.sender, _to, _value);
    return true;
  } else {
    return transferToAddress(msg.sender, _to, _value, _data);
  }
}

constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable

Modifiers help

Source Code
function() public payable whenNotPaused {}

tokenFallback keyboard_arrow_up

Parameters help

Name Type
_from
address help
_value
uint256 help
_data
bytes help

Properties

Visibility help public
Mutability help view

Modifiers help

Source Code
function tokenFallback(
  address _from,
  uint256 _value,
  bytes _data
) public view whenNotPaused {
  revert();
}

setReward keyboard_arrow_up

Parameters help

Name Type
_roundNumber
uint64 help
_roundRewardInWei
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyRewardManager checks for the following:
Source Code
function setReward(uint64 _roundNumber, uint256 _roundRewardInWei)
  public
  whenNotPaused
  onlyRewardManager
{
  isNewRound();

  Reward storage rewardInfo = reward[_roundNumber];

  //validations
  assert(rewardInfo.roundNumber == _roundNumber);
  assert(!rewardInfo.isConfigured); //allow just not configured reward configuration

  rewardInfo.rewardInWei = _roundRewardInWei;
  if (_roundRewardInWei > 0) {
    rewardInfo.rewardRate = safeDiv(
      _roundRewardInWei,
      issuedTokensInRound[_roundNumber]
    );
  }
  rewardInfo.isConfigured = true;
}

changeContractOwner keyboard_arrow_up

Parameters help

Name Type
_newContractOwner
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyContractOwner checks for the following:
Source Code
function changeContractOwner(address _newContractOwner)
  public
  onlyContractOwner
{
  isNewRound();
  if (_newContractOwner != contractOwner) {
    contractOwner = _newContractOwner;
  } else {
    revert();
  }
}

changeRewardManager keyboard_arrow_up

Parameters help

Name Type
_newRewardManager
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyContractOwner checks for the following:
Source Code
function changeRewardManager(address _newRewardManager)
  public
  onlyContractOwner
{
  isNewRound();
  if (_newRewardManager != rewardManager) {
    rewardManager = _newRewardManager;
  } else {
    revert();
  }
}

changeRoundManager keyboard_arrow_up

Parameters help

Name Type
_newRoundManager
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyContractOwner checks for the following:
Source Code
function changeRoundManager(address _newRoundManager) public onlyContractOwner {
  isNewRound();
  if (_newRoundManager != roundManager) {
    roundManager = _newRoundManager;
  } else {
    revert();
  }
}

changeIssueManager keyboard_arrow_up

Parameters help

Name Type
_newIssueManager
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyContractOwner checks for the following:
Source Code
function changeIssueManager(address _newIssueManager) public onlyContractOwner {
  isNewRound();
  if (_newIssueManager != issueManager) {
    issueManager = _newIssueManager;
  } else {
    revert();
  }
}

setBlocksPerRound keyboard_arrow_up

Parameters help

Name Type
_newBlocksPerRound
uint64 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyRoundManager checks for the following:
Source Code
function setBlocksPerRound(uint64 _newBlocksPerRound)
  public
  whenNotPaused
  onlyRoundManager
{
  blocksPerRound = _newBlocksPerRound;
}

pause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyContractOwner checks for the following:
Source Code
function pause() public onlyContractOwner whenNotPaused {
  paused = true;
}

resume keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function resume() public onlyContractOwner whenPaused {
  paused = false;
}

getRoundBalance keyboard_arrow_up

Parameters help

Name Type
_address
address help
_round
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getRoundBalance(address _address, uint256 _round)
  public
  view
  returns (uint256)
{
  return accountBalances[_address].roundBalanceMap[_round];
}

isModifiedInRound keyboard_arrow_up

Parameters help

Name Type
_address
address help
_round
uint64 help

Properties

Visibility help public
Mutability help view
Source Code
function isModifiedInRound(address _address, uint64 _round)
  public
  view
  returns (bool)
{
  return accountBalances[_address].wasModifiedInRoundMap[_round];
}

getBalanceModificationRounds keyboard_arrow_up

Parameters help

Name Type
_address
address help

Properties

Visibility help public
Mutability help view
Source Code
function getBalanceModificationRounds(address _address)
  public
  view
  returns (uint64[])
{
  return accountBalances[_address].mapKeys;
}

issueTokens keyboard_arrow_up

Parameters help

Name Type
_receiver
address help
_tokenAmount
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyIssueManager checks for the following:
Source Code
function issueTokens(address _receiver, uint256 _tokenAmount)
  public
  whenNotPaused
  onlyIssueManager
{
  isNewRound();
  issue(_receiver, _tokenAmount);
}

withdrawEther keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyContractOwner checks for the following:
Source Code
function withdrawEther() public onlyContractOwner {
  isNewRound();
  if (this.balance > 0) {
    contractOwner.transfer(this.balance);
  } else {
    revert();
  }
}

increaseApproval keyboard_arrow_up

Parameters help

Name Type
_spender
address help
_addedValue
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function increaseApproval(address _spender, uint256 _addedValue)
  public
  returns (bool)
{
  allowed[msg.sender][_spender] = safeAdd(
    allowed[msg.sender][_spender],
    _addedValue
  );
  Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
  return true;
}

decreaseApproval keyboard_arrow_up

Parameters help

Name Type
_spender
address help
_subtractedValue
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function decreaseApproval(address _spender, uint256 _subtractedValue)
  public
  returns (bool)
{
  uint256 oldValue = allowed[msg.sender][_spender];
  if (_subtractedValue > oldValue) {
    allowed[msg.sender][_spender] = 0;
  } else {
    allowed[msg.sender][_spender] = safeSub(oldValue, _subtractedValue);
  }
  Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
  return true;
}

claimReward keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function claimReward()
  public
  whenNotPaused
  returns (uint256 rewardAmountInWei)
{
  isNewRound();
  return claimRewardTillRound(currentRound);
}

claimRewardTillRound keyboard_arrow_up

Parameters help

Name Type
_claimTillRound
uint64 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function claimRewardTillRound(uint64 _claimTillRound)
  public
  whenNotPaused
  returns (uint256 rewardAmountInWei)
{
  isNewRound();
  rewardAmountInWei = calculateClaimableRewardTillRound(
    msg.sender,
    _claimTillRound
  );
  accountBalances[msg.sender].claimedRewardTillRound = _claimTillRound;

  if (rewardAmountInWei > 0) {
    accountBalances[msg.sender].totalClaimedReward = safeAdd(
      accountBalances[msg.sender].totalClaimedReward,
      rewardAmountInWei
    );
    msg.sender.transfer(rewardAmountInWei);
  }

  return rewardAmountInWei;
}

calculateClaimableReward keyboard_arrow_up

Parameters help

Name Type
_address
address help

Properties

Visibility help public
Mutability help constant
Source Code
function calculateClaimableReward(address _address)
  public
  constant
  returns (uint256 rewardAmountInWei)
{
  return calculateClaimableRewardTillRound(_address, currentRound);
}

calculateClaimableRewardTillRound keyboard_arrow_up

Parameters help

Name Type
_address
address help
_claimTillRound
uint64 help

Properties

Visibility help public
Mutability help constant
Source Code
function calculateClaimableRewardTillRound(
  address _address,
  uint64 _claimTillRound
) public constant returns (uint256) {
  uint256 rewardAmountInWei = 0;

  if (_claimTillRound > currentRound) {
    revert();
  }
  if (currentRound < 1) {
    revert();
  }

  AddressBalanceInfoStructure storage accountBalanceInfo = accountBalances[
    _address
  ];
  if (accountBalanceInfo.mapKeys.length == 0) {
    revert();
  }

  uint64 userLastClaimedRewardRound = accountBalanceInfo.claimedRewardTillRound;
  if (_claimTillRound < userLastClaimedRewardRound) {
    revert();
  }

  for (
    uint64 workRound = userLastClaimedRewardRound;
    workRound < _claimTillRound;
    workRound++
  ) {
    Reward storage rewardInfo = reward[workRound];
    assert(rewardInfo.isConfigured); //don't allow to withdraw reward if affected reward is not configured

    if (accountBalanceInfo.wasModifiedInRoundMap[workRound]) {
      rewardAmountInWei = safeAdd(
        rewardAmountInWei,
        safeMul(
          accountBalanceInfo.roundBalanceMap[workRound],
          rewardInfo.rewardRate
        )
      );
    } else {
      uint64 lastBalanceModifiedRound = 0;
      for (uint256 i = accountBalanceInfo.mapKeys.length; i > 0; i--) {
        uint64 modificationInRound = accountBalanceInfo.mapKeys[i - 1];
        if (modificationInRound <= workRound) {
          lastBalanceModifiedRound = modificationInRound;
          break;
        }
      }
      rewardAmountInWei = safeAdd(
        rewardAmountInWei,
        safeMul(
          accountBalanceInfo.roundBalanceMap[lastBalanceModifiedRound],
          rewardInfo.rewardRate
        )
      );
    }
  }
  return rewardAmountInWei;
}

createRounds keyboard_arrow_up

Parameters help

Name Type
maxRounds
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function createRounds(uint256 maxRounds) public {
  uint256 blocksAfterLastRound = safeSub(block.number, lastBlockNumberInRound); //current block number - last round block number = blocks after last round

  if (blocksAfterLastRound >= blocksPerRound) {
    // need to increase reward round if blocks after last round is greater or equal blocks per round

    uint256 roundsNeedToCreate = safeDiv(blocksAfterLastRound, blocksPerRound); //calculate how many rounds need to create
    if (roundsNeedToCreate > maxRounds) {
      roundsNeedToCreate = maxRounds;
    }
    lastBlockNumberInRound = safeAdd(
      lastBlockNumberInRound,
      safeMul(roundsNeedToCreate, blocksPerRound)
    );
    for (uint256 i = 0; i < roundsNeedToCreate; i++) {
      updateRoundInformation();
    }
  }
}

Internal Functions Expand All Collapse All

Internal functions are parts of the contract that can't be used directly, but instead are used by the public functions listed above.

internal BankeraToken.isContract keyboard_arrow_up

Parameters help

Name Type
_address
address help

Properties

Visibility help private
Mutability help view
Source Code
function isContract(address _address) private view returns (bool is_contract) {
  uint256 length;
  assembly {
    //retrieve the size of the code on target address, this needs assembly
    length := extcodesize(_address)
  }
  return (length > 0);
}

internal BankeraToken.isNewRound keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help private
Mutability help transaction
Source Code
function isNewRound() private {
  uint256 blocksAfterLastRound = safeSub(block.number, lastBlockNumberInRound); //current block number - last round block number = blocks after last round
  if (blocksAfterLastRound >= blocksPerRound) {
    // need to increase reward round if blocks after last round is greater or equal blocks per round
    updateRoundsInformation(blocksAfterLastRound);
  }
}

internal BankeraToken.updateRoundsInformation keyboard_arrow_up

Parameters help

Name Type
_blocksAfterLastRound
uint256 help

Properties

Visibility help private
Mutability help transaction
Source Code
function updateRoundsInformation(uint256 _blocksAfterLastRound) private {
  uint256 roundsNeedToCreate = safeDiv(_blocksAfterLastRound, blocksPerRound); //calculate how many rounds need to create
  lastBlockNumberInRound = safeAdd(
    lastBlockNumberInRound,
    safeMul(roundsNeedToCreate, blocksPerRound)
  ); //calculate last round creation block number
  for (uint256 i = 0; i < roundsNeedToCreate; i++) {
    updateRoundInformation();
  }
}

internal BankeraToken.updateRoundInformation keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help private
Mutability help transaction
Source Code
function updateRoundInformation() private {
  issuedTokensInRound[currentRound] = issued;

  Reward storage rewardInfo = reward[currentRound];
  rewardInfo.roundNumber = currentRound;

  currentRound = currentRound + 1;
}

internal BankeraToken.issue keyboard_arrow_up

Parameters help

Name Type
_receiver
address help
_tokenAmount
uint256 help

Properties

Visibility help private
Mutability help transaction
Source Code
function issue(address _receiver, uint256 _tokenAmount) private {
  if (_tokenAmount == 0) {
    revert();
  }
  uint256 newIssuedAmount = safeAdd(_tokenAmount, issued);
  if (newIssuedAmount > totalTokens) {
    revert();
  }
  addToAddressBalancesInfo(_receiver, _tokenAmount);
  issued = newIssuedAmount;
  bytes memory empty;
  if (isContract(_receiver)) {
    ContractReceiver receiverContract = ContractReceiver(_receiver);
    receiverContract.tokenFallback(msg.sender, _tokenAmount, empty);
  }
  /* Notify anyone listening that this transfer took place */
  Transfer(msg.sender, _receiver, _tokenAmount, empty);
  Transfer(msg.sender, _receiver, _tokenAmount);
}

internal BankeraToken.addToAddressBalancesInfo keyboard_arrow_up

Parameters help

Name Type
_receiver
address help
_tokenAmount
uint256 help

Properties

Visibility help private
Mutability help transaction
Source Code
function addToAddressBalancesInfo(address _receiver, uint256 _tokenAmount)
  private
{
  AddressBalanceInfoStructure storage accountBalance = accountBalances[
    _receiver
  ];

  if (!accountBalance.wasModifiedInRoundMap[currentRound]) {
    //allow just push one time per round
    // If user first time get update balance set user claimed reward round to round before.
    if (accountBalance.mapKeys.length == 0 && currentRound > 0) {
      accountBalance.claimedRewardTillRound = currentRound;
    }
    accountBalance.mapKeys.push(currentRound);
    accountBalance.wasModifiedInRoundMap[currentRound] = true;
  }
  accountBalance.addressBalance = safeAdd(
    accountBalance.addressBalance,
    _tokenAmount
  );
  accountBalance.roundBalanceMap[currentRound] = accountBalance.addressBalance;
}

internal BankeraToken.subFromAddressBalancesInfo keyboard_arrow_up

Parameters help

Name Type
_adr
address help
_tokenAmount
uint256 help

Properties

Visibility help private
Mutability help transaction
Source Code
function subFromAddressBalancesInfo(address _adr, uint256 _tokenAmount)
  private
{
  AddressBalanceInfoStructure storage accountBalance = accountBalances[_adr];
  if (!accountBalance.wasModifiedInRoundMap[currentRound]) {
    //allow just push one time per round
    accountBalance.mapKeys.push(currentRound);
    accountBalance.wasModifiedInRoundMap[currentRound] = true;
  }
  accountBalance.addressBalance = safeSub(
    accountBalance.addressBalance,
    _tokenAmount
  );
  accountBalance.roundBalanceMap[currentRound] = accountBalance.addressBalance;
}

internal BankeraToken.transferToAddress keyboard_arrow_up

Parameters help

Name Type
_from
address help
_to
address help
_value
uint256 help
_data
bytes help

Properties

Visibility help private
Mutability help transaction
Source Code
function transferToAddress(
  address _from,
  address _to,
  uint256 _value,
  bytes _data
) private returns (bool success) {
  if (accountBalances[_from].addressBalance < _value) {
    // Check if the sender has enough
    revert();
  }
  if (
    safeAdd(accountBalances[_to].addressBalance, _value) <
    accountBalances[_to].addressBalance
  ) {
    // Check for overflows
    revert();
  }

  isNewRound();
  subFromAddressBalancesInfo(_from, _value); // Subtract from the sender
  addToAddressBalancesInfo(_to, _value); // Add the same to the recipient

  /* Notify anyone listening that this transfer took place */
  Transfer(_from, _to, _value, _data);
  Transfer(_from, _to, _value);
  return true;
}

internal BankeraToken.transferToContract keyboard_arrow_up

Parameters help

Name Type
_from
address help
_to
address help
_value
uint256 help
_data
bytes help

Properties

Visibility help private
Mutability help transaction
Source Code
function transferToContract(
  address _from,
  address _to,
  uint256 _value,
  bytes _data
) private returns (bool success) {
  if (accountBalances[_from].addressBalance < _value) {
    // Check if the sender has enough
    revert();
  }
  if (
    safeAdd(accountBalances[_to].addressBalance, _value) <
    accountBalances[_to].addressBalance
  ) {
    // Check for overflows
    revert();
  }

  isNewRound();
  subFromAddressBalancesInfo(_from, _value); // Subtract from the sender
  addToAddressBalancesInfo(_to, _value); // Add the same to the recipient

  ContractReceiver receiver = ContractReceiver(_to);
  receiver.tokenFallback(_from, _value, _data);

  /* Notify anyone listening that this transfer took place */
  Transfer(_from, _to, _value, _data);
  Transfer(_from, _to, _value);
  return true;
}