Token.sol

The contract is designed to create a new cryptocurrency token that can be transferred between accounts, with different usefull features.

Construction Arguments

__name

__name represents the name of the token. It is a string value that is specified during the deployment of the contract.

__symbol

__symbol represents the symbol of the token. It is a string value that is specified during the deployment of the contract.

_maxSupply

_maxSupply represents the maximum supply of the token. It is an unsigned integer value that is specified during the deployment of the contract.

_initialSupply

_initialSupply represents the initial supply of the token. It is an unsigned integer value that is specified during the deployment of the contract.

Read Functions

BUY_FEE

BUY_FEE

The BUY_FEE function is a public view function that returns a uint256 value. It does not take any arguments. This function is used to retrieve the buy fee percentage for transactions. The buy fee is a percentage of the transaction value that is deducted as a fee when buying tokens. The function simply returns the value of the BUY_FEE variable, which represents the buy fee percentage. Users can call this function to get the current buy fee percentage before making a transaction to calculate the fee amount.

MAX_SUPPLY

MAX_SUPPLY

The MAX_SUPPLY function is a public view function that does not take any arguments and returns a uint256 value. It is used to retrieve the maximum supply of the token. This function simply returns the value of the MAX_SUPPLY variable, which represents the maximum number of tokens that can ever exist in the token contract. Users can call this function to get the maximum supply of the token, which can be useful for various purposes such as calculating percentages or determining the total possible value of the token ecosystem. Since this function is a view function, it does not modify the state of the contract and can be called by anyone at any time without incurring any gas fees.

SELL_FEE

SELL_FEE

The function SELL_FEE is a public view function that returns a uint256 value. It does not take any arguments.

This function is used to retrieve the sell fee percentage applied to token transfers. The sell fee is a percentage of the transferred token value that is deducted as a fee.

Users can call this function to get the current sell fee percentage set by the contract. The returned value is a uint256 representing the sell fee percentage.

Note: This function is a view function, which means it does not modify the state of the contract and does not require any gas to execute.

allowance

allowance

The function allowance is a public view function that takes two address parameters: owner and spender. It returns a uint256 value representing the amount of tokens that the spender is allowed to spend on behalf of the owner.

This function is used to check the allowance of tokens for a specific owner and spender pair. It is typically used by external contracts or applications to verify the available allowance before executing a transferFrom function.

The function retrieves the allowance value by accessing the mapping of allowances using the owner and spender addresses as keys. If there is no specific allowance set for the owner and spender pair, the function returns the default value of uint256, which is 0.

The function does not modify any state variables and is marked as view, indicating that it does not modify the blockchain state.

balanceOf

balanceOf

The function balanceOf is a public view function that takes an address parameter called account and returns a uint256 value. It is used to retrieve the balance of a specific account in the token contract.

The function first checks if the account is a valid address by ensuring it is not the zero address. If the account is the zero address, the function reverts with an error message.

Next, the function retrieves the balance of the account by calling the balanceOf function from the token contract's storage. The balance is stored as a uint256 value.

Finally, the function returns the balance of the account as the output of the function.

This function is useful for users or external applications to check the balance of a specific account in the token contract. It can be used to display the balance of an account in a user interface or to perform calculations based on the account's balance.

  • Arguments

    NAMETYPEDESCRIPTION

    account

    address

    The account parameter is an Ethereum address that represents the account for which the balance is being retrieved. It can be any valid Ethereum address.

decimals

decimals

The function decimals is a public view function that does not take any arguments and returns a uint8 value. It is a standard function defined in the ERC20 contract. The purpose of this function is to retrieve the number of decimal places used for the token. The function simply returns the value of the decimals variable, which is an uint8 value representing the number of decimal places. Users can call this function to get the decimal precision of the token. This information is important for correctly interpreting and displaying the token balance and transfer amounts. For example, if the decimals value is 18, it means that the token has 18 decimal places, and 1 token is equivalent to 10^18 base units. This function does not require any prerequisites or special conditions to be met before calling it.

developmentAddress

developmentAddress

