Post
Topic
Board Altcoin Discussion
Re: Where DeFi is headed
by
Tokenista
on 02/04/2021, 02:59:19 UTC
Just so everyone here can start their own projects

This will be a thread about TRC20 Token creation

Code:
pragma solidity ^0.4.23;

import "./ITRC20.sol";
import "../../utils/SafeMath.sol";

/**
 * @title Standard TRC20 token (compatible with ERC20 token)
 *
 * @dev Implementation of the basic standard token.
 * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
 * Originally based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
 */
contract TRC20 is ITRC20 {
    using SafeMath for uint256;

    mapping (address => uint256) private _balances;

    mapping (address => mapping (address => uint256)) private _allowed;

    uint256 private _totalSupply;

    /**
     * @dev Total number of tokens in existence
     */
    function totalSupply() public view returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev Gets the balance of the specified address.
     * @param owner The address to query the balance of.
     * @return An uint256 representing the amount owned by the passed address.
     */
    function balanceOf(address owner) public view returns (uint256) {
        return _balances[owner];
    }

    /**
     * @dev Function to check the amount of tokens that an owner allowed to a spender.
     * @param owner address The address which owns the funds.
     * @param spender address The address which will spend the funds.
     * @return A uint256 specifying the amount of tokens still available for the spender.
     */
    function allowance(
        address owner,
        address spender
    )
    public
    view
    returns (uint256)
    {
        return _allowed[owner][spender];
    }

    /**
     * @dev Transfer token for a specified address
     * @param to The address to transfer to.
     * @param value The amount to be transferred.
     */
    function transfer(address to, uint256 value) public returns (bool) {
        _transfer(msg.sender, to, value);
        return true;
    }

    /**
     * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
     * Beware that changing an allowance with this method brings the risk that someone may use both the old
     * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
     * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     */
    function approve(address spender, uint256 value) public returns (bool) {
        require(spender != address(0));

        _allowed[msg.sender][spender] = value;
        emit Approval(msg.sender, spender, value);
        return true;
    }

    /**
     * @dev Transfer tokens from one address to another
     * @param from address The address which you want to send tokens from
     * @param to address The address which you want to transfer to
     * @param value uint256 the amount of tokens to be transferred
     */
    function transferFrom(
        address from,
        address to,
        uint256 value
    )
    public
    returns (bool)
    {
        _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
        _transfer(from, to, value);
        return true;
    }

    /**
     * @dev Increase the amount of tokens that an owner allowed to a spender.
     * approve should be called when allowed_[_spender] == 0. To increment
     * allowed value is better to use this function to avoid 2 calls (and wait until
     * the first transaction is mined)
     * From MonolithDAO Token.sol
     * @param spender The address which will spend the funds.
     * @param addedValue The amount of tokens to increase the allowance by.
     */
    function increaseAllowance(
        address spender,
        uint256 addedValue
    )
    public
    returns (bool)
    {
        require(spender != address(0));

        _allowed[msg.sender][spender] = (
        _allowed[msg.sender][spender].add(addedValue));
        emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
        return true;
    }

    /**
     * @dev Decrease the amount of tokens that an owner allowed to a spender.
     * approve should be called when allowed_[_spender] == 0. To decrement
     * allowed value is better to use this function to avoid 2 calls (and wait until
     * the first transaction is mined)
     * From MonolithDAO Token.sol
     * @param spender The address which will spend the funds.
     * @param subtractedValue The amount of tokens to decrease the allowance by.
     */
    function decreaseAllowance(
        address spender,
        uint256 subtractedValue
    )
    public
    returns (bool)
    {
        require(spender != address(0));

        _allowed[msg.sender][spender] = (
        _allowed[msg.sender][spender].sub(subtractedValue));
        emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
        return true;
    }

    /**
     * @dev Transfer token for a specified addresses
     * @param from The address to transfer from.
     * @param to The address to transfer to.
     * @param value The amount to be transferred.
     */
    function _transfer(address from, address to, uint256 value) internal {
        require(to != address(0));

        _balances[from] = _balances[from].sub(value);
        _balances[to] = _balances[to].add(value);
        emit Transfer(from, to, value);
    }

    /**
     * @dev Internal function that mints an amount of the token and assigns it to
     * an account. This encapsulates the modification of balances such that the
     * proper events are emitted.
     * @param account The account that will receive the created tokens.
     * @param value The amount that will be created.
     */
    function _mint(address account, uint256 value) internal {
        require(account != address(0));

        _totalSupply = _totalSupply.add(value);
        _balances[account] = _balances[account].add(value);
        emit Transfer(address(0), account, value);
    }

    /**
     * @dev Internal function that burns an amount of the token of a given
     * account.
     * @param account The account whose tokens will be burnt.
     * @param value The amount that will be burnt.
     */
    function _burn(address account, uint256 value) internal {
        require(account != address(0));

        _totalSupply = _totalSupply.sub(value);
        _balances[account] = _balances[account].sub(value);
        emit Transfer(account, address(0), value);
    }

    /**
     * @dev Internal function that burns an amount of the token of a given
     * account, deducting from the sender's allowance for said account. Uses the
     * internal burn function.
     * @param account The account whose tokens will be burnt.
     * @param value The amount that will be burnt.
     */
    function _burnFrom(address account, uint256 value) internal {
        // Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
        // this function needs to emit an event with the updated approval.
        _allowed[account][msg.sender] = _allowed[account][msg.sender].sub(
            value);
        _burn(account, value);
    }
}

