Smart Contracts
Allowance should be given to TokenTransferProxy contract and not to AugustusSwapper

AugustusSwapper

It's the contract router responsible for making swaps
Swap through Augustus workflow

TokenTransferProxy

It's the Spender contract responsible for moving ERC20 tokens (and equivalent on side chains). To get the address, you can call getTokenTransferProxy() on Augustus.
1
pragma solidity 0.7.5;
2
โ€‹
3
โ€‹
4
interface ITokenTransferProxy {
5
โ€‹
6
function transferFrom(
7
address token,
8
address from,
9
address to,
10
uint256 amount
11
)
12
external;
13
โ€‹
14
function freeReduxTokens(address user, uint256 tokensToFree) external;
15
}
Copied!

AugustusSwapper

1
pragma solidity 0.7.5;
2
pragma experimental ABIEncoderV2;
3
โ€‹
4
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
5
โ€‹
6
interface IAugustusSwapper {
7
โ€‹
8
/**
9
* @param fromToken Address of the source token
10
* @param fromAmount Amount of source tokens to be swapped
11
* @param toAmount Minimum destination token amount expected out of this swap
12
* @param expectedAmount Expected amount of destination tokens without slippage
13
* @param beneficiary Beneficiary address
14
* 0 then 100% will be transferred to beneficiary. Pass 10000 for 100%
15
* @param referrer referral id
16
* @param useReduxToken whether to use redux token or not
17
* @param path Route to be taken for this swap to take place
18
โ€‹
19
*/
20
struct SellData {
21
address fromToken;
22
uint256 fromAmount;
23
uint256 toAmount;
24
uint256 expectedAmount;
25
address payable beneficiary;
26
string referrer;
27
bool useReduxToken;
28
Path[] path;
29
โ€‹
30
}
31
โ€‹
32
struct MegaSwapSellData {
33
address fromToken;
34
uint256 fromAmount;
35
uint256 toAmount;
36
uint256 expectedAmount;
37
address payable beneficiary;
38
string referrer;
39
bool useReduxToken;
40
MegaSwapPath[] path;
41
}
42
โ€‹
43
struct BuyData {
44
address fromToken;
45
address toToken;
46
uint256 fromAmount;
47
uint256 toAmount;
48
address payable beneficiary;
49
string referrer;
50
bool useReduxToken;
51
BuyRoute[] route;
52
}
53
โ€‹
54
struct Route {
55
address payable exchange;
56
address targetExchange;
57
uint percent;
58
bytes payload;
59
uint256 networkFee;//Network fee is associated with 0xv3 trades
60
}
61
โ€‹
62
struct MegaSwapPath {
63
uint256 fromAmountPercent;
64
Path[] path;
65
}
66
โ€‹
67
struct Path {
68
address to;
69
uint256 totalNetworkFee;//Network fee is associated with 0xv3 trades
70
Route[] routes;
71
}
72
โ€‹
73
struct BuyRoute {
74
address payable exchange;
75
address targetExchange;
76
uint256 fromAmount;
77
uint256 toAmount;
78
bytes payload;
79
uint256 networkFee;//Network fee is associated with 0xv3 trades
80
}
81
โ€‹
82
function getPartnerRegistry() external view returns(address);
83
โ€‹
84
function getWhitelistAddress() external view returns(address);
85
โ€‹
86
function getFeeWallet() external view returns(address);
87
โ€‹
88
function getTokenTransferProxy() external view returns (address);
89
โ€‹
90
function getUniswapProxy() external view returns(address);
91
โ€‹
92
function getVersion() external view returns(string memory);
93
โ€‹
94
/**
95
* @dev The function which performs the multi path swap.
96
*/
97
function multiSwap(
98
SellData calldata data
99
)
100
external
101
payable
102
returns (uint256);
103
โ€‹
104
/**
105
* @dev The function which performs the single path buy.
106
*/
107
function buy(
108
BuyData calldata data
109
)
110
external
111
payable
112
returns (uint256);
113
โ€‹
114
function swapOnUniswap(
115
uint256 amountIn,
116
uint256 amountOutMin,
117
address[] calldata path,
118
uint8 referrer
119
)
120
external
121
payable;
122
โ€‹
123
function buyOnUniswap(
124
uint256 amountInMax,
125
uint256 amountOut,
126
address[] calldata path,
127
uint8 referrer
128
)
129
external
130
payable;
131
โ€‹
132
function buyOnUniswapFork(
133
address factory,
134
bytes32 initCode,
135
uint256 amountInMax,
136
uint256 amountOut,
137
address[] calldata path,
138
uint8 referrer
139
)
140
external
141
payable;
142
โ€‹
143
function swapOnUniswapFork(
144
address factory,
145
bytes32 initCode,
146
uint256 amountIn,
147
uint256 amountOutMin,
148
address[] calldata path,
149
uint8 referrer
150
)
151
external
152
payable;
153
โ€‹
154
โ€‹
155
function simplBuy(
156
address fromToken,
157
address toToken,
158
uint256 fromAmount,
159
uint256 toAmount,
160
address[] memory callees,
161
bytes memory exchangeData,
162
uint256[] memory startIndexes,
163
uint256[] memory values,
164
address payable beneficiary,
165
string memory referrer,
166
bool useReduxToken
167
)
168
external
169
payable;
170
โ€‹
171
function simpleSwap(
172
address fromToken,
173
address toToken,
174
uint256 fromAmount,
175
uint256 toAmount,
176
uint256 expectedAmount,
177
address[] memory callees,
178
bytes memory exchangeData,
179
uint256[] memory startIndexes,
180
uint256[] memory values,
181
address payable beneficiary,
182
string memory referrer,
183
bool useReduxToken
184
)
185
external
186
payable
187
returns (uint256 receivedAmount);
188
โ€‹
189
/**
190
* @dev The function which performs the mega path swap.
191
* @param data Data required to perform swap.
192
*/
193
function megaSwap(
194
MegaSwapSellData memory data
195
)
196
external
197
payable
198
returns (uint256);
199
}
Copied!

REDUX

REDUX is a new cutting-edge gas token, part of the new ParaSwap version: P4. It allows users to reduce their gas fees up to 50%. Read more hereโ€‹
1
pragma solidity 0.7.5;
2
โ€‹
3
interface IReduxToken {
4
โ€‹
5
function freeUpTo(uint256 value) external returns (uint256 freed);
6
โ€‹
7
function freeFromUpTo(address from, uint256 value) external returns (uint256 freed);
8
โ€‹
9
function mint(uint256 value) external;
10
}
Copied!
Last modified 4mo ago