treasurenetprotocol / treasurenet-contracts

contracts
Apache License 2.0
1 stars 1 forks source link

treasurenetLogo

Treasurenet

Treasurenet proposes a solution for the critical lack of sustaining and tangible value in the crypto world. Our goal is the combine real world economic drivers and distributed ledger scalability. As a layer 1 protocol, TN will become a model for sustaining value in the fiat world and the digital world.

Treasurenet Contracts

License: Apache-2.0 npm: v9.5.1 Treasurenet CI Contributor Covenant

This contains almost all contracts officially developed and maintained by Treasurenet Foundation.

Installation

To install and set up the project contract for development, follow these steps:

# Clone the repository
git clone https://github.com/treasurenetprotocol/treasurenet-contracts.git

# Navigate to the project directory
cd treasurenetprotocol

# Install the dependencies
npm install

Usage

To run the tests for this project,use the following command:

run a ganache test network

npm run ganache

run tests

npm run test

Make sure all tests pass before submitting a pull request.

Introduction and APIs

Airdrop module

This AirDrop smart contract is engineered to systematically distribute tokens to foundations and VIP users according to a predefined schedule. It incorporates a sophisticated multi-signature proposal mechanism, enabling secure and collective decision-making for modifications to VIP users and their respective token distribution ratios. The contract is equipped with comprehensive query functions, allowing users to retrieve detailed information about their airdrop entitlements and transaction history. Additionally, it ensures secure withdrawal operations, providing a robust framework for token claims.

Features

​ - Function to get the role (FOUNDATION, VIP, Unknown) of an address.

​ - Initial total amount granted to VIPs.

​ - Monthly airdrop amount calculated and distributed over 12 periods.

​ - VIPs can claim tokens based on monthly distribution.

​ - Event logging for VIP claims.

​ - Mechanism for Foundation to claim remaining VIP tokens after 12 months if unclaimed.

Airdrop documentation

Bid module

This module implements the process of selecting an Active Validator through the participation consensus mechanism of the validator. This requires that the validator has pledged at least 158 UNITs, which will form a candidate pool Candidate pool before implementing the validator bid TAT. The specific process is as follows:

  1. User wallet login system;
  2. Enter the quantity of TAT to be pledged and submit it;
  3. Sign the transaction, the transaction is successful, and the list on the left side of the page updates the pledge record. The transaction failed and will not be updated.

Features

Bid documentation

Crosschain module

The Gravity contract is an innovative solution that locks assets on the Ethereum blockchain, facilitating the creation of synthetic versions of these assets on the Tendermint blockchain. This cross-chain functionality enables users to leverage the unique benefits of both ecosystems. The contract is specifically designed to integrate seamlessly with software operating on the Tendermint blockchain, ensuring a smooth and efficient transfer of value. Its core purpose revolves around bridging assets between these two distinct platforms, will primarily focus on the Ethereum-related components of the Gravity contract, shedding light on its deployment, operation, and the mechanisms it employs to secure and manage locked assets on Ethereum.

Features

Crosschain documentation

governance module

The Governance module implements the initial appointment and transfer functions for Governance administrators and FoundationManagers, and supports Governance administrators to configure platform parameters. The Governance contract is the governance contract of the Treasury project, responsible for managing the relevant information and contract addresses of different types of assets (such as oil, gas, etc.). The specific process is as follows:

  1. Appointment of initial system role: During system initialization, appoint the first Governance administrator FoundationManager。
  2. System Role Identity Transfer: The Governance Administrator/FoundationManager performs identity transfer by replacing the saved Governance Administrator/FoundationManager user address in the system with the successor user address. This feature is only allowed for Governance administrators, auditors, and feeders to use.
  3. Platform parameter configuration: Governance administrators set platform parameters for each module. This feature is only allowed for Governance administrators to use.

Features

Governance documentation

TAT module

The TAT contract is the implementation of the TreasureNet ERC20 token, which comes with advanced features including mintable, pausable, and burnable capabilities. Additionally, it supports staking functionality, providing a comprehensive framework for managing token issuance and user engagement. The contract utilizes multiple OpenZeppelin libraries, ensuring it is upgradeable and integrates seamlessly with governance mechanisms. This design allows for flexible and secure token management, aligning with best practices in smart contract development.

