Skip to content

Instantly share code, notes, and snippets.

@mounibec
Created April 7, 2021 18:35
Show Gist options
  • Save mounibec/c675379a2a93ab31710f43810d63eec3 to your computer and use it in GitHub Desktop.
Save mounibec/c675379a2a93ab31710f43810d63eec3 to your computer and use it in GitHub Desktop.
pragma solidity 0.7.5;
pragma experimental ABIEncoderV2;
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
interface IAugustusSwapper {
/**
* @param fromToken Address of the source token
* @param fromAmount Amount of source tokens to be swapped
* @param toAmount Minimum destination token amount expected out of this swap
* @param expectedAmount Expected amount of destination tokens without slippage
* @param beneficiary Beneficiary address
* 0 then 100% will be transferred to beneficiary. Pass 10000 for 100%
* @param referrer referral id
* @param useReduxToken whether to use redux token or not
* @param path Route to be taken for this swap to take place
*/
struct SellData {
address fromToken;
uint256 fromAmount;
uint256 toAmount;
uint256 expectedAmount;
address payable beneficiary;
string referrer;
bool useReduxToken;
Path[] path;
}
struct MegaSwapSellData {
address fromToken;
uint256 fromAmount;
uint256 toAmount;
uint256 expectedAmount;
address payable beneficiary;
string referrer;
bool useReduxToken;
MegaSwapPath[] path;
}
struct BuyData {
address fromToken;
address toToken;
uint256 fromAmount;
uint256 toAmount;
address payable beneficiary;
string referrer;
bool useReduxToken;
BuyRoute[] route;
}
struct Route {
address payable exchange;
address targetExchange;
uint percent;
bytes payload;
uint256 networkFee;//Network fee is associated with 0xv3 trades
}
struct MegaSwapPath {
uint256 fromAmountPercent;
Path[] path;
}
struct Path {
address to;
uint256 totalNetworkFee;//Network fee is associated with 0xv3 trades
Route[] routes;
}
struct BuyRoute {
address payable exchange;
address targetExchange;
uint256 fromAmount;
uint256 toAmount;
bytes payload;
uint256 networkFee;//Network fee is associated with 0xv3 trades
}
function getPartnerRegistry() external view returns(address);
function getWhitelistAddress() external view returns(address);
function getFeeWallet() external view returns(address);
function getTokenTransferProxy() external view returns (address);
function getUniswapProxy() external view returns(address);
function getVersion() external view returns(string memory);
/**
* @dev The function which performs the multi path swap.
*/
function multiSwap(
SellData calldata data
)
external
payable
returns (uint256);
/**
* @dev The function which performs the single path buy.
*/
function buy(
BuyData calldata data
)
external
payable
returns (uint256);
function swapOnUniswap(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
uint8 referrer
)
external
payable;
function buyOnUniswap(
uint256 amountInMax,
uint256 amountOut,
address[] calldata path,
uint8 referrer
)
external
payable;
function buyOnUniswapFork(
address factory,
bytes32 initCode,
uint256 amountInMax,
uint256 amountOut,
address[] calldata path,
uint8 referrer
)
external
payable;
function swapOnUniswapFork(
address factory,
bytes32 initCode,
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
uint8 referrer
)
external
payable;
function simplBuy(
address fromToken,
address toToken,
uint256 fromAmount,
uint256 toAmount,
address[] memory callees,
bytes memory exchangeData,
uint256[] memory startIndexes,
uint256[] memory values,
address payable beneficiary,
string memory referrer,
bool useReduxToken
)
external
payable;
function simpleSwap(
address fromToken,
address toToken,
uint256 fromAmount,
uint256 toAmount,
uint256 expectedAmount,
address[] memory callees,
bytes memory exchangeData,
uint256[] memory startIndexes,
uint256[] memory values,
address payable beneficiary,
string memory referrer,
bool useReduxToken
)
external
payable
returns (uint256 receivedAmount);
/**
* @dev The function which performs the mega path swap.
* @param data Data required to perform swap.
*/
function megaSwap(
MegaSwapSellData memory data
)
external
payable
returns (uint256);
}
@jameshuntt
Copy link

is this the way to use paraswap in a smart contract

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment