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

Atomic Swap Implementation in Solidity #31

Open
liangping opened this issue May 26, 2023 · 0 comments
Open

Atomic Swap Implementation in Solidity #31

liangping opened this issue May 26, 2023 · 0 comments

Comments

@liangping
Copy link
Contributor

Introduction

The purpose of this document is to guide developers through the implementation of atomic swaps in Solidity, enabling users to perform trustless, internally atomic swaps on an EVM blockchain. Atomic swaps allow for the exchange of assets without the need for a trusted intermediary, ensuring the security and integrity of the swap process.

Prerequisites

A basic understanding of Solidity, Ethereum, and smart contracts is required. It is also recommended to be familiar with the concepts of atomic swaps. For more information, you can refer to the ICS 100 documentation. Additionally, you will need a development environment with a Solidity compiler and testing tools such as Remix or Truffle.

Atomic Swap Functions

  • Make Order: The initiator sends a makeMsg to the contract, and the contract generates a swap order and saves it. The message structure will be similar to the one defined in ICS 100.
  • Take Order: The taker sends a takeMsg to execute the order by providing the required amount of the buying token. The contract verifies if the transaction meets the order's restrictions. If the conditions are met, the contract transfers the buying token to the maker and the selling token to the taker.
  • Cancel Order: The creator of the order can cancel it if it has not been completed.
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

No branches or pull requests

1 participant