feat: Implemented swap
This commit is contained in:
@@ -66,6 +66,7 @@ contract EtherfiAdapter is ISwapAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @inheritdoc ISwapAdapter
|
||||||
function swap(
|
function swap(
|
||||||
bytes32,
|
bytes32,
|
||||||
IERC20 sellToken,
|
IERC20 sellToken,
|
||||||
@@ -128,11 +129,17 @@ contract EtherfiAdapter is ISwapAdapter {
|
|||||||
limits[1] = limits[0];
|
limits[1] = limits[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCapabilities(bytes32 poolId, IERC20 sellToken, IERC20 buyToken)
|
/// @inheritdoc ISwapAdapter
|
||||||
|
function getCapabilities(bytes32, IERC20, IERC20)
|
||||||
external
|
external
|
||||||
|
pure
|
||||||
|
override
|
||||||
returns (Capability[] memory capabilities)
|
returns (Capability[] memory capabilities)
|
||||||
{
|
{
|
||||||
revert NotImplemented("TemplateSwapAdapter.getCapabilities");
|
capabilities = new Capability[](3);
|
||||||
|
capabilities[0] = Capability.SellOrder;
|
||||||
|
capabilities[1] = Capability.BuyOrder;
|
||||||
|
capabilities[2] = Capability.PriceFunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @inheritdoc ISwapAdapter
|
/// @inheritdoc ISwapAdapter
|
||||||
|
|||||||
37
evm/test/EtherfiAdapter.t.sol
Normal file
37
evm/test/EtherfiAdapter.t.sol
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
pragma solidity ^0.8.13;
|
||||||
|
|
||||||
|
import "forge-std/Test.sol";
|
||||||
|
import "openzeppelin-contracts/contracts/interfaces/IERC20.sol";
|
||||||
|
import "src/interfaces/ISwapAdapterTypes.sol";
|
||||||
|
import "src/libraries/FractionMath.sol";
|
||||||
|
import "src/etherfi/EtherfiAdapter.sol";
|
||||||
|
|
||||||
|
contract EtherfiAdapterTest is Test, ISwapAdapterTypes {
|
||||||
|
EtherfiAdapter adapter;
|
||||||
|
IWeEth wEeth = IWeEth(0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee);
|
||||||
|
IeEth eEth;
|
||||||
|
|
||||||
|
function setUp() public {
|
||||||
|
uint256 forkBlock = 19218495;
|
||||||
|
vm.createSelectFork(vm.rpcUrl("mainnet"), forkBlock);
|
||||||
|
adapter = new EtherfiAdapter(address(wEeth));
|
||||||
|
eEth = wEeth.eETH();
|
||||||
|
|
||||||
|
vm.label(address(wEeth), "WeETH");
|
||||||
|
vm.label(address(eEth), "eETH");
|
||||||
|
}
|
||||||
|
|
||||||
|
receive() external payable {}
|
||||||
|
|
||||||
|
function testMe() public {
|
||||||
|
// // uint256 requiredETH = adapter.getETHRequiredToMintEeth(1 ether);
|
||||||
|
// deal(address(adapter), 100 ether);
|
||||||
|
// // adapter.swapEthForEeth(1 ether, OrderSide.Buy);
|
||||||
|
// IERC20(address(eEth)).approve(address(adapter), type(uint256).max);
|
||||||
|
|
||||||
|
// console.log(IERC20(address(eEth)).balanceOf(address(this)));
|
||||||
|
// console.log(adapter.swapEthForWeEth(1 ether, OrderSide.Buy));
|
||||||
|
// console.log(IERC20(address(eEth)).balanceOf(address(this)));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user