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

Updated mintingPool/Vault #26

Open 123456788940 opened 1 year ago

123456788940 commented 1 year ago

// SPDX-License-Identifier: MIT pragma solidity ^0.8.0;

contract TimechainToken { string public name; string public symbol; uint8 public decimals; uint256 public totalSupply;

mapping(address => uint256) public balanceOf;

address public owner;
address public mintingPool; // Address of the minting pool
address public gdvPool; // Address of the GDV pool

uint256 public timechainCount = 0;
uint256 public constant totalTimechains = 50;
uint256 public constant timechainInterval = 7 days; // 7 days interval

event Transfer(address indexed from, address indexed to, uint256 value);
event Mint(address indexed to, uint256 value);
event Burn(address indexed from, uint256 value);

modifier onlyOwner() {
    require(msg.sender == owner, "Only the owner can call this function");
    _;
}

constructor(
    string memory _name,
    string memory _symbol,
    uint8 _decimals,
    uint256 _initialSupply,
    address _mintingPool,
    address _gdvPool
) {
    name = _name;
    symbol = _symbol;
    decimals = _decimals;
    totalSupply = _initialSupply * 10**uint256(_decimals);
    balanceOf[msg.sender] = totalSupply;
    owner = msg.sender;
    mintingPool = _mintingPool;
    gdvPool = _gdvPool;
}

function transfer(address to, uint256 value) public returns (bool) {
    require(to != address(0), "Invalid address");
    require(value <= balanceOf[msg.sender], "Insufficient balance");

    balanceOf[msg.sender] -= value;
    balanceOf[to] += value;

    emit Transfer(msg.sender, to, value);
    return true;
}

function mint(address to, uint256 value) public onlyOwner {
    require(to != address(0), "Invalid address");
    require(value > 0, "Amount must be greater than 0");

    totalSupply += value;
    balanceOf[to] += value;

    emit Mint(to, value);
    emit Transfer(address(0), to, value);
}

function startNextTimechain() public onlyOwner {
    require(timechainCount < totalTimechains, "All timechains have been processed");
    require(block.timestamp >= (timechainCount * timechainInterval), "Timechain slot is not yet active");

    // Calculate the amount to burn (2% of the total supply)
    uint256 burnAmount = (totalSupply * 2) / 100;

    // Calculate the amount to decrease from minting pool and GDV pool
    uint256 mintingPoolDecrease = (burnAmount * 50) / 100; // 50% of burnAmount
    uint256 gdvPoolDecrease = (burnAmount * 50) / 100; // 50% of burnAmount

    // Burn tokens from total supply
    totalSupply -= burnAmount;
    emit Burn(address(0), burnAmount);
    emit Transfer(address(this), address(0), burnAmount);

    // Decrease tokens from minting pool
    balanceOf[mintingPool] -= mintingPoolDecrease;
    emit Transfer(mintingPool, address(0), mintingPoolDecrease);

    // Decrease tokens from GDV pool
    balanceOf[gdvPool] -= gdvPoolDecrease;
    emit Transfer(gdvPool, address(0), gdvPoolDecrease);

    timechainCount++;
}

}

WeuFoundDev commented 1 year ago

update this contract based on updated docs. Mint will be done in the minting vault and 2% burn from it will be send to the unaccessible burning address. Whereas for GDV or buning pool - 2% of stables will be send to the GLV contract. Update it with the proper docs with functions added uo in it . @123456788940

shivasai780 commented 1 year ago
pragma solidity ^0.8.16;

import "./Iint.sol";

/**
 * @title Minting Contract
 * @dev This contract governs the process of minting new tokens within a protocol.
 */