The function developmentAddress is a public view function that does not take any arguments and returns an address value. It is a getter function for the developmentAddress variable. The purpose of this function is to allow users to retrieve the current development address that is set in the contract. Users can call this function to obtain the development address, which can be used for various purposes such as sending funds or interacting with the development address in other contracts or applications. The function returns the development address as an address value. This function does not have any prerequisites or restrictions on who can call it.

isExcludedFromFee

isExcludedFromFee

The function isExcludedFromFee is a public view function that takes an address parameter called _address and returns a bool value. It is used to check if a given address is excluded from fees.

The function first checks if the _address is present in the mapping called isExcludedFromFee, which maps addresses to boolean values. If the _address is present in the mapping, the function returns true, indicating that the address is excluded from fees. If the _address is not present in the mapping, the function returns false, indicating that the address is not excluded from fees.

This function is useful for determining if a specific address is exempt from paying fees in the contract. Users can call this function to check if their address is excluded from fees before performing any fee-related transactions.

No prerequisite is mentioned in the function. Users can directly call this function to check if an address is excluded from fees.

  • Arguments

    NAMETYPEDESCRIPTION

    input (address)

    address

    No description

isMinter

isMinter

The function isMinter is a public view function that takes an address parameter called _user and returns a bool value. It is used to check if a given address is a minter.

The function first checks if the _user address is excluded from the fee by calling the isExcludedFromFee function. If the _user address is excluded from the fee, the function returns false, indicating that the address is not a minter.

If the _user address is not excluded from the fee, the function then checks if the _user address is a minter by calling the isMinter function. If the _user address is a minter, the function returns true, indicating that the address is a minter.

This function is useful for checking if a specific address has the minter role, which allows the address to mint new tokens. Other contracts or external applications can use this function to verify if an address has the necessary permissions to mint tokens.

  • Arguments

    NAMETYPEDESCRIPTION

    input (address)

    address

    No description

name

name

The function name is a public view function that returns a string value. It is a standard function defined in the ERC20 contract. The purpose of this function is to retrieve the name of the token. The function simply returns the value of the name variable, which is a string representing the name of the token. Users can call this function to get the name of the token, which can be used for display purposes or for identifying the token in a user interface or application.

owner

owner

The function owner is a view function that does not take any arguments and returns an address value. It is a public function. The purpose of this function is to retrieve the address of the owner of the contract. The function simply returns the address value stored in the owner state variable. Users can call this function to get the address of the contract owner. It does not require any prerequisites or special conditions to be met.

symbol

symbol

The function symbol is a public view function that does not take any arguments and returns a string value. It is an overridden function from the ERC20 contract. The purpose of this function is to retrieve the symbol of the token. The function returns the symbol of the token, which is a string value representing the token's ticker symbol. Users can use this function to get the symbol of the token, which can be used for display purposes or to identify the token in various applications or exchanges.

totalSupply

totalSupply

The function totalSupply is a public view function that does not take any arguments and returns a uint256 value. It is used to retrieve the total supply of the token. This function does not modify the state of the contract and can be called by any user or contract without any prerequisites. Users can use this function to get the current total supply of the token, which represents the total number of tokens that have been minted or created. The return value is a uint256 value representing the total supply of the token.

whiteListedPair

whiteListedPair

The function whiteListedPair is a public view function that takes an address parameter called pair and returns a bool value. It is used to check if a given pair address is whitelisted. The purpose of this function is to allow users to verify if a specific pair address is included in the whitelist. The function retrieves the boolean value associated with the pair address from the internal mapping called whiteListedPair. If the pair address is present in the whiteListedPair mapping, the function returns true, indicating that the pair is whitelisted. Otherwise, it returns false, indicating that the pair is not whitelisted. This function is useful for users who want to ensure that they are interacting with whitelisted pairs, which may have certain privileges or restrictions within the contract.

  • Arguments

    NAMETYPEDESCRIPTION

    input (address)

    address

    No description

Write Functions

approve

approve

The function approve is a non-payable function that takes two parameters: spender and amount. The spender parameter is an address that represents the account that is allowed to spend the tokens. The amount parameter is a uint256 value that represents the maximum number of tokens that the spender is allowed to spend.

