The Creature Hunters Lab-CRT token mechanism!#2

crttoken
2 min readJun 30, 2021

Hello, I’m Creature Hunters Lab!

ERC20

I explained the basic design of the Creature Token earlier, so I will explain the logic design accordingly~!

First, we need to define two mapping objects. This is the Solidity concept for association or key/value array!

mapping(address => uint256) balances;

mapping(address => mapping (address => uint256)) allowed;

This expression mapping (address = > uint256) defines the associated array (uint256 commonly used to store token balances) in which the key is the numeric type used to represent the address accounting address and the value type.

- The first mapping object, balances, holds the token balance for each owner account.

- The second mapping object allowed includes all accounts authorized to withdraw from the specified account and the total withdrawal allowed for each.

The value field of the allowed mapping is itself the mapping plotting account address for the approved withdrawal total, which, along with all other contract fields, is stored and mined in the blockchain to propagate changes to all network user nodes:)

Blockchain storage is expensive and the contractor has to pay in some way.

You should always minimize storage size and write to blockchain!

Additional SafeMath functions exist here to prevent hacking and to deal with overflow attacks in malicious smart contracts!

--

--

crttoken
0 Followers

We are Creature Hunters Lab, making innovative blockchain in gaming industry.