EGreg / AutonomousTokenContract

Contract for issuing tokens to be sold to others, and traded on exchanges.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AutonomousTokenContract

Autonomous smart contract that issues and manages tokens to be traded on exchanges, and transferred between users. The approach behind its design is to be radically decentralized and autonomous. Unlike most crypto projects, the initial team and early investors do not sell any pre-minted tokens into the marketplace. Rather, the contract itself mints and sells the tokens, organizes buybacks and manages their transfers according to predetermined rules and parameters which can be easily conveyed to end-users. Proceeds from the sales can be shared with the team and early investors, who may hold other tokens that were used to raise funds for the project. The contract continues to operate into the future, regardless of any activities by any off-chain teams, companies, foundations or organizations.

Buyers of the token can be assured of the behavior and operation of the smart contracts on the decentralized network, both of the decentralized exchange on which they trade it, and the TradedTokenContract from which they buy it. Collateral in the liquidity pool and buyback fund can be employed to secure the value in a completely decentralized, trustless system rather than a common enterprise, so it would be difficult to classify tokens traded in this manner as a security under either the Howey Test or Risk Capital test. At any rate, the source code of the contracts constitutes full disclosure of how they operate, and what people can expect when buying them. Buyers would only need to look at the parameters that were used when the contract was launched. Take care with the initial parameters when deploying this contract: they should be set depending on your desired tokenomic and regulatory outcomes.

About

✊ Power to the People

  • The tokens wind up in the hands of the community
  • Encourages investment, stability and growth
  • Penalizes dumping and eliminates rugpulls

πŸ’΅ Incentives for Long Term Holds, Relationships and Utility

  • No tax on buying, or users transferring small amounts of their balance per day
  • Progressive tax on transferring larger % of balance in a given time period
  • Designed to discourage day traders and counteract whales dumping the tokens

πŸš€ Selling Tokens into the Marketplace and Distributing Profits

  • All tokens are placed into liquidity at launch by the smart contract
  • As users buy up the token, contract removes some liquidity without affecting price
  • ETH from removed liquidity is set aside for buybacks (70%) and the rest disbursed to investors (30%)

🐳 Buybacks to Counter Dumping by Whales

  • During sell-offs, the contract can buy back the tokens and take them out of circulation
  • This leads to a smaller token supply, pushing the price up even more
  • When reserves run low, the smart contract can gradually lower the buy price, while maintaing the sell price

πŸ”’ Smart Contract Holds Liquidity: Will Never Rug Pull

  • The liquidity pool tokens are owned by the smart contract
  • Everyone can be confident that the smart contract will never "rug pull" the liquidity
  • Team and early investors cannot dump the tokens onto the market

πŸ”₯ Options for Hyper-Deflation or Rewards for Viral Referrals

  • Taxes can remove tokens from circulation
  • Taxes can be used to pay referral fees to the account who invited you, incentivizing people to invite others

πŸ’³ Disbursing the proceeds

  • Contract buys and the tokens in a completely predictable manner.
  • Disburses shares of proceeds to one or more addresses.
  • Those addresses can be smart contracts that handle disbursements to the original team and investors, or for discounts to certain groups.

Overview

Once installed will be use methods:

method name called by description
initialize Anyone initialize a contract
startPool owner starting pool with initial price. can be called only once
_updateRestrictionsAndRules owner set address of TransferRules contract.
bulkTransfer Anyone bulk transfer support
sell Anyone initiate mechanism to smooth out buy and sell prices. Contract will sell some own tokens to LP
buy Anyone initiate mechanism to smooth out buy and sell prices. Contract will buy back some tokens from LP

Settings

TotalSupply are 1_000_000_000 tokens

Methods

initialize

Params:

name type description
name string ERC777 token's name
symbol string ERC777 token's symbol
defaultOperators address[] ERC777 token's defaultOperators
_presalePrice uint256 fixed price(presale Price) to exchange coins to tokens. it's actual before owner call startPool
_predefinedBalances tuple[] array of tuples like [address,amount] of user balances that need to be predefined
_buyTax tuple buy settings - [percentOfTokenAmount, priceDecreaseMin, slippage, percentOfSellPrice]. Default are [0, 10, 10, 0]
_sellTax tuple sell settings - [percentOfTokenAmount, priceIncreaseMin, slippage]. Default are [0, 10, 10]
_transferTax tuple transfer settings - [total, toLiquidity, toBurn]. Default are [0, 10, 0]
_progressiveTax tuple progressive settings - [from, to, duration]. Default are [5, 100, 3600]
_disbursementList tuple[] array of tuples like [address, percent]. sum of percents require to be 100%

