WeuFoundDev / Governance-token-contracts

Governance contract of INPUT (INT) | A development based minting tokens for developers and researchers ecosystem.
GNU General Public License v3.0
2 stars 0 forks source link

Burning and minting docs #24

Open 123456788940 opened 1 year ago

123456788940 commented 1 year ago

The provided smart contract is called "Minting" and it facilitates the minting of a custom token. Let's break down the contract and its components:

  1. // SPDX-License-Identifier: MIT: This is a SPDX license identifier that indicates the licensing of the smart contract. In this case, the MIT license is used, which is a permissive open-source license.

  2. pragma solidity ^0.8.0;: This line specifies the version of the Solidity compiler required to compile the contract. In this case, version 0.8.0 or higher is needed.

  3. Import Statements:

    • import "@openzeppelin/contracts/access/Ownable.sol";: This imports the Ownable contract from the OpenZeppelin library. The Ownable contract provides a modifier that restricts certain functions to be callable only by the contract owner.
    • import "@openzeppelin/contracts/utils/math/SafeMath.sol";: This imports the SafeMath library from the OpenZeppelin library. The SafeMath library provides safe arithmetic operations to prevent integer overflows and underflows.
    • import "./Iint.sol";: This imports the interface Iint, which defines the function signature for the minting of the custom token. This interface will be used later in the contract.
  4. Interface:

    • interface Iint { function mint(address to, uint256 amount) external; }: This is the interface Iint, which defines a single function mint. The purpose of this interface is to interact with the external contract that implements this function for minting tokens.
  5. Contract Structure:

    • contract Minting is Ownable { ... }: The Minting contract inherits from the Ownable contract, meaning it will have the access control functionality provided by Ownable. It is a standard practice to use access control mechanisms to manage ownership and permissions within a smart contract.
  6. State Variables:

    • uint256 public immutable MaxSupply;: This variable represents the maximum supply of the custom token and is declared as immutable, meaning it can only be set during contract deployment and cannot be changed thereafter.
    • uint256 public presentSupply;: This variable keeps track of the current supply of the custom token.
    • address public immutable BurningAddress;: This variable stores the address that has permission to perform specific actions (defined by the onlyBurning modifier).
    • address public immutable WeuFoundation;: This variable stores the address of the WeuFoundation, which is granted permission to perform specific actions (defined by the onlyFoundation modifier).
    • Iint public immutable intToken;: This variable is of type Iint, representing the interface of the contract that implements the minting function.
    • address public immutable ProtocolAddress;: This variable stores the address of a protocol.
  7. Modifiers:

    • modifier onlyBurning() { ... }: This modifier restricts access to certain functions to the BurningAddress.
    • modifier onlyFoundation() { ... }: This modifier restricts access to certain functions to the WeuFoundation.
  8. Constructor:

    • constructor(uint256 _maxSupply) { ... }: This is the constructor function that is executed once during the contract deployment. It sets the MaxSupply and initializes the BurningAddress with the address of the deployer.
  9. External Functions:

    • function initialize(uint _supply, address _weuFoundation, address _intToken, address _protocol) external OnlyBurning { ... }: This function can be called by the BurningAddress to initialize various parameters of the contract, such as the MaxSupply, WeuFoundation, intToken, and ProtocolAddress.
    • function increaseMaxSupply(uint256 _supply) external onlyBurning { ... }: This function allows the BurningAddress to increase the maximum supply by a specified amount.
    • function mintSupply(uint256 _supply, address _dev) external onlyFoundation { ... }: This function allows the WeuFoundation to mint new tokens and increase the present supply.

Overall, this contract is designed to handle the minting of a custom token with controlled access to specific functions. The actual minting of tokens is done through an external contract that implements the mint function as defined in the Iint interface. The contract enforces access control through the onlyBurning and onlyFoundation modifiers, ensuring that only the designated addresses can perform certain actions.

As always, it's crucial to ensure that the interfaces and external contracts used in this contract are implemented securely and have been audited for potential vulnerabilities before deploying this contract to the mainnet or any production environment.

WeuFoundDev commented 1 year ago

Contract Variables:

