feat(adapters): Add new bytes parameter to swap

that allows arbitrary data to be passed
This commit is contained in:
PierreMkt
2024-08-02 11:55:00 -04:00
parent 75e8bdf96f
commit 034d5ac8c2
13 changed files with 85 additions and 34 deletions

View File

@@ -56,7 +56,8 @@ contract AngleAdapter is ISwapAdapter {
address sellToken,
address buyToken,
OrderSide side,
uint256 specifiedAmount
uint256 specifiedAmount,
bytes32
) external returns (Trade memory trade) {
if (specifiedAmount == 0) {
return trade;
@@ -223,7 +224,7 @@ contract AngleAdapter is ISwapAdapter {
interface IAgToken is IERC20 {
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MINTER ROLE ONLY FUNCTIONS
MINTER ROLE ONLY FUNCTIONS
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/// @notice Lets a whitelisted contract mint agTokens
@@ -254,7 +255,7 @@ interface IAgToken is IERC20 {
function burnSelf(uint256 amount, address burner) external;
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TREASURY ONLY FUNCTIONS
TREASURY ONLY FUNCTIONS
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/// @notice Adds a minter in the contract
@@ -274,7 +275,7 @@ interface IAgToken is IERC20 {
function setTreasury(address _treasury) external;
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
EXTERNAL FUNCTIONS
EXTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/// @notice Checks whether an address has the right to mint agTokens

View File

@@ -118,7 +118,8 @@ contract BalancerV2SwapAdapter is ISwapAdapter {
address sellToken,
address buyToken,
OrderSide side,
uint256 specifiedAmount
uint256 specifiedAmount,
bytes32 data
) external override returns (Trade memory trade) {
uint256 sellAmount;
IVault.SwapKind kind;

View File

@@ -99,7 +99,8 @@ contract EtherfiAdapter is ISwapAdapter {
address sellToken,
address buyToken,
OrderSide side,
uint256 specifiedAmount
uint256 specifiedAmount,
bytes32
)
external
override

View File

@@ -59,7 +59,8 @@ contract IntegralSwapAdapter is ISwapAdapter {
address sellToken,
address buyToken,
OrderSide side,
uint256 specifiedAmount
uint256 specifiedAmount,
bytes32 data
) external override returns (Trade memory trade) {
if (specifiedAmount == 0) {
return trade;

View File

@@ -54,6 +54,7 @@ interface ISwapAdapter is ISwapAdapterTypes {
* @param buyToken The token being bought.
* @param side The side of the trade (Sell or Buy).
* @param specifiedAmount The amount to be traded.
* @param data Additional arbitrary data for the swap.
* @return trade Trade struct representing the executed trade.
*/
function swap(
@@ -61,7 +62,8 @@ interface ISwapAdapter is ISwapAdapterTypes {
address sellToken,
address buyToken,
OrderSide side,
uint256 specifiedAmount
uint256 specifiedAmount,
bytes32 data
) external returns (Trade memory trade);
/// @notice Retrieves the limits for each token.

View File

@@ -22,7 +22,8 @@ contract TemplateSwapAdapter is ISwapAdapter {
address sellToken,
address buyToken,
OrderSide side,
uint256 specifiedAmount
uint256 specifiedAmount,
bytes32
) external returns (Trade memory trade) {
revert NotImplemented("TemplateSwapAdapter.swap");
}

View File

@@ -69,7 +69,8 @@ contract UniswapV2SwapAdapter is ISwapAdapter {
address sellToken,
address buyToken,
OrderSide side,
uint256 specifiedAmount
uint256 specifiedAmount,
bytes32
) external override returns (Trade memory trade) {
if (specifiedAmount == 0) {
return trade;