> For the complete documentation index, see [llms.txt](https://meversedex.gitbook.io/meverse-dev-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://meversedex.gitbook.io/meverse-dev-docs/meverse-dev-docs-kr/undefined-1/sample-contracts.md).

# Sample Contracts

아래는 string을 저장해서 view 함수로 값을 확인 할 수 있는 간단한 예제입니다.

```solidity
//SPDX-License-Identifier: MIT

pragma solidity 0.8.0;

contract HelloWorld {
    string private word;

    constructor (string memory _word) {
        word = _word;
    }

    function setWord(string memory _word) external returns (bool) {
        word = _word;
        return true;
    }

    function hello() public view returns (string memory) {
        return word;
    }
}
```

Remix IDE를 활용해 간단하게 컨트랙트 배포가 가능합니다.

* Testnet 배포에 필요한 가스는 아래 링크에서 확보 할 수 있습니다.
  * <https://testnet.meversescan.io/faucet>
* 생성자 파라미터에 원하는 문구를 넣어 컨트랙트를 배포합니다.
* IDE에서 hello를 호출하면 입력한 문구를 확인할 수 있습니다.
* setWord함수를 호출하여 입력된 문구를 갱신할 수 있습니다.
