Skip to content

Commit

Permalink
[example/escrow] Port escrow.move (#13606)
Browse files Browse the repository at this point in the history
## Description

Original: ./sui_programmability/examples/defi/sources/escrow.move

Porting and modernising example used in "object wrapping" documentation,
with the following changes:

- Moved into an isolated move package.
- Remove use of `public entry`
- Add unit tests that will get run during CI.

The modernised example also addresses the TODO in the original where one
party can commit to a trade believing they are getting one object, only
to have that object modified (and therefore made less valuable).

This is done by adding a new phase to the swap where parties lock the
object they are going to transfer. See comments in the example for how
this is done while preserving safety and liveness at all stages.

## Test Plan

New unit tests:

```
sui-move$ sui move test -p escrow
```
  • Loading branch information
amnn authored Sep 6, 2023
1 parent 406b38d commit db15bd5
Show file tree
Hide file tree
Showing 2 changed files with 526 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/sui-move/escrow/Move.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "escrow"
version = "0.0.1"

[dependencies]
Sui = { local = "../../../crates/sui-framework/packages/sui-framework" }

[addresses]
escrow = "0x0"
Loading

0 comments on commit db15bd5

Please sign in to comment.