09/04/2019
wen ico? wen moon?
-
Open your laptops!
msg.sender
, tx.origin
is an addressmsg.value
, msg.gas
, block.timestamp
, now
, is a uintmsg.data
is bytesexample
class interface ACCOUNT create makefeature balance: INTEGER ... deposit (sum: INTEGER) is -- Deposit sum into the account. require sum >= 0 ensure balance = old balance + sum withdraw (sum: INTEGER) is -- Withdraw sum from the account. require sum >= 0 sum <= balance - minimum_balance ensure balance = old balance - sum may_withdraw ...end -- class ACCOUNT
function honkCar(uint256 carId, uint256 otherCarId) public onlyCarOwner(carId){ require(cars[otherCarId].owner != address(0x00), "other car must exist"); emit CarHonk(carId, otherCarId);}
\
not covered
function honkCar(uint256 carId, uint256 otherCarId) public onlyCarOwner(carId) { require(cars[otherCarId].owner != address(0x00), "other car must exist"); emit CarHonk(carId, otherCarId);}
Canonical function signature:
honkCar(uint256,uint256)
Method ID - first4Bytes(keccak256(canonicalFuncSig)):
0x6977eaaa
(hash collisions can occur)
{ "constant": false, "inputs": [ { "name": "carId", "type": "uint256" }, { "name": "otherCarId", "type": "uint256" } ], "name": "honkCar", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0x6977eaaa"}
honkCar
functionsignature
is the Method IDsolc
Smart contract development tools
npm install --global truffle
0X00
address any moresolc
, truffle
, ganache
-
Lifelong Learning Institute & SkillsFutureSG, Chainstack & Acronis, BitTemple, NBC'19, Spartan, StartupToken, EngineersSG, and Blockchain&DApps
Alex Towle
09/04/2019
Keyboard shortcuts
↑, ←, Pg Up, k | Go to previous slide |
↓, →, Pg Dn, Space, j | Go to next slide |
Home | Go to first slide |
End | Go to last slide |
Number + Return | Go to specific slide |
b / m / f | Toggle blackout / mirrored / fullscreen mode |
c | Clone slideshow |
p | Toggle presenter mode |
t | Restart the presentation timer |
?, h | Toggle this help |
Esc | Back to slideshow |