This function is used to approve the spender to spend a certain amount of tokens from the caller's account. It is typically used in token transfer scenarios, where the caller wants to allow a specific address (spender) to transfer a certain amount of tokens from their account.

The function updates the allowance mapping, which keeps track of the approved allowances for each account. It sets the allowance for the spender to the specified amount.

The function returns a bool value indicating whether the approval was successful or not. It returns true if the approval was successful and false otherwise.

There are no specific prerequisites for using this function. However, the caller must have a sufficient balance of tokens in their account to approve the specified amount for the spender.

  • Arguments

    NAMETYPEDESCRIPTION

    spender

    address

    The spender parameter is an address that represents the account that is allowed to spend the tokens. This address must be a valid Ethereum address.

    amount

    uint256

    The amount parameter is a uint256 value that represents the maximum number of tokens that the spender is allowed to spend. This value must be greater than or equal to zero.

assignMinterRole

assignMinterRole

The function assignMinterRole is a public function that takes an address parameter called _account. It is a function that can only be called by the contract owner.

The purpose of this function is to assign the minter role to a specified account. When the function is called, it sets the isMinter mapping for the specified account to true, indicating that the account has the minter role.

This function is used by the contract owner to grant the minter role to other accounts. The minter role allows the assigned account to mint new tokens.

Note: The contract owner is the only account that can call this function.

This function can only be called by the contract owner. The contract owner is the account that deployed the contract and has the authority to manage the minter role.

  • Arguments

    NAMETYPEDESCRIPTION

    _account

    address

    The _account parameter is an address value that represents the account to which the minter role will be assigned.

burn

burn

The function burn is a non-payable function that takes a uint256 parameter called amount. It does not have any outputs. The purpose of this function is to burn a specified amount of tokens from the caller's balance. The function first checks if the caller has a sufficient balance to burn the specified amount of tokens. If the caller has enough balance, the function subtracts the specified amount from the caller's balance and updates the total supply of tokens by subtracting the burned amount. This function is typically used by token holders who want to permanently remove a certain amount of tokens from circulation. It is important to note that once tokens are burned, they cannot be recovered or transferred to another address. To use this function, the caller needs to provide the amount of tokens they want to burn as the argument. The amount should be a positive integer value representing the number of tokens to be burned.

The caller must have a sufficient balance of tokens to burn the specified amount.

  • Arguments

    NAMETYPEDESCRIPTION

    amount

    uint256

    The amount parameter is a uint256 value that represents the number of tokens to be burned. It should be a positive integer value.

burnFrom

burnFrom

The function burnFrom is a non-payable function that takes two parameters: account (address) and amount (uint256). It is used to burn a specified amount of tokens from the account's balance.

To use this function, the caller must have the necessary allowance from the account to burn the tokens. The allowance can be set using the approve function.

The function first checks if the caller has the necessary allowance by calling the allowance function with the caller's address and the account's address. If the allowance is sufficient, the function proceeds to burn the specified amount of tokens from the account's balance.

After burning the tokens, the function updates the account's balance and the total supply of tokens accordingly.

This function is useful for reducing the token supply by burning tokens from a specific account's balance, as long as the caller has the necessary allowance.

The caller must have the necessary allowance from the account to burn the tokens. The allowance can be set using the approve function.

  • Arguments

    NAMETYPEDESCRIPTION

    account

    address

    The account parameter is the address of the account from which the tokens will be burned. The account must have the necessary allowance for the caller to burn the tokens.

    amount

    uint256

    The amount parameter is the number of tokens to be burned from the account's balance. The amount must be a non-negative integer value.

decreaseAllowance

decreaseAllowance

The function decreaseAllowance is a public function that takes two parameters: spender of type address and subtractedValue of type uint256. It returns a bool value.

The purpose of this function is to atomically decrease the allowance granted to the spender by the caller. It is an alternative to the approve function and can be used as a mitigation for problems described in the IERC20-approve interface.

The function first retrieves the current allowance granted to the spender by the caller using the _allowances mapping. It checks if the current allowance is greater than or equal to the subtractedValue. If not, it reverts with an error message 'ERC20: decreased allowance below zero'.

