文件 1 的 14:Address.sol
pragma solidity ^0.8.1;
library Address {
function isContract(address account) internal view returns (bool) {
return account.code.length > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
文件 2 的 14:Context.sol
pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
文件 3 的 14:IBurnHandler.sol
pragma solidity ^0.8.8;
interface IBurnHandler {
function burn(uint256 _amountOutMin) external;
function rescue(address _token) external;
function tokenWhitelist(address _addr) external view returns (bool);
}
文件 4 的 14:IERC20.sol
pragma solidity ^0.8.0;
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}
文件 5 的 14:IERC20Metadata.sol
pragma solidity ^0.8.0;
import "../IERC20.sol";
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
文件 6 的 14:IUniswapV2Factory.sol
pragma solidity >=0.5.0;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
文件 7 的 14:IUniswapV2Router01.sol
pragma solidity >=0.6.2;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
文件 8 的 14:IUniswapV2Router02.sol
pragma solidity >=0.6.2;
import './IUniswapV2Router01.sol';
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
文件 9 的 14:IWETH.sol
pragma solidity ^0.8.8;
interface IWETH {
function deposit() external payable;
function withdraw(uint256) external;
}
文件 10 的 14:Ownable.sol
pragma solidity ^0.8.0;
import "../utils/Context.sol";
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
modifier onlyOwner() {
_checkOwner();
_;
}
function owner() public view virtual returns (address) {
return _owner;
}
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
文件 11 的 14:SafeERC20.sol
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
文件 12 的 14:SwapToBurnBase.sol
pragma solidity ^0.8.8;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./interfaces/IWETH.sol";
import "./interfaces/IBurnHandler.sol";
abstract contract SwapToBurnBase is Ownable {
using SafeERC20 for IERC20;
address internal constant nullAddress = 0x000000000000000000000000000000000000dEaD;
address internal immutable WETH;
address public immutable burnHandlerAddress;
uint256 public immutable burnFee;
uint256 public immutable teamFee;
address public teamWalletAddress;
modifier validate(address[] memory path) {
require(path.length >= 2, "INVALID_PATH");
_;
}
constructor(
uint256 _burnFee,
uint256 _teamFee,
address _burnHandler,
address _teamWallet
) {
WETH = UNISWAP_V2_ROUTER().WETH();
burnFee = _burnFee;
teamFee = _teamFee;
burnHandlerAddress = _burnHandler;
teamWalletAddress = _teamWallet;
}
function LUFFY() public pure virtual returns (address);
function UNISWAP_V2_ROUTER() internal pure virtual returns (IUniswapV2Router02);
function UNISWAP_FACTORY() internal pure virtual returns (IUniswapV2Factory);
function burn(uint256 _burnAmount, address[] memory _path) internal {
address tokenIn = _path[0];
if (tokenIn == LUFFY()) {
IERC20(tokenIn).safeTransfer(nullAddress, _burnAmount);
} else {
if (tokenIn == WETH) {
_safeTransfer(burnHandlerAddress, _burnAmount);
} else {
address[] memory wethPath = _getWETHPath(_path);
if (wethPath.length >= 2) {
UNISWAP_V2_ROUTER().swapExactTokensForETHSupportingFeeOnTransferTokens(
_burnAmount,
0,
wethPath,
burnHandlerAddress,
block.timestamp
);
} else {
IERC20(tokenIn).safeTransfer(burnHandlerAddress, _burnAmount);
}
}
}
}
function swapTokenForToken(
uint256 _amountIn,
uint256 _amountOutMin,
address[] memory _path
) public validate(_path) {
address tokenIn = _path[0];
IERC20(tokenIn).safeTransferFrom(msg.sender, address(this), _amountIn);
uint256 _realAmountIn = IERC20(tokenIn).balanceOf(address(this));
_approve(tokenIn, _realAmountIn);
uint256 burnAmount = (_realAmountIn * burnFee) / 10000;
uint256 teamAmount = (_realAmountIn * teamFee) / 10000;
uint256 totalFee = burnAmount + teamAmount;
uint256 amountInSub = _realAmountIn - totalFee;
UNISWAP_V2_ROUTER().swapExactTokensForTokensSupportingFeeOnTransferTokens(
amountInSub,
_amountOutMin,
_path,
msg.sender,
block.timestamp
);
burn(burnAmount, _path);
IERC20(tokenIn).safeTransfer(teamWalletAddress, teamAmount);
}
function swapTokenForExactToken(
uint256 _amountOut,
uint256 _amountInMax,
address[] memory _path
) public validate(_path) {
address tokenIn = _path[0];
IERC20(tokenIn).safeTransferFrom(msg.sender, address(this), _amountInMax);
uint256 adjustedAmountIn = IERC20(tokenIn).balanceOf(address(this));
_approve(tokenIn, adjustedAmountIn);
uint256 adjustedBurnFee = (adjustedAmountIn * burnFee) / 10000;
uint256 adjustedTeamFee = (adjustedAmountIn * teamFee) / 10000;
uint256 totalFee = adjustedBurnFee + adjustedTeamFee;
uint256 amountInSub = adjustedAmountIn - totalFee;
uint256[] memory amounts = UNISWAP_V2_ROUTER().swapTokensForExactTokens(
_amountOut,
amountInSub,
_path,
msg.sender,
block.timestamp
);
uint256 realAmountIn = amounts[0];
uint256 burnAmount = (realAmountIn * burnFee) / 10000;
uint256 teamAmount = (realAmountIn * teamFee) / 10000;
uint256 totalConsume = realAmountIn + burnAmount + teamAmount;
uint256 refundAmount = adjustedAmountIn - totalConsume;
if (refundAmount > 0) {
IERC20(tokenIn).safeTransfer(msg.sender, refundAmount);
}
burn(burnAmount, _path);
IERC20(tokenIn).safeTransfer(teamWalletAddress, teamAmount);
}
function swapTokenForETH(
uint256 _amountIn,
uint256 _amountOutMin,
address[] memory _path
) public validate(_path) {
address tokenIn = _path[0];
IERC20(tokenIn).safeTransferFrom(msg.sender, address(this), _amountIn);
uint256 adjustedAmountIn = IERC20(tokenIn).balanceOf(address(this));
if (tokenIn == WETH) {
IWETH(WETH).withdraw(adjustedAmountIn);
_safeTransfer(msg.sender, adjustedAmountIn);
} else {
_approve(tokenIn, adjustedAmountIn);
uint256 burnAmount = (adjustedAmountIn * burnFee) / 10000;
uint256 teamAmount = (adjustedAmountIn * teamFee) / 10000;
uint256 totalFee = burnAmount + teamAmount;
uint256 amountInSub = adjustedAmountIn - totalFee;
UNISWAP_V2_ROUTER().swapExactTokensForETHSupportingFeeOnTransferTokens(
amountInSub,
_amountOutMin,
_path,
msg.sender,
block.timestamp
);
burn(burnAmount, _path);
IERC20(tokenIn).safeTransfer(teamWalletAddress, teamAmount);
}
}
function swapTokenForExactETH(
uint256 _amountOut,
uint256 _amountInMax,
address[] memory _path
) public validate(_path) {
address tokenIn = _path[0];
IERC20(tokenIn).safeTransferFrom(msg.sender, address(this), _amountInMax);
uint256 adjustedAmountIn = IERC20(tokenIn).balanceOf(address(this));
if (tokenIn == WETH) {
IWETH(WETH).withdraw(adjustedAmountIn);
_safeTransfer(msg.sender, adjustedAmountIn);
} else {
_approve(tokenIn, adjustedAmountIn);
uint256 adjustedBurnFee = (adjustedAmountIn * burnFee) / 10000;
uint256 adjustedTeamFee = (adjustedAmountIn * teamFee) / 10000;
uint256 totalFee = adjustedBurnFee + adjustedTeamFee;
uint256 amountInSub = adjustedAmountIn - totalFee;
uint256[] memory amounts = UNISWAP_V2_ROUTER().swapTokensForExactETH(
_amountOut,
amountInSub,
_path,
msg.sender,
block.timestamp
);
uint256 realAmountIn = amounts[0];
uint256 burnAmount = (realAmountIn * burnFee) / 10000;
uint256 teamAmount = (realAmountIn * teamFee) / 10000;
uint256 totalConsume = realAmountIn + burnAmount + teamAmount;
uint256 refundAmount = adjustedAmountIn - totalConsume;
if (refundAmount > 0) {
IERC20(tokenIn).safeTransfer(msg.sender, refundAmount);
}
burn(burnAmount, _path);
IERC20(tokenIn).safeTransfer(teamWalletAddress, teamAmount);
}
}
function swapETHForToken(uint256 _amountOutMin, address[] memory _path)
public
payable
validate(_path)
{
address tokenOut = _path[_path.length - 1];
uint256 amountIn = msg.value;
if (tokenOut == WETH) {
IWETH(WETH).deposit{value: amountIn}();
IERC20(WETH).safeTransfer(msg.sender, amountIn);
} else {
uint256 burnAmount = (amountIn * burnFee) / 10000;
uint256 teamAmount = (amountIn * teamFee) / 10000;
uint256 totalFee = burnAmount + teamAmount;
uint256 amountInSub = amountIn - totalFee;
UNISWAP_V2_ROUTER().swapExactETHForTokensSupportingFeeOnTransferTokens{
value: amountInSub
}(_amountOutMin, _path, msg.sender, block.timestamp);
burn(burnAmount, _path);
_safeTransfer(teamWalletAddress, teamAmount);
}
}
function swapETHForExactToken(uint256 _amountOut, address[] memory _path)
public
payable
validate(_path)
{
address tokenOut = _path[_path.length - 1];
uint256 amountIn = msg.value;
if (tokenOut == WETH) {
IWETH(WETH).deposit{value: amountIn}();
IERC20(WETH).safeTransfer(msg.sender, amountIn);
} else {
uint256 burnAmount = (amountIn * burnFee) / 10000;
uint256 teamAmount = (amountIn * teamFee) / 10000;
uint256 totalFee = burnAmount + teamAmount;
uint256 amountInSub = amountIn - totalFee;
uint256[] memory amounts = UNISWAP_V2_ROUTER().swapETHForExactTokens{
value: amountInSub
}(_amountOut, _path, msg.sender, block.timestamp);
uint256 refund = amountInSub - amounts[0];
if (refund > 0) {
_safeTransfer(msg.sender, refund);
}
burn(burnAmount, _path);
_safeTransfer(teamWalletAddress, teamAmount);
}
}
function getPair(address _tokenIn, address _tokenOut) external view returns (address) {
return UNISWAP_FACTORY().getPair(_tokenIn, _tokenOut);
}
function getAmountIn(uint256 _amountOut, address[] memory _path) public view returns (uint256) {
uint256[] memory amountsIn = UNISWAP_V2_ROUTER().getAmountsIn(_amountOut, _path);
uint256 amountInWithoutFee = amountsIn[0];
uint256 burnAmount = (amountInWithoutFee * burnFee) / 10000;
uint256 teamAmount = (amountInWithoutFee * teamFee) / 10000;
uint256 totalFee = burnAmount + teamAmount;
uint256 amountInWithFee = amountInWithoutFee + totalFee;
return amountInWithFee;
}
function getAmountOut(uint256 _amountIn, address[] memory _path)
public
view
returns (uint256)
{
uint256 burnAmount = (_amountIn * burnFee) / 10000;
uint256 teamAmount = (_amountIn * teamFee) / 10000;
uint256 totalFee = burnAmount + teamAmount;
uint256 amountInSub = _amountIn - totalFee;
uint256[] memory amountOutMins = UNISWAP_V2_ROUTER().getAmountsOut(amountInSub, _path);
return amountOutMins[amountOutMins.length - 1];
}
function _getWETHPath(address[] memory _path)
internal
view
returns (address[] memory wethPath)
{
uint256 index = 0;
for (uint256 i = 0; i < _path.length; i++) {
if (_path[i] == WETH) {
index = i + 1;
break;
}
}
wethPath = new address[](index);
for (uint256 i = 0; i < index; i++) {
wethPath[i] = _path[i];
}
}
function _safeTransfer(address _to, uint256 _amount) internal {
(bool sent, ) = _to.call{value: _amount}("");
require(sent, "Failed to send Ether");
}
function getTokenDecimals(address _addr) public view returns (uint8) {
return IERC20Metadata(_addr).decimals();
}
function setTeamWallet(address payable _teamWallet) public onlyOwner {
require(_teamWallet != address(0), "invalid team wallet");
teamWalletAddress = _teamWallet;
}
function _approve(address token, uint256 amount) internal {
(bool success, ) = token.call(
abi.encodeWithSignature("approve(address,uint256)", address(UNISWAP_V2_ROUTER()), 0)
);
require(success, "Approval to zero failed");
(success, ) = token.call(
abi.encodeWithSignature(
"approve(address,uint256)",
address(UNISWAP_V2_ROUTER()),
amount
)
);
require(success, "Approval failed");
}
receive() external payable {}
}
文件 13 的 14:SwapToBurnEthereum.sol
pragma solidity ^0.8.8;
import "./SwapToBurnBase.sol";
contract SwapToBurnEthereum is SwapToBurnBase {
constructor(
uint256 _burnFee,
uint256 _teamFee,
address _burnHandler,
address _teamWallet
) SwapToBurnBase(_burnFee, _teamFee, _burnHandler, _teamWallet) {}
function LUFFY() public pure override returns (address) {
return 0x7121D00b4fA18F13Da6c2e30d19C04844E6AfDC8;
}
function UNISWAP_V2_ROUTER() internal pure override returns (IUniswapV2Router02) {
return IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
}
function UNISWAP_FACTORY() internal pure override returns (IUniswapV2Factory) {
return IUniswapV2Factory(0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f);
}
}
文件 14 的 14:draft-IERC20Permit.sol
pragma solidity ^0.8.0;
interface IERC20Permit {
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
function nonces(address owner) external view returns (uint256);
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
{
"compilationTarget": {
"contracts/SwapToBurnEthereum.sol": "SwapToBurnEthereum"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"uint256","name":"_burnFee","type":"uint256"},{"internalType":"uint256","name":"_teamFee","type":"uint256"},{"internalType":"address","name":"_burnHandler","type":"address"},{"internalType":"address","name":"_teamWallet","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"LUFFY","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"burnFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"burnHandlerAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountOut","type":"uint256"},{"internalType":"address[]","name":"_path","type":"address[]"}],"name":"getAmountIn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"address[]","name":"_path","type":"address[]"}],"name":"getAmountOut","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenIn","type":"address"},{"internalType":"address","name":"_tokenOut","type":"address"}],"name":"getPair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_addr","type":"address"}],"name":"getTokenDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_teamWallet","type":"address"}],"name":"setTeamWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountOut","type":"uint256"},{"internalType":"address[]","name":"_path","type":"address[]"}],"name":"swapETHForExactToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountOutMin","type":"uint256"},{"internalType":"address[]","name":"_path","type":"address[]"}],"name":"swapETHForToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint256","name":"_amountOutMin","type":"uint256"},{"internalType":"address[]","name":"_path","type":"address[]"}],"name":"swapTokenForETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountOut","type":"uint256"},{"internalType":"uint256","name":"_amountInMax","type":"uint256"},{"internalType":"address[]","name":"_path","type":"address[]"}],"name":"swapTokenForExactETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountOut","type":"uint256"},{"internalType":"uint256","name":"_amountInMax","type":"uint256"},{"internalType":"address[]","name":"_path","type":"address[]"}],"name":"swapTokenForExactToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint256","name":"_amountOutMin","type":"uint256"},{"internalType":"address[]","name":"_path","type":"address[]"}],"name":"swapTokenForToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"teamFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"teamWalletAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]