Features

TAT documentation

Oracle module

The Oracle module verifies the price data pushed by the feeder, stores and updates it. The steps are as follows:

  1. Obtain mineral price data pushed by the feeder;
  2. Obtain the feed whitelist address saved in the Governance module and verify whether the current feed address matches the whitelist feed address;
    • Consistent, save price data on the chain;
    • Inconsistent, failed to save data.
  3. Rules for verifying the legality of price data:
    • The category of mineral prices pushed by the feeder must be consistent with the category configured in the Governance module, otherwise the push will fail.
  4. Price storage rules:
    • Add the price data of physical minerals on the chain in chronological order.
    • Update the price data of UNIT and USTN on the chain for single coverage.

Features

Oracel documentation

Treasure module

Treasure is mainly divided into two parts: natural assets and digital assets, including four types: BTC, ETH, GAS, and OIL.To add a well in addition to filling in required information, you can also add the beneficiaries of the mine and add relevant rules for the beneficiaries; After the mine audit is approved, the production can be obtained and the casting of TAT can begin; Failed review, unable to obtain production output, unable to cast TAT; The mine has a one-year validity period (365 days) and requires annual review upon expiration.

Multiple beneficiaries are allowed to receive the final cast TAT for the same well. This function mainly implements the function of adding/deleting beneficiaries for the well, while allocating the proportion of benefits.The business rules are as follows:

​ - Each time the manufacturer mintTAT, the corresponding TAT quantity is distributed to the beneficiary's account according to the profit ratio of the well;


Eg:
Well 1 has three beneficiaries, with a producer benefit ratio of 60%, user 1 benefit ratio of 20%, and user 2 benefit ratio of 20%;
In February, if the manufacturer mintTAT is 100 pieces, then the manufacturer's receipt of 100 60%=60 TAT, user 1's receipt of 100 20%=20 TAT, and user 2's receipt of 100 * 20%=20 TAT


​ - The total profit ratio is 100%, and the profit ratio has no decimals. It is calculated and distributed as an integer;

​ - The beneficiaries include the manufacturer, with a maximum of 10 people and a minimum of 1 person (only the manufacturer);

​ - The beneficiary allocates their own benefit ratio, distribution scope [1, current benefit ratio];

​ - Manufacturers allocate their own benefit ratio, distribution range [1, current benefit ratio -1];

​ - The beneficiary is allowed to modify their own benefit ratio, with a modification range of [0, current benefit ratio];

​ - Beneficiaries with a benefit ratio of 0 are allowed to be deleted, only producers can delete them;

Treasure documentation

USTN module

The USTN contract is a smart contract that complies with the ERC20 standard and is responsible for issuing and managing USTN tokens. This contract integrates multiple functions, including casting, destruction, transfer, and auction related operations. By integrating with governance contracts and oracle contracts, the USTN contract achieves decentralized management and real-time exchange rate calculation.

Features

USTN documentation

Contributing

We welcome contributions to the project! Please follow these steps to contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Commit your changes (git commit -am 'Add new feature').
  4. Push to the branch (git push origin feature-branch).
  5. Create a new Pull Request.

Please ensure your code adheres to our coding standards and includes relevant tests.

Code of Conduct

We expect all contributors to adhere to our Code of Conduct. Please read it to understand the expected behavior.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

(https://github.com/treasurenetprotocol/treasurenet-js-libs/blob/master/LICENSE)

FAQ

What is a producer?

Producers are economic contributors in the real world, providing production records of physical or digital assets to Treasury for auditing and on chain recording.

What is the purpose of this contract?

The contract manages an airdrop of tokens to Foundation and VIP users, with features for managing multi-stage token releases and multi-signature proposals.

How are the tokens distributed?

Tokens are distributed over time in multiple stages. The Foundation can claim tokens in two stages, while VIPs receive monthly airdrops.

How do multi-signature proposals work?

Foundation managers and board directors can propose changes to VIP ratios. Proposals require multiple signatures and a timelock before execution.

Acknowledgements

We would like to thank the developers and contributors of OpenZeppelin for their excellent upgradable contract library.

Contact Information

For questions or collaboration, please contact:


Treasurenet Foundation 2024