You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Question: is it possible to perform an additional swap at the moment the 'transfer' function of a solidity contract is triggered?
Network: Ethereum
Uniswap Pair: V2
Case:
I have a smartcontract with an erc20 token and user swaps (w)eth for erc20, this triggers the 'transfer' function on the smartcontract. In the smartcontract 'transfer' function, i want to trigger an additional swap call where the smartcontract sells some of its erc20 to (w)eth. Using a modifier and conditions statements to prevent the initial call to infinite loop.
I have read some documentation on multicalls, but can't seem to find if this will work for uniswap v2 pairs
Question: is it possible to perform an additional swap at the moment the 'transfer' function of a solidity contract is triggered?
Network: Ethereum
Uniswap Pair: V2
Case:
I have a smartcontract with an erc20 token and user swaps (w)eth for erc20, this triggers the 'transfer' function on the smartcontract. In the smartcontract 'transfer' function, i want to trigger an additional swap call where the smartcontract sells some of its erc20 to (w)eth. Using a modifier and conditions statements to prevent the initial call to infinite loop.
I have read some documentation on multicalls, but can't seem to find if this will work for uniswap v2 pairs
Solidity:
`// SPDX-License-Identifier: Unlicensed
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol";
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
pragma solidity ^0.8.16;
contract SOL is ERC20, ERC20Burnable, Ownable {
using Address for address;
}`
The text was updated successfully, but these errors were encountered: