mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-24 10:01:38 +00:00
update chinese version content
This commit is contained in:
parent
484e1325ef
commit
84f9aa47fc
@ -5,6 +5,7 @@ contributors:
|
|||||||
- ["Nemil Dalal", "https://www.nemil.com"]
|
- ["Nemil Dalal", "https://www.nemil.com"]
|
||||||
- ["Joseph Chow", ""]
|
- ["Joseph Chow", ""]
|
||||||
- ["Bhoomtawath Plinsut", "https://github.com/varshard"]
|
- ["Bhoomtawath Plinsut", "https://github.com/varshard"]
|
||||||
|
- ["Shooter", "https://github.com/liushooter"]
|
||||||
---
|
---
|
||||||
|
|
||||||
Solidity lets you program on [Ethereum](https://www.ethereum.org/), a
|
Solidity lets you program on [Ethereum](https://www.ethereum.org/), a
|
||||||
@ -237,7 +238,7 @@ uint x[][5]; // arr with 5 dynamic array elements (opp order of most languages)
|
|||||||
// Dictionaries (any type to any other type)
|
// Dictionaries (any type to any other type)
|
||||||
mapping (string => uint) public balances;
|
mapping (string => uint) public balances;
|
||||||
balances["charles"] = 1;
|
balances["charles"] = 1;
|
||||||
// balances["ada"] is 0, all non-set key values return zeroes
|
// balances["ada"] result is 0, all non-set key values return zeroes
|
||||||
// 'public' allows following from another contract
|
// 'public' allows following from another contract
|
||||||
contractName.balances("charles"); // returns 1
|
contractName.balances("charles"); // returns 1
|
||||||
// 'public' created a getter (but not setter) like the following:
|
// 'public' created a getter (but not setter) like the following:
|
||||||
|
@ -6,6 +6,7 @@ contributors:
|
|||||||
- ["Nemil Dalal", "https://www.nemil.com"]
|
- ["Nemil Dalal", "https://www.nemil.com"]
|
||||||
- ["Joseph Chow", ""]
|
- ["Joseph Chow", ""]
|
||||||
- ["Bhoomtawath Plinsut", "https://github.com/varshard"]
|
- ["Bhoomtawath Plinsut", "https://github.com/varshard"]
|
||||||
|
- ["Shooter", "https://github.com/liushooter"]
|
||||||
translators:
|
translators:
|
||||||
- ["Bob Jiang", "https://github.com/bobjiang"]
|
- ["Bob Jiang", "https://github.com/bobjiang"]
|
||||||
---
|
---
|
||||||
@ -217,7 +218,7 @@ uint x[][5]; // 5个动态数组元素的数组(和多数语言的顺序相反)
|
|||||||
// 字典类型 (任一类型到其他类型的映射)
|
// 字典类型 (任一类型到其他类型的映射)
|
||||||
mapping (string => uint) public balances;
|
mapping (string => uint) public balances;
|
||||||
balances["charles"] = 1;
|
balances["charles"] = 1;
|
||||||
console.log(balances["ada"]); // 所有没有设定key值的,返回0
|
// balances["ada"]得到 0, 所有没有设定key值的,返回0
|
||||||
// 'public' 允许跟着(调用)另一份合约
|
// 'public' 允许跟着(调用)另一份合约
|
||||||
contractName.balances("charles"); // returns 1
|
contractName.balances("charles"); // returns 1
|
||||||
// 'public' 创建 getter (而不是 setter )如下:
|
// 'public' 创建 getter (而不是 setter )如下:
|
||||||
@ -373,7 +374,9 @@ event LogSent(address indexed from, address indexed to, uint amount); // 注意
|
|||||||
// 调用
|
// 调用
|
||||||
LogSent(from, to, amount);
|
LogSent(from, to, amount);
|
||||||
|
|
||||||
|
/*
|
||||||
// 对于外部方(合约或外部实体),使用 Web3 Javascript 库来监听
|
// 对于外部方(合约或外部实体),使用 Web3 Javascript 库来监听
|
||||||
|
// 以下是javascript代码,不是solidity代码
|
||||||
Coin.LogSent().watch({}, '', function(error, result) {
|
Coin.LogSent().watch({}, '', function(error, result) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
console.log("Coin transfer: " + result.args.amount +
|
console.log("Coin transfer: " + result.args.amount +
|
||||||
@ -384,6 +387,9 @@ Coin.LogSent().watch({}, '', function(error, result) {
|
|||||||
"Receiver: " + Coin.balances.call(result.args.to));
|
"Receiver: " + Coin.balances.call(result.args.to));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
// 一个合约依赖另一个合约的共同范例(例如,合约取决于另一个合约提供的当前汇率)
|
// 一个合约依赖另一个合约的共同范例(例如,合约取决于另一个合约提供的当前汇率)
|
||||||
|
|
||||||
// C. 修饰器
|
// C. 修饰器
|
||||||
|
Loading…
Reference in New Issue
Block a user