https://medium.com/@jgulacsy/use-the-open-zeppelin-smart-contract-framework-51ab17c5ae9

https://tronprotocol.github.io/documentation-en/contracts/trc20/

https://coredevs.medium.com/what-is-trc20-da34cac6608d

https://developers.tron.network/docs/issuing-trc20-tokens-tutorial

https://newreleases.io/project/github/tronprotocol/java-tron/release/GreatVoyage-v4.0.0

ERC20 guide to help since they are basically the same
https://github.com/bitfwdcommunity/Issue-your-own-ERC20-token
I have been trying to learn solidity but it hasn't been that easy for me because of my lack of background in programming. But anytime I see a new coin or token launched I feel more compelled to try to give it a try.

The fact that one can just create a token with little or no cost and launch it to the public to raise money for one's project makes learning Ethereum solidity for ERC-20 and even TRC-20 creation a worthwhile effort. I just hope I will be able to achieve that one day.

Here are some Solidity guides

Something everyone should know. This applies to BLURT because BLURT is a STEEM Fork, meaning it is an exact copy of STEEM from March 2020, but everything after that is independent from what happens on Steemit.

When I joined Steemit in 2016, it took 104 weeks, which is 2 years, to take your funds out. I am fully in support of that, but it is not a well understood position. Most people think STEEM or BLURT should be able to be withdrawn in 4 weeks.

So I want to explain this for everyone.

Anarcho-Capitalists took over Steemit, and I left. STEEM was topping at like $20 and sitting at like $5 when I left because the platform became useless. Dan and Ned are the Developers, then the Bitshares people were the Witnesses and early adopters. So when they all got Anarchy Fever, no one could get an upvote unless they were saying "Taxation is Theft", and being proud Anti-Statists who literally think anyone who believes in a State is wrong.

You may think "that's democracy" or Majority Rule or whatever, but that is not good business for a Social Media Blogging site trying to be a real universal platform.

Apparently these Anarchists voted for a 13 week STEEM Power Down, so people could withdraw all their money. I started my Power Down during the 104 week rule, and never came back, so I literally had no idea this happened. I spoke to someone today and they said "it was always 13 weeks on Steemit", so that means that most people don't even understand how this works.

So, everyone wants their money when they need it, but that is why Steemit had a 50/50 Payout in Liquid and STEEM Power. So half is saved, half is held.

And you are supposed to use this like a Bank.

STEEM Power has 4% interest. So it makes money like a Bank, actually better than most Banks. Plus, you get Curation and Author Rewards. So if you think of STEEM Power as Money held in your Bank account, you can actually live on the Interest and Rewards.

And the fact that it took 102 weeks to pull it out meant that people had to be in it for the long haul. People couldn't just pull all the STEEM being used for Curation and dump it.

If that isn't obviously clear, you can look at what happened when they changed to 4 week withdrawals. It is $0.15 now and everyone is gone.

This could be resolved if we all just started coming in, buying it up, and holding it ourselves. But you can see how the 4 weeks was not really a good move. And really 13 weeks was too quick.

But, in order to raise the prices of these currencies, we can collectively do this ourselves.

This concept that existed at the beginning of Steemit, which the Anarchocapitalists got rid of, is very well defined here.


Something that should be mentioned, right now if I want to send a Bitcoin or an ETH somewhere, it costs like $2.00+, this is due to Transaction fees used to pay miners to want to mine your block, the more fees you pay the faster your transaction goes through, it can take 1 hr or more for a Bitcoin to go from 1 wallet to another.

So there is an entire market for what are called Micropayments.

Micropayments are if I want to send $1 or less, or even $10 or so. It is not really efficient to send $10.00 payments with fees at $2.00 or more.

So there is an entire industry for Micropayments, and TRC10/20 Tokens definitely fulfill this. You get about 5000 free Bandwidth per day in your wallet, and can send any amount of a Token to another wallet for about 280 Bandwidth. So you can easily send several people small payments in 1 day if you needed, or accept small payments from them. All within the TRON wallet, then for liquid trade on the TRON Link exchanges.

There have been entire currencies with the singular purpose of being a Micropayment Blockchain, and TRON Tokens have it built in. And the Tokens move to the other wallet just about instantly.
Use this with the links, it gives you the Github repository to clone
https://developers.tron.network/docs/issuing-trc20-tokens-tutorial

Then this as a guide to set up the git repository
https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/cloning-a-repository#cloning-a-repository-using-the-command-line

I have been busy, but will be launching a TRC20 Token very soon using this method and will take screen shots.

This explains how you get your Token from the Github website to visibly up if you clone a more complex Token, but this is Steem-Engine Tokens. Github works the same for both though.
https://steemit.com/dtube/@heimindanger/steem-engine-tokens-dtube-scottube
Here is the TRC10 Token creation Guide, you can do it from your Cell phone
Android/Iphone Guide to Make a TRC10 TRON Token: Every Steemit user should Create or be involved with one
https://steemit.com/hive-142140/@punicwax/android-iphone-guide-to-make-a-trc10-tron-token-every-steemit-user-should-create-or-be-involved-with-one
I created a trc10 token on tronscan.org few months back but it never got approved.
I was a newbie (still am) so I just left it there.
Do we need website to create our token? I was asked to fill website address in one field if I remember correctly.
Do tokens created by us have any life cycle or they stay alive forever even if they are not in circulation?

I am suing Poloniex soon to fix this, they are Monopolizing under false pretenses of self listing, anyone interested just keep checking in, and if you want you can join later to make it class action.