Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pause125 committed Dec 5, 2023
1 parent 47b7f84 commit d8789e9
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 433 deletions.
24 changes: 11 additions & 13 deletions docs/website/pages/docs/getting-started.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public fun create_blog(ctx: &mut Context, owner: &signer) {
}
public entry fun set_blog_name(ctx: &mut Context, owner: &signer, blog_name: String) {
assert!(std::string::length(&blog_name) <= 200, error::invalid_argument(ErrorDataTooLong));
assert!(std::string::length(&blog_name) <= 200, ErrorDataTooLong);
let owner_address = signer::address_of(owner);
// if blog not exist, create it
if (!context::exists_resource<MyBlog>(ctx, owner_address)) {
Expand Down Expand Up @@ -204,7 +204,6 @@ Then, provide a function to query the blog list and a function to add and delete

```move
module simple_blog::simple_blog {
use std::error;
use std::signer;
use std::string::{Self, String};
use std::vector;
Expand Down Expand Up @@ -237,7 +236,7 @@ module simple_blog::simple_blog {
}
public entry fun set_blog_name(ctx: &mut Context, owner: &signer, blog_name: String) {
assert!(std::string::length(&blog_name) <= 200, error::invalid_argument(ErrorDataTooLong));
assert!(std::string::length(&blog_name) <= 200, ErrorDataTooLong);
let owner_address = signer::address_of(owner);
// if blog not exist, create it
if (!context::exists_resource<MyBlog>(ctx, owner_address)) {
Expand Down Expand Up @@ -285,7 +284,7 @@ module simple_blog::simple_blog {
let owner_address = signer::address_of(owner);
let myblog = context::borrow_mut_resource<MyBlog>(ctx, owner_address);
let (contains, index) = vector::index_of(&myblog.articles, &article_id);
assert!(contains, error::not_found(ErrorNotFound));
assert!(contains, ErrorNotFound);
vector::remove(&mut myblog.articles, index);
}
Expand Down Expand Up @@ -503,8 +502,8 @@ Define a function to create an article:
title: String,
body: String,
): ObjectID {
assert!(std::string::length(&title) <= 200, error::invalid_argument(ErrorDataTooLong));
assert!(std::string::length(&body) <= 2000, error::invalid_argument(ErrorDataTooLong));
assert!(std::string::length(&title) <= 200, ErrorDataTooLong);
assert!(std::string::length(&body) <= 2000, ErrorDataTooLong);
let article = Article {
version: 0,
Expand Down Expand Up @@ -538,8 +537,8 @@ Then define the modification function:
new_title: String,
new_body: String,
) {
assert!(std::string::length(&new_title) <= 200, error::invalid_argument(ErrorDataTooLong));
assert!(std::string::length(&new_body) <= 2000, error::invalid_argument(ErrorDataTooLong));
assert!(std::string::length(&new_title) <= 200, ErrorDataTooLong);
assert!(std::string::length(&new_body) <= 2000, ErrorDataTooLong);
let id = object::id(article_obj);
let article = object::borrow_mut(article_obj);
Expand Down Expand Up @@ -583,7 +582,6 @@ The complete contract code is as follows:
```move
module simple_blog::simple_article {
use std::error;
use std::signer;
use std::string::String;
use moveos_std::event;
Expand Down Expand Up @@ -623,8 +621,8 @@ module simple_blog::simple_article {
title: String,
body: String,
): ObjectID {
assert!(std::string::length(&title) <= 200, error::invalid_argument(ErrorDataTooLong));
assert!(std::string::length(&body) <= 2000, error::invalid_argument(ErrorDataTooLong));
assert!(std::string::length(&title) <= 200, ErrorDataTooLong);
assert!(std::string::length(&body) <= 2000, ErrorDataTooLong);
let article = Article {
version: 0,
Expand Down Expand Up @@ -652,8 +650,8 @@ module simple_blog::simple_article {
new_title: String,
new_body: String,
) {
assert!(std::string::length(&new_title) <= 200, error::invalid_argument(ErrorDataTooLong));
assert!(std::string::length(&new_body) <= 2000, error::invalid_argument(ErrorDataTooLong));
assert!(std::string::length(&new_title) <= 200, ErrorDataTooLong);
assert!(std::string::length(&new_body) <= 2000, ErrorDataTooLong);
let id = object::id(article_obj);
let article = object::borrow_mut(article_obj);
Expand Down
24 changes: 11 additions & 13 deletions docs/website/pages/docs/getting-started.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public fun create_blog(ctx: &mut Context, owner: &signer) {
}
public entry fun set_blog_name(ctx: &mut Context, owner: &signer, blog_name: String) {
assert!(std::string::length(&blog_name) <= 200, error::invalid_argument(ErrorDataTooLong));
assert!(std::string::length(&blog_name) <= 200, ErrorDataTooLong);
let owner_address = signer::address_of(owner);
// if blog not exist, create it
if (!context::exists_resource<MyBlog>(ctx, owner_address)) {
Expand Down Expand Up @@ -204,7 +204,6 @@ fun init(ctx: &mut Context, owner: &signer) {

```move
module simple_blog::simple_blog {
use std::error;
use std::signer;
use std::string::{Self, String};
use std::vector;
Expand Down Expand Up @@ -237,7 +236,7 @@ module simple_blog::simple_blog {
}
public entry fun set_blog_name(ctx: &mut Context, owner: &signer, blog_name: String) {
assert!(std::string::length(&blog_name) <= 200, error::invalid_argument(ErrorDataTooLong));
assert!(std::string::length(&blog_name) <= 200, ErrorDataTooLong);
let owner_address = signer::address_of(owner);
// if blog not exist, create it
if (!context::exists_resource<MyBlog>(ctx, owner_address)) {
Expand Down Expand Up @@ -285,7 +284,7 @@ module simple_blog::simple_blog {
let owner_address = signer::address_of(owner);
let myblog = context::borrow_mut_resource<MyBlog>(ctx, owner_address);
let (contains, index) = vector::index_of(&myblog.articles, &article_id);
assert!(contains, error::not_found(ErrorNotFound));
assert!(contains, ErrorNotFound);
vector::remove(&mut myblog.articles, index);
}
Expand Down Expand Up @@ -504,8 +503,8 @@ struct ArticleDeletedEvent has copy, store, drop {
title: String,
body: String,
): ObjectID {
assert!(std::string::length(&title) <= 200, error::invalid_argument(ErrorDataTooLong));
assert!(std::string::length(&body) <= 2000, error::invalid_argument(ErrorDataTooLong));
assert!(std::string::length(&title) <= 200, ErrorDataTooLong);
assert!(std::string::length(&body) <= 2000, ErrorDataTooLong);
let article = Article {
version: 0,
Expand Down Expand Up @@ -539,8 +538,8 @@ struct ArticleDeletedEvent has copy, store, drop {
new_title: String,
new_body: String,
) {
assert!(std::string::length(&new_title) <= 200, error::invalid_argument(ErrorDataTooLong));
assert!(std::string::length(&new_body) <= 2000, error::invalid_argument(ErrorDataTooLong));
assert!(std::string::length(&new_title) <= 200, ErrorDataTooLong);
assert!(std::string::length(&new_body) <= 2000, ErrorDataTooLong);
let id = object::id(article_obj);
let article = object::borrow_mut(article_obj);
Expand Down Expand Up @@ -584,7 +583,6 @@ struct ArticleDeletedEvent has copy, store, drop {
```move
module simple_blog::simple_article {
use std::error;
use std::signer;
use std::string::String;
use moveos_std::event;
Expand Down Expand Up @@ -624,8 +622,8 @@ module simple_blog::simple_article {
title: String,
body: String,
): ObjectID {
assert!(std::string::length(&title) <= 200, error::invalid_argument(ErrorDataTooLong));
assert!(std::string::length(&body) <= 2000, error::invalid_argument(ErrorDataTooLong));
assert!(std::string::length(&title) <= 200, ErrorDataTooLong);
assert!(std::string::length(&body) <= 2000, ErrorDataTooLong);
let article = Article {
version: 0,
Expand Down Expand Up @@ -653,8 +651,8 @@ module simple_blog::simple_article {
new_title: String,
new_body: String,
) {
assert!(std::string::length(&new_title) <= 200, error::invalid_argument(ErrorDataTooLong));
assert!(std::string::length(&new_body) <= 2000, error::invalid_argument(ErrorDataTooLong));
assert!(std::string::length(&new_title) <= 200, ErrorDataTooLong);
assert!(std::string::length(&new_body) <= 2000, ErrorDataTooLong);
let id = object::id(article_obj);
let article = object::borrow_mut(article_obj);
Expand Down
1 change: 0 additions & 1 deletion moveos/moveos-stdlib/move-stdlib/doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ This is the reference documentation of the Move standard library.
- [`0x1::bit_vector`](bit_vector.md#0x1_bit_vector)
- [`0x1::compare`](compare.md#0x1_compare)
- [`0x1::debug`](debug.md#0x1_debug)
- [`0x1::error`](error.md#0x1_error)
- [`0x1::fixed_point32`](fixed_point32.md#0x1_fixed_point32)
- [`0x1::hash`](hash.md#0x1_hash)
- [`0x1::option`](option.md#0x1_option)
Expand Down
Loading

0 comments on commit d8789e9

Please sign in to comment.