Skip to content

thetatoken/tdrop-governance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TDROP Token and Governance

Introduction

This repository contains the smart contracts for the TNT-20 TDROP Token, the staking contract and the on-chain governance module. For more information, please read Section 3 and 4 of the Theta 2022 Ecosystem whitepaper.

TDROP Token

The TDROP token is a TNT-20 Token (similar to the Ethereum ERC20 token) which forms the basis of the decentralized governance of the Theta Drop NFT Marketplace. The token is implemented by this smart contract. This and this test case verify its TNT-20 token interface, and also cover some specicial features.

Staking

The TDROP staking feature is implemented by this smart contract. This test case demonstrates how to interact with the contract with Javascript for TDROP staking and unstaking. There is no minimum requirement for staking. The staked TDROP can be partially unstaked. Upon unstaking, the staking reward corresponding to the unstaked amount will be sent to the user's wallet along with the principal unstaked. A total of 4 Billion TDROP (20% of total supply) is allocated over a 4-year period as rewards for staking TDROP, which also allows users to participate in the decentralized governance of the network. Each year 1 Billion TDROP will be distributed proportionally to all TDROP stakers.

Governance

The TDROP on-chain governance feature is implemented by this smart contract. This test case illustrates how to interact with the contract using Javascript for submitting and voting for proposals. TDROP serves as the governance token for ThetaDrop and the NFT Marketplace. TDROP holders can stake their tokens to gain voting rights for proposed changes to ThetaDrop. Each user's voting rights for a given proposal will be equal to their share of staked TDROP as a percentage of total TDROP staked. The first TDROP vote proposal is expected to be the earning rate of TDROP for staking and/or liquidity miners, subject to change. As the voting process progresses and stabilizes, TDROP holders will be responsible for creating new proposals to be voted on. Similar to the governance mechanism of prominent DeFi projects like Compound and Uniswap, TDROP governance voting will be conducted fully on-chain through smart contract calls. These community proposals will also serve as the testbed for community governance features to be implemented on the Theta blockchain itself, to be voted on by holders of the Theta token.

Setup

git clone https://github.com/thetatoken/tdrop-governance
cd tdrop-governance
npm install

Compilation

npx hardhat compile

Unit Tests

Test against ganache

To test against ganache, first install ganache following the steps here. Then, start ganache-cli in a terminal with the following commond:

ganache-cli

Next, in another terminal, run the tests with

# run all tests
npx hardhat test --network ganache

# run an individual test
npx hardhat test test/02-tdrop-token-special-features.js --network ganache

Test against the Theta local privatenet

We need to run the unit tests against the Theta local privatenet to make sure the smart contracts behave as expected on the Theta EVM.

First we need to setup the Theta local privatenet with the Theta/Ethereum RPC Adaptor following this guide. The ETH RPC adaptor running at http://localhost:18888/rpc interacts with the ethers.js library by translating the Theta RPC interface into the ETH RPC interface.

Next, run the test suite with

# run all tests
npx hardhat test --network theta_privatenet

# run an individual test
npx hardhat test test/02-tdrop-token-special-features.js --network theta_privatenet

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published