Open anthonyche opened 2 years ago
pragma solidity 0.5.1;
contract MyContract{
// string public constant stringValue = 'myValue';
// bool public mybool = true;
// int public myInt = -1;
// uint public myUint = 1;
// uint8 public myUint8 = 8;
// uint256 public myUint256 = 25886;
enum State {Waiting, Ready, Active}
State public state;
constructor() public{
state = State.Waiting;
}
function active() public{
state = State.Active;
}
function isActive() public view returns(bool){
return state == State.Active;
}
}
pragma solidity 0.5.1;
contract MyContract{
Person[] public people;
uint256 public PeopleCount;
struct Person{
string _firstName;
string _lastName;
}
function add_person(string memory _firstName, string memory _lastName) public {
people.push(Person(_firstName,_lastName));
PeopleCount +=1;
}
}
第一个使用 Remix IDE 部署的智能合约
public 这种声明会加在通常python常见的声明之后