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 token and operates on the Ethereum platform. Bankera has a current supply of 25,000,000,000 with 24,618,912,107.743 in circulation. The last known price of Bankera is $0.001447 USD and is down -1.45% over the last 24 hours. It is currently trading on 5 active market(s) with $4,487.07 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

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 Event

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

AddressBalanceInfoStructure Event

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

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;
	}

totalSupply keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

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

balanceOf keyboard_arrow_up

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;
	}

transfer keyboard_arrow_up

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);
		}
	}

transferFrom keyboard_arrow_up

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;
	}

approve keyboard_arrow_up

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;
	}

allowance keyboard_arrow_up

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];
	}

transfer keyboard_arrow_up

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);
		}
	}

transfer keyboard_arrow_up

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 whenNotPaused payable {
	}

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 whenNotPaused view {
		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() onlyContractOwner whenNotPaused public {
		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() onlyContractOwner whenPaused public {
		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();
			}
		}
	}