The Creature Hunters Lab-CRT token mechanism!#3

crttoken
2 min readJun 30, 2021

Hello, I’m Creature Hunters Lab!

Today is the last chapter of the CRT token mechanism!

SafeMath

Creature SafeMath eliminates the risk of overflow attacks. Since SafeMath’s library has the characteristic of using low capacity compared to high security, it provides high security and no disadvantages to storage capacity.

library SafeMath { // Only relevant functions

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;

}

SafeMath uses theASSERT statement above to verify the accuracy of the passed parameters.

Therefore, if an error occurs in theASSERT value, the function execution will be stopped immediately and all blockchain changes will be rolled back, below is the code for SafeMath Blance!

balances[msg.sender] = balances[msg.sender].sub(numTokens); balances[receiver] = balances[receiver].add(numTokens); balances[buyer] = balances[buyer].add(numTokens); balances[owner] = balances[owner].sub(numTokens);

In Solidity, features and events in smart contracts wrap to entities called contracts that can automatically switch to “blockchain classes”!

Smart contracts for Creature tokens can be changed by business logic, modeling user interactions, permitting token mining and incineration, changing the lifecycle introduced in contracts, and the need for commonly provided administrator-level features.

Until today, we’ve been looking at the CRT token mechanism of the Creature Hunters Lab.

Thank you for reading the long article!

See you in the next post!

--

--

crttoken
0 Followers

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