If the current allowance is greater than or equal to the subtractedValue, the function calls the _approve internal function to update the allowance. It subtracts the subtractedValue from the current allowance and sets the new allowance for the spender.

The function returns true if the allowance is successfully decreased, indicating that the operation was successful.

The caller must have an existing allowance granted to the spender that is greater than or equal to the subtractedValue.

  • Arguments

    NAMETYPEDESCRIPTION

    spender

    address

    The spender parameter is the address for which the allowance is being decreased. It represents the account or contract that is allowed to spend the caller's tokens.

    subtractedValue

    uint256

    The subtractedValue parameter is the amount by which the allowance is being decreased. It represents the value that is subtracted from the current allowance.

enableV2PairFee

enableV2PairFee

The function enableV2PairFee is an external function that takes two parameters: _account of type address and _flag of type bool. This function is used to enable or disable fees for a specific pair in the contract.

To use this function, the caller must be the owner of the contract. The function updates the whiteListedPair mapping with the given _account and _flag values. It sets the _flag value for the _account address in the whiteListedPair mapping, indicating whether fees should be enabled or disabled for that specific pair.

After updating the mapping, the function emits a ToggleV2Pair event, providing information about the caller (_msgSender()), the _account address, and the _flag value.

This function is useful for managing fees for specific pairs in the contract, allowing the owner to enable or disable fees as needed.

The caller must be the owner of the contract to use this function.

  • Arguments

    NAMETYPEDESCRIPTION

    _account

    address

    The _account parameter is an address value that represents the pair for which fees will be enabled or disabled. The caller must be the owner of the contract to use this function.

    _flag

    bool

    The _flag parameter is a boolean value that indicates whether fees should be enabled or disabled for the specified pair. If _flag is true, fees will be enabled. If _flag is false, fees will be disabled.

excludeMultipleAccountsFromFees

excludeMultipleAccountsFromFees

The function excludeMultipleAccountsFromFees is an external function that can only be called by the contract owner. It takes two parameters: _accounts, an array of addresses, and _excluded, a boolean value.

The purpose of this function is to exclude multiple accounts from fees. The function iterates over each address in the _accounts array and sets the isExcludedFromFee mapping for that address to the value of _excluded. It also emits an AddressExcluded event for each address, indicating whether it has been excluded or included from fees.

This function is useful for the contract owner to manage the list of accounts that are exempt from fees. By excluding certain accounts, the contract can apply different fee structures or waive fees altogether for those accounts.

To use this function, the contract owner should provide an array of addresses in the _accounts parameter and specify whether those accounts should be excluded or included from fees by setting the _excluded parameter to true or false, respectively.

This function can only be called by the contract owner. The contract owner should have the necessary permissions to execute this function.

  • Arguments

    NAMETYPEDESCRIPTION

    _accounts

    address[]

    The _accounts parameter is an array of addresses. It represents the list of accounts that will be excluded or included from fees.

    _excluded

    bool

    The _excluded parameter is a boolean value. It determines whether the accounts in the _accounts parameter should be excluded or included from fees. If _excluded is true, the accounts will be excluded from fees. If _excluded is false, the accounts will be included in fees.

increaseAllowance

increaseAllowance

The function increaseAllowance is a non-payable function that takes two parameters: spender and addedValue. The spender parameter is of type address and represents the address of the account for which the allowance is being increased. The addedValue parameter is of type uint256 and represents the amount by which the allowance is being increased.

This function is used to increase the allowance granted to a spender by the caller. The caller must be the owner of the tokens or have sufficient allowance to increase the allowance. The function first checks if the caller has sufficient balance or allowance to increase the allowance. If the caller has sufficient balance or allowance, the function increases the allowance by the addedValue and returns true. Otherwise, the function returns false.

Users can use this function to grant additional allowance to a specific spender, allowing them to spend more tokens on behalf of the caller.

  • Arguments

    NAMETYPEDESCRIPTION

    spender

    address

    The spender parameter is of type address and represents the address of the account for which the allowance is being increased. This address should be a valid Ethereum address.

    addedValue

    uint256

    The addedValue parameter is of type uint256 and represents the amount by which the allowance is being increased. This value should be a non-negative integer.

