このページは英語からの機械翻訳を使用しており、誤りや不明瞭な表現が含まれている可能性があります。最も正確な情報については、オリジナルの英語版をご覧ください。頻繁な更新のため、一部のコンテンツはオリジナルの英語になっている可能性がありま す。Crowdinでの取り組みに参加して、このページの翻訳改善にご協力ください。 (Crowdin translation page, Contributing guide)
KaiaGreeter
KaiaGreeter
は挨拶メッセージを返すシンプルなコントラクトである。 挨拶メッセージは契約展開時に設定されます。
カイアグリーターの作成
pragma solidity 0.5.6;contract Mortal { /* Define variable owner of the type address */ address payable owner; /* This function is executed at initialization and sets the owner of the contract */ constructor () public { owner = msg.sender; } /* Function to recover the funds on the contract */ function kill() public { if (msg.sender == owner) selfdestruct(owner); }}contract KaiaGreeter is Mortal { /* Define variable greeting of the type string */ string greeting; /* This runs once when the contract is created */ constructor (string memory _greeting) public { greeting = _greeting; } /* Main function */ function greet() public view returns (string memory) { return greeting; }}
RemixオンラインIDEを使ってKaiaGreeterをデプロイする
- Kaia Plugin for Remixにアクセスし、
KaiaGreeter
契約を作成してください。 完全なソースコードは上記の通り。 - 契約を展開するために使用するアカウントを準備します。
- まだアカウントをお持ちでない方は、https://toolkit.kaia.io/account/accountKeyLegacyからアカウントを作成してください。
- FaucetからKAIAを試す - https://kairos.wallet.kaia.io/faucet
- 初期パラメータである挨拶メッセージを持つコントラクトをデプロイする。
- デプロイ後、IDEから
greet
を呼び出すことができる。
参考文献
契約展開の詳細およびRemix Online IDE利用ガイドラインについては、以下のドキュメントをご参照ください。