Replies: 1 comment 1 reply
-
|
因为move一个特性是module之间可以互相调用,不需要通过API,所以调用时候传递数据struct有什么安全限制呢? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Move安全特性里面都强调了如下两点:
Struct 只能在定义的module里面创建。开始我以为struct是个类似Java的内部类,是其他module无法使用。但是看Move Book代码是可以的 https://move-book.com/cn/advanced-topics/struct.html
请问这里的意思是不是不能用简单的{}来new个结构体,也不能通过.来直接访问字段。必须通过getter方法来,这样等于多了一层访问控制。请问这个理解是否对?
在实际工程中,能否举个例子代码,这种特性安全在哪里。
Resource类型的struct,不能被其他合约使用。例如不能move_from其他合约的resource。这实际工程中,resource相关逻辑必须在一个合约中完成是么。能否从工程角度讲讲最佳实践。
总之这些安全特性在move book里面讲地不明白,而且没有实际工程的例子,不好理解其场景。
Beta Was this translation helpful? Give feedback.
All reactions