Code

// Some codefunction atomicSwap(address _inputToken, address _outputToken, uint _amount) public {
    // Prepare the transaction
    // ....
    // Atomic swap
    // Any problem occurs here, the transaction would fail and user can claim his original tokens.
    if (/* atomic swap failed */) {
        revert();
    }
}

Last updated