LogoLogo
  • 🎛️Smartt Collectors DApp
    • 🌫️SmarttCollectors DApp
    • 📚SmarttCollectors Flow-Chart
    • ⚙️Technical Features
  • 👥Members
    • 😎Smartt-Holder
    • 🤩hSmartt-Holder
  • 📄Documents
    • ➡️Community Guidelines
    • 🗣️Smartt-Communication
      • Welcome to SmarttCollectors
      • The Concept
Powered by GitBook
On this page
  • Smart Contract Overview: The SMARTT-Token
  • Key Features:
  • Technologies Involved:
  1. Smartt Collectors DApp

Technical Features

Useful and important information about the IT details of the Smartt-Token

Smart Contract Overview: The SMARTT-Token

The provided Smart Contract code creates an ERC20 token (also called BEP20 at the BSC Network) called SMARTT-Token.

This token incorporates some additional features such as transaction fees, which are used to increase the project's balance and support rewards and token burning.

The code is based on the Solidity programming language (version 0.8.6) and utilizes OpenZeppelin libraries for standard token functionalities and security features.

Solidity and OpenZeppelin

  • Solidity: Solidity is a high-level, contract-oriented programming language specifically designed for writing Smart Contracts on the Ethereum platform. The code provided is written in Solidity version 0.8.6, which offers improved stability, security, and efficiency compared to earlier versions.

  • OpenZeppelin: OpenZeppelin is a widely used and audited library that provides secure and tested building blocks for creating Smart Contracts. The code provided imports several OpenZeppelin contracts, such as ERC20, ERC20Burnable, Ownable, and SafeMath, to inherit their functionalities and ensure a secure, compliant, and efficient implementation.

Key Components

  • ERC20 and ERC20Burnable: The contract inherits from the ERC20.sol and ERC20Burnable.sol libraries, which provide essential token functions such as balance tracking, transfers, etc.

  • Ownable: The contract inherits from the Ownable.sol library, which helps manage ownership.

  • SafeMath: The contract imports the SafeMath.sol library and uses it for calculations involving fees and token transfers to prevent arithmetic overflows and underflows, which could lead to vulnerabilities.

Token Features

  • Transaction Fees: The SMARTT-Token incorporates a fee mechanism, charging users a percentage fee for each transaction. This fee is split equally between the Airdrop Vault and the Burning Wallet. The percentage fee is set during the contract's deployment and can be updated by the contract owner using the setFee function:

function setFee(uint256 _fee) external onlyOwner { fee = _fee; }
  • Airdrop Vault: This is a designated wallet address that receives a portion of the transaction fees. These funds can be used to support airdrops, rewards, or other initiatives within the project.

  • Burning Wallet: This is another designated wallet address that receives a portion of the transaction fees. Tokens sent to this wallet are considered "burned" and removed from circulation, which can help reduce the overall token supply and potentially increase the value of the remaining tokens.

  • Custom Transfer and TransferFrom Functions: The contract overrides the standard ERC20 transfer and transferFrom functions to incorporate the transaction fee mechanism. When a transfer occurs, the specified amount is sent to the recipient, and the fee is deducted from the sender's balance and distributed to the Airdrop Vault and Burning Wallet.

function transfer(address recipient, uint256 amount)
    public
    override
    returns (bool)
  {
    uint256 _fee = (amount.mul(fee)).div(10000);
    _transfer(_msgSender(), recipient, amount);
    if (_msgSender() != staking) {
      _transfer(_msgSender(), airdropVault, _fee);
      _transfer(_msgSender(), burningWallet, _fee);
    }
    return true;
  }

  function transferFrom(
    address sender,
    address recipient,
    uint256 amount
  ) public virtual override returns (bool) {
    uint256 _fee = (amount.mul(fee)).div(10000);
    _transfer(sender, recipient, amount);
    _transfer(sender, airdropVault, _fee);
    _transfer(sender, burningWallet, _fee);

    uint256 currentAllowance = allowance(sender, _msgSender());
    require(
      currentAllowance >= amount,
      "ERC20: transfer amount exceeds allowance"
    );
    unchecked {
      _approve(sender, _msgSender(), currentAllowance.sub(amount));
    }

    return true;
  }
}

By using Solidity 0.8.6, OpenZeppelin libraries, and implementing custom features such as transaction fees, the provided Smart Contract creates a secure and efficient ERC20 token that supports airdrops and token burning, while allowing for controlled updates by the contract owner. Smart Contract Overview: Holding Smart Contract

The Holding Smart Contract is a staking contract that allows users to stake their tokens in order to achieve various roles based on the amount and duration of their stakes. It is built using Solidity 0.8.6 and leverages OpenZeppelin libraries for the standard ERC20 token functionality and access control.

Key Features:

  1. Role Management: The contract has four predefined roles that users can achieve through staking. Each role has specific time and amount requirements, defined in the 'role' struct.

struct role {
    uint256 time;
    uint256 amount;
}
// The contract constructor initializes the roles with their respective requirements

roles[0] = _roles1;
roles[1] = _roles2;
roles[2] = _roles3;
roles[3] = _roles4;
  1. Staking Function: The 'staking' function enables users to stake their tokens and receive the same amount of staking tokens in return. This function also calculates and updates the user's roles based on the staked amount and role requirements.

function staking(uint256 _amount) public {
    ...
    ERC20(this).transfer(msg.sender, _amount);
    _approve(msg.sender, address(this), allowance(msg.sender, address(this)) + _amount);
    ERC20(token).transferFrom(msg.sender, address(this), _amount);
    ...
}
  1. Withdraw Function: The 'withdraw' function allows users to withdraw their staked tokens and return the corresponding staking tokens.

function withdraw(uint256 _amount) public { 
    ... 
    ERC20(this).transferFrom(msg.sender, address(this), _amount);
    ERC20(token).transfer(msg.sender, _amount); 
    ... 
}
  1. Role Checking: The 'getRole' function checks the current role of a user based on their stake.

function getRole(address _account) public view returns(uint256) {...}

Technologies Involved:

By using the Holding Smart Contract, users can stake their tokens and earn roles based on the amount and duration of their stakes. This provides an incentive for users to participate in the project and contribute to its growth and success.

PreviousSmarttCollectors Flow-ChartNextSmartt-Holder

Last updated 1 year ago

Solidity: The Holding Smart Contract is written in Solidity 0.8.6, a programming language specifically designed for smart contracts on the Ethereum blockchain. This version offers improved security, optimized gas usage, and various bug fixes over previous versions.

OpenZeppelin: The contract imports OpenZeppelin's ERC20.sol and Ownable.sol libraries. The ERC20.sol library provides standard ERC20 token functionality, while the Ownable.sol library allows for access control, enabling the contract owner to change role requirements.

https://soliditylang.org/
https://www.openzeppelin.com/
🎛️
⚙️
Page cover image