startPool

Params:

name type description
price uint256 price mul by 1e9

method initiate first price by adding liquidity. contract eth balance will divide by price to get token amount token's amount and eth will be added to liquidity pool.

updateRestrictionsAndRules

Params:

name type description
rules address TransferRules address contract

TransferRules contract flow validation described here

bulkTransfer

Params:

name type description
_bulkStruct tuple[] array of tuples [recipient, address]
_data bytes data to operatorSend params

sell

mechanism to smooth out buy and sell prices. Contract will sell some own tokens to LP

buy

mechanism to smooth out buy and sell prices. Contract will buyback some tokens from LP

Tuples

BulkStruct

Params:

name type description
recipient address address
amount uint256 amount

BuyTax

Params:

name type description
percentOfTokenAmount uint256 percent of LP token's reserve that need to be buyback by contract
priceDecreaseMin uint256 triggered event ShouldBuy when current sell price will fall by priceDecreaseMin percents of last buyback price
slippage uint256 slippage
percentOfSellPrice uint256 buyback price will update after everytime when contract sell tokens by formula buybackprice = sellprice * percentOfSellPrice / 100

SellTax

Params:

name type description
percentOfTokenAmount uint256 percent of LP token's reserve that need to be sell by contract
priceIncreaseMin uint256 triggered event ShouldSell when current sell price will rise by priceIncreaseMin percents of last LastMaxSellPrice
slippage uint256 slippage

TransferTax

Params:

name type description
total uint256 calculate percent of transfer that applied on each usual transfer(not exchange with Uniswap)
toLiquidity uint256 percent of total that will add to liquidity
toBurn uint256 percent of LP tokens that contract will burn after adding liquidity. can be [0;100]

ProgressiveTax

Params:

name type description
from uint256 percent
to uint256 percent
duration uint256 progressive tax can be applied to user by this duration

DisbursementList

Params:

name type description
addr address address
percent uint256 percent [1;100]

Events

event name description
RulesUpdated when Rules contract updated
SwapAndLiquifyEnabledUpdated when flag SwapAndLiquifyEnabled changed
SwapAndLiquify when SwapAndLiquify happens
SentBonusToInviter when inviter get some bonus
SentDisbursements emitted after all disbursements were sent
PresaleBuy when contract recieve coins and return tokens in presale period
NotEnoughTokenToSell when contract didn't have enough tokens to sell
NotEnoughETHToBuyTokens when contract didn't have enough Coins to buy tokens
NoAvailableReserves when no available LP reserve
NoAvailableReserveToken when no available tokens in LP reserve
NoAvailableReserveETH when no available Coins in LP reserve
ContractSellTokens when contract sell additional tokens to LP successfully
ContractBuyBackTokens when contract buy back tokens from LP successfully
ShouldSell when current sell price become more than lastMaxSellPrice
ShouldBuy when current sell price become less than lastBuyPrice

Example to use

After deploy owner need:

  • to call method initialize. to correctly initialize contract and all sub contracts inside
  • [optionally] if need to activate Transfer Rules regulation: -- to deploy TransferRules contract (or get exist address) -- to call method _updateRestrictionsAndRules to link our token with Transfer Rules contract.
  • to send to contract some coins(eth or bnb) and get tokens by presale price and then call method startPool to add to liquidity pool all contract's coins and calculated tokens amount via transferred price as param
  • at last owner should call renounceOwnership to show that contract does not own him now any person can use pancakeSwap to exchange his coins to our tokens and vice versa
  • [periodically] need to call sell or buy to smooth out prices. Logic described at issues-6

About

Contract for issuing tokens to be sold to others, and traded on exchanges.

License:GNU Affero General Public License v3.0


Languages

Language:Solidity 67.0%Language:JavaScript 33.0%