波场发币教程TRC20发币教程TRX发币教程波场代币智能合约发币教程

作者&投稿:步伊 (若有异议请与网页底部的电邮联系)
~ 波场链的币种叫TRC20代币,部署到TRX的主网上,波场发币教程也很简单,一起学习下吧,波场发币教程TRC20发币教程TRX发币教程波场代币智能合约发币教程,不会的退出阅读模式,我帮你代发

TRC-20

TRC-20是用于TRON区块链上的智能合约的技术标准,用于使用TRON虚拟机(TVM)实施代币。

实现规则

3 个可选项

通证名称

string public constant name = “TRONEuropeRewardCoin”;

通证缩写

string public constant symbol = “TERC”;

通证精度

uint8 public constant decimals = 6;

6 个必选项

contract TRC20 {

function totalSupply() constant returns (uint theTotalSupply);

function balanceOf(address _owner) constant returns (uint balance);

function transfer(address _to, uint _value) returns (bool success);

function transferFrom(address _from, address _to, uint _value) returns (bool success);

function approve(address _spender, uint _value) returns (bool success);

function allowance(address _owner, address _spender) constant returns (uint remaining);

event Transfer(address indexed _from, address indexed _to, uint _value);

event Approval(address indexed _owner, address indexed _spender, uint _value);

}

totalSupply()

这个方法返回通证总的发行量。

balanceOf()

这个方法返回查询账户的通证余额。

transfer()

这个方法用来从智能合约地址里转账通证到指定账户。

approve()

这个方法用来授权第三方(例如DAPP合约)从通证拥有者账户转账通证。

transferFrom()

这个方法可供第三方从通证拥有者账户转账通证。需要配合approve()方法使用。

allowance()

这个方法用来查询可供第三方转账的查询账户的通证余额。

2 个事件函数

当通证被成功转账后,会触发转账事件。

event Transfer(address indexed _from, address indexed _to, uint256 _value)

当approval()方法被成功调用后,会触发Approval事件。

event Approval(address indexed _owner, address indexed _spender, uint256 _value)

合约示例

pragma solidity ^0.4.16;

interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }

contract TokenTRC20 {

// Public variables of the token

string public name;

string public symbol;

uint8 public decimals = 18;

// 18 decimals is the strongly suggested default, avoid changing it

uint256 public totalSupply;

// This creates an array with all balances

mapping (address => uint256) public balanceOf;

mapping (address => mapping (address => uint256)) public allowance;

// This generates a public event on the blockchain that will notify clients

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

// This notifies clients about the amount burnt

event Burn(address indexed from, uint256 value);

/**

* Constructor function

*

* Initializes contract with initial supply tokens to the creator of the contract

*/

function TokenTRC20(

    uint256 initialSupply,

    string tokenName,

    string tokenSymbol

) public {

    totalSupply = initialSupply * 10 ** uint256(decimals);  // Update total supply with the decimal amount

    balanceOf[msg.sender] = totalSupply;                // Give the creator all initial tokens

    name = tokenName;                                  // Set the name for display purposes

    symbol = tokenSymbol;                              // Set the symbol for display purposes

}

/**

* Internal transfer, only can be called by this contract

*/

function _transfer(address _from, address _to, uint _value) internal {

    // Prevent transfer to 0x0 address. Use burn() instead

    require(_to != 0x0);

    // Check if the sender has enough

    require(balanceOf[_from] >= _value);

    // Check for overflows

    require(balanceOf[_to] + _value >= balanceOf[_to]);

    // Save this for an assertion in the future

    uint previousBalances = balanceOf[_from] + balanceOf[_to];

    // Subtract from the sender

    balanceOf[_from] -= _value;

    // Add the same to the recipient

    balanceOf[_to] += _value;

    emit Transfer(_from, _to, _value);

    // Asserts are used to use static analysis to find bugs in your code. They should never fail

    assert(balanceOf[_from] + balanceOf[_to] == previousBalances);

}

/**

* Transfer tokens

*

* Send `_value` tokens to `_to` from your account

*

* @param _to The address of the recipient

* @param _value the amount to send

*/

function transfer(address _to, uint256 _value) public {

    _transfer(msg.sender, _to, _value);

}

/**

* Transfer tokens from other address

*

* Send `_value` tokens to `_to` on behalf of `_from`

*

* @param _from The address of the sender

* @param _to The address of the recipient

* @param _value the amount to send

*/

function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {

    require(_value <= allowance[_from][msg.sender]);    // Check allowance

    allowance[_from][msg.sender] -= _value;

    _transfer(_from, _to, _value);

    return true;

}

/**

* Set allowance for other address

*

* Allows `_spender` to spend no more than `_value` tokens on your behalf

*

* @param _spender The address authorized to spend

* @param _value the max amount they can spend

*/

function approve(address _spender, uint256 _value) public

    returns (bool success) {

    allowance[msg.sender][_spender] = _value;

    return true;

}

/**

* Set allowance for other address and notify

*

* Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it

*

* @param _spender The address authorized to spend

* @param _value the max amount they can spend

* @param _extraData some extra information to send to the approved contract

*/

function approveAndCall(address _spender, uint256 _value, bytes _extraData)

    public

    returns (bool success) {

    tokenRecipient spender = tokenRecipient(_spender);

    if (approve(_spender, _value)) {

        spender.receiveApproval(msg.sender, _value, this, _extraData);

        return true;

    }

}

/**

* Destroy tokens

*

* Remove `_value` tokens from the system irreversibly

*

* @param _value the amount of money to burn

*/

function burn(uint256 _value) public returns (bool success) {

    require(balanceOf[msg.sender] >= _value);  // Check if the sender has enough

    balanceOf[msg.sender] -= _value;            // Subtract from the sender

    totalSupply -= _value;                      // Updates totalSupply

    emit Burn(msg.sender, _value);

    return true;

}

/**

* Destroy tokens from other account

*

* Remove `_value` tokens from the system irreversibly on behalf of `_from`.

*

* @param _from the address of the sender

* @param _value the amount of money to burn

*/

function burnFrom(address _from, uint256 _value) public returns (bool success) {

    require(balanceOf[_from] >= _value);                // Check if the targeted balance is enough

    require(_value <= allowance[_from][msg.sender]);    // Check allowance

    balanceOf[_from] -= _value;                        // Subtract from the targeted balance

    allowance[_from][msg.sender] -= _value;            // Subtract from the sender's allowance

    totalSupply -= _value;                              // Update totalSupply

    emit Burn(_from, _value);

    return true;

}

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

}

