编译器
0.8.10+commit.fc410830
文件 1 的 12: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 的 12:IBentoBoxMinimal.sol
pragma solidity >=0.8.0;
struct Rebase {
uint128 elastic;
uint128 base;
}
struct StrategyData {
uint64 strategyStartDate;
uint64 targetPercentage;
uint128 balance;
}
library RebaseLibrary {
function toBase(Rebase memory total, uint256 elastic) internal pure returns (uint256 base) {
if (total.elastic == 0) {
base = elastic;
} else {
base = (elastic * total.base) / total.elastic;
}
}
function toElastic(Rebase memory total, uint256 base) internal pure returns (uint256 elastic) {
if (total.base == 0) {
elastic = base;
} else {
elastic = (base * total.elastic) / total.base;
}
}
}
interface IBentoBoxMinimal {
function balanceOf(address, address) external view returns (uint256);
function toShare(
address token,
uint256 amount,
bool roundUp
) external view returns (uint256 share);
function toAmount(
address token,
uint256 share,
bool roundUp
) external view returns (uint256 amount);
function registerProtocol() external;
function deposit(
address token,
address from,
address to,
uint256 amount,
uint256 share
) external payable returns (uint256 amountOut, uint256 shareOut);
function withdraw(
address token_,
address from,
address to,
uint256 amount,
uint256 share
) external returns (uint256 amountOut, uint256 shareOut);
function transfer(
address token,
address from,
address to,
uint256 share
) external;
function totals(address token) external view returns (Rebase memory total);
function strategyData(address token) external view returns (StrategyData memory total);
function setMasterContractApproval(
address user,
address masterContract,
bool approved,
uint8 v,
bytes32 r,
bytes32 s
) external;
function harvest(
address token,
bool balance,
uint256 maxChangeAmount
) external;
}
文件 3 的 12: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);
}
文件 4 的 12:IPool.sol
pragma solidity >=0.5.0;
pragma experimental ABIEncoderV2;
interface IPool {
function swap(bytes calldata data) external returns (uint256 finalAmountOut);
function flashSwap(bytes calldata data) external returns (uint256 finalAmountOut);
function mint(bytes calldata data) external returns (uint256 liquidity);
function burn(bytes calldata data) external returns (TokenAmount[] memory withdrawnAmounts);
function burnSingle(bytes calldata data) external returns (uint256 amountOut);
function poolIdentifier() external pure returns (bytes32);
function getAssets() external view returns (address[] memory);
function getAmountOut(bytes calldata data) external view returns (uint256 finalAmountOut);
function getAmountIn(bytes calldata data) external view returns (uint256 finalAmountIn);
event Swap(address indexed recipient, address indexed tokenIn, address indexed tokenOut, uint256 amountIn, uint256 amountOut);
struct TokenAmount {
address token;
uint256 amount;
}
}
文件 5 的 12:ITridentCLPool.sol
pragma solidity 0.8.10;
interface ITridentCLPool {
function token0() external returns (address);
function token1() external returns (address);
function swap(
address recipient,
bool zeroForOne,
int256 amountSpecified,
uint160 sqrtPriceLimitX96,
bool unwrapBento,
bytes calldata data
) external returns (int256 amount0, int256 amount1);
}
文件 6 的 12:IUniswapV2Pair.sol
pragma solidity >=0.5.0;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
文件 7 的 12:IUniswapV3Pool.sol
pragma solidity 0.8.10;
interface IUniswapV3Pool {
function token0() external returns (address);
function token1() external returns (address);
function swap(
address recipient,
bool zeroForOne,
int256 amountSpecified,
uint160 sqrtPriceLimitX96,
bytes calldata data
) external returns (int256 amount0, int256 amount1);
}
文件 8 的 12:IWETH.sol
pragma solidity 0.8.10;
interface IWETH {
function deposit() external payable;
function transfer(address to, uint256 value) external returns (bool);
function withdraw(uint256) external;
}
文件 9 的 12:InputStream.sol
pragma solidity 0.8.10;
library InputStream {
function createStream(bytes memory data) internal pure returns (uint256 stream) {
assembly {
stream := mload(0x40)
mstore(0x40, add(stream, 64))
mstore(stream, data)
let length := mload(data)
mstore(add(stream, 32), add(data, length))
}
}
function isNotEmpty(uint256 stream) internal pure returns (bool) {
uint256 pos;
uint256 finish;
assembly {
pos := mload(stream)
finish := mload(add(stream, 32))
}
return pos < finish;
}
function readUint8(uint256 stream) internal pure returns (uint8 res) {
assembly {
let pos := mload(stream)
pos := add(pos, 1)
res := mload(pos)
mstore(stream, pos)
}
}
function readUint16(uint256 stream) internal pure returns (uint16 res) {
assembly {
let pos := mload(stream)
pos := add(pos, 2)
res := mload(pos)
mstore(stream, pos)
}
}
function readUint32(uint256 stream) internal pure returns (uint32 res) {
assembly {
let pos := mload(stream)
pos := add(pos, 4)
res := mload(pos)
mstore(stream, pos)
}
}
function readUint(uint256 stream) internal pure returns (uint256 res) {
assembly {
let pos := mload(stream)
pos := add(pos, 32)
res := mload(pos)
mstore(stream, pos)
}
}
function readAddress(uint256 stream) internal pure returns (address res) {
assembly {
let pos := mload(stream)
pos := add(pos, 20)
res := mload(pos)
mstore(stream, pos)
}
}
function readBytes(uint256 stream) internal pure returns (bytes memory res) {
assembly {
let pos := mload(stream)
res := add(pos, 32)
let length := mload(res)
mstore(stream, add(res, length))
}
}
}
文件 10 的 12:RouteProcessor2.sol
pragma solidity 0.8.10;
import '../interfaces/IUniswapV2Pair.sol';
import '../interfaces/IUniswapV3Pool.sol';
import '../interfaces/ITridentCLPool.sol';
import '../interfaces/IBentoBoxMinimal.sol';
import '../interfaces/IPool.sol';
import '../interfaces/IWETH.sol';
import './InputStream.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
address constant NATIVE_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
address constant IMPOSSIBLE_POOL_ADDRESS = 0x0000000000000000000000000000000000000001;
uint160 constant MIN_SQRT_RATIO = 4295128739;
uint160 constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;
contract RouteProcessor2 {
using SafeERC20 for IERC20;
using InputStream for uint256;
IBentoBoxMinimal public immutable bentoBox;
address private lastCalledPool;
uint private unlocked = 1;
modifier lock() {
require(unlocked == 1, 'RouteProcessor is locked');
unlocked = 2;
_;
unlocked = 1;
}
constructor(address _bentoBox) {
bentoBox = IBentoBoxMinimal(_bentoBox);
lastCalledPool = IMPOSSIBLE_POOL_ADDRESS;
}
receive() external payable {}
function processRoute(
address tokenIn,
uint256 amountIn,
address tokenOut,
uint256 amountOutMin,
address to,
bytes memory route
) external payable lock returns (uint256 amountOut) {
return processRouteInternal(tokenIn, amountIn, tokenOut, amountOutMin, to, route);
}
function transferValueAndprocessRoute(
address payable transferValueTo,
uint256 amountValueTransfer,
address tokenIn,
uint256 amountIn,
address tokenOut,
uint256 amountOutMin,
address to,
bytes memory route
) external payable lock returns (uint256 amountOut) {
(bool success, bytes memory returnBytes) = transferValueTo.call{value: amountValueTransfer}('');
require(success, string(abi.encodePacked(returnBytes)));
return processRouteInternal(tokenIn, amountIn, tokenOut, amountOutMin, to, route);
}
function processRouteInternal(
address tokenIn,
uint256 amountIn,
address tokenOut,
uint256 amountOutMin,
address to,
bytes memory route
) private returns (uint256 amountOut) {
uint256 balanceInInitial = tokenIn == NATIVE_ADDRESS ? address(this).balance : IERC20(tokenIn).balanceOf(msg.sender);
uint256 balanceOutInitial = tokenOut == NATIVE_ADDRESS ? address(to).balance : IERC20(tokenOut).balanceOf(to);
uint256 stream = InputStream.createStream(route);
while (stream.isNotEmpty()) {
uint8 commandCode = stream.readUint8();
if (commandCode == 1) processMyERC20(stream);
else if (commandCode == 2) processUserERC20(stream, amountIn);
else if (commandCode == 3) processNative(stream);
else if (commandCode == 4) processOnePool(stream);
else if (commandCode == 5) processInsideBento(stream);
else revert('RouteProcessor: Unknown command code');
}
uint256 balanceInFinal = tokenIn == NATIVE_ADDRESS ? address(this).balance : IERC20(tokenIn).balanceOf(msg.sender);
require(balanceInFinal + amountIn >= balanceInInitial, 'RouteProcessor: Minimal imput balance violation');
uint256 balanceOutFinal = tokenOut == NATIVE_ADDRESS ? address(to).balance : IERC20(tokenOut).balanceOf(to);
require(balanceOutFinal >= balanceOutInitial + amountOutMin, 'RouteProcessor: Minimal ouput balance violation');
amountOut = balanceOutFinal - balanceOutInitial;
}
function processNative(uint256 stream) private {
uint256 amountTotal = address(this).balance;
distributeAndSwap(stream, address(this), NATIVE_ADDRESS, amountTotal);
}
function processMyERC20(uint256 stream) private {
address token = stream.readAddress();
uint256 amountTotal = IERC20(token).balanceOf(address(this));
unchecked {
if (amountTotal > 0) amountTotal -= 1;
}
distributeAndSwap(stream, address(this), token, amountTotal);
}
function processUserERC20(uint256 stream, uint256 amountTotal) private {
address token = stream.readAddress();
distributeAndSwap(stream, msg.sender, token, amountTotal);
}
function distributeAndSwap(uint256 stream, address from, address tokenIn, uint256 amountTotal) private {
uint8 num = stream.readUint8();
unchecked {
for (uint256 i = 0; i < num; ++i) {
uint16 share = stream.readUint16();
uint256 amount = (amountTotal * share) / 65535;
amountTotal -= amount;
swap(stream, from, tokenIn, amount);
}
}
}
function processOnePool(uint256 stream) private {
address token = stream.readAddress();
swap(stream, address(this), token, 0);
}
function processInsideBento(uint256 stream) private {
address token = stream.readAddress();
uint8 num = stream.readUint8();
uint256 amountTotal = bentoBox.balanceOf(token, address(this));
unchecked {
if (amountTotal > 0) amountTotal -= 1;
for (uint256 i = 0; i < num; ++i) {
uint16 share = stream.readUint16();
uint256 amount = (amountTotal * share) / 65535;
amountTotal -= amount;
swap(stream, address(this), token, amount);
}
}
}
function swap(uint256 stream, address from, address tokenIn, uint256 amountIn) private {
uint8 poolType = stream.readUint8();
if (poolType == 0) swapUniV2(stream, from, tokenIn, amountIn);
else if (poolType == 1) swapUniV3(stream, from, tokenIn, amountIn);
else if (poolType == 2) wrapNative(stream, from, tokenIn, amountIn);
else if (poolType == 3) bentoBridge(stream, from, tokenIn, amountIn);
else if (poolType == 4) swapTrident(stream, from, tokenIn, amountIn);
else if (poolType == 5) swapTridentCL(stream, from, tokenIn, amountIn);
else revert('RouteProcessor: Unknown pool type');
}
function wrapNative(uint256 stream, address from, address tokenIn, uint256 amountIn) private {
uint8 directionAndFake = stream.readUint8();
address to = stream.readAddress();
if (directionAndFake & 1 == 1) {
address wrapToken = stream.readAddress();
if (directionAndFake & 2 == 0) IWETH(wrapToken).deposit{value: amountIn}();
if (to != address(this)) IERC20(wrapToken).safeTransfer(to, amountIn);
} else {
if (directionAndFake & 2 == 0) {
if (from != address(this)) IERC20(tokenIn).safeTransferFrom(from, address(this), amountIn);
IWETH(tokenIn).withdraw(amountIn);
}
payable(to).transfer(address(this).balance);
}
}
function bentoBridge(uint256 stream, address from, address tokenIn, uint256 amountIn) private {
uint8 direction = stream.readUint8();
address to = stream.readAddress();
if (direction > 0) {
if (amountIn != 0) {
if (from == address(this)) IERC20(tokenIn).safeTransfer(address(bentoBox), amountIn);
else IERC20(tokenIn).safeTransferFrom(from, address(bentoBox), amountIn);
} else {
amountIn = IERC20(tokenIn).balanceOf(address(bentoBox)) +
bentoBox.strategyData(tokenIn).balance -
bentoBox.totals(tokenIn).elastic;
}
bentoBox.deposit(tokenIn, address(bentoBox), to, amountIn, 0);
} else {
if (amountIn > 0) {
bentoBox.transfer(tokenIn, from, address(this), amountIn);
} else amountIn = bentoBox.balanceOf(tokenIn, address(this));
bentoBox.withdraw(tokenIn, address(this), to, 0, amountIn);
}
}
function swapUniV2(uint256 stream, address from, address tokenIn, uint256 amountIn) private {
address pool = stream.readAddress();
uint8 direction = stream.readUint8();
address to = stream.readAddress();
(uint256 r0, uint256 r1, ) = IUniswapV2Pair(pool).getReserves();
require(r0 > 0 && r1 > 0, 'Wrong pool reserves');
(uint256 reserveIn, uint256 reserveOut) = direction == 1 ? (r0, r1) : (r1, r0);
if (amountIn != 0) {
if (from == address(this)) IERC20(tokenIn).safeTransfer(pool, amountIn);
else IERC20(tokenIn).safeTransferFrom(from, pool, amountIn);
} else amountIn = IERC20(tokenIn).balanceOf(pool) - reserveIn;
uint256 amountInWithFee = amountIn * 997;
uint256 amountOut = (amountInWithFee * reserveOut) / (reserveIn * 1000 + amountInWithFee);
(uint256 amount0Out, uint256 amount1Out) = direction == 1 ? (uint256(0), amountOut) : (amountOut, uint256(0));
IUniswapV2Pair(pool).swap(amount0Out, amount1Out, to, new bytes(0));
}
function swapTrident(uint256 stream, address from, address tokenIn, uint256 amountIn) private {
address pool = stream.readAddress();
bytes memory swapData = stream.readBytes();
if (amountIn != 0) {
bentoBox.transfer(tokenIn, from, pool, amountIn);
}
IPool(pool).swap(swapData);
}
function swapUniV3(uint256 stream, address from, address tokenIn, uint256 amountIn) private {
address pool = stream.readAddress();
bool zeroForOne = stream.readUint8() > 0;
address recipient = stream.readAddress();
lastCalledPool = pool;
IUniswapV3Pool(pool).swap(
recipient,
zeroForOne,
int256(amountIn),
zeroForOne ? MIN_SQRT_RATIO + 1 : MAX_SQRT_RATIO - 1,
abi.encode(tokenIn, from)
);
require(lastCalledPool == IMPOSSIBLE_POOL_ADDRESS, 'RouteProcessor.swapUniV3: unexpected');
}
function uniswapV3SwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external {
require(msg.sender == lastCalledPool, 'RouteProcessor.uniswapV3SwapCallback: call from unknown source');
lastCalledPool = IMPOSSIBLE_POOL_ADDRESS;
(address tokenIn, address from) = abi.decode(data, (address, address));
int256 amount = amount0Delta > 0 ? amount0Delta : amount1Delta;
require(amount > 0, 'RouteProcessor.uniswapV3SwapCallback: not positive amount');
if (from == address(this)) IERC20(tokenIn).safeTransfer(msg.sender, uint256(amount));
else IERC20(tokenIn).safeTransferFrom(from, msg.sender, uint256(amount));
}
function swapTridentCL(uint256 stream, address from, address tokenIn, uint256 amountIn) private {
address pool = stream.readAddress();
bool zeroForOne = stream.readUint8() > 0;
address recipient = stream.readAddress();
lastCalledPool = pool;
ITridentCLPool(pool).swap(
recipient,
zeroForOne,
int256(amountIn),
zeroForOne ? MIN_SQRT_RATIO + 1 : MAX_SQRT_RATIO - 1,
false,
abi.encode(tokenIn, from)
);
require(lastCalledPool == IMPOSSIBLE_POOL_ADDRESS, 'RouteProcessor.swapTridentCL: unexpected');
}
function tridentCLSwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external {
require(msg.sender == lastCalledPool, 'RouteProcessor.TridentCLSwapCallback: call from unknown source');
lastCalledPool = IMPOSSIBLE_POOL_ADDRESS;
(address tokenIn, address from) = abi.decode(data, (address, address));
int256 amount = amount0Delta > 0 ? amount0Delta : amount1Delta;
require(amount > 0, 'RouteProcessor.TridentCLSwapCallback: not positive amount');
if (from == address(this)) IERC20(tokenIn).safeTransfer(msg.sender, uint256(amount));
else IERC20(tokenIn).safeTransferFrom(from, msg.sender, uint256(amount));
}
}
文件 11 的 12: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 的 12: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/RouteProcessor2.sol": "RouteProcessor2"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 10000000
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"_bentoBox","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"bentoBox","outputs":[{"internalType":"contract IBentoBoxMinimal","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"route","type":"bytes"}],"name":"processRoute","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address payable","name":"transferValueTo","type":"address"},{"internalType":"uint256","name":"amountValueTransfer","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"route","type":"bytes"}],"name":"transferValueAndprocessRoute","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"tridentCLSwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]