maxSupply: An unsigned integer that represents the maximum total supply of the token.

presentSupply: As minting pool will be different for every entropy being build or have grants offered . But there burning address will remain the same .

burningAddress: An Ethereum address that is set during contract deployment. It represents the address authorized to trigger functions with the onlyBurning modifier. Burning contract can only investment from FRP (foundation revenue pool) and burning of INT can only be done by council members (8 members) with a quorum of 75 percent and psuedo overide address controlling it for critical time which will be the FRP pool addresses only. Burning address performs a function of checking every minting address denoting no. of timechain left and no. of int tokens can be minted out .

Foundation Revenue Pool: An Ethereum/arbritrum based address that represents the address of the Weu Foundation. It is authorized to trigger functions with the onlyFoundation modifier.

intToken: An instance of a contract implementing the int interface. It represents the token contract that complies with the minting interface. Each project/entropy will have their own minting address denoting no. of time chains and no. of int tokens.

Modifiers: onlyBurning: A custom modifier that restricts the execution of a function to be triggered only by the burningAddress defined during contract deployment. onlyFoundation: A custom modifier that restricts the execution of a function to be triggered only by the weu Foundation address.

Verifiers: A multi sig aggregation based signing for approval of minting of existing INT tokens equal to the amount of INT tokens are specified for minting for the particular job. The verifier function must be triggered by 66% percent of the total auditors/verifiers .

Constructor: The constructor sets the address of the burningAddress to be the address of the sender who deploys the contract. It also initializes the maxSupply to be existed for the specified minting pool for particular timechains.

Function initialize: This function can only be called by the burningAddress (through the onlyBurning modifier) during contract initialization with the quorum of 100 % of council members. It allows the contract owner (presumably the burning address) to set the initial values of mintSupply for the particular minting pool , no. of timechains assigned to particular minting pool , and protocolAddress. This function can be used to update these values after the contract is deployed.

Function increaseMintSupply: This function can only be called by the burningAddress (through the onlyBurning modifier) which will trigger only after all the council members signed the increaseMintSupply for the particular minting pool. It increases the maxSupply of the INT by the specified _supply amount for the specified pool . The _supply must be greater than zero. But it will increase the threshold percentage for Burning INT per TIMECHAIN as the end of 50 timechain the minting supply will reach 0.

Function mintSupply: This function can only be called by the developers and researchers after getting approval by the verifiers address for their work. Verifiers are the core devs who let the community to mint the INT tokens for their work . Before minting, the function checks if the _minting supply , _dev address and their attached id are valid .

If the checks pass, it calls the mint function on the intToken contract to mint specified tokens approved by the verifiers for the _dev address and updates the presentSupply accordingly. Overall, the contract aims to provide a controlled minting process for a token, where only the burningAddress can increase the maximum supply, and only the weuFoundation can mint new tokens to a specified address while adhering to the defined maximum supply limit.

However, please note that the contract assumes the existence of an interface called int, which should be defined in a separate file (imported as "@openzeppelin/contracts/access/Ownable.sol"). This interface likely contains a function signature for the mint function used in the mintSupply function.

@123456788940 @shivasai780 tell me more things to update .

WeuFoundDev commented 1 year ago

@123456788940 Update the docs with the same contract and configure to close this branch once done

WeuFoundDev commented 1 year ago

Is this branch should be closed . Configure it here n close it @123456788940 @shivasai780

123456788940 commented 1 year ago

Minting Smart Contract

Overview:

The Minting Smart Contract is designed to govern the process of minting new tokens within a protocol. It provides control over maximum mintable limits, tracks developer-specific minted amounts, and enforces authorization through designated addresses.

Features:

Getting Started:

Prerequisites:

To interact with the Minting Smart Contract, you'll need:

Usage:

Contract Initialization:

The contract should be deployed with the following parameters:

Modifiers:

Constructor:

The constructor initializes the contract with the deployer's address as the initial BurningAddress.

Functions:

The Minting Smart Contract ensures proper control and accountability in the minting process, keeping track of minted tokens and enforcing maximum minting limits. It provides a secure framework for managing minting activities within a protocol.