Logo Brainers
DOCS Brainers Contract

// Brainers is a unique concept that utilizes Nikola Tesla's theorem of perpetual generator as its foundation. For more information, please visit www.docs.brainers.network

// We believe that simplicity is the key to success. This contract is crafted with clear examples for each line of code, so that anyone reading it does not require extensive knowledge. With respect, Brainers Team

Token contract Brainers explanations

Descrierea imaginii

The Brainers contract represents a token with the following properties:

Descrierea imaginii

The constructor function initializes the contract when it is deployed. It sets the initial _totalSupply of tokens to 371,000,000 multiplied by 10 to the power of the decimals. Additionally, it defines the percentages allocated for various purposes:

.
Descrierea imaginii
Explanation:

_totalSupply: Stores the total supply of tokens.

_balances: Maps addresses to their token balances.

_allowances: Maps addresses to the allowances granted to spend tokens on behalf of other addresses.

Descrierea imaginii
Explanation:

_socialNetworkAddress: This is the immutable address variable representing the address of the Brainers social network.

_teamAddress: This is the immutable address variable representing the address of the Brainers team.

Descrierea imaginii

- _teamSupply: This variable stores the supply allocated to the Brainers team.

- _teamUnlockTime: This variable stores the timestamp when the team supply is unlocked.

- _teamReleaseAmount: This variable stores the amount of tokens released from the team supply.

- _teamReleaseInterval: This variable stores the interval between releases from the team supply.

- _teamReleaseStartTime: This variable stores the timestamp when the team supply release starts.

- _socialReleaseInterval: This variable stores the interval between releases from the social supply.

- _socialReleaseStartTime: This variable stores the timestamp when the social supply release starts.

Descrierea imaginii

- _socialNetworkAddress: This is the immutable address variable representing the address of the Brainers social network.

- _teamAddress: This is the immutable address variable representing the address of the Brainers team.

- _teamSupply: Stores the supply allocated to the Brainers team.

- _teamUnlockTime: Stores the timestamp when the team supply is unlocked.

- _teamReleaseAmount: Stores the amount of tokens released from the team supply.

- _teamReleaseInterval: Stores the interval between releases from the team supply.

- _teamReleaseStartTime: Stores the timestamp when the team supply release starts.

- _socialReleaseInterval: Stores the interval between releases from the social supply.

- _socialReleaseStartTime: Stores the timestamp when the social supply release starts.

- Transfer event: Fired when tokens are transferred from one address to another.

- Approval event: Fired when an approval for token transfer is granted between two addresses.

Descrierea imaginii

onlyUnlockedTeam() modifier: Ensures that the function can only be executed if the team supply is unlocked.

onlyOwner() modifier: Ensures that the function can only be called by the owner, which is the Brainers team address.

Descrierea imaginii

_teamSupply: Calculates the team's supply based on the percentage of the total supply.

_teamUnlockTime: Sets the time when the team supply will be unlocked, which is 12 months from the current timestamp.

_teamReleaseAmount: Determines the amount of tokens to be released periodically. Here, 5% of the team supply is released every 30 days after the 12-month lock period.

_teamReleaseInterval: Specifies the interval between each release, which is set to 30 days.

Descrierea imaginii

_socialReleaseInterval: Specifies the interval for releasing tokens for the Brainers Social, which is set to 30 days for monthly releases.

_socialReleaseStartTime: Marks the starting time for releasing tokens for the Brainers Social, set to the current timestamp.

_balances[_socialNetworkAddress]: Assigns the token balance for the Brainers Social network based on a percentage of the total supply.

_balances[_teamAddress]: Assigns the token balance for the Brainers team to the specified team address.

_balances[address(this)]: Assigns the remaining token balances to the contract itself, distributed among various purposes such as marketing, development, investor allocation, and future development.

Descrierea imaginii

totalSupply(): This function returns the total supply of tokens.

balanceOf(address account): This function returns the token balance of a specified account.

transfer(address recipient, uint256 amount): This function transfers a specified amount of tokens from the sender's account to the recipient's account.

allowance(address owner, address spender): This function returns the amount of tokens that the spender is allowed to withdraw from the owner's account.

approve(address spender, uint256 amount): This function allows the spender to withdraw a specified amount of tokens from the caller's account.

Descrierea imaginii

approve(address spender, uint256 amount): This function approves the spender to transfer a specified amount of tokens from the caller's account.

transferFrom(address sender, address recipient, uint256 amount): This function transfers a specified amount of tokens from the sender's account to the recipient's account on behalf of the spender, if the spender is approved to do so.

increaseAllowance(address spender, uint256 addedValue): This function increases the allowance for the spender to spend tokens on behalf of the caller by a specified amount.

Descrierea imaginii

decreaseAllowance(address spender, uint256 subtractedValue): This function decreases the allowance for the spender to spend tokens on behalf of the caller by a specified amount.

releaseTeamSupply(): This function releases the team supply of tokens if the unlock time has been reached and the release interval has elapsed.

Descrierea imaginii

A variable releaseAmount is initialized with the value of _teamReleaseAmount.

If releaseAmount exceeds the available team supply, it is adjusted to equal the team supply. The token balance of the team address is increased by releaseAmount, and _teamSupply is decreased by the same amount.

The start time for the team release interval is updated, and an event is emitted to indicate the transfer of tokens from the contract to the team address.

Descrierea imaginii

The releaseSocialSupply function is callable only by the owner and checks if the social supply release interval has been reached.

It calculates the releaseAmount to be released, which is 10% of the total supply.

If releaseAmount is greater than zero, tokens are transferred from the contract to the social network address, and the total supply is decreased accordingly. The start time for the social release interval is updated, and an event is emitted to indicate the transfer of tokens.

The _transfer internal function ensures that neither the sender nor the recipient is the zero address and that the sender has sufficient balance to transfer the specified amount of tokens.

Descrierea imaginii

The _approve internal function is used to approve a spender to spend a certain amount of tokens on behalf of an owner.

It ensures that neither the owner nor the spender is the zero address. If the conditions are met, the allowance is updated in the _allowances mapping, and an Approval event is emitted to indicate the approval.