mint

mint

The function mint is an external function that takes two parameters: _user of type address and _amount of type uint256. This function can only be called by an address that has the minter role.

The purpose of this function is to mint new tokens and assign them to the specified user. It first checks if the total supply of tokens, when added with the minting amount, exceeds the maximum supply. If it does, it reverts the transaction with the error message 'UNIW: No more Minting is allowed!!!'.

If the minting is allowed, it calls the internal _mint function to create new tokens and assigns them to the specified user.

This function is used by the contract owner or any address that has been assigned the minter role to create new tokens and distribute them to users.

  • Arguments

    NAMETYPEDESCRIPTION

    _user

    address

    The _user parameter is the address of the user to whom the newly minted tokens will be assigned.

    _amount

    uint256

    The _amount parameter is the number of tokens to be minted and assigned to the specified user.

recoverToken

recoverToken

The function recoverToken is a public function that takes an address parameter called _token. It is used to recover tokens from the contract.

The function first checks the balance of the contract for the specified token using the balanceOf function from the IERC20 interface. If the token balance is greater than 0, the function transfers the tokens to the owner of the contract using the transfer function from the IERC20 interface.

This function is intended to be used by the owner of the contract to recover any tokens that may have been accidentally sent to the contract address.

The function can only be called by the owner of the contract.

  • Arguments

    NAMETYPEDESCRIPTION

    _token

    address

    The _token parameter is an address value that represents the token to be recovered. It should be the address of the token contract.

renounceOwnership

renounceOwnership

The function renounceOwnership is a non-payable function that allows the current owner of the contract to renounce their ownership. This function can only be called by the current owner of the contract. When called, the function sets the owner address to the zero address, effectively removing the ownership rights from the current owner. This action cannot be undone. This function is typically used when the current owner wants to permanently relinquish their control over the contract and transfer ownership to a new address or to make the contract completely decentralized. After calling this function, the contract will have no owner, and certain functions that require the owner's permission may no longer be accessible or restricted. It is important to note that once ownership is renounced, it cannot be regained, and the contract will be permanently ownerless.

revokeMinterRole

revokeMinterRole

The function revokeMinterRole is a public function that takes an address parameter called _account. It is a function that can only be called by the contract owner. The purpose of this function is to revoke the minter role from a specified account. When called, the function sets the isMinter mapping for the specified account to false, indicating that the account is no longer a minter. The function also emits the MinterRoleRevoked event, providing the address of the user who called the function (_msgSender()) and the address of the account whose minter role was revoked (_account). This function is useful for the contract owner to manage the minter roles and control who can mint new tokens.

The function can only be called by the contract owner. This means that the caller must be the address that deployed the contract or has been assigned the owner role through the assignOwnerRole

  • Arguments

    NAMETYPEDESCRIPTION

    _account

    address

    The _account parameter is an address value that represents the account for which the minter role will be revoked.

transfer

transfer

The function transfer is a public function that takes two parameters: recipient and amount. The recipient parameter is of type address and represents the address of the recipient to whom the tokens will be transferred. The amount parameter is of type uint256 and represents the amount of tokens to be transferred.

This function is used to transfer tokens from the sender's address (the caller of the function) to the specified recipient address. The function first checks if the sender has sufficient balance to transfer the specified amount of tokens. If the sender has enough balance, the function subtracts the transferred amount from the sender's balance and adds it to the recipient's balance. The function then emits a Transfer event to notify the network about the token transfer.

The function returns a bool value indicating the success or failure of the transfer operation. It returns true if the transfer is successful and false otherwise.

Users can use this function to transfer their tokens to another address within the network.

  • Arguments

    NAMETYPEDESCRIPTION

    recipient

    address

    The recipient parameter is of type address and represents the address of the recipient to whom the tokens will be transferred.

    amount

    uint256

    The amount parameter is of type uint256 and represents the amount of tokens to be transferred.

transferFrom

transferFrom

The function transferFrom is a non-payable function that takes three parameters: sender, recipient, and amount. It returns a bool value indicating whether the transfer was successful or not.

