更新一些学习内容

master
土豆兄弟 1 year ago
parent 4f2213d902
commit 4dd8b0fefa

@ -204,8 +204,38 @@ personal.listAccounts
- 谜恋猫: https://www.cryptokitties.co/
- 百度莱茨, 网易招财猫, 小米加密兔
## 5. 智能合约编程语言-solidity
- 合约文件的结构
- 版本声明
- import
- 合约
- 状态变量
- 函数
- 结构类型
- 事件
- 函数修改器
- 代码注释
- Solidity 语言的类型
- 值类型(Value Type)
- 引用类型(Reference Types)
- https://docs.soliditylang.org/en/v0.4.23/types.html
- 常用值类型
- 布尔类型(Booleans)
- 取值 true/false
- 运算符 ! && || == !=
- 整型(Integers)
- int/uint
- 关键字 unit8 到 uint256(以8步进)
- 位运算符 & | ^ ``
- 算术运算 + - * / % ** << >>
- 右移 等价于 除法去除以2的几次方
-
- 字符串常量(String literals)
- 地址类型(Address)

@ -0,0 +1,47 @@
pragma solidity ^0.4.0;
import "solidity_for_import.sol";
// this is a test Contract
contract Test{
//
uint a;
bool boola = true;
bool boolb = false;
//
function setA(uint x) public {
a = x;
// -> ,
emit Set_A(x);
}
//
event Set_A(uint a);
//
struct Position{
int lat;
int lng;
}
address public ownerAddr;
// - python ,
modifier owner(){
// mine
require(msg.sender == ownerAddr);
// mine
_;
}
// owner
function mine() public owner {
}
}

@ -0,0 +1,8 @@
pragma solidity ^0.4.0;
// this is a ForImport Contract
contract ForImport{
}
Loading…
Cancel
Save