Next Previous

就是这么简单,你学会了吗?


imtoken怎么添加usdt的trc20
操作如下:第一步:找到交易所的充币入口,对应到具体币种。第二步:打开imtoken钱包中的ETH钱包,点击“转账”。提币是数字交易中最频繁的操作,如ICO项目,很多投资者在参与该项目之前,需要进行转账,即在交易所和imtoken钱包之间做一个ETH转移。首先要先将imtoken钱包中的数字货币转换成现金。数字货币...

trc20和erc20有什么区别
一、TRC20特点 1.支付的手续费…不收手续费?!是的!在波场上转账USDT是不收手续费的,但在交易所提现TRC-USDT还是会收提现手续费的(由交易所收取)。地址示例:TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t (TRC-20合约)2. 目前仍在测试中 大部分交易所均支持TRC-USDT的充值了,但因为目前TRC-USDT...

trc是什么币种
塔罗币,简称TRC,全称TaroCion总量2100万枚1研发团队200万枚2各社区,工作人员100万枚31800万通过市场挖矿获取2.对接imtoken钱包1可售余额,可提币到imtoken钱包,手续费10%,用户与用户间,可通过imtoken互转TRC,imtoken钱包的TRC可冲值到矿机钱包模式及制度1.免费注册,获得一台微型矿机。

erc20和trc20的区别
1、地址样式不同:地址样式上erc20是数字0和小写x开头,trc20则是以大写字母T开头。 2、使用网络不同:使用网络上erc20是基于以太坊存在的,trc20是波场网络。 3、安全性不同:安全性上erc20安全性较高,trc20则相对较低。 trc20 TRC20-USDT是Tether泰达公司基于TRON网络发行的USDT,充币地址是TRON地址,充提币走T...

什么区块链转账秒到(区块链赚钱app排名)
区块链项目中的达世币Dash是什么?达世币是匿名币类区块链项目的典型代表之一,不仅如此,达世币还可以用即时支付实现秒到账,它是如何实现的呢?达世币诞生于2014年1月18日,匿名程度较比特币更高。达世币有三种转账方式,一是像比特币一样的普通转账;二是即时交易。不需要矿工打包确认,就可以...

《文明6》文明、政策等要素深度解析
国际商路自发+4金,他发+2金:强力UA,一些人说他发给别人+2粮所以是倒贴UA,其实这是误解,因为同样是2粮,对玩家来说很有价值,但是对AI来说就是鸡肋,尤其神级AI本来就不缺粮锤(人口增长需求减半,生产产能需求减半),但是这对玩家来说可是免费的三角贸易(+4金、+1信仰,中期人文解锁)效果啊!所以,哪里不强了?大...

简述串联电路与并联电路的含义及各自基本物理量的特点.
并联是将二个或二个以上二端电路元件中每个元件的二个端子,分别接到一对公共节点上的连接方式如图1所示,图示为n个二端元件的并联。它们都接到一对公共节点之上,这对节点再分别与电路的其他部分连接。并联特点:所有并联元件的端电压是同一个电压,即图示电路中的V。并联电路的总电流是所有元件的电流...

