๐งก Payable
์ด๋๋ฆฌ์์ ์ง๋ถ์ ๊ด์ฌํ ์ ์๋ ํจ์ ์ ์ด์์ด๋ค.
contract OnlineStore {
function buySomething() external payable {
require(msg.value == 0.001 ether);
transferThing(msg.sender);
}
}
๐งก Random Numbers
keccak256์ ์ด์ฉํด ๋์๋ฅผ ์์ฑํ ์ ์๋ค.
uint randNonce = 0;
uint random = uint(keccak256(now, msg.sender, randNonce)) % 100;
randNonce++;
uint random2 = uint(keccak256(now, msg.sender, randNonce)) % 100;
https://share.cryptozombies.io/ko/lesson/4/share/bjloed?id=WyJjenwxMjAyMjMiLDEsMTRd
'Solidity' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[CryptoZombie] 1-5 ERC721 & Crypto-Collectibles (1) | 2021.08.02 |
---|---|
[CryptoZombie] 1-3 Advanced Solidity Concepts (0) | 2021.07.22 |
[CryptoZombie] 1-2 Zombies Attack Their Victims (0) | 2021.07.22 |
[CryptoZombie] 1-1 Making the Zombie Factory (0) | 2021.07.22 |
[Chap4] ์ค๋งํธ ์ปจํธ๋ํธ์ ๊ฐ๋ (0) | 2021.07.16 |