定义约定俗成:变量小写开头,类型或合约大写开头
基础数据类型
bool
uint256 无符号整型,代表一个不允许负数的整数。
int256 有符号整型,代表一个能取到正数和负数的整数。
bytes32
string
address
合约:也可以作为数据类型去使用
https://binschool.org/solidity-basic/solidity-integer.html
关键字
constant 常量
内置函数(环境变量)
msg
msg.sender —当前合约的调用者
msg.value —随消息发送的 wei 的数量
https://zhuanlan.zhihu.com/p/340068444(内置函数总结文档)
函数
public
private 无法被继承
internal
external
存储模式
storage 永久存储
memory 暂时存储 运行时可以修改 (基础数据类型不需要加memory)
calldata 暂时存储 运行时无法修改(js里的常量)
stack
codes
logs
基础数据结构:
结构体:struct (js中的类)
数组:array
映射:mapping
修改器
modifier
bool
uint256 无符号整型,代表一个不允许负数的整数。
int256 有符号整型,代表一个能取到正数和负数的整数。
bytes32
string
address
合约:也可以作为数据类型去使用
https://binschool.org/solidity-basic/solidity-integer.html
关键字
constant 常量
msg
msg.sender —当前合约的调用者
msg.value —随消息发送的 wei 的数量
https://zhuanlan.zhihu.com/p/340068444(内置函数总结文档)
public
private 无法被继承
internal
external
storage 永久存储
memory 暂时存储 运行时可以修改 (基础数据类型不需要加memory)
calldata 暂时存储 运行时无法修改(js里的常量)
stack
codes
logs
结构体:struct (js中的类)
数组:array
映射:mapping
modifier