This function is used to transfer a specified amount of tokens from the sender's address to the recipient's address. The sender must have previously approved the transfer by calling the approve function and specifying the recipient's address as the spender.

The function first checks if the sender has sufficient balance to cover the transfer amount. If the sender does not have enough balance, the function returns false and the transfer is not executed.

If the sender has sufficient balance, the function subtracts the transfer amount from the sender's balance and adds it to the recipient's balance. The function also updates the allowance of the sender by subtracting the transfer amount from the allowance.

Finally, the function emits a Transfer event with the sender's address, recipient's address, and the transfer amount.

This function is typically used by users who want to transfer tokens from their own address to another address. It requires the sender to have previously approved the transfer and have sufficient balance to cover the transfer amount.

The sender must have previously approved the transfer by calling the approve function and specifying the recipient's address as the spender.

  • Arguments

    NAMETYPEDESCRIPTION

    sender

    address

    The sender parameter is the address of the token holder who wants to transfer tokens. This address must have previously approved the transfer by calling the approve function.

    recipient

    address

    The recipient parameter is the address of the recipient who will receive the transferred tokens.

    amount

    uint256

    The amount parameter is the number of tokens to be transferred from the sender's address to the recipient's address.

transferOwnership

transferOwnership

The function transferOwnership is a non-payable function that takes an address parameter called newOwner. It is a public function that can be called by anyone. The purpose of this function is to transfer the ownership of the contract to a new owner. The function updates the owner variable of the contract with the newOwner address. This function can be used when the current owner of the contract wants to transfer the ownership to another address. The newOwner address should be a valid Ethereum address. After calling this function, the newOwner will become the new owner of the contract and will have the ability to perform owner-only functions. It is important to note that only the current owner of the contract can call this function. If any other address tries to call this function, the transaction will fail. There are no additional prerequisites or conditions for calling this function.

updateDevAddress

updateDevAddress

The function updateDevAddress is an external function that takes an address parameter called _dev. It is a function that can only be called by the owner of the contract.

The purpose of this function is to update the development address. The function first sets the isExcludedFromFee flag of the current developmentAddress to false and emits an AddressExcluded event with the _msgSender (the caller of the function), the current developmentAddress, and the value false.

Then, the function updates the developmentAddress to the new address provided (_dev) and sets the isExcludedFromFee flag of the new developmentAddress to true. Finally, it emits an AddressExcluded event with the _msgSender, the new developmentAddress, and the value true.

This function is used to change the development address, which can be useful for various purposes such as updating the recipient of development fees or changing the address for development-related operations.

The caller of this function must be the owner of the contract.

  • Arguments

    NAMETYPEDESCRIPTION

    _dev

    address

    The _dev parameter is an address value that represents the new development address to be set. It is the address where development fees or operations related to development will be directed.

updateFee

updateFee

The function updateFee is an external function that allows the contract owner to update the fee for buying or selling tokens. It takes two parameters: feeType (a boolean value) and fee (a uint256 value).

The feeType parameter determines whether the fee being updated is for buying or selling tokens. If feeType is true, it means the fee being updated is for buying tokens. If feeType is false, it means the fee being updated is for selling tokens.

The fee parameter represents the new fee value that the contract owner wants to set. The function first checks if the fee is less than or equal to 1000 (representing 10%). If the fee is greater than 1000, the function reverts with an error message.

If the feeType is true, the function updates the BUY_FEE variable with the new fee value. If the feeType is false, the function updates the SELL_FEE variable with the new fee value.

After updating the fee, the function emits the FeeUpdated event, which includes the address of the caller, the feeType, and the new fee value.

This function can only be called by the contract owner.

  • Arguments

    NAMETYPEDESCRIPTION

    feeType

    bool

    The feeType parameter is a boolean value that determines whether the fee being updated is for buying or selling tokens. If feeType is true, it means the fee being updated is for buying tokens. If feeType is false, it means the fee being updated is for selling tokens.

    fee

    uint256

    The fee parameter is a uint256 value that represents the new fee value that the contract owner wants to set. The fee must be less than or equal to 1000 (representing 10%).

Last updated