This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
[2018-07-16 16:41:01] local.INFO: stdClass Object | |
( | |
[errors] => Array | |
( | |
[0] => stdClass Object | |
( | |
[code] => 89 | |
[message] => Invalid or expired token. | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mapping (address => uint) userAge; | |
// ブロックチェーン上のデータへアクセス可能 | |
function viewAge(address _address) public view returns (uint) { | |
return userAge[_address]; | |
} | |
// view 修飾子内では値の変更ができないため、Warningが表示される | |
function viewWarnAge(address _address) public view returns (uint) { | |
userAge[_address] = 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function global() { | |
bytes32 blochHash = block.blochHash(100); // 100番目のブロックハッシュ値 | |
address coinbase = block.coinbase; | |
uint number = block.number; | |
uint timestamp = block.timestamp; | |
uint difficulty = block.difficulty; | |
address sender = msg.sender; | |
uint value = msg.value; | |
uint now = now; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getBool() public returns (bool) { | |
bool a = true; | |
bool b = false; | |
// このとき既にbがfalseであるため、aの処理は発動されない | |
if (b || a) { | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getArray() public returns (uint[]) { | |
uint[2] a; // 固定長配列の宣言 | |
uint[] b; // 可変長配列の宣言 | |
b.push(1); // 要素の追加はpushを使う | |
uint length = b.length; // 配列の要素数はlengthで取得する | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct a { | |
uint8 b; // このとき可能な限りbit数を下げることで、容量を下げ、使用するGASの節約に繋がる | |
string c; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getBalance(address _addr) returns (uint) { | |
return _addr.balance; // 残高を返す | |
} | |
function send(address _to, uint _amount) { | |
_to.send(_amount); // Etherの送金 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct User { | |
string name; | |
uint8 age; | |
} | |
mapping (address => balance) balanceList; | |
mapping (address => User) userList; | |
function setBalance(address _address) { | |
balanceList[_address] = _address.balance; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ether() { | |
uint wei = 1 wei; | |
uint szabo = 1 szabo; | |
uint finney = 1 finney; | |
uint ether = 1 ether; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function time() { | |
uint seconds = 1 seconds; | |
uint minutes = 1 minutes; | |
uint hours = 1 hours; | |
uint days = 1 days; | |
uint weeks = 1 weeks; | |
uint years = 1 years; | |
} |