Last active
August 24, 2021 11:03
-
-
Save ezynda3/3f3fa2fca495fa99f4ce5b1610814829 to your computer and use it in GitHub Desktop.
Swap Interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: UNLICENSED | |
pragma solidity 0.8.4; | |
import "./interfaces/ITransactionManager.sol"; | |
contract CrossChain { | |
private immutable ITransactionManager transactionManager; | |
enum SwapType { ONE_INCH, PARASWAP, SUSHI } | |
constructor() public { | |
transactionManager = ITransactionManager(0x80623b8534d855479Ff4621caBE65d451A81BDFe); // from deployments.json | |
} | |
function startTransfer( | |
address user, | |
InvariantTransactionData calldata invariantData, // contains swap info such as assets, router, chains | |
uint256 expiry, | |
bytes calldata encryptedCallData, // optional calldata | |
bytes calldata encodedBid, // bid from router | |
bytes calldata bidSignature, // router's sig on bid | |
SwapType swapType, | |
bytes calldata swapCallData | |
) | |
public returns (TransactionData memory) | |
{ | |
// ... | |
// do some stuff | |
// ... | |
return transactionManager.prepare( | |
invariantData, | |
amount, | |
expiry, | |
encryptedCallData, | |
encodedBid, | |
bidSignature | |
) | |
} | |
function completeTransfer( | |
SwapType swapType, | |
bytes calldata swapCallData | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment