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

Noto/Zeto atomic swap example #498

Open
wants to merge 49 commits into
base: main
Choose a base branch
from
Open

Noto/Zeto atomic swap example #498

wants to merge 49 commits into from

Conversation

awrichar
Copy link
Contributor

@awrichar awrichar commented Jan 4, 2025

In a chain with #483

This example shows how to perform an atomic swap between Zeto and Noto (with Pente notary hooks), with full counterparty protection. It leverages locking functionality on both tokens to set aside the value for the swap, then approve a single base ledger Atom contract to finalize the swap. This ensures neither party can receive the other's tokens unless the full swap is executed.

Some caveats:

This variant isn't fully proved out, and may begin causing confusion.
We can bring it back at the time we're able to work through all of the
flows in detail.

Signed-off-by: Andrew Richardson <[email protected]>
Allows an owner to "lock" some portion of value such that it cannot be
spent except when specific conditions are met.

Signed-off-by: Andrew Richardson <[email protected]>
Currently you can only unlock to return the value to yourself (additional
work needed to allow specifying and executing a transfer).

Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Also gather two separate sender signatures for transfer + lock, so that
they can be emitted separately in the two blockchain events.

Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Use shorter names "restrictMint" and "allowBurn".

Signed-off-by: Andrew Richardson <[email protected]>
Allows a domain to directly trigger a new transaction, such as in response to
an event.

Signed-off-by: Andrew Richardson <[email protected]>
Change Noto to ensure notary name is fully qualified during deploy, and to
check on contract init if the current node is the notary.

Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Some functionality for delegating locks is lost, but will be added back in.

Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Example is working again (without hoooks for now).

Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Rather than storing all input/outputs states on the smart contract, store an
EIP-712 hash of the prepared unlock. Allow extracting the input/output states
from the state receipt (as info/read states) so that they can be passed in to
the final "unlockWithApproval" transaction.

Signed-off-by: Andrew Richardson <[email protected]>
Allows a domain to look up specific states, regardless of whether they've been
spent or not.

Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Performs an atomic swap leveraging Zeto, Noto, and Pente together.

Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant