Allowance should be given to TokenTransferProxy contract and not to AugustusSwapper, FUNDS MAY BE LOST OTHERWISE!
AugustusSwapper
The contract router is responsible for making swaps.
Mainnet :
Arbitrum:
Avalanche:
Base:
BSC:
Fantom:
Optimism:
Polygon:
Polygon zkEVM:
TokenTransferProxy
The Spender contract is responsible for moving ERC20 tokens (and equivalents on side chains). To get the address, you can call getTokenTransferProxy() on Augustus.
pragma solidity 0.7.5;
interface ITokenTransferProxy {
function transferFrom(
address token,
address from,
address to,
uint256 amount
)
external;
}
Augustus Registry
Use AugustusRegistry to verify AugustusSwapper addresses.
interface IAugustusRegistry {
function isAugustusBanned(address augustus) external view returns (bool);
function isValidAugustus(address augustus) external view returns (bool);
function getAugustusCount() external view returns (uint256);
function getLatestVersion() external view returns (string memory);
function getLatestAugustus() external view returns (address);
function getAugustusByVersion(string calldata version) external view returns (address);
}
AugustusSwapper (implements IParaswap through fallback method)
ABI (merged AugustusSwapper and IParaswap ABIs)
IAugustusSwapper
interface IAugustusSwapper {
struct FeeStructure {
uint256 partnerShare;
bool noPositiveSlippage;
bool positiveSlippageToUser;
uint16 feePercent;
string partnerId;
bytes data;
}
function DEFAULT_ADMIN_ROLE ( ) external view returns ( bytes32 );
function ROUTER_ROLE ( ) external view returns ( bytes32 );
function WHITELISTED_ROLE ( ) external view returns ( bytes32 );
function getAdapterData ( bytes32 key ) external view returns ( bytes );
function getFeeWallet ( ) external view returns ( address );
function getImplementation ( bytes4 selector ) external view returns ( address );
function getPartnerFeeStructure ( address partner ) external view returns ( FeeStructure memory );
function getRoleAdmin ( bytes32 role ) external view returns ( bytes32 );
function getRoleMember ( bytes32 role, uint256 index ) external view returns ( address );
function getRoleMemberCount ( bytes32 role ) external view returns ( uint256 );
function getRouterData ( bytes32 key ) external view returns ( bytes );
function getTokenTransferProxy ( ) external view returns ( address );
function getVersion ( ) external pure returns ( string );
function grantRole ( bytes32 role, address account ) external;
function hasRole ( bytes32 role, address account ) external view returns ( bool );
function initializeAdapter ( address adapter, bytes data ) external;
function initializeRouter ( address router, bytes data ) external;
function isAdapterInitialized ( bytes32 key ) external view returns ( bool );
function isRouterInitialized ( bytes32 key ) external view returns ( bool );
function registerPartner ( address partner, uint256 _partnerShare, bool _noPositiveSlippage, bool _positiveSlippageToUser, uint16 _feePercent, string partnerId, bytes _data ) external;
function renounceRole ( bytes32 role, address account ) external;
function revokeRole ( bytes32 role, address account ) external;
function setFeeWallet ( address _feeWallet ) external;
function setImplementation ( bytes4 selector, address implementation ) external;
function transferTokens ( address token, address destination, uint256 amount ) external;
}
pragma solidity 0.7.5;
library Utils {
/**
* @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 path Route to be taken for this swap to take place
*/
struct SellData {
address fromToken;
uint256 fromAmount;
uint256 toAmount;
uint256 expectedAmount;
address payable beneficiary;
Utils.Path[] path;
address payable partner;
uint256 feePercent;
bytes permit;
uint256 deadline;
bytes16 uuid;
}
struct MegaSwapSellData {
address fromToken;
uint256 fromAmount;
uint256 toAmount;
uint256 expectedAmount;
address payable beneficiary;
Utils.MegaSwapPath[] path;
address payable partner;
uint256 feePercent;
bytes permit;
uint256 deadline;
bytes16 uuid;
}
struct SimpleData {
address fromToken;
address toToken;
uint256 fromAmount;
uint256 toAmount;
uint256 expectedAmount;
address[] callees;
bytes exchangeData;
uint256[] startIndexes;
uint256[] values;
address payable beneficiary;
address payable partner;
uint256 feePercent;
bytes permit;
uint256 deadline;
bytes16 uuid;
}
struct Adapter {
address payable adapter;
uint256 percent;
uint256 networkFee;
Route[] route;
}
struct Route {
uint256 index;//Adapter at which index needs to be used
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
Adapter[] adapters;
}
}
Fee Claimer
pragma solidity 0.7.5;
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface IFeeClaimer {
/**
* @notice register partner's, affiliate's and PP's fee
* @dev only callable by AugustusSwapper contract
* @param _account account address used to withdraw fees
* @param _token token address
* @param _fee fee amount in token
*/
function registerFee(
address _account,
IERC20 _token,
uint256 _fee
) external;
/**
* @notice claim partner share fee in ERC20 token
* @dev transfers ERC20 token balance to the caller's account
* the call will fail if withdrawer have zero balance in the contract
* @param _token address of the ERC20 token
* @param _recipient address
* @return true if the withdraw was successfull
*/
function withdrawAllERC20(IERC20 _token, address _recipient) external returns (bool);
/**
* @notice batch claim whole balance of fee share amount
* @dev transfers ERC20 token balance to the caller's account
* the call will fail if withdrawer have zero balance in the contract
* @param _tokens list of addresses of the ERC20 token
* @param _recipient address of recipient
* @return true if the withdraw was successfull
*/
function batchWithdrawAllERC20(IERC20[] calldata _tokens, address _recipient) external returns (bool);
/**
* @notice claim some partner share fee in ERC20 token
* @dev transfers ERC20 token amount to the caller's account
* the call will fail if withdrawer have zero balance in the contract
* @param _token address of the ERC20 token
* @param _recipient address
* @return true if the withdraw was successfull
*/
function withdrawSomeERC20(
IERC20 _token,
uint256 _tokenAmount,
address _recipient
) external returns (bool);
/**
* @notice batch claim some amount of fee share in ERC20 token
* @dev transfers ERC20 token balance to the caller's account
* the call will fail if withdrawer have zero balance in the contract
* @param _tokens address of the ERC20 tokens
* @param _tokenAmounts array of amounts
* @param _recipient destination account addresses
* @return true if the withdraw was successfull
*/
function batchWithdrawSomeERC20(
IERC20[] calldata _tokens,
uint256[] calldata _tokenAmounts,
address _recipient
) external returns (bool);
/**
* @notice compute unallocated fee in token
* @param _token address of the ERC20 token
* @return amount of unallocated token in fees
*/
function getUnallocatedFees(IERC20 _token) external view returns (uint256);
/**
* @notice returns unclaimed fee amount given the token
* @dev retrieves the balance of ERC20 token fee amount for a partner
* @param _token address of the ERC20 token
* @param _partner account address of the partner
* @return amount of balance
*/
function getBalance(IERC20 _token, address _partner) external view returns (uint256);
/**
* @notice returns unclaimed fee amount given the token in batch
* @dev retrieves the balance of ERC20 token fee amount for a partner in batch
* @param _tokens list of ERC20 token addresses
* @param _partner account address of the partner
* @return _fees array of the token amount
*/
function batchGetBalance(IERC20[] calldata _tokens, address _partner)
external
view
returns (uint256[] memory _fees);
}
Mainnet:
Arbitrum:
Avalanche:
Base:
BSC:
Optimism:
Polygon:
Polygon zkEVM:
Mainnet:
Arbitrum:
Avalanche:
Base:
BSC:
Fantom:
Optimism:
Polygon:
Polygon zkEVM:
(Generated from AugustusSwapper ABI using then edited to add FeeStructure)