Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object Tutorials Chapter 4 #1848

Merged
merged 12 commits into from
May 10, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update doc/src/build/programming-with-objects/ch4-object-wrapping.md
Fix typo

Co-authored-by: Sam Blackshear <sam.blackshear@gmail.com>
  • Loading branch information
Clay-Mysten and sblackshear authored May 9, 2022
commit 394f6139981807612e2fdf4190095a33cab27e0d
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public(script) fun request_swap(object: Object, fee: Coin<SUI>, service_address:
}
```
In the above entry function, to request for swapping an `object`, one must pass the object by value so that it's fully consumed and wrapped into `ObjectWrapper`. A fee (in the type of `Coin<SUI>`) is also provided. It also checks that the fee is sufficient. Note that we turn `Coin` into `Balance` when putting it into the `wrapper` object. This is because `Coin` is a Sui object type and only used to pass around as Sui objects (e.g. as entry function arguments or objects sent to addresses). For coin balances that need to be embedded in another Sui object struct, we use `Balance` instead because it's not a Sui object type and hence is much cheaper to use.
The wrapper object is then sent to the service operator, whose address is also specified in the call as `serviec_address`.
The wrapper object is then sent to the service operator, whose address is also specified in the call as `service_address`.

Although the service operator (`service_address`) now owns the `ObjectWrapper`, which contains the object to be swapped, there is nothing they can do about the object. They cannot transfer it even though we have defined a `transfer_object` entry function for `Object`. This is because they cannot pass the wrapped `Object` as an argument to the function.
Clay-Mysten marked this conversation as resolved.
Show resolved Hide resolved

Expand Down