Nhảy tới nội dung
This page uses machine translation from English, which may contain errors or unclear language. For the most accurate information, please see the original English version. Some content may be in the original English due to frequent updates. Help us improve this page's translation by joining our effort on Crowdin. (Crowdin translation page, Contributing guide)

KaiaGreeter

KaiaGreeter is a simple contract that returns a greeting message. Greeting message is set when the contract is deployed.

Writing KaiaGreeter


// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract KaiaGreeter {
/* Định nghĩa biến greeting có kiểu string */
string greeting;
/* Hàm này chạy một lần khi contract được tạo */
constructor (string memory _greeting) {
greeting = _greeting;
}
/* Hàm chính */
function greet() public view returns (string memory) {
return greeting;
}
}

Deploying KaiaGreeter using Remix Online IDE

  • Vui lòng truy cập Kaia Plugin for Remix và tạo hợp đồng KaiaGreeter.sol.

  • Sao chép và dán mã ở trên vào tệp bạn vừa tạo: KaiaGreeter.sol.

  • Nhận một số KAIA thử nghiệm từ vòi nếu bạn chưa có KAIA thử nghiệm.

  • Deploy the contract with initial parameter, a greeting message.

  • After deploying, you can invoke greet from the IDE.

References

For the details of contract deployment and the Remix Online IDE usage guideline, please refer to the following documents.

Cải thiện trang này