contract Minting {
    uint public Maxminted;              // The maximum limit of tokens that can be minted
    uint public PresentMinted;          // The total number of tokens currently minted
    address public BurningAddress;      // The address authorized to perform certain burning-related actions
    mapping(address => uint) public Devamount;  // Tracks the minted amount for each developer address
    address public WeuFoundation;       // The address of the foundation overseeing the protocol
    Iint public intToken;               // Interface to the token contract for minting
    address public ProtocolAddress;     // The address of the protocol contract

    // Modifier: Only allows the BurningAddress to execute the function
    modifier OnlyBurning() {
        require(msg.sender == BurningAddress, "Only the burning address can call this function");
        _;
    }

    // Modifier: Only allows the WeuFoundation to execute the function
    modifier OnlyFoundation() {
        require(msg.sender == WeuFoundation, "Only the WeuFoundation address can call this function");
        _;
    }

    // Constructor: Initializes the contract with the deployer's address as the BurningAddress
    constructor() {
        BurningAddress = msg.sender;
    }

    /**
     * @dev Initializes the protocol by setting initial values and addresses.
     * @param _supply The maximum limit of tokens that can be minted.
     * @param _weuFoundation The address of the foundation overseeing the protocol.
     * @param _intToken The address of the token contract interface for minting.
     * @param _protocol The address of the protocol contract.
     */
    function initialize(uint _supply, address _weuFoundation, address _intToken, address _protocol) external OnlyBurning {
        require(ProtocolAddress == address(0), "Protocol is already initialized");
        Maxminted = _supply;
        WeuFoundation = _weuFoundation;
        intToken = Iint(_intToken);
        ProtocolAddress = _protocol;
    }

    /**
     * @dev Increases the maximum limit of tokens that can be minted.
     * @param _supply The additional supply to increase the limit by.
     */
    function increaseMaxMinted(uint _supply) external OnlyBurning {
        require(_supply != 0, "Supply cannot be equal to zero");
        Maxminted += _supply;
    }

    /**
     * @dev Decreases the maximum limit of tokens that can be minted.
     * @param _supply The supply to decrease the limit by.
     */
    function decreaseMaxMinted(uint _supply) external OnlyBurning {
        require(_supply != 0, "Supply cannot be equal to zero");
        Maxminted -= _supply;
    }

    /**
     * @dev Mints new tokens and assigns them to a developer.
     * @param _supply The amount of tokens to be minted.
     * @param _dev The address of the developer receiving the minted tokens.
     */
    function mintSupply(uint _supply, address _dev) external OnlyFoundation {
        require(_supply != 0 && _dev != address(0), "Supply and developer address cannot be zero");
        require(Maxminted >= (PresentMinted + _supply), "Exceeds maximum mintable limit");
        intToken.mint(_dev, _supply);
        Devamount[_dev] += _supply;
        PresentMinted += _supply;
    }
}
WeuFoundDev commented 1 year ago

add the functions in here

shivasai780 commented 1 year ago

This Solidity contract, named Minting, facilitates the process of minting new tokens within a protocol. It allows designated addresses to manage the minting process, control maximum mintable limits, and track developer-specific minted amounts. Here's a comprehensive breakdown of its features:

Contract Overview: The Minting contract controls the minting of new tokens within a protocol. It employs modifiers to ensure that only authorized addresses (BurningAddress and WeuFoundation) can execute certain functions.

State Variables:

Maxminted: Represents the maximum limit of tokens that can be minted. PresentMinted: Indicates the total number of tokens that have been minted so far. BurningAddress: The address authorized to perform burning-related actions. Devamount: A mapping that tracks the minted amount for each developer address. WeuFoundation: The address of the foundation overseeing the protocol. intToken: An interface to the token contract, enabling minting. ProtocolAddress: The address of the protocol contract.

Modifiers:

OnlyBurning(): Restricts function execution to the authorized BurningAddress. OnlyFoundation(): Restricts function execution to the WeuFoundation address.

Constructor:

Initializes the contract with the deployer's address as the initial BurningAddress. Functions:

initialize(...): Initializes the protocol by setting initial values and addresses. It can only be called by the BurningAddress. Sets values such as Maxminted, WeuFoundation, intToken, and ProtocolAddress. increaseMaxMinted(...): Allows the BurningAddress to increase the maximum limit of tokens that can be minted by a specified supply. decreaseMaxMinted(...): Allows the BurningAddress to decrease the maximum limit of tokens that can be minted by a specified supply. mintSupply(...): Allows the WeuFoundation to mint new tokens and assign them to a developer. Checks constraints and updates PresentMinted, Devamount, and the token supply. The Minting contract ensures proper control and accountability in the minting process, keeping track of the minted tokens and enforcing maximum minting limits. It facilitates secure management of minting activities within a protocol.

WeuFoundDev commented 1 year ago

What the hell is time chain token . Soham stop using chat gpt , use brain better . @123456788940 . Shiv please review the contract , dont know which token he is minting out @shivasai780

123456788940 commented 1 year ago

Foundation Smart Contract Documentation

Introduction:

The Foundation contract is a Solidity-based smart contract designed to manage a committee of members with varying roles, such as Research, Technical, and FoundationMember. Its primary purpose is to facilitate the periodic rotation of roles within this committee using a secure session key mechanism. This documentation provides an in-depth explanation of the contract's features, how to interact with it, and its core architecture.

Getting Started:

To use this contract effectively, it's essential to have a basic understanding of Solidity and Ethereum smart contracts. You will also require a development environment, such as Remix or Truffle, for contract deployment and interaction.

Roles:

The contract defines three distinct roles:

  1. Research: Committee members with a focus on research-related activities.
  2. Technical: Committee members with technical expertise.
  3. FoundationMember: General committee members with broader responsibilities.

Each committee member is assigned one of these roles and actively participates in role rotations based on their session keys.

Functions:

The contract offers the following essential functions:

initiateNewChain(address[] newCouncilMembers): This function initiates a new chain and, in the process, rotates council members. It clears existing session keys and generates new ones for incoming council members.

changeMembersUsingSessionKeys(): Committee members can use this function to request a role rotation when the rotation threshold is met.

rotateRolesUsingSessionKeys(): This private function handles the actual role rotation for committee members based on their session keys.

getCouncilMembers(): A utility function that returns the list of currently active council members.

computeNewRole(CommitteeMember memory member): This private function calculates the new role for a committee member based on their session key.