回忆杀(之二):你还记得2007年的汽车广告么
2) 凯迪拉克SLS赛威2007年的时候,凯迪拉克在中国市场推出了对标奥迪A6L的SLS赛威车型,无论是气场还是配置,其实都是高于那时候的奥迪A6L产品。或许凯迪拉克错半级竞争的打法就是那时候形成的。在海外并没有SLS车型,凯迪拉克的旗舰其实是STS,不过后来导入中国市场进行了加长,就改为SLS,而中文名称则是依照STS的上代车型...

通道侗族自治县17828036268: trx币如何挖矿
戈豪前列: 波场TRON(txr)是一种数字货币,可以通过挖矿获取,先注册货币钱包,下载对应的挖矿软件,在软件中填写挖矿地址,就可以挖矿了.波场TRON(trx)是基于区块链的去中...

通道侗族自治县17828036268: PHOTOSHOP,还有三剑客最新版本是什么,下载地址 -
戈豪前列: Adobe Flash CS3 PHOTOSHOP CS5 firework 8 都是现在的最新版本 下载的话在GOUGOU.COM 搜索就可以下载了 希望我的回答对你有所帮助(*^__^*) !

通道侗族自治县17828036268: html代码大全 -
戈豪前列: 1.结构性定义 文件类型 (放在档案的开头与结尾) 文件主题 (必须放在「文头」区块内) 文头 (描述性...

通道侗族自治县17828036268: 幽浮2感应式地雷用法详解 感应式地雷怎么详解 -
戈豪前列: 3个大炸B,穿W甲,高级能量武器带绿球.高级技能齐射和撕裂,也点破甲弹,一回合爆发感应地雷/追踪绿球飞弹/榴弹拆掩体+撕裂.范围地雷+单体撕裂暴击20左右的输出,撕裂之后单体伤害增加.2个点重装机枪手,穿普通动力甲,带拟态...

通道侗族自治县17828036268: 魔方公式TR2 B2 U2 TL U2 TR'U2 TR U2 F2 TR F2 TL'B2 TR2什么意思 匿名 -
戈豪前列: 除了字母T、其他的都和三阶一样的,字母T的意思是挨着的第二层,比如TR2就是表示右边两层顺时针180°.TL'就是表示左边两层逆时针90°,TR'就是表示右边两层逆时针90°

通道侗族自治县17828036268: 魔兽争霸3冰封王座狼骑放网技巧 -
戈豪前列: 你问的技巧范围也太广了,一般4只左右就可以无限网了(对一个目标),同时网多个单位就要吧狼骑编成一队,手速快点的e、e、e……要网的单位.高级点的方法就是e+shift+你要网的单位.你问题太抽象,实在不知答什么. 快速的话没其他捷径,手速问题,那是练出来的~~~~

通道侗族自治县17828036268: 电力机车总体结构由什么组成
戈豪前列: 电力机车由机械部分,电气部分和空气管路系统三部分组成.机械部分包括走行部和车体.走行部是承受车辆自重和载重在钢轨上行走的部件,由2轴或3轴转向架以及安装在其上的弹簧悬挂装置、基础制动装置、轮对和轴箱、齿轮传动装置和牵引电动机悬挂装置组成.车体用来安放各种设备,同时也是乘务人员的工作场所,由底架、司机室、台架、侧墙和车顶等部分组成.司机室设在车体的两端,有走廊相通.

通道侗族自治县17828036268: 什么是激波?我想知道激波的具体概念以及它是怎么形成的?
戈豪前列: 当飞机的飞行速度接近音速的时候,就会出现一个新的现象,叫激波. 飞机在空气中飞行时,前端对空气产生扰动,这个扰动以扰动波的形式以音速传播,当飞机的速度小于音速时,扰动波的传播速度大于飞机前进速度,因此它的传播方式为四面八方;而当物体以音速或超音速运动时,扰动波的传播速度等于或小于飞机前进速度,这样,后续时间的扰动就会同已有的扰动波叠加在一起,形成较强的波,空气遭到强烈的压缩、而形成了激波.

通道侗族自治县17828036268: 幻世录2完美攻略 - 幻世录2怎么用秘籍啊?输入dmmode启动密技模式,再输入以下密
戈豪前列: 是这样用的,当前行动的人,在选择要干什么的时候(魔法,移动之类的),打开字符串的窗口,输入dmmode 启动密技模式, 不用关闭字符串的窗口,再输入getitem n1 n2,按enter,再按esc退出输入.举个例子就是getitem 23 30,我用的是小写,注意英文和数字间的空格,还有就是我用的是1.01版,方法没问题,但你是1.02的话就不好说了,可能这个秘籍只是1.01下的,你要是改物品的话,金山游侠也行的.

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网