pragma solidity =0.7.6; pragma abicoder v2;
import "https://github.com/Uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol";
interface IERC20 { function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
}
contract MultiSwap {
address public owner;
address public balance;
constructor() {
owner == msg.sender;
}
address public constant routerAddress =
0xE592427A0AEce92De3Edee1F18E0157C05861564;
ISwapRouter public immutable swapRouter = ISwapRouter(routerAddress);
address public constant SHUBYDAI = 0xe742A911ffFAEc86786bd2246Dd035F6Aa55aE2B;
address public constant SHUBYUSDC = 0xA61C9829209b75741bBB9f682483B3A4C3e4E924;
IERC20 public shubyToken = IERC20(SHUBYDAI);
function swapExactInputMultihop(uint amountIn)
external
returns (uint amountOut)
{
shubyToken.transfer(
address(this),
amountIn
);
shubyToken.approve(address(swapRouter), amountIn);
ISwapRouter.ExactInputParams memory params = ISwapRouter
.ExactInputParams({
path: abi.encodePacked(
SHUBYDAI,
uint24(3000),
SHUBYUSDC,
uint24(3000),
SHUBYDAI
),
recipient: msg.sender,
deadline: block.timestamp,
amountIn: amountIn,
amountOutMinimum: 0
});
amountOut = swapRouter.exactInput(params);
}
function transferIERC20(IERC20 token, address to, uint256 amount) public {
require(msg.sender == owner, "Only the owner can use this function");
uint256 erc20Balance = token.balanceOf(address(this));
require(amount <= erc20Balance, "balance is low");
token.transfer(to, amount);
}
function SeeBalance(IERC20 token) public view {
IERC20(token).balanceOf(address(this));
}
}
when i try to interact with this contract on remix and i try to run the seeBalance function it doesn't work, the message i get is.
[block: txIndex:]from: 0x241...8Be5fto: 0xFC4c5cE47f2E9361B28E8f6B486668dB61730A81 0xFC4...30A81value: 0 weidata: 0xbbb...5ae2blogs: 0hash:
decoded output -
i have transfered 4000 ShubyDAI which is the token i want to see the token for but i dont get a value.
Could someone help please.