Enabling secure, decentralized, and efficient asset swaps across blockchain networks, inspired by 1inch Fusion+.
This project extends the 1inch Fusion+ protocol on Sui, featuring:
- Competitive Dutch auctions
- Partial fills
- Multi-stage timelocks for secure swap execution
-
Decentralized & Trustless Cross-Chain Swaps
Secure asset exchange between EVM and Sui without intermediaries. -
Hashed Timelock Contracts (HTLCs)
Guarantee atomicity—both parties swap, or no one does. -
Dutch Auction Mechanism
Resolvers compete as prices descend over time. -
Partial Fills Support
Large orders can be segmented and filled incrementally. -
Merkle Trees for Secrets
Use Merkle root to validate multiple secret hashes securely. -
Multi-Stage Timelocks
Enforces claim/cancel logic with:- Finality Lock
- Resolver Exclusive Unlock
- Public Unlock
- Resolver Cancellation
- Public Cancellation Incentive
- Maker’s Final Cancellation
-
Incentivized Safety Deposits
Ensures resolver accountability via staked collateral.
Funds are locked using a hashlock (secret hash). Swap completion requires the preimage (secret). Refunds are time-based (timelock).
- Starts at
start_price, descends linearly toreserve_price - Duration is defined by
duration_ms - Resolvers fill when price becomes acceptable
Partial fill support is enabled via Merkle-based secret indexing. Each PartialOrder commits to a Merkle root of secret hashes, allowing the protocol to validate unique secrets per fill.
The field expected_secret_index of the function fill_order_partial is calculated using calculateExpectedSecretIndex in the clientpartial.ts file based on the fill progress. This index is then submitted with each partial fill. The Move contract enforces that:
- 🔒 The same secret index cannot be used more than once
- 📈 Index progression aligns with the
parts_countand fill ratio - ✅ Secrets are bound to their claimed Merkle index (future-proof for proof validation)
This ensures consistency with the protocol logic defined in the whitepaper and prevents secret reuse or double-fills.
Once Merkle proof integration is live, the resolver will also submit a cryptographic proof to confirm the secret hash belongs to the committed Merkle tree.
- SUI Chain Transactions
- SUI Contract
- SUI Package Id - 0x14e9f86c5e966674e6dbb28545bbff2052e916d93daba5729dbc475b1b336bb4
- SUI Interaction Functions
- EVM → SUI Swap
- SUI → EVM Swap
- EVM → SUI Partial Fills
- SUI → EVM Partial Fills
Cross chain swap examples with screenshots
Maker funds are on Sui. Resolver commits funds on EVM.
Maker funds are on EVM. Resolver commits funds on Sui.
Large orders can be filled by multiple resolvers using a Merkle Tree of secret hashes.
Each HashedTimelockEscrow follows strict timelock rules for claiming/cancelling.
Core module: sui_htlc_contract::htlc
SUI_PACKAGE_ID: 0x14e9f86c5e966674e6dbb28545bbff2052e916d93daba5729dbc475b1b336bb4
| Function | Description |
|---|---|
announce_order<T> |
Announces standard HTLC order |
auction_tick<T> |
Calculates price of standard order |
partial_auction_tick<T> |
Calculates price of partial order |
fill_order<T> |
Fills standard order if bid ≥ auction price |
add_safety_deposit<T> |
Adds resolver’s safety deposit |
create_htlc_escrow_src<T> |
Maker locks coins (Sui as source) |
create_htlc_escrow_dst<T> |
Resolver locks coins + deposit (Sui as destination) |
internal_create_htlc_escrow<T> |
Shared escrow logic for src/dst |
claim_htlc<T> |
Unlocks HTLC if correct secret is given |
recover_htlc_escrow<T> |
Refunds escrow depending on time conditions |
partial_announce_order<T> |
Announces partial-fill order |
fill_order_partial<T> |
Partially fills order with Merkle index validation |
create_htlc_escrow_src_partial<T> |
Maker locks source funds for partial fill |
create_htlc_escrow_dst_partial<T> |
Resolver locks destination funds for partial fill |
verify_merkle_proof |
Internal proof check for partial orders |
struct Order<T> {
id: UID,
maker: address,
resolver: address,
secret_hash: vector<u8>,
start_time: u64,
duration_ms: u64,
start_price: u64,
reserve_price: u64,
fill_price: u64,
status: u8,
}struct PartialOrder<T> {
id: UID,
maker: address,
start_time: u64,
duration_ms: u64,
start_price: u64,
reserve_price: u64,
total_amount: u64,
remaining: u64,
parts_count: u64,
merkle_root: vector<u8>,
filled_parts_bitmap: vector<bool>,
fills: vector<PartialFill>,
status: u8,
}struct PartialFill {
resolver: address,
amount: u64,
fill_price: u64,
hash_lock_index_used: u64,
}struct HashedTimelockEscrow<T> {
id: UID,
secret_hash: vector<u8>,
finality_lock_expires_ms: u64,
resolver_exclusive_unlock_expires_ms: u64,
resolver_cancellation_expires_ms: u64,
maker_cancellation_expires_ms: u64,
public_cancellation_incentive_expires_ms: u64,
maker_address: address,
resolver_address: address,
locked_balance: Balance<T>,
claimed: bool,
safety_deposit: Balance<0x2::sui::SUI>,
isSrc: bool,
order_id: ID,
hash_lock_index: u64,
}- Node.js (LTS)
- npm
- Rust + Cargo
- Sui CLI:
cargo install --locked --git https://github.com/MystenLabs/sui.git --tag testnet suigit clone https://github.com/juSt-jeLLy/Not1inch/
npm installcd source/sources
sui move build
sui client publish --gas-budget 300000000 --jsonUpdate
.envwith the returnedSUI_PACKAGE_ID
(1) 0x38c4aadf07a344bd5f5baedc7b43f11a9b863cdd16242f3b94a53541ad19fedc: "0x39619C9fe2AF793f847D112123F62c01df0A0025" User
(2) 0x1d02f466767e86d82b6c647fc7be69dc1bc98931a99ac9666d8b591bb0cc1e66: "0x4207ebd97F999F142fFD3696dD76A61193b23e89" Resolver
export $(grep -v '^#' .env | xargs)pnpm installforge installforge buildFor EVM to SUI standard order
pnpm test main.spec.tsFor SUI to EVM standard order
pnpm test suitoevm.spec.tsFor SUI to EVM Partial Fills
pnpm test suitoevmpartialfills.spec.tsFor EVM to SUI Partial Fills
pnpm test evmtosuipartialfills.spec.tsPath: client/frontend
-@mysten/dapp-kit
@mysten/sui/transactionsfor TX buildingEd25519Keypairfor key managementsuiClientfor chain interactionsethers.jsforkeccak256hashingmerkletreejs
- On-chain resolver registry (KYC/KYB support)
- More complex Dutch auction curves
- Sui-native cross-chain messaging
PRs and issues welcome! Let’s build together.
MIT License
- Inspired by 1inch Fusion+
- 1inch Fusion+ Whitepaper
- Thanks to the Sui ecosystem for tooling and SDKs



