티스토리 뷰
솔리디티 example
https://remix.ethereum.org/#optimize=false
리믹스에서 붙여넣고 실행하면 된다.
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 | pragma solidity ^0.4.21; contract Farm{ struct Animal{ string name; uint age; bool mammal; } mapping(address => Animal) public animals; address public farmOwner; event NewAnimal(address animal, string name, uint age, bool mammal); modifier onlyOwner{ require(msg.sender == farmOwner); _; } constructor() public{ farmOwner = msg.sender; } function setAnimal(address _address, string _name, uint _age, bool _mammal) public onlyOwner{ Animal storage animal = animals[_address]; animal.name = _name; animal.age = _age; animal.mammal = _mammal; emit NewAnimal(_address, _name, _age, _mammal); } function getAnimalName(address _address) public constant returns(string name){ return animals[_address].name; } } | cs |
setter를 여러개 만들면 여러개 생긴다. 분홍색 setAnimal, setAnimal2 이렇게 2가지가 생긴다.
end.
728x90
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- vim
- 이직
- 도커티슈박스
- shellscript
- docker container whale
- docker container tissue box
- docker container case
- Linux
- docker container
- 2017 티스토리 결산
- 싱가폴
- Sh
- 도커티슈케이스
- docker container tissue
- 개발자
- 도커컨테이너
- 도커각티슈박스
- 도커각티슈케이스
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함